aboutsummaryrefslogtreecommitdiff
path: root/include/linux/i2c.h
AgeCommit message (Collapse)AuthorFilesLines
2023-09-13i2c: Drop legacy callback .probe_new()Uwe Kleine-König1-10/+1
Now that all drivers are converted to the (new) .probe() callback, the temporary .probe_new() can go away. \o/ Link: https://lore.kernel.org/linux-i2c/[email protected] Reviewed-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Jean Delvare <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2023-06-09i2c: Add i2c_get_match_data()Biju Das1-0/+2
Add i2c_get_match_data() to get match data for I2C, ACPI and DT-based matching, so that we can optimize the driver code. Suggested-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Biju Das <[email protected]> [wsa: simplified var initialization] Signed-off-by: Wolfram Sang <[email protected]>
2023-05-03i2c: gxp: fix build failure without CONFIG_I2C_SLAVEArnd Bergmann1-2/+2
The gxp_i2c_slave_irq_handler() is hidden in an #ifdef, but the caller uses an IS_ENABLED() check: drivers/i2c/busses/i2c-gxp.c: In function 'gxp_i2c_irq_handler': drivers/i2c/busses/i2c-gxp.c:467:29: error: implicit declaration of function 'gxp_i2c_slave_irq_handler'; did you mean 'gxp_i2c_irq_handler'? [-Werror=implicit-function-declaration] It has to consistently use one method or the other to avoid warnings, so move to IS_ENABLED() here for readability and build coverage, and move the #ifdef in linux/i2c.h to allow building it as dead code. Fixes: 4a55ed6f89f5 ("i2c: Add GXP SoC I2C Controller") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Nick Hawkins <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2023-03-09i2c: Switch .probe() to not take an id parameterUwe Kleine-König1-7/+11
Commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type") introduced a new probe callback to convert i2c init routines to not take an i2c_device_id parameter. Now that all in-tree drivers are converted to the temporary .probe_new() callback, .probe() can be modified to match the desired prototype. Now that .probe() and .probe_new() have the same semantic, they can be defined as members of an anonymous union to save some memory and simplify the core code a bit. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2023-01-17i2c: add fwnode APIsRussell King (Oracle)1-3/+21
Add fwnode APIs for finding and getting I2C adapters, which will be used by the SFP code. These are passed the fwnode corresponding to the adapter, and return the I2C adapter. It is the responsibility of the caller to find the appropriate fwnode. We keep the DT and ACPI interfaces, but where appropriate, recode them to use the fwnode interfaces internally. Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2022-11-14i2c: core: Introduce i2c_client_get_device_id helper functionAngel Iglesias1-0/+1
Introduces new helper function to aid in .probe_new() refactors. In order to use existing i2c_get_device_id() on the probe callback, the device match table needs to be accessible in that function, which would require bigger refactors in some drivers using the deprecated .probe callback. This issue was discussed in more detail in the IIO mailing list. Link: https://lore.kernel.org/all/[email protected]/ Suggested-by: Nuno Sá <[email protected]> Suggested-by: Andy Shevchenko <[email protected]> Suggested-by: Jonathan Cameron <[email protected]> Signed-off-by: Angel Iglesias <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2022-08-16i2c: Make remove callback return voidUwe Kleine-König1-1/+1
The value returned by an i2c driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Reviewed-by: Peter Senna Tschudin <[email protected]> Reviewed-by: Jeremy Kerr <[email protected]> Reviewed-by: Benjamin Mugnier <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Crt Mori <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-by: Marek Behún <[email protected]> # for leds-turris-omnia Acked-by: Andy Shevchenko <[email protected]> Reviewed-by: Petr Machata <[email protected]> # for mlxsw Reviewed-by: Maximilian Luz <[email protected]> # for surface3_power Acked-by: Srinivas Pandruvada <[email protected]> # for bmc150-accel-i2c + kxcjk-1013 Reviewed-by: Hans Verkuil <[email protected]> # for media/* + staging/media/* Acked-by: Miguel Ojeda <[email protected]> # for auxdisplay/ht16k33 + auxdisplay/lcd2s Reviewed-by: Luca Ceresoli <[email protected]> # for versaclock5 Reviewed-by: Ajay Gupta <[email protected]> # for ucsi_ccg Acked-by: Jonathan Cameron <[email protected]> # for iio Acked-by: Peter Rosin <[email protected]> # for i2c-mux-*, max9860 Acked-by: Adrien Grassein <[email protected]> # for lontium-lt8912b Reviewed-by: Jean Delvare <[email protected]> # for hwmon, i2c-core and i2c/muxes Acked-by: Corey Minyard <[email protected]> # for IPMI Reviewed-by: Vladimir Oltean <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Sebastian Reichel <[email protected]> # for drivers/power Acked-by: Krzysztof Hałasa <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2022-07-26i2c: extend documentation about retvals of master_xfer functionsWolfram Sang1-1/+2
It was stated how the error codes should be. It was not stated what the regular case should return. Add this. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2022-03-20i2c: add tracepoints for I2C slave eventsJae Hyun Yoo1-6/+2
I2C slave events tracepoints can be enabled by: echo 1 > /sys/kernel/tracing/events/i2c_slave/enable and logs in /sys/kernel/tracing/trace will look like: ... i2c_slave: i2c-0 a=010 ret=0 WR_REQ [] ... i2c_slave: i2c-0 a=010 ret=0 WR_RCV [02] ... i2c_slave: i2c-0 a=010 ret=0 WR_RCV [0c] ... i2c_slave: i2c-0 a=010 ret=0 STOP [] ... i2c_slave: i2c-0 a=010 ret=0 RD_REQ [04] ... i2c_slave: i2c-0 a=010 ret=0 RD_PRO [b4] ... i2c_slave: i2c-0 a=010 ret=0 STOP [] formatted as: i2c-<adapter_nr> a=<addr> ret=<ret> <- callback return value <event> [<data>] trace printings can be selected by adding a filter like: echo adapter_nr==1 >/sys/kernel/tracing/events/i2c_slave/filter Signed-off-by: Jae Hyun Yoo <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-12-13i2c: acpi: Add i2c_acpi_new_device_by_fwnode() functionHans de Goede1-4/+13
Change i2c_acpi_new_device() into i2c_acpi_new_device_by_fwnode() and add a static inline wrapper providing the old i2c_acpi_new_device() behavior. This is necessary because in some cases we may only have access to the fwnode / acpi_device and not to the matching physical-node struct device *. Suggested-by: Andy Shevchenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Mika Westerberg <[email protected]> Acked-by: Wolfram Sang <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-11-03i2c: Allow an ACPI driver to manage the device's power state during probeSakari Ailus1-0/+18
Enable drivers to tell ACPI that there's no need to power on a device for probe. Drivers should still perform this by themselves if there's a need to. In some cases powering on the device during probe is undesirable, and this change enables a driver to choose what fits best for it. Add a field called "flags" into struct i2c_driver for driver flags, and a flag I2C_DRV_ACPI_WAIVE_D0_PROBE to tell a driver supports probe in ACPI D states other than 0. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Tomasz Figa <[email protected]> Acked-by: Wolfram Sang <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2021-08-12i2c: acpi: Add an i2c_acpi_client_count() helper functionHans de Goede1-0/+5
We have 3 files now which have the need to count the number of I2cSerialBus resources in an ACPI-device's resource-list. Currently all implement their own helper function for this, add a generic helper function to replace the 3 implementations. Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Mika Westerberg <[email protected]> Acked-by: Wolfram Sang <[email protected]>
2021-07-05Merge tag 'staging-5.14-rc1' of ↵Linus Torvalds1-1/+7
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging / IIO driver updates from Greg KH: "Here is the big set of IIO and staging driver patches for 5.14-rc1. Loads of IIO driver updates and additions in here, the shortlog has the full details. For the staging side, we moved a few drivers out of staging, and deleted the kpc2000 drivers as the original developer asked us to because no one was working on them anymore. Also in here are loads of coding style cleanups due to different intern projects focusing on the staging tree to try to get experience doing kernel development. All of these have been in the linux-next tree for a while with no reported problems" * tag 'staging-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (744 commits) staging: hi6421-spmi-pmic: cleanup some macros staging: hi6421-spmi-pmic: change identation of a table staging: hi6421-spmi-pmic: change a return code staging: hi6421-spmi-pmic: better name IRQs staging: hi6421-spmi-pmic: use devm_request_threaded_irq() staging: hisilicon,hi6421-spmi-pmic.yaml: cleanup descriptions spmi: hisi-spmi-controller: move driver from staging phy: phy-hi3670-usb3: move driver from staging into phy staging: rtl8188eu: remove include/rtw_debug.h header staging: rtl8188eu: remove GlobalDebugLevel variable staging: rtl8188eu: remove DRIVER_PREFIX preprocessor definition staging: rtl8188eu: remove RT_TRACE macro staging: rtl8188eu: remove all RT_TRACE calls from hal/rtl8188eu_recv.c staging: rtl8188eu: remove all RT_TRACE calls from hal/hal_intf.c staging: rtl8188eu: remove all RT_TRACE calls from hal/rtl8188eu_xmit.c staging: rtl8188eu: remove all RT_TRACE calls from core/rtw_xmit.c staging: rtl8188eu: remove all RT_TRACE calls from core/rtw_pwrctrl.c staging: rtl8188eu: remove all RT_TRACE calls from core/rtw_recv.c staging: rtl8188eu: remove all RT_TRACE calls from core/rtw_ioctl_set.c staging: rtl8188eu: remove all RT_TRACE calls from core/rtw_ieee80211.c ...
2021-06-25i2c: core-smbus: Expose PEC calculate function for generic useQuan Nguyen1-0/+1
Expose the PEC calculation i2c_smbus_pec() for generic use. Signed-off-by: Quan Nguyen <[email protected]> Acked-by: Matt Johnston <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-06-07i2c: core: Add stub for i2c_verify_client() if !CONFIG_I2CJonathan Cameron1-1/+7
If I2C is not compiled, there is no way we should see a call to i2c_verify_client() on a device that is an i2c client. As such, provide a stub to return NULL to resolve an associated build failure. The build is failing with this link error ld: fxls8962af-core.o: in function `fxls8962af_fifo_transfer': fxls8962af-core.c: undefined reference to `i2c_verify_client' Reported-by: Tom Rix <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]> Fixes: af959b7b96b8 ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads") Reviewed-by: Sean Nyekjaer <[email protected]> Acked-by: Wolfram Sang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-05-28i2c: core: support bus regulator controlling in adapterBibby Hsieh1-0/+2
Although in the most platforms, the bus power of i2c are alway on, some platforms disable the i2c bus power in order to meet low power request. We can control bulk regulator if it is provided in i2c adapter device. Signed-off-by: Bibby Hsieh <[email protected]> Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Hsin-Yi Wang <[email protected]> Reviewed-by: Matthias Brugger <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: ensure timely release of driver-allocated resourcesDmitry Torokhov1-0/+3
More and more drivers rely on devres to manage their resources, however if bus' probe() and release() methods are not trivial and control some of resources as well (for example enable or disable clocks, or attach device to a power domain), we need to make sure that driver-allocated resources are released immediately after driver's remove() method returns, and not postponed until driver core gets around to releasing resources. To fix that we open a new devres group before calling driver's probe() and explicitly release it when we return from driver's remove(). Tested-by: Jeff LaBundy <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: core: add api to provide frequency mode stringsYicong Yang1-0/+3
Some I2C drivers like Designware and HiSilicon will print the bus frequency mode information, so add a public one that everyone can make use of. Tested-by: Jarkko Nikula <[email protected]> Reviewed-by: Jarkko Nikula <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Yicong Yang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: core: add managed function for adding i2c adaptersYicong Yang1-0/+1
Some I2C controller drivers will only unregister the I2C adapter in their .remove() callback, which can be done by simply using a managed variant to add the I2C adapter. So add the managed functions for adding the I2C adapter. Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Signed-off-by: Yicong Yang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10Merge branch 'i2c/software-nodes' into i2c/for-5.13Wolfram Sang1-2/+2
2021-04-10i2c: Remove support for dangling device propertiesHeikki Krogerus1-2/+0
From now on only accepting complete software nodes. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-08i2c: Add support for software nodesHeikki Krogerus1-1/+3
This makes it possible for the drivers to assign complete software fwnodes to the devices instead of only the device properties in those nodes. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-05i2c: Add I2C_AQ_NO_REP_START adapter quirkBence Csókás1-0/+2
This quirk signifies that the adapter cannot do a repeated START, it always issues a STOP condition after transfers. Suggested-by: Wolfram Sang <[email protected]> Signed-off-by: Bence Csókás <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-09-21i2c: Switch to using the new API kobj_to_dev()Tian Tao1-1/+1
Switch to using the new API kobj_to_dev(). Signed-off-by: Tian Tao <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-08-13Merge branch 'i2c/for-5.9' of ↵Linus Torvalds1-3/+11
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: - bus recovery can now be given a pinctrl handle and the I2C core will do all the steps to switch to/from GPIO which can save quite some boilerplate code from drivers - "fallthrough" conversion - driver updates, mostly ID additions * 'i2c/for-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (32 commits) i2c: iproc: fix race between client unreg and isr i2c: eg20t: use generic power management i2c: eg20t: Drop PCI wakeup calls from .suspend/.resume i2c: mediatek: Fix i2c_spec_values description i2c: mediatek: Add i2c compatible for MediaTek MT8192 dt-bindings: i2c: update bindings for MT8192 SoC i2c: mediatek: Add access to more than 8GB dram in i2c driver i2c: mediatek: Add apdma sync in i2c driver i2c: i801: Add support for Intel Tiger Lake PCH-H i2c: i801: Add support for Intel Emmitsburg PCH i2c: bcm2835: Replace HTTP links with HTTPS ones Documentation: i2c: dev: 'block process call' is supported i2c: at91: Move to generic GPIO bus recovery i2c: core: treat EPROBE_DEFER when acquiring SCL/SDA GPIOs i2c: core: add generic I2C GPIO recovery dt-bindings: i2c: add generic properties for GPIO bus recovery i2c: rcar: avoid race when unregistering slave i2c: tegra: Avoid tegra_i2c_init_dma() for Tegra210 vi i2c i2c: tegra: Fix runtime resume to re-init VI I2C i2c: tegra: Fix the error path in tegra_i2c_runtime_resume ...
2020-08-05i2c: core: add generic I2C GPIO recoveryCodrin Ciubotariu1-0/+11
Multiple I2C bus drivers use similar bindings to obtain information needed for I2C recovery. For example, for platforms using device-tree, the properties look something like this: &i2c { ... pinctrl-names = "default", "gpio"; pinctrl-0 = <&pinctrl_i2c_default>; pinctrl-1 = <&pinctrl_i2c_gpio>; sda-gpios = <&pio 0 GPIO_ACTIVE_HIGH>; scl-gpios = <&pio 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ... } For this reason, we can add this common initialization in the core. This way, other I2C bus drivers will be able to support GPIO recovery just by providing a pointer to platform's pinctrl and calling i2c_recover_bus() when SDA is stuck low. Signed-off-by: Codrin Ciubotariu <[email protected]> [wsa: inverted one logic for better readability, minor update to kdoc] Signed-off-by: Wolfram Sang <[email protected]>
2020-07-31Merge tag 'v5.8-rc7' into i2c/for-5.9Wolfram Sang1-1/+1
2020-07-27i2c: also convert placeholder function to return errnoWolfram Sang1-1/+1
All i2c_new_device-alike functions return ERR_PTR these days, but this fallback function was missed. Fixes: 2dea645ffc21 ("i2c: acpi: Return error pointers from i2c_acpi_new_device()") Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> [wsa: changed from 'ENOSYS' to 'ENODEV'] Signed-off-by: Wolfram Sang <[email protected]>
2020-07-24i2c: revert "i2c: core: Allow drivers to disable i2c-core irq mapping"Wolfram Sang1-3/+0
This manually reverts commit d1d84bb95364ed604015c2b788caaf3dbca0262f. The only user has gone two years ago with commit 589edb56b424 ("ACPI / scan: Create platform device for INT33FE ACPI nodes") and no new user has showed up. Remove and hope we will never need it again. Signed-off-by: Wolfram Sang <[email protected]> Acked-by: Hans de Goede <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-07-22i2c: drop duplicated word in the header fileRandy Dunlap1-1/+1
Drop the doubled word "be" in a comment. Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-06-19i2c: remove deprecated i2c_new_device APIWolfram Sang1-5/+3
All in-tree users have been converted to the new i2c_new_client_device function, so remove this deprecated one. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-28i2c: avoid confusing naming in headerWolfram Sang1-4/+4
i2c_client pointers are usually named 'client'. Use it here to get rid of the ambiguity of 'dev->dev'. Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22Revert "i2c: core: support bus regulator controlling in adapter"Wolfram Sang1-2/+0
This reverts commit 6fe12cdbcfe35ad4726a619a9546822d34fc934c. Testing in linux-next showed it needs some more time. Signed-off-by: Wolfram Sang <[email protected]>
2020-05-20Merge branch 'i2c/for-current-fixed' into i2c/for-5.8Wolfram Sang1-7/+1
2020-05-20i2c: core: support bus regulator controlling in adapterBibby Hsieh1-0/+2
Although in the most platforms, the bus power of i2c are alway on, some platforms disable the i2c bus power in order to meet low power request. We get and enable bulk regulator in i2c adapter device. Signed-off-by: Bibby Hsieh <[email protected]> Reviewed-by: Tomasz Figa <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-05i2c: use my kernel.org address from now onWolfram Sang1-1/+1
The old email is still active, but for easier handling, I am going to use my kernel.org address from now on. Also, add a mailmap for the now defunct Pengutronix address. Signed-off-by: Wolfram Sang <[email protected]>
2020-04-15i2c: remove i2c_new_probed_device APIWolfram Sang1-6/+0
All in-tree users have been converted to the new i2c_new_scanned_device function, so remove this deprecated one. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-04-02Merge branch 'i2c/for-5.7' of ↵Linus Torvalds1-0/+8
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: "I2C has: - using defines for bus speeds to avoid mistakes in hardcoded values; lots of small driver updates because of that. Thanks, Andy! - API change: i2c_setup_smbus_alert() was renamed to i2c_new_smbus_alert_device() and returns ERRPTR now. All in-tree users have been converted - in the core, a rare race condition when deleting the cdev has been fixed. Thanks, Kevin! - lots of driver updates. Thanks, everyone! I also want to mention: The amount of review and testing tags given was quite high this time. Thank you to these people, too. I hope we can keep it like this!" * 'i2c/for-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (34 commits) i2c: rcar: clean up after refactoring i2c_timings macintosh: convert to i2c_new_scanned_device i2c: drivers: Use generic definitions for bus frequencies i2c: algo: Use generic definitions for bus frequencies i2c: stm32f7: switch to I²C generic property parsing i2c: rcar: Consolidate timings calls in rcar_i2c_clock_calculate() i2c: core: Allow override timing properties with 0 i2c: core: Provide generic definitions for bus frequencies i2c: mxs: Use dma_request_chan() instead dma_request_slave_channel() i2c: imx: remove duplicate print after platform_get_irq() i2c: designware: Fix spelling typos in the comments i2c: designware: Discard i2c_dw_read_comp_param() function i2c: designware: Detect the FIFO size in the common code i2c: dev: Fix the race between the release of i2c_dev and cdev i2c: qcom-geni: Drop of_platform.h include i2c: qcom-geni: Grow a dev pointer to simplify code i2c: qcom-geni: Let firmware specify irq trigger flags i2c: stm32f7: do not backup read-only PECR register i2c: smbus: remove outdated references to irq level triggers i2c: convert SMBus alert setup function to return an ERRPTR ...
2020-03-24i2c: core: Provide generic definitions for bus frequenciesAndy Shevchenko1-0/+8
There are few maximum bus frequencies being used in the I²C core code. Provide generic definitions for bus frequencies and use them in the core. The drivers may use predefined constants where it is appropriate. Some of them are already using these under slightly different names. We will convert them later to use newly introduced defines. Note, the name of modes are chosen to follow well established naming scheme [1]. These definitions will also help to avoid typos in the numbers that may lead to subtle errors. [1]: https://en.wikipedia.org/wiki/I%C2%B2C#Differences_between_modes Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-03-23i2c: fix a doc warningMauro Carvalho Chehab1-2/+2
Don't let non-letters inside a literal block without escaping it, as the toolchain would mis-interpret it: ./include/linux/i2c.h:518: WARNING: Inline strong start-string without end-string. Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-12-17i2c: remove unneeded 'extern' from function declatationsLuca Ceresoli1-60/+55
According to coding-style.rst, extern should not be specified for exported functions. Signed-off-by: Luca Ceresoli <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-12-11i2c: add helper to check if a client has a driver attachedWolfram Sang1-0/+5
As a preparation for an API conversion, factor out something frequently used in the media subsystem. As an improvement, it bails out on both, NULL and ERRPTR to handle the old and new API. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-12-10i2c: fix header file kernel-doc warningRandy Dunlap1-0/+1
Fix kernel-doc warning in <linux/i2c.h>. ../include/linux/i2c.h:337: warning: Function parameter or member 'init_irq' not described in 'i2c_client' Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-12-10i2c: remove i2c_new_dummy() APIWolfram Sang1-6/+0
All in-kernel users have been converted to {devm_}i2c_new_dummy_device(). Remove the old API. Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Niklas Söderlund <[email protected]> Tested-by: Luca Ceresoli <[email protected]> Reviewed-by: Luca Ceresoli <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-11-28i2c: replace i2c_new_probed_device with an ERR_PTR variantWolfram Sang1-3/+9
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 <[email protected]> Reviewed-by: Luca Ceresoli <[email protected]> Reviewed-by: Max Staudt <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-11-15i2c: remove helpers for ref-counting clientsWolfram Sang1-3/+0
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 <[email protected]> Reviewed-by: Niklas Söderlund <[email protected]> Reviewed-by: Jean Delvare <[email protected]> Tested-by: Luca Ceresoli <[email protected]> Reviewed-by: Luca Ceresoli <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]>
2019-10-24i2c: add support for filters optional propertiesEugen Hristev1-0/+6
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 <[email protected]> Acked-by: Ludovic Desroches <[email protected]> Reviewed-by: Peter Rosin <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-09-24Merge branch 'i2c/for-5.4' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: - new driver for ICY, an Amiga Zorro card :) - axxia driver gained slave mode support, NXP driver gained ACPI - the slave EEPROM backend gained 16 bit address support - and lots of regular driver updates and reworks * 'i2c/for-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (52 commits) i2c: tegra: Move suspend handling to NOIRQ phase i2c: imx: ACPI support for NXP i2c controller i2c: uniphier(-f): remove all dev_dbg() i2c: uniphier(-f): use devm_platform_ioremap_resource() i2c: slave-eeprom: Add comment about address handling i2c: exynos5: Remove IRQF_ONESHOT i2c: stm32f7: Make structure stm32f7_i2c_algo constant i2c: cht-wc: drop check because i2c_unregister_device() is NULL safe i2c-eeprom_slave: Add support for more eeprom models i2c: fsi: Add of_put_node() before break i2c: synquacer: Make synquacer_i2c_ops constant i2c: hix5hd2: Remove IRQF_ONESHOT i2c: i801: Use iTCO version 6 in Cannon Lake PCH and beyond watchdog: iTCO: Add support for Cannon Lake PCH iTCO i2c: iproc: Make bcm_iproc_i2c_quirks constant i2c: iproc: Add full name of devicetree node to adapter name i2c: piix4: Add ACPI support i2c: piix4: Fix probing of reserved ports on AMD Family 16h Model 30h i2c: ocores: use request_any_context_irq() to register IRQ handler i2c: designware: Fix optional reset error handling ...
2019-08-14i2c: replace i2c_new_secondary_device with an ERR_PTR variantWolfram Sang1-1/+1
In the general move to have i2c_new_*_device functions which return ERR_PTR instead of NULL, this patch converts i2c_new_secondary_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_ancillary_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 <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> # adv748x Reviewed-by: Laurent Pinchart <[email protected]> # adv7511 + adv7604 Reviewed-by: Hans Verkuil <[email protected]> # adv7604 Signed-off-by: Wolfram Sang <[email protected]>
2019-07-31docs: i2c: convert to ReST and add to driver-api booksetMauro Carvalho Chehab1-1/+1
Convert each file at I2C subsystem, renaming them to .rst and adding to the driver-api book. Signed-off-by: Mauro Carvalho Chehab <[email protected]> Acked-by: Wolfram Sang <[email protected]> Acked-by: Alexandre Belloni <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]>