update for broadcast mode
authora0220410 <peter-li@ti.com>
Tue, 1 Nov 2016 23:27:55 +0000 (07:27 +0800)
committera0220410 <peter-li@ti.com>
Tue, 1 Nov 2016 23:27:55 +0000 (07:27 +0800)
tas2555-core.c
tas2555-i2c.c
tas2555.h

index 50a72db8fa488dd379df90af1acaf95d342363a1..e1d7c07fd8a57b58f946ed83816e908c932480ee 100755 (executable)
@@ -64,6 +64,7 @@ static void tas2555_load_configuration(struct tas2555_priv *pTAS2555,
 #define FW_ERR_SIZE -2
 
 #define TAS2555_BLOCK_PLL                      0x00
+#define TAS2555_BLOCK_MAIN_ALL         0x0d
 #define TAS2555_BLOCK_MAIN_DEV_A       0x01
 #define TAS2555_BLOCK_MAIN_DEV_B       0x08
 #define TAS2555_BLOCK_COEFF_DEV_A      0x03
@@ -119,6 +120,18 @@ static unsigned int p_tas2555_unmute_data[] = {
        0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
 };
 
+static unsigned int p_tas2555_enter_broadcast_data[] = {
+       channel_both, TAS2555_TEST_MODE_REG, 0x0d,              //enter test mode
+       channel_both, TAS2555_BROADCAST_REG, 0x81,      //enable broadcast
+       0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
+};
+
+static unsigned int p_tas2555_exit_broadcast_data[] = {
+       channel_broadcast, TAS2555_TEST_MODE_REG, 0x0d,         //enter test mode
+       channel_broadcast, TAS2555_BROADCAST_REG, 0x01, //disable broadcast
+       0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
+};
+
 static unsigned int p_tas2555_shutdown_data[] = {
        channel_both, TAS2555_SOFT_MUTE_REG, 0x01,      //soft mute
        channel_both, TAS2555_UDELAY, 10000,            //delay 10ms
@@ -700,10 +713,16 @@ static void tas2555_load_block(struct tas2555_priv *pTAS2555, TBlock * pBlock)
                ||(pBlock->mnType == TAS2555_BLOCK_COEFF_DEV_B)
                ||(pBlock->mnType == TAS2555_BLOCK_PRE_DEV_B)){
                chl = channel_right;            
+       }else if(pBlock->mnType == TAS2555_BLOCK_MAIN_ALL){
+               chl = channel_broadcast;                
        }else{
                dev_err(pTAS2555->dev, "block type error %d\n", pBlock->mnType);
                return;
        }
+       
+       if(chl == channel_broadcast){
+               tas2555_dev_load_data(pTAS2555, p_tas2555_enter_broadcast_data);
+       }
                        
        while (nCommand < pBlock->mnCommands) {
                pData = pBlock->mpData + nCommand * 4;
@@ -746,6 +765,10 @@ static void tas2555_load_block(struct tas2555_priv *pTAS2555, TBlock * pBlock)
                                nCommand += ((nLength - 2) / 4) + 1;
                }
        }
+       
+       if(chl == channel_broadcast){
+               tas2555_dev_load_data(pTAS2555, p_tas2555_exit_broadcast_data);
+       }
 }
 
 static void tas2555_load_data(struct tas2555_priv *pTAS2555, TData * pData,
index 732a562d4fde3f6acbf377111c078fcbedd56757..668e5158e05311df1770be8d76436e97668d2375 100755 (executable)
@@ -232,6 +232,19 @@ static int tas2555_change_book_page(
                        }
                }
        }       
+       
+       if(chn == channel_broadcast){
+               nResult = tas2555_i2c_write_device(pTAS2555, TAS2555_BROADCAST_ADDR, TAS2555_BOOKCTL_PAGE, 0);
+               if(nResult >= 0){
+                       tas2555_i2c_write_device(pTAS2555, TAS2555_BROADCAST_ADDR, TAS2555_BOOKCTL_REG, nBook);
+                       tas2555_i2c_write_device(pTAS2555, TAS2555_BROADCAST_ADDR, TAS2555_BOOKCTL_PAGE, nPage);
+                       pTAS2555->mnLCurrentPage = nPage;
+                       pTAS2555->mnRCurrentPage = nPage;
+                       pTAS2555->mnLCurrentBook = nBook;
+                       pTAS2555->mnRCurrentBook = nBook;               
+               }
+       }
+       
        return nResult;
 }
 
@@ -341,6 +354,10 @@ static int tas2555_dev_write(
                if(chn & channel_right){
                        nResult = tas2555_i2c_write_device(pTAS2555, pTAS2555->mnRAddr, TAS2555_PAGE_REG(nRegister), nValue);
                }       
+               
+               if(chn == channel_broadcast){
+                       nResult = tas2555_i2c_write_device(pTAS2555, TAS2555_BROADCAST_ADDR, TAS2555_PAGE_REG(nRegister), nValue);
+               }
        }
        
        mutex_unlock(&pTAS2555->dev_lock);              
@@ -463,6 +480,10 @@ static int tas2555_dev_bulk_write(
                                dev_err(pTAS2555->dev, "bulk write error %d\n", nResult);
                        }
                }
+               
+               if(chn == channel_broadcast){
+                       nResult = tas2555_i2c_bulkwrite_device(pTAS2555, TAS2555_BROADCAST_ADDR, reg, pData, nLength);
+               }
        }
        mutex_unlock(&pTAS2555->dev_lock);              
        
@@ -514,6 +535,10 @@ static int tas2555_dev_update_bits(
                if(chn&channel_right){
                        tas2555_i2c_update_bits(pTAS2555, pTAS2555->mnRAddr, TAS2555_PAGE_REG(nRegister), nMask, nValue);
                }       
+               
+               if(chn == channel_broadcast){
+                       tas2555_i2c_update_bits(pTAS2555, TAS2555_BROADCAST_ADDR, TAS2555_PAGE_REG(nRegister), nMask, nValue);
+               }
        }
                
        mutex_unlock(&pTAS2555->dev_lock);              
index 1b0b97efcf87b2727b17caaa7da88dd48889a719..3902b81cbd2e28c6e7ccc0e89fcb1d25b885b65f 100755 (executable)
--- a/tas2555.h
+++ b/tas2555.h
 #define TAS2555_HACK01_REG                     TAS2555_REG(0, 2, 10)
 
 #define TAS2555_TEST_MODE_REG                  TAS2555_REG(0, 253, 13)
+#define TAS2555_BROADCAST_REG                  TAS2555_REG(0, 253, 54)
 #define TAS2555_CRYPTIC_REG                    TAS2555_REG(0, 253, 71)
 
 //#define TAS2555__REG      TAS2555_REG(0, 1, )
 
 #define TAS2555_FW_NAME     "tas2555s_uCDSP.bin"
 
+#define TAS2555_BROADCAST_ADDR 0x4c
+
 typedef struct {
        unsigned int mnType;
        unsigned int mnCommands;
@@ -340,6 +343,7 @@ enum channel{
        channel_left = 0x01,
        channel_right = 0x02,
        channel_both = (channel_left|channel_right),
+       channel_broadcast = 0x4,
 } ;
 
 struct tas2555_priv {