* [PATCH v5 0/5] x86: clean ups and feature enhancement in pmc_atom
@ 2015-01-14 16:39 Andy Shevchenko
2015-01-14 16:39 ` [PATCH v5 1/5] x86: pmc-atom: assign debugfs node as soon as possible Andy Shevchenko
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Andy Shevchenko @ 2015-01-14 16:39 UTC (permalink / raw)
To: x86, Aubrey Li, Rafael J . Wysocki, Kumar P, Mahesh,
linux-kernel, linux-acpi
Cc: Andy Shevchenko
Couple of clean ups and one feature enhancement (expose PSS register in the
debug fs).
Changes since v4:
- address one Thomas' comment (patch 1/5 was added)
- rebased on recent linux-next
Changes since v3:
- rebase on top of recent linux-next
- resend to better place for review and push
Changes since v2:
- rebase on top of recent linux-next
- applied Acks
- introduce patch 3/3
Andy Shevchenko (5):
x86: pmc-atom: assign debugfs node as soon as possible
x86: pmc_atom: don't check for NULL twice
x86: pmc-atom: remove unused macro
x86: pmc_atom: clean up init function
x86: pmc_atom: expose contents of PSS
arch/x86/include/asm/pmc_atom.h | 22 +++++++++++
arch/x86/kernel/pmc_atom.c | 81 ++++++++++++++++++++++++++++++++---------
2 files changed, 86 insertions(+), 17 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v5 1/5] x86: pmc-atom: assign debugfs node as soon as possible 2015-01-14 16:39 [PATCH v5 0/5] x86: clean ups and feature enhancement in pmc_atom Andy Shevchenko @ 2015-01-14 16:39 ` Andy Shevchenko 2015-01-20 11:54 ` [tip:x86/platform] x86: pmc-atom: Assign " tip-bot for Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 2/5] x86: pmc_atom: don't check for NULL twice Andy Shevchenko ` (3 subsequent siblings) 4 siblings, 1 reply; 11+ messages in thread From: Andy Shevchenko @ 2015-01-14 16:39 UTC (permalink / raw) To: x86, Aubrey Li, Rafael J . Wysocki, Kumar P, Mahesh, linux-kernel, linux-acpi Cc: Andy Shevchenko pmc_dbgfs_unregister() will be called when pmc->dbgfs_dir is unconditionally NULL on error path in pmc_dbgfs_register(). To prevent this we move an assignment to where is should be. Fixes: f855911c1f48 (x86/pmc_atom: Expose PMC device state and platform sleep state) Reported-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- arch/x86/kernel/pmc_atom.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 0ee5025e..8bb9a61 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -217,6 +217,8 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) if (!dir) return -ENOMEM; + pmc->dbgfs_dir = dir; + f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, dir, pmc, &pmc_dev_state_ops); if (!f) { @@ -229,7 +231,7 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) dev_err(&pdev->dev, "sleep_state register failed\n"); goto err; } - pmc->dbgfs_dir = dir; + return 0; err: pmc_dbgfs_unregister(pmc); -- 2.1.4 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip:x86/platform] x86: pmc-atom: Assign debugfs node as soon as possible 2015-01-14 16:39 ` [PATCH v5 1/5] x86: pmc-atom: assign debugfs node as soon as possible Andy Shevchenko @ 2015-01-20 11:54 ` tip-bot for Andy Shevchenko 0 siblings, 0 replies; 11+ messages in thread From: tip-bot for Andy Shevchenko @ 2015-01-20 11:54 UTC (permalink / raw) To: linux-tip-commits Cc: aubrey.li, mahesh.kumar.p, tglx, andriy.shevchenko, rafael.j.wysocki, linux-kernel, mingo, hpa Commit-ID: 1b43d7125f3b6f7d46e72da64f65f3187a83b66b Gitweb: http://git.kernel.org/tip/1b43d7125f3b6f7d46e72da64f65f3187a83b66b Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> AuthorDate: Wed, 14 Jan 2015 18:39:31 +0200 Committer: Thomas Gleixner <tglx@linutronix.de> CommitDate: Tue, 20 Jan 2015 12:50:14 +0100 x86: pmc-atom: Assign debugfs node as soon as possible pmc_dbgfs_unregister() will be called when pmc->dbgfs_dir is unconditionally NULL on error path in pmc_dbgfs_register(). To prevent this we move the assignment to where is should be. Fixes: f855911c1f48 (x86/pmc_atom: Expose PMC device state and platform sleep state) Reported-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Aubrey Li <aubrey.li@linux.intel.com> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Kumar P. Mahesh <mahesh.kumar.p@intel.com> Link: http://lkml.kernel.org/r/1421253575-22509-2-git-send-email-andriy.shevchenko@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- arch/x86/kernel/pmc_atom.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 0ee5025e..8bb9a61 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -217,6 +217,8 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) if (!dir) return -ENOMEM; + pmc->dbgfs_dir = dir; + f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, dir, pmc, &pmc_dev_state_ops); if (!f) { @@ -229,7 +231,7 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) dev_err(&pdev->dev, "sleep_state register failed\n"); goto err; } - pmc->dbgfs_dir = dir; + return 0; err: pmc_dbgfs_unregister(pmc); ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 2/5] x86: pmc_atom: don't check for NULL twice 2015-01-14 16:39 [PATCH v5 0/5] x86: clean ups and feature enhancement in pmc_atom Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 1/5] x86: pmc-atom: assign debugfs node as soon as possible Andy Shevchenko @ 2015-01-14 16:39 ` Andy Shevchenko 2015-01-20 11:55 ` [tip:x86/platform] x86: pmc_atom: don%27t " tip-bot for Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 3/5] x86: pmc-atom: remove unused macro Andy Shevchenko ` (2 subsequent siblings) 4 siblings, 1 reply; 11+ messages in thread From: Andy Shevchenko @ 2015-01-14 16:39 UTC (permalink / raw) To: x86, Aubrey Li, Rafael J . Wysocki, Kumar P, Mahesh, linux-kernel, linux-acpi Cc: Andy Shevchenko debugfs_remove_recursive() is NULL-aware, thus, we may safely remove the check here. There is no need to assing NULL to variable since it will be not used anywhere. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Aubrey Li <aubrey.li@linux.intel.com> --- arch/x86/kernel/pmc_atom.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 8bb9a61..1dd6c62 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -202,11 +202,7 @@ static const struct file_operations pmc_sleep_tmr_ops = { static void pmc_dbgfs_unregister(struct pmc_dev *pmc) { - if (!pmc->dbgfs_dir) - return; - debugfs_remove_recursive(pmc->dbgfs_dir); - pmc->dbgfs_dir = NULL; } static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) -- 2.1.4 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip:x86/platform] x86: pmc_atom: don%27t check for NULL twice 2015-01-14 16:39 ` [PATCH v5 2/5] x86: pmc_atom: don't check for NULL twice Andy Shevchenko @ 2015-01-20 11:55 ` tip-bot for Andy Shevchenko 0 siblings, 0 replies; 11+ messages in thread From: tip-bot for Andy Shevchenko @ 2015-01-20 11:55 UTC (permalink / raw) To: linux-tip-commits Cc: hpa, andriy.shevchenko, linux-kernel, rafael.j.wysocki, tglx, mingo, aubrey.li, mahesh.kumar.p Commit-ID: d5df8fe34bec4539e259525feabd16efccf16750 Gitweb: http://git.kernel.org/tip/d5df8fe34bec4539e259525feabd16efccf16750 Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> AuthorDate: Wed, 14 Jan 2015 18:39:32 +0200 Committer: Thomas Gleixner <tglx@linutronix.de> CommitDate: Tue, 20 Jan 2015 12:50:14 +0100 x86: pmc_atom: don%27t check for NULL twice debugfs_remove_recursive() is NULL-aware, thus, we may safely remove the check here. There is no need to assing NULL to variable since it will be not used anywhere. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Aubrey Li <aubrey.li@linux.intel.com> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Kumar P. Mahesh <mahesh.kumar.p@intel.com> Link: http://lkml.kernel.org/r/1421253575-22509-3-git-send-email-andriy.shevchenko@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- arch/x86/kernel/pmc_atom.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 8bb9a61..1dd6c62 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -202,11 +202,7 @@ static const struct file_operations pmc_sleep_tmr_ops = { static void pmc_dbgfs_unregister(struct pmc_dev *pmc) { - if (!pmc->dbgfs_dir) - return; - debugfs_remove_recursive(pmc->dbgfs_dir); - pmc->dbgfs_dir = NULL; } static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 3/5] x86: pmc-atom: remove unused macro 2015-01-14 16:39 [PATCH v5 0/5] x86: clean ups and feature enhancement in pmc_atom Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 1/5] x86: pmc-atom: assign debugfs node as soon as possible Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 2/5] x86: pmc_atom: don't check for NULL twice Andy Shevchenko @ 2015-01-14 16:39 ` Andy Shevchenko 2015-01-20 11:55 ` [tip:x86/platform] x86: pmc-atom: Remove " tip-bot for Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 4/5] x86: pmc_atom: clean up init function Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 5/5] x86: pmc_atom: expose contents of PSS Andy Shevchenko 4 siblings, 1 reply; 11+ messages in thread From: Andy Shevchenko @ 2015-01-14 16:39 UTC (permalink / raw) To: x86, Aubrey Li, Rafael J . Wysocki, Kumar P, Mahesh, linux-kernel, linux-acpi Cc: Andy Shevchenko DRIVER_NAME seems unused. This patch just removes it. There is no functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- arch/x86/kernel/pmc_atom.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 1dd6c62..6b62f55 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -25,8 +25,6 @@ #include <asm/pmc_atom.h> -#define DRIVER_NAME KBUILD_MODNAME - struct pmc_dev { u32 base_addr; void __iomem *regmap; -- 2.1.4 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip:x86/platform] x86: pmc-atom: Remove unused macro 2015-01-14 16:39 ` [PATCH v5 3/5] x86: pmc-atom: remove unused macro Andy Shevchenko @ 2015-01-20 11:55 ` tip-bot for Andy Shevchenko 0 siblings, 0 replies; 11+ messages in thread From: tip-bot for Andy Shevchenko @ 2015-01-20 11:55 UTC (permalink / raw) To: linux-tip-commits Cc: aubrey.li, mahesh.kumar.p, tglx, rafael.j.wysocki, linux-kernel, hpa, mingo, andriy.shevchenko Commit-ID: 4922b9ce89ccdeb99364666f1fcc297c4af31bf7 Gitweb: http://git.kernel.org/tip/4922b9ce89ccdeb99364666f1fcc297c4af31bf7 Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> AuthorDate: Wed, 14 Jan 2015 18:39:33 +0200 Committer: Thomas Gleixner <tglx@linutronix.de> CommitDate: Tue, 20 Jan 2015 12:50:14 +0100 x86: pmc-atom: Remove unused macro DRIVER_NAME seems unused. This patch just removes it. There is no functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Aubrey Li <aubrey.li@linux.intel.com> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Kumar P. Mahesh <mahesh.kumar.p@intel.com> Link: http://lkml.kernel.org/r/1421253575-22509-4-git-send-email-andriy.shevchenko@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- arch/x86/kernel/pmc_atom.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 1dd6c62..6b62f55 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -25,8 +25,6 @@ #include <asm/pmc_atom.h> -#define DRIVER_NAME KBUILD_MODNAME - struct pmc_dev { u32 base_addr; void __iomem *regmap; ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 4/5] x86: pmc_atom: clean up init function 2015-01-14 16:39 [PATCH v5 0/5] x86: clean ups and feature enhancement in pmc_atom Andy Shevchenko ` (2 preceding siblings ...) 2015-01-14 16:39 ` [PATCH v5 3/5] x86: pmc-atom: remove unused macro Andy Shevchenko @ 2015-01-14 16:39 ` Andy Shevchenko 2015-01-20 11:55 ` [tip:x86/platform] x86: pmc_atom: Clean " tip-bot for Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 5/5] x86: pmc_atom: expose contents of PSS Andy Shevchenko 4 siblings, 1 reply; 11+ messages in thread From: Andy Shevchenko @ 2015-01-14 16:39 UTC (permalink / raw) To: x86, Aubrey Li, Rafael J . Wysocki, Kumar P, Mahesh, linux-kernel, linux-acpi Cc: Andy Shevchenko There is no need to use err variable. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Aubrey Li <aubrey.li@linux.intel.com> --- arch/x86/kernel/pmc_atom.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 6b62f55..f8becc4 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -288,7 +288,6 @@ MODULE_DEVICE_TABLE(pci, pmc_pci_ids); static int __init pmc_atom_init(void) { - int err = -ENODEV; struct pci_dev *pdev = NULL; const struct pci_device_id *ent; @@ -302,14 +301,11 @@ static int __init pmc_atom_init(void) */ for_each_pci_dev(pdev) { ent = pci_match_id(pmc_pci_ids, pdev); - if (ent) { - err = pmc_setup_dev(pdev); - goto out; - } + if (ent) + return pmc_setup_dev(pdev); } /* Device not found. */ -out: - return err; + return -ENODEV; } module_init(pmc_atom_init); -- 2.1.4 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip:x86/platform] x86: pmc_atom: Clean up init function 2015-01-14 16:39 ` [PATCH v5 4/5] x86: pmc_atom: clean up init function Andy Shevchenko @ 2015-01-20 11:55 ` tip-bot for Andy Shevchenko 0 siblings, 0 replies; 11+ messages in thread From: tip-bot for Andy Shevchenko @ 2015-01-20 11:55 UTC (permalink / raw) To: linux-tip-commits Cc: linux-kernel, rafael.j.wysocki, tglx, aubrey.li, mingo, mahesh.kumar.p, andriy.shevchenko, hpa Commit-ID: 4b25f42a371b16807f0966490f8faad9abc712d9 Gitweb: http://git.kernel.org/tip/4b25f42a371b16807f0966490f8faad9abc712d9 Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> AuthorDate: Wed, 14 Jan 2015 18:39:34 +0200 Committer: Thomas Gleixner <tglx@linutronix.de> CommitDate: Tue, 20 Jan 2015 12:50:14 +0100 x86: pmc_atom: Clean up init function There is no need to use err variable. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Aubrey Li <aubrey.li@linux.intel.com> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Kumar P. Mahesh <mahesh.kumar.p@intel.com> Link: http://lkml.kernel.org/r/1421253575-22509-5-git-send-email-andriy.shevchenko@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- arch/x86/kernel/pmc_atom.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 6b62f55..f8becc4 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -288,7 +288,6 @@ MODULE_DEVICE_TABLE(pci, pmc_pci_ids); static int __init pmc_atom_init(void) { - int err = -ENODEV; struct pci_dev *pdev = NULL; const struct pci_device_id *ent; @@ -302,14 +301,11 @@ static int __init pmc_atom_init(void) */ for_each_pci_dev(pdev) { ent = pci_match_id(pmc_pci_ids, pdev); - if (ent) { - err = pmc_setup_dev(pdev); - goto out; - } + if (ent) + return pmc_setup_dev(pdev); } /* Device not found. */ -out: - return err; + return -ENODEV; } module_init(pmc_atom_init); ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 5/5] x86: pmc_atom: expose contents of PSS 2015-01-14 16:39 [PATCH v5 0/5] x86: clean ups and feature enhancement in pmc_atom Andy Shevchenko ` (3 preceding siblings ...) 2015-01-14 16:39 ` [PATCH v5 4/5] x86: pmc_atom: clean up init function Andy Shevchenko @ 2015-01-14 16:39 ` Andy Shevchenko 2015-01-20 11:56 ` [tip:x86/platform] x86: pmc_atom: Expose " tip-bot for Andy Shevchenko 4 siblings, 1 reply; 11+ messages in thread From: Andy Shevchenko @ 2015-01-14 16:39 UTC (permalink / raw) To: x86, Aubrey Li, Rafael J . Wysocki, Kumar P, Mahesh, linux-kernel, linux-acpi Cc: Andy Shevchenko The PSS register reflects the power state of each island on SoC. It would be useful to know which of the islands is on or off at the momemnt. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Aubrey Li <aubrey.li@linux.intel.com> --- arch/x86/include/asm/pmc_atom.h | 22 +++++++++++++++ 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 fc7a17c..bc0fc08 100644 --- a/arch/x86/include/asm/pmc_atom.h +++ b/arch/x86/include/asm/pmc_atom.h @@ -53,6 +53,28 @@ /* Sleep state counter is in units of of 32us */ #define PMC_TMR_SHIFT 5 +/* Power status of power islands */ +#define PMC_PSS 0x98 + +#define PMC_PSS_BIT_GBE BIT(0) +#define PMC_PSS_BIT_SATA BIT(1) +#define PMC_PSS_BIT_HDA BIT(2) +#define PMC_PSS_BIT_SEC BIT(3) +#define PMC_PSS_BIT_PCIE BIT(4) +#define PMC_PSS_BIT_LPSS BIT(5) +#define PMC_PSS_BIT_LPE BIT(6) +#define PMC_PSS_BIT_DFX BIT(7) +#define PMC_PSS_BIT_USH_CTRL BIT(8) +#define PMC_PSS_BIT_USH_SUS BIT(9) +#define PMC_PSS_BIT_USH_VCCS BIT(10) +#define PMC_PSS_BIT_USH_VCCA BIT(11) +#define PMC_PSS_BIT_OTG_CTRL BIT(12) +#define PMC_PSS_BIT_OTG_VCCS BIT(13) +#define PMC_PSS_BIT_OTG_VCCA_CLK BIT(14) +#define PMC_PSS_BIT_OTG_VCCA BIT(15) +#define PMC_PSS_BIT_USB BIT(16) +#define PMC_PSS_BIT_USB_SUS BIT(17) + /* These registers reflect D3 status of functions */ #define PMC_D3_STS_0 0xA0 diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index f8becc4..d66a4fe 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -36,12 +36,12 @@ struct pmc_dev { static struct pmc_dev pmc_device; static u32 acpi_base_addr; -struct pmc_dev_map { +struct pmc_bit_map { const char *name; u32 bit_mask; }; -static const struct pmc_dev_map dev_map[] = { +static const struct pmc_bit_map dev_map[] = { {"0 - LPSS1_F0_DMA", BIT_LPSS1_F0_DMA}, {"1 - LPSS1_F1_PWM1", BIT_LPSS1_F1_PWM1}, {"2 - LPSS1_F2_PWM2", BIT_LPSS1_F2_PWM2}, @@ -80,6 +80,27 @@ static const struct pmc_dev_map dev_map[] = { {"35 - DFX", BIT_DFX}, }; +static const struct pmc_bit_map pss_map[] = { + {"0 - GBE", PMC_PSS_BIT_GBE}, + {"1 - SATA", PMC_PSS_BIT_SATA}, + {"2 - HDA", PMC_PSS_BIT_HDA}, + {"3 - SEC", PMC_PSS_BIT_SEC}, + {"4 - PCIE", PMC_PSS_BIT_PCIE}, + {"5 - LPSS", PMC_PSS_BIT_LPSS}, + {"6 - LPE", PMC_PSS_BIT_LPE}, + {"7 - DFX", PMC_PSS_BIT_DFX}, + {"8 - USH_CTRL", PMC_PSS_BIT_USH_CTRL}, + {"9 - USH_SUS", PMC_PSS_BIT_USH_SUS}, + {"10 - USH_VCCS", PMC_PSS_BIT_USH_VCCS}, + {"11 - USH_VCCA", PMC_PSS_BIT_USH_VCCA}, + {"12 - OTG_CTRL", PMC_PSS_BIT_OTG_CTRL}, + {"13 - OTG_VCCS", PMC_PSS_BIT_OTG_VCCS}, + {"14 - OTG_VCCA_CLK", PMC_PSS_BIT_OTG_VCCA_CLK}, + {"15 - OTG_VCCA", PMC_PSS_BIT_OTG_VCCA}, + {"16 - USB", PMC_PSS_BIT_USB}, + {"17 - USB_SUS", PMC_PSS_BIT_USB_SUS}, +}; + static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset) { return readl(pmc->regmap + reg_offset); @@ -167,6 +188,32 @@ static const struct file_operations pmc_dev_state_ops = { .release = single_release, }; +static int pmc_pss_state_show(struct seq_file *s, void *unused) +{ + struct pmc_dev *pmc = s->private; + u32 pss = pmc_reg_read(pmc, PMC_PSS); + int pss_index; + + for (pss_index = 0; pss_index < ARRAY_SIZE(pss_map); pss_index++) { + seq_printf(s, "Island: %-32s\tState: %s\n", + pss_map[pss_index].name, + pss_map[pss_index].bit_mask & pss ? "Off" : "On"); + } + return 0; +} + +static int pmc_pss_state_open(struct inode *inode, struct file *file) +{ + return single_open(file, pmc_pss_state_show, inode->i_private); +} + +static const struct file_operations pmc_pss_state_ops = { + .open = pmc_pss_state_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static int pmc_sleep_tmr_show(struct seq_file *s, void *unused) { struct pmc_dev *pmc = s->private; @@ -216,9 +263,17 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, dir, pmc, &pmc_dev_state_ops); if (!f) { - dev_err(&pdev->dev, "dev_states register failed\n"); + dev_err(&pdev->dev, "dev_state register failed\n"); goto err; } + + f = debugfs_create_file("pss_state", S_IFREG | S_IRUGO, + dir, pmc, &pmc_pss_state_ops); + if (!f) { + dev_err(&pdev->dev, "pss_state register failed\n"); + goto err; + } + f = debugfs_create_file("sleep_state", S_IFREG | S_IRUGO, dir, pmc, &pmc_sleep_tmr_ops); if (!f) { -- 2.1.4 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip:x86/platform] x86: pmc_atom: Expose contents of PSS 2015-01-14 16:39 ` [PATCH v5 5/5] x86: pmc_atom: expose contents of PSS Andy Shevchenko @ 2015-01-20 11:56 ` tip-bot for Andy Shevchenko 0 siblings, 0 replies; 11+ messages in thread From: tip-bot for Andy Shevchenko @ 2015-01-20 11:56 UTC (permalink / raw) To: linux-tip-commits Cc: andriy.shevchenko, tglx, linux-kernel, rafael.j.wysocki, hpa, aubrey.li, mahesh.kumar.p, mingo Commit-ID: 0e1540208ef34a2246822fa56f751efe23748e7a Gitweb: http://git.kernel.org/tip/0e1540208ef34a2246822fa56f751efe23748e7a Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> AuthorDate: Wed, 14 Jan 2015 18:39:35 +0200 Committer: Thomas Gleixner <tglx@linutronix.de> CommitDate: Tue, 20 Jan 2015 12:50:14 +0100 x86: pmc_atom: Expose contents of PSS The PSS register reflects the power state of each island on SoC. It would be useful to know which of the islands is on or off at the momemnt. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Aubrey Li <aubrey.li@linux.intel.com> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Kumar P. Mahesh <mahesh.kumar.p@intel.com> Link: http://lkml.kernel.org/r/1421253575-22509-6-git-send-email-andriy.shevchenko@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- arch/x86/include/asm/pmc_atom.h | 22 +++++++++++++++ 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 fc7a17c..bc0fc08 100644 --- a/arch/x86/include/asm/pmc_atom.h +++ b/arch/x86/include/asm/pmc_atom.h @@ -53,6 +53,28 @@ /* Sleep state counter is in units of of 32us */ #define PMC_TMR_SHIFT 5 +/* Power status of power islands */ +#define PMC_PSS 0x98 + +#define PMC_PSS_BIT_GBE BIT(0) +#define PMC_PSS_BIT_SATA BIT(1) +#define PMC_PSS_BIT_HDA BIT(2) +#define PMC_PSS_BIT_SEC BIT(3) +#define PMC_PSS_BIT_PCIE BIT(4) +#define PMC_PSS_BIT_LPSS BIT(5) +#define PMC_PSS_BIT_LPE BIT(6) +#define PMC_PSS_BIT_DFX BIT(7) +#define PMC_PSS_BIT_USH_CTRL BIT(8) +#define PMC_PSS_BIT_USH_SUS BIT(9) +#define PMC_PSS_BIT_USH_VCCS BIT(10) +#define PMC_PSS_BIT_USH_VCCA BIT(11) +#define PMC_PSS_BIT_OTG_CTRL BIT(12) +#define PMC_PSS_BIT_OTG_VCCS BIT(13) +#define PMC_PSS_BIT_OTG_VCCA_CLK BIT(14) +#define PMC_PSS_BIT_OTG_VCCA BIT(15) +#define PMC_PSS_BIT_USB BIT(16) +#define PMC_PSS_BIT_USB_SUS BIT(17) + /* These registers reflect D3 status of functions */ #define PMC_D3_STS_0 0xA0 diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index f8becc4..d66a4fe 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -36,12 +36,12 @@ struct pmc_dev { static struct pmc_dev pmc_device; static u32 acpi_base_addr; -struct pmc_dev_map { +struct pmc_bit_map { const char *name; u32 bit_mask; }; -static const struct pmc_dev_map dev_map[] = { +static const struct pmc_bit_map dev_map[] = { {"0 - LPSS1_F0_DMA", BIT_LPSS1_F0_DMA}, {"1 - LPSS1_F1_PWM1", BIT_LPSS1_F1_PWM1}, {"2 - LPSS1_F2_PWM2", BIT_LPSS1_F2_PWM2}, @@ -80,6 +80,27 @@ static const struct pmc_dev_map dev_map[] = { {"35 - DFX", BIT_DFX}, }; +static const struct pmc_bit_map pss_map[] = { + {"0 - GBE", PMC_PSS_BIT_GBE}, + {"1 - SATA", PMC_PSS_BIT_SATA}, + {"2 - HDA", PMC_PSS_BIT_HDA}, + {"3 - SEC", PMC_PSS_BIT_SEC}, + {"4 - PCIE", PMC_PSS_BIT_PCIE}, + {"5 - LPSS", PMC_PSS_BIT_LPSS}, + {"6 - LPE", PMC_PSS_BIT_LPE}, + {"7 - DFX", PMC_PSS_BIT_DFX}, + {"8 - USH_CTRL", PMC_PSS_BIT_USH_CTRL}, + {"9 - USH_SUS", PMC_PSS_BIT_USH_SUS}, + {"10 - USH_VCCS", PMC_PSS_BIT_USH_VCCS}, + {"11 - USH_VCCA", PMC_PSS_BIT_USH_VCCA}, + {"12 - OTG_CTRL", PMC_PSS_BIT_OTG_CTRL}, + {"13 - OTG_VCCS", PMC_PSS_BIT_OTG_VCCS}, + {"14 - OTG_VCCA_CLK", PMC_PSS_BIT_OTG_VCCA_CLK}, + {"15 - OTG_VCCA", PMC_PSS_BIT_OTG_VCCA}, + {"16 - USB", PMC_PSS_BIT_USB}, + {"17 - USB_SUS", PMC_PSS_BIT_USB_SUS}, +}; + static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset) { return readl(pmc->regmap + reg_offset); @@ -167,6 +188,32 @@ static const struct file_operations pmc_dev_state_ops = { .release = single_release, }; +static int pmc_pss_state_show(struct seq_file *s, void *unused) +{ + struct pmc_dev *pmc = s->private; + u32 pss = pmc_reg_read(pmc, PMC_PSS); + int pss_index; + + for (pss_index = 0; pss_index < ARRAY_SIZE(pss_map); pss_index++) { + seq_printf(s, "Island: %-32s\tState: %s\n", + pss_map[pss_index].name, + pss_map[pss_index].bit_mask & pss ? "Off" : "On"); + } + return 0; +} + +static int pmc_pss_state_open(struct inode *inode, struct file *file) +{ + return single_open(file, pmc_pss_state_show, inode->i_private); +} + +static const struct file_operations pmc_pss_state_ops = { + .open = pmc_pss_state_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static int pmc_sleep_tmr_show(struct seq_file *s, void *unused) { struct pmc_dev *pmc = s->private; @@ -216,9 +263,17 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, dir, pmc, &pmc_dev_state_ops); if (!f) { - dev_err(&pdev->dev, "dev_states register failed\n"); + dev_err(&pdev->dev, "dev_state register failed\n"); goto err; } + + f = debugfs_create_file("pss_state", S_IFREG | S_IRUGO, + dir, pmc, &pmc_pss_state_ops); + if (!f) { + dev_err(&pdev->dev, "pss_state register failed\n"); + goto err; + } + f = debugfs_create_file("sleep_state", S_IFREG | S_IRUGO, dir, pmc, &pmc_sleep_tmr_ops); if (!f) { ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-01-20 11:56 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-01-14 16:39 [PATCH v5 0/5] x86: clean ups and feature enhancement in pmc_atom Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 1/5] x86: pmc-atom: assign debugfs node as soon as possible Andy Shevchenko 2015-01-20 11:54 ` [tip:x86/platform] x86: pmc-atom: Assign " tip-bot for Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 2/5] x86: pmc_atom: don't check for NULL twice Andy Shevchenko 2015-01-20 11:55 ` [tip:x86/platform] x86: pmc_atom: don%27t " tip-bot for Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 3/5] x86: pmc-atom: remove unused macro Andy Shevchenko 2015-01-20 11:55 ` [tip:x86/platform] x86: pmc-atom: Remove " tip-bot for Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 4/5] x86: pmc_atom: clean up init function Andy Shevchenko 2015-01-20 11:55 ` [tip:x86/platform] x86: pmc_atom: Clean " tip-bot for Andy Shevchenko 2015-01-14 16:39 ` [PATCH v5 5/5] x86: pmc_atom: expose contents of PSS Andy Shevchenko 2015-01-20 11:56 ` [tip:x86/platform] x86: pmc_atom: Expose " tip-bot for Andy Shevchenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome