All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Mika Westerberg" <mika.westerberg@linux.intel.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Linus Walleij" <linusw@kernel.org>,
	"Radek Válko" <rvalko@lipicko.cz>
Subject: [PATCH v1 2/2] pinctrl: intel: Try to retrieve driver data for pure platform drivers
Date: Mon, 31 Aug 2026 16:25:47 +0200	[thread overview]
Message-ID: <20260831142853.1995573-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20260831142853.1995573-1-andriy.shevchenko@linux.intel.com>

The Denverton pinctrl device can be instantiated by the Intel LPC
driver as an MFD platform device named "denverton-pinctrl".

On affected systems the platform device does not carry the INTC3000
ACPI match data itself. As a result, intel_pinctrl_probe_by_hid()
fails to obtain the SoC data using device_get_match_data() and
returns -ENODATA.

This might be also true for other platforms that can be enumerated
by ACPI _HID. Fix the above by trying the pure platform driver data
in case the firmware node is not set or doesn't carry the necessary
information.

Reported-by: Radek Válko <rvalko@lipicko.cz>
Closes: https://lore.kernel.org/r/20260827184259.32386-1-rvalko@lipicko.cz
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-intel.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 7aa7f81ac405..50ffad6a7610 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -1716,13 +1716,32 @@ int intel_pinctrl_probe(struct platform_device *pdev,
 }
 EXPORT_SYMBOL_NS_GPL(intel_pinctrl_probe, "PINCTRL_INTEL");
 
+static const struct intel_pinctrl_soc_data *
+intel_pinctrl_get_soc_data_by_hid(struct platform_device *pdev)
+{
+	const struct intel_pinctrl_soc_data *data;
+	const struct platform_device_id *id;
+	struct device *dev = &pdev->dev;
+
+	data = device_get_match_data(dev);
+	if (data)
+		return data;
+
+	id = platform_get_device_id(pdev);
+	if (!id)
+		return ERR_PTR(-ENODEV);
+
+	data = (const struct intel_pinctrl_soc_data *)id->driver_data;
+	return data ?: ERR_PTR(-ENODATA);
+}
+
 int intel_pinctrl_probe_by_hid(struct platform_device *pdev)
 {
 	const struct intel_pinctrl_soc_data *data;
 
-	data = device_get_match_data(&pdev->dev);
-	if (!data)
-		return -ENODATA;
+	data = intel_pinctrl_get_soc_data_by_hid(pdev);
+	if (IS_ERR(data))
+		return PTR_ERR(data);
 
 	return intel_pinctrl_probe(pdev, data);
 }
-- 
2.50.1


  parent reply	other threads:[~2026-08-31 14:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 14:25 [PATCH v1 0/2] pinctrl: intel: retrieve pure platform driver data as well Andy Shevchenko
2026-08-31 14:25 ` [PATCH v1 1/2] pinctrl: intel: Move intel_pinctrl_get_soc_data() upper in the code Andy Shevchenko
2026-08-31 14:25 ` Andy Shevchenko [this message]
2026-09-01 10:24   ` [PATCH v1 2/2] pinctrl: intel: Try to retrieve driver data for pure platform drivers Mika Westerberg
2026-09-01 10:27     ` Andy Shevchenko
2026-09-01 14:45       ` Radek Válko
2026-09-02 18:12   ` Radek Válko

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=20260831142853.1995573-3-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 \
    --cc=rvalko@lipicko.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.