29 Aug, 2018

1 commit

  • In preparation to remove the node name pointer from struct device_node,
    convert printf users to use the %pOFn format specifier.

    Cc: Linus Walleij
    Cc: Dong Aisheng
    Cc: Fabio Estevam
    Cc: Shawn Guo
    Cc: Stefan Agner
    Cc: Pengutronix Kernel Team
    Cc: Sean Wang
    Cc: Matthias Brugger
    Cc: Carlo Caione
    Cc: Kevin Hilman
    Cc: Jason Cooper
    Cc: Andrew Lunn
    Cc: Gregory Clement
    Cc: Sebastian Hesselbarth
    Cc: Jean-Christophe Plagniol-Villard
    Cc: Nicolas Ferre
    Cc: Alexandre Belloni
    Cc: Heiko Stuebner
    Cc: Tony Lindgren
    Cc: Haojian Zhuang
    Cc: Patrice Chotard
    Cc: Barry Song
    Cc: Maxime Coquelin
    Cc: Alexandre Torgue
    Cc: Maxime Ripard
    Cc: Chen-Yu Tsai
    Cc: linux-gpio@vger.kernel.org
    Cc: linux-mediatek@lists.infradead.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-amlogic@lists.infradead.org
    Cc: linux-rockchip@lists.infradead.org
    Cc: linux-omap@vger.kernel.org
    Acked-by: Dong Aisheng
    Reviewed-by: Alexandre Belloni
    Acked-by: Tony Lindgren
    Acked-by: Sean Wang
    Acked-by: Chen-Yu Tsai
    Acked-by: Heiko Stuebner
    Signed-off-by: Rob Herring
    Signed-off-by: Linus Walleij

    Rob Herring
     

15 Aug, 2018

1 commit

  • Pull pin control updates from Linus Walleij:
    "This is the bulk of pin control changes for v4.19:

    Core changes:

    - Augment pinctrl_generic_add_group() and pinmux_generic_add_function()
    to return the selector for the added group/function to the caller
    and augment (hopefully) all drivers to handle this

    New subdrivers:

    - Qualcomm PM8998 and PM8005 are supported in the SPMI pin control
    and GPIO driver

    - Intel Ice Lake PCH (platform controller hub) support

    - NXP (ex Freescale) i.MX8MQ support

    - Berlin AS370 support

    Improvements to drivers:

    - Support interrupts on the Ocelot pin controller

    - Add SPI pins to the Uniphier driver

    - Define a GPIO compatible per SoC in the Tegra driver

    - Push Tegra initialization down in the initlevels

    - Support external wakeup interrupts on the Exynos

    - Add generic clocks pins to the meson driver

    - Add USB and HSCIF pins for some Renesas PFC chips

    - Suspend/resume support in the armada-37xx

    - Interrupt support for the Actions Semiconductor S900 also known as
    "owl"

    - Correct the pin ordering in Cedarfork

    - Debugfs output for INTF in the mcp23s08 driver

    - Avoid divisions in context save/restore in pinctrl-single

    The rest is minor bug fixes or cleanups"

    * tag 'pinctrl-v4.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (69 commits)
    pinctrl: nomadik: silence uninitialized variable warning
    pinctrl: axp209: Fix NULL pointer dereference after allocation
    pinctrl: samsung: Remove duplicated "wakeup" in printk
    pinctrl: ocelot: add support for interrupt controller
    pinctrl: intel: Don't shadow error code of gpiochip_lock_as_irq()
    pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state
    gpio: tegra: Move driver registration to subsys_init level
    pinctrl: tegra: Move drivers registration to arch_init level
    pinctrl: baytrail: actually print the apparently misconfigured pin
    MAINTAINERS: Replace Heikki as maintainer of Intel pinctrl
    pinctrl: freescale: off by one in imx1_pinconf_group_dbg_show()
    pinctrl: uniphier: add spi pin-mux settings
    pinctrl: cannonlake: Fix community ordering for H variant
    pinctrl: tegra: define GPIO compatible node per SoC
    pinctrl: intel: Do pin translation when lock IRQ
    pinctrl: imx: off by one in imx_pinconf_group_dbg_show()
    pinctrl: mediatek: include chained_irq.h header
    pinctrl/amd: only handle irq if it is pending and unmasked
    pinctrl/amd: fix gpio irq level in debugfs
    pinctrl: stm32: add syscfg mask parameter
    ...

    Linus Torvalds
     

17 Jul, 2018

2 commits

  • Add the missing unlock before return from function
    in the error handling case.

    Fixes: 0f5972033509 ("pinctrl: single: Fix group and function selector use")
    Signed-off-by: Wei Yongjun
    Acked-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Wei Yongjun
     
  • We must use a mutex around the generic_add functions and save the
    function and group selector in case we need to remove them. Otherwise
    the selector use will be racy for deferred probe at least.

    Note that struct device_node *np is unused in pcs_add_function() we
    remove that too and fix a checkpatch warning for bare unsigned while
    at it.

    Fixes: 571aec4df5b7 ("pinctrl: single: Use generic pinmux helpers for
    managing functions")
    Reported-by: H. Nikolaus Schaller
    Cc: Christ van Willegen
    Cc: Haojian Zhuang
    Cc: Jacopo Mondi
    Cc: Paul Cercueil
    Cc: Sean Wang
    Signed-off-by: Tony Lindgren
    Tested-By: H. Nikolaus Schaller
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Linus Walleij

    Tony Lindgren
     

18 Jun, 2018

2 commits

  • The divisions (and multiplications) can be avoided by changing the loops
    to use increments of mux_bytes instead of 1.
    While at it, remove the unneeded casts when assigning void pointers.

    This saves +100 bytes of kernel size on arm32/arm64.

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Tony Lindgren
    Tested-by: Keerthy
    Reviewed-by: Keerthy
    Signed-off-by: Linus Walleij

    Geert Uytterhoeven
     
  • Currently saved_vals is being allocated and there is no check for
    failed allocation (which is more likely than normal when using
    GFP_ATOMIC). Fix this by checking for a failed allocation and
    propagating this error return down the the caller chain.

    Detected by CoverityScan, CID#1469841 ("Dereference null return value")
    Fixes: 88a1dbdec682 ("pinctrl: pinctrl-single: Add functions to save and restore pinctrl context")
    Signed-off-by: Colin Ian King
    Reviewed-by: Johan Hovold
    Acked-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Colin Ian King
     

13 Jun, 2018

1 commit

  • The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
    This patch replaces cases of:

    devm_kzalloc(handle, a * b, gfp)

    with:
    devm_kcalloc(handle, a * b, gfp)

    as well as handling cases of:

    devm_kzalloc(handle, a * b * c, gfp)

    with:

    devm_kzalloc(handle, array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    devm_kcalloc(handle, array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    devm_kzalloc(handle, 4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    Some manual whitespace fixes were needed in this patch, as Coccinelle
    really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    expression HANDLE;
    type TYPE;
    expression THING, E;
    @@

    (
    devm_kzalloc(HANDLE,
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression HANDLE;
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    expression HANDLE;
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    expression HANDLE;
    identifier SIZE, COUNT;
    @@

    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression HANDLE;
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression HANDLE;
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    expression HANDLE;
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression HANDLE;
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression HANDLE;
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
    |
    devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2, ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

23 May, 2018

1 commit

  • This adds a pair of context save/restore functions to save/restore the
    state of a set of pinctrl registers. The context is lost during rtc only
    suspend with ddr in self-refresh on am43xx. Currently the save/restore
    is being done unconditionally. This will be optimized later with a
    pdata-quirk function which will allow is to save/restore only when doing
    the rtc only mode with ddr in self refresh.

    Signed-off-by: Keerthy
    Acked-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Keerthy
     

26 Mar, 2018

1 commit


03 Feb, 2018

1 commit

  • Pull pin control updates from Linus Walleij:
    "This is the bulk of pin control changes for the v4.16 kernel cycle.
    Like with GPIO it is actually a bit calm this time.

    Core changes:

    - After lengthy discussions and partly due to my ignorance, we have
    merged a patch making pinctrl_force_default() and
    pinctrl_force_sleep() reprogram the states into the hardware of any
    hogged pins, even if they are already in the desired state.

    This only apply to hogged pins since groups of pins owned by
    drivers need to be managed by each driver, lest they could not do
    things like runtime PM and put pins to sleeping state even if the
    system as a whole is not in sleep.

    New drivers:

    - New driver for the Microsemi Ocelot SoC. This is used in ethernet
    switches.

    - The X-Powers AXP209 GPIO driver was extended to also deal with pin
    control and moved over from the GPIO subsystem. This circuit is a
    mixed-mode integrated circuit which is part of AllWinner designs.

    - New subdriver for the Qualcomm MSM8998 SoC, core of a high end
    mobile devices (phones) chipset.

    - New subdriver for the ST Microelectronics STM32MP157 MPU and
    STM32F769 MCU from the STM32 family.

    - New subdriver for the MediaTek MT7622 SoC. This is used for
    routers, repeater, gateways and such network infrastructure.

    - New subdriver for the NXP (former Freescale) i.MX 6ULL. This SoC
    has multimedia features and target "smart devices", I guess in-car
    entertainment, in-flight entertainment, industrial control panels
    etc.

    General improvements:

    - Incremental improvements on the SH-PFC subdrivers for things like
    the CAN bus.

    - Enable the glitch filter on Baytrail GPIOs used for interrupts.

    - Proper handling of pins to GPIO ranges on the Semtec SX150X

    - An IRQ setup ordering fix on MCP23S08.

    - A good set of janitorial coding style fixes"

    * tag 'pinctrl-v4.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (102 commits)
    pinctrl: mcp23s08: fix irq setup order
    pinctrl: Forward declare struct device
    pinctrl: sunxi: Use of_clk_get_parent_count() instead of open coding
    pinctrl: stm32: add STM32F769 MCU support
    pinctrl: sx150x: Add a static gpio/pinctrl pin range mapping
    pinctrl: sx150x: Register pinctrl before adding the gpiochip
    pinctrl: sx150x: Unregister the pinctrl on release
    pinctrl: ingenic: Remove redundant dev_err call in ingenic_pinctrl_probe()
    pinctrl: sprd: Use seq_putc() in sprd_pinconf_group_dbg_show()
    pinctrl: pinmux: Use seq_putc() in pinmux_pins_show()
    pinctrl: abx500: Use seq_putc() in abx500_gpio_dbg_show()
    pinctrl: mediatek: mt7622: align error handling of mtk_hw_get_value call
    pinctrl: mediatek: mt7622: fix potential uninitialized value being returned
    pinctrl: uniphier: refactor drive strength get/set functions
    pinctrl: imx7ulp: constify struct imx_cfg_params_decode
    pinctrl: imx: constify struct imx_pinctrl_soc_info
    pinctrl: imx7d: simplify imx7d_pinctrl_probe
    pinctrl: imx: use struct imx_pinctrl_soc_info as a const
    pinctrl: sunxi-pinctrl: fix pin funtion can not be match correctly.
    pinctrl: qcom: Add msm8998 pinctrl driver
    ...

    Linus Torvalds
     

03 Jan, 2018

2 commits


28 Dec, 2017

1 commit

  • The IRQ code already has support for lockdep class for the lock mutex
    in an interrupt descriptor. Extend this to add a second class for the
    request mutex in the descriptor. Not having a class is resulting in
    false positive splats in some code paths.

    Signed-off-by: Andrew Lunn
    Signed-off-by: Thomas Gleixner
    Acked-by: linus.walleij@linaro.org
    Cc: grygorii.strashko@ti.com
    Cc: f.fainelli@gmail.com
    Link: https://lkml.kernel.org/r/1512234664-21555-1-git-send-email-andrew@lunn.ch

    Andrew Lunn
     

20 Dec, 2017

1 commit

  • Pinctrl single should just show how many pins were found, the physical
    address is already in the dev information. So let's remove the wrong
    information that claims to show the physical address but really prints
    a virtual address that is now hashed.

    Signed-off-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Tony Lindgren
     

21 Sep, 2017

1 commit

  • Don't populate the read-only arrays prop2 and prop4 on the stack, instead
    make them static const. Makes the object code smaller by over 230 bytes:

    Before:
    text data bss dec hex filename
    28235 5820 192 34247 85c7 drivers/pinctrl/pinctrl-single.o

    After:
    text data bss dec hex filename
    27839 5980 192 34011 84db drivers/pinctrl/pinctrl-single.o

    Signed-off-by: Colin Ian King
    Acked-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Colin Ian King
     

29 May, 2017

1 commit


07 Apr, 2017

1 commit

  • Recent pinctrl changes to allow dynamic allocation of pins exposed one
    more issue with the pinctrl pins claimed early by the controller itself.
    This caused a regression for IMX6 pinctrl hogs.

    Before enabling the pin controller driver we need to wait until it has
    been properly initialized, then claim the hogs, and only then enable it.

    To fix the regression, split the code into pinctrl_claim_hogs() and
    pinctrl_enable(). And then let's require that pinctrl_enable() is always
    called by the pin controller driver when ready after calling
    pinctrl_register_and_init().

    Depends-on: 950b0d91dc10 ("pinctrl: core: Fix regression caused by delayed
    work for hogs")
    Fixes: df61b366af26 ("pinctrl: core: Use delayed work for hogs")
    Fixes: e566fc11ea76 ("pinctrl: imx: use generic pinctrl helpers for
    managing groups")
    Cc: Haojian Zhuang
    Cc: Masahiro Yamada
    Cc: Mika Penttilä
    Cc: Mika Westerberg
    Cc: Nishanth Menon
    Cc: Shawn Guo
    Cc: Stefan Agner
    Tested-by: Geert Uytterhoeven
    Tested-by: Gary Bisson
    Tested-by: Fabio Estevam
    Signed-off-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Tony Lindgren
     

26 Jan, 2017

2 commits

  • Linus Walleij
     
  • The current pinconf packed format allows only 16-bit argument limiting
    the maximum value 65535. For most types this is enough. However,
    debounce time can be in range of hundreths of milliseconds in case of
    mechanical switches so we cannot represent the worst case using the
    current format.

    In order to support larger values change the packed format so that the
    lower 8 bits are used as type which leaves 24 bits for the argument.
    This allows representing values up to 16777215 and debounce times up to
    16 seconds.

    We also convert the existing users to use 32-bit integer when extracting
    argument from the packed configuration value.

    Signed-off-by: Mika Westerberg
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Linus Walleij

    Mika Westerberg
     

13 Jan, 2017

1 commit

  • Commit df61b366af26 ("pinctrl: core: Use delayed work for hogs") caused a
    regression at least with sh-pfc that is also a GPIO controller as
    noted by Geert Uytterhoeven .

    As the original pinctrl_register() has issues calling pin controller
    driver functions early before the controller has finished registering,
    we can't just revert commit df61b366af26. That would break the drivers
    using GENERIC_PINCTRL_GROUPS or GENERIC_PINMUX_FUNCTIONS.

    So let's fix the issue with the following steps as a single patch:

    1. Revert the late_init parts of commit df61b366af26.

    The late_init clearly won't work and we have to just give up
    on fixing pinctrl_register() for GENERIC_PINCTRL_GROUPS and
    GENERIC_PINMUX_FUNCTIONS.

    2. Split pinctrl_register() into two parts

    By splitting pinctrl_register() into pinctrl_init_controller()
    and pinctrl_create_and_start() we have better control over when
    it's safe to call pinctrl_create().

    3. Introduce a new pinctrl_register_and_init() function

    As suggested by Linus Walleij , we
    can just introduce a new function for the controllers that need
    pinctrl_create() called later.

    4. Convert the four known problem cases to use new function

    Let's convert pinctrl-imx, pinctrl-single, sh-pfc and ti-iodelay
    to use the new function to fix the issues. The rest of the drivers
    can be converted later. Let's also update Documentation/pinctrl.txt
    accordingly because of the known issues with pinctrl_register().

    Fixes: df61b366af26 ("pinctrl: core: Use delayed work for hogs")
    Reported-by: Geert Uytterhoeven
    Cc: Gary Bisson
    Signed-off-by: Tony Lindgren
    Tested-by: Geert Uytterhoeven
    Signed-off-by: Linus Walleij

    Tony Lindgren
     

03 Jan, 2017

2 commits


30 Dec, 2016

1 commit


17 Nov, 2016

1 commit


12 Nov, 2016

2 commits


05 Nov, 2016

2 commits


28 Oct, 2016

2 commits

  • This is left over from initial experiments with more properties.
    It's only used in one place, so let's just get rid of it to make
    the code more readable.

    Signed-off-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Tony Lindgren
     
  • >From tony Mon Sep 17 00:00:00 2001
    From: Tony Lindgren
    Date: Tue, 25 Oct 2016 08:33:34 -0700
    Subject: [PATCHv2] pinctrl: single: Drop custom names

    We no longer need to allocate custom names as those are dynamically
    generated in pinctrl_register_one_pin() if no name is passed to
    pinctrl_register_pins().

    Signed-off-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Tony Lindgren
     

22 Jun, 2016

1 commit

  • With many repeated suspend resume cycles, the pin specific wakeirq
    may not always work on omaps. This is because the write to enable the
    pin interrupt may not have reached the device over the interconnect
    before suspend happens.

    Let's fix the issue with a flush of posted write with a readback.

    Cc: stable@vger.kernel.org
    Reported-by: Nishanth Menon
    Signed-off-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Tony Lindgren
     

15 Apr, 2016

1 commit

  • pcs_parse_bits_in_pinctrl_entry uses ffs which gives bit indices
    ranging from 1 to MAX. This leads to a corner case where we try to request
    the pin number = MAX and fails.

    bit_pos value is being calculted using ffs. pin_num_from_lsb uses
    bit_pos value. pins array is populated with:

    pin + pin_num_from_lsb.

    The above is 1 more than usual bit indices as bit_pos uses ffs to compute
    first set bit. Hence the last of the pins array is populated with the MAX
    value and not MAX - 1 which causes error when we call pin_request.

    mask_pos is rightly calculated as ((pcs->fmask) << (bit_pos - 1))
    Consequently val_pos and submask are correct.

    Hence use __ffs which gives (ffs(x) - 1) as the first bit set.

    fixes: 4e7e8017a8 ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
    Signed-off-by: Keerthy
    Acked-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Keerthy
     

12 Mar, 2016

1 commit

  • The single pinmux controller can be cascaded to the other interrupt
    controllers. Hence when propagating wake-up settings to its parent
    interrupt controller, there's possiblity of detecting possible recursive
    locking and getting lockdep warning.

    This patch avoids this false positive by using a separate lockdep class
    for this single pinctrl interrupts.

    Cc: linux-gpio@vger.kernel.org
    Suggested-by: Thomas Gleixner
    Signed-off-by: Sudeep Holla
    Reviewed-by: Grygorii Strashko
    Signed-off-by: Linus Walleij

    Sudeep Holla
     

17 Nov, 2015

1 commit

  • The pinctrl_unregister() function tests whether its argument is NULL
    and then returns immediately. Thus the test around the call is not needed.

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring
    Signed-off-by: Linus Walleij

    Markus Elfring
     

16 Sep, 2015

1 commit

  • Most interrupt flow handlers do not use the irq argument. Those few
    which use it can retrieve the irq number from the irq descriptor.

    Remove the argument.

    Search and replace was done with coccinelle and some extra helper
    scripts around it. Thanks to Julia for her help!

    Signed-off-by: Thomas Gleixner
    Cc: Julia Lawall
    Cc: Jiang Liu

    Thomas Gleixner
     

05 Sep, 2015

1 commit

  • Pull pin control updates from Linus Walleij:
    "This is the bulk of pin control changes for the v4.3 development
    cycle.

    Like with GPIO it's a lot of stuff. If my subsystems are any sign of
    the overall tempo of the kernel v4.3 will be a gigantic diff.

    [ It looks like 4.3 is calmer than 4.2 in most other subsystems, but
    we'll see - Linus ]

    Core changes:

    - It is possible configure groups in debugfs.

    - Consolidation of chained IRQ handler install/remove replacing all
    call sites where irq_set_handler_data() and
    irq_set_chained_handler() were done in succession with a combined
    call to irq_set_chained_handler_and_data(). This series was
    created by Thomas Gleixner after the problem was observed by
    Russell King.

    - Tglx also made another series of patches switching
    __irq_set_handler_locked() for irq_set_handler_locked() which is
    way cleaner.

    - Tglx also wrote a good bunch of patches to make use of
    irq_desc_get_xxx() accessors and avoid looking up irq_descs from
    IRQ numbers. The goal is to get rid of the irq number from the
    handlers in the IRQ flow which is nice.

    Driver feature enhancements:

    - Power management support for the SiRF SoC Atlas 7.

    - Power down support for the Qualcomm driver.

    - Intel Cherryview and Baytrail: switch drivers to use raw spinlocks
    in IRQ handlers to play nice with the realtime patch set.

    - Rework and new modes handling for Qualcomm SPMI-MPP.

    - Pinconf power source config for SH PFC.

    New drivers and subdrivers:

    - A new driver for Conexant Digicolor CX92755.

    - A new driver for UniPhier PH1-LD4, PH1-Pro4, PH1-sLD8, PH1-Pro5,
    ProXtream2 and PH1-LD6b SoC pin control support.

    - Reverse-egineered the S/PDIF settings for the Allwinner sun4i
    driver.

    - Support for Qualcomm Technologies QDF2xxx ARM64 SoCs

    - A new Freescale i.mx6ul subdriver.

    Cleanup:

    - Remove platform data support in a number of SH PFC subdrivers"

    * tag 'pinctrl-v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (95 commits)
    pinctrl: at91: fix null pointer dereference
    pinctrl: mediatek: Implement wake handler and suspend resume
    pinctrl: mediatek: Fix multiple registration issue.
    pinctrl: sh-pfc: r8a7794: add USB pin groups
    pinctrl: at91: Use generic irq_{request,release}_resources()
    pinctrl: cherryview: Use raw_spinlock for locking
    pinctrl: baytrail: Use raw_spinlock for locking
    pinctrl: imx6ul: Remove .owner field
    pinctrl: zynq: Fix typos in smc0_nand_grp and smc0_nor_grp
    pinctrl: sh-pfc: Implement pinconf power-source param for voltage switching
    clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks
    pinctrl: sun4i: add spdif to pin description.
    pinctrl: atlas7: clear ugly branch statements for pull and drivestrength
    pinctrl: baytrail: Serialize all register access
    pinctrl: baytrail: Drop FSF mailing address
    pinctrl: rockchip: only enable gpio clock when it setting
    pinctrl/mediatek: fix spelling mistake in dev_err error message
    pinctrl: cherryview: Serialize all register access
    pinctrl: UniPhier: PH1-Pro5: add I2C ch6 pin-mux setting
    pinctrl: nomadik: reflect current input value
    ...

    Linus Torvalds
     

28 Jul, 2015

1 commit

  • set_irq_flags is ARM specific with custom flags which have genirq
    equivalents. Convert drivers to use the genirq interfaces directly, so we
    can kill off set_irq_flags. The translation of flags is as follows:

    IRQF_VALID -> !IRQ_NOREQUEST
    IRQF_PROBE -> !IRQ_NOPROBE
    IRQF_NOAUTOEN -> IRQ_NOAUTOEN

    For IRQs managed by an irqdomain, the irqdomain core code handles clearing
    and setting IRQ_NOREQUEST already, so there is no need to do this in
    .map() functions and we can simply remove the set_irq_flags calls. Some
    users also modify IRQ_NOPROBE and this has been maintained although it
    is not clear that is really needed. There appears to be a great deal of
    blind copy and paste of this code.

    Signed-off-by: Rob Herring
    Cc: Stephen Warren
    Cc: Lee Jones
    Cc: Matthias Brugger
    Cc: Tomasz Figa
    Cc: Thomas Abraham
    Cc: Kukjin Kim
    Cc: Krzysztof Kozlowski
    Cc: linux-gpio@vger.kernel.org
    Cc: linux-rpi-kernel@lists.infradead.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-mediatek@lists.infradead.org
    Cc: linux-samsung-soc@vger.kernel.org
    Signed-off-by: Linus Walleij

    Rob Herring
     

20 Jul, 2015

1 commit

  • The PSC IRQ is requested using request_irq() API and as result it can
    be forced to be threaded IRQ in RT-Kernel if PCS_QUIRK_HAS_SHARED_IRQ
    is enabled for pinctrl domain.

    As result, following 'possible irq lock inversion dependency' report
    can be seen:
    =========================================================
    [ INFO: possible irq lock inversion dependency detected ]
    3.14.43-rt42-00360-g96ff499-dirty #24 Not tainted
    ---------------------------------------------------------
    irq/369-pinctrl/927 just changed the state of lock:
    (&pcs->lock){+.....}, at: [] pcs_irq_handle+0x48/0x9c
    but this lock was taken by another, HARDIRQ-safe lock in the past:
    (&irq_desc_lock_class){-.....}

    and interrupts could create inverse lock ordering between them.

    other info that might help us debug this:
    Possible interrupt unsafe locking scenario:

    CPU0 CPU1
    ---- ----
    lock(&pcs->lock);
    local_irq_disable();
    lock(&irq_desc_lock_class);
    lock(&pcs->lock);

    lock(&irq_desc_lock_class);

    *** DEADLOCK ***

    no locks held by irq/369-pinctrl/927.

    the shortest dependencies between 2nd lock and 1st lock:
    -> (&irq_desc_lock_class){-.....} ops: 58724 {
    IN-HARDIRQ-W at:
    [] lock_acquire+0x9c/0x158
    [] _raw_spin_lock+0x48/0x58
    [] handle_fasteoi_irq+0x24/0x15c
    [] generic_handle_irq+0x3c/0x4c
    [] handle_IRQ+0x50/0xa0
    [] gic_handle_irq+0x3c/0x6c
    [] __irq_svc+0x44/0x8c
    [] arch_cpu_idle+0x40/0x4c
    [] cpu_startup_entry+0x270/0x2e0
    [] rest_init+0xd4/0xe4
    [] start_kernel+0x3d0/0x3dc
    [] 0x80008084
    INITIAL USE at:
    [] lock_acquire+0x9c/0x158
    [] _raw_spin_lock_irqsave+0x54/0x68
    [] __irq_get_desc_lock+0x64/0xa4
    [] irq_set_chip+0x30/0x78
    [] irq_set_chip_and_handler_name+0x24/0x3c
    [] gic_irq_domain_map+0x48/0xb4
    [] irq_domain_associate+0x84/0x1d4
    [] irq_create_mapping+0x80/0x11c
    [] irq_create_of_mapping+0x80/0x120
    [] irq_of_parse_and_map+0x34/0x3c
    [] omap_dm_timer_init_one+0x90/0x30c
    [] omap5_realtime_timer_init+0x8c/0x48c
    [] time_init+0x28/0x38
    [] start_kernel+0x240/0x3dc
    [] 0x80008084
    }
    ... key at: [] irq_desc_lock_class+0x0/0x8
    ... acquired at:
    [] _raw_spin_lock+0x48/0x58
    [] pcs_irq_unmask+0x58/0xa0
    [] irq_enable+0x38/0x48
    [] irq_startup+0x78/0x7c
    [] __setup_irq+0x4a8/0x4f4
    [] request_threaded_irq+0xb8/0x138
    [] omap_8250_startup+0x4c/0x148
    [] serial8250_startup+0x24/0x30
    [] uart_startup.part.9+0x5c/0x1b4
    [] uart_open+0xf4/0x16c
    [] tty_open+0x170/0x61c
    [] chrdev_open+0xbc/0x1b4
    [] do_dentry_open+0x1e8/0x2bc
    [] finish_open+0x44/0x5c
    [] do_last.isra.47+0x710/0xca0
    [] path_openat+0xc4/0x640
    [] do_filp_open+0x3c/0x98
    [] do_sys_open+0x114/0x1d8
    [] SyS_open+0x28/0x2c
    [] kernel_init_freeable+0x168/0x1e4
    [] kernel_init+0x1c/0xf8
    [] ret_from_fork+0x14/0x20

    -> (&pcs->lock){+.....} ops: 65 {
    HARDIRQ-ON-W at:
    [] lock_acquire+0x9c/0x158
    [] _raw_spin_lock+0x48/0x58
    [] pcs_irq_handle+0x48/0x9c
    [] pcs_irq_handler+0x1c/0x28
    [] irq_forced_thread_fn+0x30/0x74
    [] irq_thread+0x158/0x1c4
    [] kthread+0xd4/0xe8
    [] ret_from_fork+0x14/0x20
    INITIAL USE at:
    [] lock_acquire+0x9c/0x158
    [] _raw_spin_lock_irqsave+0x54/0x68
    [] pcs_enable+0x7c/0xe8
    [] pinmux_enable_setting+0x178/0x220
    [] pinctrl_select_state+0x110/0x194
    [] pinctrl_bind_pins+0x7c/0x108
    [] driver_probe_device+0x70/0x254
    [] __driver_attach+0x9c/0xa0
    [] bus_for_each_dev+0x78/0xac
    [] driver_attach+0x2c/0x30
    [] bus_add_driver+0x15c/0x204
    [] driver_register+0x88/0x108
    [] __platform_driver_register+0x64/0x6c
    [] omap_hsmmc_driver_init+0x1c/0x20
    [] do_one_initcall+0x110/0x170
    [] kernel_init_freeable+0x140/0x1e4
    [] kernel_init+0x1c/0xf8
    [] ret_from_fork+0x14/0x20
    }
    ... key at: [] __key.18572+0x0/0x8
    ... acquired at:
    [] mark_lock+0x388/0x76c
    [] __lock_acquire+0x6d0/0x1f98
    [] lock_acquire+0x9c/0x158
    [] _raw_spin_lock+0x48/0x58
    [] pcs_irq_handle+0x48/0x9c
    [] pcs_irq_handler+0x1c/0x28
    [] irq_forced_thread_fn+0x30/0x74
    [] irq_thread+0x158/0x1c4
    [] kthread+0xd4/0xe8
    [] ret_from_fork+0x14/0x20

    stack backtrace:
    CPU: 1 PID: 927 Comm: irq/369-pinctrl Not tainted 3.14.43-rt42-00360-g96ff499-dirty #24
    [] (unwind_backtrace) from [] (show_stack+0x20/0x24)
    [] (show_stack) from [] (dump_stack+0x84/0xd0)
    [] (dump_stack) from [] (print_irq_inversion_bug+0x1d0/0x21c)
    [] (print_irq_inversion_bug) from [] (check_usage_backwards+0xb4/0x11c)
    [] (check_usage_backwards) from [] (mark_lock+0x388/0x76c)
    [] (mark_lock) from [] (__lock_acquire+0x6d0/0x1f98)
    [] (__lock_acquire) from [] (lock_acquire+0x9c/0x158)
    [] (lock_acquire) from [] (_raw_spin_lock+0x48/0x58)
    [] (_raw_spin_lock) from [] (pcs_irq_handle+0x48/0x9c)
    [] (pcs_irq_handle) from [] (pcs_irq_handler+0x1c/0x28)
    [] (pcs_irq_handler) from [] (irq_forced_thread_fn+0x30/0x74)
    [] (irq_forced_thread_fn) from [] (irq_thread+0x158/0x1c4)
    [] (irq_thread) from [] (kthread+0xd4/0xe8)
    [] (kthread) from [] (ret_from_fork+0x14/0x20)

    To fix it use IRQF_NO_THREAD to ensure that pcs irq will not be forced threaded.

    Cc: Tony Lindgren
    Cc: Sebastian Andrzej Siewior
    Signed-off-by: Grygorii Strashko
    Acked-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Grygorii Strashko
     

18 Jul, 2015

2 commits