Lines Matching refs:npctl

160 	struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev);  in ma35_get_groups_count()  local
162 return npctl->ngroups; in ma35_get_groups_count()
167 struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev); in ma35_get_group_name() local
169 return npctl->groups[selector].name; in ma35_get_group_name()
175 struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev); in ma35_get_group_pins() local
177 if (selector >= npctl->ngroups) in ma35_get_group_pins()
180 *pins = npctl->groups[selector].pins; in ma35_get_group_pins()
181 *npins = npctl->groups[selector].npins; in ma35_get_group_pins()
187 const struct ma35_pinctrl *npctl, const char *name) in ma35_pinctrl_find_group_by_name() argument
191 for (i = 0; i < npctl->ngroups; i++) { in ma35_pinctrl_find_group_by_name()
192 if (!strcmp(npctl->groups[i].name, name)) in ma35_pinctrl_find_group_by_name()
193 return &npctl->groups[i]; in ma35_pinctrl_find_group_by_name()
203 struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev); in ma35_pinctrl_dt_node_to_map_func() local
214 grp = ma35_pinctrl_find_group_by_name(npctl, np->name); in ma35_pinctrl_dt_node_to_map_func()
216 dev_err(npctl->dev, "unable to find group for node %s\n", np->name); in ma35_pinctrl_dt_node_to_map_func()
260 struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev); in ma35_pinmux_get_func_count() local
262 return npctl->nfunctions; in ma35_pinmux_get_func_count()
268 struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev); in ma35_pinmux_get_func_name() local
270 return npctl->functions[selector].name; in ma35_pinmux_get_func_name()
278 struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev); in ma35_pinmux_get_func_groups() local
280 *groups = npctl->functions[function].groups; in ma35_pinmux_get_func_groups()
281 *num_groups = npctl->functions[function].ngroups; in ma35_pinmux_get_func_groups()
289 struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev); in ma35_pinmux_set_mux() local
290 struct ma35_pin_group *grp = &npctl->groups[group]; in ma35_pinmux_set_mux()
294 dev_dbg(npctl->dev, "enable function %s group %s\n", in ma35_pinmux_set_mux()
295 npctl->functions[selector].name, npctl->groups[group].name); in ma35_pinmux_set_mux()
298 regmap_read(npctl->regmap, setting->offset, &regval); in ma35_pinmux_set_mux()
302 regmap_write(npctl->regmap, setting->offset, regval); in ma35_pinmux_set_mux()
517 static int ma35_gpiolib_register(struct platform_device *pdev, struct ma35_pinctrl *npctl) in ma35_gpiolib_register() argument
519 struct ma35_pin_ctrl *ctrl = npctl->ctrl; in ma35_gpiolib_register()
627 static int ma35_pinconf_set_pull(struct ma35_pinctrl *npctl, unsigned int pin, in ma35_pinconf_set_pull() argument
635 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_set_pull()
660 static int ma35_pinconf_get_output(struct ma35_pinctrl *npctl, unsigned int pin) in ma35_pinconf_get_output() argument
667 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_get_output()
676 static int ma35_pinconf_get_pull(struct ma35_pinctrl *npctl, unsigned int pin) in ma35_pinconf_get_pull() argument
683 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_get_pull()
703 static int ma35_pinconf_set_output(struct ma35_pinctrl *npctl, unsigned int pin, bool out) in ma35_pinconf_set_output() argument
709 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_set_output()
716 static int ma35_pinconf_get_power_source(struct ma35_pinctrl *npctl, unsigned int pin) in ma35_pinconf_get_power_source() argument
723 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_get_power_source()
733 static int ma35_pinconf_set_power_source(struct ma35_pinctrl *npctl, in ma35_pinconf_set_power_source() argument
744 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_set_power_source()
758 static int ma35_pinconf_get_drive_strength(struct ma35_pinctrl *npctl, unsigned int pin, in ma35_pinconf_get_drive_strength() argument
766 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_get_drive_strength()
771 if (ma35_pinconf_get_power_source(npctl, pin) == MVOLT_1800) in ma35_pinconf_get_drive_strength()
779 static int ma35_pinconf_set_drive_strength(struct ma35_pinctrl *npctl, unsigned int pin, in ma35_pinconf_set_drive_strength() argument
787 if (ma35_pinconf_get_power_source(npctl, pin) == MVOLT_1800) { in ma35_pinconf_set_drive_strength()
806 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_set_drive_strength()
817 static int ma35_pinconf_get_schmitt_enable(struct ma35_pinctrl *npctl, unsigned int pin) in ma35_pinconf_get_schmitt_enable() argument
824 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_get_schmitt_enable()
831 static int ma35_pinconf_set_schmitt(struct ma35_pinctrl *npctl, unsigned int pin, int enable) in ma35_pinconf_set_schmitt() argument
838 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_set_schmitt()
852 static int ma35_pinconf_get_slew_rate(struct ma35_pinctrl *npctl, unsigned int pin) in ma35_pinconf_get_slew_rate() argument
859 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_get_slew_rate()
866 static int ma35_pinconf_set_slew_rate(struct ma35_pinctrl *npctl, unsigned int pin, int rate) in ma35_pinconf_set_slew_rate() argument
873 base = npctl->ctrl->pin_banks[group_num].reg_base; in ma35_pinconf_set_slew_rate()
886 struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev); in ma35_pinconf_get() local
895 if (ma35_pinconf_get_pull(npctl, pin) != param) in ma35_pinconf_get()
901 ret = ma35_pinconf_get_drive_strength(npctl, pin, &arg); in ma35_pinconf_get()
907 arg = ma35_pinconf_get_schmitt_enable(npctl, pin); in ma35_pinconf_get()
911 arg = ma35_pinconf_get_slew_rate(npctl, pin); in ma35_pinconf_get()
915 arg = ma35_pinconf_get_output(npctl, pin); in ma35_pinconf_get()
919 arg = ma35_pinconf_get_power_source(npctl, pin); in ma35_pinconf_get()
933 struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev); in ma35_pinconf_set() local
946 ret = ma35_pinconf_set_pull(npctl, pin, param); in ma35_pinconf_set()
950 ret = ma35_pinconf_set_drive_strength(npctl, pin, arg); in ma35_pinconf_set()
954 ret = ma35_pinconf_set_schmitt(npctl, pin, 1); in ma35_pinconf_set()
958 ret = ma35_pinconf_set_schmitt(npctl, pin, arg); in ma35_pinconf_set()
962 ret = ma35_pinconf_set_slew_rate(npctl, pin, arg); in ma35_pinconf_set()
966 ret = ma35_pinconf_set_output(npctl, pin, arg); in ma35_pinconf_set()
970 ret = ma35_pinconf_set_power_source(npctl, pin, arg); in ma35_pinconf_set()
990 struct ma35_pinctrl *npctl, u32 index) in ma35_pinctrl_parse_groups() argument
1008 elems = devm_kmalloc_array(npctl->dev, count, sizeof(u32), GFP_KERNEL); in ma35_pinctrl_parse_groups()
1018 grp->pins = devm_kcalloc(npctl->dev, grp->npins, sizeof(*grp->pins), GFP_KERNEL); in ma35_pinctrl_parse_groups()
1022 grp->settings = devm_kcalloc(npctl->dev, grp->npins, sizeof(*grp->settings), GFP_KERNEL); in ma35_pinctrl_parse_groups()
1034 grp->pins[j] = npctl->info->get_pin_num(pin->offset, pin->shift); in ma35_pinctrl_parse_groups()
1040 static int ma35_pinctrl_parse_functions(struct device_node *np, struct ma35_pinctrl *npctl, in ma35_pinctrl_parse_functions() argument
1049 dev_dbg(npctl->dev, "parse function(%d): %s\n", index, np->name); in ma35_pinctrl_parse_functions()
1051 func = &npctl->functions[index]; in ma35_pinctrl_parse_functions()
1058 func->groups = devm_kcalloc(npctl->dev, func->ngroups, sizeof(char *), GFP_KERNEL); in ma35_pinctrl_parse_functions()
1064 grp = &npctl->groups[grp_index++]; in ma35_pinctrl_parse_functions()
1065 ret = ma35_pinctrl_parse_groups(child, grp, npctl, i++); in ma35_pinctrl_parse_functions()
1074 static int ma35_pinctrl_probe_dt(struct platform_device *pdev, struct ma35_pinctrl *npctl) in ma35_pinctrl_probe_dt() argument
1083 npctl->nfunctions++; in ma35_pinctrl_probe_dt()
1084 npctl->ngroups += of_get_child_count(to_of_node(child)); in ma35_pinctrl_probe_dt()
1087 if (!npctl->nfunctions) in ma35_pinctrl_probe_dt()
1090 npctl->functions = devm_kcalloc(&pdev->dev, npctl->nfunctions, in ma35_pinctrl_probe_dt()
1091 sizeof(*npctl->functions), GFP_KERNEL); in ma35_pinctrl_probe_dt()
1092 if (!npctl->functions) in ma35_pinctrl_probe_dt()
1095 npctl->groups = devm_kcalloc(&pdev->dev, npctl->ngroups, in ma35_pinctrl_probe_dt()
1096 sizeof(*npctl->groups), GFP_KERNEL); in ma35_pinctrl_probe_dt()
1097 if (!npctl->groups) in ma35_pinctrl_probe_dt()
1104 ret = ma35_pinctrl_parse_functions(to_of_node(child), npctl, idx++); in ma35_pinctrl_probe_dt()
1118 struct ma35_pinctrl *npctl; in ma35_pinctrl_probe() local
1126 npctl = devm_kzalloc(&pdev->dev, sizeof(*npctl), GFP_KERNEL); in ma35_pinctrl_probe()
1127 if (!npctl) in ma35_pinctrl_probe()
1134 npctl->ctrl = devm_kzalloc(&pdev->dev, sizeof(*npctl->ctrl), GFP_KERNEL); in ma35_pinctrl_probe()
1135 if (!npctl->ctrl) in ma35_pinctrl_probe()
1146 npctl->info = info; in ma35_pinctrl_probe()
1147 npctl->dev = &pdev->dev; in ma35_pinctrl_probe()
1149 npctl->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "nuvoton,sys"); in ma35_pinctrl_probe()
1150 if (IS_ERR(npctl->regmap)) in ma35_pinctrl_probe()
1151 return dev_err_probe(&pdev->dev, PTR_ERR(npctl->regmap), in ma35_pinctrl_probe()
1154 ret = ma35_pinctrl_get_soc_data(npctl, pdev); in ma35_pinctrl_probe()
1158 platform_set_drvdata(pdev, npctl); in ma35_pinctrl_probe()
1160 ret = ma35_pinctrl_probe_dt(pdev, npctl); in ma35_pinctrl_probe()
1164 ret = devm_pinctrl_register_and_init(dev, ma35_pinctrl_desc, npctl, &npctl->pctl); in ma35_pinctrl_probe()
1168 ret = pinctrl_enable(npctl->pctl); in ma35_pinctrl_probe()
1172 return ma35_gpiolib_register(pdev, npctl); in ma35_pinctrl_probe()
1177 struct ma35_pinctrl *npctl = dev_get_drvdata(dev); in ma35_pinctrl_suspend() local
1179 return pinctrl_force_sleep(npctl->pctl); in ma35_pinctrl_suspend()
1184 struct ma35_pinctrl *npctl = dev_get_drvdata(dev); in ma35_pinctrl_resume() local
1186 return pinctrl_force_default(npctl->pctl); in ma35_pinctrl_resume()