* [PATCH v2 00/10] hts221: add new features and fix power-off procedure
@ 2017-07-17 17:38 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:38 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
Patches 1-3: fix a bug in power-down/suspend procedure
Patch 4-5: avoid useless sample rate configurations
Patches 6-9: add active low and open drain support with corresponding
dt-binding
Patch 10: improve code readability
Changes since v1:
- simplify hts221_avg_list table management
- split patch 4 in two separate patches
- improve commit log in patch 3
Lorenzo Bianconi (10):
iio: humidity: hts221: refactor write_with_mask code
iio: humidity: hts221: move BDU configuration in probe routine
iio: humidity: hts221: do not overwrite reserved data during
power-down
iio: humidity: hts221: avoid useless ODR reconfiguration
iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable
iio: humidity: hts221: support active-low interrupts
dt-bindings: iio: humidity: hts221: support active-low interrupts
iio: humidity: hts221: support open drain mode
dt-bindings: iio: humidity: hts221: support open drain mode
iio: humidity: hts221: move drdy enable logic in
hts221_trig_set_state()
.../devicetree/bindings/iio/humidity/hts221.txt | 11 +-
drivers/iio/humidity/hts221.h | 11 +-
drivers/iio/humidity/hts221_buffer.c | 43 +++++-
drivers/iio/humidity/hts221_core.c | 144 ++++++++-------------
4 files changed, 103 insertions(+), 106 deletions(-)
--
2.13.2
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 00/10] hts221: add new features and fix power-off procedure
@ 2017-07-17 17:38 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:38 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
Patches 1-3: fix a bug in power-down/suspend procedure
Patch 4-5: avoid useless sample rate configurations
Patches 6-9: add active low and open drain support with corresponding
dt-binding
Patch 10: improve code readability
Changes since v1:
- simplify hts221_avg_list table management
- split patch 4 in two separate patches
- improve commit log in patch 3
Lorenzo Bianconi (10):
iio: humidity: hts221: refactor write_with_mask code
iio: humidity: hts221: move BDU configuration in probe routine
iio: humidity: hts221: do not overwrite reserved data during
power-down
iio: humidity: hts221: avoid useless ODR reconfiguration
iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable
iio: humidity: hts221: support active-low interrupts
dt-bindings: iio: humidity: hts221: support active-low interrupts
iio: humidity: hts221: support open drain mode
dt-bindings: iio: humidity: hts221: support open drain mode
iio: humidity: hts221: move drdy enable logic in
hts221_trig_set_state()
.../devicetree/bindings/iio/humidity/hts221.txt | 11 +-
drivers/iio/humidity/hts221.h | 11 +-
drivers/iio/humidity/hts221_buffer.c | 43 +++++-
drivers/iio/humidity/hts221_core.c | 144 ++++++++-------------
4 files changed, 103 insertions(+), 106 deletions(-)
--
2.13.2
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 01/10] iio: humidity: hts221: refactor write_with_mask code
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-17 17:38 ` Lorenzo Bianconi
-1 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:38 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
Move bit-shift in hts221_write_with_mask() instead of coding
the shift depth in the configured value. That change will be necessary
to fix an issue in device power-down procedure.
Simplify hts221_avg_list table management
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
drivers/iio/humidity/hts221.h | 6 ---
drivers/iio/humidity/hts221_core.c | 94 +++++++++++++++++---------------------
2 files changed, 42 insertions(+), 58 deletions(-)
diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
index 94510266e0a5..bf33d8f6396c 100644
--- a/drivers/iio/humidity/hts221.h
+++ b/drivers/iio/humidity/hts221.h
@@ -30,12 +30,6 @@ struct hts221_transfer_function {
int (*write)(struct device *dev, u8 addr, int len, u8 *data);
};
-#define HTS221_AVG_DEPTH 8
-struct hts221_avg_avl {
- u16 avg;
- u8 val;
-};
-
enum hts221_sensor_type {
HTS221_SENSOR_H,
HTS221_SENSOR_T,
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index a56da3999e00..d2f59626b040 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -32,30 +32,12 @@
#define HTS221_HUMIDITY_AVG_MASK 0x07
#define HTS221_TEMP_AVG_MASK 0x38
-#define HTS221_ODR_MASK 0x87
+#define HTS221_ODR_MASK 0x03
#define HTS221_BDU_MASK BIT(2)
+#define HTS221_ENABLE_MASK BIT(7)
#define HTS221_DRDY_MASK BIT(2)
-#define HTS221_ENABLE_SENSOR BIT(7)
-
-#define HTS221_HUMIDITY_AVG_4 0x00 /* 0.4 %RH */
-#define HTS221_HUMIDITY_AVG_8 0x01 /* 0.3 %RH */
-#define HTS221_HUMIDITY_AVG_16 0x02 /* 0.2 %RH */
-#define HTS221_HUMIDITY_AVG_32 0x03 /* 0.15 %RH */
-#define HTS221_HUMIDITY_AVG_64 0x04 /* 0.1 %RH */
-#define HTS221_HUMIDITY_AVG_128 0x05 /* 0.07 %RH */
-#define HTS221_HUMIDITY_AVG_256 0x06 /* 0.05 %RH */
-#define HTS221_HUMIDITY_AVG_512 0x07 /* 0.03 %RH */
-
-#define HTS221_TEMP_AVG_2 0x00 /* 0.08 degC */
-#define HTS221_TEMP_AVG_4 0x08 /* 0.05 degC */
-#define HTS221_TEMP_AVG_8 0x10 /* 0.04 degC */
-#define HTS221_TEMP_AVG_16 0x18 /* 0.03 degC */
-#define HTS221_TEMP_AVG_32 0x20 /* 0.02 degC */
-#define HTS221_TEMP_AVG_64 0x28 /* 0.015 degC */
-#define HTS221_TEMP_AVG_128 0x30 /* 0.01 degC */
-#define HTS221_TEMP_AVG_256 0x38 /* 0.007 degC */
/* calibration registers */
#define HTS221_REG_0RH_CAL_X_H 0x36
@@ -73,10 +55,11 @@ struct hts221_odr {
u8 val;
};
+#define HTS221_AVG_DEPTH 8
struct hts221_avg {
u8 addr;
u8 mask;
- struct hts221_avg_avl avg_avl[HTS221_AVG_DEPTH];
+ u16 avg_avl[HTS221_AVG_DEPTH];
};
static const struct hts221_odr hts221_odr_table[] = {
@@ -90,28 +73,28 @@ static const struct hts221_avg hts221_avg_list[] = {
.addr = HTS221_REG_AVG_ADDR,
.mask = HTS221_HUMIDITY_AVG_MASK,
.avg_avl = {
- { 4, HTS221_HUMIDITY_AVG_4 },
- { 8, HTS221_HUMIDITY_AVG_8 },
- { 16, HTS221_HUMIDITY_AVG_16 },
- { 32, HTS221_HUMIDITY_AVG_32 },
- { 64, HTS221_HUMIDITY_AVG_64 },
- { 128, HTS221_HUMIDITY_AVG_128 },
- { 256, HTS221_HUMIDITY_AVG_256 },
- { 512, HTS221_HUMIDITY_AVG_512 },
+ 4, /* 0.4 %RH */
+ 8, /* 0.3 %RH */
+ 16, /* 0.2 %RH */
+ 32, /* 0.15 %RH */
+ 64, /* 0.1 %RH */
+ 128, /* 0.07 %RH */
+ 256, /* 0.05 %RH */
+ 512, /* 0.03 %RH */
},
},
{
.addr = HTS221_REG_AVG_ADDR,
.mask = HTS221_TEMP_AVG_MASK,
.avg_avl = {
- { 2, HTS221_TEMP_AVG_2 },
- { 4, HTS221_TEMP_AVG_4 },
- { 8, HTS221_TEMP_AVG_8 },
- { 16, HTS221_TEMP_AVG_16 },
- { 32, HTS221_TEMP_AVG_32 },
- { 64, HTS221_TEMP_AVG_64 },
- { 128, HTS221_TEMP_AVG_128 },
- { 256, HTS221_TEMP_AVG_256 },
+ 2, /* 0.08 degC */
+ 4, /* 0.05 degC */
+ 8, /* 0.04 degC */
+ 16, /* 0.03 degC */
+ 32, /* 0.02 degC */
+ 64, /* 0.015 degC */
+ 128, /* 0.01 degC */
+ 256, /* 0.007 degC */
},
},
};
@@ -166,7 +149,7 @@ static int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask,
goto unlock;
}
- data = (data & ~mask) | (val & mask);
+ data = (data & ~mask) | ((val << __ffs(mask)) & mask);
err = hw->tf->write(hw->dev, addr, sizeof(data), &data);
if (err < 0)
@@ -201,11 +184,10 @@ static int hts221_check_whoami(struct hts221_hw *hw)
int hts221_config_drdy(struct hts221_hw *hw, bool enable)
{
- u8 val = enable ? BIT(2) : 0;
int err;
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR,
- HTS221_DRDY_MASK, val);
+ HTS221_DRDY_MASK, enable);
return err < 0 ? err : 0;
}
@@ -213,7 +195,6 @@ int hts221_config_drdy(struct hts221_hw *hw, bool enable)
static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
{
int i, err;
- u8 val;
for (i = 0; i < ARRAY_SIZE(hts221_odr_table); i++)
if (hts221_odr_table[i].hz == odr)
@@ -222,9 +203,19 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
if (i == ARRAY_SIZE(hts221_odr_table))
return -EINVAL;
- val = HTS221_ENABLE_SENSOR | HTS221_BDU_MASK | hts221_odr_table[i].val;
+ /* enable Block Data Update */
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_BDU_MASK, 1);
+ if (err < 0)
+ return err;
+
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_ODR_MASK, hts221_odr_table[i].val);
+ if (err < 0)
+ return err;
+
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_ODR_MASK, val);
+ HTS221_ENABLE_MASK, 1);
if (err < 0)
return err;
@@ -241,14 +232,13 @@ static int hts221_update_avg(struct hts221_hw *hw,
const struct hts221_avg *avg = &hts221_avg_list[type];
for (i = 0; i < HTS221_AVG_DEPTH; i++)
- if (avg->avg_avl[i].avg == val)
+ if (avg->avg_avl[i] == val)
break;
if (i == HTS221_AVG_DEPTH)
return -EINVAL;
- err = hts221_write_with_mask(hw, avg->addr, avg->mask,
- avg->avg_avl[i].val);
+ err = hts221_write_with_mask(hw, avg->addr, avg->mask, i);
if (err < 0)
return err;
@@ -283,7 +273,7 @@ hts221_sysfs_rh_oversampling_avail(struct device *dev,
for (i = 0; i < ARRAY_SIZE(avg->avg_avl); i++)
len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
- avg->avg_avl[i].avg);
+ avg->avg_avl[i]);
buf[len - 1] = '\n';
return len;
@@ -300,7 +290,7 @@ hts221_sysfs_temp_oversampling_avail(struct device *dev,
for (i = 0; i < ARRAY_SIZE(avg->avg_avl); i++)
len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
- avg->avg_avl[i].avg);
+ avg->avg_avl[i]);
buf[len - 1] = '\n';
return len;
@@ -534,13 +524,13 @@ static int hts221_read_raw(struct iio_dev *iio_dev,
case IIO_HUMIDITYRELATIVE:
avg = &hts221_avg_list[HTS221_SENSOR_H];
idx = hw->sensors[HTS221_SENSOR_H].cur_avg_idx;
- *val = avg->avg_avl[idx].avg;
+ *val = avg->avg_avl[idx];
ret = IIO_VAL_INT;
break;
case IIO_TEMP:
avg = &hts221_avg_list[HTS221_SENSOR_T];
idx = hw->sensors[HTS221_SENSOR_T].cur_avg_idx;
- *val = avg->avg_avl[idx].avg;
+ *val = avg->avg_avl[idx];
ret = IIO_VAL_INT;
break;
default:
@@ -661,7 +651,7 @@ int hts221_probe(struct iio_dev *iio_dev)
return err;
}
- data = hts221_avg_list[HTS221_SENSOR_H].avg_avl[3].avg;
+ data = hts221_avg_list[HTS221_SENSOR_H].avg_avl[3];
err = hts221_update_avg(hw, HTS221_SENSOR_H, data);
if (err < 0) {
dev_err(hw->dev, "failed to set rh oversampling ratio\n");
@@ -676,7 +666,7 @@ int hts221_probe(struct iio_dev *iio_dev)
return err;
}
- data = hts221_avg_list[HTS221_SENSOR_T].avg_avl[3].avg;
+ data = hts221_avg_list[HTS221_SENSOR_T].avg_avl[3];
err = hts221_update_avg(hw, HTS221_SENSOR_T, data);
if (err < 0) {
dev_err(hw->dev,
--
2.13.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 01/10] iio: humidity: hts221: refactor write_with_mask code
@ 2017-07-17 17:38 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:38 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
Move bit-shift in hts221_write_with_mask() instead of coding
the shift depth in the configured value. That change will be necessary
to fix an issue in device power-down procedure.
Simplify hts221_avg_list table management
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
drivers/iio/humidity/hts221.h | 6 ---
drivers/iio/humidity/hts221_core.c | 94 +++++++++++++++++---------------------
2 files changed, 42 insertions(+), 58 deletions(-)
diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
index 94510266e0a5..bf33d8f6396c 100644
--- a/drivers/iio/humidity/hts221.h
+++ b/drivers/iio/humidity/hts221.h
@@ -30,12 +30,6 @@ struct hts221_transfer_function {
int (*write)(struct device *dev, u8 addr, int len, u8 *data);
};
-#define HTS221_AVG_DEPTH 8
-struct hts221_avg_avl {
- u16 avg;
- u8 val;
-};
-
enum hts221_sensor_type {
HTS221_SENSOR_H,
HTS221_SENSOR_T,
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index a56da3999e00..d2f59626b040 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -32,30 +32,12 @@
#define HTS221_HUMIDITY_AVG_MASK 0x07
#define HTS221_TEMP_AVG_MASK 0x38
-#define HTS221_ODR_MASK 0x87
+#define HTS221_ODR_MASK 0x03
#define HTS221_BDU_MASK BIT(2)
+#define HTS221_ENABLE_MASK BIT(7)
#define HTS221_DRDY_MASK BIT(2)
-#define HTS221_ENABLE_SENSOR BIT(7)
-
-#define HTS221_HUMIDITY_AVG_4 0x00 /* 0.4 %RH */
-#define HTS221_HUMIDITY_AVG_8 0x01 /* 0.3 %RH */
-#define HTS221_HUMIDITY_AVG_16 0x02 /* 0.2 %RH */
-#define HTS221_HUMIDITY_AVG_32 0x03 /* 0.15 %RH */
-#define HTS221_HUMIDITY_AVG_64 0x04 /* 0.1 %RH */
-#define HTS221_HUMIDITY_AVG_128 0x05 /* 0.07 %RH */
-#define HTS221_HUMIDITY_AVG_256 0x06 /* 0.05 %RH */
-#define HTS221_HUMIDITY_AVG_512 0x07 /* 0.03 %RH */
-
-#define HTS221_TEMP_AVG_2 0x00 /* 0.08 degC */
-#define HTS221_TEMP_AVG_4 0x08 /* 0.05 degC */
-#define HTS221_TEMP_AVG_8 0x10 /* 0.04 degC */
-#define HTS221_TEMP_AVG_16 0x18 /* 0.03 degC */
-#define HTS221_TEMP_AVG_32 0x20 /* 0.02 degC */
-#define HTS221_TEMP_AVG_64 0x28 /* 0.015 degC */
-#define HTS221_TEMP_AVG_128 0x30 /* 0.01 degC */
-#define HTS221_TEMP_AVG_256 0x38 /* 0.007 degC */
/* calibration registers */
#define HTS221_REG_0RH_CAL_X_H 0x36
@@ -73,10 +55,11 @@ struct hts221_odr {
u8 val;
};
+#define HTS221_AVG_DEPTH 8
struct hts221_avg {
u8 addr;
u8 mask;
- struct hts221_avg_avl avg_avl[HTS221_AVG_DEPTH];
+ u16 avg_avl[HTS221_AVG_DEPTH];
};
static const struct hts221_odr hts221_odr_table[] = {
@@ -90,28 +73,28 @@ static const struct hts221_avg hts221_avg_list[] = {
.addr = HTS221_REG_AVG_ADDR,
.mask = HTS221_HUMIDITY_AVG_MASK,
.avg_avl = {
- { 4, HTS221_HUMIDITY_AVG_4 },
- { 8, HTS221_HUMIDITY_AVG_8 },
- { 16, HTS221_HUMIDITY_AVG_16 },
- { 32, HTS221_HUMIDITY_AVG_32 },
- { 64, HTS221_HUMIDITY_AVG_64 },
- { 128, HTS221_HUMIDITY_AVG_128 },
- { 256, HTS221_HUMIDITY_AVG_256 },
- { 512, HTS221_HUMIDITY_AVG_512 },
+ 4, /* 0.4 %RH */
+ 8, /* 0.3 %RH */
+ 16, /* 0.2 %RH */
+ 32, /* 0.15 %RH */
+ 64, /* 0.1 %RH */
+ 128, /* 0.07 %RH */
+ 256, /* 0.05 %RH */
+ 512, /* 0.03 %RH */
},
},
{
.addr = HTS221_REG_AVG_ADDR,
.mask = HTS221_TEMP_AVG_MASK,
.avg_avl = {
- { 2, HTS221_TEMP_AVG_2 },
- { 4, HTS221_TEMP_AVG_4 },
- { 8, HTS221_TEMP_AVG_8 },
- { 16, HTS221_TEMP_AVG_16 },
- { 32, HTS221_TEMP_AVG_32 },
- { 64, HTS221_TEMP_AVG_64 },
- { 128, HTS221_TEMP_AVG_128 },
- { 256, HTS221_TEMP_AVG_256 },
+ 2, /* 0.08 degC */
+ 4, /* 0.05 degC */
+ 8, /* 0.04 degC */
+ 16, /* 0.03 degC */
+ 32, /* 0.02 degC */
+ 64, /* 0.015 degC */
+ 128, /* 0.01 degC */
+ 256, /* 0.007 degC */
},
},
};
@@ -166,7 +149,7 @@ static int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask,
goto unlock;
}
- data = (data & ~mask) | (val & mask);
+ data = (data & ~mask) | ((val << __ffs(mask)) & mask);
err = hw->tf->write(hw->dev, addr, sizeof(data), &data);
if (err < 0)
@@ -201,11 +184,10 @@ static int hts221_check_whoami(struct hts221_hw *hw)
int hts221_config_drdy(struct hts221_hw *hw, bool enable)
{
- u8 val = enable ? BIT(2) : 0;
int err;
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR,
- HTS221_DRDY_MASK, val);
+ HTS221_DRDY_MASK, enable);
return err < 0 ? err : 0;
}
@@ -213,7 +195,6 @@ int hts221_config_drdy(struct hts221_hw *hw, bool enable)
static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
{
int i, err;
- u8 val;
for (i = 0; i < ARRAY_SIZE(hts221_odr_table); i++)
if (hts221_odr_table[i].hz == odr)
@@ -222,9 +203,19 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
if (i == ARRAY_SIZE(hts221_odr_table))
return -EINVAL;
- val = HTS221_ENABLE_SENSOR | HTS221_BDU_MASK | hts221_odr_table[i].val;
+ /* enable Block Data Update */
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_BDU_MASK, 1);
+ if (err < 0)
+ return err;
+
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_ODR_MASK, hts221_odr_table[i].val);
+ if (err < 0)
+ return err;
+
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_ODR_MASK, val);
+ HTS221_ENABLE_MASK, 1);
if (err < 0)
return err;
@@ -241,14 +232,13 @@ static int hts221_update_avg(struct hts221_hw *hw,
const struct hts221_avg *avg = &hts221_avg_list[type];
for (i = 0; i < HTS221_AVG_DEPTH; i++)
- if (avg->avg_avl[i].avg == val)
+ if (avg->avg_avl[i] == val)
break;
if (i == HTS221_AVG_DEPTH)
return -EINVAL;
- err = hts221_write_with_mask(hw, avg->addr, avg->mask,
- avg->avg_avl[i].val);
+ err = hts221_write_with_mask(hw, avg->addr, avg->mask, i);
if (err < 0)
return err;
@@ -283,7 +273,7 @@ hts221_sysfs_rh_oversampling_avail(struct device *dev,
for (i = 0; i < ARRAY_SIZE(avg->avg_avl); i++)
len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
- avg->avg_avl[i].avg);
+ avg->avg_avl[i]);
buf[len - 1] = '\n';
return len;
@@ -300,7 +290,7 @@ hts221_sysfs_temp_oversampling_avail(struct device *dev,
for (i = 0; i < ARRAY_SIZE(avg->avg_avl); i++)
len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
- avg->avg_avl[i].avg);
+ avg->avg_avl[i]);
buf[len - 1] = '\n';
return len;
@@ -534,13 +524,13 @@ static int hts221_read_raw(struct iio_dev *iio_dev,
case IIO_HUMIDITYRELATIVE:
avg = &hts221_avg_list[HTS221_SENSOR_H];
idx = hw->sensors[HTS221_SENSOR_H].cur_avg_idx;
- *val = avg->avg_avl[idx].avg;
+ *val = avg->avg_avl[idx];
ret = IIO_VAL_INT;
break;
case IIO_TEMP:
avg = &hts221_avg_list[HTS221_SENSOR_T];
idx = hw->sensors[HTS221_SENSOR_T].cur_avg_idx;
- *val = avg->avg_avl[idx].avg;
+ *val = avg->avg_avl[idx];
ret = IIO_VAL_INT;
break;
default:
@@ -661,7 +651,7 @@ int hts221_probe(struct iio_dev *iio_dev)
return err;
}
- data = hts221_avg_list[HTS221_SENSOR_H].avg_avl[3].avg;
+ data = hts221_avg_list[HTS221_SENSOR_H].avg_avl[3];
err = hts221_update_avg(hw, HTS221_SENSOR_H, data);
if (err < 0) {
dev_err(hw->dev, "failed to set rh oversampling ratio\n");
@@ -676,7 +666,7 @@ int hts221_probe(struct iio_dev *iio_dev)
return err;
}
- data = hts221_avg_list[HTS221_SENSOR_T].avg_avl[3].avg;
+ data = hts221_avg_list[HTS221_SENSOR_T].avg_avl[3];
err = hts221_update_avg(hw, HTS221_SENSOR_T, data);
if (err < 0) {
dev_err(hw->dev,
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 02/10] iio: humidity: hts221: move BDU configuration in probe routine
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-17 17:38 ` Lorenzo Bianconi
-1 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:38 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
Enable Block Data Update in hts221_probe() in order to avoid to reconfigure
it every time the sensor is enabled
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
drivers/iio/humidity/hts221_core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index d2f59626b040..47a29b2da1ce 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -203,12 +203,6 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
if (i == ARRAY_SIZE(hts221_odr_table))
return -EINVAL;
- /* enable Block Data Update */
- err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_BDU_MASK, 1);
- if (err < 0)
- return err;
-
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
HTS221_ODR_MASK, hts221_odr_table[i].val);
if (err < 0)
@@ -644,6 +638,12 @@ int hts221_probe(struct iio_dev *iio_dev)
iio_dev->name = HTS221_DEV_NAME;
iio_dev->info = &hts221_info;
+ /* enable Block Data Update */
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_BDU_MASK, 1);
+ if (err < 0)
+ return err;
+
/* configure humidity sensor */
err = hts221_parse_rh_caldata(hw);
if (err < 0) {
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 02/10] iio: humidity: hts221: move BDU configuration in probe routine
@ 2017-07-17 17:38 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:38 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
Enable Block Data Update in hts221_probe() in order to avoid to reconfigure
it every time the sensor is enabled
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
drivers/iio/humidity/hts221_core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index d2f59626b040..47a29b2da1ce 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -203,12 +203,6 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
if (i == ARRAY_SIZE(hts221_odr_table))
return -EINVAL;
- /* enable Block Data Update */
- err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_BDU_MASK, 1);
- if (err < 0)
- return err;
-
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
HTS221_ODR_MASK, hts221_odr_table[i].val);
if (err < 0)
@@ -644,6 +638,12 @@ int hts221_probe(struct iio_dev *iio_dev)
iio_dev->name = HTS221_DEV_NAME;
iio_dev->info = &hts221_info;
+ /* enable Block Data Update */
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_BDU_MASK, 1);
+ if (err < 0)
+ return err;
+
/* configure humidity sensor */
err = hts221_parse_rh_caldata(hw);
if (err < 0) {
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-17 17:38 ` Lorenzo Bianconi
-1 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:38 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
GENMASK(6, 3) in CTRL_REG1 and GENMASK(6, 2) in CTRL_REG2 are marked
reserved. Do not changed the original value (not declared in the
datasheet) during power-down/suspend routines.
Fixes: e4a70e3e7d84 (iio: humidity: add support to hts221 rh/temp device)
Fixes: b7079eeac5da (iio: humidity: hts221: add power management support)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
drivers/iio/humidity/hts221_core.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 47a29b2da1ce..6e5847386a45 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -305,11 +305,10 @@ int hts221_power_on(struct hts221_hw *hw)
int hts221_power_off(struct hts221_hw *hw)
{
- __le16 data = 0;
int err;
- err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
- (u8 *)&data);
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_ENABLE_MASK, false);
if (err < 0)
return err;
@@ -692,11 +691,10 @@ static int __maybe_unused hts221_suspend(struct device *dev)
{
struct iio_dev *iio_dev = dev_get_drvdata(dev);
struct hts221_hw *hw = iio_priv(iio_dev);
- __le16 data = 0;
int err;
- err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
- (u8 *)&data);
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_ENABLE_MASK, false);
return err < 0 ? err : 0;
}
--
2.13.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down
@ 2017-07-17 17:38 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:38 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
GENMASK(6, 3) in CTRL_REG1 and GENMASK(6, 2) in CTRL_REG2 are marked
reserved. Do not changed the original value (not declared in the
datasheet) during power-down/suspend routines.
Fixes: e4a70e3e7d84 (iio: humidity: add support to hts221 rh/temp device)
Fixes: b7079eeac5da (iio: humidity: hts221: add power management support)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
drivers/iio/humidity/hts221_core.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 47a29b2da1ce..6e5847386a45 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -305,11 +305,10 @@ int hts221_power_on(struct hts221_hw *hw)
int hts221_power_off(struct hts221_hw *hw)
{
- __le16 data = 0;
int err;
- err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
- (u8 *)&data);
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_ENABLE_MASK, false);
if (err < 0)
return err;
@@ -692,11 +691,10 @@ static int __maybe_unused hts221_suspend(struct device *dev)
{
struct iio_dev *iio_dev = dev_get_drvdata(dev);
struct hts221_hw *hw = iio_priv(iio_dev);
- __le16 data = 0;
int err;
- err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
- (u8 *)&data);
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_ENABLE_MASK, false);
return err < 0 ? err : 0;
}
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 04/10] iio: humidity: hts221: avoid useless ODR reconfiguration
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-17 17:38 ` Lorenzo Bianconi
-1 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:38 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
Configure sensor ODR just in hts221_write_raw() in order to avoid
to set device sample rate multiple times.
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
drivers/iio/humidity/hts221_core.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 6e5847386a45..f99adc44139e 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -208,11 +208,6 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
if (err < 0)
return err;
- err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_ENABLE_MASK, 1);
- if (err < 0)
- return err;
-
hw->odr = odr;
return 0;
@@ -294,7 +289,8 @@ int hts221_power_on(struct hts221_hw *hw)
{
int err;
- err = hts221_update_odr(hw, hw->odr);
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_ENABLE_MASK, true);
if (err < 0)
return err;
@@ -627,8 +623,6 @@ int hts221_probe(struct iio_dev *iio_dev)
if (err < 0)
return err;
- hw->odr = hts221_odr_table[0].hz;
-
iio_dev->modes = INDIO_DIRECT_MODE;
iio_dev->dev.parent = hw->dev;
iio_dev->available_scan_masks = hts221_scan_masks;
@@ -643,6 +637,10 @@ int hts221_probe(struct iio_dev *iio_dev)
if (err < 0)
return err;
+ err = hts221_update_odr(hw, hts221_odr_table[0].hz);
+ if (err < 0)
+ return err;
+
/* configure humidity sensor */
err = hts221_parse_rh_caldata(hw);
if (err < 0) {
@@ -706,7 +704,8 @@ static int __maybe_unused hts221_resume(struct device *dev)
int err = 0;
if (hw->enabled)
- err = hts221_update_odr(hw, hw->odr);
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_ENABLE_MASK, true);
return err;
}
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 04/10] iio: humidity: hts221: avoid useless ODR reconfiguration
@ 2017-07-17 17:38 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:38 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
Configure sensor ODR just in hts221_write_raw() in order to avoid
to set device sample rate multiple times.
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
drivers/iio/humidity/hts221_core.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 6e5847386a45..f99adc44139e 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -208,11 +208,6 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
if (err < 0)
return err;
- err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_ENABLE_MASK, 1);
- if (err < 0)
- return err;
-
hw->odr = odr;
return 0;
@@ -294,7 +289,8 @@ int hts221_power_on(struct hts221_hw *hw)
{
int err;
- err = hts221_update_odr(hw, hw->odr);
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_ENABLE_MASK, true);
if (err < 0)
return err;
@@ -627,8 +623,6 @@ int hts221_probe(struct iio_dev *iio_dev)
if (err < 0)
return err;
- hw->odr = hts221_odr_table[0].hz;
-
iio_dev->modes = INDIO_DIRECT_MODE;
iio_dev->dev.parent = hw->dev;
iio_dev->available_scan_masks = hts221_scan_masks;
@@ -643,6 +637,10 @@ int hts221_probe(struct iio_dev *iio_dev)
if (err < 0)
return err;
+ err = hts221_update_odr(hw, hts221_odr_table[0].hz);
+ if (err < 0)
+ return err;
+
/* configure humidity sensor */
err = hts221_parse_rh_caldata(hw);
if (err < 0) {
@@ -706,7 +704,8 @@ static int __maybe_unused hts221_resume(struct device *dev)
int err = 0;
if (hw->enabled)
- err = hts221_update_odr(hw, hw->odr);
+ err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
+ HTS221_ENABLE_MASK, true);
return err;
}
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 05/10] iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-17 17:39 ` Lorenzo Bianconi
-1 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
drivers/iio/humidity/hts221.h | 3 +--
drivers/iio/humidity/hts221_buffer.c | 4 ++--
drivers/iio/humidity/hts221_core.c | 24 +++++-------------------
3 files changed, 8 insertions(+), 23 deletions(-)
diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
index bf33d8f6396c..69dfa5c63ec2 100644
--- a/drivers/iio/humidity/hts221.h
+++ b/drivers/iio/humidity/hts221.h
@@ -62,8 +62,7 @@ extern const struct dev_pm_ops hts221_pm_ops;
int hts221_config_drdy(struct hts221_hw *hw, bool enable);
int hts221_probe(struct iio_dev *iio_dev);
-int hts221_power_on(struct hts221_hw *hw);
-int hts221_power_off(struct hts221_hw *hw);
+int hts221_set_enable(struct hts221_hw *hw, bool enable);
int hts221_allocate_buffers(struct hts221_hw *hw);
int hts221_allocate_trigger(struct hts221_hw *hw);
diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index 7d19a3da7ab7..c4ed153ad397 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -109,12 +109,12 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
static int hts221_buffer_preenable(struct iio_dev *iio_dev)
{
- return hts221_power_on(iio_priv(iio_dev));
+ return hts221_set_enable(iio_priv(iio_dev), true);
}
static int hts221_buffer_postdisable(struct iio_dev *iio_dev)
{
- return hts221_power_off(iio_priv(iio_dev));
+ return hts221_set_enable(iio_priv(iio_dev), false);
}
static const struct iio_buffer_setup_ops hts221_buffer_ops = {
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index f99adc44139e..dc55d9fbc702 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -285,30 +285,16 @@ hts221_sysfs_temp_oversampling_avail(struct device *dev,
return len;
}
-int hts221_power_on(struct hts221_hw *hw)
+int hts221_set_enable(struct hts221_hw *hw, bool enable)
{
int err;
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_ENABLE_MASK, true);
+ HTS221_ENABLE_MASK, enable);
if (err < 0)
return err;
- hw->enabled = true;
-
- return 0;
-}
-
-int hts221_power_off(struct hts221_hw *hw)
-{
- int err;
-
- err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_ENABLE_MASK, false);
- if (err < 0)
- return err;
-
- hw->enabled = false;
+ hw->enabled = enable;
return 0;
}
@@ -463,7 +449,7 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
u8 data[HTS221_DATA_SIZE];
int err;
- err = hts221_power_on(hw);
+ err = hts221_set_enable(hw, true);
if (err < 0)
return err;
@@ -473,7 +459,7 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
if (err < 0)
return err;
- hts221_power_off(hw);
+ hts221_set_enable(hw, false);
*val = (s16)get_unaligned_le16(data);
--
2.13.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 05/10] iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable
@ 2017-07-17 17:39 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
drivers/iio/humidity/hts221.h | 3 +--
drivers/iio/humidity/hts221_buffer.c | 4 ++--
drivers/iio/humidity/hts221_core.c | 24 +++++-------------------
3 files changed, 8 insertions(+), 23 deletions(-)
diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
index bf33d8f6396c..69dfa5c63ec2 100644
--- a/drivers/iio/humidity/hts221.h
+++ b/drivers/iio/humidity/hts221.h
@@ -62,8 +62,7 @@ extern const struct dev_pm_ops hts221_pm_ops;
int hts221_config_drdy(struct hts221_hw *hw, bool enable);
int hts221_probe(struct iio_dev *iio_dev);
-int hts221_power_on(struct hts221_hw *hw);
-int hts221_power_off(struct hts221_hw *hw);
+int hts221_set_enable(struct hts221_hw *hw, bool enable);
int hts221_allocate_buffers(struct hts221_hw *hw);
int hts221_allocate_trigger(struct hts221_hw *hw);
diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index 7d19a3da7ab7..c4ed153ad397 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -109,12 +109,12 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
static int hts221_buffer_preenable(struct iio_dev *iio_dev)
{
- return hts221_power_on(iio_priv(iio_dev));
+ return hts221_set_enable(iio_priv(iio_dev), true);
}
static int hts221_buffer_postdisable(struct iio_dev *iio_dev)
{
- return hts221_power_off(iio_priv(iio_dev));
+ return hts221_set_enable(iio_priv(iio_dev), false);
}
static const struct iio_buffer_setup_ops hts221_buffer_ops = {
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index f99adc44139e..dc55d9fbc702 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -285,30 +285,16 @@ hts221_sysfs_temp_oversampling_avail(struct device *dev,
return len;
}
-int hts221_power_on(struct hts221_hw *hw)
+int hts221_set_enable(struct hts221_hw *hw, bool enable)
{
int err;
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_ENABLE_MASK, true);
+ HTS221_ENABLE_MASK, enable);
if (err < 0)
return err;
- hw->enabled = true;
-
- return 0;
-}
-
-int hts221_power_off(struct hts221_hw *hw)
-{
- int err;
-
- err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_ENABLE_MASK, false);
- if (err < 0)
- return err;
-
- hw->enabled = false;
+ hw->enabled = enable;
return 0;
}
@@ -463,7 +449,7 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
u8 data[HTS221_DATA_SIZE];
int err;
- err = hts221_power_on(hw);
+ err = hts221_set_enable(hw, true);
if (err < 0)
return err;
@@ -473,7 +459,7 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
if (err < 0)
return err;
- hts221_power_off(hw);
+ hts221_set_enable(hw, false);
*val = (s16)get_unaligned_le16(data);
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 06/10] iio: humidity: hts221: support active-low interrupts
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-17 17:39 ` Lorenzo Bianconi
-1 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
Add support for active low interrupts (IRQF_TRIGGER_LOW and
IRQF_TRIGGER_FALLING). Configure the device as active high or low
according to the requested irq line.
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
drivers/iio/humidity/hts221.h | 1 +
drivers/iio/humidity/hts221_buffer.c | 11 +++++++++++
drivers/iio/humidity/hts221_core.c | 3 +--
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
index 69dfa5c63ec2..c3de6e494f8c 100644
--- a/drivers/iio/humidity/hts221.h
+++ b/drivers/iio/humidity/hts221.h
@@ -61,6 +61,7 @@ struct hts221_hw {
extern const struct dev_pm_ops hts221_pm_ops;
int hts221_config_drdy(struct hts221_hw *hw, bool enable);
+int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val);
int hts221_probe(struct iio_dev *iio_dev);
int hts221_set_enable(struct hts221_hw *hw, bool enable);
int hts221_allocate_buffers(struct hts221_hw *hw);
diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index c4ed153ad397..ad5222295b2c 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -22,6 +22,8 @@
#include "hts221.h"
+#define HTS221_REG_DRDY_HL_ADDR 0x22
+#define HTS221_REG_DRDY_HL_MASK BIT(7)
#define HTS221_REG_STATUS_ADDR 0x27
#define HTS221_RH_DRDY_MASK BIT(1)
#define HTS221_TEMP_DRDY_MASK BIT(0)
@@ -67,6 +69,7 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
int hts221_allocate_trigger(struct hts221_hw *hw)
{
struct iio_dev *iio_dev = iio_priv_to_dev(hw);
+ bool irq_active_low = false;
unsigned long irq_type;
int err;
@@ -76,6 +79,10 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
case IRQF_TRIGGER_HIGH:
case IRQF_TRIGGER_RISING:
break;
+ case IRQF_TRIGGER_LOW:
+ case IRQF_TRIGGER_FALLING:
+ irq_active_low = true;
+ break;
default:
dev_info(hw->dev,
"mode %lx unsupported, using IRQF_TRIGGER_RISING\n",
@@ -84,6 +91,10 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
break;
}
+ err = hts221_write_with_mask(hw, HTS221_REG_DRDY_HL_ADDR,
+ HTS221_REG_DRDY_HL_MASK, irq_active_low);
+ if (err < 0)
+ return err;
err = devm_request_threaded_irq(hw->dev, hw->irq, NULL,
hts221_trigger_handler_thread,
irq_type | IRQF_ONESHOT,
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index dc55d9fbc702..25fcb9993998 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -135,8 +135,7 @@ static const struct iio_chan_spec hts221_channels[] = {
IIO_CHAN_SOFT_TIMESTAMP(2),
};
-static int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask,
- u8 val)
+int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val)
{
u8 data;
int err;
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 06/10] iio: humidity: hts221: support active-low interrupts
@ 2017-07-17 17:39 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
Add support for active low interrupts (IRQF_TRIGGER_LOW and
IRQF_TRIGGER_FALLING). Configure the device as active high or low
according to the requested irq line.
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
drivers/iio/humidity/hts221.h | 1 +
drivers/iio/humidity/hts221_buffer.c | 11 +++++++++++
drivers/iio/humidity/hts221_core.c | 3 +--
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
index 69dfa5c63ec2..c3de6e494f8c 100644
--- a/drivers/iio/humidity/hts221.h
+++ b/drivers/iio/humidity/hts221.h
@@ -61,6 +61,7 @@ struct hts221_hw {
extern const struct dev_pm_ops hts221_pm_ops;
int hts221_config_drdy(struct hts221_hw *hw, bool enable);
+int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val);
int hts221_probe(struct iio_dev *iio_dev);
int hts221_set_enable(struct hts221_hw *hw, bool enable);
int hts221_allocate_buffers(struct hts221_hw *hw);
diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index c4ed153ad397..ad5222295b2c 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -22,6 +22,8 @@
#include "hts221.h"
+#define HTS221_REG_DRDY_HL_ADDR 0x22
+#define HTS221_REG_DRDY_HL_MASK BIT(7)
#define HTS221_REG_STATUS_ADDR 0x27
#define HTS221_RH_DRDY_MASK BIT(1)
#define HTS221_TEMP_DRDY_MASK BIT(0)
@@ -67,6 +69,7 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
int hts221_allocate_trigger(struct hts221_hw *hw)
{
struct iio_dev *iio_dev = iio_priv_to_dev(hw);
+ bool irq_active_low = false;
unsigned long irq_type;
int err;
@@ -76,6 +79,10 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
case IRQF_TRIGGER_HIGH:
case IRQF_TRIGGER_RISING:
break;
+ case IRQF_TRIGGER_LOW:
+ case IRQF_TRIGGER_FALLING:
+ irq_active_low = true;
+ break;
default:
dev_info(hw->dev,
"mode %lx unsupported, using IRQF_TRIGGER_RISING\n",
@@ -84,6 +91,10 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
break;
}
+ err = hts221_write_with_mask(hw, HTS221_REG_DRDY_HL_ADDR,
+ HTS221_REG_DRDY_HL_MASK, irq_active_low);
+ if (err < 0)
+ return err;
err = devm_request_threaded_irq(hw->dev, hw->irq, NULL,
hts221_trigger_handler_thread,
irq_type | IRQF_ONESHOT,
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index dc55d9fbc702..25fcb9993998 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -135,8 +135,7 @@ static const struct iio_chan_spec hts221_channels[] = {
IIO_CHAN_SOFT_TIMESTAMP(2),
};
-static int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask,
- u8 val)
+int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val)
{
u8 data;
int err;
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 07/10] dt-bindings: iio: humidity: hts221: support active-low interrupts
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-17 17:39 ` Lorenzo Bianconi
-1 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
Update hts221 device binding with active-low interrupts support
(IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_EDGE_FALLING).
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
Documentation/devicetree/bindings/iio/humidity/hts221.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/iio/humidity/hts221.txt b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
index b20ab9c12080..fca263e13400 100644
--- a/Documentation/devicetree/bindings/iio/humidity/hts221.txt
+++ b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
@@ -7,7 +7,8 @@ Required properties:
Optional properties:
- interrupt-parent: should be the phandle for the interrupt controller
- interrupts: interrupt mapping for IRQ. It should be configured with
- flags IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_EDGE_RISING.
+ flags IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_EDGE_RISING, IRQ_TYPE_LEVEL_LOW or
+ IRQ_TYPE_EDGE_FALLING.
Refer to interrupt-controller/interrupts.txt for generic interrupt
client node bindings.
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 07/10] dt-bindings: iio: humidity: hts221: support active-low interrupts
@ 2017-07-17 17:39 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
Update hts221 device binding with active-low interrupts support
(IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_EDGE_FALLING).
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
Documentation/devicetree/bindings/iio/humidity/hts221.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/iio/humidity/hts221.txt b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
index b20ab9c12080..fca263e13400 100644
--- a/Documentation/devicetree/bindings/iio/humidity/hts221.txt
+++ b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
@@ -7,7 +7,8 @@ Required properties:
Optional properties:
- interrupt-parent: should be the phandle for the interrupt controller
- interrupts: interrupt mapping for IRQ. It should be configured with
- flags IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_EDGE_RISING.
+ flags IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_EDGE_RISING, IRQ_TYPE_LEVEL_LOW or
+ IRQ_TYPE_EDGE_FALLING.
Refer to interrupt-controller/interrupts.txt for generic interrupt
client node bindings.
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 08/10] iio: humidity: hts221: support open drain mode
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-17 17:39 ` Lorenzo Bianconi
-1 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
Add open drain support in order to share requested IRQ line between
hts221 device and other peripherals
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
drivers/iio/humidity/hts221_buffer.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index ad5222295b2c..f29f01a22375 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -20,10 +20,14 @@
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/buffer.h>
+#include <linux/platform_data/st_sensors_pdata.h>
+
#include "hts221.h"
#define HTS221_REG_DRDY_HL_ADDR 0x22
#define HTS221_REG_DRDY_HL_MASK BIT(7)
+#define HTS221_REG_DRDY_PP_OD_ADDR 0x22
+#define HTS221_REG_DRDY_PP_OD_MASK BIT(6)
#define HTS221_REG_STATUS_ADDR 0x27
#define HTS221_RH_DRDY_MASK BIT(1)
#define HTS221_TEMP_DRDY_MASK BIT(0)
@@ -69,7 +73,9 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
int hts221_allocate_trigger(struct hts221_hw *hw)
{
struct iio_dev *iio_dev = iio_priv_to_dev(hw);
- bool irq_active_low = false;
+ bool irq_active_low = false, open_drain = false;
+ struct device_node *np = hw->dev->of_node;
+ struct st_sensors_platform_data *pdata;
unsigned long irq_type;
int err;
@@ -95,6 +101,20 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
HTS221_REG_DRDY_HL_MASK, irq_active_low);
if (err < 0)
return err;
+
+ pdata = (struct st_sensors_platform_data *)hw->dev->platform_data;
+ if ((np && of_property_read_bool(np, "drive-open-drain")) ||
+ (pdata && pdata->open_drain)) {
+ irq_type |= IRQF_SHARED;
+ open_drain = true;
+ }
+
+ err = hts221_write_with_mask(hw, HTS221_REG_DRDY_PP_OD_ADDR,
+ HTS221_REG_DRDY_PP_OD_MASK,
+ open_drain);
+ if (err < 0)
+ return err;
+
err = devm_request_threaded_irq(hw->dev, hw->irq, NULL,
hts221_trigger_handler_thread,
irq_type | IRQF_ONESHOT,
--
2.13.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 08/10] iio: humidity: hts221: support open drain mode
@ 2017-07-17 17:39 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
Add open drain support in order to share requested IRQ line between
hts221 device and other peripherals
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
drivers/iio/humidity/hts221_buffer.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index ad5222295b2c..f29f01a22375 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -20,10 +20,14 @@
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/buffer.h>
+#include <linux/platform_data/st_sensors_pdata.h>
+
#include "hts221.h"
#define HTS221_REG_DRDY_HL_ADDR 0x22
#define HTS221_REG_DRDY_HL_MASK BIT(7)
+#define HTS221_REG_DRDY_PP_OD_ADDR 0x22
+#define HTS221_REG_DRDY_PP_OD_MASK BIT(6)
#define HTS221_REG_STATUS_ADDR 0x27
#define HTS221_RH_DRDY_MASK BIT(1)
#define HTS221_TEMP_DRDY_MASK BIT(0)
@@ -69,7 +73,9 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
int hts221_allocate_trigger(struct hts221_hw *hw)
{
struct iio_dev *iio_dev = iio_priv_to_dev(hw);
- bool irq_active_low = false;
+ bool irq_active_low = false, open_drain = false;
+ struct device_node *np = hw->dev->of_node;
+ struct st_sensors_platform_data *pdata;
unsigned long irq_type;
int err;
@@ -95,6 +101,20 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
HTS221_REG_DRDY_HL_MASK, irq_active_low);
if (err < 0)
return err;
+
+ pdata = (struct st_sensors_platform_data *)hw->dev->platform_data;
+ if ((np && of_property_read_bool(np, "drive-open-drain")) ||
+ (pdata && pdata->open_drain)) {
+ irq_type |= IRQF_SHARED;
+ open_drain = true;
+ }
+
+ err = hts221_write_with_mask(hw, HTS221_REG_DRDY_PP_OD_ADDR,
+ HTS221_REG_DRDY_PP_OD_MASK,
+ open_drain);
+ if (err < 0)
+ return err;
+
err = devm_request_threaded_irq(hw->dev, hw->irq, NULL,
hts221_trigger_handler_thread,
irq_type | IRQF_ONESHOT,
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 09/10] dt-bindings: iio: humidity: hts221: support open drain mode
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-17 17:39 ` Lorenzo Bianconi
-1 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
Documentation/devicetree/bindings/iio/humidity/hts221.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/iio/humidity/hts221.txt b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
index fca263e13400..10adeb0d703d 100644
--- a/Documentation/devicetree/bindings/iio/humidity/hts221.txt
+++ b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
@@ -5,6 +5,14 @@ Required properties:
- reg: i2c address of the sensor / spi cs line
Optional properties:
+- drive-open-drain: the interrupt/data ready line will be configured
+ as open drain, which is useful if several sensors share the same
+ interrupt line. This is a boolean property.
+ If the requested interrupt is configured as IRQ_TYPE_LEVEL_HIGH or
+ IRQ_TYPE_EDGE_RISING a pull-down resistor is needed to drive the line
+ when it is not active, whereas a pull-up one is needed when interrupt
+ line is configured as IRQ_TYPE_LEVEL_LOW or IRQ_TYPE_EDGE_FALLING.
+ Refer to pinctrl/pinctrl-bindings.txt for the property description.
- interrupt-parent: should be the phandle for the interrupt controller
- interrupts: interrupt mapping for IRQ. It should be configured with
flags IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_EDGE_RISING, IRQ_TYPE_LEVEL_LOW or
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 09/10] dt-bindings: iio: humidity: hts221: support open drain mode
@ 2017-07-17 17:39 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
Documentation/devicetree/bindings/iio/humidity/hts221.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/iio/humidity/hts221.txt b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
index fca263e13400..10adeb0d703d 100644
--- a/Documentation/devicetree/bindings/iio/humidity/hts221.txt
+++ b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
@@ -5,6 +5,14 @@ Required properties:
- reg: i2c address of the sensor / spi cs line
Optional properties:
+- drive-open-drain: the interrupt/data ready line will be configured
+ as open drain, which is useful if several sensors share the same
+ interrupt line. This is a boolean property.
+ If the requested interrupt is configured as IRQ_TYPE_LEVEL_HIGH or
+ IRQ_TYPE_EDGE_RISING a pull-down resistor is needed to drive the line
+ when it is not active, whereas a pull-up one is needed when interrupt
+ line is configured as IRQ_TYPE_LEVEL_LOW or IRQ_TYPE_EDGE_FALLING.
+ Refer to pinctrl/pinctrl-bindings.txt for the property description.
- interrupt-parent: should be the phandle for the interrupt controller
- interrupts: interrupt mapping for IRQ. It should be configured with
flags IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_EDGE_RISING, IRQ_TYPE_LEVEL_LOW or
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 10/10] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state()
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-17 17:39 ` Lorenzo Bianconi
-1 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
Move data-ready configuration in hts221_buffer.c since it is only related
to trigger logic
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
drivers/iio/humidity/hts221.h | 1 -
drivers/iio/humidity/hts221_buffer.c | 8 +++++++-
drivers/iio/humidity/hts221_core.c | 14 --------------
3 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
index c3de6e494f8c..51d021966222 100644
--- a/drivers/iio/humidity/hts221.h
+++ b/drivers/iio/humidity/hts221.h
@@ -60,7 +60,6 @@ struct hts221_hw {
extern const struct dev_pm_ops hts221_pm_ops;
-int hts221_config_drdy(struct hts221_hw *hw, bool enable);
int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val);
int hts221_probe(struct iio_dev *iio_dev);
int hts221_set_enable(struct hts221_hw *hw, bool enable);
diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index f29f01a22375..9690dfe9a844 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -28,6 +28,8 @@
#define HTS221_REG_DRDY_HL_MASK BIT(7)
#define HTS221_REG_DRDY_PP_OD_ADDR 0x22
#define HTS221_REG_DRDY_PP_OD_MASK BIT(6)
+#define HTS221_REG_DRDY_EN_ADDR 0x22
+#define HTS221_REG_DRDY_EN_MASK BIT(2)
#define HTS221_REG_STATUS_ADDR 0x27
#define HTS221_RH_DRDY_MASK BIT(1)
#define HTS221_TEMP_DRDY_MASK BIT(0)
@@ -36,8 +38,12 @@ static int hts221_trig_set_state(struct iio_trigger *trig, bool state)
{
struct iio_dev *iio_dev = iio_trigger_get_drvdata(trig);
struct hts221_hw *hw = iio_priv(iio_dev);
+ int err;
+
+ err = hts221_write_with_mask(hw, HTS221_REG_DRDY_EN_ADDR,
+ HTS221_REG_DRDY_EN_MASK, state);
- return hts221_config_drdy(hw, state);
+ return err < 0 ? err : 0;
}
static const struct iio_trigger_ops hts221_trigger_ops = {
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 25fcb9993998..32524a8dc66f 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -23,7 +23,6 @@
#define HTS221_REG_CNTRL1_ADDR 0x20
#define HTS221_REG_CNTRL2_ADDR 0x21
-#define HTS221_REG_CNTRL3_ADDR 0x22
#define HTS221_REG_AVG_ADDR 0x10
#define HTS221_REG_H_OUT_L 0x28
@@ -36,9 +35,6 @@
#define HTS221_BDU_MASK BIT(2)
#define HTS221_ENABLE_MASK BIT(7)
-#define HTS221_DRDY_MASK BIT(2)
-
-
/* calibration registers */
#define HTS221_REG_0RH_CAL_X_H 0x36
#define HTS221_REG_1RH_CAL_X_H 0x3a
@@ -181,16 +177,6 @@ static int hts221_check_whoami(struct hts221_hw *hw)
return 0;
}
-int hts221_config_drdy(struct hts221_hw *hw, bool enable)
-{
- int err;
-
- err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR,
- HTS221_DRDY_MASK, enable);
-
- return err < 0 ? err : 0;
-}
-
static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
{
int i, err;
--
2.13.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 10/10] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state()
@ 2017-07-17 17:39 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-07-17 17:39 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi
Move data-ready configuration in hts221_buffer.c since it is only related
to trigger logic
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
drivers/iio/humidity/hts221.h | 1 -
drivers/iio/humidity/hts221_buffer.c | 8 +++++++-
drivers/iio/humidity/hts221_core.c | 14 --------------
3 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
index c3de6e494f8c..51d021966222 100644
--- a/drivers/iio/humidity/hts221.h
+++ b/drivers/iio/humidity/hts221.h
@@ -60,7 +60,6 @@ struct hts221_hw {
extern const struct dev_pm_ops hts221_pm_ops;
-int hts221_config_drdy(struct hts221_hw *hw, bool enable);
int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val);
int hts221_probe(struct iio_dev *iio_dev);
int hts221_set_enable(struct hts221_hw *hw, bool enable);
diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index f29f01a22375..9690dfe9a844 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -28,6 +28,8 @@
#define HTS221_REG_DRDY_HL_MASK BIT(7)
#define HTS221_REG_DRDY_PP_OD_ADDR 0x22
#define HTS221_REG_DRDY_PP_OD_MASK BIT(6)
+#define HTS221_REG_DRDY_EN_ADDR 0x22
+#define HTS221_REG_DRDY_EN_MASK BIT(2)
#define HTS221_REG_STATUS_ADDR 0x27
#define HTS221_RH_DRDY_MASK BIT(1)
#define HTS221_TEMP_DRDY_MASK BIT(0)
@@ -36,8 +38,12 @@ static int hts221_trig_set_state(struct iio_trigger *trig, bool state)
{
struct iio_dev *iio_dev = iio_trigger_get_drvdata(trig);
struct hts221_hw *hw = iio_priv(iio_dev);
+ int err;
+
+ err = hts221_write_with_mask(hw, HTS221_REG_DRDY_EN_ADDR,
+ HTS221_REG_DRDY_EN_MASK, state);
- return hts221_config_drdy(hw, state);
+ return err < 0 ? err : 0;
}
static const struct iio_trigger_ops hts221_trigger_ops = {
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 25fcb9993998..32524a8dc66f 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -23,7 +23,6 @@
#define HTS221_REG_CNTRL1_ADDR 0x20
#define HTS221_REG_CNTRL2_ADDR 0x21
-#define HTS221_REG_CNTRL3_ADDR 0x22
#define HTS221_REG_AVG_ADDR 0x10
#define HTS221_REG_H_OUT_L 0x28
@@ -36,9 +35,6 @@
#define HTS221_BDU_MASK BIT(2)
#define HTS221_ENABLE_MASK BIT(7)
-#define HTS221_DRDY_MASK BIT(2)
-
-
/* calibration registers */
#define HTS221_REG_0RH_CAL_X_H 0x36
#define HTS221_REG_1RH_CAL_X_H 0x3a
@@ -181,16 +177,6 @@ static int hts221_check_whoami(struct hts221_hw *hw)
return 0;
}
-int hts221_config_drdy(struct hts221_hw *hw, bool enable)
-{
- int err;
-
- err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR,
- HTS221_DRDY_MASK, enable);
-
- return err < 0 ? err : 0;
-}
-
static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
{
int i, err;
--
2.13.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 01/10] iio: humidity: hts221: refactor write_with_mask code
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-22 17:57 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 17:57 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, 17 Jul 2017 19:38:56 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Move bit-shift in hts221_write_with_mask() instead of coding
> the shift depth in the configured value. That change will be necessary
> to fix an issue in device power-down procedure.
> Simplify hts221_avg_list table management
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
Applied to the togreg branch of iio.git. Whilst this is
associated with a fix, the series to that point is really
too invasive to be material suitable for heading mainline
except during a merge window.
Pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/humidity/hts221.h | 6 ---
> drivers/iio/humidity/hts221_core.c | 94 +++++++++++++++++---------------------
> 2 files changed, 42 insertions(+), 58 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
> index 94510266e0a5..bf33d8f6396c 100644
> --- a/drivers/iio/humidity/hts221.h
> +++ b/drivers/iio/humidity/hts221.h
> @@ -30,12 +30,6 @@ struct hts221_transfer_function {
> int (*write)(struct device *dev, u8 addr, int len, u8 *data);
> };
>
> -#define HTS221_AVG_DEPTH 8
> -struct hts221_avg_avl {
> - u16 avg;
> - u8 val;
> -};
> -
> enum hts221_sensor_type {
> HTS221_SENSOR_H,
> HTS221_SENSOR_T,
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index a56da3999e00..d2f59626b040 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -32,30 +32,12 @@
> #define HTS221_HUMIDITY_AVG_MASK 0x07
> #define HTS221_TEMP_AVG_MASK 0x38
>
> -#define HTS221_ODR_MASK 0x87
> +#define HTS221_ODR_MASK 0x03
> #define HTS221_BDU_MASK BIT(2)
> +#define HTS221_ENABLE_MASK BIT(7)
>
> #define HTS221_DRDY_MASK BIT(2)
>
> -#define HTS221_ENABLE_SENSOR BIT(7)
> -
> -#define HTS221_HUMIDITY_AVG_4 0x00 /* 0.4 %RH */
> -#define HTS221_HUMIDITY_AVG_8 0x01 /* 0.3 %RH */
> -#define HTS221_HUMIDITY_AVG_16 0x02 /* 0.2 %RH */
> -#define HTS221_HUMIDITY_AVG_32 0x03 /* 0.15 %RH */
> -#define HTS221_HUMIDITY_AVG_64 0x04 /* 0.1 %RH */
> -#define HTS221_HUMIDITY_AVG_128 0x05 /* 0.07 %RH */
> -#define HTS221_HUMIDITY_AVG_256 0x06 /* 0.05 %RH */
> -#define HTS221_HUMIDITY_AVG_512 0x07 /* 0.03 %RH */
> -
> -#define HTS221_TEMP_AVG_2 0x00 /* 0.08 degC */
> -#define HTS221_TEMP_AVG_4 0x08 /* 0.05 degC */
> -#define HTS221_TEMP_AVG_8 0x10 /* 0.04 degC */
> -#define HTS221_TEMP_AVG_16 0x18 /* 0.03 degC */
> -#define HTS221_TEMP_AVG_32 0x20 /* 0.02 degC */
> -#define HTS221_TEMP_AVG_64 0x28 /* 0.015 degC */
> -#define HTS221_TEMP_AVG_128 0x30 /* 0.01 degC */
> -#define HTS221_TEMP_AVG_256 0x38 /* 0.007 degC */
>
> /* calibration registers */
> #define HTS221_REG_0RH_CAL_X_H 0x36
> @@ -73,10 +55,11 @@ struct hts221_odr {
> u8 val;
> };
>
> +#define HTS221_AVG_DEPTH 8
> struct hts221_avg {
> u8 addr;
> u8 mask;
> - struct hts221_avg_avl avg_avl[HTS221_AVG_DEPTH];
> + u16 avg_avl[HTS221_AVG_DEPTH];
> };
>
> static const struct hts221_odr hts221_odr_table[] = {
> @@ -90,28 +73,28 @@ static const struct hts221_avg hts221_avg_list[] = {
> .addr = HTS221_REG_AVG_ADDR,
> .mask = HTS221_HUMIDITY_AVG_MASK,
> .avg_avl = {
> - { 4, HTS221_HUMIDITY_AVG_4 },
> - { 8, HTS221_HUMIDITY_AVG_8 },
> - { 16, HTS221_HUMIDITY_AVG_16 },
> - { 32, HTS221_HUMIDITY_AVG_32 },
> - { 64, HTS221_HUMIDITY_AVG_64 },
> - { 128, HTS221_HUMIDITY_AVG_128 },
> - { 256, HTS221_HUMIDITY_AVG_256 },
> - { 512, HTS221_HUMIDITY_AVG_512 },
> + 4, /* 0.4 %RH */
> + 8, /* 0.3 %RH */
> + 16, /* 0.2 %RH */
> + 32, /* 0.15 %RH */
> + 64, /* 0.1 %RH */
> + 128, /* 0.07 %RH */
> + 256, /* 0.05 %RH */
> + 512, /* 0.03 %RH */
> },
> },
> {
> .addr = HTS221_REG_AVG_ADDR,
> .mask = HTS221_TEMP_AVG_MASK,
> .avg_avl = {
> - { 2, HTS221_TEMP_AVG_2 },
> - { 4, HTS221_TEMP_AVG_4 },
> - { 8, HTS221_TEMP_AVG_8 },
> - { 16, HTS221_TEMP_AVG_16 },
> - { 32, HTS221_TEMP_AVG_32 },
> - { 64, HTS221_TEMP_AVG_64 },
> - { 128, HTS221_TEMP_AVG_128 },
> - { 256, HTS221_TEMP_AVG_256 },
> + 2, /* 0.08 degC */
> + 4, /* 0.05 degC */
> + 8, /* 0.04 degC */
> + 16, /* 0.03 degC */
> + 32, /* 0.02 degC */
> + 64, /* 0.015 degC */
> + 128, /* 0.01 degC */
> + 256, /* 0.007 degC */
> },
> },
> };
> @@ -166,7 +149,7 @@ static int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask,
> goto unlock;
> }
>
> - data = (data & ~mask) | (val & mask);
> + data = (data & ~mask) | ((val << __ffs(mask)) & mask);
>
> err = hw->tf->write(hw->dev, addr, sizeof(data), &data);
> if (err < 0)
> @@ -201,11 +184,10 @@ static int hts221_check_whoami(struct hts221_hw *hw)
>
> int hts221_config_drdy(struct hts221_hw *hw, bool enable)
> {
> - u8 val = enable ? BIT(2) : 0;
> int err;
>
> err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR,
> - HTS221_DRDY_MASK, val);
> + HTS221_DRDY_MASK, enable);
>
> return err < 0 ? err : 0;
> }
> @@ -213,7 +195,6 @@ int hts221_config_drdy(struct hts221_hw *hw, bool enable)
> static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
> {
> int i, err;
> - u8 val;
>
> for (i = 0; i < ARRAY_SIZE(hts221_odr_table); i++)
> if (hts221_odr_table[i].hz == odr)
> @@ -222,9 +203,19 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
> if (i == ARRAY_SIZE(hts221_odr_table))
> return -EINVAL;
>
> - val = HTS221_ENABLE_SENSOR | HTS221_BDU_MASK | hts221_odr_table[i].val;
> + /* enable Block Data Update */
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_BDU_MASK, 1);
> + if (err < 0)
> + return err;
> +
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_ODR_MASK, hts221_odr_table[i].val);
> + if (err < 0)
> + return err;
> +
> err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> - HTS221_ODR_MASK, val);
> + HTS221_ENABLE_MASK, 1);
> if (err < 0)
> return err;
>
> @@ -241,14 +232,13 @@ static int hts221_update_avg(struct hts221_hw *hw,
> const struct hts221_avg *avg = &hts221_avg_list[type];
>
> for (i = 0; i < HTS221_AVG_DEPTH; i++)
> - if (avg->avg_avl[i].avg == val)
> + if (avg->avg_avl[i] == val)
> break;
>
> if (i == HTS221_AVG_DEPTH)
> return -EINVAL;
>
> - err = hts221_write_with_mask(hw, avg->addr, avg->mask,
> - avg->avg_avl[i].val);
> + err = hts221_write_with_mask(hw, avg->addr, avg->mask, i);
> if (err < 0)
> return err;
>
> @@ -283,7 +273,7 @@ hts221_sysfs_rh_oversampling_avail(struct device *dev,
>
> for (i = 0; i < ARRAY_SIZE(avg->avg_avl); i++)
> len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
> - avg->avg_avl[i].avg);
> + avg->avg_avl[i]);
> buf[len - 1] = '\n';
>
> return len;
> @@ -300,7 +290,7 @@ hts221_sysfs_temp_oversampling_avail(struct device *dev,
>
> for (i = 0; i < ARRAY_SIZE(avg->avg_avl); i++)
> len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
> - avg->avg_avl[i].avg);
> + avg->avg_avl[i]);
> buf[len - 1] = '\n';
>
> return len;
> @@ -534,13 +524,13 @@ static int hts221_read_raw(struct iio_dev *iio_dev,
> case IIO_HUMIDITYRELATIVE:
> avg = &hts221_avg_list[HTS221_SENSOR_H];
> idx = hw->sensors[HTS221_SENSOR_H].cur_avg_idx;
> - *val = avg->avg_avl[idx].avg;
> + *val = avg->avg_avl[idx];
> ret = IIO_VAL_INT;
> break;
> case IIO_TEMP:
> avg = &hts221_avg_list[HTS221_SENSOR_T];
> idx = hw->sensors[HTS221_SENSOR_T].cur_avg_idx;
> - *val = avg->avg_avl[idx].avg;
> + *val = avg->avg_avl[idx];
> ret = IIO_VAL_INT;
> break;
> default:
> @@ -661,7 +651,7 @@ int hts221_probe(struct iio_dev *iio_dev)
> return err;
> }
>
> - data = hts221_avg_list[HTS221_SENSOR_H].avg_avl[3].avg;
> + data = hts221_avg_list[HTS221_SENSOR_H].avg_avl[3];
> err = hts221_update_avg(hw, HTS221_SENSOR_H, data);
> if (err < 0) {
> dev_err(hw->dev, "failed to set rh oversampling ratio\n");
> @@ -676,7 +666,7 @@ int hts221_probe(struct iio_dev *iio_dev)
> return err;
> }
>
> - data = hts221_avg_list[HTS221_SENSOR_T].avg_avl[3].avg;
> + data = hts221_avg_list[HTS221_SENSOR_T].avg_avl[3];
> err = hts221_update_avg(hw, HTS221_SENSOR_T, data);
> if (err < 0) {
> dev_err(hw->dev,
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 01/10] iio: humidity: hts221: refactor write_with_mask code
@ 2017-07-22 17:57 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 17:57 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi
On Mon, 17 Jul 2017 19:38:56 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> Move bit-shift in hts221_write_with_mask() instead of coding
> the shift depth in the configured value. That change will be necessary
> to fix an issue in device power-down procedure.
> Simplify hts221_avg_list table management
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Applied to the togreg branch of iio.git. Whilst this is
associated with a fix, the series to that point is really
too invasive to be material suitable for heading mainline
except during a merge window.
Pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/humidity/hts221.h | 6 ---
> drivers/iio/humidity/hts221_core.c | 94 +++++++++++++++++---------------------
> 2 files changed, 42 insertions(+), 58 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
> index 94510266e0a5..bf33d8f6396c 100644
> --- a/drivers/iio/humidity/hts221.h
> +++ b/drivers/iio/humidity/hts221.h
> @@ -30,12 +30,6 @@ struct hts221_transfer_function {
> int (*write)(struct device *dev, u8 addr, int len, u8 *data);
> };
>
> -#define HTS221_AVG_DEPTH 8
> -struct hts221_avg_avl {
> - u16 avg;
> - u8 val;
> -};
> -
> enum hts221_sensor_type {
> HTS221_SENSOR_H,
> HTS221_SENSOR_T,
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index a56da3999e00..d2f59626b040 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -32,30 +32,12 @@
> #define HTS221_HUMIDITY_AVG_MASK 0x07
> #define HTS221_TEMP_AVG_MASK 0x38
>
> -#define HTS221_ODR_MASK 0x87
> +#define HTS221_ODR_MASK 0x03
> #define HTS221_BDU_MASK BIT(2)
> +#define HTS221_ENABLE_MASK BIT(7)
>
> #define HTS221_DRDY_MASK BIT(2)
>
> -#define HTS221_ENABLE_SENSOR BIT(7)
> -
> -#define HTS221_HUMIDITY_AVG_4 0x00 /* 0.4 %RH */
> -#define HTS221_HUMIDITY_AVG_8 0x01 /* 0.3 %RH */
> -#define HTS221_HUMIDITY_AVG_16 0x02 /* 0.2 %RH */
> -#define HTS221_HUMIDITY_AVG_32 0x03 /* 0.15 %RH */
> -#define HTS221_HUMIDITY_AVG_64 0x04 /* 0.1 %RH */
> -#define HTS221_HUMIDITY_AVG_128 0x05 /* 0.07 %RH */
> -#define HTS221_HUMIDITY_AVG_256 0x06 /* 0.05 %RH */
> -#define HTS221_HUMIDITY_AVG_512 0x07 /* 0.03 %RH */
> -
> -#define HTS221_TEMP_AVG_2 0x00 /* 0.08 degC */
> -#define HTS221_TEMP_AVG_4 0x08 /* 0.05 degC */
> -#define HTS221_TEMP_AVG_8 0x10 /* 0.04 degC */
> -#define HTS221_TEMP_AVG_16 0x18 /* 0.03 degC */
> -#define HTS221_TEMP_AVG_32 0x20 /* 0.02 degC */
> -#define HTS221_TEMP_AVG_64 0x28 /* 0.015 degC */
> -#define HTS221_TEMP_AVG_128 0x30 /* 0.01 degC */
> -#define HTS221_TEMP_AVG_256 0x38 /* 0.007 degC */
>
> /* calibration registers */
> #define HTS221_REG_0RH_CAL_X_H 0x36
> @@ -73,10 +55,11 @@ struct hts221_odr {
> u8 val;
> };
>
> +#define HTS221_AVG_DEPTH 8
> struct hts221_avg {
> u8 addr;
> u8 mask;
> - struct hts221_avg_avl avg_avl[HTS221_AVG_DEPTH];
> + u16 avg_avl[HTS221_AVG_DEPTH];
> };
>
> static const struct hts221_odr hts221_odr_table[] = {
> @@ -90,28 +73,28 @@ static const struct hts221_avg hts221_avg_list[] = {
> .addr = HTS221_REG_AVG_ADDR,
> .mask = HTS221_HUMIDITY_AVG_MASK,
> .avg_avl = {
> - { 4, HTS221_HUMIDITY_AVG_4 },
> - { 8, HTS221_HUMIDITY_AVG_8 },
> - { 16, HTS221_HUMIDITY_AVG_16 },
> - { 32, HTS221_HUMIDITY_AVG_32 },
> - { 64, HTS221_HUMIDITY_AVG_64 },
> - { 128, HTS221_HUMIDITY_AVG_128 },
> - { 256, HTS221_HUMIDITY_AVG_256 },
> - { 512, HTS221_HUMIDITY_AVG_512 },
> + 4, /* 0.4 %RH */
> + 8, /* 0.3 %RH */
> + 16, /* 0.2 %RH */
> + 32, /* 0.15 %RH */
> + 64, /* 0.1 %RH */
> + 128, /* 0.07 %RH */
> + 256, /* 0.05 %RH */
> + 512, /* 0.03 %RH */
> },
> },
> {
> .addr = HTS221_REG_AVG_ADDR,
> .mask = HTS221_TEMP_AVG_MASK,
> .avg_avl = {
> - { 2, HTS221_TEMP_AVG_2 },
> - { 4, HTS221_TEMP_AVG_4 },
> - { 8, HTS221_TEMP_AVG_8 },
> - { 16, HTS221_TEMP_AVG_16 },
> - { 32, HTS221_TEMP_AVG_32 },
> - { 64, HTS221_TEMP_AVG_64 },
> - { 128, HTS221_TEMP_AVG_128 },
> - { 256, HTS221_TEMP_AVG_256 },
> + 2, /* 0.08 degC */
> + 4, /* 0.05 degC */
> + 8, /* 0.04 degC */
> + 16, /* 0.03 degC */
> + 32, /* 0.02 degC */
> + 64, /* 0.015 degC */
> + 128, /* 0.01 degC */
> + 256, /* 0.007 degC */
> },
> },
> };
> @@ -166,7 +149,7 @@ static int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask,
> goto unlock;
> }
>
> - data = (data & ~mask) | (val & mask);
> + data = (data & ~mask) | ((val << __ffs(mask)) & mask);
>
> err = hw->tf->write(hw->dev, addr, sizeof(data), &data);
> if (err < 0)
> @@ -201,11 +184,10 @@ static int hts221_check_whoami(struct hts221_hw *hw)
>
> int hts221_config_drdy(struct hts221_hw *hw, bool enable)
> {
> - u8 val = enable ? BIT(2) : 0;
> int err;
>
> err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR,
> - HTS221_DRDY_MASK, val);
> + HTS221_DRDY_MASK, enable);
>
> return err < 0 ? err : 0;
> }
> @@ -213,7 +195,6 @@ int hts221_config_drdy(struct hts221_hw *hw, bool enable)
> static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
> {
> int i, err;
> - u8 val;
>
> for (i = 0; i < ARRAY_SIZE(hts221_odr_table); i++)
> if (hts221_odr_table[i].hz == odr)
> @@ -222,9 +203,19 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
> if (i == ARRAY_SIZE(hts221_odr_table))
> return -EINVAL;
>
> - val = HTS221_ENABLE_SENSOR | HTS221_BDU_MASK | hts221_odr_table[i].val;
> + /* enable Block Data Update */
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_BDU_MASK, 1);
> + if (err < 0)
> + return err;
> +
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_ODR_MASK, hts221_odr_table[i].val);
> + if (err < 0)
> + return err;
> +
> err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> - HTS221_ODR_MASK, val);
> + HTS221_ENABLE_MASK, 1);
> if (err < 0)
> return err;
>
> @@ -241,14 +232,13 @@ static int hts221_update_avg(struct hts221_hw *hw,
> const struct hts221_avg *avg = &hts221_avg_list[type];
>
> for (i = 0; i < HTS221_AVG_DEPTH; i++)
> - if (avg->avg_avl[i].avg == val)
> + if (avg->avg_avl[i] == val)
> break;
>
> if (i == HTS221_AVG_DEPTH)
> return -EINVAL;
>
> - err = hts221_write_with_mask(hw, avg->addr, avg->mask,
> - avg->avg_avl[i].val);
> + err = hts221_write_with_mask(hw, avg->addr, avg->mask, i);
> if (err < 0)
> return err;
>
> @@ -283,7 +273,7 @@ hts221_sysfs_rh_oversampling_avail(struct device *dev,
>
> for (i = 0; i < ARRAY_SIZE(avg->avg_avl); i++)
> len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
> - avg->avg_avl[i].avg);
> + avg->avg_avl[i]);
> buf[len - 1] = '\n';
>
> return len;
> @@ -300,7 +290,7 @@ hts221_sysfs_temp_oversampling_avail(struct device *dev,
>
> for (i = 0; i < ARRAY_SIZE(avg->avg_avl); i++)
> len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
> - avg->avg_avl[i].avg);
> + avg->avg_avl[i]);
> buf[len - 1] = '\n';
>
> return len;
> @@ -534,13 +524,13 @@ static int hts221_read_raw(struct iio_dev *iio_dev,
> case IIO_HUMIDITYRELATIVE:
> avg = &hts221_avg_list[HTS221_SENSOR_H];
> idx = hw->sensors[HTS221_SENSOR_H].cur_avg_idx;
> - *val = avg->avg_avl[idx].avg;
> + *val = avg->avg_avl[idx];
> ret = IIO_VAL_INT;
> break;
> case IIO_TEMP:
> avg = &hts221_avg_list[HTS221_SENSOR_T];
> idx = hw->sensors[HTS221_SENSOR_T].cur_avg_idx;
> - *val = avg->avg_avl[idx].avg;
> + *val = avg->avg_avl[idx];
> ret = IIO_VAL_INT;
> break;
> default:
> @@ -661,7 +651,7 @@ int hts221_probe(struct iio_dev *iio_dev)
> return err;
> }
>
> - data = hts221_avg_list[HTS221_SENSOR_H].avg_avl[3].avg;
> + data = hts221_avg_list[HTS221_SENSOR_H].avg_avl[3];
> err = hts221_update_avg(hw, HTS221_SENSOR_H, data);
> if (err < 0) {
> dev_err(hw->dev, "failed to set rh oversampling ratio\n");
> @@ -676,7 +666,7 @@ int hts221_probe(struct iio_dev *iio_dev)
> return err;
> }
>
> - data = hts221_avg_list[HTS221_SENSOR_T].avg_avl[3].avg;
> + data = hts221_avg_list[HTS221_SENSOR_T].avg_avl[3];
> err = hts221_update_avg(hw, HTS221_SENSOR_T, data);
> if (err < 0) {
> dev_err(hw->dev,
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 02/10] iio: humidity: hts221: move BDU configuration in probe routine
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-22 17:58 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 17:58 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, 17 Jul 2017 19:38:57 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Enable Block Data Update in hts221_probe() in order to avoid to reconfigure
> it every time the sensor is enabled
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
Applied. Thanks,
Jonathan
> ---
> drivers/iio/humidity/hts221_core.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index d2f59626b040..47a29b2da1ce 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -203,12 +203,6 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
> if (i == ARRAY_SIZE(hts221_odr_table))
> return -EINVAL;
>
> - /* enable Block Data Update */
> - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> - HTS221_BDU_MASK, 1);
> - if (err < 0)
> - return err;
> -
> err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> HTS221_ODR_MASK, hts221_odr_table[i].val);
> if (err < 0)
> @@ -644,6 +638,12 @@ int hts221_probe(struct iio_dev *iio_dev)
> iio_dev->name = HTS221_DEV_NAME;
> iio_dev->info = &hts221_info;
>
> + /* enable Block Data Update */
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_BDU_MASK, 1);
> + if (err < 0)
> + return err;
> +
> /* configure humidity sensor */
> err = hts221_parse_rh_caldata(hw);
> if (err < 0) {
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 02/10] iio: humidity: hts221: move BDU configuration in probe routine
@ 2017-07-22 17:58 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 17:58 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi
On Mon, 17 Jul 2017 19:38:57 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> Enable Block Data Update in hts221_probe() in order to avoid to reconfigure
> it every time the sensor is enabled
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Applied. Thanks,
Jonathan
> ---
> drivers/iio/humidity/hts221_core.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index d2f59626b040..47a29b2da1ce 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -203,12 +203,6 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
> if (i == ARRAY_SIZE(hts221_odr_table))
> return -EINVAL;
>
> - /* enable Block Data Update */
> - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> - HTS221_BDU_MASK, 1);
> - if (err < 0)
> - return err;
> -
> err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> HTS221_ODR_MASK, hts221_odr_table[i].val);
> if (err < 0)
> @@ -644,6 +638,12 @@ int hts221_probe(struct iio_dev *iio_dev)
> iio_dev->name = HTS221_DEV_NAME;
> iio_dev->info = &hts221_info;
>
> + /* enable Block Data Update */
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_BDU_MASK, 1);
> + if (err < 0)
> + return err;
> +
> /* configure humidity sensor */
> err = hts221_parse_rh_caldata(hw);
> if (err < 0) {
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-22 18:02 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 18:02 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, 17 Jul 2017 19:38:58 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> GENMASK(6, 3) in CTRL_REG1 and GENMASK(6, 2) in CTRL_REG2 are marked
> reserved. Do not changed the original value (not declared in the
> datasheet) during power-down/suspend routines.
>
> Fixes: e4a70e3e7d84 (iio: humidity: add support to hts221 rh/temp device)
> Fixes: b7079eeac5da (iio: humidity: hts221: add power management support)
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
Applied to the togreg branch of iio.git and pushed out as testing.
If we want to do a backport of this it would be fine, but it needs
to require absolute minimal changes to the driver.
Jonathan
> ---
> drivers/iio/humidity/hts221_core.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index 47a29b2da1ce..6e5847386a45 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -305,11 +305,10 @@ int hts221_power_on(struct hts221_hw *hw)
>
> int hts221_power_off(struct hts221_hw *hw)
> {
> - __le16 data = 0;
> int err;
>
> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
> - (u8 *)&data);
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_ENABLE_MASK, false);
> if (err < 0)
> return err;
>
> @@ -692,11 +691,10 @@ static int __maybe_unused hts221_suspend(struct device *dev)
> {
> struct iio_dev *iio_dev = dev_get_drvdata(dev);
> struct hts221_hw *hw = iio_priv(iio_dev);
> - __le16 data = 0;
> int err;
>
> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
> - (u8 *)&data);
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_ENABLE_MASK, false);
>
> return err < 0 ? err : 0;
> }
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down
@ 2017-07-22 18:02 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 18:02 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi
On Mon, 17 Jul 2017 19:38:58 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> GENMASK(6, 3) in CTRL_REG1 and GENMASK(6, 2) in CTRL_REG2 are marked
> reserved. Do not changed the original value (not declared in the
> datasheet) during power-down/suspend routines.
>
> Fixes: e4a70e3e7d84 (iio: humidity: add support to hts221 rh/temp device)
> Fixes: b7079eeac5da (iio: humidity: hts221: add power management support)
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Applied to the togreg branch of iio.git and pushed out as testing.
If we want to do a backport of this it would be fine, but it needs
to require absolute minimal changes to the driver.
Jonathan
> ---
> drivers/iio/humidity/hts221_core.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index 47a29b2da1ce..6e5847386a45 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -305,11 +305,10 @@ int hts221_power_on(struct hts221_hw *hw)
>
> int hts221_power_off(struct hts221_hw *hw)
> {
> - __le16 data = 0;
> int err;
>
> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
> - (u8 *)&data);
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_ENABLE_MASK, false);
> if (err < 0)
> return err;
>
> @@ -692,11 +691,10 @@ static int __maybe_unused hts221_suspend(struct device *dev)
> {
> struct iio_dev *iio_dev = dev_get_drvdata(dev);
> struct hts221_hw *hw = iio_priv(iio_dev);
> - __le16 data = 0;
> int err;
>
> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
> - (u8 *)&data);
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_ENABLE_MASK, false);
>
> return err < 0 ? err : 0;
> }
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 04/10] iio: humidity: hts221: avoid useless ODR reconfiguration
2017-07-17 17:38 ` Lorenzo Bianconi
@ 2017-07-22 20:19 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 20:19 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, 17 Jul 2017 19:38:59 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Configure sensor ODR just in hts221_write_raw() in order to avoid
> to set device sample rate multiple times.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/humidity/hts221_core.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index 6e5847386a45..f99adc44139e 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -208,11 +208,6 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
> if (err < 0)
> return err;
>
> - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> - HTS221_ENABLE_MASK, 1);
> - if (err < 0)
> - return err;
> -
> hw->odr = odr;
>
> return 0;
> @@ -294,7 +289,8 @@ int hts221_power_on(struct hts221_hw *hw)
> {
> int err;
>
> - err = hts221_update_odr(hw, hw->odr);
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_ENABLE_MASK, true);
> if (err < 0)
> return err;
>
> @@ -627,8 +623,6 @@ int hts221_probe(struct iio_dev *iio_dev)
> if (err < 0)
> return err;
>
> - hw->odr = hts221_odr_table[0].hz;
> -
> iio_dev->modes = INDIO_DIRECT_MODE;
> iio_dev->dev.parent = hw->dev;
> iio_dev->available_scan_masks = hts221_scan_masks;
> @@ -643,6 +637,10 @@ int hts221_probe(struct iio_dev *iio_dev)
> if (err < 0)
> return err;
>
> + err = hts221_update_odr(hw, hts221_odr_table[0].hz);
> + if (err < 0)
> + return err;
> +
> /* configure humidity sensor */
> err = hts221_parse_rh_caldata(hw);
> if (err < 0) {
> @@ -706,7 +704,8 @@ static int __maybe_unused hts221_resume(struct device *dev)
> int err = 0;
>
> if (hw->enabled)
> - err = hts221_update_odr(hw, hw->odr);
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_ENABLE_MASK, true);
>
> return err;
> }
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 04/10] iio: humidity: hts221: avoid useless ODR reconfiguration
@ 2017-07-22 20:19 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 20:19 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi
On Mon, 17 Jul 2017 19:38:59 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> Configure sensor ODR just in hts221_write_raw() in order to avoid
> to set device sample rate multiple times.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/humidity/hts221_core.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index 6e5847386a45..f99adc44139e 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -208,11 +208,6 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
> if (err < 0)
> return err;
>
> - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> - HTS221_ENABLE_MASK, 1);
> - if (err < 0)
> - return err;
> -
> hw->odr = odr;
>
> return 0;
> @@ -294,7 +289,8 @@ int hts221_power_on(struct hts221_hw *hw)
> {
> int err;
>
> - err = hts221_update_odr(hw, hw->odr);
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_ENABLE_MASK, true);
> if (err < 0)
> return err;
>
> @@ -627,8 +623,6 @@ int hts221_probe(struct iio_dev *iio_dev)
> if (err < 0)
> return err;
>
> - hw->odr = hts221_odr_table[0].hz;
> -
> iio_dev->modes = INDIO_DIRECT_MODE;
> iio_dev->dev.parent = hw->dev;
> iio_dev->available_scan_masks = hts221_scan_masks;
> @@ -643,6 +637,10 @@ int hts221_probe(struct iio_dev *iio_dev)
> if (err < 0)
> return err;
>
> + err = hts221_update_odr(hw, hts221_odr_table[0].hz);
> + if (err < 0)
> + return err;
> +
> /* configure humidity sensor */
> err = hts221_parse_rh_caldata(hw);
> if (err < 0) {
> @@ -706,7 +704,8 @@ static int __maybe_unused hts221_resume(struct device *dev)
> int err = 0;
>
> if (hw->enabled)
> - err = hts221_update_odr(hw, hw->odr);
> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> + HTS221_ENABLE_MASK, true);
>
> return err;
> }
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 05/10] iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable
2017-07-17 17:39 ` Lorenzo Bianconi
@ 2017-07-22 20:21 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 20:21 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, 17 Jul 2017 19:39:00 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
Applied to the togreg branch of iio.git and pushed out
as testing for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/humidity/hts221.h | 3 +--
> drivers/iio/humidity/hts221_buffer.c | 4 ++--
> drivers/iio/humidity/hts221_core.c | 24 +++++-------------------
> 3 files changed, 8 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
> index bf33d8f6396c..69dfa5c63ec2 100644
> --- a/drivers/iio/humidity/hts221.h
> +++ b/drivers/iio/humidity/hts221.h
> @@ -62,8 +62,7 @@ extern const struct dev_pm_ops hts221_pm_ops;
>
> int hts221_config_drdy(struct hts221_hw *hw, bool enable);
> int hts221_probe(struct iio_dev *iio_dev);
> -int hts221_power_on(struct hts221_hw *hw);
> -int hts221_power_off(struct hts221_hw *hw);
> +int hts221_set_enable(struct hts221_hw *hw, bool enable);
> int hts221_allocate_buffers(struct hts221_hw *hw);
> int hts221_allocate_trigger(struct hts221_hw *hw);
>
> diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> index 7d19a3da7ab7..c4ed153ad397 100644
> --- a/drivers/iio/humidity/hts221_buffer.c
> +++ b/drivers/iio/humidity/hts221_buffer.c
> @@ -109,12 +109,12 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
>
> static int hts221_buffer_preenable(struct iio_dev *iio_dev)
> {
> - return hts221_power_on(iio_priv(iio_dev));
> + return hts221_set_enable(iio_priv(iio_dev), true);
> }
>
> static int hts221_buffer_postdisable(struct iio_dev *iio_dev)
> {
> - return hts221_power_off(iio_priv(iio_dev));
> + return hts221_set_enable(iio_priv(iio_dev), false);
> }
>
> static const struct iio_buffer_setup_ops hts221_buffer_ops = {
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index f99adc44139e..dc55d9fbc702 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -285,30 +285,16 @@ hts221_sysfs_temp_oversampling_avail(struct device *dev,
> return len;
> }
>
> -int hts221_power_on(struct hts221_hw *hw)
> +int hts221_set_enable(struct hts221_hw *hw, bool enable)
> {
> int err;
>
> err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> - HTS221_ENABLE_MASK, true);
> + HTS221_ENABLE_MASK, enable);
> if (err < 0)
> return err;
>
> - hw->enabled = true;
> -
> - return 0;
> -}
> -
> -int hts221_power_off(struct hts221_hw *hw)
> -{
> - int err;
> -
> - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> - HTS221_ENABLE_MASK, false);
> - if (err < 0)
> - return err;
> -
> - hw->enabled = false;
> + hw->enabled = enable;
>
> return 0;
> }
> @@ -463,7 +449,7 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
> u8 data[HTS221_DATA_SIZE];
> int err;
>
> - err = hts221_power_on(hw);
> + err = hts221_set_enable(hw, true);
> if (err < 0)
> return err;
>
> @@ -473,7 +459,7 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
> if (err < 0)
> return err;
>
> - hts221_power_off(hw);
> + hts221_set_enable(hw, false);
>
> *val = (s16)get_unaligned_le16(data);
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 05/10] iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable
@ 2017-07-22 20:21 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 20:21 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi
On Mon, 17 Jul 2017 19:39:00 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Applied to the togreg branch of iio.git and pushed out
as testing for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/humidity/hts221.h | 3 +--
> drivers/iio/humidity/hts221_buffer.c | 4 ++--
> drivers/iio/humidity/hts221_core.c | 24 +++++-------------------
> 3 files changed, 8 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
> index bf33d8f6396c..69dfa5c63ec2 100644
> --- a/drivers/iio/humidity/hts221.h
> +++ b/drivers/iio/humidity/hts221.h
> @@ -62,8 +62,7 @@ extern const struct dev_pm_ops hts221_pm_ops;
>
> int hts221_config_drdy(struct hts221_hw *hw, bool enable);
> int hts221_probe(struct iio_dev *iio_dev);
> -int hts221_power_on(struct hts221_hw *hw);
> -int hts221_power_off(struct hts221_hw *hw);
> +int hts221_set_enable(struct hts221_hw *hw, bool enable);
> int hts221_allocate_buffers(struct hts221_hw *hw);
> int hts221_allocate_trigger(struct hts221_hw *hw);
>
> diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> index 7d19a3da7ab7..c4ed153ad397 100644
> --- a/drivers/iio/humidity/hts221_buffer.c
> +++ b/drivers/iio/humidity/hts221_buffer.c
> @@ -109,12 +109,12 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
>
> static int hts221_buffer_preenable(struct iio_dev *iio_dev)
> {
> - return hts221_power_on(iio_priv(iio_dev));
> + return hts221_set_enable(iio_priv(iio_dev), true);
> }
>
> static int hts221_buffer_postdisable(struct iio_dev *iio_dev)
> {
> - return hts221_power_off(iio_priv(iio_dev));
> + return hts221_set_enable(iio_priv(iio_dev), false);
> }
>
> static const struct iio_buffer_setup_ops hts221_buffer_ops = {
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index f99adc44139e..dc55d9fbc702 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -285,30 +285,16 @@ hts221_sysfs_temp_oversampling_avail(struct device *dev,
> return len;
> }
>
> -int hts221_power_on(struct hts221_hw *hw)
> +int hts221_set_enable(struct hts221_hw *hw, bool enable)
> {
> int err;
>
> err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> - HTS221_ENABLE_MASK, true);
> + HTS221_ENABLE_MASK, enable);
> if (err < 0)
> return err;
>
> - hw->enabled = true;
> -
> - return 0;
> -}
> -
> -int hts221_power_off(struct hts221_hw *hw)
> -{
> - int err;
> -
> - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> - HTS221_ENABLE_MASK, false);
> - if (err < 0)
> - return err;
> -
> - hw->enabled = false;
> + hw->enabled = enable;
>
> return 0;
> }
> @@ -463,7 +449,7 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
> u8 data[HTS221_DATA_SIZE];
> int err;
>
> - err = hts221_power_on(hw);
> + err = hts221_set_enable(hw, true);
> if (err < 0)
> return err;
>
> @@ -473,7 +459,7 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
> if (err < 0)
> return err;
>
> - hts221_power_off(hw);
> + hts221_set_enable(hw, false);
>
> *val = (s16)get_unaligned_le16(data);
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 06/10] iio: humidity: hts221: support active-low interrupts
2017-07-17 17:39 ` Lorenzo Bianconi
@ 2017-07-22 20:22 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 20:22 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, 17 Jul 2017 19:39:01 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Add support for active low interrupts (IRQF_TRIGGER_LOW and
> IRQF_TRIGGER_FALLING). Configure the device as active high or low
> according to the requested irq line.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
Applied
> ---
> drivers/iio/humidity/hts221.h | 1 +
> drivers/iio/humidity/hts221_buffer.c | 11 +++++++++++
> drivers/iio/humidity/hts221_core.c | 3 +--
> 3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
> index 69dfa5c63ec2..c3de6e494f8c 100644
> --- a/drivers/iio/humidity/hts221.h
> +++ b/drivers/iio/humidity/hts221.h
> @@ -61,6 +61,7 @@ struct hts221_hw {
> extern const struct dev_pm_ops hts221_pm_ops;
>
> int hts221_config_drdy(struct hts221_hw *hw, bool enable);
> +int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val);
> int hts221_probe(struct iio_dev *iio_dev);
> int hts221_set_enable(struct hts221_hw *hw, bool enable);
> int hts221_allocate_buffers(struct hts221_hw *hw);
> diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> index c4ed153ad397..ad5222295b2c 100644
> --- a/drivers/iio/humidity/hts221_buffer.c
> +++ b/drivers/iio/humidity/hts221_buffer.c
> @@ -22,6 +22,8 @@
>
> #include "hts221.h"
>
> +#define HTS221_REG_DRDY_HL_ADDR 0x22
> +#define HTS221_REG_DRDY_HL_MASK BIT(7)
> #define HTS221_REG_STATUS_ADDR 0x27
> #define HTS221_RH_DRDY_MASK BIT(1)
> #define HTS221_TEMP_DRDY_MASK BIT(0)
> @@ -67,6 +69,7 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
> int hts221_allocate_trigger(struct hts221_hw *hw)
> {
> struct iio_dev *iio_dev = iio_priv_to_dev(hw);
> + bool irq_active_low = false;
> unsigned long irq_type;
> int err;
>
> @@ -76,6 +79,10 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
> case IRQF_TRIGGER_HIGH:
> case IRQF_TRIGGER_RISING:
> break;
> + case IRQF_TRIGGER_LOW:
> + case IRQF_TRIGGER_FALLING:
> + irq_active_low = true;
> + break;
> default:
> dev_info(hw->dev,
> "mode %lx unsupported, using IRQF_TRIGGER_RISING\n",
> @@ -84,6 +91,10 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
> break;
> }
>
> + err = hts221_write_with_mask(hw, HTS221_REG_DRDY_HL_ADDR,
> + HTS221_REG_DRDY_HL_MASK, irq_active_low);
> + if (err < 0)
> + return err;
> err = devm_request_threaded_irq(hw->dev, hw->irq, NULL,
> hts221_trigger_handler_thread,
> irq_type | IRQF_ONESHOT,
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index dc55d9fbc702..25fcb9993998 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -135,8 +135,7 @@ static const struct iio_chan_spec hts221_channels[] = {
> IIO_CHAN_SOFT_TIMESTAMP(2),
> };
>
> -static int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask,
> - u8 val)
> +int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val)
> {
> u8 data;
> int err;
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 06/10] iio: humidity: hts221: support active-low interrupts
@ 2017-07-22 20:22 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 20:22 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi
On Mon, 17 Jul 2017 19:39:01 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> Add support for active low interrupts (IRQF_TRIGGER_LOW and
> IRQF_TRIGGER_FALLING). Configure the device as active high or low
> according to the requested irq line.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Applied
> ---
> drivers/iio/humidity/hts221.h | 1 +
> drivers/iio/humidity/hts221_buffer.c | 11 +++++++++++
> drivers/iio/humidity/hts221_core.c | 3 +--
> 3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
> index 69dfa5c63ec2..c3de6e494f8c 100644
> --- a/drivers/iio/humidity/hts221.h
> +++ b/drivers/iio/humidity/hts221.h
> @@ -61,6 +61,7 @@ struct hts221_hw {
> extern const struct dev_pm_ops hts221_pm_ops;
>
> int hts221_config_drdy(struct hts221_hw *hw, bool enable);
> +int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val);
> int hts221_probe(struct iio_dev *iio_dev);
> int hts221_set_enable(struct hts221_hw *hw, bool enable);
> int hts221_allocate_buffers(struct hts221_hw *hw);
> diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> index c4ed153ad397..ad5222295b2c 100644
> --- a/drivers/iio/humidity/hts221_buffer.c
> +++ b/drivers/iio/humidity/hts221_buffer.c
> @@ -22,6 +22,8 @@
>
> #include "hts221.h"
>
> +#define HTS221_REG_DRDY_HL_ADDR 0x22
> +#define HTS221_REG_DRDY_HL_MASK BIT(7)
> #define HTS221_REG_STATUS_ADDR 0x27
> #define HTS221_RH_DRDY_MASK BIT(1)
> #define HTS221_TEMP_DRDY_MASK BIT(0)
> @@ -67,6 +69,7 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
> int hts221_allocate_trigger(struct hts221_hw *hw)
> {
> struct iio_dev *iio_dev = iio_priv_to_dev(hw);
> + bool irq_active_low = false;
> unsigned long irq_type;
> int err;
>
> @@ -76,6 +79,10 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
> case IRQF_TRIGGER_HIGH:
> case IRQF_TRIGGER_RISING:
> break;
> + case IRQF_TRIGGER_LOW:
> + case IRQF_TRIGGER_FALLING:
> + irq_active_low = true;
> + break;
> default:
> dev_info(hw->dev,
> "mode %lx unsupported, using IRQF_TRIGGER_RISING\n",
> @@ -84,6 +91,10 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
> break;
> }
>
> + err = hts221_write_with_mask(hw, HTS221_REG_DRDY_HL_ADDR,
> + HTS221_REG_DRDY_HL_MASK, irq_active_low);
> + if (err < 0)
> + return err;
> err = devm_request_threaded_irq(hw->dev, hw->irq, NULL,
> hts221_trigger_handler_thread,
> irq_type | IRQF_ONESHOT,
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index dc55d9fbc702..25fcb9993998 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -135,8 +135,7 @@ static const struct iio_chan_spec hts221_channels[] = {
> IIO_CHAN_SOFT_TIMESTAMP(2),
> };
>
> -static int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask,
> - u8 val)
> +int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val)
> {
> u8 data;
> int err;
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 07/10] dt-bindings: iio: humidity: hts221: support active-low interrupts
2017-07-17 17:39 ` Lorenzo Bianconi
@ 2017-07-22 20:23 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 20:23 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, 17 Jul 2017 19:39:02 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Update hts221 device binding with active-low interrupts support
> (IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_EDGE_FALLING).
>
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.
thanks,
Jonathan
> ---
> Documentation/devicetree/bindings/iio/humidity/hts221.txt | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/humidity/hts221.txt b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
> index b20ab9c12080..fca263e13400 100644
> --- a/Documentation/devicetree/bindings/iio/humidity/hts221.txt
> +++ b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
> @@ -7,7 +7,8 @@ Required properties:
> Optional properties:
> - interrupt-parent: should be the phandle for the interrupt controller
> - interrupts: interrupt mapping for IRQ. It should be configured with
> - flags IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_EDGE_RISING.
> + flags IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_EDGE_RISING, IRQ_TYPE_LEVEL_LOW or
> + IRQ_TYPE_EDGE_FALLING.
>
> Refer to interrupt-controller/interrupts.txt for generic interrupt
> client node bindings.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 07/10] dt-bindings: iio: humidity: hts221: support active-low interrupts
@ 2017-07-22 20:23 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 20:23 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi
On Mon, 17 Jul 2017 19:39:02 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> Update hts221 device binding with active-low interrupts support
> (IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_EDGE_FALLING).
>
> Acked-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.
thanks,
Jonathan
> ---
> Documentation/devicetree/bindings/iio/humidity/hts221.txt | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/humidity/hts221.txt b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
> index b20ab9c12080..fca263e13400 100644
> --- a/Documentation/devicetree/bindings/iio/humidity/hts221.txt
> +++ b/Documentation/devicetree/bindings/iio/humidity/hts221.txt
> @@ -7,7 +7,8 @@ Required properties:
> Optional properties:
> - interrupt-parent: should be the phandle for the interrupt controller
> - interrupts: interrupt mapping for IRQ. It should be configured with
> - flags IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_EDGE_RISING.
> + flags IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_EDGE_RISING, IRQ_TYPE_LEVEL_LOW or
> + IRQ_TYPE_EDGE_FALLING.
>
> Refer to interrupt-controller/interrupts.txt for generic interrupt
> client node bindings.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 08/10] iio: humidity: hts221: support open drain mode
2017-07-17 17:39 ` Lorenzo Bianconi
@ 2017-07-22 20:25 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 20:25 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, 17 Jul 2017 19:39:03 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Add open drain support in order to share requested IRQ line between
> hts221 device and other peripherals
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
I'm going to hold off on the rest of this series to give Rob
time to take another look at the bindings documentation and
confirm he is happy with the changes.
Give me a poke if I seem to have forgotten them!
Jonathan
> ---
> drivers/iio/humidity/hts221_buffer.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> index ad5222295b2c..f29f01a22375 100644
> --- a/drivers/iio/humidity/hts221_buffer.c
> +++ b/drivers/iio/humidity/hts221_buffer.c
> @@ -20,10 +20,14 @@
> #include <linux/iio/triggered_buffer.h>
> #include <linux/iio/buffer.h>
>
> +#include <linux/platform_data/st_sensors_pdata.h>
> +
> #include "hts221.h"
>
> #define HTS221_REG_DRDY_HL_ADDR 0x22
> #define HTS221_REG_DRDY_HL_MASK BIT(7)
> +#define HTS221_REG_DRDY_PP_OD_ADDR 0x22
> +#define HTS221_REG_DRDY_PP_OD_MASK BIT(6)
> #define HTS221_REG_STATUS_ADDR 0x27
> #define HTS221_RH_DRDY_MASK BIT(1)
> #define HTS221_TEMP_DRDY_MASK BIT(0)
> @@ -69,7 +73,9 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
> int hts221_allocate_trigger(struct hts221_hw *hw)
> {
> struct iio_dev *iio_dev = iio_priv_to_dev(hw);
> - bool irq_active_low = false;
> + bool irq_active_low = false, open_drain = false;
> + struct device_node *np = hw->dev->of_node;
> + struct st_sensors_platform_data *pdata;
> unsigned long irq_type;
> int err;
>
> @@ -95,6 +101,20 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
> HTS221_REG_DRDY_HL_MASK, irq_active_low);
> if (err < 0)
> return err;
> +
> + pdata = (struct st_sensors_platform_data *)hw->dev->platform_data;
> + if ((np && of_property_read_bool(np, "drive-open-drain")) ||
> + (pdata && pdata->open_drain)) {
> + irq_type |= IRQF_SHARED;
> + open_drain = true;
> + }
> +
> + err = hts221_write_with_mask(hw, HTS221_REG_DRDY_PP_OD_ADDR,
> + HTS221_REG_DRDY_PP_OD_MASK,
> + open_drain);
> + if (err < 0)
> + return err;
> +
> err = devm_request_threaded_irq(hw->dev, hw->irq, NULL,
> hts221_trigger_handler_thread,
> irq_type | IRQF_ONESHOT,
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 08/10] iio: humidity: hts221: support open drain mode
@ 2017-07-22 20:25 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-22 20:25 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi
On Mon, 17 Jul 2017 19:39:03 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> Add open drain support in order to share requested IRQ line between
> hts221 device and other peripherals
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
I'm going to hold off on the rest of this series to give Rob
time to take another look at the bindings documentation and
confirm he is happy with the changes.
Give me a poke if I seem to have forgotten them!
Jonathan
> ---
> drivers/iio/humidity/hts221_buffer.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> index ad5222295b2c..f29f01a22375 100644
> --- a/drivers/iio/humidity/hts221_buffer.c
> +++ b/drivers/iio/humidity/hts221_buffer.c
> @@ -20,10 +20,14 @@
> #include <linux/iio/triggered_buffer.h>
> #include <linux/iio/buffer.h>
>
> +#include <linux/platform_data/st_sensors_pdata.h>
> +
> #include "hts221.h"
>
> #define HTS221_REG_DRDY_HL_ADDR 0x22
> #define HTS221_REG_DRDY_HL_MASK BIT(7)
> +#define HTS221_REG_DRDY_PP_OD_ADDR 0x22
> +#define HTS221_REG_DRDY_PP_OD_MASK BIT(6)
> #define HTS221_REG_STATUS_ADDR 0x27
> #define HTS221_RH_DRDY_MASK BIT(1)
> #define HTS221_TEMP_DRDY_MASK BIT(0)
> @@ -69,7 +73,9 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
> int hts221_allocate_trigger(struct hts221_hw *hw)
> {
> struct iio_dev *iio_dev = iio_priv_to_dev(hw);
> - bool irq_active_low = false;
> + bool irq_active_low = false, open_drain = false;
> + struct device_node *np = hw->dev->of_node;
> + struct st_sensors_platform_data *pdata;
> unsigned long irq_type;
> int err;
>
> @@ -95,6 +101,20 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
> HTS221_REG_DRDY_HL_MASK, irq_active_low);
> if (err < 0)
> return err;
> +
> + pdata = (struct st_sensors_platform_data *)hw->dev->platform_data;
> + if ((np && of_property_read_bool(np, "drive-open-drain")) ||
> + (pdata && pdata->open_drain)) {
> + irq_type |= IRQF_SHARED;
> + open_drain = true;
> + }
> +
> + err = hts221_write_with_mask(hw, HTS221_REG_DRDY_PP_OD_ADDR,
> + HTS221_REG_DRDY_PP_OD_MASK,
> + open_drain);
> + if (err < 0)
> + return err;
> +
> err = devm_request_threaded_irq(hw->dev, hw->irq, NULL,
> hts221_trigger_handler_thread,
> irq_type | IRQF_ONESHOT,
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 09/10] dt-bindings: iio: humidity: hts221: support open drain mode
2017-07-17 17:39 ` Lorenzo Bianconi
@ 2017-07-24 17:48 ` Rob Herring
-1 siblings, 0 replies; 49+ messages in thread
From: Rob Herring @ 2017-07-24 17:48 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: jic23-DgEjT+Ai2ygdnm+yROfE0A, linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, Jul 17, 2017 at 07:39:04PM +0200, Lorenzo Bianconi wrote:
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
> ---
> Documentation/devicetree/bindings/iio/humidity/hts221.txt | 8 ++++++++
> 1 file changed, 8 insertions(+)
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 09/10] dt-bindings: iio: humidity: hts221: support open drain mode
@ 2017-07-24 17:48 ` Rob Herring
0 siblings, 0 replies; 49+ messages in thread
From: Rob Herring @ 2017-07-24 17:48 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: jic23, linux-iio, devicetree, lorenzo.bianconi
On Mon, Jul 17, 2017 at 07:39:04PM +0200, Lorenzo Bianconi wrote:
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
> ---
> Documentation/devicetree/bindings/iio/humidity/hts221.txt | 8 ++++++++
> 1 file changed, 8 insertions(+)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 08/10] iio: humidity: hts221: support open drain mode
2017-07-22 20:25 ` Jonathan Cameron
@ 2017-07-25 19:01 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-25 19:01 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Sat, 22 Jul 2017 21:25:24 +0100
Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Mon, 17 Jul 2017 19:39:03 +0200
> Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Add open drain support in order to share requested IRQ line between
> > hts221 device and other peripherals
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
> I'm going to hold off on the rest of this series to give Rob
> time to take another look at the bindings documentation and
> confirm he is happy with the changes.
>
> Give me a poke if I seem to have forgotten them!
Applied to the togreg branch of iio.git.
Thanks,
Jonathan
>
> Jonathan
> > ---
> > drivers/iio/humidity/hts221_buffer.c | 22 +++++++++++++++++++++-
> > 1 file changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> > index ad5222295b2c..f29f01a22375 100644
> > --- a/drivers/iio/humidity/hts221_buffer.c
> > +++ b/drivers/iio/humidity/hts221_buffer.c
> > @@ -20,10 +20,14 @@
> > #include <linux/iio/triggered_buffer.h>
> > #include <linux/iio/buffer.h>
> >
> > +#include <linux/platform_data/st_sensors_pdata.h>
> > +
> > #include "hts221.h"
> >
> > #define HTS221_REG_DRDY_HL_ADDR 0x22
> > #define HTS221_REG_DRDY_HL_MASK BIT(7)
> > +#define HTS221_REG_DRDY_PP_OD_ADDR 0x22
> > +#define HTS221_REG_DRDY_PP_OD_MASK BIT(6)
> > #define HTS221_REG_STATUS_ADDR 0x27
> > #define HTS221_RH_DRDY_MASK BIT(1)
> > #define HTS221_TEMP_DRDY_MASK BIT(0)
> > @@ -69,7 +73,9 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
> > int hts221_allocate_trigger(struct hts221_hw *hw)
> > {
> > struct iio_dev *iio_dev = iio_priv_to_dev(hw);
> > - bool irq_active_low = false;
> > + bool irq_active_low = false, open_drain = false;
> > + struct device_node *np = hw->dev->of_node;
> > + struct st_sensors_platform_data *pdata;
> > unsigned long irq_type;
> > int err;
> >
> > @@ -95,6 +101,20 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
> > HTS221_REG_DRDY_HL_MASK, irq_active_low);
> > if (err < 0)
> > return err;
> > +
> > + pdata = (struct st_sensors_platform_data *)hw->dev->platform_data;
> > + if ((np && of_property_read_bool(np, "drive-open-drain")) ||
> > + (pdata && pdata->open_drain)) {
> > + irq_type |= IRQF_SHARED;
> > + open_drain = true;
> > + }
> > +
> > + err = hts221_write_with_mask(hw, HTS221_REG_DRDY_PP_OD_ADDR,
> > + HTS221_REG_DRDY_PP_OD_MASK,
> > + open_drain);
> > + if (err < 0)
> > + return err;
> > +
> > err = devm_request_threaded_irq(hw->dev, hw->irq, NULL,
> > hts221_trigger_handler_thread,
> > irq_type | IRQF_ONESHOT,
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 08/10] iio: humidity: hts221: support open drain mode
@ 2017-07-25 19:01 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-25 19:01 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi
On Sat, 22 Jul 2017 21:25:24 +0100
Jonathan Cameron <jic23@kernel.org> wrote:
> On Mon, 17 Jul 2017 19:39:03 +0200
> Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
>
> > Add open drain support in order to share requested IRQ line between
> > hts221 device and other peripherals
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
> I'm going to hold off on the rest of this series to give Rob
> time to take another look at the bindings documentation and
> confirm he is happy with the changes.
>
> Give me a poke if I seem to have forgotten them!
Applied to the togreg branch of iio.git.
Thanks,
Jonathan
>
> Jonathan
> > ---
> > drivers/iio/humidity/hts221_buffer.c | 22 +++++++++++++++++++++-
> > 1 file changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> > index ad5222295b2c..f29f01a22375 100644
> > --- a/drivers/iio/humidity/hts221_buffer.c
> > +++ b/drivers/iio/humidity/hts221_buffer.c
> > @@ -20,10 +20,14 @@
> > #include <linux/iio/triggered_buffer.h>
> > #include <linux/iio/buffer.h>
> >
> > +#include <linux/platform_data/st_sensors_pdata.h>
> > +
> > #include "hts221.h"
> >
> > #define HTS221_REG_DRDY_HL_ADDR 0x22
> > #define HTS221_REG_DRDY_HL_MASK BIT(7)
> > +#define HTS221_REG_DRDY_PP_OD_ADDR 0x22
> > +#define HTS221_REG_DRDY_PP_OD_MASK BIT(6)
> > #define HTS221_REG_STATUS_ADDR 0x27
> > #define HTS221_RH_DRDY_MASK BIT(1)
> > #define HTS221_TEMP_DRDY_MASK BIT(0)
> > @@ -69,7 +73,9 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
> > int hts221_allocate_trigger(struct hts221_hw *hw)
> > {
> > struct iio_dev *iio_dev = iio_priv_to_dev(hw);
> > - bool irq_active_low = false;
> > + bool irq_active_low = false, open_drain = false;
> > + struct device_node *np = hw->dev->of_node;
> > + struct st_sensors_platform_data *pdata;
> > unsigned long irq_type;
> > int err;
> >
> > @@ -95,6 +101,20 @@ int hts221_allocate_trigger(struct hts221_hw *hw)
> > HTS221_REG_DRDY_HL_MASK, irq_active_low);
> > if (err < 0)
> > return err;
> > +
> > + pdata = (struct st_sensors_platform_data *)hw->dev->platform_data;
> > + if ((np && of_property_read_bool(np, "drive-open-drain")) ||
> > + (pdata && pdata->open_drain)) {
> > + irq_type |= IRQF_SHARED;
> > + open_drain = true;
> > + }
> > +
> > + err = hts221_write_with_mask(hw, HTS221_REG_DRDY_PP_OD_ADDR,
> > + HTS221_REG_DRDY_PP_OD_MASK,
> > + open_drain);
> > + if (err < 0)
> > + return err;
> > +
> > err = devm_request_threaded_irq(hw->dev, hw->irq, NULL,
> > hts221_trigger_handler_thread,
> > irq_type | IRQF_ONESHOT,
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 09/10] dt-bindings: iio: humidity: hts221: support open drain mode
2017-07-24 17:48 ` Rob Herring
@ 2017-07-25 19:02 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-25 19:02 UTC (permalink / raw)
To: Rob Herring
Cc: Lorenzo Bianconi, linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, 24 Jul 2017 12:48:16 -0500
Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Mon, Jul 17, 2017 at 07:39:04PM +0200, Lorenzo Bianconi wrote:
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
> > ---
> > Documentation/devicetree/bindings/iio/humidity/hts221.txt | 8 ++++++++
> > 1 file changed, 8 insertions(+)
>
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Applied to the togreg branch of iio.git and pushed out as testing
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 09/10] dt-bindings: iio: humidity: hts221: support open drain mode
@ 2017-07-25 19:02 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-25 19:02 UTC (permalink / raw)
To: Rob Herring; +Cc: Lorenzo Bianconi, linux-iio, devicetree, lorenzo.bianconi
On Mon, 24 Jul 2017 12:48:16 -0500
Rob Herring <robh@kernel.org> wrote:
> On Mon, Jul 17, 2017 at 07:39:04PM +0200, Lorenzo Bianconi wrote:
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
> > ---
> > Documentation/devicetree/bindings/iio/humidity/hts221.txt | 8 ++++++++
> > 1 file changed, 8 insertions(+)
>
> Acked-by: Rob Herring <robh@kernel.org>
Applied to the togreg branch of iio.git and pushed out as testing
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 10/10] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state()
2017-07-17 17:39 ` Lorenzo Bianconi
@ 2017-07-25 19:03 ` Jonathan Cameron
-1 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-25 19:03 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o
On Mon, 17 Jul 2017 19:39:05 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Move data-ready configuration in hts221_buffer.c since it is only related
> to trigger logic
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks
Jonathan
> ---
> drivers/iio/humidity/hts221.h | 1 -
> drivers/iio/humidity/hts221_buffer.c | 8 +++++++-
> drivers/iio/humidity/hts221_core.c | 14 --------------
> 3 files changed, 7 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
> index c3de6e494f8c..51d021966222 100644
> --- a/drivers/iio/humidity/hts221.h
> +++ b/drivers/iio/humidity/hts221.h
> @@ -60,7 +60,6 @@ struct hts221_hw {
>
> extern const struct dev_pm_ops hts221_pm_ops;
>
> -int hts221_config_drdy(struct hts221_hw *hw, bool enable);
> int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val);
> int hts221_probe(struct iio_dev *iio_dev);
> int hts221_set_enable(struct hts221_hw *hw, bool enable);
> diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> index f29f01a22375..9690dfe9a844 100644
> --- a/drivers/iio/humidity/hts221_buffer.c
> +++ b/drivers/iio/humidity/hts221_buffer.c
> @@ -28,6 +28,8 @@
> #define HTS221_REG_DRDY_HL_MASK BIT(7)
> #define HTS221_REG_DRDY_PP_OD_ADDR 0x22
> #define HTS221_REG_DRDY_PP_OD_MASK BIT(6)
> +#define HTS221_REG_DRDY_EN_ADDR 0x22
> +#define HTS221_REG_DRDY_EN_MASK BIT(2)
> #define HTS221_REG_STATUS_ADDR 0x27
> #define HTS221_RH_DRDY_MASK BIT(1)
> #define HTS221_TEMP_DRDY_MASK BIT(0)
> @@ -36,8 +38,12 @@ static int hts221_trig_set_state(struct iio_trigger *trig, bool state)
> {
> struct iio_dev *iio_dev = iio_trigger_get_drvdata(trig);
> struct hts221_hw *hw = iio_priv(iio_dev);
> + int err;
> +
> + err = hts221_write_with_mask(hw, HTS221_REG_DRDY_EN_ADDR,
> + HTS221_REG_DRDY_EN_MASK, state);
>
> - return hts221_config_drdy(hw, state);
> + return err < 0 ? err : 0;
> }
>
> static const struct iio_trigger_ops hts221_trigger_ops = {
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index 25fcb9993998..32524a8dc66f 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -23,7 +23,6 @@
>
> #define HTS221_REG_CNTRL1_ADDR 0x20
> #define HTS221_REG_CNTRL2_ADDR 0x21
> -#define HTS221_REG_CNTRL3_ADDR 0x22
>
> #define HTS221_REG_AVG_ADDR 0x10
> #define HTS221_REG_H_OUT_L 0x28
> @@ -36,9 +35,6 @@
> #define HTS221_BDU_MASK BIT(2)
> #define HTS221_ENABLE_MASK BIT(7)
>
> -#define HTS221_DRDY_MASK BIT(2)
> -
> -
> /* calibration registers */
> #define HTS221_REG_0RH_CAL_X_H 0x36
> #define HTS221_REG_1RH_CAL_X_H 0x3a
> @@ -181,16 +177,6 @@ static int hts221_check_whoami(struct hts221_hw *hw)
> return 0;
> }
>
> -int hts221_config_drdy(struct hts221_hw *hw, bool enable)
> -{
> - int err;
> -
> - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR,
> - HTS221_DRDY_MASK, enable);
> -
> - return err < 0 ? err : 0;
> -}
> -
> static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
> {
> int i, err;
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 10/10] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state()
@ 2017-07-25 19:03 ` Jonathan Cameron
0 siblings, 0 replies; 49+ messages in thread
From: Jonathan Cameron @ 2017-07-25 19:03 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi
On Mon, 17 Jul 2017 19:39:05 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> Move data-ready configuration in hts221_buffer.c since it is only related
> to trigger logic
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks
Jonathan
> ---
> drivers/iio/humidity/hts221.h | 1 -
> drivers/iio/humidity/hts221_buffer.c | 8 +++++++-
> drivers/iio/humidity/hts221_core.c | 14 --------------
> 3 files changed, 7 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
> index c3de6e494f8c..51d021966222 100644
> --- a/drivers/iio/humidity/hts221.h
> +++ b/drivers/iio/humidity/hts221.h
> @@ -60,7 +60,6 @@ struct hts221_hw {
>
> extern const struct dev_pm_ops hts221_pm_ops;
>
> -int hts221_config_drdy(struct hts221_hw *hw, bool enable);
> int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val);
> int hts221_probe(struct iio_dev *iio_dev);
> int hts221_set_enable(struct hts221_hw *hw, bool enable);
> diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> index f29f01a22375..9690dfe9a844 100644
> --- a/drivers/iio/humidity/hts221_buffer.c
> +++ b/drivers/iio/humidity/hts221_buffer.c
> @@ -28,6 +28,8 @@
> #define HTS221_REG_DRDY_HL_MASK BIT(7)
> #define HTS221_REG_DRDY_PP_OD_ADDR 0x22
> #define HTS221_REG_DRDY_PP_OD_MASK BIT(6)
> +#define HTS221_REG_DRDY_EN_ADDR 0x22
> +#define HTS221_REG_DRDY_EN_MASK BIT(2)
> #define HTS221_REG_STATUS_ADDR 0x27
> #define HTS221_RH_DRDY_MASK BIT(1)
> #define HTS221_TEMP_DRDY_MASK BIT(0)
> @@ -36,8 +38,12 @@ static int hts221_trig_set_state(struct iio_trigger *trig, bool state)
> {
> struct iio_dev *iio_dev = iio_trigger_get_drvdata(trig);
> struct hts221_hw *hw = iio_priv(iio_dev);
> + int err;
> +
> + err = hts221_write_with_mask(hw, HTS221_REG_DRDY_EN_ADDR,
> + HTS221_REG_DRDY_EN_MASK, state);
>
> - return hts221_config_drdy(hw, state);
> + return err < 0 ? err : 0;
> }
>
> static const struct iio_trigger_ops hts221_trigger_ops = {
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index 25fcb9993998..32524a8dc66f 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -23,7 +23,6 @@
>
> #define HTS221_REG_CNTRL1_ADDR 0x20
> #define HTS221_REG_CNTRL2_ADDR 0x21
> -#define HTS221_REG_CNTRL3_ADDR 0x22
>
> #define HTS221_REG_AVG_ADDR 0x10
> #define HTS221_REG_H_OUT_L 0x28
> @@ -36,9 +35,6 @@
> #define HTS221_BDU_MASK BIT(2)
> #define HTS221_ENABLE_MASK BIT(7)
>
> -#define HTS221_DRDY_MASK BIT(2)
> -
> -
> /* calibration registers */
> #define HTS221_REG_0RH_CAL_X_H 0x36
> #define HTS221_REG_1RH_CAL_X_H 0x3a
> @@ -181,16 +177,6 @@ static int hts221_check_whoami(struct hts221_hw *hw)
> return 0;
> }
>
> -int hts221_config_drdy(struct hts221_hw *hw, bool enable)
> -{
> - int err;
> -
> - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR,
> - HTS221_DRDY_MASK, enable);
> -
> - return err < 0 ? err : 0;
> -}
> -
> static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
> {
> int i, err;
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down
2017-07-22 18:02 ` Jonathan Cameron
(?)
@ 2017-08-11 19:54 ` Lorenzo Bianconi
2017-08-12 11:07 ` Jonathan Cameron
-1 siblings, 1 reply; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-08-11 19:54 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio
> On Mon, 17 Jul 2017 19:38:58 +0200
> Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
>
>> GENMASK(6, 3) in CTRL_REG1 and GENMASK(6, 2) in CTRL_REG2 are marked
>> reserved. Do not changed the original value (not declared in the
>> datasheet) during power-down/suspend routines.
>>
>> Fixes: e4a70e3e7d84 (iio: humidity: add support to hts221 rh/temp device)
>> Fixes: b7079eeac5da (iio: humidity: hts221: add power management support)
>> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
> Applied to the togreg branch of iio.git and pushed out as testing.
>
> If we want to do a backport of this it would be fine, but it needs
> to require absolute minimal changes to the driver.
>
I think we need to push write_with_mask patch as well in order to fix
that issue. What do you think?
Regards,
Lorenzo
> Jonathan
>> ---
>> drivers/iio/humidity/hts221_core.c | 10 ++++------
>> 1 file changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
>> index 47a29b2da1ce..6e5847386a45 100644
>> --- a/drivers/iio/humidity/hts221_core.c
>> +++ b/drivers/iio/humidity/hts221_core.c
>> @@ -305,11 +305,10 @@ int hts221_power_on(struct hts221_hw *hw)
>>
>> int hts221_power_off(struct hts221_hw *hw)
>> {
>> - __le16 data = 0;
>> int err;
>>
>> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
>> - (u8 *)&data);
>> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
>> + HTS221_ENABLE_MASK, false);
>> if (err < 0)
>> return err;
>>
>> @@ -692,11 +691,10 @@ static int __maybe_unused hts221_suspend(struct device *dev)
>> {
>> struct iio_dev *iio_dev = dev_get_drvdata(dev);
>> struct hts221_hw *hw = iio_priv(iio_dev);
>> - __le16 data = 0;
>> int err;
>>
>> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
>> - (u8 *)&data);
>> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
>> + HTS221_ENABLE_MASK, false);
>>
>> return err < 0 ? err : 0;
>> }
>
--
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down
2017-08-11 19:54 ` Lorenzo Bianconi
@ 2017-08-12 11:07 ` Jonathan Cameron
2017-08-12 16:28 ` Lorenzo Bianconi
0 siblings, 1 reply; 49+ messages in thread
From: Jonathan Cameron @ 2017-08-12 11:07 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio
On Fri, 11 Aug 2017 21:54:07 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> > On Mon, 17 Jul 2017 19:38:58 +0200
> > Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> >
> >> GENMASK(6, 3) in CTRL_REG1 and GENMASK(6, 2) in CTRL_REG2 are marked
> >> reserved. Do not changed the original value (not declared in the
> >> datasheet) during power-down/suspend routines.
> >>
> >> Fixes: e4a70e3e7d84 (iio: humidity: add support to hts221 rh/temp device)
> >> Fixes: b7079eeac5da (iio: humidity: hts221: add power management support)
> >> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
> > Applied to the togreg branch of iio.git and pushed out as testing.
> >
> > If we want to do a backport of this it would be fine, but it needs
> > to require absolute minimal changes to the driver.
> >
>
> I think we need to push write_with_mask patch as well in order to fix
> that issue. What do you think?
>
> Regards,
> Lorenzo
Hmm. Is it possible to do a much more minimal local implementation
in just these two locations. That patch is rather larger than
it feels like we should need. Obviously the end result is clean,
but the process to get there is non trivial.
Jonathan
>
> > Jonathan
> >> ---
> >> drivers/iio/humidity/hts221_core.c | 10 ++++------
> >> 1 file changed, 4 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> >> index 47a29b2da1ce..6e5847386a45 100644
> >> --- a/drivers/iio/humidity/hts221_core.c
> >> +++ b/drivers/iio/humidity/hts221_core.c
> >> @@ -305,11 +305,10 @@ int hts221_power_on(struct hts221_hw *hw)
> >>
> >> int hts221_power_off(struct hts221_hw *hw)
> >> {
> >> - __le16 data = 0;
> >> int err;
> >>
> >> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
> >> - (u8 *)&data);
> >> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> >> + HTS221_ENABLE_MASK, false);
> >> if (err < 0)
> >> return err;
> >>
> >> @@ -692,11 +691,10 @@ static int __maybe_unused hts221_suspend(struct device *dev)
> >> {
> >> struct iio_dev *iio_dev = dev_get_drvdata(dev);
> >> struct hts221_hw *hw = iio_priv(iio_dev);
> >> - __le16 data = 0;
> >> int err;
> >>
> >> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
> >> - (u8 *)&data);
> >> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> >> + HTS221_ENABLE_MASK, false);
> >>
> >> return err < 0 ? err : 0;
> >> }
> >
>
>
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down
2017-08-12 11:07 ` Jonathan Cameron
@ 2017-08-12 16:28 ` Lorenzo Bianconi
0 siblings, 0 replies; 49+ messages in thread
From: Lorenzo Bianconi @ 2017-08-12 16:28 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio
> On Fri, 11 Aug 2017 21:54:07 +0200
> Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
>
>> > On Mon, 17 Jul 2017 19:38:58 +0200
>> > Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
>> >
>> >> GENMASK(6, 3) in CTRL_REG1 and GENMASK(6, 2) in CTRL_REG2 are marked
>> >> reserved. Do not changed the original value (not declared in the
>> >> datasheet) during power-down/suspend routines.
>> >>
>> >> Fixes: e4a70e3e7d84 (iio: humidity: add support to hts221 rh/temp device)
>> >> Fixes: b7079eeac5da (iio: humidity: hts221: add power management support)
>> >> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
>> > Applied to the togreg branch of iio.git and pushed out as testing.
>> >
>> > If we want to do a backport of this it would be fine, but it needs
>> > to require absolute minimal changes to the driver.
>> >
>>
>> I think we need to push write_with_mask patch as well in order to fix
>> that issue. What do you think?
>>
>> Regards,
>> Lorenzo
> Hmm. Is it possible to do a much more minimal local implementation
> in just these two locations. That patch is rather larger than
> it feels like we should need. Obviously the end result is clean,
> but the process to get there is non trivial.
>
> Jonathan
Ack, I will come up with a patch.
Regards,
Lorenzo
>>
>> > Jonathan
>> >> ---
>> >> drivers/iio/humidity/hts221_core.c | 10 ++++------
>> >> 1 file changed, 4 insertions(+), 6 deletions(-)
>> >>
>> >> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
>> >> index 47a29b2da1ce..6e5847386a45 100644
>> >> --- a/drivers/iio/humidity/hts221_core.c
>> >> +++ b/drivers/iio/humidity/hts221_core.c
>> >> @@ -305,11 +305,10 @@ int hts221_power_on(struct hts221_hw *hw)
>> >>
>> >> int hts221_power_off(struct hts221_hw *hw)
>> >> {
>> >> - __le16 data = 0;
>> >> int err;
>> >>
>> >> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
>> >> - (u8 *)&data);
>> >> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
>> >> + HTS221_ENABLE_MASK, false);
>> >> if (err < 0)
>> >> return err;
>> >>
>> >> @@ -692,11 +691,10 @@ static int __maybe_unused hts221_suspend(struct device *dev)
>> >> {
>> >> struct iio_dev *iio_dev = dev_get_drvdata(dev);
>> >> struct hts221_hw *hw = iio_priv(iio_dev);
>> >> - __le16 data = 0;
>> >> int err;
>> >>
>> >> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
>> >> - (u8 *)&data);
>> >> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
>> >> + HTS221_ENABLE_MASK, false);
>> >>
>> >> return err < 0 ? err : 0;
>> >> }
>> >
>>
>>
>>
>
--
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep
^ permalink raw reply [flat|nested] 49+ messages in thread
end of thread, other threads:[~2017-08-12 16:28 UTC | newest]
Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17 17:38 [PATCH v2 00/10] hts221: add new features and fix power-off procedure Lorenzo Bianconi
2017-07-17 17:38 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-1-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-17 17:38 ` [PATCH v2 01/10] iio: humidity: hts221: refactor write_with_mask code Lorenzo Bianconi
2017-07-17 17:38 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-2-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-22 17:57 ` Jonathan Cameron
2017-07-22 17:57 ` Jonathan Cameron
2017-07-17 17:38 ` [PATCH v2 02/10] iio: humidity: hts221: move BDU configuration in probe routine Lorenzo Bianconi
2017-07-17 17:38 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-3-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-22 17:58 ` Jonathan Cameron
2017-07-22 17:58 ` Jonathan Cameron
2017-07-17 17:38 ` [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down Lorenzo Bianconi
2017-07-17 17:38 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-4-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-22 18:02 ` Jonathan Cameron
2017-07-22 18:02 ` Jonathan Cameron
2017-08-11 19:54 ` Lorenzo Bianconi
2017-08-12 11:07 ` Jonathan Cameron
2017-08-12 16:28 ` Lorenzo Bianconi
2017-07-17 17:38 ` [PATCH v2 04/10] iio: humidity: hts221: avoid useless ODR reconfiguration Lorenzo Bianconi
2017-07-17 17:38 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-5-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-22 20:19 ` Jonathan Cameron
2017-07-22 20:19 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 05/10] iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable Lorenzo Bianconi
2017-07-17 17:39 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-6-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-22 20:21 ` Jonathan Cameron
2017-07-22 20:21 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 06/10] iio: humidity: hts221: support active-low interrupts Lorenzo Bianconi
2017-07-17 17:39 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-7-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-22 20:22 ` Jonathan Cameron
2017-07-22 20:22 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 07/10] dt-bindings: " Lorenzo Bianconi
2017-07-17 17:39 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-8-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-22 20:23 ` Jonathan Cameron
2017-07-22 20:23 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 08/10] iio: humidity: hts221: support open drain mode Lorenzo Bianconi
2017-07-17 17:39 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-9-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-22 20:25 ` Jonathan Cameron
2017-07-22 20:25 ` Jonathan Cameron
[not found] ` <20170722212524.6fc06db7-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-07-25 19:01 ` Jonathan Cameron
2017-07-25 19:01 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 09/10] dt-bindings: " Lorenzo Bianconi
2017-07-17 17:39 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-10-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-24 17:48 ` Rob Herring
2017-07-24 17:48 ` Rob Herring
2017-07-25 19:02 ` Jonathan Cameron
2017-07-25 19:02 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 10/10] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state() Lorenzo Bianconi
2017-07-17 17:39 ` Lorenzo Bianconi
[not found] ` <20170717173905.8209-11-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-25 19:03 ` Jonathan Cameron
2017-07-25 19:03 ` Jonathan Cameron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.