diff options
Diffstat (limited to 'drivers/pinctrl/cirrus/pinctrl-madera-core.c')
| -rw-r--r-- | drivers/pinctrl/cirrus/pinctrl-madera-core.c | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/drivers/pinctrl/cirrus/pinctrl-madera-core.c b/drivers/pinctrl/cirrus/pinctrl-madera-core.c index a5dda832024a..1d9481b17091 100644 --- a/drivers/pinctrl/cirrus/pinctrl-madera-core.c +++ b/drivers/pinctrl/cirrus/pinctrl-madera-core.c @@ -1,23 +1,23 @@ -// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0-only /* * Pinctrl for Cirrus Logic Madera codecs * * Copyright (C) 2016-2018 Cirrus Logic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation; version 2. */ #include <linux/err.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> +#include <linux/seq_file.h> #include <linux/slab.h> + +#include <linux/pinctrl/machine.h> +#include <linux/pinctrl/pinconf-generic.h> +#include <linux/pinctrl/pinconf.h> #include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinmux.h> -#include <linux/pinctrl/pinconf.h> -#include <linux/pinctrl/pinconf-generic.h> #include <linux/mfd/madera/core.h> #include <linux/mfd/madera/registers.h> @@ -399,6 +399,16 @@ static const struct { .group_names = madera_pin_single_group_names, .func = 0x157 }, + { + .name = "aux-pdm-clk", + .group_names = madera_pin_single_group_names, + .func = 0x280 + }, + { + .name = "aux-pdm-dat", + .group_names = madera_pin_single_group_names, + .func = 0x281 + }, }; static u16 madera_pin_make_drv_str(struct madera_pin_private *priv, @@ -553,7 +563,6 @@ static void __maybe_unused madera_pin_dbg_show(struct pinctrl_dev *pctldev, seq_puts(s, " SCHMITT"); } - static const struct pinctrl_ops madera_pin_group_ops = { .get_groups_count = madera_get_groups_count, .get_group_name = madera_get_group_name, @@ -795,7 +804,7 @@ static int madera_pin_conf_get(struct pinctrl_dev *pctldev, unsigned int pin, if (conf[0] & MADERA_GP1_IP_CFG_MASK) result = 1; break; - case PIN_CONFIG_OUTPUT: + case PIN_CONFIG_LEVEL: if ((conf[1] & MADERA_GP1_DIR_MASK) && (conf[0] & MADERA_GP1_LVL_MASK)) result = 1; @@ -893,7 +902,7 @@ static int madera_pin_conf_set(struct pinctrl_dev *pctldev, unsigned int pin, mask[1] |= MADERA_GP1_DIR_MASK; conf[1] |= MADERA_GP1_DIR; break; - case PIN_CONFIG_OUTPUT: + case PIN_CONFIG_LEVEL: val = pinconf_to_config_argument(*configs); mask[0] |= MADERA_GP1_LVL_MASK; if (val) @@ -989,7 +998,7 @@ static struct pinctrl_desc madera_pin_desc = { static int madera_pin_probe(struct platform_device *pdev) { struct madera *madera = dev_get_drvdata(pdev->dev.parent); - const struct madera_pdata *pdata = dev_get_platdata(madera->dev); + const struct madera_pdata *pdata = &madera->pdata; struct madera_pin_private *priv; int ret; @@ -998,15 +1007,20 @@ static int madera_pin_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "%s\n", __func__); + device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; priv->dev = &pdev->dev; priv->madera = madera; - pdev->dev.of_node = madera->dev->of_node; switch (madera->type) { + case CS47L15: + if (IS_ENABLED(CONFIG_PINCTRL_CS47L15)) + priv->chip = &cs47l15_pin_chip; + break; case CS47L35: if (IS_ENABLED(CONFIG_PINCTRL_CS47L35)) priv->chip = &cs47l35_pin_chip; @@ -1021,6 +1035,12 @@ static int madera_pin_probe(struct platform_device *pdev) if (IS_ENABLED(CONFIG_PINCTRL_CS47L90)) priv->chip = &cs47l90_pin_chip; break; + case CS42L92: + case CS47L92: + case CS47L93: + if (IS_ENABLED(CONFIG_PINCTRL_CS47L92)) + priv->chip = &cs47l92_pin_chip; + break; default: break; } @@ -1040,15 +1060,13 @@ static int madera_pin_probe(struct platform_device *pdev) } /* if the configuration is provided through pdata, apply it */ - if (pdata && pdata->gpio_configs) { - ret = pinctrl_register_mappings(pdata->gpio_configs, - pdata->n_gpio_configs); - if (ret) { - dev_err(priv->dev, - "Failed to register pdata mappings (%d)\n", - ret); - return ret; - } + if (pdata->gpio_configs) { + ret = devm_pinctrl_register_mappings(priv->dev, + pdata->gpio_configs, + pdata->n_gpio_configs); + if (ret) + return dev_err_probe(priv->dev, ret, + "Failed to register pdata mappings\n"); } ret = pinctrl_enable(priv->pctl); @@ -1057,6 +1075,8 @@ static int madera_pin_probe(struct platform_device *pdev) return ret; } + platform_set_drvdata(pdev, priv); + dev_dbg(priv->dev, "pinctrl probed ok\n"); return 0; |
