(CR):Update Capsensor parameters
authoryanfei <yanfei5@huaqin.com>
Wed, 9 Jan 2019 12:36:10 +0000 (20:36 +0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:30:12 +0000 (17:30 +0800)
Update Capsensor parameters

Change-Id: Ia3ba6057a6fa6850ee1e55f6b03200bfdeb43681
Signed-off-by: yanfei <yanfei5@huaqin.com>
arch/arm64/boot/dts/exynos/wing-sensor.dtsi
drivers/input/misc/sx933x_sar.c

index af09352af5d35a9fce5b0af8c36ac326c9461ce3..3d4c3887c0de398c99211f2e12cc392f1951e79a 100755 (executable)
                0x8018 0x00
                0x801C 0x58
                0x8024 0x300014BE
-               0x8028 0x3FFE8267
+               0x8028 0x3FFE82C2
                0x802C 0x300014BE
-               0x8030 0x3FF7825B
+               0x8030 0x3FF7825F
                0x8034 0x14BE
-               0x8038 0x3FBF8269
+               0x8038 0x3FBF82C2
                0x803C 0x1446
-               0x8040 0x3DFF825F
+               0x8040 0x3DFF8261
                0x8044 0x300014BE
-               0x8048 0x2FFF82C4
+               0x8048 0x2FFF82C7
                0x804C 0x88E
                0x8050 0x80001EE6
-               0x8054 0x10163F00
+               0x8054 0x10163D00
                0x8058 0x60600031
                0x805C 0x54AC5300
                0x8060 0x00
@@ -69,7 +69,7 @@
                0x8088 0x00
                0x808C 0x1E001E00
                0x8090 0x10000
-               0x8094 0x1006C800
+               0x8094 0x1052C800
                0x8098 0x60600931
                0x809C 0x54AC4300
                0x80A0 0x00
@@ -77,7 +77,7 @@
                0x80A8 0x00
                0x80AC 0x00
                0x80B0 0x00
-               0x80B4 0x10163C00
+               0x80B4 0x10123500
                0x80B8 0x60600031
                0x80BC 0x54AC5300
                0x80C0 0x00
@@ -85,7 +85,7 @@
                0x80C8 0x00
                0x80CC 0x500050
                0x80D0 0x20000
-               0x80D4 0x1006C800
+               0x80D4 0x1052C800
                0x80D8 0x60600931
                0x80DC 0x54AC4300
                0x80E0 0x00
                0x8144 0x00
                0x8148 0x00
                0x814C 0x00 
-               0x81A4 0x1C40008>;
+               0x81A4 0x1D40008>;
                };
 
 
index f59a6c2c5638ec131401b6e358bd78a9ad32205d..943ad17acfa6c9fa9968b7320a8d6b3a7c002c09 100755 (executable)
@@ -175,10 +175,20 @@ static int sx933x_i2c_read_16bit(psx93XX_t this, u16 reg_addr, u32 *data32)
 static int read_regStat(psx93XX_t this)
 {
        u32 data = 0;
+       int ret = 0;
        if (this)
        {
-               if (sx933x_i2c_read_16bit(this,SX933X_HOSTIRQSRC_REG,&data) > 0) //bug
+               ret = sx933x_i2c_read_16bit(this,SX933X_HOSTIRQSRC_REG,&data);
+               if (ret > 0)
+               {
                        return (data & 0x00FF);
+               }
+               else
+               {
+                       LOG_DBG("%s - i2c read reg 0x%x error %d, force to process state irqs\n",
+                               __func__, SX933X_HOSTIRQSRC_REG, ret);
+                       return 0x64;
+               }
        }
        return 0;
 }
@@ -340,6 +350,7 @@ static ssize_t sx933x_register_read_store(struct device *dev,
        LOG_DBG("%s - Register(0x%2x) data(0x%4x) nirq_state(%d)\n",__func__, regist, val, nirq_state);
        return count;
 }
+#if 0
 static char* read_dbg_raw(psx93XX_t this, s32 *my_ant_raw, s32 *dlt_var_1, s32 *dlt_var_2)
 {
        u32 uData, reg_val;
@@ -367,7 +378,7 @@ static char* read_dbg_raw(psx93XX_t this, s32 *my_ant_raw, s32 *dlt_var_1, s32 *
        }
        //ph1
        else if((reg_val & (0x7 << 3)) == (1 << 3))
-       {               
+       {
                sx933x_i2c_read_16bit(this, SX933X_USEPH4_REG, &uData);
                ref_raw = (s32)uData>>10;
                sx933x_i2c_read_16bit(this, SX933X_USEPH1_REG, &uData);
@@ -393,23 +404,23 @@ static char* read_dbg_raw(psx93XX_t this, s32 *my_ant_raw, s32 *dlt_var_1, s32 *
                return "inv_raw";
        }
 }
-
+#endif
 static void read_rawData(psx93XX_t this)
 {
        u8 csx, index;
        s32 useful;
        s32 average;
        s32 diff;
-       s32 ph2_use, ph4_use, ant_raw, dlt_var_1, dlt_var_2;
-       u32 uData;
+       s32 ph2_use, ph4_use, prox_raw, dlt_var;
+       u32 uData, chip_state, dbg_ph_sel;
        u16 offset;
        int state;
-       char *ant_raw_name;
+       //char *ant_raw_name;
 
        if(this)
        {
-               sx933x_i2c_read_16bit(this, SX933X_STAT0_REG, &uData);
-               LOG_DBG("SX933X_STAT0_REG[0x8000] = 0x%08X\n", uData);
+               sx933x_i2c_read_16bit(this, SX933X_STAT0_REG, &chip_state);
+               LOG_DBG("SX933X_STAT0_REG[0x8000] = 0x%08X\n", chip_state);
 
                sx933x_i2c_read_16bit(this, SX933X_USEPH2_REG, &uData);
                ph2_use = (s32)uData >> 10;
@@ -417,11 +428,16 @@ static void read_rawData(psx93XX_t this)
                sx933x_i2c_read_16bit(this, SX933X_USEPH4_REG, &uData);
                ph4_use = (s32)uData >> 10;
 
-               ant_raw_name = read_dbg_raw(this, &ant_raw, &dlt_var_1, &dlt_var_2);
+               sx933x_i2c_read_16bit(this, 0x81A4, &dbg_ph_sel);
+               dbg_ph_sel &= ~(7<<3);
 
                for(csx =0; csx<5; csx++)
                {
                        index = csx*4;
+                       dbg_ph_sel &= ~(7<<3);
+                       dbg_ph_sel |= (csx << 3);
+                       sx933x_i2c_write_16bit(this, 0x81A4, dbg_ph_sel);
+                       msleep(2);
                        sx933x_i2c_read_16bit(this, SX933X_USEPH0_REG + index, &uData);
                        useful = (s32)uData>>10;
                        sx933x_i2c_read_16bit(this, SX933X_AVGPH0_REG + index, &uData);
@@ -430,20 +446,20 @@ static void read_rawData(psx93XX_t this)
                        diff = (s32)uData>>10;
                        sx933x_i2c_read_16bit(this, SX933X_OFFSETPH0_REG + index*2, &uData);
                        offset = (u16)(uData & 0x7FFF);
+                       sx933x_i2c_read_16bit(this, 0x81B0, &uData);
+                       prox_raw = (s32)uData>>10;
+                       sx933x_i2c_read_16bit(this, 0x81B4, &uData);
+                       dlt_var = (s32)uData >> 3;
                        state = psmtcButtons[csx].state;
                        if(csx == 0 || csx == 1)
                        {
-                               LOG_DBG("[PH: %d] ref_use = %d Useful = %d DIFF = %d state = %d %s = %d Average = %d Offset = %d "
-                    "dlt_var_1 = %d dlt_var_2 = %d\n",
-                                       csx, ph4_use, useful, diff, state, ant_raw_name, ant_raw, average, offset,
-                                       dlt_var_1, dlt_var_2);
+                               LOG_DBG("[PH:%d] ref_use= %d use= %d diff= %d state= %d chip_state= 0x%X dlt_var= %d raw= %d avg= %d offset= %d \n",
+                                               csx, ph4_use,    useful, diff,    state,    chip_state,      dlt_var,    prox_raw,average,offset);
                        }
                        else if(csx == 3)
                        {
-                               LOG_DBG("[PH: %d] ref_use = %d Useful = %d DIFF = %d state = %d %s = %d Average = %d Offset = %d "
-                    "dlt_var_1 = %d dlt_var_2 = %d\n",
-                                       csx, ph2_use, useful, diff, state, ant_raw_name, ant_raw, average, offset,
-                                       dlt_var_1, dlt_var_2);
+                               LOG_DBG("[PH:%d] ref_use= %d use= %d diff= %d state= %d chip_state= 0x%X dlt_var= %d raw= %d avg= %d offset= %d \n",
+                                               csx, ph2_use,    useful, diff,    state,    chip_state,      dlt_var,    prox_raw,average,offset);
                        }
                        else
                        {
@@ -461,7 +477,7 @@ static ssize_t sx933x_all_reg_data_show(struct device *dev, struct device_attrib
        int i;
        psx93XX_t this = dev_get_drvdata(dev);
 
-       p += snprintf(p, PAGE_SIZE, "DRV_VER=%s\n", "1_decrease_init_time");
+       p += snprintf(p, PAGE_SIZE, "DRV_VER=%s\n", "09_show_dlt_var");
 
        for (i = 0; i < ARRAY_SIZE(sx933x_i2c_reg_setup); i++)
        {
@@ -477,7 +493,7 @@ static ssize_t sx933x_all_reg_data_show(struct device *dev, struct device_attrib
                        val &= ~0x7FFF;
                }
                
-               p += snprintf(p, PAGE_SIZE, "(reg,val) = (0x%X,0x%02X);\n", regist,val);
+               p += snprintf(p, PAGE_SIZE, "(reg,val)= (0x%X,0x%02X);\n", regist,val);
        }
        return (p-buf);
 }