hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/pinctrl/intel/pinctrl-sunrisepoint.c
....@@ -7,33 +7,41 @@
77 * Mika Westerberg <mika.westerberg@linux.intel.com>
88 */
99
10
-#include <linux/acpi.h>
10
+#include <linux/mod_devicetable.h>
1111 #include <linux/module.h>
1212 #include <linux/platform_device.h>
13
-#include <linux/pm.h>
13
+
1414 #include <linux/pinctrl/pinctrl.h>
1515
1616 #include "pinctrl-intel.h"
1717
18
-#define SPT_PAD_OWN 0x020
19
-#define SPT_PADCFGLOCK 0x0a0
20
-#define SPT_HOSTSW_OWN 0x0d0
21
-#define SPT_GPI_IE 0x120
18
+#define SPT_PAD_OWN 0x020
19
+#define SPT_H_PADCFGLOCK 0x090
20
+#define SPT_LP_PADCFGLOCK 0x0a0
21
+#define SPT_HOSTSW_OWN 0x0d0
22
+#define SPT_GPI_IS 0x100
23
+#define SPT_GPI_IE 0x120
2224
23
-#define SPT_COMMUNITY(b, s, e) \
25
+#define SPT_COMMUNITY(b, s, e, pl, gs, gn, g, n) \
2426 { \
2527 .barno = (b), \
2628 .padown_offset = SPT_PAD_OWN, \
27
- .padcfglock_offset = SPT_PADCFGLOCK, \
29
+ .padcfglock_offset = (pl), \
2830 .hostown_offset = SPT_HOSTSW_OWN, \
31
+ .is_offset = SPT_GPI_IS, \
2932 .ie_offset = SPT_GPI_IE, \
30
- .gpp_size = 24, \
31
- .gpp_num_padown_regs = 4, \
33
+ .gpp_size = (gs), \
34
+ .gpp_num_padown_regs = (gn), \
3235 .pin_base = (s), \
3336 .npins = ((e) - (s) + 1), \
37
+ .gpps = (g), \
38
+ .ngpps = (n), \
3439 }
3540
36
-#define SPTH_GPP(r, s, e, g) \
41
+#define SPT_LP_COMMUNITY(b, s, e) \
42
+ SPT_COMMUNITY(b, s, e, SPT_LP_PADCFGLOCK, 24, 4, NULL, 0)
43
+
44
+#define SPT_H_GPP(r, s, e, g) \
3745 { \
3846 .reg_num = (r), \
3947 .base = (s), \
....@@ -41,18 +49,8 @@
4149 .gpio_base = (g), \
4250 }
4351
44
-#define SPTH_COMMUNITY(b, s, e, g) \
45
- { \
46
- .barno = (b), \
47
- .padown_offset = SPT_PAD_OWN, \
48
- .padcfglock_offset = SPT_PADCFGLOCK, \
49
- .hostown_offset = SPT_HOSTSW_OWN, \
50
- .ie_offset = SPT_GPI_IE, \
51
- .pin_base = (s), \
52
- .npins = ((e) - (s) + 1), \
53
- .gpps = (g), \
54
- .ngpps = ARRAY_SIZE(g), \
55
- }
52
+#define SPT_H_COMMUNITY(b, s, e, g) \
53
+ SPT_COMMUNITY(b, s, e, SPT_H_PADCFGLOCK, 0, 0, g, ARRAY_SIZE(g))
5654
5755 /* Sunrisepoint-LP */
5856 static const struct pinctrl_pin_desc sptlp_pins[] = {
....@@ -288,9 +286,9 @@
288286 };
289287
290288 static const struct intel_community sptlp_communities[] = {
291
- SPT_COMMUNITY(0, 0, 47),
292
- SPT_COMMUNITY(1, 48, 119),
293
- SPT_COMMUNITY(2, 120, 151),
289
+ SPT_LP_COMMUNITY(0, 0, 47),
290
+ SPT_LP_COMMUNITY(1, 48, 119),
291
+ SPT_LP_COMMUNITY(2, 120, 151),
294292 };
295293
296294 static const struct intel_pinctrl_soc_data sptlp_soc_data = {
....@@ -550,27 +548,27 @@
550548 };
551549
552550 static const struct intel_padgroup spth_community0_gpps[] = {
553
- SPTH_GPP(0, 0, 23, 0), /* GPP_A */
554
- SPTH_GPP(1, 24, 47, 24), /* GPP_B */
551
+ SPT_H_GPP(0, 0, 23, 0), /* GPP_A */
552
+ SPT_H_GPP(1, 24, 47, 24), /* GPP_B */
555553 };
556554
557555 static const struct intel_padgroup spth_community1_gpps[] = {
558
- SPTH_GPP(0, 48, 71, 48), /* GPP_C */
559
- SPTH_GPP(1, 72, 95, 72), /* GPP_D */
560
- SPTH_GPP(2, 96, 108, 96), /* GPP_E */
561
- SPTH_GPP(3, 109, 132, 120), /* GPP_F */
562
- SPTH_GPP(4, 133, 156, 144), /* GPP_G */
563
- SPTH_GPP(5, 157, 180, 168), /* GPP_H */
556
+ SPT_H_GPP(0, 48, 71, 48), /* GPP_C */
557
+ SPT_H_GPP(1, 72, 95, 72), /* GPP_D */
558
+ SPT_H_GPP(2, 96, 108, 96), /* GPP_E */
559
+ SPT_H_GPP(3, 109, 132, 120), /* GPP_F */
560
+ SPT_H_GPP(4, 133, 156, 144), /* GPP_G */
561
+ SPT_H_GPP(5, 157, 180, 168), /* GPP_H */
564562 };
565563
566564 static const struct intel_padgroup spth_community3_gpps[] = {
567
- SPTH_GPP(0, 181, 191, 192), /* GPP_I */
565
+ SPT_H_GPP(0, 181, 191, 192), /* GPP_I */
568566 };
569567
570568 static const struct intel_community spth_communities[] = {
571
- SPTH_COMMUNITY(0, 0, 47, spth_community0_gpps),
572
- SPTH_COMMUNITY(1, 48, 180, spth_community1_gpps),
573
- SPTH_COMMUNITY(2, 181, 191, spth_community3_gpps),
569
+ SPT_H_COMMUNITY(0, 0, 47, spth_community0_gpps),
570
+ SPT_H_COMMUNITY(1, 48, 180, spth_community1_gpps),
571
+ SPT_H_COMMUNITY(2, 181, 191, spth_community3_gpps),
574572 };
575573
576574 static const struct intel_pinctrl_soc_data spth_soc_data = {
....@@ -586,31 +584,16 @@
586584
587585 static const struct acpi_device_id spt_pinctrl_acpi_match[] = {
588586 { "INT344B", (kernel_ulong_t)&sptlp_soc_data },
587
+ { "INT3451", (kernel_ulong_t)&spth_soc_data },
589588 { "INT345D", (kernel_ulong_t)&spth_soc_data },
590589 { }
591590 };
592591 MODULE_DEVICE_TABLE(acpi, spt_pinctrl_acpi_match);
593592
594
-static int spt_pinctrl_probe(struct platform_device *pdev)
595
-{
596
- const struct intel_pinctrl_soc_data *soc_data;
597
- const struct acpi_device_id *id;
598
-
599
- id = acpi_match_device(spt_pinctrl_acpi_match, &pdev->dev);
600
- if (!id || !id->driver_data)
601
- return -ENODEV;
602
-
603
- soc_data = (const struct intel_pinctrl_soc_data *)id->driver_data;
604
- return intel_pinctrl_probe(pdev, soc_data);
605
-}
606
-
607
-static const struct dev_pm_ops spt_pinctrl_pm_ops = {
608
- SET_LATE_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend,
609
- intel_pinctrl_resume)
610
-};
593
+static INTEL_PINCTRL_PM_OPS(spt_pinctrl_pm_ops);
611594
612595 static struct platform_driver spt_pinctrl_driver = {
613
- .probe = spt_pinctrl_probe,
596
+ .probe = intel_pinctrl_probe_by_hid,
614597 .driver = {
615598 .name = "sunrisepoint-pinctrl",
616599 .acpi_match_table = spt_pinctrl_acpi_match,