Biju Das
0f5cecd14f
iio: potentiometer: ds1803: Convert enum->pointer for data in the ID table
...
Convert enum->pointer for data in the ID table, so that
device_get_match_data() can do match against OF/ACPI/I2C tables, once i2c
bus type match support added to it.
Replace enum->struct *ds1803_cfg for data in the ID table and simplify
ds1803_probe() by replacing device_get_match_data() with
i2c_get_match_data().
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20230812144106.163355-1-biju.das.jz@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-09-12 10:42:03 +01:00
Uwe Kleine-König
7cf15f4275
iio: Switch i2c drivers back to use .probe()
...
After commit b8a1a4cd5a ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498 ("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 >
2023-05-21 18:54:53 +01:00
Uwe Kleine-König
705f1ce22b
iio: potentiometer: ds1803: Convert to i2c's .probe_new()
...
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.
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-162-uwe@kleine-koenig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-11-23 20:20:30 +00:00
Jagath Jog J
73c169857c
iio: potentiometer: ds1803: Add support for Maxim DS3502
...
The DS3502 is a 7-bit, nonvolatile digital potentiometer featuring
an output voltage range of up to 15.5V. DS3502 support is added
into existing DS1803 driver.
Datasheet: https://datasheets.maximintegrated.com/en/ds/DS3502.pdf
Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220223163525.13399-7-jagathjog1996@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-02-26 18:39:27 +00:00
Jagath Jog J
9b68725e90
iio: potentiometer: ds1803: Add device specific read_raw function
...
Added function pointer in the device specific structure to
call the appropriate device read_raw function, so that the
other type of devices with different read method can be
handled.
Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220223163525.13399-6-jagathjog1996@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-02-26 18:39:24 +00:00
Jagath Jog J
6450b62cb2
iio: potentiometer: ds1803: Change to firmware provided data
...
Using firmware provided data to get the device specific
structure if not available fall back to id->driver_data.
Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220223163525.13399-5-jagathjog1996@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-02-26 18:38:00 +00:00
Jagath Jog J
a98d2b029b
iio: potentiometer: ds1803: Add channel information in device data
...
Adding each device wiper count and channel information into
device private data.
Utilizing addr member of struct iio_chan_spec to get the
wiper register address so that the value can be read or write
to the same address.
Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220223163525.13399-4-jagathjog1996@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-02-26 18:38:00 +00:00
Jagath Jog J
4a68b32611
iio: potentiometer: ds1803: Add available functionality
...
Adding available functionality for DS1803 driver which
will show the minimum, step and maximum values that the
driver can accepts through sysfs entry.
Now using the max value present in avail array instead of chip
type specific macro to make the driver flexible to add other
type of potentiometer with different max position value.
Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220223163525.13399-3-jagathjog1996@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-02-26 18:38:00 +00:00
Jagath Jog J
d3616e09ba
iio: potentiometer: ds1803: Alignment to match the open parenthesis
...
Fix following checkpatch.pl check by removing blank space.
CHECK: Alignment should match open parenthesis.
Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220223163525.13399-2-jagathjog1996@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-02-26 18:37:50 +00:00
Jonathan Cameron
c34bed923d
iio:potentiometer:ds1803: Drop of_match_ptr and CONFIG_OF protections
...
These prevent use of this driver with ACPI via PRP0001 and are
an example of an anti pattern I'm trying to remove from IIO.
Drop them to remove this restriction.
Also switch of.h for mod_devicetable.h include given use of
struct of_device_id which is defined in that header.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Cc: Slawomir Stepien <sst@poczta.fm >
Link: https://lore.kernel.org/r/20200910173242.621168-3-jic23@kernel.org
2020-09-17 19:13:38 +01:00
Alexandru Ardelean
d3be83244c
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 >
2020-06-14 11:49:59 +01:00
Thomas Gleixner
d2912cb15b
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500
...
Based on 2 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-only
has been chosen to replace the boilerplate/reference in 4122 file(s).
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Enrico Weigelt <info@metux.net >
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org >
Reviewed-by: Allison Randal <allison@lohutok.net >
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-06-19 17:09:55 +02:00
Himanshu Jha
a937729c93
iio: potentiometer: ds1803: Remove VLA usage
...
In preparation to enabling -Wvla, remove VLA usage and replace it
with fixed a fixed length array and therefore, prevent potential
stack overflow attacks.
Fixed as a part of the discussion to remove all VLAs from the kernel:
https://lkml.org/lkml/2018/3/7/621
Cc: keescook@chromium.org
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com >
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2018-03-10 15:02:41 +00:00
Jonathan Cameron
6d9d020da5
iio:dpot: drop assign iio_info.driver_module
...
The equivalent of this is now done via macro magic when
the relevant register call is 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 >
2017-08-22 21:34:10 +01:00
Slawomir Stepien
fbbc5e7044
iio: potentiometer: add driver for Maxim Integrated DS1803
...
The following functions are supported:
- write, read potentiometer value
- potentiometer scale
Datasheet: https://datasheets.maximintegrated.com/en/ds/DS1803.pdf
Signed-off-by: Slawomir Stepien <sst@poczta.fm >
Signed-off-by: Jonathan Cameron <jic23@kernel.org >
2016-04-10 12:34:09 +01:00