From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andy@kernel.org>, Linus Walleij <linusw@kernel.org>
Subject: [PATCH v1 1/5] pinctrl: intel: Improve capability support
Date: Wed, 18 Mar 2026 16:10:15 +0100 [thread overview]
Message-ID: <20260318151256.2590375-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20260318151256.2590375-1-andriy.shevchenko@linux.intel.com>
The register space of a certain capability starts at the offset just after
the respective node in the capability list. It means that there are no fixed
offsets for them from SoC to SoC generation and they have to be calculated
at run-time. Improve capability support by adding the respective calculation
algorithm and in the result enable PWM on more platforms that currently may
use the wrong register.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/intel/pinctrl-intel.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 9d32bb8bc13a..adaa37a42754 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -53,8 +53,6 @@
#define PADOWN_MASK(p) (GENMASK(3, 0) << PADOWN_SHIFT(p))
#define PADOWN_GPP(p) ((p) / 8)
-#define PWMC 0x204
-
/* Offset from pad_regs */
#define PADCFG0 0x000
#define PADCFG0_RXEVCFG_MASK GENMASK(26, 25)
@@ -1549,8 +1547,10 @@ static int intel_pinctrl_pm_init(struct intel_pinctrl *pctrl)
}
static int intel_pinctrl_probe_pwm(struct intel_pinctrl *pctrl,
- struct intel_community *community)
+ struct intel_community *community,
+ unsigned short capability_offset)
{
+ void __iomem *base = community->regs + capability_offset + 4;
static const struct pwm_lpss_boardinfo info = {
.clk_rate = 19200000,
.npwm = 1,
@@ -1564,7 +1564,7 @@ static int intel_pinctrl_probe_pwm(struct intel_pinctrl *pctrl,
if (!IS_REACHABLE(CONFIG_PWM_LPSS))
return 0;
- chip = devm_pwm_lpss_probe(pctrl->dev, community->regs + PWMC, &info);
+ chip = devm_pwm_lpss_probe(pctrl->dev, base, &info);
return PTR_ERR_OR_ZERO(chip);
}
@@ -1595,6 +1595,7 @@ int intel_pinctrl_probe(struct platform_device *pdev,
for (i = 0; i < pctrl->ncommunities; i++) {
struct intel_community *community = &pctrl->communities[i];
+ unsigned short capability_offset[6];
void __iomem *regs;
u32 offset;
u32 value;
@@ -1622,15 +1623,19 @@ int intel_pinctrl_probe(struct platform_device *pdev,
switch ((value & CAPLIST_ID_MASK) >> CAPLIST_ID_SHIFT) {
case CAPLIST_ID_GPIO_HW_INFO:
community->features |= PINCTRL_FEATURE_GPIO_HW_INFO;
+ capability_offset[CAPLIST_ID_GPIO_HW_INFO] = offset;
break;
case CAPLIST_ID_PWM:
community->features |= PINCTRL_FEATURE_PWM;
+ capability_offset[CAPLIST_ID_PWM] = offset;
break;
case CAPLIST_ID_BLINK:
community->features |= PINCTRL_FEATURE_BLINK;
+ capability_offset[CAPLIST_ID_BLINK] = offset;
break;
case CAPLIST_ID_EXP:
community->features |= PINCTRL_FEATURE_EXP;
+ capability_offset[CAPLIST_ID_EXP] = offset;
break;
default:
break;
@@ -1653,7 +1658,7 @@ int intel_pinctrl_probe(struct platform_device *pdev,
if (ret)
return ret;
- ret = intel_pinctrl_probe_pwm(pctrl, community);
+ ret = intel_pinctrl_probe_pwm(pctrl, community, capability_offset[CAPLIST_ID_PWM]);
if (ret)
return ret;
}
--
2.50.1
next prev parent reply other threads:[~2026-03-18 15:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 15:10 [PATCH v1 0/5] pinctrl: intel: capability handling rework Andy Shevchenko
2026-03-18 15:10 ` Andy Shevchenko [this message]
2026-03-19 5:57 ` [PATCH v1 1/5] pinctrl: intel: Improve capability support Mika Westerberg
2026-03-19 7:00 ` Andy Shevchenko
2026-03-18 15:10 ` [PATCH v1 2/5] pinctrl: intel: Fix the revision for new features (1kOhm PD, HW debouncer) Andy Shevchenko
2026-03-19 5:58 ` Mika Westerberg
2026-03-19 7:00 ` Andy Shevchenko
2026-03-18 15:10 ` [PATCH v1 3/5] pinctrl: intel: Enable 3-bit PAD_OWN feature Andy Shevchenko
2026-03-19 5:58 ` Mika Westerberg
2026-03-19 7:00 ` Andy Shevchenko
2026-03-18 15:10 ` [PATCH v1 4/5] pinctrl: intel: Refactor intel_gpio_add_pin_ranges() to make it shorter Andy Shevchenko
2026-03-19 6:03 ` Mika Westerberg
2026-03-19 6:56 ` Andy Shevchenko
2026-03-19 7:07 ` Mika Westerberg
2026-03-19 7:18 ` Andy Shevchenko
2026-03-18 15:10 ` [PATCH v1 5/5] pinctrl: intel: define iterator variables inside for-loop Andy Shevchenko
2026-03-19 6:02 ` Mika Westerberg
2026-03-19 6:57 ` Andy Shevchenko
2026-03-19 7:09 ` Mika Westerberg
2026-03-19 7:20 ` Andy Shevchenko
2026-03-19 10:41 ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260318151256.2590375-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox