diff options
-rw-r--r-- | arch/x86/include/asm/pmc_atom.h | 22 | ||||
-rw-r--r-- | arch/x86/kernel/pmc_atom.c | 61 |
2 files changed, 80 insertions, 3 deletions
diff --git a/arch/x86/include/asm/pmc_atom.h b/arch/x86/include/asm/pmc_atom.h index fc7a17c05d35..bc0fc0866553 100644 --- a/arch/x86/include/asm/pmc_atom.h +++ b/arch/x86/include/asm/pmc_atom.h | |||
@@ -53,6 +53,28 @@ | |||
53 | /* Sleep state counter is in units of of 32us */ | 53 | /* Sleep state counter is in units of of 32us */ |
54 | #define PMC_TMR_SHIFT 5 | 54 | #define PMC_TMR_SHIFT 5 |
55 | 55 | ||
56 | /* Power status of power islands */ | ||
57 | #define PMC_PSS 0x98 | ||
58 | |||
59 | #define PMC_PSS_BIT_GBE BIT(0) | ||
60 | #define PMC_PSS_BIT_SATA BIT(1) | ||
61 | #define PMC_PSS_BIT_HDA BIT(2) | ||
62 | #define PMC_PSS_BIT_SEC BIT(3) | ||
63 | #define PMC_PSS_BIT_PCIE BIT(4) | ||
64 | #define PMC_PSS_BIT_LPSS BIT(5) | ||
65 | #define PMC_PSS_BIT_LPE BIT(6) | ||
66 | #define PMC_PSS_BIT_DFX BIT(7) | ||
67 | #define PMC_PSS_BIT_USH_CTRL BIT(8) | ||
68 | #define PMC_PSS_BIT_USH_SUS BIT(9) | ||
69 | #define PMC_PSS_BIT_USH_VCCS BIT(10) | ||
70 | #define PMC_PSS_BIT_USH_VCCA BIT(11) | ||
71 | #define PMC_PSS_BIT_OTG_CTRL BIT(12) | ||
72 | #define PMC_PSS_BIT_OTG_VCCS BIT(13) | ||
73 | #define PMC_PSS_BIT_OTG_VCCA_CLK BIT(14) | ||
74 | #define PMC_PSS_BIT_OTG_VCCA BIT(15) | ||
75 | #define PMC_PSS_BIT_USB BIT(16) | ||
76 | #define PMC_PSS_BIT_USB_SUS BIT(17) | ||
77 | |||
56 | /* These registers reflect D3 status of functions */ | 78 | /* These registers reflect D3 status of functions */ |
57 | #define PMC_D3_STS_0 0xA0 | 79 | #define PMC_D3_STS_0 0xA0 |
58 | 80 | ||
diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index f8becc43295c..d66a4fe6caee 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c | |||
@@ -36,12 +36,12 @@ struct pmc_dev { | |||
36 | static struct pmc_dev pmc_device; | 36 | static struct pmc_dev pmc_device; |
37 | static u32 acpi_base_addr; | 37 | static u32 acpi_base_addr; |
38 | 38 | ||
39 | struct pmc_dev_map { | 39 | struct pmc_bit_map { |
40 | const char *name; | 40 | const char *name; |
41 | u32 bit_mask; | 41 | u32 bit_mask; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | static const struct pmc_dev_map dev_map[] = { | 44 | static const struct pmc_bit_map dev_map[] = { |
45 | {"0 - LPSS1_F0_DMA", BIT_LPSS1_F0_DMA}, | 45 | {"0 - LPSS1_F0_DMA", BIT_LPSS1_F0_DMA}, |
46 | {"1 - LPSS1_F1_PWM1", BIT_LPSS1_F1_PWM1}, | 46 | {"1 - LPSS1_F1_PWM1", BIT_LPSS1_F1_PWM1}, |
47 | {"2 - LPSS1_F2_PWM2", BIT_LPSS1_F2_PWM2}, | 47 | {"2 - LPSS1_F2_PWM2", BIT_LPSS1_F2_PWM2}, |
@@ -80,6 +80,27 @@ static const struct pmc_dev_map dev_map[] = { | |||
80 | {"35 - DFX", BIT_DFX}, | 80 | {"35 - DFX", BIT_DFX}, |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static const struct pmc_bit_map pss_map[] = { | ||
84 | {"0 - GBE", PMC_PSS_BIT_GBE}, | ||
85 | {"1 - SATA", PMC_PSS_BIT_SATA}, | ||
86 | {"2 - HDA", PMC_PSS_BIT_HDA}, | ||
87 | {"3 - SEC", PMC_PSS_BIT_SEC}, | ||
88 | {"4 - PCIE", PMC_PSS_BIT_PCIE}, | ||
89 | {"5 - LPSS", PMC_PSS_BIT_LPSS}, | ||
90 | {"6 - LPE", PMC_PSS_BIT_LPE}, | ||
91 | {"7 - DFX", PMC_PSS_BIT_DFX}, | ||
92 | {"8 - USH_CTRL", PMC_PSS_BIT_USH_CTRL}, | ||
93 | {"9 - USH_SUS", PMC_PSS_BIT_USH_SUS}, | ||
94 | {"10 - USH_VCCS", PMC_PSS_BIT_USH_VCCS}, | ||
95 | {"11 - USH_VCCA", PMC_PSS_BIT_USH_VCCA}, | ||
96 | {"12 - OTG_CTRL", PMC_PSS_BIT_OTG_CTRL}, | ||
97 | {"13 - OTG_VCCS", PMC_PSS_BIT_OTG_VCCS}, | ||
98 | {"14 - OTG_VCCA_CLK", PMC_PSS_BIT_OTG_VCCA_CLK}, | ||
99 | {"15 - OTG_VCCA", PMC_PSS_BIT_OTG_VCCA}, | ||
100 | {"16 - USB", PMC_PSS_BIT_USB}, | ||
101 | {"17 - USB_SUS", PMC_PSS_BIT_USB_SUS}, | ||
102 | }; | ||
103 | |||
83 | static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset) | 104 | static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset) |
84 | { | 105 | { |
85 | return readl(pmc->regmap + reg_offset); | 106 | return readl(pmc->regmap + reg_offset); |
@@ -167,6 +188,32 @@ static const struct file_operations pmc_dev_state_ops = { | |||
167 | .release = single_release, | 188 | .release = single_release, |
168 | }; | 189 | }; |
169 | 190 | ||
191 | static int pmc_pss_state_show(struct seq_file *s, void *unused) | ||
192 | { | ||
193 | struct pmc_dev *pmc = s->private; | ||
194 | u32 pss = pmc_reg_read(pmc, PMC_PSS); | ||
195 | int pss_index; | ||
196 | |||
197 | for (pss_index = 0; pss_index < ARRAY_SIZE(pss_map); pss_index++) { | ||
198 | seq_printf(s, "Island: %-32s\tState: %s\n", | ||
199 | pss_map[pss_index].name, | ||
200 | pss_map[pss_index].bit_mask & pss ? "Off" : "On"); | ||
201 | } | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static int pmc_pss_state_open(struct inode *inode, struct file *file) | ||
206 | { | ||
207 | return single_open(file, pmc_pss_state_show, inode->i_private); | ||
208 | } | ||
209 | |||
210 | static const struct file_operations pmc_pss_state_ops = { | ||
211 | .open = pmc_pss_state_open, | ||
212 | .read = seq_read, | ||
213 | .llseek = seq_lseek, | ||
214 | .release = single_release, | ||
215 | }; | ||
216 | |||
170 | static int pmc_sleep_tmr_show(struct seq_file *s, void *unused) | 217 | static int pmc_sleep_tmr_show(struct seq_file *s, void *unused) |
171 | { | 218 | { |
172 | struct pmc_dev *pmc = s->private; | 219 | struct pmc_dev *pmc = s->private; |
@@ -216,9 +263,17 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) | |||
216 | f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, | 263 | f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, |
217 | dir, pmc, &pmc_dev_state_ops); | 264 | dir, pmc, &pmc_dev_state_ops); |
218 | if (!f) { | 265 | if (!f) { |
219 | dev_err(&pdev->dev, "dev_states register failed\n"); | 266 | dev_err(&pdev->dev, "dev_state register failed\n"); |
220 | goto err; | 267 | goto err; |
221 | } | 268 | } |
269 | |||
270 | f = debugfs_create_file("pss_state", S_IFREG | S_IRUGO, | ||
271 | dir, pmc, &pmc_pss_state_ops); | ||
272 | if (!f) { | ||
273 | dev_err(&pdev->dev, "pss_state register failed\n"); | ||
274 | goto err; | ||
275 | } | ||
276 | |||
222 | f = debugfs_create_file("sleep_state", S_IFREG | S_IRUGO, | 277 | f = debugfs_create_file("sleep_state", S_IFREG | S_IRUGO, |
223 | dir, pmc, &pmc_sleep_tmr_ops); | 278 | dir, pmc, &pmc_sleep_tmr_ops); |
224 | if (!f) { | 279 | if (!f) { |