iio: adc: rzg2l_adc: Add fwnode_xlate() callback
Subsystems (2)
PATCH 1/1 iio: adc: rzg2l_adc: Add fwnode_xlate() callback
From: Biju Das <[email protected]>
On RZ/G3L ADC1, IIO channel indices don't map 1:1 to hardware channel numbers. Add a fwnode_xlate() callback that finds the registered channel whose number matches the specifier argument and returns its index.
--- drivers/iio/adc/rzg2l_adc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/iio/adc/rzg2l_adc.c +14 -0
@@ -286,9 +286,23 @@ static int rzg2l_adc_read_label(struct iio_dev *iio_dev,return sysfs_emit (label,"%s\n" , rzg2l_adc_channels[chan->channel].name); } +static int rzg2l_adc_fwnode_xlate (struct iio_dev *indio_dev, +const struct fwnode_reference_args *iiospec) +{ +if (iiospec->nargs !=1 ) +return -EINVAL ; + +for (unsigned int i =0 ; i < indio_dev->num_channels; i++) +if (indio_dev->channels[i].channel == iiospec->args[0 ]) +return i; + +return -EINVAL ; +} +static const struct iio_info rzg2l_adc_iio_info = { .read_raw = rzg2l_adc_read_raw, .read_label = rzg2l_adc_read_label, + .fwnode_xlate = rzg2l_adc_fwnode_xlate, };static irqreturn_t rzg2l_adc_isr (int irq,void *dev_id)
Signature · 1 line
2.43.0
Jonathan Cameron
maintainerQuoted 7 lines · On Thu, 26 Nov 2026 13:48:19 +0000 Biju Das <[email protected]> wrote:
From: Biju Das <[email protected]>
On RZ/G3L ADC1, IIO channel indices don't map 1:1 to hardware channel numbers. Add a
fwnode_xlate()callback that finds the registered channel whose number matches the specifier argument and returns its index.Signed-off-by Biju Das <[email protected]>
Sounds like a fix. So why no fixes tag? If it needs one then reply directly to this email with one and the tools will pick it up when I apply.
Thanks,
Jonathan
Quoted 32 lines
--- drivers/iio/adc/rzg2l_adc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/iio/adc/rzg2l_adc.c +14
-0@@ -286,9 +286,23 @@ static int rzg2l_adc_read_label(struct iio_dev *iio_dev,return sysfs_emit (label,"%s\n" , rzg2l_adc_channels[chan->channel].name); } +static int rzg2l_adc_fwnode_xlate (struct iio_dev *indio_dev, +const struct fwnode_reference_args *iiospec) +{ +if (iiospec->nargs !=1 ) +return -EINVAL ; + +for (unsigned int i =0 ; i < indio_dev->num_channels; i++) +if (indio_dev->channels[i].channel == iiospec->args[0 ]) +return i; + +return -EINVAL ; +} +static const struct iio_info rzg2l_adc_iio_info = { .read_raw = rzg2l_adc_read_raw, .read_label = rzg2l_adc_read_label, + .fwnode_xlate = rzg2l_adc_fwnode_xlate, };static irqreturn_t rzg2l_adc_isr (int irq,void *dev_id)
Hi Jonathan,
Quoted 6 lines · Jonathan Cameron
Quoted 2 lines · On Thu, 26 Nov 2026 13:48:19 +0000 Biju Das <[email protected]> wrote:
From: Biju Das <[email protected]>
Quoted 7 lines
Quoted 5 lines
On RZ/G3L ADC1, IIO channel indices don't map 1:1 to hardware channel numbers. Add a
fwnode_xlate()callback that finds the registered channel whose number matches the specifier argument and returns its index.Signed-off-by Biju Das <[email protected]>Sounds like a fix. So why no fixes tag? If it needs one then reply directly to this email with one and the tools will pick it up when I apply.
Yes, it is a fix. I missed that.
Cheers,
Biju
Quoted 38 lines
Thanks,
Jonathan
Quoted 32 lines
--- drivers/iio/adc/rzg2l_adc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/iio/adc/rzg2l_adc.c +14
-0@@ -286,9 +286,23 @@ static int rzg2l_adc_read_label(struct iio_dev *iio_dev,return sysfs_emit (label,"%s\n" , rzg2l_adc_channels[chan->channel].name); } +static int rzg2l_adc_fwnode_xlate (struct iio_dev *indio_dev, +const struct fwnode_reference_args *iiospec) +{ +if (iiospec->nargs !=1 ) +return -EINVAL ; + +for (unsigned int i =0 ; i < indio_dev->num_channels; i++) +if (indio_dev->channels[i].channel == iiospec->args[0 ]) +return i; + +return -EINVAL ; +} +static const struct iio_info rzg2l_adc_iio_info = { .read_raw = rzg2l_adc_read_raw, .read_label = rzg2l_adc_read_label, + .fwnode_xlate = rzg2l_adc_fwnode_xlate, };static irqreturn_t rzg2l_adc_isr (int irq,void *dev_id)
Quoted 13 lines · On Sat, 28 Nov 2026 08:37:01 +0000 Biju Das <[email protected]> wrote:
Hi Jonathan,
Quoted 10 lines · Jonathan Cameron
Quoted 6 lines · On Thu, 26 Nov 2026 13:48:19 +0000 Biju Das <[email protected]> wrote:
From: Biju Das <[email protected]>
On RZ/G3L ADC1, IIO channel indices don't map 1:1 to hardware channel numbers. Add a
fwnode_xlate()callback that finds the registered channel whose number matches the specifier argument and returns its index.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Biju Das <[email protected]>Sounds like a fix. So why no fixes tag? If it needs one then reply directly to this email with one and the tools will pick it up when I apply.
Yes, it is a fix. I missed that.
Fixes 39e16807997c ("iio: adc: rzg2l_adc: Add RZ/G3L ADC support for TSU")
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
Quoted 43 lines
Cheers,
BijuQuoted 38 lines
Thanks,
Jonathan
Quoted 32 lines
--- drivers/iio/adc/rzg2l_adc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/iio/adc/rzg2l_adc.c +14
-0@@ -286,9 +286,23 @@ static int rzg2l_adc_read_label(struct iio_dev *iio_dev,return sysfs_emit (label,"%s\n" , rzg2l_adc_channels[chan->channel].name); } +static int rzg2l_adc_fwnode_xlate (struct iio_dev *indio_dev, +const struct fwnode_reference_args *iiospec) +{ +if (iiospec->nargs !=1 ) +return -EINVAL ; + +for (unsigned int i =0 ; i < indio_dev->num_channels; i++) +if (indio_dev->channels[i].channel == iiospec->args[0 ]) +return i; + +return -EINVAL ; +} +static const struct iio_info rzg2l_adc_iio_info = { .read_raw = rzg2l_adc_read_raw, .read_label = rzg2l_adc_read_label, + .fwnode_xlate = rzg2l_adc_fwnode_xlate, };static irqreturn_t rzg2l_adc_isr (int irq,void *dev_id)