pinctrl: lynxpoint: reuse common functions from pinctrl-intel

Reuse common functions from pinctrl-intel driver.
While at it, select pinctrl-intel for Intel Lynxpoint driver.

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-5-raag.jadav@intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
Raag Jadav 2023-08-14 11:33:11 +05:30 committed by Andy Shevchenko
parent a2118cebc6
commit 976cf4a6ee
2 changed files with 9 additions and 83 deletions

View file

@ -26,11 +26,7 @@ config PINCTRL_CHERRYVIEW
config PINCTRL_LYNXPOINT config PINCTRL_LYNXPOINT
tristate "Intel Lynxpoint pinctrl and GPIO driver" tristate "Intel Lynxpoint pinctrl and GPIO driver"
depends on ACPI depends on ACPI
select PINMUX select PINCTRL_INTEL
select PINCONF
select GENERIC_PINCONF
select GPIOLIB
select GPIOLIB_IRQCHIP
help help
Lynxpoint is the PCH of Intel Haswell. This pinctrl driver Lynxpoint is the PCH of Intel Haswell. This pinctrl driver
provides an interface that allows configuring of PCH pins and provides an interface that allows configuring of PCH pins and

View file

@ -206,21 +206,6 @@ static const struct intel_pinctrl_soc_data lptlp_soc_data = {
* IOxAPIC redirection map applies only for gpio 8-10, 13-14, 45-55. * IOxAPIC redirection map applies only for gpio 8-10, 13-14, 45-55.
*/ */
static struct intel_community *lp_get_community(struct intel_pinctrl *lg,
unsigned int pin)
{
struct intel_community *comm;
int i;
for (i = 0; i < lg->ncommunities; i++) {
comm = &lg->communities[i];
if (pin < comm->pin_base + comm->npins && pin >= comm->pin_base)
return comm;
}
return NULL;
}
static void __iomem *lp_gpio_reg(struct gpio_chip *chip, unsigned int offset, static void __iomem *lp_gpio_reg(struct gpio_chip *chip, unsigned int offset,
int reg) int reg)
{ {
@ -228,7 +213,7 @@ static void __iomem *lp_gpio_reg(struct gpio_chip *chip, unsigned int offset,
struct intel_community *comm; struct intel_community *comm;
int reg_offset; int reg_offset;
comm = lp_get_community(lg, offset); comm = intel_get_community(lg, offset);
if (!comm) if (!comm)
return NULL; return NULL;
@ -272,34 +257,6 @@ static bool lp_gpio_ioxapic_use(struct gpio_chip *chip, unsigned int offset)
return false; return false;
} }
static int lp_get_groups_count(struct pinctrl_dev *pctldev)
{
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
return lg->soc->ngroups;
}
static const char *lp_get_group_name(struct pinctrl_dev *pctldev,
unsigned int selector)
{
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
return lg->soc->groups[selector].grp.name;
}
static int lp_get_group_pins(struct pinctrl_dev *pctldev,
unsigned int selector,
const unsigned int **pins,
unsigned int *num_pins)
{
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
*pins = lg->soc->groups[selector].grp.pins;
*num_pins = lg->soc->groups[selector].grp.npins;
return 0;
}
static void lp_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, static void lp_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
unsigned int pin) unsigned int pin)
{ {
@ -323,40 +280,12 @@ static void lp_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
} }
static const struct pinctrl_ops lptlp_pinctrl_ops = { static const struct pinctrl_ops lptlp_pinctrl_ops = {
.get_groups_count = lp_get_groups_count, .get_groups_count = intel_get_groups_count,
.get_group_name = lp_get_group_name, .get_group_name = intel_get_group_name,
.get_group_pins = lp_get_group_pins, .get_group_pins = intel_get_group_pins,
.pin_dbg_show = lp_pin_dbg_show, .pin_dbg_show = lp_pin_dbg_show,
}; };
static int lp_get_functions_count(struct pinctrl_dev *pctldev)
{
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
return lg->soc->nfunctions;
}
static const char *lp_get_function_name(struct pinctrl_dev *pctldev,
unsigned int selector)
{
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
return lg->soc->functions[selector].func.name;
}
static int lp_get_function_groups(struct pinctrl_dev *pctldev,
unsigned int selector,
const char * const **groups,
unsigned int *ngroups)
{
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
*groups = lg->soc->functions[selector].func.groups;
*ngroups = lg->soc->functions[selector].func.ngroups;
return 0;
}
static int lp_pinmux_set_mux(struct pinctrl_dev *pctldev, static int lp_pinmux_set_mux(struct pinctrl_dev *pctldev,
unsigned int function, unsigned int group) unsigned int function, unsigned int group)
{ {
@ -481,9 +410,9 @@ static int lp_gpio_set_direction(struct pinctrl_dev *pctldev,
} }
static const struct pinmux_ops lptlp_pinmux_ops = { static const struct pinmux_ops lptlp_pinmux_ops = {
.get_functions_count = lp_get_functions_count, .get_functions_count = intel_get_functions_count,
.get_function_name = lp_get_function_name, .get_function_name = intel_get_function_name,
.get_function_groups = lp_get_function_groups, .get_function_groups = intel_get_function_groups,
.set_mux = lp_pinmux_set_mux, .set_mux = lp_pinmux_set_mux,
.gpio_request_enable = lp_gpio_request_enable, .gpio_request_enable = lp_gpio_request_enable,
.gpio_disable_free = lp_gpio_disable_free, .gpio_disable_free = lp_gpio_disable_free,
@ -987,3 +916,4 @@ MODULE_AUTHOR("Andy Shevchenko (Intel)");
MODULE_DESCRIPTION("Intel Lynxpoint pinctrl driver"); MODULE_DESCRIPTION("Intel Lynxpoint pinctrl driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:lp_gpio"); MODULE_ALIAS("platform:lp_gpio");
MODULE_IMPORT_NS(PINCTRL_INTEL);