pinctrl: intel: retrieve pure platform driver data as well
Subsystems (3)
cover pinctrl: intel: retrieve pure platform driver data as well
The reported platform can't be enumerated as it misses driver data associated with the firmware node. Instead we should use platform driver data. This mini-series to make it happen.
Radek, please test at least the second patch and provide your formal Tested-by tag in case it works as expected.
Andy Shevchenko (2):
pinctrl: intel: Move intel_pinctrl_get_soc_data() upper in the code
pinctrl: intel: Try to retrieve driver data for pure platform drivers
drivers/pinctrl/intel/pinctrl-intel.c | 47 +++++++++++++++++++-------- 1 file changed, 33 insertions(+), 14 deletions(-)
Signature · 1 line
2.50.1
PATCH 1/2 pinctrl: intel: Move intel_pinctrl_get_soc_data() upper in the code
While it's exported function, move it upper in the code to be on top of the local user. This brings a consistency to the follow change that will introduce similar helper for the intel_pinctrl_probe_by_hid().
--- drivers/pinctrl/intel/pinctrl-intel.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/pinctrl/intel/pinctrl-intel.c +12 -12
@@ -1728,18 +1728,6 @@ int intel_pinctrl_probe_by_hid(struct platform_device *pdev) }EXPORT_SYMBOL_NS_GPL (intel_pinctrl_probe_by_hid,"PINCTRL_INTEL" ); -int intel_pinctrl_probe_by_uid (struct platform_device *pdev) -{ -const struct intel_pinctrl_soc_data *data; - - data =intel_pinctrl_get_soc_data (pdev); -if (IS_ERR (data)) -return PTR_ERR (data); - -return intel_pinctrl_probe (pdev, data); -} -EXPORT_SYMBOL_NS_GPL (intel_pinctrl_probe_by_uid,"PINCTRL_INTEL" ); -const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data (struct platform_device *pdev) {const struct intel_pinctrl_soc_data *const *table;
@@ -1771,6 +1759,18 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_ }EXPORT_SYMBOL_NS_GPL (intel_pinctrl_get_soc_data,"PINCTRL_INTEL" ); +int intel_pinctrl_probe_by_uid (struct platform_device *pdev) +{ +const struct intel_pinctrl_soc_data *data; + + data =intel_pinctrl_get_soc_data (pdev); +if (IS_ERR (data)) +return PTR_ERR (data); + +return intel_pinctrl_probe (pdev, data); +} +EXPORT_SYMBOL_NS_GPL (intel_pinctrl_probe_by_uid,"PINCTRL_INTEL" ); +static bool __intel_gpio_is_direct_irq (u32 value) { return (value & PADCFG0_GPIROUTIOXAPIC) &&
Signature · 1 line
2.50.1
PATCH 2/2 pinctrl: intel: Try to retrieve driver data for pure platform drivers
In reply to Andy ShevchenkoThe 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.
--- drivers/pinctrl/intel/pinctrl-intel.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/pinctrl/intel/pinctrl-intel.c +22 -3
@@ -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); }
Signature · 1 line
2.50.1
Mika Westerberg
maintainerRe: [PATCH v1 2/2] pinctrl: intel: Try to retrieve driver data for pure platform drivers
Quoted 25 lines · Andy Shevchenko
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 usingdevice_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 <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/pinctrl/intel/pinctrl-intel.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)drivers/pinctrl/intel/pinctrl-intel.c +0
-0
drivers/pinctrl/intel/pinctrl-intel.c int intel_pinctrl_probe(struct platform_device *pdev, · line 1720
Quoted 5 lines
drivers/pinctrl/intel/pinctrl-intel.c +2
-0@@ -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)
pdev can be const, no?
Quoted 32 lines
drivers/pinctrl/intel/pinctrl-intel.c +20
-3+{ +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); }Signature · 1 line
2.50.1
Re: [PATCH v1 2/2] pinctrl: intel: Try to retrieve driver data for pure platform drivers
Quoted 3 lines · Mika Westerberg
Quoted 2 lines · Andy Shevchenko
The Denverton pinctrl device can be instantiated by the Intel LPC driver as an MFD platform device named "denverton-pinctrl".
...
Quoted 4 lines
drivers/pinctrl/intel/pinctrl-intel.c int intel_pinctrl_probe(struct platform_device *pdev, · line 1720
Quoted 2 lines
drivers/pinctrl/intel/pinctrl-intel.c +2
-0+static const struct intel_pinctrl_soc_data * +intel_pinctrl_get_soc_data_by_hid (struct platform_device *pdev)pdev can be const, no?
Yes, but it will require also to change the existing prototype for _uid case. After I get a confirmation the fix works I will issue a v2 with an additional patch included.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v1 2/2] pinctrl: intel: Try to retrieve driver data for pure platform drivers
Hi,
I test it hopefully tomorrow and will let you know.
Thanks.
Radek
Quoted 14 lines · Andy Shevchenko
Quoted 3 lines · Mika Westerberg
Quoted 2 lines · Andy Shevchenko
The Denverton pinctrl device can be instantiated by the Intel LPC driver as an MFD platform device named "denverton-pinctrl".
...
Quoted 3 lines
drivers/pinctrl/intel/pinctrl-intel.c int intel_pinctrl_probe(struct platform_device *pdev, · line 1720
Quoted 2 lines
drivers/pinctrl/intel/pinctrl-intel.c +2
-0+static const struct intel_pinctrl_soc_data * +intel_pinctrl_get_soc_data_by_hid (struct platform_device *pdev)pdev can be const, no?
Yes, but it will require also to change the existing prototype for
_uidcase. After I get a confirmation the fix works I will issue a v2 with an additional patch included.
Re: [PATCH v1 2/2] pinctrl: intel: Try to retrieve driver data for pure platform drivers
In reply to Andy ShevchenkoHi Andy,
thanks for the patch.
I tested [PATCH v1 2/2] successfully on the affected Intel Atom C3000 / Denverton system, first with Linux 6.12.105 and now also with Linux 6.12.107.
With the patch applied, the original -ENODATA (-61) probe failure is gone. The pinctrl device registers successfully:
denverton-pinctrl.0 yes yes
and the GPIO controller exposes all 154 lines:
gpiochip0 - 154 lines
Thanks,
Radek
Quoted 60 lines · Andy Shevchenko
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 usingdevice_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 <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/pinctrl/intel/pinctrl-intel.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)drivers/pinctrl/intel/pinctrl-intel.c +22
-3@@ -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); }