Skip to content

Commit 976cf4a

Browse files
raagjadavandy-shev
authored andcommitted
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>
1 parent a2118ce commit 976cf4a

File tree

2 files changed

+9
-83
lines changed

2 files changed

+9
-83
lines changed

drivers/pinctrl/intel/Kconfig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ config PINCTRL_CHERRYVIEW
2626
config PINCTRL_LYNXPOINT
2727
tristate "Intel Lynxpoint pinctrl and GPIO driver"
2828
depends on ACPI
29-
select PINMUX
30-
select PINCONF
31-
select GENERIC_PINCONF
32-
select GPIOLIB
33-
select GPIOLIB_IRQCHIP
29+
select PINCTRL_INTEL
3430
help
3531
Lynxpoint is the PCH of Intel Haswell. This pinctrl driver
3632
provides an interface that allows configuring of PCH pins and

drivers/pinctrl/intel/pinctrl-lynxpoint.c

Lines changed: 8 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -206,29 +206,14 @@ static const struct intel_pinctrl_soc_data lptlp_soc_data = {
206206
* IOxAPIC redirection map applies only for gpio 8-10, 13-14, 45-55.
207207
*/
208208

209-
static struct intel_community *lp_get_community(struct intel_pinctrl *lg,
210-
unsigned int pin)
211-
{
212-
struct intel_community *comm;
213-
int i;
214-
215-
for (i = 0; i < lg->ncommunities; i++) {
216-
comm = &lg->communities[i];
217-
if (pin < comm->pin_base + comm->npins && pin >= comm->pin_base)
218-
return comm;
219-
}
220-
221-
return NULL;
222-
}
223-
224209
static void __iomem *lp_gpio_reg(struct gpio_chip *chip, unsigned int offset,
225210
int reg)
226211
{
227212
struct intel_pinctrl *lg = gpiochip_get_data(chip);
228213
struct intel_community *comm;
229214
int reg_offset;
230215

231-
comm = lp_get_community(lg, offset);
216+
comm = intel_get_community(lg, offset);
232217
if (!comm)
233218
return NULL;
234219

@@ -272,34 +257,6 @@ static bool lp_gpio_ioxapic_use(struct gpio_chip *chip, unsigned int offset)
272257
return false;
273258
}
274259

275-
static int lp_get_groups_count(struct pinctrl_dev *pctldev)
276-
{
277-
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
278-
279-
return lg->soc->ngroups;
280-
}
281-
282-
static const char *lp_get_group_name(struct pinctrl_dev *pctldev,
283-
unsigned int selector)
284-
{
285-
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
286-
287-
return lg->soc->groups[selector].grp.name;
288-
}
289-
290-
static int lp_get_group_pins(struct pinctrl_dev *pctldev,
291-
unsigned int selector,
292-
const unsigned int **pins,
293-
unsigned int *num_pins)
294-
{
295-
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
296-
297-
*pins = lg->soc->groups[selector].grp.pins;
298-
*num_pins = lg->soc->groups[selector].grp.npins;
299-
300-
return 0;
301-
}
302-
303260
static void lp_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
304261
unsigned int pin)
305262
{
@@ -323,40 +280,12 @@ static void lp_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
323280
}
324281

325282
static const struct pinctrl_ops lptlp_pinctrl_ops = {
326-
.get_groups_count = lp_get_groups_count,
327-
.get_group_name = lp_get_group_name,
328-
.get_group_pins = lp_get_group_pins,
283+
.get_groups_count = intel_get_groups_count,
284+
.get_group_name = intel_get_group_name,
285+
.get_group_pins = intel_get_group_pins,
329286
.pin_dbg_show = lp_pin_dbg_show,
330287
};
331288

332-
static int lp_get_functions_count(struct pinctrl_dev *pctldev)
333-
{
334-
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
335-
336-
return lg->soc->nfunctions;
337-
}
338-
339-
static const char *lp_get_function_name(struct pinctrl_dev *pctldev,
340-
unsigned int selector)
341-
{
342-
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
343-
344-
return lg->soc->functions[selector].func.name;
345-
}
346-
347-
static int lp_get_function_groups(struct pinctrl_dev *pctldev,
348-
unsigned int selector,
349-
const char * const **groups,
350-
unsigned int *ngroups)
351-
{
352-
struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
353-
354-
*groups = lg->soc->functions[selector].func.groups;
355-
*ngroups = lg->soc->functions[selector].func.ngroups;
356-
357-
return 0;
358-
}
359-
360289
static int lp_pinmux_set_mux(struct pinctrl_dev *pctldev,
361290
unsigned int function, unsigned int group)
362291
{
@@ -481,9 +410,9 @@ static int lp_gpio_set_direction(struct pinctrl_dev *pctldev,
481410
}
482411

483412
static const struct pinmux_ops lptlp_pinmux_ops = {
484-
.get_functions_count = lp_get_functions_count,
485-
.get_function_name = lp_get_function_name,
486-
.get_function_groups = lp_get_function_groups,
413+
.get_functions_count = intel_get_functions_count,
414+
.get_function_name = intel_get_function_name,
415+
.get_function_groups = intel_get_function_groups,
487416
.set_mux = lp_pinmux_set_mux,
488417
.gpio_request_enable = lp_gpio_request_enable,
489418
.gpio_disable_free = lp_gpio_disable_free,
@@ -987,3 +916,4 @@ MODULE_AUTHOR("Andy Shevchenko (Intel)");
987916
MODULE_DESCRIPTION("Intel Lynxpoint pinctrl driver");
988917
MODULE_LICENSE("GPL v2");
989918
MODULE_ALIAS("platform:lp_gpio");
919+
MODULE_IMPORT_NS(PINCTRL_INTEL);

0 commit comments

Comments
 (0)