From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <lee@kernel.org>, <robh+dt@kernel.org>,
<krzysztof.kozlowski+dt@linaro.org>, <linus.walleij@linaro.org>,
<broonie@kernel.org>, <tglx@linutronix.de>, <maz@kernel.org>
Cc: <alsa-devel@alsa-project.org>, <devicetree@vger.kernel.org>,
<linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<patches@opensource.cirrus.com>,
Richard Fitzgerald <rf@opensource.cirrus.com>
Subject: [PATCH 08/12] regulator: arizona-micsupp: Support Cirrus Logic CS48L31/32/33
Date: Wed, 9 Nov 2022 16:53:27 +0000 [thread overview]
Message-ID: <20221109165331.29332-9-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20221109165331.29332-1-rf@opensource.cirrus.com>
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@opensource.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@opensource.wolfsonmicro.com>");
+MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.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
next prev parent reply other threads:[~2022-11-09 16:55 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 16:53 [PATCH 00/12] Add support for the Cirrus Logic CS48L32 audio codecs Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 01/12] dt-bindings: mfd: Add Cirrus Logic CS48L32 audio codec Richard Fitzgerald
2022-11-09 21:09 ` Rob Herring
2022-11-14 8:36 ` Krzysztof Kozlowski
2022-11-09 16:53 ` [PATCH 02/12] mfd: cs48l32: Add register definitions for Cirrus Logic CS48L31/32/33 Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 03/12] mfd: cs48l32: Add support for CS48L31/32/33 codecs Richard Fitzgerald
2022-11-11 23:07 ` kernel test robot
2022-11-16 15:43 ` Lee Jones
2022-11-09 16:53 ` [PATCH 04/12] dt-bindings: pinctrl: Add Cirrus Logic CS48L31/32/33 Richard Fitzgerald
2022-11-09 21:09 ` Rob Herring
2022-11-14 8:39 ` Krzysztof Kozlowski
2022-11-09 16:53 ` [PATCH 05/12] pinctrl: cirrus: Add support for CS48L31/32/33 codecs Richard Fitzgerald
2022-11-10 10:02 ` Linus Walleij
2022-11-10 10:55 ` Richard Fitzgerald
2022-11-12 21:01 ` kernel test robot
2022-11-09 16:53 ` [PATCH 06/12] regulator: arizona-micsupp: Don't hardcode use of ARIZONA defines Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 07/12] regulator: arizona-micsupp: Don't use a common regulator name Richard Fitzgerald
2022-11-09 16:53 ` Richard Fitzgerald [this message]
2022-11-09 16:53 ` [PATCH 09/12] irqchip: cirrus: Add driver for Cirrus Logic CS48L31/32/33 codecs Richard Fitzgerald
2022-11-10 8:02 ` Marc Zyngier
2022-11-10 11:22 ` Richard Fitzgerald
2022-11-10 12:01 ` Marc Zyngier
2022-11-10 13:00 ` Richard Fitzgerald
2022-11-10 15:13 ` Marc Zyngier
2022-11-10 16:31 ` Richard Fitzgerald
2022-11-10 16:55 ` Mark Brown
2022-11-10 18:47 ` Marc Zyngier
2022-11-10 20:36 ` Mark Brown
2022-11-11 8:00 ` Marc Zyngier
2022-11-11 11:16 ` Charles Keepax
2022-11-11 11:49 ` Mark Brown
2022-11-11 13:01 ` Charles Keepax
2022-11-11 13:00 ` Charles Keepax
2022-11-16 16:44 ` Mark Brown
2022-11-10 13:14 ` Richard Fitzgerald
2022-11-10 15:40 ` Marc Zyngier
2022-11-10 13:01 ` Mark Brown
2022-11-09 16:53 ` [PATCH 10/12] ASoC: wm_adsp: Allow client to hook into pre_run callback Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 11/12] dt-bindings: sound: Add Cirrus Logic CS48L31/32/33 codecs Richard Fitzgerald
2022-11-09 21:09 ` Rob Herring
2022-11-14 8:45 ` Krzysztof Kozlowski
2022-11-14 11:00 ` Richard Fitzgerald
2022-11-14 11:03 ` Krzysztof Kozlowski
2022-11-14 12:34 ` Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 12/12] ASoC: cs48l32: Add codec driver for Cirrus Logic CS48L31/32/33 Richard Fitzgerald
2022-11-10 20:20 ` kernel test robot
2022-11-10 20:53 ` [PATCH 00/12] Add support for the Cirrus Logic CS48L32 audio codecs Mark Brown
2022-11-11 13:50 ` Richard Fitzgerald
2022-11-23 13:11 ` (subset) " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221109165331.29332-9-rf@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).