aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-04-15i2c: mpc: Update license and copyrightChris Packham1-8/+3
Use SPDX-License-Identifier and add copyright for Allied Telesis because of the reasonably large rewrite in the preceding patch. Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-15i2c: mpc: Interrupt driven transferChris Packham1-187/+239
The fsl-i2c controller will generate an interrupt after every byte transferred. Make use of this interrupt to drive a state machine which allows the next part of a transfer to happen as soon as the interrupt is received. This is particularly helpful with SMBUS devices like the LM81 which will timeout if we take too long between bytes in a transfer. Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: sh7760: add IRQ checkSergey Shtylyov1-1/+4
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s. Fixes: a26c20b1fa6d ("i2c: Renesas SH7760 I2C master driver") Signed-off-by: Sergey Shtylyov <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: rcar: add IRQ checkSergey Shtylyov1-1/+4
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: 6ccbe607132b ("i2c: add Renesas R-Car I2C driver") Signed-off-by: Sergey Shtylyov <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: mlxbf: add IRQ checkSergey Shtylyov1-0/+2
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s. Fixes: b5b5b32081cd ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC") Signed-off-by: Sergey Shtylyov <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: jz4780: add IRQ checkSergey Shtylyov1-1/+4
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s. Fixes: ba92222ed63a ("i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780") Signed-off-by: Sergey Shtylyov <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: emev2: add IRQ checkSergey Shtylyov1-1/+4
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s. Fixes: 5faf6e1f58b4 ("i2c: emev2: add driver") Signed-off-by: Sergey Shtylyov <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: cadence: add IRQ checkSergey Shtylyov1-1/+4
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s. Fixes: df8eb5691c48 ("i2c: Add driver for Cadence I2C controller") Signed-off-by: Sergey Shtylyov <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: imx: Fix PM reference leak in i2c_imx_reg_slave()Ye Weihua1-1/+1
pm_runtime_get_sync() will increment the PM reference count even on failure. Forgetting to put the reference again will result in a leak. Replace it with pm_runtime_resume_and_get() to keep the usage counter balanced. Reported-by: Hulk Robot <[email protected]> Signed-off-by: Ye Weihua <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: xiic: fix reference leak when pm_runtime_get_sync failsQinglang Miao1-2/+2
The PM reference count is not expected to be incremented on return in xiic_xfer and xiic_i2c_remove. However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here. Replace it with pm_runtime_resume_and_get to keep usage counter balanced. Fixes: 10b17004a74c ("i2c: xiic: Fix the clocking across bind unbind") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Qinglang Miao <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: stm32f7: fix reference leak when pm_runtime_get_sync failsQinglang Miao1-6/+6
The PM reference count is not expected to be incremented on return in these stm32f7_i2c_xx serious functions. However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here. Replace it with pm_runtime_resume_and_get to keep usage counter balanced. Fixes: ea6dd25deeb5 ("i2c: stm32f7: add PM_SLEEP suspend/resume support") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Qinglang Miao <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: sprd: fix reference leak when pm_runtime_get_sync failsQinglang Miao1-2/+2
The PM reference count is not expected to be incremented on return in sprd_i2c_master_xfer() and sprd_i2c_remove(). However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here. Replace it with pm_runtime_resume_and_get to keep usage counter balanced. Fixes: 8b9ec0719834 ("i2c: Add Spreadtrum I2C controller driver") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Qinglang Miao <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: omap: fix reference leak when pm_runtime_get_sync failsQinglang Miao1-4/+4
The PM reference count is not expected to be incremented on return in omap_i2c_probe() and omap_i2c_remove(). However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here. I Replace it with pm_runtime_resume_and_get to keep usage counter balanced. What's more, error path 'err_free_mem' seems not like a proper name any more. So I change the name to err_disable_pm and move pm_runtime_disable below, for pm_runtime of 'pdev->dev' should be disabled when pm_runtime_resume_and_get fails. Fixes: 3b0fb97c8dc4 ("I2C: OMAP: Handle error check for pm runtime") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Qinglang Miao <[email protected]> Reviewed-by: Grygorii Strashko <[email protected]> Reviewed-by: Vignesh Raghavendra <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: imx: fix reference leak when pm_runtime_get_sync failsQinglang Miao1-2/+2
In i2c_imx_xfer() and i2c_imx_remove(), the pm reference count is not expected to be incremented on return. However, pm_runtime_get_sync will increment pm reference count even failed. Forgetting to putting operation will result in a reference leak here. Replace it with pm_runtime_resume_and_get to keep usage counter balanced. Fixes: 3a5ee18d2a32 ("i2c: imx: implement master_xfer_atomic callback") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Qinglang Miao <[email protected]> Reviewed-by: Oleksij Rempel <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: imx-lpi2c: fix reference leak when pm_runtime_get_sync failsQinglang Miao1-1/+1
The PM reference count is not expected to be incremented on return in lpi2c_imx_master_enable. However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here. Replace it with pm_runtime_resume_and_get to keep usage counter balanced. Fixes: 13d6eb20fc79 ("i2c: imx-lpi2c: add runtime pm support") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Qinglang Miao <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: img-scb: fix reference leak when pm_runtime_get_sync failsQinglang Miao1-2/+2
The PM reference count is not expected to be incremented on return in functions img_i2c_xfer and img_i2c_init. However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here. Replace it with pm_runtime_resume_and_get to keep usage counter balanced. Fixes: 93222bd9b966 ("i2c: img-scb: Add runtime PM") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Qinglang Miao <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-14i2c: cadence: fix reference leak when pm_runtime_get_sync failsQinglang Miao1-2/+2
The PM reference count is not expected to be incremented on return in functions cdns_i2c_master_xfer and cdns_reg_slave. However, pm_runtime_get_sync will increment pm usage counter even failed. Forgetting to putting operation will result in a reference leak here. Replace it with pm_runtime_resume_and_get to keep usage counter balanced. Fixes: 7fa32329ca03 ("i2c: cadence: Move to sensible power management") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Qinglang Miao <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-13i2c: sprd: Add missing MODULE_DEVICE_TABLEBixuan Cui1-0/+1
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module. Reported-by: Hulk Robot <[email protected]> Signed-off-by: Bixuan Cui <[email protected]> Reviewed-by: Baolin Wang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-13MAINTAINERS: Add Chris Packham as FREESCALE MPC I2C maintainerChris Packham1-0/+7
Add Chris Packham as FREESCALE MPC I2C maintainer. Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-13i2c: mpc: Remove redundant NULL checkChris Packham1-1/+1
In mpc_i2c_get_fdr_8xxx div is assigned as we iterate through the mpc_i2c_dividers_8xxx array. By the time we exit the loop div will either have the value that matches the requested speed or be pointing at the last entry in mpc_i2c_dividers_8xxx. Checking for div being NULL after the loop is redundant so remove the check. Reported-by: Wolfram Sang <[email protected]> Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-13i2c: mpc: drop release for resource allocated with devm_*Wei Yongjun1-6/+0
It's not necessary to release resource which allocated with devm_* and those release may leads to a double free. And also remove useless irq_dispose_mapping() call since mapping not created. Fixes: 09aab7add7bf ("i2c: mpc: use device managed APIs") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Wei Yongjun <[email protected]> Reviewed-by: Chris Packham <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: mpc: use device managed APIsChris Packham1-28/+18
Use device managed functions an clean up error handling. Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: mpc: make interrupt mandatory and remove polling codeChris Packham1-32/+19
All the in-tree dts files that use one of the compatible strings from i2c-mpc.c provide an interrupt property. By making this mandatory we can simplify the code. Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: mpc: Make use of i2c_recover_bus()Chris Packham1-2/+16
Move the existing calls of mpc_i2c_fixup() to a recovery function registered via bus_recovery_info. This makes it more obvious that recovery is supported and allows for a future where recovery is triggered by the i2c core. Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10dt-bindings: i2c: convert i2c-mpc to json-schemaChris Packham2-62/+91
Convert i2c-mpc to YAML. Signed-off-by: Chris Packham <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10dt-bindings: i2c-mpc: Document interrupt property as requiredChris Packham1-3/+3
All of the in-tree device-trees that use the one of the compatible strings from i2c-mpc.c supply an interrupts property. Make this property mandatory to aid refactoring the driver. Signed-off-by: Chris Packham <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: ensure timely release of driver-allocated resourcesDmitry Torokhov2-1/+23
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: designware: Switch over to i2c_freq_mode_string()Andy Shevchenko1-16/+4
Use generic i2c_freq_mode_string() helper to print chosen bus speed. Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Yicong Yang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: add support for HiSilicon I2C controllerYicong Yang4-0/+522
Add HiSilicon I2C controller driver for the Kunpeng SoC. It provides the access to the i2c busses, which connects to the eeprom, rtc, etc. The driver works with IRQ mode, and supports basic I2C features and 10bit address. The DMA is not supported. 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-10i2c: core: add api to provide frequency mode stringsYicong Yang2-0/+24
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 Yang2-0/+27
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 Sang902-3999/+7120
2021-04-10i2c: Remove support for dangling device propertiesHeikki Krogerus3-27/+1
From now on only accepting complete software nodes. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10Input: elantech - Prepare a complete software node for the deviceHeikki Krogerus1-2/+4
Creating a software node and supplying that for the device instead of only the device properties in it. A software node was always created in any case to hold the additional device properties, so this change does not have any real effect. This change makes it possible to remove support for the problematic "dangling" device properties from i2c subsystem, i.e. the "properties" member from struct i2c_board_info. The problems caused by them are not related to this driver. Signed-off-by: Heikki Krogerus <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10platform/chrome: chromeos_laptop - Prepare complete software nodesHeikki Krogerus1-40/+60
The older device property API is going to be removed soon and that will affect also I2C subystem. Supplying complete software nodes instead of only the properties in them for the I2C devices. Signed-off-by: Heikki Krogerus <[email protected]> Acked-by: Enric Balletbo i Serra <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: icy: Constify the software nodeHeikki Krogerus1-23/+9
Complete software node can now be supplied to the device with struct i2c_board_info. Signed-off-by: Heikki Krogerus <[email protected]> Reviewed-by: Max Staudt <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: nvidia-gpu: Constify the software nodeHeikki Krogerus1-1/+5
Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10i2c: cht-wc: Constify the software nodeHeikki Krogerus1-1/+5
Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10platform/x86: intel_cht_int33fe_microb: Constify the software nodeHeikki Krogerus1-1/+5
Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10ARM: s3c: mini2440: Constify the software nodeHeikki Krogerus1-1/+5
Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-10ARM: pxa: stargate2: Constify the software nodeHeikki Krogerus1-1/+5
Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus <[email protected]> Acked-by: Robert Jarzmik <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-08ARM: omap1: osk: Constify the software nodeHeikki Krogerus1-1/+5
Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus <[email protected]> Acked-by: Tony Lindgren <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-08ARM: davinci: Constify the software nodesHeikki Krogerus6-6/+30
Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus <[email protected]> Acked-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-08i2c: Add support for software nodesHeikki Krogerus2-2/+17
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-08i2c: remove unused 'version.h' include in driversTian Tao2-2/+0
Signed-off-by: Tian Tao <[email protected]> Signed-off-by: Zhiqi Song <[email protected]> Acked-by: Florian Fainelli <[email protected]> # for brcmstb Signed-off-by: Wolfram Sang <[email protected]>
2021-04-08i2c: core: simplify devm_i2c_new_dummy_device()Yicong Yang1-19/+9
Use devm_add_action_or_reset() instead of devres_alloc() and devres_add(), which works the same. This will simplify the code. There is no functional change. Signed-off-by: Yicong Yang <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-08i2c: designware: Fix return value check in navi_amd_register_client()Wei Yongjun1-2/+2
In case of error, the function i2c_new_client_device() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 17631e8ca2d3 ("i2c: designware: Add driver support for AMD NAVI GPU") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Wei Yongjun <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-06i2c: stm32f7: avoid ifdef CONFIG_PM_SLEEP for pm callbacksAlain Volmat1-6/+4
Avoid CONFIG_PM preprocessor check for pm suspend/resume callbacks and identify the functions with __maybe_unused. Signed-off-by: Alain Volmat <[email protected]> Reviewed-by: Pierre-Yves MORDRET <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-05i2c: tegra-bpmp: make some functions voidWolfram Sang1-16/+4
They return 0 always, so save some lines and code. Signed-off-by: Wolfram Sang <[email protected]> Acked-by: Thierry Reding <[email protected]> Tested-by: Thierry Reding <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-04-05i2c: tegra-bpmp: don't modify input variable in xlate_flagsWolfram Sang1-24/+8
Since commit bc1c2048abbe ("i2c: bpmp-tegra: Ignore unknown I2C_M flags") we don't need to mask out flags and can keep the input variable as is to save quite some lines. Signed-off-by: Wolfram Sang <[email protected]> Acked-by: Thierry Reding <[email protected]> Tested-by: Thierry Reding <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>