update: clock error detection, calibration_re reading,
authorPeter Li <a0220410@ti.com>
Mon, 17 Apr 2017 15:22:15 +0000 (23:22 +0800)
committerPeter Li <a0220410@ti.com>
Mon, 17 Apr 2017 15:22:15 +0000 (23:22 +0800)
tas2557-codec.c
tas2557-core.c
tas2557-core.h
tas2557-misc.c
tas2557-regmap.c
tas2557.h

index 2bd6fb462d2075703ff628dbbc488fb06b40db73..1cec7976fcc9263fe5a49dcf5333b9c31fe0fe9c 100755 (executable)
@@ -294,6 +294,27 @@ static int tas2557_fs_put(struct snd_kcontrol *pKcontrol,
        return ret;
 }
 
+static int tas2557_Cali_get(struct snd_kcontrol *pKcontrol,
+       struct snd_ctl_elem_value *pValue)
+{
+#ifdef KCONTROL_CODEC
+       struct snd_soc_codec *codec = snd_soc_kcontrol_codec(pKcontrol);
+#else
+       struct snd_soc_codec *codec = snd_kcontrol_chip(pKcontrol);
+#endif
+       struct tas2557_priv *pTAS2557 = snd_soc_codec_get_drvdata(codec);
+       int ret = 0;
+       int prm_r0 = 0;
+
+       mutex_lock(&pTAS2557->codec_lock);
+
+       ret = tas2557_get_Cali_prm_r0(pTAS2557, &prm_r0);
+       pValue->value.integer.value[0] = prm_r0;
+       dev_dbg(pTAS2557->dev, "%s = 0x%x\n", __func__, prm_r0);
+
+       mutex_unlock(&pTAS2557->codec_lock);
+       return ret;
+}
 static int tas2557_program_get(struct snd_kcontrol *pKcontrol,
        struct snd_ctl_elem_value *pValue)
 {
@@ -324,11 +345,13 @@ static int tas2557_program_put(struct snd_kcontrol *pKcontrol,
 #endif
        struct tas2557_priv *pTAS2557 = snd_soc_codec_get_drvdata(codec);
        unsigned int nProgram = pValue->value.integer.value[0];
-       int ret = 0;
+       int ret = 0, nConfiguration = -1;
 
        mutex_lock(&pTAS2557->codec_lock);
 
-       ret = tas2557_set_program(pTAS2557, nProgram, -1);
+       if (nProgram == pTAS2557->mnCurrentProgram)
+               nConfiguration = pTAS2557->mnCurrentConfiguration;
+       ret = tas2557_set_program(pTAS2557, nProgram, nConfiguration);
 
        mutex_unlock(&pTAS2557->codec_lock);
        return ret;
@@ -416,68 +439,7 @@ static int tas2557_calibration_put(struct snd_kcontrol *pKcontrol,
        return ret;
 }
 
-
-/*
- * DAC digital volumes. From 0 to 15 dB in 1 dB steps
- */
-static DECLARE_TLV_DB_SCALE(dac_tlv, 0, 100, 0);
-
-
-
-       
-
-static const char * const chl_setup_text[] = {
-       "default",
-       "DevA-Mute",
-       "DevA-Left",
-       "DevA-Right",
-       "DevA-MonoMix"
-};
-static const struct soc_enum chl_setup_enum[] = {
-       SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(chl_setup_text), chl_setup_text),
-};
-
-static int tas2557_dsp_chl_setup_get(struct snd_kcontrol *pKcontrol,
-                       struct snd_ctl_elem_value *pValue)
-{
-#ifdef KCONTROL_CODEC
-       struct snd_soc_codec *codec = snd_soc_kcontrol_codec(pKcontrol);
-#else
-       struct snd_soc_codec *codec = snd_kcontrol_chip(pKcontrol);
-#endif
-       struct tas2557_priv *pTAS2557 = snd_soc_codec_get_drvdata(codec);
-
-       mutex_lock(&pTAS2557->codec_lock);
-
-       pValue->value.integer.value[0] = pTAS2557->mnChannelState;
-
-       mutex_unlock(&pTAS2557->codec_lock);
-
-       return 0;
-}
-
-static int tas2557_dsp_chl_setup_put(struct snd_kcontrol *pKcontrol,
-                       struct snd_ctl_elem_value *pValue)
-{
-#ifdef KCONTROL_CODEC
-       struct snd_soc_codec *codec = snd_soc_kcontrol_codec(pKcontrol);
-#else
-       struct snd_soc_codec *codec = snd_kcontrol_chip(pKcontrol);
-#endif
-       struct tas2557_priv *pTAS2557 = snd_soc_codec_get_drvdata(codec);
-       int channel_state = pValue->value.integer.value[0];
-
-       mutex_lock(&pTAS2557->codec_lock);
-
-       tas2557_SA_DevChnSetup(pTAS2557, channel_state);
-
-       mutex_unlock(&pTAS2557->codec_lock);
-       return 0;
-}
-
 static const struct snd_kcontrol_new tas2557_snd_controls[] = {
-       SOC_SINGLE_TLV("DAC Playback Volume", TAS2557_SPK_CTRL_REG, 3, 0x0f, 0,
-               dac_tlv),
        SOC_SINGLE_EXT("PowerCtrl", SND_SOC_NOPM, 0, 0x0001, 0,
                tas2557_power_ctrl_get, tas2557_power_ctrl_put),
        SOC_SINGLE_EXT("Program", SND_SOC_NOPM, 0, 0x00FF, 0, tas2557_program_get,
@@ -486,10 +448,10 @@ static const struct snd_kcontrol_new tas2557_snd_controls[] = {
                tas2557_configuration_get, tas2557_configuration_put),
        SOC_SINGLE_EXT("FS", SND_SOC_NOPM, 8000, 48000, 0,
                tas2557_fs_get, tas2557_fs_put),
+       SOC_SINGLE_EXT("Get Cali_Re", SND_SOC_NOPM, 0, 0x7f000000, 0,
+               tas2557_Cali_get, NULL),
        SOC_SINGLE_EXT("Calibration", SND_SOC_NOPM, 0, 0x00FF, 0,
                tas2557_calibration_get, tas2557_calibration_put),
-       SOC_ENUM_EXT("DSPChl Setup", chl_setup_enum[0],
-               tas2557_dsp_chl_setup_get, tas2557_dsp_chl_setup_put),
 };
 
 static struct snd_soc_codec_driver soc_codec_driver_tas2557 = {
index 448555cda251b79e32eab35bc7e6ee17f1ed090b..c1acbc561480db60cb3dc2bda888d453ac4b0e80 100755 (executable)
@@ -41,8 +41,9 @@
 #include "tas2557.h"
 #include "tas2557-core.h"
 
-#define PPC_DRIVER_CRCCHK                      0x00000200
-#define PPC_DRIVER_CONFDEV                     0x00000300
+#define        PPC_DRIVER_CRCCHK                       0x00000200
+#define        PPC_DRIVER_CONFDEV                      0x00000300
+#define        PPC_DRIVER_CFGDEV_NONCRC        0x00000101
 
 #define TAS2557_CAL_NAME    "/data/tas2557_cal.bin"
 
@@ -97,7 +98,7 @@ static unsigned int p_tas2557_startup_data[] = {
        TAS2557_POWER_CTRL2_REG, 0xA3,   /* Class-D, Boost, IV sense power up */
        TAS2557_POWER_CTRL1_REG, 0xF8,   /* PLL, DSP, clock dividers power up */
        TAS2557_UDELAY, 2000,           /* delay */
-       TAS2557_CLK_ERR_CTRL, 0x03,     /* enable clock error detection */
+       TAS2557_CLK_ERR_CTRL, 0x0b,     /* enable clock error detection */
        0xFFFFFFFF, 0xFFFFFFFF
 };
 
@@ -150,79 +151,6 @@ int tas2557_configIRQ(struct tas2557_priv *pTAS2557)
        return tas2557_dev_load_data(pTAS2557, p_tas2557_irq_config);
 }
 
-/*
-* for PG2.1 Dual Mono
-*/
-int tas2557_SA_DevChnSetup(struct tas2557_priv *pTAS2557, unsigned int mode)
-{
-       int nResult = 0;
-       struct TProgram *pProgram;
-       unsigned char buf_mute[16] = {0};
-       unsigned char buf_DevA_Left[16] = {0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-       unsigned char buf_DevA_Right[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0x40, 0, 0, 0, 0, 0, 0, 0};
-       unsigned char buf_DevA_MonoMix[16] = {0x20, 0, 0, 0, 0, 0, 0, 0, 0x20, 0, 0, 0, 0, 0, 0, 0};
-       unsigned char *pDevABuf;
-
-       dev_dbg(pTAS2557->dev, "%s, mode %d\n", __func__, mode);
-       if ((pTAS2557->mpFirmware->mnPrograms == 0)
-               || (pTAS2557->mpFirmware->mnConfigurations == 0)) {
-               dev_err(pTAS2557->dev, "%s, firmware not loaded\n", __func__);
-               goto end;
-       }
-
-       pProgram = &(pTAS2557->mpFirmware->mpPrograms[pTAS2557->mnCurrentProgram]);
-       if (pProgram->mnAppMode != TAS2557_APP_TUNINGMODE) {
-               dev_err(pTAS2557->dev, "%s, not tuning mode\n", __func__);
-               goto end;
-       }
-
-       if (pTAS2557->mnPGID != TAS2557_PG_VERSION_2P1) {
-               dev_err(pTAS2557->dev, "%s, currently we only support PG2.1\n", __func__);
-               goto end;
-       }
-
-       if (pTAS2557->mbLoadConfigurationPrePowerUp) {
-               dev_dbg(pTAS2557->dev, "%s, setup channel after coeff update\n", __func__);
-               pTAS2557->mnChannelState = mode;
-               goto end;
-       }
-
-       switch (mode) {
-       case TAS2557_DEVA_CHL_DEFAULT:
-       pDevABuf = pTAS2557->mnDevAChlData;
-       break;
-
-       case TAS2557_DEVA_CHL_MUTE:
-       pDevABuf = buf_mute;
-       break;
-
-       case TAS2557_DEVA_CHL_LEFT:
-       pDevABuf = buf_DevA_Left;
-       break;
-
-       case TAS2557_DEVA_CHL_RIGHT:
-       pDevABuf = buf_DevA_Right;
-       break;
-
-       case TAS2557_DEVA_CHL_MONOMIX:
-       pDevABuf = buf_DevA_MonoMix;
-       break;
-       default:
-       break;
-       }
-
-       if (pDevABuf) {
-               nResult = pTAS2557->bulk_write(pTAS2557, TAS2557_SA_PG2P1_CHL_CTRL_REG, pDevABuf, 16);
-               if (nResult < 0)
-                       goto end;
-               pTAS2557->mnChannelState = mode;
-       }
-
-end:
-
-       return nResult;
-}
-
 int tas2557_set_bit_rate(struct tas2557_priv *pTAS2557, unsigned int nBitRate)
 {
        int ret = 0, n = -1;
@@ -299,18 +227,27 @@ int tas2557_set_DAC_gain(struct tas2557_priv *pTAS2557, unsigned int nGain)
 */
 int tas2557_get_die_temperature(struct tas2557_priv *pTAS2557, int *pTemperature)
 {
+       int nResult = 0;
        unsigned char nBuf[4];
        int temp;
-       int nResult = 0;
 
-       if (pTAS2557->mbPowerUp) {
-               nResult = pTAS2557->bulk_read(pTAS2557, TAS2557_DIE_TEMP_REG, nBuf, 4);
-               if (nResult >= 0) {
-                       temp = ((int)nBuf[0] << 24) | ((int)nBuf[1] << 16) | ((int)nBuf[2] << 8) | nBuf[3];
-                       *pTemperature = temp;
-               }
-       } else
-               dev_err(pTAS2557->dev, "Get Die Temperature when music is playing\n");
+       if (!pTAS2557->mpFirmware->mnConfigurations) {
+               dev_err(pTAS2557->dev, "%s, firmware not loaded\n", __func__);
+               goto end;
+       }
+
+       if (!pTAS2557->mbPowerUp) {
+               dev_err(pTAS2557->dev, "%s, device not powered on\n", __func__);
+               goto end;
+       }
+
+       nResult = pTAS2557->bulk_read(pTAS2557, TAS2557_DIE_TEMP_REG, nBuf, 4);
+       if (nResult >= 0) {
+               temp = ((int)nBuf[0] << 24) | ((int)nBuf[1] << 16) | ((int)nBuf[2] << 8) | nBuf[3];
+               *pTemperature = temp;
+       }
+
+end:
 
        return nResult;
 }
@@ -454,16 +391,6 @@ prog_coefficient:
                TAS2557_BLOCK_CFG_COEFF_DEV_A);
        if (nResult < 0)
                goto end;
-       if (pTAS2557->mnChannelState == TAS2557_DEVA_CHL_DEFAULT) {
-               nResult = pTAS2557->bulk_read(pTAS2557,
-                       TAS2557_SA_PG2P1_CHL_CTRL_REG, pTAS2557->mnDevAChlData, 16);
-               if (nResult < 0)
-                       goto end;
-       } else {
-               nResult = tas2557_SA_DevChnSetup(pTAS2557, pTAS2557->mnChannelState);
-               if (nResult < 0)
-                       goto end;
-       }
 
        if (pTAS2557->mpCalFirmware->mnCalibrations) {
                pCalibration = &(pTAS2557->mpCalFirmware->mpCalibrations[pTAS2557->mnCurrentCalibration]);
@@ -480,11 +407,13 @@ prog_coefficient:
                nResult = tas2557_dev_load_data(pTAS2557, p_tas2557_startup_data);
                if (nResult < 0)
                        goto end;
-               nResult = tas2557_checkPLL(pTAS2557);
-               if (nResult < 0) {
-                       nResult = tas2557_dev_load_data(pTAS2557, p_tas2557_shutdown_data);
-                       pTAS2557->mbPowerUp = false;
-                       goto end;
+               if (pProgram->mnAppMode == TAS2557_APP_TUNINGMODE) {
+                       nResult = tas2557_checkPLL(pTAS2557);
+                       if (nResult < 0) {
+                               nResult = tas2557_dev_load_data(pTAS2557, p_tas2557_shutdown_data);
+                               pTAS2557->mbPowerUp = false;
+                               goto end;
+                       }
                }
                dev_dbg(pTAS2557->dev,
                        "device powered up, load unmute\n");
@@ -893,11 +822,13 @@ static int fw_parse_configuration_data(struct tas2557_priv *pTAS2557,
                pConfiguration->mpDescription = kmemdup(pData, n + 1, GFP_KERNEL);
                pData += n + 1;
 
-               if (pFirmware->mnDriverVersion >= PPC_DRIVER_CONFDEV) {
+               if ((pFirmware->mnDriverVersion >= PPC_DRIVER_CONFDEV)
+                       || ((pFirmware->mnDriverVersion >= PPC_DRIVER_CFGDEV_NONCRC)
+                               && (pFirmware->mnDriverVersion < PPC_DRIVER_CRCCHK))) {
                        pConfiguration->mnDevices = (pData[0] << 8) + pData[1];
                        pData += 2;
                } else
-                       pConfiguration->mnDevices = 0;
+                       pConfiguration->mnDevices = 1;
 
                pConfiguration->mnProgram = pData[0];
                pData++;
@@ -1885,6 +1816,80 @@ end:
        return nResult;
 }
 
+int tas2557_get_Cali_prm_r0(struct tas2557_priv *pTAS2557, int *prm_r0)
+{
+       int nResult = 0;
+       int n, nn;
+       struct TCalibration *pCalibration;
+       struct TData *pData;
+       struct TBlock *pBlock;
+       int nReg;
+       int nBook, nPage, nOffset;
+       unsigned char *pCommands;
+       int nCali_Re;
+       bool bFound = false;
+       int nBlockType;
+       int len;
+
+       if (!pTAS2557->mpCalFirmware->mnCalibrations) {
+               dev_err(pTAS2557->dev, "%s, no calibration data\n", __func__);
+               goto end;
+       }
+
+       if (pTAS2557->mnPGID == TAS2557_PG_VERSION_2P1)
+               nReg = TAS2557_PG2P1_CALI_R0_REG;
+       else
+               nReg = TAS2557_PG1P0_CALI_R0_REG;
+
+       nBlockType = TAS2557_BLOCK_CFG_COEFF_DEV_A;
+
+       pCalibration = &(pTAS2557->mpCalFirmware->mpCalibrations[pTAS2557->mnCurrentCalibration]);
+       pData = &(pCalibration->mData);
+
+       for (n = 0; n < pData->mnBlocks; n++) {
+               pBlock = &(pData->mpBlocks[n]);
+               if (pBlock->mnType == nBlockType) {
+                       pCommands = pBlock->mpData;
+                       for (nn = 0 ; nn < pBlock->mnCommands;) {
+                               nBook = pCommands[4 * nn + 0];
+                               nPage = pCommands[4 * nn + 1];
+                               nOffset = pCommands[4 * nn + 2];
+                               if ((nOffset < 0x7f) || (nOffset == 0x81))
+                                       nn++;
+                               else if (nOffset == 0x85) {
+                                       len = ((int)nBook << 8) | nPage;
+
+                                       nBook = pCommands[4 * nn + 4];
+                                       nPage = pCommands[4 * nn + 5];
+                                       nOffset = pCommands[4 * nn + 6];
+                                       if ((nBook == TAS2557_BOOK_ID(nReg))
+                                               && (nPage == TAS2557_PAGE_ID(nReg))
+                                               && (nOffset == TAS2557_PAGE_REG(nReg))) {
+                                               nCali_Re = ((int)pCommands[4 * nn + 7] << 24)
+                                                       | ((int)pCommands[4 * nn + 8] << 16)
+                                                       | ((int)pCommands[4 * nn + 9] << 8)
+                                                       | (int)pCommands[4 * nn + 10];
+                                               bFound = true;
+                                               goto end;
+                                       }
+                                       nn++;
+                                       nn += ((len - 1) / 4);
+                                       if ((len - 1) % 4)
+                                               nn++;
+                               } else
+                                       dev_err(pTAS2557->dev, "%s, format error %d\n", __func__, nOffset);
+                       }
+               }
+       }
+
+end:
+
+       if (bFound)
+               *prm_r0 = nCali_Re;
+
+       return nResult;
+}
+
 int tas2557_parse_dt(struct device *dev, struct tas2557_priv *pTAS2557)
 {
        struct device_node *np = dev->of_node;
@@ -1892,36 +1897,30 @@ int tas2557_parse_dt(struct device *dev, struct tas2557_priv *pTAS2557)
        unsigned int value;
 
        pTAS2557->mnResetGPIO = of_get_named_gpio(np, "ti,cdc-reset-gpio", 0);
-       if (pTAS2557->mnResetGPIO < 0) {
+       if (!gpio_is_valid(pTAS2557->mnResetGPIO)) {
                dev_err(pTAS2557->dev, "Looking up %s property in node %s failed %d\n",
                        "ti,cdc-reset-gpio", np->full_name,
                        pTAS2557->mnResetGPIO);
                ret = -EINVAL;
+               goto end;
        } else
-                       dev_dbg(pTAS2557->dev, "ti,cdc-reset-gpio=%d\n", pTAS2557->mnResetGPIO);
+               dev_dbg(pTAS2557->dev, "ti,cdc-reset-gpio=%d\n", pTAS2557->mnResetGPIO);
 
-       if (ret >= 0) {
-               pTAS2557->mnGpioINT = of_get_named_gpio(np, "ti,irq-gpio", 0);
-               if (pTAS2557->mnGpioINT < 0) {
-                       dev_err(pTAS2557->dev, "Looking up %s property in node %s failed %d\n",
-                               "ti,irq-gpio", np->full_name,
-                               pTAS2557->mnGpioINT);
-                       ret = -EINVAL;
-               } else
-                       dev_dbg(pTAS2557->dev, "ti,irq-gpio=%d\n", pTAS2557->mnGpioINT);
-       }
+       pTAS2557->mnGpioINT = of_get_named_gpio(np, "ti,irq-gpio", 0);
+       if (!gpio_is_valid(pTAS2557->mnGpioINT))
+               dev_err(pTAS2557->dev, "Looking up %s property in node %s failed %d\n",
+                       "ti,irq-gpio", np->full_name,
+                       pTAS2557->mnGpioINT);
 
-       if (ret >= 0) {
-               rc = of_property_read_u32(np, "ti,i2s-bits", &value);
-               if (rc) {
-                       dev_err(pTAS2557->dev, "Looking up %s property in node %s failed %d\n",
-                               "ti,i2s-bits", np->full_name, rc);
-                       ret = -EINVAL;
-               } else {
-                       pTAS2557->mnI2SBits = value;
-                       dev_dbg(pTAS2557->dev, "ti,i2s-bits=%d\n", pTAS2557->mnI2SBits);
-               }
-       }
+
+       rc = of_property_read_u32(np, "ti,i2s-bits", &value);
+       if (rc)
+               dev_err(pTAS2557->dev, "Looking up %s property in node %s failed %d\n",
+                       "ti,i2s-bits", np->full_name, rc);
+       else
+               pTAS2557->mnI2SBits = value;
+
+end:
 
        return ret;
 }
index 7170428bc864c10aa5c934dcdd2e0af18835c514..e031a19c92a94cb28c9acd49a84a3374256a504c 100755 (executable)
@@ -66,6 +66,7 @@ int tas2557_set_bit_rate(struct tas2557_priv *pTAS2557, unsigned int nBitRate);
 int tas2557_get_bit_rate(struct tas2557_priv *pTAS2557, unsigned char *pBitRate);
 int tas2557_set_config(struct tas2557_priv *pTAS2557, int config);
 void tas2557_fw_ready(const struct firmware *pFW, void *pContext);
+int tas2557_get_Cali_prm_r0(struct tas2557_priv *pTAS2557, int *prm_r0);
 int tas2557_set_program(struct tas2557_priv *pTAS2557, unsigned int nProgram, int nConfig);
 int tas2557_set_calibration(struct tas2557_priv *pTAS2557, int nCalibration);
 int tas2557_load_default(struct tas2557_priv *pTAS2557);
index f53425b0272f736838a7f2afd28d5f5fcf827a34..32777acd100fbd725937462eec6d499881951d22 100755 (executable)
@@ -363,9 +363,13 @@ static ssize_t tas2557_file_write(struct file *file, const char *buf, size_t cou
                if (count == 2) {
                        if ((pTAS2557->mpFirmware->mnConfigurations > 0)
                                && (pTAS2557->mpFirmware->mnPrograms > 0)) {
+                               int config = -1;
+
+                               if (p_kBuf[1] == pTAS2557->mnCurrentProgram)
+                                       config = pTAS2557->mnCurrentConfiguration;
                                if (g_logEnable)
-                                       dev_info(pTAS2557->dev, "TIAUDIO_CMD_PROGRAM, set to %d\n", p_kBuf[1]);
-                               tas2557_set_program(pTAS2557, p_kBuf[1], -1);
+                                       dev_info(pTAS2557->dev, "TIAUDIO_CMD_PROGRAM, set to %d, cfg=%d\n", p_kBuf[1], config);
+                               tas2557_set_program(pTAS2557, p_kBuf[1], config);
                                pTAS2557->mnDBGCmd = 0;
                        } else
                                dev_err(pTAS2557->dev, "%s, firmware not loaded\n", __func__);
index 2f9f771fe59852f689d27f54fc80951594848e2c..071e6a9cbc6d5a07fa79ac0245cff62c428873f8 100755 (executable)
@@ -340,13 +340,16 @@ void tas2557_enableIRQ(struct tas2557_priv *pTAS2557, bool enable)
 {
        if (enable) {
                if (!pTAS2557->mbIRQEnable) {
-                       if (pTAS2557->mnIRQ != 0)
+                       if (gpio_is_valid(pTAS2557->mnGpioINT)) {
                                enable_irq(pTAS2557->mnIRQ);
-                       pTAS2557->mbIRQEnable = true;
+                               /* check after 10 ms */
+                               schedule_delayed_work(&pTAS2557->irq_work, msecs_to_jiffies(10));
+                               pTAS2557->mbIRQEnable = true;
+                       }
                }
        } else {
                if (pTAS2557->mbIRQEnable) {
-                       if (pTAS2557->mnIRQ != 0)
+                       if (gpio_is_valid(pTAS2557->mnGpioINT))
                                disable_irq_nosync(pTAS2557->mnIRQ);
                        pTAS2557->mbIRQEnable = false;
                }
@@ -458,7 +461,7 @@ static void irq_work_routine(struct work_struct *work)
                if (nResult < 0)
                        goto program;
                if ((nDevPowerUpFlag & 0xc0) != 0xc0) {
-                       dev_err(pTAS2557->dev, "%s, Critical DevA ERROR B[%d]_P[%d]_R[%d]= 0x%x\n",
+                       dev_err(pTAS2557->dev, "%s, Critical ERROR B[%d]_P[%d]_R[%d]= 0x%x\n",
                                __func__,
                                TAS2557_BOOK_ID(TAS2557_POWER_UP_FLAG_REG),
                                TAS2557_PAGE_ID(TAS2557_POWER_UP_FLAG_REG),
index 834252576b00eb89494b8a8f7dbcaab696232c5b..5cd4f7af6b79e9e52399120c6c1fa03dac8742ac 100755 (executable)
--- a/tas2557.h
+++ b/tas2557.h
@@ -79,7 +79,7 @@
 #define TAS2557_DSP_MODE_SELECT_REG            TAS2557_REG(0, 0, 34)
 #define TAS2557_SAFE_GUARD_REG                 TAS2557_REG(0, 0, 37)
 #define TAS2557_ASI_CTL1_REG                   TAS2557_REG(0, 0, 42)
-#define TAS2557_CLK_ERR_CTRL                   TAS2557_REG(0, 0, 44)
+#define TAS2557_CLK_ERR_CTRL                   TAS2557_REG(0, 0, 44)   /* B0_P0_R0x2c*/
 #define TAS2557_CLK_ERR_CTRL2                  TAS2557_REG(0, 0, 45)   /* B0_P0_R0x2d*/
 #define TAS2557_CLK_ERR_CTRL3                  TAS2557_REG(0, 0, 46)   /* B0_P0_R0x2e*/
 #define TAS2557_DBOOST_CFG_REG                 TAS2557_REG(0, 0, 52)
 #define TAS2557_TEST_MODE_REG                  TAS2557_REG(0, 253, 13)
 #define TAS2557_BROADCAST_REG                  TAS2557_REG(0, 253, 54)
 #define TAS2557_CRYPTIC_REG                    TAS2557_REG(0, 253, 71)
+#define TAS2557_PG2P1_CALI_R0_REG              TAS2557_REG(0x8c, 0x2f, 0x40)
+#define TAS2557_PG1P0_CALI_R0_REG              TAS2557_REG(0x8c, 0x2f, 0x28)
 
 #define TAS2557_DAC_INTERPOL_REG               TAS2557_REG(100, 0, 1)
 #define TAS2557_SOFT_MUTE_REG                  TAS2557_REG(100, 0, 7)
 #define        TAS2557_BOOST_DEVB              2
 #define        TAS2557_BOOST_BOTH              3
 
-#define        TAS2557_DEVA_CHL_DEFAULT        0       /* DevA default */
-#define        TAS2557_DEVA_CHL_MUTE           1       /* DevA mute */
-#define        TAS2557_DEVA_CHL_LEFT           2       /* DevA left channel */
-#define        TAS2557_DEVA_CHL_RIGHT          3       /* DevA right channel */
-#define        TAS2557_DEVA_CHL_MONOMIX        4       /* DevA (L+R)/2 */
-
 #define        ERROR_NONE                      0x00000000
 #define        ERROR_PLL_ABSENT        0x00000001
 #define        ERROR_DEVA_I2C_COMM     0x00000002
@@ -400,7 +396,6 @@ struct tas2557_register {
 struct tas2557_priv {
        struct device *dev;
        struct regmap *mpRegmap;
-       int mnLoad;
        int mnPGID;
        int mnResetGPIO;
        struct mutex dev_lock;
@@ -450,8 +445,6 @@ struct tas2557_priv {
        bool mbIRQEnable;
        unsigned char mnI2SBits;
 
-       unsigned int mnChannelState;
-       unsigned char mnDevAChlData[16];
 
        /* for low temperature check */
        unsigned int mnDevGain;