drivers/gpio/gpio-rtd.c
Source file repositories/reference/linux-study-clean/drivers/gpio/gpio-rtd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpio/gpio-rtd.c- Extension
.c- Size
- 17448 bytes
- Lines
- 610
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/bitops.hlinux/cleanup.hlinux/gpio/driver.hlinux/interrupt.hlinux/irqchip.hlinux/irqchip/chained_irq.hlinux/irqdomain.hlinux/module.hlinux/platform_device.hlinux/property.hlinux/spinlock.hlinux/types.h
Detected Declarations
struct rtd_gpio_infostruct rtd_gpiofunction rtd_gpio_get_deb_setvalfunction rtd1295_misc_gpio_get_deb_setvalfunction rtd1295_iso_gpio_get_deb_setvalfunction rtd_gpio_dir_offsetfunction rtd_gpio_dato_offsetfunction rtd_gpio_dati_offsetfunction rtd_gpio_ie_offsetfunction rtd_gpio_dp_offsetfunction rtd_gpio_gpa_offsetfunction rtd_gpio_gpda_offsetfunction rtd_gpio_set_debouncefunction rtd_gpio_set_configfunction rtd_gpio_setfunction rtd_gpio_getfunction rtd_gpio_get_directionfunction rtd_gpio_set_directionfunction rtd_gpio_direction_inputfunction rtd_gpio_direction_outputfunction rtd_gpio_check_iefunction rtd_gpio_irq_handlefunction for_each_set_bitfunction rtd_gpio_enable_irqfunction rtd_gpio_disable_irqfunction scoped_guardfunction rtd_gpio_irq_set_typefunction scoped_guardfunction rtd_gpio_probe
Annotated Snippet
struct rtd_gpio_info {
const char *name;
unsigned int gpio_base;
unsigned int num_gpios;
u8 *dir_offset;
u8 *dato_offset;
u8 *dati_offset;
u8 *ie_offset;
u8 *dp_offset;
u8 *gpa_offset;
u8 *gpda_offset;
u8 *deb_offset;
u8 *deb_val;
u8 (*get_deb_setval)(const struct rtd_gpio_info *info,
unsigned int offset, u8 deb_index,
u8 *reg_offset, u8 *shift);
};
struct rtd_gpio {
struct gpio_chip gpio_chip;
const struct rtd_gpio_info *info;
void __iomem *base;
void __iomem *irq_base;
unsigned int irqs[2];
raw_spinlock_t lock;
};
static u8 rtd_gpio_get_deb_setval(const struct rtd_gpio_info *info, unsigned int offset,
u8 deb_index, u8 *reg_offset, u8 *shift)
{
*reg_offset = info->deb_offset[offset / 8];
*shift = (offset % 8) * 4;
return info->deb_val[deb_index];
}
static u8 rtd1295_misc_gpio_get_deb_setval(const struct rtd_gpio_info *info, unsigned int offset,
u8 deb_index, u8 *reg_offset, u8 *shift)
{
*reg_offset = info->deb_offset[0];
*shift = (offset % 8) * 4;
return info->deb_val[deb_index];
}
static u8 rtd1295_iso_gpio_get_deb_setval(const struct rtd_gpio_info *info, unsigned int offset,
u8 deb_index, u8 *reg_offset, u8 *shift)
{
*reg_offset = info->deb_offset[0];
*shift = 0;
return info->deb_val[deb_index];
}
static const struct rtd_gpio_info rtd_iso_gpio_info = {
.name = "rtd_iso_gpio",
.gpio_base = 0,
.num_gpios = 82,
.dir_offset = (u8 []){ 0x0, 0x18, 0x2c },
.dato_offset = (u8 []){ 0x4, 0x1c, 0x30 },
.dati_offset = (u8 []){ 0x8, 0x20, 0x34 },
.ie_offset = (u8 []){ 0xc, 0x24, 0x38 },
.dp_offset = (u8 []){ 0x10, 0x28, 0x3c },
.gpa_offset = (u8 []){ 0x8, 0xe0, 0x90 },
.gpda_offset = (u8 []){ 0xc, 0xe4, 0x94 },
.deb_offset = (u8 []){ 0x44, 0x48, 0x4c, 0x50, 0x54, 0x58, 0x5c,
0x60, 0x64, 0x68, 0x6c },
.deb_val = (u8 []){ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 },
.get_deb_setval = rtd_gpio_get_deb_setval,
};
static const struct rtd_gpio_info rtd1619_iso_gpio_info = {
.name = "rtd1619_iso_gpio",
.gpio_base = 0,
.num_gpios = 86,
.dir_offset = (u8 []){ 0x0, 0x18, 0x2c },
.dato_offset = (u8 []){ 0x4, 0x1c, 0x30 },
.dati_offset = (u8 []){ 0x8, 0x20, 0x34 },
.ie_offset = (u8 []){ 0xc, 0x24, 0x38 },
.dp_offset = (u8 []){ 0x10, 0x28, 0x3c },
.gpa_offset = (u8 []){ 0x8, 0xe0, 0x90 },
.gpda_offset = (u8 []){ 0xc, 0xe4, 0x94 },
.deb_offset = (u8 []){ 0x44, 0x48, 0x4c, 0x50, 0x54, 0x58, 0x5c,
0x60, 0x64, 0x68, 0x6c },
.deb_val = (u8 []){ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 },
.get_deb_setval = rtd_gpio_get_deb_setval,
};
static const struct rtd_gpio_info rtd1395_iso_gpio_info = {
.name = "rtd1395_iso_gpio",
.gpio_base = 0,
.num_gpios = 57,
.dir_offset = (u8 []){ 0x0, 0x18 },
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/cleanup.h`, `linux/gpio/driver.h`, `linux/interrupt.h`, `linux/irqchip.h`, `linux/irqchip/chained_irq.h`, `linux/irqdomain.h`, `linux/module.h`.
- Detected declarations: `struct rtd_gpio_info`, `struct rtd_gpio`, `function rtd_gpio_get_deb_setval`, `function rtd1295_misc_gpio_get_deb_setval`, `function rtd1295_iso_gpio_get_deb_setval`, `function rtd_gpio_dir_offset`, `function rtd_gpio_dato_offset`, `function rtd_gpio_dati_offset`, `function rtd_gpio_ie_offset`, `function rtd_gpio_dp_offset`.
- Atlas domain: Driver Families / drivers/gpio.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.