Hi Kristen,

Could you please review this patch and accept this into your patchset?

This patch fixes BOO #11049
-- 
guanqun
sst: fix incorrect tristate method

Mute speaker/headphone when PMIC is tristated so that it can suppress the
noises.

Besides, we incorporate a new card state called 'SND_CARD_TRISTATED' which
prevents us from un-muting speaker/headphone by accident.

Signed-off-by: Lu Guanqun <guanqun...@intel.com>

Index: linux-2.6.37/drivers/staging/intel_sst/intelmid_v2_control.c
===================================================================
--- linux-2.6.37.orig/drivers/staging/intel_sst/intelmid_v2_control.c   
2011-07-28 09:34:35.715999997 +0800
+++ linux-2.6.37/drivers/staging/intel_sst/intelmid_v2_control.c        
2011-08-01 15:18:07.784000006 +0800
@@ -205,6 +205,9 @@
        struct sc_reg_access sc_access[3];
        int retval = 0;
 
+       if (snd_pmic_ops_nc.card_status == SND_CARD_TRISTATED)
+               return 0;
+
        if (snd_pmic_ops_nc.card_status == SND_CARD_UN_INIT)
                retval = nc_init_card();
        if (retval)
@@ -285,6 +288,8 @@
        struct sc_reg_access sc_access[2];
        int retval = 0;
 
+       if (snd_pmic_ops_nc.card_status == SND_CARD_TRISTATED)
+               return 0;
 
        if (snd_pmic_ops_nc.card_status == SND_CARD_UN_INIT)
                retval = nc_init_card();
@@ -339,6 +344,9 @@
        int retval = 0;
        struct sc_reg_access sc_access[5];
 
+       if (snd_pmic_ops_nc.card_status == SND_CARD_TRISTATED)
+               return 0;
+
        if (snd_pmic_ops_nc.card_status == SND_CARD_UN_INIT)
                retval = nc_init_card();
        if (retval)
@@ -379,6 +387,9 @@
        int retval = 0;
        struct sc_reg_access sc_access[5];
 
+       if (snd_pmic_ops_nc.card_status == SND_CARD_TRISTATED)
+               return 0;
+
        if (snd_pmic_ops_nc.card_status == SND_CARD_UN_INIT)
                retval = nc_init_card();
        if (retval)
@@ -434,6 +445,9 @@
        };
        int retval = 0;
 
+       if (snd_pmic_ops_nc.card_status == SND_CARD_TRISTATED)
+               return 0;
+
        if (snd_pmic_ops_nc.card_status == SND_CARD_UN_INIT)
                retval = nc_init_card();
        if (retval)
@@ -1168,16 +1182,31 @@
 
 static int nc_tristate_pmic(int tristate)
 {
-       struct sc_reg_access sc_access;
+       struct sc_reg_access sc_access[2];
 
-       sc_access.reg_addr = AUDIOPORT1;
-       if (tristate)
-               sc_access.value = 0x0;
-       else
-               sc_access.value = 0x98;
-       sc_access.mask = 0x0;
+       if (!tristate) {
+               snd_pmic_ops_nc.card_status = SND_CARD_UN_INIT;
+               return 0;
+       }
+
+       /* mute */
+       sc_access[0].reg_addr = LMUTE;
+       sc_access[1].reg_addr = RMUTE;
+       sc_access[0].mask = sc_access[1].mask = MASK2 | MASK1;
+       sc_access[0].value = sc_access[1].value = 0x6;
+       sst_sc_reg_access(sc_access, PMIC_WRITE, 2);
+       msleep(30);
+       nc_set_amp_power(0);
+
+       /* tristate */
+       sc_access[0].reg_addr = AUDIOPORT1;
+       sc_access[0].value = 0x0;
+       sc_access[0].mask = 0x0;
+       sst_sc_reg_access(sc_access, PMIC_WRITE, 1);
+
+       snd_pmic_ops_nc.card_status = SND_CARD_TRISTATED;
 
-       return sst_sc_reg_access(&sc_access, PMIC_WRITE, 1);
+       return 0;
 }
 
 struct snd_pmic_ops snd_pmic_ops_nc = {
Index: linux-2.6.37/drivers/staging/intel_sst/intel_sst.h
===================================================================
--- linux-2.6.37.orig/drivers/staging/intel_sst/intel_sst.h     2011-07-28 
09:06:23.655999982 +0800
+++ linux-2.6.37/drivers/staging/intel_sst/intel_sst.h  2011-07-28 
09:50:35.463999984 +0800
@@ -46,6 +46,7 @@
 enum sst_card_states {
        SND_CARD_UN_INIT = 0,
        SND_CARD_INIT_DONE,
+       SND_CARD_TRISTATED,
 };
 
 enum sst_controls {
_______________________________________________
MeeGo-kernel mailing list
MeeGo-kernel@lists.meego.com
http://lists.meego.com/listinfo/meego-kernel

Reply via email to