.. | .. |
---|
7 | 7 | * Mika Westerberg <mika.westerberg@linux.intel.com> |
---|
8 | 8 | */ |
---|
9 | 9 | |
---|
10 | | -#include <linux/acpi.h> |
---|
| 10 | +#include <linux/mod_devicetable.h> |
---|
11 | 11 | #include <linux/module.h> |
---|
12 | 12 | #include <linux/platform_device.h> |
---|
13 | | -#include <linux/pm.h> |
---|
| 13 | + |
---|
14 | 14 | #include <linux/pinctrl/pinctrl.h> |
---|
15 | 15 | |
---|
16 | 16 | #include "pinctrl-intel.h" |
---|
17 | 17 | |
---|
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 |
---|
22 | 24 | |
---|
23 | | -#define SPT_COMMUNITY(b, s, e) \ |
---|
| 25 | +#define SPT_COMMUNITY(b, s, e, pl, gs, gn, g, n) \ |
---|
24 | 26 | { \ |
---|
25 | 27 | .barno = (b), \ |
---|
26 | 28 | .padown_offset = SPT_PAD_OWN, \ |
---|
27 | | - .padcfglock_offset = SPT_PADCFGLOCK, \ |
---|
| 29 | + .padcfglock_offset = (pl), \ |
---|
28 | 30 | .hostown_offset = SPT_HOSTSW_OWN, \ |
---|
| 31 | + .is_offset = SPT_GPI_IS, \ |
---|
29 | 32 | .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), \ |
---|
32 | 35 | .pin_base = (s), \ |
---|
33 | 36 | .npins = ((e) - (s) + 1), \ |
---|
| 37 | + .gpps = (g), \ |
---|
| 38 | + .ngpps = (n), \ |
---|
34 | 39 | } |
---|
35 | 40 | |
---|
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) \ |
---|
37 | 45 | { \ |
---|
38 | 46 | .reg_num = (r), \ |
---|
39 | 47 | .base = (s), \ |
---|
.. | .. |
---|
41 | 49 | .gpio_base = (g), \ |
---|
42 | 50 | } |
---|
43 | 51 | |
---|
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)) |
---|
56 | 54 | |
---|
57 | 55 | /* Sunrisepoint-LP */ |
---|
58 | 56 | static const struct pinctrl_pin_desc sptlp_pins[] = { |
---|
.. | .. |
---|
288 | 286 | }; |
---|
289 | 287 | |
---|
290 | 288 | 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), |
---|
294 | 292 | }; |
---|
295 | 293 | |
---|
296 | 294 | static const struct intel_pinctrl_soc_data sptlp_soc_data = { |
---|
.. | .. |
---|
550 | 548 | }; |
---|
551 | 549 | |
---|
552 | 550 | 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 */ |
---|
555 | 553 | }; |
---|
556 | 554 | |
---|
557 | 555 | 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 */ |
---|
564 | 562 | }; |
---|
565 | 563 | |
---|
566 | 564 | 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 */ |
---|
568 | 566 | }; |
---|
569 | 567 | |
---|
570 | 568 | 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), |
---|
574 | 572 | }; |
---|
575 | 573 | |
---|
576 | 574 | static const struct intel_pinctrl_soc_data spth_soc_data = { |
---|
.. | .. |
---|
586 | 584 | |
---|
587 | 585 | static const struct acpi_device_id spt_pinctrl_acpi_match[] = { |
---|
588 | 586 | { "INT344B", (kernel_ulong_t)&sptlp_soc_data }, |
---|
| 587 | + { "INT3451", (kernel_ulong_t)&spth_soc_data }, |
---|
589 | 588 | { "INT345D", (kernel_ulong_t)&spth_soc_data }, |
---|
590 | 589 | { } |
---|
591 | 590 | }; |
---|
592 | 591 | MODULE_DEVICE_TABLE(acpi, spt_pinctrl_acpi_match); |
---|
593 | 592 | |
---|
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); |
---|
611 | 594 | |
---|
612 | 595 | static struct platform_driver spt_pinctrl_driver = { |
---|
613 | | - .probe = spt_pinctrl_probe, |
---|
| 596 | + .probe = intel_pinctrl_probe_by_hid, |
---|
614 | 597 | .driver = { |
---|
615 | 598 | .name = "sunrisepoint-pinctrl", |
---|
616 | 599 | .acpi_match_table = spt_pinctrl_acpi_match, |
---|