History log of /linux-master/drivers/iio/light/adjd_s311.c
Revision Date Author Comments
# 7cf15f42 15-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

iio: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230515205048.19561-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 39c7d963 18-Nov-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

iio: light: adjd_s311: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221118224540.619276-113-uwe@kleine-koenig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# bb761e72 05-Jul-2021 Alexandru Ardelean <aardelean@deviqon.com>

iio: light: adjd_s311: convert probe to device-managed functions

Now that the driver's buffer is stored on the adjd_s311_data private
object, the driver is a simple conversion to use only device-managed
functions in the probe.

The iio_triggered_buffer_setup() and iio_device_register() functions are
the only ones needing conversion.
And i2c_set_clientdata() is no longer required.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210705071456.649659-2-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 2427a7e9 05-Jul-2021 Alexandru Ardelean <aardelean@deviqon.com>

iio: light: adjd_s311: move buffer on adjd_s311_data object

This change moves the entire buffer on the private adjd_s311_data type.
Since the device has 4 channels, it's not a big waste to just allocate the
maximum possible buffer and use only what's needed.

This is in contrast with free-ing and re-allocating the buffer on the
update_scan_mode hook.

Since the driver pushes buffer data with
iio_push_to_buffers_with_timestamp(), the buffer must also include a
64-bit buffer for the timestamp, for each sample-set.

With this change, the adjd_s311_update_scan_mode() is no longer needed.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210705071456.649659-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 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>


# 36edc939 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330

Based on 1 normalized pattern(s):

this file is subject to the terms and conditions of version 2 of the
gnu general public license see the file copying in the main
directory of this archive for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 55 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190530000436.108941081@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4166b47c 23-Jul-2017 Jonathan Cameron <jic23@kernel.org>

iio:light: drop assign iio_info.driver_module and iio_trigger_ops.owner

The equivalent of both of these are now done via macro magic when
the relevant register calls are made. The actual structure
elements will shortly go away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>


# bc2b7dab 09-Mar-2016 Gregor Boirie <gregor.boirie@parrot.com>

iio:core: timestamping clock selection support

Adds a new per-device sysfs attribute "current_timestamp_clock" to allow
userspace to select a particular POSIX clock for buffered samples and
events timestamping.

Following clocks, as listed in clock_gettime(2), are supported:
CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW,
CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and
CLOCK_TAI.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 36eb8cc2 01-Sep-2014 Paul Gortmaker <paul.gortmaker@windriver.com>

iio: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 4f38521b 01-Jul-2014 Peter Meerwald <pmeerw@pmeerw.net>

iio: Remove obsolete variable in adjd_s311 driver

len variable become obsolete with
iio_push_to_buffers_with_timestamp()

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 80ac4b8a 11-Dec-2013 Jonathan Cameron <jic23@kernel.org>

iio:light:adjd_s311 replaces IIO_ST macro with explicit entries to struct scan_type

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>


# a9f3acd0 19-Sep-2013 Lars-Peter Clausen <lars@metafoo.de>

iio:adjd_s311: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 8c60c7e7 15-Sep-2013 Lars-Peter Clausen <lars@metafoo.de>

iio: Remove unnecessary casts for iio_push_to_buffers()

Now that iio_push_to_buffers() takes a void pointer for the data parameter we
can remove those casts to u8*.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# caeac374 08-Sep-2013 Peter Meerwald <pmeerw@pmeerw.net>

iio: adjd_s311: Use INT_TIME channel info

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 4c730292 18-Aug-2013 Peter Meerwald <pmeerw@pmeerw.net>

iio: adjd_s311: Cleanup unused #defines

using word reads, no need for HI/LO register #defines

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 71f42642 18-Aug-2013 Peter Meerwald <pmeerw@pmeerw.net>

iio: adjd_s311: Fix non-scan mode data read

forgot to convert channel index to data register

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# ccf12c33 29-Jul-2013 Peter Meerwald <pmeerw@pmeerw.net>

iio:adjd_s311: Use devm_iio_device_alloc

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 0112f521 27-Feb-2013 Jonathan Cameron <jic23@kernel.org>

iio:light:adjd_s311 move to info_mask_(shared_by_type/separate)

The original info_mask is going away in favour of the broken out versions.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
cc: Peter Meerwald <pmeerw@pmeerw.net>


# fc52692c 21-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Drivers: iio: remove __dev* attributes.

CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, and __devexit
from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 84b36ce5 30-Jun-2012 Jonathan Cameron <jic23@kernel.org>

staging:iio: Add support for multiple buffers

Route all buffer writes through the demux.
Addition or removal of a buffer results in tear down and
setup of all the buffers for a given device.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Tested-by: srinivas pandruvada <srinivas.pandruvada@intel.com>


# ce56ade6 04-Sep-2012 Lars-Peter Clausen <lars@metafoo.de>

iio: Drop timestamp parameter from buffer store_to callback

Drop timestamp parameter from buffer store_to callback and subsequently from
iio_push_to_buffer. The timestamp parameter is unused and it seems likely that
it will stay unused in the future, so it should be safe to remove it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 1c795ebd 08-Aug-2012 Alexey Khoroshilov <khoroshilov@ispras.ru>

iio/adjd_s311: Fix potential memory leak in adjd_s311_update_scan_mode()

Do not leak memory by updating pointer with potentially NULL realloc return value.
There is no need to preserve data in the buffer,
so replace krealloc() by kfree()-kmalloc() pair.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 79587623 14-Jul-2012 Peter Meerwald <pmeerw@pmeerw.net>

iio: fix pointer cast warning

fix compile warning reported by Fengguang Wu:

drivers/iio/light/adjd_s311.c: In function 'adjd_s311_trigger_handler':
drivers/iio/light/adjd_s311.c:188:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/iio/light/adjd_s311.c:188:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

185 }
186
187 if (indio_dev->scan_timestamp)
> 188 *(s64 *)((phys_addr_t)data->buffer + ALIGN(len, sizeof(s64)))
189 = time_ns;
190 iio_push_to_buffer(buffer, (u8 *)data->buffer, time_ns);
191

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# bbdb822c 10-Jul-2012 Peter Meerwald <pmeerw@pmeerw.net>

iio: add adjd_s311 I2C digital color sensor driver

sensor has 4 channels (10-bit each, R/G/B and clear), sensitivity
and gain is controlled in the driver by ext_info integration_time
and CHAN_INFO_HARDWAREGAIN

driver supports triggered buffer and IIO_CHAN_INFO_RAW to get the
sensor data

v5: address comments by Jonathan Cameron
* use macro for channel declaration
* get timestamp right before measurement
* cleanups

v4: address comments by Lars-Peter Clausen
* make sure trigger handler is exited with iio_trigger_notify_done()
and IRQ_HANDLED
* kfree()/kalloc() -> krealloc()

v3:
* fix warnings

v2: address comments by Lars-Peter Clausen
* buffer allocation now in update_scan_mode instead of in trigger
handler
* simplify trigger code (assume active_scan_mask is not empty, use
for_each_set_bit, use iio_push_to_buffer)
* reorder entry in Makefile and Kconfig
* fix remove

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>