mbox series

[v6,0/3] HID: mcp2221: iio support and device resource management

Message ID 20221001005208.8010-1-matt.ranostay@konsulko.com
Headers show
Series HID: mcp2221: iio support and device resource management | expand

Message

Matt Ranostay Oct. 1, 2022, 12:52 a.m. UTC
This patchset is primarily to enable iio support for the MCP2221 HID driver,
but requires several Kconfig changes and device resource management.

First attempt of this patchset is referenced here:

Link: https://lore.kernel.org/all/20220729154723.99947-1-matt.ranostay@xxxxxxxxxxxx/

Changes from v1:
* Fixing various Kconfig recursive dependencies that appear with 'imply IIO'
* Switch hid-mcp2221 driver to device managed resources for i2c support
* Reworking patchset per advice on lore.kernel.org link above

Changes from v2:
* add linux-iio list to CC

Changes from v3:
* replace .remove() tasks with devm_add_action_or_reset() in .probe()
* reschedule SRAM configuration read on failures
* add IIO_CHAN_INFO_SCALE values for ADC + DAC based on reference voltage

Changes from v4:
* add .remove function with no operation to avoid hid_hw_stop() being called
  twice due to new devm functions
* add retries limit to five for reading SRAM configuration data
* update 'io: adc: stx104: fix future recursive dependencies' to new Kconfig
  location for STX104 driver on linux-next pending-fixes branch

Changes from v5:
* dropped all Kconfig changes not related to mcp2221 driver
* changed 'select GPIOLIB' to imply for mcp2221 along with IS_REACHABLE check

Matt Ranostay (3):
  HID: mcp2221: switch i2c registration to devm functions
  HID: mcp2221: change 'select GPIOLIB' to imply
  HID: mcp2221: add ADC/DAC support via iio subsystem

 drivers/hid/Kconfig       |   3 +-
 drivers/hid/hid-mcp2221.c | 310 ++++++++++++++++++++++++++++++++++----
 2 files changed, 286 insertions(+), 27 deletions(-)

Comments

Jonathan Cameron Oct. 2, 2022, 1:50 p.m. UTC | #1
On Fri, 30 Sep 2022 17:52:08 -0700
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> Add support for 3x 10-bit ADC and 1x DAC channels registered via the iio
> subsystem.
> 
> To prevent breakage and unexpected dependencies this support only is
> only built if CONFIG_IIO is enabled, and is only weakly referenced by
> 'imply IIO' within the respective Kconfig.
> 
> Additionally the iio device only gets registered if at least one channel
> is enabled in the power-on configuration read from SRAM.
> 
> Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>

I'm never particularly keen on drivers from elsewhere in the tree gaining
IIO support - but that's just because it can make a bit of a mess of
changes to the IIO subsystem itself.  Having said that, this code looks fine to me.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jiri Kosina Oct. 18, 2022, 1 p.m. UTC | #2
On Sun, 2 Oct 2022, Jonathan Cameron wrote:

> > Add support for 3x 10-bit ADC and 1x DAC channels registered via the 
> > iio subsystem.
> > 
> > To prevent breakage and unexpected dependencies this support only is
> > only built if CONFIG_IIO is enabled, and is only weakly referenced by
> > 'imply IIO' within the respective Kconfig.
> > 
> > Additionally the iio device only gets registered if at least one channel
> > is enabled in the power-on configuration read from SRAM.
> > 
> > Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
> 
> I'm never particularly keen on drivers from elsewhere in the tree gaining
> IIO support - but that's just because it can make a bit of a mess of
> changes to the IIO subsystem itself.  Having said that, this code looks fine to me.
> 
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Thanks. Applied for 6.2.