diff mbox

[1/2] ASoC: add bindings for ZTE zx-aud96p22 audio codec

Message ID 1497708574-22380-2-git-send-email-shawnguo@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Guo June 17, 2017, 2:09 p.m. UTC
From: Baoyou Xie <baoyou.xie@linaro.org>

It adds dt-bindings document for ZTE zx-aud96p22 audio codec.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 .../devicetree/bindings/sound/zte,zx-aud96p22.txt  | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/zte,zx-aud96p22.txt

Comments

Mark Brown June 19, 2017, 4:16 p.m. UTC | #1
On Sat, Jun 17, 2017 at 10:09:33PM +0800, Shawn Guo wrote:

> +Optional properties:
> + - zte,pa-gpios: The GPIO to enable external power amplifier

If there's an external power amplifier this is a separate chip to this
CODEC and should therefore be separately controlled and integrated as
part of the machine integration.
Shawn Guo June 20, 2017, 3:11 a.m. UTC | #2
On Mon, Jun 19, 2017 at 05:16:06PM +0100, Mark Brown wrote:
> On Sat, Jun 17, 2017 at 10:09:33PM +0800, Shawn Guo wrote:
> 
> > +Optional properties:
> > + - zte,pa-gpios: The GPIO to enable external power amplifier
> 
> If there's an external power amplifier this is a separate chip to this
> CODEC and should therefore be separately controlled and integrated as
> part of the machine integration.

Yes, that should be the best.  But we do not have a particular machine
driver for our platform, and we are using simple-audio-card driver
instead.  I'm not sure if it's generic enough to patch simple-audio-card
driver support this pa-gpios, so chose to fold this quick change in the
codec driver.

Should I patch simple-audio-card driver to support pa-gpios property
and create a DAPM widget with event for it?  I'm currently using
SND_SOC_DAPM_OUT_DRV_E.  Is it the correct one?

Shawn
Mark Brown June 20, 2017, 2:33 p.m. UTC | #3
On Tue, Jun 20, 2017 at 11:11:32AM +0800, Shawn Guo wrote:
> On Mon, Jun 19, 2017 at 05:16:06PM +0100, Mark Brown wrote:

> > If there's an external power amplifier this is a separate chip to this
> > CODEC and should therefore be separately controlled and integrated as
> > part of the machine integration.

> Yes, that should be the best.  But we do not have a particular machine
> driver for our platform, and we are using simple-audio-card driver

You should be switching to the of-graph card now.

> instead.  I'm not sure if it's generic enough to patch simple-audio-card
> driver support this pa-gpios, so chose to fold this quick change in the
> codec driver.

Having a separate amplifier is a completely normal thing, and no matter
how unusual something is it's obviously not OK to hack one driver to
support a completely different device.

> Should I patch simple-audio-card driver to support pa-gpios property
> and create a DAPM widget with event for it?  I'm currently using
> SND_SOC_DAPM_OUT_DRV_E.  Is it the correct one?

Should be fine.
Shawn Guo June 21, 2017, 1:22 p.m. UTC | #4
On Tue, Jun 20, 2017 at 03:33:52PM +0100, Mark Brown wrote:
> On Tue, Jun 20, 2017 at 11:11:32AM +0800, Shawn Guo wrote:
> > On Mon, Jun 19, 2017 at 05:16:06PM +0100, Mark Brown wrote:
> 
> > > If there's an external power amplifier this is a separate chip to this
> > > CODEC and should therefore be separately controlled and integrated as
> > > part of the machine integration.
> 
> > Yes, that should be the best.  But we do not have a particular machine
> > driver for our platform, and we are using simple-audio-card driver
> 
> You should be switching to the of-graph card now.

Thanks for the info.  Will do.

> > instead.  I'm not sure if it's generic enough to patch simple-audio-card
> > driver support this pa-gpios, so chose to fold this quick change in the
> > codec driver.
> 
> Having a separate amplifier is a completely normal thing, and no matter
> how unusual something is it's obviously not OK to hack one driver to
> support a completely different device.

Okay, I will drop it from codec driver, and try to support it in
audio-graph-card with separate patch later.

Shawn
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/sound/zte,zx-aud96p22.txt b/Documentation/devicetree/bindings/sound/zte,zx-aud96p22.txt
new file mode 100644
index 000000000000..cb211a295cad
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/zte,zx-aud96p22.txt
@@ -0,0 +1,28 @@ 
+ZTE ZX AUD96P22 Audio Codec
+
+Required properties:
+ - compatible: Must be "zte,zx-aud96p22"
+ - #sound-dai-cells: Should be 0
+ - reg: I2C bus slave address of AUD96P22
+
+Optional properties:
+ - zte,pa-gpios: The GPIO to enable external power amplifier
+
+Example:
+
+	i2c0: i2c@1486000 {
+		compatible = "zte,zx296718-i2c";
+		reg = <0x01486000 0x1000>;
+		interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&audiocrm AUDIO_I2C0_WCLK>;
+		clock-frequency = <1600000>;
+
+		aud96p22: codec@22 {
+			compatible = "zte,zx-aud96p22";
+			#sound-dai-cells = <0>;
+			reg = <0x22>;
+			zte,pa-gpios = <&bgpio4 0 GPIO_ACTIVE_HIGH>;
+		};
+	};