| 91 | } |
| 92 | |
| 93 | static int |
| 94 | mtk_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 | |
| 123 | static int |
| 124 | mtk_pinctrl_process_node(device_t dev, struct mtk_pin_group *table, |
no test coverage detected