Lines Matching +full:dsp +full:- +full:gpio4

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2016-2018 Cirrus Logic
17 #include <linux/pinctrl/pinconf-generic.h>
25 #include "../pinctrl-utils.h"
27 #include "pinctrl-madera.h"
31 * NOTE: IDs are zero-indexed for coding convenience
37 PINCTRL_PIN(3, "gpio4"),
77 * All single-pin functions can be mapped to any GPIO, however pinmux applies
81 * Since these do not correspond to anything in the actual hardware - they are
82 * merely an adaptation to pinctrl's view of the world - we use the same name
86 "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
94 /* set of pin numbers for single-pin groups, zero-indexed */
119 * alt-functions always apply to a single pin group, other functions always
198 .name = "dsp-gpio",
213 .name = "fll1-clk",
218 .name = "fll2-clk",
223 .name = "fll3-clk",
228 .name = "fllao-clk",
233 .name = "fll1-lock",
238 .name = "fll2-lock",
243 .name = "fll3-lock",
248 .name = "fllao-lock",
258 .name = "opclk-async",
278 .name = "asrc1-in1-lock",
283 .name = "asrc1-in2-lock",
288 .name = "asrc2-in1-lock",
293 .name = "asrc2-in2-lock",
298 .name = "spkl-short-circuit",
303 .name = "spkr-short-circuit",
308 .name = "spk-shutdown",
313 .name = "spk-overheat-shutdown",
318 .name = "spk-overheat-warn",
323 .name = "timer1-sts",
328 .name = "timer2-sts",
333 .name = "timer3-sts",
338 .name = "timer4-sts",
343 .name = "timer5-sts",
348 .name = "timer6-sts",
353 .name = "timer7-sts",
358 .name = "timer8-sts",
363 .name = "log1-fifo-ne",
368 .name = "log2-fifo-ne",
373 .name = "log3-fifo-ne",
378 .name = "log4-fifo-ne",
383 .name = "log5-fifo-ne",
388 .name = "log6-fifo-ne",
393 .name = "log7-fifo-ne",
398 .name = "log8-fifo-ne",
403 .name = "aux-pdm-clk",
408 .name = "aux-pdm-dat",
426 dev_warn(priv->dev, "%u mA not a valid drive strength", milliamps); in madera_pin_make_drv_str()
450 /* Number of alt function groups plus number of single-pin groups */ in madera_get_groups_count()
451 return priv->chip->n_pin_groups + priv->chip->n_pins; in madera_get_groups_count()
459 if (selector < priv->chip->n_pin_groups) in madera_get_group_name()
460 return priv->chip->pin_groups[selector].name; in madera_get_group_name()
462 selector -= priv->chip->n_pin_groups; in madera_get_group_name()
473 if (selector < priv->chip->n_pin_groups) { in madera_get_group_pins()
474 *pins = priv->chip->pin_groups[selector].pins; in madera_get_group_pins()
475 *num_pins = priv->chip->pin_groups[selector].n_pins; in madera_get_group_pins()
478 selector -= priv->chip->n_pin_groups; in madera_get_group_pins()
489 const struct madera_pin_chip *chip = priv->chip; in madera_pin_dbg_show_fn()
504 for (i = 0; i < chip->n_pin_groups; ++i) { in madera_pin_dbg_show_fn()
505 for (g_pin = 0; g_pin < chip->pin_groups[i].n_pins; ++g_pin) { in madera_pin_dbg_show_fn()
506 if (chip->pin_groups[i].pins[g_pin] == pin) { in madera_pin_dbg_show_fn()
508 chip->pin_groups[i].name); in madera_pin_dbg_show_fn()
525 ret = regmap_read(priv->madera->regmap, reg, &conf[0]); in madera_pin_dbg_show()
529 ret = regmap_read(priv->madera->regmap, reg + 1, &conf[1]); in madera_pin_dbg_show()
604 *num_groups = priv->chip->n_pins; in madera_mux_get_groups()
615 struct madera *madera = priv->madera; in madera_mux_set_mux()
616 const struct madera_pin_groups *pin_group = priv->chip->pin_groups; in madera_mux_set_mux()
617 unsigned int n_chip_groups = priv->chip->n_pin_groups; in madera_mux_set_mux()
622 dev_dbg(priv->dev, "%s selecting %u (%s) for group %u (%s)\n", in madera_mux_set_mux()
627 /* alt func pin assignments are codec-specific */ in madera_mux_set_mux()
629 if (strcmp(func_name, pin_group->name) == 0) in madera_mux_set_mux()
636 return -EINVAL; in madera_mux_set_mux()
638 for (i = 0; i < pin_group->n_pins; ++i) { in madera_mux_set_mux()
639 reg = MADERA_GPIO1_CTRL_1 + (2 * pin_group->pins[i]); in madera_mux_set_mux()
641 dev_dbg(priv->dev, "%s setting 0x%x func bits to 0\n", in madera_mux_set_mux()
644 ret = regmap_update_bits(madera->regmap, reg, in madera_mux_set_mux()
653 * be offset by the number of chip-specific functions at the in madera_mux_set_mux()
656 group -= n_chip_groups; in madera_mux_set_mux()
659 dev_dbg(priv->dev, "%s setting 0x%x func bits to 0x%x\n", in madera_mux_set_mux()
662 ret = regmap_update_bits(madera->regmap, in madera_mux_set_mux()
669 dev_err(priv->dev, "Failed to write to 0x%x (%d)\n", reg, ret); in madera_mux_set_mux()
680 struct madera *madera = priv->madera; in madera_gpio_set_direction()
690 ret = regmap_update_bits(madera->regmap, reg, MADERA_GP1_DIR_MASK, val); in madera_gpio_set_direction()
692 dev_err(priv->dev, "Failed to write to 0x%x (%d)\n", reg, ret); in madera_gpio_set_direction()
702 struct madera *madera = priv->madera; in madera_gpio_request_enable()
707 ret = regmap_update_bits(madera->regmap, reg, MADERA_GP1_FN_MASK, 1); in madera_gpio_request_enable()
709 dev_err(priv->dev, "Failed to write to 0x%x (%d)\n", reg, ret); in madera_gpio_request_enable()
719 struct madera *madera = priv->madera; in madera_gpio_disable_free()
726 ret = regmap_update_bits(madera->regmap, reg, MADERA_GP1_FN_MASK, 1); in madera_gpio_disable_free()
728 dev_err(priv->dev, "Failed to write to 0x%x (%d)\n", reg, ret); in madera_gpio_disable_free()
752 ret = regmap_read(priv->madera->regmap, reg, &conf[0]); in madera_pin_conf_get()
754 ret = regmap_read(priv->madera->regmap, reg + 1, &conf[1]); in madera_pin_conf_get()
757 dev_err(priv->dev, "Failed to read GP%d conf (%d)\n", in madera_pin_conf_get()
813 return -ENOTSUPP; in madera_pin_conf_get()
832 dev_dbg(priv->dev, "%s config 0x%lx\n", __func__, *configs); in madera_pin_conf_set()
871 * we can't configure debounce time per-pin so value in madera_pin_conf_set()
917 return -ENOTSUPP; in madera_pin_conf_set()
921 --num_configs; in madera_pin_conf_set()
924 dev_dbg(priv->dev, in madera_pin_conf_set()
928 ret = regmap_update_bits(priv->madera->regmap, reg, mask[0], conf[0]); in madera_pin_conf_set()
933 ret = regmap_update_bits(priv->madera->regmap, reg, mask[1], conf[1]); in madera_pin_conf_set()
940 dev_err(priv->dev, in madera_pin_conf_set()
954 unsigned int n_groups = priv->chip->n_pin_groups; in madera_pin_conf_group_set()
957 dev_dbg(priv->dev, "%s setting group %s\n", __func__, in madera_pin_conf_group_set()
963 selector - n_groups, in madera_pin_conf_group_set()
967 pin_group = &priv->chip->pin_groups[selector]; in madera_pin_conf_group_set()
969 for (i = 0; i < pin_group->n_pins; ++i) { in madera_pin_conf_group_set()
971 pin_group->pins[i], in madera_pin_conf_group_set()
990 .name = "madera-pinctrl",
1000 struct madera *madera = dev_get_drvdata(pdev->dev.parent); in madera_pin_probe()
1001 const struct madera_pdata *pdata = &madera->pdata; in madera_pin_probe()
1008 dev_dbg(&pdev->dev, "%s\n", __func__); in madera_pin_probe()
1010 device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); in madera_pin_probe()
1012 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in madera_pin_probe()
1014 return -ENOMEM; in madera_pin_probe()
1016 priv->dev = &pdev->dev; in madera_pin_probe()
1017 priv->madera = madera; in madera_pin_probe()
1019 switch (madera->type) { in madera_pin_probe()
1022 priv->chip = &cs47l15_pin_chip; in madera_pin_probe()
1026 priv->chip = &cs47l35_pin_chip; in madera_pin_probe()
1031 priv->chip = &cs47l85_pin_chip; in madera_pin_probe()
1036 priv->chip = &cs47l90_pin_chip; in madera_pin_probe()
1042 priv->chip = &cs47l92_pin_chip; in madera_pin_probe()
1048 if (!priv->chip) in madera_pin_probe()
1049 return -ENODEV; in madera_pin_probe()
1051 madera_pin_desc.npins = priv->chip->n_pins; in madera_pin_probe()
1053 ret = devm_pinctrl_register_and_init(&pdev->dev, in madera_pin_probe()
1056 &priv->pctl); in madera_pin_probe()
1058 dev_err(priv->dev, "Failed pinctrl register (%d)\n", ret); in madera_pin_probe()
1063 if (pdata->gpio_configs) { in madera_pin_probe()
1064 ret = pinctrl_register_mappings(pdata->gpio_configs, in madera_pin_probe()
1065 pdata->n_gpio_configs); in madera_pin_probe()
1067 return dev_err_probe(priv->dev, ret, in madera_pin_probe()
1071 ret = pinctrl_enable(priv->pctl); in madera_pin_probe()
1073 dev_err(priv->dev, "Failed to enable pinctrl (%d)\n", ret); in madera_pin_probe()
1079 dev_dbg(priv->dev, "pinctrl probed ok\n"); in madera_pin_probe()
1088 if (priv->madera->pdata.gpio_configs) in madera_pin_remove()
1089 pinctrl_unregister_mappings(priv->madera->pdata.gpio_configs); in madera_pin_remove()
1096 .name = "madera-pinctrl",