drivers/pinctrl/sophgo/pinctrl-cv18xx.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/sophgo/pinctrl-cv18xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/sophgo/pinctrl-cv18xx.c- Extension
.c- Size
- 11553 bytes
- Lines
- 444
- Domain
- Driver Families
- Bucket
- drivers/pinctrl
- 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/bitfield.hlinux/export.hlinux/io.hlinux/of.hlinux/platform_device.hlinux/bsearch.hlinux/seq_file.hlinux/spinlock.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hdt-bindings/pinctrl/pinctrl-cv18xx.h../pinctrl-utils.h../pinmux.hpinctrl-cv18xx.h
Detected Declarations
struct cv1800_privfunction cv1800_dt_get_pin_muxfunction cv1800_dt_get_pin_mux2function cv1800_set_power_cfgfunction cv1800_get_power_cfgfunction cv1800_pctrl_dbg_showfunction cv1800_verify_pinmux_configfunction cv1800_verify_pin_groupfunction cv1800_dt_node_to_map_postfunction cv1800_set_pinmux_configfunction cv1800_pconf_getfunction cv1800_pinconf_compute_configfunction cv1800_set_pinconf_configfunction cv1800_pinctrl_initexport cv1800_pctrl_opsexport cv1800_pmx_opsexport cv1800_pconf_opsexport cv1800_cfg_ops
Annotated Snippet
struct cv1800_priv {
void __iomem *regs[2];
unsigned int num_power_cfg;
u32 power_cfg[] __counted_by(num_power_cfg);
};
static unsigned int cv1800_dt_get_pin_mux(u32 value)
{
return (value >> 16) & GENMASK(7, 0);
}
static unsigned int cv1800_dt_get_pin_mux2(u32 value)
{
return (value >> 24) & GENMASK(7, 0);
}
#define cv1800_pinctrl_get_component_addr(pctrl, _comp) \
((pctrl)->regs[(_comp)->area] + (_comp)->offset)
static int cv1800_set_power_cfg(struct sophgo_pinctrl *pctrl,
u8 domain, u32 cfg)
{
struct cv1800_priv *priv = pctrl->priv_ctrl;
if (domain >= pctrl->data->npds)
return -ENOTSUPP;
if (priv->power_cfg[domain] && priv->power_cfg[domain] != cfg)
return -EINVAL;
priv->power_cfg[domain] = cfg;
return 0;
}
static int cv1800_get_power_cfg(struct sophgo_pinctrl *pctrl,
u8 domain)
{
struct cv1800_priv *priv = pctrl->priv_ctrl;
return priv->power_cfg[domain];
}
#define PIN_BGA_ID_OFFSET 8
#define PIN_BGA_ID_MASK 0xff
static const char *const io_type_desc[] = {
"1V8",
"18OD33",
"AUDIO",
"ETH"
};
static const char *cv1800_get_power_cfg_desc(struct sophgo_pinctrl *pctrl,
u8 domain)
{
return pctrl->data->pdnames[domain];
}
static void cv1800_pctrl_dbg_show(struct pinctrl_dev *pctldev,
struct seq_file *seq, unsigned int pin_id)
{
struct sophgo_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
struct cv1800_priv *priv = pctrl->priv_ctrl;
const struct sophgo_pin *sp = sophgo_get_pin(pctrl, pin_id);
const struct cv1800_pin *pin = sophgo_to_cv1800_pin(sp);
enum cv1800_pin_io_type type = cv1800_pin_io_type(pin);
u32 pin_hwid = pin->pin.id;
u32 value;
void __iomem *reg;
if (pin_hwid >> PIN_BGA_ID_OFFSET)
seq_printf(seq, "pos: %c%u ",
'A' + (pin_hwid >> PIN_BGA_ID_OFFSET) - 1,
pin_hwid & PIN_BGA_ID_MASK);
else
seq_printf(seq, "pos: %u ", pin_hwid);
seq_printf(seq, "power-domain: %s ",
cv1800_get_power_cfg_desc(pctrl, pin->power_domain));
seq_printf(seq, "type: %s ", io_type_desc[type]);
reg = cv1800_pinctrl_get_component_addr(priv, &pin->mux);
value = readl(reg);
seq_printf(seq, "mux: 0x%08x ", value);
if (pin->pin.flags & CV1800_PIN_HAVE_MUX2) {
reg = cv1800_pinctrl_get_component_addr(priv, &pin->mux2);
value = readl(reg);
seq_printf(seq, "mux2: 0x%08x ", value);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/export.h`, `linux/io.h`, `linux/of.h`, `linux/platform_device.h`, `linux/bsearch.h`, `linux/seq_file.h`, `linux/spinlock.h`.
- Detected declarations: `struct cv1800_priv`, `function cv1800_dt_get_pin_mux`, `function cv1800_dt_get_pin_mux2`, `function cv1800_set_power_cfg`, `function cv1800_get_power_cfg`, `function cv1800_pctrl_dbg_show`, `function cv1800_verify_pinmux_config`, `function cv1800_verify_pin_group`, `function cv1800_dt_node_to_map_post`, `function cv1800_set_pinmux_config`.
- Atlas domain: Driver Families / drivers/pinctrl.
- 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.