drivers/gpio/gpio-fxl6408.c
Source file repositories/reference/linux-study-clean/drivers/gpio/gpio-fxl6408.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpio/gpio-fxl6408.c- Extension
.c- Size
- 4734 bytes
- Lines
- 172
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/gpio/regmap.hlinux/i2c.hlinux/kernel.hlinux/module.hlinux/regmap.h
Detected Declarations
function fxl6408_identifyfunction fxl6408_probefunction fxl6408_resume
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* FXL6408 GPIO driver
*
* Copyright 2023 Toradex
*
* Author: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
*/
#include <linux/err.h>
#include <linux/gpio/regmap.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regmap.h>
#define FXL6408_REG_DEVICE_ID 0x01
#define FXL6408_MF_FAIRCHILD 0b101
#define FXL6408_MF_SHIFT 5
/* Bits set here indicate that the GPIO is an output. */
#define FXL6408_REG_IO_DIR 0x03
/*
* Bits set here, when the corresponding bit of IO_DIR is set, drive
* the output high instead of low.
*/
#define FXL6408_REG_OUTPUT 0x05
/* Bits here make the output High-Z, instead of the OUTPUT value. */
#define FXL6408_REG_OUTPUT_HIGH_Z 0x07
/* Returns the current status (1 = HIGH) of the input pins. */
#define FXL6408_REG_INPUT_STATUS 0x0f
/*
* Return the current interrupt status
* This bit is HIGH if input GPIO != default state (register 09h).
* The flag is cleared after being read (bit returns to 0).
* The input must go back to default state and change again before this flag is raised again.
*/
#define FXL6408_REG_INT_STS 0x13
#define FXL6408_NGPIO 8
static const struct regmap_range rd_range[] = {
{ FXL6408_REG_DEVICE_ID, FXL6408_REG_DEVICE_ID },
{ FXL6408_REG_IO_DIR, FXL6408_REG_OUTPUT },
{ FXL6408_REG_INPUT_STATUS, FXL6408_REG_INPUT_STATUS },
};
static const struct regmap_range wr_range[] = {
{ FXL6408_REG_DEVICE_ID, FXL6408_REG_DEVICE_ID },
{ FXL6408_REG_IO_DIR, FXL6408_REG_OUTPUT },
{ FXL6408_REG_OUTPUT_HIGH_Z, FXL6408_REG_OUTPUT_HIGH_Z },
};
static const struct regmap_range volatile_range[] = {
{ FXL6408_REG_DEVICE_ID, FXL6408_REG_DEVICE_ID },
{ FXL6408_REG_INPUT_STATUS, FXL6408_REG_INPUT_STATUS },
};
static const struct regmap_access_table rd_table = {
.yes_ranges = rd_range,
.n_yes_ranges = ARRAY_SIZE(rd_range),
};
static const struct regmap_access_table wr_table = {
.yes_ranges = wr_range,
.n_yes_ranges = ARRAY_SIZE(wr_range),
};
static const struct regmap_access_table volatile_table = {
.yes_ranges = volatile_range,
.n_yes_ranges = ARRAY_SIZE(volatile_range),
};
static const struct regmap_config regmap = {
.reg_bits = 8,
.val_bits = 8,
.max_register = FXL6408_REG_INT_STS,
.wr_table = &wr_table,
.rd_table = &rd_table,
.volatile_table = &volatile_table,
.cache_type = REGCACHE_MAPLE,
.num_reg_defaults_raw = FXL6408_REG_INT_STS + 1,
};
Annotation
- Immediate include surface: `linux/err.h`, `linux/gpio/regmap.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/module.h`, `linux/regmap.h`.
- Detected declarations: `function fxl6408_identify`, `function fxl6408_probe`, `function fxl6408_resume`.
- 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.