linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: allow drivers in modules to register fixed regulators
       [not found] <20180718004909.213735-1-djkurtz@chromium.org>
@ 2018-07-18  0:49 ` Daniel Kurtz
  2018-07-18 10:42   ` Mark Brown
  2018-07-18  0:49 ` [PATCH 2/2] ASoC: AMD: Add an always on fixed 1.8V regulator for da7219 VDDIO Daniel Kurtz
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Kurtz @ 2018-07-18  0:49 UTC (permalink / raw)
  Cc: Dylan Reid, Jimmy Cheng-Yi Chiang, Daniel Kurtz, Liam Girdwood,
	Mark Brown, open list:VOLTAGE AND CURRENT REGULATOR FRAMEWORK

Sound machine drivers tend to live in modules. Sometimes such a machine
driver needs to register a fixed regulator to provide to a codec.

Export regulator_register_always_on() such that this is possible.

Change-Id: I2906f96df278b5fa65d40d3a777bf6d3d91841d2
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
 drivers/regulator/fixed-helper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/fixed-helper.c b/drivers/regulator/fixed-helper.c
index 777fac6fb4cb0a..f53fbda043f525 100644
--- a/drivers/regulator/fixed-helper.c
+++ b/drivers/regulator/fixed-helper.c
@@ -60,3 +60,4 @@ struct platform_device *regulator_register_always_on(int id, const char *name,
 
 	return &data->pdev;
 }
+EXPORT_SYMBOL_GPL(regulator_register_always_on);
-- 
2.18.0.203.gfac676dfb9-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ASoC: AMD: Add an always on fixed 1.8V regulator for da7219 VDDIO
       [not found] <20180718004909.213735-1-djkurtz@chromium.org>
  2018-07-18  0:49 ` [PATCH 1/2] regulator: allow drivers in modules to register fixed regulators Daniel Kurtz
@ 2018-07-18  0:49 ` Daniel Kurtz
  2018-07-18 10:46   ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Kurtz @ 2018-07-18  0:49 UTC (permalink / raw)
  Cc: Dylan Reid, Jimmy Cheng-Yi Chiang, Akshu Agrawal, Daniel Kurtz,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Alex Deucher, Mukunda, Vijendar, Kuninori Morimoto, Wei Yongjun,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

From: Akshu Agrawal <akshu.agrawal@amd.com>

DA7219's VDDIO for our platform need to be configured for 1.8V.
Hence we register a fixed 1.8V voltage regulator in the machine driver.

Change-Id: I65fd93e1dd37c3e0d38265b4b1492ea53b93afd4
Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
 sound/soc/amd/Kconfig                |  1 +
 sound/soc/amd/acp-da7219-max98357a.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig
index 6cbf9cf4d1a4c2..58c1dcb4d2550f 100644
--- a/sound/soc/amd/Kconfig
+++ b/sound/soc/amd/Kconfig
@@ -8,6 +8,7 @@ config SND_SOC_AMD_CZ_DA7219MX98357_MACH
 	select SND_SOC_DA7219
 	select SND_SOC_MAX98357A
 	select SND_SOC_ADAU7002
+	select REGULATOR
 	depends on SND_SOC_AMD_ACP && I2C
 	help
 	 This option enables machine driver for DA7219 and MAX9835.
diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c
index ccddc6650b9c79..6ea0f42f5b7692 100644
--- a/sound/soc/amd/acp-da7219-max98357a.c
+++ b/sound/soc/amd/acp-da7219-max98357a.c
@@ -32,6 +32,8 @@
 #include <linux/clk.h>
 #include <linux/gpio.h>
 #include <linux/module.h>
+#include <linux/regulator/fixed.h>
+#include <linux/regulator/machine.h>
 #include <linux/i2c.h>
 #include <linux/input.h>
 #include <linux/acpi.h>
@@ -278,11 +280,23 @@ static struct snd_soc_card cz_card = {
 	.num_controls = ARRAY_SIZE(cz_mc_controls),
 };
 
+static struct regulator_consumer_supply acp_da7219_supplies[] = {
+	REGULATOR_SUPPLY("VDDIO", "i2c-DLGS7219:00")
+};
+
 static int cz_probe(struct platform_device *pdev)
 {
 	int ret;
 	struct snd_soc_card *card;
 	struct acp_platform_info *machine;
+	struct platform_device *reg;
+
+	reg = regulator_register_always_on(0, "fixed-1.8V",
+					   acp_da7219_supplies,
+					   ARRAY_SIZE(acp_da7219_supplies),
+					   1800000);
+	if (!reg)
+		return -ENOMEM;
 
 	machine = devm_kzalloc(&pdev->dev, sizeof(struct acp_platform_info),
 			       GFP_KERNEL);
-- 
2.18.0.203.gfac676dfb9-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] regulator: allow drivers in modules to register fixed regulators
  2018-07-18  0:49 ` [PATCH 1/2] regulator: allow drivers in modules to register fixed regulators Daniel Kurtz
@ 2018-07-18 10:42   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2018-07-18 10:42 UTC (permalink / raw)
  To: Daniel Kurtz
  Cc: Dylan Reid, Jimmy Cheng-Yi Chiang, Liam Girdwood,
	open list:VOLTAGE AND CURRENT REGULATOR FRAMEWORK

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

On Tue, Jul 17, 2018 at 06:49:08PM -0600, Daniel Kurtz wrote:
> Sound machine drivers tend to live in modules. Sometimes such a machine
> driver needs to register a fixed regulator to provide to a codec.
> 
> Export regulator_register_always_on() such that this is possible.

Given that your driver is for a device you shouldn't be using this
function, anything you're creating should be parented off that device
and so you should be registering normally.

> Change-Id: I2906f96df278b5fa65d40d3a777bf6d3d91841d2

Please don't include noise like this in upstream submissions.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ASoC: AMD: Add an always on fixed 1.8V regulator for da7219 VDDIO
  2018-07-18  0:49 ` [PATCH 2/2] ASoC: AMD: Add an always on fixed 1.8V regulator for da7219 VDDIO Daniel Kurtz
@ 2018-07-18 10:46   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2018-07-18 10:46 UTC (permalink / raw)
  To: Daniel Kurtz
  Cc: Dylan Reid, Jimmy Cheng-Yi Chiang, Akshu Agrawal, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Alex Deucher, Mukunda, Vijendar,
	Kuninori Morimoto, Wei Yongjun,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

[-- Attachment #1: Type: text/plain, Size: 797 bytes --]

On Tue, Jul 17, 2018 at 06:49:09PM -0600, Daniel Kurtz wrote:
> From: Akshu Agrawal <akshu.agrawal@amd.com>
> 
> DA7219's VDDIO for our platform need to be configured for 1.8V.
> Hence we register a fixed 1.8V voltage regulator in the machine driver.
> 
> Change-Id: I65fd93e1dd37c3e0d38265b4b1492ea53b93afd4

Again, please don't include noise like this in upstream submissions.

> +++ b/sound/soc/amd/Kconfig
> @@ -8,6 +8,7 @@ config SND_SOC_AMD_CZ_DA7219MX98357_MACH
>  	select SND_SOC_DA7219
>  	select SND_SOC_MAX98357A
>  	select SND_SOC_ADAU7002
> +	select REGULATOR
>  	depends on SND_SOC_AMD_ACP && I2C

This seems inappropriate, I'd expect a dependency and if it were to stay
a select it's also not selecting all the bits required to make this do
something useful.  

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-18 10:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20180718004909.213735-1-djkurtz@chromium.org>
2018-07-18  0:49 ` [PATCH 1/2] regulator: allow drivers in modules to register fixed regulators Daniel Kurtz
2018-07-18 10:42   ` Mark Brown
2018-07-18  0:49 ` [PATCH 2/2] ASoC: AMD: Add an always on fixed 1.8V regulator for da7219 VDDIO Daniel Kurtz
2018-07-18 10:46   ` Mark Brown

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).