drivers/pinctrl/mediatek/pinctrl-moore.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/mediatek/pinctrl-moore.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/mediatek/pinctrl-moore.c- Extension
.c- Size
- 18681 bytes
- Lines
- 748
- 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.
- 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
dt-bindings/pinctrl/mt65xx.hlinux/gpio/driver.hlinux/pinctrl/consumer.hpinctrl-moore.h
Detected Declarations
function mtk_pinmux_set_muxfunction mtk_pinmux_gpio_request_enablefunction mtk_pinmux_gpio_set_directionfunction mtk_pinconf_getfunction mtk_pinconf_setfunction mtk_pinconf_group_getfunction mtk_pinconf_group_setfunction mtk_gpio_getfunction mtk_gpio_setfunction mtk_gpio_direction_outputfunction mtk_gpio_get_directionfunction mtk_gpio_to_irqfunction mtk_gpio_set_configfunction mtk_build_gpiochipfunction mtk_build_groupsfunction mtk_build_functionsfunction mtk_moore_pinctrl_probe
Annotated Snippet
if (hw->soc->bias_get_combo) {
err = hw->soc->bias_get_combo(hw, desc, &pullup, &ret);
if (err)
return err;
if (ret != MTK_PUPD_SET_R1R0_00 && ret != MTK_DISABLE)
return -EINVAL;
} else if (hw->soc->bias_disable_get) {
err = hw->soc->bias_disable_get(hw, desc, &ret);
if (err)
return err;
} else {
return -ENOTSUPP;
}
break;
case PIN_CONFIG_BIAS_PULL_UP:
if (hw->soc->bias_get_combo) {
err = hw->soc->bias_get_combo(hw, desc, &pullup, &ret);
if (err)
return err;
if (ret == MTK_PUPD_SET_R1R0_00 || ret == MTK_DISABLE)
return -EINVAL;
if (!pullup)
return -EINVAL;
} else if (hw->soc->bias_get) {
err = hw->soc->bias_get(hw, desc, 1, &ret);
if (err)
return err;
} else {
return -ENOTSUPP;
}
break;
case PIN_CONFIG_BIAS_PULL_DOWN:
if (hw->soc->bias_get_combo) {
err = hw->soc->bias_get_combo(hw, desc, &pullup, &ret);
if (err)
return err;
if (ret == MTK_PUPD_SET_R1R0_00 || ret == MTK_DISABLE)
return -EINVAL;
if (pullup)
return -EINVAL;
} else if (hw->soc->bias_get) {
err = hw->soc->bias_get(hw, desc, 0, &ret);
if (err)
return err;
} else {
return -ENOTSUPP;
}
break;
case PIN_CONFIG_SLEW_RATE:
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SR, &val);
if (err)
return err;
if (!val)
return -EINVAL;
break;
case PIN_CONFIG_INPUT_ENABLE:
case PIN_CONFIG_OUTPUT_ENABLE:
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &val);
if (err)
return err;
/* HW takes input mode as zero; output mode as non-zero */
if ((val && param == PIN_CONFIG_INPUT_ENABLE) ||
(!val && param == PIN_CONFIG_OUTPUT_ENABLE))
return -EINVAL;
break;
case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &val);
if (err)
return err;
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SMT, &val2);
if (err)
return err;
if (val || !val2)
return -EINVAL;
break;
case PIN_CONFIG_DRIVE_STRENGTH:
if (hw->soc->drive_get) {
err = hw->soc->drive_get(hw, desc, &ret);
if (err)
return err;
} else {
err = -ENOTSUPP;
}
Annotation
- Immediate include surface: `dt-bindings/pinctrl/mt65xx.h`, `linux/gpio/driver.h`, `linux/pinctrl/consumer.h`, `pinctrl-moore.h`.
- Detected declarations: `function mtk_pinmux_set_mux`, `function mtk_pinmux_gpio_request_enable`, `function mtk_pinmux_gpio_set_direction`, `function mtk_pinconf_get`, `function mtk_pinconf_set`, `function mtk_pinconf_group_get`, `function mtk_pinconf_group_set`, `function mtk_gpio_get`, `function mtk_gpio_set`, `function mtk_gpio_direction_output`.
- Atlas domain: Driver Families / drivers/pinctrl.
- 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.