Skip to contentSkip to conversation

ASoC: imx-sgtl5000.c: Add support for specifying PDCR_TXRXEN

PATCH Shawn Guo 3 participants 5 messages Apr 24, 2014 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Shawn Guo

author
#1 lore raw
Quoted 3 lines · David Jander

This enables effectively swapping RX/TX pins on the external audio port

You should copy Mark Brown <[email protected]> and [email protected] on this patch.

Shawn

Quoted 53 lines
---
 Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt | 4 ++++
 sound/soc/fsl/imx-sgtl5000.c                                   | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt +4 -0
index e4acdd8..3afea85 100644
@@ -29,6 +29,10 @@ Required properties:
 - mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
 - mux-ext-port : The external port of the i.MX audio muxer
 
+Optional properties:
+- ext-port-txrxen : Flag. Set to swap RX/TX signals on external port (set the
+  IMX_AUDMUX_V2_PDCR_TXRXEN bit in the PDC register of the external port)
+
 Note: The AUDMUX port numbering should start at 1, which is consistent with
 hardware manual.
 
sound/soc/fsl/imx-sgtl5000.c +4 -1
index 1cb22dd..b543fa6 100644
@@ -63,6 +63,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 	struct i2c_client *codec_dev;
 	struct imx_sgtl5000_data *data = NULL;
 	int int_port, ext_port;
+	unsigned int ext_txrxen = 0;
 	int ret;
 
 	ret = of_property_read_u32(np, "mux-int-port", &int_port);
@@ -75,6 +76,8 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "mux-ext-port missing or invalid\n");
 		return ret;
 	}
+	if (of_property_read_bool(np, "ext-port-txrxen"))
+		ext_txrxen = IMX_AUDMUX_V2_PDCR_TXRXEN;
 
 	/*
 	 * The port numbering in the hardware manual starts at 1, while
@@ -95,7 +98,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 	}
 	ret = imx_audmux_v2_configure_port(ext_port,
 			IMX_AUDMUX_V2_PTCR_SYN,
-			IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));
+			IMX_AUDMUX_V2_PDCR_RXDSEL(int_port) | ext_txrxen);
 	if (ret) {
 		dev_err(&pdev->dev, "audmux external port setup failed\n");
 		return ret;
Signature · 1 line
1.9.1
#2 lore raw
In reply to a message not in the archive

Hi,

Quoted 13 lines · David Jander

This enables effectively swapping RX/TX pins on the external audio port

---
 Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt | 4 ++++
 sound/soc/fsl/imx-sgtl5000.c                                   | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt +0 -0
index e4acdd8..3afea85 100644

Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt Required properties: · line 37

Quoted 9 lines
Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt +4 -0
@@ -29,6 +29,10 @@ Required properties:
 - mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
 - mux-ext-port : The external port of the i.MX audio muxer
 
+Optional properties:
+- ext-port-txrxen : Flag. Set to swap RX/TX signals on external port (set the
+  IMX_AUDMUX_V2_PDCR_TXRXEN bit in the PDC register of the external port)
+
 Note: The AUDMUX port numbering should start at 1, which is consistent with
 hardware manual.

You could also try to use the simple sound card and use DT properties to setup audmux.

This is a configuration example for the audmux:

&audmux {
        status = "okay";

        aud4 {
                fsl,audmux-port = <MX31_AUDMUX_PORT4_SSI_PINS_4>;
                fsl,port-config = <
                        (IMX_AUDMUX_V2_PTCR_SYN |
                                IMX_AUDMUX_V2_PTCR_TFSDIR |
                                IMX_AUDMUX_V2_PTCR_TFSEL(MX31_AUDMUX_PORT1_SSI0) |
                                IMX_AUDMUX_V2_PTCR_TCLKDIR |
                                IMX_AUDMUX_V2_PTCR_TCSEL(MX31_AUDMUX_PORT1_SSI0))
                        IMX_AUDMUX_V2_PDCR_RXDSEL(MX31_AUDMUX_PORT1_SSI0)
                >;
        };
};

Regards,

Markus

Quoted 35 lines
sound/soc/fsl/imx-sgtl5000.c +4 -1
index 1cb22dd..b543fa6 100644
@@ -63,6 +63,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 	struct i2c_client *codec_dev;
 	struct imx_sgtl5000_data *data = NULL;
 	int int_port, ext_port;
+	unsigned int ext_txrxen = 0;
 	int ret;
 
 	ret = of_property_read_u32(np, "mux-int-port", &int_port);
@@ -75,6 +76,8 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "mux-ext-port missing or invalid\n");
 		return ret;
 	}
+	if (of_property_read_bool(np, "ext-port-txrxen"))
+		ext_txrxen = IMX_AUDMUX_V2_PDCR_TXRXEN;
 
 	/*
 	 * The port numbering in the hardware manual starts at 1, while
@@ -95,7 +98,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 	}
 	ret = imx_audmux_v2_configure_port(ext_port,
 			IMX_AUDMUX_V2_PTCR_SYN,
-			IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));
+			IMX_AUDMUX_V2_PDCR_RXDSEL(int_port) | ext_txrxen);
 	if (ret) {
 		dev_err(&pdev->dev, "audmux external port setup failed\n");
 		return ret;
Signature · 1 line
1.9.1
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#3 lore raw
Quoted 33 lines · On Thu, 24 Apr 2014 10:46:30 +0200 Markus Pargmann <[email protected]> wrote:

Hi,

Quoted 24 lines · David Jander

This enables effectively swapping RX/TX pins on the external audio port

---
 Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt | 4 ++++
 sound/soc/fsl/imx-sgtl5000.c                                   | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt b/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt index e4acdd8..3afea85 100644 --- a/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt @@ -29,6 +29,10 @@ Required properties:
- mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
- mux-ext-port : The external port of the i.MX audio muxer

+Optional properties:
+- ext-port-txrxen : Flag. Set to swap RX/TX signals on external port (set the

(quoted diff) +2 -0
+  IMX_AUDMUX_V2_PDCR_TXRXEN bit in the PDC register of the external port)
+
 Note: The AUDMUX port numbering should start at 1, which is consistent
Quoted 1 line

with hardware manual.

You could also try to use the simple sound card and use DT properties to setup audmux.

This is a configuration example for the audmux:

Quoted 15 lines
&audmux {
        status = "okay";

        aud4 {
                fsl,audmux-port = <MX31_AUDMUX_PORT4_SSI_PINS_4>;
                fsl,port-config = <
                        (IMX_AUDMUX_V2_PTCR_SYN |
                                IMX_AUDMUX_V2_PTCR_TFSDIR |
                                IMX_AUDMUX_V2_PTCR_TFSEL(MX31_AUDMUX_PORT1_SSI0)
| IMX_AUDMUX_V2_PTCR_TCLKDIR |
                                IMX_AUDMUX_V2_PTCR_TCSEL(MX31_AUDMUX_PORT1_SSI0))
                        IMX_AUDMUX_V2_PDCR_RXDSEL(MX31_AUDMUX_PORT1_SSI0)
                >;
        };
};

I tried this, but the glue driver imx-sgtl5000.c changes the port settings to its own knowledge.... and that includes hard-coded clearing of the IMX_AUDMUX_V2_PDCR_TXRXEN bit.

How can I avoid the imx-sgtl5000.c driver from clearing the settings I specify in the AUDMUX driver?

Best regards,

Signature · 2 lines
David Jander
Protonic Holland.
#4 lore raw
Quoted 52 lines · David Jander
Quoted 33 lines · On Thu, 24 Apr 2014 10:46:30 +0200 Markus Pargmann <[email protected]> wrote:

Hi,

Quoted 24 lines · David Jander

This enables effectively swapping RX/TX pins on the external audio port

---
 Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt | 4 ++++
 sound/soc/fsl/imx-sgtl5000.c                                   | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt b/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt index e4acdd8..3afea85 100644 --- a/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt @@ -29,6 +29,10 @@ Required properties:
- mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
- mux-ext-port : The external port of the i.MX audio muxer

+Optional properties:
+- ext-port-txrxen : Flag. Set to swap RX/TX signals on external port (set the

(quoted diff) +2 -0
+  IMX_AUDMUX_V2_PDCR_TXRXEN bit in the PDC register of the external port)
+
 Note: The AUDMUX port numbering should start at 1, which is consistent
Quoted 1 line

with hardware manual.

You could also try to use the simple sound card and use DT properties to setup audmux.

This is a configuration example for the audmux:

Quoted 15 lines
&audmux {
        status = "okay";

        aud4 {
                fsl,audmux-port = <MX31_AUDMUX_PORT4_SSI_PINS_4>;
                fsl,port-config = <
                        (IMX_AUDMUX_V2_PTCR_SYN |
                                IMX_AUDMUX_V2_PTCR_TFSDIR |
                                IMX_AUDMUX_V2_PTCR_TFSEL(MX31_AUDMUX_PORT1_SSI0)
| IMX_AUDMUX_V2_PTCR_TCLKDIR |
                                IMX_AUDMUX_V2_PTCR_TCSEL(MX31_AUDMUX_PORT1_SSI0))
                        IMX_AUDMUX_V2_PDCR_RXDSEL(MX31_AUDMUX_PORT1_SSI0)
                >;
        };
};
Quoted 6 lines

I tried this, but the glue driver imx-sgtl5000.c changes the port settings to its own knowledge.... and that includes hard-coded clearing of the IMX_AUDMUX_V2_PDCR_TXRXEN bit.

How can I avoid the imx-sgtl5000.c driver from clearing the settings I specify in the AUDMUX driver?

You can use the simple sound card (sound/soc/generic/simple-card.c). The sound card properties have to be described in the DT. See Documentation/devicetree/bindings/sound/simple-card.txt

Regards,

Markus

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#5 lore raw
Quoted 57 lines · On Thu, 24 Apr 2014 11:32:29 +0200 Markus Pargmann <[email protected]> wrote:
Quoted 56 lines · David Jander
Quoted 33 lines · On Thu, 24 Apr 2014 10:46:30 +0200 Markus Pargmann <[email protected]> wrote:

Hi,

Quoted 18 lines · David Jander

This enables effectively swapping RX/TX pins on the external audio port

---
 Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt | 4

++++ sound/soc/fsl/imx-sgtl5000.c |
5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt b/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt index e4acdd8..3afea85 100644 --- a/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt @@ -29,6 +29,10 @@ Required properties:
- mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
- mux-ext-port : The external port of the i.MX audio muxer

Quoted 7 lines

+Optional properties:
+- ext-port-txrxen : Flag. Set to swap RX/TX signals on external port (set the
+ IMX_AUDMUX_V2_PDCR_TXRXEN bit in the PDC register of the external port) +
Note: The AUDMUX port numbering should start at 1, which is consistent
with hardware manual.

You could also try to use the simple sound card and use DT properties to setup audmux.

This is a configuration example for the audmux:

Quoted 15 lines
&audmux {
        status = "okay";

        aud4 {
                fsl,audmux-port = <MX31_AUDMUX_PORT4_SSI_PINS_4>;
                fsl,port-config = <
                        (IMX_AUDMUX_V2_PTCR_SYN |
                                IMX_AUDMUX_V2_PTCR_TFSDIR |
                                IMX_AUDMUX_V2_PTCR_TFSEL(MX31_AUDMUX_PORT1_SSI0)
| IMX_AUDMUX_V2_PTCR_TCLKDIR |
                                IMX_AUDMUX_V2_PTCR_TCSEL(MX31_AUDMUX_PORT1_SSI0))
                        IMX_AUDMUX_V2_PDCR_RXDSEL(MX31_AUDMUX_PORT1_SSI0)
                >;
        };
};

I tried this, but the glue driver imx-sgtl5000.c changes the port settings to its own knowledge.... and that includes hard-coded clearing of the IMX_AUDMUX_V2_PDCR_TXRXEN bit.

Quoted 6 lines
Quoted 2 lines

How can I avoid the imx-sgtl5000.c driver from clearing the settings I specify in the AUDMUX driver?

You can use the simple sound card (sound/soc/generic/simple-card.c). The sound card properties have to be described in the DT. See Documentation/devicetree/bindings/sound/simple-card.txt

This looks very interesting. I was not aware of this. Thanks! I will see if this solves my problem.

Best regards,

Signature · 2 lines
David Jander
Protonic Holland.