drivers/gpio/gpio-tegra186.c
Source file repositories/reference/linux-study-clean/drivers/gpio/gpio-tegra186.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpio/gpio-tegra186.c- Extension
.c- Size
- 44851 bytes
- Lines
- 1563
- Domain
- Driver Families
- Bucket
- drivers/gpio
- 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/gpio/driver.hlinux/hte.hlinux/interrupt.hlinux/irq.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/property.hlinux/seq_file.hdt-bindings/gpio/tegra186-gpio.hdt-bindings/gpio/tegra194-gpio.hdt-bindings/gpio/tegra234-gpio.hdt-bindings/gpio/nvidia,tegra238-gpio.hdt-bindings/gpio/tegra241-gpio.hdt-bindings/gpio/tegra256-gpio.hdt-bindings/gpio/nvidia,tegra264-gpio.h
Detected Declarations
struct tegra_gpio_portstruct tegra186_pin_rangestruct tegra_gpio_socstruct tegra_gpiofunction tegra186_gpio_get_portfunction tegra186_gpio_is_accessiblefunction tegra186_init_valid_maskfunction tegra186_gpio_setfunction tegra186_gpio_get_directionfunction tegra186_gpio_direction_inputfunction tegra186_gpio_direction_outputfunction tegra186_gpio_en_hw_tsfunction tegra186_gpio_dis_hw_tsfunction tegra186_gpio_getfunction tegra186_gpio_set_configfunction tegra186_gpio_add_pin_rangesfunction tegra186_gpio_of_xlatefunction tegra186_irq_ackfunction tegra186_irq_maskfunction tegra186_irq_unmaskfunction tegra186_irq_set_typefunction tegra186_irq_set_wakefunction tegra186_irq_print_chipfunction tegra186_gpio_irqfunction for_each_set_bitfunction tegra186_gpio_irq_domain_translatefunction tegra186_gpio_populate_parent_fwspecfunction tegra186_gpio_child_to_parent_hwirqfunction tegra186_gpio_child_offset_to_irqfunction tegra186_gpio_init_route_mappingfunction tegra186_gpio_irqs_per_bankfunction tegra186_gpio_probe
Annotated Snippet
struct tegra_gpio_port {
const char *name;
unsigned int bank;
unsigned int port;
unsigned int pins;
};
struct tegra186_pin_range {
unsigned int offset;
const char *group;
};
struct tegra_gpio_soc {
const struct tegra_gpio_port *ports;
unsigned int num_ports;
const char *name;
const char *prefix;
unsigned int instance;
unsigned int num_irqs_per_bank;
const struct tegra186_pin_range *pin_ranges;
unsigned int num_pin_ranges;
const char *pinmux;
bool has_gte;
bool has_vm_support;
};
struct tegra_gpio {
struct gpio_chip gpio;
unsigned int num_irq;
const struct tegra_gpio_soc *soc;
unsigned int num_irqs_per_bank;
unsigned int num_banks;
void __iomem *secure;
void __iomem *base;
unsigned int irq[] __counted_by(num_irq);
};
static const struct tegra_gpio_port *
tegra186_gpio_get_port(struct tegra_gpio *gpio, unsigned int *pin)
{
unsigned int start = 0, i;
for (i = 0; i < gpio->soc->num_ports; i++) {
const struct tegra_gpio_port *port = &gpio->soc->ports[i];
if (*pin >= start && *pin < start + port->pins) {
*pin -= start;
return port;
}
start += port->pins;
}
return NULL;
}
static void __iomem *tegra186_gpio_get_base(struct tegra_gpio *gpio,
unsigned int pin)
{
const struct tegra_gpio_port *port;
unsigned int offset;
port = tegra186_gpio_get_port(gpio, &pin);
if (!port)
return NULL;
offset = port->bank * 0x1000 + port->port * 0x200;
return gpio->base + offset + pin * 0x20;
}
static void __iomem *tegra186_gpio_get_secure_base(struct tegra_gpio *gpio,
unsigned int pin)
{
const struct tegra_gpio_port *port;
unsigned int offset;
port = tegra186_gpio_get_port(gpio, &pin);
if (!port)
return NULL;
offset = port->bank * 0x1000 + port->port * TEGRA186_GPIO_SCR_PORT_SIZE;
return gpio->secure + offset + pin * TEGRA186_GPIO_SCR_PIN_SIZE;
}
Annotation
- Immediate include surface: `linux/gpio/driver.h`, `linux/hte.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/property.h`.
- Detected declarations: `struct tegra_gpio_port`, `struct tegra186_pin_range`, `struct tegra_gpio_soc`, `struct tegra_gpio`, `function tegra186_gpio_get_port`, `function tegra186_gpio_is_accessible`, `function tegra186_init_valid_mask`, `function tegra186_gpio_set`, `function tegra186_gpio_get_direction`, `function tegra186_gpio_direction_input`.
- Atlas domain: Driver Families / drivers/gpio.
- 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.