Lines Matching refs:ts

223 static bool qt1050_identify(struct qt1050_priv *ts)  in qt1050_identify()  argument
229 regmap_read(ts->regmap, QT1050_CHIP_ID, &val); in qt1050_identify()
231 dev_err(&ts->client->dev, "ID %d not supported\n", val); in qt1050_identify()
236 err = regmap_read(ts->regmap, QT1050_FW_VERSION, &val); in qt1050_identify()
238 dev_err(&ts->client->dev, "could not read the firmware version\n"); in qt1050_identify()
242 dev_info(&ts->client->dev, "AT42QT1050 firmware version %1d.%1d\n", in qt1050_identify()
250 struct qt1050_priv *ts = dev_id; in qt1050_irq_threaded() local
251 struct input_dev *input = ts->input; in qt1050_irq_threaded()
257 err = regmap_read(ts->regmap, QT1050_DET_STATUS, &val); in qt1050_irq_threaded()
259 dev_err(&ts->client->dev, "Fail to read detection status: %d\n", in qt1050_irq_threaded()
265 err = regmap_read(ts->regmap, QT1050_KEY_STATUS, &val); in qt1050_irq_threaded()
267 dev_err(&ts->client->dev, in qt1050_irq_threaded()
272 changed = ts->last_keys ^ new_keys; in qt1050_irq_threaded()
274 changed &= ts->reg_keys; in qt1050_irq_threaded()
277 input_report_key(input, ts->keys[i].keycode, in qt1050_irq_threaded()
280 ts->last_keys = new_keys; in qt1050_irq_threaded()
301 static int qt1050_apply_fw_data(struct qt1050_priv *ts) in qt1050_apply_fw_data() argument
303 struct regmap *map = ts->regmap; in qt1050_apply_fw_data()
304 struct qt1050_key *button = &ts->keys[0]; in qt1050_apply_fw_data()
341 static int qt1050_parse_fw(struct qt1050_priv *ts) in qt1050_parse_fw() argument
343 struct device *dev = &ts->client->dev; in qt1050_parse_fw()
374 ts->reg_keys |= BIT(button.num); in qt1050_parse_fw()
418 ts->keys[button.num] = button; in qt1050_parse_fw()
430 struct qt1050_priv *ts; in qt1050_probe() local
450 ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); in qt1050_probe()
451 if (!ts) in qt1050_probe()
462 ts->client = client; in qt1050_probe()
463 ts->input = input; in qt1050_probe()
464 ts->regmap = map; in qt1050_probe()
466 i2c_set_clientdata(client, ts); in qt1050_probe()
469 if (!qt1050_identify(ts)) in qt1050_probe()
473 err = qt1050_parse_fw(ts); in qt1050_probe()
484 input->keycode = ts->keycodes; in qt1050_probe()
485 input->keycodesize = sizeof(ts->keycodes[0]); in qt1050_probe()
490 ts->keycodes[i] = ts->keys[i].keycode; in qt1050_probe()
491 __set_bit(ts->keycodes[i], input->keybit); in qt1050_probe()
495 err = regmap_update_bits(ts->regmap, QT1050_RES_CAL, 0x7f, in qt1050_probe()
501 err = regmap_read_poll_timeout(ts->regmap, QT1050_DET_STATUS, status, in qt1050_probe()
509 err = regmap_update_bits(ts->regmap, QT1050_RES_CAL, in qt1050_probe()
518 err = qt1050_apply_fw_data(ts); in qt1050_probe()
526 "qt1050", ts); in qt1050_probe()
533 err = regmap_read(ts->regmap, QT1050_DET_STATUS, &status); in qt1050_probe()
540 err = input_register_device(ts->input); in qt1050_probe()
553 struct qt1050_priv *ts = i2c_get_clientdata(client); in qt1050_suspend() local
562 return regmap_write(ts->regmap, QT1050_LPMODE, in qt1050_suspend()
569 struct qt1050_priv *ts = i2c_get_clientdata(client); in qt1050_resume() local
574 return regmap_write(ts->regmap, QT1050_LPMODE, 2); in qt1050_resume()