MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mtk_pinctrl_process_entry

Function mtk_pinctrl_process_entry

freebsd/mips/mediatek/mtk_pinctrl.c:93–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93static int
94mtk_pinctrl_process_entry(device_t dev, struct mtk_pin_group *table,
95 const char *group, char *func)
96{
97 uint32_t val;
98 int found = 0, i, j;
99
100 for (i = 0; table[i].name != NULL; i++) {
101 if (strcmp(table[i].name, group) == 0) {
102 found = 1;
103 break;
104 }
105 }
106
107 if (!found)
108 return (ENOENT);
109
110 for (j = 0; j < table[i].funcnum; j++) {
111 if (strcmp(table[i].functions[j].name, func) == 0) {
112 val = mtk_sysctl_get(table[i].sysc_reg);
113 val &= ~(table[i].mask << table[i].offset);
114 val |= (table[i].functions[j].value << table[i].offset);
115 mtk_sysctl_set(table[i].sysc_reg, val);
116 return (0);
117 }
118 }
119
120 return (ENOENT);
121}
122
123static int
124mtk_pinctrl_process_node(device_t dev, struct mtk_pin_group *table,

Callers 1

mtk_pinctrl_process_nodeFunction · 0.85

Calls 3

strcmpFunction · 0.85
mtk_sysctl_getFunction · 0.85
mtk_sysctl_setFunction · 0.85

Tested by

no test coverage detected