update for ESD recovery test
authorPeter Li <a0220410@ti.com>
Thu, 30 Mar 2017 00:27:14 +0000 (08:27 +0800)
committerPeter Li <a0220410@ti.com>
Thu, 30 Mar 2017 00:27:14 +0000 (08:27 +0800)
tas2557-core.c
tas2557-regmap.c
tas2557.h

index 4bc1cfa19a9d4b5bb5175587be25f2c4354d291e..448555cda251b79e32eab35bc7e6ee17f1ed090b 100755 (executable)
@@ -386,11 +386,11 @@ static int tas2557_load_coefficient(struct tas2557_priv *pTAS2557,
 {
        int nResult = 0;
        struct TPLL *pPLL;
-       bool bRestorePower = false;
        struct TProgram *pProgram;
        struct TConfiguration *pPrevConfiguration;
        struct TConfiguration *pNewConfiguration;
        struct TCalibration *pCalibration = NULL;
+       bool bRestorePower = false;
 
        if (!pTAS2557->mpFirmware->mnConfigurations) {
                dev_err(pTAS2557->dev, "%s, firmware not loaded\n", __func__);
@@ -896,7 +896,8 @@ static int fw_parse_configuration_data(struct tas2557_priv *pTAS2557,
                if (pFirmware->mnDriverVersion >= PPC_DRIVER_CONFDEV) {
                        pConfiguration->mnDevices = (pData[0] << 8) + pData[1];
                        pData += 2;
-               }
+               } else
+                       pConfiguration->mnDevices = 0;
 
                pConfiguration->mnProgram = pData[0];
                pData++;
index 9f20c167526c0221a16bc3464884b50b480bb6af..2f9f771fe59852f689d27f54fc80951594848e2c 100755 (executable)
@@ -373,7 +373,7 @@ static void irq_work_routine(struct work_struct *work)
 {
        int nResult = 0;
        unsigned int nDevInt1Status = 0, nDevInt2Status = 0;
-       unsigned int nDevPowerUpFlag = 0, nDevPowerStatus = 0;
+       unsigned int nDevPowerUpFlag = 0;
        struct tas2557_priv *pTAS2557 =
                container_of(work, struct tas2557_priv, irq_work.work);
 
@@ -457,20 +457,20 @@ static void irq_work_routine(struct work_struct *work)
                nResult = tas2557_dev_read(pTAS2557, TAS2557_POWER_UP_FLAG_REG, &nDevPowerUpFlag);
                if (nResult < 0)
                        goto program;
-               if ((nDevPowerUpFlag & 0x40) == 0) {
-                       /* Class-D doesn't power on */
-                       nResult = tas2557_dev_read(pTAS2557, TAS2557_POWER_CTRL2_REG, &nDevPowerStatus);
-                       if (nResult < 0)
-                               goto program;
-                       if (nDevPowerStatus & 0x80)
-                                       pTAS2557->mnErrCode |= ERROR_CLASSD_PWR;
-                               goto program; /* failed to power on the Class-D */
+               if ((nDevPowerUpFlag & 0xc0) != 0xc0) {
+                       dev_err(pTAS2557->dev, "%s, Critical DevA 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),
+                               TAS2557_PAGE_REG(TAS2557_POWER_UP_FLAG_REG),
+                               nDevPowerUpFlag);
+                       pTAS2557->mnErrCode |= ERROR_CLASSD_PWR;
+                       goto program;
                }
-
                pTAS2557->mnErrCode &= ~ERROR_CLASSD_PWR;
 
-               dev_dbg(pTAS2557->dev, "%s: INT1=0x%x, INT2=0x%x; PowerUpFlag=0x%x, PwrStatus=0x%x\n",
-                       __func__, nDevInt1Status, nDevInt2Status, nDevPowerUpFlag, nDevPowerStatus);
+               dev_dbg(pTAS2557->dev, "%s: INT1=0x%x, INT2=0x%x; PowerUpFlag=0x%x\n",
+                       __func__, nDevInt1Status, nDevInt2Status, nDevPowerUpFlag);
                goto end;
        }
 
@@ -494,8 +494,8 @@ static irqreturn_t tas2557_irq_handler(int irq, void *dev_id)
        struct tas2557_priv *pTAS2557 = (struct tas2557_priv *)dev_id;
 
        tas2557_enableIRQ(pTAS2557, false);
-       /* get IRQ status after 50 ms */
-       schedule_delayed_work(&pTAS2557->irq_work, msecs_to_jiffies(50));
+       /* get IRQ status after 100 ms */
+       schedule_delayed_work(&pTAS2557->irq_work, msecs_to_jiffies(100));
        return IRQ_HANDLED;
 }
 
@@ -503,8 +503,10 @@ static enum hrtimer_restart temperature_timer_func(struct hrtimer *timer)
 {
        struct tas2557_priv *pTAS2557 = container_of(timer, struct tas2557_priv, mtimer);
 
-       if (pTAS2557->mbPowerUp)
+       if (pTAS2557->mbPowerUp) {
                schedule_work(&pTAS2557->mtimerwork);
+               schedule_delayed_work(&pTAS2557->irq_work, msecs_to_jiffies(1));
+       }
        return HRTIMER_NORESTART;
 }
 
index f230a216959cfb4b1526be3142d3a905e61daafa..834252576b00eb89494b8a8f7dbcaab696232c5b 100755 (executable)
--- a/tas2557.h
+++ b/tas2557.h
@@ -413,12 +413,10 @@ struct tas2557_priv {
        unsigned int mnCurrentCalibration;
        unsigned char mnCurrentBook;
        unsigned char mnCurrentPage;
-       int mnDevChl;
        bool mbTILoadActive;
        bool mbPowerUp;
        bool mbLoadConfigurationPrePowerUp;
        bool mbLoadCalibrationPostPowerUp;
-       unsigned int mnPowerCtrl;
        bool mbCalibrationLoaded;
        int (*read)(struct tas2557_priv *pTAS2557,
                unsigned int reg,