; + 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
> > >> +.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
> > >> +.modified = 1, \
> > >> +}
> > >> +
> > >> +#define DMARD06_TEMP_CHANNEL(reg) { \
> > >> +.type = IIO_TEMP, \
> > >> +.address = reg, \
> > >> +.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> > >> + BIT(IIO_CHAN_INFO_OFFSET),\
> > >> +}
> > >> +
> > >> +static const struct iio_chan_spec dmard06_channels[] = {
> > >> +DMARD06_ACCEL_CHANNEL(X, DMARD06_XOUT_REG),
> > >> +DMARD06_ACCEL_CHANNEL(Y, DMARD06_YOUT_REG),
> > >> +DMARD06_ACCEL_CHANNEL(Z, DMARD06_ZOUT_REG),
> > >> +DMARD06_TEMP_CHANNEL(DMARD06_TOUT_REG),
> > >> +};
> > >> +
> > >> +static int dmard06_probe(struct i2c_client *client,
> > >> +const struct i2c_device_id *id)
> > >> +{
> > >> +int error;
> > >> +struct iio_dev *indio_dev;
> > >> +struct dmard06_data *dmard06;
> > >> +
> > >> +dev_dbg(&client->dev, "I2C Address: 0x%02x\n", client->addr);
> > >
> > > not needed
> > >
> > >> +
> > >> +if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> > >> +dev_err(&client->dev, "I2C check functionality
> > >> failed\n");
> > >> +return -ENXIO;
> > >> +}
> > >> +
> > >> +indio_dev = devm_iio_device_alloc(&client->dev,
> > >> sizeof(*dmard06));
> > >> +if (!indio_dev) {
> > >> +dev_err(&client->dev, "Failed to allocate iio
> > >> device\n");
> > >> +return -ENOMEM;
> > >> +}
> > >> +
> > >> +dmard06 = iio_priv(indio_dev);
> > >> +dmard06->client = client;
> > >> +
> > >> +error = dmard06_read_chip_id(dmard06);
> > >> +if (error)
> > >> +return error;
> > >> +
> > >> +i2c_set_clientdata(client, indio_dev);
> > >> +indio_dev->dev.parent = &client->dev;
> > >> +indio_dev->name = DMARD06_DRV_NAME;
> > >> +indio_dev->modes = INDIO_DIRECT_MODE;
> > >> +indio_dev->channels = dmard06_channels;
> > >> +indio_dev->num_channels = ARRAY_SIZE(dmard06_channels);
> > >> +indio_dev->info = &dmard06_info;
> > >> +
> > >> +return devm_iio_device_register(&client->dev, indio_dev);
> > >> +}
> > >> +
> > >> +static const struct i2c_device_id dmard06_id[] = {
> > >> +{ "dmard06", 0 },
> > >> +{ }
> > >> +};
> > >> +MODULE_DEVICE_TABLE(i2c, dmard06_id);
> > >> +
> > >> +static const struct of_device_id dmard06_of_match[] = {
> > >> +{ .compatible = "domintech,dmard06" },
> > >> +{ }
> > >> +};
> > >> +MODULE_DEVICE_TABLE(of, dmard06_of_match);
> > >> +
> > >> +static struct i2c_driver dmard06_driver = {
> > >> +.probe = dmard06_probe,
> > >> +.id_table = dmard06_id,
> > >> +.driver = {
> > >> +.name = DMARD06_DRV_NAME,
> > >> +.of_match_table = of_match_ptr(dmard06_of_match),
> > >> +},
> > >> +};
> > >> +module_i2c_driver(dmard06_driver);
> > >> +
> > >> +MODULE_AUTHOR("Aleksei Mamlin ");
> > >> +MODULE_DESCRIPTION("Domintech DMARD06 accelerometer driver");
> > >> +MODULE_LICENSE("GPL v2");
> > >>
> > >
> >
>
>
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
dmard06);
> + if (error)
> + return error;
> +
> + i2c_set_clientdata(client, indio_dev);
> + indio_dev->dev.parent = &client->dev;
> + indio_dev->name = DMARD06_DRV_NAME;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->channels = dmard06_channels;
> + indio_dev->num_channels = ARRAY_SIZE(dmard06_channels);
> + indio_dev->info = &dmard06_info;
> +
> + return devm_iio_device_register(&client->dev, indio_dev);
> +}
> +
> +static const struct i2c_device_id dmard06_id[] = {
> + { "dmard06", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, dmard06_id);
> +
> +static const struct of_device_id dmard06_of_match[] = {
> + { .compatible = "domintech,dmard06" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, dmard06_of_match);
> +
> +static struct i2c_driver dmard06_driver = {
> + .probe = dmard06_probe,
> + .id_table = dmard06_id,
> + .driver = {
> + .name = DMARD06_DRV_NAME,
> + .of_match_table = of_match_ptr(dmard06_of_match),
> + },
> +};
> +module_i2c_driver(dmard06_driver);
> +
> +MODULE_AUTHOR("Aleksei Mamlin ");
> +MODULE_DESCRIPTION("Domintech DMARD06 accelerometer driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
it in linux.
> >
> > https://git.kernel.org/cgit/linux/kernel/git/jic23/iio.git/log/?h=testing
>
> Means we have to do development here and this testing branch will get
> merged to main branch later.
yes, Jonathan will queue up stuff in testing, then send to GregHK, and
then to mainline
p.
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
,
> + &hdc_buffer_setup_ops);
> + if (ret < 0) {
> + dev_err(&client->dev, "iio triggered buffer setup failed\n");
> + return ret;
> + }
> + ret = iio_device_register(indio_dev);
> + if (ret < 0)
> + iio_triggered_buffer_cleanup(indio_dev);
> +
> + return ret;
> +}
> +
> +static int hdc100x_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 devm_iio_device_register(&client->dev, indio_dev);
> + return 0;
> }
>
> static const struct i2c_device_id hdc100x_id[] = {
> @@ -311,6 +442,7 @@ static struct i2c_driver hdc100x_driver = {
> .name = "hdc100x",
> },
> .probe = hdc100x_probe,
> + .remove = hdc100x_remove,
> .id_table = hdc100x_id,
> };
> module_i2c_driver(hdc100x_driver);
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
ev)
> {
> struct sunxi_gpadc_dev *info;
> @@ -286,16 +401,20 @@ static int sunxi_gpadc_probe(struct platform_device
> *pdev)
> info = iio_priv(indio_dev);
>
> info->regmap = sunxi_gpadc_mfd_dev->regmap;
> + info->indio_dev = indio_dev;
> init_completion(&info->completion);
> 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 = &sunxi_gpadc_iio_info;
> - indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;
> indio_dev->num_channels = ARRAY_SIZE(sunxi_gpadc_channels);
> indio_dev->channels = sunxi_gpadc_channels;
> + indio_dev->setup_ops = &sunxi_gpadc_buffer_setup_ops;
>
> info->flags = platform_get_device_id(pdev)->driver_data;
> + info->ts_attached = of_property_read_bool(pdev->dev.parent->of_node,
> + "allwinner,ts-attached");
>
> regmap_write(info->regmap, SUNXI_GPADC_TP_CTRL0, SUNXI_GPADC_FS_DIV(7) |
>SUNXI_GPADC_ADC_CLK_DIVIDER(2) | SUNXI_GPADC_T_ACQ(63));
> @@ -305,6 +424,8 @@ static int sunxi_gpadc_probe(struct platform_device *pdev)
> else
> regmap_write(info->regmap, SUNXI_GPADC_TP_CTRL1,
>SUNXI_GPADC_TP_MODE_EN);
> + regmap_write(info->regmap, SUNXI_GPADC_TP_CTRL2,
> + SUNXI_GPADC_TP_SENSITIVE_ADJUST(15));
> regmap_write(info->regmap, SUNXI_GPADC_TP_CTRL3, SUNXI_GPADC_FILTER_EN |
>SUNXI_GPADC_FILTER_TYPE(1));
> regmap_write(info->regmap, SUNXI_GPADC_TP_TPR,
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
git/jic23/iio.git/log/?h=testing
p.
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
; - if (!devm_request_region(dev, base[id], STX104_EXTENT,
> - dev_name(dev))) {
> - dev_err(dev, "Unable to lock port addresses (0x%X-0x%X)\n",
> - base[id], base[id] + STX104_EXTENT);
> - return -EBUSY;
> - }
> -
> - indio_dev->info = &stx104_info;
> - indio_dev->modes = INDIO_DIRECT_MODE;
> - indio_dev->num_channels = IN_CHAN_OFFSET + STX104_NUM_IN_CHAN;
> -
> - /* determine if differential inputs */
> - if (inb(base[id] + 8) & BIT(5)) {
> - indio_dev->num_channels -= STX104_NUM_IN_CHAN / 2;
> -
> - for (i = 0; i < STX104_NUM_IN_CHAN / 2; i++) {
> - stx104_channels[i + IN_CHAN_OFFSET].differential = 1;
> - stx104_channels[i + IN_CHAN_OFFSET].channel2 = i;
> - }
> - }
> -
> - indio_dev->channels = stx104_channels;
> - indio_dev->name = dev_name(dev);
> -
> - priv = iio_priv(indio_dev);
> - priv->base = base[id];
> -
> - /* configure device for software trigger operation */
> - outb(0, base[id] + 9);
> -
> - /* initialize gain setting to x1 */
> - outb(0, base[id] + 11);
> -
> - /* initialize DAC output to 0V */
> - outw(0, base[id] + 4);
> - outw(0, base[id] + 6);
> -
> - err = devm_iio_device_register(dev, indio_dev);
> - if (err) {
> - dev_err(dev, "IIO device registering failed (%d)\n", err);
> - return err;
> - }
> -
> - stx104gpio->chip.label = dev_name(dev);
> - stx104gpio->chip.parent = dev;
> - stx104gpio->chip.owner = THIS_MODULE;
> - stx104gpio->chip.base = -1;
> - stx104gpio->chip.ngpio = 8;
> - stx104gpio->chip.get_direction = stx104_gpio_get_direction;
> - stx104gpio->chip.direction_input = stx104_gpio_direction_input;
> - stx104gpio->chip.direction_output = stx104_gpio_direction_output;
> - stx104gpio->chip.get = stx104_gpio_get;
> - stx104gpio->chip.set = stx104_gpio_set;
> - stx104gpio->base = base[id] + 3;
> - stx104gpio->out_state = 0x0;
> -
> - spin_lock_init(&stx104gpio->lock);
> -
> - dev_set_drvdata(dev, stx104gpio);
> -
> - err = gpiochip_add_data(&stx104gpio->chip, stx104gpio);
> - if (err) {
> - dev_err(dev, "GPIO registering failed (%d)\n", err);
> - return err;
> - }
> -
> - return 0;
> -}
> -
> -static int stx104_remove(struct device *dev, unsigned int id)
> -{
> - struct stx104_gpio *const stx104gpio = dev_get_drvdata(dev);
> -
> - gpiochip_remove(&stx104gpio->chip);
> -
> - return 0;
> -}
> -
> -static struct isa_driver stx104_driver = {
> - .probe = stx104_probe,
> - .driver = {
> - .name = "stx104"
> - },
> - .remove = stx104_remove
> -};
> -
> -module_isa_driver(stx104_driver, num_stx104);
> -
> -MODULE_AUTHOR("William Breathitt Gray ");
> -MODULE_DESCRIPTION("Apex Embedded Systems STX104 IIO driver");
> -MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
l4000_readable_reg,
> + .writeable_reg = vcnl4000_writeable_reg,
> +};
> +
> static int vcnl4000_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> @@ -162,7 +269,13 @@ static int vcnl4000_probe(struct i2c_client *client,
> return -ENOMEM;
>
> data = iio_priv(indio_dev);
> + data->regmap = devm_regmap_init_i2c(client, &vcnl4000_regmap_config);
> + if (IS_ERR(data->regmap)) {
> + dev_err(&client->dev, "regmap_init failed!\n");
> + return PTR_ERR(data->regmap);
> + }
> i2c_set_clientdata(client, indio_dev);
> + mutex_init(&data->lock);
> data->client = client;
>
> ret = i2c_smbus_read_byte_data(data->client, VCNL4000_PROD_REV);
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
ensor */
> + enum motionsensor_type type;
> + enum motionsensor_location loc;
> +
> + /*
> + * Calibration parameters. Note that trigger captured data will always
> + * provide the calibrated values.
> + */
> + struct calib_data {
> + s16 offset;
> + } calib[MAX_AXIS];
> +
> + /*
> + * Static array to hold data from a single capture. For each
> + * channel we need 2 bytes, except for the timestamp. The timestamp
> + * is always last and is always 8-byte aligned.
> + */
> + u8 samples[CROS_EC_SAMPLE_SIZE];
> +
> + /* Pointer to function used for accessing sensors values. */
> + cros_ec_sensors_read_t *read_ec_sensors_data;
> +
> + /* Current sampling period */
> + int curr_sampl_freq;
> +};
> +
> +/* Basic initialization of the core structure. */
> +int cros_ec_sensors_core_init(struct platform_device *pdev,
> + struct iio_dev *indio_dev,
> + bool physical_device);
> +
> +/*
> + * cros_ec_sensors_capture - the trigger handler function
> + *
> + * @irq: the interrupt number
> + * @p: private data - always a pointer to the poll func.
> + *
> + * On a trigger event occurring, if the pollfunc is attached then this
> + * handler is called as a threaded interrupt (and hence may sleep). It
> + * is responsible for grabbing data from the device and pushing it into
> + * the associated buffer.
> + */
> +irqreturn_t cros_ec_sensors_capture(int irq, void *p);
> +
> +
> +/*
> + * cros_ec_motion_send_host_cmd - send motion sense host command
> + *
> + * @st Pointer to state information for device.
> + * @opt_length: optional length: to reduce the response size,
> + *useful on the data path.
> + *Otherwise, the maximal allowed response size is used.
> + * @return 0 if ok, -ve on error.
> + *
> + * Note, when called, the sub-command is assumed to be set in param->cmd.
> + */
> +int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st,
> + u16 opt_length);
> +
> +/*
> + * cros_ec_sensors_core_read/write: handler for core attributes.
> + *
> + * Handler for attributes identical among sensors:
> + * - frequency,
> + * - sampling_frequency.
> + *
> + * cmd_lock lock must be held.
> + */
> +int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st,
> + struct iio_chan_spec const *chan,
> + int *val, int *val2, long mask);
> +
> +int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st,
> +struct iio_chan_spec const *chan,
> +int val, int val2, long mask);
> +
> +extern const struct dev_pm_ops cros_ec_sensors_pm_ops;
> +
> +/* List of extended channel specification for all sensors */
> +extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[];
> +extern const struct iio_chan_spec_ext_info cros_ec_sensors_limited_info[];
> +
> +#endif /* __CROS_EC_SENSORS_CORE_H */
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->channels = cio_dac_channels;
> + indio_dev->num_channels = CIO_DAC_NUM_CHAN;
> + indio_dev->name = dev_name(dev);
> +
> + priv = iio_priv(indio_dev);
> + priv->base = base[id];
> +
> + /* initialize DAC outputs to 0V */
> + for (i = 0; i < 32; i += 2)
> + outw(0, base[id] + i);
> +
> + return devm_iio_device_register(dev, indio_dev);
> +}
> +
> +static struct isa_driver cio_dac_driver = {
> + .probe = cio_dac_probe,
> + .driver = {
> + .name = "cio-dac"
> + }
> +};
> +
> +module_isa_driver(cio_dac_driver, num_cio_dac);
> +
> +MODULE_AUTHOR("William Breathitt Gray ");
> +MODULE_DESCRIPTION("Measurement Computing CIO-DAC DAC driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
p4725_probe(struct i2c_client *client,
> return err;
> }
> pd = (inbuf[0] >> 1) & 0x3;
> - data->powerdown = pd > 0 ? true : false;
> + data->powerdown = pd > 0;
> data->powerdown_mode = pd ? pd - 1 : 2; /* largest register to
if (val2 == SENSING_RANGE_1)
> > data->conf1 |= ISL29125_MODE_RANGE;
> > - else if (val2 == 5722)
> > + else if (val2 == SENSING_RANGE_0)
> > data->conf1 &= ~ISL29125_MODE_RANGE;
> > else
> > return -EINVAL;
> >
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
== 1) err =
> > +i2c_master_recv(client, rx_buf, 2);
>
> This is not thread safe. Another thread could interrupt between
> i2c_master_send() and i2c_master_recv() and cause undefined behavior. Use
> i2c_smbus_read_word_swapped() which makes sure that the I2C communication
> happens atomically.
>
> > +if (err == 2) {
> > +*reg_val = rx_buf[0];
> > +*reg_val = *reg_val << 8;
> > +*reg_val = *reg_val | rx_buf[1];
> > +}
> > +return err;
> > +} else {
> > +return -EINVAL;
> > +}
> > +}
> [...]
> > +
> > +static irqreturn_t alert_isr(int irq, void *dev_id) {
> > +dev_warn(dev_id, "Temperature outside of limits!");
>
> Please use IIO threshold events for this. Such out-of-band communication is
> really not acceptable.
>
> > +return IRQ_HANDLED;
> > +}
> > +
> > +static int setupIRQ(struct iio_dev *indio_dev, bool set_gpio, u8 pol)
> > +{ int err; struct as6200_data *data = iio_priv(indio_dev); struct
> > +device *dev = &data->client->dev; int gpio = -1; int irq_num; int
> > +irq_trig;
> > +
> > +if (pol == 1)
> > +irq_trig = IRQF_TRIGGER_RISING;
> > +else
> > +irq_trig = IRQF_TRIGGER_FALLING;
> > +
> > +if (set_gpio) {
> > +gpio = of_get_named_gpio_flags(dev->of_node,
> > +"as6200,irq-gpio", 0, 0);
> > +err = gpio_request(gpio, "as6200_irq"); if (err) { dev_info(dev, "%s:
> > +requesting gpio %d failed\n", as6200_id[0].name, gpio); return err; }
> > +err = gpio_direction_input(gpio); if (err) { dev_info(dev, "%s: gpio
> > +%d cannot apply direction\n", as6200_id[0].name, gpio); return err; }
> > +} irq_num = gpio_to_irq(gpio); dev_info(dev, "%s: registering for IRQ
> > +%d\n", as6200_id[0].name, irq_num);
>
> Please drop all these dev_info(). That's just noise in the boot log, imagine
> every driver did this you wouldn't be able to spot the critical information.
>
> > +err = request_irq(irq_num, alert_isr, irq_trig, as6200_id[0].name,
> > +dev);
>
> Don't do all the GPIO translation. This pin is only used as a interrupt, so
> specify it directly as an interrupt and use it that way as well.
>
> > +if (err) {
> > +dev_info(dev, "%s: error requesting irq %d\n", as6200_id[0].name,
> > +err);
>
> For errors use dev_err. Also the as6200_id[0].name is redundant since
> dev_info/dev_err already prefixes the message with the device name.
>
> > +return err;
> > +}
> > +dev_info(dev, "%s: registered for IRQ %d\n", as6200_id[0].name,
> > +irq_num); mutex_lock(&data->update_lock);
> > +data->irqn = irq_num;
> > +mutex_unlock(&data->update_lock);
>
> What exactly is protect by that mutex here?
>
> > +
> > +return 0;
> > +}
> > +
> [...]
> > +if (err == 0) {
> > +if ((val < -40) | (val > 150)) {
> > +dev_info(&client->dev,
> > +"Value for THIGH is invalid min = -40%cC, max = 150°C, val = %d°C",
> > +(unsigned char)(248), val);
>
> Please no out-of-band error reporting.
>
> > +return count;
> > +}
> > +val = (val * 1) / 625;
> > +reg_val = val << 4;
> [...]
> > +static int as6200_probe(struct i2c_client *client, const struct
> > +i2c_device_id *id) { struct iio_dev *indio_dev = NULL; struct
> > +as6200_data *data = NULL;
>
> No need to initialize those here with dummy, this will just hide warnings in
> case you forgot to initialize them with actual data.
>
> > +
> > +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;
> > +
> > +indio_dev->dev.parent = &client->dev; indio_dev->name =
> > +dev_name(&client->dev);
>
> use id->name for this. dev_name() contains things like the I2C bus and device
> address, etc. Whereas the IIO device name should describe the type of device.
>
> > +indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->info = &as6200_info;
> > +
> > +indio_dev->channels = as6200_channels; indio_dev->num_channels =
> > +ARRAY_SIZE(as6200_channels);
> > +
> > +initClientData(data);
> > +mutex_init(&data->update_lock);
> > +setupIRQ(indio_dev, true, 0);
> > +
> > +return iio_device_register(indio_dev);
>
> Error handling is missing here, you need to free the resources that were
> acquired in case of an error.
>
> > +}
> > +
> [...]
>
>
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
On Mon, 6 Jun 2016, Alison Schofield wrote:
> Replace the code that guarantees the device stays in direct mode
> with iio_device_claim_direct_mode() which does same. This allows
> removal of an unused lock in the device private global data.
Acked-by: Peter Meerwald-Stadler
> S
> Replace the code that guarantees the device stays in direct mode
> with iio_device_claim_direct_mode() which does same. This allows
> removal of an unused lock in the device private global data.
nice!
Acked-by: Peter Meerwald-Stadler
> Signed-off-by: Alison Schofield
> Cc
> Replace the code that guarantees the device stays in direct mode
> with iio_device_claim_direct_mode() which does same. This allows
> removal of an unused lock in the device private global data.
Acked-by: Peter Meerwald-Stadler
> Signed-off-by: Alison Schofield
> Cc
> + if (chip->regs[CM36672_ADDR_PRX_CONF] & CM36672_PRX_INT_MASK) {
> + ret = i2c_smbus_write_word_data(chip->client,
> + CM36672_ADDR_PRX_CONF,
> + chip->regs[CM36672_ADDR_PRX_CONF]);
> + if (ret) {
> + dev_err(&client->dev,
> + "%s: enable interrupt failed\n",
> + __func__);
> + return ret;
> + }
> + }
> + }
> +
> + ret = iio_device_register(indio_dev);
> + if (ret) {
> + dev_err(&client->dev,
> + "%s: regist device failed\n",
registering
> + __func__);
> + if (client->irq)
> + free_irq(client->irq, indio_dev);
> + }
> +
> + return 0;
> +}
> +
> +static int cm36672_remove(struct i2c_client *client)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(client);
> + struct cm36672_chip *chip = iio_priv(indio_dev);
> +
> + i2c_smbus_write_word_data(
> + chip->client,
> + CM36672_ADDR_PRX_CONF,
> + CM36672_PRX_DISABLE);
> + if (client->irq)
> + free_irq(client->irq, indio_dev);
> + iio_device_unregister(indio_dev);
> + return 0;
> +}
> +
> +static const struct i2c_device_id cm36672_id[] = {
> + { "cm36672", 0 },
> + { }
> +};
> +
> +MODULE_DEVICE_TABLE(i2c, cm36672_id);
> +
> +static const struct of_device_id cm36672_of_match[] = {
> + { .compatible = "capella,cm36672" },
> + { }
> +};
> +
> +#ifdef CONFIG_ACPI
> +static const struct acpi_device_id cm36672_acpi_match[] = {
> + { "CPLM6672", 0},
> + {},
> +};
> +
> +MODULE_DEVICE_TABLE(acpi, cm36672_acpi_match);
> +#endif
> +
> +#ifdef CONFIG_PM_SLEEP
> +static int cm36672_suspend(struct device *dev)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> + struct cm36672_chip *chip = iio_priv(indio_dev);
> + int ret;
> +
> + chip->regs[CM36672_ADDR_PRX_CONF] |= CM36672_PRX_DISABLE;
> + ret = i2c_smbus_write_byte_data(
> + chip->client,
> + CM36672_ADDR_PRX_CONF,
> + chip->regs[CM36672_ADDR_PRX_CONF]);
> + return ret;
> +}
> +
> +static int cm36672_resume(struct device *dev)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> + struct cm36672_chip *chip = iio_priv(indio_dev);
> + int i, ret;
> +
> + chip->regs[CM36672_ADDR_PRX_CONF] &= ~CM36672_PRX_DISABLE;
> +
> + /* Initialize registers*/
whitespace before */ please
> + for (i = 0; i < CM36672_REGS_NUM; i++) {
> + ret = i2c_smbus_write_word_data(
> + chip->client,
> + i,
> + chip->regs[i]);
> + if (ret < 0)
> + return ret;
> + }
> +
> + return ret;
> +}
> +
> +static const struct dev_pm_ops cm36672_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(cm36672_suspend, cm36672_resume)};
> +#endif
> +
> +static struct i2c_driver cm36672_driver = {
> + .driver = {
> + .name = CM36672_DRIVER_NAME,
> + .of_match_table = cm36672_of_match,
> +#ifdef CONFIG_ACPI
> + .acpi_match_table = ACPI_PTR(cm36672_acpi_match),
> +#endif
> + .owner = THIS_MODULE,
> +#ifdef CONFIG_PM_SLEEP
> + .pm = &cm36672_pm_ops,
> +#endif
> + },
> + .id_table = cm36672_id,
> + .probe = cm36672_probe,
> + .remove = cm36672_remove,
> +};
> +
> +module_i2c_driver(cm36672_driver);
> +
> +MODULE_AUTHOR("Kevin Tsai ");
> +MODULE_DESCRIPTION("CM36672 proximity sensor driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
46 +591,5 @@ int main(int argc, char **argv)
>num_channels);
> }
>
> - /* Stop the buffer */
> - ret = write_sysfs_int("enable", buf_dir_name, 0);
> - if (ret < 0)
> - goto error_close_buffer_access;
> -
> - if (!notrigger)
> - /* Disconnect the trigger - just write a dummy name. */
> - ret = write_sysfs_string("trigger/current_trigger",
> - dev_dir_name, "NULL");
> - if (ret < 0)
> - fprintf(stderr, "Failed to write to %s\n",
> - dev_dir_name);
> -
> -error_close_buffer_access:
> - if (close(fp) == -1)
> - perror("Failed to close buffer");
> -
> -error_free_buffer_access:
> - free(buffer_access);
> -error_free_data:
> - free(data);
> -error_free_buf_dir_name:
> - free(buf_dir_name);
> -error_free_channels:
> - for (i = num_channels - 1; i >= 0; i--) {
> - free(channels[i].name);
> - free(channels[i].generic_name);
> - }
> - free(channels);
> -error_free_triggername:
> - if (datardytrigger)
> - free(trigger_name);
> -error_disable_channels:
> - if (autochannels == AUTOCHANNELS_ACTIVE) {
> - ret = enable_disable_all_channels(dev_dir_name, 0);
> - if (ret)
> - fprintf(stderr, "Failed to disable all channels\n");
> - }
> -error_free_dev_dir_name:
> - free(dev_dir_name);
> -
> - return ret;
> + return 0;
> }
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
From: Peter Meerwald
The si114x supports x=1,2,3 IR LEDs for proximity sensing together with
visible and IR ambient light sensing (ALS).
Newer parts (si1132, si1145/6/7) can measure UV light and compute an UV index
Arranging 3 IR LEDs in a triangular shape can be used for detection of swipe
write_cmd(spi, MAX5487_COPY_AB_TO_NV);
> +}
> +
> +static const struct spi_device_id max5487_id[] = {
> + { "MAX5487", 10 },
> + { "MAX5488", 50 },
> + { "MAX5489", 100 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(spi, max5487_id);
> +
> +static const struct acpi_device_id max5487_acpi_match[] = {
> + { "MAX5487", 10 },
> + { "MAX5488", 50 },
> + { "MAX5489", 100 },
> + { },
> +};
> +MODULE_DEVICE_TABLE(acpi, max5487_acpi_match);
> +
> +static struct spi_driver max5487_driver = {
> + .driver = {
> + .name = "max5487",
> + .owner = THIS_MODULE,
> + .acpi_match_table = ACPI_PTR(max5487_acpi_match),
> + },
> + .id_table = max5487_id,
> + .probe = max5487_spi_probe,
> + .remove = max5487_spi_remove
> +};
> +module_spi_driver(max5487_driver);
> +
> +MODULE_AUTHOR("Cristina-Gabriela Moraru ");
> +MODULE_DESCRIPTION("max5487 SPI driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
rm_watch(fd, i)); // 0
printf("add %d\n", j=inotify_add_watch(fd, "/tmp/foo", IN_MODIFY)); // 2
return 0;
}
Ubuntu kernel x86_64 4.4.0-21, seems to work here
so we have to guess what's going on between _add and _rm?
regards, p.
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
> +{
> + struct mma7660_data *data;
> +
> + data = iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
> +
> + return mma7660_set_mode(data, MMA7660_MODE_STANDBY);
> +}
> +
> +static int mma7660_resume(struct device *dev)
> +{
> + struct mma7660_d
emperature/tmp006.c: indio_dev->name = dev_name(&client->dev);
./chemical/ams-iaq-core.c: indio_dev->name = dev_name(&client->dev);
./chemical/vz89x.c: indio_dev->name = dev_name(&client->dev);
./humidity/si7005.c:indio_dev->name = dev_name(&client->dev);
./humidity/hdc100x.c: indio_dev->name = dev_name(&client->dev);
./humidity/si7020.c:indio_dev->name = dev_name(&client->dev);
regards, p.
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
rite_raw_get_fmt
>
> At this point I do not know why should I do it, but I will look into that.
write_raw expects a VAL_INT_PLUS_MICROS per default, passed
in val and val2
you can change that with .write_raw_get_fmt (e.g. to expect VAL_INT),
or just make sure that the micros are 0
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
uct i2c_device_id *id)
> {
> @@ -513,6 +569,12 @@ static int max44000_probe(struct i2c_client *client,
> return ret;
> }
>
> + ret = iio_triggered_buffer_setup(indio_dev, NULL,
> max44000_trigger_handler, NULL);
> + if (ret < 0) {
> +
gt; + return 0;
> +}
> +
> +static const struct i2c_device_id max44000_id[] = {
> + {"max44000", 0},
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, max44000_id);
> +
> +#ifdef CONFIG_OF
> +static const struct of_device_id max44000_of_match[] = {
> + { .compatible = "maxim,max44000" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, max44000_of_match);
> +#endif
> +
> +#ifdef CONFIG_ACPI
> +static const struct acpi_device_id max44000_acpi_match[] = {
> + {"MAX44000", 0},
> + { }
> +};
> +MODULE_DEVICE_TABLE(acpi, max44000_acpi_match);
> +#endif
> +
> +static struct i2c_driver max44000_driver = {
> + .driver = {
> + .name = MAX44000_DRV_NAME,
> + .of_match_table = of_match_ptr(max44000_of_match),
> + .acpi_match_table = ACPI_PTR(max44000_acpi_match),
> + },
> + .probe = max44000_probe,
> + .remove = max44000_remove,
> + .id_table = max44000_id,
> +};
> +
> +module_i2c_driver(max44000_driver);
> +
> +MODULE_AUTHOR("Crestez Dan Leonard ");
> +MODULE_DESCRIPTION("MAX44000 Ambient and Infrared Proximity Sensor");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
_device_register(dev, indio_dev);
> +}
> +
> +#if defined(CONFIG_OF)
> +static const struct of_device_id ds1803_dt_ids[] = {
> + { .compatible = "maxim,ds1803-010", .data = &ds1803_cfg[DS1803_010] },
> + { .compatible = "maxim,ds1803-050", .data = &ds1803_cfg[DS1803_050] },
> + { .compatible = "maxim,ds1803-100", .data = &ds1803_cfg[DS1803_100] },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, ds1803_dt_ids);
> +#endif /* CONFIG_OF */
> +
> +static const struct i2c_device_id ds1803_id[] = {
> + { "ds1803-010", DS1803_010 },
> + { "ds1803-050", DS1803_050 },
> + { "ds1803-100", DS1803_100 },
> + {}
> +};
> +MODULE_DEVICE_TABLE(i2c, ds1803_id);
> +
> +static struct i2c_driver ds1803_driver = {
> + .driver = {
> + .name = "ds1803",
> + .of_match_table = of_match_ptr(ds1803_dt_ids),
> + },
> + .probe = ds1803_probe,
> + .id_table = ds1803_id,
> +};
> +
> +module_i2c_driver(ds1803_driver);
> +
> +MODULE_AUTHOR("Slawomir Stepien ");
> +MODULE_DESCRIPTION("DS1803 digital potentiometer");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
t; +};
> +MODULE_DEVICE_TABLE(i2c, bmi160_i2c_id);
> +
> +static const struct acpi_device_id bmi160_acpi_match[] = {
> + {"BMI0160", 0},
> + { },
> +};
> +MODULE_DEVICE_TABLE(acpi, bmi160_acpi_match);
> +
> +static struct i2c_driver bmi160_i2c_driver = {
> + .driver = {
> + .name = BMI160_I2C_DRV_NAME,
> + .acpi_match_table = ACPI_PTR(bmi160_acpi_match),
> + },
> + .probe = bmi160_i2c_probe,
> + .remove = bmi160_i2c_remove,
> + .id_table = bmi160_i2c_id,
> +};
> +
> +module_i2c_driver(bmi160_i2c_driver);
> +
> +MODULE_AUTHOR("Daniel Baluta ");
> +MODULE_DESCRIPTION("BMI160 I2C driver");
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/iio/imu/bmi160/bmi160_spi.c
> b/drivers/iio/imu/bmi160/bmi160_spi.c
> new file mode 100644
> index 000..444b723
> --- /dev/null
> +++ b/drivers/iio/imu/bmi160/bmi160_spi.c
> @@ -0,0 +1,71 @@
> +/*
> + * BMI160 - Bosch IMU, SPI bits
> + *
> + * Copyright (c) 2016, Intel Corporation.
> + *
> + * This file is subject to the terms and conditions of version 2 of
> + * the GNU General Public License. See the file COPYING in the main
> + * directory of this archive for more details.
> + *
> + */
> +#include
> +#include
> +#include
> +
> +#include "bmi160.h"
> +
> +#define BMI160_SPI_DRV_NAME "bmi160_spi"
> +
> +static const struct regmap_config bmi160_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> +};
> +
> +static int bmi160_spi_probe(struct spi_device *spi)
> +{
> + struct regmap *regmap;
> + const struct spi_device_id *id = spi_get_device_id(spi);
> +
> + regmap = devm_regmap_init_spi(spi, &bmi160_regmap_config);
> + if (IS_ERR(regmap)) {
> + dev_err(&spi->dev, "Failed to register spi regmap %d\n",
> + (int)PTR_ERR(regmap));
> + return PTR_ERR(regmap);
> + }
> + return bmi160_core_probe(&spi->dev, regmap, id->name, true);
> +}
> +
> +static int bmi160_spi_remove(struct spi_device *spi)
> +{
> + bmi160_core_remove(&spi->dev);
> +
> + return 0;
> +}
> +
> +static const struct spi_device_id bmi160_spi_id[] = {
> + {"bmi160", 0},
> + {}
> +};
> +
> +MODULE_DEVICE_TABLE(spi, bmi160_spi_id);
> +
> +static const struct acpi_device_id bmi160_acpi_match[] = {
> + {"BMI0160", 0},
> + { },
> +};
> +MODULE_DEVICE_TABLE(acpi, bmi160_acpi_match);
> +
> +static struct spi_driver bmi160_spi_driver = {
> + .probe = bmi160_spi_probe,
> + .remove = bmi160_spi_remove,
> + .id_table = bmi160_spi_id,
> + .driver = {
> + .acpi_match_table = ACPI_PTR(bmi160_acpi_match),
> + .name = BMI160_SPI_DRV_NAME,
> + },
> +};
> +module_spi_driver(bmi160_spi_driver);
> +
> +MODULE_AUTHOR("Daniel Baluta +MODULE_DESCRIPTION("Bosch BMI160 SPI driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
+ }
>
> err = iio_device_register(iio);
> if (err < 0)
> - goto regulator_disable;
> + goto err_buffer_cleanup;
>
> i2c_set_clientdata(client, iio);
>
> return 0;
>
> -regulator_disable:
> +err_buffer_cleanup:
&
EVICE_TABLE(i2c, adc081c_id);
> #ifdef CONFIG_OF
> static const struct of_device_id adc081c_of_match[] = {
> { .compatible = "ti,adc081c" },
> + { .compatible = "ti,adc101c" },
> + { .compatible = "ti,adc121c" },
> { }
> };
> MODULE_DEVICE_TABLE(of, adc081c_of_match);
> @@ -149,5 +172,5 @@ static struct i2c_driver adc081c_driver = {
> module_i2c_driver(adc081c_driver);
>
> MODULE_AUTHOR("Thierry Reding ");
> -MODULE_DESCRIPTION("Texas Instruments ADC081C021/027 driver");
> +MODULE_DESCRIPTION("Texas Instruments ADC081C/ADC101C/ADC121C driver");
> MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
\
> + .endianness = IIO_LE, \
> }, \
> .event_spec = &bmc150_accel_event, \
> .num_event_specs = 1\
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
> + dev_err(&client->dev, "Adapter does not support "
> + "all required i2c functionality\n");
> + return -ENODEV;
> + }
> +
> + indio
_read(data->regmap, BMG160_AXIS_TO_REG(bit),
> > - &val, 2);
> > - if (ret < 0) {
> > - mutex_unlock(&data->mutex);
> > - goto err;
> > - }
> > -
uot;microchip,mcp4116x-503",
> + .data = &mcp41xx_cfg[MCP416x_503] },
> + { .compatible = "microchip,mcp4116x-104",
> + .data = &mcp41xx_cfg[MCP416x_104] },
> + { .compatible = "microchip,mcp4123x-502",
> + .data = &mcp41xx_cfg[MCP423x_502] },
> + { .compatible = "microchip,mcp4123x-103",
> + .data = &mcp41xx_cfg[MCP423x_103] },
> + { .compatible = "microchip,mcp4123x-503",
> + .data = &mcp41xx_cfg[MCP423x_503] },
> + { .compatible = "microchip,mcp4123x-104",
> + .data = &mcp41xx_cfg[MCP423x_104] },
> + { .compatible = "microchip,mcp4124x-502",
> + .data = &mcp41xx_cfg[MCP424x_502] },
> + { .compatible = "microchip,mcp4124x-103",
> + .data = &mcp41xx_cfg[MCP424x_103] },
> + { .compatible = "microchip,mcp4124x-503",
> + .data = &mcp41xx_cfg[MCP424x_503] },
> + { .compatible = "microchip,mcp4124x-104",
> + .data = &mcp41xx_cfg[MCP424x_104] },
> + { .compatible = "microchip,mcp4125x-502",
> + .data = &mcp41xx_cfg[MCP425x_502] },
> + { .compatible = "microchip,mcp4125x-103",
> + .data = &mcp41xx_cfg[MCP425x_103] },
> + { .compatible = "microchip,mcp4125x-503",
> + .data = &mcp41xx_cfg[MCP425x_503] },
> + { .compatible = "microchip,mcp4125x-104",
> + .data = &mcp41xx_cfg[MCP425x_104] },
> + { .compatible = "microchip,mcp4126x-502",
> + .data = &mcp41xx_cfg[MCP426x_502] },
> + { .compatible = "microchip,mcp4126x-103",
> + .data = &mcp41xx_cfg[MCP426x_103] },
> + { .compatible = "microchip,mcp4126x-503",
> + .data = &mcp41xx_cfg[MCP426x_503] },
> + { .compatible = "microchip,mcp4126x-104",
> + .data = &mcp41xx_cfg[MCP426x_104] },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, mcp41xx_dt_ids);
> +#endif
> +
> +static const struct spi_device_id mcp41xx_id[] = {
> + { "mcp413x-502", MCP413x_502 },
> + { "mcp413x-103", MCP413x_103 },
> + { "mcp413x-503", MCP413x_503 },
> + { "mcp413x-104", MCP413x_104 },
> + { "mcp414x-502", MCP414x_502 },
> + { "mcp414x-103", MCP414x_103 },
> + { "mcp414x-503", MCP414x_503 },
> + { "mcp414x-104", MCP414x_104 },
> + { "mcp415x-502", MCP415x_502 },
> + { "mcp415x-103", MCP415x_103 },
> + { "mcp415x-503", MCP415x_503 },
> + { "mcp415x-104", MCP415x_104 },
> + { "mcp416x-502", MCP416x_502 },
> + { "mcp416x-103", MCP416x_103 },
> + { "mcp416x-503", MCP416x_503 },
> + { "mcp416x-104", MCP416x_104 },
> + { "mcp423x-502", MCP423x_502 },
> + { "mcp423x-103", MCP423x_103 },
> + { "mcp423x-503", MCP423x_503 },
> + { "mcp423x-104", MCP423x_104 },
> + { "mcp424x-502", MCP424x_502 },
> + { "mcp424x-103", MCP424x_103 },
> + { "mcp424x-503", MCP424x_503 },
> + { "mcp424x-104", MCP424x_104 },
> + { "mcp425x-502", MCP425x_502 },
> + { "mcp425x-103", MCP425x_103 },
> + { "mcp425x-503", MCP425x_503 },
> + { "mcp425x-104", MCP425x_104 },
> + { "mcp426x-502", MCP426x_502 },
> + { "mcp426x-103", MCP426x_103 },
> + { "mcp426x-503", MCP426x_503 },
> + { "mcp426x-104", MCP426x_104 },
> + {}
> +};
> +MODULE_DEVICE_TABLE(spi, mcp41xx_id);
> +
> +static struct spi_driver mcp41xx_driver = {
> + .driver = {
> + .name = "mcp41xx",
> + .of_match_table = of_match_ptr(mcp41xx_dt_ids),
> + },
> + .probe = mcp41xx_probe,
> + .remove = mcp41xx_remove,
> + .id_table = mcp41xx_id,
> +};
> +
> +module_spi_driver(mcp41xx_driver);
> +
> +MODULE_AUTHOR("Slawomir Stepien ");
> +MODULE_DESCRIPTION("MCP41XX digital potentiometer");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
31_cfg[MCP426x_103] },
> + { .compatible = "microchip,mcp4261-503",
> + .data = &mcp4131_cfg[MCP426x_503] },
> + { .compatible = "microchip,mcp4261-104",
> + .data = &mcp4131_cfg[MCP426x_104] },
> + { .compatible = "microchip,mcp4262-502",
> + .data = &mcp4131_cfg[MCP426x_502] },
> + { .compatible = "microchip,mcp4262-103",
> + .data = &mcp4131_cfg[MCP426x_103] },
> + { .compatible = "microchip,mcp4262-503",
> + .data = &mcp4131_cfg[MCP426x_503] },
> + { .compatible = "microchip,mcp4262-104",
> + .data = &mcp4131_cfg[MCP426x_104] },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, mcp4131_dt_ids);
> +#endif /* CONFIG_OF */
> +
> +static const struct spi_device_id mcp4131_id[] = {
> + { "mcp4131-502", MCP413x_502 },
> + { "mcp4131-103", MCP413x_103 },
> + { "mcp4131-503", MCP413x_503 },
> + { "mcp4131-104", MCP413x_104 },
> + { "mcp4132-502", MCP413x_502 },
> + { "mcp4132-103", MCP413x_103 },
> + { "mcp4132-503", MCP413x_503 },
> + { "mcp4132-104", MCP413x_104 },
> + { "mcp4141-502", MCP414x_502 },
> + { "mcp4141-103", MCP414x_103 },
> + { "mcp4141-503", MCP414x_503 },
> + { "mcp4141-104", MCP414x_104 },
> + { "mcp4142-502", MCP414x_502 },
> + { "mcp4142-103", MCP414x_103 },
> + { "mcp4142-503", MCP414x_503 },
> + { "mcp4142-104", MCP414x_104 },
> + { "mcp4151-502", MCP415x_502 },
> + { "mcp4151-103", MCP415x_103 },
> + { "mcp4151-503", MCP415x_503 },
> + { "mcp4151-104", MCP415x_104 },
> + { "mcp4152-502", MCP415x_502 },
> + { "mcp4152-103", MCP415x_103 },
> + { "mcp4152-503", MCP415x_503 },
> + { "mcp4152-104", MCP415x_104 },
> + { "mcp4161-502", MCP416x_502 },
> + { "mcp4161-103", MCP416x_103 },
> + { "mcp4161-503", MCP416x_503 },
> + { "mcp4161-104", MCP416x_104 },
> + { "mcp4162-502", MCP416x_502 },
> + { "mcp4162-103", MCP416x_103 },
> + { "mcp4162-503", MCP416x_503 },
> + { "mcp4162-104", MCP416x_104 },
> + { "mcp4231-502", MCP423x_502 },
> + { "mcp4231-103", MCP423x_103 },
> + { "mcp4231-503", MCP423x_503 },
> + { "mcp4231-104", MCP423x_104 },
> + { "mcp4232-502", MCP423x_502 },
> + { "mcp4232-103", MCP423x_103 },
> + { "mcp4232-503", MCP423x_503 },
> + { "mcp4232-104", MCP423x_104 },
> + { "mcp4241-502", MCP424x_502 },
> + { "mcp4241-103", MCP424x_103 },
> + { "mcp4241-503", MCP424x_503 },
> + { "mcp4241-104", MCP424x_104 },
> + { "mcp4242-502", MCP424x_502 },
> + { "mcp4242-103", MCP424x_103 },
> + { "mcp4242-503", MCP424x_503 },
> + { "mcp4242-104", MCP424x_104 },
> + { "mcp4251-502", MCP425x_502 },
> + { "mcp4251-103", MCP425x_103 },
> + { "mcp4251-503", MCP425x_503 },
> + { "mcp4251-104", MCP425x_104 },
> + { "mcp4252-502", MCP425x_502 },
> + { "mcp4252-103", MCP425x_103 },
> + { "mcp4252-503", MCP425x_503 },
> + { "mcp4252-104", MCP425x_104 },
> + { "mcp4261-502", MCP426x_502 },
> + { "mcp4261-103", MCP426x_103 },
> + { "mcp4261-503", MCP426x_503 },
> + { "mcp4261-104", MCP426x_104 },
> + { "mcp4262-502", MCP426x_502 },
> + { "mcp4262-103", MCP426x_103 },
> + { "mcp4262-503", MCP426x_503 },
> + { "mcp4262-104", MCP426x_104 },
> + {}
> +};
> +MODULE_DEVICE_TABLE(spi, mcp4131_id);
> +
> +static struct spi_driver mcp4131_driver = {
> + .driver = {
> + .name = "mcp4131",
> + .of_match_table = of_match_ptr(mcp4131_dt_ids),
> + },
> + .probe = mcp4131_probe,
> + .remove = mcp4131_remove,
> + .id_table = mcp4131_id,
> +};
> +
> +module_spi_driver(mcp4131_driver);
> +
> +MODULE_AUTHOR("Slawomir Stepien ");
> +MODULE_DESCRIPTION("MCP4131 digital potentiometer");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
val, val2);
> + val, val2, &i);
>
> - if (i < 0)
> - return i;
> + if (ret < 0)
> + return ret;
>
> mutex_lock(&data->lock_ps);
> ret = regmap_field_write(data->reg_ps_rate, i);
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
indio_dev->id);
> + if (!afe->trig) {
> + dev_err(afe->dev, "Unable to allocate IIO trigger\n");
> + return -ENOMEM;
> + }
> +
> + iio_trigger_set_drvdata(afe->trig, indio_dev);
> +
> + afe->trig->ops = &afe4403_trigger_ops;
> + afe->trig->dev.parent = afe->dev;
> +
> + ret = iio_trigger_register(afe->trig);
> + if (ret) {
> + dev_err(afe->dev, "Unable to register IIO trigger\n");
> + return ret;
> + }
> +
> + ret = devm_request_threaded_irq(afe->dev, afe->irq,
> +
> iio_trigger_generic_data_rdy_poll,
> + NULL, IRQF_ONESHOT,
> + AFE4403_DRIVER_NAME,
> + afe->trig);
> + if (ret) {
> + dev_err(afe->dev, "Unable to request IRQ\n");
> + return ret;
> + }
> + }
> +
> + ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time,
> + afe4403_trigger_handler, NULL);
> + if (ret) {
> + dev_err(afe->dev, "Unable to setup buffer\n");
> + return ret;
> + }
> +
> + ret = iio_device_register(indio_dev);
> + if (ret) {
> + dev_err(afe->dev, "Unable to register IIO device\n");
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static int afe4403_remove(struct spi_device *spi)
> +{
> + struct iio_dev *indio_dev = spi_get_drvdata(spi);
> + struct afe4403_data *afe = iio_priv(indio_dev);
> + int ret;
> +
> + iio_device_unregister(indio_dev);
> +
> + iio_trigger_unregister(afe->trig);
> +
> + ret = regulator_disable(afe->regulator);
> + if (ret) {
> + dev_err(afe->dev, "Unable to disable regulator\n");
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static const struct spi_device_id afe4403_ids[] = {
> + { "afe4403", 0 },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(spi, afe4403_ids);
> +
> +static struct spi_driver afe4403_spi_driver = {
> + .driver = {
> + .name = AFE4403_DRIVER_NAME,
> + .of_match_table = of_match_ptr(afe4403_of_match),
> + .pm = &afe4403_pm_ops,
> + },
> + .probe = afe4403_probe,
> + .remove = afe4403_remove,
> + .id_table = afe4403_ids,
> +};
> +module_spi_driver(afe4403_spi_driver);
> +
> +MODULE_AUTHOR("Andrew F. Davis ");
> +MODULE_DESCRIPTION("TI AFE4403 Heart Rate and Pulse Oximeter");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald-Stadler
+43-664-218 (mobile)
ltage reference
> Thanks to Jonathan Cameron
>
> v2: A lot of CodeStyle Fixes
> Thanks to Peter Meerwald-Stadler and
> Jonathan Cameron
>
> CREDITS| 1 +
> drivers/iio/dac/Kconfig| 10 +
> dri
ly, I'd prefer to return something from _get_vref() instead of
first setting a could of variable and then checking a couple of variables
> + if (st->use_intref && !chip_info->int_vref) {
> + dev_err(&spi->dev, "Missing vref, cannot continue");
> > -Original Message-
> > From: Peter Meerwald-Stadler [mailto:pme...@pmeerw.net]
> > Sent: Tuesday, December 01, 2015 4:51 PM
> > To: Chen Haibo-B51421
> > Cc: ji...@kernel.org; knaac...@gmx.de; l...@metafoo.de;
> > shawn...@kernel.org; linux
static void imx7d_adc_power_down(struct imx7d_adc *info)
> +{
> + u32 adc_cfg;
> +
> + adc_cfg = readl(info->regs + IMX7D_REG_ADC_ADC_CFG);
> + adc_cfg |= IMX7D_REG_ADC_ADC_CFG_ADC_CLK_DOWN |
> +IMX7D_REG_ADC_ADC_CFG_ADC_POWER_DOWN;
> + adc_cf
onfig.max_register = chip->config->registers;
> +
> + mutex_init(&chip->state_lock);
> +
> + /* This is only used for device removal purposes. */
> + i2c_set_clientdata(client, indio_dev);
> +
> + indio_dev->name = id->name;
> + indio_dev->
a2xx_channels;
> + indio_dev->num_channels = ARRAY_SIZE(ina2xx_channels);
> +
> + indio_dev->dev.parent = &client->dev;
> + indio_dev->info = &ina2xx_info;
> + indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;
> +
> + ch
> +error_iio_device_register:
> + clk_disable_unprepare(info->clk);
> +error_adc_clk_enable:
> + regulator_disable(info->vref);
> +
> + return ret;
> +}
> +
> +static int imx7d_adc_remove(struct platform_device *pdev)
> +{
> + struct iio_dev *indio_
ttrs = as6200_attrs,
> +};
> +
> +static const struct iio_chan_spec as6200_channels[] = {
> + {
> + .type = IIO_TEMP,
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> + BIT(IIO_CHAN_INFO_SCALE),
> + }
> +};
> +
> +static const struct iio_info as6200_info = {
> + .read_raw = as6200_read_raw,
> + .attrs = &as6200_attr_group,
> + .driver_module = THIS_MODULE,
> +};
> +
> +static int as6200_detect(struct i2c_client *client,
> + struct i2c_board_info *info)
> +{
> + struct i2c_adapter *adapter = client->adapter;
> + const char *name = NULL;
> + char tx_buf[1];
> + char rx_buf[2];
> +
> + if (!i2c_check_functionality(adapter, I2C_FUNC_I2C |
> + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA))
> + return -ENODEV;
> + tx_buf[0] = 0x03;
> + i2c_master_send(client, tx_buf, 1);
> + i2c_master_recv(client, rx_buf, 2);
> + if (rx_buf[0] != 0x40 && rx_buf[1] != 0xA0)
> + return -ENODEV;
> +
> + name = "as6200";
> +
> + strlcpy(info->type, name, I2C_NAME_SIZE);
> +
> + return 0;
> +}
> +
> +static void initClientData(struct as6200_data *data)
> +{
> + data->dw = 0;
> + data->al = 1;
> + data->cr = 2; /* 250ms */
> + data->sm = 0; /* continuous or sleep mode */
use bool or enum?
> + data->im = 0; /* comparator */
> + data->pol = 0; /* alert irq active low */
> + data->cf = 0; /* 1 consecutive faults */
> + data->ss = 0; /* single shot conversion */
> +
> + /* registers */
> + data->config = 0x40A0; /* reflect above settings */
> + data->thigh = 0x4B00;
> + data->tlow = 0x5000;
> +}
> +
> +static int as6200_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
> +{
> + struct iio_dev *indio_dev = NULL;
> + struct as6200_data *data = NULL;
> +
> + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
drop newline here
> +
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + data = iio_priv(indio_dev);
> + i2c_set_clientdata(client, indio_dev);
> + data->client = client;
> +
> + indio_dev->dev.parent = &client->dev;
> + indio_dev->name = dev_name(&client->dev);
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->info = &as6200_info;
> +
> + indio_dev->channels = as6200_channels;
> + indio_dev->num_channels = ARRAY_SIZE(as6200_channels);
> +
> + initClientData(data);
> + mutex_init(&data->update_lock);
> + setupIRQ(indio_dev, true, 0);
> +
> + return iio_device_register(indio_dev);
> +}
> +
> +static int as6200_remove(struct i2c_client *client)
> +{
> + struct iio_dev *indio_dev;
> + struct as6200_data *data;
> + int irq_num;
> +
> + indio_dev = i2c_get_clientdata(client);
> + data = iio_priv(indio_dev);
> +
> + iio_device_unregister(indio_dev);
> + irq_num = data->irqn;
drop irq_num
> + free_irq(irq_num, &client->dev);
> + gpio_free(49);
magic 49?
> + return 0;
> +}
> +
> +static struct i2c_driver as6200_driver = {
> + .driver = {
> + .name = "as6200",
> + .owner = THIS_MODULE,
> + },
> + .probe = as6200_probe,
> + .remove = as6200_remove,
> + .id_table = as6200_id,
> + .detect = as6200_detect,
> + .address_list = normal_i2c,
i2c device are generally not auto-detected; drop .detect, .address_list
> +};
> +
> +static int __init as6200_init(void)
> +{
> + return i2c_add_driver(&as6200_driver);
> +}
> +
> +static void __exit as6200_exit(void)
> +{
> + i2c_del_driver(&as6200_driver);
> +}
> +module_init(as6200_init);
> +module_exit(as6200_exit);
use module_i2c_driver()
> +
> +MODULE_DESCRIPTION("ams AS6200 temperature sensor");
> +MODULE_AUTHOR("Elitsa Polizoeva ");
> +MODULE_AUTHOR("Florian Lobmaier ");
> +MODULE_LICENSE("GPL");
> --
> 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
+43-664-218 (mobile)
dev_err(&client->dev, "Could not register IIO device\n");
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static const struct acpi_device_id mxc6255_acpi_match[] = {
> + {"MXC6255", 0},
> + { }
> +};
> +MODULE_DEVICE_TABLE(acpi, mxc6255_acpi_match);
> +
> +static const struct i2c_device_id mxc6255_id[] = {
> + {"mxc6255", 0},
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, mxc6255_id);
> +
> +static struct i2c_driver mxc6255_driver = {
> + .driver = {
> + .name = MXC6255_DRV_NAME,
> + .acpi_match_table = ACPI_PTR(mxc6255_acpi_match),
> + },
> + .probe = mxc6255_probe,
> + .id_table = mxc6255_id,
> +};
> +
> +module_i2c_driver(mxc6255_driver);
> +
> +MODULE_AUTHOR("Teodora Baluta ");
> +MODULE_DESCRIPTION("MEMSIC MXC6255 orientation sensing accelerometer
> driver");
> +MODULE_LICENSE("GPL v2");
>
--
Peter Meerwald
+43-664-218 (mobile)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
indings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -46,6 +46,7 @@ digilentDiglent, Inc.
> dlg Dialog Semiconductor
> dlinkD-Link Corporation
> dmo Data Modul AG
> +dynaimageDyna-Image
> ebv EBV Elektronik
>
0x04
> +
> +/* INT FLAG BIT MASK */
> +#define AP3223_SYS_ALS_INT_TRI 0x01
> +#define AP3223_SYS_PS_INT_TRI 0x02
> +#define AP3223_SYS_PS_INT_OBJ 0x10
> +#define AP3223_SYS_PS_INT_IROV 0x20
> +
> +/* INT CLEAN Mode */
> +#defi
_gpadc_init(void)
> +{
> + return platform_driver_register(&palmas_gpadc_driver);
> +}
> +module_init(palmas_gpadc_init);
> +
> +static void __exit palmas_gpadc_exit(void)
> +{
> + platform_driver_unregister(&palmas_gpadc_driver);
> +}
> +module_exit(p
ndio_dev->dev.parent = dev;
> + indio_dev->info = &mcp4531_info;
> + indio_dev->channels = mcp4531_channels;
> + indio_dev->num_channels = MCP4531_WIPERS(devid);
> + indio_dev->name = client->name;
> +
> + return iio_device_register(indio_dev);
break;
> >> +case IIO_CHAN_INFO_SCALE:
> >> +switch (chan->type) {
> >> +case IIO_RESISTANCE:
> >> +*val = 10;
> >> +ret = IIO_VAL_INT;
> >> +break;
> >> +case IIO_CONCENTRATION:
+ data->last_update = jiffies - HZ;
> + mutex_init(&data->lock);
> +
> + indio_dev->dev.parent = &client->dev;
> + indio_dev->info = &vz89x_info,
> + indio_dev->name = dev_name(&client->dev);
> + indio_dev->modes = INDIO_DIRE
++ b/include/uapi/linux/iio/types.h
> @@ -35,6 +35,7 @@ enum iio_chan_type {
> IIO_ENERGY,
> IIO_DISTANCE,
> IIO_VELOCITY,
> + IIO_CONCENTRATION,
> };
>
> enum iio_modifier {
> @@ -72,6 +73,8 @@ enum iio_modifier {
> IIO_MOD_ROOT_SUM_SQU
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->info = &us5182d_info;
> + indio_dev->name
a->regmap = regmap;
> data->res = MMC35240_16_BITS_SLOW;
>
> + if (id) {
> + data->chipset = (enum mmc35240_chipset)(id->driver_data);
> + name = id->name;
> + } else if (ACPI_HANDLE(&client->dev)) {
> + name = mmc3524
_id bmg160_spi_id[] = {
> + {"bmg160", 0},
> + {"bmi055_gyro", 0},
> + {}
> +};
> +
> +MODULE_DEVICE_TABLE(spi, bmg160_spi_id);
> +
> +static struct spi_driver bmg160_spi_driver = {
> + .driver = {
> + .name = "bmg160_spi",
> Now the core implements the work queue, remove it from the drivers.
nice!
> Signed-off-by: Andrew Lunn
> Signed-off-by: Jacek Anaszewski
> Cc: Peter Meerwald
> Cc: Ricardo Ribalda
Acked-by: Peter Meerwald
> ---
> drivers/leds/
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->info = &a
; +};
> +MODULE_DEVICE_TABLE(of, max6675_dt_ids);
> +
> +static const struct spi_device_id max6675_spi_ids[] = {
> + {"max6675", 0},
> + {},
> +};
> +MODULE_DEVICE_TABLE(spi, max6675_spi_ids);
> +
> +static struct spi_driver max6675_driver
c_probe(struct platform_device *pdev)
> vf610_adc_cfg_init(info);
> vf610_adc_hw_init(info);
>
> + ret = vf610_adc_buffer_init(indio_dev);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "Couldn't initialise the buffer\n");
> + goto error_iio
> +sensor_iio_pollfunc, the function that
> + will be used as top half of poll function. It should do as little
> +processing as possible, because it runs in interrupt context. The most
> +common operation is recording of the current timestamp and for this
> reason
> +one can use the IIO core defined iio_pollfunc_store_time
> + function.
> +
> +sensor_trigger_handler, the function that
> +will be used as bottom half of the poll function. This runs in the
> +context of a kernel thread and all the processing takes place here.
> +It usually reads data from the device and stores it in the internal
> +buffer together with the timestamp recorded in the top half.
> +
> +
> +
> +
> +
> +
> + Resources
> + IIO core may change during time so the best documentation to read is
> the
> + source code. There are several locations where you should look:
> +
> +
> + drivers/iio/, contains the IIO core plus
> + and directories for each sensor type (e.g. accel, magnetometer,
> + etc.)
> +
> +
> + include/linux/iio/, contains the header
> + files, nice to read for the internal kernel interfaces.
> +
> +
> +include/uapi/linux/iio/, contains files to be
> + used by user space applications.
> +
> +
> + tools/iio/, contains tools for rapidly
> + testing buffers, events and device creation.
> +
> +
> + drivers/staging/iio/, contains code for some
> + drivers or experimental features that are not yet mature enough
> + to be moved out.
> +
> +
> +
> +Besides the code, there are some good online documentation sources:
> +
> +
> + http://marc.info/?l=linux-iio";> Industrial I/O mailing
> + list
> +
> +
> + http://wiki.analog.com/software/linux/docs/iio/iio";>
> + Analog Device IIO wiki page
> +
> +
> + https://fosdem.org/2015/schedule/event/iiosdr/";>
> + Using the Linux IIO framework for SDR, Lars-Peter Clausen's
> + presentation at FOSDEM
> +
> +
> +
> +
> +
> +
> +
>
--
Peter Meerwald
+43-664-218 (mobile)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
triggered buffer\n");
> + return ret;
> + }
> +
> ret = iio_device_register(indio_dev);
> if (ret < 0) {
> dev_err(&client->dev,
> "unable to register iio device %d\n", ret);
> - return ret;
>
utex);
> +
> + indio_dev->dev.parent = &client->dev;
> + indio_dev->channels = mxc4005_channels;
> + indio_dev->num_channels = ARRAY_SIZE(mxc4005_channels);
> + indio_dev->name = MXC4005_DRV_NAME;
> + indio_dev->modes = INDIO_DIRECT_MODE;
>
define INDIO_BUFFER_HARDWARE0x08
> +#define INDIO_EVENT_TRIGGERED0x10
>
> #define INDIO_ALL_BUFFER_MODES \
> (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE)
> diff --git a/includ
r_trigger_poll.attr,
> NULL,
> };
>
> @@ -164,6 +219,7 @@ static int iio_sysfs_trigger_probe(int id)
> iio_trigger_set_drvdata(t->trig, t);
>
> init_irq_work(&t->work, iio_sysfs_trigger_work);
> + INIT_DELAYED_WORK(&t->poll_work, iio_sysfs_t
gt; +
> + spi_set_drvdata(spi, idev);
> + mutex_init(&priv->lock);
> + INIT_DELAYED_WORK(&priv->work, hi8435_debounce_work);
> +
> + idev->dev.parent= &spi->dev;
> + idev->name = spi_get_device_id(spi)->name
review
> The second patch corrects how interrupts are described as IIO events. It
> exists
> seperately because it changes the driver's behaviour for existing users of
> mma8452.
what is the difference?
thanks, p.
--
Peter Meerwald
+43-664-218 (mobile)
--
To uns
tning sensor which uses the proximity
> API, while not being a true proximity sensor.
Acked-by: Peter Meerwald
> Fixes: 614e8842ddf ("iio: ABI: add clarification for proximity")
> Signed-off-by: Daniel Baluta
> ---
> Documentation/ABI/testing/sysfs-bus-iio | 6 +
;mutex);
> if (ret < 0)
> return ret;
> - ret = mmc35240_raw_to_gauss(data, chan->address,
> - buf, val, val2);
> + ret = mmc35240_raw_to_mgauss(data, chan->address, buf, val);
> if
[0] = X_COEFFICIENT(1);
> + data->axis_coef[1] = Y_COEFFICIENT(y_convert);
> + data->axis_coef[2] = Z_COEFFICIENT(z_convert);
> +
> + data->axis_scale[0] = 1;
> + data->axis_scale[1] = 1000;
> + data->axis_scale[2] = 1;
> +
> + return 0;
&
0) {
> >> + rpr0521_set_power_state(data, false, device_mask);
> >> + mutex_unlock(&data->lock);
> >> + return ret;
> >> + }
> >> +
> >> + ret = rpr0521_set_power_state(data, false, device_mask);
> >> + mutex_unlock(&data->lock);
> >> + if (ret < 0)
> >> + return ret;
> >> +
> >> + *val = le16_to_cpu(raw_data);
> >> + /*
> >> + * proximity uses 12 bits, with bits 7:4 of PXS MSB DATA
> >> + * being always zero. Also, proximity MUST be exposed as
> >> + * a distance with lower values for closer objects.
> >
> > this matter hasn't been settled, all other proximity sensor drivers do it
> > the other way around
>
> Which sensors? It means they do not agree with the ABI:
>
> http://lxr.free-electrons.com/source/Documentation/ABI/testing/sysfs-bus-iio#L1131
that 'clarification' was added recently,
614e8842ddf5502f0e781f91695bfbc1e1e1d9b6 (with 3.18)
"Proximity measurement .. by observing reflectivity"
high proximity <-> high reflectivity -- this is the reality of what most
sensors output (including yours)
proximity and distance are opposite concepts;
high proximity <-> low distance, and vice versa
the distance part doesn't make sense in the ABI description
> >
> >> + */
> >> + if (chan->type == IIO_PROXIMITY)
> >> + *val = RPR0521_PXS_MAX_VAL - *val;
> >
> > really this should be _PROCESSED, not _RAW?
>
> I understand and it makes sense. Anyhow, looking at
> drivers/iio/proximity/sx9500.c
> it seems to be using _RAW.
>
> > how to handle it for buffered reads?
>
> Not sure I understand this. Care to add more details :)?
> I would expect that for buffer mode we create an item with 12 realbits and
> 16 storage bits, and to copy the data from register to buffer.
in buffered mode we want to avoid manipulating the data (i.e. MAX_DATA -
measurement_value)
since MAX_DATA is not exposed, user mode cannot do this computation and
_RAW differs from the buffered output
(I assume that we want to have buffered output correspond to _RAW values)
> >> + pm_runtime_set_autosuspend_delay(&client->dev,
> >> RPR0521_SLEEP_DELAY_MS);
> >> + pm_runtime_use_autosuspend(&client->dev);
> >> +
> >> + return 0;
> >
> > maybe some whitespace here
> >
> do you mean remove the new line? :)
add a newline if I predict Jonathan's perference correctly :)
--
Peter Meerwald
+43-664-218 (mobile)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
ntdata(client);
> +
> + pm_runtime_disable(&client->dev);
> + pm_runtime_set_suspended(&client->dev);
> + pm_runtime_put_noidle(&client->dev);
> +
> + iio_device_unregister(indio_dev);
> + rpr0521_poweroff(iio_priv(indio_dev));
> +
esn't match the function name, the text, 'for %d', is
not very clear
> + if (on)
> + pm_runtime_put_noidle(dev);
> +
> + return ret;
> + }
> +#endif
> + return 0;
> +}
> +
> +#endif /* __IIO_PM_RUNTIME */
>
--
Peter Meerwald
+43-664-218 (mobile)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
*val = ltr501_calculate_lux(le16_to_cpu(buf[1]),
> + le16_to_cpu(buf[0]));
> + return IIO_VAL_INT;
> + default:
> + return -EINVAL;
> + }
> case IIO_CHAN_INFO_RAW:
> if (iio_buffer_enabled(indio_dev))
> return -EBUSY;
>
--
Peter Meerwald
+43-664-218 (mobile)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
smbus_write_byte(client, BH1750_POWER_DOWN);
> + mutex_unlock(&data->lock);
> +
> + return 0;
> +}
> +
> +#ifdef CONFIG_PM_SLEEP
> +static int bh1750_suspend(struct device *dev)
> +{
> + int ret;
> + struct bh1750_data *data =
> + iio_priv(i
ruct bh1750_data *data =
> + iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
> +
> + mutex_lock(&data->lock);
> + ret = i2c_smbus_write_byte(data->client, BH1750_POWER_DOWN);
> + mutex_unlock(&data->lock);
> +
> + return ret;
>dev, sizeof(*data));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + regmap = devm_regmap_init_i2c(client, &mmc35240_regmap_config);
> + if (IS_ERR(regmap)) {
> + dev_err(&client->dev, "regmap initialization failed\n");
- /dev/null
> +++ b/include/linux/iio/iio_configfs_trigger.h
> @@ -0,0 +1,48 @@
> +#ifndef __IIO_CONFIGFS_TRIGGER
> +#define __IIO_CONFIGFS_TRIGGER
> +
> +#define IIO_TRIGGER_TYPE_NONE0
> +
> +struct iio_configfs_trigger_info {
> + const char *name;
> +
clude/linux/iio) and then support it in iio_trigger_set_configfs_ops
> +function from industrialiio-configfs.c file.
> +
> +These are the existing drivers implementing new trigger types:
> + * hrtimer => iio/trigger/iio-trig-hrtimer.c
> +
> +4. Further work
> +
> +* IIO
> + idev->modes = INDIO_DIRECT_MODE;
> + idev->info = &berlin2_adc_info;
> +
> + idev->num_channels = N_CHANNELS;
> + idev->channels = berlin2_adc_channels;
> +
> + /* Power up the ADC */
> + regmap_read(priv->regmap, SYSCTL_SM_CTRL, &val);
> +
turn ret;
> +
> + *val = (buf[0] << 16) | (buf[1] << 8) | buf[0];
buf[2]?
> + return 0;
> +}
> +
> +static int ms5611_read_adc_temp_and_pressure(struct device *dev,
> + s32 *temp, s32 *pressure)
> +{
>
General Public License (GPL), version 2
> + */
> +
> +#include
> +#include
> +#include
> +#include
> +#include
> +#include
> +
> +static const char *const stm32_compat[] __initconst = {
> + "st,stm32f429",
> + NULL
> +};
> +
> +static void __
ata.
> > Will fix this in the next version. Thanks for catching this!
> >
> I don't think changing to IIO_LE is good idea as when i2c_read_bock..
> then the scan type will be CPU. So better to fix endianness in this
> function.
the chip has little-endian data registers;
t line
> +
> static struct i2c_driver cm3232_driver = {
> .driver = {
> .name = "cm3232",
> .owner = THIS_MODULE,
> .of_match_table = of_match_ptr(cm3232_of_match),
> + .pm = &cm3232_pm_ops,
>
INV_MPU6050_BIT_PWR_ACCL_STBY);
> if (result)
> - return result;
> + goto write_error;
> result = inv_mpu6050_set_power_itg(st, false);
> if (result)
> -
optimize i2c transfers in trigger handler
>
> drivers/iio/gyro/bmg160.c | 50
> ---
> 1 file changed, 39 insertions(+), 11 deletions(-)
>
>
--
Peter Meerwald
+43-664-218 (mobile)
--
To unsubscribe from this list: send the
mc150: optimize i2c transfers in trigger handler
>
> drivers/iio/accel/bmc150-accel.c | 49
> +++-
> 1 file changed, 38 insertions(+), 11 deletions(-)
>
>
--
Peter Meerwald
+43-664-218 (mobile)
--
To unsubscribe from this list: send t
lient = client;
>
> + if (i2c_check_functionality(client->adapter,
> + I2C_FUNC_SMBUS_READ_I2C_BLOCK))
> + data->read_block_data = i2c_smbus_read_i2c_block_data;
> + else
> + data->read_block_data = kxcjk10
e available_scan_masks
> iio: accel: kxcjk-1013: optimize i2c transfers in trigger handler
>
> drivers/iio/accel/kxcjk-1013.c | 50
> --
> 1 file changed, 39 insertions(+), 11 deletions(-)
>
>
--
Peter Meerwald
+43-664-21
nfo = &cm3323_info;
> + indio_dev->name = CM3323_DRV_NAME;
> + indio_dev->channels = cm3323_channels;
> + indio_dev->num_channels = ARRAY_SIZE(cm3323_channels);
> + indio_dev->modes = INDIO_DIRECT_MODE;
> +
> + ret = cm3323_init(indio_dev);
> + if
mutex_lock(&data->lock);
> + ret = kmx61_set_scale(data, val2);
> + mutex_unlock(&data->lock);
> + break;
> + default:
> + ret = -EINVAL;
return -EINVAL
> + }
return r
o_dev->modes = INDIO_DIRECT_MODE;
> > + indio_dev->channels = ms5637_channels;
> > + indio_dev->num_channels = ARRAY_SIZE(ms5637_channels);
> > +
> > + i2c_set_clientdata(client, indio_dev);
> > + ret = iio_device_register(indio_dev);
> > + if (ret < 0)
> > + return ret;
> > +
> > + ret = i2c_smbus_write_byte(client, MS5637_RESET);
I'd rather do this before iio_device_register() -- what happens when it
fails? there is no unregister()
> > + if (ret < 0)
> > + return ret;
> > + usleep_range(3000, 6000);
> > +
> > + ret = ms5637_fill_calibration_coeffs(dev_data);
> > + if (ret == 0)
> > + dev_data->got_calibration_words = true;
> > +
> > + if (ret < 0)
> > + return ret;
> > +
> > + dev_dbg(&client->dev, "Driver initialization done");
> > + return 0;
> > +}
> > +
> > +static int ms5637_remove(struct i2c_client *client)
> > +{
> > + struct iio_dev *indio_dev = i2c_get_clientdata(client);
> > +
> > + iio_device_unregister(indio_dev);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct i2c_device_id ms5637_id[] = {
> > + {"ms5637", 0},
> > + {}
> > +};
> > +
> > +static struct i2c_driver ms5637_driver = {
> > + .probe = ms5637_probe,
> > + .remove = ms5637_remove,
> > + .id_table = ms5637_id,
> > + .driver = {
> > + .name = "ms5637",
> > + .owner = THIS_MODULE,
> > + },
> > +};
> > +
> > +module_i2c_driver(ms5637_driver);
> > +
> > +MODULE_LICENSE("GPL");
> > +MODULE_DESCRIPTION("Measurement Specialties MS5637 temperature driver");
> > +MODULE_AUTHOR("William Markezana ");
> > +MODULE_AUTHOR("Ludovic Tancerel ");
> > diff --git a/drivers/staging/iio/Documentation/pressure/ms5637
> > b/drivers/staging/iio/Documentation/pressure/ms5637
> > new file mode 100644
> > index 000..d0d64f3
> > --- /dev/null
> > +++ b/drivers/staging/iio/Documentation/pressure/ms5637
> > @@ -0,0 +1,25 @@
> > +Kernel driver ms5637
> > +
> > +
> > +Supported chips:
> > + * Measurement Specialties MS5637
> > +Prefix: 'ms5637'
> > +Addresses scanned: I2C 0x76
0x77 is claimed at the top of ms5637.c
> > +Datasheet: Available for download on meas-spec.com
> > +
> > +Authors:
> > +William Markezana (Meas-Spec)
> > +Ludovic Tancerel
> > +
> > +Description
> > +---
> > +
> > +The MS5637 is a single chip pressure & temperature sensor.
> > +The driver returns a milli-bar pressure value and a milli-degre celius
> > value using the iio framework
degree; the information so far is redundant
> > +
> > +Via the iio sysfs interface, there are several attributes available.
> > +in_reset - Reset ms5637 device by writing a 1 in it.
> > +in_resolution - Set the number of bits for ADC resolution.
> > +out_pressure_input - Current pressure from ms5637 sensor (milli-bar)
> > +out_temp_input - Current temperature from htu21 sensor (milli-°C value)
> > +resolution_available - List of resolutions supported
in_, not out_
regular IIO channels (integration time?) could/should be used
I don't know about reset, needed?
private ABI should go to documentation/ABI/testing/sysfs-bus-iio-*
> > --
> > 1.7.9.5
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
Peter Meerwald
+43-664-218 (mobile)
;
> > +
> > + /* Scale it to nono Ohms */
> Typo: nano
> > + int_sense = IADC_INT_RSENSE_IDEAL_VALUE * 1000;
> > + int_sense += sign * deviation * IADC_INT_RSENSE_DEVIATION;
> > + int_sense /= 1000; /* micro Ohms */
> > +
> > + iadc->rsense[IADC_INT
> kdbus is a system for low-latency, low-overhead, easy to use
> interprocess communication (IPC).
>
> The interface to all functions in this driver is implemented through ioctls
> on /dev nodes. This patch adds detailed documentation about the kernel
> level API design.
just some typos below
C_SMBUS_WORD_DATA))
> > > + return -ENODEV;
> > > +
> > > + dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> > > + if (!dev)
> > > + return -ENOMEM;
> > > +
> > > + data = iio_priv(dev);
> > > + i2c_set_c
_CLIENT_END
> +};
> +
> +static const struct i2c_device_id si701x_id[] = {
> + { "si701x", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, si701x_id);
> +
> +static struct i2c_driver si701x_driver = {
> + .class = I2C_CLASS_HWMON,
> +
value, use i2c_smbus_read_word instead of
> i2c_smbus_read_word_swapped and fix the endianess after read.
no need to fix endianness
> * small coding style fixes
>
> Changes since v2: (reported by Peter Meerwald)
> * removed definition of DATA_HIGH and SW_
;client->dev;
> - indio_dev->channels = bmc150_accel_channels;
> - indio_dev->num_channels = ARRAY_SIZE(bmc150_accel_channels);
> - indio_dev->name = BMC150_ACCEL_DRV_NAME;
> + indio_dev->channels = data->chip_info->channels;
> + indio_dev->num_channels = d
Signed-off-by: Daniel Baluta
> ---
> Changes since v1: (reported by Peter Meerwald)
> * used u8 instead of int for passing gain and mean_time
> * used i2c_smbus_read_word_swapped instead of 2 x
> i2c_smbus_read_byte_data
> * used devm_iio_device_register instead
101 - 200 of 238 matches
Mail list logo