Skip to content

Commit bfec8ce

Browse files
committed
pinctrl: lynxpoint: Convert to use intel_gpio_add_pin_ranges()
Driver is ready to use intel_gpio_add_pin_ranges() directly instead of custom approach. Convert it now. Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 57db74b commit bfec8ce

1 file changed

Lines changed: 11 additions & 16 deletions

File tree

drivers/pinctrl/intel/pinctrl-lynxpoint.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929

3030
#include "pinctrl-intel.h"
3131

32-
#define COMMUNITY(p, n) \
32+
#define LPTLP_COMMUNITY(p, n, g) \
3333
{ \
3434
.pin_base = (p), \
3535
.npins = (n), \
36+
.gpps = (g), \
37+
.ngpps = ARRAY_SIZE(g), \
3638
}
3739

3840
static const struct pinctrl_pin_desc lptlp_pins[] = {
@@ -133,8 +135,14 @@ static const struct pinctrl_pin_desc lptlp_pins[] = {
133135
PINCTRL_PIN(94, "GP94_UART0_CTSB"),
134136
};
135137

138+
static const struct intel_padgroup lptlp_gpps[] = {
139+
INTEL_GPP(0, 0, 31, 0),
140+
INTEL_GPP(1, 32, 63, 32),
141+
INTEL_GPP(2, 64, 94, 64),
142+
};
143+
136144
static const struct intel_community lptlp_communities[] = {
137-
COMMUNITY(0, 95),
145+
LPTLP_COMMUNITY(0, 95, lptlp_gpps),
138146
};
139147

140148
static const struct intel_pinctrl_soc_data lptlp_soc_data = {
@@ -692,19 +700,6 @@ static int lp_gpio_irq_init_hw(struct gpio_chip *chip)
692700
return 0;
693701
}
694702

695-
static int lp_gpio_add_pin_ranges(struct gpio_chip *chip)
696-
{
697-
struct intel_pinctrl *lg = gpiochip_get_data(chip);
698-
struct device *dev = lg->dev;
699-
int ret;
700-
701-
ret = gpiochip_add_pin_range(chip, dev_name(dev), 0, 0, lg->soc->npins);
702-
if (ret)
703-
return dev_err_probe(dev, ret, "failed to add GPIO pin range\n");
704-
705-
return 0;
706-
}
707-
708703
static int lp_gpio_probe(struct platform_device *pdev)
709704
{
710705
const struct intel_pinctrl_soc_data *soc;
@@ -777,7 +772,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
777772
gc->base = -1;
778773
gc->ngpio = LP_NUM_GPIO;
779774
gc->can_sleep = false;
780-
gc->add_pin_ranges = lp_gpio_add_pin_ranges;
775+
gc->add_pin_ranges = intel_gpio_add_pin_ranges;
781776
gc->parent = dev;
782777

783778
/* set up interrupts */

0 commit comments

Comments
 (0)