drivers/platform/x86/intel/int3472/tps68470.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/int3472/tps68470.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/intel/int3472/tps68470.c- Extension
.c- Size
- 7388 bytes
- Lines
- 267
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/i2c.hlinux/kernel.hlinux/mfd/core.hlinux/mfd/tps68470.hlinux/platform_device.hlinux/platform_data/tps68470.hlinux/platform_data/x86/int3472.hlinux/regmap.hlinux/string.htps68470.h
Detected Declarations
function tps68470_chip_initfunction skl_int3472_tps68470_calc_typefunction skl_int3472_fill_clk_pdatafunction for_each_acpi_consumer_devfunction skl_int3472_tps68470_probefunction skl_int3472_tps68470_remove
Annotated Snippet
if (!sensor_name) {
acpi_dev_put(consumer);
return -ENOMEM;
}
(*clk_pdata)->consumers[i].consumer_dev_name = sensor_name;
i++;
}
return n_consumers;
}
static int skl_int3472_tps68470_probe(struct i2c_client *client)
{
struct acpi_device *adev = ACPI_COMPANION(&client->dev);
const struct int3472_tps68470_board_data *board_data;
struct tps68470_clk_platform_data *clk_pdata;
struct mfd_cell *cells;
struct regmap *regmap;
int n_consumers;
int device_type;
int ret;
int i;
if (!adev)
return -ENODEV;
n_consumers = skl_int3472_fill_clk_pdata(&client->dev, &clk_pdata);
if (n_consumers < 0)
return n_consumers;
regmap = devm_regmap_init_i2c(client, &tps68470_regmap_config);
if (IS_ERR(regmap)) {
dev_err(&client->dev, "Failed to create regmap: %ld\n", PTR_ERR(regmap));
return PTR_ERR(regmap);
}
i2c_set_clientdata(client, regmap);
ret = tps68470_chip_init(&client->dev, regmap);
if (ret < 0) {
dev_err(&client->dev, "TPS68470 init error %d\n", ret);
return ret;
}
device_type = skl_int3472_tps68470_calc_type(adev);
switch (device_type) {
case DESIGNED_FOR_WINDOWS:
board_data = int3472_tps68470_get_board_data(dev_name(&client->dev));
if (!board_data)
return dev_err_probe(&client->dev, -ENODEV, "No board-data found for this model\n");
cells = kzalloc_objs(*cells, TPS68470_WIN_MFD_CELL_COUNT);
if (!cells)
return -ENOMEM;
/*
* The order of the cells matters here! The clk must be first
* because the regulator depends on it. The gpios must be last,
* acpi_gpiochip_add() calls acpi_dev_clear_dependencies() and
* the clk + regulators must be ready when this happens.
*/
cells[0].name = "tps68470-clk";
cells[0].platform_data = clk_pdata;
cells[0].pdata_size = struct_size(clk_pdata, consumers, n_consumers);
cells[1].name = "tps68470-regulator";
cells[1].platform_data = (void *)board_data->tps68470_regulator_pdata;
cells[1].pdata_size = sizeof(struct tps68470_regulator_platform_data);
cells[2].name = "tps68470-gpio";
cells[2].swnode = board_data->tps68470_gpio_swnode;
for (i = 0; i < board_data->n_gpiod_lookups; i++)
gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_tables[i]);
ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE,
cells, TPS68470_WIN_MFD_CELL_COUNT,
NULL, 0, NULL);
kfree(cells);
if (ret) {
for (i = 0; i < board_data->n_gpiod_lookups; i++)
gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_tables[i]);
}
break;
case DESIGNED_FOR_CHROMEOS:
ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE,
tps68470_cros, ARRAY_SIZE(tps68470_cros),
NULL, 0, NULL);
break;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/mfd/core.h`, `linux/mfd/tps68470.h`, `linux/platform_device.h`, `linux/platform_data/tps68470.h`, `linux/platform_data/x86/int3472.h`.
- Detected declarations: `function tps68470_chip_init`, `function skl_int3472_tps68470_calc_type`, `function skl_int3472_fill_clk_pdata`, `function for_each_acpi_consumer_dev`, `function skl_int3472_tps68470_probe`, `function skl_int3472_tps68470_remove`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.