drivers/platform/x86/intel/int3472/discrete.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/int3472/discrete.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/intel/int3472/discrete.c- Extension
.c- Size
- 15315 bytes
- Lines
- 532
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/array_size.hlinux/bitfield.hlinux/device.hlinux/dmi.hlinux/gpio/consumer.hlinux/gpio/machine.hlinux/i2c.hlinux/kernel.hlinux/module.hlinux/overflow.hlinux/platform_data/x86/int3472.hlinux/platform_device.hlinux/string_choices.hlinux/uuid.h
Detected Declarations
struct int3472_gpio_mapfunction skl_int3472_log_sensor_module_namefunction skl_int3472_fill_gpiod_lookupfunction skl_int3472_map_gpio_to_sensorfunction skl_int3472_gpiod_get_from_temp_lookupfunction int3472_get_con_id_and_polarityfunction acpi_dev_get_resourcesfunction int3472_discrete_parse_crsfunction int3472_discrete_cleanupfunction skl_int3472_discrete_removefunction skl_int3472_discrete_probe
Annotated Snippet
struct int3472_gpio_map {
const char *hid;
u8 type_from;
u8 type_to;
bool polarity_low;
unsigned int enable_time_us;
const char *con_id;
};
static const struct int3472_gpio_map int3472_gpio_map[] = {
{ /* mt9m114 designs declare a powerdown pin which controls the regulators */
.hid = "INT33F0",
.type_from = INT3472_GPIO_TYPE_POWERDOWN,
.type_to = INT3472_GPIO_TYPE_POWER_ENABLE,
.con_id = "vdd",
.enable_time_us = GPIO_REGULATOR_ENABLE_TIME,
},
{ /* ov7251 driver / DT-bindings expect "enable" as con_id for reset */
.hid = "INT347E",
.type_from = INT3472_GPIO_TYPE_RESET,
.type_to = INT3472_GPIO_TYPE_RESET,
.con_id = "enable",
},
{ /* ov08x40's handshake pin needs a 45 ms delay on some HP laptops */
.hid = "OVTI08F4",
.type_from = INT3472_GPIO_TYPE_HANDSHAKE,
.type_to = INT3472_GPIO_TYPE_HANDSHAKE,
.con_id = "dvdd",
.enable_time_us = 45 * USEC_PER_MSEC,
},
};
static void int3472_get_con_id_and_polarity(struct int3472_discrete_device *int3472, u8 *type,
const char **con_id, unsigned long *gpio_flags,
unsigned int *enable_time_us)
{
struct acpi_device *adev = int3472->sensor;
unsigned int i;
for (i = 0; i < ARRAY_SIZE(int3472_gpio_map); i++) {
/*
* Map the firmware-provided GPIO to whatever a driver expects
* (as in DT bindings). First check if the type matches with the
* GPIO map, then further check that the device _HID matches.
*/
if (*type != int3472_gpio_map[i].type_from)
continue;
if (!acpi_dev_hid_uid_match(adev, int3472_gpio_map[i].hid, NULL))
continue;
dev_dbg(int3472->dev, "mapping type 0x%02x pin to 0x%02x %s\n",
*type, int3472_gpio_map[i].type_to, int3472_gpio_map[i].con_id);
*type = int3472_gpio_map[i].type_to;
*gpio_flags = int3472_gpio_map[i].polarity_low ?
GPIO_ACTIVE_LOW : GPIO_ACTIVE_HIGH;
*con_id = int3472_gpio_map[i].con_id;
*enable_time_us = int3472_gpio_map[i].enable_time_us;
return;
}
*enable_time_us = GPIO_REGULATOR_ENABLE_TIME;
switch (*type) {
case INT3472_GPIO_TYPE_RESET:
*con_id = "reset";
*gpio_flags = GPIO_ACTIVE_LOW;
break;
case INT3472_GPIO_TYPE_POWERDOWN:
*con_id = "powerdown";
*gpio_flags = GPIO_ACTIVE_LOW;
break;
case INT3472_GPIO_TYPE_CLK_ENABLE:
*con_id = "clk-enable";
*gpio_flags = GPIO_ACTIVE_HIGH;
break;
case INT3472_GPIO_TYPE_PRIVACY_LED:
*con_id = "privacy";
*gpio_flags = GPIO_ACTIVE_HIGH;
break;
case INT3472_GPIO_TYPE_STROBE:
*con_id = "ir_flood";
*gpio_flags = GPIO_ACTIVE_HIGH;
break;
case INT3472_GPIO_TYPE_HOTPLUG_DETECT:
*con_id = "hpd";
*gpio_flags = GPIO_ACTIVE_HIGH;
break;
case INT3472_GPIO_TYPE_POWER_ENABLE:
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/array_size.h`, `linux/bitfield.h`, `linux/device.h`, `linux/dmi.h`, `linux/gpio/consumer.h`, `linux/gpio/machine.h`, `linux/i2c.h`.
- Detected declarations: `struct int3472_gpio_map`, `function skl_int3472_log_sensor_module_name`, `function skl_int3472_fill_gpiod_lookup`, `function skl_int3472_map_gpio_to_sensor`, `function skl_int3472_gpiod_get_from_temp_lookup`, `function int3472_get_con_id_and_polarity`, `function acpi_dev_get_resources`, `function int3472_discrete_parse_crs`, `function int3472_discrete_cleanup`, `function skl_int3472_discrete_remove`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: integration 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.