25 Sep, 2019
1 commit
-
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
...
14 Aug, 2019
1 commit
-
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
Reviewed-by: Kieran Bingham # adv748x
Reviewed-by: Laurent Pinchart # adv7511 + adv7604
Reviewed-by: Hans Verkuil # adv7604
Signed-off-by: Wolfram Sang
01 Aug, 2019
1 commit
-
Convert each file at I2C subsystem, renaming them to .rst and
adding to the driver-api book.Signed-off-by: Mauro Carvalho Chehab
Acked-by: Wolfram Sang
Acked-by: Alexandre Belloni
Acked-by: Jonathan Cameron
Signed-off-by: Jonathan Corbet
26 Jun, 2019
1 commit
-
Nobody (including me) noticed that these functions were exported but not
added to the header :/Fixes: 7159dbdae3c5 ("i2c: core: improve return value handling of i2c_new_device and i2c_new_dummy")
Signed-off-by: Wolfram Sang
Reviewed-by: Bartosz Golaszewski
Reviewed-by: Kieran Bingham
Signed-off-by: Wolfram Sang
15 Jun, 2019
4 commits
-
Let's stick to coding style.
Signed-off-by: Wolfram Sang
-
Update kerneldoc for i2c client flags because they increased over time.
Also, move them to a position where they can be more easily found.Signed-off-by: Wolfram Sang
-
Much better to read and understand. Naming for i2c_adapter is not
consistent (yet), so use the name which is also used in core code.Signed-off-by: Wolfram Sang
-
It is not a struct device, so 'dev' is confusing. Use 'adap', the most
common name.Signed-off-by: Wolfram Sang
03 Jun, 2019
1 commit
-
This allows drivers to lookup i2c adapters on ACPI based systems similar to
of_get_i2c_adapter_by_node() with DT based systems.Signed-off-by: Ruslan Babayev
Reviewed-by: Andrew Lunn
Signed-off-by: Wolfram Sang
21 May, 2019
1 commit
-
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 as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
51 franklin street fifth floor boston ma 02110 1301 usathis program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option [no]_[pad]_[ctrl] any later version this program is
distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details you should have received a copy of the gnu general
public license along with this program if not write to the free
software foundation inc 51 franklin street fifth floor boston ma
02110 1301 usaextracted by the scancode license scanner the SPDX license identifier
GPL-2.0-or-later
has been chosen to replace the boilerplate/reference in 176 file(s).
Signed-off-by: Thomas Gleixner
Reviewed-by: Jilayne Lovejoy
Reviewed-by: Steve Winslow
Reviewed-by: Allison Randal
Reviewed-by: Kate Stewart
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190519154040.652910950@linutronix.de
Signed-off-by: Greg Kroah-Hartman
18 May, 2019
1 commit
-
i2c_new_dummy is typically called from the probe function of the
driver for the primary i2c client. It requires calls to
i2c_unregister_device in the error path of the probe function and
in the remove function.
This can be simplified by introducing a device-managed version.Note the changed error case return value type: i2c_new_dummy returns
NULL whilst devm_i2c_new_dummy_device returns an ERR_PTR.Signed-off-by: Heiner Kallweit
[wsa: rename new functions and fix minor kdoc issues]
Signed-off-by: Wolfram Sang
Reviewed-by: Peter Rosin
Reviewed-by: Kieran Bingham
Reviewed-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang
03 May, 2019
1 commit
-
There are two problems with WARN_ON() here. One: It is not ratelimited.
Two: We don't see which adapter was used when trying to transfer
something when already suspended. Implement a custom ratelimit once per
adapter and use dev_WARN there. This fixes both issues. Drawback is that
we don't see if multiple drivers are trying to transfer with the same
adapter while suspended. They need to be discovered one after the other
now. This is better than a high CPU load because a really broken driver
might try to resend endlessly.Fixes: 9ac6cb5fbb17 ("i2c: add suspended flag and accessors for i2c adapters")
Signed-off-by: Wolfram Sang
Reviewed-by: Simon Horman
Signed-off-by: Wolfram Sang
Cc: stable@vger.kernel.org # v5.1+
16 Apr, 2019
1 commit
-
We had the request to access devices very late when interrupts are not
available anymore multiple times now. Mostly to prepare shutdown or
reboot. Allow adapters to specify a specific callback for this case.
Note that we fall back to the generic {master|smbus}_xfer callback if
this new atomic one is not present. This is intentional to preserve the
previous behaviour and avoid regressions. Because there are drivers not
using interrupts or because it might have worked "accidently" before.Signed-off-by: Wolfram Sang
Reviewed-by Andy Shevchenko
Tested-by: Stefan Lengfeld
Signed-off-by: Wolfram Sang
27 Mar, 2019
1 commit
-
Signed-off-by: Wolfram Sang
Reviewed-by: Simon Horman
Reviewed-by: Andy Shevchenko
Signed-off-by: Wolfram Sang
24 Feb, 2019
1 commit
-
A previous change allowed I2C client devices to discover new IRQs upon
reprobe by clearing the IRQ in i2c_device_remove. However, if an IRQ was
assigned in i2c_new_device, that information is lost.For example, the touchscreen and trackpad devices on a Dell Inspiron laptop
are I2C devices whose IRQs are defined by ACPI extended IRQ types. The
client device structures are initialized during an ACPI walk. After
removing the i2c_hid device, modprobe fails.This change caches the initial IRQ value in i2c_new_device and then resets
the client device IRQ to the initial value in i2c_device_remove.Fixes: 6f108dd70d30 ("i2c: Clear client->irq in i2c_device_remove")
Signed-off-by: Jim Broadus
Reviewed-by: Benjamin Tissoires
Reviewed-by: Charles Keepax
[wsa: this is an easy to backport fix for the regression. We will
refactor the code to handle irq assignments better in general.]
Signed-off-by: Wolfram Sang
16 Jan, 2019
1 commit
-
As discussed previously the best location for certain bus related bits,
e.g. I2C, is its own realm of the headers.In order to uncontaminate acpi.h move the I2C bits to i2c.h.
There is no functional change intended.
Link: https://lkml.org/lkml/2018/11/28/744
Signed-off-by: Andy Shevchenko
Acked-by: Mika Westerberg
Acked-by: Rafael J. Wysocki
Signed-off-by: Wolfram Sang
09 Jan, 2019
1 commit
-
A few drivers open code the handling of suspended adapters. It could be
handled by the core, though, to ensure generic handling. This patch adds
the flag and accessor functions. The usage of these helpers is optional,
though. See the kerneldoc in this patch. Using the new flag, we now
reject further transfers if the adapter is already marked suspended.Signed-off-by: Wolfram Sang
Signed-off-by: Wolfram Sang
31 Aug, 2018
1 commit
-
a) rename to 'put' instead of 'release' to match 'get' when obtaining
the buffer
b) change the argument order to have the buffer as first argument
c) add a new argument telling the function if the message was
transferred. This allows the function to be used also in cases
where setting up DMA failed, so the buffer needs to be freed without
syncing to the message buffer.Also convert the only user.
Signed-off-by: Wolfram Sang
Reviewed-by: Niklas Söderlund
Signed-off-by: Wolfram Sang
24 Aug, 2018
1 commit
-
There aren't any users left. Remove this callback from the 2.4 times.
Phew, finally, that took years to reach...Signed-off-by: Wolfram Sang
09 Aug, 2018
1 commit
-
There are two drivers already using the SDA hold time setting.
It might be more in the future, thus, make I2C core to parse the setting
for us if provided by firmware.Signed-off-by: Andy Shevchenko
Tested-by: Alexandre Belloni
Reviewed-by: Alexandre Belloni
Acked-by: Ludovic Desroches
Signed-off-by: Wolfram Sang
05 Aug, 2018
1 commit
-
Some adapters do not support a message length of 0. Add this as a quirk
so drivers don't have to open code it.Signed-off-by: Wolfram Sang
Reviewed-by: Niklas Söderlund
Reviewed-by: Andy Shevchenko
Tested-by: Jarkko Nikula
Acked-by: Jarkko Nikula
Signed-off-by: Wolfram Sang
17 Jul, 2018
2 commits
-
Some IP cores have an internal 'bus free' logic which may be more
advanced than just checking if SDA is high. Add a separate callback to
get this status. Filling it is optional.Signed-off-by: Wolfram Sang
Signed-off-by: Wolfram Sang -
For bus recovery, we either need to bail out early if we can read SDA or
we need to send STOP after every pulse. Otherwise recovery might be
misinterpreted as an unwanted write. So, require one of those SDA
handling functions to avoid this problem.Signed-off-by: Wolfram Sang
Acked-by: Peter Rosin
Signed-off-by: Wolfram Sang
13 Jul, 2018
2 commits
-
The i2c_lock_adapter name is ambiguous since it is unclear if it
refers to the root adapter or the adapter you name in the argument.
The natural interpretation is the adapter you name in the argument,
but there are historical reasons for that not being the case; it
in fact locks the root adapter. Just remove the function and force
users to spell out the I2C_LOCK_ROOT_ADAPTER name to indicate what
is really going on. Also remove i2c_unlock_adapter, of course.This patch was generated with
git grep -l 'i2c_\(un\)\?lock_adapter' \
| xargs sed -i 's/i2c_\(un\)\?lock_adapter(\([^)]*\))/'\
'i2c_\1lock_bus(\2, I2C_LOCK_ROOT_ADAPTER)/g'followed by white-space touch-up.
Signed-off-by: Peter Rosin
Acked-by: Jonathan Cameron
Tested-by: Sekhar Nori
Signed-off-by: Wolfram Sang
04 Jul, 2018
1 commit
-
Removes all locking from i2c_smbus_xfer and renames it to __i2c_smbus_xfer,
then adds a new i2c_smbus_xfer function that simply grabs the lock while
calling the unlocked variant.This is not perfectly equivalent, since i2c_smbus_xfer was callable from
atomic/irq context if you happened to end up emulating SMBus with an I2C
transfer, and that is no longer the case with this patch. It is unknown
(to me) if anything depends on that quirk, but it seems fragile enough to
simply break those cases and require them to call i2c_transfer directly
instead.While at it, for consistency rename the 2nd to last argument (size) of
the i2c_smbus_xfer declaration to protocol and remove the surplus extern
marker.Signed-off-by: Peter Rosin
Signed-off-by: Wolfram Sang
22 May, 2018
1 commit
-
I3C busses have to know about all I2C devices connected on the I3C bus
to properly initialize the I3C master, and I2C frames can't be sent on
the bus until this initialization is done.We can't let the I2C core parse the DT and instantiate I2C devices as
part of its i2c_add_adapter() procedure because, when done this way,
I2C devices are directly registered to the device-model and might be
attached to drivers which could in turn start sending frames on the bus,
which won't work since, as said above, the bus is not yet initialized.Export of_i2c_register_device() in order to let the I3C core parse the
I2C device nodes by itself and initialize the bus.Signed-off-by: Boris Brezillon
Signed-off-by: Wolfram Sang
15 May, 2018
1 commit
-
The only user of i2c_board_info->archdata is the OF parsing code and it
just pass a zero-initialized object which has the same effect as leaving
->archdata to NULL since the client object is allocated with kzalloc().Get rid of this useless field.
Signed-off-by: Boris Brezillon
Signed-off-by: Wolfram Sang
06 Mar, 2018
1 commit
-
Can be used during probe to double check that the probed device is
what is expected.Loosely based on code from Adrian Fiergolski .
Tested-by: Adrian Fiergolski
Reviewed-by: Wolfram Sang
Signed-off-by: Peter Rosin
16 Jan, 2018
3 commits
-
This will be needed when we want to create STOP conditions, too, later.
Create the needed fields and populate them for the GPIO case if the GPIO
is set to output.Tested-by: Phil Reid
Signed-off-by: Wolfram Sang
Reviewed-by: Linus Walleij
Signed-off-by: Wolfram Sang -
No reason to have them undefined, so let's add them.
Tested-by: Phil Reid
Signed-off-by: Wolfram Sang
Signed-off-by: Wolfram Sang -
"Used internally" is vague. What it actually means is that those fields
are populated by the core if valid GPIOs are provided. Change the
comments to reflect that.Tested-by: Phil Reid
Signed-off-by: Wolfram Sang
Signed-off-by: Wolfram Sang
04 Dec, 2017
3 commits
-
Use the new helper to create variants of i2c_master_{send|recv} which
mark their buffers as DMA safe.Signed-off-by: Wolfram Sang
Acked-by: Jonathan Cameron
Signed-off-by: Wolfram Sang -
Those two functions are very similar, the only differences are that one
needs the I2C_M_RD flag for its message while the other one needs the
buffer casted to drop the const. Introduce a generic helper which allows
to specify the flags (also needed later for DMA safe variants of these
calls) and let the casting be done in the inlining functions which are
now calling the new helper function.Signed-off-by: Wolfram Sang
Reviewed-by: Jonathan Cameron
Signed-off-by: Wolfram Sang -
One helper checks if DMA is suitable and optionally creates a bounce
buffer, if not. The other function returns the bounce buffer and makes
sure the data is properly copied back to the message.Reviewed-by: Jonathan Cameron
Signed-off-by: Wolfram Sang
Signed-off-by: Wolfram Sang
28 Nov, 2017
3 commits
-
Remove all reference to code related to using integer based ids for
scl/sda gpio for bus recovery. All in tree drivers are now using the
gpio descriptors to specific the required gpios.Reviewed-by: Andy Shevchenko
Signed-off-by: Phil Reid
Reviewed-by: Jarkko Nikula
Signed-off-by: Wolfram Sang -
Currently the i2c gpio recovery code uses gpio integer interface
instead of the gpiod. This change switch the core code to use
the gpiod while still retaining compatibility with the gpio integer
interface. This will allow individual driver to be updated and tested
individual to switch to using the gpiod interface.Reviewed-by: Jarkko Nikula
Reviewed-by: Andy Shevchenko
Signed-off-by: Phil Reid
Signed-off-by: Wolfram Sang -
Using the macro IS_ENABLED to check the option CONFIG_I2C=(y|m) makes
the code nicer. No functional change.Signed-off-by: Stefan Lengfeld
Signed-off-by: Wolfram Sang
27 Oct, 2017
1 commit
-
For devices not instantiated through ACPI the i2c-client's device-name
gets set to - by default, e.g. "0-0022" this means that
the device-name is dependent on the order in which the i2c-busses are
enumerated.In some cases having a predictable constant device-name is desirable,
for example on non device-tree platforms the link between a regulator
and its consumers is specified by the platform code by setting
regulator_init_data.consumers. This array identifies the regulator's
consumers by dev_name and supply(-name). Which requires a constant
dev_name.This commit adds a dev_name field to i2c_board_info allowing
platform code to set a contstant dev_name so that the device can
be identified by its dev_name in other platform code.Signed-off-by: Hans de Goede
Acked-by: Mark Brown (live at ELCE17)
Acked-by: Andy Shevchenko (live at ELCE17)
Signed-off-by: Wolfram Sang
31 Jul, 2017
1 commit
-
Hopefully making clear that it is not needed for new drivers.
Signed-off-by: Wolfram Sang