drivers/pinctrl/mediatek/pinctrl-paris.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/mediatek/pinctrl-paris.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/mediatek/pinctrl-paris.c- Extension
.c- Size
- 27987 bytes
- Lines
- 1108
- 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.
- 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/gpio/driver.hlinux/module.hlinux/seq_file.hlinux/pinctrl/consumer.hdt-bindings/pinctrl/mt65xx.hpinctrl-paris.h
Detected Declarations
function mtk_drv_adv_to_uAfunction mtk_drv_uA_to_advfunction mtk_pinmux_gpio_request_enablefunction mtk_pinmux_gpio_set_directionfunction mtk_pinconf_getfunction mtk_pinconf_setfunction mtk_pctrl_find_group_by_pinfunction mtk_pctrl_find_function_by_pinfunction mtk_pctrl_is_function_validfunction mtk_pctrl_dt_node_to_map_funcfunction mtk_pctrl_dt_subnode_to_mapfunction mtk_pctrl_dt_node_to_mapfunction for_each_child_of_node_scopedfunction mtk_pctrl_get_groups_countfunction mtk_pctrl_get_group_pinsfunction mtk_hw_get_value_wrapfunction mtk_pctrl_show_one_pinfunction mtk_pctrl_dbg_showfunction mtk_pmx_get_funcs_cntfunction mtk_pmx_get_func_groupsfunction mtk_pmx_set_muxfunction mtk_pconf_group_getfunction mtk_pconf_group_setfunction mtk_gpio_get_directionfunction mtk_gpio_getfunction mtk_gpio_setfunction mtk_gpio_direction_inputfunction mtk_gpio_direction_outputfunction mtk_gpio_to_irqfunction mtk_gpio_set_configfunction mtk_build_gpiochipfunction mtk_pctrl_build_statefunction mtk_paris_pinctrl_probefunction mtk_paris_pinctrl_suspendfunction mtk_paris_pinctrl_resumeexport mtk_pctrl_show_one_pinexport mtk_paris_pinctrl_probe
Annotated Snippet
if (param == PIN_CONFIG_BIAS_DISABLE) {
if (ret != MTK_DISABLE)
err = -EINVAL;
} else if (param == PIN_CONFIG_BIAS_PULL_UP) {
if (!pullup || ret == MTK_DISABLE)
err = -EINVAL;
} else if (param == PIN_CONFIG_BIAS_PULL_DOWN) {
if (pullup || ret == MTK_DISABLE)
err = -EINVAL;
}
break;
case PIN_CONFIG_SLEW_RATE:
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SR, &ret);
break;
case PIN_CONFIG_INPUT_ENABLE:
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_IES, &ret);
if (!ret)
err = -EINVAL;
break;
case PIN_CONFIG_LEVEL:
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &ret);
if (err)
break;
if (!ret) {
err = -EINVAL;
break;
}
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DO, &ret);
break;
case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &ret);
if (err)
break;
/* return error when in output mode
* because schmitt trigger only work in input mode
*/
if (ret) {
err = -EINVAL;
break;
}
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SMT, &ret);
if (!ret)
err = -EINVAL;
break;
case PIN_CONFIG_DRIVE_STRENGTH:
if (!hw->soc->drive_get)
break;
if (hw->soc->adv_drive_get) {
err = hw->soc->adv_drive_get(hw, desc, &ret);
if (!err) {
err = mtk_drv_adv_to_uA(ret);
if (err > 0) {
/* PIN_CONFIG_DRIVE_STRENGTH_UA used */
err = -EINVAL;
break;
}
}
}
err = hw->soc->drive_get(hw, desc, &ret);
break;
case PIN_CONFIG_DRIVE_STRENGTH_UA:
if (!hw->soc->adv_drive_get)
break;
err = hw->soc->adv_drive_get(hw, desc, &ret);
if (err)
break;
err = mtk_drv_adv_to_uA(ret);
if (err < 0)
break;
ret = err;
err = 0;
break;
case MTK_PIN_CONFIG_TDSEL:
case MTK_PIN_CONFIG_RDSEL:
reg = (param == MTK_PIN_CONFIG_TDSEL) ?
PINCTRL_PIN_REG_TDSEL : PINCTRL_PIN_REG_RDSEL;
err = mtk_hw_get_value(hw, desc, reg, &ret);
break;
case MTK_PIN_CONFIG_PU_ADV:
case MTK_PIN_CONFIG_PD_ADV:
if (!hw->soc->adv_pull_get)
break;
pullup = param == MTK_PIN_CONFIG_PU_ADV;
Annotation
- Immediate include surface: `linux/gpio/driver.h`, `linux/module.h`, `linux/seq_file.h`, `linux/pinctrl/consumer.h`, `dt-bindings/pinctrl/mt65xx.h`, `pinctrl-paris.h`.
- Detected declarations: `function mtk_drv_adv_to_uA`, `function mtk_drv_uA_to_adv`, `function mtk_pinmux_gpio_request_enable`, `function mtk_pinmux_gpio_set_direction`, `function mtk_pinconf_get`, `function mtk_pinconf_set`, `function mtk_pctrl_find_group_by_pin`, `function mtk_pctrl_find_function_by_pin`, `function mtk_pctrl_is_function_valid`, `function mtk_pctrl_dt_node_to_map_func`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: integration 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.