hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/pinctrl/cirrus/pinctrl-madera-core.c
....@@ -1,12 +1,8 @@
1
-// SPDX-License-Identifier: GPL-2.0
1
+// SPDX-License-Identifier: GPL-2.0-only
22 /*
33 * Pinctrl for Cirrus Logic Madera codecs
44 *
55 * Copyright (C) 2016-2018 Cirrus Logic
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by the
9
- * Free Software Foundation; version 2.
106 */
117
128 #include <linux/err.h>
....@@ -14,6 +10,7 @@
1410 #include <linux/platform_device.h>
1511 #include <linux/regmap.h>
1612 #include <linux/slab.h>
13
+#include <linux/pinctrl/machine.h>
1714 #include <linux/pinctrl/pinctrl.h>
1815 #include <linux/pinctrl/pinmux.h>
1916 #include <linux/pinctrl/pinconf.h>
....@@ -399,6 +396,16 @@
399396 .group_names = madera_pin_single_group_names,
400397 .func = 0x157
401398 },
399
+ {
400
+ .name = "aux-pdm-clk",
401
+ .group_names = madera_pin_single_group_names,
402
+ .func = 0x280
403
+ },
404
+ {
405
+ .name = "aux-pdm-dat",
406
+ .group_names = madera_pin_single_group_names,
407
+ .func = 0x281
408
+ },
402409 };
403410
404411 static u16 madera_pin_make_drv_str(struct madera_pin_private *priv,
....@@ -550,9 +557,8 @@
550557 seq_printf(s, " DRV=%umA", madera_pin_unmake_drv_str(priv, conf[1]));
551558
552559 if (conf[0] & MADERA_GP1_IP_CFG_MASK)
553
- seq_puts(s, "SCHMITT");
560
+ seq_puts(s, " SCHMITT");
554561 }
555
-
556562
557563 static const struct pinctrl_ops madera_pin_group_ops = {
558564 .get_groups_count = madera_get_groups_count,
....@@ -801,7 +807,7 @@
801807 result = 1;
802808 break;
803809 default:
804
- break;
810
+ return -ENOTSUPP;
805811 }
806812
807813 *config = pinconf_to_config_packed(param, result);
....@@ -905,7 +911,7 @@
905911 conf[1] &= ~MADERA_GP1_DIR;
906912 break;
907913 default:
908
- break;
914
+ return -ENOTSUPP;
909915 }
910916
911917 ++configs;
....@@ -971,10 +977,10 @@
971977 }
972978
973979 static const struct pinconf_ops madera_pin_conf_ops = {
980
+ .is_generic = true,
974981 .pin_config_get = madera_pin_conf_get,
975982 .pin_config_set = madera_pin_conf_set,
976983 .pin_config_group_set = madera_pin_conf_group_set,
977
-
978984 };
979985
980986 static struct pinctrl_desc madera_pin_desc = {
....@@ -989,7 +995,7 @@
989995 static int madera_pin_probe(struct platform_device *pdev)
990996 {
991997 struct madera *madera = dev_get_drvdata(pdev->dev.parent);
992
- const struct madera_pdata *pdata = dev_get_platdata(madera->dev);
998
+ const struct madera_pdata *pdata = &madera->pdata;
993999 struct madera_pin_private *priv;
9941000 int ret;
9951001
....@@ -1007,6 +1013,10 @@
10071013 pdev->dev.of_node = madera->dev->of_node;
10081014
10091015 switch (madera->type) {
1016
+ case CS47L15:
1017
+ if (IS_ENABLED(CONFIG_PINCTRL_CS47L15))
1018
+ priv->chip = &cs47l15_pin_chip;
1019
+ break;
10101020 case CS47L35:
10111021 if (IS_ENABLED(CONFIG_PINCTRL_CS47L35))
10121022 priv->chip = &cs47l35_pin_chip;
....@@ -1020,6 +1030,12 @@
10201030 case CS47L91:
10211031 if (IS_ENABLED(CONFIG_PINCTRL_CS47L90))
10221032 priv->chip = &cs47l90_pin_chip;
1033
+ break;
1034
+ case CS42L92:
1035
+ case CS47L92:
1036
+ case CS47L93:
1037
+ if (IS_ENABLED(CONFIG_PINCTRL_CS47L92))
1038
+ priv->chip = &cs47l92_pin_chip;
10231039 break;
10241040 default:
10251041 break;
....@@ -1040,7 +1056,7 @@
10401056 }
10411057
10421058 /* if the configuration is provided through pdata, apply it */
1043
- if (pdata && pdata->gpio_configs) {
1059
+ if (pdata->gpio_configs) {
10441060 ret = pinctrl_register_mappings(pdata->gpio_configs,
10451061 pdata->n_gpio_configs);
10461062 if (ret) {
....@@ -1057,13 +1073,26 @@
10571073 return ret;
10581074 }
10591075
1076
+ platform_set_drvdata(pdev, priv);
1077
+
10601078 dev_dbg(priv->dev, "pinctrl probed ok\n");
1079
+
1080
+ return 0;
1081
+}
1082
+
1083
+static int madera_pin_remove(struct platform_device *pdev)
1084
+{
1085
+ struct madera_pin_private *priv = platform_get_drvdata(pdev);
1086
+
1087
+ if (priv->madera->pdata.gpio_configs)
1088
+ pinctrl_unregister_mappings(priv->madera->pdata.gpio_configs);
10611089
10621090 return 0;
10631091 }
10641092
10651093 static struct platform_driver madera_pin_driver = {
10661094 .probe = madera_pin_probe,
1095
+ .remove = madera_pin_remove,
10671096 .driver = {
10681097 .name = "madera-pinctrl",
10691098 },