diff options
| author | Stephen Boyd <sboyd@kernel.org> | 2021-12-15 20:11:38 -0800 | 
|---|---|---|
| committer | Stephen Boyd <sboyd@kernel.org> | 2021-12-15 20:11:38 -0800 | 
| commit | 55c174e5c05f93b676c595b927bf74c32274356c (patch) | |
| tree | aa9c3589afef3cd5825b31dfd2a6a67cd75c09c3 /drivers/platform/x86/intel/int3472/tps68470_board_data.c | |
| parent | fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf (diff) | |
| parent | 97c2259ec7757ec24a90f0ef8fc5ea7fa1c6acca (diff) | |
Merge tag 'platform-drivers-x86-int3472-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86 into clk-x86
Signed tag for the immutable platform-drivers-x86-int3472 branch
This branch contains 5.16-rc1 + the pending ACPI/i2c, tps68570 platform_data
and INT3472 driver patches.
* tag 'platform-drivers-x86-int3472-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
  platform/x86: int3472: Deal with probe ordering issues
  platform/x86: int3472: Pass tps68470_regulator_platform_data to the tps68470-regulator MFD-cell
  platform/x86: int3472: Pass tps68470_clk_platform_data to the tps68470-regulator MFD-cell
  platform/x86: int3472: Add get_sensor_adev_and_name() helper
  platform/x86: int3472: Split into 2 drivers
  platform_data: Add linux/platform_data/tps68470.h file
  i2c: acpi: Add i2c_acpi_new_device_by_fwnode() function
  i2c: acpi: Use acpi_dev_ready_for_enumeration() helper
  ACPI: delay enumeration of devices with a _DEP pointing to an INT3472 device
Diffstat (limited to 'drivers/platform/x86/intel/int3472/tps68470_board_data.c')
| -rw-r--r-- | drivers/platform/x86/intel/int3472/tps68470_board_data.c | 145 | 
1 files changed, 145 insertions, 0 deletions
diff --git a/drivers/platform/x86/intel/int3472/tps68470_board_data.c b/drivers/platform/x86/intel/int3472/tps68470_board_data.c new file mode 100644 index 000000000000..faa5570f6e6b --- /dev/null +++ b/drivers/platform/x86/intel/int3472/tps68470_board_data.c @@ -0,0 +1,145 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * TI TPS68470 PMIC platform data definition. + * + * Copyright (c) 2021 Dan Scally <djrscally@gmail.com> + * Copyright (c) 2021 Red Hat Inc. + * + * Red Hat authors: + * Hans de Goede <hdegoede@redhat.com> + */ + +#include <linux/dmi.h> +#include <linux/gpio/machine.h> +#include <linux/platform_data/tps68470.h> +#include <linux/regulator/machine.h> +#include "tps68470.h" + +static struct regulator_consumer_supply int347a_core_consumer_supplies[] = { +	REGULATOR_SUPPLY("dvdd", "i2c-INT347A:00"), +}; + +static struct regulator_consumer_supply int347a_ana_consumer_supplies[] = { +	REGULATOR_SUPPLY("avdd", "i2c-INT347A:00"), +}; + +static struct regulator_consumer_supply int347a_vcm_consumer_supplies[] = { +	REGULATOR_SUPPLY("vdd", "i2c-INT347A:00-VCM"), +}; + +static struct regulator_consumer_supply int347a_vsio_consumer_supplies[] = { +	REGULATOR_SUPPLY("dovdd", "i2c-INT347A:00"), +	REGULATOR_SUPPLY("vsio", "i2c-INT347A:00-VCM"), +}; + +static const struct regulator_init_data surface_go_tps68470_core_reg_init_data = { +	.constraints = { +		.min_uV = 1200000, +		.max_uV = 1200000, +		.apply_uV = true, +		.valid_ops_mask = REGULATOR_CHANGE_STATUS, +	}, +	.num_consumer_supplies = ARRAY_SIZE(int347a_core_consumer_supplies), +	.consumer_supplies = int347a_core_consumer_supplies, +}; + +static const struct regulator_init_data surface_go_tps68470_ana_reg_init_data = { +	.constraints = { +		.min_uV = 2815200, +		.max_uV = 2815200, +		.apply_uV = true, +		.valid_ops_mask = REGULATOR_CHANGE_STATUS, +	}, +	.num_consumer_supplies = ARRAY_SIZE(int347a_ana_consumer_supplies), +	.consumer_supplies = int347a_ana_consumer_supplies, +}; + +static const struct regulator_init_data surface_go_tps68470_vcm_reg_init_data = { +	.constraints = { +		.min_uV = 2815200, +		.max_uV = 2815200, +		.apply_uV = true, +		.valid_ops_mask = REGULATOR_CHANGE_STATUS, +	}, +	.num_consumer_supplies = ARRAY_SIZE(int347a_vcm_consumer_supplies), +	.consumer_supplies = int347a_vcm_consumer_supplies, +}; + +/* Ensure the always-on VIO regulator has the same voltage as VSIO */ +static const struct regulator_init_data surface_go_tps68470_vio_reg_init_data = { +	.constraints = { +		.min_uV = 1800600, +		.max_uV = 1800600, +		.apply_uV = true, +		.always_on = true, +	}, +}; + +static const struct regulator_init_data surface_go_tps68470_vsio_reg_init_data = { +	.constraints = { +		.min_uV = 1800600, +		.max_uV = 1800600, +		.apply_uV = true, +		.valid_ops_mask = REGULATOR_CHANGE_STATUS, +	}, +	.num_consumer_supplies = ARRAY_SIZE(int347a_vsio_consumer_supplies), +	.consumer_supplies = int347a_vsio_consumer_supplies, +}; + +static const struct tps68470_regulator_platform_data surface_go_tps68470_pdata = { +	.reg_init_data = { +		[TPS68470_CORE] = &surface_go_tps68470_core_reg_init_data, +		[TPS68470_ANA]  = &surface_go_tps68470_ana_reg_init_data, +		[TPS68470_VCM]  = &surface_go_tps68470_vcm_reg_init_data, +		[TPS68470_VIO] = &surface_go_tps68470_vio_reg_init_data, +		[TPS68470_VSIO] = &surface_go_tps68470_vsio_reg_init_data, +	}, +}; + +static struct gpiod_lookup_table surface_go_tps68470_gpios = { +	.dev_id = "i2c-INT347A:00", +	.table = { +		GPIO_LOOKUP("tps68470-gpio", 9, "reset", GPIO_ACTIVE_LOW), +		GPIO_LOOKUP("tps68470-gpio", 7, "powerdown", GPIO_ACTIVE_LOW) +	} +}; + +static const struct int3472_tps68470_board_data surface_go_tps68470_board_data = { +	.dev_name = "i2c-INT3472:05", +	.tps68470_gpio_lookup_table = &surface_go_tps68470_gpios, +	.tps68470_regulator_pdata = &surface_go_tps68470_pdata, +}; + +static const struct dmi_system_id int3472_tps68470_board_data_table[] = { +	{ +		.matches = { +			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), +			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Go"), +		}, +		.driver_data = (void *)&surface_go_tps68470_board_data, +	}, +	{ +		.matches = { +			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), +			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Go 2"), +		}, +		.driver_data = (void *)&surface_go_tps68470_board_data, +	}, +	{ } +}; + +const struct int3472_tps68470_board_data *int3472_tps68470_get_board_data(const char *dev_name) +{ +	const struct int3472_tps68470_board_data *board_data; +	const struct dmi_system_id *match; + +	for (match = dmi_first_match(int3472_tps68470_board_data_table); +	     match; +	     match = dmi_first_match(match + 1)) { +		board_data = match->driver_data; +		if (strcmp(board_data->dev_name, dev_name) == 0) +			return board_data; +	} + +	return NULL; +}  | 
