26 Jan, 2017

3 commits

  • Do not hide pinctrl drivers for Mediatek platforms using
    conditionals. Doing so actually leaves the symbols present (but
    always disabled) on all other platforms, which is confusing and
    inefficient. Better use real dependencies so that the symbols do not
    exist at all on platforms where they are not relevant.

    Signed-off-by: Jean Delvare
    Reported-by: Andreas Färber
    Reviewed-by: Matthias Brugger
    Signed-off-by: Linus Walleij

    Jean Delvare
     
  • Linus Walleij
     
  • Currently we already have two pin configuration related callbacks
    available for GPIO chips .set_single_ended() and .set_debounce(). In
    future we expect to have even more, which does not scale well if we need
    to add yet another callback to the GPIO chip structure for each possible
    configuration parameter.

    Better solution is to reuse what we already have available in the
    generic pinconf.

    To support this, we introduce a new .set_config() callback for GPIO
    chips. The callback takes a single packed pin configuration value as
    parameter. This can then be extended easily beyond what is currently
    supported by just adding new types to the generic pinconf enum.

    If the GPIO driver is backed up by a pinctrl driver the GPIO driver can
    just assign gpiochip_generic_config() (introduced in this patch) to
    .set_config and that will take care configuration requests are directed
    to the pinctrl driver.

    We then convert the existing drivers over .set_config() and finally
    remove the .set_single_ended() and .set_debounce() callbacks.

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

    Mika Westerberg
     

30 Dec, 2016

1 commit


07 Dec, 2016

1 commit


22 Nov, 2016

1 commit


13 Sep, 2016

1 commit

  • These structures are only used to copy into other structures, so declare
    them as const.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @r disable optional_qualifier@
    identifier i;
    position p;
    @@
    static struct gpio_chip i@p = { ... };

    @ok@
    identifier r.i;
    expression e;
    position p;
    @@
    e = i@p;

    @bad@
    position p != {r.p,ok.p};
    identifier r.i;
    struct gpio_chip e;
    @@
    e@i@p

    @depends on !bad disable optional_qualifier@
    identifier r.i;
    @@
    static
    +const
    struct gpio_chip i = { ... };
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Linus Walleij

    Julia Lawall
     

27 Aug, 2016

1 commit

  • The Makefile currently controlling compilation of this code is:

    drivers/pinctrl/mediatek/pinctrl-mtk-common.o
    ---> drivers/pinctrl/mediatek/Makefile:obj-y += pinctrl-mtk-common.o

    ...meaning that it currently is not being built as a module by anyone.

    Lets remove the couple traces of modular infrastructure use, so that
    when reading the driver there is no doubt it is builtin-only.

    We delete the MODULE_LICENSE tag etc. since all that information
    is already contained at the top of the file in the comments.

    We don't replace module.h with init.h since the file doesn't need that.

    Cc: Linus Walleij
    Cc: Hongzhou Yang
    Cc: linux-gpio@vger.kernel.org
    Signed-off-by: Paul Gortmaker
    Signed-off-by: Linus Walleij

    Paul Gortmaker
     

29 Jul, 2016

1 commit

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

    Nothing stands out as especially exiting: new drivers, new subdrivers,
    lots of cleanups and incremental features.

    Business as usual.

    New drivers:

    - New driver for Oxnas pin control and GPIO. This ARM-based chipset
    is used in a few storage (NAS) type devices.

    - New driver for the MAX77620/MAX20024 pin controller portions.

    - New driver for the Intel Merrifield pin controller.

    New subdrivers:

    - New subdriver for the Qualcomm MDM9615

    - New subdriver for the STM32F746 MCU

    - New subdriver for the Broadcom NSP SoC.

    Cleanups:

    - Demodularization of bool compiled-in drivers.

    Apart from this there is just regular incremental improvements to a
    lot of drivers, especially Uniphier and PFC"

    * tag 'pinctrl-v4.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (131 commits)
    pinctrl: fix pincontrol definition for marvell
    pinctrl: xway: fix typo
    Revert "pinctrl: amd: make it explicitly non-modular"
    pinctrl: iproc: Add NSP and Stingray GPIO support
    pinctrl: Update iProc GPIO DT bindings
    pinctrl: bcm: add OF dependencies
    pinctrl: ns2: remove redundant dev_err call in ns2_pinmux_probe()
    pinctrl: Add STM32F746 MCU support
    pinctrl: intel: Protect set wake flow by spin lock
    pinctrl: nsp: remove redundant dev_err call in nsp_pinmux_probe()
    pinctrl: uniphier: add Ethernet pin-mux settings
    sh-pfc: Use PTR_ERR_OR_ZERO() to simplify the code
    pinctrl: ns2: fix return value check in ns2_pinmux_probe()
    pinctrl: qcom: update DT bindings with ebi2 groups
    pinctrl: qcom: establish proper EBI2 pin groups
    pinctrl: imx21: Remove the MODULE_DEVICE_TABLE() macro
    Documentation: dt: Add new compatible to STM32 pinctrl driver bindings
    includes: dt-bindings: Add STM32F746 pinctrl DT bindings
    pinctrl: sunxi: fix nand0 function name for sun8i
    pinctrl: uniphier: remove pointless pin-mux settings for PH1-LD11
    ...

    Linus Torvalds
     

08 Jun, 2016

1 commit

  • An irq which is a wake up source maybe masked unexpectedly if the wake
    up source irq was triggered after pinctrl irqchip suspend and before
    suspend_device_irqs finished.
    Use *_noirq callbacks to guarantee pinctrl irqchip suspend would be
    called after suspend_devices_irqs.

    Signed-off-by: hongkun.cao
    Signed-off-by: Linus Walleij

    hongkun.cao
     

31 May, 2016

1 commit

  • When a dual-edge irq is triggered, an incorrect irq will be reported on
    condition that the external signal is not stable and this incorrect irq
    has been registered.
    Correct the register offset.

    Cc: stable@vger.kernel.org
    Signed-off-by: Hongkun Cao
    Reviewed-by: Matthias Brugger
    Signed-off-by: Linus Walleij

    hongkun.cao
     

20 May, 2016

1 commit

  • Pull pin control updates from Linus Walleij:
    "This kernel cycle was quite calm when it comes to pin control and
    there is really just one major change, and that is the introduction of
    devm_pinctrl_register() managed resources.

    Apart from that linear development, details below.

    Core changes:

    - Add the devm_pinctrl_register() API and switch all applicable
    drivers to use it, saving lots of lines of code all over the place.

    New drivers:

    - driver for the Broadcom NS2 SoC

    - subdriver for the PXA25x SoCs

    - subdriver for the AMLogic Meson GXBB SoC

    Driver improvements:

    - the Intel Baytrail driver now properly supports pin control

    - Nomadik, Rockchip, Broadcom BCM2835 support the .get_direction()
    callback in the GPIO portions

    - continued development and stabilization of several SH-PFC SoC
    subdrivers: r8a7795, r8a7790, r8a7794 etc"

    * tag 'pinctrl-v4.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (85 commits)
    Revert "pinctrl: tegra: avoid parked_reg and parked_bank"
    pinctrl: meson: Fix eth_tx_en bit index
    pinctrl: tegra: avoid parked_reg and parked_bank
    pinctrl: tegra: Correctly check the supported configuration
    pinctrl: amlogic: Add support for Amlogic Meson GXBB SoC
    pinctrl: rockchip: fix pull setting error for rk3399
    pinctrl: stm32: Implement .pin_config_dbg_show()
    pinctrl: nomadik: hide nmk_gpio_get_mode when unused
    pinctrl: ns2: rename pinctrl_utils_dt_free_map
    pinctrl: at91: Merge clk_prepare and clk_enable into clk_prepare_enable
    pinctrl: at91: Make at91_gpio_template const
    pinctrl: baytrail: fix some error handling in debugfs
    pinctrl: ns2: add pinmux driver support for Broadcom NS2 SoC
    pinctrl: sirf/atlas7: trivial fix of spelling mistake on flagged
    pinctrl: sh-pfc: Kill unused variable in sh_pfc_remove()
    pinctrl: nomadik: implement .get_direction()
    pinctrl: nomadik: use BIT() with offsets consequently
    pinctrl: exynos5440: Use off-stack memory for pinctrl_gpio_range
    pinctrl: zynq: Use devm_pinctrl_register() for pinctrl registration
    pinctrl: u300: Use devm_pinctrl_register() for pinctrl registration
    ...

    Linus Torvalds
     

21 Apr, 2016

1 commit


15 Apr, 2016

1 commit

  • The debounce time unit for gpio_chip.set_debounce is us but
    mtk_gpio_set_debounce regard it as ms.
    Fix this by correct debounce time array dbnc_arr so it can find correct
    debounce setting. Debounce time for first debounce setting is 500us,
    correct this as well.

    While I'm at it, also change the debounce time array name to
    "debounce_time" for readability.

    Cc: stable@vger.kernel.org
    Signed-off-by: Yingjoe Chen
    Reviewed-by: Daniel Kurtz
    Acked-by: Hongzhou Yang
    Signed-off-by: Linus Walleij

    Yingjoe Chen
     

01 Apr, 2016

1 commit


10 Mar, 2016

1 commit


09 Mar, 2016

1 commit

  • The Kconfig for this driver is currently:

    config PINCTRL_MT6397
    bool "Mediatek MT6397 pin control" if COMPILE_TEST && !MFD_MT6397

    ...meaning that it is currently not being built as a module by anyone.
    Lets remove the modular code that is essentially orphaned, so that
    when reading the driver there is no doubt it is builtin-only.

    Since module_init translates to device_initcall in the non-modular
    case, the init ordering remains unchanged with this commit.

    We also delete the MODULE_LICENSE tag etc. since all that information
    is already contained at the top of the file in the comments.

    Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

    Cc: Matthias Brugger
    Cc: linux-gpio@vger.kernel.org
    Cc: linux-mediatek@lists.infradead.org
    Signed-off-by: Paul Gortmaker
    Acked-by: Hongzhou Yang
    Signed-off-by: Linus Walleij

    Paul Gortmaker
     

25 Feb, 2016

1 commit


19 Feb, 2016

3 commits


18 Feb, 2016

1 commit


16 Feb, 2016

1 commit


14 Feb, 2016

1 commit


09 Feb, 2016

1 commit


05 Feb, 2016

2 commits


28 Jan, 2016

1 commit


27 Jan, 2016

1 commit

  • The Kconfig for these drivers are currently:

    config PINCTRL_MT8127
    bool "Mediatek MT8127 pin control" if COMPILE_TEST && !MACH_MT8127

    config PINCTRL_MT8135
    bool "Mediatek MT8135 pin control" if COMPILE_TEST && !MACH_MT8135

    config PINCTRL_MT8173
    bool "Mediatek MT8173 pin control"

    ...meaning that they are currently not being built as a module by anyone.
    Lets remove the modular code that is essentially orphaned, so that
    when reading the driver there is no doubt it is builtin-only.

    A recent commit moved these from module_init to arch_initcall already, so
    the init ordering remains untouched with this commit.

    We also delete the MODULE_LICENSE tag etc. since all that information
    is already contained at the top of the file in the comments.

    Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

    Cc: Daniel Kurtz
    Cc: Matthias Brugger
    Cc: Hongzhou Yang
    Cc: Yingjoe Chen
    Cc: linux-gpio@vger.kernel.org
    Cc: linux-mediatek@lists.infradead.org
    Signed-off-by: Paul Gortmaker
    Signed-off-by: Linus Walleij

    Paul Gortmaker
     

18 Jan, 2016

1 commit

  • Pull GPIO updates from Linus Walleij:
    "Here is the bulk of GPIO changes for v4.5.

    Notably there are big refactorings mostly by myself, aimed at getting
    the gpio_chip into a shape that makes me believe I can proceed to
    preserve state for a proper userspace ABI (character device) that has
    already been proposed once, but resulted in the feedback that I need
    to go back and restructure stuff. So I've been restructuring stuff.
    On the way I ran into brokenness (return code from the get_value()
    callback) and had to fix it. Also, refactored generic GPIO to be
    simpler.

    Some of that is still waiting to trickle down from the subsystems all
    over the kernel that provide random gpio_chips, I've touched every
    single GPIO driver in the kernel now, oh man I didn't know I was
    responsible for so much...

    Apart from that we're churning along as usual.

    I took some effort to test and retest so it should merge nicely and we
    shook out a couple of bugs in -next.

    Infrastructural changes:

    - In struct gpio_chip, rename the .dev node to .parent to better
    reflect the fact that this is not the GPIO struct device
    abstraction. We will add that soon so this would be totallt
    confusing.

    - It was noted that the driver .get_value() callbacks was sometimes
    reporting negative -ERR values to the gpiolib core, expecting them
    to be propagated to consumer gpiod_get_value() and gpio_get_value()
    calls. This was not happening, so as there was a mess of drivers
    returning negative errors and some returning "anything else than
    zero" to indicate that a line was active. As some would have bit
    31 set to indicate "line active" it clashed with negative error
    codes. This is fixed by the largeish series clamping values in all
    drivers with !!value to [0,1] and then augmenting the code to
    propagate error codes to consumers. (Includes some ACKed patches
    in other subsystems.)

    - Add a void *data pointer to struct gpio_chip. The container_of()
    design pattern is indeed very nice, but we want to reform the
    struct gpio_chip to be a non-volative, stateless business, and keep
    states internal to the gpiolib to be able to hold on to the state
    when adding a proper userspace ABI (character device) further down
    the road. To achieve this, drivers need a handle at the internal
    state that is not dependent on their struct gpio_chip() so we add
    gpiochip_add_data() and gpiochip_get_data() following the pattern
    of many other subsystems. All the "use gpiochip data pointer"
    patches transforms drivers to this scheme.

    - The Generic GPIO chip header has been merged into the general
    header, and the custom header for that
    removed. Instead of having a separate mm_gpio_chip struct for
    these generic drivers, merge that into struct gpio_chip,
    simplifying the code and removing the need for separate and
    confusing includes.

    Misc improvements:

    - Stabilize the way GPIOs are looked up from the ACPI legacy
    specification.

    - Incremental driver features for PXA, PCA953X, Lantiq (patches from
    the OpenWRT community), RCAR, Zynq, PL061, 104-idi-48

    New drivers:

    - Add a GPIO chip to the ALSA SoC AC97 driver.

    - Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir,
    but the branch is merged here too to account for infrastructural
    changes).

    - The sx150x driver now supports the sx1502"

    * tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (220 commits)
    gpio: generic: make bgpio_pdata always visible
    gpiolib: fix chip order in gpio list
    gpio: mpc8xxx: Do not use gpiochip_get_data() in mpc8xxx_gpio_save_regs()
    gpio: mm-lantiq: Do not use gpiochip_get_data() in ltq_mm_save_regs()
    gpio: brcmstb: Allow building driver for BMIPS_GENERIC
    gpio: brcmstb: Set endian flags for big-endian MIPS
    gpio: moxart: fix build regression
    gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()
    leds: pca9532: use gpiochip data pointer
    leds: tca6507: use gpiochip data pointer
    hid: cp2112: use gpiochip data pointer
    bcma: gpio: use gpiochip data pointer
    avr32: gpio: use gpiochip data pointer
    video: fbdev: via: use gpiochip data pointer
    gpio: pch: Optimize pch_gpio_get()
    Revert "pinctrl: lantiq: Implement gpio_chip.to_irq"
    pinctrl: nsp-gpio: use gpiochip data pointer
    pinctrl: vt8500-wmt: use gpiochip data pointer
    pinctrl: exynos5440: use gpiochip data pointer
    pinctrl: at91-pio4: use gpiochip data pointer
    ...

    Linus Torvalds
     

05 Jan, 2016

1 commit


22 Dec, 2015

2 commits

  • Move pinctrl initialization earlier in boot so that real devices can find
    their pctldev without probe deferring.

    Note: We don't change mt6397 probe order in this patch, since MT6397 is mfd
    PMIC, which depends on pwrap on main AP to work. Since pmic-wrap itself
    is module_platform_driver, we keep it as module_init. A later patch
    will convert both pmic-wrap, and all functions of the MT6397 mfd to
    arch_initcall.

    Signed-off-by: Daniel Kurtz
    Signed-off-by: Linus Walleij

    Daniel Kurtz
     
  • for_each_child_of_node performs an of_node_get on each iteration, so a
    return from the loop requires an of_node_put.

    A simplified version of the semantic patch that fixes this problem is as
    follows (http://coccinelle.lip6.fr):

    //
    @@
    local idexpression n;
    expression e,e1;
    @@

    for_each_child_of_node(e1,n) {
    ...
    (
    of_node_put(n);
    |
    e = n
    |
    return n;
    |
    + of_node_put(n);
    ? return ...;
    )
    ...
    }
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Linus Walleij

    Julia Lawall
     

21 Dec, 2015

1 commit


17 Dec, 2015

1 commit


30 Nov, 2015

1 commit


19 Nov, 2015

1 commit

  • The name .dev in a struct is normally reserved for a struct device
    that is let us say a superclass to the thing described by the struct.
    struct gpio_chip stands out by confusingly using a struct device *dev
    to point to the parent device (such as a platform_device) that
    represents the hardware. As we want to give gpio_chip:s real devices,
    this is not working. We need to rename this member to parent.

    This was done by two coccinelle scripts, I guess it is possible to
    combine them into one, but I don't know such stuff. They look like
    this:

    @@
    struct gpio_chip *var;
    @@
    -var->dev
    +var->parent

    and:

    @@
    struct gpio_chip var;
    @@
    -var.dev
    +var.parent

    and:

    @@
    struct bgpio_chip *var;
    @@
    -var->gc.dev
    +var->gc.parent

    Plus a few instances of bgpio that I couldn't figure out how
    to teach Coccinelle to rewrite.

    This patch hits all over the place, but I *strongly* prefer this
    solution to any piecemal approaches that just exercise patch
    mechanics all over the place. It mainly hits drivers/gpio and
    drivers/pinctrl which is my own backyard anyway.

    Cc: Haavard Skinnemoen
    Cc: Rafał Miłecki
    Cc: Richard Purdie
    Cc: Mauro Carvalho Chehab
    Cc: Alek Du
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Acked-by: Dmitry Torokhov
    Acked-by: Greg Kroah-Hartman
    Acked-by: Lee Jones
    Acked-by: Jiri Kosina
    Acked-by: Hans-Christian Egtvedt
    Acked-by: Jacek Anaszewski
    Signed-off-by: Linus Walleij

    Linus Walleij
     

18 Nov, 2015

1 commit

  • Since Linux gpio framework return 0 for output, 1 for input.
    But HW use 0 stands for input, and 1 stands for output.
    So use negative to correct it.

    And gpio_chip.get is used to get input value, no need to get
    output value, so removing it.

    Signed-off-by: Hongzhou Yang
    Signed-off-by: Linus Walleij

    Hongzhou Yang
     

03 Nov, 2015

1 commit

  • Pull GPIO updates from Linus Walleij:
    "Here is the bulk of GPIO changes for the v4.4 development cycle.

    The only changes hitting outside drivers/gpio are in the pin control
    subsystem and these seem to have settled nicely in linux-next.

    Development mistakes and catfights are nicely documented in the
    reverts as you can see. The outcome of the ABI fight is that we're
    working on a chardev ABI for GPIO now, where hope to show results for
    the v4.5 kernel.

    Summary of changes:

    GPIO core:
    - Define and handle flags for open drain/open collector and open
    source/open emitter, also know as "single-ended" configurations.
    - Generic request/free operations that handle calling out to the
    (optional) pin control backend.
    - Some refactoring related to an ABI change that did not happen, yet
    provide useful.
    - Added a real-time compliance checklist. Many GPIO chips have
    irqchips, and need to think this over with the RT patches going
    upstream.
    - Restructure, fix and clean up Kconfig menus a bit.

    New drivers:
    - New driver for AMD Promony.
    - New driver for ACCES 104-IDIO-16, a port-mapped I/O card,
    ISA-style. Very retro.

    Subdriver changes:
    - OMAP changes to handle real time requirements.
    - Handle trigger types for edge and level IRQs on PL061 properly. As
    this hardware is very common it needs to set a proper example for
    others to follow.
    - Some container_of() cleanups.
    - Delete the unused MSM driver in favor of the driver that is
    embedded inside the pin control driver.
    - Cleanup of the ath79 GPIO driver used by many, many OpenWRT router
    targets.
    - A consolidated IT87xx driver replacing the earlier very specific
    IT8761e driver.
    - Handle the TI TCA9539 in the PCA953x driver. Also handle ACPI
    devices in this subdriver.
    - Drop xilinx arch dependencies as these FPGAs seem to profilate over
    a few different architectures. MIPS and ARM come to mind"

    * tag 'gpio-v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (57 commits)
    gpio: fix up SPI submenu
    gpio: drop surplus I2C dependencies
    gpio: drop surplus X86 dependencies
    gpio: dt-bindings: document the official use of "ngpios"
    gpio: MAINTAINERS: Add an entry for the ATH79 GPIO driver
    gpio / ACPI: Allow shared GPIO event to be read via operation region
    gpio: group port-mapped I/O drivers in a menu
    gpio: Add ACCES 104-IDIO-16 driver maintainer entry
    gpio: zynq: Document interrupt-controller DT binding
    gpio: xilinx: Drop architecture dependencies
    gpio: generic: Revert to old error handling in bgpio_map
    gpio: add a real time compliance notes
    Revert "gpio: add a real time compliance checklist"
    gpio: Add GPIO support for the ACCES 104-IDIO-16
    gpio: driver for AMD Promontory
    gpio: xlp: Convert to use gpiolib irqchip helpers
    gpio: add a real time compliance checklist
    gpio/xilinx: enable for MIPS
    gpiolib: Add and use OF_GPIO_SINGLE_ENDED flag
    gpiolib: Split GPIO flags parsing and GPIO configuration
    ...

    Linus Torvalds
     

17 Oct, 2015

1 commit

  • Replace all trivial request/free callbacks that do nothing but call into
    pinctrl code with the generic versions.

    Signed-off-by: Jonas Gorski
    Acked-by: Bjorn Andersson
    Acked-by: Heiko Stuebner
    Acked-by: Eric Anholt
    Acked-by: Mika Westerberg
    Acked-by: Andrew Bresticker
    Acked-by: Baruch Siach
    Acked-by: Matthias Brugger
    Acked-by: Lee Jones
    Acked-by: Laxman Dewangan
    Acked-by: Maxime Ripard
    Signed-off-by: Linus Walleij

    Jonas Gorski