int mxt_gripsuppression_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_PROCI_GRIPSUPPRESSION_T40); obj_size = MXT_GET_SIZE(MXT_PROCI_GRIPSUPPRESSION_T40); gripsuppression_t40_config.ctrl = T40_CTRL; gripsuppression_t40_config.xlogrip = T40_XLOGRIP; gripsuppression_t40_config.xhigrip = T40_XHIGRIP; gripsuppression_t40_config.ylogrip = T40_YLOGRIP; gripsuppression_t40_config.yhigrip = T40_YHIGRIP; #if !defined (CONFIG_MACH_BOSE_ATT) error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&gripsuppression_t40_config); #else error = mxt_write_block(client, obj_addr, obj_size, (u8 *)t40_config_e); #endif if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_comc_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_SPT_COMMSCONFIG_T18); obj_size = MXT_GET_SIZE(MXT_SPT_COMMSCONFIG_T18); comc_config.ctrl = T18_CTRL; comc_config.cmd = T18_COMMAND; #if !defined (CONFIG_MACH_BOSE_ATT) error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&comc_config); #else error = mxt_write_block(client, obj_addr, obj_size, (u8 *)t18_config_e); #endif if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_userdata_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_USER_INFO_T38); obj_size = MXT_GET_SIZE(MXT_USER_INFO_T38); if(T38_USERDATA0 != 0) userdata_t38.data[0] = T38_USERDATA0; if(T38_USERDATA1 != 0) userdata_t38.data[1] = T38_USERDATA1; if(T38_USERDATA2 != 0) userdata_t38.data[2] = T38_USERDATA2; if(T38_USERDATA3 != 0) userdata_t38.data[3] = T38_USERDATA3; if(T38_USERDATA4 != 0) userdata_t38.data[4] = T38_USERDATA4; if(T38_USERDATA5 != 0) userdata_t38.data[5] = T38_USERDATA5; if(T38_USERDATA6 != 0) userdata_t38.data[6] = T38_USERDATA6; if(T38_USERDATA7 != 0) userdata_t38.data[7] = T38_USERDATA7; error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&userdata_t38); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_power_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_GEN_POWERCONFIG_T7); obj_size = MXT_GET_SIZE(MXT_GEN_POWERCONFIG_T7); power_config.idleacqint = T7_IDLEACQINT; /* Set Idle Acquisition Interval to 32 ms. */ power_config.actvacqint = T7_ACTVACQINT; /* Set Active Acquisition Interval to 16 ms. */ ; power_config.actv2idleto = T7_ACTV2IDLETO; /* Set Active to Idle Timeout to 4 s (one unit = 200ms). */ #if !defined (CONFIG_MACH_BOSE_ATT) error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&power_config); #else error = mxt_write_block(client, obj_addr, obj_size, (u8 *)t7_config_e); #endif if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_proximity_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_TOUCH_PROXIMITY_T23); obj_size = MXT_GET_SIZE(MXT_TOUCH_PROXIMITY_T23); proximity_config.ctrl = T23_CTRL; proximity_config.xorigin = T23_XORIGIN; proximity_config.yorigin = T23_YORIGIN; proximity_config.xsize = T23_XSIZE; proximity_config.ysize = T23_YSIZE; proximity_config.reserved = T23_RESERVED; proximity_config.blen = T23_BLEN; proximity_config.fxddthr = T23_FXDDTHR; proximity_config.fxddi = T23_FXDDI; proximity_config.average = T23_AVERAGE; proximity_config.mvnullrate = T23_MVNULLRATE; proximity_config.mvdthr = T23_MVDTHR; error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&proximity_config); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_one_touch_gesture_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_PROCI_ONETOUCHGESTUREPROCESSOR_T24); obj_size = MXT_GET_SIZE(MXT_PROCI_ONETOUCHGESTUREPROCESSOR_T24); /* Disable one touch gestures. */ onetouch_gesture_config.ctrl = T24_CTRL ; onetouch_gesture_config.numgest = T24_NUMGEST ; onetouch_gesture_config.gesten = T24_GESTEN ; onetouch_gesture_config.process = T24_PROCESS ; onetouch_gesture_config.tapto = T24_TAPTO ; onetouch_gesture_config.flickto = T24_FLICKTO ; onetouch_gesture_config.dragto = T24_DRAGTO ; onetouch_gesture_config.spressto = T24_SPRESSTO ; onetouch_gesture_config.lpressto = T24_LPRESSTO ; onetouch_gesture_config.reppressto = T24_REPPRESSTO; onetouch_gesture_config.flickthr = T24_FLICKTHR ; onetouch_gesture_config.dragthr = T24_DRAGTHR ; onetouch_gesture_config.tapthr = T24_TAPTHR ; onetouch_gesture_config.throwthr = T24_THROWTHR ; error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&onetouch_gesture_config); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_cte_t46_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_SPT_CTECONFIG_T46); obj_size = MXT_GET_SIZE(MXT_SPT_CTECONFIG_T46); /* Set CTE config */ cte_t46_config.ctrl = T46_CTRL; cte_t46_config.mode = T46_MODE; cte_t46_config.idlesyncsperx = T46_IDLESYNCSPERX; cte_t46_config.actvsyncsperx = T46_ACTVSYNCSPERX; cte_t46_config.adcspersync = T46_ADCSPERSYNC; cte_t46_config.pulsesperadc = T46_PULSESPERADC; cte_t46_config.xslew = T46_XSLEW; cte_t46_config.syncdelay = T46_SYNCDELAY; /* Write CTE config to chip. */ error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&cte_t46_config); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_gpio_pwm_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_SPT_GPIOPWM_T19); obj_size = MXT_GET_SIZE(MXT_SPT_GPIOPWM_T19); gpiopwm_config.ctrl = T19_CTRL ; gpiopwm_config.reportmask = T19_REPORTMASK; gpiopwm_config.dir = T19_DIR ; gpiopwm_config.intpullup = T19_INTPULLUP ; gpiopwm_config.out = T19_OUT ; gpiopwm_config.wake = T19_WAKE ; gpiopwm_config.pwm = T19_PWM ; gpiopwm_config.period = T19_PERIOD ; gpiopwm_config.duty[0] = T19_DUTY_0 ; gpiopwm_config.duty[1] = T19_DUTY_1 ; gpiopwm_config.duty[2] = T19_DUTY_2 ; gpiopwm_config.duty[3] = T19_DUTY_3 ; gpiopwm_config.trigger[0] = T19_TRIGGER_0 ; gpiopwm_config.trigger[1] = T19_TRIGGER_1 ; gpiopwm_config.trigger[2] = T19_TRIGGER_2 ; gpiopwm_config.trigger[3] = T19_TRIGGER_3 ; error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&gpiopwm_config); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_acquisition_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_GEN_ACQUIRECONFIG_T8); obj_size = MXT_GET_SIZE(MXT_GEN_ACQUIRECONFIG_T8); acquisition_config.chrgtime = T8_CHRGTIME; acquisition_config.reserved = T8_ATCHDRIFT; acquisition_config.tchdrift = T8_TCHDRIFT; acquisition_config.driftst = T8_DRIFTST; acquisition_config.tchautocal = T8_TCHAUTOCAL; acquisition_config.sync = T8_SYNC; acquisition_config.atchcalst = T8_ATCHCALST; acquisition_config.atchcalsthr = T8_ATCHCALSTHR; acquisition_config.atchcalfrcthr = T8_ATCHFRCCALTHR; /*!< Anti-touch force calibration threshold */ acquisition_config.atchcalfrcratio = T8_ATCHFRCCALRATIO; /*!< Anti-touch force calibration ratio */ error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&acquisition_config); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_touch_suppression_t42_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_PROCI_TOUCHSUPPRESSION_T42); obj_size = MXT_GET_SIZE(MXT_PROCI_TOUCHSUPPRESSION_T42); touchsuppression_t42_config.ctrl = T42_CTRL; touchsuppression_t42_config.apprthr = T42_APPRTHR; touchsuppression_t42_config.maxapprarea = T42_MAXAPPRAREA; touchsuppression_t42_config.maxtcharea = T42_MAXTCHAREA; touchsuppression_t42_config.supstrength = T42_SUPSTRENGTH; touchsuppression_t42_config.supextto = T42_SUPEXTTO; touchsuppression_t42_config.maxnumtchs = T42_MAXNUMTCHS; touchsuppression_t42_config.shapestrength = T42_SHAPESTRENGTH; error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&touchsuppression_t42_config); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
static int mxt_other_configs(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error = 0, i = 0; u8 addr = 0; u8 obj_data[65]; u8 obj_type[MXT_MAX_OBJECT_TYPES] = { MXT_TOUCH_KEYARRAY_T15, MXT_SPT_COMMSCONFIG_T18, MXT_PROCI_ONETOUCHGESTUREPROCESSOR_T24, MXT_PROCI_TWOTOUCHGESTUREPROCESSOR_T27, MXT_SPT_DIGITIZER_T43, 0, }; for (i= 0; i < 20; i++) obj_data[i] = 0; for (i= 0; i < MXT_MAX_OBJECT_TYPES; i++) { if (0 == obj_type[i]) break; else addr = obj_type[i]; obj_addr = MXT_BASE_ADDR(addr); obj_size = MXT_GET_SIZE(addr); error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&obj_data); if (error < 0) { dev_err(&client->dev, "mxt_write_byte failed!\n"); return -EIO; } } return 0; }
int mxt_stylus_t47_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_PROCI_STYLUS_T47); obj_size = MXT_GET_SIZE(MXT_PROCI_STYLUS_T47); stylus_t47_config.ctrl = T47_CTRL; stylus_t47_config.contmin = T47_CONTMIN; stylus_t47_config.contmax = T47_CONTMAX; stylus_t47_config.stability = T47_STABILITY; stylus_t47_config.maxtcharea = T47_MAXTCHAREA; stylus_t47_config.amplthr = T47_AMPLTHR; stylus_t47_config.styshape = T47_STYSHAPE; stylus_t47_config.hoversup = T47_HOVERSUP; stylus_t47_config.confthr = T47_CONFTHR; stylus_t47_config.syncsperx = T47_SYNCSPERX; error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&stylus_t47_config); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_selftest_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_SPT_SELFTEST_T25); obj_size = MXT_GET_SIZE(MXT_SPT_SELFTEST_T25); selftest_config.ctrl = T25_CTRL; selftest_config.cmd = T25_CMD; /* Multiple Touch Touchscreen T9 */ selftest_config.siglim[0].upsiglim = T25_SIGLIM_0_UPSIGLIM; selftest_config.siglim[0].losiglim = T25_SIGLIM_0_LOSIGLIM; /* Key Array T15 */ selftest_config.siglim[1].upsiglim = T25_SIGLIM_1_UPSIGLIM; selftest_config.siglim[1].losiglim = T25_SIGLIM_1_LOSIGLIM; /* Proximity T23 */ selftest_config.siglim[2].upsiglim = T25_SIGLIM_2_UPSIGLIM; selftest_config.siglim[2].losiglim = T25_SIGLIM_2_LOSIGLIM; error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&selftest_config); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_keyarray_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_TOUCH_KEYARRAY_T15); obj_size = MXT_GET_SIZE(MXT_TOUCH_KEYARRAY_T15); keyarray_config.ctrl = T15_CTRL; if ((mxt->pdata->board_rev <= 9) || (mxt->pdata->board_rev >= 13)) { keyarray_config.xorigin = T15_XORIGIN; keyarray_config.xsize = T15_XSIZE; } else { /* board rev1.0~1.2, touch key is 4 key array */ keyarray_config.xorigin = T15_XORIGIN_4KEY; keyarray_config.xsize = T15_XSIZE_4KEY; } keyarray_config.yorigin = T15_YORIGIN; keyarray_config.ysize = T15_YSIZE; keyarray_config.akscfg = T15_AKSCFG; keyarray_config.blen = T15_BLEN; keyarray_config.tchthr = T15_TCHTHR; keyarray_config.tchdi = T15_TCHDI; keyarray_config.reserved[0] = T15_RESERVED_0; keyarray_config.reserved[1] = T15_RESERVED_1; error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&keyarray_config); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_multitouch_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_TOUCH_MULTITOUCHSCREEN_T9); obj_size = MXT_GET_SIZE(MXT_TOUCH_MULTITOUCHSCREEN_T9); touchscreen_config.ctrl = T9_CTRL; touchscreen_config.xorigin = T9_XORIGIN; touchscreen_config.yorigin = T9_YORIGIN; touchscreen_config.xsize = T9_XSIZE; touchscreen_config.ysize = T9_YSIZE; touchscreen_config.akscfg = T9_AKSCFG; touchscreen_config.blen = T9_BLEN; touchscreen_config.tchthr = T9_TCHTHR; touchscreen_config.tchdi = T9_TCHDI; touchscreen_config.orient = T9_ORIENT; touchscreen_config.mrgtimeout = T9_MRGTIMEOUT; touchscreen_config.movhysti = T9_MOVHYSTI; touchscreen_config.movhystn = T9_MOVHYSTN; touchscreen_config.movfilter = T9_MOVFILTER; touchscreen_config.numtouch = T9_NUMTOUCH; touchscreen_config.mrghyst = T9_MRGHYST; touchscreen_config.mrgthr = T9_MRGTHR; touchscreen_config.amphyst = T9_AMPHYST; touchscreen_config.xrange = T9_XRANGE; touchscreen_config.yrange = T9_YRANGE; touchscreen_config.xloclip = T9_XLOCLIP; touchscreen_config.xhiclip = T9_XHICLIP; touchscreen_config.yloclip = T9_YLOCLIP; touchscreen_config.yhiclip = T9_YHICLIP; touchscreen_config.xedgectrl = T9_XEDGECTRL; touchscreen_config.xedgedist = T9_XEDGEDIST; touchscreen_config.yedgectrl = T9_YEDGECTRL; touchscreen_config.yedgedist = T9_YEDGEDIST; touchscreen_config.jumplimit = T9_JUMPLIMIT; touchscreen_config.tchhyst = T9_TCHHYST; touchscreen_config.xpitch = T9_XPITCH; touchscreen_config.ypitch = T9_YPITCH; touchscreen_config.nexttchdi = T9_NEXTTCHDI; #if !defined (CONFIG_MACH_BOSE_ATT) error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&touchscreen_config); #else error = mxt_write_block(client, obj_addr, obj_size, (u8 *)t9_config_e); #endif if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_get_object_values(struct mxt_data *mxt, u8 *buf, int obj_type) { u8 *obj = NULL; u16 obj_size = 0; switch (obj_type) { case MXT_GEN_POWERCONFIG_T7: obj = (u8 *)&mxt->pdata->power_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_GEN_ACQUIRECONFIG_T8: obj = (u8 *)&mxt->pdata->acquisition_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_TOUCH_MULTITOUCHSCREEN_T9: obj = (u8 *)&mxt->pdata->touchscreen_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_PROCG_NOISESUPPRESSION_T22: obj = (u8 *)&mxt->pdata->noise_suppression_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_SPT_CTECONFIG_T28: obj = (u8 *)&mxt->pdata->cte_config; obj_size = MXT_GET_SIZE(obj_type); break; default: pr_err("Not supporting object type (object type: %d)", obj_type); return -1; } pr_info("obj type: %d, obj size: %d", obj_type, obj_size); if (memcpy(buf, obj, obj_size) == NULL) { pr_err("memcpy failed!"); return -1; } return 0; }
int mxt_multitouch_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_TOUCH_MULTITOUCHSCREEN_T9); obj_size = MXT_GET_SIZE(MXT_TOUCH_MULTITOUCHSCREEN_T9); /*pr_info("address: 0x%x, size: %d", obj_addr, obj_size);*/ /*touchscreen_config initial values are got from platform_data*/ error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&mxt->pdata->touchscreen_config); if (error < 0) { dev_err(&client->dev, "mxt_write_byte failed!\n"); return -EIO; } return 0; }
static int mxt_acquisition_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_GEN_ACQUIRECONFIG_T8); obj_size = MXT_GET_SIZE(MXT_GEN_ACQUIRECONFIG_T8); /*pr_info("address: 0x%x, size: %d", obj_addr, obj_size);*/ /*acquisition_config initial values are got from platform_data*/ error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&mxt->pdata->acquisition_config); if (error < 0) { dev_err(&client->dev, "mxt_write_byte failed!\n"); return -EIO; } return 0; }
static int mxt_palmsuppression_config(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_PROCI_PALMSUPPRESSION_T41); obj_size = MXT_GET_SIZE(MXT_PROCI_PALMSUPPRESSION_T41); /*pr_info("address: 0x%x, size: %d", obj_addr, obj_size);*/ /*palmsupression_config initial values are got from platform_data*/ error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&mxt->pdata->palmsupression_config); if (error < 0) { dev_err(&client->dev, "mxt_write_byte failed!\n"); return -EIO; } return 0; }
int mxt_noisesuppression_t48_config_for_TA(struct mxt_data *mxt) { struct i2c_client *client = mxt->client; u16 obj_addr, obj_size; int error; obj_addr = MXT_BASE_ADDR(MXT_PROCG_NOISESUPPRESSION_T48); obj_size = MXT_GET_SIZE(MXT_PROCG_NOISESUPPRESSION_T48); noisesuppression_t48_config.ctrl = T48_CTRL_TA ; noisesuppression_t48_config.cfg = T48_CFG_TA; noisesuppression_t48_config.calcfg = T48_CALCFG_TA; noisesuppression_t48_config.basefreq = T48_BASEFREQ_TA; noisesuppression_t48_config.freq_0 = T48_RESERVED0_TA; noisesuppression_t48_config.freq_1 = T48_RESERVED1_TA; noisesuppression_t48_config.freq_2 = T48_RESERVED2_TA; noisesuppression_t48_config.freq_3 = T48_RESERVED3_TA; noisesuppression_t48_config.mffreq_2 = T48_MFFREQ_2_TA; noisesuppression_t48_config.mffreq_3 = T48_MFFREQ_3_TA; noisesuppression_t48_config.nlgain = T48_RESERVED4_TA; noisesuppression_t48_config.nlthr = T48_RESERVED5_TA; noisesuppression_t48_config.gclimit = T48_RESERVED6_TA; noisesuppression_t48_config.gcactvinvldadcs = T48_GCACTVINVLDADCS_TA; noisesuppression_t48_config.gcidleinvldadcs = T48_GCIDLEINVLDADCS_TA; noisesuppression_t48_config.gcinvalidthr = T48_RESERVED7_TA; /* noisesuppression_t48_config.reserved8 = T48_RESERVED8_TA ; */ noisesuppression_t48_config.gcmaxadcsperx = T48_GCMAXADCSPERX_TA; noisesuppression_t48_config.gclimitmin = T48_GCLIMITMIN_TA; noisesuppression_t48_config.gclimitmax = T48_GCLIMITMAX_TA; noisesuppression_t48_config.gccountmintgt = T48_GCCOUNTMINTGT_TA; noisesuppression_t48_config.mfinvlddiffthr = T48_MFINVLDDIFFTHR_TA; noisesuppression_t48_config.mfincadcspxthr = T48_MFINCADCSPXTHR_TA; noisesuppression_t48_config.mferrorthr = T48_MFERRORTHR_TA; noisesuppression_t48_config.selfreqmax = T48_SELFREQMAX_TA; noisesuppression_t48_config.reserved9 = T48_RESERVED9_TA; noisesuppression_t48_config.reserved10 = T48_RESERVED10_TA; noisesuppression_t48_config.reserved11 = T48_RESERVED11_TA; noisesuppression_t48_config.reserved12 = T48_RESERVED12_TA; noisesuppression_t48_config.reserved13 = T48_RESERVED13_TA; noisesuppression_t48_config.reserved14 = T48_RESERVED14_TA; noisesuppression_t48_config.blen = T48_BLEN_TA; noisesuppression_t48_config.tchthr = T48_TCHTHR_TA; noisesuppression_t48_config.tchdi = T48_TCHDI_TA; noisesuppression_t48_config.movhysti = T48_MOVHYSTI_TA; noisesuppression_t48_config.movhystn = T48_MOVHYSTN_TA; noisesuppression_t48_config.movfilter = T48_MOVFILTER_TA; noisesuppression_t48_config.numtouch = T48_NUMTOUCH_TA; noisesuppression_t48_config.mrghyst = T48_MRGHYST_TA; noisesuppression_t48_config.mrgthr = T48_MRGTHR_TA; noisesuppression_t48_config.xloclip = T48_XLOCLIP_TA; noisesuppression_t48_config.xhiclip = T48_XHICLIP_TA; noisesuppression_t48_config.yloclip = T48_YLOCLIP_TA; noisesuppression_t48_config.yhiclip = T48_YHICLIP_TA; noisesuppression_t48_config.xedgectrl = T48_XEDGECTRL_TA; noisesuppression_t48_config.xedgedist = T48_XEDGEDIST_TA; noisesuppression_t48_config.yedgectrl = T48_YEDGECTRL_TA; noisesuppression_t48_config.yedgedist = T48_YEDGEDIST_TA; noisesuppression_t48_config.jumplimit = T48_JUMPLIMIT_TA; noisesuppression_t48_config.tchhyst = T48_TCHHYST_TA; noisesuppression_t48_config.nexttchdi = T48_NEXTTCHDI_TA; error = mxt_write_block(client, obj_addr, obj_size, (u8 *)&noisesuppression_t48_config); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_get_object_values(struct mxt_data *mxt, int obj_type) { struct i2c_client *client = mxt->client; u8 *obj = NULL; u16 obj_size = 0; u16 obj_addr = 0; int error; switch (obj_type) { case MXT_GEN_POWERCONFIG_T7: obj = (u8 *)&power_config; break; case MXT_GEN_ACQUIRECONFIG_T8: obj = (u8 *)&acquisition_config; break; case MXT_TOUCH_MULTITOUCHSCREEN_T9: obj = (u8 *)&touchscreen_config; break; case MXT_PROCI_GRIPSUPPRESSION_T40: obj = (u8 *)&gripsuppression_t40_config; break; case MXT_PROCI_TOUCHSUPPRESSION_T42: obj = (u8 *)&touchsuppression_t42_config; break; case MXT_SPT_CTECONFIG_T46: obj = (u8 *)&cte_t46_config; break; case MXT_PROCI_STYLUS_T47: obj = (u8 *)&stylus_t47_config; break; case MXT_PROCG_NOISESUPPRESSION_T48: obj = (u8 *)&noisesuppression_t48_config; break; case MXT_USER_INFO_T38: obj = (u8 *)&userdata_t38; break; default: pr_err("[TSP] Not supporting object type (object type: %d)", obj_type); return -1; } obj_addr = MXT_BASE_ADDR(obj_type); obj_size = MXT_GET_SIZE(obj_type); if ((obj_addr == 0) || (obj_size == 0)) { pr_err("[TSP] Not supporting object type (object type: %d)", obj_type); return -1; } error = mxt_read_block(client, obj_addr, obj_size, obj); if (error < 0) { dev_err(&client->dev, "[TSP] mxt_write_block failed! (%s, %d)\n", __func__, __LINE__); return -EIO; } return 0; }
int mxt_copy_object(struct mxt_data *mxt, u8 *buf, int obj_type) { u8 *obj = NULL; u16 obj_size = 0; switch (obj_type) { case MXT_GEN_POWERCONFIG_T7: obj = (u8 *)&power_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_GEN_ACQUIRECONFIG_T8: obj = (u8 *)&acquisition_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_TOUCH_MULTITOUCHSCREEN_T9: obj = (u8 *)&touchscreen_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_PROCI_GRIPSUPPRESSION_T40: obj = (u8 *)&gripsuppression_t40_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_PROCI_TOUCHSUPPRESSION_T42: obj = (u8 *)&touchsuppression_t42_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_SPT_CTECONFIG_T46: obj = (u8 *)&cte_t46_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_PROCI_STYLUS_T47: obj = (u8 *)&stylus_t47_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_PROCG_NOISESUPPRESSION_T48: obj = (u8 *)&noisesuppression_t48_config; obj_size = MXT_GET_SIZE(obj_type); break; case MXT_USER_INFO_T38: obj = (u8 *)&userdata_t38; obj_size = MXT_GET_SIZE(obj_type); break; default: pr_err("[TSP] Not supporting object type (object type: %d)", obj_type); return -1; } pr_info("[TSP] obj type: %d, obj size: %d", obj_type, obj_size); if (memcpy(buf, obj, obj_size) == NULL) { pr_err("[TSP] memcpy failed! (%s, %d)\n", __func__, __LINE__); return -1; } return 0; }