summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
Commit message (Collapse)AuthorAgeFilesLines
* i2c: dev: Fix bus callback return valuesGeert Uytterhoeven2023-03-091-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The i2cdev_{at,de}tach_adapter() callbacks are used for two purposes: 1. As notifier callbacks, when (un)registering I2C adapters created or destroyed after i2c_dev_init(), 2. As bus iterator callbacks, for registering already existing adapters from i2c_dev_init(), and for cleanup. Unfortunately both use cases expect different return values: the former expects NOTIFY_* return codes, while the latter expects zero or error codes, and aborts in case of error. Hence in case 2, as soon as i2cdev_{at,de}tach_adapter() returns (non-zero) NOTIFY_OK, the bus iterator aborts. This causes (a) only the first already existing adapter to be registered, leading to missing /dev/i2c-* entries, and (b) a failure to unregister all but the first I2C adapter during cleanup. Fix this by introducing separate callbacks for the bus iterator, wrapping the notifier functions, and always returning succes. Any errors inside these callback functions are unlikely to happen, and are fatal anyway. Fixes: cddf70d0bce71c2a ("i2c: dev: fix notifier return values") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* i2c: Convert drivers to new .probe() callbackUwe Kleine-König2023-03-094-4/+4
| | | | | | | | | | Now that .probe() was changed not to get the id parameter, drivers can be converted back to that with the eventual goal to drop .probe_new(). Implement that for the i2c drivers that are part of the i2c core. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* i2c: mux: Convert all drivers to new .probe() callbackUwe Kleine-König2023-03-093-3/+3
| | | | | | | | | | | | Now that .probe() was changed not to get the id parameter, drivers can be converted back to that with the eventual goal to drop .probe_new(). Implement that for the i2c mux drivers. Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* i2c: Switch .probe() to not take an id parameterUwe Kleine-König2023-03-091-9/+2
| | | | | | | | | | | | | | | 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 <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* i2c: gxp: fix an error code in probeDan Carpenter2023-03-031-1/+1
| | | | | | | | | | This is passing IS_ERR() instead of PTR_ERR() so instead of an error code it prints and returns the number 1. Fixes: 4a55ed6f89f5 ("i2c: Add GXP SoC I2C Controller") Signed-off-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Nick Hawkins <nick.hawkins@hpe.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* i2c: gxp: return proper error on address NACKWolfram Sang2023-03-031-2/+4
| | | | | | | According to Documentation/i2c/fault-codes.rst, NACK after sending an address should be -ENXIO. Signed-off-by: Wolfram Sang <wsa@kernel.org>
* i2c: gxp: remove "empty" switch statementWolfram Sang2023-03-031-12/+1
| | | | | | | There used to be error messages which had to go. Now, it only consists of 'break's, so it can go. Signed-off-by: Wolfram Sang <wsa@kernel.org>
* i2c: Disable I2C_APPLE when I2C_PASEMI is a builtinBenjamin Gray2023-03-031-0/+1
| | | | | | | | | | | | | | | | | | The ppc64le_allmodconfig sets I2C_PASEMI=y and leaves COMPILE_TEST to default to y and I2C_APPLE to default to m, running into a known incompatible configuration that breaks the build [1]. Specifically, a common dependency (i2c-pasemi-core.o in this case) cannot be used by both builtin and module consumers. Disable I2C_APPLE when I2C_PASEMI is a builtin to prevent this. [1]: https://lore.kernel.org/all/202112061809.XT99aPrf-lkp@intel.com Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Sven Peter <sven@svenpeter.dev> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* Merge tag 'i2c-for-6.3-rc1' of ↵Linus Torvalds2023-02-2422-334/+1833
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: - new drivers for HPE GXP and Loongson 2K/LS7A - bigger refactorings for i801 and xiic - gpio driver gained ACPI and SDA-write only support - the core converted some OF helpers to fwnode helpers - usual bunch of driver updates * tag 'i2c-for-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (52 commits) MAINTAINERS: Add HPE GXP I2C Support i2c: Add GXP SoC I2C Controller dt-bindings: i2c: Add hpe,gxp-i2c i2c: xiic: Remove some dead code i2c: xiic: Add SCL frequency configuration support i2c: xiic: Update compatible with new IP version dt-bindings: i2c: xiic: Add 'xlnx,axi-iic-2.1' to compatible i2c: i801: Call i801_check_post() from i801_access() i2c: i801: Call i801_check_pre() from i801_access() i2c: i801: Centralize configuring block commands in i801_block_transaction i2c: i801: Centralize configuring non-block commands in i801_simple_transaction i2c: i801: Handle SMBAUXCTL_E32B in i801_block_transaction_by_block only i2c: i801: Add i801_simple_transaction(), complementing i801_block_transaction() Documentation: i2c: correct spelling dt-bindings: i2c: i2c-st: convert to DT schema i2c: i801: add helper i801_set_hstadd() i2c: i801: make FEATURE_BLOCK_PROC dependent on FEATURE_BLOCK_BUFFER i2c: i801: make FEATURE_HOST_NOTIFY dependent on FEATURE_IRQ i2c: i801: improve interrupt handler i2c: st: use pm_sleep_ptr to avoid ifdef CONFIG_PM_SLEEP ...
| * i2c: Add GXP SoC I2C ControllerNick Hawkins2023-02-173-0/+628
| | | | | | | | | | | | | | | | | | | | | | The GXP SoC supports 10 I2C engines. Each I2C engine is completely independent and can function both as an I2C master and I2C slave. The I2C master can operate in a multi master environment. The engines support a scalable speed from 8kHZ to 1.5 Mhz. Signed-off-by: Nick Hawkins <nick.hawkins@hpe.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: xiic: Remove some dead codeChristophe JAILLET2023-02-171-4/+0
| | | | | | | | | | | | | | | | wait_for_completion_timeout() never returns negative value. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: xiic: Add SCL frequency configuration supportRaviteja Narayanam2023-02-171-0/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From 'clock-frequency' device tree property, configure I2C SCL frequency by calculating the timing register values according to input clock. After soft reset in reinit function, the timing registers are set to default values (configured in design tool). So, setting SCL frequency is done inside reinit function after the soft reset. This allows configuration of SCL frequency exclusively through software via device tree property, overriding the design. If the clock-frequency parameter is not specified in DT, driver doesn't configure frequency, making it backward compatible. Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com> Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com> Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: xiic: Update compatible with new IP versionRaviteja Narayanam2023-02-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Xilinx AXI I2C IP is updated with a bug fix for dynamic mode reads. Older IPs are handled with a workaround in which they are using xiic standard mode for all these effected use cases. Add the new IP version to compatible. Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com> Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com> Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: i801: Call i801_check_post() from i801_access()Heiner Kallweit2023-02-171-11/+9
| | | | | | | | | | | | | | | | Avoid code duplication by calling i801_check_post() from i801_access(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: i801: Call i801_check_pre() from i801_access()Heiner Kallweit2023-02-171-8/+5
| | | | | | | | | | | | | | | | | | This avoids code duplication, in a next step we'll call i801_check_post() from i801_transaction() as well. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: i801: Centralize configuring block commands in i801_block_transactionHeiner Kallweit2023-02-171-49/+35
| | | | | | | | | | | | | | | | | | Similar to what was done for non-block commands, centralize block command register settings in i801_block_transaction(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: i801: Centralize configuring non-block commands in i801_simple_transactionHeiner Kallweit2023-02-171-17/+14
| | | | | | | | | | | | | | | | | | | | Currently configuring command register settings is distributed over multiple functions. At first centralize this for non-block commands in i801_simple_transaction(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: i801: Handle SMBAUXCTL_E32B in i801_block_transaction_by_block onlyHeiner Kallweit2023-02-171-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we touch SMBAUXCTL even if not needed. That's the case for block commands that don't use block buffer mode, either because block buffer mode isn't available or because it's not supported for the respective command (e.g. I2C block transfer). Improve this by setting/resetting SMBAUXCTL_E32B in i801_block_transaction_by_block() only. Small downside is that we now access SMBAUXCTL twice for transactions that use PEC and block buffer mode. But this should a rather rare case and the impact is negligible. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: i801: Add i801_simple_transaction(), complementing i801_block_transaction()Heiner Kallweit2023-02-171-37/+55
| | | | | | | | | | | | | | | | | | | | Factor out non-block pre/post processing to a new function i801_simple_transaction(), complementing existing function i801_block_transaction(). This makes i801_access() better readable. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: i801: add helper i801_set_hstadd()Heiner Kallweit2023-02-121-20/+16
| | | | | | | | | | | | | | | | | | | | Factor out setting SMBHSTADD to a helper. The current code makes the assumption that constant I2C_SMBUS_READ has bit 0 set, that's not ideal. Therefore let the new helper explicitly check for I2C_SMBUS_READ. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: i801: make FEATURE_BLOCK_PROC dependent on FEATURE_BLOCK_BUFFERHeiner Kallweit2023-02-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | According to the datasheet the block process call requires block buffer mode. The user may disable block buffer mode by module parameter disable_features, in such a case we have to clear FEATURE_BLOCK_PROC. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: i801: make FEATURE_HOST_NOTIFY dependent on FEATURE_IRQHeiner Kallweit2023-02-121-5/+9
| | | | | | | | | | | | | | | | | | | | Host notification uses an interrupt, therefore it makes sense only if interrupts are enabled. Make this dependency explicit by removing FEATURE_HOST_NOTIFY if FEATURE_IRQ isn't set. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: i801: improve interrupt handlerHeiner Kallweit2023-02-121-17/+8
| | | | | | | | | | | | | | | | | | | | | | | | Not sure if it can happen, but better play safe: If SMBHSTSTS_BYTE_DONE and an error flag is set, then don't trust the result and skip calling i801_isr_byte_done(). In addition clear status bit SMBHSTSTS_BYTE_DONE in the main interrupt handler, this allows to simplify the code a little. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: st: use pm_sleep_ptr to avoid ifdef CONFIG_PM_SLEEPAlain Volmat2023-02-121-7/+2
| | | | | | | | | | | | | | | | Rely on pm_sleep_ptr when setting the pm ops and get rid of the ifdef CONFIG_PM_SLEEP around suspend/resume functions. Signed-off-by: Alain Volmat <avolmat@me.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: xiic: Remove interrupt enable/disable in Rx pathRaviteja Narayanam2023-02-031-5/+0
| | | | | | | | | | | | | | | | | | | | | | 'DYNAMIC_MODE_READ_BROKEN_BIT' quirk added in the driver, effected IP versions no longer enter dynamic mode. So, remove local_irq_save/local_irq_restore APIs from driver. Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com> Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com> Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: xiic: Add smbus_block_read functionalityRaviteja Narayanam2023-02-031-4/+78
| | | | | | | | | | | | | | | | | | | | | | | | smbus_block_read is added to xiic driver to read from few sensors which support this command. Since the number of bytes to read is not known prior to transfer, xiic standard mode is being used for low level control of IP. Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com> Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com> Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: xiic: Add wait for FIFO empty in send_txRaviteja Narayanam2023-02-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If the tx_half_empty interrupt comes first instead of tx_empty, STOP bit is generated even before all the bytes are transmitted out on the bus. STOP bit should be sent only after all the bytes in the FIFO are transmitted out of the FIFO. So wait until FIFO is empty before sending the STOP bit. Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com> Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com> Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: xiic: Switch to Xiic standard mode for i2c-readRaviteja Narayanam2023-02-031-39/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Xilinx I2C IP has two modes of operation, both of which implement I2C transactions. The only difference from sw perspective is the programming sequence for these modes. Dynamic mode -> Simple to program, less number of steps in sequence. Standard mode -> Gives flexibility, more number of steps in sequence. In dynamic mode, during the i2c-read transactions, if there is a delay(> 200us) between the register writes (address & byte count), read transaction fails. On a system with load, this scenario is occurring frequently. To avoid this, switch to standard mode if there is a read request. Added a quirk to identify the IP version effected by this and follow the standard mode. Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com> Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com> Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: xiic: Fix Rx and Tx paths in standard modeRaviteja Narayanam2023-02-031-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | repeated start When a combined message request comes from user space, the controller has to initiate repeated start sequence. In standard mode, this repeated start sequence is corrupted if there is still data in the Tx FIFO. So, always make sure that all the bytes are completely transmitted out of the FIFO by waiting for TXEMPTY, if the previous message is of Tx type. Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com> Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com> Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: xiic: Add standard mode support for > 255 byteRaviteja Narayanam2023-02-031-41/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | read transfers Added standard mode for AXI I2C controller to enable read transfers of size more than 255 bytes. The driver selects standard mode in the following scenarios. 1. If a single message request comes from user space, requesting a read of more than 255 bytes 2. If a message set request comes from user space consisting of many messages and if any one of them is a read operation, irrespective of the size of transfer. (This is done because it is observed that repeated start operation is not happening in dynamic mode read as expected in a message set request from user space.) Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com> Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com> Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: ls2x: Add driver for Loongson-2K/LS7A I2C controllerBinbin Zhou2023-02-023-0/+382
| | | | | | | | | | | | | | | | | | This I2C module is integrated into the Loongson-2K SoCs and Loongson LS7A bridge chip. Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: designware: Change from u32 to unsigned int for regmap_read() callsShyam Sundar S K2023-01-284-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | regmap_read() API signature expects the caller to send "unsigned int" type to return back the read value, but there are some occurrences of 'u32' across i2c-designware-* files. Change them to match the regmap_read() signature. Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: designware: add a new bit check for IC_CON controlShyam Sundar S K2023-01-282-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some AMD platforms, based on the new designware datasheet, BIOS sets the BIT(11) within the IC_CON register to advertise the "bus clear feature capability". AMD/Designware datasheet says: Bit(11) BUS_CLEAR_FEATURE_CTRL. Read-write,Volatile. Reset: 0. Description: In Master mode: - 1'b1: Bus Clear Feature is enabled. - 1'b0: Bus Clear Feature is Disabled. In Slave mode, this register bit is not applicable. On AMD platform designs: 1. BIOS programs the BUS_CLEAR_FEATURE_CTRL and enables the detection of SCL/SDA stuck low. 2. Whenever the stuck low is detected, the SMU FW shall do the bus recovery procedure. Currently, the way in which the "master_cfg" is built in the driver, it overrides the BUS_CLEAR_FEATURE_CTRL advertised by BIOS and the SMU FW cannot initiate the bus recovery if the stuck low is detected. Hence add a check in i2c_dw_probe_master() that if the BIOS advertises the bus clear feature, let driver not ignore it and adapt accordingly. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: gpio: support write-only sda/scl w/o pull-upHeiner Kallweit2023-01-231-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are slave devices that understand I2C but have read-only SDA and SCL. Examples are FD650 7-segment LED controller and its derivatives. Typical board designs don't even have a pull-up for both pins. Handle the new attributes for write-only SDA and missing pull-up on SDA/SCL. For either pin the open-drain and has-no-pullup properties are mutually-exclusive, what is documented in the DT property documentation. We don't add an extra warning here because the open-drain properties are marked deprecated anyway. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> [wsa: switched to device properties] Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: algo: bit: allow getsda to be NULLHeiner Kallweit2023-01-231-42/+35
| | | | | | | | | | | | | | This is in preparation of supporting write-only SDA in i2c-gpio. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: au1550: Use devm_platform_get_and_ioremap_resource()ye xingchen2023-01-201-3/+1
| | | | | | | | | | | | | | | | | | Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: mt65xx: Use devm_platform_get_and_ioremap_resource()ye xingchen2023-01-201-5/+2
| | | | | | | | | | | | | | | | | | | | Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: bcm2835: Use devm_platform_get_and_ioremap_resource()ye xingchen2023-01-201-3/+1
| | | | | | | | | | | | | | | | | | | | Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: aspeed: Use devm_platform_get_and_ioremap_resource()ye xingchen2023-01-201-3/+1
| | | | | | | | | | | | | | | | | | | | Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: gpio: Add support on ACPI-based systemBinbin Zhou2023-01-201-13/+21
| | | | | | | | | | | | | | | | | | | | Add support for the ACPI-based device registration, so that the driver can be also enabled through ACPI table. Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Andy Shevchenko <andy@kernel.org> Tested-by: Peibao Liu <liupeibao@loongson.cn> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: cadence: Remove redundant expression in if clauseLars-Peter Clausen2023-01-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the mrecv() function the Cadence I2C driver has the following expression in an if clause. ((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) && (id->recv_count <= CDNS_I2C_FIFO_DEPTH)) Earlier in the same function when I2C_M_RECV_LEN is set the recv_count is initialized to a value that is larger than CDNS_I2C_FIFO_DEPTH. This means if the first expression is false the second expression is also false. Checking the first expression is thus redundant and can be removed. This slightly simplifies the logic. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: cadence: Remove `irq` field from driver state structLars-Peter Clausen2023-01-201-10/+7
| | | | | | | | | | | | | | | | | | | | The irq field of the driver state struct is only used in the probe function. There is no need to keep it around. Remove it from the state struct and use a on-stack variable instead. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: cadence: Remove unused CDNS_I2C_DATA_INTR_DEPTH defineLars-Peter Clausen2023-01-201-2/+0
| | | | | | | | | | | | | | | | | | The CDNS_I2C_DATA_INTR_DEPTH is not used in the Cadence I2C driver. Remove it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: Set i2c pinctrl recovery info from it's device pinctrlHanna Hawa2023-01-201-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the i2c subsystem rely on the controller device tree to initialize the pinctrl recovery information, part of the drivers does not set this field (rinfo->pinctrl), for example i2c DesignWare driver. The pins information is saved part of the device structure before probe and it's done on pinctrl_bind_pins(). Make the i2c init recovery to get the device pins if it's not initialized by the driver from the device pins. Signed-off-by: Hanna Hawa <hhhawa@amazon.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * i2c: dev: fix notifier return valuesBartosz Golaszewski2023-01-171-8/+8
| | | | | | | | | | | | | | | | | | | | We have a set of return values that notifier callbacks can return. They should not return 0, error codes or anything other than those predefined values. Make the i2c character device's callback return NOTIFY_DONE or NOTIFY_OK depending on the situation. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * Merge branch 'i2c/fwnode-api' into i2c/for-mergewindowWolfram Sang2023-01-173-78/+99
| |\
| * | i2c: qcom-geni: change i2c_master_hub to staticYang Yingliang2023-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | i2c_master_hub is only used in i2c-qcom-geni.c now, change it to static. Fixes: cacd9643eca7 ("i2c: qcom-geni: add support for I2C Master Hub variant") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Bjorn Andersson <andersson@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: designware: fix i2c_dw_clk_rate() return size to be u32Hanna Hawa2023-01-092-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make i2c_dw_clk_rate() to return u32 instead of unsigned long, as the function return the value of get_clk_rate_khz() which returns u32. Fixes: b33af11de236 ("i2c: designware: Do not require clock when SSCN and FFCN are provided") Signed-off-by: Hanna Hawa <hhhawa@amazon.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: qcom-cci: Deprecate duplicated compatiblesKonrad Dybcio2023-01-091-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Many compatibles have been introduced, pointing to the same config data. Leave a note reminding future developers to not do that again. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* | | Merge tag 'driver-core-6.3-rc1' of ↵Linus Torvalds2023-02-241-2/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg KH: "Here is the large set of driver core changes for 6.3-rc1. There's a lot of changes this development cycle, most of the work falls into two different categories: - fw_devlink fixes and updates. This has gone through numerous review cycles and lots of review and testing by lots of different devices. Hopefully all should be good now, and Saravana will be keeping a watch for any potential regression on odd embedded systems. - driver core changes to work to make struct bus_type able to be moved into read-only memory (i.e. const) The recent work with Rust has pointed out a number of areas in the driver core where we are passing around and working with structures that really do not have to be dynamic at all, and they should be able to be read-only making things safer overall. This is the contuation of that work (started last release with kobject changes) in moving struct bus_type to be constant. We didn't quite make it for this release, but the remaining patches will be finished up for the release after this one, but the groundwork has been laid for this effort. Other than that we have in here: - debugfs memory leak fixes in some subsystems - error path cleanups and fixes for some never-able-to-be-hit codepaths. - cacheinfo rework and fixes - Other tiny fixes, full details are in the shortlog All of these have been in linux-next for a while with no reported problems" [ Geert Uytterhoeven points out that that last sentence isn't true, and that there's a pending report that has a fix that is queued up - Linus ] * tag 'driver-core-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (124 commits) debugfs: drop inline constant formatting for ERR_PTR(-ERROR) OPP: fix error checking in opp_migrate_dentry() debugfs: update comment of debugfs_rename() i3c: fix device.h kernel-doc warnings dma-mapping: no need to pass a bus_type into get_arch_dma_ops() driver core: class: move EXPORT_SYMBOL_GPL() lines to the correct place Revert "driver core: add error handling for devtmpfs_create_node()" Revert "devtmpfs: add debug info to handle()" Revert "devtmpfs: remove return value of devtmpfs_delete_node()" driver core: cpu: don't hand-override the uevent bus_type callback. devtmpfs: remove return value of devtmpfs_delete_node() devtmpfs: add debug info to handle() driver core: add error handling for devtmpfs_create_node() driver core: bus: update my copyright notice driver core: bus: add bus_get_dev_root() function driver core: bus: constify bus_unregister() driver core: bus: constify some internal functions driver core: bus: constify bus_get_kset() driver core: bus: constify bus_register/unregister_notifier() driver core: remove private pointer from struct bus_type ...