Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp1358936rdb; Wed, 16 Aug 2023 09:10:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHv69lM4vAqfQGSKizkZBBmX5qIRHXui67YlzCN1l03HQfK91L+JZziQZFv0ra8bNOAaBZm X-Received: by 2002:a17:90b:189:b0:263:72c5:9ac6 with SMTP id t9-20020a17090b018900b0026372c59ac6mr1656713pjs.11.1692202223922; Wed, 16 Aug 2023 09:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692202223; cv=none; d=google.com; s=arc-20160816; b=Z48fvQA/7I0HMTxZa4xeqKJFazgjv9aVHcrI+A8trIUkP524xZjeUI3U24mcWM2Kjk d9sq1WJM5sMZCXVVBedgbXdfXafnXdfIOLyErNRv3MaqzmxlxA7bpJeLO85tZ62yIgVZ t4ozCBpRAL+1S06nxwWRH6j+QKkixpAyDQB+OPiYcjwWNBS9vdzaPwRk25su6371ucUq OY4n4qQx2mt/jgA8nXh8pyhfi4zsP7ZlXoBc56JH97Aoeyh801mGT9LoJvfX9HA4WTug b0gGuVi7P9RbYHB8nJmk/wdHTkZ42md0J6RVMmtcSLhl0Jnf5Bh4SMMZ1n7DZFhh013S HKag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LoYBHDxoa5S1fAWhUVAfhOAKVFZPDYxqhnR63ECxR3Y=; fh=V8iAieFyRYEzBvA/VG+aAukEprWlyjzwQtL2ZE5iOkI=; b=Z/tNJGsj75UyaMZA/Ph/2C77xGVS21lyUK01g3QrgizIhAjzV6jzy6JIa/eQ6Y2+xA //ix4bzMaYfDtnVTlLjyOlTlHP5UQiwArx4kh6x/qHsmSHMRwZvXKj/+MZlXrTI+4MHi XSLYlRkOQsz8gKNUXyv7udyJSlL4sXApEzfjw6+Gu2q435uORJcta+Qhh6rVXVUQZcMw j0EtC4uEualrW2qQCEI3b5Eg5kUQj9bU2XYbm7Kac9/MO3HgjKpZP+3hZUJGJcy6RIq3 KMMBzxRElC8y8LchVhtwK1Zl6dUBY/2URnrJky+QPpIwDqTznJeiWdy2H7z8CNDIbN7E GX1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg8-20020a17090b1e0800b0026369cc7286si14166430pjb.154.2023.08.16.09.10.02; Wed, 16 Aug 2023 09:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239343AbjHOS50 (ORCPT + 99 others); Tue, 15 Aug 2023 14:57:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239298AbjHOS44 (ORCPT ); Tue, 15 Aug 2023 14:56:56 -0400 X-Greylist: delayed 1563 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 15 Aug 2023 11:56:26 PDT Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a02:c205:3004:2154::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFDB92127; Tue, 15 Aug 2023 11:56:26 -0700 (PDT) Received: from p200300ccff31d1001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff31:d100: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 1qVynp-002fC7-AB; Tue, 15 Aug 2023 20:30:01 +0200 Received: from andi by aktux with local (Exim 4.96) (envelope-from ) id 1qVyno-000tJC-2x; Tue, 15 Aug 2023 20:30:00 +0200 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, u.kleine-koenig@pengutronix.de, linus.walleij@linaro.org, Jonathan.Cameron@huawei.com, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Andreas Kemnade Subject: [PATCH 3/4] Input: zforce_ts: Accept standard touchscreen properties Date: Tue, 15 Aug 2023 20:29:47 +0200 Message-Id: <20230815182948.212575-4-andreas@kemnade.info> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230815182948.212575-1-andreas@kemnade.info> References: <20230815182948.212575-1-andreas@kemnade.info> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 5be5112845e1..f4397497bbe9 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