ASoC: fsl: make audmux optional for i.MX6UL support
authorLothar Waßmann <LW@KARO-electronics.de>
Fri, 4 Dec 2015 12:40:30 +0000 (13:40 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 4 Dec 2015 12:40:30 +0000 (13:40 +0100)
Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt
sound/soc/fsl/imx-sgtl5000.c

index 2f89db8..fd46671 100644 (file)
@@ -6,7 +6,7 @@ Required properties:
 
   - model              : The user-visible name of this sound complex
 
-  - ssi-controller     : The phandle of the i.MX SSI controller
+  - ssi-controller     : The phandle of the i.MX SSI (or SAI) controller
 
   - audio-codec                : The phandle of the SGTL5000 audio codec
 
@@ -39,6 +39,16 @@ Required properties:
 Note: The AUDMUX port numbering should start at 1, which is consistent with
 hardware manual.
 
+Optional properties:
+  - fsl,no-audmux      : boolean
+                         Required for i.MX6UL (and maybe other SoCs)
+                         which don't have an AUDMUX, but still
+                         feature the same audio subsystem otherwise.
+
+Note: Setting this property will make mux-int-port and mux-ext-port
+obsolete.
+
+
 Example:
 
 sound {
@@ -54,3 +64,17 @@ sound {
        mux-int-port = <1>;
        mux-ext-port = <3>;
 };
+
+or (e.g. for i.MX6UL):
+sound {
+       compatible = "karo,imx6ul-tx6ul-sgtl5000",
+                    "fsl,imx-audio-sgtl5000";
+       model = "imx6ul-tx6ul-sgtl5000";
+       ssi-controller = <&sai2>;
+       audio-codec = <&sgtl5000>;
+       audio-routing =
+               "MIC_IN", "Mic Jack",
+               "Mic Jack", "Mic Bias",
+               "Headphone Jack", "HP_OUT";
+       fsl,no-audmux;
+};
index b99e0b5..7cefb40 100644 (file)
@@ -65,40 +65,42 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
        int int_port, ext_port;
        int ret;
 
-       ret = of_property_read_u32(np, "mux-int-port", &int_port);
-       if (ret) {
-               dev_err(&pdev->dev, "mux-int-port missing or invalid\n");
-               return ret;
-       }
-       ret = of_property_read_u32(np, "mux-ext-port", &ext_port);
-       if (ret) {
-               dev_err(&pdev->dev, "mux-ext-port missing or invalid\n");
-               return ret;
-       }
-
-       /*
-        * The port numbering in the hardware manual starts at 1, while
-        * the audmux API expects it starts at 0.
-        */
-       int_port--;
-       ext_port--;
-       ret = imx_audmux_v2_configure_port(int_port,
-                       IMX_AUDMUX_V2_PTCR_SYN |
-                       IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |
-                       IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |
-                       IMX_AUDMUX_V2_PTCR_TFSDIR |
-                       IMX_AUDMUX_V2_PTCR_TCLKDIR,
-                       IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port));
-       if (ret) {
-               dev_err(&pdev->dev, "audmux internal port setup failed\n");
-               return ret;
-       }
-       ret = imx_audmux_v2_configure_port(ext_port,
-                       IMX_AUDMUX_V2_PTCR_SYN,
-                       IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));
-       if (ret) {
-               dev_err(&pdev->dev, "audmux external port setup failed\n");
-               return ret;
+       if (!of_property_read_bool(np, "fsl,no-audmux")) {
+               ret = of_property_read_u32(np, "mux-int-port", &int_port);
+               if (ret) {
+                       dev_err(&pdev->dev, "mux-int-port missing or invalid\n");
+                       return ret;
+               }
+               ret = of_property_read_u32(np, "mux-ext-port", &ext_port);
+               if (ret) {
+                       dev_err(&pdev->dev, "mux-ext-port missing or invalid\n");
+                       return ret;
+               }
+
+               /*
+                * The port numbering in the hardware manual starts at 1, while
+                * the audmux API expects it starts at 0.
+                */
+               int_port--;
+               ext_port--;
+               ret = imx_audmux_v2_configure_port(int_port,
+                               IMX_AUDMUX_V2_PTCR_SYN |
+                               IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |
+                               IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |
+                               IMX_AUDMUX_V2_PTCR_TFSDIR |
+                               IMX_AUDMUX_V2_PTCR_TCLKDIR,
+                               IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port));
+               if (ret) {
+                       dev_err(&pdev->dev, "audmux internal port setup failed\n");
+                       return ret;
+               }
+               ret = imx_audmux_v2_configure_port(ext_port,
+                               IMX_AUDMUX_V2_PTCR_SYN,
+                               IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));
+               if (ret) {
+                       dev_err(&pdev->dev, "audmux external port setup failed\n");
+                       return ret;
+               }
        }
 
        ssi_np = of_parse_phandle(pdev->dev.of_node, "ssi-controller", 0);