add channel
authora0220410 <peter-li@ti.com>
Thu, 15 Dec 2016 00:21:58 +0000 (08:21 +0800)
committera0220410 <peter-li@ti.com>
Thu, 15 Dec 2016 00:21:58 +0000 (08:21 +0800)
dts.readme
tas2557-core.c
tas2557.h

index 2a9a377691b5128cc34e11bacee50ac188e2f305..b936a9971b5ed087ed11c890dacc3d28c48695f3 100755 (executable)
@@ -4,6 +4,7 @@ example for dts:
                        compatible = "ti,tas2557";
                        reg = <0x4c>;                   
                        ti,cdc-reset-gpio = <&msmgpio 73 0>;
+                       ti,channel = <0>;   /* 0, left channel; 1, right channel */
                        ti,load = <0>;   /* 0, 8Ohm; 1, 6Ohm; 2, 4Ohm */
                        status = "ok";
                };
\ No newline at end of file
index e66ca69eecba3fc3ec52ec9c9373a8e44ee40706..a680b14d7b8752434beb0467f3d9b8404f8301b3 100755 (executable)
@@ -276,6 +276,11 @@ int tas2557_load_platdata(struct tas2557_priv *pTAS2557)
        int ret = 0;
        
        ret = tas2557_setLoad(pTAS2557, pTAS2557->mnLoad);
+       if(pTAS2557->mnDevChl == LEFT_CHANNEL){
+               pTAS2557->update_bits(pTAS2557, TAS2557_ASI_CTRL_REG, 0x06, 0x00);
+       }else if(pTAS2557->mnDevChl == LEFT_CHANNEL){
+               pTAS2557->update_bits(pTAS2557, TAS2557_ASI_CTRL_REG, 0x06, 0x02);
+       }
                
        return ret;
 }
@@ -1196,6 +1201,15 @@ int tas2557_parse_dt(struct device *dev,
                dev_dbg(pTAS2557->dev, "ti,load=%d", pTAS2557->mnLoad);
        }
 
+       rc = of_property_read_u32(np, "ti,channel", &pTAS2557->mnDevChl);
+       if (rc) {
+               dev_err(pTAS2557->dev, "Looking up %s property in node %s failed %d\n",
+                       "ti,channel", np->full_name, rc);
+               ret = -1;
+       }else{
+               dev_dbg(pTAS2557->dev, "ti,channel=%d", pTAS2557->mnDevChl);
+       }
+       
        pTAS2557->mnResetGPIO = of_get_named_gpio(np,
                                "ti,cdc-reset-gpio", 0);
        if (pTAS2557->mnResetGPIO < 0) {
index ebd119a2468a3d80c0b37b0c1427c02dbb48861b..efd928bade75c0c5203abc2ee5d4cb703f1aca3d 100755 (executable)
--- a/tas2557.h
+++ b/tas2557.h
@@ -70,7 +70,7 @@
 #define TAS2557_CRC_CHECKSUM_REG               TAS2557_REG(0, 0, 32)
 #define TAS2557_CRC_RESET_REG                  TAS2557_REG(0, 0, 33)
 #define TAS2557_DSP_MODE_SELECT_REG            TAS2557_REG(0, 0, 34)
-#define TAS2557_NONAME42_REG                   TAS2557_REG(0, 0, 42)
+#define TAS2557_ASI_CTRL_REG                   TAS2557_REG(0, 0, 42)
 #define TAS2557_CLK_ERR_CTRL                   TAS2557_REG(0, 0, 44)
 #define TAS2557_DBOOST_CFG_REG                 TAS2557_REG(0, 0, 52)
 #define TAS2557_POWER_UP_FLAG_REG              TAS2557_REG(0, 0, 100)
 
 #define TAS2557_FW_NAME     "tas2557_uCDSP.bin"
 
+#define LEFT_CHANNEL   0
+#define RIGHT_CHANNEL  1
+
 typedef struct {
        unsigned int mnType;
        unsigned int mnCommands;
@@ -361,6 +364,7 @@ struct tas2557_priv {
        unsigned int mnCurrentCalibration;
        int mnCurrentBook;
        int mnCurrentPage;
+       int mnDevChl;
        bool mbTILoadActive;
        bool mbPowerUp;
        bool mbLoadConfigurationPostPowerUp;