Skip to content

Commit 57db74b

Browse files
committed
pinctrl: baytrail: 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 8f0b4cc commit 57db74b

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

drivers/pinctrl/intel/pinctrl-baytrail.c

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,12 @@ struct intel_pad_context {
101101
u32 val;
102102
};
103103

104-
#define COMMUNITY(p, n, map) \
104+
#define BYT_COMMUNITY(p, n, g, map) \
105105
{ \
106106
.pin_base = (p), \
107107
.npins = (n), \
108+
.gpps = (g), \
109+
.ngpps = ARRAY_SIZE(g), \
108110
.pad_map = (map),\
109111
}
110112

@@ -360,8 +362,15 @@ static const struct intel_function byt_score_functions[] = {
360362
FUNCTION("gpio", byt_score_gpio_groups),
361363
};
362364

365+
static const struct intel_padgroup byt_score_gpps[] = {
366+
INTEL_GPP(0, 0, 31, 0),
367+
INTEL_GPP(1, 32, 63, 32),
368+
INTEL_GPP(2, 64, 95, 64),
369+
INTEL_GPP(3, 96, 101, 96),
370+
};
371+
363372
static const struct intel_community byt_score_communities[] = {
364-
COMMUNITY(0, BYT_NGPIO_SCORE, byt_score_pins_map),
373+
BYT_COMMUNITY(0, 102, byt_score_gpps, byt_score_pins_map),
365374
};
366375

367376
static const struct intel_pinctrl_soc_data byt_score_soc_data = {
@@ -483,8 +492,13 @@ static const struct intel_function byt_sus_functions[] = {
483492
FUNCTION("pmu_clk", byt_sus_pmu_clk_groups),
484493
};
485494

495+
static const struct intel_padgroup byt_sus_gpps[] = {
496+
INTEL_GPP(0, 0, 31, 0),
497+
INTEL_GPP(1, 32, 43, 32),
498+
};
499+
486500
static const struct intel_community byt_sus_communities[] = {
487-
COMMUNITY(0, BYT_NGPIO_SUS, byt_sus_pins_map),
501+
BYT_COMMUNITY(0, 44, byt_sus_gpps, byt_sus_pins_map),
488502
};
489503

490504
static const struct intel_pinctrl_soc_data byt_sus_soc_data = {
@@ -536,8 +550,12 @@ static const unsigned int byt_ncore_pins_map[BYT_NGPIO_NCORE] = {
536550
3, 6, 10, 13, 2, 5, 9, 7,
537551
};
538552

553+
static const struct intel_padgroup byt_ncore_gpps[] = {
554+
INTEL_GPP(0, 0, 27, 0),
555+
};
556+
539557
static const struct intel_community byt_ncore_communities[] = {
540-
COMMUNITY(0, BYT_NGPIO_NCORE, byt_ncore_pins_map),
558+
BYT_COMMUNITY(0, 28, byt_ncore_gpps, byt_ncore_pins_map),
541559
};
542560

543561
static const struct intel_pinctrl_soc_data byt_ncore_soc_data = {
@@ -1490,19 +1508,6 @@ static int byt_gpio_irq_init_hw(struct gpio_chip *chip)
14901508
return 0;
14911509
}
14921510

1493-
static int byt_gpio_add_pin_ranges(struct gpio_chip *chip)
1494-
{
1495-
struct intel_pinctrl *vg = gpiochip_get_data(chip);
1496-
struct device *dev = vg->dev;
1497-
int ret;
1498-
1499-
ret = gpiochip_add_pin_range(chip, dev_name(dev), 0, 0, vg->soc->npins);
1500-
if (ret)
1501-
return dev_err_probe(dev, ret, "failed to add GPIO pin range\n");
1502-
1503-
return 0;
1504-
}
1505-
15061511
static int byt_gpio_probe(struct intel_pinctrl *vg)
15071512
{
15081513
struct platform_device *pdev = to_platform_device(vg->dev);
@@ -1515,7 +1520,7 @@ static int byt_gpio_probe(struct intel_pinctrl *vg)
15151520
gc->label = dev_name(vg->dev);
15161521
gc->base = -1;
15171522
gc->can_sleep = false;
1518-
gc->add_pin_ranges = byt_gpio_add_pin_ranges;
1523+
gc->add_pin_ranges = intel_gpio_add_pin_ranges;
15191524
gc->parent = vg->dev;
15201525
gc->ngpio = vg->soc->npins;
15211526

0 commit comments

Comments
 (0)