History log of /linux-master/drivers/iio/chemical/sps30.c
Revision Date Author Comments
# 53bee458 04-Jun-2022 Jonathan Cameron <Jonathan.Cameron@huawei.com>

iio: chemical: sps30: Move symbol exports into IIO_SPS30 namespace

Avoid unnecessary pollution of the global symbol namespace by
moving library functions in to a specific namespace and import
that into the drivers that make use of the functions.

For more info: https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>
Link: https://lore.kernel.org/r/20220220173701.502331-4-jic23@kernel.org
Reviewed-By: Joe Simmons-Talbott <joetalbott@gmail.com>
Link: https://lore.kernel.org/r/20220604155306.422937-4-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# f22ab91a 16-Dec-2021 Lars-Peter Clausen <lars@metafoo.de>

iio: sps30: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom `cleaning_period` device attribute of
the sps30 driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-14-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 8f3f1308 03-May-2021 Tomasz Duszynski <tomasz.duszynski@octakon.com>

iio: sps30: separate core and interface specific code

Move code responsible for handling i2c communication to a separate file.
Rationale for this change is preparation for adding support for serial
communication.

Signed-off-by: Tomasz Duszynski <tomasz.duszynski@octakon.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 643adb9a 12-Apr-2021 Tian Tao <tiantao6@hisilicon.com>

iio:chemical:sps30: Convert sysfs sprintf/snprintf family to sysfs_emit

Fix the following coccicheck warning:
./drivers/iio/chemical/sps30.c:414:8-16: WARNING:
use scnprintf or sprintf

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Link: https://lore.kernel.org/r/1618216751-1678-2-git-send-email-tiantao6@hisilicon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# df561f66 23-Aug-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

treewide: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>


# d3be8324 22-May-2020 Alexandru Ardelean <alexandru.ardelean@analog.com>

iio: remove explicit IIO device parent assignment

This patch applies the semantic patch:
@@
expression I, P, SP;
@@
I = devm_iio_device_alloc(P, SP);
...
- I->dev.parent = P;

It updates 302 files and does 307 deletions.
This semantic patch also removes some comments like
'/* Establish that the iio_dev is a child of the i2c device */'

But this is is only done in case where the block is left empty.

The patch does not seem to cover all cases. It looks like in some cases a
different variable is used in some cases to assign the parent, but it
points to the same reference.
In other cases, the block covered by ... may be just too big to be covered
by the semantic patch.

However, this looks pretty good as well, as it does cover a big bulk of the
drivers that should remove the parent assignment.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# a5bf6fdd 17-May-2020 Jonathan Cameron <Jonathan.Cameron@huawei.com>

iio:chemical:sps30: Fix timestamp alignment

One of a class of bugs pointed out by Lars in a recent review.
iio_push_to_buffers_with_timestamp assumes the buffer used is aligned
to the size of the timestamp (8 bytes). This is not guaranteed in
this driver which uses an array of smaller elements on the stack.

Fixes: 232e0f6ddeae ("iio: chemical: add support for Sensirion SPS30 sensor")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: <Stable@vger.kernel.org>
Acked-by: Tomasz Duszynski <tomasz.duszynski@octakon.com>


# 78b75ab3 13-Oct-2019 Jonathan Cameron <Jonathan.Cameron@huawei.com>

iio: chemical: sps30: Explicity truncate constant by masking

When breaking up a constant to write to two 8 bit registers
it isn't obvious to sparse that it was intentional.

CHECK drivers/iio/chemical/sps30.c
drivers/iio/chemical/sps30.c:120:30: warning: cast truncates bits from constant value (8004 becomes 4)

So in the interests of minimising noisy warnings, let us add
a mask.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Tomasz Duszynski <tduszyns@gmail.com>


# 59b9bb0a 09-Feb-2019 Jonathan Cameron <Jonathan.Cameron@huawei.com>

iio:chemical:sps30 Supress some switch fallthrough warnings.

Fixes warnings reported on linux-next but marking one path
and adding an explicit return in the other.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andreas Brauchli <a.brauchli@elementarea.net>
Acked-by: Tomasz Duszynski <tduszyns@gmail.com>


# 905889b4 08-Feb-2019 Dan Carpenter <dan.carpenter@oracle.com>

iio: chemical: sps30: fix a loop timeout test

The "while (tries--) {" loop is a postop so it exits with "tries" set
to -1.

Fixes: 232e0f6ddeae ("iio: chemical: add support for Sensirion SPS30 sensor")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 3fa30bf7 02-Feb-2019 Tomasz Duszynski <tduszyns@gmail.com>

iio: chemical: sps30: remove printk format specifier

pr_fmt is used by printk wrappers. There are not any in the driver
code so remove the format specifier.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 62129a08 15-Jan-2019 Tomasz Duszynski <tduszyns@gmail.com>

iio: chemical: sps30: allow changing self cleaning period

Sensor can periodically trigger self cleaning. Period can be changed by
writing a new value to a dedicated attribute. Upon attribute read
current period gets returned.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# c546d496 18-Dec-2018 Tomasz Duszynski <tduszyns@gmail.com>

iio: chemical: sps30: add support for self cleaning

Self cleaning is especially useful in cases where sensor undergoes
frequent power on/off cycles. In such scenarios it is recommended to
turn self cleaning at least once per week in order to maintain reliable
measurements.

Self cleaning is activated by writing 1 to a dedicated attribute.
Internal fan accelerates to its maximum speed and keeps spinning
for about 10 seconds blowing out accumulated dust.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Tested-by: Andreas Brauchli <andreas.brauchli@sensirion.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 232e0f6d 14-Dec-2018 Tomasz Duszynski <tduszyns@gmail.com>

iio: chemical: add support for Sensirion SPS30 sensor

Add support for Sensirion SPS30 particulate matter sensor.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>