Lines Matching refs:tsi
28 static void da9052_ts_adc_toggle(struct da9052_tsi *tsi, bool on) in da9052_ts_adc_toggle() argument
30 da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 0, on); in da9052_ts_adc_toggle()
31 tsi->adc_on = on; in da9052_ts_adc_toggle()
36 struct da9052_tsi *tsi = data; in da9052_ts_pendwn_irq() local
38 if (!tsi->stopped) { in da9052_ts_pendwn_irq()
40 da9052_disable_irq_nosync(tsi->da9052, DA9052_IRQ_PENDOWN); in da9052_ts_pendwn_irq()
41 da9052_enable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); in da9052_ts_pendwn_irq()
43 da9052_ts_adc_toggle(tsi, true); in da9052_ts_pendwn_irq()
45 schedule_delayed_work(&tsi->ts_pen_work, HZ / 50); in da9052_ts_pendwn_irq()
51 static void da9052_ts_read(struct da9052_tsi *tsi) in da9052_ts_read() argument
53 struct input_dev *input = tsi->dev; in da9052_ts_read()
58 ret = da9052_reg_read(tsi->da9052, DA9052_TSI_X_MSB_REG); in da9052_ts_read()
64 ret = da9052_reg_read(tsi->da9052, DA9052_TSI_Y_MSB_REG); in da9052_ts_read()
70 ret = da9052_reg_read(tsi->da9052, DA9052_TSI_Z_MSB_REG); in da9052_ts_read()
76 ret = da9052_reg_read(tsi->da9052, DA9052_TSI_LSB_REG); in da9052_ts_read()
95 struct da9052_tsi *tsi = data; in da9052_ts_datardy_irq() local
97 da9052_ts_read(tsi); in da9052_ts_datardy_irq()
104 struct da9052_tsi *tsi = container_of(work, struct da9052_tsi, in da9052_ts_pen_work() local
106 if (!tsi->stopped) { in da9052_ts_pen_work()
107 int ret = da9052_reg_read(tsi->da9052, DA9052_TSI_LSB_REG); in da9052_ts_pen_work()
110 schedule_delayed_work(&tsi->ts_pen_work, HZ / 50); in da9052_ts_pen_work()
112 struct input_dev *input = tsi->dev; in da9052_ts_pen_work()
115 da9052_ts_adc_toggle(tsi, false); in da9052_ts_pen_work()
126 ret = da9052_reg_update(tsi->da9052, in da9052_ts_pen_work()
132 da9052_disable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); in da9052_ts_pen_work()
133 da9052_enable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); in da9052_ts_pen_work()
157 static int da9052_configure_tsi(struct da9052_tsi *tsi) in da9052_configure_tsi() argument
161 error = da9052_ts_configure_gpio(tsi->da9052); in da9052_configure_tsi()
166 error = da9052_reg_update(tsi->da9052, DA9052_ADC_CONT_REG, in da9052_configure_tsi()
172 error = da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 0xFC, 0xC0); in da9052_configure_tsi()
177 error = da9052_reg_write(tsi->da9052, DA9052_LDO9_REG, 0x59); in da9052_configure_tsi()
186 struct da9052_tsi *tsi = input_get_drvdata(input_dev); in da9052_ts_input_open() local
188 tsi->stopped = false; in da9052_ts_input_open()
192 da9052_enable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); in da9052_ts_input_open()
195 return da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, in da9052_ts_input_open()
201 struct da9052_tsi *tsi = input_get_drvdata(input_dev); in da9052_ts_input_close() local
203 tsi->stopped = true; in da9052_ts_input_close()
205 da9052_disable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); in da9052_ts_input_close()
206 cancel_delayed_work_sync(&tsi->ts_pen_work); in da9052_ts_input_close()
208 if (tsi->adc_on) { in da9052_ts_input_close()
209 da9052_disable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); in da9052_ts_input_close()
210 da9052_ts_adc_toggle(tsi, false); in da9052_ts_input_close()
217 da9052_enable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); in da9052_ts_input_close()
221 da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 1, 0); in da9052_ts_input_close()
227 struct da9052_tsi *tsi; in da9052_ts_probe() local
235 tsi = kzalloc(sizeof(struct da9052_tsi), GFP_KERNEL); in da9052_ts_probe()
237 if (!tsi || !input_dev) { in da9052_ts_probe()
242 tsi->da9052 = da9052; in da9052_ts_probe()
243 tsi->dev = input_dev; in da9052_ts_probe()
244 tsi->stopped = true; in da9052_ts_probe()
245 INIT_DELAYED_WORK(&tsi->ts_pen_work, da9052_ts_pen_work); in da9052_ts_probe()
263 input_set_drvdata(input_dev, tsi); in da9052_ts_probe()
266 da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 1, 0); in da9052_ts_probe()
269 da9052_ts_adc_toggle(tsi, false); in da9052_ts_probe()
271 error = da9052_request_irq(tsi->da9052, DA9052_IRQ_PENDOWN, in da9052_ts_probe()
272 "pendown-irq", da9052_ts_pendwn_irq, tsi); in da9052_ts_probe()
274 dev_err(tsi->da9052->dev, in da9052_ts_probe()
279 error = da9052_request_irq(tsi->da9052, DA9052_IRQ_TSIREADY, in da9052_ts_probe()
280 "tsiready-irq", da9052_ts_datardy_irq, tsi); in da9052_ts_probe()
282 dev_err(tsi->da9052->dev, in da9052_ts_probe()
288 da9052_disable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); in da9052_ts_probe()
289 da9052_disable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); in da9052_ts_probe()
291 error = da9052_configure_tsi(tsi); in da9052_ts_probe()
295 error = input_register_device(tsi->dev); in da9052_ts_probe()
299 platform_set_drvdata(pdev, tsi); in da9052_ts_probe()
304 da9052_free_irq(tsi->da9052, DA9052_IRQ_TSIREADY, tsi); in da9052_ts_probe()
306 da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi); in da9052_ts_probe()
308 kfree(tsi); in da9052_ts_probe()
316 struct da9052_tsi *tsi = platform_get_drvdata(pdev); in da9052_ts_remove() local
318 da9052_reg_write(tsi->da9052, DA9052_LDO9_REG, 0x19); in da9052_ts_remove()
320 da9052_free_irq(tsi->da9052, DA9052_IRQ_TSIREADY, tsi); in da9052_ts_remove()
321 da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi); in da9052_ts_remove()
323 input_unregister_device(tsi->dev); in da9052_ts_remove()
324 kfree(tsi); in da9052_ts_remove()