[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221109165331.29332-9-rf@opensource.cirrus.com>
Date: Wed, 9 Nov 2022 16:53:27 +0000
From: Richard Fitzgerald <rf@...nsource.cirrus.com>
To: <lee@...nel.org>, <robh+dt@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <linus.walleij@...aro.org>,
<broonie@...nel.org>, <tglx@...utronix.de>, <maz@...nel.org>
CC: <alsa-devel@...a-project.org>, <devicetree@...r.kernel.org>,
<linux-gpio@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<patches@...nsource.cirrus.com>,
Richard Fitzgerald <rf@...nsource.cirrus.com>
Subject: [PATCH 08/12] regulator: arizona-micsupp: Support Cirrus Logic CS48L31/32/33
This adds a new driver identity "cs48l32-micsupp" and probe function
so that this driver can be used to control the micsupp regulator on
Cirrus Logic CS48L31/32/33 audio codecs.
Signed-off-by: Richard Fitzgerald <rf@...nsource.cirrus.com>
---
drivers/regulator/Kconfig | 8 ++--
drivers/regulator/arizona-micsupp.c | 58 +++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 070e4403c6c2..1d6813b24f85 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -139,12 +139,12 @@ config REGULATOR_ARIZONA_LDO1
config REGULATOR_ARIZONA_MICSUPP
tristate "Cirrus Madera and Wolfson Arizona class devices MICSUPP"
- depends on MFD_ARIZONA || MFD_MADERA
+ depends on MFD_ARIZONA || MFD_MADERA || MFD_CS48L32
depends on SND_SOC
help
- Support for the MICSUPP regulators found on Cirrus Logic Madera codecs
- and Wolfson Microelectronic Arizona codecs
- devices.
+ Support for the MICSUPP regulators found on Cirrus Logic Madera,
+ Cirrus Logic CS48L31/32/33, and on Wolfson Microelectronic
+ Arizona codecs.
config REGULATOR_ARM_SCMI
tristate "SCMI based regulator driver"
diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c
index 596ecd8041cd..bf154067ed34 100644
--- a/drivers/regulator/arizona-micsupp.c
+++ b/drivers/regulator/arizona-micsupp.c
@@ -24,6 +24,9 @@
#include <linux/mfd/arizona/pdata.h>
#include <linux/mfd/arizona/registers.h>
+#include <linux/mfd/cs48l32/core.h>
+#include <linux/mfd/cs48l32/registers.h>
+
#include <linux/mfd/madera/core.h>
#include <linux/mfd/madera/pdata.h>
#include <linux/mfd/madera/registers.h>
@@ -225,6 +228,28 @@ static const struct regulator_desc madera_micsupp = {
.owner = THIS_MODULE,
};
+static const struct regulator_desc cs48l32_micsupp = {
+ .name = "VOUT_MIC",
+ .supply_name = "VDD_CP",
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = 40,
+ .ops = &arizona_micsupp_ops,
+
+ .vsel_reg = CS48L32_LDO2_CTRL1,
+ .vsel_mask = CS48L32_LDO2_VSEL_MASK,
+ .enable_reg = CS48L32_CHARGE_PUMP1,
+ .enable_mask = CS48L32_CP2_EN_MASK,
+ .bypass_reg = CS48L32_CHARGE_PUMP1,
+ .bypass_mask = CS48L32_CP2_BYPASS_MASK,
+
+ .linear_ranges = arizona_micsupp_ext_ranges,
+ .n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ext_ranges),
+
+ .enable_time = 3000,
+
+ .owner = THIS_MODULE,
+};
+
static int arizona_micsupp_of_get_pdata(struct arizona_micsupp_pdata *pdata,
struct regulator_config *config,
const struct regulator_desc *desc)
@@ -361,6 +386,29 @@ static int madera_micsupp_probe(struct platform_device *pdev)
&madera->pdata.micvdd);
}
+static int cs48l32_micsupp_probe(struct platform_device *pdev)
+{
+ struct cs48l32_mfd *mfd = dev_get_drvdata(pdev->dev.parent);
+ struct arizona_micsupp *micsupp;
+ struct arizona_micsupp_pdata *pdata;
+
+ micsupp = devm_kzalloc(&pdev->dev, sizeof(*micsupp), GFP_KERNEL);
+ if (!micsupp)
+ return -ENOMEM;
+
+ pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
+
+ micsupp->regmap = mfd->regmap;
+ micsupp->dapm = &mfd->dapm;
+ micsupp->dev = mfd->dev;
+ micsupp->init_data = arizona_micsupp_ext_default;
+ micsupp->supply.supply = "VOUT_MIC";
+
+ return arizona_micsupp_common_init(pdev, micsupp, &cs48l32_micsupp, pdata);
+}
+
static struct platform_driver arizona_micsupp_driver = {
.probe = arizona_micsupp_probe,
.driver = {
@@ -375,9 +423,17 @@ static struct platform_driver madera_micsupp_driver = {
},
};
+static struct platform_driver cs48l32_micsupp_driver = {
+ .probe = cs48l32_micsupp_probe,
+ .driver = {
+ .name = "cs48l32-micsupp",
+ },
+};
+
static struct platform_driver * const arizona_micsupp_drivers[] = {
&arizona_micsupp_driver,
&madera_micsupp_driver,
+ &cs48l32_micsupp_driver,
};
static int __init arizona_micsupp_init(void)
@@ -396,7 +452,9 @@ module_exit(arizona_micsupp_exit);
/* Module information */
MODULE_AUTHOR("Mark Brown <broonie@...nsource.wolfsonmicro.com>");
+MODULE_AUTHOR("Richard Fitzgerald <rf@...nsource.cirrus.com>");
MODULE_DESCRIPTION("Arizona microphone supply driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:arizona-micsupp");
+MODULE_ALIAS("platform:cs48l32-micsupp");
MODULE_ALIAS("platform:madera-micsupp");
--
2.30.2
Powered by blists - more mailing lists