// SPDX-License-Identifier: GPL-2.0-only /* * Driver for Cypress CY8CTMA140 (TMA140) touchscreen * (C) 2020 Linus Walleij <linus.walleij@linaro.org> * (C) 2007 Cypress * (C) 2007 Google, Inc. * * Inspired by the tma140_skomer.c driver in the Samsung GT-S7710 code * drop. The GT-S7710 is codenamed "Skomer", the code also indicates * that the same touchscreen was used in a product called "Lucas". * * The code drop for GT-S7710 also contains a firmware downloader and * 15 (!) versions of the firmware drop from Cypress. But here we assume * the firmware got downloaded to the touchscreen flash successfully and * just use it to read the fingers. The shipped vendor driver does the * same.
*/
for (i = 0; i < n_fingers; i++) {
buf = &data[contact_offsets[i]];
/* * Odd contacts have contact ID in the lower nibble of * the preceding byte, whereas even contacts have it in * the upper nibble of the following byte.
*/
id = i % 2 ? buf[-1] & 0x0f : buf[5] >> 4;
slot = input_mt_get_slot_by_key(ts->input, id); if (slot < 0) continue;
x = get_unaligned_be16(buf);
y = get_unaligned_be16(buf + 2);
w = buf[4];
dev_dbg(ts->dev, "finger %d: ID %02x (%d, %d) w: %d\n",
slot, id, x, y, w);
input_set_capability(input, EV_ABS, ABS_MT_POSITION_X);
input_set_capability(input, EV_ABS, ABS_MT_POSITION_Y); /* One byte for width 0..255 so this is the limit */
input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); /* * This sets up event max/min capabilities and fuzz. * Some DT properties are compulsory so we do not need * to provide defaults for X/Y max or pressure max. * * We just initialize a very simple MT touchscreen here, * some devices use the capability of this touchscreen to * provide touchkeys, and in that case this needs to be * extended to handle touchkey input. * * The firmware takes care of finger tracking and dropping * invalid ranges.
*/
touchscreen_parse_properties(input, true, &ts->props);
input_abs_set_fuzz(input, ABS_MT_POSITION_X, 0);
input_abs_set_fuzz(input, ABS_MT_POSITION_Y, 0);
/* * VCPIN is the analog voltage supply * VDD is the digital voltage supply * since the voltage range of VDD overlaps that of VCPIN, * many designs to just supply both with a single voltage * source of ~3.3 V.
*/
ts->regulators[0].supply = "vcpin";
ts->regulators[1].supply = "vdd";
error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->regulators),
ts->regulators); if (error) return dev_err_probe(dev, error, "Failed to get regulators\n");
error = cy8ctma140_power_up(ts); if (error) return error;
error = devm_add_action_or_reset(dev, cy8ctma140_power_off_action, ts); if (error) {
dev_err(dev, "failed to install power off handler\n"); return error;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.