Lines Matching +full:touchscreen +full:- +full:min +full:- +full:pressure

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Driver for Cypress CY8CTMA140 (TMA140) touchscreen
8 * Inspired by the tma140_skomer.c driver in the Samsung GT-S7710 code
9 * drop. The GT-S7710 is codenamed "Skomer", the code also indicates
10 * that the same touchscreen was used in a product called "Lucas".
12 * The code drop for GT-S7710 also contains a firmware downloader and
14 * the firmware got downloaded to the touchscreen flash successfully and
23 #include <linux/input/touchscreen.h>
73 id = i % 2 ? buf[-1] & 0x0f : buf[5] >> 4; in cy8ctma140_report()
74 slot = input_mt_get_slot_by_key(ts->input, id); in cy8ctma140_report()
82 dev_dbg(ts->dev, "finger %d: ID %02x (%d, %d) w: %d\n", in cy8ctma140_report()
85 input_mt_slot(ts->input, slot); in cy8ctma140_report()
86 input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, true); in cy8ctma140_report()
87 touchscreen_report_pos(ts->input, &ts->props, x, y, true); in cy8ctma140_report()
88 input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, w); in cy8ctma140_report()
91 input_mt_sync_frame(ts->input); in cy8ctma140_report()
92 input_sync(ts->input); in cy8ctma140_report()
102 .addr = ts->client->addr, in cy8ctma140_irq_thread()
107 .addr = ts->client->addr, in cy8ctma140_irq_thread()
116 ret = i2c_transfer(ts->client->adapter, msg, ARRAY_SIZE(msg)); in cy8ctma140_irq_thread()
119 dev_err(ts->dev, "error reading message: %d\n", ret); in cy8ctma140_irq_thread()
121 dev_err(ts->dev, "wrong number of messages\n"); in cy8ctma140_irq_thread()
126 dev_dbg(ts->dev, "invalid event\n"); in cy8ctma140_irq_thread()
132 dev_err(ts->dev, "unexpected number of fingers: %d\n", in cy8ctma140_irq_thread()
150 ret = i2c_master_send(ts->client, addr, 1); in cy8ctma140_init()
152 dev_err(ts->dev, "error sending FW info message\n"); in cy8ctma140_init()
155 ret = i2c_master_recv(ts->client, buf, 5); in cy8ctma140_init()
157 dev_err(ts->dev, "error receiving FW info message\n"); in cy8ctma140_init()
161 dev_err(ts->dev, "got only %d bytes\n", ret); in cy8ctma140_init()
162 return -EIO; in cy8ctma140_init()
165 dev_dbg(ts->dev, "vendor %c%c, HW ID %.2d, FW ver %.4d\n", in cy8ctma140_init()
175 error = regulator_bulk_enable(ARRAY_SIZE(ts->regulators), in cy8ctma140_power_up()
176 ts->regulators); in cy8ctma140_power_up()
178 dev_err(ts->dev, "failed to enable regulators\n"); in cy8ctma140_power_up()
189 regulator_bulk_disable(ARRAY_SIZE(ts->regulators), in cy8ctma140_power_down()
190 ts->regulators); in cy8ctma140_power_down()
206 struct device *dev = &client->dev; in cy8ctma140_probe()
211 return -ENOMEM; in cy8ctma140_probe()
215 return -ENOMEM; in cy8ctma140_probe()
217 ts->dev = dev; in cy8ctma140_probe()
218 ts->client = client; in cy8ctma140_probe()
219 ts->input = input; in cy8ctma140_probe()
226 * This sets up event max/min capabilities and fuzz. in cy8ctma140_probe()
228 * to provide defaults for X/Y max or pressure max. in cy8ctma140_probe()
230 * We just initialize a very simple MT touchscreen here, in cy8ctma140_probe()
231 * some devices use the capability of this touchscreen to in cy8ctma140_probe()
238 touchscreen_parse_properties(input, true, &ts->props); in cy8ctma140_probe()
247 input->name = CY8CTMA140_NAME; in cy8ctma140_probe()
248 input->id.bustype = BUS_I2C; in cy8ctma140_probe()
258 ts->regulators[0].supply = "vcpin"; in cy8ctma140_probe()
259 ts->regulators[1].supply = "vdd"; in cy8ctma140_probe()
260 error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->regulators), in cy8ctma140_probe()
261 ts->regulators); in cy8ctma140_probe()
263 if (error != -EPROBE_DEFER) in cy8ctma140_probe()
279 error = devm_request_threaded_irq(dev, client->irq, in cy8ctma140_probe()
283 dev_err(dev, "irq %d busy? error %d\n", client->irq, error); in cy8ctma140_probe()
305 if (!device_may_wakeup(&client->dev)) in cy8ctma140_suspend()
317 if (!device_may_wakeup(&client->dev)) { in cy8ctma140_resume()
352 MODULE_DESCRIPTION("CY8CTMA140 TouchScreen Driver");