02 Mar, 2016

1 commit

  • We want the size of the struct, not of a pointer to it. To be future
    proof, just dereference the pointer to get the desired type.

    Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver")
    Acked-by: Gregory Fong
    Acked-by: Florian Fainelli
    Reviewed-by: Kamal Dasu
    Signed-off-by: Wolfram Sang
    Cc: stable@kernel.org

    Wolfram Sang
     

18 Feb, 2016

1 commit

  • Starting from Intel Sunrisepoint (Skylake PCH) the iTCO watchdog
    resources have been moved to reside under the i801 SMBus host
    controller whereas previously they were under the LPC device.

    This patch adds Intel lewisburg SMBus support for iTCO device.
    It allows to load watchdog dynamically when the hardware is
    present.

    Fixes: cdc5a3110e7c ("i2c: i801: add Intel Lewisburg device IDs")
    Reviewed-by: Jean Delvare
    Signed-off-by: Alexandra Yates
    Signed-off-by: Wolfram Sang
    Cc: stable@kernel.org

    Alexandra Yates
     

13 Feb, 2016

2 commits

  • Signed-off-by: Masahiro Yamada
    Signed-off-by: Wolfram Sang

    Masahiro Yamada
     
  • Commit 5de85b9d57ab ("PM / runtime: Re-init runtime PM states at probe
    error and driver unbind") introduced pm_runtime_reinit() that is used
    to reinitialize PM runtime after -EPROBE_DEFER. This allows shutting
    down the device after a failed probe.

    However, for drivers using pm_runtime_use_autosuspend() this can cause
    a state where suspend callback is never called after -EPROBE_DEFER.
    On the following device driver probe, hardware state is different from
    the PM runtime state causing omap_device to produce the following
    error:

    omap_device_enable() called from invalid state 1

    And with omap_device and omap hardware being picky for PM, this will
    block any deeper idle states in hardware.

    The solution is to fix the drivers to follow the PM runtime documentation:

    1. For sections of code that needs the device disabled, use
    pm_runtime_put_sync_suspend() if pm_runtime_set_autosuspend() has
    been set.

    2. For driver exit code, use pm_runtime_dont_use_autosuspend() before
    pm_runtime_put_sync() if pm_runtime_use_autosuspend() has been
    set.

    Fixes: 5de85b9d57ab ("PM / runtime: Re-init runtime PM states at probe
    error and driver unbind")
    Signed-off-by: Tony Lindgren
    Acked-by: Ulf Hansson
    Signed-off-by: Wolfram Sang

    Tony Lindgren
     

29 Jan, 2016

1 commit

  • The I2C bus names are supposed to be stable as they can be used by
    userspace to uniquely identify a specific I2C bus. So restore the
    original names for all legacy (pre-SB800) devices.

    For SB800 devices and later, improve the names. "SDA" refers to the
    serial data pin of each SMBus port, it's an implementation detail the
    user doesn't need to know. Use "port" instead, which is easier to
    understand.

    Signed-off-by: Jean Delvare
    Reviewed-by: Mika Westerberg
    Tested-by: Christian Fetzer
    Signed-off-by: Wolfram Sang

    Jean Delvare
     

26 Jan, 2016

3 commits

  • This is effectively reapplies the commit b0898fdaffb2 ("i2c: designware-pci: use
    IRQF_COND_SUSPEND flag") after the commit d80d134182ba ("i2c: designware: Move
    common probe code into i2c_dw_probe()"). Original message as follows.

    The mentioned flag fixes a warning on Intel Edison board since one of the I2C
    controller shares IRQ line with watchdog timer.

    Fixes: d80d134182ba (i2c: designware: Move common probe code into i2c_dw_probe())
    Signed-off-by: Andy Shevchenko
    Acked-by: Jarkko Nikula
    Signed-off-by: Wolfram Sang

    Andy Shevchenko
     
  • This closes a race window where I2C device drivers attempt to access
    I2C buses which aren't fully initialized yet.

    Signed-off-by: Jean Delvare
    Tested-by: Christian Fetzer
    Signed-off-by: Wolfram Sang

    Jean Delvare
     
  • We need a single mutex for all 4 shared SMBus ports on the SB800. A
    per-port mutex doesn't protect us from concurrent access.

    In theory the mutex should be per PCI device, however in practice we
    know that there's only ever a single instance of the device in a given
    system so we can use a global.

    Also take the mutex during initialization, as first port may be already
    in use when second port is initialized.

    Signed-off-by: Jean Delvare
    Tested-by: Christian Fetzer
    Reviewed-by: Mika Westerberg
    [wsa: made mutex static]
    Signed-off-by: Wolfram Sang

    Jean Delvare
     

15 Jan, 2016

1 commit

  • Pull i2c updates from Wolfram Sang:
    "Quite some driver updates:
    - piix4 can now handle multiplexed adapters
    - brcmstb, xlr, eg20t, designware drivers support more SoCs
    - emev2 gained i2c slave support
    - img-scb and rcar got bigger refactoring to remove issues
    - lots of common driver updates

    i2c core changes:
    - new quirk flag when an adapter does not support clock stretching,
    so clients can be configured to avoid that if possible
    - added a helper function to retrieve timing parameters from firmware
    (with rcar being the first user)
    - "multi-master" DT binding added so drivers can adapt to this
    setting (like disabling PM to keep arbitration working)
    - RuntimePM for the logical adapter device is now always enabled by
    the core to ensure propagation from childs to the parent (the HW
    device)
    - new macro builtin_i2c_driver to reduce boilerplate"

    * 'i2c/for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (70 commits)
    i2c: create builtin_i2c_driver to avoid registration boilerplate
    i2c: imx: fix i2c resource leak with dma transfer
    dt-bindings: i2c: eeprom: add another EEPROM device
    dt-bindings: move I2C eeprom descriptions to the proper file
    i2c: designware: Do not require clock when SSCN and FFCN are provided
    DT: i2c: trivial-devices: Add Epson RX8010 and MPL3115
    i2c: s3c2410: remove superfluous runtime PM calls
    i2c: always enable RuntimePM for the adapter device
    i2c: designware: retry transfer on transient failure
    i2c: ibm_iic: rename i2c_timings struct due to clash with generic version
    i2c: designware: Add support for AMD Seattle I2C
    i2c: imx: Remove unneeded comments
    i2c: st: use to_platform_device()
    i2c: designware: use to_pci_dev()
    i2c: brcmstb: Adding support for CM and DSL SoCs
    i2c: mediatek: fix i2c multi transfer issue in high speed mode
    i2c: imx: improve code readability
    i2c: imx: Improve message log when DMA is not used
    i2c: imx: add runtime pm support to improve the performance
    i2c: imx: init bus recovery info before adding i2c adapter
    ...

    Linus Torvalds
     

12 Jan, 2016

2 commits

  • * acpi-soc:
    PM / clk: don't leave clocks enabled when driver not bound
    i2c: dw: Add APM X-Gene ACPI I2C device support
    ACPI / APD: Add APM X-Gene ACPI I2C device support
    ACPI / LPSS: change 'does not have' to 'has' in comment
    Revert "dmaengine: dw: platform: provide platform data for Intel"
    dmaengine: dw: return immediately from IRQ when DMA isn't in use
    dmaengine: dw: platform: power on device on shutdown
    ACPI / LPSS: override power state for LPSS DMA device
    ACPI / LPSS: power on when probe() and otherwise when remove()
    ACPI / LPSS: do delay for all LPSS devices when D3->D0
    ACPI / LPSS: allow to use specific PM domain during ->probe()
    Revert "ACPI / LPSS: allow to use specific PM domain during ->probe()"
    device core: add BUS_NOTIFY_DRIVER_NOT_BOUND notification
    x86/platform/iosf_mbi: Remove duplicate definitions

    Conflicts:
    drivers/i2c/busses/i2c-designware-platdrv.c

    Rafael J. Wysocki
     
  • * device-properties:
    device property: avoid allocations of 0 length
    device property: the secondary fwnode needs to depend on the primary
    device property: add spaces to PROPERTY_ENTRY_STRING macro
    include/linux/property.h: fix build issues with gcc-4.4.4
    i2c: designware: Convert to use unified device property API
    mfd: intel-lpss: Pass HSUART configuration via properties
    mfd: intel-lpss: Pass SDA hold time to I2C host controller driver
    mfd: intel-lpss: Add support for passing device properties
    mfd: core: propagate device properties to sub devices drivers
    driver core: Do not overwrite secondary fwnode with NULL if it is set
    driver core: platform: Add support for built-in device properties
    device property: Take a copy of the property set
    device property: Fallback to secondary fwnode if primary misses the property
    device property: return -EINVAL when property isn't found in ACPI
    device property: improve readability of macros
    device property: helper macros for property entry creation
    device property: keep single value inplace
    device property: refactor built-in properties support
    device property: rename helper functions
    device property: always check for fwnode type

    Rafael J. Wysocki
     

10 Jan, 2016

5 commits

  • In i2c_imx_dma_xfer(), when dmaengine_submit() returns error,
    the context goto label err_submit and then return. However, the
    memory allocated for txdesc has not been freed yet, which
    leads to resource leak.

    Signed-off-by: Gao Pan
    Signed-off-by: Fugang Duan
    Signed-off-by: Wolfram Sang

    Gao Pan
     
  • The current driver uses input clock source frequency to calculate
    values for [SS|FS]_[HC|LC] registers. However, when booting ACPI, we do not
    currently have a good way to provide the frequency information.
    Instead, we can leverage the SSCN and FFCN ACPI methods, which can be used
    to directly provide these values. So, the clock information should
    no longer be required during probing.

    However, since clk can be invalid, additional checks must be done where
    we are making use of it.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Suravee Suthikulpanit
    Tested-by: Loc Ho
    Signed-off-by: Wolfram Sang

    Suravee Suthikulpanit
     
  • RuntimePM of the adapter device is now taken care of by the core. So, we
    can remove these calls.

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

    Wolfram Sang
     
  • The adapter device is a logical device. Because of that, it already uses
    pm_runtime_no_callbacks() in the core. To ensure proper propagation from
    the children (i2c devices) to the parent of the adapter (the HW device),
    make sure RuntimePM is enabled in any case.

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

    Wolfram Sang
     
  • Set the i2c_adapter retries field to a sensible value. This allows the i2c core
    to retry master_xfer() when it returns -EAGAIN. Currently the i2c-designware
    driver returns -EAGAIN only on Tx arbitration failure (DW_IC_TX_ARB_LOST).

    Reported-by: Rolland Chau
    Signed-off-by: Baruch Siach
    Acked-by: Andy Shevchenko
    Signed-off-by: Wolfram Sang

    Baruch Siach
     

07 Jan, 2016

1 commit

  • Enable APM X-Gene ACPI I2C device support by adding the
    corresponding ACPI ID. The platform ACPI APD corresponding
    change is required to provide the proper clock frequency input.

    Signed-off-by: Loc Ho
    Acked-by: Mika Westerberg
    Signed-off-by: Rafael J. Wysocki

    Loc Ho
     

05 Jan, 2016

3 commits


04 Jan, 2016

8 commits

  • Use to_platform_device() instead of open-coding it.

    Signed-off-by: Geliang Tang
    Signed-off-by: Wolfram Sang

    Geliang Tang
     
  • Use to_pci_dev() instead of open-coding it.

    Signed-off-by: Geliang Tang
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Wolfram Sang

    Geliang Tang
     
  • Broadcoms DSL, CM (cable modem)and STB I2C core implementation have
    8 data in/out registers that can transfer 8 bytes or 32 bytes max.
    Cable and DSL "Peripheral" i2c cores use single byte per data
    register and the STB can use 4 byte per data register transfer.
    Adding support to take care of this difference. Accordingly added
    the compatible string for SoCs using the "Peripheral" I2C block.

    Signed-off-by: Kamal Dasu
    Reviewed-by: Florian Fainelli
    Signed-off-by: Wolfram Sang

    Kamal Dasu
     
  • For mt8173 platform with auto restart support, when doing i2c multi
    transfer in high speed, we should ignore the first restart irq after
    the master code, otherwise the first transfer will be discarded.

    Signed-off-by: Liguo Zhang
    Reviewed-by: Eddie Huang
    Signed-off-by: Wolfram Sang

    Liguo Zhang
     
  • Replace of_get_named_gpio_flags with of_get_named_gpio because
    the latter has less parameters, which improves code readability.

    Signed-off-by: Fugang Duan
    Signed-off-by: Gao Pan
    Signed-off-by: Wolfram Sang

    Gao Pan
     
  • When DMA cannot be used, it is better to state that the I2C controller
    will operate in PIO mode.

    Signed-off-by: Fabio Estevam
    Signed-off-by: Wolfram Sang

    Fabio Estevam
     
  • In our former i2c driver, i2c clk is enabled and disabled in
    xfer function, which contributes to power saving. However,
    the clk enable process brings a busy wait delay until the core
    is stable. As a result, the performance is sacrificed.

    To weigh the power consumption and i2c bus performance, runtime
    pm is the good solution for it. The clk is enabled when a i2c
    transfer starts, and disabled after a specifically defined delay.

    If CONFIG_PM is disabled the net result of this patch is that the
    clock is never disabled.

    Without the patch the test case (many eeprom reads) executes with approx:
    real 1m7.735s
    user 0m0.488s
    sys 0m20.040s

    With the patch the same test case (many eeprom reads) executes with approx:
    real 0m54.241s
    user 0m0.440s
    sys 0m5.920s

    Signed-off-by: Fugang Duan
    Signed-off-by: Gao Pan
    Acked-by: Uwe Kleine-König
    [wsa: sorted includes]
    Signed-off-by: Wolfram Sang

    Gao Pan
     
  • During driver probe, i2c_imx_init_recovery_info() must come before
    i2c_add_numbered_adapter(), because the get/set_scl() functions
    are assigned in i2c_register_adapter() under the conditon that bus
    recover_info are initialized. Otherwise, get/set_scl() function
    pointers never get assigned.

    In such case, when i2c_generic_gpio_recovery() is used for bus recovery,
    there will be kernel crash because bri->set_scl is NULL.

    The solution to this bug is moving i2c_imx_init_recovery_info() before
    i2c_register_adapter().

    Signed-off-by: Gao Pan
    Signed-off-by: Fugang Duan
    Acked-by: Uwe Kleine-König
    Signed-off-by: Wolfram Sang
    Cc: stable@kernel.org

    Gao Pan
     

03 Jan, 2016

7 commits

  • In multi master mode, the IP core needs to be always active for
    arbitration reasons. Get the config from DT and set up PM depending on
    the config.

    Acked-by: Geert Uytterhoeven
    Signed-off-by: Wolfram Sang
    Signed-off-by: Wolfram Sang

    Wolfram Sang
     
  • These macros don't really hide complexity, but C idioms. Removing them
    makes the code easier to read IMO and make a planned extension easier.

    Acked-by: Geert Uytterhoeven
    Signed-off-by: Wolfram Sang
    Signed-off-by: Wolfram Sang

    Wolfram Sang
     
  • In version 3.3 of the IP when transaction halt is set, an interrupt
    will be generated after each byte of a transfer instead of after
    every transfer but before the stop bit.
    Due to this behaviour we have to be careful that every time we
    release the transaction halt we have to re-enable it straight away
    so that we only process a single byte, not doing so will result in
    all remaining bytes been processed and a stop bit being issued,
    which will prevent us having a repeated start.

    This change will have no effect on earlier versions of the IP.

    Signed-off-by: Sifan Naeem
    Acked-by: James Hogan
    Reviewed-by: James Hartley
    Signed-off-by: Wolfram Sang

    Sifan Naeem
     
  • Master halt is issued after each byte of a transaction is processed in
    IP version 3.3.
    Master halt will stall the bus by holding the SCK line low until the
    halt bit in the scb_general_control is cleared.

    After the last byte of a transfer is processed we can use the Master
    Halt interrupt to facilitate a repeated start transfer without
    issuing a stop bit.

    Signed-off-by: Sifan Naeem
    Reviewed-by: James Hartley
    Signed-off-by: Wolfram Sang

    Sifan Naeem
     
  • Stop Detected interrupt is triggered when a Stop bit is detected on
    the bus, which indicates the end of the current transfer.

    When the end of a transfer is indicated by the Stop Detected interrupt,
    drain the FIFO and signal completion for the transaction.

    Signed-off-by: Sifan Naeem
    Signed-off-by: Wolfram Sang

    Sifan Naeem
     
  • Now that we are using the transaction halt interrupt to safely control
    repeated start transfers, we no longer need to handle the fifo
    emptying interrupts.

    Handling this interrupt along with Transaction Halt interrupt can
    cause erratic behaviour.

    Signed-off-by: Sifan Naeem
    Signed-off-by: Wolfram Sang

    Sifan Naeem
     
  • This commit adds support for the I2C_M_IGNORE_NAK protocol
    modification.

    Such behaviour can only be implemented in atomic mode. So, if a
    transaction contains a message with such flag the drivers
    switches to atomic mode. The implementation consists simply in
    treating NAKs as ACKs.

    Signed-off-by: Sifan Naeem
    Acked-by: James Hogan
    Reviewed-by: James Hartley
    Signed-off-by: Wolfram Sang

    Sifan Naeem
     

19 Dec, 2015

1 commit

  • When we also are I2C slave, we need to disable runtime PM because the
    address detection mechanism needs to be active all the time. However, we
    can reenable runtime PM once the slave instance was unregistered. So,
    use pm_runtime_get_sync/put to achieve this, since it has proper
    refcounting. pm_runtime_allow/forbid is like a global knob controllable
    from userspace which is unsuitable here.

    Signed-off-by: Wolfram Sang
    Signed-off-by: Wolfram Sang
    Cc: stable@kernel.org

    Wolfram Sang
     

18 Dec, 2015

2 commits


16 Dec, 2015

2 commits

  • The Sigma Designs variant of this controller has the ability to generate
    interrupts. This is controlled using two additional registers, oddly
    enough overlapping with the defined but unused HDSTATIM.

    This patch adds support for using this feature instead of busy-looping
    if an IRQ is specified.

    Signed-off-by: Mans Rullgard
    Signed-off-by: Wolfram Sang

    Måns Rullgård
     
  • The BYTECNT register holds the transfer size minus one. Setting it to
    the correct value removes the need for a dummy read/write at the end of
    each transfer. As zero-length transfers are not supported, do not
    advertise I2C_FUNC_SMBUS_QUICK.

    In other words, this patch makes the driver transfer the number of bytes
    requested unless this is zero, which is not supported by the hardware
    and is thus refused.

    Signed-off-by: Mans Rullgard
    Signed-off-by: Wolfram Sang

    Måns Rullgård