Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1611314rdb; Sat, 23 Dec 2023 14:13:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJG9eQhU/cF74a/GirIhaw5s+8d0t6T5IV2R5PqC1lBrlfR9AO10JlDc87OC5u7K6z+OGt X-Received: by 2002:a05:6214:301d:b0:67a:dc5f:bab8 with SMTP id ke29-20020a056214301d00b0067adc5fbab8mr5834573qvb.53.1703369589456; Sat, 23 Dec 2023 14:13:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703369589; cv=none; d=google.com; s=arc-20160816; b=0pM7KzxjdT4/p1TnjwERRxAvsKNxyzqhyRUZwMPWPtLzyZfxB2NP/ViRG8RsOLbvZq C6Vzwmq6SiaRBWJLet6QUs7rjw0NMqcRJKNpnddd6tQoCYrIrSPHo9L4EmodNadxXCL0 PA19Twtklaz17CIRdOUvyhvIrUUZkP2LIYePQxEUPtCsWf1j/RVG1ZdWOmwNCmCzX09Y bgVi+HXBq4uN7Gn6MSqzSIh5Z2jS1fevsZRcjU/Jn73R9gCOtuj9SnbmxizU9cMGEydm TFdBn3bKApJiqcf6Jy4A/fRfeUrQUwOND5PgQLbBo+/EQajNKqT4gH5v5xI8UoV9SnMx Drfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=NpY3EimOAO7fdKupobvAOCqbFhsZ6eizQExlx9KlQYE=; fh=19PAcIZvNFNleegirCCdfUNxsGxQC+zmYor10Ufsvac=; b=p3QCRmciSTbWP4qZ2FhGOtNBkEmhe/lvqf/9jmTZa7pLDfaOD2l7EoVvTsyFI4UCXG Y0c+YQBQI1tH9DQeo6JvHXU6ZVl8Xc4mQUT77sux6+74zx2fOVahfPV+P1CjDXL7nRDV vC5G2n3FvoRd3Oc9nzVkcjHirDNGCiuP22iEmazfhW6OmsxcwDO3abXIMt1Um1uheSnX FVvkXuyy2AiOFcT6LVAuSw9w4AKTP8rWBKLNw43GbHvR2gvGTaXQk61g1/2gkiXxHkXu EqIiPk6sBHkDXnQOdEu4axJLGyKcxkFYvQ6ZZaG/eMluHU//XVUSRag/Y2mLDnaEmRiv 80gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b="rq/Wl09B"; spf=pass (google.com: domain of linux-kernel+bounces-10597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10597-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q3-20020a0ce203000000b0067f76abb772si7742945qvl.139.2023.12.23.14.13.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 14:13:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b="rq/Wl09B"; spf=pass (google.com: domain of linux-kernel+bounces-10597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10597-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3BA091C2150C for ; Sat, 23 Dec 2023 22:13:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34E4420310; Sat, 23 Dec 2023 22:12:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kemnade.info header.i=@kemnade.info header.b="rq/Wl09B" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.andi.de1.cc (mail.andi.de1.cc [178.238.236.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F244A179A9; Sat, 23 Dec 2023 22:12:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kemnade.info Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kemnade.info DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=NpY3EimOAO7fdKupobvAOCqbFhsZ6eizQExlx9KlQYE=; b=rq/Wl09BjslAj82DLo/FVvQuft mRUWIegLkCGz44P8oMlovQ/F3f3IEcn75Qy6NJt+AIRbt5Lcr3tD0ZLRymlgY6xCYFdb3jOoNS6Tw DjgaXKWW4E9Ip4rntf8lFStcPkil+Svsw47G1Xqn0YIXWGCcv8MR2e5xIObvpYo/2/LFquZYOSNOe asMNVHj7M5OBVUGI63K0nwgufPn92MW+j+mBUxZkmA5FIr4ert/qF/6Qp+HFDirM/gwK6jNYrFOYD xLcUtfhYitO795tnJH92CPSWt2cMqvreTsgCKsw7cE26AokolCZ8kv5clNnq0PTPIvFCKb1IZD5Ok kTmSb1SQ==; Received: from p200301077700c3001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:107:7700:c300:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rHAEK-007f7c-OD; Sat, 23 Dec 2023 23:12:24 +0100 Received: from andi by aktux with local (Exim 4.96) (envelope-from ) id 1rHAEK-003FaH-0i; Sat, 23 Dec 2023 23:12:24 +0100 From: Andreas Kemnade To: dmitry.torokhov@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, rydberg@bitmath.org, andreas@kemnade.info, linus.walleij@linaro.org, Jonathan.Cameron@huawei.com, u.kleine-koenig@pengutronix.de, heiko@sntech.de, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 3/4] Input: zforce_ts: Accept standard touchscreen properties Date: Sat, 23 Dec 2023 23:12:12 +0100 Message-Id: <20231223221213.774868-4-andreas@kemnade.info> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231223221213.774868-1-andreas@kemnade.info> References: <20231223221213.774868-1-andreas@kemnade.info> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Only driver-specific properties were accepted, change it to use the now-available standard properties. Signed-off-by: Andreas Kemnade --- drivers/input/touchscreen/zforce_ts.c | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 5be5112845e1e..f4397497bbe94 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -106,6 +107,7 @@ struct zforce_point { struct zforce_ts { struct i2c_client *client; struct input_dev *input; + struct touchscreen_properties prop; const struct zforce_ts_platdata *pdata; char phys[32]; @@ -266,7 +268,6 @@ static int zforce_setconfig(struct zforce_ts *ts, char b1) static int zforce_start(struct zforce_ts *ts) { struct i2c_client *client = ts->client; - const struct zforce_ts_platdata *pdata = ts->pdata; int ret; dev_dbg(&client->dev, "starting device\n"); @@ -277,7 +278,7 @@ static int zforce_start(struct zforce_ts *ts) return ret; } - ret = zforce_resolution(ts, pdata->x_max, pdata->y_max); + ret = zforce_resolution(ts, ts->prop.max_x, ts->prop.max_y); if (ret) { dev_err(&client->dev, "Unable to set resolution, %d\n", ret); goto error; @@ -337,7 +338,6 @@ static int zforce_stop(struct zforce_ts *ts) static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) { struct i2c_client *client = ts->client; - const struct zforce_ts_platdata *pdata = ts->pdata; struct zforce_point point; int count, i, num = 0; @@ -355,8 +355,8 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) point.coord_y = payload[9 * i + 4] << 8 | payload[9 * i + 3]; - if (point.coord_x > pdata->x_max || - point.coord_y > pdata->y_max) { + if (point.coord_x > ts->prop.max_x || + point.coord_y > ts->prop.max_y) { dev_warn(&client->dev, "coordinates (%d,%d) invalid\n", point.coord_x, point.coord_y); point.coord_x = point.coord_y = 0; @@ -390,10 +390,11 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) point.state != STATE_UP); if (point.state != STATE_UP) { - input_report_abs(ts->input, ABS_MT_POSITION_X, - point.coord_x); - input_report_abs(ts->input, ABS_MT_POSITION_Y, - point.coord_y); + touchscreen_report_pos(ts->input, + &ts->prop, + point.coord_x, + point.coord_y, + true); input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, point.area_major); input_report_abs(ts->input, ABS_MT_TOUCH_MINOR, @@ -719,15 +720,8 @@ static struct zforce_ts_platdata *zforce_parse_dt(struct device *dev) return ERR_PTR(-ENOMEM); } - if (of_property_read_u32(np, "x-size", &pdata->x_max)) { - dev_err(dev, "failed to get x-size property\n"); - return ERR_PTR(-EINVAL); - } - - if (of_property_read_u32(np, "y-size", &pdata->y_max)) { - dev_err(dev, "failed to get y-size property\n"); - return ERR_PTR(-EINVAL); - } + of_property_read_u32(np, "x-size", &pdata->x_max); + of_property_read_u32(np, "y-size", &pdata->y_max); return pdata; } @@ -856,6 +850,12 @@ static int zforce_probe(struct i2c_client *client) input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, pdata->y_max, 0, 0); + touchscreen_parse_properties(input_dev, true, &ts->prop); + if (ts->prop.max_x == 0 || ts->prop.max_y == 0) { + dev_err(&client->dev, "no size specified\n"); + return -EINVAL; + } + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, ZFORCE_MAX_AREA, 0, 0); input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, -- 2.39.2