Lines Matching full:pci
138 struct rk805_pctrl_info *pci = gpiochip_get_data(chip); in rk805_gpio_get() local
141 ret = regmap_read(pci->rk808->regmap, pci->pin_cfg[offset].reg, &val); in rk805_gpio_get()
143 dev_err(pci->dev, "get gpio%d value failed\n", offset); in rk805_gpio_get()
147 return !!(val & pci->pin_cfg[offset].val_msk); in rk805_gpio_get()
154 struct rk805_pctrl_info *pci = gpiochip_get_data(chip); in rk805_gpio_set() local
157 ret = regmap_update_bits(pci->rk808->regmap, in rk805_gpio_set()
158 pci->pin_cfg[offset].reg, in rk805_gpio_set()
159 pci->pin_cfg[offset].val_msk, in rk805_gpio_set()
160 value ? pci->pin_cfg[offset].val_msk : 0); in rk805_gpio_set()
162 dev_err(pci->dev, "set gpio%d value %d failed\n", in rk805_gpio_set()
181 struct rk805_pctrl_info *pci = gpiochip_get_data(chip); in rk805_gpio_get_direction() local
186 if (!pci->pin_cfg[offset].dir_msk) in rk805_gpio_get_direction()
189 ret = regmap_read(pci->rk808->regmap, in rk805_gpio_get_direction()
190 pci->pin_cfg[offset].reg, in rk805_gpio_get_direction()
193 dev_err(pci->dev, "get gpio%d direction failed\n", offset); in rk805_gpio_get_direction()
197 if (val & pci->pin_cfg[offset].dir_msk) in rk805_gpio_get_direction()
220 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_groups_count() local
222 return pci->num_pin_groups; in rk805_pinctrl_get_groups_count()
228 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_group_name() local
230 return pci->groups[group].name; in rk805_pinctrl_get_group_name()
238 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_group_pins() local
240 *pins = pci->groups[group].pins; in rk805_pinctrl_get_group_pins()
241 *num_pins = pci->groups[group].npins; in rk805_pinctrl_get_group_pins()
256 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_funcs_count() local
258 return pci->num_functions; in rk805_pinctrl_get_funcs_count()
264 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_func_name() local
266 return pci->functions[function].name; in rk805_pinctrl_get_func_name()
274 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_func_groups() local
276 *groups = pci->functions[function].groups; in rk805_pinctrl_get_func_groups()
277 *num_groups = pci->functions[function].ngroups; in rk805_pinctrl_get_func_groups()
286 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in _rk805_pinctrl_set_mux() local
289 if (!pci->pin_cfg[offset].fun_msk) in _rk805_pinctrl_set_mux()
293 ret = regmap_update_bits(pci->rk808->regmap, in _rk805_pinctrl_set_mux()
294 pci->pin_cfg[offset].reg, in _rk805_pinctrl_set_mux()
295 pci->pin_cfg[offset].fun_msk, in _rk805_pinctrl_set_mux()
296 pci->pin_cfg[offset].fun_msk); in _rk805_pinctrl_set_mux()
298 dev_err(pci->dev, "set gpio%d GPIO failed\n", offset); in _rk805_pinctrl_set_mux()
302 dev_err(pci->dev, "Couldn't find function mux %d\n", mux); in _rk805_pinctrl_set_mux()
313 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_set_mux() local
314 int mux = pci->functions[function].mux_option; in rk805_pinctrl_set_mux()
324 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pmx_gpio_set_direction() local
330 dev_err(pci->dev, "set gpio%d mux failed\n", offset); in rk805_pmx_gpio_set_direction()
335 if (!pci->pin_cfg[offset].dir_msk) in rk805_pmx_gpio_set_direction()
338 ret = regmap_update_bits(pci->rk808->regmap, in rk805_pmx_gpio_set_direction()
339 pci->pin_cfg[offset].reg, in rk805_pmx_gpio_set_direction()
340 pci->pin_cfg[offset].dir_msk, in rk805_pmx_gpio_set_direction()
341 input ? 0 : pci->pin_cfg[offset].dir_msk); in rk805_pmx_gpio_set_direction()
343 dev_err(pci->dev, "set gpio%d direction failed\n", offset); in rk805_pmx_gpio_set_direction()
361 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinconf_get() local
367 arg = rk805_gpio_get(&pci->gpio_chip, pin); in rk805_pinconf_get()
370 dev_err(pci->dev, "Properties not supported\n"); in rk805_pinconf_get()
383 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinconf_set() local
393 rk805_gpio_set(&pci->gpio_chip, pin, arg); in rk805_pinconf_set()
397 dev_err(pci->dev, "Properties not supported\n"); in rk805_pinconf_set()
420 struct rk805_pctrl_info *pci; in rk805_pinctrl_probe() local
425 pci = devm_kzalloc(&pdev->dev, sizeof(*pci), GFP_KERNEL); in rk805_pinctrl_probe()
426 if (!pci) in rk805_pinctrl_probe()
429 pci->dev = &pdev->dev; in rk805_pinctrl_probe()
430 pci->rk808 = dev_get_drvdata(pdev->dev.parent); in rk805_pinctrl_probe()
432 pci->pinctrl_desc = rk805_pinctrl_desc; in rk805_pinctrl_probe()
433 pci->gpio_chip = rk805_gpio_chip; in rk805_pinctrl_probe()
434 pci->gpio_chip.parent = &pdev->dev; in rk805_pinctrl_probe()
436 platform_set_drvdata(pdev, pci); in rk805_pinctrl_probe()
438 switch (pci->rk808->variant) { in rk805_pinctrl_probe()
440 pci->pins = rk805_pins_desc; in rk805_pinctrl_probe()
441 pci->num_pins = ARRAY_SIZE(rk805_pins_desc); in rk805_pinctrl_probe()
442 pci->functions = rk805_pin_functions; in rk805_pinctrl_probe()
443 pci->num_functions = ARRAY_SIZE(rk805_pin_functions); in rk805_pinctrl_probe()
444 pci->groups = rk805_pin_groups; in rk805_pinctrl_probe()
445 pci->num_pin_groups = ARRAY_SIZE(rk805_pin_groups); in rk805_pinctrl_probe()
446 pci->pinctrl_desc.pins = rk805_pins_desc; in rk805_pinctrl_probe()
447 pci->pinctrl_desc.npins = ARRAY_SIZE(rk805_pins_desc); in rk805_pinctrl_probe()
448 pci->pin_cfg = rk805_gpio_cfgs; in rk805_pinctrl_probe()
449 pci->gpio_chip.ngpio = ARRAY_SIZE(rk805_gpio_cfgs); in rk805_pinctrl_probe()
453 pci->rk808->variant); in rk805_pinctrl_probe()
458 ret = devm_gpiochip_add_data(&pdev->dev, &pci->gpio_chip, pci); in rk805_pinctrl_probe()
465 pci->pctl = devm_pinctrl_register(&pdev->dev, &pci->pinctrl_desc, pci); in rk805_pinctrl_probe()
466 if (IS_ERR(pci->pctl)) { in rk805_pinctrl_probe()
468 return PTR_ERR(pci->pctl); in rk805_pinctrl_probe()
472 ret = gpiochip_add_pin_range(&pci->gpio_chip, dev_name(&pdev->dev), in rk805_pinctrl_probe()
473 0, 0, pci->gpio_chip.ngpio); in rk805_pinctrl_probe()