From b84dfe1af54053e0aedb14cd26307859aa1df35f Mon Sep 17 00:00:00 2001 From: Eugen Hristev Date: Wed, 23 Oct 2019 12:40:14 +0000 Subject: i2c: add support for filters optional properties i2c-digital-filter-width-ns: This optional timing property specifies the width of the spikes on the i2c lines (in ns) that can be filtered out by built-in digital filters which are embedded in some i2c controllers. i2c-analog-filter-cutoff-frequency: This optional timing property specifies the cutoff frequency of a low-pass analog filter built-in i2c controllers. This low pass filter is used to filter out high frequency noise on the i2c lines. Specified in Hz. Include these properties in the timings structure and read them as integers. Signed-off-by: Eugen Hristev Acked-by: Ludovic Desroches Reviewed-by: Peter Rosin Signed-off-by: Wolfram Sang --- include/linux/i2c.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 1361637c369d..aaf57d9b41db 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -575,6 +575,10 @@ struct i2c_lock_operations { * @scl_int_delay_ns: time IP core additionally needs to setup SCL in ns * @sda_fall_ns: time SDA signal takes to fall in ns; t(f) in the I2C specification * @sda_hold_ns: time IP core additionally needs to hold SDA in ns + * @digital_filter_width_ns: width in ns of spikes on i2c lines that the IP core + * digital filter can filter out + * @analog_filter_cutoff_freq_hz: threshold frequency for the low pass IP core + * analog filter */ struct i2c_timings { u32 bus_freq_hz; @@ -583,6 +587,8 @@ struct i2c_timings { u32 scl_int_delay_ns; u32 sda_fall_ns; u32 sda_hold_ns; + u32 digital_filter_width_ns; + u32 analog_filter_cutoff_freq_hz; }; /** -- cgit v1.2.3 From 7be5f90f689af5abb6b16755e212f76ed97a20dd Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Tue, 1 Oct 2019 11:00:00 -0500 Subject: i2c: pxa: remove unused i2c-slave APIs With the i2c-pxa driver migrated to the standard i2c-slave APIs, the custom APIs and structures are no longer needed or used. Remove them. Signed-off-by: Patrick Williams Signed-off-by: Wolfram Sang --- include/linux/i2c-pxa.h | 18 ------------------ include/linux/platform_data/i2c-pxa.h | 4 ---- 2 files changed, 22 deletions(-) delete mode 100644 include/linux/i2c-pxa.h (limited to 'include') diff --git a/include/linux/i2c-pxa.h b/include/linux/i2c-pxa.h deleted file mode 100644 index a897e2b507b6..000000000000 --- a/include/linux/i2c-pxa.h +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _LINUX_I2C_ALGO_PXA_H -#define _LINUX_I2C_ALGO_PXA_H - -typedef enum i2c_slave_event_e { - I2C_SLAVE_EVENT_START_READ, - I2C_SLAVE_EVENT_START_WRITE, - I2C_SLAVE_EVENT_STOP -} i2c_slave_event_t; - -struct i2c_slave_client { - void *data; - void (*event)(void *ptr, i2c_slave_event_t event); - int (*read) (void *ptr); - void (*write)(void *ptr, unsigned int val); -}; - -#endif /* _LINUX_I2C_ALGO_PXA_H */ diff --git a/include/linux/platform_data/i2c-pxa.h b/include/linux/platform_data/i2c-pxa.h index cb290092599c..6a9b28399b39 100644 --- a/include/linux/platform_data/i2c-pxa.h +++ b/include/linux/platform_data/i2c-pxa.h @@ -55,11 +55,7 @@ */ #define I2C_ISR_INIT 0x7FF /* status register init */ -struct i2c_slave_client; - struct i2c_pxa_platform_data { - unsigned int slave_addr; - struct i2c_slave_client *slave; unsigned int class; unsigned int use_pio :1; unsigned int fast_mode :1; -- cgit v1.2.3 From 9af433840b3f61ac30d569a85234ab8f210f813a Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Sat, 9 Nov 2019 22:16:33 +0100 Subject: i2c: remove helpers for ref-counting clients MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are no in-tree users of these helpers anymore, and there shouldn't. Most use cases went away once the driver model started to refcount for us. There have been users like the media subsystem, but they all switched to better refcounting methods meanwhile. Media did this in 2008. Last user (IPMI) left 2018. Remove this cruft. Signed-off-by: Wolfram Sang Reviewed-by: Niklas Söderlund Reviewed-by: Jean Delvare Tested-by: Luca Ceresoli Reviewed-by: Luca Ceresoli Reviewed-by: Geert Uytterhoeven --- include/linux/i2c.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/linux/i2c.h b/include/linux/i2c.h index aaf57d9b41db..88b825601f3d 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -850,9 +850,6 @@ extern void i2c_del_driver(struct i2c_driver *driver); #define i2c_add_driver(driver) \ i2c_register_driver(THIS_MODULE, driver) -extern struct i2c_client *i2c_use_client(struct i2c_client *client); -extern void i2c_release_client(struct i2c_client *client); - /* call the i2c_client->command() of all attached clients with * the given arguments */ extern void i2c_clients_command(struct i2c_adapter *adap, -- cgit v1.2.3 From c1d084759c95ecd0ef08274654a1f6c4f343cdcd Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Wed, 6 Nov 2019 10:50:19 +0100 Subject: i2c: replace i2c_new_probed_device with an ERR_PTR variant In the general move to have i2c_new_*_device functions which return ERR_PTR instead of NULL, this patch converts i2c_new_probed_device(). There are only few users, so this patch converts the I2C core and all users in one go. The function gets renamed to i2c_new_scanned_device() so out-of-tree users will get a build failure to understand they need to adapt their error checking code. Signed-off-by: Wolfram Sang Reviewed-by: Luca Ceresoli Reviewed-by: Max Staudt Signed-off-by: Wolfram Sang --- include/linux/i2c.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 88b825601f3d..d2f786706657 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -452,10 +452,16 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf * a default probing method is used. */ extern struct i2c_client * +i2c_new_scanned_device(struct i2c_adapter *adap, + struct i2c_board_info *info, + unsigned short const *addr_list, + int (*probe)(struct i2c_adapter *adap, unsigned short addr)); + +extern struct i2c_client * i2c_new_probed_device(struct i2c_adapter *adap, - struct i2c_board_info *info, - unsigned short const *addr_list, - int (*probe)(struct i2c_adapter *adap, unsigned short addr)); + struct i2c_board_info *info, + unsigned short const *addr_list, + int (*probe)(struct i2c_adapter *adap, unsigned short addr)); /* Common custom probe functions */ extern int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr); -- cgit v1.2.3