Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: intel: Provide Intel pin control wide PM ops structure

With the help of EXPORT_NS_GPL_DEV_PM_OPS() and
NOIRQ_SYSTEM_SLEEP_PM_OPS() we may convert PM ops functions to become
static. This also takes into account the PM configuration options such
as CONFIG_PM and CONFIG_PM_SLEEP. Hence the first step is to provide
a generic PM ops structure that can be used by drivers directly.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20231030120734.2831419-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

+7 -5
+5 -3
drivers/pinctrl/intel/pinctrl-intel.c
··· 899 899 * 900 900 * Return: a GPIO offset, or negative error code if translation can't be done. 901 901 */ 902 - static __maybe_unused int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin) 902 + static int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin) 903 903 { 904 904 const struct intel_community *community; 905 905 const struct intel_padgroup *padgrp; ··· 1682 1682 } 1683 1683 EXPORT_SYMBOL_NS_GPL(intel_pinctrl_get_soc_data, PINCTRL_INTEL); 1684 1684 1685 - #ifdef CONFIG_PM_SLEEP 1686 1685 static bool __intel_gpio_is_direct_irq(u32 value) 1687 1686 { 1688 1687 return (value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) && ··· 1882 1883 return 0; 1883 1884 } 1884 1885 EXPORT_SYMBOL_GPL(intel_pinctrl_resume_noirq); 1885 - #endif 1886 + 1887 + EXPORT_NS_GPL_DEV_PM_OPS(intel_pinctrl_pm_ops, PINCTRL_INTEL) = { 1888 + NOIRQ_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend_noirq, intel_pinctrl_resume_noirq) 1889 + }; 1886 1890 1887 1891 MODULE_AUTHOR("Mathias Nyman <mathias.nyman@linux.intel.com>"); 1888 1892 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
+2 -2
drivers/pinctrl/intel/pinctrl-intel.h
··· 255 255 int intel_pinctrl_probe_by_hid(struct platform_device *pdev); 256 256 int intel_pinctrl_probe_by_uid(struct platform_device *pdev); 257 257 258 - #ifdef CONFIG_PM_SLEEP 259 258 int intel_pinctrl_suspend_noirq(struct device *dev); 260 259 int intel_pinctrl_resume_noirq(struct device *dev); 261 - #endif 262 260 263 261 #define INTEL_PINCTRL_PM_OPS(_name) \ 264 262 const struct dev_pm_ops _name = { \ 265 263 SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend_noirq, \ 266 264 intel_pinctrl_resume_noirq) \ 267 265 } 266 + 267 + extern const struct dev_pm_ops intel_pinctrl_pm_ops; 268 268 269 269 struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin); 270 270