Re: [PATCH 1/1] iio: vcnl4000: Add IR current adjust support

2016-07-18 Thread Peter Meerwald-Stadler
0_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, _regmap_config); > + if (IS_ERR(data->regmap)) { > + dev_err(>dev, "regmap_init failed!\n"); > + return PTR_ERR(data->regmap); > + } > i2c_set_clientdata(client, indio_dev); > + mutex_init(>lock); > data->client = client; > > ret = i2c_smbus_read_byte_data(data->client, VCNL4000_PROD_REV); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH 1/1] iio: vcnl4000: Add IR current adjust support

2016-07-18 Thread Peter Meerwald-Stadler
able_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, _regmap_config); > + if (IS_ERR(data->regmap)) { > + dev_err(>dev, "regmap_init failed!\n"); > + return PTR_ERR(data->regmap); > + } > i2c_set_clientdata(client, indio_dev); > + mutex_init(>lock); > data->client = client; > > ret = i2c_smbus_read_byte_data(data->client, VCNL4000_PROD_REV); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH 04/10] iio: cros_ec: Add common functions for cros_ec sensors.

2016-07-18 Thread Peter Meerwald-Stadler
uct ec_params_motion_sense param; > + struct ec_response_motion_sense *resp; > + > + /* Type of sensor */ > + 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)

Re: [PATCH 04/10] iio: cros_ec: Add common functions for cros_ec sensors.

2016-07-18 Thread Peter Meerwald-Stadler
; + /* Type of sensor */ > + 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)

Re: [PATCH] iio: Add IIO support for the Measurement Computing CIO-DAC family

2016-07-11 Thread Peter Meerwald-Stadler
return -EBUSY; > + } > + > + indio_dev->info = _dac_info; > + 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 <vilhelm.g...@gmail.com>"); > +MODULE_DESCRIPTION("Measurement Computing CIO-DAC DAC driver"); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH] iio: Add IIO support for the Measurement Computing CIO-DAC family

2016-07-11 Thread Peter Meerwald-Stadler
> + 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)

Re: [PATCH] iio: dac: mcp4725: Remove unneeded conversions to bool

2016-07-01 Thread Peter Meerwald-Stadler
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 reg

Re: [PATCH] iio: dac: mcp4725: Remove unneeded conversions to bool

2016-07-01 Thread Peter Meerwald-Stadler
e(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 gnd */ &g

Re: [PATCH 1/1] drivers:iio:light:isl29125: added macros for sensing range

2016-06-27 Thread Peter Meerwald-Stadler
NGE_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)

Re: [PATCH 1/1] drivers:iio:light:isl29125: added macros for sensing range

2016-06-27 Thread Peter Meerwald-Stadler
NGE_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)

RE: [PATCH V1 1/1] iio: as6200: add AS6200 temperature sensor driver from ams AG

2016-06-21 Thread Peter Meerwald-Stadler
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 = >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(>update_lock); > > +data->irqn = irq_num; > > +mutex_unlock(>update_lock); > > What exactly is protect by that mutex here? > > > + > > +return 0; > > +} > > + > [...] > > +if (err == 0) { > > +if ((val < -40) | (val > 150)) { > > +dev_info(>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(>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 = >dev; indio_dev->name = > > +dev_name(>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 = _info; > > + > > +indio_dev->channels = as6200_channels; indio_dev->num_channels = > > +ARRAY_SIZE(as6200_channels); > > + > > +initClientData(data); > > +mutex_init(>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)

RE: [PATCH V1 1/1] iio: as6200: add AS6200 temperature sensor driver from ams AG

2016-06-21 Thread Peter Meerwald-Stadler
gt; 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 = >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(>update_lock); > > +data->irqn = irq_num; > > +mutex_unlock(>update_lock); > > What exactly is protect by that mutex here? > > > + > > +return 0; > > +} > > + > [...] > > +if (err == 0) { > > +if ((val < -40) | (val > 150)) { > > +dev_info(>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(>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 = >dev; indio_dev->name = > > +dev_name(>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 = _info; > > + > > +indio_dev->channels = as6200_channels; indio_dev->num_channels = > > +ARRAY_SIZE(as6200_channels); > > + > > +initClientData(data); > > +mutex_init(>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)

Re: [PATCH] iio: light: tcs3472: use iio helper function to guarantee direct mode

2016-06-06 Thread Peter Meerwald-Stadler
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 <pme..

Re: [PATCH] iio: light: tcs3472: use iio helper function to guarantee direct mode

2016-06-06 Thread Peter Meerwald-Stadler
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 >

Re: [PATCH] iio: light: isl29125: use iio helper function to guarantee direct mode

2016-06-06 Thread Peter Meerwald-Stadler
> 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 <pme...@pmeerw.net> > Signed-off-by

Re: [PATCH] iio: light: isl29125: use iio helper function to guarantee direct mode

2016-06-06 Thread Peter Meerwald-Stadler
> 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

Re: [PATCH] iio: light: tcs3414: use iio helper function to guarantee direct mode

2016-06-06 Thread Peter Meerwald-Stadler
> 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 <pme...@pmeerw.net> > Signed-off-by: Alison

Re: [PATCH] iio: light: tcs3414: use iio helper function to guarantee direct mode

2016-06-06 Thread Peter Meerwald-Stadler
> 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

Re: [PATCH 1/1] iio: light: Added CM36672 Proximity Sensor Driver.

2016-05-29 Thread Peter Meerwald-Stadler
+ ret = i2c_smbus_write_word_data(chip->client, > + CM36672_ADDR_PRX_CONF, > + chip->regs[CM36672_ADDR_PRX_CONF]); > + if (ret) { > + dev_err(>dev, > + "%s: enable interrupt failed\n", > + __func__); > + return ret; > + } > + } > + } > + > + ret = iio_device_register(indio_dev); > + if (ret) { > + dev_err(>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 = _pm_ops, > +#endif > + }, > + .id_table = cm36672_id, > + .probe = cm36672_probe, > + .remove = cm36672_remove, > +}; > + > +module_i2c_driver(cm36672_driver); > + > +MODULE_AUTHOR("Kevin Tsai <capellami...@gmail.com>"); > +MODULE_DESCRIPTION("CM36672 proximity sensor driver"); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH 1/1] iio: light: Added CM36672 Proximity Sensor Driver.

2016-05-29 Thread Peter Meerwald-Stadler
chip->regs[CM36672_ADDR_PRX_CONF]); > + if (ret) { > + dev_err(>dev, > + "%s: enable interrupt failed\n", > + __func__); > + return ret; > + } > + } > + } > + > + ret = iio_device_register(indio_dev); > + if (ret) { > + dev_err(>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 = _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)

Re: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals

2016-05-20 Thread Peter Meerwald-Stadler
hannels); > } > > - /* 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)

Re: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals

2016-05-20 Thread Peter Meerwald-Stadler
hannels); > } > > - /* 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)

[RFC] iio: Add driver for Silabs si1132, si1141/2/3 and si1145/6/7 ambient light, uv index and proximity sensors

2016-05-19 Thread Peter Meerwald-Stadler
From: Peter Meerwald <pme...@pmeerw.net> 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 b

[RFC] iio: Add driver for Silabs si1132, si1141/2/3 and si1145/6/7 ambient light, uv index and proximity sensors

2016-05-19 Thread Peter Meerwald-Stadler
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

Re: [PATCH v3] iio: max5487: Add support for Maxim digital potentiometers

2016-05-17 Thread Peter Meerwald-Stadler
; +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 <cristina.morar...@gmail.com>"); > +MODULE_DESCRIPTION("max5487 SPI driver"); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH v3] iio: max5487: Add support for Maxim digital potentiometers

2016-05-17 Thread Peter Meerwald-Stadler
tatic 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)

Re: getting mysterious (to me) EINVAL from inotify_rm_watch

2016-05-11 Thread Peter Meerwald-Stadler
tch(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)

Re: getting mysterious (to me) EINVAL from inotify_rm_watch

2016-05-11 Thread Peter Meerwald-Stadler
tch(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)

Re: [PATCH v2] iio: accel: Add support for Freescale MMA7660FC

2016-04-29 Thread Peter Meerwald-Stadler
to_i2c_client(dev))); > + > + return mma7660_set_mode(data, MMA7660_MODE_STANDBY); > +} > + > +static int mma7660_resume(struct device *dev) > +{ > + struct mma7660_data *data; > + > + data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); > + > + return mma7660_set_mode(data, MMA7660_MODE_ACTIVE); > +} > + > +static SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend, mma7660_resume); > + > +#define MMA7660_PM_OPS (_pm_ops) > +#else > +#define MMA7660_PM_OPS NULL > +#endif > + > +static const struct i2c_device_id mma7660_i2c_id[] = { > + {"MMA7660", 0}, really uppercase? > + {} > +}; > + > +static const struct acpi_device_id mma7660_acpi_id[] = { > + {"MMA7660", 0}, > + {} > +}; > + > +MODULE_DEVICE_TABLE(acpi, mma7660_acpi_id); > + > +static struct i2c_driver mma7660_driver = { > + .driver = { > + .name = "mma7660", > + .pm = MMA7660_PM_OPS, > + .acpi_match_table = ACPI_PTR(mma7660_acpi_id), > + }, > + .probe = mma7660_probe, > + .remove = mma7660_remove, > + .id_table = mma7660_i2c_id, > +}; > + > +module_i2c_driver(mma7660_driver); > + > +MODULE_AUTHOR("Constantin Musca <constantin.mu...@intel.com>"); > +MODULE_DESCRIPTION("Freescale MMA7660FC 3-Axis Accelerometer driver"); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH v2] iio: accel: Add support for Freescale MMA7660FC

2016-04-29 Thread Peter Meerwald-Stadler
> + return mma7660_set_mode(data, MMA7660_MODE_STANDBY); > +} > + > +static int mma7660_resume(struct device *dev) > +{ > + struct mma7660_data *data; > + > + data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); > + > + return mma7660_set_mode(data, MMA7660_MODE_ACTIVE); > +} > + > +static SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend, mma7660_resume); > + > +#define MMA7660_PM_OPS (_pm_ops) > +#else > +#define MMA7660_PM_OPS NULL > +#endif > + > +static const struct i2c_device_id mma7660_i2c_id[] = { > + {"MMA7660", 0}, really uppercase? > + {} > +}; > + > +static const struct acpi_device_id mma7660_acpi_id[] = { > + {"MMA7660", 0}, > + {} > +}; > + > +MODULE_DEVICE_TABLE(acpi, mma7660_acpi_id); > + > +static struct i2c_driver mma7660_driver = { > + .driver = { > + .name = "mma7660", > + .pm = MMA7660_PM_OPS, > + .acpi_match_table = ACPI_PTR(mma7660_acpi_id), > + }, > + .probe = mma7660_probe, > + .remove = mma7660_remove, > + .id_table = mma7660_i2c_id, > +}; > + > +module_i2c_driver(mma7660_driver); > + > +MODULE_AUTHOR("Constantin Musca "); > +MODULE_DESCRIPTION("Freescale MMA7660FC 3-Axis Accelerometer driver"); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH] iio: tmp006: Set correct iio name

2016-04-28 Thread Peter Meerwald-Stadler
dev->name = dev_name(>dev); ./humidity/si7005.c:indio_dev->name = dev_name(>dev); ./humidity/hdc100x.c: indio_dev->name = dev_name(>dev); ./humidity/si7020.c:indio_dev->name = dev_name(>dev); regards, p. -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH] iio: tmp006: Set correct iio name

2016-04-28 Thread Peter Meerwald-Stadler
dev->name = dev_name(>dev); ./humidity/si7005.c:indio_dev->name = dev_name(>dev); ./humidity/hdc100x.c: indio_dev->name = dev_name(>dev); ./humidity/si7020.c:indio_dev->name = dev_name(>dev); regards, p. -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH] iio: potentiometer: add driver for Maxim Integrated DS1803

2016-04-08 Thread Peter Meerwald-Stadler
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)

Re: [PATCH] iio: potentiometer: add driver for Maxim Integrated DS1803

2016-04-08 Thread Peter Meerwald-Stadler
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)

Re: [PATCH 5/5] max44000: Initial triggered buffer support

2016-04-07 Thread Peter Meerwald-Stadler
> { > @@ -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) { > + dev_err(>d

Re: [PATCH 5/5] max44000: Initial triggered buffer support

2016-04-07 Thread Peter Meerwald-Stadler
@ -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) { > + dev_err(>dev, "iio triggered buffer

Re: [PATCH 1/5] max44000: Initial commit

2016-04-07 Thread Peter Meerwald-Stadler
ve obsolete > +} > + > +static int max44000_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 max44000_id[] = { >

Re: [PATCH 1/5] max44000: Initial commit

2016-04-07 Thread Peter Meerwald-Stadler
+static int max44000_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 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)

Re: [PATCH] iio: potentiometer: add driver for Maxim Integrated DS1803

2016-04-07 Thread Peter Meerwald-Stadler
dev); > +} > + > +#if defined(CONFIG_OF) > +static const struct of_device_id ds1803_dt_ids[] = { > + { .compatible = "maxim,ds1803-010", .data = _cfg[DS1803_010] }, > + { .compatible = "maxim,ds1803-050", .data = _cfg[DS1803_050] }, > + { .compatible = "maxim,ds1803-100", .data = _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 <s...@poczta.fm>"); > +MODULE_DESCRIPTION("DS1803 digital potentiometer"); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH] iio: potentiometer: add driver for Maxim Integrated DS1803

2016-04-07 Thread Peter Meerwald-Stadler
; +#if defined(CONFIG_OF) > +static const struct of_device_id ds1803_dt_ids[] = { > + { .compatible = "maxim,ds1803-010", .data = _cfg[DS1803_010] }, > + { .compatible = "maxim,ds1803-050", .data = _cfg[DS1803_050] }, > + { .compatible = "maxim,ds1803-100", .data = _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)

Re: [PATCH] iio: imu: Add initial support for Bosch BMI160

2016-04-01 Thread Peter Meerwald-Stadler
; +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 <daniel.bal...@intel.com>"); > +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, _regmap_config); > + if (IS_ERR(regmap)) { > + dev_err(>dev, "Failed to register spi regmap %d\n", > + (int)PTR_ERR(regmap)); > + return PTR_ERR(regmap); > + } > + return bmi160_core_probe(>dev, regmap, id->name, true); > +} > + > +static int bmi160_spi_remove(struct spi_device *spi) > +{ > + bmi160_core_remove(>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 <daniel.bal...@intel.com"); > +MODULE_DESCRIPTION("Bosch BMI160 SPI driver"); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH] iio: imu: Add initial support for Bosch BMI160

2016-04-01 Thread Peter Meerwald-Stadler
_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, _regmap_config); > + if (IS_ERR(regmap)) { > + dev_err(>dev, "Failed to register spi regmap %d\n", > + (int)PTR_ERR(regmap)); > + return PTR_ERR(regmap); > + } > + return bmi160_core_probe(>dev, regmap, id->name, true); > +} > + > +static int bmi160_spi_remove(struct spi_device *spi) > +{ > + bmi160_core_remove(>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)

Re: [PATCH 2/2] ti-adc081c: Initial triggered buffer support

2016-04-01 Thread Peter Meerwald-Stadler
t; if (err < 0) > - goto regulator_disable; > + goto err_buffer_cleanup; > > i2c_set_clientdata(client, iio); > > return 0; > > -regulator_disable: > +err_buffer_cleanup: > + iio_triggered_buffer_cleanup(iio); > +err_regulator_disable: > regulator_disable(adc->ref); > > return err; > @@ -143,9 +210,9 @@ static int adc081c_remove(struct i2c_client *client) > } iio_triggered_buffer_cleanup() in _remove()? > static const struct i2c_device_id adc081c_id[] = { > - { "adc081c", 8 }, > - { "adc101c", 10 }, > - { "adc121c", 12 }, > + { "adc081c", (long)_model }, often an enum is used instead of a pointer > + { "adc101c", (long)_model }, > + { "adc121c", (long)_model }, > { } > }; > MODULE_DEVICE_TABLE(i2c, adc081c_id); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH 2/2] ti-adc081c: Initial triggered buffer support

2016-04-01 Thread Peter Meerwald-Stadler
goto regulator_disable; > + goto err_buffer_cleanup; > > i2c_set_clientdata(client, iio); > > return 0; > > -regulator_disable: > +err_buffer_cleanup: > + iio_triggered_buffer_cleanup(iio); > +err_regulator_disable: > regulator_disable(adc->ref); > > return err; > @@ -143,9 +210,9 @@ static int adc081c_remove(struct i2c_client *client) > } iio_triggered_buffer_cleanup() in _remove()? > static const struct i2c_device_id adc081c_id[] = { > - { "adc081c", 8 }, > - { "adc101c", 10 }, > - { "adc121c", 12 }, > + { "adc081c", (long)_model }, often an enum is used instead of a pointer > + { "adc101c", (long)_model }, > + { "adc121c", (long)_model }, > { } > }; > MODULE_DEVICE_TABLE(i2c, adc081c_id); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH 1/2] ti-adc081c: Add support for adc101c* and adc121c*

2016-04-01 Thread Peter Meerwald-Stadler
_DEVICE_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 <thierry.red...@avionic-design.de>"); > -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)

Re: [PATCH 1/2] ti-adc081c: Add support for adc101c* and adc121c*

2016-04-01 Thread Peter Meerwald-Stadler
> #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)

Re: [PATCH 1/1] iio: accel: bmc150: fix endianness when reading axes

2016-03-28 Thread Peter Meerwald-Stadler
\ > + .endianness = IIO_LE, \ > }, \ > .event_spec = _accel_event, \ > .num_event_specs = 1\ > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH 1/1] iio: accel: bmc150: fix endianness when reading axes

2016-03-28 Thread Peter Meerwald-Stadler
\ > }, \ > .event_spec = _accel_event, \ > .num_event_specs = 1\ > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH v2] hp206c: Initial support for reading sensor values

2016-03-28 Thread Peter Meerwald-Stadler
"all required i2c functionality\n"); > + return -ENODEV; > + } > + > + indio_dev = devm_iio_device_alloc(>dev, sizeof(*data)); > + if (!indio_dev) > + return -ENOMEM; > + > + data = iio_priv(indio_dev); > + data->client = client; > + mutex_init(>mutex); > + > + indio_dev->info = _info; > + indio_dev->name = id->name; > + indio_dev->dev.parent = >dev; > + indio_dev->modes = INDIO_DIRECT_MODE; > + indio_dev->channels = hp206c_channels; > + indio_dev->num_channels = ARRAY_SIZE(hp206c_channels); > + > + i2c_set_clientdata(client, indio_dev); > + > + /* Do a soft reset on probe */ > + ret = hp206c_soft_reset(indio_dev); > + if (ret) { > + dev_err(>dev, "Failed to reset on startup: %d\n", ret); > + /* Maybe it will recover later? */ I suggest to return -ENODEV; > + } > + > + return devm_iio_device_register(>dev, indio_dev); > +} > + > +static const struct i2c_device_id hp206c_id[] = { > + {"hp206c"}, > + {} > +}; > + > +static const struct acpi_device_id hp206c_acpi_match[] = { > + {"HOP206C", 0}, > + { }, > +}; > +MODULE_DEVICE_TABLE(acpi, hp206c_acpi_match); > + > +static struct i2c_driver hp206c_driver = { > + .probe = hp206c_probe, > + .id_table = hp206c_id, > + .driver = { > + .name = "hp206c", > + .acpi_match_table = ACPI_PTR(hp206c_acpi_match), > + }, > +}; > + > +module_i2c_driver(hp206c_driver); > + > +MODULE_DESCRIPTION("HOPERF HP206C precision barometer and altimeter sensor"); > +MODULE_AUTHOR("Leonard Crestez <leonard.cres...@intel.com>"); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH v2] hp206c: Initial support for reading sensor values

2016-03-28 Thread Peter Meerwald-Stadler
all required i2c functionality\n"); > + return -ENODEV; > + } > + > + indio_dev = devm_iio_device_alloc(>dev, sizeof(*data)); > + if (!indio_dev) > + return -ENOMEM; > + > + data = iio_priv(indio_dev); > + data->client = client; > + mutex_init(>mutex); > + > + indio_dev->info = _info; > + indio_dev->name = id->name; > + indio_dev->dev.parent = >dev; > + indio_dev->modes = INDIO_DIRECT_MODE; > + indio_dev->channels = hp206c_channels; > + indio_dev->num_channels = ARRAY_SIZE(hp206c_channels); > + > + i2c_set_clientdata(client, indio_dev); > + > + /* Do a soft reset on probe */ > + ret = hp206c_soft_reset(indio_dev); > + if (ret) { > + dev_err(>dev, "Failed to reset on startup: %d\n", ret); > + /* Maybe it will recover later? */ I suggest to return -ENODEV; > + } > + > + return devm_iio_device_register(>dev, indio_dev); > +} > + > +static const struct i2c_device_id hp206c_id[] = { > + {"hp206c"}, > + {} > +}; > + > +static const struct acpi_device_id hp206c_acpi_match[] = { > + {"HOP206C", 0}, > + { }, > +}; > +MODULE_DEVICE_TABLE(acpi, hp206c_acpi_match); > + > +static struct i2c_driver hp206c_driver = { > + .probe = hp206c_probe, > + .id_table = hp206c_id, > + .driver = { > + .name = "hp206c", > + .acpi_match_table = ACPI_PTR(hp206c_acpi_match), > + }, > +}; > + > +module_i2c_driver(hp206c_driver); > + > +MODULE_DESCRIPTION("HOPERF HP206C precision barometer and altimeter sensor"); > +MODULE_AUTHOR("Leonard Crestez "); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH 4/6] iio: accel: bmg160: optimize transfers in trigger handler

2016-03-28 Thread Peter Meerwald-Stadler
IS_TO_REG(bit), > > - , 2); > > - if (ret < 0) { > > - mutex_unlock(>mutex); > > - goto err; > > - } > > - data->buffer[i++] = ret; > > - } > >

Re: [PATCH 4/6] iio: accel: bmg160: optimize transfers in trigger handler

2016-03-28 Thread Peter Meerwald-Stadler
REG(bit), > > - , 2); > > - if (ret < 0) { > > - mutex_unlock(>mutex); > > - goto err; > > - } > > - data->buffer[i++] = ret; > > - } > > + ret = regmap_bulk_read(d

Re: [PATCH] iio: add driver for Microchip MCP414X/416X/424X/426X

2016-03-19 Thread Peter Meerwald-Stadler
.data = _cfg[MCP416x_103] }, > + { .compatible = "microchip,mcp4116x-503", > + .data = _cfg[MCP416x_503] }, > + { .compatible = "microchip,mcp4116x-104", > + .data = _cfg[MCP416x_104] }, > + { .compatible = "microchip

Re: [PATCH] iio: add driver for Microchip MCP414X/416X/424X/426X

2016-03-19 Thread Peter Meerwald-Stadler
ta = _cfg[MCP416x_103] }, > + { .compatible = "microchip,mcp4116x-503", > + .data = _cfg[MCP416x_503] }, > + { .compatible = "microchip,mcp4116x-104", > + .data = _cfg[MCP416x_104] }, > + { .compatible = "microchip,mcp4123x-502", > + .data = _cfg[MCP423x_502] }, > + { .compatible = "microchip,mcp4123x-103", > + .data = _cfg[MCP423x_103] }, > + { .compatible = "microchip,mcp4123x-503", > + .data = _cfg[MCP423x_503] }, > + { .compatible = "microchip,mcp4123x-104", > + .data = _cfg[MCP423x_104] }, > + { .compatible = "microchip,mcp4124x-502", > + .data = _cfg[MCP424x_502] }, > + { .compatible = "microchip,mcp4124x-103", > + .data = _cfg[MCP424x_103] }, > + { .compatible = "microchip,mcp4124x-503", > + .data = _cfg[MCP424x_503] }, > + { .compatible = "microchip,mcp4124x-104", > + .data = _cfg[MCP424x_104] }, > + { .compatible = "microchip,mcp4125x-502", > + .data = _cfg[MCP425x_502] }, > + { .compatible = "microchip,mcp4125x-103", > + .data = _cfg[MCP425x_103] }, > + { .compatible = "microchip,mcp4125x-503", > + .data = _cfg[MCP425x_503] }, > + { .compatible = "microchip,mcp4125x-104", > + .data = _cfg[MCP425x_104] }, > + { .compatible = "microchip,mcp4126x-502", > + .data = _cfg[MCP426x_502] }, > + { .compatible = "microchip,mcp4126x-103", > + .data = _cfg[MCP426x_103] }, > + { .compatible = "microchip,mcp4126x-503", > + .data = _cfg[MCP426x_503] }, > + { .compatible = "microchip,mcp4126x-104", > + .data = _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)

Re: [PATCH v2] iio: add driver for Microchip MCP413X/414X/415X/416X/423X/424X/425X/426X

2016-03-19 Thread Peter Meerwald-Stadler
;microchip,mcp4262-502", > + .data = _cfg[MCP426x_502] }, > + { .compatible = "microchip,mcp4262-103", > + .data = _cfg[MCP426x_103] }, > + { .compatible = "microchip,mcp4262-503", > + .data = _cfg[MCP426x_503] }, > + { .compatible = "microchip,mcp4262-104", > + .data = _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 <s...@poczta.fm>"); > +MODULE_DESCRIPTION("MCP4131 digital potentiometer"); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH v2] iio: add driver for Microchip MCP413X/414X/415X/416X/423X/424X/425X/426X

2016-03-19 Thread Peter Meerwald-Stadler
ot;, > + .data = _cfg[MCP426x_502] }, > + { .compatible = "microchip,mcp4262-103", > + .data = _cfg[MCP426x_103] }, > + { .compatible = "microchip,mcp4262-503", > + .data = _cfg[MCP426x_503] }, > + { .compatible = "microchip,mcp4262-104", > + .data = _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)

Re: [PATCH] iio: ltr501: Use a signed return type for ltr501_match_samp_freq

2016-01-26 Thread Peter Meerwald-Stadler
val, val2); > + val, val2, ); > > - if (i < 0) > - return i; > + if (ret < 0) > + return ret; > > mutex_lock(>lock_ps); > ret = regmap_field_write(data->reg_ps_rate, i); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH] iio: ltr501: Use a signed return type for ltr501_match_samp_freq

2016-01-26 Thread Peter Meerwald-Stadler
val, val2); > + val, val2, ); > > - if (i < 0) > - return i; > + if (ret < 0) > + return ret; > > mutex_lock(>lock_ps); > ret = regmap_field_write(data->reg_ps_rate, i); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH v4 4/4] iio: health: Add driver for the TI AFE4403 heart monitor

2016-01-25 Thread Peter Meerwald-Stadler
t; +indio_dev->name, > +indio_dev->id); > + if (!afe->trig) { > + dev_err(afe->dev, "Unable to allocate IIO trigger\n"); > +

Re: [PATCH v4 4/4] iio: health: Add driver for the TI AFE4403 heart monitor

2016-01-25 Thread Peter Meerwald-Stadler
ocate IIO trigger\n"); > + return -ENOMEM; > + } > + > + iio_trigger_set_drvdata(afe->trig, indio_dev); > + > + afe->trig->ops = _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, _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 = _pm_ops, > + }, > + .probe = afe4403_probe, > + .remove = afe4403_remove, > + .id_table = afe4403_ids, > +}; > +module_spi_driver(afe4403_spi_driver); > + > +MODULE_AUTHOR("Andrew F. Davis <a...@ti.com>"); > +MODULE_DESCRIPTION("TI AFE4403 Heart Rate and Pulse Oximeter"); > +MODULE_LICENSE("GPL v2"); > -- Peter Meerwald-Stadler +43-664-218 (mobile)

Re: [PATCH v4] iio: add ad5761 DAC driver

2016-01-05 Thread Peter Meerwald-Stadler
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

Re: [PATCH v4] iio: add ad5761 DAC driver

2016-01-05 Thread Peter Meerwald-Stadler
ata > Exit on error instead of using internal voltage reference > Thanks to Jonathan Cameron <ji...@kernel.org> > > v2: A lot of CodeStyle Fixes > Thanks to Peter Meerwald-Stadler <pme...@pmeerw.net> and > Jonathan Cameron <ji...@kernel.org> > >

Re: [PATCH] iio: add ad5761 DAC driver

2015-12-19 Thread Peter Meerwald-Stadler
ref && !chip_info->int_vref) { > + dev_err(>dev, "Missing vref, cannot continue"); > + return -EIO; > + } > + > + ad5761_spi_set_range(st, MODE_0V_5V); this can fail, retval not checked > + > + iio_dev->dev.parent =

Re: [PATCH] iio: add ad5761 DAC driver

2015-12-19 Thread Peter Meerwald-Stadler
e of variables > + if (st->use_intref && !chip_info->int_vref) { > + dev_err(>dev, "Missing vref, cannot continue"); > + return -EIO; > + } > + > + ad5761_spi_set_range(st, MODE_0V_5V); this can fail, retval not checked &

RE: [PATCH v4 1/4] iio: adc: add IMX7D ADC driver support

2015-12-01 Thread Peter Meerwald-Stadler
> > -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

Re: [PATCH v4 1/4] iio: adc: add IMX7D ADC driver support

2015-12-01 Thread Peter Meerwald-Stadler
+} > + > +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_cfg

Re: [PATCH v4 1/4] iio: adc: add IMX7D ADC driver support

2015-12-01 Thread Peter Meerwald-Stadler
; > +} > + > +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_DOW

RE: [PATCH v4 1/4] iio: adc: add IMX7D ADC driver support

2015-12-01 Thread Peter Meerwald-Stadler
> > -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

Re: [PATCH v2 1/2] iio: ina2xx: add support for TI INA2xx Power Monitors

2015-11-30 Thread Peter Meerwald-Stadler
ndio_dev->name = id->name; > + indio_dev->channels = ina2xx_channels; > + indio_dev->num_channels = ARRAY_SIZE(ina2xx_channels); > + > + indio_dev->dev.parent = >dev; > + indio_dev->info = _info; > + indio_dev->modes = INDIO_DIRECT_M

Re: [PATCH v2 1/2] iio: ina2xx: add support for TI INA2xx Power Monitors

2015-11-30 Thread Peter Meerwald-Stadler
set_clientdata(client, indio_dev); > + > + indio_dev->name = id->name; > + indio_dev->channels = ina2xx_channels; > + indio_dev->num_channels = ARRAY_SIZE(ina2xx_channels); > + > + indio_dev->dev.parent = >dev; > + indio_dev->info = _inf

Re: [PATCH 1/2] iio: ina2xx: add support for TI INA2xx Power Monitors

2015-11-25 Thread Peter Meerwald-Stadler
; > + > + indio_dev->name = id->name; > + indio_dev->channels = ina2xx_channels; > + indio_dev->num_channels = ARRAY_SIZE(ina2xx_channels); > + > + indio_dev->dev.parent = >dev; > + indio_dev->info = _info; > + indio_dev->modes = INDIO_DIRECT_

Re: [PATCH 1/2] iio: ina2xx: add support for TI INA2xx Power Monitors

2015-11-25 Thread Peter Meerwald-Stadler
; + i2c_set_clientdata(client, indio_dev); > + > + indio_dev->name = id->name; > + indio_dev->channels = ina2xx_channels; > + indio_dev->num_channels = ARRAY_SIZE(ina2xx_channels); > + > + indio_dev->dev.parent = >dev; > + indio_dev->info =

Re: [PATCH v3 1/4] iio: adc: add IMX7D ADC driver support

2015-11-20 Thread Peter Meerwald-Stadler
+ return 0; > + > +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 *ind

Re: [PATCH v3 1/4] iio: adc: add IMX7D ADC driver support

2015-11-20 Thread Peter Meerwald-Stadler
> + struct iio_dev *indio_dev = platform_get_drvdata(pdev); > + struct imx7d_adc *info = iio_priv(indio_dev); > + > + iio_device_unregister(indio_dev); > + regulator_disable(info->vref); > + clk_disable_unprepare(info->clk); should be in the same order

Re: [PATCH V1 1/1] iio: as6200: add AS6200 temperature sensor driver from ams AG

2015-11-10 Thread Peter Meerwald
P, > + .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 = _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(>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 = >dev; > + indio_dev->name = dev_name(>dev); > + indio_dev->modes = INDIO_DIRECT_MODE; > + indio_dev->info = _info; > + > + indio_dev->channels = as6200_channels; > + indio_dev->num_channels = ARRAY_SIZE(as6200_channels); > + > + initClientData(data); > + mutex_init(>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, >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(_driver); > +} > + > +static void __exit as6200_exit(void) > +{ > + i2c_del_driver(_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)

Re: [PATCH V1 1/1] iio: as6200: add AS6200 temperature sensor driver from ams AG

2015-11-10 Thread Peter Meerwald
ad_raw, > + .attrs = _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(>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 = >dev; > + indio_dev->name = dev_name(>dev); > + indio_dev->modes = INDIO_DIRECT_MODE; > + indio_dev->info = _info; > + > + indio_dev->channels = as6200_channels; > + indio_dev->num_channels = ARRAY_SIZE(as6200_channels); > + > + initClientData(data); > + mutex_init(>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, >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(_driver); > +} > + > +static void __exit as6200_exit(void) > +{ > + i2c_del_driver(_driver); > +} > +module_init(as6200_init); > +module_exit(as6200_exit); use module_i2c_driver() > + > +MODULE_DESCRIPTION("ams AS6200 temperature sensor"); > +MODULE_AUTHOR("Elitsa Polizoeva <elitsa.polizo...@ams.com>"); > +MODULE_AUTHOR("Florian Lobmaier <florian.lobma...@ams.com>"); > +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)

Re: [PATCH] iio: accel: add support for Memsic MXC6255XC sensor

2015-10-19 Thread Peter Meerwald
x\n", chip_id); maybe check chip id? > + > + ret = devm_iio_device_register(>dev, indio_dev); > + if (ret < 0) { > + dev_err(>dev, "Could not register IIO device\n"); > + return ret; > + } > + > + return 0; >

Re: [PATCH] iio: accel: add support for Memsic MXC6255XC sensor

2015-10-19 Thread Peter Meerwald
(>dev, "Chip id %x\n", chip_id); maybe check chip id? > + > + ret = devm_iio_device_register(>dev, indio_dev); > + if (ret < 0) { > + dev_err(>dev, "Could not register IIO device\n"); > + return ret; > + } >

Re: [PATCH v2 2/2] iio:light:tsl2563: Add DT support

2015-09-29 Thread Peter Meerwald
xt > +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt > @@ -46,6 +46,7 @@ digilentDiglent, Inc. > dlg Dialog Semiconductor > dlink D-Link Corporation > dmo Data Modul AG > +dynaimageDyna-Image > ebv EBV Elektronik > edt Emerging Displa

Re: [PATCH v2 2/2] iio:light:tsl2563: Add DT support

2015-09-29 Thread Peter Meerwald
etree/bindings/vendor-prefixes.txt > +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt > @@ -46,6 +46,7 @@ digilentDiglent, Inc. > dlg Dialog Semiconductor > dlink D-Link Corporation > dmo Data Modul AG > +dynaimageDyna-Image > ebv EBV Elekt

Re: [PATCH] CHROMIUM: iio: Add Dyna-Image AP3223 ambient light and proximity driver

2015-09-28 Thread Peter Meerwald
> +#define AP3223_SYS_PS_INT_OBJ 0x10 > +#define AP3223_SYS_PS_INT_IROV 0x20 > + > +/* INT CLEAN Mode */ > +#define AP3223_SYS_ICLEAN_AUTO 0x00 > +#define AP3223_SYS_ICLEAN_MANUAL 0x01 > + > +/* ALS CONFIG */ > +#define AP3223_ALS_RANGE_0 0x00/* Full range 32768

Re: [PATCH] CHROMIUM: iio: Add Dyna-Image AP3223 ambient light and proximity driver

2015-09-28 Thread Peter Meerwald
0x02 > +#define AP3223_SYS_PS_INT_OBJ 0x10 > +#define AP3223_SYS_PS_INT_IROV 0x20 > + > +/* INT CLEAN Mode */ > +#define AP3223_SYS_ICLEAN_AUTO 0x00 > +#define AP3223_SYS_ICLEAN_MANUAL 0x01 > + > +/* ALS CONFIG */ > +#define AP3223_AL

Re: [PATCH 1/3] iio:adc: add iio driver for Palmas (twl6035/7) gpadc

2015-09-23 Thread Peter Meerwald
.pm = _pm_ops, > + }, > +}; > + > +static int __init palmas_gpadc_init(void) > +{ > + return platform_driver_register(_gpadc_driver); > +} > +module_init(palmas_gpadc_init); > + > +static void __exit palmas_gpadc_exit(void) > +{ > + platform_

Re: [PATCH 1/3] iio:adc: add iio driver for Palmas (twl6035/7) gpadc

2015-09-23 Thread Peter Meerwald
e_init(palmas_gpadc_init); > + > +static void __exit palmas_gpadc_exit(void) > +{ > + platform_driver_unregister(_gpadc_driver); > +} > +module_exit(palmas_gpadc_exit); > + > +MODULE_DESCRIPTION("palmas GPADC driver"); > +MODULE_AUTHOR("Pra

Re: [PATCH v3 2/2] iio: mcp4531: Driver for Microchip digital potentiometers

2015-09-22 Thread Peter Meerwald
rent = dev; > + indio_dev->info = _info; > + indio_dev->channels = mcp4531_channels; > + indio_dev->num_channels = MCP4531_WIPERS(devid); > + indio_dev->name = client->name; > + > + return iio_device_register(indio_dev); use devm_ ... > +} > + > +

Re: [PATCH v3 2/2] iio: mcp4531: Driver for Microchip digital potentiometers

2015-09-22 Thread Peter Meerwald
> + data->max_pos = (1 << MCP4531_MAX_POS(devid)) + 1; > + > + indio_dev->dev.parent = dev; > + indio_dev->info = _info; > + indio_dev->channels = mcp4531_channels; > + indio_dev->num_channels = MCP4531_WIPERS(devid); > + indio_dev->nam

Re: [RFC v1 4/4] iio: chemical: add SGX VZ89x VOC sensor support

2015-09-05 Thread Peter Meerwald
> +switch (chan->type) { > >> +case IIO_RESISTANCE: > >> +*val = 10; > >> + ret = IIO_VAL_INT; > >> +break; > >> +case IIO_CONCENTRATION: > >> +ret = vz89x_get_channel_s

Re: [RFC v1 4/4] iio: chemical: add SGX VZ89x VOC sensor support

2015-09-05 Thread Peter Meerwald
- HZ; > + mutex_init(>lock); > + > + indio_dev->dev.parent = >dev; > + indio_dev->info = _info, > + indio_dev->name = dev_name(>dev); > + indio_dev->modes = INDIO_DIRECT_MODE; > + > + indio_dev->channels = vz89x_channels; > + indio_dev->nu

Re: [RFC v1 1/4] iio: chemical: Add IIO_CONCENTRATION channel type

2015-09-05 Thread Peter Meerwald
++ 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

Re: [RFC v1 4/4] iio: chemical: add SGX VZ89x VOC sensor support

2015-09-05 Thread Peter Meerwald
client; > + data->last_update = jiffies - HZ; > + mutex_init(>lock); > + > + indio_dev->dev.parent = >dev; > + indio_dev->info = _info, > + indio_dev->name = dev_name(>dev); > + indio_dev->modes = INDIO_DIRECT_MODE; > + > + indio_dev-&

Re: [RFC v1 4/4] iio: chemical: add SGX VZ89x VOC sensor support

2015-09-05 Thread Peter Meerwald
> >> +case IIO_CHAN_INFO_SCALE: > >> +switch (chan->type) { > >> +case IIO_RESISTANCE: > >> +*val = 10; > >> +ret = IIO_VAL_INT; > >> +break; > >> +case IIO_CONCENTRATIO

Re: [RFC v1 1/4] iio: chemical: Add IIO_CONCENTRATION channel type

2015-09-05 Thread Peter Meerwald
gt; --- a/include/uapi/linux/iio/types.h > +++ 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 { &

Re: [PATCH v5 1/2] iio: light: Add support for UPISEMI uS5182d als and proximity sensor

2015-08-20 Thread Peter Meerwald
+ indio_dev->info = _info; > + indio_dev->name = US5182D_DRV_NAME; > + indio_dev->channels = us5182d_channels; > + indio_dev->num_channels = ARRAY_SIZE(us5182d_channels); > + indio_dev->modes = INDIO_DIRECT_MODE; > + > + ret = i2c_smbus_re

Re: [PATCH v5 1/2] iio: light: Add support for UPISEMI uS5182d als and proximity sensor

2015-08-20 Thread Peter Meerwald
, + .id_table = us5182d_id, + +}; +module_i2c_driver(us5182d_driver); + +MODULE_AUTHOR(Adriana Reus adriana.r...@intel.com); +MODULE_DESCRIPTION(Driver for us5182d Proximity and Light Sensor); +MODULE_LICENSE(GPL v2); -- Peter Meerwald +43-664-218 (mobile) -- To unsubscribe from

Re: [PATCH v4] iio: magnetometer: add mmc34160 magnetometer driver

2015-08-17 Thread Peter Meerwald
= MMC35240_16_BITS_SLOW; > > + if (id) { > + data->chipset = (enum mmc35240_chipset)(id->driver_data); > + name = id->name; > + } else if (ACPI_HANDLE(>dev)) { > + name = mmc35240_match_acpi_device(>dev, > +

Re: [PATCH v4] iio: magnetometer: add mmc34160 magnetometer driver

2015-08-17 Thread Peter Meerwald
}, - {} + {mmc35240, MMC35240}, + {mmc34160, MMC34160}, + { } }; MODULE_DEVICE_TABLE(i2c, mmc35240_id); -- 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

Re: [PATCH v3 6/6] iio: bmg160: Add SPI driver

2015-08-12 Thread Peter Meerwald
> + {"bmi055_gyro", 0}, > + {} > +}; > + > +MODULE_DEVICE_TABLE(spi, bmg160_spi_id); > + > +static struct spi_driver bmg160_spi_driver = { > + .driver = { > + .name = "bmg160_spi", > + .pm = _

Re: [PATCH v3 6/6] iio: bmg160: Add SPI driver

2015-08-12 Thread Peter Meerwald
= bmg160_spi_remove, + .id_table = bmg160_spi_id, +}; +module_spi_driver(bmg160_spi_driver); + +MODULE_AUTHOR(Markus Pargmann m...@pengutronix.de); +MODULE_LICENSE(GPL v2); +MODULE_DESCRIPTION(BMG160 SPI Gyro driver); -- Peter Meerwald +43-664-218 (mobile) -- To unsubscribe

Re: [PATCH/RFC v5 25/57] leds: pca963x: Remove work queue

2015-08-11 Thread Peter Meerwald
> 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/

Re: [PATCH/RFC v5 25/57] leds: pca963x: Remove work queue

2015-08-11 Thread Peter Meerwald
Now the core implements the work queue, remove it from the drivers. nice! Signed-off-by: Andrew Lunn and...@lunn.ch Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Cc: Peter Meerwald p.meerw...@bct-electronic.com Cc: Ricardo Ribalda ricardo.riba...@gmail.com Acked-by: Peter

<    1   2   3   4   5   >