mbox series

[00/34] make iio inkern interface firmware agnostic

Message ID 20220610084545.547700-1-nuno.sa@analog.com (mailing list archive)
Headers show
Series make iio inkern interface firmware agnostic | expand

Message

Nuno Sa June 10, 2022, 8:45 a.m. UTC
The main goal of this patchset is to convert the iio inkern interface to
be firmware agnostic. Some previous discussion was done in here [1].
Though something odd happened while sending the patches and the RFC
actually never landed in the IIO list (hopefully now works):

As suggested by Andy, the series can be seen in three blocks:

1) "Fix" all drivers that were relying on iio.h for specific header
files (mainly of.h and mod_devicetable.h). After that we can drop
of.h from iio.h and just forward declare what we need.

2) Move "most" of the IIO in kernel interface to FW API. At this point,
there's still some OF dependent API in place so that users are not broken.

3) Move all users of the IIO in kernel interface to the FW API and with
that, make IIO firmware agnostic.

On 3), the qcom-spmi-adc-tm5.c driver was only converted to use the IIO
API while on the IIO drivers a full driver conversion was done. The
thermal one would be really non trivial as we would also need to touch the
subsystem. On the IIO drivers, the conversions were mostly peacefull
(apparently). Special care for the stm32-adc.c driver though as that one
was far from being straight :).

Lastly, this is only compile tested with allyesconfig for arm and arm64.
While I surely can come up with some dummy devices to make sure I can still
properly get IIO channels, having proper tested-by tags on platforms
relying on this interface would be very appreciated (and I suspect Jonathan
will require it).

[1]: https://lore.kernel.org/linux-iio/20220604141925.129f0ffe@jic23-huawei/T/#mfd5ccd793841569182e4f831f2c46089b665c346

Nuno Sá (34):
  iio: adc: ad7606: explicitly add proper header files
  iio: adc: ad7606_par: explicitly add proper header files
  iio: adc: berlin2-adc: explicitly add proper header files
  iio: adc: imx7d_adc: explicitly add proper header files
  iio: adc: imx8qxp-adc: explicitly add proper header files
  iio: adc: ingenic-adc: explicitly add proper header files
  iio: adc: mp2629_adc: explicitly add proper header files
  iio: adc: mt6360-adc: explicitly add proper header files
  iio: adc: npcm_adc: explicitly add proper header files
  iio: adc: rzg2l_adc: explicitly add proper header files
  iio: common: cros_ec_lid_angle: explicitly add proper header files
  iio: common: cros_ec_sensors: explicitly add proper header files
  iio: dac: stm32-dac: explicitly add proper header files
  iio: dac: vf610_dac: explicitly add proper header files
  iio: humidity: hts221_buffer: explicitly add proper header files
  iio: light: cros_ec_light_prox: explicitly add proper header files
  iio: pressure: cros_ec_baro: explicitly add proper header files
  iio: trigger: stm32-lptimer-trigger: explicitly add proper header
    files
  iio: core: drop of.h from iio.h
  iio: inkern: only relase the device node when done with it
  iio: inkern: fix return value in devm_of_iio_channel_get_by_name()
  iio: inkern: only return error codes in iio_channel_get_*() APIs
  iio: inkern: split of_iio_channel_get_by_name()
  iio: inkern: move to fwnode properties
  thermal: qcom: qcom-spmi-adc-tm5: convert to IIO fwnode API
  iio: adc: ingenic-adc: convert to IIO fwnode interface
  iio: adc: ab8500-gpadc: convert to device properties
  iio: adc: at91-sama5d2_adc: convert to device properties
  iio: adc: qcom-pm8xxx-xoadc: convert to device properties
  iio: adc: qcom-spmi-vadc: convert to device properties
  iio: adc: qcom-spmi-adc5: convert to device properties
  iio: adc: stm32-adc: convert to device properties
  iio: inkern: remove OF dependencies
  iio: inkern: fix coding style warnings

 drivers/iio/adc/ab8500-gpadc.c                |  27 +-
 drivers/iio/adc/ad7606.c                      |   1 +
 drivers/iio/adc/ad7606_par.c                  |   1 +
 drivers/iio/adc/at91-sama5d2_adc.c            |  30 +--
 drivers/iio/adc/berlin2-adc.c                 |   2 +
 drivers/iio/adc/imx7d_adc.c                   |   1 +
 drivers/iio/adc/imx8qxp-adc.c                 |   1 +
 drivers/iio/adc/ingenic-adc.c                 |   9 +-
 drivers/iio/adc/mp2629_adc.c                  |   1 +
 drivers/iio/adc/mt6360-adc.c                  |   1 +
 drivers/iio/adc/npcm_adc.c                    |   1 +
 drivers/iio/adc/qcom-pm8xxx-xoadc.c           |  58 ++---
 drivers/iio/adc/qcom-spmi-adc5.c              |  63 +++--
 drivers/iio/adc/qcom-spmi-vadc.c              |  44 ++--
 drivers/iio/adc/rzg2l_adc.c                   |   1 +
 drivers/iio/adc/stm32-adc.c                   | 128 +++++-----
 .../cros_ec_sensors/cros_ec_lid_angle.c       |   1 +
 .../common/cros_ec_sensors/cros_ec_sensors.c  |   1 +
 drivers/iio/dac/stm32-dac.c                   |   2 +
 drivers/iio/dac/vf610_dac.c                   |   1 +
 drivers/iio/humidity/hts221_buffer.c          |   1 +
 drivers/iio/inkern.c                          | 241 +++++++++---------
 drivers/iio/light/cros_ec_light_prox.c        |   1 +
 drivers/iio/pressure/cros_ec_baro.c           |   1 +
 drivers/iio/trigger/stm32-lptimer-trigger.c   |   1 +
 drivers/thermal/qcom/qcom-spmi-adc-tm5.c      |   3 +-
 include/linux/iio/consumer.h                  |  28 +-
 include/linux/iio/iio.h                       |   9 +-
 28 files changed, 347 insertions(+), 312 deletions(-)

Comments

Andy Shevchenko June 10, 2022, 2:48 p.m. UTC | #1
On Fri, Jun 10, 2022 at 10:45 AM Nuno Sá <nuno.sa@analog.com> wrote:
>
> The main goal of this patchset is to convert the iio inkern interface to
> be firmware agnostic. Some previous discussion was done in here [1].
> Though something odd happened while sending the patches and the RFC
> actually never landed in the IIO list (hopefully now works):
>
> As suggested by Andy, the series can be seen in three blocks:
>
> 1) "Fix" all drivers that were relying on iio.h for specific header
> files (mainly of.h and mod_devicetable.h). After that we can drop
> of.h from iio.h and just forward declare what we need.
>
> 2) Move "most" of the IIO in kernel interface to FW API. At this point,
> there's still some OF dependent API in place so that users are not broken.
>
> 3) Move all users of the IIO in kernel interface to the FW API and with
> that, make IIO firmware agnostic.
>
> On 3), the qcom-spmi-adc-tm5.c driver was only converted to use the IIO
> API while on the IIO drivers a full driver conversion was done. The
> thermal one would be really non trivial as we would also need to touch the
> subsystem. On the IIO drivers, the conversions were mostly peacefull
> (apparently). Special care for the stm32-adc.c driver though as that one
> was far from being straight :).
>
> Lastly, this is only compile tested with allyesconfig for arm and arm64.
> While I surely can come up with some dummy devices to make sure I can still
> properly get IIO channels, having proper tested-by tags on platforms
> relying on this interface would be very appreciated (and I suspect Jonathan
> will require it).

For non-commented patches 1-19:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

You may add it for the commented patches in the 1-19 range in case you
are going to address my comments.

> [1]: https://lore.kernel.org/linux-iio/20220604141925.129f0ffe@jic23-huawei/T/#mfd5ccd793841569182e4f831f2c46089b665c346
>
> Nuno Sá (34):
>   iio: adc: ad7606: explicitly add proper header files
>   iio: adc: ad7606_par: explicitly add proper header files
>   iio: adc: berlin2-adc: explicitly add proper header files
>   iio: adc: imx7d_adc: explicitly add proper header files
>   iio: adc: imx8qxp-adc: explicitly add proper header files
>   iio: adc: ingenic-adc: explicitly add proper header files
>   iio: adc: mp2629_adc: explicitly add proper header files
>   iio: adc: mt6360-adc: explicitly add proper header files
>   iio: adc: npcm_adc: explicitly add proper header files
>   iio: adc: rzg2l_adc: explicitly add proper header files
>   iio: common: cros_ec_lid_angle: explicitly add proper header files
>   iio: common: cros_ec_sensors: explicitly add proper header files
>   iio: dac: stm32-dac: explicitly add proper header files
>   iio: dac: vf610_dac: explicitly add proper header files
>   iio: humidity: hts221_buffer: explicitly add proper header files
>   iio: light: cros_ec_light_prox: explicitly add proper header files
>   iio: pressure: cros_ec_baro: explicitly add proper header files
>   iio: trigger: stm32-lptimer-trigger: explicitly add proper header
>     files
>   iio: core: drop of.h from iio.h
>   iio: inkern: only relase the device node when done with it
>   iio: inkern: fix return value in devm_of_iio_channel_get_by_name()
>   iio: inkern: only return error codes in iio_channel_get_*() APIs
>   iio: inkern: split of_iio_channel_get_by_name()
>   iio: inkern: move to fwnode properties
>   thermal: qcom: qcom-spmi-adc-tm5: convert to IIO fwnode API
>   iio: adc: ingenic-adc: convert to IIO fwnode interface
>   iio: adc: ab8500-gpadc: convert to device properties
>   iio: adc: at91-sama5d2_adc: convert to device properties
>   iio: adc: qcom-pm8xxx-xoadc: convert to device properties
>   iio: adc: qcom-spmi-vadc: convert to device properties
>   iio: adc: qcom-spmi-adc5: convert to device properties
>   iio: adc: stm32-adc: convert to device properties
>   iio: inkern: remove OF dependencies
>   iio: inkern: fix coding style warnings
>
>  drivers/iio/adc/ab8500-gpadc.c                |  27 +-
>  drivers/iio/adc/ad7606.c                      |   1 +
>  drivers/iio/adc/ad7606_par.c                  |   1 +
>  drivers/iio/adc/at91-sama5d2_adc.c            |  30 +--
>  drivers/iio/adc/berlin2-adc.c                 |   2 +
>  drivers/iio/adc/imx7d_adc.c                   |   1 +
>  drivers/iio/adc/imx8qxp-adc.c                 |   1 +
>  drivers/iio/adc/ingenic-adc.c                 |   9 +-
>  drivers/iio/adc/mp2629_adc.c                  |   1 +
>  drivers/iio/adc/mt6360-adc.c                  |   1 +
>  drivers/iio/adc/npcm_adc.c                    |   1 +
>  drivers/iio/adc/qcom-pm8xxx-xoadc.c           |  58 ++---
>  drivers/iio/adc/qcom-spmi-adc5.c              |  63 +++--
>  drivers/iio/adc/qcom-spmi-vadc.c              |  44 ++--
>  drivers/iio/adc/rzg2l_adc.c                   |   1 +
>  drivers/iio/adc/stm32-adc.c                   | 128 +++++-----
>  .../cros_ec_sensors/cros_ec_lid_angle.c       |   1 +
>  .../common/cros_ec_sensors/cros_ec_sensors.c  |   1 +
>  drivers/iio/dac/stm32-dac.c                   |   2 +
>  drivers/iio/dac/vf610_dac.c                   |   1 +
>  drivers/iio/humidity/hts221_buffer.c          |   1 +
>  drivers/iio/inkern.c                          | 241 +++++++++---------
>  drivers/iio/light/cros_ec_light_prox.c        |   1 +
>  drivers/iio/pressure/cros_ec_baro.c           |   1 +
>  drivers/iio/trigger/stm32-lptimer-trigger.c   |   1 +
>  drivers/thermal/qcom/qcom-spmi-adc-tm5.c      |   3 +-
>  include/linux/iio/consumer.h                  |  28 +-
>  include/linux/iio/iio.h                       |   9 +-
>  28 files changed, 347 insertions(+), 312 deletions(-)
>
> --
> 2.36.1
>
Andy Shevchenko June 10, 2022, 3:28 p.m. UTC | #2
On Fri, Jun 10, 2022 at 4:48 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Fri, Jun 10, 2022 at 10:45 AM Nuno Sá <nuno.sa@analog.com> wrote:

> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Ditto for patches 26-34.