Commit Graph

7404 Commits

Author SHA1 Message Date
Mario Limonciello
179db1909c pinctrl: amd: Add an LPS0 check() callback
During suspend the pinctrl_amd driver disables the interrupts for
any GPIOs that are not marked as wake sources.

This however does not prevent them from changing the wake status
bit during suspend, it just stops the system from waking.

If the system wakes from hardware sleep for another reason (such
as plugging in the AC adapter) this wake bits might be active.

This could potentially cause problems with going back to hardware
sleep.  Add an extra debugging message when PM debugging is enabled
to help identify if this is happening.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3929
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/20250407183656.1503446-2-superm1@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-04-09 16:10:37 +02:00
Peter Griffin
a30692b4f8 pinctrl: samsung: Add filter selection support for alive bank on gs101
Newer Exynos based SoCs have a filter selection bitfield in the filter
configuration registers on alive bank pins. This allows the selection of
a digital or analog delay filter for each pin. Add support for selecting
and enabling the filter.

On suspend we set the analog filter to all pins in the bank (as the
digital filter relies on a clock). On resume the digital filter is
reapplied to all pins in the bank. The digital filter is working via
a clock and has an adjustable filter delay flt_width bitfield, whereas
the analog filter uses a fixed delay.

The filter determines to what extent signal fluctuations received through
the pad are considered glitches.

The code path can be exercised using
echo mem > /sys/power/state
And then wake the device using a eint gpio

Reviewed-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20250402-pinctrl-fltcon-suspend-v6-4-78ce0d4eb30c@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2025-04-08 20:57:51 +02:00
Peter Griffin
bdbe0a0f71 pinctrl: samsung: add gs101 specific eint suspend/resume callbacks
gs101 differs to other SoCs in that fltcon1 register doesn't
always exist. Additionally the offset of fltcon0 is not fixed
and needs to use the newly added eint_fltcon_offset variable.

Fixes: 4a8be01a1a ("pinctrl: samsung: Add gs101 SoC pinctrl configuration")
Cc: stable@vger.kernel.org  # depends on the previous three patches
Reviewed-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20250402-pinctrl-fltcon-suspend-v6-3-78ce0d4eb30c@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2025-04-08 20:57:47 +02:00
Peter Griffin
77ac6b742e pinctrl: samsung: add dedicated SoC eint suspend/resume callbacks
Refactor the existing platform specific suspend/resume callback
so that each SoC variant has it's own callback containing the
SoC specific logic.

This allows exynosautov920 to have a dedicated function for using
eint_con_offset and eint_mask_offset. Also it is easily extendable
for gs101 which will need dedicated logic for handling the varying
register offset of fltcon0 via eint_fltcon_offset.

Reviewed-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20250402-pinctrl-fltcon-suspend-v6-2-78ce0d4eb30c@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2025-04-08 20:57:47 +02:00
Peter Griffin
3ade961e97 pinctrl: samsung: refactor drvdata suspend & resume callbacks
This enables the clk_enable() and clk_disable() logic to be removed
from each callback, but otherwise should have no functional impact.

It is a prepatory patch so that the callbacks can become SoC
specific.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20250402-pinctrl-fltcon-suspend-v6-1-78ce0d4eb30c@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2025-04-08 20:57:46 +02:00
Linus Torvalds
29d9983b2c Pin control changes for the v6.15 kernel cycle:
Core changes:
 
 - None really.
 
 New drivers:
 
 - AMD ISP411 "AMD ISP" driver.
 
 - Exynos 2200 and 7870 SoC subdrivers.
 
 - Sophgo RISC-V SG2042 and SG2044 subdrivers.
 
 - Amlogic A4 subdriver.
 
 - Rockchip RK3528 subdriver.
 
 - Broadcom BCM21664 subdriver.
 
 - Allwinner A523/T527 subdriver.
 
 - Ingenic X1600 subdriver.
 
 - Microchip SAMA7D65 subdriver, essentially a re-branded
   Atmel AT91 PIO4 driver, but nowadays a Microschip SoC line.
 
 Improvements:
 
 - Bring in the devm_kmemdup_array() helper and use it throughout,
   also bring in changes to other subsystems for this to establish
   this helper.
 
 - Support EGPIO on the Qualcomm SA8775P SoC.
 
 - Extend EINT support in the Mediatek driver.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAmfmehEACgkQQRCzN7AZ
 XXMP7xAAislvKr11tILu/pJerSOI+OI6VcqJHa+u2AZbW/KuVpfMJNM5por5eXrX
 sCKJh86zXd39fhC5znLFaESvrmCWdwjPu4HKfHA+BsPLOt3mEbM6XQUlxHJnnU8A
 JrLDZFit7odPFxou9nApdd6QtM+Pqaaib4YSXFDrvULNyjoi0O6/NDuoOjunV4q9
 C0S1yHSVOqO91qTZqpFE1PMVdNgzO7EmQ8UYQgGSPijl4NRS9CP7lFAxD9Z0VGhh
 4Yjnlhr3ZSn3VklbGTBN8AcC8Yv69KSh2oYrue90PQwYI9yo3twIplqEIVFkDm39
 27oLZoC+RLXNPTbrzSsdYwzti2Rg7mObJC7WMxyrl4wbu1ikzuBG8HjSj1Ai0Vmt
 f4uchPA2w+L5hP0WLhujd7ocXrG2YNohjaduYZU/1y6Cvu2L7kF6+MK/fjlFWbVr
 7JIKAR7ALvkpmPLQoUTsJxKLrwbvY5Q6Qh6plLdh6/L0rNQ1tLrJpklHhf3VzkCC
 GuZSyC89Ym1smKO3XcfC+cmVUVheJQj0/NoY59RBkc0rDgApc6Uvs0icELBoDpLr
 4XmghtMFdhTdUEs6n9Q4laEbHgYBAKrnN0BYWvaCmBxnZBZbUO44G7sbFOTMC+9l
 wFs7MnH0f0YmzeF1LDz5z/oF8T3Xl0xMUL7qWoSu4zS1gjziJP8=
 =iPMS
 -----END PGP SIGNATURE-----

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

Pull pin control updates from Linus Walleij:
 "Core changes:

   - None really.

  New drivers:

   - AMD ISP411 "AMD ISP" driver

   - Exynos 2200 and 7870 SoC subdrivers

   - Sophgo RISC-V SG2042 and SG2044 subdrivers

   - Amlogic A4 subdriver

   - Rockchip RK3528 subdriver

   - Broadcom BCM21664 subdriver

   - Allwinner A523/T527 subdriver

   - Ingenic X1600 subdriver

   - Microchip SAMA7D65 subdriver, essentially a re-branded Atmel AT91
     PIO4 driver, but nowadays a Microschip SoC line

  Improvements:

   - Bring in the devm_kmemdup_array() helper and use it throughout,
     also bring in changes to other subsystems for this to establish
     this helper

   - Support EGPIO on the Qualcomm SA8775P SoC

   - Extend EINT support in the Mediatek driver"

* tag 'pinctrl-v6.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (101 commits)
  pinctrl: mediatek: Add EINT support for multiple addresses
  pinctrl: amlogic-a4: Drop surplus semicolon
  pinctrl: nuvoton: Reduce use of OF-specific APIs
  pinctrl: nuvoton: Convert to use struct group_desc
  pinctrl: nuvoton: Make use of struct pinfunction and PINCTRL_PINFUNCTION()
  pinctrl: nuvoton: Convert to use struct pingroup and PINCTRL_PINGROUP()
  pinctrl: npcm8xx: Fix incorrect struct npcm8xx_pincfg assignment
  pinctrl: tegra: Fix off by one in tegra_pinctrl_get_group()
  pinctrl: PINCTRL_AMDISP should depend on DRM_AMD_ISP
  pinctrl: qcom: sa8775p: Enable egpio function
  dt-bindings: pinctrl: qcom: Add egpio function for sa8775p
  pinctrl: qcom: tlmm-test: Validate irq_enable delivers edge irqs
  pinctrl: qcom: Clear latched interrupt status when changing IRQ type
  dt-bindings: pinctrl: airoha: Add missing gpio-ranges property
  pinctrl: bcm281xx: Add missing assignment in bcm21664_pinctrl_lock_all()
  pinctrl: amd: isp411: Fix IS_ERR() vs NULL check in probe()
  dt-bindings: pinctrl: at91-pio4: add microchip,sama7d65-pinctrl
  pinctrl: tegra: Set SFIO mode to Mux Register
  pinctrl-tegra: Restore SFSEL bit when freeing pins
  pinctrl: tegra: Add descriptions for SoC data fields
  ...
2025-03-29 16:59:16 -07:00
Hao Chang
3ef9f710ef pinctrl: mediatek: Add EINT support for multiple addresses
For flexible routing, eint will be divided into 5 bases,
and it will obtain the operation address through the pins array.

Signed-off-by: Hao Chang <ot_chhao.chang@mediatek.com>
Signed-off-by: Qingliang Li <qingliang.li@mediatek.com>
Link: https://lore.kernel.org/20250322035307.4811-2-ot_chhao.chang@mediatek.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-24 08:51:09 +01:00
Linus Walleij
5df0211a67 pinctrl: amlogic-a4: Drop surplus semicolon
The kernel bots complain about untidy code found using
coccinelle, fix it up.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202503212354.Hx2qaDRe-lkp@intel.com/
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-22 21:33:43 +01:00
Andy Shevchenko
693c9ecd83 pinctrl: nuvoton: Reduce use of OF-specific APIs
Some drivers are using device property APIs along with OF-specific ones.
At the same time few of the latter can be converted to device property
calls. Reduce use of OF-specific APIs in order to bring a bit more consistency
into the drivers.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250318105932.2090926-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-20 09:14:10 +01:00
Andy Shevchenko
d52ecc655a pinctrl: nuvoton: Convert to use struct group_desc
The pin control core header provides struct group_desc.
Utilize it instead of open coded variants in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250318105932.2090926-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-20 09:14:10 +01:00
Andy Shevchenko
1bce744173 pinctrl: nuvoton: Make use of struct pinfunction and PINCTRL_PINFUNCTION()
Since pin control provides a generic data type and a macro for
the pin function definition, use them in the driver.

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250318105932.2090926-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-20 09:14:10 +01:00
Andy Shevchenko
1a65846509 pinctrl: nuvoton: Convert to use struct pingroup and PINCTRL_PINGROUP()
The pin control header provides struct pingroup and PINCTRL_PINGROUP() macro.
Utilize them instead of open coded variants in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250318105932.2090926-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-20 09:14:10 +01:00
Andy Shevchenko
113ec87b0f pinctrl: npcm8xx: Fix incorrect struct npcm8xx_pincfg assignment
Sparse is not happy about implementation of the NPCM8XX_PINCFG()

 pinctrl-npcm8xx.c:1314:9: warning: obsolete array initializer, use C99 syntax
 pinctrl-npcm8xx.c:1315:9: warning: obsolete array initializer, use C99 syntax
 ...
 pinctrl-npcm8xx.c:1412:9: warning: obsolete array initializer, use C99 syntax
 pinctrl-npcm8xx.c:1413:9: warning: too many warnings

which uses index-based assignment in a wrong way, i.e. it missed
the equal sign and hence the index is simply ignored, while the
entries are indexed naturally. This is not a problem as the pin
numbering repeats the natural order, but it might be in case of
shuffling the entries. Fix this by adding missed equal sign and
reformat a bit for better readability.

Fixes: acf4884a57 ("pinctrl: nuvoton: add NPCM8XX pinctrl and GPIO driver")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250318105932.2090926-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-20 09:14:09 +01:00
Dan Carpenter
5a062c3c3b pinctrl: tegra: Fix off by one in tegra_pinctrl_get_group()
This should be >= pmx->soc->ngroups instead of > to avoid an out of
bounds access.  The pmx->soc->groups[] array is allocated in
tegra_pinctrl_probe().

Fixes: c12bfa0fee ("pinctrl-tegra: Restore SFSEL bit when freeing pins")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Kunwu Chan <kunwu.chan@linux.dev>
Link: https://lore.kernel.org/82b40d9d-b437-42a9-9eb3-2328aa6877ac@stanley.mountain
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-20 09:12:44 +01:00
Geert Uytterhoeven
813b1a1a21 pinctrl: PINCTRL_AMDISP should depend on DRM_AMD_ISP
The AMD Image Signal Processor GPIO pin control functionality is only
present on AMD platforms with ISP support, and its platform device is
instantiated by the AMD ISP driver.  Hence add a dependency on
DRM_AMD_ISP, to prevent asking the user about this driver when
configuring a kernel that does not support the AMD ISP.

Fixes: e97435ab09 ("pinctrl: amd: isp411: Add amdisp GPIO pinctrl")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/3685561e8e3cd1d94bce220eeb6001d659da615c.1742306024.git.geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-18 15:23:52 +01:00
Geert Uytterhoeven
c746ff4a67 pinctrl: spacemit: PINCTRL_SPACEMIT_K1 should not default to y unconditionally
Merely enabling compile-testing should not enable additional
functionality.

Fixes: 7ff4faba63 ("pinctrl: spacemit: enable config option")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yixun Lan <dlan@gentoo.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Alex Elder <elder@riscstar.com>
Reviewed-by: Alex Elder <elder@riscstar.com>
Link: https://lore.kernel.org/6881b8d1ad74ac780af8a974e604b5ef3f5d4aad.1742198691.git.geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-18 14:11:46 +01:00
Linus Walleij
eb8578843f Samsung pinctrl drivers changes for v6.15
1. Add pin controller drivers for newly usptreamed Samsung Exynos2200
    and Exynos7870.
 2. Correct filter configuration offset of some of Google GS101 SoC pin
    banks, which later is supposed to be used during system
    suspend/resume.
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmfW4GQQHGtyemtAa2Vy
 bmVsLm9yZwAKCRDBN2bmhouD13QSEACYr14mY3bEzRDyxchkOiwi50uNgieKCI2/
 JQIEs/TtGqDAlvwN+OODkyIKzwyc0PDkbKGBP/kUOblHr/4i9H06dT653d8mgzkZ
 Kkoe9SLeniW717YCS9N5vrZOYmQNIqYA0rEHFO5G45fAWQCNomFjrbtakkdG4Zx3
 jEEGoxFygR4Pu4vymEYhdzX8W3KgcqNQEwxf6gN+HOM18DNq/0zW6lcP6Pe66eaR
 3VcoyvaU7B8UAJOLecOwKOfcCc1g32+hBkWuLHsSwcky8yK/Nt6sW7xbeUflcEwU
 XYJeqv9B4OzPHNiTVovAgBw/ZRcv1x4jeajqI0+pU22JZj80orI+lzQEBpjRpUmh
 u6g/e8K9Y/66Xnyt/T5fvTWlkOkSWZh0tL3aqcS6JJ/7RNFB9FBaClydlyEAprhs
 UZ1ACsX9xZz+XeKIL864zQlUa/lKJWcS+bzviuqB83Kqtwqv6tW2ijReco87MIaf
 jeP6IGlFFotLofCfphbLn8ppuiG+r+1aZKfZryMurL27KM4LL/cffWTYxyvgOjZs
 IoxIfZaXtJrJk7B7U5mmajMziT7Mzly7fQIuTDmlSWNnxi7xklCkvLFzW//r4341
 2jFjIsX3avNzsckq3laJtLX36w5oOlv1V8RIdWOOE4YlsBZhIXEZj2HIznPhdnCd
 2MccU8vOrg==
 =H+LK
 -----END PGP SIGNATURE-----

Merge tag 'samsung-pinctrl-6.15' of https://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung into devel

Samsung pinctrl drivers changes for v6.15

1. Add pin controller drivers for newly usptreamed Samsung Exynos2200
   and Exynos7870.
2. Correct filter configuration offset of some of Google GS101 SoC pin
   banks, which later is supposed to be used during system
   suspend/resume.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-18 11:09:15 +01:00
Wasim Nazir
a326b0523f pinctrl: qcom: sa8775p: Enable egpio function
Egpio feature allows IsLand Domain IOs to be reused as TLMM GPIOs.
sa8775p supports egpio feature for GPIOs ranging from 126 to 148.

Signed-off-by: Wasim Nazir <quic_wasimn@quicinc.com>
Reviewed-by: Dmitry Baryshkov <lumag@kernel.org>
Link: https://lore.kernel.org/20250312072509.3247885-3-quic_wasimn@quicinc.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-17 14:24:45 +01:00
Bjorn Andersson
b938feb790 pinctrl: qcom: tlmm-test: Validate irq_enable delivers edge irqs
In commit 'cf9d052aa600 ("pinctrl: qcom: Don't clear pending interrupts
when enabling")' Doug establishes an expectation that edge interrupts
occurring while an interrupt is disabled should be delivered once the
interrupt is enabled again.

Implement a test to validate that this is the case.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Link: https://lore.kernel.org/20250313-tlmm-test-disabled-irq-delivered-v1-1-f0be903732ac@oss.qualcomm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-17 14:24:45 +01:00
Stephan Gerhold
e225128c3f pinctrl: qcom: Clear latched interrupt status when changing IRQ type
When submitting the TLMM test driver, Bjorn reported that some of the test
cases are failing for GPIOs that not are backed by PDC (i.e. "non-wakeup"
GPIOs that are handled directly in pinctrl-msm). Basically, lingering
latched interrupt state is still being delivered at IRQ request time, e.g.:

  ok 1 tlmm_test_silent_rising
  tlmm_test_silent_falling: ASSERTION FAILED at drivers/pinctrl/qcom/tlmm-test.c:178
  Expected atomic_read(&priv->intr_count) == 0, but
      atomic_read(&priv->intr_count) == 1 (0x1)
  not ok 2 tlmm_test_silent_falling
  tlmm_test_silent_low: ASSERTION FAILED at drivers/pinctrl/qcom/tlmm-test.c:178
  Expected atomic_read(&priv->intr_count) == 0, but
      atomic_read(&priv->intr_count) == 1 (0x1)
  not ok 3 tlmm_test_silent_low
  ok 4 tlmm_test_silent_high

Whether to report interrupts that came in while the IRQ was unclaimed
doesn't seem to be well-defined in the Linux IRQ API. However, looking
closer at these specific cases, we're actually reporting events that do not
match the interrupt type requested by the driver:

 1. After "ok 1 tlmm_test_silent_rising", the GPIO is in low state and
    configured for IRQF_TRIGGER_RISING.

 2. (a) In preparation for "tlmm_test_silent_falling", the GPIO is switched
        to high state. The rising interrupt gets latched.
    (b) The GPIO is re-configured for IRQF_TRIGGER_FALLING, but the latched
        interrupt isn't cleared.
    (c) The IRQ handler is called for the latched interrupt, but there
        wasn't any falling edge.

 3. (a) For "tlmm_test_silent_low", the GPIO remains in high state.
    (b) The GPIO is re-configured for IRQF_TRIGGER_LOW. This seems to
        result in a phantom interrupt that gets latched.
    (c) The IRQ handler is called for the latched interrupt, but the GPIO
        isn't in low state.

 4. (a) For "tlmm_test_silent_high", the GPIO is switched to low state.
    (b) This doesn't result in a latched interrupt, because RAW_STATUS_EN
        was cleared when masking the level-triggered interrupt.

Fix this by clearing the interrupt state whenever making any changes to the
interrupt configuration. This includes previously disabled interrupts, but
also any changes to interrupt polarity or detection type.

With this change, all 16 test cases are now passing for the non-wakeup
GPIOs in the TLMM.

Cc: stable@vger.kernel.org
Fixes: cf9d052aa6 ("pinctrl: qcom: Don't clear pending interrupts when enabling")
Reported-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Closes: https://lore.kernel.org/r/20250227-tlmm-test-v1-1-d18877b4a5db@oss.qualcomm.com/
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Tested-by: Bjorn Andersson <andersson@kernel.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/20250312-pinctrl-msm-type-latch-v1-1-ce87c561d3d7@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-17 14:24:45 +01:00
Dan Carpenter
774e344716 pinctrl: bcm281xx: Add missing assignment in bcm21664_pinctrl_lock_all()
The next line checks if this regmap_write() failed, but it doesn't
work because the assignment was accidentally left out.  Add the
assignment.

Fixes: 60d69769c8 ("pinctrl: bcm281xx: Add support for BCM21664 pinmux")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Artur Weber <aweber.kernel@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/dfc15d59-7fa9-4f96-aacb-37c3df6d420d@stanley.mountain
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-17 14:24:45 +01:00
Dan Carpenter
465cf67671 pinctrl: amd: isp411: Fix IS_ERR() vs NULL check in probe()
The platform_get_resource() returns NULL on error.  It doesn't
return error pointers.  Fix the error checking to match.

Fixes: e97435ab09 ("pinctrl: amd: isp411: Add amdisp GPIO pinctrl")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
Link: https://lore.kernel.org/617f4c77-7837-4e24-9f4d-620ecfedf924@stanley.mountain
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-17 14:24:45 +01:00
Prathamesh Shete
17013f0acb pinctrl: tegra: Set SFIO mode to Mux Register
Tegra devices have an 'sfsel' bit field that determines whether a pin
operates in SFIO (Special Function I/O) or GPIO mode. Currently,
tegra_pinctrl_gpio_disable_free() sets this bit when releasing a GPIO.

However, tegra_pinctrl_set_mux() can be called independently in certain
code paths where gpio_disable_free() is not invoked. In such cases, failing
to set the SFIO mode could lead to incorrect pin configurations, resulting
in functional issues for peripherals relying on SFIO.

This patch ensures that whenever set_mux() is called, the SFIO mode is
correctly set in the Mux Register if the 'sfsel' bit is present. This
prevents situations where the pin remains in GPIO mode despite being
configured for SFIO use.

Fixes: 971dac7123 ("pinctrl: add a driver for NVIDIA Tegra")
Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
Link: https://lore.kernel.org/20250306050542.16335-1-pshete@nvidia.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-17 14:24:21 +01:00
Prathamesh Shete
c12bfa0fee pinctrl-tegra: Restore SFSEL bit when freeing pins
Each pin can be configured as a Special Function IO (SFIO) or GPIO,
where the SFIO enables the pin to operate in alternative modes such as
I2C, SPI, etc.

The current implementation sets all the pins back to SFIO mode
even if they were initially in GPIO mode. This can cause glitches
on the pins when pinctrl_gpio_free() is called.

Avoid these undesired glitches by storing the pin's SFIO/GPIO
state on GPIO request and restoring it on GPIO free.

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
Link: https://lore.kernel.org/20250305104939.15168-2-pshete@nvidia.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-14 11:03:49 +01:00
Prathamesh Shete
4fd41e74bd pinctrl: tegra: Add descriptions for SoC data fields
Add detailed descriptions for the remaining fields in the
tegra_pinctrl_soc_data structure. This improves code documentation
and clarifies the purpose of each field, particularly for the
pin-specific configuration options.

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
Link: https://lore.kernel.org/20250305104939.15168-1-pshete@nvidia.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-14 11:03:49 +01:00
Bartosz Golaszewski
597b3627d5 pinctrl: spacemit: destroy mutex at driver detach
The mutex initialized in probe() is never cleaned up. Use
devm_mutex_init() to destroy it automatically.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Yixun Lan <dlan@gentoo.org>
Link: https://lore.kernel.org/20250305102710.52762-1-brgl@bgdev.pl
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-14 11:02:08 +01:00
H. Nikolaus Schaller
8171e7b929 pinctrl: ingenic: jz4730: add pinmux for I2S interface
I2S is used for the sound codec of the Alpha400.

Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Link: https://lore.kernel.org/7e79b16be569fb0f501032b2b6ec726e4a09411f.1740823241.git.hns@goldelico.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-14 10:51:23 +01:00
H. Nikolaus Schaller
4b490ccbc3 pinctrl: ingenic: jz4730: add pinmux for MII
The MII interface is used for the Ethernet connection of the Alpha400.

Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Link: https://lore.kernel.org/972b31e1fce03808745e53df17315b29e2bcf696.1740823241.git.hns@goldelico.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-14 10:51:23 +01:00
Paul Boddie
4da56f9c6f pinctrl: ingenic: add x1600 support
Add support for the Lumissil/Ingenic X1600 SoC.

It uses shadow registers to commit changes to multiple pinctrl
registers in parallel.

Define specific Chip ID, register offsets, pin tables etc.

Handling the unique X1600_GPIO_PU only for the x1600 but
not for x1830 and above must be carefully taken into account.

Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Co-authored-by: Andreas Kemnade <andreas@kemnade.info>
Co-authored-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Paul Boddie <paul@boddie.org.uk>
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Link: https://lore.kernel.org/84477ec9cb9ed13bf4f6f87d5fb3b55542d31097.1740823241.git.hns@goldelico.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-14 10:51:22 +01:00
Andre Przywara
b8a51e95b3 pinctrl: sunxi: Add support for the secondary A523 GPIO ports
As most other Allwinner SoCs before, the A523 chip contains a second
GPIO controller, managing banks PL and PM.
Use the newly introduced DT based pinctrl driver to describe just the
generic pinctrl properties, so advertise the number of pins per bank
and the interrupt capabilities. The actual function/mux assignment is
taken from the devicetree.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/20250306235827.4895-9-andre.przywara@arm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-13 14:48:57 +01:00
Andre Przywara
648be4cd95 pinctrl: sunxi: Add support for the Allwinner A523
The Allwinner A523 contains pins in 10 out of the 11 possible pin banks;
it just skips port A.
Use the newly introduced DT based pinctrl driver to describe just the
generic pinctrl properties, so advertise the number of pins per bank
and the interrupt capabilities. The actual function/mux assignment is
taken from the devicetree.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/20250306235827.4895-8-andre.przywara@arm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-13 14:48:57 +01:00
Andre Przywara
f5e2cd34b1 pinctrl: sunxi: allow reading mux values from DT
So far every Allwinner SoC needs a large table in the kernel code, to
describe the mapping between the pinctrl function names ("uart") and
the actual pincontroller mux value to be written into the registers.
This adds a lot of data into a single image kernel, and also looks
somewhat weird, as the DT can easily store the mux value.

Add some code that allows to avoid that table: the struct that describes
the existing pins will be build at *runtime*, based on very basic
information provided by the respective SoC's pinctrl driver. This
consists of the number of pins per bank, plus information which bank
provides IRQ support, along with the mux value to use for that.
The code will then iterate over all children of the pincontroller DT
node (which describe each pin group), and populate that struct with the
mapping between function names and mux values. The only thing that needs
adding in the DT is a property with that value, per pin group.

When this table is built, it will be handed over to the existing sunxi
pinctrl driver, which cannot tell a difference between a hardcoded
struct and this new one built at runtime. It will take care of
registering the pinctrl device with the pinctrl subsystem.

All a new SoC driver would need to do is to provide two arrays, and then
call the sunxi_pinctrl_dt_table_init() function.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/20250306235827.4895-6-andre.przywara@arm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-13 14:48:57 +01:00
Andre Przywara
6d079d93e4 pinctrl: sunxi: support moved power configuration registers
The Allwinner pincontroller IP features some registers to control the
withstand voltage of each pin group. So far those registers were always
located at the same offset, but the A523 SoC has moved them (probably to
accommodate all eleven pin banks).

Add a flag to note this feature, and use that to program the registers
either at offset 0x340 or 0x380. So far no pincontroller driver uses
this flag, but we need it for the upcoming A523 support.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/20250306235827.4895-5-andre.przywara@arm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-13 14:48:56 +01:00
Andre Przywara
c6c4dc75a1 pinctrl: sunxi: move bank K register offset
The Allwinner pincontroller register layout used to allow for at least
11 banks per controller, any more banks would reside at a second
controller instance.
When the per-bank register map size was increased with the D1, it turned
out that the last bank (port K) of those maximum 11 banks actually would
not fit anymore in the 512 bytes reserved for the pincontroller registers.
On new SoCs Allwinner thus moved the last bank beyond the existing
registers, at offset 0x500.

So far SoCs never used more than 9 banks per controller, but the new
Allwinner A523 actually uses all 11 banks. Since that SoC also uses the
extended layout, its PortK needs to be programmed at offset 0x500.

Factor out the bank offset calculation into a new function, and handle
the case for the last bank separately. Since none of the older SoCs ever
used PortK, we can ignore this case, and just always use offset 0x500
for the last bank.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/20250306235827.4895-4-andre.przywara@arm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-13 14:48:56 +01:00
Andre Przywara
4713b70cc4 pinctrl: sunxi: increase number of GPIO bank regulators
By design, the Allwinner pinctrl IP always supported up to 11 GPIO banks,
though no SoC ever used more than 9 banks so far.
The Allwinner A523 has pins in all 11 banks, which exceeds the number of
per-bank regulators that we currently support, as this was set to 9.

Increase the size of the array to hold up to 11 regulator structs, to
support pins in bank J and K as well.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/20250306235827.4895-3-andre.przywara@arm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-13 14:48:56 +01:00
Andre Przywara
12966fdfba pinctrl: sunxi: refactor pinctrl variants into flags
For some Allwinner SoCs we have one pinctrl driver caring for multiple
very similar chips, and are tagging certain pins with a variant bitmask.
The Allwinner D1 introduced a slightly extended register layout, and we
were abusing this variant mask to convey this bit of information into
the common code part.
Now there will be more pinctrl device properties to consider (has PortF
voltage switch, for instance), so shoehorning this into the variant
bitmask will not fly anymore.

Refactor the "variant" field into a more generic "flags" field. It turns
out that we don't need the variant bits to be unique across all SoCs,
but only among those SoCs that share one driver (table), of which there
are at most three variants at the moment. So the actual variant field can
be limited to say 8 bits, and the other bits in the flag register can be
re-purposed to hold other information, like this extended register
layout.
As a side effect we can move the variant definition into the per-SoC
pinctrl driver file, which makes it more obvious that this is just a
private definition, only relevant for this particular table.
This also changes the artificial sun20i-d1 "variant" into the actual
flag bit that we are after.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/20250306235827.4895-2-andre.przywara@arm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-13 14:48:55 +01:00
Linus Walleij
bc9527fb07 intel-pinctrl for v6.15-1
* Introduce devm_kmemdup_array() and convert Intel pin control drivers
 * Update PWM handling for the cases when it's provided by Intel pin control
 * Miscellaneous fixes, updates, and cleanups
 
 The following is an automated git shortlog grouped by driver:
 
 baytrail:
  -  copy communities using devm_kmemdup_array()
  -  Use dedicated helpers for chained IRQ handlers
 
 cherryview:
  -  use devm_kmemdup_array()
 
 devres:
  -  Introduce devm_kmemdup_array()
 
 driver core:
  -  Split devres APIs to device/devres.h
 
 err.h:
  -  move IOMEM_ERR_PTR() to err.h
 
 iio:
  -  adc: xilinx-xadc-core: use devm_kmemdup_array()
  -  imu: st_lsm9ds0: Replace device.h with what is needed
 
 input:
  -  ipaq-micro-keys: use devm_kmemdup_array()
  -  sparse-keymap: use devm_kmemdup_array()
 
 intel:
  -  drop repeated config dependency
  -  copy communities using devm_kmemdup_array()
  -  Fix wrong bypass assignment in intel_pinctrl_probe_pwm()
  -  Import PWM_LPSS namespace for devm_pwm_lpss_probe()
 
 lynxpoint:
  -  Use dedicated helpers for chained IRQ handlers
 
 MAINTAINERS:
  -  Add pin control and GPIO to the Intel MID record
 
 pwm:
  -  lpss: Clarify the bypass member semantics in struct pwm_lpss_boardinfo
  -  lpss: Actually use a module namespace by defining the namespace earlier
 
 pxa2xx:
  -  use devm_kmemdup_array()
 
 tangier:
  -  use devm_kmemdup_array()
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEqaflIX74DDDzMJJtb7wzTHR8rCgFAmfRVwoACgkQb7wzTHR8
 rChzOBAAxUnpx5kPeoWYV7LWtN9GWeO4lRyM86els3nW+wFBJ4qozq5cUO0gw5RA
 vOtCW/ErCja0fs364L1IB2grDF8McmeEqCbLnuuhrrUQ09hd3dGX+8G4kmhzNi4R
 5Hj2cyrTFiOHBrWI5QFe0l6mq3IMVfmzv3VxjD9b/xW7yJ20KTu42cmHpmIvS4xe
 jph5XoCI8FQNPfQB5xu/5IGf0hKwJl3xBGWtRyRVar/KaZfBkrKNXXOrqDcckboP
 A0wXKZyU5DJwvdeOWE05wYUVuOZ+rzwWpZpdk3OmLMTp2Z6e+rJ4DgvkG+xh7zip
 1w9bCaSBS24eYpEvNCjjlnX5zGHrAHg1tu9T802ZcPybmPvGV0gsXEN4+EIKkUOA
 KkVhghci57muWE0OkDblH8w3BYWnM5p9aUs0KoYghjDKKRR34HY6UPau0K407BeO
 zT/5hHzyhd77zzzLY3LKwXUNNpmUKlYcIRwZhrwV19DJhpzftsczt4z3RYgntpmj
 cYAotxlvhgI1RmQsYXmsrwQ6NPOrXb0/Zby1aDTB9EOyY99mb0u5EyQIe4KX2nfS
 eyZyzU4E5eyp4Y2noyYdfJV9XwFK+OH7hdHuvZOsxf59kJWR9fsQSX64XGNomjdW
 F48l0l+Sf3ILHgn459PAvtO22UeoWet3e8LWUMBszZFyCmsZa0I=
 =SG01
 -----END PGP SIGNATURE-----

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

intel-pinctrl for v6.15-1

* Introduce devm_kmemdup_array() and convert Intel pin control drivers
* Update PWM handling for the cases when it's provided by Intel pin control
* Miscellaneous fixes, updates, and cleanups

The following is an automated git shortlog grouped by driver:

baytrail:
 -  copy communities using devm_kmemdup_array()
 -  Use dedicated helpers for chained IRQ handlers

cherryview:
 -  use devm_kmemdup_array()

devres:
 -  Introduce devm_kmemdup_array()

driver core:
 -  Split devres APIs to device/devres.h

err.h:
 -  move IOMEM_ERR_PTR() to err.h

iio:
 -  adc: xilinx-xadc-core: use devm_kmemdup_array()
 -  imu: st_lsm9ds0: Replace device.h with what is needed

input:
 -  ipaq-micro-keys: use devm_kmemdup_array()
 -  sparse-keymap: use devm_kmemdup_array()

intel:
 -  drop repeated config dependency
 -  copy communities using devm_kmemdup_array()
 -  Fix wrong bypass assignment in intel_pinctrl_probe_pwm()
 -  Import PWM_LPSS namespace for devm_pwm_lpss_probe()

lynxpoint:
 -  Use dedicated helpers for chained IRQ handlers

MAINTAINERS:
 -  Add pin control and GPIO to the Intel MID record

pwm:
 -  lpss: Clarify the bypass member semantics in struct pwm_lpss_boardinfo
 -  lpss: Actually use a module namespace by defining the namespace earlier

pxa2xx:
 -  use devm_kmemdup_array()

tangier:
 -  use devm_kmemdup_array()

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-13 09:58:14 +01:00
Linus Walleij
7dadc4b152 pinctrl: renesas: Updates for v6.15 (take two)
- Add missing of_node_put() calls.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQ9qaHoIs/1I4cXmEiKwlD9ZEnxcAUCZ8sTCwAKCRCKwlD9ZEnx
 cJNoAQCHoa7kwfKCbFIpTRQLX4l3PlzM9gAwoHI6AsfokcgzqwEA7BZFRmhmcXTQ
 HWKP8aeSrfiiKvhrjU5j3hr6n9geWgo=
 =dy1I
 -----END PGP SIGNATURE-----

Merge tag 'renesas-pinctrl-for-v6.15-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel

pinctrl: renesas: Updates for v6.15 (take two)

  - Add missing of_node_put() calls.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-13 09:56:13 +01:00
Peter Griffin
701d0e9109 pinctrl: samsung: add support for eint_fltcon_offset
On gs101 SoC the fltcon0 (filter configuration 0) offset isn't at a
fixed offset like previous SoCs as the fltcon1 register only exists when
there are more than 4 pins in the bank.

Add a eint_fltcon_offset and new GS101_PIN_BANK_EINT* macros that take
an additional fltcon_offs variable.

This can then be used in suspend/resume callbacks to save and restore
the fltcon0 and fltcon1 registers.

Fixes: 4a8be01a1a ("pinctrl: samsung: Add gs101 SoC pinctrl configuration")
Cc: stable@vger.kernel.org
Reviewed-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20250307-pinctrl-fltcon-suspend-v4-1-2d775e486036@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2025-03-11 20:37:29 +01:00
Fabrizio Castro
abcdeb4e29 pinctrl: renesas: rza2: Fix missing of_node_put() call
of_parse_phandle_with_fixed_args() requires its caller to
call into of_node_put() on the node pointer from the output
structure, but such a call is currently missing.

Call into of_node_put() to rectify that.

Fixes: b59d0e7827 ("pinctrl: Add RZ/A2 pin and gpio controller")
Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250305163753.34913-5-fabrizio.castro.jz@renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2025-03-06 16:41:46 +01:00
Fabrizio Castro
5a550b0070 pinctrl: renesas: rzv2m: Fix missing of_node_put() call
of_parse_phandle_with_fixed_args() requires its caller to
call into of_node_put() on the node pointer from the output
structure, but such a call is currently missing.

Call into of_node_put() to rectify that.

Fixes: 92a9b82525 ("pinctrl: renesas: Add RZ/V2M pin and gpio controller driver")
Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250305163753.34913-4-fabrizio.castro.jz@renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2025-03-06 16:41:43 +01:00
Fabrizio Castro
a5779e625e pinctrl: renesas: rzg2l: Fix missing of_node_put() call
of_parse_phandle_with_fixed_args() requires its caller to
call into of_node_put() on the node pointer from the output
structure, but such a call is currently missing.

Call into of_node_put() to rectify that.

Fixes: c4c4637eb5 ("pinctrl: renesas: Add RZ/G2L pin and gpio controller driver")
Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250305163753.34913-3-fabrizio.castro.jz@renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2025-03-06 16:41:30 +01:00
Artur Weber
60d69769c8 pinctrl: bcm281xx: Add support for BCM21664 pinmux
BCM21664 is another chip from the Kona line of Broadcom SoCs, and
its pinmux shares a lot of similarities with the BCM281xx pinmux.

Add support for the BCM21664 pinmux controller to the BCM281xx driver.

This also enables pinmux support for the BCM23550, which has an
identical pinmux config to the BCM21664 (hence they can share a
single compatible, brcm,bcm21664-pinctrl).

Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
Link: https://lore.kernel.org/20250303-bcm21664-pinctrl-v3-4-5f8b80e4ab51@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-05 09:01:47 +01:00
Artur Weber
596c185284 pinctrl: bcm281xx: Provide pinctrl device info as OF platform data
Introduce a new struct type, "bcm281xx_pinctrl_info", that holds
information about the pins, pin functions and regmap config for a pin
control chip. Create such a struct for the BCM218xx and pass it as
device data for the OF compatible match.

This is done in preparation for introducing additional chip types
to the driver.

Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
Link: https://lore.kernel.org/20250303-bcm21664-pinctrl-v3-3-5f8b80e4ab51@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-05 09:00:47 +01:00
Artur Weber
07b5a2a13f pinctrl: bcm281xx: Use "unsigned int" instead of bare "unsigned"
Replace uses of bare "unsigned" with "unsigned int" to fix checkpatch
warnings. No functional change.

Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
Link: https://lore.kernel.org/20250303-bcm21664-pinctrl-v3-2-5f8b80e4ab51@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-05 08:53:29 +01:00
Pratap Nirujogi
e97435ab09 pinctrl: amd: isp411: Add amdisp GPIO pinctrl
Add pinctrl driver support for AMD SoC with isp41 hw ip block.

Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
Link: https://lore.kernel.org/20250304232051.2936557-1-pratap.nirujogi@amd.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-05 08:47:43 +01:00
Colin Ian King
7f7a793d71 pinctrl: pinconf-generic: Fix spelling mistake "paramers" -> "parameters"
There is a spelling mistake in a dev_err message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/20250303092826.318638-1-colin.i.king@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-04 09:39:32 +01:00
Xianwei Zhao
c3a0b61e49 pinctrl: meson: fix pin input property for a4
The register of pin input attribute means the opposite.
value of reigster meaning is 1 for input and 0 for output.
So fix it.

Fixes: 6e9be3abb7 ("pinctrl: Add driver support for Amlogic SoCs")
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
Link: https://lore.kernel.org/20250303-fix-a4-pinctl-v1-1-6579888b4272@amlogic.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-04 09:37:33 +01:00
Bartosz Golaszewski
75f87f5d04 pinctrl: bcm2835: don't -EINVAL on alternate funcs from get_direction()
Since commit 9d846b1aeb ("gpiolib: check the return value of
gpio_chip::get_direction()") we check the return value of the
get_direction() callback as per its API contract. This driver returns
-EINVAL if the pin in question is set to one of the alternative
(non-GPIO) functions. This isn't really an error that should be
communicated to GPIOLIB so default to returning the "safe" value of
INPUT in this case. The GPIO subsystem does not have the notion of
"unknown" direction.

Fixes: 9d846b1aeb ("gpiolib: check the return value of gpio_chip::get_direction()")
Reported-by: Mark Brown <broonie@kernel.org>
Closes: https://lore.kernel.org/all/Z7VFB1nST6lbmBIo@finisterre.sirena.org.uk/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/20250219102750.38519-1-brgl@bgdev.pl
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-04 08:52:34 +01:00
Steven Liu
a5e4cde647 pinctrl: rockchip: Add support for RK3528
Add gpio and pinctrl support for the 5 GPIO banks on RK3528.

Signed-off-by: Steven Liu <steven.liu@rock-chips.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/20250228064024.3200000-4-jonas@kwiboo.se
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-03-04 08:50:05 +01:00
Raag Jadav
0ee2261d08 pinctrl: intel: drop repeated config dependency
We already have ACPI dependency for Intel pinctrl menu. No need to
repeat it.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-03-03 16:20:51 +02:00
Kaustabh Chakraborty
eb76dc973c pinctrl: samsung: add support for exynos7870 pinctrl
Add support for the Exynos7870 SoC pin-controller in the pinctrl driver.
It has 8 GPIO banks, and 3-bit PINCFG_TYPE_DRV width.

Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
Link: https://lore.kernel.org/r/20250301-exynos7870-pinctrl-v3-3-ba1da9d3cd2f@disroot.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2025-03-03 10:06:01 +01:00
Bjorn Andersson
c7984dc0a2 pinctrl: qcom: Add test case for TLMM interrupt handling
While looking at the X1E PDC GPIO interrupts it became clear that we're
lacking a convenient and accessible way to validate if the TLMM
interrupt code performing as expected.

This introduces a kunit-based "hack" that relies on pin bias/pull
configuration to tickle the interrupt logic in non-connected pins to
allow us to evaluate that an expected number of interrupts are
delivered.

The bias/pull configuration is done with mmio accesses directly from the
test code, to avoid having to programmatically acquire and drive the
pinconf interface for the test pin. This limits the scalability of the
code to targets with a particular register layout, but serves our needs
for now.

The pin to be used for testing is specified by the tester using the
"tlmm-test.gpio" module parameter.

Worth mentioning is that some of the test cases currently fails for
GPIOs that is not backed by PDC (i.e. "non-wakeup" GPIOs), as lingering
latched interrupt state is being delivered at IRQ request time.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Link: https://lore.kernel.org/20250227-tlmm-test-v1-1-d18877b4a5db@oss.qualcomm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-28 09:41:14 +01:00
Prathamesh Shete
7da6a3578a pinctrl-tegra: Add config property GPIO mode
The SFIO/GPIO select bit is a crucial part of Tegra's pin multiplexing
system:
- When set to 1, the pin operates in SFIO mode, controlled by the
  pin's assigned special function.
- When set to 0, the pin operates as a general-purpose GPIO.

This SFIO/GPIO select bit that is set for a given pin is not displayed,
adding the support to retrieve this information from the
pinmux set for each pin.

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
Link: https://lore.kernel.org/20241217153249.5712-1-pshete@nvidia.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-28 09:37:25 +01:00
Andy Shevchenko
e2a9df2fe1 pinctrl: wpcm450: Switch to use for_each_gpiochip_node() helper
Switch the code to use for_each_gpiochip_node() helper.

While at it, correct header inclusion as device property APIs
are provided in property.h.

Reviewed-by: J. Neuschäfer <j.ne@posteo.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250220155036.2734838-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-28 00:29:48 +01:00
Linus Walleij
73c2cdfdcf pinctrl: renesas: Updates for v6.15
- Add suspend/resume support for pull up/down on RZ/G3S,
   - Miscellaneous fixes and improvements.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQ9qaHoIs/1I4cXmEiKwlD9ZEnxcAUCZ7itjwAKCRCKwlD9ZEnx
 cH8CAP49PGRwN8jLyFBMQRwnmqFhcuXEFdF9jrx2a1uTUIx4UgEAlAMdzt9kfLCI
 3JulXF4Di/xL0yRinfhOfmQ3CNdE9As=
 =vaT3
 -----END PGP SIGNATURE-----

Merge tag 'renesas-pinctrl-for-v6.15-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel

pinctrl: renesas: Updates for v6.15

  - Add suspend/resume support for pull up/down on RZ/G3S,
  - Miscellaneous fixes and improvements.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-28 00:13:55 +01:00
Linus Walleij
3f11be833b Merge branch 'ib-amlogic-a4' into devel
Merge immutable branch into devel for next.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-28 00:03:55 +01:00
Xianwei Zhao
6e9be3abb7 pinctrl: Add driver support for Amlogic SoCs
Add a new pinctrl driver for Amlogic SoCs. All future Amlogic
SoCs pinctrl drives use this, such A4, A5, S6, S7 etc. To support
new Amlogic SoCs, only need to add the corresponding dts file.

Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
Link: https://lore.kernel.org/20250212-amlogic-pinctrl-v5-3-282bc2516804@amlogic.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-28 00:03:18 +01:00
Xianwei Zhao
7112c05fff pinctrl: pinconf-generic: Add API for pinmux propertity in DTS file
When describing pin mux func through pinmux propertity,
a standard API is added for support. The pinmux contains pin
identification and mux values, which can include multiple
pins. And groups configuration use other word. DTS such as:

func-name {
	group_alias: group-name{
		pinmux= <pin_id << 8 | mux_value)>,
			<pin_id << 8 | mux_value)>;
		bias-pull-up;
		drive-strength-microamp = <4000>;
	};
};

Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
Link: https://lore.kernel.org/20250212-amlogic-pinctrl-v5-2-282bc2516804@amlogic.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-28 00:03:17 +01:00
Linus Walleij
fdcb3ff6d0 Merge branch 'ib-sophgo' into devel
Pull the immutable branch into devel for next.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-27 23:57:00 +01:00
Inochi Amaoto
614a54cb5a pinctrl: sophgo: add support for SG2044 SoC
SG2044 share the share common control logic with SG2042. So
only pin definition is needed.

Add pin definition driver for SG2044 SoC.

Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Link: https://lore.kernel.org/20250211051801.470800-8-inochiama@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-27 23:56:18 +01:00
Inochi Amaoto
1e67465d3b pinctrl: sophgo: add support for SG2042 SoC
Add base driver for SG2042 SoC and pin definition.

Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Link: https://lore.kernel.org/20250211051801.470800-7-inochiama@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-27 23:56:18 +01:00
Inochi Amaoto
2a85188c2f pinctrl: sophgo: introduce generic probe function
Since different series of the Sophgo chip share a common pinctrl data
structure. It is necessary to add a common probe function to alloc
the this data structure. Add pctrl_init callback to allow soc to perform
its own initialization.

Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Link: https://lore.kernel.org/20250211051801.470800-5-inochiama@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-27 23:56:17 +01:00
Inochi Amaoto
96406fa941 pinctrl: sophgo: generalize shareable code of cv18xx pinctrl driver
With generic data structure, it is possible to generalize vddio
operators and DT parsing code of cv18xx pinctrl driver. Introduce
sophgo_cfg_ops callback to allow the driver to adjust the soc
logic and share common code.

Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Link: https://lore.kernel.org/20250211051801.470800-4-inochiama@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-27 23:56:17 +01:00
Inochi Amaoto
e096d3ada7 pinctrl: sophgo: introduce generic data structure for cv18xx pinctrl driver
To share DT parsing and vddio code, it is necessary to introduce
some generic data structure to abstract the different cv18xx series
and the incoming sg2042 series.

Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Link: https://lore.kernel.org/20250211051801.470800-3-inochiama@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-27 23:56:17 +01:00
Inochi Amaoto
ef1a5121ae pinctrl: sophgo: avoid to modify untouched bit when setting cv1800 pinconf
When setting pinconf configuration for cv1800 SoC, the driver just writes
the value. It may zero some bits of the pinconf register and cause some
unexpected error. Add a mask to avoid this.

Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Link: https://lore.kernel.org/20250211051801.470800-2-inochiama@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-27 23:56:17 +01:00
Dang Huynh
3dd3ab6901 pinctrl: qcom: msm8917: Add MSM8937 wsa_reset pin
It looks like both 8917 and 8937 are the same except for one pin
"wsa_reset".

Signed-off-by: Dang Huynh <danct12@riseup.net>
Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
Link: https://lore.kernel.org/20250211-msm8937-v1-4-7d27ed67f708@mainlining.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-26 22:29:59 +01:00
Yixun Lan
7ff4faba63 pinctrl: spacemit: enable config option
Pinctrl is an essential driver for SpacemiT's SoC,
The uart driver requires it, same as sd card driver,
so let's enable it by default for this SoC.

The CONFIG_PINCTRL_SPACEMIT_K1 isn't enabled when using
'make defconfig' to select kernel configuration options.
This result in a broken uart driver where fail at probe()
stage due to no pins found.

Fixes: a83c29e1d1 ("pinctrl: spacemit: add support for SpacemiT K1 SoC")
Reported-by: Alex Elder <elder@kernel.org>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Alex Elder <elder@riscstar.com>
Signed-off-by: Yixun Lan <dlan@gentoo.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://lore.kernel.org/20250218-k1-pinctrl-option-v3-1-36e031e0da1b@gentoo.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-25 17:22:36 +01:00
Charles Han
acf40ab427 pinctrl: nuvoton: npcm8xx: Add NULL check in npcm8xx_gpio_fw
devm_kasprintf() calls can return null pointers on failure.
But the return values were not checked in npcm8xx_gpio_fw().
Add NULL check in npcm8xx_gpio_fw(), to handle kernel NULL
pointer dereference error.

Fixes: acf4884a57 ("pinctrl: nuvoton: add NPCM8XX pinctrl and GPIO driver")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Link: https://lore.kernel.org/20250212100532.4317-1-hanchunchao@inspur.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-25 17:21:50 +01:00
Artur Weber
68283c1cb5 pinctrl: bcm281xx: Fix incorrect regmap max_registers value
The max_registers value does not take into consideration the stride;
currently, it's set to the number of the last pin, but this does not
accurately represent the final register.

Fix this by multiplying the current value by 4.

Fixes: 54b1aa5a5b ("ARM: pinctrl: Add Broadcom Capri pinctrl driver")
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
Link: https://lore.kernel.org/20250207-bcm21664-pinctrl-v1-2-e7cfac9b2d3b@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-25 17:21:50 +01:00
Andy Shevchenko
aa0554d375 ib-devres-iio-input-pinctrl for v6.15
* Split devres APIs to a separate header (linux/device/devres.h)
 * Move IOMEM_ERR_PTR() to err.h to avoid unneeded loops
 * Introduce devm_kmemdup_array()
 * Use devm_kmemdup_array() in input, IIO, and pinctrl subsystems
 
 The following is an automated git shortlog grouped by driver:
 
 baytrail:
  -  copy communities using devm_kmemdup_array()
 
 cherryview:
  -  use devm_kmemdup_array()
 
 devres:
  -  Introduce devm_kmemdup_array()
 
 driver core:
  -  Split devres APIs to device/devres.h
 
 err.h:
  -  move IOMEM_ERR_PTR() to err.h
 
 iio:
  -  adc: xilinx-xadc-core: use devm_kmemdup_array()
  -  imu: st_lsm9ds0: Replace device.h with what is needed
 
 input:
  -  ipaq-micro-keys: use devm_kmemdup_array()
  -  sparse-keymap: use devm_kmemdup_array()
 
 intel:
  -  copy communities using devm_kmemdup_array()
 
 Merge patch series "Split devres APIs to device/devres.h and introduce devm_kmemdup_array()":
  - Merge patch series "Split devres APIs to device/devres.h and introduce devm_kmemdup_array()"
 
 pxa2xx:
  -  use devm_kmemdup_array()
 
 tangier:
  -  use devm_kmemdup_array()
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEqaflIX74DDDzMJJtb7wzTHR8rCgFAme8RZYACgkQb7wzTHR8
 rCjJZQ/+I3T47leAtx3RJV9ZhJ5EoXB3sk9l8ob5tYT0U2FafWHHyTmdI1/6C7od
 cdjxoChoVWRrQwscu8i37Jnh955PiZSDW2NGNeVLi7+bRotSkuQbNR0QZ1bC6qe4
 IHRQzMbIXgfy5mDISHQU9eshL7qw3VgPQ2Ol2v/w/xVR44X7to9PvmSVp6KTMEj4
 E1xzVNHAHlsx3qEGd+ytsutNMCpQZfYwn8QJjr8p2CI32in5asSrtrVUzcWP6db3
 64ohbpP8aetjrhct2XSWeHL9zrAl92LMMbxuZZMAVQs3Agef3967LGYR213eMtEN
 637py119PmEd7l366LFifTICbDVVTIf3bv19wP3CkCMoFta10BGkPuIvBlyJCqHW
 Hryljafx6DKMSldUN1HUQXgvqlgpjliMm/hDyiFstQAUul2Olz8WizZfeZq4ixeb
 mKqGqjMVxIROKmOPouLSF12kgX1TAvgEfH6RMBGsfUuZVux0lRJr0lInesNrxWvl
 /djJJoldRfeS1rL2turis3YlBlvqrDr4dEIpCLUlpmYfR6QnUSHA+AzRKkNECrbx
 1AEstCculkLUXfCnTReHm+SZfk+HhDY/aVIaiEDLBLb52dY7Us2tlhC/CrYSVksD
 hT6EULuo5jDCNw8EJc/eB0J/E2e0WiDaxUEnh/Xnap4qC1vJqkg=
 =j1xo
 -----END PGP SIGNATURE-----

Merge tag 'ib-devres-iio-input-pinctrl-v6.15' into intel/pinctrl

There are a few Intel pin control drivers that are affected
by the devm_kmemdup_array() conversion, merge the ib-devres-iio-input-pinctrl
for making development going smoothly.

* Split devres APIs to a separate header (linux/device/devres.h)
* Move IOMEM_ERR_PTR() to err.h to avoid unneeded loops
* Introduce devm_kmemdup_array()
* Use devm_kmemdup_array() in input, IIO, and pinctrl subsystems

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-25 13:16:46 +02:00
Raag Jadav
86068aca75 pinctrl: pxa2xx: use devm_kmemdup_array()
Convert to use devm_kmemdup_array() which is more robust.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-24 12:08:52 +02:00
Raag Jadav
91bfcc7a2f pinctrl: tangier: use devm_kmemdup_array()
Convert to use devm_kmemdup_array() and while at it, use source size
instead of destination.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-24 12:08:52 +02:00
Raag Jadav
d795fb90d6 pinctrl: cherryview: use devm_kmemdup_array()
Convert to use devm_kmemdup_array() and while at it, use source size
instead of destination.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-24 12:08:52 +02:00
Raag Jadav
f192c8447f pinctrl: baytrail: copy communities using devm_kmemdup_array()
Copy communities using devm_kmemdup_array() instead of doing it manually.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-24 12:08:52 +02:00
Raag Jadav
753764aa8e pinctrl: intel: copy communities using devm_kmemdup_array()
Copy communities using devm_kmemdup_array() instead of doing it manually.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-24 12:08:52 +02:00
Claudiu Beznea
ea40653456 pinctrl: renesas: rzg2l: Suppress binding attributes
Suppress binding attributes for the rzg2l pinctrl driver, as it is an
essential block for Renesas SoCs.  Unbinding the driver leads to
warnings from __device_links_no_driver() and can eventually render the
system inaccessible.

Fixes: c4c4637eb5 ("pinctrl: renesas: Add RZ/G2L pin and gpio controller driver")
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250215131235.228274-1-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2025-02-20 17:33:08 +01:00
Ivaylo Ivanov
574d0f2120 pinctrl: samsung: add exynos2200 SoC pinctrl configuration
Add support for the pin-controller found on the Exynos2200 SoC
used in Samsung Galaxy S22, S22 Plus and S22 Ultra phones.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
Link: https://lore.kernel.org/r/20250215113248.159386-4-ivo.ivanov.ivanov1@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2025-02-19 09:33:02 +01:00
Andy Shevchenko
ba1d9787f8 pinctrl: cy8c95x0: Fix comment style
One comment style is not aligned with the rest. Fix that.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250205095243.512292-11-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:17:26 +01:00
Andy Shevchenko
b5bad465ac pinctrl: cy8c95x0: Separate EEPROM related register definitios
Currently it's not easy to see at a glance the group of the registers
that are per port. Add a blank line and a comment to make it better.

Also add a missing definition for one of the EEPROM related registers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250205095243.512292-10-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:17:26 +01:00
Andy Shevchenko
6a6cab49f0 pinctrl: cy8c95x0: Drop unneeded casting
The 'arg' variable in cy8c95x0_gpio_get_pincfg() is already type of u16.
No need to cast it, so drop unneeded casting.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250205095243.512292-9-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:17:26 +01:00
Andy Shevchenko
145c39050e pinctrl: cy8c95x0: Get rid of cy8c95x0_pinmux_direction() forward declaration
The function is used before being defined. Just move it up enough to
get rid of forward declaration.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250205095243.512292-8-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:17:26 +01:00
Andy Shevchenko
682d385aca pinctrl: cy8c95x0: Initialise boolean variable with boolean values
The 'ret' variable in cy8c95x0_irq_handler() is defined as bool,
but is intialised with integers. Avoid implicit castings and
initialise boolean variable with boolean values.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250205095243.512292-7-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:17:26 +01:00
Andy Shevchenko
c0fc403983 pinctrl: cy8c95x0: Replace 'return ret' by 'return 0' in some cases
When it's known that the returned value can't be non-zero,
use 'return 0' explicitly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250205095243.512292-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:17:25 +01:00
Andy Shevchenko
009ba0eafe pinctrl: cy8c95x0: Remove redundant check in cy8c95x0_regmap_update_bits_base()
The function is never called with the PORTSEL register in the argument.
Drop unneeded check, but rescue a comment. While at it, drop inline
and allow any compiler to choose better stragy (note, that inline in
C code is only a recomendation to most of the modern compilers anyway).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250205095243.512292-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:17:25 +01:00
Andy Shevchenko
4f7a59abf9 pinctrl: cy8c95x0: Transform to cy8c95x0_regmap_read_bits()
The returned value of cy8c95x0_regmap_read() is used always with
a bitmask being applied. Move that bitmasking code into the function.
At the same time transform it to cy8c95x0_regmap_read_bits() which
will be in align with the write and update counterparts.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250205095243.512292-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:17:25 +01:00
Andy Shevchenko
83e29a7a1f pinctrl: cy8c95x0; Switch to use for_each_set_clump8()
for_each_set_clump8() has embedded check for unset clump to skip.
Switch driver to use for_each_set_clump8().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250205095243.512292-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:17:25 +01:00
Andy Shevchenko
e9330dc9b3 pinctrl: cy8c95x0: Use better bitmap APIs where appropriate
There are bitmap_gather() and bitmap_scatter() that are factually
reimplemented in the driver. Use better bitmap APIs where appropriate.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250205095243.512292-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:17:25 +01:00
Dmitry Mastykin
7b0671b97f pinctrl: mcp23s08: Get rid of spurious level interrupts
irq_mask()/irq_unmask() are not called for nested interrupts. So level
interrupts are never masked, chip's interrupt output is not cleared on
INTCAP or GPIO read, the irq handler is uselessly called again. Nested
irq handler is not called again, because interrupt reason is cleared by
its first call.
/proc/interrupts shows that number of chip's irqs is greater than
number of nested irqs.

This patch adds masking and unmasking level interrupts inside irq handler.

Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>
Link: https://lore.kernel.org/20250122120504.1279790-1-mastichi@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:16:02 +01:00
Yue Haibing
d6c6fd77e5 pinctrl: nuvoton: npcm8xx: Fix error handling in npcm8xx_gpio_fw()
fwnode_irq_get() was changed to not return 0, fix this by checking
for negative error, also update the error log.

Fixes: acf4884a57 ("pinctrl: nuvoton: add NPCM8XX pinctrl and GPIO driver")
Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/20250118031334.243324-1-yuehaibing@huawei.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:16:01 +01:00
Yue Haibing
75b456278e pinctrl: pistachio: Remove dead code in pistachio_gpio_register()
fwnode_irq_get() was changed to not return 0, so this check is dead code now.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/20250118031145.243104-1-yuehaibing@huawei.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:16:01 +01:00
Valentin Caron
c98868e816 pinctrl: devicetree: do not goto err when probing hogs in pinctrl_dt_to_map
Cross case in pinctrl framework make impossible to an hogged pin and
another, not hogged, used within the same device-tree node. For example
with this simplified device-tree :

  &pinctrl {
    pinctrl_pin_1: pinctrl-pin-1 {
      pins = "dummy-pinctrl-pin";
    };
  };

  &rtc {
    pinctrl-names = "default"
    pinctrl-0 = <&pinctrl_pin_1 &rtc_pin_1>

    rtc_pin_1: rtc-pin-1 {
      pins = "dummy-rtc-pin";
    };
  };

"pinctrl_pin_1" configuration is never set. This produces this path in
the code:

  really_probe()
    pinctrl_bind_pins()
    | devm_pinctrl_get()
    |   pinctrl_get()
    |     create_pinctrl()
    |       pinctrl_dt_to_map()
    |         // Hog pin create an abort for all pins of the node
    |         ret = dt_to_map_one_config()
    |         | /* Do not defer probing of hogs (circular loop) */
    |         | if (np_pctldev == p->dev->of_node)
    |         |   return -ENODEV;
    |         if (ret)
    |           goto err
    |
    call_driver_probe()
      stm32_rtc_probe()
        pinctrl_enable()
          pinctrl_claim_hogs()
            create_pinctrl()
              for_each_maps(maps_node, i, map)
                // Not hog pin is skipped
                if (pctldev && strcmp(dev_name(pctldev->dev),
                                      map->ctrl_dev_name))
                  continue;

At the first call of create_pinctrl() the hogged pin produces an abort to
avoid a defer of hogged pins. All other pin configurations are trashed.

At the second call, create_pinctrl is now called with pctldev parameter to
get hogs, but in this context only hogs are set. And other pins are
skipped.

To handle this, do not produce an abort in the first call of
create_pinctrl(). Classic pin configuration will be set in
pinctrl_bind_pins() context. And the hogged pin configuration will be set
in pinctrl_claim_hogs() context.

Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Link: https://lore.kernel.org/20250116170009.2075544-1-valentin.caron@foss.st.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-17 00:16:01 +01:00
Chenyuan Yang
f752ee5b5b pinctrl: renesas: rza2: Fix potential NULL pointer dereference
`chip.label` in rza2_gpio_register() could be NULL.
Add the missing check.

Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Link: https://lore.kernel.org/20250210232552.1545887-1-chenyuan0y@gmail.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2025-02-14 09:36:54 +01:00
Claudiu Beznea
b2bd65fbb6 pinctrl: renesas: rzg2l: Add suspend/resume support for pull up/down
The Renesas RZ/G3S supports a power-saving mode where power to most of
the SoC components is lost, including the PIN controller.  Save and
restore the pull-up/pull-down register contents to ensure the
functionality is preserved after a suspend/resume cycle.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250205100116.2032765-1-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2025-02-14 09:36:00 +01:00
Andy Shevchenko
0eee258cdf pinctrl: intel: Fix wrong bypass assignment in intel_pinctrl_probe_pwm()
When instantiating PWM, the bypass should be set to false. The field
is used for the selected Intel SoCs that do not have PWM feature enabled
in their pin control IPs.

Fixes: eb78d3604d ("pinctrl: intel: Enumerate PWM device when community has a capability")
Reported-by: Alexis GUILLEMET <alexis.guillemet@dunasys.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Alexis GUILLEMET <alexis.guillemet@dunasys.com>
2025-02-11 16:27:50 +02:00
Claudiu Beznea
0af4c120f5 pinctrl: pinconf-generic: Print unsigned value if a format is registered
Commit 3ba11e684d ("pinctrl: pinconf-generic: print hex value")
unconditionally switched to printing hex values in
pinconf_generic_dump_one(). However, if a dump format is registered for the
dumped pin, the hex value is printed as well. This hex value does not
necessarily correspond 1:1 with the hardware register value (as noted by
commit 3ba11e684d ("pinctrl: pinconf-generic: print hex value")). As a
result, user-facing output may include information like:
output drive strength (0x100 uA).

To address this, check if a dump format is registered for the dumped
property, and print the unsigned value instead when applicable.

Fixes: 3ba11e684d ("pinctrl: pinconf-generic: print hex value")
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/20250205101058.2034860-1-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-06 10:13:15 +01:00
Andy Shevchenko
1ddee69108 pinctrl: cy8c95x0: Respect IRQ trigger settings from firmware
Some of the platforms may connect the INT pin via inversion logic
effectively make the triggering to be active-low.
Remove explicit trigger flag to respect the settings from firmware.

Without this change even idling chip produces spurious interrupts
and kernel disables the line in the result:

  irq 33: nobody cared (try booting with the "irqpoll" option)
  CPU: 0 UID: 0 PID: 125 Comm: irq/33-i2c-INT3 Not tainted 6.12.0-00236-g8b874ed11dae #64
  Hardware name: Intel Corp. QUARK/Galileo, BIOS 0x01000900 01/01/2014
  ...
  handlers:
  [<86e86bea>] irq_default_primary_handler threaded [<d153e44a>] cy8c95x0_irq_handler [pinctrl_cy8c95x0]
  Disabling IRQ #33

Fixes: e6cbbe4294 ("pinctrl: Add Cypress cy8c95x0 support")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250117142304.596106-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-03 21:51:35 +01:00
Uwe Kleine-König
c42a407bee pinctrl: intel: Import PWM_LPSS namespace for devm_pwm_lpss_probe()
The Intel pinctrl driver can provide a PWM device and for that needs to
call the function devm_pwm_lpss_probe(). That function is provided by
the pwm-lpss driver which intends to export it in the "PWM_LPSS"
namespace. To prepare fixing the pwm-lpss driver to indeed use the
"PWM_LPSS" namespace, import that namespace when used.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-03 17:22:36 +02:00
Andy Shevchenko
0a7404fc53 pinctrl: cy8c95x0: Rename PWMSEL to SELPWM
There are two registers in the hardware, one, "Select PWM",
is per-port configuration enabling PWM function instead of GPIO.
The other one is "PWM Select" is per-PWM selector to configure
PWM itself. Original code uses abbreviation of the latter
to describe the former. Rename it to follow the datasheet.

Fixes: e6cbbe4294 ("pinctrl: Add Cypress cy8c95x0 support")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250203131506.3318201-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-03 14:34:26 +01:00
Andy Shevchenko
aac4470fa6 pinctrl: cy8c95x0: Enable regmap locking for debug
When regmap locking is disabled, debugfs is also disabled.
Enable locking for debug when CONFIG_DEBUG_PINCTRL is set.

Fixes: f71aba339a ("pinctrl: cy8c95x0: Use single I2C lock")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250203131506.3318201-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-03 14:34:13 +01:00
Andy Shevchenko
3fbe3fe287 pinctrl: cy8c95x0: Avoid accessing reserved registers
The checks for vrtual registers in the cy8c95x0_readable_register()
and cy8c95x0_writeable_register() are not aligned and broken.

Fix that by explicitly avoiding reserved registers to be accessed.

Fixes: 71e4001a04 ("pinctrl: pinctrl-cy8c95x0: Fix regcache")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250203131506.3318201-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-03 14:33:51 +01:00
Andy Shevchenko
6f36f103cf pinctrl: cy8c95x0: Fix off-by-one in the regmap range settings
The range_max is inclusive, so we need to use the number of
the last accessible register address.

Fixes: 8670de9fae ("pinctrl: cy8c95x0: Use regmap ranges")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20250203131506.3318201-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-02-03 14:33:43 +01:00
Andy Shevchenko
5feac4d72d pinctrl: lynxpoint: Use dedicated helpers for chained IRQ handlers
Instead of relying on the fact that the parent IRQ chip supports
fasteoi mode and calling the respective callback at the end of
the interrupt handler, surround it with enter and exit helpers
for chained IRQ handlers which will consider all possible cases.

This in particular unifies how GPIO drivers handle IRQ.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-03 11:59:14 +02:00
Andy Shevchenko
8e54033b42 pinctrl: baytrail: Use dedicated helpers for chained IRQ handlers
Instead of relying on the fact that the parent IRQ chip supports
fasteoi mode and calling the respective callback at the end of
the interrupt handler, surround it with enter and exit helpers
for chained IRQ handlers which will consider all possible cases.

This in particular unifies how GPIO drivers handle IRQ.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-03 11:59:14 +02:00
Linus Torvalds
b746043cb3 Pin control changes for the v6.14 kernel cycle:
No core changes this time
 
 New drivers:
 
 - New subdriver for the Qualcomm MSM8917 SoC TLMM
 
 - New subdriver for the Mediatek MT7988 SoC
 
 - New subdriver for the Rockchip RK3562 SoC
 
 - New subdriver for the Renesas RZ/G3E SoC
 
 Improvements:
 
 - Fix some missing pins in the Qualcomm IPQ5424 TLMM
 
 - Fix some missing LVDS pins in the Sunxi A100/A133
 
 - Support Sunxi V853 (simple compatible string)
 
 - Cleanups in the Samsung driver
 
 - Fix some AMD suspend behaviour
 
 - Cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAmeR+5IACgkQQRCzN7AZ
 XXNkTQ/7Blf3alkeaUTjTj3LYFfaky2UjV8i2QLtRiznaLsNitNzRAOq8VYWFKHl
 ysDB8Bheal0vmUEig5I+CboTq2cTt5M5abcQHccOzq29Ln0O9nhlEgds2VjqRgxc
 6rD5TtbeXISkaLBUQdOQ0CkfmoAq0ihH8krFT8gOP01iiiGdLMq3g+v0F6g+wgOX
 0YV6v10wDTsxyh0xlBlshcEt+wTe4EC85WsQf9EerCnSbAqMk32lGLRGeIkazZyX
 l0mTm/JuB7m1UKS2eaZiyOpikK7aq7NirtFTdb5EGa3KYwlwYueiI0AjqCkx//NF
 0txtrk83EU+ApQuP3cXt5mCm19BBpSbIMMuv5qmz1EiX3kBEK++NM7L00ERatHDV
 LXwWObedtkMwzLPmOSPW/RXg7LhnoO34HgbEjznJQ6vV06a9hCMyJZCcIXOrxIP+
 +M5HHbVNrEt5MpcG5Q0FCTALiEKd7cmkQDoZAM9tracl4g5NdZawi4A+PwMdX6UO
 YYnAMYEdJGlCEvcpKNjTebdHz1PDRThk/bLtNNEJ9X8k0inA2H6XIOKW2LFjfR9c
 jNVBxQyOc6o2SKTWdzJm6+F4b/Rzo7awZzXFvURSguCRnbiJ81hIOwooE/o5+IJF
 Fg1N+7cC5AQdtKCy4rh7Hy0H+132XIFPSdeknk5BxUMtXpSGjh8=
 =qLiC
 -----END PGP SIGNATURE-----

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

Pull pin control updates from Linus Walleij:
 "No core changes this time

  New drivers:

   - New subdriver for the Qualcomm MSM8917 SoC TLMM

   - New subdriver for the Mediatek MT7988 SoC

   - New subdriver for the Rockchip RK3562 SoC

   - New subdriver for the Renesas RZ/G3E SoC

  Improvements:

   - Fix some missing pins in the Qualcomm IPQ5424 TLMM

   - Fix some missing LVDS pins in the Sunxi A100/A133

   - Support Sunxi V853 (simple compatible string)

   - Cleanups in the Samsung driver

   - Fix some AMD suspend behaviour

   - Cleanups"

* tag 'pinctrl-v6.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (29 commits)
  dt-bindings: pinctrl: sunxi: add compatible for V853
  pinctrl: Use str_enable_disable-like helpers
  dt-bindings: pinctrl: Correct indentation and style in DTS example
  pinctrl: amd: Take suspend type into consideration which pins are non-wake
  pinctrl: stm32: Add check for clk_enable()
  pinctrl: renesas: rzg2l: Fix PFC_MASK for RZ/V2H and RZ/G3E
  pinctrl: sunxi: add missed lvds pins for a100/a133
  pinctrl: mediatek: Drop mtk_pinconf_bias_set_pd()
  pinctrl: renesas: rzg2l: Add support for RZ/G3E SoC
  pinctrl: renesas: rzg2l: Update r9a09g057_variable_pin_cfg table
  dt-bindings: pinctrl: renesas: Document RZ/G3E SoC
  dt-bindings: pinctrl: renesas: Add alpha-numerical port support for RZ/V2H
  pinctrl: rockchip: add rk3562 support
  dt-bindings: pinctrl: Add rk3562 pinctrl support
  pinctrl: Fix the clean up on pinconf_apply_setting failure
  dt-bindings: pinctrl: add binding for MT7988 SoC
  pinctrl: mediatek: add MT7988 pinctrl driver
  pinctrl: mediatek: add support for MTK_PULL_PD_TYPE
  pinctrl: ocelot: Constify some structures
  pinctrl: renesas: rzg2l: Add audio clock pins on RZ/G3S
  ...
2025-01-24 07:38:50 -08:00
Krzysztof Kozlowski
3f36bffab9 pinctrl: Use str_enable_disable-like helpers
Replace ternary (condition ? "enable" : "disable") syntax with helpers
from string_choices.h because:
1. Simple function call with one argument is easier to read.  Ternary
   operator has three arguments and with wrapping might lead to quite
   long code.
2. Is slightly shorter thus also easier to read.
3. It brings uniformity in the text - same string.
4. Allows deduping by the linker, which results in a smaller binary
   file.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Antonio Borneo <antonio.borneo@foss.st.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/20250114203602.1013275-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-01-15 12:52:26 +01:00
Linus Walleij
33f32a06a5 pinctrl: renesas: Updates for v6.14 (take three)
- Fix PFC_MASK for RZ/V2H and RZ/G3E.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQ9qaHoIs/1I4cXmEiKwlD9ZEnxcAUCZ4dtyQAKCRCKwlD9ZEnx
 cEugAP9lsFXn7sYorudAoK3jDPQC3dHtg5vZQJGCxWNyqz7AYgEAg9VO/VZuhw+y
 JNdKSKGgAk2JPAv3gL2nJqx3w7eQMgA=
 =IPLE
 -----END PGP SIGNATURE-----

Merge tag 'renesas-pinctrl-for-v6.14-tag3' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel

pinctrl: renesas: Updates for v6.14 (take three)

  - Fix PFC_MASK for RZ/V2H and RZ/G3E.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-01-15 12:25:13 +01:00
Maciej S. Szmigiero
f31f33dbb3 pinctrl: amd: Take suspend type into consideration which pins are non-wake
Some laptops have pins which are a wake source for S0i3/S3 but which
aren't a wake source for S4/S5 and which cause issues when left unmasked
during hibernation (S4).

For example HP EliteBook 855 G7 has pin #24 that causes instant wakeup
(hibernation failure) if left unmasked (it is a wake source only for
S0i3/S3).
GPIO pin #24 on this platform is likely dedicated to WWAN XMM7360
modem since this pin triggers wake notify to WWAN modem's parent PCIe
port.

Fix this by considering a pin a wake source only if it is marked as one
for the current suspend type (S0i3/S3 vs S4/S5).

Since Z-wake pins only make sense at runtime these were excluded from
both of suspend categories, so pins with only the Z-wake flag set are
effectively treated as non-wake pins.

Fixes: 2fff0b5e1a ("pinctrl: amd: Mask non-wake source pins with interrupt enabled at suspend")
Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/d4b2d076366fdd08a0c1cd9b7ecd91dc95e07269.1736184752.git.mail@maciej.szmigiero.name
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-01-14 14:33:59 +01:00
Mingwei Zheng
451bc9aea9 pinctrl: stm32: Add check for clk_enable()
Convert the driver to clk_bulk*() API.
Add check for the return value of clk_bulk_enable() to catch
the potential error.

Fixes: 05d8af449d ("pinctrl: stm32: Keep pinctrl block clock enabled when LEVEL IRQ requested")
Signed-off-by: Mingwei Zheng <zmw12306@gmail.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Antonio Borneo <antonio.borneo@foss.st.com>
Link: https://lore.kernel.org/20250106220659.2640365-1-zmw12306@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-01-14 13:37:26 +01:00
Linus Walleij
94467a2274 pinctrl: renesas: Updates for v6.14 (take two)
- Add support for alpha-numerical port references on the RZ/V2H SoC,
   - Add support for the RZ/G3E (R9A09G047) Soc.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQ9qaHoIs/1I4cXmEiKwlD9ZEnxcAUCZ3wDjwAKCRCKwlD9ZEnx
 cCdWAP0T4ESTa0bidvMS9J8qfkacjKu5o2FwsVdy1dtUWrPI/QD/QtHRrPySULEv
 XwnulOMLOy8GkpM8GChe378pHauWDgw=
 =2sZ8
 -----END PGP SIGNATURE-----

Merge tag 'renesas-pinctrl-for-v6.14-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel

pinctrl: renesas: Updates for v6.14 (take two)

  - Add support for alpha-numerical port references on the RZ/V2H SoC,
  - Add support for the RZ/G3E (R9A09G047) Soc.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-01-14 13:30:36 +01:00
Lad Prabhakar
accabfaae0 pinctrl: renesas: rzg2l: Fix PFC_MASK for RZ/V2H and RZ/G3E
The PFC_MASK value for the PFC_mx registers is currently hardcoded to
0x07, which is correct for SoCs in the RZ/G2L family, but insufficient
for RZ/V2H and RZ/G3E, where the mask value should be 0x0f.  This
discrepancy causes incorrect PFC register configuration on RZ/V2H and
RZ/G3E SoCs.

On RZ/G2L, the PFC_mx bitfields are also 4 bits wide, with bit 4 marked
as reserved.  The reserved bits are documented to read as zero and be
ignored when written.  Updating the PFC_MASK definition from 0x07 to
0x0f ensures compatibility with both SoC families while maintaining
correct behavior on RZ/G2L.

Fixes: 9bd95ac86e ("pinctrl: renesas: rzg2l: Add support for RZ/V2H SoC")
Cc: stable@vger.kernel.org
Reported-by: Hien Huynh <hien.huynh.px@renesas.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250110221045.594596-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2025-01-14 09:22:48 +01:00
Parthiban Nallathambi
cef4f1b5ba pinctrl: sunxi: add missed lvds pins for a100/a133
lvds, lcd, dsi all shares the same GPIO D bank and lvds0
data 3 lines and lvds1 pins are missed, add them.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Link: https://lore.kernel.org/20241227-a133-display-support-v1-10-13b52f71fb14@linumiz.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-01-13 15:29:23 +01:00
Linus Walleij
0e18b09967 pinctrl: mediatek: Drop mtk_pinconf_bias_set_pd()
This function is unused and causing compile errors, delete it.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: https://lore.kernel.org/linux-next/20250106164630.4447cd0d@canb.auug.org.au/
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-01-08 22:52:44 +01:00
Biju Das
829356da70 pinctrl: renesas: rzg2l: Add support for RZ/G3E SoC
Add pinctrl driver support for RZ/G3E SoC.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20241216195325.164212-5-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2025-01-03 21:09:19 +01:00
Biju Das
0ce66380a7 pinctrl: renesas: rzg2l: Update r9a09g057_variable_pin_cfg table
Currently r9a09g057_variable_pin_cfg table uses port 11 instead of port PB
as mentioned in the hardware manual. Update the r9a09g057_variable_pin_cfg
table with alpha-numeric port names to match with the hardware manual.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20241216195325.164212-4-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2025-01-03 21:09:04 +01:00
Linus Torvalds
f274fffbc2 Pin control fixes for the v6.13 series:
- A small Kconfig fixup for the i.MX, in principle this
   could come in from the SoC tree but the bug was introduced
   from the pin control tree so let's fix it from here.
 
 - Fix a sleep in atomic context in the MCP23xxx GPIO expander
   by disabling the regmap locking and using explicit
   mutex locks.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAmd3nJcACgkQQRCzN7AZ
 XXOhNg/8C5lXyL8M8LEiCL7qatG9fBlFCIsCs6/bprYUT5tQksMpBlJUtYmyKEf4
 nw1UWOrwPz6RFC5UnK0PnDg3wC2y8sElWab5FUMsqZaBdCeDnCQXsbnJ7iiow/pN
 +BigELRBgHJtfyMBp8WymS1w+2IarlBuh3JPTVFTZO/uZFCiM4C9QLFg3oPaUMhq
 ZaVMYldRIIbM0QVs2JjYas317dmH290qOIQu7tTNVsiVDIias0Z3gv4ejKTe+QAt
 qAgHrK5xMBcTu07Dx/DVg8+X1YN+LCqk1CkZuCk6kYoUv4pAARGAWwO2JtbeHldI
 9iuBBDOmaqVS+GKxrXgga7nu4mcsQqanXGmu12+YibkuMt56iGCp0LVLVWe8/CAN
 aNg5/5fDrfKWssAOrMVupGJkaqR5uVkZ8v9oPDq1fSh2jAATzOa/l8OiaonIfkJ9
 2UG0jr23LtrsAsfcObRR2xbvK6BwtFONFnk51ivzM+tLyXBl1DkXiUBakrrYpYKN
 eTF2+5Att/XKu8yghTqtl6XPLPb9DLjWCzFh7Y7z8hylHoIOUHNUpS4sMZ/gveTq
 yBCLpo7tSYZfIvhrIRkPlNciyCQJDoLOxb2OJT/6WcomW561RSEhOjTFObSsn634
 YjJ3bSobGLMq4bT3p6iCylXc5KTGhvf54hp/bLj4HMekM7daSyY=
 =+Eo1
 -----END PGP SIGNATURE-----

Merge tag 'pinctrl-v6.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control fixes from Linus Walleij:

 - A small Kconfig fixup for the i.MX.

   In principle this could come in from the SoC tree but the bug was
   introduced from the pin control tree so let's fix it from here.

 - Fix a sleep in atomic context in the MCP23xxx GPIO expander by
   disabling the regmap locking and using explicit mutex locks.

* tag 'pinctrl-v6.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
  pinctrl: mcp23s08: Fix sleeping in atomic context due to regmap locking
  ARM: imx: Re-introduce the PINCTRL selection
2025-01-03 10:57:57 -08:00
Linus Walleij
8cd5ba3d3f Samsung pinctrl drivers changes for v6.14
Two fixes for very old issues around error handling and also one
 cleanup.
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmdz8ekQHGtyemtAa2Vy
 bmVsLm9yZwAKCRDBN2bmhouD1892D/9uooivW21SpYIZ8PFTWGCxbSLlKGQIfNOq
 z88sBE1+ZB6YjDQgUaaIhH0cd3viXAD3ha90SpWYgFpQhGtj8Eqid7jtdv6eLUX9
 oRyDYsoQriipSJE0t33Bydve0Sw2l0j9B2ZV0jBCsSlj6qD+G77RAWew2ohogbD5
 WCYTnQAD738HCB9PY1vQIF8c55DPgeBbl9t7pYpfoFeQj99+t+EDN2OOBigFaqBD
 ldNecvb26r9nYFeYmoFJpCtzDEYrC1G8/EnjMK3l123ddsvRdhs0otPPY7NNDbPf
 zYlN1ciFvmZ7zaSRT6nGR5N1/HDXRAxRlu41AodNgkV+Ul6VKKsmlmmwiF4iqLJj
 n3YSyvM/QRi4CVoWUEER+k4O12kyo88gTg0yacr/HhueFMPIwdGrUZf2BO8Sd/Yc
 nQZH9Bi2c3QskCspsmf04JkRZYE9ru6N3zyMIHqKxGDAM6GOen0z2tByJJBo/Cq9
 Ukm5T3a+vAWjxbz8wb7mS4VO6fpdTRW1pVnzjcffq0AObGh2vO1kR1YkajxCY0Iz
 /XXHflgroCh+vxmUPBIG6oOj7DRlUThMYKqI7ZimMUfcp8qerJSQhcAQjlCoGQZY
 JRRbtRHRhXPKkT7lHYR3QcClFeoul+j+CBF2JyhflHfJTNeOkb5afcY8XkU5qM+X
 WnXDQ0AuVw==
 =lt2P
 -----END PGP SIGNATURE-----

Merge tag 'samsung-pinctrl-6.14' of https://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung into devel

Samsung pinctrl drivers changes for v6.14

Two fixes for very old issues around error handling and also one
cleanup.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-01-03 01:48:03 +01:00
Steven Liu
2f0ffa57f6 pinctrl: rockchip: add rk3562 support
Add support for the 5 GPIO banks in the rk3562.

Signed-off-by: Steven Liu <steven.liu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/20241224093620.3815705-1-kever.yang@rock-chips.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-27 17:12:09 +01:00
Mukesh Ojha
001d7ef8e3 pinctrl: Fix the clean up on pinconf_apply_setting failure
When some client does devm_pinctrl_get() followed by
pinctrl_select_state() that does pinmux first successfully and later
during config setting it sets the wrong drive strenght to the pin due to
which pinconf_apply_setting fails. Currently, on failure during config
setting is implemented as if pinmux has failed for one of the pin but
that does not seem right and need to undo the pinmux for all the pin if
config setting fails.

Current commit does a bit refactor to reuse the code and tries to clean
up mux setting on config setting failure.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Link: https://lore.kernel.org/20241224084441.515870-1-mukesh.ojha@oss.qualcomm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-27 17:07:56 +01:00
Daniel Golle
08bec85111 pinctrl: mediatek: add MT7988 pinctrl driver
Add pinctrl driver for the MediaTek MT7988 SoC.

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
[correctly initialise for the function_desc structure]
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/20241217085435.9586-3-linux@fw-web.de
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-27 09:21:58 +01:00
Daniel Golle
1673d720b7 pinctrl: mediatek: add support for MTK_PULL_PD_TYPE
The MediaTek MT7988 SoC got some pins which only got configurable
pull-down but unlike previous designs there is no pull-up option.
Add new type MTK_PULL_PD_TYPE to support configuring such pins.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/20241217085435.9586-2-linux@fw-web.de
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-27 09:21:48 +01:00
Christophe JAILLET
1c6799266a pinctrl: ocelot: Constify some structures
'struct ocelot_match_data and 'struct irq_chip' are not modified in this
driver.

Constifying these structures moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  41459	   9008	     80	  50547	   c573	drivers/pinctrl/pinctrl-ocelot.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  42803	   7640	     80	  50523	   c55b	drivers/pinctrl/pinctrl-ocelot.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/32edcf0567fffd0b1a219e7e2dad7e0bd8c5aaf4.1734023550.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-20 13:48:31 +01:00
Linus Walleij
fa4752d4b5 pinctrl: renesas: Updates for v6.14
- Add audio clock pin support for the RZ/G3S SoC.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQQ9qaHoIs/1I4cXmEiKwlD9ZEnxcAUCZ2VALgAKCRCKwlD9ZEnx
 cDLdAQCR8Hkai+4Z4stmL5aMWEiVp89+PbAo0uP7EbDMKlh3nAEA2RreyHVKI7er
 r2LvKr+/7aT8c0ESDMMl4ctnqyrfFgU=
 =GF+E
 -----END PGP SIGNATURE-----

Merge tag 'renesas-pinctrl-for-v6.14-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel

pinctrl: renesas: Updates for v6.14

  - Add audio clock pin support for the RZ/G3S SoC.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-20 13:34:46 +01:00
Claudiu Beznea
03fc60cd8e pinctrl: renesas: rzg2l: Add audio clock pins on RZ/G3S
Add audio clock pins on the RZ/G3S SoC.  These are used by audio IPs as
input pins to feed them with audio clocks.

Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20241113133540.2005850-6-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-12-20 10:58:46 +01:00
Evgenii Shatokhin
a37eecb705 pinctrl: mcp23s08: Fix sleeping in atomic context due to regmap locking
If a device uses MCP23xxx IO expander to receive IRQs, the following
bug can happen:

  BUG: sleeping function called from invalid context
    at kernel/locking/mutex.c:283
  in_atomic(): 1, irqs_disabled(): 1, non_block: 0, ...
  preempt_count: 1, expected: 0
  ...
  Call Trace:
  ...
  __might_resched+0x104/0x10e
  __might_sleep+0x3e/0x62
  mutex_lock+0x20/0x4c
  regmap_lock_mutex+0x10/0x18
  regmap_update_bits_base+0x2c/0x66
  mcp23s08_irq_set_type+0x1ae/0x1d6
  __irq_set_trigger+0x56/0x172
  __setup_irq+0x1e6/0x646
  request_threaded_irq+0xb6/0x160
  ...

We observed the problem while experimenting with a touchscreen driver which
used MCP23017 IO expander (I2C).

The regmap in the pinctrl-mcp23s08 driver uses a mutex for protection from
concurrent accesses, which is the default for regmaps without .fast_io,
.disable_locking, etc.

mcp23s08_irq_set_type() calls regmap_update_bits_base(), and the latter
locks the mutex.

However, __setup_irq() locks desc->lock spinlock before calling these
functions. As a result, the system tries to lock the mutex whole holding
the spinlock.

It seems, the internal regmap locks are not needed in this driver at all.
mcp->lock seems to protect the regmap from concurrent accesses already,
except, probably, in mcp_pinconf_get/set.

mcp23s08_irq_set_type() and mcp23s08_irq_mask/unmask() are called under
chip_bus_lock(), which calls mcp23s08_irq_bus_lock(). The latter takes
mcp->lock and enables regmap caching, so that the potentially slow I2C
accesses are deferred until chip_bus_unlock().

The accesses to the regmap from mcp23s08_probe_one() do not need additional
locking.

In all remaining places where the regmap is accessed, except
mcp_pinconf_get/set(), the driver already takes mcp->lock.

This patch adds locking in mcp_pinconf_get/set() and disables internal
locking in the regmap config. Among other things, it fixes the sleeping
in atomic context described above.

Fixes: 8f38910ba4 ("pinctrl: mcp23s08: switch to regmap caching")
Cc: stable@vger.kernel.org
Signed-off-by: Evgenii Shatokhin <e.shatokhin@yadro.com>
Link: https://lore.kernel.org/20241209074659.1442898-1-e.shatokhin@yadro.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-17 15:10:32 +01:00
Mingwei Zheng
5c4bfbb21d pinctrl: nomadik: Add check for clk_enable()
Add check for the return value of clk_enable() to catch the potential
error.
Disable success clks in the error handling.
Change return type of nmk_gpio_glitch_slpm_init casade.

Fixes: 3a19805920 ("pinctrl: nomadik: move all Nomadik drivers to subdir")
Signed-off-by: Mingwei Zheng <zmw12306@gmail.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Link: https://lore.kernel.org/20241206221618.3453159-1-zmw12306@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-17 15:06:05 +01:00
Geert Uytterhoeven
efe479ccc4 pinctrl: ingenic: Replace seq_printf() by seq_puts()
Simplify "seq_printf(p, "%s", ...)" to "seq_puts(p, ...)".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/9a5b38027ed674ca773fe28a3b3246631eae8834.1733404358.git.geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-17 15:05:43 +01:00
Manikanta Mylavarapu
9550fd31fd pinctrl: qcom: ipq5424: split spi0 pin group
The GPIO configuration differs for the spi0 clk, cs, miso, mosi pins.
Therefore, split the spi0 pin group and assign function to each pin
as per the specification.

Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
Link: https://lore.kernel.org/20241217091308.3253897-3-quic_mmanikan@quicinc.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-17 11:52:38 +01:00
Otto Pflüger
ff5eb00255 pinctrl: qcom: Add MSM8917 tlmm pinctrl driver
It is based on MSM8916 driver with the pinctrl definitions from
Qualcomm's downstream MSM8917 driver.

Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
Link: https://lore.kernel.org/20241215-msm8917-v9-3-bacaa26f3eef@mainlining.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-12-16 15:15:35 +01:00
Peter Zijlstra
cdd30ebb1b module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498f ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.

Scripted using

  git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
  do
    awk -i inplace '
      /^#define EXPORT_SYMBOL_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /^#define MODULE_IMPORT_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /MODULE_IMPORT_NS/ {
        $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
      }
      /EXPORT_SYMBOL_NS/ {
        if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
  	if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
  	    $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
  	    $0 !~ /^my/) {
  	  getline line;
  	  gsub(/[[:space:]]*\\$/, "");
  	  gsub(/[[:space:]]/, "", line);
  	  $0 = $0 " " line;
  	}

  	$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
  		    "\\1(\\2, \"\\3\")", "g");
        }
      }
      { print }' $file;
  done

Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 11:34:44 -08:00
Javier Carrasco
0ebb1e9e1b pinctrl: samsung: update child reference drop comment
Commit 954445c72f ("pinctrl: samsung: Drop redundant node parameter in
samsung_banks_of_node_get()") modified the name of the function used to
release child nodes from samsung_drop_banks_of_node() to
samsung_banks_node_put(). Update the comment to use the current function
name.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241106-samsung-pinctrl-put-v1-2-de854e26dd03@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-12-02 15:11:54 +01:00
Javier Carrasco
459915f555 pinctrl: samsung: fix fwnode refcount cleanup if platform_get_irq_optional() fails
Commit 50ebd19e35 ("pinctrl: samsung: drop pin banks references on
error paths") fixed the pin bank references on the error paths of the
probe function, but there is still an error path where this is not done.

If samsung_pinctrl_get_soc_data() does not fail, the child references
will have acquired, and they will need to be released in the error path
of platform_get_irq_optional(), as it is done in the following error
paths within the probe function.

Replace the direct return in the error path with a goto instruction to
the cleanup function.

Cc: stable@vger.kernel.org
Fixes: a382d568f1 ("pinctrl: samsung: Use platform_get_irq_optional() to get the interrupt")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241106-samsung-pinctrl-put-v1-1-de854e26dd03@gmail.com
[krzysztof: change Fixes SHA to point to commit introducing the return
 leading to OF node leak]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-12-02 15:10:47 +01:00
Christophe JAILLET
f686a2b52e pinctrl: samsung: Fix irq handling if an error occurs in exynos_irq_demux_eint16_31()
chained_irq_enter(() should be paired with a corresponding
chained_irq_exit().

Here, if clk_enable() fails, a early return occurs and chained_irq_exit()
is not called.

Add a new label and a goto for fix it.

Fixes: f9c7447479 ("pinctrl: samsung: support a bus clock")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: André Draszik <andre.draszik@linaro.org>
Link: https://lore.kernel.org/r/f148d823acfb3326a115bd49a0eed60f2345f909.1731844995.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-12-02 15:01:34 +01:00
Linus Torvalds
55cb93fd24 Driver core changes for 6.13-rc1
Here is a small set of driver core changes for 6.13-rc1.
 
 Nothing major for this merge cycle, except for the 2 simple merge
 conflicts are here just to make life interesting.
 
 Included in here are:
   - sysfs core changes and preparations for more sysfs api cleanups that
     can come through all driver trees after -rc1 is out
   - fw_devlink fixes based on many reports and debugging sessions
   - list_for_each_reverse() removal, no one was using it!
   - last-minute seq_printf() format string bug found and fixed in many
     drivers all at once.
   - minor bugfixes and changes full details in the shortlog
 
 As mentioned above, there is 2 merge conflicts with your tree, one is
 where the file is removed (easy enough to resolve), the second is a
 build time error, that has been found in linux-next and the fix can be
 seen here:
 	https://lore.kernel.org/r/20241107212645.41252436@canb.auug.org.au
 
 Other than that, the changes here have been in linux-next with no other
 reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZ0lEog8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ym+0ACgw6wN+LkLVIHWhxTq5DYHQ0QCxY8AoJrRIcKe
 78h0+OU3OXhOy8JGz62W
 =oI5S
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here is a small set of driver core changes for 6.13-rc1.

  Nothing major for this merge cycle, except for the two simple merge
  conflicts are here just to make life interesting.

  Included in here are:

   - sysfs core changes and preparations for more sysfs api cleanups
     that can come through all driver trees after -rc1 is out

   - fw_devlink fixes based on many reports and debugging sessions

   - list_for_each_reverse() removal, no one was using it!

   - last-minute seq_printf() format string bug found and fixed in many
     drivers all at once.

   - minor bugfixes and changes full details in the shortlog"

* tag 'driver-core-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (35 commits)
  Fix a potential abuse of seq_printf() format string in drivers
  cpu: Remove spurious NULL in attribute_group definition
  s390/con3215: Remove spurious NULL in attribute_group definition
  perf: arm-ni: Remove spurious NULL in attribute_group definition
  driver core: Constify bin_attribute definitions
  sysfs: attribute_group: allow registration of const bin_attribute
  firmware_loader: Fix possible resource leak in fw_log_firmware_info()
  drivers: core: fw_devlink: Fix excess parameter description in docstring
  driver core: class: Correct WARN() message in APIs class_(for_each|find)_device()
  cacheinfo: Use of_property_present() for non-boolean properties
  cdx: Fix cdx_mmap_resource() after constifying attr in ->mmap()
  drivers: core: fw_devlink: Make the error message a bit more useful
  phy: tegra: xusb: Set fwnode for xusb port devices
  drm: display: Set fwnode for aux bus devices
  driver core: fw_devlink: Stop trying to optimize cycle detection logic
  driver core: Constify attribute arguments of binary attributes
  sysfs: bin_attribute: add const read/write callback variants
  sysfs: implement all BIN_ATTR_* macros in terms of __BIN_ATTR()
  sysfs: treewide: constify attribute callback of bin_attribute::llseek()
  sysfs: treewide: constify attribute callback of bin_attribute::mmap()
  ...
2024-11-29 11:43:29 -08:00
Linus Torvalds
2d32fba02e This is the bulk of the pin control changes for v6.13:
No core changes this time.
 
 New drivers:
 
 - Xlinix Versal pin control driver.
 
 - Ocelot LAN969x pin control driver.
 
 - T-Head TH1520 RISC-V SoC pin control driver.
 
 - Qualcomm SM8750, IPQ5424, QCS8300, SAR2130P and QCS615 SoC
   pin control drivers.
 
 - Qualcomm SM8750 LPASS (low power audio subsystem)
   pin control driver.
 
 - Qualcomm PM8937 mixsig IC pin control support, GPIO and
   MPP (multi-purpose-pin).
 
 - Samsung Exynos8895 and Exynos9810 SoC pin control driver.
 
 - SpacemiT K1 SoC pin control driver.
 
 - Airhoa EN7581 IC pin control driver.
 
 Improvements:
 
 - The Renesas subdriver now supports schmitt-trigger and
   open drain pin configurations if the hardware supports it.
 
 - Support GPIOF and GPIOG banks in the Aspeed G6 SoC.
 
 - Support the DSW community in the Intel Elkhartlake SoC.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAmdAhqsACgkQQRCzN7AZ
 XXOX/BAAkTh2Xwh4t9u9p0wjvXcY9bu+O204vUaQNJr3zphqLegJihChriU8LiQN
 7BTQcYMHMsoVXRzFsoRBSocfJmcFE6amoHemSkCaYDCrr0fchk61AzkivUMvMHBi
 8qBFB1kYbk/Cmk2JwOEpf16gT45wTdIIOfqB6X9ikRdIUwCgjMH77OYHilXF0zPO
 vmikY8fnIj/0r9hdVqD5bcpeHo8XHZpHBMvr1NfMUehfhGoJNLZF+xyg+fosnoDH
 om92ugKC856jVP0Hl9kfL58ggKuBI2YPlm2OW9VxAQZu7EMvlCeUjv8R+sNpXrpI
 rod84A62/K8OYcQLW+UIA2ykty3LFfh90wKtpkKV0z/7jtEfBBzCMsln/mCUVHEl
 3zoo0n6n68r0i1zKAFf45JGJExeJv5U0lBfFGm8PnOOouZW3IYJcgHQfBswaPzRD
 lEsT37jUEF+qE0VWqBx3xTz/w2Kxs5XHoF4P5UwE5TCAA90hjMLPdXXzn6bNiuww
 4T8iOT5NFwHqlIKJxRBYJDDuc+EtQksmKhbDXilKgg0h+n/YmQN12CFKy5d+Ch57
 mT/M6bP4FCsTOioUEALUVLMzUN7FJjPHN7GO1nwpA6Rmb8yMaYZJHxglfjduo83y
 PNOsaLRY3BhukBh74B6OTq7SKgvH1Bj1VwEY87JhYZLmDE49xjw=
 =F7bj
 -----END PGP SIGNATURE-----

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

Pull pin control updates from Linus Walleij:
 "No core changes this time.

  New drivers:

   - Xlinix Versal pin control driver

   - Ocelot LAN969x pin control driver

   - T-Head TH1520 RISC-V SoC pin control driver

   - Qualcomm SM8750, IPQ5424, QCS8300, SAR2130P and QCS615 SoC pin
     control drivers

   - Qualcomm SM8750 LPASS (low power audio subsystem) pin control
     driver

   - Qualcomm PM8937 mixsig IC pin control support, GPIO and MPP
     (multi-purpose-pin)

   - Samsung Exynos8895 and Exynos9810 SoC pin control driver

   - SpacemiT K1 SoC pin control driver

   - Airhoa EN7581 IC pin control driver

  Improvements:

   - The Renesas subdriver now supports schmitt-trigger and open drain
     pin configurations if the hardware supports it

   - Support GPIOF and GPIOG banks in the Aspeed G6 SoC

   - Support the DSW community in the Intel Elkhartlake SoC"

* tag 'pinctrl-v6.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (105 commits)
  pinctrl: airoha: Use unsigned long for bit search
  pinctrl: k210: Undef K210_PC_DEFAULT
  pinctrl: qcom: spmi: fix debugfs drive strength
  pinctrl: qcom: Add sm8750 pinctrl driver
  dt-bindings: pinctrl: qcom: Add sm8750 pinctrl
  pinctrl: cy8c95x0: remove unneeded goto labels
  pinctrl: cy8c95x0: embed iterator to the for-loop
  pinctrl: cy8c95x0: Use temporary variable for struct device
  pinctrl: cy8c95x0: use flexible sleeping in reset function
  pinctrl: cy8c95x0: switch to using devm_regulator_get_enable()
  pinctrl: cy8c95x0: Use 2-argument strscpy()
  dt-bindings: pinctrl: sx150xq: allow gpio line naming
  pinctrl: single: add marvell,pxa1908-padconf compatible
  dt-bindings: pinctrl: pinctrl-single: add marvell,pxa1908-padconf compatible
  dt-bindings: pinctrl: correct typo of description for cv1800
  pinctrl: qcom: spmi-mpp: Add PM8937 compatible
  dt-bindings: pinctrl: qcom,pmic-mpp: Document PM8937 compatible
  pinctrl: qcom-pmic-gpio: add support for PM8937
  dt-bindings: pinctrl: qcom,pmic-gpio: add PM8937
  pinctrl: Use of_property_present() for non-boolean properties
  ...
2024-11-25 17:24:51 -08:00
David Wang
acfeb6defc Fix a potential abuse of seq_printf() format string in drivers
Using device name as format string of seq_printf() is proned to
"Format string attack", opens possibility for exploitation.
Seq_puts() is safer and more efficient.

Signed-off-by: David Wang <00107082@163.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20241120053055.225195-1-00107082@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-22 15:31:35 +01:00
Kees Cook
ac6f0825e5 pinctrl: airoha: Use unsigned long for bit search
Instead of risking alignment problems and causing (false positive) array
bound warnings when casting a u32 to (64-bit) unsigned long, just use a
native unsigned long for doing bit searches. Avoids warning with GCC 15's
-Warray-bounds -fdiagnostics-details:

In file included from ../include/linux/bitmap.h:11,
                 from ../include/linux/cpumask.h:12,
                 from ../arch/x86/include/asm/paravirt.h:21,
                 from ../arch/x86/include/asm/irqflags.h:80,
                 from ../include/linux/irqflags.h:18,
                 from ../include/linux/spinlock.h:59,
                 from ../include/linux/irq.h:14,
                 from ../include/linux/irqchip/chained_irq.h:10,
                 from ../include/linux/gpio/driver.h:8,
                 from ../drivers/pinctrl/mediatek/pinctrl-airoha.c:11:
In function 'find_next_bit',
    inlined from 'airoha_irq_handler' at ../drivers/pinctrl/mediatek/pinctrl-airoha.c:2394:3:
../include/linux/find.h:65:23: error: array subscript 'long unsigned int[0]' is partly outside array bounds of 'u32[1]' {aka 'unsigned int[1]'} [-Werror=array-bounds=]
   65 |                 val = *addr & GENMASK(size - 1, offset);
      |                       ^~~~~
../drivers/pinctrl/mediatek/pinctrl-airoha.c: In function 'airoha_irq_handler':
../drivers/pinctrl/mediatek/pinctrl-airoha.c:2387:21: note: object 'status' of size 4
 2387 |                 u32 status;
      |                     ^~~~~~

Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/20241117114534.work.292-kees@kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-18 23:57:38 +01:00
zhang jiao
7e86490c5d pinctrl: k210: Undef K210_PC_DEFAULT
When the temporary macro K210_PC_DEFAULT is not needed anymore,
use its name in the #undef statement instead of
the incorrect "DEFAULT" name.

Fixes: d4c34d09ab ("pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver")
Signed-off-by: zhang jiao <zhangjiao2@cmss.chinamobile.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/20241113071201.5440-1-zhangjiao2@cmss.chinamobile.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-18 23:51:05 +01:00
Johan Hovold
6bc0ebfb1d pinctrl: qcom: spmi: fix debugfs drive strength
Commit 723e8462a4 ("pinctrl: qcom: spmi-gpio: Fix the GPIO strength
mapping") fixed a long-standing issue in the Qualcomm SPMI PMIC gpio
driver which had the 'low' and 'high' drive strength settings switched
but failed to update the debugfs interface which still gets this wrong.

Fix the debugfs code so that the exported values match the hardware
settings.

Note that this probably means that most devicetrees that try to describe
the firmware settings got this wrong if the settings were derived from
debugfs. Before the above mentioned commit the settings would have
actually matched the firmware settings even if they were described
incorrectly, but now they are inverted.

Fixes: 723e8462a4 ("pinctrl: qcom: spmi-gpio: Fix the GPIO strength mapping")
Fixes: eadff30244 ("pinctrl: Qualcomm SPMI PMIC GPIO pin controller driver")
Cc: Anjelique Melendez <quic_amelende@quicinc.com>
Cc: stable@vger.kernel.org	# 3.19
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/20241025121622.1496-1-johan+linaro@kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-18 00:40:49 +01:00
Melody Olvera
afe9803e3b pinctrl: qcom: Add sm8750 pinctrl driver
Add TLMM pinctrl driver to support pin configuration with pinctrl
framework for sm8750 SoC.

Signed-off-by: Melody Olvera <quic_molvera@quicinc.com>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/20241112002843.2804490-3-quic_molvera@quicinc.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-13 14:45:58 +01:00
Andy Shevchenko
581d24052a pinctrl: cy8c95x0: remove unneeded goto labels
In some cases the code uses goto labels to just return an error code.
Replace those with direct return:s and drop unneeded goto labels.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/20241110210040.18918-7-andy.shevchenko@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-13 14:18:06 +01:00
Andy Shevchenko
ab899a0ec3 pinctrl: cy8c95x0: embed iterator to the for-loop
When we iterate through nports the iterator variable is effectively
being not used outside of the loop. Make it clear by moving its definition
into the for-loop. This makes code cleaner as well.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/20241110210040.18918-6-andy.shevchenko@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-13 14:18:06 +01:00
Andy Shevchenko
e1b47291bd pinctrl: cy8c95x0: Use temporary variable for struct device
Use a temporary variable for the struct device pointers to avoid
dereferencing. This makes code a bit neater.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/20241110210040.18918-5-andy.shevchenko@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-13 14:18:06 +01:00
Andy Shevchenko
f8bd5383d8 pinctrl: cy8c95x0: use flexible sleeping in reset function
The device reset assert and deassert length was created by usleep_range()
but that does not ensure optimal handling of all the different values from
device tree properties. By switching to the new flexible sleeping helper
function, fsleep(), the correct delay function is called depending on
delay length, e.g. udelay(), usleep_range() or msleep().

While at it, move out GPIO consumer name setting of the reset conditional,
the all necessary checks are already done there, so logically that call is
not related to the reset sequence.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/20241110210040.18918-4-andy.shevchenko@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-13 14:18:06 +01:00
Andy Shevchenko
c13411c6fa pinctrl: cy8c95x0: switch to using devm_regulator_get_enable()
The driver does not actively manage regulator state past probe() time,
so we can use devm_regulator_get_enable() to simplify the code.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/20241110210040.18918-3-andy.shevchenko@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-13 14:18:06 +01:00
Andy Shevchenko
b7e9fc3361 pinctrl: cy8c95x0: Use 2-argument strscpy()
Use 2-argument strscpy(), which is not only shorter but also provides
an additional check that destination buffer is an array.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/20241110210040.18918-2-andy.shevchenko@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-13 14:18:06 +01:00
Duje Mihanović
ffb7474969 pinctrl: single: add marvell,pxa1908-padconf compatible
Add the "marvell,pxa1908-padconf" compatible to allow migrating to a
separate pinctrl driver later.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Link: https://lore.kernel.org/20241104-pxa1908-lkml-v13-3-e050609b8d6c@skole.hr
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-08 09:32:21 +01:00
Barnabás Czémán
f755261190 pinctrl: qcom: spmi-mpp: Add PM8937 compatible
The PM8937 provides 4 MPPs.
Add a compatible to support them.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
Link: https://lore.kernel.org/20241031-msm8917-v2-4-8a075faa89b1@mainlining.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-08 09:08:33 +01:00
Barnabás Czémán
89265a58ff pinctrl: qcom-pmic-gpio: add support for PM8937
PM8937 has 8 GPIO-s with holes on GPIO3, GPIO4 and GPIO6.

Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/20241031-msm8917-v2-2-8a075faa89b1@mainlining.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-08 09:07:17 +01:00
Rob Herring (Arm)
86db3f0dfa pinctrl: Use of_property_present() for non-boolean properties
The use of of_property_read_bool() for non-boolean properties is
deprecated in favor of of_property_present() when testing for property
presence.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/20241104194437.327430-1-robh@kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-08 09:02:15 +01:00
Linus Walleij
546ee7b890 intel-pinctrl for v6.13-2
This includes following Intel pinctrl changes for v6.13 merge window:
 
   - Expose DSW community on Elkhart Lake.
   - Elaborate in the code comment the pull bias settings.
 
 Both have been in linux-next with no reported issues.
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAmcskXwgHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKBZWg/8CN4qU9KeZrMK
 gao6NLTSFmwUsesGK7S/Lk3LpKYOquGarEIxMSeHTBMFOIgu+RQ+meqjpTm7X0Oa
 fXUDzOPdhwqw36EbqR8DVSXoAeNSfwK2sfmQeOKbQFfBtgFLbSNyfdYFr1kJnYlw
 7zKSsLXNxgi1KFu81K0zyPzPkX6EEy1jmSLQ0k3uXFfqDvagy3d1h2nvSvV9ze6f
 WtPz1H8wye2a5WCOC2HnFujmXWFBByp+QEfyNMB4vwwPEoN2ZgbogCq11lyDJufc
 DtlHUM0jf1nslL3F9RE/nfP/k2AHYZ6Y4gDXBFaUHF1LyaEzzmHh+afMErvfjMvs
 j7v3s+6RG2bAzrDB0bZC1EZ9UUuSW2pIS/Fyo0Sd+IKGI2m90As1IccveI5m3hqJ
 b1AF5mGqF9ljxPdJtCEfxpZGR+57r0uAU/mQxE2/mQjKSM5KmJ9BeWBR0WwbSqnE
 o5zBoba+/v1YipkDFk2UXSHDXdzBu8Qtlt0pOHaNigtewOZsc0tWrz3jptiiFtPv
 YTuZ8mv67PgZOm1hZY58coEMvs4bRsO98+NmGkAXu6Wi2CWVcaqo67GJEsqLsTrw
 pfAtdjO31iWxmg7vfm3E4/6tEZw3/KdlYWJ2lKT7fXL3O2mGxGeTpIk95QsTsq1S
 aZHWETf5GXiE+lq4jGh0ag8X3ZfgKzg=
 =TQtH
 -----END PGP SIGNATURE-----

Merge tag 'intel-pinctrl-v6.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel into devel

intel-pinctrl for v6.13-2

This includes following Intel pinctrl changes for v6.13 merge window:

  - Expose DSW community on Elkhart Lake.
  - Elaborate in the code comment the pull bias settings.

Both have been in linux-next with no reported issues.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-07 14:56:52 +01:00
Linus Walleij
f52f40b22e pinctrl: renesas: Updates for v6.13 (take two)
- Use the gpiochip_populate_parent_fwspec_twocell() helper.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQQ9qaHoIs/1I4cXmEiKwlD9ZEnxcAUCZyjIdwAKCRCKwlD9ZEnx
 cI6RAQDqTVxEJlMub7D2flautgRyXQT80+TGfj36omXcpz4fHwD/eDLdyNgFazng
 evi/UmKjSAJVY28wxKuvWKuXiH262g4=
 =bcW/
 -----END PGP SIGNATURE-----

Merge tag 'renesas-pinctrl-for-v6.13-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel

pinctrl: renesas: Updates for v6.13 (take two)

  - Use the gpiochip_populate_parent_fwspec_twocell() helper.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-11-05 10:50:49 +01:00
Andy Shevchenko
c6235c426d pinctrl: elkhartlake: Add support for DSW community
Hardware has a DSW (Deep Sleep Well) community that might be exposed
by some BIOSes. Add support for it in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-11-05 07:48:58 +02:00
Andy Shevchenko
4cbf2b660f pinctrl: intel: Add a human readable decoder for pull bias values
Add a human readable decoder for pull bias values in the comment.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-11-05 07:48:45 +02:00
Lorenzo Bianconi
1c8ace2d07 pinctrl: airoha: Add support for EN7581 SoC
Introduce pinctrl driver for EN7581 SoC. Current EN7581 pinctrl driver
supports the following functionalities:
- pin multiplexing
- pin pull-up, pull-down, open-drain, current strength,
  {input,output}_enable, output_{low,high}
- gpio controller
- irq controller

Tested-by: Benjamin Larsson <benjamin.larsson@genexis.eu>
Co-developed-by: Benjamin Larsson <benjamin.larsson@genexis.eu>
Signed-off-by: Benjamin Larsson <benjamin.larsson@genexis.eu>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/20241023-en7581-pinctrl-v9-5-afb0cbcab0ec@kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-30 10:56:51 +01:00
Linus Walleij
ef15f683aa Samsung pinctrl drivers changes for v6.13
1. Add new pin controller drivers for new Samsung SoCs: Exynos8895,
    Exynos9810, Exynos990.
 
 2. Correct the condition when applying further interrupt constraints on
    certain Samsung pin controllers.  The condition was simply not
    effective.
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmcgkycQHGtyemtAa2Vy
 bmVsLm9yZwAKCRDBN2bmhouD1xyHD/0fjh8RZ8H6j9/msO2ro0GVMSw+mLB4XiyW
 ExGoeXJeAgr4jkWGtXYBGOiH/GQei/eDFB37HY/t1S/7eFMPnoze4vumzTfcX6Ls
 K6/OGtCpRq8zDU7O7E64sa1Ve9JHNPEtsOqTeXi4CyUMcsRX40l3mvUnu6YyjFBU
 AF/x/GglPpeTDHlwk+H2qI88UTp+TL6m/ear1BxO9MhiaCrdt2tzrT8NMyk+M5QV
 GK6GNuiTs0+3vizxBMxZA103nyPuIHw/xqg+ElWD+7KYD+ibsL5fKzb70n6hhNwl
 25aF9FzHZgB1vt/OQgNnx/lHyCjDKrCBU9dzomgxpXwQpWHwL6ukFTh0DvEZ9W5N
 TTREXk2xr74d1LMa7qdx3xczpI5IhvXz+BQo97HKmd7Yf/i4DjF4jg5ol25ApjwC
 i1WFcszyVK4jmmkyNVVxNJvAjHrZMHEgJyIYUuPsLRKGpOrmHgQAf+qFF6Z8H4dY
 p3lwKOv3Hw9FbY9iUQd60Eg/szO4HgasrruSgZLpiNnv84kcKstRe0AmpT+lPH84
 kQEvdWDyw0gbjO4eKZ2X/AbewdAjJu7n5I7K38lX9p93qpxDZrfVa6oY252W3emF
 MlnHEh5KQVRzDz7QffooHhwdBsWsr68LPT2KZgCsKwuv1+vEQdofiL0K8nFctboR
 Lr7Ph/bAtg==
 =Y1vm
 -----END PGP SIGNATURE-----

Merge tag 'samsung-pinctrl-6.13' of https://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung into devel

Samsung pinctrl drivers changes for v6.13

1. Add new pin controller drivers for new Samsung SoCs: Exynos8895,
   Exynos9810, Exynos990.

2. Correct the condition when applying further interrupt constraints on
   certain Samsung pin controllers.  The condition was simply not
   effective.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-29 11:04:08 +01:00
Billy Tsai
c34b20622e pinctrl: aspeed-g6: Support drive-strength for GPIOF/G
Add drive strength configuration support for GPIO F and G groups.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Link: https://lore.kernel.org/20241023104406.4083460-1-billy_tsai@aspeedtech.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-28 13:58:43 +01:00
Dan Carpenter
5a18e2be45 pinctrl: spacemit: fix double free of map
The map pointer is freed by pinctrl_utils_free_map().  It must not be a
devm_ pointer or it leads to a double free when the device is unloaded.

This is similar to a couple bugs Harshit Mogalapalli fixed earlier in
commits 3fd976afe9 ("pinctrl: nuvoton: fix a double free in
ma35_pinctrl_dt_node_to_map_func()") and 4575962aee ("pinctrl: sophgo:
fix double free in cv1800_pctrl_dt_node_to_map()").

Fixes: a83c29e1d1 ("pinctrl: spacemit: add support for SpacemiT K1 SoC")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Yixun Lan <dlan@gentoo.org>
Link: https://lore.kernel.org/4b5f1306-dc01-4edc-96d3-b232b930ddf2@stanley.mountain
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-28 13:54:04 +01:00
Markuss Broks
6d2dbd4cec pinctrl: samsung: Add Exynos9810 SoC specific data
Add Samsung Exynos9810 SoC specific data to enable pinctrl
support for platforms based on Exynos9810.

Co-developed-by: Maksym Holovach <nergzd@nergzd723.xyz>
Signed-off-by: Maksym Holovach <nergzd@nergzd723.xyz>
Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
Link: https://lore.kernel.org/r/20241026-exynos9810-v3-8-b89de9441ea8@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-10-27 21:02:08 +01:00
Lad Prabhakar
f407af78c8 pinctrl: renesas: rzg2l: Use gpiochip_populate_parent_fwspec_twocell helper
Because rzg2l_gpio_populate_parent_fwspec() and
gpiochip_populate_parent_fwspec_twocell() are identical.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20241017113942.139712-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-10-25 10:43:18 +02:00
Mukesh Ojha
5a3e85c3c3 pinmux: Use sequential access to access desc->pinmux data
When two client of the same gpio call pinctrl_select_state() for the
same functionality, we are seeing NULL pointer issue while accessing
desc->mux_owner.

Let's say two processes A, B executing in pin_request() for the same pin
and process A updates the desc->mux_usecount but not yet updated the
desc->mux_owner while process B see the desc->mux_usecount which got
updated by A path and further executes strcmp and while accessing
desc->mux_owner it crashes with NULL pointer.

Serialize the access to mux related setting with a mutex lock.

	cpu0 (process A)			cpu1(process B)

pinctrl_select_state() {		  pinctrl_select_state() {
  pin_request() {				pin_request() {
  ...
						 ....
    } else {
         desc->mux_usecount++;
    						desc->mux_usecount && strcmp(desc->mux_owner, owner)) {

         if (desc->mux_usecount > 1)
               return 0;
         desc->mux_owner = owner;

  }						}

Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
Link: https://lore.kernel.org/20241014192930.1539673-1-quic_mojha@quicinc.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-23 11:59:23 +02:00
Jean Delvare
b509b5e597 pinctrl: imx-scmi: Drop obsolete dependency on COMPILE_TEST
Since commit 0166dc11be ("of: make CONFIG_OF user selectable"), OF
can be enabled on all architectures. Therefore depending on
COMPILE_TEST as an alternative is no longer needed.

As ARM_SCMI_PROTOCOL already depends on COMPILE_TEST, we also don't
need to add COMPILE_TEST as an alternative dependency for it.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Link: https://lore.kernel.org/20241022134017.172411db@endymion.delvare
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-23 11:51:34 +02:00
Dmitry Baryshkov
11138a5caa pinctrl: qcom: add support for TLMM on SAR2130P
Add driver for the pincontrol device as present on the Qualcomm
SAR2130P platform. This is based on the msm-5.10 tree, tag
KERNEL.PLATFORM.1.0.r4-00400-NEO.0.

Co-developed-by: Mayank Grover <groverm@codeaurora.org>
Signed-off-by: Mayank Grover <groverm@codeaurora.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/20241018-sar2130p-tlmm-v2-2-11a1d09a6e5f@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-22 14:43:45 +02:00
Jingyi Wang
0c4cd2cc87 pinctrl: qcom: add the tlmm driver for QCS8300 platforms
Add support for QCS8300 TLMM configuration and control via the
pinctrl framework.

Signed-off-by: Jingyi Wang <quic_jingyw@quicinc.com>
Link: https://lore.kernel.org/20241018-qcs8300_tlmm-v3-2-8b8d3957cf1a@quicinc.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-22 14:41:44 +02:00
Linus Walleij
f8d355bfd0 pinctrl: renesas: Updates for v6.13
- Marks GPIOs as used on RZ/A1 and RZ/A2,
   - Add open-drain and schmitt-trigger support on RZ/V2H(P),
   - Miscellaneous fixes and improvements.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQQ9qaHoIs/1I4cXmEiKwlD9ZEnxcAUCZxJNNgAKCRCKwlD9ZEnx
 cC3jAQDNM1sh8LuEi6lMhgOKvnNPI0l2/HUvIgqtp347/x9/BwD/ZWiTB1Wu7tA1
 allIRqsiteZSsFW3u6jTlqv/wDSoxAs=
 =Xzt5
 -----END PGP SIGNATURE-----

Merge tag 'renesas-pinctrl-for-v6.13-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel

pinctrl: renesas: Updates for v6.13

  - Marks GPIOs as used on RZ/A1 and RZ/A2,
  - Add open-drain and schmitt-trigger support on RZ/V2H(P),
  - Miscellaneous fixes and improvements.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-19 20:18:03 +02:00
Yixun Lan
a83c29e1d1 pinctrl: spacemit: add support for SpacemiT K1 SoC
SpacemiT's K1 SoC has a pinctrl controller which use single register
to describe all functions, which include bias pull up/down(strong pull),
drive strength, schmitter trigger, slew rate, mux mode.

Signed-off-by: Yixun Lan <dlan@gentoo.org>
Link: https://lore.kernel.org/20241016-02-k1-pinctrl-v5-2-03d395222e4f@gentoo.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-19 20:15:12 +02:00
Igor Belwon
2193074458 pinctrl: samsung: Add Exynos 990 SoC pinctrl configuration
Add SoC pinctrl configuration for the Exynos 990. The bank types
used are the same as Exynos 850, so we can reuse its macros.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
Link: https://lore.kernel.org/r/20241016154838.64515-4-igor.belwon@mentallysanemainliners.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-10-17 09:55:24 +02:00
Colin Ian King
05214b06ee pinctrl: th1520: Fix potential null pointer dereference on func
The initialization of muxtype deferences pointer func before func
is sanity checked with a null pointer check, hence we have a null
pointer deference issue. Fix this by only deferencing func with
the assignment to muxtype after func has been null pointer checked.

Fixes: 1fc30cd927 ("pinctrl: th1520: Factor out casts")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reported-by: Kees Bakker <kees@ijzerbout.nl>
Acked-by: Drew Fustini <dfustini@tenstorrent.com>
Link: https://lore.kernel.org/20241016155655.334518-1-colin.i.king@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-16 21:30:18 +02:00
Thomas Bonnefille
22c918258f pinctrl: sophgo: fix typo in tristate of SG2002
Fix typo in tristate definition of the SG2002 Pinctrl driver.

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Link: https://lore.kernel.org/20241016-typo-pinctrl-sg2002-v1-1-2bdacb2d41e3@bootlin.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-16 21:19:01 +02:00
Geert Uytterhoeven
642490b50a pinctrl: PINCTRL_K230 should depend on ARCH_CANAAN
The Canaan Kendryte K230 pin controller is only present on Canaan
Kendryte K230 SoCs.  Hence add a dependency on ARCH_CANAAN, to prevent
asking the user about this driver when configuring a kernel without
Canaan Kendryte series SoC platform support.

Fixes: 545887eab6 ("pinctrl: canaan: Add support for k230 SoC")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/d70279ba02a67250203744b38314f4475b3c5671.1728986052.git.geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-15 23:59:41 +02:00
Arnd Bergmann
60ba5da29a pinctrl: th1520: add a CONFIG_OF dependency
When compile-testing without CONfIG_OF:

drivers/pinctrl/pinctrl-th1520.c: In function 'th1520_pinctrl_dt_node_to_map':
drivers/pinctrl/pinctrl-th1520.c:455:23: error: implicit declaration of function 'pinconf_generic_parse_dt_config'; did you mean 'pinconf_generic_dump_config'? [-Wimplicit-function-declaration]
  455 |                 ret = pinconf_generic_parse_dt_config(child, pctldev, &configs, &nconfigs);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                       pinconf_generic_dump_config

Enforce this using Kconig dependencies.

Fixes: bed5cd6f8a ("pinctrl: Add driver for the T-Head TH1520 SoC")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Drew Fustini <drew@pdp7.com>
Link: https://lore.kernel.org/20241015151126.2401855-1-arnd@kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-15 23:38:58 +02:00
Lad Prabhakar
5dcde519a0 pinctrl: renesas: Select PINCTRL_RZG2L for RZ/V2H(P) SoC
Add explicit selection of the PINCTRL_RZG2L config option for the
RZ/V2H(P) (R9A09G057) SoC, ensuring pin control driver is enabled
for this SoC.

Fixes: 9bd95ac86e ("pinctrl: renesas: rzg2l: Add support for RZ/V2H SoC")
Reported-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20241010132726.702658-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-10-14 10:02:13 +02:00
Lad Prabhakar
725933a54f pinctrl: renesas: rzg2l: Add support for configuring schmitt-trigger
Add support for configuring the multiplexed pins as schmitt-trigger
inputs.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/20241004123658.764557-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-10-14 10:01:56 +02:00
Lad Prabhakar
9d75b70061 pinctrl: renesas: rzg2l: Add support for enabling/disabling open-drain outputs
Add support for enabling and disabling open-drain outputs.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/20241004123658.764557-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-10-14 10:01:45 +02:00
Sergey Matsievskiy
93b8ddc545 pinctrl: ocelot: fix system hang on level based interrupts
The current implementation only calls chained_irq_enter() and
chained_irq_exit() if it detects pending interrupts.

```
for (i = 0; i < info->stride; i++) {
	uregmap_read(info->map, id_reg + 4 * i, &reg);
	if (!reg)
		continue;

	chained_irq_enter(parent_chip, desc);
```

However, in case of GPIO pin configured in level mode and the parent
controller configured in edge mode, GPIO interrupt might be lowered by the
hardware. In the result, if the interrupt is short enough, the parent
interrupt is still pending while the GPIO interrupt is cleared;
chained_irq_enter() never gets called and the system hangs trying to
service the parent interrupt.

Moving chained_irq_enter() and chained_irq_exit() outside the for loop
ensures that they are called even when GPIO interrupt is lowered by the
hardware.

The similar code with chained_irq_enter() / chained_irq_exit() functions
wrapping interrupt checking loop may be found in many other drivers:
```
grep -r -A 10 chained_irq_enter drivers/pinctrl
```

Cc: stable@vger.kernel.org
Signed-off-by: Sergey Matsievskiy <matsievskiysv@gmail.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/20241012105743.12450-2-matsievskiysv@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-12 22:04:38 +02:00
Harshit Mogalapalli
3fd976afe9 pinctrl: nuvoton: fix a double free in ma35_pinctrl_dt_node_to_map_func()
'new_map' is allocated using devm_* which takes care of freeing the
allocated data on device removal, call to

	.dt_free_map = pinconf_generic_dt_free_map

double frees the map as pinconf_generic_dt_free_map() calls
pinctrl_utils_free_map().

Fix this by using kcalloc() instead of auto-managed devm_kcalloc().

Cc: stable@vger.kernel.org
Fixes: f805e35631 ("pinctrl: nuvoton: Add ma35d1 pinctrl and GPIO driver")
Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/20241010205237.1245318-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-11 21:54:58 +02:00
Marc Ferland
d7eac9379f pinctrl: amd: Fix two small typos
Found those two while reading the code:

EDGE_TRAGGER -> EDGE_TRIGGER
BOTH_EADGE -> BOTH_EDGES

No functional changes, compile tested only.

Signed-off-by: Marc Ferland <marc.ferland@sonatest.com>
Link: https://lore.kernel.org/20241009151249.2086702-1-marc.ferland@sonatest.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-11 21:52:53 +02:00
Uwe Kleine-König
1a075b1dcc pinctrl: Switch back to struct platform_driver::remove()
After commit 0edb555a65 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.

Convert all platform drivers below drivers/pinctrl to use .remove(),
with the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/20241007205803.444994-8-u.kleine-koenig@baylibre.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-11 21:45:47 +02:00
Emil Renner Berthing
1fc30cd927 pinctrl: th1520: Factor out casts
Limit the casts to get the mux data and flags from the driver data
pointer with each pin to two inline functions as requested by Andy
during review.

Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Reviewed-by: Drew Fustini <dfustini@tenstorrent.com>
Tested-by: Drew Fustini <dfustini@tenstorrent.com>
Link: https://lore.kernel.org/20241011144826.381104-4-emil.renner.berthing@canonical.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-11 21:27:41 +02:00
Emil Renner Berthing
d1e16e2199 pinctrl: th1520: Update pinmux tables
When Drew took over the pinctrl driver it seems like he didn't use the
git tree I pointed him at and thus missed some important fixes to the
tables describing valid pinmux settings.

The documentation has a nice overview table of these settings but
unfortunately it doesn't fully match the register descriptions, which
seem to be the correct version.

Fixes: bed5cd6f8a ("pinctrl: Add driver for the T-Head TH1520 SoC")
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Reviewed-by: Drew Fustini <dfustini@tenstorrent.com>
Tested-by: Drew Fustini <dfustini@tenstorrent.com>
Link: https://lore.kernel.org/20241011144826.381104-3-emil.renner.berthing@canonical.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-11 21:27:41 +02:00
Emil Renner Berthing
ca35d5d245 pinctrl: th1520: Fix pinconf return values
When Drew took over the pinctrl driver he must have changed
all the -ENOTSUPP returns into -EOPNOTSUPP. This subtle change
was most likely not spotted because it was never mentioned in the
changelog of the patchset, but it breaks all the places in the
pin control and GPIO frameworks where -ENOTSUPP is expected.

Fixes: bed5cd6f8a ("pinctrl: Add driver for the T-Head TH1520 SoC")
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Reviewed-by: Drew Fustini <dfustini@tenstorrent.com>
Tested-by: Drew Fustini <dfustini@tenstorrent.com>
Link: https://lore.kernel.org/20241011144826.381104-2-emil.renner.berthing@canonical.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-11 21:27:41 +02:00
Bartosz Golaszewski
2a85fc7044 pinctrl: zynqmp: drop excess struct member description
The 'node' member has never been part of this structure so drop its
description.

Fixes: 8b242ca700 ("pinctrl: Add Xilinx ZynqMP pinctrl driver support")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/20241010080432.7781-1-brgl@bgdev.pl
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-10 21:48:11 +02:00
Bartosz Golaszewski
07d944b99c pinctrl: aw9523: fix kerneldoc for _aw9523_gpio_get_multiple()
The parameters' descriptions are wrong, drop the invalid ones and
document the ones that are missing the description.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/20241010080347.7759-1-brgl@bgdev.pl
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-10 21:35:46 +02:00
Harshit Mogalapalli
4575962aee pinctrl: sophgo: fix double free in cv1800_pctrl_dt_node_to_map()
'map' is allocated using devm_* which takes care of freeing the allocated
data, but in error paths there is a call to pinctrl_utils_free_map()
which also does kfree(map) which leads to a double free.

Use kcalloc() instead of devm_kcalloc() as freeing is manually handled.

Fixes: a29d8e93e7 ("pinctrl: sophgo: add support for CV1800B SoC")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/20241010111830.3474719-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-10 21:12:59 +02:00
Andrei Stefanescu
07963c0206 pinctrl: s32: add missing pins definitions
Added definitions for some pins which were missing from the
S32G2 SIUL2 pinctrl driver. These pins are used by the JTAG,
PFE and LLCE hardware modules.

Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Andrei Stefanescu <andrei.stefanescu@oss.nxp.com>
Link: https://lore.kernel.org/20241002135920.3647322-2-andrei.stefanescu@oss.nxp.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-09 18:16:56 +02:00
Drew Fustini
573cba2827 pinctrl: th1520: Convert dt child node loop to scoped iterator
Convert th1520_pinctrl_dt_node_to_map() to use a scoped iterator with
for_each_available_child_of_node_scoped(). As a result, there is no need
to call of_node_put() anymore. The put_child label has been renamed to
free_map which is now a more accurate description.

Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
Link: https://lore.kernel.org/20241008-th1520-pinctrl-fixes-v3-3-5b60db446a49@tenstorrent.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-09 14:42:07 +02:00
Drew Fustini
f3a3d006a4 pinctrl: th1520: Convert thp->mutex to guarded mutex
Convert th1520_pinctrl_dt_node_to_map() to use guarded mutex for
thp->mutex.

Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
Link: https://lore.kernel.org/20241008-th1520-pinctrl-fixes-v3-2-5b60db446a49@tenstorrent.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-09 14:42:07 +02:00
Drew Fustini
7027e36f55 pinctrl: th1520: Fix return value for unknown pin error
Fix th1520_pinctrl_dt_node_to_map() to set the return value before
jumping to free_configs when an unknown pin error occurs.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202410022336.xyWlV0Tf-lkp@intel.com/
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
Link: https://lore.kernel.org/20241008-th1520-pinctrl-fixes-v3-1-5b60db446a49@tenstorrent.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-09 14:42:07 +02:00
Biju Das
1737715a4c pinctrl: renesas: rzg2l: Fix missing return in rzg2l_pinctrl_register()
Fix the missing return statement in the error path of
rzg2l_pinctrl_register().

Fixes: f73f63b244 ("pinctrl: renesas: rzg2l: Use dev_err_probe()")
Reported-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Closes: https://lore.kernel.org/all/OS0PR01MB638837327E5487B71D88A70392712@OS0PR01MB6388.jpnprd01.prod.outlook.com/
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20241003082550.33341-1-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-10-09 13:39:26 +02:00
Fabrizio Castro
1d930d4bf8 pinctrl: renesas: rzg2l: Remove RZG2L_TINT_IRQ_START_INDEX
The RZ/V2H(P) SoC has 16 IRQ interrupts, while every other SoC has 8,
and this affects the start index of TINT interrupts (1 + 16 = 17, rather
than 1 + 8 = 9).
Macro RZG2L_TINT_IRQ_START_INDEX cannot work anymore, replace it with a
new member within struct rzg2l_hwcfg.

Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/20240930145244.356565-2-fabrizio.castro.jz@renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-10-09 13:39:13 +02:00
Linus Walleij
2694868880 pinctrl: k230: Drop unused code
The build robot complains about unused code. Let's drop it,
this can be restored with simple git revert when needed.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410021136.ie3cFM2w-lkp@intel.com/
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/20241003-k320-unused-v1-1-72e65bc2f27b@linaro.org
2024-10-04 09:46:27 +02:00
Linus Walleij
f2256e344d pinctrl: imx27: Fix too generic defines
The "PC" define is colliding with the (apparently broadcased)
define for "program counter" on Loongarch, so let's rename all
these 2-letter defines so they don't collide with stuff.

Fixes: a55222b7a1 ("pinctrl: freescale: enable use with COMPILE_TEST")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410030214.dPrgmUqd-lkp@intel.com/
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/20241003-fix-imx27-pc-v1-1-0e78d1fc6175@linaro.org
2024-10-04 09:45:45 +02:00
Rosen Penev
7b2a96de50 pinctrl: aw9523: use devm_mutex_init
Simplifies probe by removing all gotos and removing mutex_destroy from
_remove.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://lore.kernel.org/20241003214746.146207-1-rosenp@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-04 09:42:39 +02:00
Rosen Penev
be86c55354 pinctrl: aw9523: add missing mutex_destroy
Otherwise the mutex remains after a failed kzalloc.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://lore.kernel.org/20241001212724.309320-1-rosenp@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-04 09:42:35 +02:00
Esben Haabendal
58414a31c5 pinctrl: freescale: fix COMPILE_TEST error with PINCTRL_IMX_SCU
When PINCTRL_IMX_SCU was selected by PINCTRL_IMX8DXL or PINCTRL_IMX8QM
combined with COMPILE_TEST on a non-arm platforms, the IMX_SCU
dependency could not be enabled.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410031439.GyTSa0kX-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202410030852.q0Hukplf-lkp@intel.com/
Signed-off-by: Esben Haabendal <esben@geanix.com>
Link: https://lore.kernel.org/20241003-imx-pinctrl-compile-test-fix-v1-1-145ca1948cc3@geanix.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-03 16:22:14 +02:00
clingfei
d01240b22a pinctrl: thead1520: Fix Null pointer dereference
pinmux_generic_get_function may return NULL, and its retval is
dereferenced without check, which will cause a NULL pointer
dereference.

Signed-off-by: clingfei <clf700383@gmail.com>
Reviewed-by: Drew Fustini <dfustini@tenstorrent.com>
Link: https://lore.kernel.org/20241003023307.2138695-1-clf700383@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-03 16:07:12 +02:00
Linus Walleij
c9560baef0 intel-pinctrl for v6.12-2
Fixes a few issues with Intel pin control platform driver:
 * fix missing reference counter drop of fwnode on error path
 * replace comma by semicolon to follow the kernel style
 * add Panther Lake to the list of supported devices
 
 The following is an automated git shortlog grouped by driver:
 
 intel:
  -  platform: Add Panther Lake to the list of supported
  -  platform: use semicolon instead of comma in ncommunities assignment
  -  platform: fix error path in device_for_each_child_node()
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEhiZOUlnC9oKN3n3AmT3/83c5Sy0FAmb+ceYACgkQmT3/83c5
 Sy2jwg//csXZ0AH8MNEP54/tysjfC6sqXjJlESzfiqf+zJSTm4fO86dzgQ9kevXv
 Vq4zf9G/jU7ZFUmg0MencuDjY45NDcrkzeakgYayiYXYfvBIIperda02c0SZkzl1
 X6Wic0kY1PnkXx5tSA1AlNpGsxF2sl6ZVeaa2bsryukB7fE4Vq56giB0WZDq5MM9
 J4UFWlFlidLqi6ZCvfBzDRv6eonzakCOK2AdvmDKupiHjB/NlRh9TrZzbYveQMjd
 H62a9qIOMM2rqZbCbbhsaQEfCupZKX+MxgF35P7fsO0UItts5/XhtxFlrzCN6VD+
 xxjaPDiZ4lEWvjeMokEhQP5C+o8yn8pq99Y+PCy5ey0lCIYHRUN0qUrEXmwXakX2
 qsXRJNR+/g0PnbhvLWBOkzf29ztFxKEYXtvehhHKNM/nao+0lpfhbp4QZYlVVx1E
 8TQx08nyyeoznSg2pph/4pAmfBaUYZtsMmDFkxcNDfmicusaImYMGHZX5OQ1TiT6
 m/27P4/AR6A70G8I1bdeobYpLDPgEunBOKxLbsjSweQ3ZTuZLjxhfBMzWchL3hmf
 8qzvLVrjAf27QzTSBpCNf3oLC5QuyvftR4Wzs9cXgG4AgumldoTKgYceZHJLaiRr
 VFn80OAIAg3PNG3w6sViWk6VnteYfrYs6X7bqRpPjLyK0R/cU1Q=
 =h/iS
 -----END PGP SIGNATURE-----

Merge tag 'intel-pinctrl-v6.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel into fixes

intel-pinctrl for v6.12-2

Fixes a few issues with Intel pin control platform driver:
* fix missing reference counter drop of fwnode on error path
* replace comma by semicolon to follow the kernel style
* add Panther Lake to the list of supported devices

The following is an automated git shortlog grouped by driver:

intel:
 -  platform: Add Panther Lake to the list of supported
 -  platform: use semicolon instead of comma in ncommunities assignment
 -  platform: fix error path in device_for_each_child_node()
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-03 16:03:27 +02:00
Andy Shevchenko
3775625709 pinctrl: intel: platform: Add Panther Lake to the list of supported
Intel Panther Lake is supported by the generic platform driver,
so add it to the list of supported in Kconfig.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2024-10-03 13:14:31 +03:00
Linus Walleij
06783dc520 pinctrl: imx1: Fix too generic defines
The "PC" define is colliding with the (apparently broadcased)
define for "program counter" on Loongarch, so let's rename all
these 2-letter defines so they don't collide with stuff.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410020940.wGISlWfV-lkp@intel.com/
Fixes: a55222b7a1 ("pinctrl: freescale: enable use with COMPILE_TEST")
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-02 22:57:23 +02:00
Quentin Schulz
30e830b8b9 pinctrl: rockchip: improve error message for incorrect rockchip,pins property
If one improperly writes a rockchip,pins property, the pinctrl driver
basically just states that one in the myriad of pinctrl nodes is
improper but does not tell you which one.

Instead, let's print the full name of the Device Tree node that is
improper as well as provide more context on what the expected content
is.

Note that this should be rather unnecessary if one reads the output of
the dtbs_check as it would be highlighted as an error.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/20241002-pinctrl-rockchip-error-modulo-4-v1-1-4addb4e5732a@cherry.de
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-02 16:12:00 +02:00
Rosen Penev
38e2d33f13 pinctrl: aw9523: use enable for regulator
devm_regulator_get_enable_optional can be used to simplify the logic
here.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://lore.kernel.org/20241001212724.309320-2-rosenp@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-02 15:50:00 +02:00
Rosen Penev
393c554093 pinctrl: aw9523: add missing mutex_destroy
Otherwise the mutex remains after a failed kzalloc.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://lore.kernel.org/20241001212724.309320-1-rosenp@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-02 15:48:38 +02:00
Ivaylo Ivanov
eed2e79221 pinctrl: samsung: Add exynos8895 SoC pinctrl configuration
Add support for the pin-controller found on the Exynos8895 SoC
used in Samsung Galaxy S8 and S8 Plus phones.

It has a newly applied pinctrl register layer for FSYS0 with a
different bank type offset that consists of the following bit
fields:

CON: 4, DAT: 1, PUD: 2, DRV: 3, CONPDN: 2, PUDPDN: 2

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240920154508.1618410-6-ivo.ivanov.ivanov1@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-10-02 09:47:45 +02:00
Mark Brown
d1c7bf9cb3 pinctrl: sx150x: Use maple tree register cache
The sx150x driver uses a rbtree register cache with no obvious reason for
specifically preferring it. The maple tree register cache is based on a
more modern data structure and makes implementation decisions more suitable
for modern systems so let's switch the driver to use that. No functional
change.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/20240924-pinctl-sx150x-maple-v1-1-17dcfefefd17@kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 16:30:08 +02:00
Uwe Kleine-König
af8e481228 pinctrl: aw9523: Drop explicit initialization of struct i2c_device_id::driver_data to 0
These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/20240920153430.503212-13-u.kleine-koenig@baylibre.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 16:21:46 +02:00
Lijuan Gao
b698f36a9d pinctrl: qcom: add the tlmm driver for QCS615 platform
Add support for QCS615 TLMM configuration and control via the
pinctrl framework.

Signed-off-by: Lijuan Gao <quic_lijuang@quicinc.com>
Link: https://lore.kernel.org/20240920-add_qcs615_pinctrl_driver-v2-2-e03c42a9d055@quicinc.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 16:20:16 +02:00
Ze Huang
545887eab6 pinctrl: canaan: Add support for k230 SoC
Configuration of the K230 is similar to that of the K210. However, in
K210, the 256 functions for each pin are shared, whereas in K230,
multiplex functions are different for every pin.

`drv_data` of `pinctrl_pin_desc` is pointing to currently activated
group, which is used to print the name of current function of pin in
`pin_dbg_show` and will be updated in `set_mux`, so they are not set
const.

Signed-off-by: Ze Huang <18771902331@163.com>
Link: https://lore.kernel.org/20240926-k230-pinctrl-v2-2-a9a36fba4b34@163.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:23:46 +02:00
Sricharan Ramabadhran
968e671ebd pinctrl: qcom: Introduce IPQ5424 TLMM driver
The IPQ5424 SoC comes with a TLMM block, like all other Qualcomm
platforms, so add a driver for it.

Co-developed-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com>
Link: https://lore.kernel.org/20240927065244.3024604-6-quic_srichara@quicinc.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:19:11 +02:00
Linus Walleij
80f133387e Merge branch 'ib-thead-th1520' into devel
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:05:16 +02:00
Emil Renner Berthing
bed5cd6f8a pinctrl: Add driver for the T-Head TH1520 SoC
Add pinctrl driver for the T-Head TH1520 RISC-V SoC.

Tested-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
[dfustini: use thead,pad-group to identify the pin controller instance]
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
Link: https://lore.kernel.org/20240930-th1520-pinctrl-v3-2-32cea2bdbecb@tenstorrent.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:04:51 +02:00
Daniel Machon
4e778d2ca2 pinctrl: ocelot: add support for lan969x SoC pinctrl
This adds support for lan969x SoC pinctrl, reusing the existing ocelot
driver. There are 66 General Purpose I/O pins that are individually
configurable to multiple interfaces.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://lore.kernel.org/20240917-lan969x-pinctrl-v2-2-ea02cbc56831@microchip.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:03:41 +02:00
Esben Haabendal
a55222b7a1 pinctrl: freescale: enable use with COMPILE_TEST
Allow compile-testing of i.MX pinctrl drivers using CONFIG_COMPILE_TEST.

Signed-off-by: Esben Haabendal <esben@geanix.com>
Link: https://lore.kernel.org/20240506-imx-pinctrl-optional-v2-3-bdff75085156@geanix.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:03:41 +02:00
Esben Haabendal
aea2dd7a6f pinctrl: freescale: Use CONFIG_SOC_IMXRT to guard i.MX RT1xxx drivers
This aligns with the use of SOC_IMX* as dependencies for all the other
mach-imx pinctrl drivers. Enabling i.MX RT pinctrl drivers for a kernel
with out i.MX RT SOC support is pointless.

Signed-off-by: Esben Haabendal <esben@geanix.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/20240506-imx-pinctrl-optional-v2-2-bdff75085156@geanix.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:03:41 +02:00
Esben Haabendal
17d2100189 ARM: imx: Allow user to disable pinctrl
Making pinctrl drivers and subsequently the pinctrl framework
user-controllable, allows building a kernel without this.
While in many (most) cases, this could make the system unbootable, it
does allow building smaller kernels for those situations where picntrl
is not needed.

One such situation is when building a kernel for NXP LS1021A systems,
which does not have run-time controllable pinctrl, so pinctrl framework
and drivers are 100% dead-weight.

Signed-off-by: Esben Haabendal <esben@geanix.com>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/20240506-imx-pinctrl-optional-v2-1-bdff75085156@geanix.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:03:41 +02:00
Geert Uytterhoeven
c919ca8617 pinctrl: k210: Make (p)clk local to k210_fpioa_probe()
There were never any users of k210_fpioa_data.clk and
k210_fpioa_data.pclk outside k210_fpioa_probe().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/77f543046d4d5c19206f829ddcf8e093d3e3f6da.1725440917.git.geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:03:40 +02:00
Sai Krishna Potthuri
4c9e8da4e7 pinctrl: pinctrl-zynqmp: Add support for Versal platform
Add Pinctrl support for Xilinx Versal platform.
Driver checks for firmware support to retrieve the Pin information, if it
is supported then proceed further otherwise it returns error saying
operation not supported. Latest Xilinx Platform Management Firmware must
be used to make use of the Pinctrl driver for Versal platform.

Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Link: https://lore.kernel.org/20240906110113.3154327-4-sai.krishna.potthuri@amd.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:03:40 +02:00
Ma Ke
b0f0e3f055 pinctrl: stm32: check devm_kasprintf() returned value
devm_kasprintf() can return a NULL pointer on failure but this returned
value is not checked. Fix this lack and check the returned value.

Found by code review.

Cc: stable@vger.kernel.org
Fixes: 32c170ff15 ("pinctrl: stm32: set default gpio line names using pin names")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Link: https://lore.kernel.org/20240906100326.624445-1-make24@iscas.ac.cn
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:03:34 +02:00
Ma Ke
665a58fe66 pinctrl: apple: check devm_kasprintf() returned value
devm_kasprintf() can return a NULL pointer on failure but this returned
value is not checked. Fix this lack and check the returned value.

Found by code review.

Cc: stable@vger.kernel.org
Fixes: a0f160ffcb ("pinctrl: add pinctrl/GPIO driver for Apple SoCs")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/20240905020917.356534-1-make24@iscas.ac.cn
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-10-01 14:03:34 +02:00
Wolfram Sang
a813032358 pinctrl: renesas: rza1: Mark GPIOs as used
GPIOs showed up as unclaimed, so they could be muxed to something else
even though they were in use. Mark GPIOs as claimed to avoid that.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240930191523.7030-2-wsa+renesas@sang-engineering.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-10-01 09:17:13 +02:00
Geert Uytterhoeven
87146254f8 pinctrl: renesas: rza2: Mark GPIOs as used
GPIOs showed up as unclaimed in debugfs, so they could be muxed to
something else even though they were in use.  Mark GPIOs as claimed when
in use to avoid that.

Reported-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/2862093f7701dcaf29f37c0b2f9268234168338f.1727711124.git.geert+renesas@glider.be
2024-10-01 09:15:45 +02:00
Javier Carrasco
d594de8956 pinctrl: intel: platform: use semicolon instead of comma in ncommunities assignment
Substitute the comma with a semicolon in the `ncommunities` assignment
for better readability and consistency with common C coding style.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2024-09-30 14:35:23 +03:00
Javier Carrasco
16a6d2e685 pinctrl: intel: platform: fix error path in device_for_each_child_node()
The device_for_each_child_node() loop requires calls to
fwnode_handle_put() upon early returns to decrement the refcount of
the child node and avoid leaking memory if that error path is triggered.

There is one early returns within that loop in
intel_platform_pinctrl_prepare_community(), but fwnode_handle_put() is
missing.

Instead of adding the missing call, the scoped version of the loop can
be used to simplify the code and avoid mistakes in the future if new
early returns are added, as the child node is only used for parsing, and
it is never assigned.

Cc: stable@vger.kernel.org
Fixes: c5860e4a27 ("pinctrl: intel: Add a generic Intel pin control platform driver")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2024-09-30 14:35:23 +03:00
Linus Torvalds
075dbe9f6e soc: convert ep93xx to devicetree
This concludes a long journey towards replacing the old
 board files with devictree description on the Cirrus Logic
 EP93xx platform.
 
 Nikita Shubin has been working on this for a long time,
 for details see the last post on
 https://lore.kernel.org/lkml/20240909-ep93xx-v12-0-e86ab2423d4b@maquefel.me/
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmb1croACgkQYKtH/8kJ
 UicY0g//XXEXcBgE2CLfKzGimN3gREIElEqFCpd7v32XWGIQNFdS7StiGqNx1MeU
 UYdILm97ldgpx+NnHd3Cb9HbLQ1CTIIvAZ2ngFLDeeZO+wgzBVxWTrdUUp57ZIBn
 5Fq0hNaR1bfqSr+J+ZbgizH5N96EvLr3OPz/eJetY7egVBUID/0OpwssPJxW1Ns0
 f+W+yIc7BomVa71xGgI+RkHrG/5DSaoFtrB+ESt7q1nNUIeMn32JqBYqE0U2iCRN
 ADO8I+WfAjIcO1uN5n3KM3tigZI3GKSrBdllByr8wWNbp9l5rMYfFAPEaI109iyI
 7PFrB6qhAlY9LckXMNhwLyjlnWt6qrI0B+tyg+3tW6+4OwFnpPN0cIhszFPOmrhv
 njsDSvybp0q9V6Mn7f394H6v9sk9RHr68mpu12hO65UBP7Qe7mrdl3snnFcm0FHL
 jCLnvjdmCSqRlV6YFsKDHuDzZOG88sAwH0mySKd3c/CVvgaNDsaJduelPGpuXlXX
 P7op6D8kyKFKfmwK0kz3t+3+2ozgYq3nu4amI7rJ72MOvJKBocTwwqpAesIuegde
 bn3ZN30yZDTbfEFuveOAzx7rqDlZYX/tN0uspL4VBN0rdayxBng5hneV2PypTtW0
 wE9ptz5qIz8AssJ7NInwpgRTDjEut4SY3m3CS2/66V08B4EznAA=
 =Y3Cd
 -----END PGP SIGNATURE-----

Merge tag 'soc-ep93xx-dt-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull SoC update from Arnd Bergmann:
 "Convert ep93xx to devicetree

  This concludes a long journey towards replacing the old board files
  with devictree description on the Cirrus Logic EP93xx platform.

  Nikita Shubin has been working on this for a long time, for details
  see the last post on

    https://lore.kernel.org/lkml/20240909-ep93xx-v12-0-e86ab2423d4b@maquefel.me/"

* tag 'soc-ep93xx-dt-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (47 commits)
  dt-bindings: gpio: ep9301: Add missing "#interrupt-cells" to examples
  MAINTAINERS: Update EP93XX ARM ARCHITECTURE maintainer
  soc: ep93xx: drop reference to removed EP93XX_SOC_COMMON config
  net: cirrus: use u8 for addr to calm down sparse
  dmaengine: cirrus: use snprintf() to calm down gcc 13.3.0
  dmaengine: ep93xx: Fix a NULL vs IS_ERR() check in probe()
  pinctrl: ep93xx: Fix raster pins typo
  spi: ep93xx: update kerneldoc comments for ep93xx_spi
  clk: ep93xx: Fix off by one in ep93xx_div_recalc_rate()
  clk: ep93xx: add module license
  dmaengine: cirrus: remove platform code
  ASoC: cirrus: edb93xx: Delete driver
  ARM: ep93xx: soc: drop defines
  ARM: ep93xx: delete all boardfiles
  ata: pata_ep93xx: remove legacy pinctrl use
  pwm: ep93xx: drop legacy pinctrl
  ARM: ep93xx: DT for the Cirrus ep93xx SoC platforms
  ARM: dts: ep93xx: Add EDB9302 DT
  ARM: dts: ep93xx: add ts7250 board
  ARM: dts: add Cirrus EP93XX SoC .dtsi
  ...
2024-09-26 12:00:25 -07:00
Linus Torvalds
962ad08780 This is the bulk of pin control changes for the v6.12 kernel cycle:
Core changes:
 
 - Add support for "input-schmitt-microvolt" property, as used in the
   Sophgo SoC.
 
 New drivers:
 
 - Mobileye EyeQ5 pin controller, I think this is an automotive SoC.
 
 - Rockchip rk3576 pin control support.
 
 - Sophgo CV1800 series pin controllers: CV1800B, CV1812H and SG2000.
 
 Improvements:
 
 - Gradual improvements to Renesas, Samsung, Qualcomm, Nuvoton
   and a few other drivers.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAmbvQpoACgkQQRCzN7AZ
 XXOwIxAApTqZMFAQwEsqMSrcDeJeoaH3vQLa1MKmOLY+IIdNPemlaCpoYUX48MRB
 DRxz9c6lU2sD80xtYfuXCpye8i4cVrkLlRWpap2efX1rqaMWQNO1vQvO4VgL6plI
 ElU1ivjKpuqIsjJH3UELILuDV8Ft26p1AoCJhE5cTVu+nsP4aNaS0DQLzf2K7nrd
 c5chLYPxM0K+ViHtDDAlrJ70y5fUCkEaSUC8PBqVu04gRjubIqNKwlbaNRR/pRKk
 dtG4RbDdJwu//pcStNIuKpwlEHcY6E8egY80fjP+i6XUNDfxN2LFcC7IWkvTRiZg
 xz7nQFsH6BnuUKpaxFCCTs58sFPKCoasbWMja4RtXoq3e0W6Gne7/tNO6uLc0dFx
 AIGIW/scLzmOgi32YYZsMu9aL6d6Gr2Bj1aJrzHcgi4gZWJnfwCDwuhb70X9eZaY
 T1HMjCGU16XO9ipAtIHrtsOt6DRvq5tLygEQ39u6nxQCrapJ30JCFMAxesGdErAL
 ER8RmUGhvv+sMJ0fE8pcCP7vOB3LaPiqgqDsEQK7ph81pIWi/iXWQBNzRqGMs2aQ
 30WZ27nO26NBS54yUd019UGJGTDafYuWVn+coXEYd8YBlqxP9qRlfbVUvLbvi730
 OopyOKOhAuYQEjuQsK2Gz9/5K5axw2f3d6ClAwqnGeWTtihgS6s=
 =7uZC
 -----END PGP SIGNATURE-----

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

Pull pin control updates from Linus Walleij:
 "Core changes:

   - Add support for "input-schmitt-microvolt" property, as used in the
     Sophgo SoC

  New drivers:

   - Mobileye EyeQ5 pin controller, I think this is an automotive SoC

   - Rockchip rk3576 pin control support

   - Sophgo CV1800 series pin controllers: CV1800B, CV1812H and SG2000

  Improvements:

   - Gradual improvements to Renesas, Samsung, Qualcomm, Nuvoton and a
     few other drivers"

* tag 'pinctrl-v6.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (67 commits)
  pinctrl: intel: Constify struct intel_pinctrl parameter
  pinctrl: Remove redundant null pointer checks in pinctrl_remove_device_debugfs()
  pinctrl: baytrail: Drop duplicate return statement
  pinctrl: intel: Inline intel_gpio_community_irq_handler()
  dt-bindings: pinctrl: qcom: add missing type to GPIO hogs
  pinctrl: madera: Simplify with dev_err_probe()
  pinctrl: k210: Use devm_clk_get_enabled() helpers
  pinctrl: Join split messages and remove double whitespace
  pinctrl: renesas: rzg2l: Move pinconf_to_config_argument() call outside of switch cases
  pinctrl: renesas: rzg2l: Introduce single macro for digital noise filter configuration
  pinctrl: renesas: rzg2l: Replace of_node_to_fwnode() with more suitable API
  pinctrl: mvebu: Fix devinit_dove_pinctrl_probe function
  pinctrl: sunxi: Use devm_clk_get_enabled() helpers
  pinctrl: sophgo: cv18xx: fix missed __iomem type identifier
  pinctrl: stmfx: Use string_choices API instead of ternary operator
  pinctrl: nomadik: Use kmemdup_array instead of kmemdup for multiple allocation
  pinctrl: intel: Introduce for_each_intel_gpio_group() helper et al.
  pinctrl: intel: Constify intel_get_community() returned object
  pinctrl: intel: Implement high impedance support
  pinctrl: intel: Add __intel_gpio_get_direction() helper
  ...
2024-09-23 13:15:23 -07:00
Nikita Shubin
7427c5b34f
pinctrl: ep93xx: Fix raster pins typo
Fix raster_on_sdram0_pins used in PMX_GROUP() instead of
raster_on_sdram3_pins as it should be.

Fixes: d1661439f5a3 ("pinctrl: add a Cirrus ep93xx SoC pin controller")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409130426.1OzNAC9M-lkp@intel.com/
Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20240913045829.11904-1-nikita.shubin@maquefel.me
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-09-16 11:16:15 +00:00
Patrick Rudolph
71e4001a04 pinctrl: pinctrl-cy8c95x0: Fix regcache
The size of the mux stride was off by one, which could result in
invalid pin configuration on the device side or invalid state
readings on the software side.

While on it also update the code and:
- Increase the mux stride size to 16
- Align the virtual muxed regmap range to 16
- Start the regmap window at the selector
- Mark reserved registers as not-readable

Fixes: 8670de9fae ("pinctrl: cy8c95x0: Use regmap ranges")
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reported-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/20240902072859.583490-1-patrick.rudolph@9elements.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-13 13:14:18 +02:00
Linus Walleij
d7c9ec3b07 intel-pinctrl for v6.11-1
This includes a new ACPI ID that is added to the Intel Meteor Lake
 driver to support recent Intel Arrow Lake hardware.
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAmaxzMwgHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKBHKxAAka3ovlC1kW5X
 dQK9wX10cv7zTe46ZZCaQ6IKZwkFSqpE3OWa1Nu1OdLMHYLgESSUERbt1YdiXfdT
 BH2UV8Vvca9ioFqCJFusf7zZvewuuCb9gJ7dgsSbgE65EFbV8gFHh8XT0TnbtoCd
 88sBINYyW5a7yN3N/qvBF+Zb0t23c+bKTwYkINOKOUO+EzOubpMK3L67CSkdMk+i
 1KMCGbgwX/TMCewBCGR+pDADVoDKAR8vkwm0qnb4iU1BSHxo+3AuR4T+h/S7NBad
 WqypmcOCw87URri+U+Y7swNEPrPqs7mfvsFRGL3oSqyTH0S/bGofU8pqKs156IHQ
 RmUXQXFdodkMZ4V85hck0JFsPk5ieIXlzpIyNWdl8tCPuTjfDOWL4XRaCjejcO+J
 7CQIpAEIV7sZ4dp0qV7dK1IAqYs/q16uKQZuKoVsqPIdHY5/k7k8aS2d/9PExXjm
 4EoEAaQQu39+dpF6EpJIYr12V1wO8IAN4vQ8dn4bG7jhsqM6XcuIZ9ANYBpAdJNM
 7wohIcepwI+sZLwHSXIvfbzzYEdG1UnWl5FfOEJfyayKzuzNSGlG7mSjHvIsQM46
 krJG93aj81qqt1BSATcXbmp3jnFXvd3+9YNdogtSZa0l3m1W2XpRulemaXWxqwXN
 KeiSIpWktVFaegiTMXE/uicloYGdfbU=
 =Mbpf
 -----END PGP SIGNATURE-----

Merge tag 'intel-pinctrl-v6.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel into fixes

intel-pinctrl for v6.11-1

This includes a new ACPI ID that is added to the Intel Meteor Lake
driver to support recent Intel Arrow Lake hardware.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-13 13:09:05 +02:00
Nikita Shubin
035f90076f pinctrl: add a Cirrus ep93xx SoC pin controller
Add a pin control (only multiplexing) driver for ep93xx SoC so
we can fully convert ep93xx to device tree.

This driver is capable of muxing ep9301/ep9302/ep9307/ep9312/ep9315
variants, this is chosen based on "compatible" in device tree.

Co-developed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
Tested-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-09-12 14:33:10 +00:00
Linus Walleij
264c13114b intel-pinctrl for v6.12-1
* Enable High Impedance pin configuration support for Intel pin control
 * Miscellaneous small improvements here and there
 
 The following is an automated git shortlog grouped by driver:
 
 baytrail:
  -  Drop duplicate return statement
 
 intel:
  -  Constify struct intel_pinctrl parameter
  -  Inline intel_gpio_community_irq_handler()
  -  Introduce for_each_intel_gpio_group() helper et al.
  -  Constify intel_get_community() returned object
  -  Implement high impedance support
  -  Add __intel_gpio_get_direction() helper
  -  Refactor __intel_gpio_set_direction() to be more useful
  -  Move debounce validation out of the lock
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEhiZOUlnC9oKN3n3AmT3/83c5Sy0FAmbgAl8ACgkQmT3/83c5
 Sy3XhQ//WfkhNv73IVvGPlKLI4s6A43xINEZ/8gVNeukaOGIi54xu3wlV5QevDOS
 6MacKg0g0ZUo1KQXp86o54LqvCfOLklFzJsiWkYXqqImRvuA+5OuP4fVOv3XV9Ga
 i1b07A4vFamHwzUKt5kTYwhPOcqNzwYmPgU3jcArpANFs3lahVA9zCCzyXURTNnQ
 UH546mEqDezH2m5WgDHATBakSRJJr9bsVYIwAO/8OOz+V75Spmag0vJgWY/9QQms
 3mUoJmTLOQbaDUqVqvTRU0uovgUlYXIOJS2EWLqnFBcK78fPZ1CDw0Vn8P6uo1km
 /FGcNmoDyXwW6TmI+CyHgiYIItjSYPE6YpxQZtIiGxA79bZwvBO7QA/7CYPniu/i
 WyKiKLUOYnvKTqsr9hKOYvHGV74hjRb0EuycnEyw0SCtsoxWlrNnuP4CG22X9O0+
 OvfD3jMAFSAmYooifK0CZyi+IFphFpTUmy+fq+hT6MAH9H3uQ88QWThrw+4hA5O0
 rNPtwvL0WoK+4v8twQbOSRVd63J20oMGL7+nGnymnO5EA/XLVIlCSBFQhhNBKC3/
 OeWlyP/v+n6KnWNY4Wo9daBgF6Vej0B/9E5Z46mOKIDO5Q9iIzG4bOh/iwv9C/7Q
 BCnbOYiXJyLZLOJ7k9AuE0DfeYzIZsNIyDwximc8wus937YE2/g=
 =Z/p4
 -----END PGP SIGNATURE-----

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

intel-pinctrl for v6.12-1

* Enable High Impedance pin configuration support for Intel pin control
* Miscellaneous small improvements here and there

The following is an automated git shortlog grouped by driver:

baytrail:
 -  Drop duplicate return statement

intel:
 -  Constify struct intel_pinctrl parameter
 -  Inline intel_gpio_community_irq_handler()
 -  Introduce for_each_intel_gpio_group() helper et al.
 -  Constify intel_get_community() returned object
 -  Implement high impedance support
 -  Add __intel_gpio_get_direction() helper
 -  Refactor __intel_gpio_set_direction() to be more useful
 -  Move debounce validation out of the lock
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-11 10:27:30 +02:00
Andy Shevchenko
1652e95b17 pinctrl: intel: Constify struct intel_pinctrl parameter
There are a few functions that do not and should not change
the state of the pin control object. Constify the respective
parameter.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-09-05 18:09:28 +03:00
Li Zetao
92f4368347 pinctrl: Remove redundant null pointer checks in pinctrl_remove_device_debugfs()
Since the debugfs_create_dir() never returns a null pointer, checking
the return value for a null pointer is redundant, and using IS_ERR is
safe enough.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Link: https://lore.kernel.org/20240903143812.2005071-1-lizetao1@huawei.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-05 15:09:47 +02:00
Linus Walleij
dbf0e9d911 pinctrl: renesas: Updates for v6.12 (take two)
- Miscellaneous fixes and improvements.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQQ9qaHoIs/1I4cXmEiKwlD9ZEnxcAUCZtcfEgAKCRCKwlD9ZEnx
 cAFWAP9aEn3SLVWHs9B8YbeGRST/ml7W4Vl0/UXg8Eth5ChT8AD/Wx8y3IUVzmsZ
 vLycxQdzSB79ajexmQzMyVy5Ed3EHQc=
 =Is1J
 -----END PGP SIGNATURE-----

Merge tag 'renesas-pinctrl-for-v6.12-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel

pinctrl: renesas: Updates for v6.12 (take two)

  - Miscellaneous fixes and improvements.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-05 15:08:12 +02:00
Andy Shevchenko
bda2f1c2d8 pinctrl: baytrail: Drop duplicate return statement
No need to repeat 'return ret;' inside and outside conditional.
Just use one outside conditional for both cases.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2024-09-04 13:31:05 +03:00
Andy Shevchenko
52c62a3da8 pinctrl: intel: Inline intel_gpio_community_irq_handler()
Since we have for_each_intel_pad_group() helper, there is
no advantage of having intel_gpio_community_irq_handler().
Inline it into intel_gpio_irq().

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2024-09-03 17:08:42 +03:00
Stephan Gerhold
602cb14e31 pinctrl: qcom: x1e80100: Bypass PDC wakeup parent for now
On X1E80100, GPIO interrupts for wakeup-capable pins have been broken since
the introduction of the pinctrl driver. This prevents keyboard and touchpad
from working on most of the X1E laptops. So far we have worked around this
by manually building a kernel with the "wakeup-parent" removed from the
pinctrl node in the device tree, but we cannot expect all users to do that.

Implement a similar workaround in the driver by clearing the wakeirq_map
for X1E80100. This avoids using the PDC wakeup parent for all GPIOs
and handles the interrupts directly in the pinctrl driver instead.

The PDC driver needs additional changes to support X1E80100 properly.
Adding a workaround separately first allows to land the necessary PDC
changes through the normal release cycle, while still solving the more
critical problem with keyboard and touchpad on the current stable kernel
versions. Bypassing the PDC is enough for now, because we have not yet
enabled the deep idle states where using the PDC becomes necessary.

Cc: stable@vger.kernel.org
Fixes: 05e4941d97 ("pinctrl: qcom: Add X1E80100 pinctrl driver")
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Konrad Dybcio <konradybcio@kernel.org>
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/20240830-x1e80100-bypass-pdc-v1-1-d4c00be0c3e3@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-02 11:07:48 +02:00
Yan Zhen
b042baa52b pinctrl: madera: Simplify with dev_err_probe()
Switch to use dev_err_probe() to simplify the error path and
unify a message template.

Using this helper is totally fine even if err is known to never
be -EPROBE_DEFER.

The benefit compared to a normal dev_err() is the standardized format
of the error code, it being emitted symbolically and the fact that
the error code is returned which allows more compact error paths.

Signed-off-by: Yan Zhen <yanzhen@vivo.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/20240829044835.2047794-1-yanzhen@vivo.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-02 10:28:53 +02:00
Wang Jianzheng
91bb8d0bf2 pinctrl: k210: Use devm_clk_get_enabled() helpers
The devm_clk_get_enabled() helpers:
    - call devm_clk_get()
    - call clk_prepare_enable() and register what is needed in order to
     call clk_disable_unprepare() when needed, as a managed resource.

This simplifies the code and avoids the calls to clk_disable_unprepare().

Signed-off-by: Wang Jianzheng <wangjianzheng@vivo.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/20240829064938.20114-1-wangjianzheng@vivo.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-02 10:26:18 +02:00
Geert Uytterhoeven
090e6fea5f pinctrl: Join split messages and remove double whitespace
Splitting error messages across multiple lines makes it harder to find
them in the kernel sources.  Fix this by joining the messages.
Remove double whitespace (end of first line + begin of second line).

Fixes: 1c8e794432 ("pinctrl: improve warning messages")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/c8e3feeedbf42a130936a5afaea0f129bcda51f6.1724938156.git.geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-02 10:14:21 +02:00
Lad Prabhakar
1325820dd0 pinctrl: renesas: rzg2l: Move pinconf_to_config_argument() call outside of switch cases
Refactor the `rzg2l_pinctrl_pinconf_set()` function by moving the call to
`arg = pinconf_to_config_argument(_configs[i])` to the beginning of the
loop. Previously, this call was redundantly made in most cases within the
switch statement.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240829194841.84398-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-09-02 10:13:59 +02:00
Lad Prabhakar
befcded234 pinctrl: renesas: rzg2l: Introduce single macro for digital noise filter configuration
Support for enabling the digital noise filter, and support for
configuring the noise filter stages (via the FILNUM register) and the
sampling interval (via the FILCLKSEL register) are related: a pin
supports either all or none of them. Hence simplify declaring digital
noise filter support for a pin by using a single feature flag instead of
three separate flags.

This patch removes the PIN_CFG_FILNUM and PIN_CFG_FILCLKSEL configuration
macros and renames PIN_CFG_FILONOFF to PIN_CFG_NF.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240829194841.84398-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-09-02 10:13:55 +02:00
Andy Shevchenko
dad83b9527 pinctrl: renesas: rzg2l: Replace of_node_to_fwnode() with more suitable API
of_node_to_fwnode() is a IRQ domain specific implementation of
of_fwnode_handle(). Replace the former with more suitable API.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240822230104.707812-1-andy.shevchenko@gmail.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2024-09-02 10:12:36 +02:00
Wang Jianzheng
c25478419f pinctrl: mvebu: Fix devinit_dove_pinctrl_probe function
When an error occurs during the execution of the function
__devinit_dove_pinctrl_probe, the clk is not properly disabled.

Fix this by calling clk_disable_unprepare before return.

Fixes: ba607b6238 ("pinctrl: mvebu: make pdma clock on dove mandatory")
Signed-off-by: Wang Jianzheng <wangjianzheng@vivo.com>
Link: https://lore.kernel.org/20240829064823.19808-1-wangjianzheng@vivo.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-02 10:08:46 +02:00
Wang Jianzheng
7dc92ece32 pinctrl: sunxi: Use devm_clk_get_enabled() helpers
sunxi sunxi_pinctrl_init_with_variant get, enable clk and
deinit_device disable and unprepare it.

This simplifes the code and avoids the calls to
clk_disable_unprepare().

Signed-off-by: Wang Jianzheng <wangjianzheng@vivo.com>
Link: https://lore.kernel.org/20240829064737.16169-1-wangjianzheng@vivo.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-02 10:06:13 +02:00
Inochi Amaoto
5213518d5a pinctrl: sophgo: cv18xx: fix missed __iomem type identifier
As the variable reg in "cv1800_pctrl_dbg_show" misses a "__iomem"
type identifier, a warning will be issued by the compiler. Add
this identifier to avoid this warning.

Fixes: a29d8e93e7 ("pinctrl: sophgo: add support for CV1800B SoC")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408271555.kpOmi9I8-lkp@intel.com/
Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
Link: https://lore.kernel.org/IA1PR20MB495329EBE498DFFDAA1EC457BB972@IA1PR20MB4953.namprd20.prod.outlook.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-09-01 00:45:50 +02:00
Andy Shevchenko
f33254db6c pinctrl: stmfx: Use string_choices API instead of ternary operator
Use modern string_choices API instead of manually determining the
output using ternary operator.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/20240826095306.1420628-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-08-31 00:11:29 +02:00
Yu Jiaoliang
a9c470d22d pinctrl: nomadik: Use kmemdup_array instead of kmemdup for multiple allocation
Let the kememdup_array() take care about multiplication and possible
overflows.

Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
Link: https://lore.kernel.org/20240826074037.2313468-1-yujiaoliang@vivo.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-08-30 23:38:26 +02:00
Andy Shevchenko
74367ad80c pinctrl: intel: Introduce for_each_intel_gpio_group() helper et al.
Introduce a helper macro for_each_intel_gpio_group() et al.
With those in place, update the users.

It reduces the C code base as well as shrinks the binary:

  add/remove: 0/0 grow/shrink: 4/21 up/down: 39/-621 (-582)
  Total: Before=15942, After=15360, chg -3.65%

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2024-08-30 21:47:36 +03:00
Andy Shevchenko
e075cbfeb4 pinctrl: intel: Constify intel_get_community() returned object
There is nothing prevents us from constifying intel_get_community()
returned object. Do it to make code more robust.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2024-08-30 21:44:38 +03:00
Andy Shevchenko
13791bb6bf pinctrl: intel: Implement high impedance support
Implement high impedance support for Intel pin control hardware.
It allows to set high impedance and check it.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2024-08-30 21:44:38 +03:00
Andy Shevchenko
91946ccbe7 pinctrl: intel: Add __intel_gpio_get_direction() helper
Add __intel_gpio_get_direction() helper which provides all possible
physical states of the pad.

With that done, update current users and make the respective checks
consistent.

While at it, make the style of anonymous enum kernel documentation
consistent.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2024-08-30 21:44:37 +03:00