Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5489899pxb; Sun, 13 Feb 2022 23:36:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJybRyN9N8jEkM+4U4PU0B9MTmRSr5vTwIwW5YhTBsEU51j7ffuNE2IUIUU0dMyWolpRg5Yb X-Received: by 2002:a05:6402:270c:: with SMTP id y12mr14092957edd.30.1644824199086; Sun, 13 Feb 2022 23:36:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644824199; cv=none; d=google.com; s=arc-20160816; b=0Bf7LRsiq5U1U4aAAlDIt+6Uxl+gTCiHdcQlMtXUO0UJah3f62l7JlVCwnXoWaQe8O 4LT6uztMH2eXWuDYRjJeATFYa740luYrNivsIyig09WeB4vv2r7aVzRxNJ/QoZk2DugH n31WLJANFt7xmNqygBO6mDHKjxm0ozVpVC6UGMjuDjyvDEbz+1pa500NqNl0/BUEzj1n DdtzRedz6ojUeKASL2gi6aBFOB3UtxJJpZ63MKEvIhhebl0ePgGBRZgUnH4bWdIAUEd/ /gHztQ+C4E1v+GmFyKfH9Dgs5SUi+iR4RVoCBhp8DSUG0jWI4O7M+11inUFFFdmRxYCj XSTg== 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=FrUQuHtQGj/olmQcr/n4ScE+eFPqjZP07zyR2QXuUyo=; b=JSa92IYgp+QrFc/42i8+VvwwpnEujzQcdwVt8OQ+FGV4edOO9dnxc/21ZtCuO/N8xD ivZYDcJ4qqRa828OqrALMbaOhMQdVyaW5eWnxBB2j/SzumXbYvkAxZKoP99UW4jXpld4 iXMT8O2NH4yUswndqAbZoNeubbTyTEs/dzXjReDuMVtfCzD6N4W286ewM0ujMGcaHbl6 y8yghFHdIEcJSK7kEFyn+uGxq3YuMMZw/j717QB+qEj+ejxVcOGZY6mQy98vbLy5Exxy XepvLZjP0dDZ5ITvF1enfQN82ykBDSTSH3Hf7X0qTlE3BsWDSmVMEagwA4IpVowypEKF t7iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RXpZl8YC; 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 du21si21412638ejc.54.2022.02.13.23.36.16; Sun, 13 Feb 2022 23:36:39 -0800 (PST) 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=RXpZl8YC; 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 S237292AbiBMRQF (ORCPT + 99 others); Sun, 13 Feb 2022 12:16:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237293AbiBMRQE (ORCPT ); Sun, 13 Feb 2022 12:16:04 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29ACE5938D for ; Sun, 13 Feb 2022 09:15:58 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id w2so5188803edc.8 for ; Sun, 13 Feb 2022 09:15:58 -0800 (PST) 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=FrUQuHtQGj/olmQcr/n4ScE+eFPqjZP07zyR2QXuUyo=; b=RXpZl8YC9hanx1D2+vwt7BQkAYxHhGoOdEVbmEjf4wONwi8ijXLzFrKwEaCfxMlBoq 2n6GoVQtS883m7X/+K0OhuZtkfFCgyDxkBA6QuxeeDWWPHkyvuXNwIJ6zNkXCa9HjSq1 lLq6BCD/Z5LrbemtYYi41eVsZzzbZckTt/h94= 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=FrUQuHtQGj/olmQcr/n4ScE+eFPqjZP07zyR2QXuUyo=; b=b8YYN+mByv9et9dtstywIbq+8+5RMO5u4qN1Vb+ZSBZuAPX0hIR8gKLW6EHUwkVCKR J4P137Y6Kn5gPaA5qsNo2indFsA0vyWmF9tF3lvdBe2qHiZJYfkjPIyf3DO5mplZTvVq REqNo5V905M58ms9PVUDJtutwzKT2yCwSpm2Sx55BMgPDbsNbfMewOb3HcSiSJer6wMW h5cXtjvYHuV+cd9jHPbBKsnRPojilRcjVxOonsmyUQaVSS2MZHP0Yrs7IH/Vc32QMhB2 +9Vd2Qo0DNmQqB5PEgNqLKq+BhevzA+Y/RSZ5CqjVWllAOwB4FvMRcR2m0Gv8H1aoQ5r MhKQ== X-Gm-Message-State: AOAM5331YucgxP8uzdVtr77PFbGXqTSOEn9IGQK277DJ+ZmFoE8zFsC2 KL1FnvMcmD6LTm0v2GesnO2GaSk7Yud3Cw== X-Received: by 2002:a05:6402:2987:: with SMTP id eq7mr2738833edb.330.1644772556567; Sun, 13 Feb 2022 09:15:56 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-52-8-210.retail.telecomitalia.it. [82.52.8.210]) by smtp.gmail.com with ESMTPSA id o10sm6598878ejj.6.2022.02.13.09.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 09:15:56 -0800 (PST) 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: [PATCH 2/6] Input: edt-ft5x06 - get/set M12 report rate by sysfs Date: Sun, 13 Feb 2022 18:15:28 +0100 Message-Id: <20220213171532.346270-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> References: <20220213171532.346270-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=unavailable 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 Add support for reading/writing scan rate (SC) register for M12 by sysfs. The register value is equal to the SC (Hz), unlike M06, where instead it is equal to SC / 10. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Tested-by: Dario Binacchi Signed-off-by: Dario Binacchi --- drivers/input/touchscreen/edt-ft5x06.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index bb2e1cbffba7..77f061af5c61 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -47,6 +47,8 @@ #define M09_REGISTER_NUM_X 0x94 #define M09_REGISTER_NUM_Y 0x95 +#define M12_REGISTER_REPORT_RATE 0x88 + #define EV_REGISTER_THRESHOLD 0x40 #define EV_REGISTER_GAIN 0x41 #define EV_REGISTER_OFFSET_Y 0x45 @@ -523,9 +525,9 @@ static EDT_ATTR(offset_y, S_IWUSR | S_IRUGO, NO_REGISTER, NO_REGISTER, /* m06: range 20 to 80, m09: range 0 to 30, m12: range 1 to 255... */ static EDT_ATTR(threshold, S_IWUSR | S_IRUGO, WORK_REGISTER_THRESHOLD, M09_REGISTER_THRESHOLD, EV_REGISTER_THRESHOLD, 0, 255); -/* m06: range 3 to 14, m12: (0x64: 100Hz) */ +/* m06: range 3 to 14, m12: range 1 to 255 */ static EDT_ATTR(report_rate, S_IWUSR | S_IRUGO, WORK_REGISTER_REPORT_RATE, - NO_REGISTER, NO_REGISTER, 0, 255); + M12_REGISTER_REPORT_RATE, NO_REGISTER, 0, 255); static struct attribute *edt_ft5x06_attrs[] = { &edt_ft5x06_attr_gain.dattr.attr, @@ -1030,7 +1032,8 @@ static void edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata) case EDT_M09: case EDT_M12: reg_addr->reg_threshold = M09_REGISTER_THRESHOLD; - reg_addr->reg_report_rate = NO_REGISTER; + reg_addr->reg_report_rate = tsdata->version == EDT_M12 ? + M12_REGISTER_REPORT_RATE : NO_REGISTER; reg_addr->reg_gain = M09_REGISTER_GAIN; reg_addr->reg_offset = M09_REGISTER_OFFSET; reg_addr->reg_offset_x = NO_REGISTER; -- 2.32.0