Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1569682iof; Tue, 7 Jun 2022 07:57:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmIYN2LbANzyPah0oP8Q9z+uo33vTyX2ukrD9SGIB76lHdEouq8T8Oe6dH/EehFtnQ40Zw X-Received: by 2002:a17:90a:9481:b0:1e8:7bbf:fa9a with SMTP id s1-20020a17090a948100b001e87bbffa9amr13177462pjo.164.1654613864898; Tue, 07 Jun 2022 07:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654613864; cv=none; d=google.com; s=arc-20160816; b=HGVSUK8ix7SFx4s2PPFlleazWo+gKJXjITrg1GVJzK7cjQgGfW/WmW9+2rzS95U34r 91p2hdG9F3tSwwyynWnzZStrbuauoQW7ixcVqTSeNYyMEXr2TgZyXTqqzT1rIXFgubPt oXGMkuOeoKwFcqoJq4zsR2DMue4+MeOmIDyeCDFQZqGFwHXNvZsgiOg/1LvMcJxqh2ua AfCIKr4eDXNTgocIY9yqgsrVeJubT94m48XLTNxLwyC/bkhp7Tg8oEvyVN/C/pgp5aNs rVoC4y+6tWpNAELxoUYvbcZcujgz8YgoSMFhOhQzUHpEoqMFogff36wZelW96UdXyygB f2QA== 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=UlMjQSJV+QHn+/KzkqmpvF6meM+i0lzXFsEGKSsaf+j3gFouo9QE7y0NnxnJmImGwh W9p5j718oC6GqpRQ/LFYgm0/ufk7j9T2uVjc6VuBZ/knWKCkbbIqgPiyfSN2j0txktWa 0wKIOoIVxGUHNlMh8kJVe2pVcJ/OWHb2Xh/dgx4EUSUDpGb97WV4/X7VSssKjrddGA6q g2vWF8+KQIxQbIif958A9w9sDPSjc2j8t7i0sXFCHl+HfM+FamA3pUysdxU4bmKfLGuj vRjNzefd6wLIOlMe3LW568kJhWyZpH/Oc/6E8aLEK7rpol6zcTUoiT+I/bep44utcEQw 4n7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=lqankbjz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y64-20020a638a43000000b003fe25570ee0si115775pgd.849.2022.06.07.07.57.30; Tue, 07 Jun 2022 07:57:44 -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; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=lqankbjz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240438AbiFGJ4r (ORCPT + 99 others); Tue, 7 Jun 2022 05:56:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239870AbiFGJ4L (ORCPT ); Tue, 7 Jun 2022 05:56:11 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7E48E8B93 for ; Tue, 7 Jun 2022 02:56:10 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id p5-20020a1c2905000000b003970dd5404dso9257094wmp.0 for ; Tue, 07 Jun 2022 02:56:10 -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=lqankbjzk7zyz3fq31CNd3emxOgHOHizyNhVpWvT/O+ZrG4X8FFMI4Z5aUc8is0a4p sFZyXeB3v3JctD4HIADw1dwo4d1WSP1pmKwEl1agf3hxtBEOT1Gdt/EFJ9NmMLHIVk7h XbFcrY4Alfae04IaJFzXBB3rJ0exSZDje7f9A= 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=ALuuYL00Fx95rZfPWEgTT5QJCW+/Xyoz3trdlHR7vkLEg+5poD+XjzTg7MI8oI9QRy 7bHqq2iL5YEipzedu9H+c913QZY3eMDQcgxyo1rzxhi3iXAjnWtWGec2MdIks52OJVAL d3++QkbthNcmoMJbOX74z6SLQq0tZLByr8uUAhhnssJAQf2vHQfFnVRWUfNR2VmSn0kd YS2FCaRrV2qTg56mg3tZQha8kJqvkT0koEVF7x9plUx5SLn1022Re2T5SuVTE1GPYx5h SVRqVaUtymc5oElq7FGAGr2vz88/fDmnHyAFwDwk2eJ2hxBWdrDD2TCbqk4DTkT5yaUJ +Kyw== X-Gm-Message-State: AOAM5306nrso2A4uAzcLAyJE98bEJLGi8LFI8l1NMhQCUQP/P3LW1GOv Pu6rLHwLZTq2cD468O78SZLmhQnqihZizg== X-Received: by 2002:a05:600c:19cb:b0:397:51db:446f with SMTP id u11-20020a05600c19cb00b0039751db446fmr57290813wmq.182.1654595769975; Tue, 07 Jun 2022 02:56:09 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.pdxnet.pdxeng.ch (mob-5-90-137-51.net.vodafone.it. [5.90.137.51]) by smtp.gmail.com with ESMTPSA id b12-20020a5d4b8c000000b0020feb9c44c2sm17693546wrt.20.2022.06.07.02.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 02:56:09 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Dmitry Torokhov , Marco Felsch , Oliver Graute , linux-input@vger.kernel.org Subject: [RESEND PATCH v4 3/6] Input: edt-ft5x06 - set report rate by dts property Date: Tue, 7 Jun 2022 11:55:53 +0200 Message-Id: <20220607095556.1034338-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220607095556.1034338-1-dario.binacchi@amarulasolutions.com> References: <20220607095556.1034338-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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