|
@@ -528,17 +528,10 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
- if (!IS_ENABLED(CONFIG_THERMAL_OF))
|
|
|
- return 0;
|
|
|
+ if (IS_ENABLED(CONFIG_THERMAL_OF))
|
|
|
+ info->sensor_device = &pdev->dev;
|
|
|
|
|
|
- info->sensor_device = &pdev->dev;
|
|
|
- info->tzd = thermal_zone_of_sensor_register(info->sensor_device, 0,
|
|
|
- info, &sun4i_ts_tz_ops);
|
|
|
- if (IS_ERR(info->tzd))
|
|
|
- dev_err(&pdev->dev, "could not register thermal sensor: %ld\n",
|
|
|
- PTR_ERR(info->tzd));
|
|
|
-
|
|
|
- return PTR_ERR_OR_ZERO(info->tzd);
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
static int sun4i_gpadc_probe_mfd(struct platform_device *pdev,
|
|
@@ -585,15 +578,6 @@ static int sun4i_gpadc_probe_mfd(struct platform_device *pdev,
|
|
|
* return the temperature.
|
|
|
*/
|
|
|
info->sensor_device = pdev->dev.parent;
|
|
|
- info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
|
|
|
- 0, info,
|
|
|
- &sun4i_ts_tz_ops);
|
|
|
- if (IS_ERR(info->tzd)) {
|
|
|
- dev_err(&pdev->dev,
|
|
|
- "could not register thermal sensor: %ld\n",
|
|
|
- PTR_ERR(info->tzd));
|
|
|
- return PTR_ERR(info->tzd);
|
|
|
- }
|
|
|
} else {
|
|
|
indio_dev->num_channels =
|
|
|
ARRAY_SIZE(sun4i_gpadc_channels_no_temp);
|
|
@@ -663,6 +647,18 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
|
|
|
pm_runtime_set_suspended(&pdev->dev);
|
|
|
pm_runtime_enable(&pdev->dev);
|
|
|
|
|
|
+ if (IS_ENABLED(CONFIG_THERMAL_OF)) {
|
|
|
+ info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
|
|
|
+ 0, info,
|
|
|
+ &sun4i_ts_tz_ops);
|
|
|
+ if (IS_ERR(info->tzd)) {
|
|
|
+ dev_err(&pdev->dev,
|
|
|
+ "could not register thermal sensor: %ld\n",
|
|
|
+ PTR_ERR(info->tzd));
|
|
|
+ return PTR_ERR(info->tzd);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
ret = devm_iio_device_register(&pdev->dev, indio_dev);
|
|
|
if (ret < 0) {
|
|
|
dev_err(&pdev->dev, "could not register the device\n");
|