Message ID | 20241104231200.2745342-2-Frank.Li@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] iio: adc: vf610_adc: use devm_* and dev_err_probe() to simple code | expand |
> -----Original Message----- > From: Frank Li <frank.li@nxp.com> > Sent: 2024年11月5日 7:12 > To: Bough Chen <haibo.chen@nxp.com>; Jonathan Cameron > <jic23@kernel.org>; Lars-Peter Clausen <lars@metafoo.de>; open list:NXP i.MX > 7D/6SX/6UL/93 AND VF610 ADC DRIVER <linux-iio@vger.kernel.org>; open > list:NXP i.MX 7D/6SX/6UL/93 AND VF610 ADC DRIVER <imx@lists.linux.dev>; > open list <linux-kernel@vger.kernel.org> > Subject: [PATCH 2/2] iio: adc: vf610_adc: limit i.MX6SX's channel number to 4 > > i.MX6SX only has 4 ADC channels, so limit channel numbers to 4 for compatible > string 'fsl,imx6sx-adc'. Reviewed-by: Haibo Chen <haibo.chen@nxp.com> Best Regards Haibo Chen > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > --- > compatible string 'fsl,imx6sx-adc' already document in > Documentation/devicetree/bindings/iio/adc/fsl,vf610-adc.yaml > --- > drivers/iio/adc/vf610_adc.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index > 4e737b193c012..84573cdfce5da 100644 > --- a/drivers/iio/adc/vf610_adc.c > +++ b/drivers/iio/adc/vf610_adc.c > @@ -809,7 +809,8 @@ static const struct iio_info vf610_adc_iio_info = { }; > > static const struct of_device_id vf610_adc_match[] = { > - { .compatible = "fsl,vf610-adc", }, > + { .compatible = "fsl,imx6sx-adc", .data = (void *)4}, > + { .compatible = "fsl,vf610-adc", .data = (void > +*)ARRAY_SIZE(vf610_adc_iio_channels)}, > { /* sentinel */ } > }; > MODULE_DEVICE_TABLE(of, vf610_adc_match); @@ -870,7 +871,7 @@ > static int vf610_adc_probe(struct platform_device *pdev) > indio_dev->info = &vf610_adc_iio_info; > indio_dev->modes = INDIO_DIRECT_MODE; > indio_dev->channels = vf610_adc_iio_channels; > - indio_dev->num_channels = ARRAY_SIZE(vf610_adc_iio_channels); > + indio_dev->num_channels = (u32)device_get_match_data(dev); > > vf610_adc_cfg_init(info); > vf610_adc_hw_init(info); > -- > 2.34.1
diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index 4e737b193c012..84573cdfce5da 100644 --- a/drivers/iio/adc/vf610_adc.c +++ b/drivers/iio/adc/vf610_adc.c @@ -809,7 +809,8 @@ static const struct iio_info vf610_adc_iio_info = { }; static const struct of_device_id vf610_adc_match[] = { - { .compatible = "fsl,vf610-adc", }, + { .compatible = "fsl,imx6sx-adc", .data = (void *)4}, + { .compatible = "fsl,vf610-adc", .data = (void *)ARRAY_SIZE(vf610_adc_iio_channels)}, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, vf610_adc_match); @@ -870,7 +871,7 @@ static int vf610_adc_probe(struct platform_device *pdev) indio_dev->info = &vf610_adc_iio_info; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = vf610_adc_iio_channels; - indio_dev->num_channels = ARRAY_SIZE(vf610_adc_iio_channels); + indio_dev->num_channels = (u32)device_get_match_data(dev); vf610_adc_cfg_init(info); vf610_adc_hw_init(info);
i.MX6SX only has 4 ADC channels, so limit channel numbers to 4 for compatible string 'fsl,imx6sx-adc'. Signed-off-by: Frank Li <Frank.Li@nxp.com> --- compatible string 'fsl,imx6sx-adc' already document in Documentation/devicetree/bindings/iio/adc/fsl,vf610-adc.yaml --- drivers/iio/adc/vf610_adc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)