11 Dec, 2018

4 commits

  • This adds a function named devm_gpiod_unhinge() that removes
    the resource management from a GPIO descriptor.

    I am not sure if this is the best anglosaxon name for the
    function, no other managed resources have an equivalent
    currently, but I chose "unhinge" as the closest intuitive
    thing I could imagine that fits Rusty Russell's API design
    criterions "the obvious use is the correct one" and
    "the name tells you how to use it".

    The idea came out of a remark from Mark Brown that it should
    be possible to handle over management of a resource from
    devres to the regulator core, and indeed we can do that.

    Signed-off-by: Linus Walleij
    Reviewed-by: Marek Szyprowski
    Tested-by: Marek Szyprowski
    Reviewed-by: Charles Keepax
    Signed-off-by: Mark Brown

    Linus Walleij
     
  • When we get a nonexeclusive GPIO descriptor using managed
    resources, we should only add it to the list of managed
    resources once: on the first user. Augment the
    devm_gpiod_get_index() and devm_gpiod_get_from_of_node()
    calls to account for this by checking if the descriptor
    is already resource managed before we proceed to allocate
    a new resource management struct.

    Fixes: b0ce7b29bfcd ("regulator/gpio: Allow nonexclusive GPIO access")
    Reported-by: Marek Szyprowski
    Signed-off-by: Linus Walleij
    Reviewed-by: Marek Szyprowski
    Tested-by: Marek Szyprowski
    Reviewed-by: Charles Keepax
    Signed-off-by: Mark Brown

    Linus Walleij
     
  • This makes gpiod_get_from_of_node() respect the
    GPIOD_FLAGS_BIT_NONEXCLUSIVE flag which is especially
    nice when getting regulator GPIOs right out of device
    tree nodes.

    Suggested-by: Marek Szyprowski
    Fixes: b0ce7b29bfcd ("regulator/gpio: Allow nonexclusive GPIO access")
    Signed-off-by: Linus Walleij
    Reviewed-by: Marek Szyprowski
    Tested-by: Marek Szyprowski
    Reviewed-by: Charles Keepax
    Signed-off-by: Mark Brown

    Linus Walleij
     
  • This function already exist inside gpiolib, we were just
    reluctant to make it available to the kernel at large as
    the devm_* seemed to be enough for anyone.

    However we found out that regulators need to do their own
    lifecycle/refcounting on GPIO descriptors and explicitly
    call gpiod_put() when done with a descriptor, so export
    this function so we can hand the refcounting over to the
    regulator core for these descriptors after retrieveal.

    Signed-off-by: Linus Walleij
    Reviewed-by: Marek Szyprowski
    Tested-by: Marek Szyprowski
    Reviewed-by: Charles Keepax
    Signed-off-by: Mark Brown

    Linus Walleij
     

25 Oct, 2018

1 commit

  • Pull PCI updates from Bjorn Helgaas:

    - Fix ASPM link_state teardown on removal (Lukas Wunner)

    - Fix misleading _OSC ASPM message (Sinan Kaya)

    - Make _OSC optional for PCI (Sinan Kaya)

    - Don't initialize ASPM link state when ACPI_FADT_NO_ASPM is set
    (Patrick Talbert)

    - Remove x86 and arm64 node-local allocation for host bridge structures
    (Punit Agrawal)

    - Pay attention to device-specific _PXM node values (Jonathan Cameron)

    - Support new Immediate Readiness bit (Felipe Balbi)

    - Differentiate between pciehp surprise and safe removal (Lukas Wunner)

    - Remove unnecessary pciehp includes (Lukas Wunner)

    - Drop pciehp hotplug_slot_ops wrappers (Lukas Wunner)

    - Tolerate PCIe Slot Presence Detect being hardwired to zero to
    workaround broken hardware, e.g., the Wilocity switch/wireless device
    (Lukas Wunner)

    - Unify pciehp controller & slot structs (Lukas Wunner)

    - Constify hotplug_slot_ops (Lukas Wunner)

    - Drop hotplug_slot_info (Lukas Wunner)

    - Embed hotplug_slot struct into users instead of allocating it
    separately (Lukas Wunner)

    - Initialize PCIe port service drivers directly instead of relying on
    initcall ordering (Keith Busch)

    - Restore PCI config state after a slot reset (Keith Busch)

    - Save/restore DPC config state along with other PCI config state
    (Keith Busch)

    - Reference count devices during AER handling to avoid race issue with
    concurrent hot removal (Keith Busch)

    - If an Upstream Port reports ERR_FATAL, don't try to read the Port's
    config space because it is probably unreachable (Keith Busch)

    - During error handling, use slot-specific reset instead of secondary
    bus reset to avoid link up/down issues on hotplug ports (Keith Busch)

    - Restore previous AER/DPC handling that does not remove and
    re-enumerate devices on ERR_FATAL (Keith Busch)

    - Notify all drivers that may be affected by error recovery resets
    (Keith Busch)

    - Always generate error recovery uevents, even if a driver doesn't have
    error callbacks (Keith Busch)

    - Make PCIe link active reporting detection generic (Keith Busch)

    - Support D3cold in PCIe hierarchies during system sleep and runtime,
    including hotplug and Thunderbolt ports (Mika Westerberg)

    - Handle hpmemsize/hpiosize kernel parameters uniformly, whether slots
    are empty or occupied (Jon Derrick)

    - Remove duplicated include from pci/pcie/err.c and unused variable
    from cpqphp (YueHaibing)

    - Remove driver pci_cleanup_aer_uncorrect_error_status() calls (Oza
    Pawandeep)

    - Uninline PCI bus accessors for better ftracing (Keith Busch)

    - Remove unused AER Root Port .error_resume method (Keith Busch)

    - Use kfifo in AER instead of a local version (Keith Busch)

    - Use threaded IRQ in AER bottom half (Keith Busch)

    - Use managed resources in AER core (Keith Busch)

    - Reuse pcie_port_find_device() for AER injection (Keith Busch)

    - Abstract AER interrupt handling to disconnect error injection (Keith
    Busch)

    - Refactor AER injection callbacks to simplify future improvments
    (Keith Busch)

    - Remove unused Netronome NFP32xx Device IDs (Jakub Kicinski)

    - Use bitmap_zalloc() for dma_alias_mask (Andy Shevchenko)

    - Add switch fall-through annotations (Gustavo A. R. Silva)

    - Remove unused Switchtec quirk variable (Joshua Abraham)

    - Fix pci.c kernel-doc warning (Randy Dunlap)

    - Remove trivial PCI wrappers for DMA APIs (Christoph Hellwig)

    - Add Intel GPU device IDs to spurious interrupt quirk (Bin Meng)

    - Run Switchtec DMA aliasing quirk only on NTB endpoints to avoid
    useless dmesg errors (Logan Gunthorpe)

    - Update Switchtec NTB documentation (Wesley Yung)

    - Remove redundant "default n" from Kconfig (Bartlomiej Zolnierkiewicz)

    - Avoid panic when drivers enable MSI/MSI-X twice (Tonghao Zhang)

    - Add PCI support for peer-to-peer DMA (Logan Gunthorpe)

    - Add sysfs group for PCI peer-to-peer memory statistics (Logan
    Gunthorpe)

    - Add PCI peer-to-peer DMA scatterlist mapping interface (Logan
    Gunthorpe)

    - Add PCI configfs/sysfs helpers for use by peer-to-peer users (Logan
    Gunthorpe)

    - Add PCI peer-to-peer DMA driver writer's documentation (Logan
    Gunthorpe)

    - Add block layer flag to indicate driver support for PCI peer-to-peer
    DMA (Logan Gunthorpe)

    - Map Infiniband scatterlists for peer-to-peer DMA if they contain P2P
    memory (Logan Gunthorpe)

    - Register nvme-pci CMB buffer as PCI peer-to-peer memory (Logan
    Gunthorpe)

    - Add nvme-pci support for PCI peer-to-peer memory in requests (Logan
    Gunthorpe)

    - Use PCI peer-to-peer memory in nvme (Stephen Bates, Steve Wise,
    Christoph Hellwig, Logan Gunthorpe)

    - Cache VF config space size to optimize enumeration of many VFs
    (KarimAllah Ahmed)

    - Remove unnecessary include (Bjorn Helgaas)

    - Fix VMD AERSID quirk Device ID matching (Jon Derrick)

    - Fix Cadence PHY handling during probe (Alan Douglas)

    - Signal Cadence Endpoint interrupts via AXI region 0 instead of last
    region (Alan Douglas)

    - Write Cadence Endpoint MSI interrupts with 32 bits of data (Alan
    Douglas)

    - Remove redundant controller tests for "device_type == pci" (Rob
    Herring)

    - Document R-Car E3 (R8A77990) bindings (Tho Vu)

    - Add device tree support for R-Car r8a7744 (Biju Das)

    - Drop unused mvebu PCIe capability code (Thomas Petazzoni)

    - Add shared PCI bridge emulation code (Thomas Petazzoni)

    - Convert mvebu to use shared PCI bridge emulation (Thomas Petazzoni)

    - Add aardvark Root Port emulation (Thomas Petazzoni)

    - Support 100MHz/200MHz refclocks for i.MX6 (Lucas Stach)

    - Add initial power management for i.MX7 (Leonard Crestez)

    - Add PME_Turn_Off support for i.MX7 (Leonard Crestez)

    - Fix qcom runtime power management error handling (Bjorn Andersson)

    - Update TI dra7xx unaligned access errata workaround for host mode as
    well as endpoint mode (Vignesh R)

    - Fix kirin section mismatch warning (Nathan Chancellor)

    - Remove iproc PAXC slot check to allow VF support (Jitendra Bhivare)

    - Quirk Keystone K2G to limit MRRS to 256 (Kishon Vijay Abraham I)

    - Update Keystone to use MRRS quirk for host bridge instead of open
    coding (Kishon Vijay Abraham I)

    - Refactor Keystone link establishment (Kishon Vijay Abraham I)

    - Simplify and speed up Keystone link training (Kishon Vijay Abraham I)

    - Remove unused Keystone host_init argument (Kishon Vijay Abraham I)

    - Merge Keystone driver files into one (Kishon Vijay Abraham I)

    - Remove redundant Keystone platform_set_drvdata() (Kishon Vijay
    Abraham I)

    - Rename Keystone functions for uniformity (Kishon Vijay Abraham I)

    - Add Keystone device control module DT binding (Kishon Vijay Abraham
    I)

    - Use SYSCON API to get Keystone control module device IDs (Kishon
    Vijay Abraham I)

    - Clean up Keystone PHY handling (Kishon Vijay Abraham I)

    - Use runtime PM APIs to enable Keystone clock (Kishon Vijay Abraham I)

    - Clean up Keystone config space access checks (Kishon Vijay Abraham I)

    - Get Keystone outbound window count from DT (Kishon Vijay Abraham I)

    - Clean up Keystone outbound window configuration (Kishon Vijay Abraham
    I)

    - Clean up Keystone DBI setup (Kishon Vijay Abraham I)

    - Clean up Keystone ks_pcie_link_up() (Kishon Vijay Abraham I)

    - Fix Keystone IRQ status checking (Kishon Vijay Abraham I)

    - Add debug messages for all Keystone errors (Kishon Vijay Abraham I)

    - Clean up Keystone includes and macros (Kishon Vijay Abraham I)

    - Fix Mediatek unchecked return value from devm_pci_remap_iospace()
    (Gustavo A. R. Silva)

    - Fix Mediatek endpoint/port matching logic (Honghui Zhang)

    - Change Mediatek Root Port Class Code to PCI_CLASS_BRIDGE_PCI (Honghui
    Zhang)

    - Remove redundant Mediatek PM domain check (Honghui Zhang)

    - Convert Mediatek to pci_host_probe() (Honghui Zhang)

    - Fix Mediatek MSI enablement (Honghui Zhang)

    - Add Mediatek system PM support for MT2712 and MT7622 (Honghui Zhang)

    - Add Mediatek loadable module support (Honghui Zhang)

    - Detach VMD resources after stopping root bus to prevent orphan
    resources (Jon Derrick)

    - Convert pcitest build process to that used by other tools (iio, perf,
    etc) (Gustavo Pimentel)

    * tag 'pci-v4.20-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (140 commits)
    PCI/AER: Refactor error injection fallbacks
    PCI/AER: Abstract AER interrupt handling
    PCI/AER: Reuse existing pcie_port_find_device() interface
    PCI/AER: Use managed resource allocations
    PCI: pcie: Remove redundant 'default n' from Kconfig
    PCI: aardvark: Implement emulated root PCI bridge config space
    PCI: mvebu: Convert to PCI emulated bridge config space
    PCI: mvebu: Drop unused PCI express capability code
    PCI: Introduce PCI bridge emulated config space common logic
    PCI: vmd: Detach resources after stopping root bus
    nvmet: Optionally use PCI P2P memory
    nvmet: Introduce helper functions to allocate and free request SGLs
    nvme-pci: Add support for P2P memory in requests
    nvme-pci: Use PCI p2pmem subsystem to manage the CMB
    IB/core: Ensure we map P2P memory correctly in rdma_rw_ctx_[init|destroy]()
    block: Add PCI P2P flag for request queue
    PCI/P2PDMA: Add P2P DMA driver writer's documentation
    docs-rst: Add a new directory for PCI documentation
    PCI/P2PDMA: Introduce configfs/sysfs enable attribute helpers
    PCI/P2PDMA: Add PCI p2pmem DMA mappings to adjust the bus offset
    ...

    Linus Torvalds
     

23 Oct, 2018

2 commits

  • Pull GPIO updates from Linus Walleij:
    "This is the bulk of GPIO changes for the v4.20 series:

    Core changes:

    - A patch series from Hans Verkuil to make it possible to
    enable/disable IRQs on a GPIO line at runtime and drive GPIO lines
    as output without having to put/get them from scratch.

    The irqchip callbacks have been improved so that they can use only
    the fastpatch callbacks to enable/disable irqs like any normal
    irqchip, especially the gpiod_lock_as_irq() has been improved to be
    callable in fastpath context.

    A bunch of rework had to be done to achieve this but it is a big
    win since I never liked to restrict this to slowpath. The only call
    requireing slowpath was try_module_get() and this is kept at the
    .request_resources() slowpath callback. In the GPIO CEC driver this
    is a big win sine a single line is used for both outgoing and
    incoming traffic, and this needs to use IRQs for incoming traffic
    while actively driving the line for outgoing traffic.

    - Janusz Krzysztofik improved the GPIO array API to pass a "cookie"
    (struct gpio_array) and a bitmap for setting or getting multiple
    GPIO lines at once.

    This improvement orginated in a specific need to speed up an OMAP1
    driver and has led to a much better API and real performance gains
    when the state of the array can be used to bypass a lot of checks
    and code when we want things to go really fast.

    The previous code would minimize the number of calls down to the
    driver callbacks assuming the CPU speed was orders of magnitude
    faster than the I/O latency, but this assumption was wrong on
    several platforms: what we needed to do was to profile and improve
    the speed on the hot path of the array functions and this change is
    now completed.

    - Clean out the painful and hard to grasp BNF experiments from the
    device tree bindings. Future approaches are looking into using JSON
    schema for this purpose. (Rob Herring is floating a patch series.)

    New drivers:

    - The RCAR driver now supports r8a774a1 (RZ/G2M).

    - Synopsys GPIO via CREGs driver.

    Major improvements:

    - Modernization of the EP93xx driver to use irqdomain and other
    contemporary concepts.

    - The ingenic driver has been merged into the Ingenic pin control
    driver and removed from the GPIO subsystem.

    - Debounce support in the ftgpio010 driver"

    * tag 'gpio-v4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (116 commits)
    gpio: Clarify kerneldoc on gpiochip_set_chained_irqchip()
    gpio: Remove unused 'irqchip' argument to gpiochip_set_cascaded_irqchip()
    gpio: Drop parent irq assignment during cascade setup
    mmc: pwrseq_simple: Fix incorrect handling of GPIO bitmap
    gpio: fix SNPS_CREG kconfig dependency warning
    gpiolib: Initialize gdev field before is used
    gpio: fix kernel-doc after devres.c file rename
    gpio: fix doc string for devm_gpiochip_add_data() to not talk about irq_chip
    gpio: syscon: Fix possible NULL ptr usage
    gpiolib: Show correct direction from the beginning
    pinctrl: msm: Use init_valid_mask exported function
    gpiolib: Add init_valid_mask exported function
    GPIO: add single-register GPIO via CREG driver
    dt-bindings: Document the Synopsys GPIO via CREG bindings
    gpio: mockup: use device properties instead of platform_data
    gpio: Slightly more helpful debugfs
    gpio: omap: Remove set but not used variable 'dev'
    gpio: omap: drop omap_gpio_list
    Accept partial 'gpio-line-names' property.
    gpio: omap: get rid of the conditional PM runtime calls
    ...

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

    There were no significant changes to the core this time! Bur the new
    Qualcomm, Mediatek and Broadcom drivers are quite interesting as they
    will be used in a few million embedded devices the coming years as it
    seems.

    New drivers:

    - Broadcom Northstar pin control driver.

    - Mediatek MT8183 subdriver.

    - Mediatek MT7623 subdriver.

    - Mediatek MT6765 subdriver.

    - Meson g12a subdriver.

    - Nuvoton NPCM7xx pin control and GPIO driver.

    - Qualcomm QCS404 pin control and GPIO subdriver.

    - Qualcomm SDM660 pin control and GPIO subdriver.

    - Renesas R8A7744 PFC subdriver.

    - Renesas R8A774C0 PFC subdriver.

    - Renesas RZ/N1 pinctrl driver

    Major improvements:

    - Pulled the GPIO support for Ingenic over from the GPIO subsystem
    and consolidated it all in the Ingenic pin control driver.

    - Major cleanups and consolidation work in all Intel drivers.

    - Major cleanups and consolidation work in all Mediatek drivers.

    - Lots of incremental improvements to the Renesas PFC pin controller
    family.

    - All drivers doing GPIO now include and
    nothing else"

    * tag 'pinctrl-v4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (153 commits)
    pinctrl: sunxi: Fix a memory leak in 'sunxi_pinctrl_build_state()'
    gpio: uniphier: include instead of
    pinctrl: uniphier: include instead of
    dt-bindings: pinctrl: bcm4708-pinmux: improve example binding
    pinctrl: geminilake: Sort register offsets by value
    pinctrl: geminilake: Get rid of unneeded ->probe() stub
    pinctrl: geminilake: Update pin list for B0 stepping
    pinctrl: renesas: Fix platform_no_drv_owner.cocci warnings
    pinctrl: mediatek: Make eint_m u16
    pinctrl: bcm: ns: Use uintptr_t for casting data
    pinctrl: madera: Fix uninitialized variable bug in madera_mux_set_mux
    pinctrl: gemini: Fix up TVC clock group
    pinctrl: gemini: Drop noisy debug prints
    pinctrl: gemini: Mask and set properly
    pinctrl: mediatek: select GPIOLIB
    pinctrl: rza1: don't manually release devm managed resources
    MAINTAINERS: update entry for Mediatek pin controller
    pinctrl: bcm: add Northstar driver
    dt-bindings: pinctrl: document Broadcom Northstar pin mux controller
    pinctrl: qcom: fix 'const' pointer handling
    ...

    Linus Torvalds
     

22 Oct, 2018

1 commit


16 Oct, 2018

4 commits

  • The reason of including here is just for BIT() and
    GENMASK macros.

    Since commit 8bd9cb51daac8 ("locking/atomics, asm-generic: Move some
    macros from to a new file"),
    is enough for such compile-time macros.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Linus Walleij

    Masahiro Yamada
     
  • This doesn't support nested anymore, so drivers shouldn't call it with
    the handler set to NULL.

    Cc: Evan Green
    Cc: Thierry Reding
    Cc: Grygorii Strashko
    Signed-off-by: Stephen Boyd
    Signed-off-by: Linus Walleij

    Stephen Boyd
     
  • This argument hasn't ever been used since it was introduced in commit
    1425052097b5 ("gpio: add IRQ chip helpers in gpiolib"). Let's drop it to
    reduce reading confusion.

    Cc: Evan Green
    Cc: Thierry Reding
    Cc: Grygorii Strashko
    Signed-off-by: Stephen Boyd
    Signed-off-by: Linus Walleij

    Stephen Boyd
     
  • We want to set the irq parent for interrupts that we're setting up to be
    cascaded from another interrupt controller, but we may or may not have
    already mapped the gpiochip irqs into the kernel's virtual irq number
    space at this point. If we have mapped irqs before calling here, then
    we've gone through gpiochip_irq_map() and called irq_set_parent()
    already. If we haven't mapped irqs, then the gpiochip is dynamically
    mapping irqs and we can rely on gpiochip_irq_map() or the gpio driver's
    irqdomain ops to setup the irq parent properly.

    Either way, setting the parent here when cascading the gpiochip doesn't
    make much sense because it should be done at irq mapping time. In the
    dynamic mapping case, this code is mapping virq 0 to some parent virq in
    a loop. While that's benign, let's drop this code to simplify.

    Cc: Evan Green
    Cc: Thierry Reding
    Cc: Grygorii Strashko
    Signed-off-by: Stephen Boyd
    Signed-off-by: Linus Walleij

    Stephen Boyd
     

15 Oct, 2018

1 commit

  • Fix kconfig warning for GPIO_SNPS_CREG:

    WARNING: unmet direct dependencies detected for OF_GPIO
    Depends on [n]: GPIOLIB [=y] && OF [=n] && HAS_IOMEM [=y]
    Selected by [y]:
    - GPIO_SNPS_CREG [=y] && GPIOLIB [=y] && HAS_IOMEM [=y] && (ARC || COMPILE_TEST [=y])

    Drivers in drivers/gpio/Kconfig depend on OF_GPIO, not select it.
    This prevents attempting to build when OF is not enabled.

    Signed-off-by: Randy Dunlap
    Cc: Linus Walleij
    Cc: linux-gpio@vger.kernel.org
    Cc: Eugeniy Paltsev
    Signed-off-by: Linus Walleij

    Randy Dunlap
     

13 Oct, 2018

1 commit

  • This allows nonexclusive (simultaneous) access to a single
    GPIO line for the fixed regulator enable line. This happens
    when several regulators use the same GPIO for enabling and
    disabling a regulator, and all need a handle on their GPIO
    descriptor.

    This solution with a special flag is not entirely elegant
    and should ideally be replaced by something more careful as
    this makes it possible for several consumers to
    enable/disable the same GPIO line to the left and right
    without any consistency. The current use inside the regulator
    core should however be fine as it takes special care to
    handle this.

    For the state of the GPIO backend, this is still the
    lesser evil compared to going back to global GPIO
    numbers.

    Cc: Marek Szyprowski
    Cc: Jon Hunter
    Fixes: efdfeb079cc3 ("regulator: fixed: Convert to use GPIO descriptor only")
    Reported-by: Marek Szyprowski
    Tested-by: Jon Hunter
    Tested-by: Marek Szyprowski
    Signed-off-by: Linus Walleij
    Signed-off-by: Mark Brown

    Linus Walleij
     

12 Oct, 2018

1 commit


10 Oct, 2018

6 commits

  • gpiochip_set_cascaded_irqchip() is passed 'parent_irq' as an argument
    and then the address of that argument is assigned to the gpio chips
    gpio_irq_chip 'parents' pointer shortly thereafter. This can't ever
    work, because we've just assigned some stack address to a pointer that
    we plan to dereference later in gpiochip_irq_map(). I ran into this
    issue with the KASAN report below when gpiochip_irq_map() tried to setup
    the parent irq with a total junk pointer for the 'parents' array.

    BUG: KASAN: stack-out-of-bounds in gpiochip_irq_map+0x228/0x248
    Read of size 4 at addr ffffffc0dde472e0 by task swapper/0/1

    CPU: 7 PID: 1 Comm: swapper/0 Not tainted 4.14.72 #34
    Call trace:
    [] dump_backtrace+0x0/0x718
    [] show_stack+0x20/0x2c
    [] __dump_stack+0x20/0x28
    [] dump_stack+0x80/0xbc
    [] print_address_description+0x70/0x238
    [] kasan_report+0x1cc/0x260
    [] __asan_report_load4_noabort+0x2c/0x38
    [] gpiochip_irq_map+0x228/0x248
    [] irq_domain_associate+0x114/0x2ec
    [] irq_create_mapping+0x120/0x234
    [] irq_create_fwspec_mapping+0x4c8/0x88c
    [] irq_create_of_mapping+0x180/0x210
    [] of_irq_get+0x138/0x198
    [] spi_drv_probe+0x94/0x178
    [] driver_probe_device+0x51c/0x824
    [] __device_attach_driver+0x148/0x20c
    [] bus_for_each_drv+0x120/0x188
    [] __device_attach+0x19c/0x2dc
    [] device_initial_probe+0x20/0x2c
    [] bus_probe_device+0x80/0x154
    [] device_add+0x9b8/0xbdc
    [] spi_add_device+0x1b8/0x380
    [] spi_register_controller+0x111c/0x1378
    [] spi_geni_probe+0x4dc/0x6f8
    [] platform_drv_probe+0xdc/0x130
    [] driver_probe_device+0x51c/0x824
    [] __driver_attach+0x100/0x194
    [] bus_for_each_dev+0x104/0x16c
    [] driver_attach+0x48/0x54
    [] bus_add_driver+0x274/0x498
    [] driver_register+0x1ac/0x230
    [] __platform_driver_register+0xcc/0xdc
    [] spi_geni_driver_init+0x1c/0x24
    [] do_one_initcall+0x240/0x3dc
    [] kernel_init_freeable+0x378/0x468
    [] kernel_init+0x14/0x110
    [] ret_from_fork+0x10/0x18

    The buggy address belongs to the page:
    page:ffffffbf037791c0 count:0 mapcount:0 mapping: (null) index:0x0
    flags: 0x4000000000000000()
    raw: 4000000000000000 0000000000000000 0000000000000000 00000000ffffffff
    raw: ffffffbf037791e0 ffffffbf037791e0 0000000000000000 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
    ffffffc0dde47180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ffffffc0dde47200: f1 f1 f1 f1 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f2 f2
    >ffffffc0dde47280: f2 f2 00 00 00 00 00 00 00 00 00 00 f3 f3 f3 f3
    ^
    ffffffc0dde47300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ffffffc0dde47380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

    Let's leave around one unsigned int in the gpio_irq_chip struct for the
    single parent irq case and repoint the 'parents' array at it. This way
    code is left mostly intact to setup parents and we waste an extra few
    bytes per structure of which there should be only a handful in a system.

    Cc: Evan Green
    Cc: Thierry Reding
    Cc: Grygorii Strashko
    Fixes: e0d897289813 ("gpio: Implement tighter IRQ chip integration")
    Signed-off-by: Stephen Boyd
    Signed-off-by: Linus Walleij

    Stephen Boyd
     
  • The function is about adding a gpio_chip so dev has to belong to this
    one. Fix wording to be more grammatically correct (but attention, I'm
    not a native speaker).

    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Linus Walleij

    Uwe Kleine-König
     
  • The priv->data->set can be NULL while flags contains GPIO_SYSCON_FEAT_OUT
    and chip->set is valid pointer. This happens in case the controller uses
    the default GPIO setter. Always use chip->set to access the setter to avoid
    possible NULL pointer dereferencing.

    Signed-off-by: Marek Vasut
    Signed-off-by: Linus Walleij

    Marek Vasut
     
  • Current code assumes that the direction is input if direction_input
    function is set.
    This might not be the case on GPIOs with programmable direction.

    Signed-off-by: Ricardo Ribalda Delgado
    Tested-by: Jeffrey Hugo
    Signed-off-by: Linus Walleij

    Ricardo Ribalda Delgado
     
  • Add a function that allows initializing the valid_mask from
    gpiochip_add_data.

    This prevents race conditions during gpiochip initialization.

    If the function is not exported, then the old behaviour is respected,
    this is, set all gpios as valid.

    Signed-off-by: Ricardo Ribalda Delgado
    Tested-by: Jeffrey Hugo
    Signed-off-by: Linus Walleij

    Ricardo Ribalda Delgado
     
  • Add single-register MMIO GPIO driver for complex cases where
    only several fields in register belong to GPIO lines and each GPIO
    line owns a field with different length and on/off value.

    Such CREG GPIOs are used in Synopsys AXS10x and HSDK boards.

    Signed-off-by: Eugeniy Paltsev
    Signed-off-by: Linus Walleij

    Eugeniy Paltsev
     

03 Oct, 2018

2 commits

  • Some users want to introduce device tree support to the mockup driver.
    Let's make it easier by switching to using generic device properties.
    The driver stays compatible with previous use cases and after this
    conversion there'll be no need to change the way probing of mockup
    GPIO chips works.

    Tested with libgpiod test suite.

    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Linus Walleij

    Bartosz Golaszewski
     
  • It is possible to have _DSD entries where the data is compatible with
    device properties format but are using different GUID for various reasons.
    In addition to that there can be many such _DSD entries for a single device
    such as for PCIe root port used to host a Thunderbolt hierarchy:

    Scope (\_SB.PCI0.RP21)
    {
    Name (_DSD, Package () {
    ToUUID ("6211e2c0-58a3-4af3-90e1-927a4e0c55a4"),
    Package () {
    Package () {"HotPlugSupportInD3", 1}
    },

    ToUUID ("efcc06cc-73ac-4bc3-bff0-76143807c389"),
    Package () {
    Package () {"ExternalFacingPort", 1},
    Package () {"UID", 0 }
    }
    })
    }

    More information about these new _DSD entries can be found in:

    https://docs.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports

    To make these available for drivers via unified device property APIs,
    modify ACPI property core so that it supports multiple _DSD entries
    organized in a linked list. We also store GUID of each _DSD entry in struct
    acpi_device_properties in case there is need to differentiate between
    entries. The supported GUIDs are then listed in prp_guids array.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Rafael J. Wysocki
    Acked-by: Sakari Ailus

    Mika Westerberg
     

02 Oct, 2018

1 commit


01 Oct, 2018

9 commits

  • Fixes gcc '-Wunused-but-set-variable' warning:

    drivers/gpio/gpio-omap.c: In function 'gpio_omap_cpu_notifier':
    drivers/gpio/gpio-omap.c:1327:17: warning:
    variable 'dev' set but not used [-Wunused-but-set-variable]

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

    YueHaibing
     
  • omap_gpio_list is unused so drop it.

    Signed-off-by: Grygorii Strashko
    Acked-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Grygorii Strashko
     
  • This is the 4.19-rc6 release

    I needed to merge this in because of extensive conflicts in
    the MSM and Intel pin control drivers. I know how to resolve
    them, so let's do it like this.

    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • Documentation/devicetree/bindings/gpio/gpio.txt says: "The names are
    assigned starting from line offset 0 from left to right from the
    passed array. An incomplete array (where the number of passed named
    are less than ngpios) will still be used up until the last provided
    valid line index". This patch makes it actually work this way.

    Signed-off-by: Christophe Blaess
    Signed-off-by: Patrick Boettcher
    Signed-off-by: Linus Walleij

    Christophe Blaess
     
  • OMAP GPIO driver is checking !BANK_USED() used condition before calling PM
    runtime API, because of PM runtime calls in
    omap2_gpio_prepare/resume_for_idle(). It's not required any more since
    "omap gpio add level idle, cpu_pm and drop runtime_irq_safe" series [1]
    from Tony Lindgren was accepted and PM runtime management was enabled in
    IRQ chip core by commit be45beb2df69 ("genirq: Add runtime power management
    support for IRQ chips") .

    As result safely drop !BANK_USED() checks from omap_gpio_request/free(),
    omap_gpio_irq_bus_lock/unlock() and enable PM runtime management for OMAP
    GPIO IRQ chip.

    [1] https://www.spinics.net/lists/arm-kernel/msg677583.html
    Tested-by: Tony Lindgren
    Signed-off-by: Grygorii Strashko
    Signed-off-by: Linus Walleij

    Grygorii Strashko
     
  • Fixes gcc '-Wunused-but-set-variable' warning:

    drivers/gpio/gpio-htc-egpio.c: In function 'egpio_set':
    drivers/gpio/gpio-htc-egpio.c:192:20: warning:
    variable 'bit' set but not used [-Wunused-but-set-variable]

    Signed-off-by: YueHaibing
    Signed-off-by: Linus Walleij

    YueHaibing
     
  • Fixes: 3027743f83f867d8 ("gpio: Remove VLA from gpiolib")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Linus Walleij

    Geert Uytterhoeven
     
  • Internal helper function gpiod_set_array_value_complex() was changed to
    return an error value, but not all gpiolib callers were updated to
    propagate the new error up.

    Fixes: 3027743f83f867d8 ("gpio: Remove VLA from gpiolib")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Linus Walleij

    Geert Uytterhoeven
     
  • Commit b17566a6b08b ("gpiolib: Implement fast processing path in
    get/set array"), already fixed to some extent with commit 5d581d7e8cdc
    ("gpiolib: Fix missing updates of bitmap index"), introduced a new mode
    of processing bitmaps where bits applicable for fast bitmap processing
    path are supposed to be skipped while iterating bits which don't apply.
    Unfortunately, find_next_zero_bit() function supposed to skip over
    those fast bits is always called with a 'start' argument equal to an
    index of last zero bit found and returns that index value again an
    again, causing an infinite loop.

    Fix it by incrementing the index uncoditionally before
    find_next_zero_bit() is optionally called.

    Reported-by: Marek Szyprowski
    Signed-off-by: Janusz Krzysztofik
    Tested-by: Marek Szyprowski
    Signed-off-by: Linus Walleij

    Janusz Krzysztofik
     

28 Sep, 2018

1 commit


25 Sep, 2018

5 commits


24 Sep, 2018

1 commit

  • If a gpio instance has any GPIO bits requested we do a pm_runtime_get()
    on the device. Now with cpu_pm handling the deeper SoC idle state quirks,
    let's just remove pm_runtime_irq_safe() call and add a warning in case we
    ever happen to encounter it.

    Cc: Aaro Koskinen
    Cc: Keerthy
    Cc: Ladislav Michl
    Cc: Tero Kristo
    Signed-off-by: Tony Lindgren
    Acked-by: Grygorii Strashko
    Signed-off-by: Linus Walleij

    Tony Lindgren