13
13
#include <linux/interrupt.h>
14
14
#include <linux/io.h>
15
15
#include <linux/kernel.h>
16
+ #include <linux/module.h>
16
17
#include <linux/types.h>
17
18
#include <linux/platform_device.h>
18
19
#include <linux/pm_runtime.h>
@@ -551,25 +552,10 @@ static const struct intel_pinctrl_soc_data *byt_soc_data[] = {
551
552
552
553
static DEFINE_RAW_SPINLOCK (byt_lock );
553
554
554
- static struct intel_community * byt_get_community (struct intel_pinctrl * vg ,
555
- unsigned int pin )
556
- {
557
- struct intel_community * comm ;
558
- int i ;
559
-
560
- for (i = 0 ; i < vg -> ncommunities ; i ++ ) {
561
- comm = vg -> communities + i ;
562
- if (pin < comm -> pin_base + comm -> npins && pin >= comm -> pin_base )
563
- return comm ;
564
- }
565
-
566
- return NULL ;
567
- }
568
-
569
555
static void __iomem * byt_gpio_reg (struct intel_pinctrl * vg , unsigned int offset ,
570
556
int reg )
571
557
{
572
- struct intel_community * comm = byt_get_community (vg , offset );
558
+ struct intel_community * comm = intel_get_community (vg , offset );
573
559
u32 reg_offset ;
574
560
575
561
if (!comm )
@@ -591,68 +577,12 @@ static void __iomem *byt_gpio_reg(struct intel_pinctrl *vg, unsigned int offset,
591
577
return comm -> pad_regs + reg_offset + reg ;
592
578
}
593
579
594
- static int byt_get_groups_count (struct pinctrl_dev * pctldev )
595
- {
596
- struct intel_pinctrl * vg = pinctrl_dev_get_drvdata (pctldev );
597
-
598
- return vg -> soc -> ngroups ;
599
- }
600
-
601
- static const char * byt_get_group_name (struct pinctrl_dev * pctldev ,
602
- unsigned int selector )
603
- {
604
- struct intel_pinctrl * vg = pinctrl_dev_get_drvdata (pctldev );
605
-
606
- return vg -> soc -> groups [selector ].grp .name ;
607
- }
608
-
609
- static int byt_get_group_pins (struct pinctrl_dev * pctldev ,
610
- unsigned int selector ,
611
- const unsigned int * * pins ,
612
- unsigned int * num_pins )
613
- {
614
- struct intel_pinctrl * vg = pinctrl_dev_get_drvdata (pctldev );
615
-
616
- * pins = vg -> soc -> groups [selector ].grp .pins ;
617
- * num_pins = vg -> soc -> groups [selector ].grp .npins ;
618
-
619
- return 0 ;
620
- }
621
-
622
580
static const struct pinctrl_ops byt_pinctrl_ops = {
623
- .get_groups_count = byt_get_groups_count ,
624
- .get_group_name = byt_get_group_name ,
625
- .get_group_pins = byt_get_group_pins ,
581
+ .get_groups_count = intel_get_groups_count ,
582
+ .get_group_name = intel_get_group_name ,
583
+ .get_group_pins = intel_get_group_pins ,
626
584
};
627
585
628
- static int byt_get_functions_count (struct pinctrl_dev * pctldev )
629
- {
630
- struct intel_pinctrl * vg = pinctrl_dev_get_drvdata (pctldev );
631
-
632
- return vg -> soc -> nfunctions ;
633
- }
634
-
635
- static const char * byt_get_function_name (struct pinctrl_dev * pctldev ,
636
- unsigned int selector )
637
- {
638
- struct intel_pinctrl * vg = pinctrl_dev_get_drvdata (pctldev );
639
-
640
- return vg -> soc -> functions [selector ].func .name ;
641
- }
642
-
643
- static int byt_get_function_groups (struct pinctrl_dev * pctldev ,
644
- unsigned int selector ,
645
- const char * const * * groups ,
646
- unsigned int * ngroups )
647
- {
648
- struct intel_pinctrl * vg = pinctrl_dev_get_drvdata (pctldev );
649
-
650
- * groups = vg -> soc -> functions [selector ].func .groups ;
651
- * ngroups = vg -> soc -> functions [selector ].func .ngroups ;
652
-
653
- return 0 ;
654
- }
655
-
656
586
static void byt_set_group_simple_mux (struct intel_pinctrl * vg ,
657
587
const struct intel_pingroup group ,
658
588
unsigned int func )
@@ -851,9 +781,9 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev,
851
781
}
852
782
853
783
static const struct pinmux_ops byt_pinmux_ops = {
854
- .get_functions_count = byt_get_functions_count ,
855
- .get_function_name = byt_get_function_name ,
856
- .get_function_groups = byt_get_function_groups ,
784
+ .get_functions_count = intel_get_functions_count ,
785
+ .get_function_name = intel_get_function_name ,
786
+ .get_function_groups = intel_get_function_groups ,
857
787
.set_mux = byt_set_mux ,
858
788
.gpio_request_enable = byt_gpio_request_enable ,
859
789
.gpio_disable_free = byt_gpio_disable_free ,
@@ -1265,7 +1195,7 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
1265
1195
val = readl (val_reg );
1266
1196
raw_spin_unlock_irqrestore (& byt_lock , flags );
1267
1197
1268
- comm = byt_get_community (vg , pin );
1198
+ comm = intel_get_community (vg , pin );
1269
1199
if (!comm ) {
1270
1200
seq_printf (s , "Pin %i: can't retrieve community\n" , pin );
1271
1201
continue ;
@@ -1852,3 +1782,5 @@ static int __init byt_gpio_init(void)
1852
1782
return platform_driver_register (& byt_gpio_driver );
1853
1783
}
1854
1784
subsys_initcall (byt_gpio_init );
1785
+
1786
+ MODULE_IMPORT_NS (PINCTRL_INTEL );
0 commit comments