drivers/pinctrl/sophgo/pinctrl-sg2002.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/sophgo/pinctrl-sg2002.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/sophgo/pinctrl-sg2002.c- Extension
.c- Size
- 17598 bytes
- Lines
- 552
- Domain
- Driver Families
- Bucket
- drivers/pinctrl
- 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/module.hlinux/platform_device.hlinux/of.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hdt-bindings/pinctrl/pinctrl-sg2002.hpinctrl-cv18xx.h
Detected Declarations
enum SG2002_POWER_DOMAINfunction sg2002_get_pull_upfunction sg2002_get_pull_downfunction sg2002_get_oc_mapfunction sg2002_get_schmitt_map
Annotated Snippet
if (pstate == PIN_POWER_STATE_1V8) {
*map = sg2002_18od33_1v8_oc_map;
return ARRAY_SIZE(sg2002_18od33_1v8_oc_map);
} else if (pstate == PIN_POWER_STATE_3V3) {
*map = sg2002_18od33_3v3_oc_map;
return ARRAY_SIZE(sg2002_18od33_3v3_oc_map);
}
}
if (type == IO_TYPE_ETH) {
*map = sg2002_eth_oc_map;
return ARRAY_SIZE(sg2002_eth_oc_map);
}
return -ENOTSUPP;
}
static const u32 sg2002_1v8_schmitt_map[] = {
0,
970000,
1040000
};
static const u32 sg2002_18od33_1v8_schmitt_map[] = {
0,
1070000
};
static const u32 sg2002_18od33_3v3_schmitt_map[] = {
0,
1100000
};
static int sg2002_get_schmitt_map(const struct sophgo_pin *sp, const u32 *psmap,
const u32 **map)
{
const struct cv1800_pin *pin = sophgo_to_cv1800_pin(sp);
enum cv1800_pin_io_type type = cv1800_pin_io_type(pin);
u32 pstate = psmap[pin->power_domain];
if (type == IO_TYPE_1V8_ONLY) {
*map = sg2002_1v8_schmitt_map;
return ARRAY_SIZE(sg2002_1v8_schmitt_map);
}
if (type == IO_TYPE_1V8_OR_3V3) {
if (pstate == PIN_POWER_STATE_1V8) {
*map = sg2002_18od33_1v8_schmitt_map;
return ARRAY_SIZE(sg2002_18od33_1v8_schmitt_map);
} else if (pstate == PIN_POWER_STATE_3V3) {
*map = sg2002_18od33_3v3_schmitt_map;
return ARRAY_SIZE(sg2002_18od33_3v3_schmitt_map);
}
}
return -ENOTSUPP;
}
static const struct sophgo_vddio_cfg_ops sg2002_vddio_cfg_ops = {
.get_pull_up = sg2002_get_pull_up,
.get_pull_down = sg2002_get_pull_down,
.get_oc_map = sg2002_get_oc_map,
.get_schmitt_map = sg2002_get_schmitt_map,
};
static const struct pinctrl_pin_desc sg2002_pins[] = {
PINCTRL_PIN(PIN_AUD_AINL_MIC, "AUD_AINL_MIC"),
PINCTRL_PIN(PIN_AUD_AOUTR, "AUD_AOUTR"),
PINCTRL_PIN(PIN_SD0_CLK, "SD0_CLK"),
PINCTRL_PIN(PIN_SD0_CMD, "SD0_CMD"),
PINCTRL_PIN(PIN_SD0_D0, "SD0_D0"),
PINCTRL_PIN(PIN_SD0_D1, "SD0_D1"),
PINCTRL_PIN(PIN_SD0_D2, "SD0_D2"),
PINCTRL_PIN(PIN_SD0_D3, "SD0_D3"),
PINCTRL_PIN(PIN_SD0_CD, "SD0_CD"),
PINCTRL_PIN(PIN_SD0_PWR_EN, "SD0_PWR_EN"),
PINCTRL_PIN(PIN_SPK_EN, "SPK_EN"),
PINCTRL_PIN(PIN_UART0_TX, "UART0_TX"),
PINCTRL_PIN(PIN_UART0_RX, "UART0_RX"),
PINCTRL_PIN(PIN_EMMC_DAT2, "EMMC_DAT2"),
PINCTRL_PIN(PIN_EMMC_CLK, "EMMC_CLK"),
PINCTRL_PIN(PIN_EMMC_DAT0, "EMMC_DAT0"),
PINCTRL_PIN(PIN_EMMC_DAT3, "EMMC_DAT3"),
PINCTRL_PIN(PIN_EMMC_CMD, "EMMC_CMD"),
PINCTRL_PIN(PIN_EMMC_DAT1, "EMMC_DAT1"),
PINCTRL_PIN(PIN_JTAG_CPU_TMS, "JTAG_CPU_TMS"),
PINCTRL_PIN(PIN_JTAG_CPU_TCK, "JTAG_CPU_TCK"),
PINCTRL_PIN(PIN_IIC0_SCL, "IIC0_SCL"),
PINCTRL_PIN(PIN_IIC0_SDA, "IIC0_SDA"),
PINCTRL_PIN(PIN_AUX0, "AUX0"),
Annotation
- Immediate include surface: `linux/module.h`, `linux/platform_device.h`, `linux/of.h`, `linux/pinctrl/pinctrl.h`, `linux/pinctrl/pinmux.h`, `dt-bindings/pinctrl/pinctrl-sg2002.h`, `pinctrl-cv18xx.h`.
- Detected declarations: `enum SG2002_POWER_DOMAIN`, `function sg2002_get_pull_up`, `function sg2002_get_pull_down`, `function sg2002_get_oc_map`, `function sg2002_get_schmitt_map`.
- Atlas domain: Driver Families / drivers/pinctrl.
- 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.