Commit graph

4312 commits

Author SHA1 Message Date
Yash Shah a924eae751 gpio: sifive: fix static checker warning
Typcasting "irq_state" leads to the below static checker warning:
The fix is to declare "irq_state" as unsigned long instead of u32.

	drivers/gpio/gpio-sifive.c:97 sifive_gpio_irq_enable()
	warn: passing casted pointer '&chip->irq_state' to
	'assign_bit()' 32 vs 64.

Fixes: 96868dce64 ("gpio/sifive: Add GPIO driver for SiFive SoCs")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yash Shah <yash.shah@sifive.com>
Link: https://lore.kernel.org/r/1580189061-14091-1-git-send-email-yash.shah@sifive.com
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-02-10 13:54:17 +01:00
Paul Thomas c3afa804c5 gpio: xilinx: Fix bug where the wrong GPIO register is written to
Care is taken with "index", however with the current version
the actual xgpio_writereg is using index for data but
xgpio_regoffset(chip, i) for the offset. And since i is already
incremented it is incorrect. This patch fixes it so that index
is used for the offset too.

Cc: stable@vger.kernel.org
Signed-off-by: Paul Thomas <pthomas8589@gmail.com>
Link: https://lore.kernel.org/r/20200125221410.8022-1-pthomas8589@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-02-10 12:52:34 +01:00
Kent Gibson 8131b73b22 gpiolib: remove unnecessary argument from set_config call
Remove unnecessary argument when setting PIN_CONFIG_BIAS_DISABLE. No
argument is expected by pinctrl, so removing it should be harmless.

Fixes: 2148ad7790 ("gpiolib: add support for disabling line bias")
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-02-10 10:55:18 +01:00
Axel Lin 4d0cabbb8b gpio: bd71828: Remove unneeded defines for GPIO_LINE_DIRECTION_IN/OUT
They are defined in gpio/driver.h now.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-02-10 10:55:18 +01:00
Bartosz Golaszewski 62adc6f33d gpiolib: fix gpio_do_set_config()
Commit d90f36851d ("gpiolib: have a single place of calling
set_config()") introduced a regression where we don't pass the right
variable as argument to the set_config() callback of gpio driver from
gpio_set_config(). After reverting two additional patches that came
on top of it - this addresses the issue by changing the type of the last
argument of gpio_do_set_config() to unsigned long and making sure the
packed config variable is actually used in gpio_set_config().

Fixes: d90f36851d ("gpiolib: have a single place of calling set_config()")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
2020-02-10 10:55:18 +01:00
Bartosz Golaszewski 91b4ea5fc5 Revert "gpiolib: remove set but not used variable 'config'"
This reverts commit e5e42ad224.

This patch came on top of another patch that introduced a regression.
Revert it before addressing the culprit.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
2020-02-10 10:55:18 +01:00
Bartosz Golaszewski d99f88761b Revert "gpiolib: Remove duplicated function gpio_do_set_config()"
This reverts commit d18fddff06.

This patch came on top of another patch that introduced a regression.
Revert it before addressing the culprit.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
2020-02-10 10:55:18 +01:00
Masahiro Yamada 45586c7078 treewide: remove redundant IS_ERR() before error code check
'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p).
Hence, IS_ERR(p) is unneeded.

The semantic patch that generates this commit is as follows:

// <smpl>
@@
expression ptr;
constant error_code;
@@
-IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code)
+PTR_ERR(ptr) == - error_code
// </smpl>

Link: http://lkml.kernel.org/r/20200106045833.1725-1-masahiroy@kernel.org
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Acked-by: Stephen Boyd <sboyd@kernel.org> [drivers/clk/clk.c]
Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> [GPIO]
Acked-by: Wolfram Sang <wsa@the-dreams.de> [drivers/i2c]
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> [acpi/scan.c]
Acked-by: Rob Herring <robh@kernel.org>
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-02-04 03:05:27 +00:00
Linus Torvalds af32f3a414 - New Drivers
- Add support for ROHM BD71828 PMICs and GPIOs
    - Add support for Qualcomm Aqstic Audio Codecs WCD9340 and WCD9341
 
 - New Device Support
    - Add support for BD71828 to BD70528 RTC driver
    - Add support for Intel's Jasper Lake to LPSS PCI
 
  - New Functionality
    - Add support for Power Key to ROHM BD71828
    - Add support for Clocks to ROHM BD71828
    - Add support for GPIOs to Dialog DA9062
    - Add support for USB PD Notify to ChromiumOS EC
    - Allow callers to specify args when requesting regmap lookup; syscon
 
  - Fix-ups
    - Improve error handling and sanity checking; atmel-hlcdc, dln2
    - Device Tree support/documentation; bd71828, da9062, xylon,logicvc,
                                         ab8500, max14577, atmel-usart
    - Match devices using platform IDs; bd7xxxx
    - Refactor BD718x7 regulator component; bd718x7-regulator
    - Use standard interfaces/helpers; syscon, sm501
    - Trivial (whitespace, spelling, etc); ab8500-core, Kconfig
    - Remove unused code; db8500-prcmu, tqmx86
    - Wait until boot has finished before accessing registers; madera-core
    - Provide missing register value defaults; cs47l15-tables
    - Allow more time for hardware to reset; madera-core
 
  - Bug Fixes
    - Fix erroneous register values; rohm-bd70528
    - Fix register volatility; axp20x, rn5t618
    - Fix Kconfig dependencies; MFD_MAX77650
    - Fix incorrect compatible string; da9062-core
    - Fix syscon_regmap_lookup_by_phandle_args() stub; syscon
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAl44Ga0ACgkQUa+KL4f8
 d2HRJg//VdigHgOTX/eJggI67n36kTgho+VzwRwLuSedDBFIkh5S8NWO7bFyf1Y4
 Qn+MybJtCvPQeUVmqO6cUi0/VqXgwW4mUe5L6oQKIsPYzfmhuc/XF+DA2S8ulOBj
 CckAM15i4WARCtNtFH12EaGGekLPAkik9nZE5EH7vS89TUxLMKbir72U+qFju6mu
 o2F8B7QbDe2jxaooxZ11zPjECwJfzgdXe+FipmogL1itLT+1phpirlttY4R5/4LV
 t3jKb3GI5xN+YWqyXHFF1EKtQEHTkYyKcby2It+8ksYAKiueY0hAuX7+pt1KXWjb
 ReM/hYH5dqjJSz6MjajrInHlpAf8iqtzNdXznSm/hQ9X+YHpaqmdYBt9bTg3pbR/
 z5F0q32e716K/XcJIv2igizT2EZDZIb2AG9oh0D93Z10tPgTpp0CTkcSsSw4CpnP
 MM60B2RN6RI/1MVK1eWRfWVSLbopsForetlnwXhTxY0Zr/7Hd+l+2ndz8IJE+vya
 86jq9yXv7kndwcKNIuUy5jIE2XV9JIbjwwDd4a8tbQgOMkSWHuV3pN+qnT6+/kRh
 TS/LFI49rjJauB85XdqhZc2+i0Eo78ctIdxQebKNZe6wz+r5Y5NTMMCZ5TjScxJX
 aSKRepOEtSbnKloUi5HZ71zfX/waTxzgyodkF7UJk3eEtzlDF8o=
 =t4+B
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "New Drivers:
   - Add support for ROHM BD71828 PMICs and GPIOs
   - Add support for Qualcomm Aqstic Audio Codecs WCD9340 and WCD9341

  New Device Support:
   - Add support for BD71828 to BD70528 RTC driver
   - Add support for Intel's Jasper Lake to LPSS PCI

  New Functionality:
   - Add support for Power Key to ROHM BD71828
   - Add support for Clocks to ROHM BD71828
   - Add support for GPIOs to Dialog DA9062
   - Add support for USB PD Notify to ChromiumOS EC
   - Allow callers to specify args when requesting regmap lookup; syscon

  Fix-ups:
   - Improve error handling and sanity checking; atmel-hlcdc, dln2
   - Device Tree support/documentation; bd71828, da9062, xylon,logicvc,
     ab8500, max14577, atmel-usart
   - Match devices using platform IDs; bd7xxxx
   - Refactor BD718x7 regulator component; bd718x7-regulator
   - Use standard interfaces/helpers; syscon, sm501
   - Trivial (whitespace, spelling, etc); ab8500-core, Kconfig
   - Remove unused code; db8500-prcmu, tqmx86
   - Wait until boot has finished before accessing registers;
     madera-core
   - Provide missing register value defaults; cs47l15-tables
   - Allow more time for hardware to reset; madera-core

  Bug Fixes:
   - Fix erroneous register values; rohm-bd70528
   - Fix register volatility; axp20x, rn5t618
   - Fix Kconfig dependencies; MFD_MAX77650
   - Fix incorrect compatible string; da9062-core
   - Fix syscon_regmap_lookup_by_phandle_args() stub; syscon"

* tag 'mfd-next-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (41 commits)
  mfd: syscon: Fix syscon_regmap_lookup_by_phandle_args() dummy
  mfd: wcd934x: Add support to wcd9340/wcd9341 codec
  mfd: syscon: Add arguments support for syscon reference
  mfd: rn5t618: Mark ADC control register volatile
  dt-bindings: atmel-usart: Add microchip,sam9x60-{usart, dbgu}
  dt-bindings: atmel-usart: Remove wildcard
  mfd: cros_ec: Add cros-usbpd-notify subdevice
  mfd: da9062: Fix watchdog compatible string
  mfd: madera: Allow more time for hardware reset
  mfd: cs47l15: Add missing register default
  mfd: madera: Wait for boot done before accessing any other registers
  mfd: Kconfig: Rename Samsung to lowercase
  mfd: tqmx86: remove set but not used variable 'i2c_ien'
  mfd: dbx500-prcmu: Drop DSI pll clock functions
  mfd: dbx500-prcmu: Drop set_display_clocks()
  mfd: max77650: Select REGMAP_IRQ in Kconfig
  mfd: axp20x: Mark AXP20X_VBUS_IPSOUT_MGMT as volatile
  mfd: ab8500: Fix ab8500-clk typo
  mfd: intel-lpss: Add Intel Jasper Lake PCI IDs
  dt-bindings: mfd: max14577: Add reference to max14040_battery.txt descriptions
  ...
2020-02-03 14:51:57 +00:00
Linus Torvalds 6ba3d7066c This is the bulk of pin control changes for the v5.6 kernel cycle:
Core changes:
 
 - Dropped the chained IRQ setup callback into GPIOLIB as we
   got rid of the last users of that in this changeset.
 
 New drivers:
 
 - New driver for Ingenic X1830.
 
 - New driver for Freescale i.MX8MP.
 
 Driver enhancements:
 
 - Fix all remaining Intel drivers to pass their IRQ chips
   along with the GPIO chips.
 
 - Intel Baytrail allocates its irqchip dynamically.
 
 - Intel Lynxpoint is thoroughly rewritten and modernized.
 
 - Aspeed AST2600 pin muxing and configuration is much
   improved.
 
 - Qualcomm SC7180 functions are updated and wakeup interrupt
   map is provided.
 
 - A whole slew of Renesas SH-PFC cleanups and improvements.
 
 - Fix up the Intel DT bindings to use the generic YAML
   DT bindings schema. (A first user of this.)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAl4xQIkACgkQQRCzN7AZ
 XXNchQ/8C4+SAMMcDQm4sIWV1duebynrXuebISqWMhAtYDRjCsRpGCqVSt+iSWod
 z29pJ/sm0xpG1Bz0bmDZ4oFv7u7+J89a/0Kl4OqI1pbO97Uadu2qGmYxZf2tMtlH
 CwWVOUAldU9scogRD6Z+qixYdRRpKufpaVaU7ooubHocmgRtzd/VCT2MX76c3w7j
 1+yHjoAKM59jpOD/8oEucEYB+5ngyTiMXo3Nms/6ciq52GdtMLE8nK+t7dM+xNLL
 hMQP95iQ2Xb+cM/bv+vdMyKF6vRxKkkeQ/hWcivGWgdI/BSFg0vCq0mWdc8qWp8k
 VeIBaTVh5wuaAdkir9dHX/zt6TsRV8ktv88jW773/z4jHr/8PmQUyFMyEA1u1haP
 yrC/vm4eL6QWCAZeATra5+5FoH2ljzwaY2rgeU0hNixjaF/aIp3GPci7+YmKHTIr
 5zZTXKAeuC/nV7g77w4O9iwn+SHWPytWBrfNZ7unyV5fl4XHckY2vNBa/g8xkYyb
 FBk642EwHRGCULb8m40+cB7TMUzk9aluXge1detJDbqlr2i+tSOWp1c3GSavLl1L
 4qRAAS2j6de1H/EaoO7EcArVrSMdPgLdpRmwCMc2xvL0HOprl6y+5iL7x86ZtQHu
 NHvgnjtw6Z6t9n28f5ZI1iEXUA6EHOHHc/sPPUqScCj4v85B25A=
 =PnK5
 -----END PGP SIGNATURE-----

Merge tag 'pinctrl-v5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control updates from Linus Walleij:
 "This is the bulk of pin control changes, nothing too exciting about
  this.

  Some changes hit arch/sh and arch/arm but are well isolated and
  acknowledged by the respective arch maintainers.

  Core changes:

   - Dropped the chained IRQ setup callback into GPIOLIB as we got rid
     of the last users of that in this changeset.

  New drivers:

   - New driver for Ingenic X1830.

   - New driver for Freescale i.MX8MP.

  Driver enhancements:

   - Fix all remaining Intel drivers to pass their IRQ chips along with
     the GPIO chips.

   - Intel Baytrail allocates its irqchip dynamically.

   - Intel Lynxpoint is thoroughly rewritten and modernized.

   - Aspeed AST2600 pin muxing and configuration is much improved.

   - Qualcomm SC7180 functions are updated and wakeup interrupt map is
     provided.

   - A whole slew of Renesas SH-PFC cleanups and improvements.

   - Fix up the Intel DT bindings to use the generic YAML DT bindings
     schema (a first user of this)"

* tag 'pinctrl-v5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (99 commits)
  pinctrl: madera: Remove extra blank line
  pinctrl: qcom: Don't lock around irq_set_irq_wake()
  pinctrl: mvebu: armada-37xx: use use platform api
  gpio: Drop the chained IRQ handler assign function
  pinctrl: freescale: Add i.MX8MP pinctrl driver support
  dt-bindings: imx: Add pinctrl binding doc for i.MX8MP
  pinctrl: tigerlake: Tiger Lake uses _HID enumeration
  pinctrl: sunrisepoint: Add Coffee Lake-S ACPI ID
  pinctrl: iproc: Use platform_get_irq_optional() to avoid error message
  pinctrl: dt-bindings: Fix some errors in the lgm and pinmux schema
  pinctrl: intel: Pass irqchip when adding gpiochip
  pinctrl: intel: Add GPIO <-> pin mapping ranges via callback
  pinctrl: baytrail: Replace WARN with dev_info_once when setting direct-irq pin to output
  pinctrl: baytrail: Do not clear IRQ flags on direct-irq enabled pins
  pinctrl: sunrisepoint: Add missing Interrupt Status register offset
  pinctrl: sh-pfc: Split R-Car H3 support in two independent drivers
  pinctrl: artpec6: fix __iomem on reg in set
  pinctrl: ingenic: Use devm_platform_ioremap_resource()
  pinctrl: ingenic: Factorize irq_set_type function
  pinctrl: ingenic: Remove duplicated ingenic_chip_info structures
  ...
2020-01-29 09:51:36 -08:00
Linus Torvalds fa889d8555 This is the bulk of GPIO changes for the v5.6 kernel cycle
Core changes:
 
 - Document the usecases for the kernelspace vs userspace
   handling of GPIOs.
 
 - Handle MSI (message signalled interrupts) properly in the
   core hierarchical irqdomain code.
 
 - Fix a rare race condition while initializing the descriptor
   array.
 
 New drivers:
 
 - Xylon LogiCVC GPIO driver.
 
 - WDC934x GPIO controller driver.
 
 Driver improvements:
 
 - Implemented suspend/resume in the Tegra driver.
 
 - MPC8xx edge detection fixup.
 
 - Properly convert ThunderX to use hierarchical irqdomain
   with GPIOLIB_IRQCHIP on top of the revert of the previous
   buggy switchover. This time it works (hopefully).
 
 Misc:
 
 - Drop a FMC remnant file <linux/ipmi-fru.h>
 
 - A slew of fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAl4xO9gACgkQQRCzN7AZ
 XXO+lBAAv+viQVCj1IG6ajCWpsAECHY+U3xRl4ETy86Jx2uNJS48xmnYrjbqUH+h
 r9HDi1Z5pyc14PtOEi01qVt87z612VmZbYNZ7tVBMXsGhN18wHRtC1y8GDtRSOxj
 Zqeyu6zFn2WxGTbwGdjxeliVcuCUOLu+zsE/xnCmUWT0gkeMi62MpSR4/chtbh3g
 Qu6lxtUcF2MN5IuGb6oCTnWQF+Bk9Pdib2HcKDqIGjQKbato7GLAEQdHY1K9vb7l
 Wwovasg62CDMtXohBL6SZJJPWPhoK0MUNrKdPJPb3W2yJKgoiVyoNz8FRGmX2OUx
 3v0elGP83v4jdmA6aHRfTmmcYKmEevxSFAxjCXw6pYEsPwf3VIr6TMkqANogA16S
 Ag2eda/6gTiVKlFCVi9uxkLfVvYcdUTYWCjG0xOseVJRnWpXJbNwjCd493Qwhbim
 zfziqoCYPZ6rLWcoDFkWZ27edfHCdPBlamnRyfHy5+1Y9s4jdcuMtp5B8tlvGuOp
 55j/FSNvpPdmXIS0g8/C90nZ2WiAM9N5C1CyrLwgJvixHcMFhmKkJVnJ0zHHCOdC
 Mu1CBdaGlH7o4+M+CIMU63q5YnHrmoZvZ3t5PPlCl5iUETuKGZmWBKzRv5qx3xld
 iwSf8vfy+4bJGOF9xSgSvTOpoVEfsJAagKoBiT3WJuK9zi65vmI=
 =3Glg
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO updates from Linus Walleij:
 "This is the bulk of GPIO changes for the v5.6 kernel cycle.

  This is a pretty calm cycle so far, nothing special going on really.
  Some more changes will come in from the irqchip and pin control trees.

  I also deleted an orphan include file for FMC that was dangling since
  subsystem was removed.

  Core changes:

   - Document the usecases for the kernelspace vs userspace handling of
     GPIOs.

   - Handle MSI (message signalled interrupts) properly in the core
     hierarchical irqdomain code.

   - Fix a rare race condition while initializing the descriptor array.

  New drivers:

   - Xylon LogiCVC GPIO driver.

   - WDC934x GPIO controller driver.

  Driver improvements:

   - Implemented suspend/resume in the Tegra driver.

   - MPC8xx edge detection fixup.

   - Properly convert ThunderX to use hierarchical irqdomain with
     GPIOLIB_IRQCHIP on top of the revert of the previous buggy
     switchover. This time it works (hopefully).

  Misc:

   - Drop a FMC remnant file <linux/ipmi-fru.h>

   - A slew of fixes"

* tag 'gpio-v5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (48 commits)
  MAINTAINERS: Replace Tien Hock Loh as Altera PIO maintainer
  gpiolib: hold gpio devices lock until ->descs array is initialised
  gpio: aspeed-sgpio: fixed typos
  gpio: mvebu: clear irq in edge cause register before unmask edge irq
  gpiolib: Lower verbosity when allocating hierarchy irq
  gpiolib: Remove duplicated function gpio_do_set_config()
  gpio: Fix the no return statement warning
  gpio: wcd934x: Add support to wcd934x gpio controller
  gpiolib: remove set but not used variable 'config'
  gpio: vx855: fixed a typo
  gpio: mockup: sort headers alphabetically
  gpio: mockup: update the license tag
  gpio: Remove the unused flags
  gpiolib: Set lockdep class for hierarchical irq domains
  gpio: thunderx: Switch to GPIOLIB_IRQCHIP
  gpiolib: Add the support for the msi parent domain
  gpiolib: Add support for the irqdomain which doesn't use irq_fwspec as arg
  gpio: Add use guidance documentation
  dt-bindings: gpio: wcd934x: Add bindings for gpio
  gpio: altera: change to platform_get_irq_optional to avoid false-positive error
  ...
2020-01-29 09:43:39 -08:00
Linus Torvalds 3d3b44a61a The interrupt departement provides:
- A mechanism to shield isolated tasks from managed interrupts:
 
    The affinity of managed interrupts is completely controlled by the
    kernel and user space has no influence on them. The reason is that
    the automatically assigned affinity correlates to the multi-queue
    CPU handling of block devices.
 
    If the generated affinity mask spaws both housekeeping and isolated CPUs
    the interrupt could be routed to an isolated CPU which would then be
    disturbed by I/O submitted by a housekeeping CPU.
 
    The new mechamism ensures that as long as one housekeeping CPU is online
    in the assigned affinity mask the interrupt is routed to a housekeeping
    CPU.
 
    If there is no online housekeeping CPU in the affinity mask, then the
    interrupt is routed to an isolated CPU to keep the device queue intact,
    but unless the isolated CPU submits I/O by itself these interrupts are
    not raised.
 
  - A small addon to the device tree irqdomain core code to avoid
    duplication in irq chip drivers
 
  - Conversion of the SiFive PLIC to hierarchical domains
 
  - The usual pile of new irq chip drivers: SiFive GPIO, Aspeed SCI, NXP
    INTMUX, Meson A1 GPIO
 
  - The first cut of support for the new ARM GICv4.1
 
  - The usual pile of fixes and improvements in core and driver code
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAl4vcbETHHRnbHhAbGlu
 dXRyb25peC5kZQAKCRCmGPVMDXSYoezyEADBPf0ipu5+KeTtCR+DjRAO8o0wM0J/
 JNkRkSrS/qENSda/d6pZE2AWpqlDOs6apg+SNGkv0knM+1Xy94nLOf4zJBsR+GW0
 w2jw68egnyB2QZtm/BvOJL+qCoixcObg5sLt0165pDdKzyDNWeCMtRU+QAw42T/l
 WC2QrhjKKqYST1m+UgDf1UXz8TDGIW4muRP9UiG0Uwc0LU6cG2H4OmGn0bYissaT
 JTG75pzGqUH3kZ1a1qD28nGyoY85BXz1iV5/IvIPaQbkQARbvfMbh1KvAnGhJj7N
 96rjMpOGv2/kv1FI+4FUy6w5Wn4EyW2OaCtB/oUCFNcZvrNNgvglxCRQkkO8yb3D
 VOOm595ICm3EnIfxBpSzhgvVl5MY39g6qRb6Rpnna+8eRtrYnytMBdvhY0OGlG8/
 cZYZDay0nzhY6vq023iw1YMDKqft7TR1R+6w1iPL7nXHXW99Dhv87d1Fjt0CqphD
 NIoNDgxciIyfMbMBvcg1qPe/g3L8+cAKNzGsIwIU9GneEZFBk3/piGcBlFpoEEOK
 2QKvks3QRXMx+qVWkIqy3LZKV9EAQlb9Lpjaa1ec5d4m/EdACm19OpZpqoCljPtw
 9vdaMz4ZxvUbwjih3VnVPklZCiVGiKj1j0iw5v3FCHh4MUljzCrxNMqK/U9CR8H0
 uid3EX8YMi+DXA==
 =E2VR
 -----END PGP SIGNATURE-----

Merge tag 'irq-core-2020-01-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq updates from Thomas Gleixner:
 "The interrupt departement provides:

   - A mechanism to shield isolated tasks from managed interrupts:

     The affinity of managed interrupts is completely controlled by the
     kernel and user space has no influence on them. The reason is that
     the automatically assigned affinity correlates to the multi-queue
     CPU handling of block devices.

     If the generated affinity mask spaws both housekeeping and isolated
     CPUs the interrupt could be routed to an isolated CPU which would
     then be disturbed by I/O submitted by a housekeeping CPU.

     The new mechamism ensures that as long as one housekeeping CPU is
     online in the assigned affinity mask the interrupt is routed to a
     housekeeping CPU.

     If there is no online housekeeping CPU in the affinity mask, then
     the interrupt is routed to an isolated CPU to keep the device queue
     intact, but unless the isolated CPU submits I/O by itself these
     interrupts are not raised.

   - A small addon to the device tree irqdomain core code to avoid
     duplication in irq chip drivers

   - Conversion of the SiFive PLIC to hierarchical domains

   - The usual pile of new irq chip drivers: SiFive GPIO, Aspeed SCI,
     NXP INTMUX, Meson A1 GPIO

   - The first cut of support for the new ARM GICv4.1

   - The usual pile of fixes and improvements in core and driver code"

* tag 'irq-core-2020-01-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (33 commits)
  genirq, sched/isolation: Isolate from handling managed interrupts
  irqchip/gic-v4.1: Allow direct invalidation of VLPIs
  irqchip/gic-v4.1: Suppress per-VLPI doorbell
  irqchip/gic-v4.1: Add VPE INVALL callback
  irqchip/gic-v4.1: Add VPE eviction callback
  irqchip/gic-v4.1: Add VPE residency callback
  irqchip/gic-v4.1: Add mask/unmask doorbell callbacks
  irqchip/gic-v4.1: Plumb skeletal VPE irqchip
  irqchip/gic-v4.1: Implement the v4.1 flavour of VMOVP
  irqchip/gic-v4.1: Don't use the VPE proxy if RVPEID is set
  irqchip/gic-v4.1: Implement the v4.1 flavour of VMAPP
  irqchip/gic-v4.1: VPE table (aka GICR_VPROPBASER) allocation
  irqchip/gic-v3: Add GICv4.1 VPEID size discovery
  irqchip/gic-v3: Detect GICv4.1 supporting RVPEID
  irqchip/gic-v3-its: Fix get_vlpi_map() breakage with doorbells
  irqdomain: Fix a memory leak in irq_domain_push_irq()
  irqchip: Add NXP INTMUX interrupt multiplexer support
  dt-bindings: interrupt-controller: Add binding for NXP INTMUX interrupt multiplexer
  irqchip: Define EXYNOS_IRQ_COMBINER
  irqchip/meson-gpio: Add support for meson a1 SoCs
  ...
2020-01-27 17:22:21 -08:00
Linus Torvalds 9e1af7567b MMC core:
- Convert to reasonable timeouts for all CMD6 commands (updates for BKOPS,
    CACHE_FLUSH and INAND_CMD38_ARG_EXT_CSD) for eMMC
  - Respect f_max clock rate at card initialization
  - Add gpiod_toggle_active_low() API
  - Consolidate slot-gpio code by using gpiod_toggle_active_low()
 
 MMC host:
  - Add pinctrl_select_default_state() API
  - Consolidate pintctrl code by using pinctrl_select_default_state()
  - mmci: Support any block sizes for SDIO for some variants
  - mmci: Enable reset control for stm32_sdmmc
  - mmc_spi: Toggle SPI_CS_HIGH polarity rather than hard-coding it
  - renesas_sdhi: Add support for the r8a77961 variant
  - renesas_sdhi: A few minor improvements
  - rockchip-dw-mshc: Add support for the rk3308 variant
  - sdhci: Enable support for external DMA controllers
  - sdhci: Fixup error path when sending CMD12
  - sdhci-brcmstb: Add support for 7216b0 variant
  - sdhci-brcmstb: Add support for command queuing (CQHCI)
  - sdhci-brcmstb: Add support for eMMC HS400ES mode
  - sdhci-msm: Add support for the sc7180 variant
  - sdhci-msm: Add support for command queuing (CQHCI)
  - sdhci-of-at91: Add support for the SAM9x60 variant
  - sdhci-of-at91: Improve support for tunings
  - sdhci-of-esdhc: A few fixups for some clock related issues
  - sdhci-omap: Add support for the am335x and the am437x variants
  - sdhci-omap: Improve support for erase operations
  - sdhci-omap: Add support for external DMA
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAl4uww8XHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjClg8w/+Iv7Emp5oBmj0aY9BA2rWpOVj
 rNPynDbRPI0qrrQPqXrZ/UdGDc6lgWHoeHdtv70u8WK8UEgi/OYw7PlE3eij9DGB
 VcOnMyDg+Q6+Hq3vjvADWZzNrHGjdvjcGLxx386DHpTCsc1zD3EL2AG5e6i2/dfH
 /FiSdfxVtRKw4GEn5jIDhHh63Av8mMCaPPfLw0DKxMQIuJ3atMvplgsr1KXIAydo
 QTjKWxDJDJnKddtdHcnjP9Tck+ksrATDHHHQ9qGVFuOr3Yy9TgvOMlLo8vxJ364l
 3bIwYfbaeE4/NKvqJGDzIF1jr4R5JoHZhvHLGqr+hUwMzxnwcbyCUSghk87oOqMt
 FKAfKqwdEvVyq8QnmV9ArPXRnVmW4ElJN3edTeC00/7MoxWIx2TRHvEO5HejqPkq
 +kw0NEIqWWiztV3/aa5zFJtlp8QphwsopvLzwEAJB+1G0tiSiNcfokrJ0AyODC5/
 K4kXTGfQh28RSIr6ait7FNphyOug1WAvXqvt3ydY1lQPH0G36DMzLMx06mjgTA4O
 DNYXzLoLPzRaPU4NvpHu3/axgRLYCN3CbGdx3U8GT9wgmerRyY/jW9ldSF7w6Wim
 W0Zx1j3SdvmgafMXVsFcxMUC0IvfOFiMzXJ6DOus37xTYLRKW40wttg9SSxtm+9E
 3IfRRlXnlkHVvTZ1ewI=
 =L0cJ
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC updates from Ulf Hansson:
 "There are no updates for the MEMSTICK subsystem this time. But note
  that I am also carrying a patch from the pinctrl tree, which has been
  shared through an immutable branch.

  Summary:

  MMC core:
   - Convert to reasonable timeouts for all CMD6 commands (updates for
     BKOPS, CACHE_FLUSH and INAND_CMD38_ARG_EXT_CSD) for eMMC
   - Respect f_max clock rate at card initialization
   - Add gpiod_toggle_active_low() API
   - Consolidate slot-gpio code by using gpiod_toggle_active_low()

  MMC host:
   - Add pinctrl_select_default_state() API
   - Consolidate pintctrl code by using pinctrl_select_default_state()
   - mmci: Support any block sizes for SDIO for some variants
   - mmci: Enable reset control for stm32_sdmmc
   - mmc_spi: Toggle SPI_CS_HIGH polarity rather than hard-coding it
   - renesas_sdhi: Add support for the r8a77961 variant
   - renesas_sdhi: A few minor improvements
   - rockchip-dw-mshc: Add support for the rk3308 variant
   - sdhci: Enable support for external DMA controllers
   - sdhci: Fixup error path when sending CMD12
   - sdhci-brcmstb: Add support for 7216b0 variant
   - sdhci-brcmstb: Add support for command queuing (CQHCI)
   - sdhci-brcmstb: Add support for eMMC HS400ES mode
   - sdhci-msm: Add support for the sc7180 variant
   - sdhci-msm: Add support for command queuing (CQHCI)
   - sdhci-of-at91: Add support for the SAM9x60 variant
   - sdhci-of-at91: Improve support for tunings
   - sdhci-of-esdhc: A few fixups for some clock related issues
   - sdhci-omap: Add support for the am335x and the am437x variants
   - sdhci-omap: Improve support for erase operations
   - sdhci-omap: Add support for external DMA"

* tag 'mmc-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (89 commits)
  mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch()
  mmc: block: Use generic_cmd6_time when modifying INAND_CMD38_ARG_EXT_CSD
  mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC
  mmc: sdhci-cadence: remove unneeded 'inline' marker
  dt-bindings: mmc: rockchip-dw-mshc: add description for rk3308
  dt-bindings: mmc: convert rockchip dw-mshc bindings to yaml
  dt-bindings: mmc: convert synopsys dw-mshc bindings to yaml
  mmc: sdhci-msm: Add CQHCI support for sdhci-msm
  mmc: sdhci: Let a vendor driver supply and update ADMA descriptor size
  mmc: sdhci-of-esdhc: fix serious issue clock is always disabled
  mmc: sdhci-of-esdhc: fix transfer mode register reading
  mmc: sdhci-brcmstb: Fix incorrect switch to HS mode
  mmc: sdhci-brcmstb: Add support for Command Queuing (CQE)
  mmc: sdhci-brcmstb: Add shutdown callback
  mmc: sdhci-brcmstb: Fix driver to defer on clk_get defer
  mmc: sdhci-brcmstb: Add ability to use HS400ES transfer mode
  dt-bindings: mmc: brcm,sdhci-brcmstb: Add support for 7216b0
  mmc: core: limit probe clock frequency to configured f_max
  mmc: sdhci-milbeaut: Remove redundant platform_get_irq error message
  mmc: sdhci: fix an issue of mixing different types
  ...
2020-01-27 10:30:42 -08:00
Linus Walleij 0282c72d30 gpio: updates for v5.6
- use platform_get_irq_optional() in gpio-altera
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl4sQqYACgkQEacuoBRx
 13KGCxAAoEfzvhn6s+ECtt2VwuPwXLt5h/Auw4JCvBXx3ISeS0WHNVuT0v6V6enM
 ckkej8Zac4D2e3H0HoFMBcxJlGiyDCtFhgA0Mt8tbyEpEvcXEmbZmN0IQVrKXsj7
 k07hXxLOqgljEa4KqObe/8/DRvY0vhsT/TbHvyENspXG7HIvSb/bRhl5iMqnL5kD
 JkmYD6aObiFx9zzAzY3281qJAYeRw3hO4wtz6Igo/3VxjxwryRdHCEWSwBMZnhMW
 eIw/tKaYHyMnjqH4VWNeRF0upSFW91Ju0UVDCgoYloL0A/kzfOq7GU79dVhD1qZ8
 ZYvMCodMK2e98k8WR+gAsyykntNAX9EEa4znCCvTKrfr83dCm0OtCfyjtaF4VDmj
 8j3tPnxv7vtjbdz0lvJ7GY/0x9mComrHwMrabloPjdJYKgy0eM/IHKgVyE2n/Xzs
 hTo/ZrP6uzKkFULmEzfRlmqhrCKuv5ieu0roHB45qzm1uoGpxsP3dAMewVksjOnU
 gsM+xKMTC/drxeG26U1rzAJ6HdkYrOadu/j4tXur9pGYkYD8kYVhap0Ix3vyPF6Y
 6ZRQpnoVW+/ZMIhwbTzeM7tOF4HcyzBx9nV1cHtiNGA33VxqVsOgrskZ5+3uOHx+
 UwWEI6Wnj+6j36tkKSfUxuGnFFLAeFxeaqVRBMR5npp/olCx0wo=
 =iqpY
 -----END PGP SIGNATURE-----

Merge tag 'gpio-updates-for-v5.6-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into devel

gpio: updates for v5.6

- use platform_get_irq_optional() in gpio-altera
2020-01-26 01:01:55 +01:00
Matti Vaittinen c31f625d06 gpio: bd71828: Initial support for ROHM BD71828 PMIC GPIOs
ROHM BD71828 PMIC contains 4 pins which can be configured by OTP
to be used for general purposes. First 3 can be used as outputs
and 4.th pin can be used as input. Allow them to be controlled
via GPIO framework.

The driver assumes all of the pins are configured as GPIOs and
trusts that the reserved pins in other OTP configurations are
excluded from control using "gpio-reserved-ranges" device tree
property (or left untouched by GPIO users).

Typical use for 4.th pin (input) is to use it as HALL sensor
input so that this pin state is toggled when HALL sensor detects
LID position change (from close to open or open to close). PMIC
HW implements some extra logic which allows PMIC to power-up the
system when this pin is toggled. Please see the data sheet for
details of GPIO options which can be selected by OTP settings.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-01-24 07:23:10 +00:00
Dan Callaghan 207270dd0b gpiolib: hold gpio devices lock until ->descs array is initialised
If a driver consuming the GPIO chip is being probed at the same time as
the GPIO driver is registering the chip, it is possible for the
consuming driver to see the ->descs array in an uninitialised state.
For example, the gpio-keys-polled driver can fail like this:

    kernel: gpiod_request: invalid GPIO (no device)
    kernel: gpio-keys-polled PRP0001:07: failed to get gpio: -22
    kernel: gpio-keys-polled: probe of PRP0001:07 failed with error -22

This patch makes gpiochip_add() hold the lock protecting gpio_devices
until it has finished setting desc->gdev on the newly inserted list
entry.

Signed-off-by: Dan Callaghan <dan.callaghan@opengear.com>
Link: https://lore.kernel.org/r/20200121001216.15964-1-dan.callaghan@opengear.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-23 16:25:03 +01:00
Sachin agarwal 0d311d8b93 gpio: aspeed-sgpio: fixed typos
This fixes some various typos.

Signed-off-by: Sachin Agarwal <asachin591@gmail.com>
Link: https://lore.kernel.org/r/20200118105319.68637-1-sachinagarwal@sachins-MacBook-2.local
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-23 16:16:05 +01:00
Linus Walleij 72780ce5f1 gpio: Drop the chained IRQ handler assign function
gpiochip_set_chained_irqchip() would assign a chained handler
to a GPIO chip. We now populate struct gpio_irq_chip for all
chained GPIO irqchips so drop this function.

Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200113220800.77817-1-linus.walleij@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-23 15:54:32 +01:00
Maxim Kiselev d5331ec2cc gpio: mvebu: clear irq in edge cause register before unmask edge irq
When input GPIO set from 0 to 1, the interrupt bit asserted in the GPIO
Interrupt Cause Register (ICR) even if the corresponding interrupt
masked in the GPIO Interrupt Mask Register.

Because interrupt mask register only affects assertion of the interrupt
bits in Main Interrupt Cause Register and it does not affect the
setting of bits in the GPIO ICR.

So, there is problem, when we unmask interrupt with already
asserted bit in the GPIO ICR, then false interrupt immediately occurs
even if GPIO don't change their value since last unmask.

Signed-off-by: Maxim Kiselev <bigunclemax@gmail.com>
Link: https://lore.kernel.org/r/20200115073811.24438-1-bigunclemax@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-23 15:52:40 +01:00
Kevin Hao 366950eeb6 gpiolib: Lower verbosity when allocating hierarchy irq
In the current codes, the following 3 lines would be output to
the console for each irq line.
  gpio gpiochip0: (gpio_thunderx): allocate IRQ 10, hwirq 0
  gpio gpiochip0: (gpio_thunderx): found parent hwirq 245784
  gpio gpiochip0: (gpio_thunderx): alloc_irqs_parent for 10 parent hwirq 245784

In general, there are about tens of irq lines for each gpio chip,
and then it would emit so many insignificant log in the boot process.
These infos are more suitable for the dbg purpose. So change these
to the dbg level. With this change, about 200 lines are suppressed
on my Marvell cn96xx board.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Link: https://lore.kernel.org/r/20200120095625.25164-1-haokexin@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-23 15:46:17 +01:00
Linus Walleij a1dd4bfb14 intel-pinctrl for v5.6-1
* Tiger Lake appears to have _HID enumeration, thus driver has been updated
 * Coffee Lake-S has the same IP as Sunrisepoint, thus ID has been added
 * Baytrail has got more clean ups and bug fixes, such as direct IRQ handling
 * Lynxpoint GPIO has been converted to true pin control driver
 * The common driver now uses IRQ chip enumeration via GPIO chip
 
 The following is an automated git shortlog grouped by driver:
 
 baytrail:
  -  Replace WARN with dev_info_once when setting direct-irq pin to output
  -  Do not clear IRQ flags on direct-irq enabled pins
  -  Reuse struct intel_pinctrl in the driver
  -  Use local variable to keep device pointer
  -  Keep pointer to struct device instead of its container
  -  Use GPIO direction definitions
  -  Move IRQ valid mask initialization to a dedicated callback
  -  Group GPIO IRQ chip initialization
  -  Allocate IRQ chip dynamic
 
 cherryview:
  -  Use GPIO direction definitions
 
 intel:
  -  Pass irqchip when adding gpiochip
  -  Add GPIO <-> pin mapping ranges via callback
  -  Share struct intel_pinctrl for wider use
  -  Use GPIO direction definitions
 
 lynxpoint:
  -  Update summary in the driver
  -  Switch to pin control API
  -  Add GPIO <-> pin mapping ranges via callback
  -  Implement ->pin_dbg_show()
  -  Add pin control operations
  -  Reuse struct intel_pinctrl in the driver
  -  Add pin control data structures
  -  Implement intel_gpio_get_direction callback
  -  Implement ->irq_ack() callback
  -  Move ownership check to IRQ chip
  -  Move lp_irq_type() closer to IRQ related routines
  -  Move ->remove closer to ->probe()
  -  Extract lp_gpio_acpi_use() for future use
  -  Convert unsigned to unsigned int
  -  Switch to memory mapped IO accessors
  -  Keep pointer to struct device instead of its container
  -  Relax GPIO request rules
  -  Assume 2 bits for mode selector
  -  Use standard pattern for memory allocation
  -  Use %pR to print IO resource
  -  Drop useless assignment
  -  Correct amount of pins
  -  Use raw_spinlock for locking
  -  Move GPIO driver to pin controller folder
 
 sunrisepoint:
  -  Add Coffee Lake-S ACPI ID
  -  Add missing Interrupt Status register offset
 
 tigerlake:
  -  Tiger Lake uses _HID enumeration
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEqaflIX74DDDzMJJtb7wzTHR8rCgFAl4lfB4ACgkQb7wzTHR8
 rCgy3g//VHTbsBk7+6NFXbI5iXgbU1sr9F9cIYbzawA3YLbR1Ioq9P89U3JPCeCz
 zaoxtd9HAxOxQrUFJGZKbsof6jS7Ee80mcvm0KQt2GNBmM4bZGS6qHofj5FAOxuz
 4MBjGINrlIntzG1RqjYxD+p2xuQ3p9H2yQIds9UTM1NB+hBIDLPx+3HUM2qbbf4s
 rbLQRc+kmVHoapmse6lV4lA2OyOW9BmgiTxeMaua/E6zyZ6WVNXLxXx+yXrEtUjj
 Q9M6moNZd4OP3pN/mGCyClLTMFyOcmaah6wdXy3GJRZ7/YD5+AnqbVTGsYLKy6To
 1w25Z6e6ygzbL8sqr5JwMiX9GnX6FeGEleY63zxvZ+WCC3TGWRzPWaTJuQIRToAz
 K3pdYWXOoK/J1fyzdjdkYHbqBbqjpB5oT/dWFx7Ii50kv41b8TEXPhDrWZSqvn9I
 J0KW/vICbsqPk8TBsQQ83nV6ILSTY5KakI8Qs5ngDov5oeKl0F/cLT9KqcY9nQdJ
 2mhJU5mn8cq4SvtyPD/NSRQHxX5xHx6Yi4KG2cXw0wJTZ+jP8rpl2di8ogDCFUK4
 fkQ/g+PhcPsW36kTKvLv57vhTqZ2u9rf9BcaJ7LGo9wsOjpGH6d4RCTiJ0VSn++T
 rkomWdFVgfMKmnsUwykyIV39mQzDy5e4vNO45wMs7LCimiRSkMA=
 =+ZAJ
 -----END PGP SIGNATURE-----

Merge tag 'intel-pinctrl-v5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel into devel

intel-pinctrl for v5.6-1

* Tiger Lake appears to have _HID enumeration, thus driver has been updated
* Coffee Lake-S has the same IP as Sunrisepoint, thus ID has been added
* Baytrail has got more clean ups and bug fixes, such as direct IRQ handling
* Lynxpoint GPIO has been converted to true pin control driver
* The common driver now uses IRQ chip enumeration via GPIO chip

The following is an automated git shortlog grouped by driver:

baytrail:
 -  Replace WARN with dev_info_once when setting direct-irq pin to output
 -  Do not clear IRQ flags on direct-irq enabled pins
 -  Reuse struct intel_pinctrl in the driver
 -  Use local variable to keep device pointer
 -  Keep pointer to struct device instead of its container
 -  Use GPIO direction definitions
 -  Move IRQ valid mask initialization to a dedicated callback
 -  Group GPIO IRQ chip initialization
 -  Allocate IRQ chip dynamic

cherryview:
 -  Use GPIO direction definitions

intel:
 -  Pass irqchip when adding gpiochip
 -  Add GPIO <-> pin mapping ranges via callback
 -  Share struct intel_pinctrl for wider use
 -  Use GPIO direction definitions

lynxpoint:
 -  Update summary in the driver
 -  Switch to pin control API
 -  Add GPIO <-> pin mapping ranges via callback
 -  Implement ->pin_dbg_show()
 -  Add pin control operations
 -  Reuse struct intel_pinctrl in the driver
 -  Add pin control data structures
 -  Implement intel_gpio_get_direction callback
 -  Implement ->irq_ack() callback
 -  Move ownership check to IRQ chip
 -  Move lp_irq_type() closer to IRQ related routines
 -  Move ->remove closer to ->probe()
 -  Extract lp_gpio_acpi_use() for future use
 -  Convert unsigned to unsigned int
 -  Switch to memory mapped IO accessors
 -  Keep pointer to struct device instead of its container
 -  Relax GPIO request rules
 -  Assume 2 bits for mode selector
 -  Use standard pattern for memory allocation
 -  Use %pR to print IO resource
 -  Drop useless assignment
 -  Correct amount of pins
 -  Use raw_spinlock for locking
 -  Move GPIO driver to pin controller folder

sunrisepoint:
 -  Add Coffee Lake-S ACPI ID
 -  Add missing Interrupt Status register offset

tigerlake:
 -  Tiger Lake uses _HID enumeration
2020-01-23 15:44:29 +01:00
Yash Shah 96868dce64 gpio/sifive: Add GPIO driver for SiFive SoCs
Adds the GPIO driver for SiFive RISC-V SoCs.

Signed-off-by: Wesley W. Terpstra <wesley@sifive.com>
[Atish: Various fixes and code cleanup]
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Yash Shah <yash.shah@sifive.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/1575976274-13487-6-git-send-email-yash.shah@sifive.com
2020-01-20 19:10:03 +00:00
YueHaibing d18fddff06 gpiolib: Remove duplicated function gpio_do_set_config()
gpio_set_config() simply call gpio_do_set_config(),
so remove the duplicated function.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20200116142927.58908-1-yuehaibing@huawei.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-17 09:11:41 +01:00
Linus Walleij 8b844d78a7 Merge branch 'fixup-thunderx-hierarchy' into devel 2020-01-17 09:00:35 +01:00
Linus Walleij 6a77de2596 Linux 5.5-rc6
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl4bv/IeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGKWEIAImoqyoGKU+ZcBPI
 PCrqWtNgrZvVDs/K/IinETZSwclvuQCJicN9DYu9g//3uxf9z+i4c5/Oq9veP1lw
 ikVjfwgo74SqNwO9L+78oUG+2rzUDwf/LTVhlqO17fxmT5WumJjC7Y6/TejwpOd5
 xmZ5NopLQTx95OJWaK0rrDUTkG1LzlQZINGbu1K8sRpbppcSc31Egh2n09kaOnmn
 6xRRuxFnk2dXuCCdcCdb6rW1vNzd1IRbPjqAktRCalp04hzIFDgXbj9pfOl/iu6O
 nl+xDSwziW3DzKxdkw3WZTYbPPK8e7s16qF23QLVgwlIKE0qL1h6uiEnAMARGfLm
 bVFIUbo=
 =Tdp+
 -----END PGP SIGNATURE-----

Merge tag 'v5.5-rc6' into devel

Linux 5.5-rc6
2020-01-17 08:59:29 +01:00
Srinivas Kandagatla 59c3246834 gpio: wcd934x: Add support to wcd934x gpio controller
This patch adds support to wcd934x gpio block found in
WCD9340/WC9341 Audio codecs.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200107130844.20763-3-srinivas.kandagatla@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 14:42:34 +01:00
YueHaibing e5e42ad224 gpiolib: remove set but not used variable 'config'
drivers/gpio/gpiolib.c: In function gpio_set_config:
drivers/gpio/gpiolib.c:3053:16: warning:
 variable config set but not used [-Wunused-but-set-variable]

commit d90f36851d ("gpiolib: have a single place
of calling set_config()") left behind this unused variable.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20200108121117.45060-1-yuehaibing@huawei.com
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 14:38:49 +01:00
Sachin agarwal e81ccba695 gpio: vx855: fixed a typo
we had written "betwee" rather than "between".

Signed-off-by: Sachin agarwal <asachin591@gmail.com>
Link: https://lore.kernel.org/r/20200112143312.66048-1-sachinagarwal@sachins-MacBook-2.local
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 13:45:01 +01:00
Bartosz Golaszewski 726a44531a gpio: mockup: sort headers alphabetically
For consistency and easier maintenance: sort the headers alphabetically.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20200114150253.28716-3-brgl@bgdev.pl
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 11:27:24 +01:00
Bartosz Golaszewski f2f679832d gpio: mockup: update the license tag
The current GPL v2.0 or later SPDX tag is 'GPL-2.0-or-later' as defined
at https://spdx.org/licenses/.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20200114150253.28716-2-brgl@bgdev.pl
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 11:27:01 +01:00
Shaokun Zhang 9a2b5b301d gpio: Remove the unused flags
drivers/gpio/gpio-grgpio.c: In function ‘grgpio_remove’:
drivers/gpio/gpio-grgpio.c:438:16: warning: unused variable ‘flags’ [-Wunused-variable]
  unsigned long flags;
                 ^
Fixes: 25d071b3f6 ("gpio: gpio-grgpio: fix possible sleep-in-atomic-context bugs in grgpio_remove()")
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Link: https://lore.kernel.org/r/1579009062-7154-1-git-send-email-zhangshaokun@hisilicon.com
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com
Reviewed-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 11:24:19 +01:00
Stephen Boyd c34f6dc8c9 gpiolib: Set lockdep class for hierarchical irq domains
I see the following lockdep splat in the qcom pinctrl driver when
attempting to suspend the device.

 ============================================
 WARNING: possible recursive locking detected
 5.4.2 #2 Tainted: G S
 --------------------------------------------
 cat/6536 is trying to acquire lock:
 ffffff814787ccc0 (&irq_desc_lock_class){-.-.}, at: __irq_get_desc_lock+0x64/0x94

 but task is already holding lock:
 ffffff81436740c0 (&irq_desc_lock_class){-.-.}, at: __irq_get_desc_lock+0x64/0x94

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

        CPU0
        ----
   lock(&irq_desc_lock_class);
   lock(&irq_desc_lock_class);

  *** DEADLOCK ***

  May be due to missing lock nesting notation

 7 locks held by cat/6536:
  #0: ffffff8140e0c420 (sb_writers#7){.+.+}, at: vfs_write+0xc8/0x19c
  #1: ffffff8121eec480 (&of->mutex){+.+.}, at: kernfs_fop_write+0x128/0x1f4
  #2: ffffff8147cad668 (kn->count#263){.+.+}, at: kernfs_fop_write+0x130/0x1f4
  #3: ffffffd011446000 (system_transition_mutex){+.+.}, at: pm_suspend+0x108/0x354
  #4: ffffff814302b970 (&dev->mutex){....}, at: __device_suspend+0x16c/0x420
  #5: ffffff81436740c0 (&irq_desc_lock_class){-.-.}, at: __irq_get_desc_lock+0x64/0x94
  #6: ffffff81479b8c10 (&pctrl->lock){....}, at: msm_gpio_irq_set_wake+0x48/0x7c

 stack backtrace:
 CPU: 4 PID: 6536 Comm: cat Tainted: G S                5.4.2 #2
 Call trace:
  dump_backtrace+0x0/0x174
  show_stack+0x20/0x2c
  dump_stack+0xdc/0x144
  __lock_acquire+0x52c/0x2268
  lock_acquire+0x1dc/0x220
  _raw_spin_lock_irqsave+0x64/0x80
  __irq_get_desc_lock+0x64/0x94
  irq_set_irq_wake+0x40/0x144
  msm_gpio_irq_set_wake+0x5c/0x7c
  set_irq_wake_real+0x40/0x5c
  irq_set_irq_wake+0x70/0x144
  cros_ec_rtc_suspend+0x38/0x4c
  platform_pm_suspend+0x34/0x60
  dpm_run_callback+0x64/0xcc
  __device_suspend+0x314/0x420
  dpm_suspend+0xf8/0x298
  dpm_suspend_start+0x84/0xb4
  suspend_devices_and_enter+0xbc/0x628
  pm_suspend+0x214/0x354
  state_store+0xb0/0x108
  kobj_attr_store+0x14/0x24
  sysfs_kf_write+0x4c/0x64
  kernfs_fop_write+0x158/0x1f4
  __vfs_write+0x54/0x18c
  vfs_write+0xdc/0x19c
  ksys_write+0x7c/0xe4
  __arm64_sys_write+0x20/0x2c
  el0_svc_common+0xa8/0x160
  el0_svc_compat_handler+0x2c/0x38
  el0_svc_compat+0x8/0x10

This is because the msm_gpio_irq_set_wake() function calls
irq_set_irq_wake() as a backup in case the irq comes in during the path
to idle. Given that we're calling irqchip functions from within an
irqchip we need to set the lockdep class to be different for this child
controller vs. the default one that the parent irqchip gets.

This used to be done before this driver was converted to hierarchical
irq domains in commit e35a6ae0eb ("pinctrl/msm: Setup GPIO chip in
hierarchy") via the gpiochip_irq_map() function. With hierarchical irq
domains this function has been replaced by
gpiochip_hierarchy_irq_domain_alloc(). Therefore, set the lockdep class
like was done previously in the irq domain path so we can avoid this
lockdep warning.

Fixes: fdd61a013a ("gpio: Add support for hierarchical IRQ domains")
Cc: Thierry Reding <treding@nvidia.com>
Cc: Brian Masney <masneyb@onstation.org>
Cc: Lina Iyer <ilina@codeaurora.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Maulik Shah <mkshah@codeaurora.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20200114231103.85641-1-swboyd@chromium.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 11:22:42 +01:00
Kevin Hao 7a9f4460f7 gpio: thunderx: Switch to GPIOLIB_IRQCHIP
The main parts of this patch are from commit a7fc89f9d5 ("gpio:
thunderx: Switch to GPIOLIB_IRQCHIP") and patch [1]. And also adjust
thunderx_gpio_child_to_parent_hwirq() and add
thunderx_gpio_populate_parent_alloc_info() to make sure that
the correct hwirq are passed to the parent msi irqdomain.

[1] https://patchwork.ozlabs.org/patch/1210180/

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Link: https://lore.kernel.org/r/20200114082821.14015-5-haokexin@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 11:18:29 +01:00
Kevin Hao 880b7cf22e gpiolib: Add the support for the msi parent domain
If the gpio's parent irqdomain is a msi irqdomain, we should ignore
the EEXIST error returned by the msi irqdomain because all the msi
interrupts have already been allocated.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Link: https://lore.kernel.org/r/20200114082821.14015-4-haokexin@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 11:18:05 +01:00
Kevin Hao 2425876167 gpiolib: Add support for the irqdomain which doesn't use irq_fwspec as arg
Some gpio's parent irqdomain may not use the struct irq_fwspec as
argument, such as msi irqdomain. So rename the callback
populate_parent_fwspec() to populate_parent_alloc_arg() and make it
allocate and populate the specific struct which is needed by the
parent irqdomain.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Link: https://lore.kernel.org/r/20200114082821.14015-3-haokexin@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 11:17:44 +01:00
Kevin Hao a564ac35d6 Revert "gpio: thunderx: Switch to GPIOLIB_IRQCHIP"
This reverts commit a7fc89f9d5 because
there are some bugs in this commit, and we don't have a simple way to
fix these bugs. So revert this commit to make the thunderx gpio work
on the stable kernel at least. We will switch to GPIOLIB_IRQCHIP
for thunderx gpio by following patches.

Fixes: a7fc89f9d5 ("gpio: thunderx: Switch to GPIOLIB_IRQCHIP")
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Link: https://lore.kernel.org/r/20200114082821.14015-2-haokexin@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 11:17:21 +01:00
Ooi, Joyce 1e4d149e90 gpio: altera: change to platform_get_irq_optional to avoid false-positive error
This patch switches to platform_get_irq_optional() from
platform_get_irq() as it causes a false-positive error such as 'IRQ
index 0 not found' when IRQ is not used. The IRQ usage is optional in
this gpio-altera driver, so the error log is undesirable.

Signed-off-by: Ooi, Joyce <joyce.ooi@intel.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-01-09 10:35:05 +01:00
Linus Walleij 9708289013 gpio: Update TODO
Drop the completed item: hierarchical irqchip helpers. Add
motivation for gpio descriptor refactoring. Extend the list of
stuff to do. Minor fixups.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200107212432.27587-1-linus.walleij@linaro.org
2020-01-09 03:01:33 +01:00
Linus Walleij 2cb81261a9 gpio updates for v5.6
- improvements in the gpio-pca953x driver
 - use platform_irq_count() in gpio-mvebu and gpio-bcm-kona
 - remove unneeded MODULE_VERSION() usage in the gpio directory
 - irq-related improvements in gpio-tegra driver
 - several improvements for the core subsystem code: fix confusing indentation,
   fix int type casting, unduplicate code in several places
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl4UZxEACgkQEacuoBRx
 13LPnhAAyrG/Vnm3UN7bs/W8hM+D4Jt/yFTcvrh+/Ua7DFYCIvptAsiGR4Y+hmdI
 Dq2J4kZw7TaL2vw8/WQ3Ij6NHBIcqnVzT8x8Id6S2WNb3jqEmuzUpGLXpUEIi+U1
 SUXT8amyNAJVlVdAXOk79zAsWML6AMkats38JR5d18Nf4+CNzjdu/2GL80MtRQLa
 CJ2X99A2BzcUed5/YwOIYwapK6IzFmPYwLyXcJr/WDY14rqWjKJtax5djml1Xrfb
 FyLdUPUC9GRD9/IQmJJTcL2LM2078yqaKbqzqiZ/SVQka3HS4K95N6LiZUt5RBt5
 vmBMXF09qXwGsUYo6VHSDQfRxp9wsw0ukfrapVK2ytRInWPTLbGbrXKrm6uA/FuW
 IYMsjtrLYuxAQNt67kahW2/+zlm63kRUdtmt9QHFMgNA8MESbJf0ds2X8seDyGhq
 Eh8+hOm1I20lbAkW2VksJn1b+e2GEszhgyUEZSv0Ew9xwiOa11SRnWjicNql0TUR
 zbViz9HRnB1QNNFpwYEJz4Ke38URdC9QT9H91u8BWPo6emopRm0KamxWag62WjCE
 vy4uJJUp2L8uMJQ/3JqjxCUyOkZ0afnJwCdysNbZqNs19g3JpjIbIHV8wxXA53Aq
 IX9PDVhq+AEa+o3wHwvB4xGY903IC9iGyEzeb8rOmiaDH/zgGng=
 =ia2k
 -----END PGP SIGNATURE-----

Merge tag 'gpio-updates-for-v5.6-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into devel

gpio updates for v5.6

- improvements in the gpio-pca953x driver
- use platform_irq_count() in gpio-mvebu and gpio-bcm-kona
- remove unneeded MODULE_VERSION() usage in the gpio directory
- irq-related improvements in gpio-tegra driver
- several improvements for the core subsystem code: fix confusing indentation,
  fix int type casting, unduplicate code in several places
2020-01-07 13:53:39 +01:00
Song Hui 227caae52b gpio: mpc8xxx: ls1088a/ls1028a edge detection mode bug fixs.
On these boards, the irq_set_type must point one valid function pointer
that can correctly set both edge and falling edge.

Signed-off-by: Song Hui <hui.song_1@nxp.com>
Link: https://lore.kernel.org/r/20191122061839.24904-1-hui.song_1@nxp.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 13:37:11 +01:00
Jia-Ju Bai e36eaf94be gpio: gpio-grgpio: fix possible sleep-in-atomic-context bugs in grgpio_irq_map/unmap()
The driver may sleep while holding a spinlock.
The function call path (from bottom to top) in Linux 4.19 is:

drivers/gpio/gpio-grgpio.c, 261:
	request_irq in grgpio_irq_map
drivers/gpio/gpio-grgpio.c, 255:
	_raw_spin_lock_irqsave in grgpio_irq_map

drivers/gpio/gpio-grgpio.c, 318:
	free_irq in grgpio_irq_unmap
drivers/gpio/gpio-grgpio.c, 299:
	_raw_spin_lock_irqsave in grgpio_irq_unmap

request_irq() and free_irq() can sleep at runtime.

To fix these bugs, request_irq() and free_irq() are called without
holding the spinlock.

These bugs are found by a static analysis tool STCheck written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20191218132605.10594-1-baijiaju1990@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 13:37:11 +01:00
Jia-Ju Bai 25d071b3f6 gpio: gpio-grgpio: fix possible sleep-in-atomic-context bugs in grgpio_remove()
drivers/gpio/gpiolib-sysfs.c, 796:
	mutex_lock in gpiochip_sysfs_unregister
drivers/gpio/gpiolib.c, 1455:
	gpiochip_sysfs_unregister in gpiochip_remove
drivers/gpio/gpio-grgpio.c, 460:
	gpiochip_remove in grgpio_remove
drivers/gpio/gpio-grgpio.c, 449:
	_raw_spin_lock_irqsave in grgpio_remove

kernel/irq/irqdomain.c, 243:
	mutex_lock in irq_domain_remove
drivers/gpio/gpio-grgpio.c, 463:
	irq_domain_remove in grgpio_remove
drivers/gpio/gpio-grgpio.c, 449:
	_raw_spin_lock_irqsave in grgpio_remove

mutex_lock() can sleep at runtime.

To fix these bugs, the lock is dropped in grgpio_remove(), because there
is no need for locking in remove() callbacks.

These bugs are found by a static analysis tool STCheck written by
myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20191219131459.18640-1-baijiaju1990@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 13:37:10 +01:00
Hans de Goede aa23ca3d98 gpiolib: acpi: Add honor_wakeup module-option + quirk mechanism
On some laptops enabling wakeup on the GPIO interrupts used for ACPI _AEI
event handling causes spurious wakeups.

This commit adds a new honor_wakeup option, defaulting to true (our current
behavior), which can be used to disable wakeup on troublesome hardware
to avoid these spurious wakeups.

This is a workaround for an architectural problem with s2idle under Linux
where we do not have any mechanism to immediately go back to sleep after
wakeup events, other then for embedded-controller events using the standard
ACPI EC interface, for details see:
https://lore.kernel.org/linux-acpi/61450f9b-cbc6-0c09-8b3a-aff6bf9a0b3c@redhat.com/

One series of laptops which is not able to suspend without this workaround
is the HP x2 10 Cherry Trail models, this commit adds a DMI based quirk
which makes sets honor_wakeup to false on these models.

Cc: stable@vger.kernel.org
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200105160357.97154-3-hdegoede@redhat.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 12:58:15 +01:00
Hans de Goede 1ad1b54099 gpiolib: acpi: Turn dmi_system_id table into a generic quirk table
Turn the existing run_edge_events_on_boot_blacklist dmi_system_id table
into a generic quirk table, storing the quirks in the driver_data ptr.

This is a preparation patch for adding other types of (DMI based) quirks.

Cc: stable@vger.kernel.org
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200105160357.97154-2-hdegoede@redhat.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 12:57:25 +01:00
Bartosz Golaszewski 2a2cabd8bc gpiolib: use gpiochip_get_desc() in gpio_ioctl()
Unduplicate the offset check by simply calling gpiochip_get_desc() and
checking its return value.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 12:03:28 +01:00
Bartosz Golaszewski 45e2360480 gpiolib: use gpiochip_get_desc() in lineevent_create()
Unduplicate the ngpio check by simply calling gpiochip_get_desc() and
checking its return value.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 12:03:28 +01:00
Bartosz Golaszewski 0f41dabe45 gpiolib: use gpiochip_get_desc() in linehandle_create()
Unduplicate the ngpio check by simply calling gpiochip_get_desc() and
checking its return value.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 12:03:28 +01:00
Bartosz Golaszewski 06863620ed gpiolib: convert the type of hwnum to unsigned int in gpiochip_get_desc()
gpiochip_get_desc() takes a u16 hwnum, but it turns out most users don't
respect that and usually pass an unsigned int. Since implicit casting to
a smaller type is dangerous - let's change the type of hwnum to unsigned
int in gpiochip_get_desc() and in gpiochip_request_own_desc() where the
size of hwnum is not respected either and who's a user of the former.

This is safe as we then check the hwnum against the number of lines
before proceeding in gpiochip_get_desc().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 12:03:28 +01:00
Bartosz Golaszewski d90f36851d gpiolib: have a single place of calling set_config()
Instead of calling the gpiochip's set_config() callback directly and
checking its existence every time - just add a new routine that performs
this check internally. Call it in gpio_set_config() and
gpiod_set_transitory(). Also call it in gpiod_set_debounce() and drop
the check for chip->set() as it's irrelevant to this config option.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 12:03:28 +01:00
Bartosz Golaszewski a9001764c6 gpiolib: use 'unsigned int' instead of 'unsigned' in gpio_set_config()
Checkpatch complains about using 'unsigned' instead of 'unsigned int'.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-07 12:03:27 +01:00