Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4764103iob; Mon, 9 May 2022 00:39:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJws3Ag024Blmsj+4W2lFlf5iVCmIxuBF0QnyYGM4Mr4exWH0tskkpFOiiJLX15VLbiZYW3i X-Received: by 2002:a17:90a:1509:b0:1d8:c22b:4d61 with SMTP id l9-20020a17090a150900b001d8c22b4d61mr24669708pja.78.1652081952523; Mon, 09 May 2022 00:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652081952; cv=none; d=google.com; s=arc-20160816; b=EWhKibbdukXC29kOqcsavsMFy7HcRd3EzB4mXvrVv2VGT9/Oim8p1yAj8cgJev9Dv+ Y6RTzuRuK+RT8f9DZ5TjTA78KKGd81ZHX360/z4OlEOBA56J0aId1mPt/NLzFy9uEw8u O7cJt45aORNPp7C2yeMYnNg2Fj/DY2OrR7rK9hbUn1EBwPDgVu3CF511RhO/2bLasPDm kX/xkVsLgHpg8ymKp20t/d3qbDjB4LwzCliJ3TnTnpLoL3GQWfA3nck/qoISAz9vCTNg 3uO+P7vaEmQD5ifPsrKRT4eZIjPRW2deApomgRmV+Yv0jNyWjbDXCwP1QsApbANDQUxt tM0A== 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 :dkim-signature; bh=NIUuHRgvgWCmYJCricL+FHDsiVQYgUJ0FjEwcnUqvHA=; b=LeI8DSjVRD/GGEalkj/68gyBTj8UAzFkMxdq6YPzjtWKDP4lbz0muzxI0c/vBvUNKU /SeEam4uqPSY+KEVlyX6Qaonk+ECPb9/pARWPYfjjFdIR4RzzmWkUrvRAeKI4UtNQQOp 38bCpzRkiKTfYL98NmOIyB3DaUVpmcNu7fjFuQh+riOVmkjwDw/GSODenMSclXIyDwd4 Rv+QwXlL5c6m+ZIYtqWzuHACjLGvQc76jmD3UIPhsSK06CZuFUAzDo9IxRfPaJDN5NQt B6tEWGm2avYmlyIiGYa4yyxB6GBpBbpuCzOOYGscADH6ijPeN5ch0f0QIR/MwiUQ680W zL0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=exXWeiui; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c141-20020a621c93000000b005103f14fc5dsi11867635pfc.46.2022.05.09.00.39.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 00:39:12 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=exXWeiui; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 05DCA1BF1B9; Mon, 9 May 2022 00:34:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381510AbiEEQAq (ORCPT + 99 others); Thu, 5 May 2022 12:00:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381494AbiEEQA0 (ORCPT ); Thu, 5 May 2022 12:00:26 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E30AD515A3 for ; Thu, 5 May 2022 08:56:45 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id gh6so9626113ejb.0 for ; Thu, 05 May 2022 08:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NIUuHRgvgWCmYJCricL+FHDsiVQYgUJ0FjEwcnUqvHA=; b=exXWeiuiJqVSSFiH2D0YiOMHTMpz2ENa4sblu+fFfCOQ5CFTWE1DweH6W0NgHDu/2b czkcCEvUFQPeRLyzJ+YUAFaTqihvHXT9bxDtGPaNRCp+z0tEhXuVk6FU7S319cJ1pxoR Aeogd8redla9tC1t9YlFTQXf6zLYAYXutvMKo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NIUuHRgvgWCmYJCricL+FHDsiVQYgUJ0FjEwcnUqvHA=; b=aByvpJcGkxWHjtrcqFCecgqKFpUIlsRyc7gNb9EN2F5x5yr0vMSluHkn/gxWjQlOwv Wv0HItky8d57JNkyN9gQrp54XVvOZtMtA69wPCVDfaE+Jh2f2NLoE6DRnYqzgtpjrY3H Asuc1DaeThOJ0x96+H+NPWMl1UFrtgXwtuf5X5SoznOyZI7GCHPfe6Y9omNFWmbXxBm8 ZjaCntkNEnRbqK6jQZ2Lhtm5VoXupy1VqNBBV+aCqcyhDxKulGP1zcmoGq6EbH3AnIby 0ZkdySb4+3nFu5KtxMLVu8TJImtlAExvzaaSQ0qGMdXt9QrWBQiv9ntjjuuDPYQ6/ALw 62Qw== X-Gm-Message-State: AOAM530+0iVtcUwiuFk6WBoP3HapCy1q1kb+8P450RUEnCLd/CiyTsHj UE5XMKsjGHLwxyBiG9GZn/S5a3cB2m5SVg== X-Received: by 2002:a17:906:2294:b0:6f3:bd02:95a3 with SMTP id p20-20020a170906229400b006f3bd0295a3mr26671291eja.201.1651766204299; Thu, 05 May 2022 08:56:44 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.pdxnet.pdxeng.ch (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id a4-20020aa7d904000000b0042617ba6385sm1009328edr.15.2022.05.05.08.56.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 08:56:43 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Dmitry Torokhov , Marco Felsch , Oliver Graute , Stephan Gerhold , linux-input@vger.kernel.org Subject: [RESEND PATCH v4 3/6] Input: edt-ft5x06 - set report rate by dts property Date: Thu, 5 May 2022 17:56:32 +0200 Message-Id: <20220505155635.419653-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220505155635.419653-1-dario.binacchi@amarulasolutions.com> References: <20220505155635.419653-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 It allows to change the M06/M12 default scan rate on driver probing. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- (no changes since v3) Changes in v3: - Check the lower and upper limits of the report-rate-hz value - Convert the M06 report-rate-hz value drivers/input/touchscreen/edt-ft5x06.c | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 77f061af5c61..843e8b0522f7 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -1084,6 +1084,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, struct input_dev *input; unsigned long irq_flags; int error; + u32 report_rate; char fw_version[EDT_NAME_LEN]; dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); @@ -1213,6 +1214,35 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, edt_ft5x06_ts_get_defaults(&client->dev, tsdata); edt_ft5x06_ts_get_parameters(tsdata); + if (tsdata->reg_addr.reg_report_rate != NO_REGISTER && + !of_property_read_u32(client->dev.of_node, "report-rate-hz", + &report_rate)) { + tsdata->report_rate = report_rate; + if (tsdata->version == EDT_M06) { + if (report_rate < 30) + report_rate = 30; + else if (report_rate > 140) + report_rate = 140; + } else if (report_rate < 1) { + report_rate = 1; + } else if (report_rate > 255) + report_rate = 255; + + if (report_rate != tsdata->report_rate) + dev_warn(&client->dev, + "report-rate %dHz is unsupported, use %dHz\n", + tsdata->report_rate, report_rate); + + if (tsdata->version == EDT_M06) + report_rate /= 10; + + tsdata->report_rate = report_rate; + + edt_ft5x06_register_write(tsdata, + tsdata->reg_addr.reg_report_rate, + tsdata->report_rate); + } + dev_dbg(&client->dev, "Model \"%s\", Rev. \"%s\", %dx%d sensors\n", tsdata->name, fw_version, tsdata->num_x, tsdata->num_y); -- 2.32.0