|
@@ -15,7 +15,6 @@
|
|
|
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
|
|
-#include <linux/module.h>
|
|
|
#include <linux/init.h>
|
|
|
#include <linux/pci.h>
|
|
|
#include <linux/device.h>
|
|
@@ -25,80 +24,149 @@
|
|
|
|
|
|
#include <asm/pmc_atom.h>
|
|
|
|
|
|
+struct pmc_bit_map {
|
|
|
+ const char *name;
|
|
|
+ u32 bit_mask;
|
|
|
+};
|
|
|
+
|
|
|
+struct pmc_reg_map {
|
|
|
+ const struct pmc_bit_map *d3_sts_0;
|
|
|
+ const struct pmc_bit_map *d3_sts_1;
|
|
|
+ const struct pmc_bit_map *func_dis;
|
|
|
+ const struct pmc_bit_map *func_dis_2;
|
|
|
+ const struct pmc_bit_map *pss;
|
|
|
+};
|
|
|
+
|
|
|
struct pmc_dev {
|
|
|
u32 base_addr;
|
|
|
void __iomem *regmap;
|
|
|
+ const struct pmc_reg_map *map;
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
struct dentry *dbgfs_dir;
|
|
|
#endif /* CONFIG_DEBUG_FS */
|
|
|
+ bool init;
|
|
|
};
|
|
|
|
|
|
static struct pmc_dev pmc_device;
|
|
|
static u32 acpi_base_addr;
|
|
|
|
|
|
-struct pmc_bit_map {
|
|
|
- const char *name;
|
|
|
- u32 bit_mask;
|
|
|
+static const struct pmc_bit_map d3_sts_0_map[] = {
|
|
|
+ {"LPSS1_F0_DMA", BIT_LPSS1_F0_DMA},
|
|
|
+ {"LPSS1_F1_PWM1", BIT_LPSS1_F1_PWM1},
|
|
|
+ {"LPSS1_F2_PWM2", BIT_LPSS1_F2_PWM2},
|
|
|
+ {"LPSS1_F3_HSUART1", BIT_LPSS1_F3_HSUART1},
|
|
|
+ {"LPSS1_F4_HSUART2", BIT_LPSS1_F4_HSUART2},
|
|
|
+ {"LPSS1_F5_SPI", BIT_LPSS1_F5_SPI},
|
|
|
+ {"LPSS1_F6_Reserved", BIT_LPSS1_F6_XXX},
|
|
|
+ {"LPSS1_F7_Reserved", BIT_LPSS1_F7_XXX},
|
|
|
+ {"SCC_EMMC", BIT_SCC_EMMC},
|
|
|
+ {"SCC_SDIO", BIT_SCC_SDIO},
|
|
|
+ {"SCC_SDCARD", BIT_SCC_SDCARD},
|
|
|
+ {"SCC_MIPI", BIT_SCC_MIPI},
|
|
|
+ {"HDA", BIT_HDA},
|
|
|
+ {"LPE", BIT_LPE},
|
|
|
+ {"OTG", BIT_OTG},
|
|
|
+ {"USH", BIT_USH},
|
|
|
+ {"GBE", BIT_GBE},
|
|
|
+ {"SATA", BIT_SATA},
|
|
|
+ {"USB_EHCI", BIT_USB_EHCI},
|
|
|
+ {"SEC", BIT_SEC},
|
|
|
+ {"PCIE_PORT0", BIT_PCIE_PORT0},
|
|
|
+ {"PCIE_PORT1", BIT_PCIE_PORT1},
|
|
|
+ {"PCIE_PORT2", BIT_PCIE_PORT2},
|
|
|
+ {"PCIE_PORT3", BIT_PCIE_PORT3},
|
|
|
+ {"LPSS2_F0_DMA", BIT_LPSS2_F0_DMA},
|
|
|
+ {"LPSS2_F1_I2C1", BIT_LPSS2_F1_I2C1},
|
|
|
+ {"LPSS2_F2_I2C2", BIT_LPSS2_F2_I2C2},
|
|
|
+ {"LPSS2_F3_I2C3", BIT_LPSS2_F3_I2C3},
|
|
|
+ {"LPSS2_F3_I2C4", BIT_LPSS2_F4_I2C4},
|
|
|
+ {"LPSS2_F5_I2C5", BIT_LPSS2_F5_I2C5},
|
|
|
+ {"LPSS2_F6_I2C6", BIT_LPSS2_F6_I2C6},
|
|
|
+ {"LPSS2_F7_I2C7", BIT_LPSS2_F7_I2C7},
|
|
|
+ {},
|
|
|
+};
|
|
|
+
|
|
|
+static struct pmc_bit_map byt_d3_sts_1_map[] = {
|
|
|
+ {"SMB", BIT_SMB},
|
|
|
+ {"OTG_SS_PHY", BIT_OTG_SS_PHY},
|
|
|
+ {"USH_SS_PHY", BIT_USH_SS_PHY},
|
|
|
+ {"DFX", BIT_DFX},
|
|
|
+ {},
|
|
|
};
|
|
|
|
|
|
-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},
|
|
|
- {"3 - LPSS1_F3_HSUART1", BIT_LPSS1_F3_HSUART1},
|
|
|
- {"4 - LPSS1_F4_HSUART2", BIT_LPSS1_F4_HSUART2},
|
|
|
- {"5 - LPSS1_F5_SPI", BIT_LPSS1_F5_SPI},
|
|
|
- {"6 - LPSS1_F6_Reserved", BIT_LPSS1_F6_XXX},
|
|
|
- {"7 - LPSS1_F7_Reserved", BIT_LPSS1_F7_XXX},
|
|
|
- {"8 - SCC_EMMC", BIT_SCC_EMMC},
|
|
|
- {"9 - SCC_SDIO", BIT_SCC_SDIO},
|
|
|
- {"10 - SCC_SDCARD", BIT_SCC_SDCARD},
|
|
|
- {"11 - SCC_MIPI", BIT_SCC_MIPI},
|
|
|
- {"12 - HDA", BIT_HDA},
|
|
|
- {"13 - LPE", BIT_LPE},
|
|
|
- {"14 - OTG", BIT_OTG},
|
|
|
- {"15 - USH", BIT_USH},
|
|
|
- {"16 - GBE", BIT_GBE},
|
|
|
- {"17 - SATA", BIT_SATA},
|
|
|
- {"18 - USB_EHCI", BIT_USB_EHCI},
|
|
|
- {"19 - SEC", BIT_SEC},
|
|
|
- {"20 - PCIE_PORT0", BIT_PCIE_PORT0},
|
|
|
- {"21 - PCIE_PORT1", BIT_PCIE_PORT1},
|
|
|
- {"22 - PCIE_PORT2", BIT_PCIE_PORT2},
|
|
|
- {"23 - PCIE_PORT3", BIT_PCIE_PORT3},
|
|
|
- {"24 - LPSS2_F0_DMA", BIT_LPSS2_F0_DMA},
|
|
|
- {"25 - LPSS2_F1_I2C1", BIT_LPSS2_F1_I2C1},
|
|
|
- {"26 - LPSS2_F2_I2C2", BIT_LPSS2_F2_I2C2},
|
|
|
- {"27 - LPSS2_F3_I2C3", BIT_LPSS2_F3_I2C3},
|
|
|
- {"28 - LPSS2_F3_I2C4", BIT_LPSS2_F4_I2C4},
|
|
|
- {"29 - LPSS2_F5_I2C5", BIT_LPSS2_F5_I2C5},
|
|
|
- {"30 - LPSS2_F6_I2C6", BIT_LPSS2_F6_I2C6},
|
|
|
- {"31 - LPSS2_F7_I2C7", BIT_LPSS2_F7_I2C7},
|
|
|
- {"32 - SMB", BIT_SMB},
|
|
|
- {"33 - OTG_SS_PHY", BIT_OTG_SS_PHY},
|
|
|
- {"34 - USH_SS_PHY", BIT_USH_SS_PHY},
|
|
|
- {"35 - DFX", BIT_DFX},
|
|
|
+static struct pmc_bit_map cht_d3_sts_1_map[] = {
|
|
|
+ {"SMB", BIT_SMB},
|
|
|
+ {"GMM", BIT_STS_GMM},
|
|
|
+ {"ISH", BIT_STS_ISH},
|
|
|
+ {},
|
|
|
};
|
|
|
|
|
|
-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 struct pmc_bit_map cht_func_dis_2_map[] = {
|
|
|
+ {"SMB", BIT_SMB},
|
|
|
+ {"GMM", BIT_FD_GMM},
|
|
|
+ {"ISH", BIT_FD_ISH},
|
|
|
+ {},
|
|
|
+};
|
|
|
+
|
|
|
+static const struct pmc_bit_map byt_pss_map[] = {
|
|
|
+ {"GBE", PMC_PSS_BIT_GBE},
|
|
|
+ {"SATA", PMC_PSS_BIT_SATA},
|
|
|
+ {"HDA", PMC_PSS_BIT_HDA},
|
|
|
+ {"SEC", PMC_PSS_BIT_SEC},
|
|
|
+ {"PCIE", PMC_PSS_BIT_PCIE},
|
|
|
+ {"LPSS", PMC_PSS_BIT_LPSS},
|
|
|
+ {"LPE", PMC_PSS_BIT_LPE},
|
|
|
+ {"DFX", PMC_PSS_BIT_DFX},
|
|
|
+ {"USH_CTRL", PMC_PSS_BIT_USH_CTRL},
|
|
|
+ {"USH_SUS", PMC_PSS_BIT_USH_SUS},
|
|
|
+ {"USH_VCCS", PMC_PSS_BIT_USH_VCCS},
|
|
|
+ {"USH_VCCA", PMC_PSS_BIT_USH_VCCA},
|
|
|
+ {"OTG_CTRL", PMC_PSS_BIT_OTG_CTRL},
|
|
|
+ {"OTG_VCCS", PMC_PSS_BIT_OTG_VCCS},
|
|
|
+ {"OTG_VCCA_CLK", PMC_PSS_BIT_OTG_VCCA_CLK},
|
|
|
+ {"OTG_VCCA", PMC_PSS_BIT_OTG_VCCA},
|
|
|
+ {"USB", PMC_PSS_BIT_USB},
|
|
|
+ {"USB_SUS", PMC_PSS_BIT_USB_SUS},
|
|
|
+ {},
|
|
|
+};
|
|
|
+
|
|
|
+static const struct pmc_bit_map cht_pss_map[] = {
|
|
|
+ {"SATA", PMC_PSS_BIT_SATA},
|
|
|
+ {"HDA", PMC_PSS_BIT_HDA},
|
|
|
+ {"SEC", PMC_PSS_BIT_SEC},
|
|
|
+ {"PCIE", PMC_PSS_BIT_PCIE},
|
|
|
+ {"LPSS", PMC_PSS_BIT_LPSS},
|
|
|
+ {"LPE", PMC_PSS_BIT_LPE},
|
|
|
+ {"UFS", PMC_PSS_BIT_CHT_UFS},
|
|
|
+ {"UXD", PMC_PSS_BIT_CHT_UXD},
|
|
|
+ {"UXD_FD", PMC_PSS_BIT_CHT_UXD_FD},
|
|
|
+ {"UX_ENG", PMC_PSS_BIT_CHT_UX_ENG},
|
|
|
+ {"USB_SUS", PMC_PSS_BIT_CHT_USB_SUS},
|
|
|
+ {"GMM", PMC_PSS_BIT_CHT_GMM},
|
|
|
+ {"ISH", PMC_PSS_BIT_CHT_ISH},
|
|
|
+ {"DFX_MASTER", PMC_PSS_BIT_CHT_DFX_MASTER},
|
|
|
+ {"DFX_CLUSTER1", PMC_PSS_BIT_CHT_DFX_CLUSTER1},
|
|
|
+ {"DFX_CLUSTER2", PMC_PSS_BIT_CHT_DFX_CLUSTER2},
|
|
|
+ {"DFX_CLUSTER3", PMC_PSS_BIT_CHT_DFX_CLUSTER3},
|
|
|
+ {"DFX_CLUSTER4", PMC_PSS_BIT_CHT_DFX_CLUSTER4},
|
|
|
+ {"DFX_CLUSTER5", PMC_PSS_BIT_CHT_DFX_CLUSTER5},
|
|
|
+ {},
|
|
|
+};
|
|
|
+
|
|
|
+static const struct pmc_reg_map byt_reg_map = {
|
|
|
+ .d3_sts_0 = d3_sts_0_map,
|
|
|
+ .d3_sts_1 = byt_d3_sts_1_map,
|
|
|
+ .func_dis = d3_sts_0_map,
|
|
|
+ .func_dis_2 = byt_d3_sts_1_map,
|
|
|
+ .pss = byt_pss_map,
|
|
|
+};
|
|
|
+
|
|
|
+static const struct pmc_reg_map cht_reg_map = {
|
|
|
+ .d3_sts_0 = d3_sts_0_map,
|
|
|
+ .d3_sts_1 = cht_d3_sts_1_map,
|
|
|
+ .func_dis = d3_sts_0_map,
|
|
|
+ .func_dis_2 = cht_func_dis_2_map,
|
|
|
+ .pss = cht_pss_map,
|
|
|
};
|
|
|
|
|
|
static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset)
|
|
@@ -111,6 +179,30 @@ static inline void pmc_reg_write(struct pmc_dev *pmc, int reg_offset, u32 val)
|
|
|
writel(val, pmc->regmap + reg_offset);
|
|
|
}
|
|
|
|
|
|
+int pmc_atom_read(int offset, u32 *value)
|
|
|
+{
|
|
|
+ struct pmc_dev *pmc = &pmc_device;
|
|
|
+
|
|
|
+ if (!pmc->init)
|
|
|
+ return -ENODEV;
|
|
|
+
|
|
|
+ *value = pmc_reg_read(pmc, offset);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(pmc_atom_read);
|
|
|
+
|
|
|
+int pmc_atom_write(int offset, u32 value)
|
|
|
+{
|
|
|
+ struct pmc_dev *pmc = &pmc_device;
|
|
|
+
|
|
|
+ if (!pmc->init)
|
|
|
+ return -ENODEV;
|
|
|
+
|
|
|
+ pmc_reg_write(pmc, offset, value);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(pmc_atom_write);
|
|
|
+
|
|
|
static void pmc_power_off(void)
|
|
|
{
|
|
|
u16 pm1_cnt_port;
|
|
@@ -142,37 +234,39 @@ static void pmc_hw_reg_setup(struct pmc_dev *pmc)
|
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
+static void pmc_dev_state_print(struct seq_file *s, int reg_index,
|
|
|
+ u32 sts, const struct pmc_bit_map *sts_map,
|
|
|
+ u32 fd, const struct pmc_bit_map *fd_map)
|
|
|
+{
|
|
|
+ int offset = PMC_REG_BIT_WIDTH * reg_index;
|
|
|
+ int index;
|
|
|
+
|
|
|
+ for (index = 0; sts_map[index].name; index++) {
|
|
|
+ seq_printf(s, "Dev: %-2d - %-32s\tState: %s [%s]\n",
|
|
|
+ offset + index, sts_map[index].name,
|
|
|
+ fd_map[index].bit_mask & fd ? "Disabled" : "Enabled ",
|
|
|
+ sts_map[index].bit_mask & sts ? "D3" : "D0");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static int pmc_dev_state_show(struct seq_file *s, void *unused)
|
|
|
{
|
|
|
struct pmc_dev *pmc = s->private;
|
|
|
- u32 func_dis, func_dis_2, func_dis_index;
|
|
|
- u32 d3_sts_0, d3_sts_1, d3_sts_index;
|
|
|
- int dev_num, dev_index, reg_index;
|
|
|
+ const struct pmc_reg_map *m = pmc->map;
|
|
|
+ u32 func_dis, func_dis_2;
|
|
|
+ u32 d3_sts_0, d3_sts_1;
|
|
|
|
|
|
func_dis = pmc_reg_read(pmc, PMC_FUNC_DIS);
|
|
|
func_dis_2 = pmc_reg_read(pmc, PMC_FUNC_DIS_2);
|
|
|
d3_sts_0 = pmc_reg_read(pmc, PMC_D3_STS_0);
|
|
|
d3_sts_1 = pmc_reg_read(pmc, PMC_D3_STS_1);
|
|
|
|
|
|
- dev_num = ARRAY_SIZE(dev_map);
|
|
|
-
|
|
|
- for (dev_index = 0; dev_index < dev_num; dev_index++) {
|
|
|
- reg_index = dev_index / PMC_REG_BIT_WIDTH;
|
|
|
- if (reg_index) {
|
|
|
- func_dis_index = func_dis_2;
|
|
|
- d3_sts_index = d3_sts_1;
|
|
|
- } else {
|
|
|
- func_dis_index = func_dis;
|
|
|
- d3_sts_index = d3_sts_0;
|
|
|
- }
|
|
|
-
|
|
|
- seq_printf(s, "Dev: %-32s\tState: %s [%s]\n",
|
|
|
- dev_map[dev_index].name,
|
|
|
- dev_map[dev_index].bit_mask & func_dis_index ?
|
|
|
- "Disabled" : "Enabled ",
|
|
|
- dev_map[dev_index].bit_mask & d3_sts_index ?
|
|
|
- "D3" : "D0");
|
|
|
- }
|
|
|
+ /* Low part */
|
|
|
+ pmc_dev_state_print(s, 0, d3_sts_0, m->d3_sts_0, func_dis, m->func_dis);
|
|
|
+
|
|
|
+ /* High part */
|
|
|
+ pmc_dev_state_print(s, 1, d3_sts_1, m->d3_sts_1, func_dis_2, m->func_dis_2);
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -191,13 +285,14 @@ static const struct file_operations pmc_dev_state_ops = {
|
|
|
static int pmc_pss_state_show(struct seq_file *s, void *unused)
|
|
|
{
|
|
|
struct pmc_dev *pmc = s->private;
|
|
|
+ const struct pmc_bit_map *map = pmc->map->pss;
|
|
|
u32 pss = pmc_reg_read(pmc, PMC_PSS);
|
|
|
- int pss_index;
|
|
|
+ int 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");
|
|
|
+ for (index = 0; map[index].name; index++) {
|
|
|
+ seq_printf(s, "Island: %-2d - %-32s\tState: %s\n",
|
|
|
+ index, map[index].name,
|
|
|
+ map[index].bit_mask & pss ? "Off" : "On");
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
@@ -250,7 +345,7 @@ static void pmc_dbgfs_unregister(struct pmc_dev *pmc)
|
|
|
debugfs_remove_recursive(pmc->dbgfs_dir);
|
|
|
}
|
|
|
|
|
|
-static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev)
|
|
|
+static int pmc_dbgfs_register(struct pmc_dev *pmc)
|
|
|
{
|
|
|
struct dentry *dir, *f;
|
|
|
|
|
@@ -262,24 +357,18 @@ 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_state register failed\n");
|
|
|
+ if (!f)
|
|
|
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");
|
|
|
+ if (!f)
|
|
|
goto err;
|
|
|
- }
|
|
|
|
|
|
f = debugfs_create_file("sleep_state", S_IFREG | S_IRUGO,
|
|
|
dir, pmc, &pmc_sleep_tmr_ops);
|
|
|
- if (!f) {
|
|
|
- dev_err(&pdev->dev, "sleep_state register failed\n");
|
|
|
+ if (!f)
|
|
|
goto err;
|
|
|
- }
|
|
|
|
|
|
return 0;
|
|
|
err:
|
|
@@ -287,15 +376,16 @@ err:
|
|
|
return -ENODEV;
|
|
|
}
|
|
|
#else
|
|
|
-static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev)
|
|
|
+static int pmc_dbgfs_register(struct pmc_dev *pmc)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
#endif /* CONFIG_DEBUG_FS */
|
|
|
|
|
|
-static int pmc_setup_dev(struct pci_dev *pdev)
|
|
|
+static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
|
{
|
|
|
struct pmc_dev *pmc = &pmc_device;
|
|
|
+ const struct pmc_reg_map *map = (struct pmc_reg_map *)ent->driver_data;
|
|
|
int ret;
|
|
|
|
|
|
/* Obtain ACPI base address */
|
|
@@ -315,32 +405,30 @@ static int pmc_setup_dev(struct pci_dev *pdev)
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
|
|
|
+ pmc->map = map;
|
|
|
+
|
|
|
/* PMC hardware registers setup */
|
|
|
pmc_hw_reg_setup(pmc);
|
|
|
|
|
|
- ret = pmc_dbgfs_register(pmc, pdev);
|
|
|
- if (ret) {
|
|
|
- iounmap(pmc->regmap);
|
|
|
- }
|
|
|
+ ret = pmc_dbgfs_register(pmc);
|
|
|
+ if (ret)
|
|
|
+ dev_warn(&pdev->dev, "debugfs register failed\n");
|
|
|
|
|
|
+ pmc->init = true;
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* Data for PCI driver interface
|
|
|
*
|
|
|
- * This data only exists for exporting the supported
|
|
|
- * PCI ids via MODULE_DEVICE_TABLE. We do not actually
|
|
|
- * register a pci_driver, because lpc_ich will register
|
|
|
- * a driver on the same PCI id.
|
|
|
+ * used by pci_match_id() call below.
|
|
|
*/
|
|
|
static const struct pci_device_id pmc_pci_ids[] = {
|
|
|
- { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_VLV_PMC) },
|
|
|
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_VLV_PMC), (kernel_ulong_t)&byt_reg_map },
|
|
|
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_CHT_PMC), (kernel_ulong_t)&cht_reg_map },
|
|
|
{ 0, },
|
|
|
};
|
|
|
|
|
|
-MODULE_DEVICE_TABLE(pci, pmc_pci_ids);
|
|
|
-
|
|
|
static int __init pmc_atom_init(void)
|
|
|
{
|
|
|
struct pci_dev *pdev = NULL;
|
|
@@ -357,15 +445,16 @@ static int __init pmc_atom_init(void)
|
|
|
for_each_pci_dev(pdev) {
|
|
|
ent = pci_match_id(pmc_pci_ids, pdev);
|
|
|
if (ent)
|
|
|
- return pmc_setup_dev(pdev);
|
|
|
+ return pmc_setup_dev(pdev, ent);
|
|
|
}
|
|
|
/* Device not found. */
|
|
|
return -ENODEV;
|
|
|
}
|
|
|
|
|
|
-module_init(pmc_atom_init);
|
|
|
-/* no module_exit, this driver shouldn't be unloaded */
|
|
|
+device_initcall(pmc_atom_init);
|
|
|
|
|
|
+/*
|
|
|
MODULE_AUTHOR("Aubrey Li <aubrey.li@linux.intel.com>");
|
|
|
MODULE_DESCRIPTION("Intel Atom SOC Power Management Controller Interface");
|
|
|
MODULE_LICENSE("GPL v2");
|
|
|
+*/
|