> Driver implementation for AMS/TAOS tsl2591 ambient light sensor.
please see comments below
>
> This driver supports configuration via device tree and sysfs.
> Supported channels for raw infrared light, raw visible light,
> raw combined light and combined lux value.
> The driver additionally s
struct iio_chan_spec const *chan, int val, int val2,
> > + long mask)
> > +{
> > + int ret;
> > + struct bma400_data *data = iio_priv(indio_dev);
> > +
> > + switch (mask) {
> > + case IIO_CHAN_INFO_SAMP_FREQ:
> > + /*
> > +* The sample frequency is readonly for the temperature
> > +* register and a fixed value in low-power mode.
> > +*/
> > + if (chan->type != IIO_ACCEL)
> > + return -EINVAL;
> > +
> > + mutex_lock(&data->mutex);
> > + ret = bma400_set_accel_output_data_rate(data, val, val2);
> > + mutex_unlock(&data->mutex);
> > + return ret;
> > + case IIO_CHAN_INFO_SCALE:
> > + if (val != 0)
> > + return -EINVAL;
> > +
> > + mutex_lock(&data->mutex);
> > + ret = bma400_set_accel_scale(data, val2);
> > + mutex_unlock(&data->mutex);
> > + return ret;
> > + case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
> > + mutex_lock(&data->mutex);
> > + ret = bma400_set_accel_oversampling_ratio(data, val);
> > + mutex_unlock(&data->mutex);
> > + return ret;
> > + default:
> > + return -EINVAL;
> > + }
> > +}
> > +
> > +static int bma400_write_raw_get_fmt(struct iio_dev *indio_dev,
> > + struct iio_chan_spec const *chan,
> > + long mask)
> > +{
> > + switch (mask) {
> > + case IIO_CHAN_INFO_SAMP_FREQ:
> > + return IIO_VAL_INT_PLUS_MICRO;
> > + case IIO_CHAN_INFO_SCALE:
> > + return IIO_VAL_INT_PLUS_MICRO;
> > + case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
> > + return IIO_VAL_INT;
> > + default:
> > + return -EINVAL;
> > + }
> > +}
> > +
> > +static const struct iio_info bma400_info = {
> > + .attrs = &bma400_attrs_group,
> > + .read_raw = bma400_read_raw,
> > + .write_raw = bma400_write_raw,
> > + .write_raw_get_fmt = bma400_write_raw_get_fmt,
> > +};
> > +
> > +int bma400_probe(struct device *dev,
> > +struct regmap *regmap,
> > +const char *name)
> > +{
> > + int ret;
> > + struct bma400_data *data;
> > + struct iio_dev *indio_dev;
> > +
> > + indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> > + if (!indio_dev)
> > + return -ENOMEM;
> > +
> > + data = iio_priv(indio_dev);
> > + data->regmap = regmap;
> > + data->dev = dev;
> > +
> > + ret = bma400_init(data);
> > + if (ret < 0)
> > + return ret;
> > +
> > + ret = iio_read_mount_matrix(dev, "mount-matrix",
> > + &data->orientation);
>
> Looks like the above will fit on one line..
>
> > + if (ret)
> > + return ret;
> > +
> > + mutex_init(&data->mutex);
> > + indio_dev->dev.parent = dev;
> > + indio_dev->name = name;
> > + indio_dev->info = &bma400_info;
> > + indio_dev->channels = bma400_channels;
> > + indio_dev->num_channels = ARRAY_SIZE(bma400_channels);
> > + indio_dev->modes = INDIO_DIRECT_MODE;
> > +
> > + dev_set_drvdata(dev, indio_dev);
> > +
> > + ret = iio_device_register(indio_dev);
> > + if (ret < 0) {
> > + dev_err(dev, "unable to register iio device\n");
> > + return ret;
>
> Drop the return out of the if statement and no need for the return 0 below.
I'd also avoid the error message altogether
>
> > + }
> > +
> > + return 0;
> > +}
> > +EXPORT_SYMBOL(bma400_probe);
> > +
> > +int bma400_remove(struct device *dev)
> > +{
> > + int ret;
> > + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> > + struct bma400_data *data = iio_priv(indio_dev);
> > +
> > + mutex_lock(&data->mutex);
> > + ret = bma400_softreset(data);
> > + if (ret < 0) {
> > + /*
> > +* If the softreset failed, try to put the device in
> > +* sleep mode, but still report the error.
> > +*/
> > + dev_err(data->dev, "Failed to reset the device");
> > + bma400_set_power_mode(data, POWER_MODE_SLEEP);
> > + }
> > + mutex_unlock(&data->mutex);
> > +
> > + iio_device_unregister(indio_dev);
> > +
> > + return ret;
> > +}
> > +EXPORT_SYMBOL(bma400_remove);
> > +
> > +MODULE_AUTHOR("Dan Robertson ");
> > +MODULE_DESCRIPTION("Bosch BMA400 triaxial acceleration sensor");
> > +MODULE_LICENSE("GPL");
> > diff --git a/drivers/iio/accel/bma400_i2c.c b/drivers/iio/accel/bma400_i2c.c
> > new file mode 100644
> > index ..227012a32e13
> > --- /dev/null
> > +++ b/drivers/iio/accel/bma400_i2c.c
> > @@ -0,0 +1,54 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * bma400-i2c.c - I2C IIO driver for Bosch BMA400 triaxial acceleration
> > sensor.
> > + *
> > + * Copyright 2019 Dan Robertson
> > + *
> > + * I2C address is either 0x14 or 0x15 depending on SDO
> > + *
>
> This blank line doesn't add anything (nitpick)
>
> > + */
> > +#include
> > +#include
> > +#include
>
> Slight preference for alphabetical order. Also why ACPI?
>
> > +#include
> > +#include
> > +
> > +#include "bma400.h"
> > +
> > +static int bma400_i2c_probe(struct i2c_client *client,
> > + const struct i2c_device_id *id)
> > +{
> > + struct regmap *regmap;
> > +
> > + regmap = devm_regmap_init_i2c(client,
> > + &bma400_regmap_config);
> > +
> > + return bma400_probe(&client->dev, regmap, id->name);
> > +}
> > +
> > +static int bma400_i2c_remove(struct i2c_client *client)
> > +{
> > + return bma400_remove(&client->dev);
> > +}
> > +
> > +static const struct i2c_device_id bma400_i2c_ids[] = {
> > + { "bma400", 0 },
> > + { }
> > +};
> > +
> > +MODULE_DEVICE_TABLE(i2c, bma400_i2c_ids);
> > +
>
> Good to have a of_device_id table as well from the start.
> There is a general (but slow) move to stop using the fallback
> to the i2c_device_id table.
>
> > +static struct i2c_driver bma400_i2c_driver = {
> > + .driver = {
> > + .name = "bma400",
> > + },
> > + .probe= bma400_i2c_probe,
> > + .remove = bma400_i2c_remove,
> > + .id_table = bma400_i2c_ids,
> > +};
> > +
> > +module_i2c_driver(bma400_i2c_driver);
> > +
> > +MODULE_AUTHOR("Dan Robertson ");
> > +MODULE_DESCRIPTION("Bosch BMA400 triaxial acceleration sensor");
> > +MODULE_LICENSE("GPL");
> >
> >
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
ev);
> +}
> +
> +static const struct of_device_id max5432_dt_ids[] = {
> + { .compatible = "maxim,max5432", .data = (void *)OHM_50K },
> + { .compatible = "maxim,max5433", .data = (void *)OHM_100K },
> + { .compatible = "maxim,max5434", .data = (void *)OHM_50K },
> + { .compatible = "maxim,max5435", .data = (void *)OHM_100K },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, max5432_dt_ids);
> +
> +static struct i2c_driver max5432_driver = {
> + .driver = {
> + .name = "max5432",
> + .of_match_table = of_match_ptr(max5432_dt_ids),
> + },
> + .probe = max5432_probe,
> +};
> +
> +module_i2c_driver(max5432_driver);
> +
> +MODULE_AUTHOR("Martin Kaiser ");
> +MODULE_DESCRIPTION("max5432-max5435 digital potentiometers");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
return -ENODEV;
> +
> + /* Switch to bank0 (Magic number)*/
> + ret = regmap_write(data->regmap, 0x7F, 0x00);
maybe a #define for 0x7f, PAT9125_BANK_SWITCH_REG
> + if (ret < 0) {
> + dev_err(indio_dev->dev.parent, "register 0x%x access failed
> %d\n",
> + 0x7F, ret);
> + return ret;
> + }
> +
> + /* Software reset */
> + ret = regmap_write_bits(data->regmap,
> + PAT9125_CONFIG_REG,
> + PAT9125_RESET_BIT,
> + 1);
> + if (ret < 0) {
> + dev_err(&client->dev, "register 0x%x access failed %d\n",
> + PAT9125_CONFIG_REG, ret);
> + return ret;
> + }
> +
> + msleep(20);
> +
> + /* Init GPIO IRQ */
> + if (client->irq) {
> + ret = devm_request_threaded_irq(&client->dev,
> + client->irq,
> + NULL,
> + pat9125_threaded_event_handler,
> + IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> + "pat9125",
> + indio_dev);
> + if (ret) {
> + dev_err(&client->dev, "GPIO IRQ init failed\n");
> + return ret;
> + }
> + }
> +
> + ret = devm_iio_device_register(&client->dev, indio_dev);
> + if (ret) {
> + dev_err(&client->dev, "IIO device register failed\n");
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static const struct i2c_device_id pat9125_id[] = {
> + { "pat9125", 0 },
> + {}
> +};
> +MODULE_DEVICE_TABLE(i2c, pat9125_id);
> +
> +static const unsigned short normal_i2c[] = {
pat9125_ prefix please
> + PAT9125_I2C_ADDR_HI,
> + PAT9125_I2C_ADDR_LO,
> + PAT9125_I2C_ADDR_NC,
> + I2C_CLIENT_END
> +};
> +
> +static struct i2c_driver pat9125_driver = {
> + .driver = {
> + .name = "pat9125",
> + },
> + .probe = pat9125_probe,
> + .address_list = normal_i2c,
> + .id_table = pat9125_id,
> +};
> +
> +module_i2c_driver(pat9125_driver);
> +
> +MODULE_AUTHOR("Alexandre Mergnat ");
> +MODULE_DESCRIPTION("Optical Tracking sensor");
> +MODULE_LICENSE("GPL");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
Set up pressure sensor in single sample, one measurement per second
> + * mode
> + */
> + r = regmap_write(data->regmap, DPS310_PRS_CFG,
> + DPS310_CALC_RATE(1) | DPS310_CALC_PRC(1));
> +
> + /*
>* Set up external (MEMS) temperature sensor in single sample, one
>* measurement per second mode
>*/
> @@ -399,16 +667,23 @@ static int dps310_probe(struct i2c_client *client,
> if (r < 0)
> goto err;
>
> - /* Temp shift is disabled when PRC <= 8 */
> + /* Temp and pressure shifts are disabled when PRC <= 8 */
> r = regmap_write_bits(data->regmap, DPS310_CFG_REG,
> - DPS310_TMP_SHIFT_EN, 0);
> + DPS310_TMP_SHIFT_EN | DPS310_PRS_SHIFT_EN, 0);
> + if (r < 0)
> + goto err;
> +
> + /* MEAS_CFG doesn't seem to update unless first written with 0 */
> + r = regmap_write_bits(data->regmap, DPS310_MEAS_CFG,
> + DPS310_MEAS_CTRL_BITS, 0);
> if (r < 0)
> goto err;
>
> - /* Turn on temperature measurement in the background */
> + /* Turn on temperature and pressure measurement in the background */
> r = regmap_write_bits(data->regmap, DPS310_MEAS_CFG,
> DPS310_MEAS_CTRL_BITS,
> - DPS310_TEMP_EN | DPS310_BACKGROUND);
> + DPS310_PRS_EN | DPS310_TEMP_EN |
> + DPS310_BACKGROUND);
> if (r < 0)
> goto err;
>
> @@ -421,7 +696,7 @@ static int dps310_probe(struct i2c_client *client,
> if (r < 0)
> goto err;
>
> - r = dps310_get_temp_coef(data);
> + r = dps310_get_coefs(data);
> if (r < 0)
> goto err;
>
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
_BACKGROUND);
> + if (r < 0)
> + goto err;
> +
> + /*
> + * Calibration coefficients required for reporting temperature.
> + * They are available 40ms after the device has started
> + */
> + r = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready,
> + ready & DPS310_COEF_RDY, 1, 4);
> + if (r < 0)
> + goto err;
> +
> + r = dps310_get_temp_coef(data);
> + if (r < 0)
> + goto err;
> +
> + r = devm_iio_device_register(&client->dev, iio);
> + if (r)
> + goto err;
> +
> + i2c_set_clientdata(client, iio);
> +
> + dev_info(&client->dev, "%s: sensor '%s'\n", dev_name(&iio->dev),
> + client->name);
don't clutter the log
> +
> + return 0;
> +
> +err:
> + regmap_write(data->regmap, DPS310_RESET, DPS310_RESET_MAGIC);
> + return r;
> +}
> +
> +static int dps310_remove(struct i2c_client *client)
> +{
> + struct dps310_data *data = i2c_get_clientdata(client);
> +
> + return regmap_write(data->regmap, DPS310_RESET, DPS310_RESET_MAGIC);
> +}
> +
> +static const struct i2c_device_id dps310_id[] = {
> + { "dps310", 0 },
> + {}
> +};
> +MODULE_DEVICE_TABLE(i2c, dps310_id);
> +
> +static const unsigned short normal_i2c[] = {
> + 0x77, 0x76, I2C_CLIENT_END
> +};
> +
> +static struct i2c_driver dps310_driver = {
> + .driver = {
> + .name = "dps310",
> + },
> + .probe = dps310_probe,
> + .remove = dps310_remove,
> + .address_list = normal_i2c,
> + .id_table = dps310_id,
> +};
> +module_i2c_driver(dps310_driver);
> +
> +MODULE_AUTHOR("Joel Stanley ");
> +MODULE_DESCRIPTION("Infineon DPS310 pressure and temperature sensor");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
r(&client->dev, indio_dev);
> + if (ret) {
> + dev_err(&client->dev, "IIO device register failed");
> + iio_triggered_buffer_cleanup(indio_dev);
> + return ret;
> + }
> +
> + i2c_set_clientdata(client, indio_dev);
> +
> + dev_info(&client->dev, "%s: sensor '%s'\n",
> + dev_name(&indio_dev->dev),
> + client->name);
please avoid log output, it just clutters the log
> +
> + /* Make read to reset motion bit status */
> + ret = pat9125_read_delta(data);
> + if (ret) {
> + dev_err(&client->dev, "Read register failed");
> + return ret;
> + }
> +
> + /* Init GPIO IRQ */
> + if (client->irq) {
> + ret = devm_request_threaded_irq(&client->dev,
> + client->irq,
> + pat9125_event_handler,
> + NULL,
> + IRQF_TRIGGER_FALLING,
> + "pat9125",
> + indio_dev);
> + if (ret) {
> + dev_err(&client->dev, "GPIO IRQ init failed");
> + return ret;
> + }
> + }
> + return 0;
> +}
> +
> +static int pat9125_remove(struct i2c_client *client)
> +{
> + struct iio_dev *indio_dev = devm_iio_device_alloc(&client->dev,
> sizeof(struct pat9125_data));
> +
> + iio_device_unregister(indio_dev);
> + iio_triggered_buffer_cleanup(indio_dev);
> +
> + dev_info(&client->dev, "PAT9125 removed\n");
> +
> + return 0;
> +}
> +
> +static const struct i2c_device_id pat9125_id[] = {
> + { "pat9125", 0 },
> + {}
> +};
> +MODULE_DEVICE_TABLE(i2c, pat9125_id);
> +
> +static const unsigned short normal_i2c[] = {
> + PAT9125_I2C_ADDR_HI,
> + PAT9125_I2C_ADDR_LO,
> + PAT9125_I2C_ADDR_NC,
> + I2C_CLIENT_END
> +};
> +
> +static struct i2c_driver pat9125_driver = {
> + .driver = {
> + .name = "pat9125",
> + },
> + .probe = pat9125_probe,
> + .remove = pat9125_remove,
> + .address_list = normal_i2c,
> + .id_table = pat9125_id,
> +};
> +
> +module_i2c_driver(pat9125_driver);
> +
> +MODULE_AUTHOR("Alexandre Mergnat ");
> +MODULE_DESCRIPTION("Optical Tracking sensor");
> +MODULE_LICENSE("GPL");
> \ No newline at end of file
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
pat9125";
> + reg = <0x75>;
> + interrupt-parent = <&gpio3>;
> + interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
> +};
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
esume(struct hid_device *hdev)
> +{
> + struct appleals_device *als_dev =
> + appleib_get_drvdata(hid_get_drvdata(hdev),
> + &appleals_hid_driver);
> +
> + appleals_config_sensor(als_dev, als_dev->events_enabled,
> +als_dev->cur_sensitivity);
> +
> + return 0;
> +}
> +#endif
> +
> +static struct hid_driver appleals_hid_driver = {
> + .name = "apple-ib-als",
> + .probe = appleals_probe,
> + .remove = appleals_remove,
> + .event = appleals_hid_event,
> +#ifdef CONFIG_PM
> + .reset_resume = appleals_reset_resume,
> +#endif
> +};
> +
> +static int appleals_platform_probe(struct platform_device *pdev)
> +{
> + struct appleib_platform_data *pdata = pdev->dev.platform_data;
> + struct appleib_device *ib_dev = pdata->ib_dev;
> + struct appleals_device *als_dev;
> + int rc;
> +
> + als_dev = kzalloc(sizeof(*als_dev), GFP_KERNEL);
> + if (!als_dev)
> + return -ENOMEM;
> +
> + als_dev->ib_dev = ib_dev;
> + als_dev->log_dev = pdata->log_dev;
> +
> + rc = appleib_register_hid_driver(ib_dev, &appleals_hid_driver, als_dev);
> + if (rc) {
> + dev_err(als_dev->log_dev, "Error registering hid driver: %d\n",
> + rc);
> + goto error;
> + }
> +
> + platform_set_drvdata(pdev, als_dev);
> +
> + return 0;
> +
> +error:
> + kfree(als_dev);
> + return rc;
> +}
> +
> +static int appleals_platform_remove(struct platform_device *pdev)
> +{
> + struct appleib_platform_data *pdata = pdev->dev.platform_data;
> + struct appleib_device *ib_dev = pdata->ib_dev;
> + struct appleals_device *als_dev = platform_get_drvdata(pdev);
> + int rc;
> +
> + rc = appleib_unregister_hid_driver(ib_dev, &appleals_hid_driver);
> + if (rc) {
> + dev_err(als_dev->log_dev,
> + "Error unregistering hid driver: %d\n", rc);
> + goto error;
> + }
> +
> + kfree(als_dev);
> +
> + return 0;
> +
> +error:
> + return rc;
> +}
> +
> +static const struct platform_device_id appleals_platform_ids[] = {
> + { .name = PLAT_NAME_IB_ALS },
> + { }
> +};
> +MODULE_DEVICE_TABLE(platform, appleals_platform_ids);
> +
> +static struct platform_driver appleals_platform_driver = {
> + .id_table = appleals_platform_ids,
> + .driver = {
> + .name = "apple-ib-als",
> + },
> + .probe = appleals_platform_probe,
> + .remove = appleals_platform_remove,
> +};
> +
> +module_platform_driver(appleals_platform_driver);
> +
> +MODULE_AUTHOR("Ronald Tschalär");
> +MODULE_DESCRIPTION("Apple iBridge ALS driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
return data->irqnr;
> + }
> +
> + ret = devm_request_irq(dev, data->irqnr, mb12x2_handle_irq,
> + IRQF_TRIGGER_FALLING, id->name, indio_dev);
> + if (ret < 0) {
> + dev_err(dev, "request_irq: %d\n", ret);
> + return ret;
> + }
> + }
> +
> + ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
> + iio_pollfunc_store_time, mb12x2_trigger_handler, NULL);
> + if (ret < 0) {
> + dev_err(dev, "setup of iio triggered buffer failed\n");
> + return ret;
> + }
> +
> + return devm_iio_device_register(dev, indio_dev);
> +}
> +
> +static const struct of_device_id of_mb12x2_match[] = {
> + { .compatible = "maxbotix,i2cxl", },
> + {},
> +};
> +
> +MODULE_DEVICE_TABLE(of, of_mb12x2_match);
> +
> +static const struct i2c_device_id mb12x2_id[] = {
> + { "maxbotix-i2cxl", },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, mb12x2_id);
> +
> +static struct i2c_driver mb12x2_driver = {
> + .driver = {
> + .name = "maxbotix-i2cxl",
> + .of_match_table = of_mb12x2_match,
> + },
> + .probe = mb12x2_probe,
> + .id_table = mb12x2_id,
> +};
> +module_i2c_driver(mb12x2_driver);
> +
> +MODULE_AUTHOR("Andreas Klinger ");
> +MODULE_DESCRIPTION("Maxbotix I2CXL-MaxSonar i2c ultrasonic ranger driver");
> +MODULE_LICENSE("GPL");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
+ dev_err(dev, "request_irq: %d\n", ret);
> + return ret;
> + }
> + }
> +
> + ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
> + iio_pollfunc_store_time, mb12x2_trigger_handler, NULL);
> + if (ret < 0) {
> + dev_err(dev, "setup of iio triggered buffer failed\n");
> + return ret;
> + }
> +
> + return devm_iio_device_register(dev, indio_dev);
> +}
> +
> +static const struct of_device_id of_mb12x2_match[] = {
> + { .compatible = "maxbotix,mb12x2", },
> + {},
> +};
> +
> +MODULE_DEVICE_TABLE(of, of_mb12x2_match);
> +
> +static const struct i2c_device_id mb12x2_id[] = {
> + { "maxbotix-mb12x2", },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, mb12x2_id);
> +
> +static struct i2c_driver mb12x2_driver = {
> + .driver = {
> + .name = "maxbotix-mb12x2",
> + .of_match_table = of_mb12x2_match,
> + },
> + .probe = mb12x2_probe,
> + .id_table = mb12x2_id,
> +};
> +module_i2c_driver(mb12x2_driver);
> +
> +MODULE_AUTHOR("Andreas Klinger ");
> +MODULE_DESCRIPTION("Maxbotix I2CXL-MB12X2-EZ i2c ultrasonic ranger driver");
> +MODULE_LICENSE("GPL");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
2.o
alphabetic order please
> obj-$(CONFIG_LIDAR_LITE_V2) += pulsedlight-lidar-lite-v2.o
> obj-$(CONFIG_RFD77402) += rfd77402.o
> obj-$(CONFIG_SRF04) += srf04.o
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
earing IRQ\n");
> +
> + return IRQ_HANDLED;
> +}
> +
> +static int ap3216c_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
> +{
> + struct ap3216c_data *data;
> + struct iio_dev *indio_dev;
> + int ret;
> +
> + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + data = iio_priv(indio_dev);
> + data->client = client;
> + indio_dev->dev.parent = &client->dev;
> + indio_dev->info = &ap3216c_info;
> + indio_dev->name = AP3216C_DRV_NAME;
> + indio_dev->channels = ap3216c_channels;
> + indio_dev->num_channels = ARRAY_SIZE(ap3216c_channels);
> +
> + data->regmap = devm_regmap_init_i2c(client, &ap3216c_regmap_config);
> + if (IS_ERR(data->regmap)) {
> + dev_err(&client->dev, "Failed to allocate register map\n");
> + return PTR_ERR(data->regmap);
> + }
> +
> + /* Default to thresh events disabled */
> + data->als_thresh_en = false;
> + data->prox_thresh_en = false;
> +
> + /*
> + * Require that that the interrupt is cleared only when the INT
that that
> + * register is written to, instead of when data is read. This
> + * prevents the interrupt from falsely reporting IRQ_NONE.
> + */
> + ret = regmap_write(data->regmap,
> +AP3216C_INT_CLR, AP3216C_INT_CLR_MANUAL);
> + if (ret < 0)
> + return ret;
> +
> + /* Before setting up IRQ, clear any stale interrupt */
> + ret = ap3216c_clear_int(data);
> + if (ret < 0)
> + return ret;
> +
> + if (client->irq) {
> + ret = devm_request_threaded_irq(&client->dev, client->irq,
> + NULL, ap3216c_event_handler,
> + IRQF_TRIGGER_FALLING |
> + IRQF_SHARED | IRQF_ONESHOT,
> + client->name, indio_dev);
> + if (ret)
> + return ret;
> + }
> +
> + /* Enable ALS and PS+IR */
> + ret = regmap_write(data->regmap, AP3216C_SYS, AP3216C_SYS_MODE_ALS_PS);
> + if (ret < 0)
> + return ret;
> +
> + return devm_iio_device_register(&client->dev, indio_dev);
> +}
> +
> +static const struct of_device_id ap3216c_of_match[] = {
> + { .compatible = "liteon,ap3216c", },
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, ap3216c_of_match);
> +
> +static const struct i2c_device_id ap3216c_id[] = {
> + {"ap3216c", 0},
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, ap3216c_id);
> +
> +static struct i2c_driver ap3216c_driver = {
> + .driver = {
> + .name = AP3216C_DRV_NAME,
> + },
> + .probe = ap3216c_probe,
> + .id_table = ap3216c_id,
> +};
> +module_i2c_driver(ap3216c_driver);
> +
> +MODULE_AUTHOR("Robert Eshleman ");
> +MODULE_DESCRIPTION("APC3216C Ambient Light and Proximity Sensor");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
ret);
> + goto error_disable_reg;
> + }
> +
> + st->filter_gpio = devm_gpiod_get_optional(&spi->dev,
> + "filter",
> + GPIOD_OUT_HIGH);
> + if (IS_ERR(st->filter_gpio)) {
> + ret = PTR_ERR(st->filter_gpio);
> + dev_err(&spi->dev,
> + "Failed to request filter GPIO: %d\n",
> + ret);
> + goto error_disable_reg;
> + }
> + }
> +
> ret = ad_sd_setup_buffer_and_trigger(indio_dev);
> if (ret)
> goto error_disable_reg;
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
_device_set_baudrate(serdev, 9600);
> + serdev_device_set_flow_control(serdev, false);
> +
> + ret = serdev_device_set_parity(serdev, SERDEV_PARITY_NONE);
> + if (ret)
> + return ret;
> +
> + ret = pms7003_do_cmd(state, CMD_WAKEUP);
> + if (ret) {
> + dev_err(&serdev->dev, "failed to wakeup sensor\n");
> + return ret;
> + }
> +
> + ret = pms7003_do_cmd(state, CMD_ENTER_PASSIVE_MODE);
> + if (ret) {
> + dev_err(&serdev->dev, "failed to enter passive mode\n");
> + return ret;
> + }
> +
> + ret = devm_add_action_or_reset(&serdev->dev, pms7003_stop, state);
> + if (ret)
> + return ret;
> +
> + ret = devm_iio_triggered_buffer_setup(&serdev->dev, indio_dev, NULL,
> + pms7003_trigger_handler, NULL);
> + if (ret)
> + return ret;
> +
> + return devm_iio_device_register(&serdev->dev, indio_dev);
> +}
> +
> +static const struct of_device_id pms7003_of_match[] = {
> + { .compatible = "plantower,pms7003" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, pms7003_of_match);
> +
> +static struct serdev_device_driver pms7003_driver = {
> + .driver = {
> + .name = PMS7003_DRIVER_NAME,
> + .of_match_table = pms7003_of_match,
> + },
> + .probe = pms7003_probe,
> +};
> +module_serdev_device_driver(pms7003_driver);
> +
> +MODULE_AUTHOR("Tomasz Duszynski ");
> +MODULE_DESCRIPTION("Plantower PMS7003 particulate matter sensor driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
+{
> > + struct iio_dev *indio_dev = p;
> > + struct max44009_data *data = iio_priv(indio_dev);
> > +
> > + data->timestamp = iio_get_time_ns(indio_dev);
>
> We have a standard core function to do this..
> iio_pollfunc_store_time.
>
> There 'mig
0_remove,
> +};
> +module_spi_driver(rm3100_driver);
> +
> +MODULE_AUTHOR("Song Qiang ");
> +MODULE_DESCRIPTION("PNI RM3100 9-axis magnetometer spi driver");
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/iio/magnetometer/rm3100.h
> b/drive
> [IIO_MOD_LIGHT_UV] = "uv",
> > > + [IIO_MOD_LIGHT_WHITE] = "white",
> > > [IIO_MOD_QUATERNION] = "quaternion",
> > > [IIO_MOD_TEMP_AMBIENT] = "ambient",
> > > [IIO_MOD_TEMP_OBJECT] = "object",
> > > @@ -178,6 +179,7 @@ static bool event_is_known(struct iio_event_data
> > > *event)
> > > case IIO_MOD_LIGHT_GREEN:
> > > case IIO_MOD_LIGHT_BLUE:
> > > case IIO_MOD_LIGHT_UV:
> > > + case IIO_MOD_LIGHT_WHITE:
> > > case IIO_MOD_QUATERNION:
> > > case IIO_MOD_TEMP_AMBIENT:
> > > case IIO_MOD_TEMP_OBJECT:
> > >
> >
>
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
);
> + return ret;
> +}
> +
> +static int vcnl4035_remove(struct i2c_client *client)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(client);
> + struct vcnl4035_data *data = iio_priv(indio_dev);
> +
> + iio_triggered_buffer_cleanup(indio_dev);
> + iio_trigger_unregister(data->drdy_trigger0);
> + iio_device_unregister(indio_dev);
> +
> + pm_runtime_disable(&client->dev);
> + pm_runtime_set_suspended(&client->dev);
> + pm_runtime_put_noidle(&client->dev);
> +
> + return vcnl4035_set_als_power_state(iio_priv(indio_dev),
> + VCNL4035_MODE_ALS_DISABLE);
> +}
> +
> +#ifdef CONFIG_PM
> +static int vcnl4035_runtime_suspend(struct device *dev)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> + struct vcnl4035_data *data = iio_priv(indio_dev);
> + int ret;
> +
> + ret = vcnl4035_set_als_power_state(data, VCNL4035_MODE_ALS_DISABLE);
> + regcache_mark_dirty(data->regmap);
> +
> + return ret;
> +}
> +
> +static int vcnl4035_runtime_resume(struct device *dev)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> + struct vcnl4035_data *data = iio_priv(indio_dev);
> + int ret;
> +
> + regcache_sync(data->regmap);
> + ret = vcnl4035_set_als_power_state(data, VCNL4035_MODE_ALS_ENABLE);
> + if (ret < 0)
> + return ret;
> + /* wait for 1 ALS integration cycle */
> + msleep(data->als_it_val * 100);
> +
> + return 0;
> +}
> +#endif
> +
> +static const struct dev_pm_ops vcnl4035_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> + pm_runtime_force_resume)
> + SET_RUNTIME_PM_OPS(vcnl4035_runtime_suspend,
> +vcnl4035_runtime_resume, NULL)
> +};
> +
> +static const struct of_device_id vcnl4035_of_match[] = {
> + { .compatible = "vishay,vcnl4035", },
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, vcnl4035_of_match);
> +
> +static const struct i2c_device_id vcnl4035_id[] = {
> + { "vcnl4035", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, vcnl4035_id);
> +
> +static struct i2c_driver vcnl4035_driver = {
> + .driver = {
> + .name = VCNL4035_DRV_NAME,
> + .pm = &vcnl4035_pm_ops,
> + .of_match_table = of_match_ptr(vcnl4035_of_match),
> + },
> + .probe = vcnl4035_probe,
> + .remove = vcnl4035_remove,
> + .id_table = vcnl4035_id,
> +};
> +
> +module_i2c_driver(vcnl4035_driver);
> +
> +MODULE_AUTHOR("Parthiban Nallathambi ");
> +MODULE_DESCRIPTION("VCNL4035 Ambient Light Sensor driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
ot;,
> [IIO_MOD_QUATERNION] = "quaternion",
> [IIO_MOD_TEMP_AMBIENT] = "ambient",
> [IIO_MOD_TEMP_OBJECT] = "object",
> @@ -178,6 +179,7 @@ static bool event_is_known(struct iio_event_data *event)
> case IIO_MOD_LIGHT_GREEN:
> case IIO_MOD_LIGHT_BLUE:
> case IIO_MOD_LIGHT_UV:
> + case IIO_MOD_LIGHT_WHITE:
> case IIO_MOD_QUATERNION:
> case IIO_MOD_TEMP_AMBIENT:
> case IIO_MOD_TEMP_OBJECT:
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
> if (ret < 0) {
> @@ -506,6 +831,41 @@ static int adxl372_probe(struct spi_device *spi)
> return ret;
> }
>
> + ret = devm_iio_triggered_buffer_setup(&st->spi->dev,
> + indio_dev, NULL,
> + adxl372_trigger_handler,
> + &adxl372_buffer_ops);
> + if (ret < 0)
> + return ret;
> +
> + iio_buffer_set_attrs(indio_dev->buffer, adxl372_fifo_attributes);
> +
> + if (st->spi->irq) {
> + st->dready_trig = devm_iio_trigger_alloc(&st->spi->dev,
> + "%s-dev%d",
> + indio_dev->name,
> + indio_dev->id);
> + if (st->dready_trig == NULL)
> + return -ENOMEM;
> +
> + st->dready_trig->ops = &adxl372_trigger_ops;
> + st->dready_trig->dev.parent = &st->spi->dev;
> + iio_trigger_set_drvdata(st->dready_trig, indio_dev);
> + ret = devm_iio_trigger_register(&st->spi->dev, st->dready_trig);
> + if (ret < 0)
> + return ret;
> +
> + indio_dev->trig = iio_trigger_get(st->dready_trig);
> +
> + ret = devm_request_threaded_irq(&st->spi->dev, st->spi->irq,
> + iio_trigger_generic_data_rdy_poll,
> + NULL,
> + IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> + indio_dev->name, st->dready_trig);
> + if (ret < 0)
> + return ret;
> + }
> +
> return devm_iio_device_register(&st->spi->dev, indio_dev);
> }
>
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
return ret;
> + }
> +
> + /* Store gain values to better calculate scale values */
> + mcp3911_get_hwgain(adc, 0, &adc->gain[0]);
> + mcp3911_get_hwgain(adc, 1, &adc->gain[1]);
> +
> + indio_dev->dev.parent = &spi->dev;
> + indio_dev->dev.of_node = spi->dev.of_node;
> + indio_dev->name = spi_get_device_id(spi)->name;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->info = &mcp3911_info;
> + spi_set_drvdata(spi, indio_dev);
> +
> + indio_dev->channels = mcp3911_channels;
> + indio_dev->num_channels = ARRAY_SIZE(mcp3911_channels);
> +
> + mutex_init(&adc->lock);
> +
> + ret = iio_device_register(indio_dev);
> + if (ret)
> + goto reg_disable;
> +
> + return ret;
> +
> +reg_disable:
> + if (adc->vref)
> + regulator_disable(adc->vref);
> +
> + return ret;
> +}
> +
> +static int mcp3911_remove(struct spi_device *spi)
> +{
> + struct iio_dev *indio_dev = spi_get_drvdata(spi);
> + struct mcp3911 *adc = iio_priv(indio_dev);
> +
> + iio_device_unregister(indio_dev);
> +
> + if (adc->vref)
> + regulator_disable(adc->vref);
> +
> + return 0;
> +}
> +
> +#if defined(CONFIG_OF)
> +static const struct of_device_id mcp3911_dt_ids[] = {
> + { .compatible = "microchip,mcp3911" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, mcp3911_dt_ids);
> +#endif
> +
> +static const struct spi_device_id mcp3911_id[] = {
> + { "mcp3911", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(spi, mcp3911_id);
> +
> +static struct spi_driver mcp3911_driver = {
> + .driver = {
> + .name = "mcp3911",
> + .of_match_table = of_match_ptr(mcp3911_dt_ids),
> + },
> + .probe = mcp3911_probe,
> + .remove = mcp3911_remove,
> + .id_table = mcp3911_id,
> +};
> +module_spi_driver(mcp3911_driver);
> +
> +MODULE_AUTHOR("Marcus Folkesson ");
> +MODULE_AUTHOR("Kent Gustavsson ");
> +MODULE_DESCRIPTION("Microchip Technology MCP3911");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
ng
> + VCNL4035_DRV_NAME);
> + return 0;
> +
> +fail_pm_disable:
> + pm_runtime_disable(&client->dev);
> + pm_runtime_set_suspended(&client->dev);
> + pm_runtime_put_noidle(&client->dev);
> +fail_poweroff:
> + return vcnl4035_set_als_power_state(data, VCNL4035_MODE_ALS_DISABLE);
I think we want to return the 'ret' value indicating the original failure,
not the return value of vcnl4035_set_als_power_state() which is likely success
> +}
> +
> +static int vcnl4035_remove(struct i2c_client *client)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(client);
> +
> + iio_device_unregister(indio_dev);
> +
> + pm_runtime_disable(&client->dev);
> + pm_runtime_set_suspended(&client->dev);
> + pm_runtime_put_noidle(&client->dev);
> +
> + return vcnl4035_set_als_power_state(iio_priv(indio_dev),
> + VCNL4035_MODE_ALS_DISABLE);
> +}
> +
> +#ifdef CONFIG_PM
> +static int vcnl4035_runtime_suspend(struct device *dev)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> + struct vcnl4035_data *data = iio_priv(indio_dev);
> + int ret;
> +
> + mutex_lock(&data->lock);
> + ret = vcnl4035_set_als_power_state(data, VCNL4035_MODE_ALS_DISABLE);
> + regcache_mark_dirty(data->regmap);
> + mutex_unlock(&data->lock);
> +
> + return ret;
> +}
> +
> +static int vcnl4035_runtime_resume(struct device *dev)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> + struct vcnl4035_data *data = iio_priv(indio_dev);
> + int ret;
> +
> + regcache_sync(data->regmap);
> + ret = vcnl4035_set_als_power_state(data, VCNL4035_MODE_ALS_ENABLE);
> + if (ret < 0)
> + return ret;
> + /* wait for 1 ALS integration cycle */
> + msleep(data->als_it_val * 100);
> +
> + return 0;
> +}
> +#endif
> +
> +static const struct dev_pm_ops vcnl4035_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> + pm_runtime_force_resume)
> + SET_RUNTIME_PM_OPS(vcnl4035_runtime_suspend,
> +vcnl4035_runtime_resume, NULL)
> +};
> +
> +static const struct of_device_id vcnl4035_of_match[] = {
> + { .compatible = "vishay,vcnl4035", },
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, vcnl4035_of_match);
> +
> +static const struct i2c_device_id vcnl4035_id[] = {
> + { "vcnl4035", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, vcnl4035_id);
> +
> +static struct i2c_driver vcnl4035_driver = {
> + .driver = {
> + .name = VCNL4035_DRV_NAME,
> + .pm = &vcnl4035_pm_ops,
> + .of_match_table = of_match_ptr(vcnl4035_of_match),
> + },
> + .probe = vcnl4035_probe,
> + .remove = vcnl4035_remove,
> + .id_table = vcnl4035_id,
> +};
> +
> +module_i2c_driver(vcnl4035_driver);
> +
> +MODULE_AUTHOR("Parthiban Nallathambi ");
> +MODULE_DESCRIPTION("VCNL4035 Ambient Light Sensor driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
et_volt_ratio = data;
> + sc27xx_data->dev = &pdev->dev;
> +
> + ret = sc27xx_adc_enable(sc27xx_data);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to enable ADC module\n");
> + goto free_hwlock;
> + }
> +
> + ret = devm_request_threaded_irq(&pdev->dev, sc27xx_data->irq, NULL,
> + sc27xx_adc_isr, IRQF_ONESHOT,
> + pdev->name, sc27xx_data);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to request ADC irq\n");
> + goto disable_adc;
> + }
> +
> + indio_dev->dev.parent = &pdev->dev;
> + indio_dev->name = dev_name(&pdev->dev);
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->info = &sc27xx_info;
> + indio_dev->channels = sc27xx_channels;
> + indio_dev->num_channels = ARRAY_SIZE(sc27xx_channels);
> + ret = devm_iio_device_register(&pdev->dev, indio_dev);
> + if (ret) {
> + dev_err(&pdev->dev, "could not register iio (ADC)");
> + goto disable_adc;
> + }
> +
> + platform_set_drvdata(pdev, indio_dev);
> + return 0;
> +
> +disable_adc:
> + sc27xx_adc_disable(sc27xx_data);
> +free_hwlock:
> + hwspin_lock_free(sc27xx_data->hwlock);
> + return ret;
> +}
> +
> +static int sc27xx_adc_remove(struct platform_device *pdev)
> +{
> + struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> + struct sc27xx_adc_data *sc27xx_data = iio_priv(indio_dev);
> +
> + sc27xx_adc_disable(sc27xx_data);
> + hwspin_lock_free(sc27xx_data->hwlock);
> + return 0;
> +}
> +
> +static const struct of_device_id sc27xx_adc_of_match[] = {
> + {
> + .compatible = "sprd,sc2731-adc",
> + .data = (void *)&sc27xx_adc_2731_ratio,
> + },
> + { }
> +};
> +
> +static struct platform_driver sc27xx_adc_driver = {
> + .probe = sc27xx_adc_probe,
> + .remove = sc27xx_adc_remove,
> + .driver = {
> + .name = "sc27xx-adc",
> + .of_match_table = sc27xx_adc_of_match,
> + },
> +};
> +
> +module_platform_driver(sc27xx_adc_driver);
> +
> +MODULE_AUTHOR("Freeman Liu ");
> +MODULE_DESCRIPTION("Spreadtrum SC27XX ADC Driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
; 0)
> + return ret;
> +
> + regval = ad5758_spi_reg_read(st, AD5758_DIGITAL_DIAG_RESULTS);
> + if (regval < 0)
> + return regval;
> +
> + /* Clear all the error flags */
> + ret = ad5758_spi_reg_write(st, AD5758_DIGITAL_DIAG_RESULTS, regval);
> + if (ret < 0)
> + return ret;
> +
> + /* Set the dc-to-dc current limit */
> + ret = ad5758_set_dc_dc_ilim(st, st->dc_dc_ilim);
> + if (ret < 0)
> + return ret;
> +
> + /* Configure the dc-to-dc controller mode */
> + ret = ad5758_set_dc_dc_conv_mode(st, st->dc_dc_mode);
> + if (ret < 0)
> + return ret;
> +
> + /* Configure the output range */
> + ret = ad5758_set_out_range(st, st->out_range);
> + if (ret < 0)
> + return ret;
> +
> + /* Enable Slew Rate Control, set the slew rate clock and step */
> + ret = ad5758_slew_rate_config(st, st->sr_config[0],
> + st->sr_config[1], st->sr_config[2]);
> + if (ret < 0)
> + return ret;
> +
> + /* Enable the VIOUT fault protection switch (FPS is closed) */
> + ret = ad5758_fault_prot_switch_en(st, 1);
> + if (ret < 0)
> + return ret;
> +
> + /* Power up the DAC and internal (INT) amplifiers */
> + ret = ad5758_internal_buffers_en(st, 1);
> + if (ret < 0)
> + return ret;
> +
> + /* Enable VIOUT */
> + ret = ad5758_spi_write_mask(st, AD5758_DAC_CONFIG,
> + AD5758_DAC_CONFIG_OUT_EN_MSK,
> + AD5758_DAC_CONFIG_OUT_EN_MODE(1));
return directly, i.e.
return ad5758_spi...
> +
> + return ret;
> +}
> +
> +static int ad5758_probe(struct spi_device *spi)
> +{
> + struct ad5758_state *st;
> + struct iio_dev *indio_dev;
> + int ret;
> +
> + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + st = iio_priv(indio_dev);
> + spi_set_drvdata(spi, indio_dev);
> +
> + st->spi = spi;
> +
> + indio_dev->dev.parent = &spi->dev;
> + indio_dev->name = spi_get_device_id(spi)->name;
> + indio_dev->info = &ad5758_info;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->channels = ad5758_channels;
> + indio_dev->num_channels = ARRAY_SIZE(ad5758_channels);
> +
> + mutex_init(&st->lock);
> +
> + ret = ad5758_init(st);
> + if (ret < 0) {
> + dev_err(&spi->dev, "AD5758 init failed\n");
> + return ret;
> + }
> +
> + ret = iio_device_register(indio_dev);
> + if (ret) {
> + dev_err(&spi->dev, "Failed to register iio device\n");
is the message really necessary/likely?
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static const struct spi_device_id ad5758_id[] = {
> + { "ad5758", 0 },
> + {}
> +};
> +MODULE_DEVICE_TABLE(spi, ad5758_id);
> +
> +static struct spi_driver ad5758_driver = {
> + .driver = {
> + .name = KBUILD_MODNAME,
> + },
> + .probe = ad5758_probe,
> + .id_table = ad5758_id,
> +};
> +
> +module_spi_driver(ad5758_driver);
> +
> +MODULE_AUTHOR("Stefan Popa ");
> +MODULE_DESCRIPTION("Analog Devices AD5758 DAC");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
minor comments below
> The AMS includes an ADC as well as on-chip sensors that can be used to
> sample external voltages and monitor on-die operating conditions, such as
> temperature and supply voltage levels. The AMS has two SYSMON blocks.
> PL-SYSMON block is capable of monitoring off chip vol
; + if (ret)
> + return ret;
> +
> + tlv493d->factset1 = buf[7];
> + tlv493d->factset2 = buf[8];
> + tlv493d->factset3 = buf[9];
> +
> + buf[0] = 0;
> + buf[1] = MOD1_FAST | MOD1_LOW;
what does this mean? some comment explaining the default mode?
> + buf[2] = 0;
> + buf[3] = 0;
> + ret = tlv493d_write_regs(tlv493d, buf, 4);
> + if (ret)
> + return ret;
> +
> + ret = iio_device_register(indio_dev);
> + if (ret) {
> + dev_err(&i2c->dev, "device registration failed");
> + tlv493d_power_down(tlv493d);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static int tlv493d_remove(struct i2c_client *i2c)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(i2c);
> + struct tlv493d *tlv493d = iio_priv(indio_dev);
> +
> + iio_device_unregister(indio_dev);
> +
> + tlv493d_power_down(tlv493d);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id tlv493d_dt_ids[] = {
> + { .compatible = "infineon,tlv493d-a1b6" },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, tlv493d_dt_ids);
> +
> +static struct i2c_driver tlv493d_i2c_driver = {
> + .driver = {
> + .name = "tlv493d",
> + .of_match_table = tlv493d_dt_ids,
> + },
> + .probe_new = tlv493d_probe,
> + .remove = tlv493d_remove,
> +};
> +
> +module_i2c_driver(tlv493d_i2c_driver);
> +
> +MODULE_DESCRIPTION("TLV493D I2C driver");
> +MODULE_AUTHOR("Andreas Faerber");
> +MODULE_LICENSE("GPL");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
version.dev_attr.attr,
> + &iio_dev_attr_in_selftest.dev_attr.attr,
> + &iio_dev_attr_out_iaq_init.dev_attr.attr,
> + &iio_dev_attr_in_iaq_baseline.dev_attr.attr,
> + &iio_dev_attr_out_iaq_baseline.dev_attr.attr,
> + NULL
> +};
> +
> +static const struct attribute_group sgp_attr_group = {
> + .attrs = sgp_attributes,
> +};
> +
> +static const struct iio_info sgp_info = {
> + .attrs = &sgp_attr_group,
> + .read_raw = sgp_read_raw,
> + .write_raw = sgp_write_raw,
> +};
> +
> +static const struct of_device_id sgp_dt_ids[] = {
> + { .compatible = "sensirion,sgp30", .data = (void *)SGP30 },
> + { .compatible = "sensirion,sgpc3", .data = (void *)SGPC3 },
> + { }
> +};
> +
> +static int sgp_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
> +{
> + struct iio_dev *indio_dev;
> + struct sgp_data *data;
> + struct sgp_device *chip;
> + const struct of_device_id *of_id;
> + unsigned long chip_id;
> + int ret;
> +
> + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + of_id = of_match_device(sgp_dt_ids, &client->dev);
> + if (!of_id)
> + chip_id = id->driver_data;
> + else
> + chip_id = (unsigned long)of_id->data;
> +
> + chip = &sgp_devices[chip_id];
> + data = iio_priv(indio_dev);
> + i2c_set_clientdata(client, indio_dev);
> + data->client = client;
> + crc8_populate_msb(sgp_crc8_table, SGP_CRC8_POLYNOMIAL);
> + mutex_init(&data->data_lock);
> + mutex_init(&data->i2c_lock);
> +
> + /* get serial id and write it to client data */
> + ret = sgp_get_serial_id(data);
> +
> + if (ret != 0)
matter of taste: most drivers just do
if (ret)
> + return ret;
> +
> + /* get feature set version and write it to client data */
> + ret = sgp_read_from_cmd(data, SGP_CMD_GET_FEATURE_SET, 1,
> + SGP_CMD_DURATION_US);
> + if (ret != 0)
> + return ret;
> +
> + data->feature_set = be16_to_cpu(data->buffer.raw_words[0].value);
> +
> + ret = setup_and_check_sgp_data(data, chip_id);
> + if (ret < 0)
> + goto fail_free;
> +
> + /* so initial reading will complete */
> + data->last_update = jiffies - data->measure_interval_hz * HZ;
> +
> + indio_dev->dev.parent = &client->dev;
> + indio_dev->info = &sgp_info;
> + indio_dev->name = dev_name(&client->dev);
> + indio_dev->modes = INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE;
is INDIO_BUFFER_SOFTWARE implemented at this stage? maybe added in
followup patch
> +
> + indio_dev->channels = chip->channels;
> + indio_dev->num_channels = chip->num_channels;
> +
> + ret = devm_iio_device_register(&client->dev, indio_dev);
> + if (!ret)
> + return ret;
> +
> + dev_err(&client->dev, "failed to register iio device\n");
really message needed?
> +
> +fail_free:
> + mutex_destroy(&data->i2c_lock);
> + mutex_destroy(&data->data_lock);
no need to explicitly destroy mutex
> + iio_device_free(indio_dev);
no need to explicitly free devm_ stuff
> + return ret;
> +}
> +
> +static int sgp_remove(struct i2c_client *client)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(client);
> +
> + devm_iio_device_unregister(&client->dev, indio_dev);
not needed
> + return 0;
> +}
> +
> +static const struct i2c_device_id sgp_id[] = {
> + { "sgp30", SGP30 },
> + { "sgpc3", SGPC3 },
> + { }
> +};
> +
> +MODULE_DEVICE_TABLE(i2c, sgp_id);
> +MODULE_DEVICE_TABLE(of, sgp_dt_ids);
> +
> +static struct i2c_driver sgp_driver = {
> + .driver = {
> + .name = "sgpxx",
> + .of_match_table = of_match_ptr(sgp_dt_ids),
> + },
> + .probe = sgp_probe,
> + .remove = sgp_remove,
> + .id_table = sgp_id,
> +};
> +module_i2c_driver(sgp_driver);
> +
> +MODULE_AUTHOR("Andreas Brauchli ");
> +MODULE_AUTHOR("Pascal Sachs ");
> +MODULE_DESCRIPTION("Sensirion SGPxx gas sensors");
> +MODULE_LICENSE("GPL v2");
> +MODULE_VERSION("0.5.0");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
case IIO_VAL_INT_PLUS_MICRO:
> if (vals[1] < 0)
> return snprintf(buf, len, "-%d.%06u%s", abs(vals[0]),
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
i2c_unregister_device(cm32181->ara);
> +
> return ret;
> }
>
> return 0;
> }
>
> +static int cm32181_remove(struct i2c_client *client)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(client);
> + struct cm32181_chip *cm32181 = iio_priv(indio_dev);
> +
> + if (cm32181->ara)
> + i2c_unregister_device(cm32181->ara);
> +
> + return 0;
> +};
> +
> static const struct i2c_device_id cm32181_id[] = {
> - { "cm32181", 0 },
> + { "cm32181", CM32181_ID },
> + { "cm3218", CM3218_ID },
> { }
> };
>
> MODULE_DEVICE_TABLE(i2c, cm32181_id);
>
> static const struct of_device_id cm32181_of_match[] = {
> - { .compatible = "capella,cm32181" },
> + { .compatible = "capella,cm32181", (void *)CM32181_ID },
> + { .compatible = "capella,cm3218", (void *)CM3218_ID },
> { }
> };
> MODULE_DEVICE_TABLE(of, cm32181_of_match);
>
> +static const struct acpi_device_id cm32181_acpi_match[] = {
> + { "CPLM3218", CM3218_ID },
> + { }
> +};
> +
> +MODULE_DEVICE_TABLE(acpi, cm32181_acpi_match);
> +
> static struct i2c_driver cm32181_driver = {
> .driver = {
> .name = "cm32181",
> .of_match_table = of_match_ptr(cm32181_of_match),
> + .acpi_match_table = ACPI_PTR(cm32181_acpi_match),
> },
> .id_table = cm32181_id,
> .probe = cm32181_probe,
> + .remove = cm32181_remove,
> };
>
> module_i2c_driver(cm32181_driver);
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
t; > If it leads to more complex flow as here, don't do it.
>
> I would appreciate to clarify such a view a bit more.
> How would you like to achieve a complete and efficient
> exception handling in shown places?
regards, p.
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
_id[] = {
> - { "cm32181", 0 },
> + { "cm32181", CM32181_ID },
> + { "cm3218", CM3218_ID },
> { }
> };
>
> MODULE_DEVICE_TABLE(i2c, cm32181_id);
>
> static const struct of_device_id cm32181_of_match[] = {
> - { .compatible = "capella,cm32181" },
> + { .compatible = "capella,cm32181", (void *)CM32181_ID },
> + { .compatible = "capella,cm3218", (void *)CM3218_ID },
> { }
> };
> MODULE_DEVICE_TABLE(of, cm32181_of_match);
>
> +static const struct acpi_device_id cm32181_acpi_match[] = {
> + { "CPLM3218", CM3218_ID },
> + { }
> +};
> +
> +MODULE_DEVICE_TABLE(acpi, cm32181_acpi_match);
> +
> static struct i2c_driver cm32181_driver = {
> .driver = {
> .name = "cm32181",
> .of_match_table = of_match_ptr(cm32181_of_match),
> + .acpi_match_table = ACPI_PTR(cm32181_acpi_match),
> },
> .id_table = cm32181_id,
> .probe = cm32181_probe,
> + .remove = cm32181_remove,
> };
>
> module_i2c_driver(cm32181_driver);
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
if (chan->type != IIO_LIGHT)
> return -EINVAL;
>
> return vl6180_set_als_gain(data, val, val2);
> +
> default:
> return -EINVAL;
> }
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
-EINVAL;
> + ret = vl6180_write_byte(data->client, VL6180_ALS_GAIN,
> + vl6180_als_gain_tab_bits[i]);
> +
> + if (ret >= 0)
> + data->als_gain_milli = vl6180_als_gain_tab[i];
> +
> +fail:
> + vl6180_hold(data, false);
> + mutex_unlock(&data->lock);
> + return ret;
> }
>
> static int vl6180_set_it(struct vl6180_data *data, int val, int val2)
> @@ -480,6 +482,7 @@ static int vl6180_init(struct vl6180_data *data)
> return ret;
>
> /* ALS gain: 1 */
> + data->als_gain_milli = 1000;
> ret = vl6180_write_byte(client, VL6180_ALS_GAIN, VL6180_ALS_GAIN_1);
> if (ret < 0)
> return ret;
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
+ case ID_DS4424:
> + indio_dev->num_channels = DS4424_MAX_DAC_CHANNELS;
> + break;
> + default:
> + dev_err(&client->dev,
> + "ds4424: Invalid chip id.\n");
> + regulator_disable(data->vcc_reg);
> + return -ENXIO;
> + }
> +
> + indio_dev->channels = ds4424_channels;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->info = &ds4424_info;
> +
> + ret = iio_device_register(indio_dev);
> + if (ret < 0) {
> + dev_err(&client->dev,
> + "iio_device_register failed. ret: %d\n", ret);
> + regulator_disable(data->vcc_reg);
> + }
> +
> + return ret;
> +}
> +
> +static int ds4424_remove(struct i2c_client *client)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(client);
> + struct ds4424_data *data = iio_priv(indio_dev);
> +
> + iio_device_unregister(indio_dev);
> + regulator_disable(data->vcc_reg);
> +
> + return 0;
> +}
> +
> +static const struct i2c_device_id ds4424_id[] = {
> + { "ds4422", ID_DS4422 },
> + { "ds4424", ID_DS4424 },
> + { }
> +};
> +
> +MODULE_DEVICE_TABLE(i2c, ds4424_id);
> +
> +static const struct of_device_id ds4424_of_match[] = {
> + { .compatible = "maxim,ds4422" },
> + { .compatible = "maxim,ds4424" },
> + { },
> +};
> +
> +MODULE_DEVICE_TABLE(of, ds4424_of_match);
> +
> +static struct i2c_driver ds4424_driver = {
> + .driver = {
> + .name = "ds4424",
> + .of_match_table = ds4424_of_match,
> + .pm = &ds4424_pm_ops,
> + },
> + .probe = ds4424_probe,
> + .remove = ds4424_remove,
> + .id_table = ds4424_id,
> +};
> +module_i2c_driver(ds4424_driver);
> +
> +MODULE_DESCRIPTION("Maxim DS4424 DAC Driver");
> +MODULE_AUTHOR("Ismail H. Kose ");
> +MODULE_AUTHOR("Vishal Sood ");
> +MODULE_AUTHOR("David Jung ");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
tatic int inv_mpu6050_write_raw(struct iio_dev
> *indio_dev,
> break;
> default:
> result = -EINVAL;
> + break;
> }
> + break;
> default:
> result = -EINVAL;
> break;
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
> From: Abhisit Sangjan
>
> TI LMP92001 Analog System Monitor and Controller
some minor comments, not a full review
> 8-bit GPIOs.
> 12 DACs with 12-bit resolution.
> The GPIOs and DACs are shared port function with Cy function pin to
> take control the pin suddenly from external hardware.
>
ed buffer failed\n");
> + return ret;
> + }
> +
> /*
>* set default values of device here
>* these register values cannot be read from the hardware
> @@ -402,5 +455,5 @@ static struct i2c_driver srf08_driver = {
> module_i2c_driver(srf08_driver);
>
> MODULE_AUTHOR("Andreas Klinger ");
> -MODULE_DESCRIPTION("Devantech SRF08 ultrasonic ranger driver");
> +MODULE_DESCRIPTION("Devantech SRF08/SRF10 ultrasonic ranger driver");
> MODULE_LICENSE("GPL");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
uot;, (void *)SRF08},
> { .compatible = "devantech,srf10", (void *)SRF10},
> {},
> @@ -473,6 +511,7 @@ static const struct of_device_id of_srf08_match[] = {
> MODULE_DEVICE_TABLE(of, of_srf08_match);
>
> static const struct i2c_device_id srf08_id[] = {
> + { "srf02", SRF02 },
> { "srf08", SRF08 },
> { "srf10", SRF10 },
> { }
> @@ -490,5 +529,5 @@ static struct i2c_driver srf08_driver = {
> module_i2c_driver(srf08_driver);
>
> MODULE_AUTHOR("Andreas Klinger ");
> -MODULE_DESCRIPTION("Devantech SRF08/SRF10 ultrasonic ranger driver");
> +MODULE_DESCRIPTION("Devantech SRF02/SRF08/SRF10 i2c ultrasonic ranger
> driver");
> MODULE_LICENSE("GPL");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
{0, 9577}, {0, 19154}, {0, 38307} },
> - .ev_cfg = MMA8452_FF_MT_CFG,
> - .ev_cfg_ele = MMA8452_FF_MT_CFG_ELE,
> - .ev_cfg_chan_shift = 3,
> - .ev_src = MMA8452_FF_MT_SRC,
> - .ev_src_xe = MMA8452_FF_MT_SRC_XHE,
> - .ev_src_ye = MMA8452_FF_MT_SRC_YHE,
> - .ev_src_ze = MMA8452_FF_MT_SRC_ZHE,
> - .ev_ths = MMA8452_FF_MT_THS,
> - .ev_ths_mask = MMA8452_FF_MT_THS_MASK,
> - .ev_count = MMA8452_FF_MT_COUNT,
> },
> [mma8653] = {
> .chip_id = MMA8653_DEVICE_ID,
> .channels = mma8653_channels,
> .num_channels = ARRAY_SIZE(mma8653_channels),
> .mma_scales = { {0, 38307}, {0, 76614}, {0, 153228} },
> - .ev_cfg = MMA8452_FF_MT_CFG,
> - .ev_cfg_ele = MMA8452_FF_MT_CFG_ELE,
> - .ev_cfg_chan_shift = 3,
> - .ev_src = MMA8452_FF_MT_SRC,
> - .ev_src_xe = MMA8452_FF_MT_SRC_XHE,
> - .ev_src_ye = MMA8452_FF_MT_SRC_YHE,
> - .ev_src_ze = MMA8452_FF_MT_SRC_ZHE,
> - .ev_ths = MMA8452_FF_MT_THS,
> - .ev_ths_mask = MMA8452_FF_MT_THS_MASK,
> - .ev_count = MMA8452_FF_MT_COUNT,
> },
> [fxls8471] = {
> .chip_id = FXLS8471_DEVICE_ID,
> .channels = mma8451_channels,
> .num_channels = ARRAY_SIZE(mma8451_channels),
> .mma_scales = { {0, 2394}, {0, 4788}, {0, 9577} },
> - .ev_cfg = MMA8452_TRANSIENT_CFG,
> - .ev_cfg_ele = MMA8452_TRANSIENT_CFG_ELE,
> - .ev_cfg_chan_shift = 1,
> - .ev_src = MMA8452_TRANSIENT_SRC,
> - .ev_src_xe = MMA8452_TRANSIENT_SRC_XTRANSE,
> - .ev_src_ye = MMA8452_TRANSIENT_SRC_YTRANSE,
> - .ev_src_ze = MMA8452_TRANSIENT_SRC_ZTRANSE,
> - .ev_ths = MMA8452_TRANSIENT_THS,
> - .ev_ths_mask = MMA8452_TRANSIENT_THS_MASK,
> - .ev_count = MMA8452_TRANSIENT_COUNT,
> },
> };
>
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
+}
> +
> +ret = regmap_update_bits(lmp92001->regmap, LMP92001_CAD3, 1, cad3);
> +if (ret < 0)
> +{
> +dev_err(&pdev->dev, "failed to enable channel 17
> (temperature)\n");
> +return ret;
>
of_property_read_u8(np, "ti,lmp92001-dac-outx", &outx);
> +cdac |= outx << 1;
> +
> +of_property_read_u8(np, "ti,lmp92001-dac-gang", &gang);
> +cdac |= gang << 2;
> +
> +ret = regmap_update_bits(lmp92001->regmap, LMP92001_CDAC, 7, cdac);
> +if (ret < 0)
> +return ret;
> +
> +platform_set_drvdata(pdev, indio_dev);
> +
> +return iio_device_register(indio_dev);
> +}
> +
> +static int lmp92001_dac_remove(struct platform_device *pdev)
can use devm_iio_device_register() if _remove() is essentially empty
> +{
> +struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> +
> +iio_device_unregister(indio_dev);
> +
> +return 0;
> +}
> +
> +static struct platform_driver lmp92001_dac_driver = {
> +.driver.name= "lmp92001-dac",
> +.driver.owner = THIS_MODULE,
> +.probe = lmp92001_dac_probe,
THIS_MODULE not needed anymore
> +.remove = lmp92001_dac_remove,
> +};
> +
> +static int __init lmp92001_dac_init(void)
> +{
> +return platform_driver_register(&lmp92001_dac_driver);
> +}
> +subsys_initcall(lmp92001_dac_init);
> +
> +static void __exit lmp92001_dac_exit(void)
> +{
> +platform_driver_unregister(&lmp92001_dac_driver);
> +}
> +module_exit(lmp92001_dac_exit);
> +
> +MODULE_AUTHOR("Abhisit Sangjan ");
> +MODULE_DESCRIPTION("IIO DAC interface for TI LMP92001");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:lmp92001-dac");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
quot;Cannot read from device.\n");
> + return ret;
> + }
> +
> + return devm_iio_device_register(&client->dev, indio_dev);
> +}
> +
> +static const struct i2c_device_id ltc2471_i2c_id[] = {
> + { "ltc2471", ltc2471 },
> + { "ltc2473", ltc2473 },
> + {}
> +};
> +MODULE_DEVICE_TABLE(i2c, ltc2471_i2c_id);
> +
> +static struct i2c_driver ltc2471_i2c_driver = {
> + .driver = {
> + .name = "ltc2471",
> + },
> + .probe= ltc2471_i2c_probe,
> + .id_table = ltc2471_i2c_id,
> +};
> +
> +module_i2c_driver(ltc2471_i2c_driver);
> +
> +MODULE_DESCRIPTION("LTC2471/LTC2473 Sensor Driver");
maybe "ADC driver"
> +MODULE_AUTHOR("Topic Embedded Products");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
(data->vcc_reg)) {
> + ret = PTR_ERR(data->vcc_reg);
> + dev_err(&client->dev,
> + "Failed to get vcc_reg regulator: %d\n", ret);
> + return ret;
> + }
> + }
>
"samplerate");
> +
> + if (!indio_dev->pollfunc) {
> + ret = -ENOMEM;
> + goto dealloc_kfifo;
> + }
> +
> + ret = dln2_register_event_cb(pdev, DLN2_ADC_CONDITION_MET_EV,
> + dln2_adc_event);
> + if (ret) {
> + dev_err(dev, "failed to register event cb: %d\n", ret);
> + goto dealloc_pollfunc;
> + }
> +
> + ret = iio_device_register(indio_dev);
> + if (ret) {
> + dev_err(dev, "failed to register iio device: %d\n", ret);
> + goto dealloc_pollfunc;
> + }
> +
> + return 0;
> +
> +dealloc_pollfunc:
> + iio_dealloc_pollfunc(indio_dev->pollfunc);
> +dealloc_kfifo:
> +dealloc_trigger:
> + iio_trigger_unregister(dln2->trig);
> +dealloc_dev:
> +
> + return ret;
> +}
> +
> +static int dln2_adc_remove(struct platform_device *pdev)
> +{
> + struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> + struct dln2_adc *dln2 = iio_priv(indio_dev);
> +
> + iio_device_unregister(indio_dev);
> + dln2_unregister_event_cb(pdev, DLN2_ADC_CONDITION_MET_EV);
> + iio_trigger_unregister(dln2->trig);
> + iio_dealloc_pollfunc(indio_dev->pollfunc);
> +
> + return 0;
> +}
> +
> +static struct platform_driver dln2_adc_driver = {
> + .driver.name= DLN2_ADC_MOD_NAME,
> + .probe = dln2_adc_probe,
> + .remove = dln2_adc_remove,
> +};
> +
> +module_platform_driver(dln2_adc_driver);
> +
> +MODULE_AUTHOR("Jack Andersen +MODULE_DESCRIPTION("Driver for the Diolan DLN2 ADC interface");
> +MODULE_LICENSE("GPL v2");
> +MODULE_ALIAS("platform:dln2-adc");
> diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
> index 704e189..a22ab8c 100644
> --- a/drivers/mfd/dln2.c
> +++ b/drivers/mfd/dln2.c
> @@ -53,6 +53,7 @@ enum dln2_handle {
> DLN2_HANDLE_GPIO,
> DLN2_HANDLE_I2C,
> DLN2_HANDLE_SPI,
> + DLN2_HANDLE_ADC,
> DLN2_HANDLES
> };
>
> @@ -663,6 +664,12 @@ static int dln2_start_rx_urbs(struct dln2_dev *dln2,
> gfp_t gfp)
> .port = 0,
> };
>
> +/* Only one ADC port supported */
> +static struct dln2_platform_data dln2_pdata_adc = {
> + .handle = DLN2_HANDLE_ADC,
> + .port = 0,
> +};
> +
> static const struct mfd_cell dln2_devs[] = {
> {
> .name = "dln2-gpio",
> @@ -679,6 +686,11 @@ static int dln2_start_rx_urbs(struct dln2_dev *dln2,
> gfp_t gfp)
> .platform_data = &dln2_pdata_spi,
> .pdata_size = sizeof(struct dln2_platform_data),
> },
> + {
> + .name = "dln2-adc",
> + .platform_data = &dln2_pdata_adc,
> + .pdata_size = sizeof(struct dln2_platform_data),
> + },
> };
>
> static void dln2_stop(struct dln2_dev *dln2)
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
dln2_register_event_cb(pdev, DLN2_ADC_CONDITION_MET_EV,
> + dln2_adc_event);
> + if (ret) {
> + dev_err(dev, "failed to register event cb: %d\n", ret);
> + goto dealloc_pollfunc;
> + }
> +
> + ret = iio_device_register(indio_dev);
> + if (ret) {
> + dev_err(dev, "failed to register iio device: %d\n", ret);
> + goto dealloc_pollfunc;
> + }
> +
> + dev_info(dev, "DLN2 ADC driver loaded\n");
avoid this kind of logging
> +
> + return 0;
> +
> +dealloc_pollfunc:
> + iio_dealloc_pollfunc(indio_dev->pollfunc);
> +dealloc_kfifo:
> +dealloc_trigger:
> + iio_trigger_unregister(dln2->trig);
> +dealloc_dev:
> +
> + return ret;
> +}
> +
> +static int dln2_adc_remove(struct platform_device *pdev)
> +{
> + struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> + struct dln2_adc *dln2 = iio_priv(indio_dev);
> +
> + dev_info(&indio_dev->dev, "DLN2 ADC driver unloaded\n");
no such logging please
> +
> + dln2_unregister_event_cb(pdev, DLN2_ADC_CONDITION_MET_EV);
should be after device_unregister
> + iio_device_unregister(indio_dev);
> + iio_trigger_unregister(dln2->trig);
> + iio_dealloc_pollfunc(indio_dev->pollfunc);
> +
> + return 0;
> +}
> +
> +static struct platform_driver dln2_adc_driver = {
> + .driver.name= DLN2_ADC_MOD_NAME,
> + .probe = dln2_adc_probe,
> + .remove = dln2_adc_remove,
> +};
> +
> +module_platform_driver(dln2_adc_driver);
> +
> +MODULE_AUTHOR("Jack Andersen +MODULE_DESCRIPTION("Driver for the Diolan DLN2 ADC interface");
> +MODULE_LICENSE("GPL v2");
> +MODULE_ALIAS("platform:dln2-adc");
> diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
> index 704e189..a22ab8c 100644
> --- a/drivers/mfd/dln2.c
> +++ b/drivers/mfd/dln2.c
> @@ -53,6 +53,7 @@ enum dln2_handle {
> DLN2_HANDLE_GPIO,
> DLN2_HANDLE_I2C,
> DLN2_HANDLE_SPI,
> + DLN2_HANDLE_ADC,
> DLN2_HANDLES
> };
>
> @@ -663,6 +664,12 @@ static int dln2_start_rx_urbs(struct dln2_dev *dln2,
> gfp_t gfp)
> .port = 0,
> };
>
> +/* Only one ADC port supported */
> +static struct dln2_platform_data dln2_pdata_adc = {
> + .handle = DLN2_HANDLE_ADC,
> + .port = 0,
> +};
> +
> static const struct mfd_cell dln2_devs[] = {
> {
> .name = "dln2-gpio",
> @@ -679,6 +686,11 @@ static int dln2_start_rx_urbs(struct dln2_dev *dln2,
> gfp_t gfp)
> .platform_data = &dln2_pdata_spi,
> .pdata_size = sizeof(struct dln2_platform_data),
> },
> + {
> + .name = "dln2-adc",
> + .platform_data = &dln2_pdata_adc,
> + .pdata_size = sizeof(struct dln2_platform_data),
> + },
> };
>
> static void dln2_stop(struct dln2_dev *dln2)
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
Commit-ID: d15bc69affc57d7985a01745ca28eafa0772325b
Gitweb: http://git.kernel.org/tip/d15bc69affc57d7985a01745ca28eafa0772325b
Author: Peter Meerwald-Stadler
AuthorDate: Tue, 30 May 2017 21:41:03 +0200
Committer: Thomas Gleixner
CommitDate: Tue, 20 Jun 2017 21:33:55 +0200
timers: Fix
Signed-off-by: Peter Meerwald-Stadler
Cc: John Stultz
Cc: Thomas Gleixner
Cc: triv...@rustcorp.com.au
---
kernel/time/timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 152a706ef8b8..709a404bd133 100644
--- a/kernel/time
if (ret != -ERESTARTSYS)
> - zpa2326_warn(indio_dev, "no one shot interrupt occurred (%d)",
> - ret);
> + } else if (timeout < 0) {
> + zpa2326_warn(indio_dev, "wait for one shot interrupt canceled");
> + ret = -ERESTARTSYS;
> + }
>
> return ret;
> }
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
lt; 0)
> + return r;
> +
> + /* Turn on temperature measurement in the background */
> + r = regmap_write_bits(data->regmap, MEAS_CFG, MEAS_CTRL_BITS,
> + TEMP_EN | BACKGROUND);
should be disabled again if _probe fails lateron
> +
*indio_dev,
> struct zpa2326_private *private,
> int irq)
> {
> int err;
>
> private->irq = irq;
>
> if (irq <= 0) {
> /*
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
adc1x8s102_state *st = iio_priv(indio_dev);
> +
> + iio_device_unregister(indio_dev);
> + iio_triggered_buffer_cleanup(indio_dev);
> +
> + regulator_disable(st->reg);
> +
> + return 0;
> +}
> +
> +static const struct spi_device_id adc1x8s102_id[] =
_channels); i++) {
> + if (stm32_dac_channels[i].channel == channel)
> + break;
> + }
> + if (i >= ARRAY_SIZE(stm32_dac_channels)) {
> + dev_err(&indio_dev->dev, "Invalid st,dac-channel\n");
> + return -EINVAL;
> + }
> +
> + indio_dev->channels = &stm32_dac_channels[i];
> + indio_dev->num_channels = 1;
this is unusual, a comment would be helpful
why not expose both channels?
> +
> + return 0;
> +};
> +
> +static int stm32_dac_probe(struct platform_device *pdev)
> +{
> + struct device_node *np = pdev->dev.of_node;
> + struct iio_dev *indio_dev;
> + struct stm32_dac *dac;
> + int ret;
> +
> + if (!np)
> + return -ENODEV;
> +
> + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*dac));
> + if (!indio_dev)
> + return -ENOMEM;
> + platform_set_drvdata(pdev, indio_dev);
> +
> + dac = iio_priv(indio_dev);
> + dac->common = dev_get_drvdata(pdev->dev.parent);
> + indio_dev->name = dev_name(&pdev->dev);
> + indio_dev->dev.parent = &pdev->dev;
> + indio_dev->dev.of_node = pdev->dev.of_node;
> + indio_dev->info = &stm32_dac_iio_info;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> +
> + ret = stm32_dac_chan_of_init(indio_dev);
> + if (ret < 0)
> + return ret;
> +
> + ret = iio_device_register(indio_dev);
just
return iio_device_register();
candidate for devm_ due to empty _remove()
> + if (ret)
> + return ret;
> +
> + return 0;
> +}
> +
> +static int stm32_dac_remove(struct platform_device *pdev)
> +{
> + struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> +
> + iio_device_unregister(indio_dev);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id stm32_dac_of_match[] = {
> + { .compatible = "st,stm32-dac", },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, stm32_dac_of_match);
> +
> +static struct platform_driver stm32_dac_driver = {
> + .probe = stm32_dac_probe,
> + .remove = stm32_dac_remove,
> + .driver = {
> + .name = "stm32-dac",
> + .of_match_table = stm32_dac_of_match,
> + },
> +};
> +module_platform_driver(stm32_dac_driver);
> +
> +MODULE_ALIAS("platform:stm32-dac");
> +MODULE_AUTHOR("Amelie Delaunay ");
> +MODULE_DESCRIPTION("STMicroelectronics STM32 DAC driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
IO_DIRECT_MODE;
> > - indio_dev->channels = max11100_channels,
> > - indio_dev->num_channels = ARRAY_SIZE(max11100_channels),
> > + indio_dev->channels = max11100_channels;
> > + indio_dev->num_channels = ARRAY_SIZE(max11100_channels);
> >
> > state->vref_reg = devm_regulator_get(&spi->dev, "vref");
> > if (IS_ERR(state->vref_reg))
> > --
> > 2.11.0
> >
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
io_device_register(&client->dev, indio_dev);
no devm_ since we have a non-empty _remove()?
> + if (ret < 0)
> + goto err_regulator_disable;
> +
> + return 0;
> +
> +err_regulator_disable:
> + regulator_disable(st->ref);
> +
> + return ret;
> +}
> +
> +static int ltc2497_remove(struct i2c_client *client)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(client);
> + struct ltc2497_st *st = iio_priv(indio_dev);
> +
> + regulator_disable(st->ref);
> +
> + return 0;
> +}
> +
> +static const struct i2c_device_id ltc2497_id[] = {
> + { "ltc2497", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, ltc2497_id);
> +
> +static const struct of_device_id ltc2497_of_match[] = {
> + { .compatible = "lltc,ltc2497", },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, ltc2497_of_match);
> +
> +static struct i2c_driver ltc2497_driver = {
> + .driver = {
> + .name = "ltc2497",
> + .of_match_table = of_match_ptr(ltc2497_of_match),
> + },
> + .probe = ltc2497_probe,
> + .remove = ltc2497_remove,
> + .id_table = ltc2497_id,
> +};
> +module_i2c_driver(ltc2497_driver);
> +
> +MODULE_AUTHOR("Michael Hennerich ");
> +MODULE_DESCRIPTION("Linear Technology LTC2497 ADC driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
k_disable_unprepare(data->clk_scaler->clk);
> + clk_hw_unregister_divider(data->clk_scaler);
> +
> +scaler_error:
> + clk_hw_unregister_divider(data->clk_prescaler);
> +
> +prescaler_error:
> +resource_error:
> + return ret;
> +}
> +
> +static int asp
DATA |
> + I2C_FUNC_SMBUS_READ_I2C_BLOCK))
> + return -ENODEV;
> +
> + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + data = iio_priv(indio_dev);
> + i2c_set_clientdata(client, indio_dev);
> + data->client = client;
> + mutex_init(&data->lock);
> +
> + indio_dev->dev.parent = &client->dev;
> + indio_dev->name = id->name;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->info = &sht21_info;
> + indio_dev->channels = sht21_channels;
> + indio_dev->num_channels = ARRAY_SIZE(sht21_channels);
> +
> + ret = sht21_soft_reset(data);
> + if (ret)
> + return ret;
> +
> + ret = iio_triggered_buffer_setup(indio_dev, NULL,
> + sht21_trigger_handler, NULL);
> + if (ret)
> + return ret;
> +
> + ret = iio_device_register(indio_dev);
> + if (ret)
> + iio_triggered_buffer_cleanup(indio_dev);
> +
> + return ret;
> +}
> +
> +static int sht21_remove(struct i2c_client *client)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(client);
> +
> + iio_device_unregister(indio_dev);
> + iio_triggered_buffer_cleanup(indio_dev);
> +
> + return 0;
> +}
> +
> +static const struct i2c_device_id sht21_id[] = {
> + { "sht21", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, sht21_id);
> +
> +static const struct of_device_id sht21_of_match[] = {
> + { .compatible = "sensirion,sht21" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, sht21_of_match);
> +
> +static struct i2c_driver sht21_driver = {
> + .driver = {
> + .name = SHT21_DRV_NAME,
> + .of_match_table = of_match_ptr(sht21_of_match),
> + },
> + .id_table = sht21_id,
> + .probe = sht21_probe,
> + .remove = sht21_remove,
> +};
> +module_i2c_driver(sht21_driver);
> +
> +MODULE_DESCRIPTION("Sensirion SHT21 relative humidity and temperature sensor
> driver");
> +MODULE_AUTHOR("Tomasz Duszynski ");
> +MODULE_LICENSE("GPL v2");
> --
> 2.11.1
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
};
>
> static const char * const iio_modifier_names[] = {
> diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> index ffafd6c25a48..52696e251c4d 100644
> --- a/include/uapi/linux/iio/types.h
> +++ b/include/uapi/linux/iio/types.h
> @@ -43,6 +43,7 @@ enum iio
1_info;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->channels = dsm501_channels;
> + indio_dev->num_channels = ARRAY_SIZE(dsm501_channels);
> +
> + return devm_iio_device_register(&pdev->dev, indio_dev);
> +}
> +
> +static const struct of_device_id dsm501_id[] = {
> + {
> + .compatible = "samyoung,dsm501",
> + .data = dsm501_number_concentartion,
type: concentration
> + },
> + {
> + .compatible = "shinyei,ppd42ns",
> + .data = ppd42ns_number_concentration,
> + },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, dsm501_id);
> +
> +static struct platform_driver dsm501_driver = {
> + .driver = {
> + .name = DSM501_DRV_NAME,
> + .of_match_table = of_match_ptr(dsm501_id)
> + },
> + .probe = dsm501_probe
> +};
> +module_platform_driver(dsm501_driver);
> +
> +MODULE_AUTHOR("Tomasz Duszynski ");
> +MODULE_DESCRIPTION("Samyoung DSM501 particle sensor driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
> >>>> .type = IIO_TEMP,
> >>>> .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> >>>> -BIT(IIO_CHAN_INFO_SCALE),
> >>>> +.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
> >>>> .scan_index = 1,
> >>>> .scan_type = {
> >>>> .sign = 's',
> >>>>
> >>>
> >>
> >
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
gt;.sign = 'u',
> >> @@ -203,7 +203,7 @@ static const struct iio_chan_spec mpl3115_channels[] =
> >> {
> >>{
> >>.type = IIO_TEMP,
> >>.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> >> - BIT(IIO_CHAN_INFO_SCALE),
> >> + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
> >>.scan_index = 1,
> >>.scan_type = {
> >>.sign = 's',
> >>
> >
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
.scan_index = 1,
> .scan_type = {
> .sign = 's',
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
or distance measuring using
> > GPIOs");
> > +MODULE_LICENSE("GPL");
> > +MODULE_ALIAS("platform:srf04");
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
= "ti,lm3533-als", },
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, lm3533_als_of_match);
> +
> static struct platform_driver lm3533_als_driver = {
> .driver = {
> .name = "lm3533-als",
> + .of_match_table = lm3533_als_of_match,
> },
> .probe = lm3533_als_probe,
> .remove = lm3533_als_remove,
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
> + See Documentation/devicetree/bindings/gpio/gpio.txt
> +
> +Example:
> +srf04@0 {
> + compatible = "devantech,srf04";
> + trig-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
> + echo-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
> +};
> +
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
modes = INDIO_DIRECT_MODE;
> + indio_dev->channels = srf04_chan_spec;
> + indio_dev->num_channels = ARRAY_SIZE(srf04_chan_spec);
> +
> + return devm_iio_device_register(dev, indio_dev);
you can't use devm_iio_device_register() if you need/have a _remove()
> +}
> +
> +static int srf04_remove(struct platform_device *pdev)
> +{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct srf04_data *data = iio_priv(indio_dev); // (but not needed anymore)
> + struct srf04_data *data = NULL;
> + struct iio_dev *indio_dev;
> +
> + indio_dev = platform_get_drvdata(pdev);
> + data = iio_priv(indio_dev);
> +
> + free_irq(data->irqnr, indio_dev);
I suggest to use in _probe()
devm_request_irq()
iio_device_register()
and in _remove() just
iio_device_unregister()
> +
> + return 0;
> +}
> +
> +static const struct of_device_id of_srf04_match[] = {
> + { .compatible = "devantech,srf04", },
> + {},
> +};
> +
> +MODULE_DEVICE_TABLE(of, of_srf04_match);
> +
> +static struct platform_driver srf04_driver = {
> + .probe = srf04_probe,
> + .remove = srf04_remove,
> + .driver = {
> + .name = "srf04-gpio",
> + .of_match_table = of_srf04_match,
> + },
> +};
> +
> +module_platform_driver(srf04_driver);
> +
> +MODULE_AUTHOR("Andreas Klinger ");
> +MODULE_DESCRIPTION("SRF04 ultrasonic sensor for distance measuring using
> GPIOs");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:srf04");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
>;
> >> +
> >> + channels = "sync-1", "", "out";
> >> + };
> >> +
> >> +
> >> + /*
> >> + * Three parallel muxes with one mux controller, useful e.g. if
> >> + * the adc is differential, thus needing two signals to be muxed
> >> + * simultaneously for correct operation.
> >> + */
> >> + &i2c0 {
> >> + pmux: adg792a@50 {
> >> + compatible = "adi,adg792a";
> >> + reg = <0x50>;
> >> + #mux-control-cells = <0>;
> >> + adi,parallel;
> >> + };
> >> + };
> >> +
> >> + diff-adc-mux {
> >> + compatible = "io-channel-mux";
> >> + io-channels = <&adc 0>;
> >> + io-channel-names = "parent";
> >> +
> >> + mux-controls = <&pmux>;
> >> +
> >> + channels = "sync-1", "", "out";
> >> + };
> >> --
> >> 2.1.4
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> >> the body of a message to majord...@vger.kernel.org
> >> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
> Driver was checking for direct mode but not locking it. Use
> claim/release helper functions to guarantee the device stays
> in direct mode during raw writes.
looks good,
Acked-by: Peter Meerwald-Stadler
> Signed-off-by: Alison Schofield
> ---
> drivers/iio/magnetome
t *client,
> + const struct i2c_device_id *id)
> +{
> + struct iio_dev *indio_dev;
> + struct srf08_data *data;
> +
> + if (!i2c_check_functionality(client->adapter,
> + I2C_FUNC_SMBUS_READ_BYTE_DATA |
> + I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
WORD_DATA if using word_swapped() above
> + return -ENODEV;
> +
> + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + data = iio_priv(indio_dev);
> + i2c_set_clientdata(client, indio_dev);
> + data->client = client;
> +
> + /* set default values of device */
> + data->gain = 1025;
use some defines, where do these magics come from?
> + data->range_mm = 11008;
> +
> + indio_dev->name = dev_name(&client->dev);
> + indio_dev->dev.parent = &client->dev;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->info = &srf08_info;
> + indio_dev->channels = srf08_channels;
> + indio_dev->num_channels = ARRAY_SIZE(srf08_channels);
> +
> + mutex_init(&data->lock);
> +
> + return devm_iio_device_register(&client->dev, indio_dev);
> +}
> +
> +static const struct i2c_device_id srf08_id[] = {
> + { "srf08", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, srf08_id);
> +
> +static struct i2c_driver srf08_driver = {
> + .driver = {
> + .name = "srf08",
> + },
> + .probe = srf08_probe,
> + .id_table = srf08_id,
> +};
> +module_i2c_driver(srf08_driver);
> +
> +MODULE_AUTHOR("Andreas Klinger ");
> +MODULE_DESCRIPTION("Devantech SRF08 ultrasonic ranger driver");
> +MODULE_LICENSE("GPL");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
ximately to fit into a 32 bit number:
> + * 1 LSB = (AVDD * 100) / GAIN / 1678 [10^-9 mV]
> + */
> + ret = regulator_get_voltage(hx711_data->reg_avdd);
> + if (ret < 0)
disable regulator
> + return ret;
> + /* we need 10^-9 mV */
> + ret *= 100;
> +
> + for (i = 0; i < HX711_GAIN_MAX; i++)
> + hx711_gain_to_scale[i].scale =
> + ret / hx711_gain_to_scale[i].gain / 1678;
> +
> + hx711_data->gain_set = 128;
> + hx711_data->gain_chan_a = 128;
> +
> + platform_set_drvdata(pdev, iio);
> +
> + iio->name = "hx711";
> + iio->dev.parent = &pdev->dev;
> + iio->info = &hx711_iio_info;
> + iio->modes = INDIO_DIRECT_MODE;
> + iio->channels = hx711_chan_spec;
> + iio->num_channels = ARRAY_SIZE(hx711_chan_spec);
> +
> + return devm_iio_device_register(dev, iio);
disable regulator if this fails
> +}
> +
> +static int hx711_remove(struct platform_device *pdev)
> +{
> + struct hx711_data *hx711_data;
> + struct iio_dev *iio;
> +
> + iio = platform_get_drvdata(pdev);
> + hx711_data = iio_priv(iio);
> +
devm_iio_device_register and _remove() doesn't mix
> + regulator_disable(hx711_data->reg_avdd);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id of_hx711_match[] = {
> + { .compatible = "avia,hx711", },
> + {},
> +};
> +
> +MODULE_DEVICE_TABLE(of, of_hx711_match);
> +
> +static struct platform_driver hx711_driver = {
> + .probe = hx711_probe,
> + .remove = hx711_remove,
> + .driver = {
> + .name = "hx711-gpio",
> + .of_match_table = of_hx711_match,
> + },
> +};
> +
> +module_platform_driver(hx711_driver);
> +
> +MODULE_AUTHOR("Andreas Klinger ");
> +MODULE_DESCRIPTION("HX711 bitbanging driver - ADC for weight cells");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:hx711-gpio");
> +
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
iio->modes = INDIO_DIRECT_MODE;
> + iio->channels = hx711_chan_spec;
> + iio->num_channels = ARRAY_SIZE(hx711_chan_spec);
> +
> + dev_err(hx711_data->dev, "initialized\n");
excessive logging, please remove
> +
> + return devm_iio_device_register(dev, iio);
> +
> +err:
> + return ret;
just return directly without goto?
> +}
> +
> +
> +static int hx711_suspend(struct device *dev)
> +{
pointless, just don't do PM support
> + return 0;
> +}
> +
> +static int hx711_resume(struct device *dev)
> +{
> + return 0;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(hx711_pm_ops, hx711_suspend, hx711_resume);
> +
> +
> +static const struct of_device_id of_hx711_match[] = {
> + { .compatible = "avia,hx711", },
> + {},
> +};
> +
> +MODULE_DEVICE_TABLE(of, of_hx711_match);
> +
> +static struct platform_driver hx711_driver = {
> + .probe = hx711_probe,
> + .driver = {
> + .name = "hx711-gpio",
> + .pm = &hx711_pm_ops,
> + .of_match_table = of_hx711_match,
> + },
> +};
> +
> +module_platform_driver(hx711_driver);
> +
> +MODULE_AUTHOR("Andreas Klinger ");
> +MODULE_DESCRIPTION("HX711 bitbanging driver - ADC for weight cells");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:hx711-gpio");
> +
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -32,6 +32,7 @@ atlas Atlas Scientific LLC
> atmelAtmel Corporation
> auo AU Optronics Corporation
> avago Avago Technologies
> +avia avia semiconductor
> avic Shanghai AVIC Optoelectronics Co., Ltd.
> axis Axis Communications AB
> boe BOE Technology Group Co., Ltd.
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
8 100644
> --- a/include/uapi/linux/iio/types.h
> +++ b/include/uapi/linux/iio/types.h
> @@ -80,6 +80,7 @@ enum iio_modifier {
> IIO_MOD_CO2,
> IIO_MOD_VOC,
> IIO_MOD_LIGHT_UV,
> + IIO_MOD_DOUBLE_TAP,
> };
>
> enum iio_event_type {
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
that *val * scale gives mV
> > +
> > + return IIO_VAL_INT;
> > + case IIO_CHAN_INFO_SCALE:
> > + ret = ti_ads7950_get_range(st);
> > + if (ret < 0)
> > + return ret;
> > +
> > + *val = ret;
> > + *val2 = chan->scan_type.realbits;
> > +
> > + return IIO_VAL_FRACTIONAL_LOG2;
> > + }
> > +
> > + return -EINVAL;
> > +}
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
ge = 1;
> > + st->scan_single_xfer[2].rx_buf = &st->rx_buf[0];
> > + st->scan_single_xfer[2].len = 2;
> > +
> Use spi_message_init_with_transfers (really minor but why not ;)
> > + spi_message_init(&st->scan_single_msg);
> > + spi_message_add_tail(&st->scan_single_xfer[0], &st->scan_single_msg);
> > + spi_message_add_tail(&st->scan_single_xfer[1], &st->scan_single_msg);
> > + spi_message_add_tail(&st->scan_single_xfer[2], &st->scan_single_msg);
> > +
> > + st->reg = devm_regulator_get(&spi->dev, "refin");
> > + if (IS_ERR(st->reg)) {
> > + dev_err(&spi->dev, "Failed get get regulator \"refin\"\n");
> > + return PTR_ERR(st->reg);
> > + }
> > +
> > + ret = regulator_enable(st->reg);
> > + if (ret) {
> > + dev_err(&spi->dev, "Failed to enable regulator \"refin\"\n");
> > + return ret;
> > + }
> > +
> > + ret = iio_triggered_buffer_setup(indio_dev, NULL,
> > +&ti_ads79xx_trigger_handler, NULL);
> > + if (ret) {
> > + dev_err(&spi->dev, "Failed to setup triggered buffer\n");
> > + goto error_disable_reg;
> > + }
> > +
> > + ret = iio_device_register(indio_dev);
> > + if (ret) {
> > + dev_err(&spi->dev, "Failed to register iio device\n");
> > + goto error_cleanup_ring;
> > + }
> > +
> Don't bother with this. It's easy to tell from sysfs or the results of the
> probe that it worked or not. This just puts uninformative noise in the
> logs (different matter if there is a serial number of similar that provides
> additional info!)
> > + dev_info(&spi->dev, "Registered %s\n", indio_dev->name);
> > +
> > + return 0;
> > +
> > +error_cleanup_ring:
> > + iio_triggered_buffer_cleanup(indio_dev);
> > +error_disable_reg:
> > + regulator_disable(st->reg);
> > +
> > + return ret;
> > +}
> > +
> > +static int ti_ads79xx_remove(struct spi_device *spi)
> > +{
> > + struct iio_dev *indio_dev = spi_get_drvdata(spi);
> > + struct ti_ads79xx_state *st = iio_priv(indio_dev);
> > +
> > + iio_device_unregister(indio_dev);
> > + iio_triggered_buffer_cleanup(indio_dev);
> > + regulator_disable(st->reg);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct spi_device_id ti_ads79xx_id[] = {
> > + {"ti-ads7950", ADS7950},
> > + {"ti-ads7951", ADS7951},
> > + {"ti-ads7952", ADS7952},
> > + {"ti-ads7953", ADS7953},
> > + {"ti-ads7954", ADS7954},
> > + {"ti-ads7955", ADS7955},
> > + {"ti-ads7956", ADS7956},
> > + {"ti-ads7957", ADS7957},
> > + {"ti-ads7958", ADS7958},
> > + {"ti-ads7959", ADS7959},
> > + {"ti-ads7960", ADS7960},
> > + {"ti-ads7961", ADS7961},
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(spi, ti_ads79xx_id);
> > +
> > +static struct spi_driver ti_ads79xx_driver = {
> > + .driver = {
> > + .name = "ti-ads79xx",
> > + },
> > + .probe = ti_ads79xx_probe,
> > + .remove = ti_ads79xx_remove,
> > + .id_table = ti_ads79xx_id,
> > +};
> > +module_spi_driver(ti_ads79xx_driver);
> > +
> > +MODULE_AUTHOR("David Lechner ");
> > +MODULE_DESCRIPTION("TI ADS79XX ADC");
> > +MODULE_LICENSE("GPL v2");
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
R_ERR(dac->dpot) != -EPROBE_DEFER)
> > + dev_err(dev, "failed to get dpot input channel\n");
> > + return PTR_ERR(dac->dpot);
> > + }
> > +
> > + ret = iio_get_channel_type(dac->dpot, &type);
> > + if (ret < 0)
> > + return ret;
> > +
> > + if (type != IIO_RESISTANCE) {
> > + dev_err(dev, "dpot is of the wrong type\n");
> > + return -EINVAL;
> > + }
> > +
> > + ret = dpot_dac_channel_max_ohms(indio_dev);
> > + if (ret < 0)
> > + return ret;
> > + dac->max_ohms = ret;
> > + dev_info(dev, "dpot max is %d\n", dac->max_ohms);
> Given we can query this (indirectly) from the dpot itself, I'd drop this now.
max_ohms is u32, so this should be %u not %d?
>
> > +
> > + ret = regulator_enable(dac->vref);
> > + if (ret) {
> > + dev_err(dev, "failed to enable the vref regulator\n");
> > + return ret;
> > + }
> > +
> > + ret = iio_device_register(indio_dev);
> > + if (ret) {
> > + dev_err(dev, "failed to register iio device\n");
> > + goto disable_reg;
> > + }
> > +
> > + return 0;
> > +
> > +disable_reg:
> > + regulator_disable(dac->vref);
> > + return ret;
> > +}
> > +
> > +static int dpot_dac_remove(struct platform_device *pdev)
> > +{
> > + struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> > + struct dpot_dac *dac = iio_priv(indio_dev);
> > +
> > + iio_device_unregister(indio_dev);
> > + regulator_disable(dac->vref);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id dpot_dac_match[] = {
> > + { .compatible = "dpot-dac" },
> > + { /* sentinel */ }
> > +};
> > +MODULE_DEVICE_TABLE(of, dpot_dac_match);
> > +
> > +static struct platform_driver dpot_dac_driver = {
> > + .probe = dpot_dac_probe,
> > + .remove = dpot_dac_remove,
> > + .driver = {
> > + .name = "iio-dpot-dac",
> > + .of_match_table = dpot_dac_match,
> > + },
> > +};
> > +module_platform_driver(dpot_dac_driver);
> > +
> > +MODULE_DESCRIPTION("DAC emulation driver using a digital potentiometer");
> > +MODULE_AUTHOR("Peter Rosin ");
> > +MODULE_LICENSE("GPL v2");
> >
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
; > +++ b/include/linux/iio/iio.h
> > @@ -315,6 +315,23 @@ static inline bool iio_channel_has_info(const struct
> > iio_chan_spec *chan,
> > (chan->info_mask_shared_by_all & BIT(type));
> > }
> >
> > +/**
> > + * iio_channel_has_available() - Checks if a channel has an available
> > attribute
> > + * @chan: The channel to be queried
> > + * @type: Type of the available attribute to be checked
> > + *
> > + * Returns true if the channels supports reporting available values for the
channel
> > + * given attribute type, false otherwise.
> > + */
> > +static inline bool iio_channel_has_available(const struct iio_chan_spec
> > *chan,
> > +enum iio_chan_info_enum type)
> > +{
> > + return (chan->info_mask_separate_available & BIT(type)) |
> > + (chan->info_mask_shared_by_type_available & BIT(type)) |
> > + (chan->info_mask_shared_by_dir_available & BIT(type)) |
> > + (chan->info_mask_shared_by_all_available & BIT(type));
> > +}
> > +
> > #define IIO_CHAN_SOFT_TIMESTAMP(_si) {
> > \
> > .type = IIO_TIMESTAMP, \
> > .channel = -1, \
> >
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
ndex 1cd38a7e0064..c68b72088945 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -6111,6 +6111,12 @@ L: linux-me...@vger.kernel.org
> S: Maintained
> F: drivers/media/rc/iguanair.c
>
> +IIO DIGITAL POTENTIOMETER DAC
> +M: Peter Rosin
> +L: linux-...@vger.kernel.org
> +S: Maintained
> +F: Documentation/devicetree/bindings/iio/dac/dpot-dac.txt
> +
> IIO SUBSYSTEM AND DRIVERS
> M: Jonathan Cameron
> R: Hartmut Knaack
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
is ull or s32, right? Given
> that assumption, I'm just dropping the cast instead. The LL specifier
> on the constant should promote *val anyway.
what I meant to pick upon was mixing
s64 with unsigned long long with LL in the code that follows
anything simpler and more consistent would be good
thanks, p.
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
envelope-detector,dac-max = <255>;
> + envelope-detector,comp-interval-ms = <50>;
> + };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8c8aae24b96b..4b6f6ec1b703 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -6118,6 +6118,12 @@ S: Maintained
> F: Documentation/devicetree/bindings/iio/dac/dpot-dac.txt
> F: drivers/iio/dac/dpot-dac.c
>
> +IIO ENVELOPE DETECTOR
> +M: Peter Rosin
> +L: linux-...@vger.kernel.org
> +S: Maintained
> +F: Documentation/devicetree/bindings/iio/adc/envelope-detector.txt
> +
> IIO SUBSYSTEM AND DRIVERS
> M: Jonathan Cameron
> R: Hartmut Knaack
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
able(dac->vref);
> + if (ret) {
> + dev_err(dev, "failed to enable the vref regulator\n");
> + return ret;
> + }
> +
> + ret = iio_device_register(indio_dev);
> + if (ret) {
> + dev_err(dev, "failed to register iio device\n"
maybe you can unify the two files in this patch series?
./staging/iio/Documentation/sysfs-bus-iio-light-tsl2583
./staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583
Suggested-by: Peter Meerwald-Stadler
:-)
> Signed-off-by: Brian Masney
> ---
> drivers/staging/
o the togreg branch of iio.git. Again, Peter, if you have
> a chance to look at this that would be great. If not then not to worry!
Acked-by: Peter Meerwald-Stadler
> Jonathan
> >
> > drivers/iio/light/ltr501.c | 81
> > +
+module_init(uleds_init);
> +
> +static void __exit uleds_exit(void)
> +{
> + misc_deregister(&uleds_misc);
> +}
> +module_exit(uleds_exit);
> +
> +MODULE_AUTHOR("David Lechner ");
> +MODULE_DESCRIPTION("Userspace driver for leds subsystem");
> +MODULE_LICENSE("GPL");
> diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
> index 185f8ea..416f5e6 100644
> --- a/include/uapi/linux/Kbuild
> +++ b/include/uapi/linux/Kbuild
> @@ -421,6 +421,7 @@ header-y += udp.h
> header-y += uhid.h
> header-y += uinput.h
> header-y += uio.h
> +header-y += uleds.h
> header-y += ultrasound.h
> header-y += un.h
> header-y += unistd.h
> diff --git a/include/uapi/linux/uleds.h b/include/uapi/linux/uleds.h
> new file mode 100644
> index 000..e78ed46
> --- /dev/null
> +++ b/include/uapi/linux/uleds.h
> @@ -0,0 +1,23 @@
> +/*
> + * Userspace driver support for leds subsystem
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +#ifndef _UAPI__ULEDS_H_
> +#define _UAPI__ULEDS_H_
> +
> +#define ULEDS_MAX_NAME_SIZE 80
> +
> +struct uleds_user_dev {
> + char name[ULEDS_MAX_NAME_SIZE];
> +};
> +
> +#endif /* _UAPI__ULEDS_H_ */
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
SE("GPL");
> diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
> index 185f8ea..416f5e6 100644
> --- a/include/uapi/linux/Kbuild
> +++ b/include/uapi/linux/Kbuild
> @@ -421,6 +421,7 @@ header-y += udp.h
> header-y += uhid.h
> header-y += uinput.h
> header-y += uio.h
> +header-y += uleds.h
> header-y += ultrasound.h
> header-y += un.h
> header-y += unistd.h
> diff --git a/include/uapi/linux/uleds.h b/include/uapi/linux/uleds.h
> new file mode 100644
> index 000..e78ed46
> --- /dev/null
> +++ b/include/uapi/linux/uleds.h
> @@ -0,0 +1,23 @@
> +/*
> + * Userspace driver support for leds subsystem
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +#ifndef _UAPI__ULEDS_H_
> +#define _UAPI__ULEDS_H_
> +
> +#define ULEDS_MAX_NAME_SIZE 80
> +
> +struct uleds_user_dev {
> + char name[ULEDS_MAX_NAME_SIZE];
> +};
> +
> +#endif /* _UAPI__ULEDS_H_ */
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
onst has the same effect;
> > constifying individual members makes more sense if there are also
> > non-const members
> >
> > nothing wrong, just unusual
> >
>
> So I would let all members non-const and then when using the struct
> soc_specific as a member in a struct or as a variable I would prefix it
> with const? That's what you mean by using the entire struct as const?
yes, exactly
thanks, p.
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
platform_device *pdev, const char *name,
> >> +irq_handler_t handler, const char *devname,
> >> +unsigned int *irq, atomic_t *atomic)
> >> +{
> >> + int ret;
> >> + struct sun4i_gpadc_mfd_dev *mfd_dev = dev_get_drvdata(pdev->dev.parent);
> >> + struct sun4i_gpadc_dev *info = iio_priv(dev_get_drvdata(&pdev->dev));
> >> +
> >> + /*
> >> + * Once the interrupt is activated, the IP continuously performs
> >> + * conversions thus throws interrupts. The interrupt is activated right
> >> + * after being requested but we want to control when these interrupts
> >> + * occurs thus we disable it right after being requested. However, an
> >
> > occur
> >
>
> ACK for all typos.
> Thanks!
>
> Quentin
>
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
goto err_fifo_irq;
> + }
> +
> + ret = iio_device_register(indio_dev);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "could not register the device\n");
> + goto err_map;
> + }
> +
> + return 0;
> +
> +err_map:
> + iio_map_array_unregister(indio_dev);
> +
> +err_fifo_irq:
> + /* Disable FIFO_DATA_PENDING interrupt on hardware side. */
> + regmap_update_bits(info->regmap, SUN4I_GPADC_INT_FIFOC,
> +SUN4I_GPADC_INT_FIFOC_TP_DATA_IRQ_EN,
> +0);
> +
> +err_temp_irq:
> + /* Disable TEMP_DATA_PENDING interrupt on hardware side. */
> + regmap_update_bits(info->regmap, SUN4I_GPADC_INT_FIFOC,
> +SUN4I_GPADC_INT_FIFOC_TEMP_IRQ_EN,
> +0);
> +
> +err:
> + pm_runtime_put(&pdev->dev);
> + pm_runtime_disable(&pdev->dev);
> +
> + return ret;
> +}
> +
> +static int sun4i_gpadc_remove(struct platform_device *pdev)
> +{
> + struct sun4i_gpadc_dev *info;
> + struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> +
> + info = iio_priv(indio_dev);
> + iio_device_unregister(indio_dev);
> + iio_map_array_unregister(indio_dev);
> + pm_runtime_put(&pdev->dev);
> + pm_runtime_disable(&pdev->dev);
> + /*
> + * Disable TEMP_DATA_PENDING and FIFO_DATA_PENDING interrupts on
> + * hardware side.
> + */
> + regmap_update_bits(info->regmap, SUN4I_GPADC_INT_FIFOC,
> +SUN4I_GPADC_INT_FIFOC_TEMP_IRQ_EN |
> + SUN4I_GPADC_INT_FIFOC_TP_DATA_IRQ_EN,
> +0);
> +
> + return 0;
> +}
> +
> +static const struct platform_device_id sun4i_gpadc_id[] = {
> + { "sun4i-a10-gpadc-iio", (kernel_ulong_t)&sun4i_gpadc_soc_specific },
> + { "sun5i-a13-gpadc-iio", (kernel_ulong_t)&sun5i_gpadc_soc_specific },
> + { "sun6i-a31-gpadc-iio", (kernel_ulong_t)&sun6i_gpadc_soc_specific },
> + { /* sentinel */ },
> +};
> +
> +static struct platform_driver sun4i_gpadc_driver = {
> + .driver = {
> + .name = "sun4i-gpadc-iio",
> + .pm = &sun4i_gpadc_pm_ops,
> + },
> + .id_table = sun4i_gpadc_id,
> + .probe = sun4i_gpadc_probe,
> + .remove = sun4i_gpadc_remove,
> +};
> +
> +module_platform_driver(sun4i_gpadc_driver);
> +
> +MODULE_DESCRIPTION("ADC driver for sunxi platforms");
> +MODULE_AUTHOR("Quentin Schulz ");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
<c2485_info;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->channels = ltc2485_channel;
> + indio_dev->num_channels = ARRAY_SIZE(ltc2485_channel);
> +
> + ret = i2c_smbus_write_byte(data->client, LTC2485_CONFIG_DEFAULT);
> + if (ret < 0)
> + return ret;
> +
> + data->time_prev = ktime_get_real_ns();
> + return devm_iio_device_register(&client->dev, indio_dev);
> +}
> +
> +static const struct i2c_device_id ltc2485_id[] = {
> + { "ltc2485", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, ltc2485_id);
> +
> +static struct i2c_driver ltc2485_driver = {
> + .driver = {
> + .name = "ltc2485",
> + },
> + .probe = ltc2485_probe,
> + .id_table = ltc2485_id,
> +};
> +module_i2c_driver(ltc2485_driver);
> +
> +MODULE_AUTHOR("Alison Schofield ");
> +MODULE_DESCRIPTION("Linear Technology LTC2485 ADC driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
> Previously code defaulted to 32 BCLKS per WCLK which meant 24 and
> 32 bit DAI formats would not work properly. This patch fixes the
> issue by defaulting to 64 BCLKs per WCLK.
Tested-by: Peter Meerwald-Stadler
> Signed-off-by: Adam Thomson
> ---
> sound/soc/codecs/da72
>
> Signed-off-by: Adam Thomson
Tested-by: Peter Meerwald-Stadler
> ---
> sound/soc/codecs/da7213.c | 20 +++-
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
> index bcf1834..
or 32KHz mode, checks are made on codec master mode and correct
>MCLK rates, to avoid incorrect usage of PLL for this operation.
> - For 32KHz mode, SRM flag now correctly enabled and fout set to
>sensible value to achieve appropriate PLL dividers.
thanks, looks good
Tested-by: P
pll_ctrl);
>
> + /* Assist 32KHz mode PLL lock */
> + if (source == DA7213_SYSCLK_PLL_32KHZ) {
> + snd_soc_write(codec, 0xF0, 0x8B);
> + snd_soc_write(codec, 0xF1, 0x03);
> + snd_soc_write(codec, 0xF1, 0x01);
> + snd_soc_write(codec, 0xF0, 0x00);
> + }
> +
> return 0;
> }
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
t->adapter,
> > I2C_FUNC_SMBUS_WORD_DATA |
> > + I2C_FUNC_SMBUS_BYTE | I2C_FUNC_I2C))
>
> Not sure we want to kill smbus support for this device... iwe should
> have two read methods for i2c and smbus (see the PulsedLight LIDAR
> driver) in this case.
>
> Ideally I wouldn't have written it with only smbus in mind, but can
> kill backwards compatibility unless we have a good reason.
>
> Thanks,
>
> Matt
>
> > return -EOPNOTSUPP;
> >
> > indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> > --
> > 2.1.4
> >
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
gs, CR, SSC_BIT(CR_SWRST));
which is performed unconditionally when a stream starts
code was introduced with
ASoC: atmel_ssc_dai: refactor the startup and shutdown, commit cbaadf0f90d6
tested with the 4.1 branch of linux-at91 git
thanks, regards, p.
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
; + .type = IIO_TEMP,
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> + BIT(IIO_CHAN_INFO_PROCESSED) |
> + BIT(IIO_CHAN_INFO_SCALE),
> + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ),
> +
&iio_dev_attr_pol.dev_attr.attr,
> + &iio_dev_attr_cf.dev_attr.attr,
> + &iio_dev_attr_ss.dev_attr.attr,
> + &iio_const_attr_sampling_frequency_available.dev_attr.attr,
> + NULL,
> +};
> +
> +static struct attribute_group as6200_attr_group = {
> + .attrs = as620
ev->dev, "no reset control found\n");
> + info->reset = NULL;
> + }
> +
> init_completion(&info->completion);
>
> irq = platform_get_irq(pdev, 0);
> @@ -252,6 +279,9 @@ static int rockchip_saradc_probe(struct platform_device
> *pdev)
> return PTR_ERR(info->vref);
> }
>
> + if (info->reset)
> + rockchip_saradc_reset_controller(info->reset);
> +
> /*
>* Use a default value for the converter clock.
>* This may become user-configurable in the future.
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
our policy is first come, first served; I have compared the two
patches, maybe you can collaborate on a common proposal?
regards, p.
> regards,
> --navin-patidar
>
> On Tue, Jul 26, 2016 at 1:07 AM, Peter Meerwald-Stadler
> wrote:
>
> >
> > > BNO055 provid
; + return -EINVAL;
> + }
> +
> + ret = bno055_chip_init(data);
> + if (ret < 0)
> + return ret;
> +
> + ret = devm_iio_device_register(&client->dev, indio_dev);
> + if (ret){
space before {
> + dev_err(&cli
1 - 100 of 144 matches
Mail list logo