diff options
| -rw-r--r-- | arch/x86/include/asm/pmc_atom.h | 22 | ||||
| -rw-r--r-- | arch/x86/kernel/apb_timer.c | 8 | ||||
| -rw-r--r-- | arch/x86/kernel/pmc_atom.c | 81 |
3 files changed, 86 insertions, 25 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/apb_timer.c b/arch/x86/kernel/apb_timer.c index b708738d016e..6a7c23ff21d3 100644 --- a/arch/x86/kernel/apb_timer.c +++ b/arch/x86/kernel/apb_timer.c | |||
| @@ -135,14 +135,6 @@ static inline void apbt_clear_mapping(void) | |||
| 135 | apbt_virt_address = NULL; | 135 | apbt_virt_address = NULL; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | /* | ||
| 139 | * APBT timer interrupt enable / disable | ||
| 140 | */ | ||
| 141 | static inline int is_apbt_capable(void) | ||
| 142 | { | ||
| 143 | return apbt_virt_address ? 1 : 0; | ||
| 144 | } | ||
| 145 | |||
| 146 | static int __init apbt_clockevent_register(void) | 138 | static int __init apbt_clockevent_register(void) |
| 147 | { | 139 | { |
| 148 | struct sfi_timer_table_entry *mtmr; | 140 | struct sfi_timer_table_entry *mtmr; |
diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 0ee5025e0fa4..d66a4fe6caee 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c | |||
| @@ -25,8 +25,6 @@ | |||
| 25 | 25 | ||
| 26 | #include <asm/pmc_atom.h> | 26 | #include <asm/pmc_atom.h> |
| 27 | 27 | ||
| 28 | #define DRIVER_NAME KBUILD_MODNAME | ||
| 29 | |||
| 30 | struct pmc_dev { | 28 | struct pmc_dev { |
| 31 | u32 base_addr; | 29 | u32 base_addr; |
| 32 | void __iomem *regmap; | 30 | void __iomem *regmap; |
| @@ -38,12 +36,12 @@ struct pmc_dev { | |||
| 38 | static struct pmc_dev pmc_device; | 36 | static struct pmc_dev pmc_device; |
| 39 | static u32 acpi_base_addr; | 37 | static u32 acpi_base_addr; |
| 40 | 38 | ||
| 41 | struct pmc_dev_map { | 39 | struct pmc_bit_map { |
| 42 | const char *name; | 40 | const char *name; |
| 43 | u32 bit_mask; | 41 | u32 bit_mask; |
| 44 | }; | 42 | }; |
| 45 | 43 | ||
| 46 | static const struct pmc_dev_map dev_map[] = { | 44 | static const struct pmc_bit_map dev_map[] = { |
| 47 | {"0 - LPSS1_F0_DMA", BIT_LPSS1_F0_DMA}, | 45 | {"0 - LPSS1_F0_DMA", BIT_LPSS1_F0_DMA}, |
| 48 | {"1 - LPSS1_F1_PWM1", BIT_LPSS1_F1_PWM1}, | 46 | {"1 - LPSS1_F1_PWM1", BIT_LPSS1_F1_PWM1}, |
| 49 | {"2 - LPSS1_F2_PWM2", BIT_LPSS1_F2_PWM2}, | 47 | {"2 - LPSS1_F2_PWM2", BIT_LPSS1_F2_PWM2}, |
| @@ -82,6 +80,27 @@ static const struct pmc_dev_map dev_map[] = { | |||
| 82 | {"35 - DFX", BIT_DFX}, | 80 | {"35 - DFX", BIT_DFX}, |
| 83 | }; | 81 | }; |
| 84 | 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 | |||
| 85 | 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) |
| 86 | { | 105 | { |
| 87 | return readl(pmc->regmap + reg_offset); | 106 | return readl(pmc->regmap + reg_offset); |
| @@ -169,6 +188,32 @@ static const struct file_operations pmc_dev_state_ops = { | |||
| 169 | .release = single_release, | 188 | .release = single_release, |
| 170 | }; | 189 | }; |
| 171 | 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 | |||
| 172 | 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) |
| 173 | { | 218 | { |
| 174 | struct pmc_dev *pmc = s->private; | 219 | struct pmc_dev *pmc = s->private; |
| @@ -202,11 +247,7 @@ static const struct file_operations pmc_sleep_tmr_ops = { | |||
| 202 | 247 | ||
| 203 | static void pmc_dbgfs_unregister(struct pmc_dev *pmc) | 248 | static void pmc_dbgfs_unregister(struct pmc_dev *pmc) |
| 204 | { | 249 | { |
| 205 | if (!pmc->dbgfs_dir) | ||
| 206 | return; | ||
| 207 | |||
| 208 | debugfs_remove_recursive(pmc->dbgfs_dir); | 250 | debugfs_remove_recursive(pmc->dbgfs_dir); |
| 209 | pmc->dbgfs_dir = NULL; | ||
| 210 | } | 251 | } |
| 211 | 252 | ||
| 212 | static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) | 253 | static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) |
| @@ -217,19 +258,29 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) | |||
| 217 | if (!dir) | 258 | if (!dir) |
| 218 | return -ENOMEM; | 259 | return -ENOMEM; |
| 219 | 260 | ||
| 261 | pmc->dbgfs_dir = dir; | ||
| 262 | |||
| 220 | f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, | 263 | f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, |
| 221 | dir, pmc, &pmc_dev_state_ops); | 264 | dir, pmc, &pmc_dev_state_ops); |
| 222 | if (!f) { | 265 | if (!f) { |
| 223 | dev_err(&pdev->dev, "dev_states register failed\n"); | 266 | dev_err(&pdev->dev, "dev_state register failed\n"); |
| 224 | goto err; | 267 | goto err; |
| 225 | } | 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 | |||
| 226 | f = debugfs_create_file("sleep_state", S_IFREG | S_IRUGO, | 277 | f = debugfs_create_file("sleep_state", S_IFREG | S_IRUGO, |
| 227 | dir, pmc, &pmc_sleep_tmr_ops); | 278 | dir, pmc, &pmc_sleep_tmr_ops); |
| 228 | if (!f) { | 279 | if (!f) { |
| 229 | dev_err(&pdev->dev, "sleep_state register failed\n"); | 280 | dev_err(&pdev->dev, "sleep_state register failed\n"); |
| 230 | goto err; | 281 | goto err; |
| 231 | } | 282 | } |
| 232 | pmc->dbgfs_dir = dir; | 283 | |
| 233 | return 0; | 284 | return 0; |
| 234 | err: | 285 | err: |
| 235 | pmc_dbgfs_unregister(pmc); | 286 | pmc_dbgfs_unregister(pmc); |
| @@ -292,7 +343,6 @@ MODULE_DEVICE_TABLE(pci, pmc_pci_ids); | |||
| 292 | 343 | ||
| 293 | static int __init pmc_atom_init(void) | 344 | static int __init pmc_atom_init(void) |
| 294 | { | 345 | { |
| 295 | int err = -ENODEV; | ||
| 296 | struct pci_dev *pdev = NULL; | 346 | struct pci_dev *pdev = NULL; |
| 297 | const struct pci_device_id *ent; | 347 | const struct pci_device_id *ent; |
| 298 | 348 | ||
| @@ -306,14 +356,11 @@ static int __init pmc_atom_init(void) | |||
| 306 | */ | 356 | */ |
| 307 | for_each_pci_dev(pdev) { | 357 | for_each_pci_dev(pdev) { |
| 308 | ent = pci_match_id(pmc_pci_ids, pdev); | 358 | ent = pci_match_id(pmc_pci_ids, pdev); |
| 309 | if (ent) { | 359 | if (ent) |
| 310 | err = pmc_setup_dev(pdev); | 360 | return pmc_setup_dev(pdev); |
| 311 | goto out; | ||
| 312 | } | ||
| 313 | } | 361 | } |
| 314 | /* Device not found. */ | 362 | /* Device not found. */ |
| 315 | out: | 363 | return -ENODEV; |
| 316 | return err; | ||
| 317 | } | 364 | } |
| 318 | 365 | ||
| 319 | module_init(pmc_atom_init); | 366 | module_init(pmc_atom_init); |
