FILE
tps68470_board_data.c
File preview with syntax highlighting.
linux-6.19.14/drivers/platform/x86/intel/int3472/tps68470_board_data.c
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * TI TPS68470 PMIC platform data definition. 4 * 5 * Copyright (c) 2021 Dan Scally <djrscally@gmail.com> 6 * Copyright (c) 2021 Red Hat Inc. 7 * 8 * Red Hat authors: 9 * Hans de Goede <hdegoede@redhat.com> 10 */ 11 12#include <linux/dmi.h> 13#include <linux/gpio/machine.h> 14#include <linux/platform_data/tps68470.h> 15#include <linux/regulator/machine.h> 16#include "tps68470.h" 17 18static struct regulator_consumer_supply int347a_core_consumer_supplies[] = { 19 REGULATOR_SUPPLY("dvdd", "i2c-INT347A:00"), 20}; 21 22static struct regulator_consumer_supply int347a_ana_consumer_supplies[] = { 23 REGULATOR_SUPPLY("avdd", "i2c-INT347A:00"), 24}; 25 26static struct regulator_consumer_supply int347a_vcm_consumer_supplies[] = { 27 REGULATOR_SUPPLY("vdd", "i2c-INT347A:00-VCM"), 28}; 29 30static struct regulator_consumer_supply int347a_vsio_consumer_supplies[] = { 31 REGULATOR_SUPPLY("dovdd", "i2c-INT347A:00"), 32 REGULATOR_SUPPLY("vsio", "i2c-INT347A:00-VCM"), 33 REGULATOR_SUPPLY("vddd", "i2c-INT347E:00"), 34}; 35 36static struct regulator_consumer_supply int347a_aux1_consumer_supplies[] = { 37 REGULATOR_SUPPLY("vdda", "i2c-INT347E:00"), 38}; 39 40static struct regulator_consumer_supply int347a_aux2_consumer_supplies[] = { 41 REGULATOR_SUPPLY("vdddo", "i2c-INT347E:00"), 42}; 43 44static const struct regulator_init_data surface_go_tps68470_core_reg_init_data = { 45 .constraints = { 46 .min_uV = 1200000, 47 .max_uV = 1200000, 48 .apply_uV = true, 49 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 50 }, 51 .num_consumer_supplies = ARRAY_SIZE(int347a_core_consumer_supplies), 52 .consumer_supplies = int347a_core_consumer_supplies, 53}; 54 55static const struct regulator_init_data surface_go_tps68470_ana_reg_init_data = { 56 .constraints = { 57 .min_uV = 2815200, 58 .max_uV = 2815200, 59 .apply_uV = true, 60 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 61 }, 62 .num_consumer_supplies = ARRAY_SIZE(int347a_ana_consumer_supplies), 63 .consumer_supplies = int347a_ana_consumer_supplies, 64}; 65 66static const struct regulator_init_data surface_go_tps68470_vcm_reg_init_data = { 67 .constraints = { 68 .min_uV = 2815200, 69 .max_uV = 2815200, 70 .apply_uV = true, 71 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 72 }, 73 .num_consumer_supplies = ARRAY_SIZE(int347a_vcm_consumer_supplies), 74 .consumer_supplies = int347a_vcm_consumer_supplies, 75}; 76 77/* Ensure the always-on VIO regulator has the same voltage as VSIO */ 78static const struct regulator_init_data surface_go_tps68470_vio_reg_init_data = { 79 .constraints = { 80 .min_uV = 1800600, 81 .max_uV = 1800600, 82 .apply_uV = true, 83 .always_on = true, 84 }, 85}; 86 87static const struct regulator_init_data surface_go_tps68470_vsio_reg_init_data = { 88 .constraints = { 89 .min_uV = 1800600, 90 .max_uV = 1800600, 91 .apply_uV = true, 92 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 93 }, 94 .num_consumer_supplies = ARRAY_SIZE(int347a_vsio_consumer_supplies), 95 .consumer_supplies = int347a_vsio_consumer_supplies, 96}; 97 98static const struct regulator_init_data surface_go_tps68470_aux1_reg_init_data = { 99 .constraints = { 100 .min_uV = 2815200, 101 .max_uV = 2815200, 102 .apply_uV = 1, 103 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 104 }, 105 .num_consumer_supplies = ARRAY_SIZE(int347a_aux1_consumer_supplies), 106 .consumer_supplies = int347a_aux1_consumer_supplies, 107}; 108 109static const struct regulator_init_data surface_go_tps68470_aux2_reg_init_data = { 110 .constraints = { 111 .min_uV = 1800600, 112 .max_uV = 1800600, 113 .apply_uV = 1, 114 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 115 }, 116 .num_consumer_supplies = ARRAY_SIZE(int347a_aux2_consumer_supplies), 117 .consumer_supplies = int347a_aux2_consumer_supplies, 118}; 119 120static const struct tps68470_regulator_platform_data surface_go_tps68470_pdata = { 121 .reg_init_data = { 122 [TPS68470_CORE] = &surface_go_tps68470_core_reg_init_data, 123 [TPS68470_ANA] = &surface_go_tps68470_ana_reg_init_data, 124 [TPS68470_VCM] = &surface_go_tps68470_vcm_reg_init_data, 125 [TPS68470_VIO] = &surface_go_tps68470_vio_reg_init_data, 126 [TPS68470_VSIO] = &surface_go_tps68470_vsio_reg_init_data, 127 [TPS68470_AUX1] = &surface_go_tps68470_aux1_reg_init_data, 128 [TPS68470_AUX2] = &surface_go_tps68470_aux2_reg_init_data, 129 }, 130}; 131 132/* Settings for Dell 7212 Tablet */ 133 134static struct regulator_consumer_supply int3479_vsio_consumer_supplies[] = { 135 REGULATOR_SUPPLY("avdd", "i2c-INT3479:00"), 136}; 137 138static struct regulator_consumer_supply int3479_aux1_consumer_supplies[] = { 139 REGULATOR_SUPPLY("dvdd", "i2c-INT3479:00"), 140}; 141 142static struct regulator_consumer_supply int3479_aux2_consumer_supplies[] = { 143 REGULATOR_SUPPLY("dovdd", "i2c-INT3479:00"), 144}; 145 146static const struct regulator_init_data dell_7212_tps68470_core_reg_init_data = { 147 .constraints = { 148 .min_uV = 1200000, 149 .max_uV = 1200000, 150 .apply_uV = 1, 151 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 152 }, 153 .num_consumer_supplies = 0, 154 .consumer_supplies = NULL, 155}; 156 157static const struct regulator_init_data dell_7212_tps68470_ana_reg_init_data = { 158 .constraints = { 159 .min_uV = 2815200, 160 .max_uV = 2815200, 161 .apply_uV = 1, 162 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 163 }, 164 .num_consumer_supplies = 0, 165 .consumer_supplies = NULL, 166}; 167 168static const struct regulator_init_data dell_7212_tps68470_vcm_reg_init_data = { 169 .constraints = { 170 .min_uV = 2815200, 171 .max_uV = 2815200, 172 .apply_uV = 1, 173 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 174 }, 175 .num_consumer_supplies = 0, 176 .consumer_supplies = NULL, 177}; 178 179static const struct regulator_init_data dell_7212_tps68470_vio_reg_init_data = { 180 .constraints = { 181 .min_uV = 1800600, 182 .max_uV = 1800600, 183 .apply_uV = 1, 184 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 185 }, 186 .num_consumer_supplies = 0, 187 .consumer_supplies = NULL, 188}; 189 190static const struct regulator_init_data dell_7212_tps68470_vsio_reg_init_data = { 191 .constraints = { 192 .min_uV = 1800600, 193 .max_uV = 1800600, 194 .apply_uV = 1, 195 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 196 }, 197 .num_consumer_supplies = ARRAY_SIZE(int3479_vsio_consumer_supplies), 198 .consumer_supplies = int3479_vsio_consumer_supplies, 199}; 200 201static const struct regulator_init_data dell_7212_tps68470_aux1_reg_init_data = { 202 .constraints = { 203 .min_uV = 1213200, 204 .max_uV = 1213200, 205 .apply_uV = 1, 206 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 207 }, 208 .num_consumer_supplies = ARRAY_SIZE(int3479_aux1_consumer_supplies), 209 .consumer_supplies = int3479_aux1_consumer_supplies, 210}; 211 212static const struct regulator_init_data dell_7212_tps68470_aux2_reg_init_data = { 213 .constraints = { 214 .min_uV = 1800600, 215 .max_uV = 1800600, 216 .apply_uV = 1, 217 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 218 }, 219 .num_consumer_supplies = ARRAY_SIZE(int3479_aux2_consumer_supplies), 220 .consumer_supplies = int3479_aux2_consumer_supplies, 221}; 222 223static const struct tps68470_regulator_platform_data dell_7212_tps68470_pdata = { 224 .reg_init_data = { 225 [TPS68470_CORE] = &dell_7212_tps68470_core_reg_init_data, 226 [TPS68470_ANA] = &dell_7212_tps68470_ana_reg_init_data, 227 [TPS68470_VCM] = &dell_7212_tps68470_vcm_reg_init_data, 228 [TPS68470_VIO] = &dell_7212_tps68470_vio_reg_init_data, 229 [TPS68470_VSIO] = &dell_7212_tps68470_vsio_reg_init_data, 230 [TPS68470_AUX1] = &dell_7212_tps68470_aux1_reg_init_data, 231 [TPS68470_AUX2] = &dell_7212_tps68470_aux2_reg_init_data, 232 }, 233}; 234 235static struct gpiod_lookup_table surface_go_int347a_gpios = { 236 .dev_id = "i2c-INT347A:00", 237 .table = { 238 GPIO_LOOKUP("tps68470-gpio", 9, "reset", GPIO_ACTIVE_LOW), 239 GPIO_LOOKUP("tps68470-gpio", 7, "powerdown", GPIO_ACTIVE_LOW), 240 { } 241 } 242}; 243 244static struct gpiod_lookup_table surface_go_int347e_gpios = { 245 .dev_id = "i2c-INT347E:00", 246 .table = { 247 GPIO_LOOKUP("tps68470-gpio", 5, "enable", GPIO_ACTIVE_HIGH), 248 { } 249 } 250}; 251 252static struct gpiod_lookup_table dell_7212_int3479_gpios = { 253 .dev_id = "i2c-INT3479:00", 254 .table = { 255 GPIO_LOOKUP("tps68470-gpio", 3, "reset", GPIO_ACTIVE_LOW), 256 GPIO_LOOKUP("tps68470-gpio", 4, "powerdown", GPIO_ACTIVE_LOW), 257 { } 258 } 259}; 260 261static const struct int3472_tps68470_board_data surface_go_tps68470_board_data = { 262 .dev_name = "i2c-INT3472:05", 263 .tps68470_regulator_pdata = &surface_go_tps68470_pdata, 264 .n_gpiod_lookups = 2, 265 .tps68470_gpio_lookup_tables = { 266 &surface_go_int347a_gpios, 267 &surface_go_int347e_gpios, 268 }, 269}; 270 271static const struct int3472_tps68470_board_data surface_go3_tps68470_board_data = { 272 .dev_name = "i2c-INT3472:01", 273 .tps68470_regulator_pdata = &surface_go_tps68470_pdata, 274 .n_gpiod_lookups = 2, 275 .tps68470_gpio_lookup_tables = { 276 &surface_go_int347a_gpios, 277 &surface_go_int347e_gpios, 278 }, 279}; 280 281static const struct int3472_tps68470_board_data dell_7212_tps68470_board_data = { 282 .dev_name = "i2c-INT3472:05", 283 .tps68470_regulator_pdata = &dell_7212_tps68470_pdata, 284 .n_gpiod_lookups = 1, 285 .tps68470_gpio_lookup_tables = { 286 &dell_7212_int3479_gpios, 287 }, 288}; 289 290static const struct dmi_system_id int3472_tps68470_board_data_table[] = { 291 { 292 .matches = { 293 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), 294 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Go"), 295 }, 296 .driver_data = (void *)&surface_go_tps68470_board_data, 297 }, 298 { 299 .matches = { 300 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), 301 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Go 2"), 302 }, 303 .driver_data = (void *)&surface_go_tps68470_board_data, 304 }, 305 { 306 .matches = { 307 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), 308 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Go 3"), 309 }, 310 .driver_data = (void *)&surface_go3_tps68470_board_data, 311 }, 312 { 313 .matches = { 314 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 315 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Latitude 7212 Rugged Extreme Tablet"), 316 }, 317 .driver_data = (void *)&dell_7212_tps68470_board_data, 318 }, 319 { } 320}; 321 322const struct int3472_tps68470_board_data *int3472_tps68470_get_board_data(const char *dev_name) 323{ 324 const struct int3472_tps68470_board_data *board_data; 325 const struct dmi_system_id *match; 326 327 for (match = dmi_first_match(int3472_tps68470_board_data_table); 328 match; 329 match = dmi_first_match(match + 1)) { 330 board_data = match->driver_data; 331 if (strcmp(board_data->dev_name, dev_name) == 0) 332 return board_data; 333 } 334 335 return NULL; 336}
~/
Read-only file preview.