Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

atomisp: eliminate intel_mid_pm.h

We can do this because the only thing it is used for is identifying the
platform for power management purposes. The driver only supports Baytrail
and Cherrytrail and both of those always need the IPU to be power managed
directly not via PCI D3 states.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alan Cox and committed by
Greg Kroah-Hartman
f406d033 5ac0a344

+10 -256
-233
drivers/staging/media/atomisp/include/linux/intel_mid_pm.h
··· 1 - /* 2 - * intel_mid_pm.h 3 - * Copyright (c) 2010, Intel Corporation. 4 - * 5 - * This program is free software; you can redistribute it and/or modify it 6 - * under the terms and conditions of the GNU General Public License, 7 - * version 2, as published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope it will be useful, but WITHOUT 10 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 - * more details. 13 - * 14 - */ 15 - #include <linux/errno.h> 16 - 17 - #ifndef INTEL_MID_PM_H 18 - #define INTEL_MID_PM_H 19 - 20 - #include "../asm/intel-mid.h" 21 - #include <linux/init.h> 22 - #include <linux/pci.h> 23 - 24 - 25 - /* Chip ID of Intel Atom SOC*/ 26 - #define INTEL_ATOM_MRST 0x26 27 - #define INTEL_ATOM_MFLD 0x27 28 - #define INTEL_ATOM_CLV 0x35 29 - #define INTEL_ATOM_MRFLD 0x4a 30 - #define INTEL_ATOM_BYT 0x37 31 - #define INTEL_ATOM_MOORFLD 0x5a 32 - #define INTEL_ATOM_CHT 0x4c 33 - 34 - static inline int platform_is(u8 model) 35 - { 36 - return boot_cpu_data.x86_model == model; 37 - } 38 - 39 - /* Register Type definitions */ 40 - #define OSPM_REG_TYPE 0x0 41 - #define APM_REG_TYPE 0x1 42 - #define OSPM_MAX_POWER_ISLANDS 16 43 - #define OSPM_ISLAND_UP 0x0 44 - #define OSPM_ISLAND_DOWN 0x1 45 - /*Soft reset*/ 46 - #define OSPM_ISLAND_SR 0x2 47 - 48 - /* North complex power islands definitions for APM block*/ 49 - #define APM_GRAPHICS_ISLAND 0x1 50 - #define APM_VIDEO_DEC_ISLAND 0x2 51 - #define APM_VIDEO_ENC_ISLAND 0x4 52 - #define APM_GL3_CACHE_ISLAND 0x8 53 - #define APM_ISP_ISLAND 0x10 54 - #define APM_IPH_ISLAND 0x20 55 - 56 - /* North complex power islands definitions for OSPM block*/ 57 - #define OSPM_DISPLAY_A_ISLAND 0x2 58 - #define OSPM_DISPLAY_B_ISLAND 0x80 59 - #define OSPM_DISPLAY_C_ISLAND 0x100 60 - #define OSPM_MIPI_ISLAND 0x200 61 - 62 - /* North Complex power islands definitions for Tangier */ 63 - #define TNG_ISP_ISLAND 0x1 64 - /* North Complex Register definitions for Tangier */ 65 - #define ISP_SS_PM0 0x39 66 - 67 - #define C4_STATE_IDX 3 68 - #define C6_STATE_IDX 4 69 - #define S0I1_STATE_IDX 5 70 - #define LPMP3_STATE_IDX 6 71 - #define S0I3_STATE_IDX 7 72 - 73 - #define C4_HINT (0x30) 74 - #define C6_HINT (0x52) 75 - 76 - #define CSTATE_EXIT_LATENCY_C1 1 77 - #define CSTATE_EXIT_LATENCY_C2 20 78 - #define CSTATE_EXIT_LATENCY_C4 100 79 - #define CSTATE_EXIT_LATENCY_C6 140 80 - #define CSTATE_EXIT_LATENCY_C7 1200 81 - 82 - /* Since entry latency is substantial 83 - * put exit_latency = entry+exit latency 84 - */ 85 - #ifdef CONFIG_REMOVEME_INTEL_ATOM_MRFLD_POWER 86 - #define CSTATE_EXIT_LATENCY_S0i1 1200 87 - #define CSTATE_EXIT_LATENCY_S0i2 2000 88 - #define CSTATE_EXIT_LATENCY_S0i3 10000 89 - #else 90 - #define CSTATE_EXIT_LATENCY_LPMP3 1040 91 - #define CSTATE_EXIT_LATENCY_S0i1 1040 92 - #define CSTATE_EXIT_LATENCY_S0i3 2800 93 - #endif 94 - #define BYT_S0I1_STATE 0x60 95 - #define BYT_S0I2_STATE 0x62 96 - #define BYT_LPMP3_STATE 0x62 97 - #define BYT_S0I3_STATE 0x64 98 - 99 - enum s3_parts { 100 - PROC_FRZ, 101 - DEV_SUS, 102 - NB_CPU_OFF, 103 - NB_CPU_ON, 104 - DEV_RES, 105 - PROC_UNFRZ, 106 - MAX_S3_PARTS 107 - }; 108 - 109 - #ifdef CONFIG_ATOM_SOC_POWER 110 - #define LOG_PMU_EVENTS 111 - 112 - /* Error codes for pmu */ 113 - #define PMU_SUCCESS 0 114 - #define PMU_FAILED -1 115 - #define PMU_BUSY_STATUS 0 116 - #define PMU_MODE_ID 1 117 - #define SET_MODE 1 118 - #define SET_AOAC_S0i1 2 119 - #define SET_AOAC_S0i3 3 120 - #define SET_LPAUDIO 4 121 - #define SET_AOAC_S0i2 7 122 - 123 - #ifdef CONFIG_REMOVEME_INTEL_ATOM_MRFLD_POWER 124 - #define MID_S0I1_STATE 0x60 125 - #define MID_S0I2_STATE 0x62 126 - #define MID_LPMP3_STATE 0x62 127 - #define MID_S0I3_STATE 0x64 128 - #else 129 - #define MID_S0I1_STATE 0x1 130 - #define MID_LPMP3_STATE 0x3 131 - #define MID_S0I2_STATE 0x7 132 - #define MID_S0I3_STATE 0x7 133 - #endif 134 - 135 - #define MID_S0IX_STATE 0xf 136 - #define MID_S3_STATE 0x1f 137 - #define MID_FAST_ON_OFF_STATE 0x3f 138 - 139 - /* combinations */ 140 - #define MID_LPI1_STATE 0x1f 141 - #define MID_LPI3_STATE 0x7f 142 - #define MID_I1I3_STATE 0xff 143 - 144 - #define REMOVE_LP_FROM_LPIX 4 145 - 146 - /* Power number for MID_POWER */ 147 - #define C0_POWER_USAGE 450 148 - #define C6_POWER_USAGE 200 149 - #define LPMP3_POWER_USAGE 130 150 - #define S0I1_POWER_USAGE 50 151 - #define S0I3_POWER_USAGE 31 152 - 153 - extern unsigned int enable_s3; 154 - extern unsigned int enable_s0ix; 155 - 156 - extern void pmu_s0ix_demotion_stat(int req_state, int grant_state); 157 - extern unsigned int pmu_get_new_cstate(unsigned int cstate, int *index); 158 - extern int get_target_platform_state(unsigned long *eax); 159 - extern int mid_s0ix_enter(int); 160 - extern int pmu_set_devices_in_d0i0(void); 161 - extern int pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t state); 162 - extern pci_power_t pmu_pci_choose_state(struct pci_dev *pdev); 163 - 164 - extern void time_stamp_in_suspend_flow(int mark, bool start); 165 - extern void time_stamp_for_sleep_state_latency(int sleep_state, 166 - bool start, bool entry); 167 - extern int mid_state_to_sys_state(int mid_state); 168 - extern void pmu_power_off(void); 169 - extern void pmu_set_s0ix_complete(void); 170 - extern bool pmu_is_s0ix_in_progress(void); 171 - extern int pmu_nc_set_power_state 172 - (int islands, int state_type, int reg_type); 173 - extern int pmu_nc_get_power_state(int island, int reg_type); 174 - extern int pmu_set_emmc_to_d0i0_atomic(void); 175 - 176 - #ifdef LOG_PMU_EVENTS 177 - extern void pmu_log_ipc(u32 command); 178 - extern void pmu_log_ipc_irq(void); 179 - #else 180 - static inline void pmu_log_ipc(u32 command) { return; }; 181 - static inline void pmu_log_ipc_irq(void) { return; }; 182 - #endif 183 - extern void dump_nc_power_history(void); 184 - 185 - extern bool mid_pmu_is_wake_source(u32 lss_number); 186 - 187 - extern void (*nc_report_power_state) (u32, int); 188 - #else 189 - 190 - /* 191 - * If CONFIG_ATOM_SOC_POWER is not defined 192 - * fall back to C6 193 - */ 194 - 195 - #define MID_S0I1_STATE C6_HINT 196 - #define MID_LPMP3_STATE C6_HINT 197 - #define MID_S0I3_STATE C6_HINT 198 - #define MID_S3_STATE C6_HINT 199 - #define MID_FAST_ON_OFF_STATE C6_HINT 200 - 201 - /* Power usage unknown if MID_POWER not defined */ 202 - #define C0_POWER_USAGE 0 203 - #define C6_POWER_USAGE 0 204 - #define LPMP3_POWER_USAGE 0 205 - #define S0I1_POWER_USAGE 0 206 - #define S0I3_POWER_USAGE 0 207 - 208 - #define TEMP_DTS_ID 43 209 - 210 - static inline int pmu_nc_set_power_state 211 - (int islands, int state_type, int reg_type) { return 0; } 212 - static inline int pmu_nc_get_power_state(int island, int reg_type) { return 0; } 213 - 214 - static inline void pmu_set_s0ix_complete(void) { return; } 215 - static inline bool pmu_is_s0ix_in_progress(void) { return false; }; 216 - static inline unsigned int pmu_get_new_cstate 217 - (unsigned int cstate, int *index) { return cstate; }; 218 - 219 - /*returns function not implemented*/ 220 - static inline void time_stamp_in_suspend_flow(int mark, bool start) {} 221 - static inline void time_stamp_for_sleep_state_latency(int sleep_state, 222 - bool start, bool entry) {} 223 - static inline int mid_state_to_sys_state(int mid_state) { return 0; } 224 - 225 - static inline int pmu_set_devices_in_d0i0(void) { return 0; } 226 - static inline void pmu_log_ipc(u32 command) { return; }; 227 - static inline void pmu_log_ipc_irq(void) { return; }; 228 - static inline int pmu_set_emmc_to_d0i0_atomic(void) { return -ENOSYS; } 229 - static inline void pmu_power_off(void) { return; } 230 - static inline bool mid_pmu_is_wake_source(u32 lss_number) { return false; } 231 - #endif /* #ifdef CONFIG_ATOM_SOC_POWER */ 232 - 233 - #endif /* #ifndef INTEL_MID_PM_H */
+10 -23
drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
··· 1 1 /* 2 2 * Support for Medifield PNW Camera Imaging ISP subsystem. 3 3 * 4 - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. 4 + * Copyright (c) 2010-2017 Intel Corporation. All Rights Reserved. 5 5 * 6 6 * Copyright (c) 2010 Silicon Hive www.siliconhive.com. 7 7 * ··· 27 27 #include <linux/timer.h> 28 28 #include <linux/delay.h> 29 29 #include <linux/interrupt.h> 30 - #include "../../include/linux/intel_mid_pm.h" 31 30 32 31 #include "../../include/linux/atomisp_gmin_platform.h" 33 32 ··· 46 47 #include "hrt/hive_isp_css_mm_hrt.h" 47 48 48 49 #include "device_access.h" 49 - #include "../../include/linux/intel_mid_pm.h" 50 50 #include <asm/intel-mid.h> 51 51 52 52 /* G-Min addition: pull this in from intel_mid_pm.h */ 53 53 #define CSTATE_EXIT_LATENCY_C1 1 54 - 55 - /* Moorefield lacks PCI PM, BYT advertises it but it's broken, use PUNIT */ 56 - #define ATOMISP_INTERNAL_PM (IS_MOFD || IS_BYT || IS_CHT) 57 54 58 55 #ifdef ISP2401 59 56 static uint skip_fwload = 0; ··· 521 526 if (ret) 522 527 return ret; 523 528 pm_qos_update_request(&isp->pm_qos, PM_QOS_DEFAULT_VALUE); 524 - if (ATOMISP_INTERNAL_PM) 525 - ret = atomisp_mrfld_power_down(isp); 529 + ret = atomisp_mrfld_power_down(isp); 526 530 527 531 return ret; 528 532 } ··· 532 538 dev_get_drvdata(dev); 533 539 int ret; 534 540 535 - if (ATOMISP_INTERNAL_PM) { 536 - ret = atomisp_mrfld_power_up(isp); 537 - if (ret) 541 + ret = atomisp_mrfld_power_up(isp); 542 + if (ret) 538 543 return ret; 539 - } 540 544 541 545 pm_qos_update_request(&isp->pm_qos, isp->max_isr_latency); 542 546 if (isp->sw_contex.power_state == ATOM_ISP_POWER_DOWN) { ··· 589 597 return ret; 590 598 } 591 599 pm_qos_update_request(&isp->pm_qos, PM_QOS_DEFAULT_VALUE); 592 - if (ATOMISP_INTERNAL_PM) 593 - ret = atomisp_mrfld_power_down(isp); 600 + ret = atomisp_mrfld_power_down(isp); 594 601 595 602 return ret; 596 603 } ··· 600 609 dev_get_drvdata(dev); 601 610 int ret; 602 611 603 - if (ATOMISP_INTERNAL_PM) { 604 - ret = atomisp_mrfld_power_up(isp); 605 - if (ret) 606 - return ret; 607 - } 612 + ret = atomisp_mrfld_power_up(isp); 613 + if (ret) 614 + return ret; 608 615 609 616 pm_qos_update_request(&isp->pm_qos, isp->max_isr_latency); 610 617 ··· 1534 1545 atomisp_ospm_dphy_down(isp); 1535 1546 1536 1547 /* Address later when we worry about the ...field chips */ 1537 - if (ATOMISP_INTERNAL_PM) { 1538 - if (atomisp_mrfld_power_down(isp)) 1539 - dev_err(&dev->dev, "Failed to switch off ISP\n"); 1540 - } 1548 + if (atomisp_mrfld_power_down(isp)) 1549 + dev_err(&dev->dev, "Failed to switch off ISP\n"); 1541 1550 pci_dev_put(isp->pci_root); 1542 1551 return err; 1543 1552 }