It is currently possible to build both MRST and MFLD into the kernel.
So we need to avoid a name conflict,
and bind the right version of pmu_pci_set_power_state().
Signed-off-by: Len Brown <len.brown@intel.com>
extern void mrst_rtc_init(void);
-extern int pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t state);
+extern int mrst_pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t state);
+extern int mfld_pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t state);
#ifdef CONFIG_X86_MRST
extern int mrst_pmu_s0i3_entry(void);
* Locking strategy::
*
* Two semaphores are used to lock the global variables used in
- * the code. The entry points in pmu driver are pmu_pci_set_power_state()
+ * the code. The entry points in pmu driver are mfld_pmu_pci_set_power_state()
* and PMU interrupt handler contexts, so here is the flow of how
* the semaphores are used.
*
EXPORT_SYMBOL(pmu_nc_set_power_state);
/**
- * pmu_pci_set_power_state - Callback function is used by all the PCI devices
+ * mfld_pmu_pci_set_power_state - Callback function is used by all the PCI devices
* for a platform specific device power on/shutdown.
*
*/
-int __ref pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t state)
+int __ref mfld_pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t state)
{
int i;
u32 pm_cmd_val;
/* Try to acquire the scu_ready_sem, if not
* get blocked, until pmu_sc_irq() releases */
+
+if (in_interrupt()) {
+ dev_err(&pmu_dev->dev, "mfld_pmu_pci_set_power_state() called from interrupt context!\n");
+ return -1;
+}
+
down_scu_timed(&scu_ready_sem);
interactive_cmd_sent = 1;
}
/**
- * pmu_pci_set_power_state - Callback function is used by all the PCI devices
+ * mrst_pmu_pci_set_power_state - Callback function is used by all the PCI devices
* for a platform specific device power on/shutdown.
*/
-int pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t pci_state)
+int mrst_pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t pci_state)
{
u32 old_sss, new_sss;
int status = 0;
static struct pci_platform_pm_ops mid_pci_platform_pm = {
.is_manageable = mid_pci_power_manageable,
- .set_state = pmu_pci_set_power_state,
.choose_state = mid_pci_choose_state,
.can_wakeup = mid_pci_can_wakeup,
.sleep_wake = mid_pci_sleep_wake,
*/
static int __init mid_pci_init(void)
{
- int ret = 0;
-
pr_info("mid_pci_init is called\n");
- pci_set_platform_pm(&mid_pci_platform_pm);
+ if (!boot_cpu_data.x86 == 6)
+ return 0;
+
+ /*
+ * n.b. this model check does not uniquely identify the platform,
+ * and additional checks are necessary inside the pmu driver
+ */
+ switch(boot_cpu_data.x86_model) {
+#ifdef CONFIG_X86_MRST
+ case 0x26:
+ mid_pci_platform_pm.set_state = mrst_pmu_pci_set_power_state;
+ pci_set_platform_pm(&mid_pci_platform_pm);
+ break;
+#endif
+#ifdef CONFIG_X86_MDFLD
+ case 0x27:
+ mid_pci_platform_pm.set_state = mfld_pmu_pci_set_power_state;
+ pci_set_platform_pm(&mid_pci_platform_pm);
+ break;
+#endif
+ }
- return ret;
+ return 0;
}
arch_initcall(mid_pci_init);