drivers/iio/chemical/sps30.c | 143 +++++++++++++++---
2 files changed, 145 insertions(+), 18 deletions(-)
-diff --git a/Documentation/ABI/testing/sysfs-bus-iio-sps30 b/Documentation/ABI/testing/sysfs-bus-iio-sps30
-index e7ce2c57635e..143df8e89d08 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio-sps30
+++ b/Documentation/ABI/testing/sysfs-bus-iio-sps30
@@ -6,3 +6,23 @@ Description:
+ The range of available values in seconds represented as the
+ minimum value, the step and the maximum value, all enclosed in
+ square brackets.
-diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c
-index f3b4390c8f5c..376fac41ecb5 100644
--- a/drivers/iio/chemical/sps30.c
+++ b/drivers/iio/chemical/sps30.c
@@ -5,9 +5,6 @@
};
DECLARE_CRC8_TABLE(sps30_crc8_table);
-@@ -107,6 +117,9 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size)
+@@ -107,6 +117,9 @@ static int sps30_do_cmd(struct sps30_sta
case SPS30_START_FAN_CLEANING:
ret = sps30_write_then_read(state, buf, 2, NULL, 0);
break;
case SPS30_READ_DATA_READY_FLAG:
case SPS30_READ_DATA:
case SPS30_READ_SERIAL:
-@@ -114,6 +127,15 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size)
+@@ -114,6 +127,15 @@ static int sps30_do_cmd(struct sps30_sta
size += size / 2;
ret = sps30_write_then_read(state, buf, 2, buf, size);
break;
}
if (ret)
-@@ -170,6 +192,14 @@ static int sps30_do_meas(struct sps30_state *state, s32 *data, int size)
+@@ -170,6 +192,14 @@ static int sps30_do_meas(struct sps30_st
int i, ret, tries = 5;
u8 tmp[16];
while (tries--) {
ret = sps30_do_cmd(state, SPS30_READ_DATA_READY_FLAG, tmp, 2);
if (ret)
-@@ -276,6 +306,24 @@ static int sps30_read_raw(struct iio_dev *indio_dev,
+@@ -276,6 +306,24 @@ static int sps30_read_raw(struct iio_dev
return -EINVAL;
}
static ssize_t start_cleaning_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
-@@ -296,10 +344,82 @@ static ssize_t start_cleaning_store(struct device *dev,
+@@ -296,10 +344,82 @@ static ssize_t start_cleaning_store(stru
return len;
}
NULL
};
-@@ -362,6 +482,7 @@ static int sps30_probe(struct i2c_client *client)
+@@ -362,6 +482,7 @@ static int sps30_probe(struct i2c_client
state = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev);
state->client = client;
indio_dev->dev.parent = &client->dev;
indio_dev->info = &sps30_info;
indio_dev->name = client->name;
-@@ -373,19 +494,11 @@ static int sps30_probe(struct i2c_client *client)
+@@ -373,19 +494,11 @@ static int sps30_probe(struct i2c_client
mutex_init(&state->lock);
crc8_populate_msb(sps30_crc8_table, SPS30_CRC8_POLYNOMIAL);
ret = sps30_do_cmd(state, SPS30_READ_SERIAL, buf, sizeof(buf));
if (ret) {
-@@ -395,12 +508,6 @@ static int sps30_probe(struct i2c_client *client)
+@@ -395,12 +508,6 @@ static int sps30_probe(struct i2c_client
/* returned serial number is already NUL terminated */
dev_info(&client->dev, "serial number: %s\n", buf);