pinctrl: intel: retrieve pure platform driver data as well
Subsystems (3)
v2 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.
Changes v2:
- constified parameter in intel_pinctrl_get_soc_data() (Mika)
- added tag (Radek)
Andy Shevchenko (3):
pinctrl: intel: Move intel_pinctrl_get_soc_data() upper in the code
pinctrl: intel: constify parameter in intel_pinctrl_get_soc_data()
pinctrl: intel: Try to retrieve driver data for pure platform drivers
drivers/pinctrl/intel/pinctrl-intel.c | 51 ++++++++++++++++++--------- drivers/pinctrl/intel/pinctrl-intel.h | 2 +- 2 files changed, 36 insertions(+), 17 deletions(-)
Signature · 1 line
2.50.1
PATCH v2 1/3 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
@@ -1714,18 +1714,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;
@@ -1757,6 +1745,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 v2 2/3 pinctrl: intel: constify parameter in intel_pinctrl_get_soc_data()
In reply to Andy ShevchenkoThe parameter of intel_pinctrl_get_soc_data() is not going to be modified. Mark it with const qualifier.
--- drivers/pinctrl/intel/pinctrl-intel.c | 4 ++-- drivers/pinctrl/intel/pinctrl-intel.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/intel/pinctrl-intel.c +2 -2
@@ -1714,11 +1714,11 @@ int intel_pinctrl_probe_by_hid(struct platform_device *pdev) }EXPORT_SYMBOL_NS_GPL (intel_pinctrl_probe_by_hid,"PINCTRL_INTEL" ); -const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data (struct platform_device *pdev) +const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data (const struct platform_device *pdev) {const struct intel_pinctrl_soc_data *const *table;const struct intel_pinctrl_soc_data *data; -struct device *dev = &pdev->dev; +const struct device *dev = &pdev->dev; table =device_get_match_data (dev);if (table) {
drivers/pinctrl/intel/pinctrl-intel.h +1 -1
@@ -225,7 +225,7 @@ struct intel_pinctrl_soc_data {size_t ncommunities; }; -const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data (struct platform_device *pdev); +const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data (const struct platform_device *pdev);struct intel_pad_context ;struct intel_community_context ;
Signature · 1 line
2.50.1
PATCH v2 3/3 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
@@ -1702,13 +1702,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 (const struct platform_device *pdev) +{ +const struct intel_pinctrl_soc_data *data; +const struct device *dev = &pdev->dev; +const struct platform_device_id *id; + + 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
Quoted 8 lines · Andy Shevchenko
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.
Changes v2:
- constified parameter inintel_pinctrl_get_soc_data()(Mika)
- added tag (Radek)
Quoted 7 lines
Cc Radek Válko <[email protected]>Andy Shevchenko (3):
pinctrl: intel: Moveintel_pinctrl_get_soc_data()upper in the code
pinctrl: intel: constify parameter inintel_pinctrl_get_soc_data()
pinctrl: intel: Try to retrieve driver data for pure platform drivers
Quoted 9 lines · Mika Westerberg
Quoted 8 lines · Andy Shevchenko
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.
Changes v2:
- constified parameter inintel_pinctrl_get_soc_data()(Mika)
- added tag (Radek)
Quoted 8 lines
Quoted 6 lines
Cc Radek Válko <[email protected]>Andy Shevchenko (3):
pinctrl: intel: Moveintel_pinctrl_get_soc_data()upper in the code
pinctrl: intel: constify parameter inintel_pinctrl_get_soc_data()
pinctrl: intel: Try to retrieve driver data for pure platform driversAcked-by Mika Westerberg <[email protected]>
Pushed to my review and testing queue, thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko