Add IRQ enable
[tas2770sw-android/tas2770sw-android.git] / tas2770-codec.c
index 1e4e852969d68c5ef37128e5396c0a8574de207f..295e3bcf144976a4116df739f5677a3d44afde9f 100644 (file)
@@ -108,6 +108,7 @@ static int tas2770_codec_suspend(struct snd_soc_codec *codec)
        mutex_lock(&pTAS2770->codec_lock);
 
        dev_dbg(pTAS2770->dev, "%s\n", __func__);
+       pTAS2770->runtime_suspend(pTAS2770);
 
        mutex_unlock(&pTAS2770->codec_lock);
        return ret;
@@ -121,6 +122,7 @@ static int tas2770_codec_resume(struct snd_soc_codec *codec)
        mutex_lock(&pTAS2770->codec_lock);
 
        dev_dbg(pTAS2770->dev, "%s\n", __func__);
+       pTAS2770->runtime_resume(pTAS2770);
 
        mutex_unlock(&pTAS2770->codec_lock);
        return ret;
@@ -146,18 +148,23 @@ static int tas2770_set_power_state(struct tas2770_priv *pTAS2770, int state)
                snd_soc_update_bits(codec, TAS2770_PowerControl,
                        TAS2770_PowerControl_OperationalMode10_Mask,
                        TAS2770_PowerControl_OperationalMode10_Active);
+               pTAS2770->mnPowerState = TAS2770_POWER_ACTIVE;
+               pTAS2770->enableIRQ(pTAS2770, true);
                break;
 
        case TAS2770_POWER_MUTE:
                snd_soc_update_bits(codec, TAS2770_PowerControl,
                        TAS2770_PowerControl_OperationalMode10_Mask,
                        TAS2770_PowerControl_OperationalMode10_Mute);
+               pTAS2770->mnPowerState = TAS2770_POWER_MUTE;
                break;
 
        case TAS2770_POWER_SHUTDOWN:
                snd_soc_update_bits(codec, TAS2770_PowerControl,
                        TAS2770_PowerControl_OperationalMode10_Mask,
                        TAS2770_PowerControl_OperationalMode10_Shutdown);
+               pTAS2770->enableIRQ(pTAS2770, false);
+               pTAS2770->mnPowerState = TAS2770_POWER_SHUTDOWN;
                break;
 
        default:
@@ -248,26 +255,26 @@ static int tas2770_set_bitwidth(struct tas2770_priv *pTAS2770, int bitwidth)
                        TAS2770_TDMConfigurationReg2_RXWLEN32_Mask,
                        TAS2770_TDMConfigurationReg2_RXWLEN32_16Bits);
                        /* If machine driver did not call set slot width */
-                       if (pTAS2770->mnSlot_width == 0)
-                               tas2770_set_slot(pTAS2770->codec, 16);
+               if (pTAS2770->mnSlot_width == 0)
+                       tas2770_set_slot(pTAS2770->codec, 16);
                pTAS2770->mnVmon_slot_no = pTAS2770->mnImon_slot_no + 2;
                break;
        case SNDRV_PCM_FORMAT_S24_LE:
-                       snd_soc_update_bits(pTAS2770->codec,
+               snd_soc_update_bits(pTAS2770->codec,
                        TAS2770_TDMConfigurationReg2,
                        TAS2770_TDMConfigurationReg2_RXWLEN32_Mask,
                        TAS2770_TDMConfigurationReg2_RXWLEN32_24Bits);
-                       if (pTAS2770->mnSlot_width == 0)
-                               tas2770_set_slot(pTAS2770->codec, 32);
+               if (pTAS2770->mnSlot_width == 0)
+                       tas2770_set_slot(pTAS2770->codec, 32);
                pTAS2770->mnVmon_slot_no = pTAS2770->mnImon_slot_no + 4;
                break;
        case SNDRV_PCM_FORMAT_S32_LE:
-                       snd_soc_update_bits(pTAS2770->codec,
+               snd_soc_update_bits(pTAS2770->codec,
                        TAS2770_TDMConfigurationReg2,
                        TAS2770_TDMConfigurationReg2_RXWLEN32_Mask,
                        TAS2770_TDMConfigurationReg2_RXWLEN32_32Bits);
-                       if (pTAS2770->mnSlot_width == 0)
-                               tas2770_set_slot(pTAS2770->codec, 32);
+               if (pTAS2770->mnSlot_width == 0)
+                       tas2770_set_slot(pTAS2770->codec, 32);
                pTAS2770->mnVmon_slot_no = pTAS2770->mnImon_slot_no + 4;
                break;