Merge tag 'iio-fixes-for-4.12a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes: First set of IIO fixes in the 4.12 cycle. Matt finally set up the lightning storm he needed to test the as3935. * core - Fix a null pointer deference in iio_trigger_write_current when changing from a non existent trigger to another non existent trigger. * a3935 - Recalibrate the RCO after resume. - Fix interrupt mask so that we actually get some interrupts. - Use iio_trigger_poll_chained as we aren't in interrupt context. * am335x - Fix wrong allocation size provided for private data to iio_device_alloc. * bcm_iproc - Swapped primary and secondary isr handlers. * ltr501 - Fix swapped als/ps register fields when enabling interrupts * max9611 - Wrong scale factor for the shunt_resistor attribute. * sun4-gpadc - Module autoloading fixes by adding the device table declarations. - Fix parent device being used in devm functions.
This commit is contained in:
@@ -143,7 +143,7 @@ static void iproc_adc_reg_dump(struct iio_dev *indio_dev)
|
||||
iproc_adc_dbg_reg(dev, adc_priv, IPROC_SOFT_BYPASS_DATA);
|
||||
}
|
||||
|
||||
static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data)
|
||||
static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data)
|
||||
{
|
||||
u32 channel_intr_status;
|
||||
u32 intr_status;
|
||||
@@ -167,7 +167,7 @@ static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data)
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data)
|
||||
static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data)
|
||||
{
|
||||
irqreturn_t retval = IRQ_NONE;
|
||||
struct iproc_adc_priv *adc_priv;
|
||||
@@ -181,7 +181,7 @@ static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data)
|
||||
adc_priv = iio_priv(indio_dev);
|
||||
|
||||
regmap_read(adc_priv->regmap, IPROC_INTERRUPT_STATUS, &intr_status);
|
||||
dev_dbg(&indio_dev->dev, "iproc_adc_interrupt_thread(),INTRPT_STS:%x\n",
|
||||
dev_dbg(&indio_dev->dev, "iproc_adc_interrupt_handler(),INTRPT_STS:%x\n",
|
||||
intr_status);
|
||||
|
||||
intr_channels = (intr_status & IPROC_ADC_INTR_MASK) >> IPROC_ADC_INTR;
|
||||
@@ -566,8 +566,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
ret = devm_request_threaded_irq(&pdev->dev, adc_priv->irqno,
|
||||
iproc_adc_interrupt_thread,
|
||||
iproc_adc_interrupt_handler,
|
||||
iproc_adc_interrupt_thread,
|
||||
IRQF_SHARED, "iproc-adc", indio_dev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "request_irq error %d\n", ret);
|
||||
|
@@ -438,10 +438,10 @@ static ssize_t max9611_shunt_resistor_show(struct device *dev,
|
||||
struct max9611_dev *max9611 = iio_priv(dev_to_iio_dev(dev));
|
||||
unsigned int i, r;
|
||||
|
||||
i = max9611->shunt_resistor_uohm / 1000;
|
||||
r = max9611->shunt_resistor_uohm % 1000;
|
||||
i = max9611->shunt_resistor_uohm / 1000000;
|
||||
r = max9611->shunt_resistor_uohm % 1000000;
|
||||
|
||||
return sprintf(buf, "%u.%03u\n", i, r);
|
||||
return sprintf(buf, "%u.%06u\n", i, r);
|
||||
}
|
||||
|
||||
static IIO_DEVICE_ATTR(in_power_shunt_resistor, 0444,
|
||||
@@ -536,8 +536,8 @@ static int max9611_probe(struct i2c_client *client,
|
||||
int ret;
|
||||
|
||||
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*max9611));
|
||||
if (IS_ERR(indio_dev))
|
||||
return PTR_ERR(indio_dev);
|
||||
if (!indio_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
|
||||
|
@@ -105,6 +105,8 @@ struct sun4i_gpadc_iio {
|
||||
bool no_irq;
|
||||
/* prevents concurrent reads of temperature and ADC */
|
||||
struct mutex mutex;
|
||||
struct thermal_zone_device *tzd;
|
||||
struct device *sensor_device;
|
||||
};
|
||||
|
||||
#define SUN4I_GPADC_ADC_CHANNEL(_channel, _name) { \
|
||||
@@ -502,7 +504,6 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
|
||||
{
|
||||
struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
|
||||
const struct of_device_id *of_dev;
|
||||
struct thermal_zone_device *tzd;
|
||||
struct resource *mem;
|
||||
void __iomem *base;
|
||||
int ret;
|
||||
@@ -532,13 +533,14 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
|
||||
if (!IS_ENABLED(CONFIG_THERMAL_OF))
|
||||
return 0;
|
||||
|
||||
tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, info,
|
||||
&sun4i_ts_tz_ops);
|
||||
if (IS_ERR(tzd))
|
||||
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(tzd));
|
||||
PTR_ERR(info->tzd));
|
||||
|
||||
return PTR_ERR_OR_ZERO(tzd);
|
||||
return PTR_ERR_OR_ZERO(info->tzd);
|
||||
}
|
||||
|
||||
static int sun4i_gpadc_probe_mfd(struct platform_device *pdev,
|
||||
@@ -584,15 +586,15 @@ static int sun4i_gpadc_probe_mfd(struct platform_device *pdev,
|
||||
* of_node, and the device from this driver as third argument to
|
||||
* return the temperature.
|
||||
*/
|
||||
struct thermal_zone_device *tzd;
|
||||
tzd = devm_thermal_zone_of_sensor_register(pdev->dev.parent, 0,
|
||||
info,
|
||||
&sun4i_ts_tz_ops);
|
||||
if (IS_ERR(tzd)) {
|
||||
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(tzd));
|
||||
return PTR_ERR(tzd);
|
||||
PTR_ERR(info->tzd));
|
||||
return PTR_ERR(info->tzd);
|
||||
}
|
||||
} else {
|
||||
indio_dev->num_channels =
|
||||
@@ -688,7 +690,13 @@ static int sun4i_gpadc_remove(struct platform_device *pdev)
|
||||
|
||||
pm_runtime_put(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
if (!info->no_irq && IS_ENABLED(CONFIG_THERMAL_OF))
|
||||
|
||||
if (!IS_ENABLED(CONFIG_THERMAL_OF))
|
||||
return 0;
|
||||
|
||||
thermal_zone_of_sensor_unregister(info->sensor_device, info->tzd);
|
||||
|
||||
if (!info->no_irq)
|
||||
iio_map_array_unregister(indio_dev);
|
||||
|
||||
return 0;
|
||||
@@ -700,6 +708,7 @@ static const struct platform_device_id sun4i_gpadc_id[] = {
|
||||
{ "sun6i-a31-gpadc-iio", (kernel_ulong_t)&sun6i_gpadc_data },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, sun4i_gpadc_id);
|
||||
|
||||
static struct platform_driver sun4i_gpadc_driver = {
|
||||
.driver = {
|
||||
@@ -711,6 +720,7 @@ static struct platform_driver sun4i_gpadc_driver = {
|
||||
.probe = sun4i_gpadc_probe,
|
||||
.remove = sun4i_gpadc_remove,
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun4i_gpadc_of_id);
|
||||
|
||||
module_platform_driver(sun4i_gpadc_driver);
|
||||
|
||||
|
@@ -614,7 +614,7 @@ static int tiadc_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*indio_dev));
|
||||
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc_dev));
|
||||
if (indio_dev == NULL) {
|
||||
dev_err(&pdev->dev, "failed to allocate iio device\n");
|
||||
return -ENOMEM;
|
||||
|
Reference in New Issue
Block a user