asoc: tegra: ap20: add functions to enable/tristate the das
Nikesh Oswal [Tue, 24 Jan 2012 06:48:04 +0000 (11:48 +0530)]
Bug: 919350

Reviewed-on: http://git-master/r/76952

Change-Id: Iffc597141a3a5ea528089ce06bf57a4b012eefe8
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/77730
Reviewed-by: Automatic_Commit_Validation_User

sound/soc/tegra/tegra20_das.c
sound/soc/tegra/tegra20_das.h

index 29ce316..0774d36 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/slab.h>
 #include <linux/io.h>
 #include <mach/iomap.h>
+#include <mach/pinmux.h>
 #include <sound/soc.h>
 #include "tegra20_das.h"
 
@@ -66,6 +67,37 @@ int tegra20_das_resume()
 }
 #endif
 
+int tegra20_das_set_tristate(int dap_id, int is_tristate)
+{
+       enum tegra_pingroup pin;
+       enum tegra_tristate tristate;
+
+       switch (dap_id) {
+       case TEGRA20_DAS_DAP_ID_1:
+               pin = TEGRA_PINGROUP_DAP1;
+               break;
+       case TEGRA20_DAS_DAP_ID_2:
+               pin = TEGRA_PINGROUP_DAP2;
+               break;
+       case TEGRA20_DAS_DAP_ID_3:
+               pin = TEGRA_PINGROUP_DAP3;
+               break;
+       case TEGRA20_DAS_DAP_ID_4:
+               pin = TEGRA_PINGROUP_DAP4;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       if (is_tristate)
+               tristate = TEGRA_TRI_TRISTATE;
+       else
+               tristate = TEGRA_TRI_NORMAL;
+
+       tegra_pinmux_set_tristate(pin, tristate);
+}
+EXPORT_SYMBOL_GPL(tegra20_das_set_tristate);
+
 int tegra20_das_connect_dap_to_dac(int dap, int dac)
 {
        u32 addr;
index 1d7c57f..0d58c7d 100644 (file)
@@ -143,4 +143,6 @@ extern int tegra20_das_connect_dap_to_dap(int dap_id, int other_dap_sel,
  */
 extern int tegra20_das_connect_dac_to_dap(int dac_id, int dap_sel);
 
+extern int tegra20_das_set_tristate(int dap_id, int is_tristate);
+
 #endif