Lines Matching refs:pin
54 unsigned long pin) in mtk_get_regmap() argument
56 if (pin >= pctl->devdata->type1_start && pin < pctl->devdata->type1_end) in mtk_get_regmap()
61 static unsigned int mtk_get_port(struct mtk_pinctrl *pctl, unsigned long pin) in mtk_get_port() argument
64 return ((pin >> 4) & pctl->devdata->port_mask) in mtk_get_port()
109 static int mtk_pconf_set_ies_smt(struct mtk_pinctrl *pctl, unsigned pin, in mtk_pconf_set_ies_smt() argument
134 return pctl->devdata->spec_ies_smt_set(mtk_get_regmap(pctl, pin), in mtk_pconf_set_ies_smt()
135 pin, pctl->devdata->port_align, value, arg); in mtk_pconf_set_ies_smt()
138 bit = BIT(pin & 0xf); in mtk_pconf_set_ies_smt()
146 reg_addr = SET_ADDR(mtk_get_port(pctl, pin) + offset, pctl); in mtk_pconf_set_ies_smt()
148 reg_addr = CLR_ADDR(mtk_get_port(pctl, pin) + offset, pctl); in mtk_pconf_set_ies_smt()
150 regmap_write(mtk_get_regmap(pctl, pin), reg_addr, bit); in mtk_pconf_set_ies_smt()
156 unsigned int pin, unsigned char align, int value) in mtk_pconf_spec_set_ies_smt_range() argument
161 if (pin >= ies_smt_infos[i].start && in mtk_pconf_spec_set_ies_smt_range()
162 pin <= ies_smt_infos[i].end) { in mtk_pconf_spec_set_ies_smt_range()
181 struct mtk_pinctrl *pctl, unsigned long pin) { in mtk_find_pin_drv_grp_by_pin() argument
187 if (pin == pin_drv->pin) in mtk_find_pin_drv_grp_by_pin()
195 unsigned int pin, unsigned char driving) in mtk_pconf_set_driving() argument
202 if (pin >= pctl->devdata->npins) in mtk_pconf_set_driving()
205 pin_drv = mtk_find_pin_drv_grp_by_pin(pctl, pin); in mtk_pconf_set_driving()
218 return regmap_update_bits(mtk_get_regmap(pctl, pin), in mtk_pconf_set_driving()
227 unsigned int info_num, unsigned int pin, in mtk_pctrl_spec_pull_set_samereg() argument
237 if (pin == pupd_infos[i].pin) { in mtk_pctrl_spec_pull_set_samereg()
286 unsigned int pin, bool enable, bool isup, unsigned int arg) in mtk_pconf_set_pull_select() argument
301 ret = pctl->devdata->spec_pull_set(mtk_get_regmap(pctl, pin), in mtk_pconf_set_pull_select()
302 pin, pctl->devdata->port_align, isup, r1r0); in mtk_pconf_set_pull_select()
310 arg, pin); in mtk_pconf_set_pull_select()
314 bit = BIT(pin & 0xf); in mtk_pconf_set_pull_select()
316 reg_pullen = SET_ADDR(mtk_get_port(pctl, pin) + in mtk_pconf_set_pull_select()
319 reg_pullen = CLR_ADDR(mtk_get_port(pctl, pin) + in mtk_pconf_set_pull_select()
323 reg_pullsel = SET_ADDR(mtk_get_port(pctl, pin) + in mtk_pconf_set_pull_select()
326 reg_pullsel = CLR_ADDR(mtk_get_port(pctl, pin) + in mtk_pconf_set_pull_select()
329 regmap_write(mtk_get_regmap(pctl, pin), reg_pullen, bit); in mtk_pconf_set_pull_select()
330 regmap_write(mtk_get_regmap(pctl, pin), reg_pullsel, bit); in mtk_pconf_set_pull_select()
335 unsigned int pin, enum pin_config_param param, in mtk_pconf_parse_conf() argument
343 ret = mtk_pconf_set_pull_select(pctl, pin, false, false, arg); in mtk_pconf_parse_conf()
346 ret = mtk_pconf_set_pull_select(pctl, pin, true, true, arg); in mtk_pconf_parse_conf()
349 ret = mtk_pconf_set_pull_select(pctl, pin, true, false, arg); in mtk_pconf_parse_conf()
352 mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true); in mtk_pconf_parse_conf()
353 ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param); in mtk_pconf_parse_conf()
356 mtk_gpio_set(pctl->chip, pin, arg); in mtk_pconf_parse_conf()
357 ret = mtk_pmx_gpio_set_direction(pctldev, NULL, pin, false); in mtk_pconf_parse_conf()
360 mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true); in mtk_pconf_parse_conf()
361 ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param); in mtk_pconf_parse_conf()
364 ret = mtk_pconf_set_driving(pctl, pin, arg); in mtk_pconf_parse_conf()
392 ret = mtk_pconf_parse_conf(pctldev, g->pin, in mtk_pconf_group_set()
410 mtk_pctrl_find_group_by_pin(struct mtk_pinctrl *pctl, u32 pin) in mtk_pctrl_find_group_by_pin() argument
417 if (grp->pin == pin) in mtk_pctrl_find_group_by_pin()
427 const struct mtk_desc_pin *pin = pctl->devdata->pins + pin_num; in mtk_pctrl_find_function_by_pin() local
428 const struct mtk_desc_function *func = pin->functions; in mtk_pctrl_find_function_by_pin()
445 const struct mtk_desc_pin *pin = pctl->devdata->pins + i; in mtk_pctrl_is_function_valid() local
447 if (pin->pin.number == pin_num) { in mtk_pctrl_is_function_valid()
449 pin->functions; in mtk_pctrl_is_function_valid()
465 u32 pin, u32 fnum, struct mtk_pinctrl_group *grp, in mtk_pctrl_dt_node_to_map_func() argument
477 ret = mtk_pctrl_is_function_valid(pctl, pin, fnum); in mtk_pctrl_dt_node_to_map_func()
480 fnum, pin); in mtk_pctrl_dt_node_to_map_func()
497 u32 pinfunc, pin, func; in mtk_pctrl_dt_subnode_to_map() local
548 pin = MTK_GET_PIN_NO(pinfunc); in mtk_pctrl_dt_subnode_to_map()
551 if (pin >= pctl->devdata->npins || in mtk_pctrl_dt_subnode_to_map()
558 grp = mtk_pctrl_find_group_by_pin(pctl, pin); in mtk_pctrl_dt_subnode_to_map()
561 pin); in mtk_pctrl_dt_subnode_to_map()
566 err = mtk_pctrl_dt_node_to_map_func(pctl, pin, func, grp, map, in mtk_pctrl_dt_subnode_to_map()
635 *pins = (unsigned *)&pctl->groups[group].pin; in mtk_pctrl_get_group_pins()
674 unsigned long pin, unsigned long mode) in mtk_pmx_set_mode() argument
683 pctl->devdata->spec_pinmux_set(mtk_get_regmap(pctl, pin), in mtk_pmx_set_mode()
684 pin, mode); in mtk_pmx_set_mode()
686 reg_addr = ((pin / MAX_GPIO_MODE_PER_REG) << pctl->devdata->port_shf) in mtk_pmx_set_mode()
690 bit = pin % MAX_GPIO_MODE_PER_REG; in mtk_pmx_set_mode()
693 return regmap_update_bits(mtk_get_regmap(pctl, pin), in mtk_pmx_set_mode()
701 const struct mtk_desc_pin *pin; in mtk_find_pin_by_eint_num() local
704 pin = pctl->devdata->pins + i; in mtk_find_pin_by_eint_num()
705 if (pin->eint.eintnum == eint_num) in mtk_find_pin_by_eint_num()
706 return pin; in mtk_find_pin_by_eint_num()
721 ret = mtk_pctrl_is_function_valid(pctl, g->pin, function); in mtk_pmx_set_mux()
728 desc = mtk_pctrl_find_function_by_pin(pctl, g->pin, function); in mtk_pmx_set_mux()
731 mtk_pmx_set_mode(pctldev, g->pin, desc->muxval); in mtk_pmx_set_mux()
738 const struct mtk_desc_pin *pin = pctl->devdata->pins + offset; in mtk_pmx_find_gpio_mode() local
739 const struct mtk_desc_function *func = pin->functions; in mtk_pmx_find_gpio_mode()
831 const struct mtk_desc_pin *pin; in mtk_gpio_to_irq() local
834 pin = pctl->devdata->pins + offset; in mtk_gpio_to_irq()
835 if (pin->eint.eintnum == NO_EINT_SUPPORT) in mtk_gpio_to_irq()
838 eint_n = pin->eint.eintnum; in mtk_gpio_to_irq()
847 const struct mtk_desc_pin *pin; in mtk_gpio_set_config() local
854 pin = pctl->devdata->pins + offset; in mtk_gpio_set_config()
855 if (pin->eint.eintnum == NO_EINT_SUPPORT) in mtk_gpio_set_config()
859 eint_n = pin->eint.eintnum; in mtk_gpio_set_config()
917 const struct mtk_desc_pin *pin = pctl->devdata->pins + i; in mtk_pctrl_build_state() local
920 group->name = pin->pin.name; in mtk_pctrl_build_state()
921 group->pin = pin->pin.number; in mtk_pctrl_build_state()
923 pctl->grp_names[i] = pin->pin.name; in mtk_pctrl_build_state()
934 const struct mtk_desc_pin *pin; in mtk_xt_get_gpio_n() local
936 pin = mtk_find_pin_by_eint_num(pctl, eint_n); in mtk_xt_get_gpio_n()
937 if (!pin) in mtk_xt_get_gpio_n()
941 *gpio_n = pin->pin.number; in mtk_xt_get_gpio_n()
949 const struct mtk_desc_pin *pin; in mtk_xt_get_gpio_state() local
951 pin = mtk_find_pin_by_eint_num(pctl, eint_n); in mtk_xt_get_gpio_state()
952 if (!pin) in mtk_xt_get_gpio_state()
955 return mtk_gpio_get(pctl->chip, pin->pin.number); in mtk_xt_get_gpio_state()
961 const struct mtk_desc_pin *pin; in mtk_xt_set_gpio_as_eint() local
963 pin = mtk_find_pin_by_eint_num(pctl, eint_n); in mtk_xt_set_gpio_as_eint()
964 if (!pin) in mtk_xt_set_gpio_as_eint()
968 mtk_pmx_set_mode(pctl->pctl_dev, pin->pin.number, pin->eint.eintmux); in mtk_xt_set_gpio_as_eint()
970 mtk_pmx_gpio_set_direction(pctl->pctl_dev, NULL, pin->pin.number, in mtk_xt_set_gpio_as_eint()
973 mtk_pconf_set_ies_smt(pctl, pin->pin.number, 1, in mtk_xt_set_gpio_as_eint()
1074 pins[i] = pctl->devdata->pins[i].pin; in mtk_pctrl_init()