pinctrl: intel: export common pinctrl functions
Export common pinctrl functions that are used across Intel specific platform drivers, so that they can be reused. Signed-off-by: Raag Jadav <raag.jadav@intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Link: https://lore.kernel.org/r/20230814060311.15945-2-raag.jadav@intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
06c2afb862
commit
25018ace79
|
@ -107,8 +107,7 @@ struct intel_community_context {
|
|||
#define pin_to_padno(c, p) ((p) - (c)->pin_base)
|
||||
#define padgroup_offset(g, p) ((p) - (g)->base)
|
||||
|
||||
static struct intel_community *intel_get_community(struct intel_pinctrl *pctrl,
|
||||
unsigned int pin)
|
||||
struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin)
|
||||
{
|
||||
struct intel_community *community;
|
||||
int i;
|
||||
|
@ -123,6 +122,7 @@ static struct intel_community *intel_get_community(struct intel_pinctrl *pctrl,
|
|||
dev_warn(pctrl->dev, "failed to find community for pin %u\n", pin);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(intel_get_community, PINCTRL_INTEL);
|
||||
|
||||
static const struct intel_padgroup *
|
||||
intel_community_get_padgroup(const struct intel_community *community,
|
||||
|
@ -276,23 +276,24 @@ static bool intel_pad_usable(struct intel_pinctrl *pctrl, unsigned int pin)
|
|||
return intel_pad_owned_by_host(pctrl, pin) && intel_pad_is_unlocked(pctrl, pin);
|
||||
}
|
||||
|
||||
static int intel_get_groups_count(struct pinctrl_dev *pctldev)
|
||||
int intel_get_groups_count(struct pinctrl_dev *pctldev)
|
||||
{
|
||||
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
|
||||
|
||||
return pctrl->soc->ngroups;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(intel_get_groups_count, PINCTRL_INTEL);
|
||||
|
||||
static const char *intel_get_group_name(struct pinctrl_dev *pctldev,
|
||||
unsigned int group)
|
||||
const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group)
|
||||
{
|
||||
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
|
||||
|
||||
return pctrl->soc->groups[group].grp.name;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(intel_get_group_name, PINCTRL_INTEL);
|
||||
|
||||
static int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
|
||||
const unsigned int **pins, unsigned int *npins)
|
||||
int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
|
||||
const unsigned int **pins, unsigned int *npins)
|
||||
{
|
||||
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
|
||||
|
||||
|
@ -300,6 +301,7 @@ static int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
|
|||
*npins = pctrl->soc->groups[group].grp.npins;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(intel_get_group_pins, PINCTRL_INTEL);
|
||||
|
||||
static void intel_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
|
||||
unsigned int pin)
|
||||
|
@ -359,25 +361,24 @@ static const struct pinctrl_ops intel_pinctrl_ops = {
|
|||
.pin_dbg_show = intel_pin_dbg_show,
|
||||
};
|
||||
|
||||
static int intel_get_functions_count(struct pinctrl_dev *pctldev)
|
||||
int intel_get_functions_count(struct pinctrl_dev *pctldev)
|
||||
{
|
||||
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
|
||||
|
||||
return pctrl->soc->nfunctions;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(intel_get_functions_count, PINCTRL_INTEL);
|
||||
|
||||
static const char *intel_get_function_name(struct pinctrl_dev *pctldev,
|
||||
unsigned int function)
|
||||
const char *intel_get_function_name(struct pinctrl_dev *pctldev, unsigned int function)
|
||||
{
|
||||
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
|
||||
|
||||
return pctrl->soc->functions[function].func.name;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(intel_get_function_name, PINCTRL_INTEL);
|
||||
|
||||
static int intel_get_function_groups(struct pinctrl_dev *pctldev,
|
||||
unsigned int function,
|
||||
const char * const **groups,
|
||||
unsigned int * const ngroups)
|
||||
int intel_get_function_groups(struct pinctrl_dev *pctldev, unsigned int function,
|
||||
const char * const **groups, unsigned int * const ngroups)
|
||||
{
|
||||
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
|
||||
|
||||
|
@ -385,6 +386,7 @@ static int intel_get_function_groups(struct pinctrl_dev *pctldev,
|
|||
*ngroups = pctrl->soc->functions[function].func.ngroups;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(intel_get_function_groups, PINCTRL_INTEL);
|
||||
|
||||
static int intel_pinmux_set_mux(struct pinctrl_dev *pctldev,
|
||||
unsigned int function, unsigned int group)
|
||||
|
|
|
@ -266,4 +266,16 @@ const struct dev_pm_ops _name = { \
|
|||
intel_pinctrl_resume_noirq) \
|
||||
}
|
||||
|
||||
struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin);
|
||||
|
||||
int intel_get_groups_count(struct pinctrl_dev *pctldev);
|
||||
const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group);
|
||||
int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
|
||||
const unsigned int **pins, unsigned int *npins);
|
||||
|
||||
int intel_get_functions_count(struct pinctrl_dev *pctldev);
|
||||
const char *intel_get_function_name(struct pinctrl_dev *pctldev, unsigned int function);
|
||||
int intel_get_function_groups(struct pinctrl_dev *pctldev, unsigned int function,
|
||||
const char * const **groups, unsigned int * const ngroups);
|
||||
|
||||
#endif /* PINCTRL_INTEL_H */
|
||||
|
|
Loading…
Reference in New Issue