Lines Matching full:tsc

50 static int tps6507x_read_u8(struct tps6507x_ts *tsc, u8 reg, u8 *data)  in tps6507x_read_u8()  argument
52 return tsc->mfd->read_dev(tsc->mfd, reg, 1, data); in tps6507x_read_u8()
55 static int tps6507x_write_u8(struct tps6507x_ts *tsc, u8 reg, u8 data) in tps6507x_write_u8() argument
57 return tsc->mfd->write_dev(tsc->mfd, reg, 1, &data); in tps6507x_write_u8()
60 static s32 tps6507x_adc_conversion(struct tps6507x_ts *tsc, in tps6507x_adc_conversion() argument
69 ret = tps6507x_write_u8(tsc, TPS6507X_REG_TSCMODE, tsc_mode); in tps6507x_adc_conversion()
71 dev_err(tsc->dev, "TSC mode read failed\n"); in tps6507x_adc_conversion()
77 ret = tps6507x_write_u8(tsc, TPS6507X_REG_ADCONFIG, in tps6507x_adc_conversion()
80 dev_err(tsc->dev, "ADC config write failed\n"); in tps6507x_adc_conversion()
85 ret = tps6507x_read_u8(tsc, TPS6507X_REG_ADCONFIG, in tps6507x_adc_conversion()
88 dev_err(tsc->dev, "ADC config read failed\n"); in tps6507x_adc_conversion()
93 ret = tps6507x_read_u8(tsc, TPS6507X_REG_ADRESULT_2, &result); in tps6507x_adc_conversion()
95 dev_err(tsc->dev, "ADC result 2 read failed\n"); in tps6507x_adc_conversion()
101 ret = tps6507x_read_u8(tsc, TPS6507X_REG_ADRESULT_1, &result); in tps6507x_adc_conversion()
103 dev_err(tsc->dev, "ADC result 1 read failed\n"); in tps6507x_adc_conversion()
109 dev_dbg(tsc->dev, "TSC channel %d = 0x%X\n", tsc_mode, *value); in tps6507x_adc_conversion()
119 static s32 tps6507x_adc_standby(struct tps6507x_ts *tsc) in tps6507x_adc_standby() argument
124 ret = tps6507x_write_u8(tsc, TPS6507X_REG_ADCONFIG, in tps6507x_adc_standby()
129 ret = tps6507x_write_u8(tsc, TPS6507X_REG_TSCMODE, in tps6507x_adc_standby()
134 ret = tps6507x_read_u8(tsc, TPS6507X_REG_INT, &val); in tps6507x_adc_standby()
140 ret = tps6507x_read_u8(tsc, TPS6507X_REG_INT, &val); in tps6507x_adc_standby()
150 struct tps6507x_ts *tsc = input_get_drvdata(input_dev); in tps6507x_ts_poll() local
154 ret = tps6507x_adc_conversion(tsc, TPS6507X_TSCMODE_PRESSURE, in tps6507x_ts_poll()
155 &tsc->tc.pressure); in tps6507x_ts_poll()
159 pendown = tsc->tc.pressure > tsc->min_pressure; in tps6507x_ts_poll()
161 if (unlikely(!pendown && tsc->pendown)) { in tps6507x_ts_poll()
162 dev_dbg(tsc->dev, "UP\n"); in tps6507x_ts_poll()
166 tsc->pendown = false; in tps6507x_ts_poll()
171 if (!tsc->pendown) { in tps6507x_ts_poll()
172 dev_dbg(tsc->dev, "DOWN\n"); in tps6507x_ts_poll()
175 dev_dbg(tsc->dev, "still down\n"); in tps6507x_ts_poll()
177 ret = tps6507x_adc_conversion(tsc, TPS6507X_TSCMODE_X_POSITION, in tps6507x_ts_poll()
178 &tsc->tc.x); in tps6507x_ts_poll()
182 ret = tps6507x_adc_conversion(tsc, TPS6507X_TSCMODE_Y_POSITION, in tps6507x_ts_poll()
183 &tsc->tc.y); in tps6507x_ts_poll()
187 input_report_abs(input_dev, ABS_X, tsc->tc.x); in tps6507x_ts_poll()
188 input_report_abs(input_dev, ABS_Y, tsc->tc.y); in tps6507x_ts_poll()
189 input_report_abs(input_dev, ABS_PRESSURE, tsc->tc.pressure); in tps6507x_ts_poll()
191 tsc->pendown = true; in tps6507x_ts_poll()
195 tps6507x_adc_standby(tsc); in tps6507x_ts_poll()
203 struct tps6507x_ts *tsc; in tps6507x_ts_probe() local
224 tsc = devm_kzalloc(&pdev->dev, sizeof(struct tps6507x_ts), GFP_KERNEL); in tps6507x_ts_probe()
225 if (!tsc) { in tps6507x_ts_probe()
230 tsc->mfd = tps6507x_dev; in tps6507x_ts_probe()
231 tsc->dev = tps6507x_dev->dev; in tps6507x_ts_probe()
232 tsc->min_pressure = init_data ? in tps6507x_ts_probe()
235 snprintf(tsc->phys, sizeof(tsc->phys), in tps6507x_ts_probe()
236 "%s/input0", dev_name(tsc->dev)); in tps6507x_ts_probe()
240 dev_err(tsc->dev, "Failed to allocate polled input device.\n"); in tps6507x_ts_probe()
244 tsc->input = input_dev; in tps6507x_ts_probe()
245 input_set_drvdata(input_dev, tsc); in tps6507x_ts_probe()
253 input_dev->phys = tsc->phys; in tps6507x_ts_probe()
254 input_dev->dev.parent = tsc->dev; in tps6507x_ts_probe()
262 error = tps6507x_adc_standby(tsc); in tps6507x_ts_probe()