|
17 | 17 | #include <linux/platform_device.h>
|
18 | 18 | #include <linux/mfd/intel_msic.h>
|
19 | 19 | #include <asm/intel-mid.h>
|
| 20 | +#include <asm/intel_mid_gpadc.h> |
| 21 | +#include <asm/intel_mid_thermal.h> |
| 22 | +#include <linux/platform_data/intel_mid_remoteproc.h> |
20 | 23 | #include "platform_msic.h"
|
21 | 24 | #include "platform_msic_thermal.h"
|
22 | 25 |
|
| 26 | +/* ctp thermal sensor list */ |
| 27 | +static struct intel_mid_thermal_sensor ctp_sensors[] = { |
| 28 | + { |
| 29 | + .name = SKIN0_NAME, |
| 30 | + .index = 0, |
| 31 | + .slope = 410, |
| 32 | + .intercept = 16808, |
| 33 | + .adc_channel = 0x04 | CH_NEED_VREF | CH_NEED_VCALIB, |
| 34 | + .temp_correlation = skin0_temp_correlation, |
| 35 | + .direct = false, |
| 36 | + }, |
| 37 | + { |
| 38 | + .name = SKIN1_NAME, |
| 39 | + .index = 1, |
| 40 | + .slope = 665, |
| 41 | + .intercept = 8375, |
| 42 | + .adc_channel = 0x04 | CH_NEED_VREF | CH_NEED_VCALIB, |
| 43 | + .temp_correlation = skin0_temp_correlation, |
| 44 | + .direct = false, |
| 45 | + }, |
| 46 | + { |
| 47 | + .name = MSIC_DIE_NAME, |
| 48 | + .index = 2, |
| 49 | + .slope = 368, |
| 50 | + .intercept = 219560, |
| 51 | + .adc_channel = 0x03 | CH_NEED_VCALIB, |
| 52 | + .direct = true, |
| 53 | + }, |
| 54 | + { |
| 55 | + .name = BPTHERM_NAME, |
| 56 | + .index = 3, |
| 57 | + .slope = 788, |
| 58 | + .intercept = 5065, |
| 59 | + .adc_channel = 0x09 | CH_NEED_VREF | CH_NEED_VCALIB, |
| 60 | + .temp_correlation = bptherm_temp_correlation, |
| 61 | + .direct = false, |
| 62 | + }, |
| 63 | + |
| 64 | +}; |
| 65 | + |
| 66 | +/* mfld thermal sensor list */ |
| 67 | +static struct intel_mid_thermal_sensor mfld_sensors[] = { |
| 68 | + { |
| 69 | + .name = SKIN0_NAME, |
| 70 | + .index = 0, |
| 71 | + .slope = 851, |
| 72 | + .intercept = 2800, |
| 73 | + .adc_channel = 0x08 | CH_NEED_VREF | CH_NEED_VCALIB, |
| 74 | + .temp_correlation = skin0_temp_correlation, |
| 75 | + .direct = false, |
| 76 | + }, |
| 77 | + { |
| 78 | + .name = SKIN1_NAME, |
| 79 | + .index = 1, |
| 80 | + .slope = 806, |
| 81 | + .intercept = 1800, |
| 82 | + .adc_channel = 0x08 | CH_NEED_VREF | CH_NEED_VCALIB, |
| 83 | + .temp_correlation = skin1_temp_correlation, |
| 84 | + .direct = false, |
| 85 | + }, |
| 86 | + { |
| 87 | + .name = MSIC_SYS_NAME, |
| 88 | + .index = 2, |
| 89 | + .slope = 0, |
| 90 | + .intercept = 0, |
| 91 | + .adc_channel = 0x0A | CH_NEED_VREF | CH_NEED_VCALIB, |
| 92 | + .direct = false, |
| 93 | + }, |
| 94 | + { |
| 95 | + .name = MSIC_DIE_NAME, |
| 96 | + .index = 3, |
| 97 | + .slope = 368, |
| 98 | + .intercept = 219560, |
| 99 | + .adc_channel = 0x03 | CH_NEED_VCALIB, |
| 100 | + .direct = true, |
| 101 | + }, |
| 102 | + |
| 103 | +}; |
| 104 | + |
| 105 | +/* LEX thermal sensor list */ |
| 106 | +static struct intel_mid_thermal_sensor lex_sensors[] = { |
| 107 | + { |
| 108 | + .name = SKIN0_NAME, |
| 109 | + .index = 0, |
| 110 | + .slope = 851, |
| 111 | + .intercept = 2800, |
| 112 | + .adc_channel = 0x08 | CH_NEED_VREF | CH_NEED_VCALIB, |
| 113 | + .temp_correlation = skin0_temp_correlation, |
| 114 | + .direct = false, |
| 115 | + }, |
| 116 | + { |
| 117 | + .name = SKIN1_NAME, |
| 118 | + .index = 1, |
| 119 | + .slope = 806, |
| 120 | + .intercept = 1800, |
| 121 | + .adc_channel = 0x08 | CH_NEED_VREF | CH_NEED_VCALIB, |
| 122 | + .temp_correlation = skin1_temp_correlation, |
| 123 | + .direct = false, |
| 124 | + }, |
| 125 | + { |
| 126 | + .name = MSIC_SYS_NAME, |
| 127 | + .index = 2, |
| 128 | + .slope = 0, |
| 129 | + .intercept = 0, |
| 130 | + .adc_channel = 0x0A | CH_NEED_VREF | CH_NEED_VCALIB, |
| 131 | + .direct = false, |
| 132 | + }, |
| 133 | + { |
| 134 | + .name = MSIC_DIE_NAME, |
| 135 | + .index = 3, |
| 136 | + .slope = 368, |
| 137 | + .intercept = 219560, |
| 138 | + .adc_channel = 0x03 | CH_NEED_VCALIB, |
| 139 | + .direct = true, |
| 140 | + }, |
| 141 | + |
| 142 | +}; |
| 143 | + |
| 144 | + |
| 145 | +static struct intel_mid_thermal_platform_data pdata[] = { |
| 146 | + [mfld_thermal] = { |
| 147 | + .num_sensors = 4, |
| 148 | + .sensors = mfld_sensors, |
| 149 | + .soc_cooling = false, |
| 150 | + }, |
| 151 | + [ctp_thermal] = { |
| 152 | + .num_sensors = 4, |
| 153 | + .sensors = ctp_sensors, |
| 154 | + .soc_cooling = true, |
| 155 | + }, |
| 156 | + [lex_thermal] = { |
| 157 | + .num_sensors = 4, |
| 158 | + .sensors = lex_sensors, |
| 159 | + .soc_cooling = false, |
| 160 | + }, |
| 161 | +}; |
| 162 | + |
23 | 163 | void __init *msic_thermal_platform_data(void *info)
|
24 | 164 | {
|
25 |
| - return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_THERMAL); |
| 165 | + struct platform_device *pdev; |
| 166 | + |
| 167 | + pdev = platform_device_alloc(MSIC_THERM_DEV_NAME, -1); |
| 168 | + if (!pdev) { |
| 169 | + pr_err("out of memory for SFI platform dev %s\n", |
| 170 | + MSIC_THERM_DEV_NAME); |
| 171 | + return NULL; |
| 172 | + } |
| 173 | + |
| 174 | + if (platform_device_add(pdev)) { |
| 175 | + pr_err("failed to add thermal platform device\n"); |
| 176 | + platform_device_put(pdev); |
| 177 | + return NULL; |
| 178 | + } |
| 179 | + |
| 180 | + if (INTEL_MID_BOARD(2, PHONE, CLVTP, VB, PRO) || |
| 181 | + INTEL_MID_BOARD(2, PHONE, CLVTP, VB, ENG)) |
| 182 | + pdev->dev.platform_data = &pdata[vb_thermal]; |
| 183 | + else if (INTEL_MID_BOARD(1, PHONE, CLVTP) || |
| 184 | + (INTEL_MID_BOARD(1, TABLET, CLVT))) |
| 185 | + pdev->dev.platform_data = &pdata[ctp_thermal]; |
| 186 | + else if (INTEL_MID_BOARD(2, PHONE, MFLD, LEX, ENG) || |
| 187 | + (INTEL_MID_BOARD(2, PHONE, MFLD, LEX, PRO))) |
| 188 | + pdev->dev.platform_data = &pdata[lex_thermal]; |
| 189 | + else |
| 190 | + pdev->dev.platform_data = &pdata[mfld_thermal]; |
| 191 | + |
| 192 | + register_rpmsg_service("rpmsg_mid_thermal", RPROC_SCU, RP_MSIC_THERMAL); |
| 193 | + |
| 194 | + return 0; |
26 | 195 | }
|
0 commit comments