STRUCT MTK_PINCTRL_DEVDATA(9)
β¨ NAME β¨
struct mtk_pinctrl_devdata β bestie, this is the struct that hands over all the HW GPIO related data π
that's literally its whole job, "Provide HW GPIO related data", iconic.
π¦ SYNOPSIS π¦
okay so here's the whole shape of it, no cap, every field exactly where it lives π
struct mtk_pinctrl_devdata {
const struct mtk_desc_pin *pins;
unsigned int npins;
const struct mtk_drv_group_desc *grp_desc;
unsigned int n_grp_cls;
const struct mtk_pin_drv_grp *pin_drv_grp;
unsigned int n_pin_drv_grps;
const struct mtk_pin_ies_smt_set *spec_ies;
unsigned int n_spec_ies;
const struct mtk_pin_spec_pupd_set_samereg *spec_pupd;
unsigned int n_spec_pupd;
const struct mtk_pin_ies_smt_set *spec_smt;
unsigned int n_spec_smt;
int (*spec_pull_set)(struct regmap *regmap, const struct
mtk_pinctrl_devdata *devdata, unsigned int pin, bool isup, unsigned int
r1r0);
int (*spec_ies_smt_set)(struct regmap *reg, const struct
mtk_pinctrl_devdata *devdata, unsigned int pin, int value, enum
pin_config_param arg);
void (*spec_pinmux_set)(struct regmap *reg, unsigned int pin,
unsigned int mode);
void (*spec_dir_set)(unsigned int *reg_addr, unsigned int pin);
int (*mt8365_set_clr_mode)(struct regmap *regmap, unsigned int bit,
unsigned int reg_pullen, unsigned int reg_pullsel, bool enable, bool
isup);
unsigned int dir_offset;
unsigned int ies_offset;
unsigned int smt_offset;
unsigned int pullen_offset;
unsigned int pullsel_offset;
unsigned int dout_offset;
unsigned int din_offset;
unsigned int pinmux_offset;
unsigned short type1_start;
unsigned short type1_end;
unsigned char port_shf;
unsigned char port_mask;
unsigned char port_align;
struct mtk_eint_hw eint_hw;
struct mtk_eint_regs *eint_regs;
unsigned int mode_mask;
unsigned int mode_per_reg;
unsigned int mode_shf;
};
π Members π
time for the vibe check on each member, let's go π
pinsβ an array that describes all the pins the pin controller affects πΈ like the full guest list, everybody's in here.npinsβ the number of entries inpins. literally just the headcount π«Άgrp_descβ the driving group info. the group chat bio, if u will β¨pin_drv_grpβ the driving group for all pins. yes, all of them πspec_iesβ special pin setting for input enable πn_spec_iesβ number of entries inspec_iesβspec_pupdβ special pull up/down setting πn_spec_pupdβ number of entries inspec_pupdπspec_smtβ special pin setting for schmitt π¦n_spec_smtβ number of entries inspec_smtπspec_pull_setβ okay so each SoC may have special pins for pull up/down setting, and these pins' pull setting are very different β they have a separate pull up/down bit, plus the R0 and R1 resistor bit, so they need special pull setting, fr fr. if the special setting is success, this should return0, otherwise it should return a non-zero value π (yes bestie,0means slay, non-zero means something went sideways).spec_ies_smt_setβ some pins are irregular: their input enable and smt control register are discontinuous, but they are mapping together. that means when the user sets smt, input enable is set at the same time π« so they also need special control. if special control is success, this should return0, otherwise return a non-zero value πspec_pinmux_setβ in some cases there are two pinmux functions that share the same value in the same segment of the pinmux control register. so if the user wants to use one of the two functions, they need an extra bit setting to select the right one π the drama of it all.spec_dir_setβ in very few SoCs, the direction control registers are not arranged continuously, they may be cut to parts, so they need special dir setting π§ rare but real.mt8365_set_clr_modeβ inmt8365, some pins won't set correcty because they need to use the main R/W register to read/update/write the modes instead of the SET/CLR register π€ (that's the manpage's spelling of "correcty", we keep it, we respect it).dir_offsetβ the direction register offset. where it's at πpullen_offsetβ the pull-up/pull-down enable register offset πΈpinmux_offsetβ the pinmux register offset β¨type1_startβ some chips have two base addresses for the pull select register, meaning some pins use the first address and others use the second. this member records the start of the pin number to use the second address π (so this is where the second-address era begins).type1_endβ the end of the pin number to use the second address π the era ends here.port_shfβ the shift between two registers π¦ the gap, the distance, the space between.port_maskβ the mask of the register πport_alignβ provide clear register and set register step β
π₯ SEE ALSO π₯
- Kernel file
./drivers/pinctrl/mediatek/pinctrl-mtk-common.h struct mtk_drv_group_desc(9)struct mtk_pin_drv_grp(9)struct mtk_pin_spec_pupd_set_samereg(9)
and that's the whole page bestie, go read the kernel source, iykyk ππ«Ά
source/version:./drivers/pinctrl/mediatekβ dated October 2026, from the Kernel API Manual, all aboutstruct mtk_pinctrl_devdata(9)π mwah, go forth and configure those pins πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms