1313#include <linux/interrupt.h>
1414#include <linux/io.h>
1515#include <linux/kernel.h>
16+ #include <linux/module.h>
1617#include <linux/types.h>
1718#include <linux/platform_device.h>
1819#include <linux/pm_runtime.h>
@@ -551,25 +552,10 @@ static const struct intel_pinctrl_soc_data *byt_soc_data[] = {
551552
552553static DEFINE_RAW_SPINLOCK (byt_lock );
553554
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-
569555static void __iomem * byt_gpio_reg (struct intel_pinctrl * vg , unsigned int offset ,
570556 int reg )
571557{
572- struct intel_community * comm = byt_get_community (vg , offset );
558+ struct intel_community * comm = intel_get_community (vg , offset );
573559 u32 reg_offset ;
574560
575561 if (!comm )
@@ -591,68 +577,12 @@ static void __iomem *byt_gpio_reg(struct intel_pinctrl *vg, unsigned int offset,
591577 return comm -> pad_regs + reg_offset + reg ;
592578}
593579
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-
622580static 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 ,
626584};
627585
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-
656586static void byt_set_group_simple_mux (struct intel_pinctrl * vg ,
657587 const struct intel_pingroup group ,
658588 unsigned int func )
@@ -851,9 +781,9 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev,
851781}
852782
853783static 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 ,
857787 .set_mux = byt_set_mux ,
858788 .gpio_request_enable = byt_gpio_request_enable ,
859789 .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)
12651195 val = readl (val_reg );
12661196 raw_spin_unlock_irqrestore (& byt_lock , flags );
12671197
1268- comm = byt_get_community (vg , pin );
1198+ comm = intel_get_community (vg , pin );
12691199 if (!comm ) {
12701200 seq_printf (s , "Pin %i: can't retrieve community\n" , pin );
12711201 continue ;
@@ -1852,3 +1782,5 @@ static int __init byt_gpio_init(void)
18521782 return platform_driver_register (& byt_gpio_driver );
18531783}
18541784subsys_initcall (byt_gpio_init );
1785+
1786+ MODULE_IMPORT_NS (PINCTRL_INTEL );
0 commit comments