24 Sep, 2016

1 commit

  • For crazy setups in which an i2c gpio expander is behind an i2c gpio
    multiplexer controlled by a gpio provided a second expander using the
    same device driver we need to explicitly tell lockdep how to handle
    nested locking.

    Export i2c_adapter_depth() as public API to be reused outside of i2c
    core code.

    Signed-off-by: Bartosz Golaszewski
    Acked-by: Peter Rosin
    Acked-by: Peter Zijlstra (Intel)
    Signed-off-by: Wolfram Sang

    Bartosz Golaszewski
     

31 Aug, 2016

1 commit


26 Aug, 2016

2 commits

  • ACPI 5 specification doesn't have property for the I2C bus speed but
    I2cSerialBus resource descriptor which define each controller-slave
    connection define the maximum speed supported by that connection.

    Thus finding the maximum safe speed for the bus is to walk through all
    I2cSerialBus resources that are associated to I2C controller and use the
    speed of slowest connection.

    Add function i2c_acpi_find_bus_speed() to the i2c-core that adapter
    drivers can call prior registering itself to core.

    This implies two-step walk through the I2cSerialBus resources: call to
    i2c_acpi_find_bus_speed() does the first scan and finds the safe bus
    speed that adapter drivers can set up. Adapter driver registration does
    the second scan when i2c-core creates the I2C slaves by calling the
    i2c_acpi_register_devices(). In that way the bus speed is set in case
    slave device probe gets called during registration and does communication.

    Previous version commit 55d38d060e99 ("i2c: core: Add function for finding
    the bus speed from ACPI") got reverted due merge conflicts from
    commit 525e6fabeae2 ("i2c / ACPI: add support for ACPI reconfigure
    notifications").

    This version is a bit bigger than previous version but is still sharing
    the lowest and complicated part of I2cSerialBus lookup routines with the
    existing code.

    Signed-off-by: Jarkko Nikula
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Wolfram Sang

    Jarkko Nikula
     
  • This unifies usage with i2c_lock_bus and i2c_unlock_bus, and paves the
    way for the next patch which looks a bit saner with this preparatory
    work taken care of beforehand.

    Signed-off-by: Peter Rosin
    Signed-off-by: Wolfram Sang

    Peter Rosin
     

19 Jul, 2016

1 commit


14 Jul, 2016

1 commit

  • ACPI 5 specification doesn't have property for the I2C bus speed but
    I2cSerialBus resource descriptors which define each controller-slave
    connection define the maximum speed supported by that connection.

    Thus finding the maximum safe speed for the bus is to walk all
    I2cSerialBus resources that are associated to I2C controller and use
    the speed of slowest connection.

    Add function i2c_acpi_find_bus_speed() to the i2c-core that adapter
    drivers can call prior registering itself to core.

    This implies two-step walk through the I2cSerialBus resources: call to
    i2c_acpi_find_bus_speed() does the first scan and finds the safe bus
    speed that adapter drivers can set up. Adapter driver registration does
    the second scan when i2c-core creates the I2C slaves by calling the
    i2c_acpi_register_devices(). In that way the bus speed is set in case
    slave device probe gets called during registration and does
    communication.

    Implement this by reusing the existing ACPI I2C walk routines in the
    i2c-core. Extend them so that slowest connection speed is saved during
    the walk and I2C slaves are registered only when calling through the
    i2c_acpi_register_devices() with the i2c_adapter pointer.

    Signed-off-by: Jarkko Nikula
    Reviewed-by: Andy Shevchenko
    Acked-by: Mika Westerberg
    Signed-off-by: Wolfram Sang

    Jarkko Nikula
     

17 Jun, 2016

2 commits

  • SMBus Host Notify allows a slave device to act as a master on a bus to
    notify the host of an interrupt. On Intel chipsets, the functionality
    is directly implemented in the firmware. We just need to export a
    function to call .alert() on the proper device driver.

    i2c_handle_smbus_host_notify() behaves like i2c_handle_smbus_alert().
    When called, it schedules a task that will be able to sleep to go through
    the list of devices attached to the adapter.

    The current implementation allows one Host Notification to be scheduled
    while an other is running.

    Tested-by: Andrew Duggan
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Wolfram Sang

    Benjamin Tissoires
     
  • .alert() is meant to be generic, but there is currently no way
    for the device driver to know which protocol generated the alert.
    Add a parameter in .alert() to help the device driver to understand
    what is given in data.

    This patch is required to have the support of SMBus Host Notify protocol
    through .alert().

    Tested-by: Andrew Duggan
    For hwmon:
    Acked-by: Guenter Roeck
    For IPMI:
    Acked-by: Corey Minyard
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Wolfram Sang

    Benjamin Tissoires
     

14 Jun, 2016

1 commit

  • Some I2C devices have multiple addresses assigned, for example each address
    corresponding to a different internal register map page of the device.
    So far drivers which need support for this have handled this with a driver
    specific and non-generic implementation, e.g. passing the additional address
    via platform data.

    This patch provides a new helper function called i2c_new_secondary_device()
    which is intended to provide a generic way to get the secondary address
    as well as instantiate a struct i2c_client for the secondary address.

    The function expects a pointer to the primary i2c_client, a name
    for the secondary address and an optional default address. The name is used
    as a handle to specify which secondary address to get.

    The default address is used as a fallback in case no secondary address
    was explicitly specified. In case no secondary address and no default
    address were specified the function returns NULL.

    For now the function only supports look-up of the secondary address
    from devicetree, but it can be extended in the future
    to for example support board files and/or ACPI.

    Signed-off-by: Jean-Michel Hautbois
    Acked-by: Rob Herring
    Acked-by: Mika Westerberg
    Signed-off-by: Wolfram Sang

    Jean-Michel Hautbois
     

05 May, 2016

2 commits

  • With a i2c topology like the following

    GPIO ---| ------ BAT1
    | v /
    I2C -----+----------+---- MUX
    | \
    EEPROM ------ BAT2

    there is a locking problem with the GPIO controller since it is a client
    on the same i2c bus that it muxes. Transfers to the mux clients (e.g. BAT1)
    will lock the whole i2c bus prior to attempting to switch the mux to the
    correct i2c segment. In the above case, the GPIO device is an I/O expander
    with an i2c interface, and since the GPIO subsystem knows nothing (and
    rightfully so) about the lockless needs of the i2c mux code, this results
    in a deadlock when the GPIO driver issues i2c transfers to modify the
    mux.

    So, observing that while it is needed to have the i2c bus locked during the
    actual MUX update in order to avoid random garbage on the slave side, it
    is not strictly a must to have it locked over the whole sequence of a full
    select-transfer-deselect mux client operation. The mux itself needs to be
    locked, so transfers to clients behind the mux are serialized, and the mux
    needs to be stable during all i2c traffic (otherwise individual mux slave
    segments might see garbage, or worse).

    Introduce this new locking concept as "mux-locked" muxes, and call the
    pre-existing mux locking scheme "parent-locked".

    Modify the i2c mux locking so that muxes that are "mux-locked" locks only
    the muxes on the parent adapter instead of the whole i2c bus when there is
    a transfer to the slave side of the mux. This lock serializes transfers to
    the slave side of the muxes on the parent adapter.

    Add code to i2c-mux-gpio and i2c-mux-pinctrl that checks if all involved
    gpio/pinctrl devices have a parent that is an i2c adapter in the same
    adapter tree that is muxed, and request a "mux-locked mux" if that is the
    case.

    Modify the select-transfer-deselect code for "mux-locked" muxes so
    that each of the select-transfer-deselect ops locks the mux parent
    adapter individually.

    Signed-off-by: Peter Rosin
    Signed-off-by: Wolfram Sang

    Peter Rosin
     
  • Add i2c_lock_bus() and i2c_unlock_bus(), which call the new lock_bus and
    unlock_bus ops in the adapter. These funcs/ops take an additional flags
    argument that indicates for what purpose the adapter is locked.

    There are two flags, I2C_LOCK_ROOT_ADAPTER and I2C_LOCK_SEGMENT, but they
    are both implemented the same. For now. Locking the root adapter means
    that the whole bus is locked, locking the segment means that only the
    current bus segment is locked (i.e. i2c traffic on the parent side of
    a mux is still allowed even if the child side of the mux is locked).

    Also support a trylock_bus op (but no function to call it, as it is not
    expected to be needed outside of the i2c core).

    Implement i2c_lock_adapter/i2c_unlock_adapter in terms of the new locking
    scheme (i.e. lock with the I2C_LOCK_ROOT_ADAPTER flag).

    Locking the root adapter and locking the segment is the same thing for
    all root adapters (e.g. in the normal case of a simple topology with no
    i2c muxes). The two locking variants are also the same for traditional
    muxes (aka parent-locked muxes). These muxes traverse the tree, locking
    each level as they go until they reach the root. This patch is preparatory
    for a later patch in the series introducing mux-locked muxes, which behave
    differently depending on the requested locking. Since all current users
    are using i2c_lock_adapter, which is a wrapper for I2C_LOCK_ROOT_ADAPTER,
    we only need to annotate the calls that will not need to lock the root
    adapter for mux-locked muxes. I.e. the instances that needs to use
    I2C_LOCK_SEGMENT instead of i2c_lock_adapter/I2C_LOCK_ROOT_ADAPTER. Those
    instances are in the i2c_transfer and i2c_smbus_xfer functions, so that
    mux-locked muxes can single out normal i2c accesses to its slave side
    and adjust the locking for those accesses.

    Signed-off-by: Peter Rosin
    Signed-off-by: Wolfram Sang

    Peter Rosin
     

12 Apr, 2016

1 commit


13 Jan, 2016

1 commit

  • In commit f309d4443130bf814e991f836e919dca22df37ae ("platform_device:
    better support builtin boilerplate avoidance") we introduced the
    builtin_driver macro.

    Here we use that support and extend it to I2C driver registration,
    so where a driver is clearly non-modular and builtin-only, we can
    register it in a similar fashion. And existing code that is clearly
    non-modular can be updated with the simple mapping of

    module_i2c_driver(...) ---> builtin_i2c_driver(...)

    We've essentially cloned the former to make the latter, and taken
    out the remove/module_exit parts since those never get used in a
    non-modular build of the code.

    A similar thing was done in commit b4eb6cdbbd13698704863f680c643c569909e1c2
    ("PCI: Add builtin_pci_driver() to avoid registration boilerplate").

    Signed-off-by: Paul Gortmaker
    Signed-off-by: Wolfram Sang

    Paul Gortmaker
     

14 Dec, 2015

1 commit


01 Dec, 2015

2 commits


24 Aug, 2015

2 commits

  • There are devices that need to handle block transactions
    regardless of the capabilities exported by the adapter.
    For performance reasons, they need to use i2c read blocks
    if available, otherwise emulate the block transaction with word
    or byte transactions.

    Add support for a helper function that would read a data block
    using the best transfer available: I2C_FUNC_SMBUS_READ_I2C_BLOCK,
    I2C_FUNC_SMBUS_READ_WORD_DATA or I2C_FUNC_SMBUS_READ_BYTE_DATA.

    Signed-off-by: Irina Tirdea
    Signed-off-by: Wolfram Sang

    Irina Tirdea
     
  • And update indentation with one more tab, sigh...

    Tested-by: Andrey Danin
    Acked-by: Stephen Warren
    Signed-off-by: Wolfram Sang
    Signed-off-by: Wolfram Sang

    Wolfram Sang
     

10 Aug, 2015

1 commit

  • of_find_i2c_adapter_by_node() call requires quite often missing
    put_device(), and i2c_put_adapter() releases a device locked by
    i2c_get_adapter() only. In general module_put(adapter->owner) and
    put_device(dev) are not interchangeable.

    This is a common error reproduction scenario as a result of the
    misusage described above (for clearness this is run on iMX6 platform
    with HDMI and I2C bus drivers compiled as kernel modules):

    root@mx6q:~# lsmod | grep i2c
    i2c_imx 10213 0
    root@mx6q:~# lsmod | grep dw_hdmi_imx
    dw_hdmi_imx 3631 0
    dw_hdmi 11846 1 dw_hdmi_imx
    imxdrm 8674 3 dw_hdmi_imx,imx_ipuv3_crtc,imx_ldb
    drm_kms_helper 113765 5 dw_hdmi,imxdrm,imx_ipuv3_crtc,imx_ldb
    root@mx6q:~# rmmod dw_hdmi_imx
    root@mx6q:~# lsmod | grep i2c
    i2c_imx 10213 -1

    ^^^^^

    root@mx6q:~# rmmod i2c_imx
    rmmod: ERROR: Module i2c_imx is in use

    To fix existing users of these interfaces and to avoid any further
    confusion and misusage in future, add one more interface
    of_get_i2c_adapter_by_node(), it is similar to i2c_get_adapter() in
    sense that an I2C bus device driver found and locked by user can be
    correctly unlocked by i2c_put_adapter().

    Signed-off-by: Vladimir Zapolskiy
    Signed-off-by: Wolfram Sang

    Vladimir Zapolskiy
     

15 Apr, 2015

1 commit

  • Pull power management and ACPI updates from Rafael Wysocki:
    "These are mostly fixes and cleanups all over, although there are a few
    items that sort of fall into the new feature category.

    First off, we have new callbacks for PM domains that should help us to
    handle some issues related to device initialization in a better way.

    There also is some consolidation in the unified device properties API
    area allowing us to use that inferface for accessing data coming from
    platform initialization code in addition to firmware-provided data.

    We have some new device/CPU IDs in a few drivers, support for new
    chips and a new cpufreq driver too.

    Specifics:

    - Generic PM domains support update including new PM domain callbacks
    to handle device initialization better (Russell King, Rafael J
    Wysocki, Kevin Hilman)

    - Unified device properties API update including a new mechanism for
    accessing data provided by platform initialization code (Rafael J
    Wysocki, Adrian Hunter)

    - ARM cpuidle update including ARM32/ARM64 handling consolidation
    (Daniel Lezcano)

    - intel_idle update including support for the Silvermont Core in the
    Baytrail SOC and for the Airmont Core in the Cherrytrail and
    Braswell SOCs (Len Brown, Mathias Krause)

    - New cpufreq driver for Hisilicon ACPU (Leo Yan)

    - intel_pstate update including support for the Knights Landing chip
    (Dasaratharaman Chandramouli, Kristen Carlson Accardi)

    - QorIQ cpufreq driver update (Tang Yuantian, Arnd Bergmann)

    - powernv cpufreq driver update (Shilpasri G Bhat)

    - devfreq update including Tegra support changes (Tomeu Vizoso,
    MyungJoo Ham, Chanwoo Choi)

    - powercap RAPL (Running-Average Power Limit) driver update including
    support for Intel Broadwell server chips (Jacob Pan, Mathias Krause)

    - ACPI device enumeration update related to the handling of the
    special PRP0001 device ID allowing DT-style 'compatible' property
    to be used for ACPI device identification (Rafael J Wysocki)

    - ACPI EC driver update including limited _DEP support (Lan Tianyu,
    Lv Zheng)

    - ACPI backlight driver update including a new mechanism to allow
    native backlight handling to be forced on non-Windows 8 systems and
    a new quirk for Lenovo Ideapad Z570 (Aaron Lu, Hans de Goede)

    - New Windows Vista compatibility quirk for Sony VGN-SR19XN (Chen Yu)

    - Assorted ACPI fixes and cleanups (Aaron Lu, Martin Kepplinger,
    Masanari Iida, Mika Westerberg, Nan Li, Rafael J Wysocki)

    - Fixes related to suspend-to-idle for the iTCO watchdog driver and
    the ACPI core system suspend/resume code (Rafael J Wysocki, Chen Yu)

    - PM tracing support for the suspend phase of system suspend/resume
    transitions (Zhonghui Fu)

    - Configurable delay for the system suspend/resume testing facility
    (Brian Norris)

    - PNP subsystem cleanups (Peter Huewe, Rafael J Wysocki)"

    * tag 'pm+acpi-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (74 commits)
    ACPI / scan: Fix NULL pointer dereference in acpi_companion_match()
    ACPI / scan: Rework modalias creation when "compatible" is present
    intel_idle: mark cpu id array as __initconst
    powercap / RAPL: mark rapl_ids array as __initconst
    powercap / RAPL: add ID for Broadwell server
    intel_pstate: Knights Landing support
    intel_pstate: remove MSR test
    cpufreq: fix qoriq uniprocessor build
    ACPI / scan: Take the PRP0001 position in the list of IDs into account
    ACPI / scan: Simplify acpi_match_device()
    ACPI / scan: Generalize of_compatible matching
    device property: Introduce firmware node type for platform data
    device property: Make it possible to use secondary firmware nodes
    PM / watchdog: iTCO: stop watchdog during system suspend
    cpufreq: hisilicon: add acpu driver
    ACPI / EC: Call acpi_walk_dep_device_list() after installing EC opregion handler
    cpufreq: powernv: Report cpu frequency throttling
    intel_idle: Add support for the Airmont Core in the Cherrytrail and Braswell SOCs
    intel_idle: Update support for Silvermont Core in Baytrail SOC
    PM / devfreq: tegra: Register governor on module init
    ...

    Linus Torvalds
     

10 Apr, 2015

1 commit

  • This patch changes type of input parameter for
    prepare/unprepare_recovery() callbacks from struct i2c_bus_recovery_info
    * to struct i2c_adapter *. This allows to simplify implementation of
    these callbacks and avoid type conversations from i2c_bus_recovery_info
    to i2c_adapter. The i2c_bus_recovery_info can be simply retrieved from
    struct i2c_adapter which contains pointer on it. There are no users
    currently, so this is safe to do.

    Acked-by: Uwe Kleine-König
    Acked-by: Alexander Sverdlin
    Signed-off-by: Grygorii Strashko
    Signed-off-by: Wolfram Sang

    Grygorii Strashko
     

27 Mar, 2015

1 commit

  • After more discussion, brave users, and additional datasheet evaluation,
    some API updates for the new I2C slave framework became imminent. The
    slave events now get some easier to understand naming. Also, the event
    handling has been simplified to only need a single call to the slave
    callback when an action by the backend is required.

    Reported-by: Uwe Kleine-König
    Signed-off-by: Wolfram Sang
    Acked-by: Geert Uytterhoeven
    Acked-by: Uwe Kleine-König
    Signed-off-by: Wolfram Sang

    Wolfram Sang
     

17 Mar, 2015

1 commit

  • Now that we have struct fwnode_handle, we can use that to point to
    ACPI companions from struct device objects instead of pointing to
    struct acpi_device directly.

    There are two benefits from that. First, the somewhat ugly and
    hackish struct acpi_dev_node can be dropped and, second, the same
    struct fwnode_handle pointer can be used in the future to point
    to other (non-ACPI) firmware device node types.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Acked-by: Grant Likely

    Rafael J. Wysocki
     

13 Mar, 2015

1 commit

  • The number of I2C adapters which are not fully I2C compatible is rising,
    sadly. Drivers usually do handle the flaws, still the user receives only
    some errno for a transfer which normally can be expected to work. This
    patch introduces a formal description of flaws. One advantage is that
    the core can check before the actual transfer if the messages could be
    transferred at all. This is done in the next patch. Another advantage is
    that we can pass this information to the user so the restrictions are
    exactly known and further actions can be based on that. This will be
    done later after some stabilization period for this description.

    Signed-off-by: Wolfram Sang
    Tested-by: Ray Jui
    Tested-by: Ivan T. Ivanov
    Tested-by: Neelesh Gupta
    Tested-By: Ludovic Desroches

    Wolfram Sang
     

22 Feb, 2015

1 commit

  • Pull i2c updates from Wolfram Sang:
    "Summary:

    - legacy PM code removed from the core, there were no users anymore
    (thanks to Lars-Peter Clausen)

    - new driver for Broadcom iProc

    - bigger driver updates for designware, rk3x, cadence, ocores

    - a bunch of smaller updates and bugfixes"

    * 'i2c/for-3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (31 commits)
    i2c: ocores: rework clk code to handle NULL cookie
    i2c: designware-baytrail: another fixup for proper Kconfig dependencies
    i2c: fix reference to functionality constants definition
    i2c: iproc: Add Broadcom iProc I2C Driver
    i2c: designware-pci: update Intel copyright line
    i2c: ocores: add common clock support
    i2c: hix5hd2: add COMPILE_TEST
    i2c: clarify comments about the dev_released completion
    i2c: ocores: fix clock-frequency binding usage
    i2c: tegra: Maintain CPU endianness
    i2c: designware-baytrail: use proper Kconfig dependencies
    i2c: designware: Do not calculate SCL timing parameters needlessly
    i2c: do not try to load modules for of-registered devices
    i2c: designware: Add Intel Baytrail PMIC I2C bus support
    i2c: designware: Add i2c bus locking support
    of: i2c: Add i2c-mux-idle-disconnect DT property to PCA954x mux driver
    i2c: designware: use {readl|writel}_relaxed instead of readl/writel
    i2c: designware-pci: no need to provide clk_khz
    i2c: designware-pci: remove Moorestown support
    i2c: imx: whitespace and checkpatch cleanup
    ...

    Linus Torvalds
     

27 Jan, 2015

1 commit


23 Dec, 2014

1 commit

  • There haven't been any I2C driver that use the legacy suspend/resume
    callbacks for a while now and new drivers are supposed to use PM ops. So
    remove support for legacy suspend/resume for I2C drivers.

    Since there aren't any special bus specific things to do during
    suspend/resume and since the PM core will automatically fallback directly to
    using the device's PM ops if no bus PM ops are specified there is no need to
    have any I2C bus PM ops.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Wolfram Sang

    Lars-Peter Clausen
     

15 Dec, 2014

1 commit

  • Pull i2c updates from Wolfram Sang:
    "For 3.19, the I2C subsystem has to offer special candy this time.
    Right in time for Christmas :)

    - I2C slave framework: finally, a generic mechanism for Linux being
    an I2C slave (if the bus driver supports that). Docs are still
    missing but will come later this cycle, the code is good enough to
    go.
    - I2C muxes represent their topology in sysfs much more detailed.
    This will help users to navigate around much easier.
    - irq population of i2c clients is now done at probe time, not device
    creation time, to have better support for deferred probing.
    - new drivers for Imagination SCB, Amlogic Meson
    - DMA support added for Freescale IMX, Renesas SHMobile
    - slightly bigger driver updates to OMAP, i801, AT91, and rk3x
    (mostly quirk handling, timing updates, and using better kernel
    interfaces)
    - eeprom driver can now write with byte-access (very slow, but OK to
    have)
    - and the bunch of smaller fixes, cleanups, ID updates..."

    * 'i2c/for-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (56 commits)
    i2c: sh_mobile: remove unneeded DMA mask
    i2c: rcar: add slave support
    i2c: slave-eeprom: add eeprom simulator driver
    i2c: core changes for slave support
    MAINTAINERS: add I2C dt bindings also to I2C realm
    i2c: designware: Fix falling time bindings doc
    i2c: davinci: switch to use platform_get_irq
    Documentation: i2c: Use PM ops instead of legacy suspend/resume
    i2c: sh_mobile: optimize irq entry
    i2c: pxa: add support for SCCB devices
    omap: i2c: don't check bus state IP rev3.3 and earlier
    i2c: s3c2410: Handle i2c sys_cfg register in i2c driver
    i2c: rk3x: add Kconfig dependency on COMMON_CLK
    i2c: omap: add notes related to i2c multimaster mode
    i2c: omap: don't reset controller if Arbitration Lost detected
    i2c: omap: implement workaround for handling invalid BB-bit values
    i2c: omap: cleanup register definitions
    i2c: rk3x: handle dynamic clock rate changes correctly
    i2c: at91: enable probe deferring on dma channel request
    i2c: at91: remove legacy DMA support
    ...

    Linus Torvalds
     

12 Dec, 2014

1 commit

  • Finally(!), make Linux support being an I2C slave. Most of the existing
    infrastructure is reused. We mainly add i2c_slave_register/unregister()
    calls which tells i2c bus drivers to activate the slave mode. Then, they
    also get a callback to report slave events to.

    Signed-off-by: Wolfram Sang
    Signed-off-by: Wolfram Sang

    Wolfram Sang
     

04 Nov, 2014

1 commit


25 Sep, 2014

1 commit

  • Commit 5d98e61d337c ("I2C/ACPI: Add i2c ACPI operation region support")
    renamed the i2c-core module. This may cause regressions for
    distributions, so put the ACPI code back into the core.

    Reported-by: Jean Delvare
    Signed-off-by: Wolfram Sang
    Tested-by: Lan Tianyu
    Tested-by: Mika Westerberg

    Wolfram Sang
     

19 Aug, 2014

1 commit

  • Commit da3c6647(I2C/ACPI: Clean up I2C ACPI code and Add CONFIG_I2C_ACPI
    config) adds a new kernel config I2C_ACPI and make I2C core built in
    when the config is selected. This is wrong because distributions
    etc generally compile I2C as a module and the commit broken that.
    This patch is to rename I2C_ACPI to ACPI_I2C_OPREGION. New config
    only controls ACPI I2C operation region code and depends on I2C=y.

    Signed-off-by: Lan Tianyu
    Reviewed-by: Mika Westerberg
    [wsa: removed unrelated change for Kconfig]
    Signed-off-by: Wolfram Sang

    Lan Tianyu
     

27 Jun, 2014

2 commits

  • Clean up ACPI related code in the i2c core and add CONFIG_I2C_ACPI
    to enable I2C ACPI code.

    Current there is a race between removing I2C ACPI operation region
    and ACPI AML code accessing. So make i2c core built-in if CONFIG_I2C_ACPI
    is set.

    Reviewed-by: Mika Westerberg
    Signed-off-by: Lan Tianyu
    Signed-off-by: Wolfram Sang

    Lan Tianyu
     
  • ACPI 5.0 spec(5.5.2.4.5) defines GenericSerialBus(i2c, spi, uart) operation region.
    It allows ACPI aml code able to access such kind of devices to implement
    some ACPI standard method.

    ACPI Spec defines some access attribute to associate with i2c protocol.
    AttribQuick Read/Write Quick Protocol
    AttribSendReceive Send/Receive Byte Protocol
    AttribByte Read/Write Byte Protocol
    AttribWord Read/Write Word Protocol
    AttribBlock Read/Write Block Protocol
    AttribBytes Read/Write N-Bytes Protocol
    AttribProcessCall Process Call Protocol
    AttribBlockProcessCall Write Block-Read Block Process Call Protocol
    AttribRawBytes Raw Read/Write N-BytesProtocol
    AttribRawProcessBytes Raw Process Call Protocol

    On the Asus T100TA, Bios use GenericSerialBus operation region to access
    i2c device to get battery info.

    Sample code From Asus T100TA

    Scope (_SB.I2C1)
    {
    Name (UMPC, ResourceTemplate ()
    {
    I2cSerialBus (0x0066, ControllerInitiated, 0x00061A80,
    AddressingMode7Bit, "\\_SB.I2C1",
    0x00, ResourceConsumer, ,
    )
    })

    ...

    OperationRegion (DVUM, GenericSerialBus, Zero, 0x0100)
    Field (DVUM, BufferAcc, NoLock, Preserve)
    {
    Connection (UMPC),
    Offset (0x81),
    AccessAs (BufferAcc, AttribBytes (0x3E)),
    FGC0, 8
    }
    ...
    }

    Device (BATC)
    {
    Name (_HID, EisaId ("PNP0C0A")) // _HID: Hardware ID
    Name (_UID, One) // _UID: Unique ID
    ...

    Method (_BST, 0, NotSerialized) // _BST: Battery Status
    {
    If (LEqual (AVBL, One))
    {
    Store (FGC0, BFFG)
    If (LNotEqual (STAT, One))
    {
    ShiftRight (CHST, 0x04, Local0)
    And (Local0, 0x03, Local0)
    If (LOr (LEqual (Local0, One), LEqual (Local0, 0x02)))
    {
    Store (0x02, Local1)
    }
    ...

    }

    The i2c operation region is defined under I2C1 scope. _BST method under
    battery device BATC read battery status from the field "FCG0". The request
    would be sent to i2c operation region handler.

    This patch is to add i2c ACPI operation region support. Due to there are
    only "Byte" and "Bytes" protocol access on the Asus T100TA, other protocols
    have not been tested.

    About RawBytes and RawProcessBytes protocol, they needs specific drivers to interpret
    reference data from AML code according ACPI 5.0 SPEC(5.5.2.4.5.3.9 and 5.5.2.4.5.3.10).
    So far, not found such case and will add when find real case.

    Signed-off-by: Lan Tianyu
    Reviewed-by: Mika Westerberg
    Signed-off-by: Wolfram Sang

    Lan Tianyu
     

06 Mar, 2014

1 commit

  • Class based instantiation can cause noticeable delays when booting. This
    mechanism is used when it is not possible to describe slaves on I2C
    busses. As we do have other mechanisms, most embedded I2C will not need
    classes and for embedded it is explicitly not recommended to use them. Add
    a deprecation warning for drivers which want to disable class based
    instantiation in the near future to gain boot-up time, so users relying
    on this technique can switch to something better. They really should.

    Signed-off-by: Wolfram Sang

    Wolfram Sang
     

27 Jan, 2014

1 commit


15 Jan, 2014

1 commit

  • The body of i2c_parent_is_i2c_adapter() is currently guarded by
    I2C_MUX. It should be CONFIG_I2C_MUX instead.

    Among potentially other problems, this resulted in i2c_lock_adapter()
    only locking I2C mux child adapters, and not the parent adapter. In
    turn, this could allow inter-mingling of mux child selection and I2C
    transactions, which could result in I2C transactions being directed to
    the wrong I2C bus, and possibly even switching between busses in the
    middle of a transaction.

    One concrete issue caused by this bug was corrupted HDMI EDID reads
    during boot on the NVIDIA Tegra Seaboard system, although this only
    became apparent in recent linux-next, when the boot timing was changed
    just enough to trigger the race condition.

    Fixes: 3923172b3d70 ("i2c: reduce parent checking to a NOOP in non-I2C_MUX case")
    Cc: Phil Carmody
    Cc:
    Signed-off-by: Stephen Warren
    Signed-off-by: Wolfram Sang

    Stephen Warren
     

04 Oct, 2013

1 commit

  • The 'driver' field of the i2c_client struct is redundant. The same data can be
    accessed through to_i2c_driver(client->dev.driver). The generated code for both
    approaches in more or less the same.

    E.g. on ARM the expression client->driver->command(...) generates

    ...
    ldr r3, [r0, #28]
    ldr r3, [r3, #32]
    blx r3
    ...

    and the expression to_i2c_driver(client->dev.driver)->command(...) generates

    ...
    ldr r3, [r0, #160]
    ldr r3, [r3, #-4]
    blx r3
    ...

    Other architectures will generate similar code.

    All users of the 'driver' field outside of the I2C core have already been
    converted. So this only leaves the core itself. This patch converts the
    remaining few users in the I2C core and then removes the 'driver' field from the
    i2c_client struct.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Wolfram Sang

    Lars-Peter Clausen
     

23 Aug, 2013

2 commits

  • This follows what has already been done for the DeviceTree helpers. Move
    the ACPI helpers from drivers/acpi/acpi_i2c.c to the I2C core and update
    documentation accordingly.

    This also solves a problem reported by Jerry Snitselaar that we can't build
    the ACPI I2C helpers as a module.

    Signed-off-by: Mika Westerberg
    Acked-by: Rafael J. Wysocki
    Signed-off-by: Wolfram Sang

    Mika Westerberg
     
  • I2C of helpers used to live in of_i2c.c but experience (from SPI) shows
    that it is much cleaner to have this in the core. This also removes a
    circular dependency between the helpers and the core, and so we can
    finally register child nodes in the core instead of doing this manually
    in each driver. So, fix the drivers and documentation, too.

    Signed-off-by: Wolfram Sang

    Wolfram Sang