On Thu, 19 Mar 2020 11:08:44 +0000 Jean-Baptiste Maneyrol <JManeyrol@xxxxxxxxxxxxxx> wrote: > Hello, > > iio debugfs register interface is quite handy because we can read a single register and write a value. > > regmap debugfs is only a dump of all registers, as far as I know (may have missed something). So this is something Mark has discussed before around regmap and more generally IIRC. The issue is that a write interface does make it somewhat easy to do really nasty things in some drivers that use regmap (to the extent of setting boards on fire etc). For IIO we are much safer - the worst you can do is break the IIO driver. I've never been that fussed myself about the debugfs interfaces as it's easy to hack them in when needed for actual debugging, but have taken the view that if someone has enough of a usecase to want to add them to a particular driver, then it's up to them. Jonathan > > Thanks. > JB > > From: Andy Shevchenko <andy.shevchenko@xxxxxxxxx> > > Sent: Thursday, March 19, 2020 11:24 > > To: Rohit Sarkar <rohitsarkar5398@xxxxxxxxx> > > Cc: linux-iio <linux-iio@xxxxxxxxxxxxxxx>; Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>; Jonathan Cameron <jic23@xxxxxxxxxx>; Hartmut Knaack <knaack.h@xxxxxx>; Lars-Peter Clausen <lars@xxxxxxxxxx>; Peter Meerwald-Stadler <pmeerw@xxxxxxxxxx>; > Jean-Baptiste Maneyrol <JManeyrol@xxxxxxxxxxxxxx>; Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>; Linus Walleij <linus.walleij@xxxxxxxxxx> > > Subject: Re: [PATCH] iio: imu: inv_mpu6050: add debugfs register r/w interface > > > > > CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe. > > > > On Thu, Mar 19, 2020 at 8:10 AM Rohit Sarkar <rohitsarkar5398@xxxxxxxxx> wrote: > > > > > > The iio debugfs interface provides direct access to read and write device > > > registers if debugfs is enabled. > > > > But regmap API provides at least reading facility. Isn't it enough? > > > > ... > > > > > static const struct iio_info mpu_info = { > > > .read_raw = &inv_mpu6050_read_raw, > > > .write_raw = &inv_mpu6050_write_raw, > > > .write_raw_get_fmt = &inv_write_raw_get_fmt, > > > .attrs = &inv_attribute_group, > > > .validate_trigger = inv_mpu6050_validate_trigger, > > > > > + .debugfs_reg_access = &inv_mpu6050_reg_access > > > > Leaving comma is helpful for future development. > > > > > }; > > > > >