aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/iio/adc/ti_am335x_adc.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index b24402cb5432..2868c0c1b7e0 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -26,7 +26,6 @@
26#include <linux/of_device.h> 26#include <linux/of_device.h>
27 27
28#include <linux/mfd/ti_am335x_tscadc.h> 28#include <linux/mfd/ti_am335x_tscadc.h>
29#include <linux/platform_data/ti_am335x_adc.h>
30 29
31struct tiadc_device { 30struct tiadc_device {
32 struct ti_tscadc_dev *mfd_tscadc; 31 struct ti_tscadc_dev *mfd_tscadc;
@@ -153,14 +152,12 @@ static int tiadc_probe(struct platform_device *pdev)
153{ 152{
154 struct iio_dev *indio_dev; 153 struct iio_dev *indio_dev;
155 struct tiadc_device *adc_dev; 154 struct tiadc_device *adc_dev;
156 struct ti_tscadc_dev *tscadc_dev = ti_tscadc_dev_get(pdev);
157 struct mfd_tscadc_board *pdata = tscadc_dev->dev->platform_data;
158 struct device_node *node = pdev->dev.of_node; 155 struct device_node *node = pdev->dev.of_node;
159 int err; 156 int err;
160 u32 val32; 157 u32 val32;
161 158
162 if (!pdata && !node) { 159 if (!node) {
163 dev_err(&pdev->dev, "Could not find platform data\n"); 160 dev_err(&pdev->dev, "Could not find valid DT data.\n");
164 return -EINVAL; 161 return -EINVAL;
165 } 162 }
166 163
@@ -174,15 +171,11 @@ static int tiadc_probe(struct platform_device *pdev)
174 171
175 adc_dev->mfd_tscadc = ti_tscadc_dev_get(pdev); 172 adc_dev->mfd_tscadc = ti_tscadc_dev_get(pdev);
176 173
177 if (pdata) 174 err = of_property_read_u32(node,
178 adc_dev->channels = pdata->adc_init->adc_channels; 175 "ti,adc-channels", &val32);
179 else { 176 if (err < 0)
180 err = of_property_read_u32(node, 177 goto err_free_device;
181 "ti,adc-channels", &val32); 178 adc_dev->channels = val32;
182 if (err < 0)
183 goto err_free_device;
184 adc_dev->channels = val32;
185 }
186 179
187 indio_dev->dev.parent = &pdev->dev; 180 indio_dev->dev.parent = &pdev->dev;
188 indio_dev->name = dev_name(&pdev->dev); 181 indio_dev->name = dev_name(&pdev->dev);