Skip to content

Commit 8174a85

Browse files
Light Hsiehlinusw
authored andcommitted
pinctrl: mediatek: make MediaTek pinctrl v2 driver ready for buidling loadable module
In the future we want to be able to build the MediaTek pinctrl driver, based on paris, as kernel module. This patch allows pinctrl-paris.c, the external interrupt controller mtk-eint.c, and pinctrl-mtk-common-v2.c to be loadable as module. Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Light Hsieh <[email protected]> Reviewed-by: Matthias Brugger <[email protected]> Link: https://lore.kernel.org/r/9feeb04805e5a406fe22a92e3f280abda39ddda4.1586289920.git.sean.wang@mediatek.com Signed-off-by: Linus Walleij <[email protected]>
1 parent 7e23ab7 commit 8174a85

File tree

5 files changed

+51
-4
lines changed

5 files changed

+51
-4
lines changed

drivers/pinctrl/mediatek/Kconfig

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ menu "MediaTek pinctrl drivers"
33
depends on ARCH_MEDIATEK || COMPILE_TEST
44

55
config EINT_MTK
6-
bool "MediaTek External Interrupt Support"
6+
tristate "MediaTek External Interrupt Support"
77
depends on PINCTRL_MTK || PINCTRL_MTK_MOORE || PINCTRL_MTK_PARIS || COMPILE_TEST
88
select GPIOLIB
99
select IRQ_DOMAIN
10+
default y if PINCTRL_MTK || PINCTRL_MTK_MOORE
11+
default PINCTRL_MTK_PARIS
1012

1113
config PINCTRL_MTK
1214
bool
@@ -17,6 +19,9 @@ config PINCTRL_MTK
1719
select EINT_MTK
1820
select OF_GPIO
1921

22+
config PINCTRL_MTK_V2
23+
tristate
24+
2025
config PINCTRL_MTK_MOORE
2126
bool
2227
depends on OF
@@ -25,15 +30,17 @@ config PINCTRL_MTK_MOORE
2530
select GENERIC_PINMUX_FUNCTIONS
2631
select GPIOLIB
2732
select OF_GPIO
33+
select PINCTRL_MTK_V2
2834

2935
config PINCTRL_MTK_PARIS
30-
bool
36+
tristate
3137
depends on OF
3238
select PINMUX
3339
select GENERIC_PINCONF
3440
select GPIOLIB
3541
select EINT_MTK
3642
select OF_GPIO
43+
select PINCTRL_MTK_V2
3744

3845
# For ARMv7 SoCs
3946
config PINCTRL_MT2701

drivers/pinctrl/mediatek/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# Core
33
obj-$(CONFIG_EINT_MTK) += mtk-eint.o
44
obj-$(CONFIG_PINCTRL_MTK) += pinctrl-mtk-common.o
5-
obj-$(CONFIG_PINCTRL_MTK_MOORE) += pinctrl-moore.o pinctrl-mtk-common-v2.o
6-
obj-$(CONFIG_PINCTRL_MTK_PARIS) += pinctrl-paris.o pinctrl-mtk-common-v2.o
5+
obj-$(CONFIG_PINCTRL_MTK_V2) += pinctrl-mtk-common-v2.o
6+
obj-$(CONFIG_PINCTRL_MTK_MOORE) += pinctrl-moore.o
7+
obj-$(CONFIG_PINCTRL_MTK_PARIS) += pinctrl-paris.o
78

89
# SoC Drivers
910
obj-$(CONFIG_PINCTRL_MT2701) += pinctrl-mt2701.o

drivers/pinctrl/mediatek/mtk-eint.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/io.h>
1616
#include <linux/irqchip/chained_irq.h>
1717
#include <linux/irqdomain.h>
18+
#include <linux/module.h>
1819
#include <linux/of_irq.h>
1920
#include <linux/platform_device.h>
2021

@@ -379,13 +380,15 @@ int mtk_eint_do_suspend(struct mtk_eint *eint)
379380

380381
return 0;
381382
}
383+
EXPORT_SYMBOL_GPL(mtk_eint_do_suspend);
382384

383385
int mtk_eint_do_resume(struct mtk_eint *eint)
384386
{
385387
mtk_eint_chip_write_mask(eint, eint->base, eint->cur_mask);
386388

387389
return 0;
388390
}
391+
EXPORT_SYMBOL_GPL(mtk_eint_do_resume);
389392

390393
int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_num,
391394
unsigned int debounce)
@@ -440,6 +443,7 @@ int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_num,
440443

441444
return 0;
442445
}
446+
EXPORT_SYMBOL_GPL(mtk_eint_set_debounce);
443447

444448
int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n)
445449
{
@@ -451,6 +455,7 @@ int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n)
451455

452456
return irq;
453457
}
458+
EXPORT_SYMBOL_GPL(mtk_eint_find_irq);
454459

455460
int mtk_eint_do_init(struct mtk_eint *eint)
456461
{
@@ -495,3 +500,7 @@ int mtk_eint_do_init(struct mtk_eint *eint)
495500

496501
return 0;
497502
}
503+
EXPORT_SYMBOL_GPL(mtk_eint_do_init);
504+
505+
MODULE_LICENSE("GPL v2");
506+
MODULE_DESCRIPTION("MediaTek EINT Driver");

drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/gpio/driver.h>
1313
#include <linux/platform_device.h>
1414
#include <linux/io.h>
15+
#include <linux/module.h>
1516
#include <linux/of_irq.h>
1617

1718
#include "mtk-eint.h"
@@ -204,6 +205,7 @@ int mtk_hw_set_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc,
204205

205206
return 0;
206207
}
208+
EXPORT_SYMBOL_GPL(mtk_hw_set_value);
207209

208210
int mtk_hw_get_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc,
209211
int field, int *value)
@@ -223,6 +225,7 @@ int mtk_hw_get_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc,
223225

224226
return 0;
225227
}
228+
EXPORT_SYMBOL_GPL(mtk_hw_get_value);
226229

227230
static int mtk_xt_find_eint_num(struct mtk_pinctrl *hw, unsigned long eint_n)
228231
{
@@ -361,6 +364,7 @@ int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev)
361364

362365
return mtk_eint_do_init(hw->eint);
363366
}
367+
EXPORT_SYMBOL_GPL(mtk_build_eint);
364368

365369
/* Revision 0 */
366370
int mtk_pinconf_bias_disable_set(struct mtk_pinctrl *hw,
@@ -380,6 +384,7 @@ int mtk_pinconf_bias_disable_set(struct mtk_pinctrl *hw,
380384

381385
return 0;
382386
}
387+
EXPORT_SYMBOL_GPL(mtk_pinconf_bias_disable_set);
383388

384389
int mtk_pinconf_bias_disable_get(struct mtk_pinctrl *hw,
385390
const struct mtk_pin_desc *desc, int *res)
@@ -402,6 +407,7 @@ int mtk_pinconf_bias_disable_get(struct mtk_pinctrl *hw,
402407

403408
return 0;
404409
}
410+
EXPORT_SYMBOL_GPL(mtk_pinconf_bias_disable_get);
405411

406412
int mtk_pinconf_bias_set(struct mtk_pinctrl *hw,
407413
const struct mtk_pin_desc *desc, bool pullup)
@@ -421,6 +427,7 @@ int mtk_pinconf_bias_set(struct mtk_pinctrl *hw,
421427

422428
return 0;
423429
}
430+
EXPORT_SYMBOL_GPL(mtk_pinconf_bias_set);
424431

425432
int mtk_pinconf_bias_get(struct mtk_pinctrl *hw,
426433
const struct mtk_pin_desc *desc, bool pullup, int *res)
@@ -440,6 +447,7 @@ int mtk_pinconf_bias_get(struct mtk_pinctrl *hw,
440447

441448
return 0;
442449
}
450+
EXPORT_SYMBOL_GPL(mtk_pinconf_bias_get);
443451

444452
/* Revision 1 */
445453
int mtk_pinconf_bias_disable_set_rev1(struct mtk_pinctrl *hw,
@@ -454,6 +462,7 @@ int mtk_pinconf_bias_disable_set_rev1(struct mtk_pinctrl *hw,
454462

455463
return 0;
456464
}
465+
EXPORT_SYMBOL_GPL(mtk_pinconf_bias_disable_set_rev1);
457466

458467
int mtk_pinconf_bias_disable_get_rev1(struct mtk_pinctrl *hw,
459468
const struct mtk_pin_desc *desc, int *res)
@@ -471,6 +480,7 @@ int mtk_pinconf_bias_disable_get_rev1(struct mtk_pinctrl *hw,
471480

472481
return 0;
473482
}
483+
EXPORT_SYMBOL_GPL(mtk_pinconf_bias_disable_get_rev1);
474484

475485
int mtk_pinconf_bias_set_rev1(struct mtk_pinctrl *hw,
476486
const struct mtk_pin_desc *desc, bool pullup)
@@ -490,6 +500,7 @@ int mtk_pinconf_bias_set_rev1(struct mtk_pinctrl *hw,
490500

491501
return 0;
492502
}
503+
EXPORT_SYMBOL_GPL(mtk_pinconf_bias_set_rev1);
493504

494505
int mtk_pinconf_bias_get_rev1(struct mtk_pinctrl *hw,
495506
const struct mtk_pin_desc *desc, bool pullup,
@@ -515,6 +526,7 @@ int mtk_pinconf_bias_get_rev1(struct mtk_pinctrl *hw,
515526

516527
return 0;
517528
}
529+
EXPORT_SYMBOL_GPL(mtk_pinconf_bias_get_rev1);
518530

519531
/* Combo for the following pull register type:
520532
* 1. PU + PD
@@ -715,6 +727,7 @@ int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw,
715727
out:
716728
return err;
717729
}
730+
EXPORT_SYMBOL_GPL(mtk_pinconf_bias_set_combo);
718731

719732
int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw,
720733
const struct mtk_pin_desc *desc,
@@ -735,6 +748,7 @@ int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw,
735748
out:
736749
return err;
737750
}
751+
EXPORT_SYMBOL_GPL(mtk_pinconf_bias_get_combo);
738752

739753
/* Revision 0 */
740754
int mtk_pinconf_drive_set(struct mtk_pinctrl *hw,
@@ -764,6 +778,7 @@ int mtk_pinconf_drive_set(struct mtk_pinctrl *hw,
764778

765779
return err;
766780
}
781+
EXPORT_SYMBOL_GPL(mtk_pinconf_drive_set);
767782

768783
int mtk_pinconf_drive_get(struct mtk_pinctrl *hw,
769784
const struct mtk_pin_desc *desc, int *val)
@@ -788,6 +803,7 @@ int mtk_pinconf_drive_get(struct mtk_pinctrl *hw,
788803

789804
return 0;
790805
}
806+
EXPORT_SYMBOL_GPL(mtk_pinconf_drive_get);
791807

792808
/* Revision 1 */
793809
int mtk_pinconf_drive_set_rev1(struct mtk_pinctrl *hw,
@@ -809,6 +825,7 @@ int mtk_pinconf_drive_set_rev1(struct mtk_pinctrl *hw,
809825

810826
return err;
811827
}
828+
EXPORT_SYMBOL_GPL(mtk_pinconf_drive_set_rev1);
812829

813830
int mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw,
814831
const struct mtk_pin_desc *desc, int *val)
@@ -826,18 +843,21 @@ int mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw,
826843

827844
return 0;
828845
}
846+
EXPORT_SYMBOL_GPL(mtk_pinconf_drive_get_rev1);
829847

830848
int mtk_pinconf_drive_set_raw(struct mtk_pinctrl *hw,
831849
const struct mtk_pin_desc *desc, u32 arg)
832850
{
833851
return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DRV, arg);
834852
}
853+
EXPORT_SYMBOL_GPL(mtk_pinconf_drive_set_raw);
835854

836855
int mtk_pinconf_drive_get_raw(struct mtk_pinctrl *hw,
837856
const struct mtk_pin_desc *desc, int *val)
838857
{
839858
return mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DRV, val);
840859
}
860+
EXPORT_SYMBOL_GPL(mtk_pinconf_drive_get_raw);
841861

842862
int mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw,
843863
const struct mtk_pin_desc *desc, bool pullup,
@@ -878,6 +898,7 @@ int mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw,
878898

879899
return err;
880900
}
901+
EXPORT_SYMBOL_GPL(mtk_pinconf_adv_pull_set);
881902

882903
int mtk_pinconf_adv_pull_get(struct mtk_pinctrl *hw,
883904
const struct mtk_pin_desc *desc, bool pullup,
@@ -920,6 +941,7 @@ int mtk_pinconf_adv_pull_get(struct mtk_pinctrl *hw,
920941

921942
return 0;
922943
}
944+
EXPORT_SYMBOL_GPL(mtk_pinconf_adv_pull_get);
923945

924946
int mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw,
925947
const struct mtk_pin_desc *desc, u32 arg)
@@ -946,6 +968,7 @@ int mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw,
946968

947969
return err;
948970
}
971+
EXPORT_SYMBOL_GPL(mtk_pinconf_adv_drive_set);
949972

950973
int mtk_pinconf_adv_drive_get(struct mtk_pinctrl *hw,
951974
const struct mtk_pin_desc *desc, u32 *val)
@@ -969,3 +992,4 @@ int mtk_pinconf_adv_drive_get(struct mtk_pinctrl *hw,
969992

970993
return 0;
971994
}
995+
EXPORT_SYMBOL_GPL(mtk_pinconf_adv_drive_get);

drivers/pinctrl/mediatek/pinctrl-paris.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
#include <linux/gpio/driver.h>
13+
#include <linux/module.h>
1314
#include <dt-bindings/pinctrl/mt65xx.h>
1415
#include "pinctrl-paris.h"
1516

@@ -633,6 +634,7 @@ ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw,
633634

634635
return len;
635636
}
637+
EXPORT_SYMBOL_GPL(mtk_pctrl_show_one_pin);
636638

637639
#define PIN_DBG_BUF_SZ 96
638640
static void mtk_pctrl_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
@@ -1021,6 +1023,7 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev,
10211023

10221024
return 0;
10231025
}
1026+
EXPORT_SYMBOL_GPL(mtk_paris_pinctrl_probe);
10241027

10251028
static int mtk_paris_pinctrl_suspend(struct device *device)
10261029
{
@@ -1040,3 +1043,6 @@ const struct dev_pm_ops mtk_paris_pinctrl_pm_ops = {
10401043
.suspend_noirq = mtk_paris_pinctrl_suspend,
10411044
.resume_noirq = mtk_paris_pinctrl_resume,
10421045
};
1046+
1047+
MODULE_LICENSE("GPL v2");
1048+
MODULE_DESCRIPTION("MediaTek Pinctrl Common Driver V2 Paris");

0 commit comments

Comments
 (0)