Re: [PATCH v3] iio: humidity: hdc100x: add triggered buffer support for HDC100X
On Fri, Sep 02, 2016 at 07:30:38AM +0100, Julia Lawall wrote: > Please check on the lines marked with @. An unlock may be needed at line > 210. > > julia Yes, needs unlock. Thanks! alisons > > -- Forwarded message -- > Date: Fri, 2 Sep 2016 07:19:23 +0800 > From: kbuild test robot <fengguang...@intel.com> > To: kbu...@01.org > Cc: Julia Lawall <julia.law...@lip6.fr> > Subject: Re: [PATCH v3] iio: humidity: hdc100x: add triggered buffer support > for > HDC100X > > Hi Alison, > > [auto build test WARNING on next-20160825] > [also build test WARNING on v4.8-rc4] > [cannot apply to iio/togreg v4.8-rc4 v4.8-rc3 v4.8-rc2] > [if your patch is applied to the wrong git tree, please drop us a note to > help improve the system] > [Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for > convenience) to record what (public, well-known) commit your patch series was > built on] > [Check https://git-scm.com/docs/git-format-patch for more information] > > url: > https://github.com/0day-ci/linux/commits/Alison-Schofield/iio-humidity-hdc100x-add-triggered-buffer-support-for-HDC100X/20160902-055115 > :: branch date: 88 minutes ago > :: commit date: 88 minutes ago > > >> drivers/iio/humidity/hdc100x.c:210:4-10: preceding lock on line 203 >drivers/iio/humidity/hdc100x.c:345:1-7: preceding lock on line 325 > > git remote add linux-review https://github.com/0day-ci/linux > git remote update linux-review > git checkout f6862a537522f8d668f7daec0aa0817f87706017 > vim +210 drivers/iio/humidity/hdc100x.c > > 4839367d9 Matt Ranostay2015-09-06 197struct hdc100x_data *data = > iio_priv(indio_dev); > 4839367d9 Matt Ranostay2015-09-06 198 > 4839367d9 Matt Ranostay2015-09-06 199switch (mask) { > 4839367d9 Matt Ranostay2015-09-06 200case IIO_CHAN_INFO_RAW: { > 4839367d9 Matt Ranostay2015-09-06 201int ret; > 4839367d9 Matt Ranostay2015-09-06 202 > 4839367d9 Matt Ranostay2015-09-06 @203mutex_lock(>lock); > 4839367d9 Matt Ranostay2015-09-06 204if (chan->type == > IIO_CURRENT) { > 4839367d9 Matt Ranostay2015-09-06 205*val = > hdc100x_get_heater_status(data); > 4839367d9 Matt Ranostay2015-09-06 206ret = > IIO_VAL_INT; > 4839367d9 Matt Ranostay2015-09-06 207} else { > f6862a537 Alison Schofield 2016-09-01 208ret = > iio_device_claim_direct_mode(indio_dev); > f6862a537 Alison Schofield 2016-09-01 209if (ret) > f6862a537 Alison Schofield 2016-09-01 @210return > ret; > f6862a537 Alison Schofield 2016-09-01 211 > 4839367d9 Matt Ranostay2015-09-06 212ret = > hdc100x_get_measurement(data, chan); > f6862a537 Alison Schofield 2016-09-01 213 > iio_device_release_direct_mode(indio_dev); > > --- > 0-DAY kernel test infrastructureOpen Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH v3] iio: humidity: hdc100x: add triggered buffer support for HDC100X
On Fri, Sep 02, 2016 at 07:30:38AM +0100, Julia Lawall wrote: > Please check on the lines marked with @. An unlock may be needed at line > 210. > > julia Yes, needs unlock. Thanks! alisons > > -- Forwarded message -- > Date: Fri, 2 Sep 2016 07:19:23 +0800 > From: kbuild test robot > To: kbu...@01.org > Cc: Julia Lawall > Subject: Re: [PATCH v3] iio: humidity: hdc100x: add triggered buffer support > for > HDC100X > > Hi Alison, > > [auto build test WARNING on next-20160825] > [also build test WARNING on v4.8-rc4] > [cannot apply to iio/togreg v4.8-rc4 v4.8-rc3 v4.8-rc2] > [if your patch is applied to the wrong git tree, please drop us a note to > help improve the system] > [Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for > convenience) to record what (public, well-known) commit your patch series was > built on] > [Check https://git-scm.com/docs/git-format-patch for more information] > > url: > https://github.com/0day-ci/linux/commits/Alison-Schofield/iio-humidity-hdc100x-add-triggered-buffer-support-for-HDC100X/20160902-055115 > :: branch date: 88 minutes ago > :: commit date: 88 minutes ago > > >> drivers/iio/humidity/hdc100x.c:210:4-10: preceding lock on line 203 >drivers/iio/humidity/hdc100x.c:345:1-7: preceding lock on line 325 > > git remote add linux-review https://github.com/0day-ci/linux > git remote update linux-review > git checkout f6862a537522f8d668f7daec0aa0817f87706017 > vim +210 drivers/iio/humidity/hdc100x.c > > 4839367d9 Matt Ranostay2015-09-06 197struct hdc100x_data *data = > iio_priv(indio_dev); > 4839367d9 Matt Ranostay2015-09-06 198 > 4839367d9 Matt Ranostay2015-09-06 199switch (mask) { > 4839367d9 Matt Ranostay2015-09-06 200case IIO_CHAN_INFO_RAW: { > 4839367d9 Matt Ranostay2015-09-06 201int ret; > 4839367d9 Matt Ranostay2015-09-06 202 > 4839367d9 Matt Ranostay2015-09-06 @203mutex_lock(>lock); > 4839367d9 Matt Ranostay2015-09-06 204if (chan->type == > IIO_CURRENT) { > 4839367d9 Matt Ranostay2015-09-06 205*val = > hdc100x_get_heater_status(data); > 4839367d9 Matt Ranostay2015-09-06 206ret = > IIO_VAL_INT; > 4839367d9 Matt Ranostay2015-09-06 207} else { > f6862a537 Alison Schofield 2016-09-01 208ret = > iio_device_claim_direct_mode(indio_dev); > f6862a537 Alison Schofield 2016-09-01 209if (ret) > f6862a537 Alison Schofield 2016-09-01 @210return > ret; > f6862a537 Alison Schofield 2016-09-01 211 > 4839367d9 Matt Ranostay2015-09-06 212ret = > hdc100x_get_measurement(data, chan); > f6862a537 Alison Schofield 2016-09-01 213 > iio_device_release_direct_mode(indio_dev); > > --- > 0-DAY kernel test infrastructureOpen Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH v3] iio: humidity: hdc100x: add triggered buffer support for HDC100X
Please check on the lines marked with @. An unlock may be needed at line 210. julia -- Forwarded message -- Date: Fri, 2 Sep 2016 07:19:23 +0800 From: kbuild test robot <fengguang...@intel.com> To: kbu...@01.org Cc: Julia Lawall <julia.law...@lip6.fr> Subject: Re: [PATCH v3] iio: humidity: hdc100x: add triggered buffer support for HDC100X Hi Alison, [auto build test WARNING on next-20160825] [also build test WARNING on v4.8-rc4] [cannot apply to iio/togreg v4.8-rc4 v4.8-rc3 v4.8-rc2] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] [Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information] url: https://github.com/0day-ci/linux/commits/Alison-Schofield/iio-humidity-hdc100x-add-triggered-buffer-support-for-HDC100X/20160902-055115 :: branch date: 88 minutes ago :: commit date: 88 minutes ago >> drivers/iio/humidity/hdc100x.c:210:4-10: preceding lock on line 203 drivers/iio/humidity/hdc100x.c:345:1-7: preceding lock on line 325 git remote add linux-review https://github.com/0day-ci/linux git remote update linux-review git checkout f6862a537522f8d668f7daec0aa0817f87706017 vim +210 drivers/iio/humidity/hdc100x.c 4839367d9 Matt Ranostay2015-09-06 197 struct hdc100x_data *data = iio_priv(indio_dev); 4839367d9 Matt Ranostay2015-09-06 198 4839367d9 Matt Ranostay2015-09-06 199 switch (mask) { 4839367d9 Matt Ranostay2015-09-06 200 case IIO_CHAN_INFO_RAW: { 4839367d9 Matt Ranostay2015-09-06 201 int ret; 4839367d9 Matt Ranostay2015-09-06 202 4839367d9 Matt Ranostay2015-09-06 @203 mutex_lock(>lock); 4839367d9 Matt Ranostay2015-09-06 204 if (chan->type == IIO_CURRENT) { 4839367d9 Matt Ranostay2015-09-06 205 *val = hdc100x_get_heater_status(data); 4839367d9 Matt Ranostay2015-09-06 206 ret = IIO_VAL_INT; 4839367d9 Matt Ranostay2015-09-06 207 } else { f6862a537 Alison Schofield 2016-09-01 208 ret = iio_device_claim_direct_mode(indio_dev); f6862a537 Alison Schofield 2016-09-01 209 if (ret) f6862a537 Alison Schofield 2016-09-01 @210 return ret; f6862a537 Alison Schofield 2016-09-01 211 4839367d9 Matt Ranostay2015-09-06 212 ret = hdc100x_get_measurement(data, chan); f6862a537 Alison Schofield 2016-09-01 213 iio_device_release_direct_mode(indio_dev); --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH v3] iio: humidity: hdc100x: add triggered buffer support for HDC100X
Please check on the lines marked with @. An unlock may be needed at line 210. julia -- Forwarded message -- Date: Fri, 2 Sep 2016 07:19:23 +0800 From: kbuild test robot To: kbu...@01.org Cc: Julia Lawall Subject: Re: [PATCH v3] iio: humidity: hdc100x: add triggered buffer support for HDC100X Hi Alison, [auto build test WARNING on next-20160825] [also build test WARNING on v4.8-rc4] [cannot apply to iio/togreg v4.8-rc4 v4.8-rc3 v4.8-rc2] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] [Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information] url: https://github.com/0day-ci/linux/commits/Alison-Schofield/iio-humidity-hdc100x-add-triggered-buffer-support-for-HDC100X/20160902-055115 :: branch date: 88 minutes ago :: commit date: 88 minutes ago >> drivers/iio/humidity/hdc100x.c:210:4-10: preceding lock on line 203 drivers/iio/humidity/hdc100x.c:345:1-7: preceding lock on line 325 git remote add linux-review https://github.com/0day-ci/linux git remote update linux-review git checkout f6862a537522f8d668f7daec0aa0817f87706017 vim +210 drivers/iio/humidity/hdc100x.c 4839367d9 Matt Ranostay2015-09-06 197 struct hdc100x_data *data = iio_priv(indio_dev); 4839367d9 Matt Ranostay2015-09-06 198 4839367d9 Matt Ranostay2015-09-06 199 switch (mask) { 4839367d9 Matt Ranostay2015-09-06 200 case IIO_CHAN_INFO_RAW: { 4839367d9 Matt Ranostay2015-09-06 201 int ret; 4839367d9 Matt Ranostay2015-09-06 202 4839367d9 Matt Ranostay2015-09-06 @203 mutex_lock(>lock); 4839367d9 Matt Ranostay2015-09-06 204 if (chan->type == IIO_CURRENT) { 4839367d9 Matt Ranostay2015-09-06 205 *val = hdc100x_get_heater_status(data); 4839367d9 Matt Ranostay2015-09-06 206 ret = IIO_VAL_INT; 4839367d9 Matt Ranostay2015-09-06 207 } else { f6862a537 Alison Schofield 2016-09-01 208 ret = iio_device_claim_direct_mode(indio_dev); f6862a537 Alison Schofield 2016-09-01 209 if (ret) f6862a537 Alison Schofield 2016-09-01 @210 return ret; f6862a537 Alison Schofield 2016-09-01 211 4839367d9 Matt Ranostay2015-09-06 212 ret = hdc100x_get_measurement(data, chan); f6862a537 Alison Schofield 2016-09-01 213 iio_device_release_direct_mode(indio_dev); --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
[PATCH v3] iio: humidity: hdc100x: add triggered buffer support for HDC100X
Triggered buffer support uses the HDC100X's dual acquisition mode to read both humidity and temperature in one shot. This patch depends on 447136effbf4 ("iio: humidity: hdc100x: fix sensor data reads of temp and humidity") Signed-off-by: Alison SchofieldCc: Daniel Baluta --- Changes in v3: Thanks for the review Jonathan - This patch now depends on 447136effbf4 ("iio: humidity: hdc100x: fix sensor data reads of temp and humidity") - remove i2c functionality check, done in dependent patch - remove unused define HDC100X_ALL_CHANNEL_MASK - define and use available_scan_masks to demux between temp &/or humid data in buffered mode - changed timestamp channel scan_index from 3 to 2. - put back private data lock in read_raw (we'll lock private data lock and claim_direct_mode on raw reads) - remove unneeded NULL parameters in iio_buffer_setup_ops - add private data lock on buffered read We are going to allow configuration changes while the sensor is in buffered mode. We need to allow the toggling of the Heater Enable bit because the heater only functions during measurements. The lock will ensure that the config change and buffer read transaction do not collide. - blank lines added for readability per reviewer Changes in v2: Thanks for the review Peter - switched endianness from IIO_CPU to IIO_BE - use only one buffer in the handler - simplify selection of temp &/or humidity to push to buffer drivers/iio/humidity/Kconfig | 2 + drivers/iio/humidity/hdc100x.c | 128 - 2 files changed, 128 insertions(+), 2 deletions(-) diff --git a/drivers/iio/humidity/Kconfig b/drivers/iio/humidity/Kconfig index f155386..5a25569 100644 --- a/drivers/iio/humidity/Kconfig +++ b/drivers/iio/humidity/Kconfig @@ -25,6 +25,8 @@ config DHT11 config HDC100X tristate "TI HDC100x relative humidity and temperature sensor" depends on I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for the Texas Instruments HDC1000 and HDC1008 relative humidity and temperature sensors. diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c index e0c9c70..7508c26 100644 --- a/drivers/iio/humidity/hdc100x.c +++ b/drivers/iio/humidity/hdc100x.c @@ -22,11 +22,15 @@ #include #include +#include +#include +#include #define HDC100X_REG_TEMP 0x00 #define HDC100X_REG_HUMIDITY 0x01 #define HDC100X_REG_CONFIG 0x02 +#define HDC100X_REG_CONFIG_ACQ_MODEBIT(12) #define HDC100X_REG_CONFIG_HEATER_EN BIT(13) struct hdc100x_data { @@ -87,22 +91,40 @@ static const struct iio_chan_spec hdc100x_channels[] = { BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_INT_TIME) | BIT(IIO_CHAN_INFO_OFFSET), + .scan_index = 0, + .scan_type = { + .sign = 's', + .realbits = 16, + .storagebits = 16, + .endianness = IIO_BE, + }, }, { .type = IIO_HUMIDITYRELATIVE, .address = HDC100X_REG_HUMIDITY, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) | - BIT(IIO_CHAN_INFO_INT_TIME) + BIT(IIO_CHAN_INFO_INT_TIME), + .scan_index = 1, + .scan_type = { + .sign = 'u', + .realbits = 16, + .storagebits = 16, + .endianness = IIO_BE, + }, }, { .type = IIO_CURRENT, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), .extend_name = "heater", .output = 1, + .scan_index = -1, }, + IIO_CHAN_SOFT_TIMESTAMP(2), }; +static const unsigned long hdc100x_scan_masks[] = {0x3, 0}; + static int hdc100x_update_config(struct hdc100x_data *data, int mask, int val) { int tmp = (~mask & data->config) | val; @@ -183,7 +205,12 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev, *val = hdc100x_get_heater_status(data); ret = IIO_VAL_INT; } else { + ret = iio_device_claim_direct_mode(indio_dev); + if (ret) + return ret; + ret = hdc100x_get_measurement(data, chan); + iio_device_release_direct_mode(indio_dev); if (ret >= 0) { *val = ret; ret = IIO_VAL_INT; @@ -246,6 +273,78 @@ static int
[PATCH v3] iio: humidity: hdc100x: add triggered buffer support for HDC100X
Triggered buffer support uses the HDC100X's dual acquisition mode to read both humidity and temperature in one shot. This patch depends on 447136effbf4 ("iio: humidity: hdc100x: fix sensor data reads of temp and humidity") Signed-off-by: Alison Schofield Cc: Daniel Baluta --- Changes in v3: Thanks for the review Jonathan - This patch now depends on 447136effbf4 ("iio: humidity: hdc100x: fix sensor data reads of temp and humidity") - remove i2c functionality check, done in dependent patch - remove unused define HDC100X_ALL_CHANNEL_MASK - define and use available_scan_masks to demux between temp &/or humid data in buffered mode - changed timestamp channel scan_index from 3 to 2. - put back private data lock in read_raw (we'll lock private data lock and claim_direct_mode on raw reads) - remove unneeded NULL parameters in iio_buffer_setup_ops - add private data lock on buffered read We are going to allow configuration changes while the sensor is in buffered mode. We need to allow the toggling of the Heater Enable bit because the heater only functions during measurements. The lock will ensure that the config change and buffer read transaction do not collide. - blank lines added for readability per reviewer Changes in v2: Thanks for the review Peter - switched endianness from IIO_CPU to IIO_BE - use only one buffer in the handler - simplify selection of temp &/or humidity to push to buffer drivers/iio/humidity/Kconfig | 2 + drivers/iio/humidity/hdc100x.c | 128 - 2 files changed, 128 insertions(+), 2 deletions(-) diff --git a/drivers/iio/humidity/Kconfig b/drivers/iio/humidity/Kconfig index f155386..5a25569 100644 --- a/drivers/iio/humidity/Kconfig +++ b/drivers/iio/humidity/Kconfig @@ -25,6 +25,8 @@ config DHT11 config HDC100X tristate "TI HDC100x relative humidity and temperature sensor" depends on I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for the Texas Instruments HDC1000 and HDC1008 relative humidity and temperature sensors. diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c index e0c9c70..7508c26 100644 --- a/drivers/iio/humidity/hdc100x.c +++ b/drivers/iio/humidity/hdc100x.c @@ -22,11 +22,15 @@ #include #include +#include +#include +#include #define HDC100X_REG_TEMP 0x00 #define HDC100X_REG_HUMIDITY 0x01 #define HDC100X_REG_CONFIG 0x02 +#define HDC100X_REG_CONFIG_ACQ_MODEBIT(12) #define HDC100X_REG_CONFIG_HEATER_EN BIT(13) struct hdc100x_data { @@ -87,22 +91,40 @@ static const struct iio_chan_spec hdc100x_channels[] = { BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_INT_TIME) | BIT(IIO_CHAN_INFO_OFFSET), + .scan_index = 0, + .scan_type = { + .sign = 's', + .realbits = 16, + .storagebits = 16, + .endianness = IIO_BE, + }, }, { .type = IIO_HUMIDITYRELATIVE, .address = HDC100X_REG_HUMIDITY, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) | - BIT(IIO_CHAN_INFO_INT_TIME) + BIT(IIO_CHAN_INFO_INT_TIME), + .scan_index = 1, + .scan_type = { + .sign = 'u', + .realbits = 16, + .storagebits = 16, + .endianness = IIO_BE, + }, }, { .type = IIO_CURRENT, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), .extend_name = "heater", .output = 1, + .scan_index = -1, }, + IIO_CHAN_SOFT_TIMESTAMP(2), }; +static const unsigned long hdc100x_scan_masks[] = {0x3, 0}; + static int hdc100x_update_config(struct hdc100x_data *data, int mask, int val) { int tmp = (~mask & data->config) | val; @@ -183,7 +205,12 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev, *val = hdc100x_get_heater_status(data); ret = IIO_VAL_INT; } else { + ret = iio_device_claim_direct_mode(indio_dev); + if (ret) + return ret; + ret = hdc100x_get_measurement(data, chan); + iio_device_release_direct_mode(indio_dev); if (ret >= 0) { *val = ret; ret = IIO_VAL_INT; @@ -246,6 +273,78 @@ static int hdc100x_write_raw(struct iio_dev *indio_dev, }