Skip to content

Commit 3ea2e2c

Browse files
committed
pinctrl: cherryview: Switch to use struct intel_pinctrl
Now when all preparations are done we may easily switch to use struct intel_pinctrl instead of custom one. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent 8a82857 commit 3ea2e2c

1 file changed

Lines changed: 39 additions & 65 deletions

File tree

‎drivers/pinctrl/intel/pinctrl-cherryview.c‎

Lines changed: 39 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -82,32 +82,6 @@ struct intel_community_context {
8282
u32 saved_intmask;
8383
};
8484

85-
/**
86-
* struct chv_pinctrl - CHV pinctrl private structure
87-
* @dev: Pointer to the parent device
88-
* @pctldesc: Pin controller description
89-
* @pctldev: Pointer to the pin controller device
90-
* @chip: GPIO chip in this pin controller
91-
* @irqchip: IRQ chip in this pin controller
92-
* @soc: Community specific pin configuration data
93-
* @communities: All communities in this pin controller
94-
* @ncommunities: Number of communities in this pin controller
95-
* @context: Configuration saved over system sleep
96-
* @irq: Our parent irq
97-
*/
98-
struct chv_pinctrl {
99-
struct device *dev;
100-
struct pinctrl_desc pctldesc;
101-
struct pinctrl_dev *pctldev;
102-
struct gpio_chip chip;
103-
struct irq_chip irqchip;
104-
const struct intel_pinctrl_soc_data *soc;
105-
struct intel_community *communities;
106-
size_t ncommunities;
107-
struct intel_pinctrl_context context;
108-
int irq;
109-
};
110-
11185
#define PINMODE_INVERT_OE BIT(15)
11286

11387
#define PINMODE(m, i) ((m) | ((i) * PINMODE_INVERT_OE))
@@ -589,14 +563,14 @@ static const struct intel_pinctrl_soc_data *chv_soc_data[] = {
589563
*/
590564
static DEFINE_RAW_SPINLOCK(chv_lock);
591565

592-
static u32 chv_pctrl_readl(struct chv_pinctrl *pctrl, unsigned int offset)
566+
static u32 chv_pctrl_readl(struct intel_pinctrl *pctrl, unsigned int offset)
593567
{
594568
const struct intel_community *community = &pctrl->communities[0];
595569

596570
return readl(community->regs + offset);
597571
}
598572

599-
static void chv_pctrl_writel(struct chv_pinctrl *pctrl, unsigned int offset, u32 value)
573+
static void chv_pctrl_writel(struct intel_pinctrl *pctrl, unsigned int offset, u32 value)
600574
{
601575
const struct intel_community *community = &pctrl->communities[0];
602576
void __iomem *reg = community->regs + offset;
@@ -606,7 +580,7 @@ static void chv_pctrl_writel(struct chv_pinctrl *pctrl, unsigned int offset, u32
606580
readl(reg);
607581
}
608582

609-
static void __iomem *chv_padreg(struct chv_pinctrl *pctrl, unsigned int offset,
583+
static void __iomem *chv_padreg(struct intel_pinctrl *pctrl, unsigned int offset,
610584
unsigned int reg)
611585
{
612586
const struct intel_community *community = &pctrl->communities[0];
@@ -618,12 +592,12 @@ static void __iomem *chv_padreg(struct chv_pinctrl *pctrl, unsigned int offset,
618592
return community->pad_regs + offset + reg;
619593
}
620594

621-
static u32 chv_readl(struct chv_pinctrl *pctrl, unsigned int pin, unsigned int offset)
595+
static u32 chv_readl(struct intel_pinctrl *pctrl, unsigned int pin, unsigned int offset)
622596
{
623597
return readl(chv_padreg(pctrl, pin, offset));
624598
}
625599

626-
static void chv_writel(struct chv_pinctrl *pctrl, unsigned int pin, unsigned int offset, u32 value)
600+
static void chv_writel(struct intel_pinctrl *pctrl, unsigned int pin, unsigned int offset, u32 value)
627601
{
628602
void __iomem *reg = chv_padreg(pctrl, pin, offset);
629603

@@ -633,30 +607,30 @@ static void chv_writel(struct chv_pinctrl *pctrl, unsigned int pin, unsigned int
633607
}
634608

635609
/* When Pad Cfg is locked, driver can only change GPIOTXState or GPIORXState */
636-
static bool chv_pad_locked(struct chv_pinctrl *pctrl, unsigned int offset)
610+
static bool chv_pad_locked(struct intel_pinctrl *pctrl, unsigned int offset)
637611
{
638612
return chv_readl(pctrl, offset, CHV_PADCTRL1) & CHV_PADCTRL1_CFGLOCK;
639613
}
640614

641615
static int chv_get_groups_count(struct pinctrl_dev *pctldev)
642616
{
643-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
617+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
644618

645619
return pctrl->soc->ngroups;
646620
}
647621

648622
static const char *chv_get_group_name(struct pinctrl_dev *pctldev,
649623
unsigned int group)
650624
{
651-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
625+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
652626

653627
return pctrl->soc->groups[group].name;
654628
}
655629

656630
static int chv_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
657631
const unsigned int **pins, unsigned int *npins)
658632
{
659-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
633+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
660634

661635
*pins = pctrl->soc->groups[group].pins;
662636
*npins = pctrl->soc->groups[group].npins;
@@ -666,7 +640,7 @@ static int chv_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
666640
static void chv_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
667641
unsigned int offset)
668642
{
669-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
643+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
670644
unsigned long flags;
671645
u32 ctrl0, ctrl1;
672646
bool locked;
@@ -705,15 +679,15 @@ static const struct pinctrl_ops chv_pinctrl_ops = {
705679

706680
static int chv_get_functions_count(struct pinctrl_dev *pctldev)
707681
{
708-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
682+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
709683

710684
return pctrl->soc->nfunctions;
711685
}
712686

713687
static const char *chv_get_function_name(struct pinctrl_dev *pctldev,
714688
unsigned int function)
715689
{
716-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
690+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
717691

718692
return pctrl->soc->functions[function].name;
719693
}
@@ -723,7 +697,7 @@ static int chv_get_function_groups(struct pinctrl_dev *pctldev,
723697
const char * const **groups,
724698
unsigned int * const ngroups)
725699
{
726-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
700+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
727701

728702
*groups = pctrl->soc->functions[function].groups;
729703
*ngroups = pctrl->soc->functions[function].ngroups;
@@ -733,7 +707,7 @@ static int chv_get_function_groups(struct pinctrl_dev *pctldev,
733707
static int chv_pinmux_set_mux(struct pinctrl_dev *pctldev,
734708
unsigned int function, unsigned int group)
735709
{
736-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
710+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
737711
const struct intel_pingroup *grp;
738712
unsigned long flags;
739713
int i;
@@ -791,7 +765,7 @@ static int chv_pinmux_set_mux(struct pinctrl_dev *pctldev,
791765
return 0;
792766
}
793767

794-
static void chv_gpio_clear_triggering(struct chv_pinctrl *pctrl,
768+
static void chv_gpio_clear_triggering(struct intel_pinctrl *pctrl,
795769
unsigned int offset)
796770
{
797771
u32 value;
@@ -806,7 +780,7 @@ static int chv_gpio_request_enable(struct pinctrl_dev *pctldev,
806780
struct pinctrl_gpio_range *range,
807781
unsigned int offset)
808782
{
809-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
783+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
810784
unsigned long flags;
811785
u32 value;
812786

@@ -860,7 +834,7 @@ static void chv_gpio_disable_free(struct pinctrl_dev *pctldev,
860834
struct pinctrl_gpio_range *range,
861835
unsigned int offset)
862836
{
863-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
837+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
864838
unsigned long flags;
865839

866840
raw_spin_lock_irqsave(&chv_lock, flags);
@@ -875,7 +849,7 @@ static int chv_gpio_set_direction(struct pinctrl_dev *pctldev,
875849
struct pinctrl_gpio_range *range,
876850
unsigned int offset, bool input)
877851
{
878-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
852+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
879853
unsigned long flags;
880854
u32 ctrl0;
881855

@@ -906,7 +880,7 @@ static const struct pinmux_ops chv_pinmux_ops = {
906880
static int chv_config_get(struct pinctrl_dev *pctldev, unsigned int pin,
907881
unsigned long *config)
908882
{
909-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
883+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
910884
enum pin_config_param param = pinconf_to_config_param(*config);
911885
unsigned long flags;
912886
u32 ctrl0, ctrl1;
@@ -983,7 +957,7 @@ static int chv_config_get(struct pinctrl_dev *pctldev, unsigned int pin,
983957
return 0;
984958
}
985959

986-
static int chv_config_set_pull(struct chv_pinctrl *pctrl, unsigned int pin,
960+
static int chv_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin,
987961
enum pin_config_param param, u32 arg)
988962
{
989963
unsigned long flags;
@@ -1048,7 +1022,7 @@ static int chv_config_set_pull(struct chv_pinctrl *pctrl, unsigned int pin,
10481022
return 0;
10491023
}
10501024

1051-
static int chv_config_set_oden(struct chv_pinctrl *pctrl, unsigned int pin,
1025+
static int chv_config_set_oden(struct intel_pinctrl *pctrl, unsigned int pin,
10521026
bool enable)
10531027
{
10541028
unsigned long flags;
@@ -1071,7 +1045,7 @@ static int chv_config_set_oden(struct chv_pinctrl *pctrl, unsigned int pin,
10711045
static int chv_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
10721046
unsigned long *configs, unsigned int nconfigs)
10731047
{
1074-
struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
1048+
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
10751049
enum pin_config_param param;
10761050
int i, ret;
10771051
u32 arg;
@@ -1172,7 +1146,7 @@ static struct pinctrl_desc chv_pinctrl_desc = {
11721146

11731147
static int chv_gpio_get(struct gpio_chip *chip, unsigned int offset)
11741148
{
1175-
struct chv_pinctrl *pctrl = gpiochip_get_data(chip);
1149+
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
11761150
unsigned long flags;
11771151
u32 ctrl0, cfg;
11781152

@@ -1190,7 +1164,7 @@ static int chv_gpio_get(struct gpio_chip *chip, unsigned int offset)
11901164

11911165
static void chv_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
11921166
{
1193-
struct chv_pinctrl *pctrl = gpiochip_get_data(chip);
1167+
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
11941168
unsigned long flags;
11951169
u32 ctrl0;
11961170

@@ -1210,7 +1184,7 @@ static void chv_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
12101184

12111185
static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
12121186
{
1213-
struct chv_pinctrl *pctrl = gpiochip_get_data(chip);
1187+
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
12141188
u32 ctrl0, direction;
12151189
unsigned long flags;
12161190

@@ -1253,7 +1227,7 @@ static const struct gpio_chip chv_gpio_chip = {
12531227
static void chv_gpio_irq_ack(struct irq_data *d)
12541228
{
12551229
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1256-
struct chv_pinctrl *pctrl = gpiochip_get_data(gc);
1230+
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
12571231
int pin = irqd_to_hwirq(d);
12581232
u32 intr_line;
12591233

@@ -1270,7 +1244,7 @@ static void chv_gpio_irq_ack(struct irq_data *d)
12701244
static void chv_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
12711245
{
12721246
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1273-
struct chv_pinctrl *pctrl = gpiochip_get_data(gc);
1247+
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
12741248
int pin = irqd_to_hwirq(d);
12751249
u32 value, intr_line;
12761250
unsigned long flags;
@@ -1315,7 +1289,7 @@ static unsigned chv_gpio_irq_startup(struct irq_data *d)
13151289
*/
13161290
if (irqd_get_trigger_type(d) == IRQ_TYPE_NONE) {
13171291
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1318-
struct chv_pinctrl *pctrl = gpiochip_get_data(gc);
1292+
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
13191293
struct intel_community_context *cctx = &pctrl->context.communities[0];
13201294
unsigned int pin = irqd_to_hwirq(d);
13211295
irq_flow_handler_t handler;
@@ -1347,7 +1321,7 @@ static unsigned chv_gpio_irq_startup(struct irq_data *d)
13471321
static int chv_gpio_irq_type(struct irq_data *d, unsigned int type)
13481322
{
13491323
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1350-
struct chv_pinctrl *pctrl = gpiochip_get_data(gc);
1324+
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
13511325
struct intel_community_context *cctx = &pctrl->context.communities[0];
13521326
unsigned int pin = irqd_to_hwirq(d);
13531327
unsigned long flags;
@@ -1408,7 +1382,7 @@ static int chv_gpio_irq_type(struct irq_data *d, unsigned int type)
14081382
static void chv_gpio_irq_handler(struct irq_desc *desc)
14091383
{
14101384
struct gpio_chip *gc = irq_desc_get_handler_data(desc);
1411-
struct chv_pinctrl *pctrl = gpiochip_get_data(gc);
1385+
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
14121386
const struct intel_community *community = &pctrl->communities[0];
14131387
struct intel_community_context *cctx = &pctrl->context.communities[0];
14141388
struct irq_chip *chip = irq_desc_get_chip(desc);
@@ -1478,7 +1452,7 @@ static void chv_init_irq_valid_mask(struct gpio_chip *chip,
14781452
unsigned long *valid_mask,
14791453
unsigned int ngpios)
14801454
{
1481-
struct chv_pinctrl *pctrl = gpiochip_get_data(chip);
1455+
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
14821456
const struct intel_community *community = &pctrl->communities[0];
14831457
int i;
14841458

@@ -1500,7 +1474,7 @@ static void chv_init_irq_valid_mask(struct gpio_chip *chip,
15001474

15011475
static int chv_gpio_irq_init_hw(struct gpio_chip *chip)
15021476
{
1503-
struct chv_pinctrl *pctrl = gpiochip_get_data(chip);
1477+
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
15041478
const struct intel_community *community = &pctrl->communities[0];
15051479

15061480
/*
@@ -1526,7 +1500,7 @@ static int chv_gpio_irq_init_hw(struct gpio_chip *chip)
15261500

15271501
static int chv_gpio_add_pin_ranges(struct gpio_chip *chip)
15281502
{
1529-
struct chv_pinctrl *pctrl = gpiochip_get_data(chip);
1503+
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
15301504
const struct intel_community *community = &pctrl->communities[0];
15311505
const struct intel_padgroup *gpp;
15321506
int ret, i;
@@ -1545,7 +1519,7 @@ static int chv_gpio_add_pin_ranges(struct gpio_chip *chip)
15451519
return 0;
15461520
}
15471521

1548-
static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
1522+
static int chv_gpio_probe(struct intel_pinctrl *pctrl, int irq)
15491523
{
15501524
const struct intel_community *community = &pctrl->communities[0];
15511525
const struct intel_padgroup *gpp;
@@ -1611,7 +1585,7 @@ static acpi_status chv_pinctrl_mmio_access_handler(u32 function,
16111585
acpi_physical_address address, u32 bits, u64 *value,
16121586
void *handler_context, void *region_context)
16131587
{
1614-
struct chv_pinctrl *pctrl = region_context;
1588+
struct intel_pinctrl *pctrl = region_context;
16151589
unsigned long flags;
16161590
acpi_status ret = AE_OK;
16171591

@@ -1635,7 +1609,7 @@ static int chv_pinctrl_probe(struct platform_device *pdev)
16351609
const struct intel_pinctrl_soc_data **soc_table;
16361610
struct intel_community *community;
16371611
struct device *dev = &pdev->dev;
1638-
struct chv_pinctrl *pctrl;
1612+
struct intel_pinctrl *pctrl;
16391613
struct acpi_device *adev;
16401614
acpi_status status;
16411615
int ret, irq, i;
@@ -1723,7 +1697,7 @@ static int chv_pinctrl_probe(struct platform_device *pdev)
17231697

17241698
static int chv_pinctrl_remove(struct platform_device *pdev)
17251699
{
1726-
struct chv_pinctrl *pctrl = platform_get_drvdata(pdev);
1700+
struct intel_pinctrl *pctrl = platform_get_drvdata(pdev);
17271701
const struct intel_community *community = &pctrl->communities[0];
17281702

17291703
acpi_remove_address_space_handler(ACPI_COMPANION(&pdev->dev),
@@ -1736,7 +1710,7 @@ static int chv_pinctrl_remove(struct platform_device *pdev)
17361710
#ifdef CONFIG_PM_SLEEP
17371711
static int chv_pinctrl_suspend_noirq(struct device *dev)
17381712
{
1739-
struct chv_pinctrl *pctrl = dev_get_drvdata(dev);
1713+
struct intel_pinctrl *pctrl = dev_get_drvdata(dev);
17401714
struct intel_community_context *cctx = &pctrl->context.communities[0];
17411715
unsigned long flags;
17421716
int i;
@@ -1766,7 +1740,7 @@ static int chv_pinctrl_suspend_noirq(struct device *dev)
17661740

17671741
static int chv_pinctrl_resume_noirq(struct device *dev)
17681742
{
1769-
struct chv_pinctrl *pctrl = dev_get_drvdata(dev);
1743+
struct intel_pinctrl *pctrl = dev_get_drvdata(dev);
17701744
struct intel_community_context *cctx = &pctrl->context.communities[0];
17711745
unsigned long flags;
17721746
int i;

0 commit comments

Comments
 (0)