devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] ASoC: sun4i-codec: Rename codec dapm widgets and routes
@ 2015-12-11 18:43 Hans de Goede
       [not found] ` <1449859439-30875-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2015-12-11 18:43 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede

Rename the codec dapm widgets and routes with a _codec prefix. This is
a preparation patch for adding card dapm widgets and routes.

Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
Changes in v2:
-New patch in v2 of this patchset
---
 sound/soc/sunxi/sun4i-codec.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 7a3fe1d..519ccb3 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -532,7 +532,7 @@ static const struct snd_kcontrol_new sun4i_codec_pa_mixer_controls[] = {
 			SUN4I_CODEC_DAC_ACTL_MIXPAS, 1, 0),
 };
 
-static const struct snd_soc_dapm_widget sun4i_codec_dapm_widgets[] = {
+static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
 	/* Digital parts of the ADCs */
 	SND_SOC_DAPM_SUPPLY("ADC", SUN4I_CODEC_ADC_FIFOC,
 			    SUN4I_CODEC_ADC_FIFOC_EN_AD, 0,
@@ -589,7 +589,7 @@ static const struct snd_soc_dapm_widget sun4i_codec_dapm_widgets[] = {
 	SND_SOC_DAPM_OUTPUT("HP Left"),
 };
 
-static const struct snd_soc_dapm_route sun4i_codec_dapm_routes[] = {
+static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 	/* Left ADC / DAC Routes */
 	{ "Left ADC", NULL, "ADC" },
 	{ "Left DAC", NULL, "DAC" },
@@ -628,10 +628,10 @@ static const struct snd_soc_dapm_route sun4i_codec_dapm_routes[] = {
 static struct snd_soc_codec_driver sun4i_codec_codec = {
 	.controls		= sun4i_codec_widgets,
 	.num_controls		= ARRAY_SIZE(sun4i_codec_widgets),
-	.dapm_widgets		= sun4i_codec_dapm_widgets,
-	.num_dapm_widgets	= ARRAY_SIZE(sun4i_codec_dapm_widgets),
-	.dapm_routes		= sun4i_codec_dapm_routes,
-	.num_dapm_routes	= ARRAY_SIZE(sun4i_codec_dapm_routes),
+	.dapm_widgets		= sun4i_codec_codec_dapm_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(sun4i_codec_codec_dapm_widgets),
+	.dapm_routes		= sun4i_codec_codec_dapm_routes,
+	.num_dapm_routes	= ARRAY_SIZE(sun4i_codec_codec_dapm_routes),
 };
 
 static const struct snd_soc_component_driver sun4i_codec_component = {
-- 
2.5.0

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

* [PATCH v2 2/4] ASoC: sun4i-codec: Add support for PA gpio pin
       [not found] ` <1449859439-30875-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-12-11 18:43   ` Hans de Goede
  2015-12-12 23:01     ` Mark Brown
       [not found]     ` <1449859439-30875-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2015-12-11 18:43   ` [PATCH v2 3/4] ARM: dts: sun5i: Enable onboard codec used on the UTOO P66 tablet Hans de Goede
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 11+ messages in thread
From: Hans de Goede @ 2015-12-11 18:43 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede

Add support for PA gpio pin for controlling an external amplifier as used
on some Allwinner boards.

Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
Changes in v2:
-Use a dapm speaker widget (SND_SOC_DAPM_SPK) to control the gpio
-Rename gpio in devicetree from pa-gpios to allwinner,pa-gpios
---
 .../devicetree/bindings/sound/sun4i-codec.txt      |  3 ++
 sound/soc/sunxi/sun4i-codec.c                      | 35 ++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/sun4i-codec.txt b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
index c92966b..0dce690 100644
--- a/Documentation/devicetree/bindings/sound/sun4i-codec.txt
+++ b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
@@ -14,6 +14,9 @@ Required properties:
    - "apb": the parent APB clock for this controller
    - "codec": the parent module clock
 
+Optional properties:
+- allwinner,pa-gpios: gpio to enable external amplifier
+
 Example:
 codec: codec@01c22c00 {
 	#sound-dai-cells = <0>;
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 519ccb3..e6cc6a1 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -28,6 +28,7 @@
 #include <linux/of_address.h>
 #include <linux/clk.h>
 #include <linux/regmap.h>
+#include <linux/gpio/consumer.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -103,6 +104,7 @@ struct sun4i_codec {
 	struct regmap	*regmap;
 	struct clk	*clk_apb;
 	struct clk	*clk_module;
+	struct gpio_desc *gpio_pa;
 
 	struct snd_dmaengine_dai_dma_data	capture_dma_data;
 	struct snd_dmaengine_dai_dma_data	playback_dma_data;
@@ -709,6 +711,26 @@ static struct snd_soc_dai_link *sun4i_codec_create_link(struct device *dev,
 	return link;
 };
 
+static int sun4i_codec_spk_event(struct snd_soc_dapm_widget *w,
+				 struct snd_kcontrol *k, int event)
+{
+	struct sun4i_codec *scodec = snd_soc_card_get_drvdata(w->dapm->card);
+
+	if (scodec->gpio_pa)
+		gpiod_set_value_cansleep(scodec->gpio_pa,
+					 !!SND_SOC_DAPM_EVENT_ON(event));
+
+	return 0;
+}
+
+static const struct snd_soc_dapm_widget sun4i_codec_card_dapm_widgets[] = {
+	SND_SOC_DAPM_SPK("Speaker", sun4i_codec_spk_event),
+};
+
+static const struct snd_soc_dapm_route sun4i_codec_card_dapm_routes[] = {
+	{ "Speaker", NULL, "Power Amplifier" },
+};
+
 static struct snd_soc_card *sun4i_codec_create_card(struct device *dev)
 {
 	struct snd_soc_card *card;
@@ -723,6 +745,10 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev)
 
 	card->dev		= dev;
 	card->name		= "sun4i-codec";
+	card->dapm_widgets	= sun4i_codec_card_dapm_widgets;
+	card->num_dapm_widgets	= ARRAY_SIZE(sun4i_codec_card_dapm_widgets);
+	card->dapm_routes	= sun4i_codec_card_dapm_routes;
+	card->num_dapm_routes	= ARRAY_SIZE(sun4i_codec_card_dapm_routes);
 
 	return card;
 };
@@ -774,6 +800,15 @@ static int sun4i_codec_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	scodec->gpio_pa = devm_gpiod_get_optional(&pdev->dev, "allwinner,pa",
+						  GPIOD_OUT_LOW);
+	if (IS_ERR(scodec->gpio_pa)) {
+		ret = PTR_ERR(scodec->gpio_pa);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Failed to get pa gpio: %d\n", ret);
+		return ret;
+	}
+
 	/* DMA configuration for TX FIFO */
 	scodec->playback_dma_data.addr = res->start + SUN4I_CODEC_DAC_TXDATA;
 	scodec->playback_dma_data.maxburst = 4;
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 3/4] ARM: dts: sun5i: Enable onboard codec used on the UTOO P66 tablet
       [not found] ` <1449859439-30875-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2015-12-11 18:43   ` [PATCH v2 2/4] ASoC: sun4i-codec: Add support for PA gpio pin Hans de Goede
@ 2015-12-11 18:43   ` Hans de Goede
  2015-12-11 18:43   ` [PATCH v2 4/4] ARM: dts: sun4i: Enable onboard codec used on the pov protab2-ips9 tablet Hans de Goede
  2015-12-14  9:44   ` [PATCH v2 1/4] ASoC: sun4i-codec: Rename codec dapm widgets and routes Maxime Ripard
  3 siblings, 0 replies; 11+ messages in thread
From: Hans de Goede @ 2015-12-11 18:43 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede

The UTOO P66 tablet uses the A13's integrated audio codec, enable it.

Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
Changes in v2:
-Adjust for gpio rename from pa-gpios to allwinner,pa-gpios
---
 arch/arm/boot/dts/sun5i-a13-utoo-p66.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/sun5i-a13-utoo-p66.dts b/arch/arm/boot/dts/sun5i-a13-utoo-p66.dts
index 5236c1e..fa9ddfd 100644
--- a/arch/arm/boot/dts/sun5i-a13-utoo-p66.dts
+++ b/arch/arm/boot/dts/sun5i-a13-utoo-p66.dts
@@ -73,6 +73,13 @@
 	};
 };
 
+&codec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&codec_pa_pin>;
+	allwinner,pa-gpios = <&pio 6 3 GPIO_ACTIVE_HIGH>; /* PG3 */
+	status = "okay";
+};
+
 &cpu0 {
 	cpu-supply = <&reg_dcdc2>;
 };
@@ -168,6 +175,13 @@
 };
 
 &pio {
+	codec_pa_pin: codec_pa_pin@0 {
+		allwinner,pins = "PG3";
+		allwinner,function = "gpio_out";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
+
 	mmc0_cd_pin_p66: mmc0_cd_pin@0 {
 		allwinner,pins = "PG0";
 		allwinner,function = "gpio_in";
-- 
2.5.0

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

* [PATCH v2 4/4] ARM: dts: sun4i: Enable onboard codec used on the pov protab2-ips9 tablet
       [not found] ` <1449859439-30875-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2015-12-11 18:43   ` [PATCH v2 2/4] ASoC: sun4i-codec: Add support for PA gpio pin Hans de Goede
  2015-12-11 18:43   ` [PATCH v2 3/4] ARM: dts: sun5i: Enable onboard codec used on the UTOO P66 tablet Hans de Goede
@ 2015-12-11 18:43   ` Hans de Goede
       [not found]     ` <1449859439-30875-4-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2015-12-14  9:44   ` [PATCH v2 1/4] ASoC: sun4i-codec: Rename codec dapm widgets and routes Maxime Ripard
  3 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2015-12-11 18:43 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede

The pov protab2-ips9 tablet uses the A10's integrated audio codec,
enable it.

Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
Changes in v2:
-Adjust for gpio rename from pa-gpios to allwinner,pa-gpios
---
 arch/arm/boot/dts/sun4i-a10-pov-protab2-ips9.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10-pov-protab2-ips9.dts b/arch/arm/boot/dts/sun4i-a10-pov-protab2-ips9.dts
index a88d5f4..ea90634 100644
--- a/arch/arm/boot/dts/sun4i-a10-pov-protab2-ips9.dts
+++ b/arch/arm/boot/dts/sun4i-a10-pov-protab2-ips9.dts
@@ -72,6 +72,13 @@
 	};
 };
 
+&codec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&codec_pa_pin>;
+	allwinner,pa-gpios = <&pio 7 15 GPIO_ACTIVE_HIGH>; /* PH15 */
+	status = "okay";
+};
+
 &cpu0 {
 	cpu-supply = <&reg_dcdc2>;
 };
@@ -170,6 +177,13 @@
 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 	};
 
+	codec_pa_pin: codec_pa_pin@0 {
+		allwinner,pins = "PH15";
+		allwinner,function = "gpio_out";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
+
 	touchscreen_pins: touchscreen_pins@0 {
 		allwinner,pins = "PA5", "PB13";
 		allwinner,function = "gpio_out";
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 2/4] ASoC: sun4i-codec: Add support for PA gpio pin
  2015-12-11 18:43   ` [PATCH v2 2/4] ASoC: sun4i-codec: Add support for PA gpio pin Hans de Goede
@ 2015-12-12 23:01     ` Mark Brown
       [not found]     ` <1449859439-30875-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  1 sibling, 0 replies; 11+ messages in thread
From: Mark Brown @ 2015-12-12 23:01 UTC (permalink / raw)
  To: Hans de Goede
  Cc: devicetree, alsa-devel, linux-sunxi, Takashi Iwai, Liam Girdwood,
	Chen-Yu Tsai, Maxime Ripard, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 304 bytes --]

On Fri, Dec 11, 2015 at 07:43:57PM +0100, Hans de Goede wrote:

> +		gpiod_set_value_cansleep(scodec->gpio_pa,
> +					 !!SND_SOC_DAPM_EVENT_ON(event));

Why the double negation here?  The macro is already supposed to give you
a boolean and gpiod_set_value_cansleep() ought to cope with a C logic
value.

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

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH v2 2/4] ASoC: sun4i-codec: Add support for PA gpio pin
       [not found]     ` <1449859439-30875-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-12-14  1:11       ` Rob Herring
  2015-12-14 15:56       ` Maxime Ripard
  1 sibling, 0 replies; 11+ messages in thread
From: Rob Herring @ 2015-12-14  1:11 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

On Fri, Dec 11, 2015 at 07:43:57PM +0100, Hans de Goede wrote:
> Add support for PA gpio pin for controlling an external amplifier as used
> on some Allwinner boards.
> 
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

> ---
> Changes in v2:
> -Use a dapm speaker widget (SND_SOC_DAPM_SPK) to control the gpio
> -Rename gpio in devicetree from pa-gpios to allwinner,pa-gpios
> ---
>  .../devicetree/bindings/sound/sun4i-codec.txt      |  3 ++
>  sound/soc/sunxi/sun4i-codec.c                      | 35 ++++++++++++++++++++++
>  2 files changed, 38 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/sun4i-codec.txt b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
> index c92966b..0dce690 100644
> --- a/Documentation/devicetree/bindings/sound/sun4i-codec.txt
> +++ b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
> @@ -14,6 +14,9 @@ Required properties:
>     - "apb": the parent APB clock for this controller
>     - "codec": the parent module clock
>  
> +Optional properties:
> +- allwinner,pa-gpios: gpio to enable external amplifier
> +
>  Example:
>  codec: codec@01c22c00 {
>  	#sound-dai-cells = <0>;
> diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
> index 519ccb3..e6cc6a1 100644
> --- a/sound/soc/sunxi/sun4i-codec.c
> +++ b/sound/soc/sunxi/sun4i-codec.c
> @@ -28,6 +28,7 @@
>  #include <linux/of_address.h>
>  #include <linux/clk.h>
>  #include <linux/regmap.h>
> +#include <linux/gpio/consumer.h>
>  
>  #include <sound/core.h>
>  #include <sound/pcm.h>
> @@ -103,6 +104,7 @@ struct sun4i_codec {
>  	struct regmap	*regmap;
>  	struct clk	*clk_apb;
>  	struct clk	*clk_module;
> +	struct gpio_desc *gpio_pa;
>  
>  	struct snd_dmaengine_dai_dma_data	capture_dma_data;
>  	struct snd_dmaengine_dai_dma_data	playback_dma_data;
> @@ -709,6 +711,26 @@ static struct snd_soc_dai_link *sun4i_codec_create_link(struct device *dev,
>  	return link;
>  };
>  
> +static int sun4i_codec_spk_event(struct snd_soc_dapm_widget *w,
> +				 struct snd_kcontrol *k, int event)
> +{
> +	struct sun4i_codec *scodec = snd_soc_card_get_drvdata(w->dapm->card);
> +
> +	if (scodec->gpio_pa)
> +		gpiod_set_value_cansleep(scodec->gpio_pa,
> +					 !!SND_SOC_DAPM_EVENT_ON(event));
> +
> +	return 0;
> +}
> +
> +static const struct snd_soc_dapm_widget sun4i_codec_card_dapm_widgets[] = {
> +	SND_SOC_DAPM_SPK("Speaker", sun4i_codec_spk_event),
> +};
> +
> +static const struct snd_soc_dapm_route sun4i_codec_card_dapm_routes[] = {
> +	{ "Speaker", NULL, "Power Amplifier" },
> +};
> +
>  static struct snd_soc_card *sun4i_codec_create_card(struct device *dev)
>  {
>  	struct snd_soc_card *card;
> @@ -723,6 +745,10 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev)
>  
>  	card->dev		= dev;
>  	card->name		= "sun4i-codec";
> +	card->dapm_widgets	= sun4i_codec_card_dapm_widgets;
> +	card->num_dapm_widgets	= ARRAY_SIZE(sun4i_codec_card_dapm_widgets);
> +	card->dapm_routes	= sun4i_codec_card_dapm_routes;
> +	card->num_dapm_routes	= ARRAY_SIZE(sun4i_codec_card_dapm_routes);
>  
>  	return card;
>  };
> @@ -774,6 +800,15 @@ static int sun4i_codec_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> +	scodec->gpio_pa = devm_gpiod_get_optional(&pdev->dev, "allwinner,pa",
> +						  GPIOD_OUT_LOW);
> +	if (IS_ERR(scodec->gpio_pa)) {
> +		ret = PTR_ERR(scodec->gpio_pa);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(&pdev->dev, "Failed to get pa gpio: %d\n", ret);
> +		return ret;
> +	}
> +
>  	/* DMA configuration for TX FIFO */
>  	scodec->playback_dma_data.addr = res->start + SUN4I_CODEC_DAC_TXDATA;
>  	scodec->playback_dma_data.maxburst = 4;
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 1/4] ASoC: sun4i-codec: Rename codec dapm widgets and routes
       [not found] ` <1449859439-30875-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (2 preceding siblings ...)
  2015-12-11 18:43   ` [PATCH v2 4/4] ARM: dts: sun4i: Enable onboard codec used on the pov protab2-ips9 tablet Hans de Goede
@ 2015-12-14  9:44   ` Maxime Ripard
  3 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2015-12-14  9:44 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Chen-Yu Tsai, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

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

Hi,

On Fri, Dec 11, 2015 at 07:43:56PM +0100, Hans de Goede wrote:
> Rename the codec dapm widgets and routes with a _codec prefix. This is
> a preparation patch for adding card dapm widgets and routes.
> 
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH v2 2/4] ASoC: sun4i-codec: Add support for PA gpio pin
       [not found]     ` <1449859439-30875-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2015-12-14  1:11       ` Rob Herring
@ 2015-12-14 15:56       ` Maxime Ripard
  2015-12-14 16:07         ` [linux-sunxi] " Hans de Goede
  1 sibling, 1 reply; 11+ messages in thread
From: Maxime Ripard @ 2015-12-14 15:56 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Chen-Yu Tsai, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

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

Hi,

On Fri, Dec 11, 2015 at 07:43:57PM +0100, Hans de Goede wrote:
> Add support for PA gpio pin for controlling an external amplifier as used
> on some Allwinner boards.
> 
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> Changes in v2:
> -Use a dapm speaker widget (SND_SOC_DAPM_SPK) to control the gpio
> -Rename gpio in devicetree from pa-gpios to allwinner,pa-gpios
> ---
>  .../devicetree/bindings/sound/sun4i-codec.txt      |  3 ++
>  sound/soc/sunxi/sun4i-codec.c                      | 35 ++++++++++++++++++++++
>  2 files changed, 38 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/sun4i-codec.txt b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
> index c92966b..0dce690 100644
> --- a/Documentation/devicetree/bindings/sound/sun4i-codec.txt
> +++ b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
> @@ -14,6 +14,9 @@ Required properties:
>     - "apb": the parent APB clock for this controller
>     - "codec": the parent module clock
>  
> +Optional properties:
> +- allwinner,pa-gpios: gpio to enable external amplifier
> +
>  Example:
>  codec: codec@01c22c00 {
>  	#sound-dai-cells = <0>;
> diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
> index 519ccb3..e6cc6a1 100644
> --- a/sound/soc/sunxi/sun4i-codec.c
> +++ b/sound/soc/sunxi/sun4i-codec.c
> @@ -28,6 +28,7 @@
>  #include <linux/of_address.h>
>  #include <linux/clk.h>
>  #include <linux/regmap.h>
> +#include <linux/gpio/consumer.h>
>  
>  #include <sound/core.h>
>  #include <sound/pcm.h>
> @@ -103,6 +104,7 @@ struct sun4i_codec {
>  	struct regmap	*regmap;
>  	struct clk	*clk_apb;
>  	struct clk	*clk_module;
> +	struct gpio_desc *gpio_pa;
>  
>  	struct snd_dmaengine_dai_dma_data	capture_dma_data;
>  	struct snd_dmaengine_dai_dma_data	playback_dma_data;
> @@ -709,6 +711,26 @@ static struct snd_soc_dai_link *sun4i_codec_create_link(struct device *dev,
>  	return link;
>  };
>  
> +static int sun4i_codec_spk_event(struct snd_soc_dapm_widget *w,
> +				 struct snd_kcontrol *k, int event)
> +{
> +	struct sun4i_codec *scodec = snd_soc_card_get_drvdata(w->dapm->card);
> +
> +	if (scodec->gpio_pa)
> +		gpiod_set_value_cansleep(scodec->gpio_pa,
> +					 !!SND_SOC_DAPM_EVENT_ON(event));
> +
> +	return 0;
> +}
> +
> +static const struct snd_soc_dapm_widget sun4i_codec_card_dapm_widgets[] = {
> +	SND_SOC_DAPM_SPK("Speaker", sun4i_codec_spk_event),
> +};
> +
> +static const struct snd_soc_dapm_route sun4i_codec_card_dapm_routes[] = {
> +	{ "Speaker", NULL, "Power Amplifier" },
> +};

Shouldn't it be tied to the HP outputs instead?

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [linux-sunxi] Re: [PATCH v2 2/4] ASoC: sun4i-codec: Add support for PA gpio pin
  2015-12-14 15:56       ` Maxime Ripard
@ 2015-12-14 16:07         ` Hans de Goede
       [not found]           ` <566EE953.3050702-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2015-12-14 16:07 UTC (permalink / raw)
  To: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Chen-Yu Tsai, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

Hi,

On 14-12-15 16:56, Maxime Ripard wrote:
> Hi,
>
> On Fri, Dec 11, 2015 at 07:43:57PM +0100, Hans de Goede wrote:
>> Add support for PA gpio pin for controlling an external amplifier as used
>> on some Allwinner boards.
>>
>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> ---
>> Changes in v2:
>> -Use a dapm speaker widget (SND_SOC_DAPM_SPK) to control the gpio
>> -Rename gpio in devicetree from pa-gpios to allwinner,pa-gpios
>> ---
>>   .../devicetree/bindings/sound/sun4i-codec.txt      |  3 ++
>>   sound/soc/sunxi/sun4i-codec.c                      | 35 ++++++++++++++++++++++
>>   2 files changed, 38 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/sound/sun4i-codec.txt b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
>> index c92966b..0dce690 100644
>> --- a/Documentation/devicetree/bindings/sound/sun4i-codec.txt
>> +++ b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
>> @@ -14,6 +14,9 @@ Required properties:
>>      - "apb": the parent APB clock for this controller
>>      - "codec": the parent module clock
>>
>> +Optional properties:
>> +- allwinner,pa-gpios: gpio to enable external amplifier
>> +
>>   Example:
>>   codec: codec@01c22c00 {
>>   	#sound-dai-cells = <0>;
>> diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
>> index 519ccb3..e6cc6a1 100644
>> --- a/sound/soc/sunxi/sun4i-codec.c
>> +++ b/sound/soc/sunxi/sun4i-codec.c
>> @@ -28,6 +28,7 @@
>>   #include <linux/of_address.h>
>>   #include <linux/clk.h>
>>   #include <linux/regmap.h>
>> +#include <linux/gpio/consumer.h>
>>
>>   #include <sound/core.h>
>>   #include <sound/pcm.h>
>> @@ -103,6 +104,7 @@ struct sun4i_codec {
>>   	struct regmap	*regmap;
>>   	struct clk	*clk_apb;
>>   	struct clk	*clk_module;
>> +	struct gpio_desc *gpio_pa;
>>
>>   	struct snd_dmaengine_dai_dma_data	capture_dma_data;
>>   	struct snd_dmaengine_dai_dma_data	playback_dma_data;
>> @@ -709,6 +711,26 @@ static struct snd_soc_dai_link *sun4i_codec_create_link(struct device *dev,
>>   	return link;
>>   };
>>
>> +static int sun4i_codec_spk_event(struct snd_soc_dapm_widget *w,
>> +				 struct snd_kcontrol *k, int event)
>> +{
>> +	struct sun4i_codec *scodec = snd_soc_card_get_drvdata(w->dapm->card);
>> +
>> +	if (scodec->gpio_pa)
>> +		gpiod_set_value_cansleep(scodec->gpio_pa,
>> +					 !!SND_SOC_DAPM_EVENT_ON(event));
>> +
>> +	return 0;
>> +}
>> +
>> +static const struct snd_soc_dapm_widget sun4i_codec_card_dapm_widgets[] = {
>> +	SND_SOC_DAPM_SPK("Speaker", sun4i_codec_spk_event),
>> +};
>> +
>> +static const struct snd_soc_dapm_route sun4i_codec_card_dapm_routes[] = {
>> +	{ "Speaker", NULL, "Power Amplifier" },
>> +};
>
> Shouldn't it be tied to the HP outputs instead?

You're right, the HP outputs are the final outputs, and since this is
for enabling an external amplifier you're right. Since Mark has already
merged this patch I will do a follow up patch to fix this.

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Re: [PATCH v2 2/4] ASoC: sun4i-codec: Add support for PA gpio pin
       [not found]           ` <566EE953.3050702-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-12-18 20:53             ` Maxime Ripard
  0 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2015-12-18 20:53 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Chen-Yu Tsai, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

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

On Mon, Dec 14, 2015 at 05:07:47PM +0100, Hans de Goede wrote:
> >>+static int sun4i_codec_spk_event(struct snd_soc_dapm_widget *w,
> >>+				 struct snd_kcontrol *k, int event)
> >>+{
> >>+	struct sun4i_codec *scodec = snd_soc_card_get_drvdata(w->dapm->card);
> >>+
> >>+	if (scodec->gpio_pa)
> >>+		gpiod_set_value_cansleep(scodec->gpio_pa,
> >>+					 !!SND_SOC_DAPM_EVENT_ON(event));
> >>+
> >>+	return 0;
> >>+}
> >>+
> >>+static const struct snd_soc_dapm_widget sun4i_codec_card_dapm_widgets[] = {
> >>+	SND_SOC_DAPM_SPK("Speaker", sun4i_codec_spk_event),
> >>+};
> >>+
> >>+static const struct snd_soc_dapm_route sun4i_codec_card_dapm_routes[] = {
> >>+	{ "Speaker", NULL, "Power Amplifier" },
> >>+};
> >
> >Shouldn't it be tied to the HP outputs instead?
> 
> You're right, the HP outputs are the final outputs, and since this is
> for enabling an external amplifier you're right. Since Mark has already
> merged this patch I will do a follow up patch to fix this.

Great, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH v2 4/4] ARM: dts: sun4i: Enable onboard codec used on the pov protab2-ips9 tablet
       [not found]     ` <1449859439-30875-4-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-12-18 21:19       ` Maxime Ripard
  0 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2015-12-18 21:19 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Chen-Yu Tsai, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

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

On Fri, Dec 11, 2015 at 07:43:59PM +0100, Hans de Goede wrote:
> The pov protab2-ips9 tablet uses the A10's integrated audio codec,
> enable it.
> 
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Applied 3 and 4. Thanks!

I have a bad network connection for the next two weeks though, so I'm
not quite sure whether or not it will make it for 4.5.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2015-12-18 21:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-11 18:43 [PATCH v2 1/4] ASoC: sun4i-codec: Rename codec dapm widgets and routes Hans de Goede
     [not found] ` <1449859439-30875-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-12-11 18:43   ` [PATCH v2 2/4] ASoC: sun4i-codec: Add support for PA gpio pin Hans de Goede
2015-12-12 23:01     ` Mark Brown
     [not found]     ` <1449859439-30875-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-12-14  1:11       ` Rob Herring
2015-12-14 15:56       ` Maxime Ripard
2015-12-14 16:07         ` [linux-sunxi] " Hans de Goede
     [not found]           ` <566EE953.3050702-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-12-18 20:53             ` Maxime Ripard
2015-12-11 18:43   ` [PATCH v2 3/4] ARM: dts: sun5i: Enable onboard codec used on the UTOO P66 tablet Hans de Goede
2015-12-11 18:43   ` [PATCH v2 4/4] ARM: dts: sun4i: Enable onboard codec used on the pov protab2-ips9 tablet Hans de Goede
     [not found]     ` <1449859439-30875-4-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-12-18 21:19       ` Maxime Ripard
2015-12-14  9:44   ` [PATCH v2 1/4] ASoC: sun4i-codec: Rename codec dapm widgets and routes Maxime Ripard

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