From patchwork Sun Oct 15 21:11:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 733943 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 5F762125C1 for ; Sun, 15 Oct 2023 21:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kPT+E0uf" Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47EA9DA for ; Sun, 15 Oct 2023 14:12:01 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4066692ad35so39843985e9.1 for ; Sun, 15 Oct 2023 14:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697404319; x=1698009119; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UwtY6tuavqhephvZ/IgYYe/hWSZGS4BBH2edbm4GSnk=; b=kPT+E0uf4j2eX3RVpZZjo6cLMrT/BDyl/CZeqSqH1BuDCncNX6vscUEZ5jtEMIqSwX HEfAUzKOn/uGbbPFYJ6KDxDbIgdOwVBQ6MAktIe7hYF+c5fW9+KSO1AaZ9c6mFAsiIJ0 vUHEtZ0G0on1mhJ+aF5JomF+F/2K0HJ4jx7jmygrMTxt3EPvoTo4Gxzt71B6DxmadroH qmVHboP2jAdpDAOmQhtlY/mzRIdy6wHJVWfQS06mvD6T3/osPOsHDYkUgA4Xt1NePzo7 KAnGeoPuEbl8VzHaLTu3GwRfowXf2oL9oDF1WozicwL8YEZjwcUqzjk2Rr99xwcoV0M3 bozg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697404319; x=1698009119; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UwtY6tuavqhephvZ/IgYYe/hWSZGS4BBH2edbm4GSnk=; b=T0FFEZPkQUD1otA+/ytphhmv9cWxRE5TCl6+JEwafUVZAVmInDHReTscWukNvVIK4/ XS4UisNgK86sxHTWJ8qVpqOBHsQgfUBxFfBSHgcYtESppsx6BI9pt+zvDbqOb2UDE0EG uPNIqgoWG/A7ogrbbENcC2l7O/OYCO/DsBFZFg3UiK2wqNHjZWPqgCA79Q+Nqk07X+rV fNIJ1pq6ghutnd6BCY3yMpJ6lIrMDMS4T7uXbQPJRSIeLI/U3ziI0qHKcHxoE8b/K+7z tfquaiA2p7taGZZmHREZ+d8oC1KURZPZ/ofuU6bBwHv/JUeCJmVA4DxHI3Qgnk21e4EJ 7etQ== X-Gm-Message-State: AOJu0YzPO+szlX7RLzpMyqGMgqxwOQ/ISKg6TRoSfduuY8p6QwSONk0f JFeb8aGliWryaSoLw0cPp2iRzQ== X-Google-Smtp-Source: AGHT+IHh3iTommnVZ/SRv1MxHgl7Wi01StwsKU+8qBOPmKCjkBX7ffpF9JSflchte2W1ztXignszaA== X-Received: by 2002:adf:a34b:0:b0:32d:857c:d546 with SMTP id d11-20020adfa34b000000b0032d857cd546mr10994414wrb.64.1697404319736; Sun, 15 Oct 2023 14:11:59 -0700 (PDT) Received: from lion.localdomain (host-2-99-112-229.as13285.net. [2.99.112.229]) by smtp.gmail.com with ESMTPSA id z17-20020a5d4d11000000b0032d9548240fsm8456734wrt.82.2023.10.15.14.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 14:11:59 -0700 (PDT) From: Caleb Connolly Date: Sun, 15 Oct 2023 22:11:49 +0100 Subject: [PATCH v2 1/7] dt-bindings: input: syna,rmi4: document syna,pdt-fallback-desc Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230929-caleb-rmi4-quirks-v2-1-b227ac498d88@linaro.org> References: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> In-Reply-To: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> To: Dmitry Torokhov , Vincent Huang Cc: methanal , linux-input@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Caleb Connolly , "Jason A. Donenfeld" , Matthias Schiffer , Rob Herring , Krzysztof Kozlowski , Conor Dooley X-Mailer: b4 0.13-dev-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=1874; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=3p+nvUWlXAHPVkfrEPpEuMHDYaLsSCwDXEwLrUrxwrY=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlSd0Lk/7wo/CTx0ouNRc/XMnnL1KRFJtp/qvZaw1d0xt /yhsP9LRykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZjIpnSG/zH9PPP2lX2o+dv7 hV3/5eO/sYfqNuyctk1KMTa0b6aiwjyGv4Ka9UlPpnuZ3PXvdPhx+3GNndND/ZsBZ4zW/nfi0g9 /VwcA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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_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 This new property allows devices to specify some register values which are missing on units with third party replacement displays. These displays use unofficial touch ICs which only implement a subset of the RMI4 specification. Signed-off-by: Caleb Connolly --- To: "Jason A. Donenfeld" To: Matthias Schiffer To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley Cc: devicetree@vger.kernel.org --- Documentation/devicetree/bindings/input/syna,rmi4.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/input/syna,rmi4.yaml b/Documentation/devicetree/bindings/input/syna,rmi4.yaml index 4d4e1a8e36be..1f4a2179e4d3 100644 --- a/Documentation/devicetree/bindings/input/syna,rmi4.yaml +++ b/Documentation/devicetree/bindings/input/syna,rmi4.yaml @@ -49,6 +49,21 @@ properties: description: Delay to wait after powering on the device. + syna,pdt-fallback-desc: + $ref: /schemas/types.yaml#/definitions/uint8-matrix + description: + An array of pairs of function number and version. These are used + on some devices with replacement displays that use unofficial touch + controllers. These controllers do report the properties of their Page + Descriptor Table (PDT) entries, but leave the function_number and + function_version registers blank. These values should match exactly + the 5th and 4th bytes of each PDT entry from the original display's + touch controller. + items: + items: + - description: The 5th byte of the PDT entry + - description: The 4th byte of the PDT entry + vdd-supply: true vio-supply: true From patchwork Sun Oct 15 21:11:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 734704 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 6692B12B80 for ; Sun, 15 Oct 2023 21:12:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WqZVAhmi" Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B6F0DE for ; Sun, 15 Oct 2023 14:12:02 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-323ef9a8b59so3783497f8f.3 for ; Sun, 15 Oct 2023 14:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697404320; x=1698009120; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vP0+gS+a1flrzX1mvrP/DkuvCGlYGfyvWtEP75LeBBM=; b=WqZVAhmisB2gW/uwFwZ1ScSRSfYgJywJgIDHDBSmnzrwhsiKsD/jzuzaFidc3ho1gT EKfDd2zIervGiPqNnK2nUHFtmZOX8pTFdbO7PpTlfIK6J7rs2uqGITyWJGtlBFnWpJmk iJt56mOr1aQQIIqAoeW5LntR1t+M6NNjmzlQyfJwQIruWr129v3VcS6FPp1FWEVdQTN6 Kt2e7G6NcZsSrSXmdtk9iCUBjudWUgWbe7lnYNsJ9WJguk8IBkBw+nO7AmazhsSiVsRX LEPr9i/dxoBekuMUeg1bPONTRsEWTZsMTt6iW/5nuiUyl3rq/G+o6sPo+5lH9GUTe/fz c1fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697404320; x=1698009120; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vP0+gS+a1flrzX1mvrP/DkuvCGlYGfyvWtEP75LeBBM=; b=KCcM/jK2LVYhfUAs4MmBXGZBZ6XaEcKPM7fS3MzzQC5qWlylT1x4RZ/TV4gaQMXyQK 3BR6Ubq/emmbXRfaL30ifnCWE3g/CeSlnqFGU9vW1t79iLIICEUcQdufKEN2zL0t4ZI3 5CDk2sL9OwPiEJu6Iml5FqTqg6nRCLB89WDKBEONZ68EKuV+j1kuTDY07kwqGNnWXliJ uZ15jmA5oPxM6PkzMRjQIk7McErBzZ+5EvlxiEK8TFb3rZPOTlQ4tDwC2nTtrmulK7ft rR6CRhobL5iFCyabkJXdDUNJ+TepJxuwcuMPlI+6cUKYvDfQ8Oele9PU4LGnkl7X/rDI vLCg== X-Gm-Message-State: AOJu0YxQzJtKfPa9BEUPEv13gQ0/t2i26xqsBg6h8tNwvkc/lJMy8btD xwlSgGSGYnBURTcWx+EHZaCeo62z2VReIgAk37IU0A== X-Google-Smtp-Source: AGHT+IF24tTLuoUnIGfRI13o7XyLfy+Tj2m+c1SfgAtpjLWn6WVV6NhpPgdqIsXnKT8QjDfPvWKORA== X-Received: by 2002:adf:e50f:0:b0:32d:aed9:413d with SMTP id j15-20020adfe50f000000b0032daed9413dmr1403995wrm.16.1697404320547; Sun, 15 Oct 2023 14:12:00 -0700 (PDT) Received: from lion.localdomain (host-2-99-112-229.as13285.net. [2.99.112.229]) by smtp.gmail.com with ESMTPSA id z17-20020a5d4d11000000b0032d9548240fsm8456734wrt.82.2023.10.15.14.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 14:12:00 -0700 (PDT) From: Caleb Connolly Date: Sun, 15 Oct 2023 22:11:50 +0100 Subject: [PATCH v2 2/7] Input: synaptics-rmi4 - handle duplicate/unknown PDT entries Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230929-caleb-rmi4-quirks-v2-2-b227ac498d88@linaro.org> References: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> In-Reply-To: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> To: Dmitry Torokhov , Vincent Huang Cc: methanal , linux-input@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Caleb Connolly X-Mailer: b4 0.13-dev-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=3674; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=/ncxkYBOHJ0GuwBcZcMHJFqIgTv8HA9Y09NBC9ADCPA=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlSd0LmuCrFxbhGXD/m6virX/1k0QUmlb42HlWb7ogOB8 8xCq890lLIwCHIwyIopsoifWGbZtPayvcb2BRdg5rAygQxh4OIUgIlcqmX4X26rP816mvkKX9Er dvlXuV6ZVTx7+3uzZHHNqu19Kxu7NRl+Mf3/u4xr7uF1OasTvjP3sbtzvPDLsvlQXWC9TJChdFf 2PQA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Some third party rmi4-compatible ICs don't expose their PDT entries very well. Add a few checks to skip duplicate entries as well as entries for unsupported functions. This is required to support some phones with third party displays. Validated on a stock OnePlus 6T (original parts): manufacturer: Synaptics, product: S3706B, fw id: 2852315 Co-developed-by: methanal Signed-off-by: methanal Signed-off-by: Caleb Connolly --- drivers/input/rmi4/rmi_driver.c | 47 +++++++++++++++++++++++++++++++++++------ drivers/input/rmi4/rmi_driver.h | 6 ++++++ 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 258d5fe3d395..cd3e4e77ab9b 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -493,12 +493,44 @@ static void rmi_driver_copy_pdt_to_fd(const struct pdt_entry *pdt, fd->function_version = pdt->function_version; } +static bool rmi_pdt_entry_is_valid(struct rmi_device *rmi_dev, + struct pdt_scan_state *state, u8 fn) +{ + int i; + + switch (fn) { + case 0x01: + case 0x03: + case 0x11: + case 0x12: + case 0x30: + case 0x34: + case 0x3a: + case 0x54: + case 0x55: + break; + + default: + rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, + "PDT has unknown function number %#02x\n", fn); + return false; + } + + for (i = 0; i < state->pdt_count; i++) { + if (state->pdts[i] == fn) + return false; + } + + state->pdts[state->pdt_count++] = fn; + return true; +} + #define RMI_SCAN_CONTINUE 0 #define RMI_SCAN_DONE 1 static int rmi_scan_pdt_page(struct rmi_device *rmi_dev, int page, - int *empty_pages, + struct pdt_scan_state *state, void *ctx, int (*callback)(struct rmi_device *rmi_dev, void *ctx, @@ -521,6 +553,9 @@ static int rmi_scan_pdt_page(struct rmi_device *rmi_dev, if (RMI4_END_OF_PDT(pdt_entry.function_number)) break; + if (!rmi_pdt_entry_is_valid(rmi_dev, state, pdt_entry.function_number)) + continue; + retval = callback(rmi_dev, ctx, &pdt_entry); if (retval != RMI_SCAN_CONTINUE) return retval; @@ -531,11 +566,11 @@ static int rmi_scan_pdt_page(struct rmi_device *rmi_dev, * or more is found, stop scanning. */ if (addr == pdt_start) - ++*empty_pages; + ++state->empty_pages; else - *empty_pages = 0; + state->empty_pages = 0; - return (data->bootloader_mode || *empty_pages >= 2) ? + return (data->bootloader_mode || state->empty_pages >= 2) ? RMI_SCAN_DONE : RMI_SCAN_CONTINUE; } @@ -544,11 +579,11 @@ int rmi_scan_pdt(struct rmi_device *rmi_dev, void *ctx, void *ctx, const struct pdt_entry *entry)) { int page; - int empty_pages = 0; + struct pdt_scan_state state = {0, 0, {0}}; int retval = RMI_SCAN_DONE; for (page = 0; page <= RMI4_MAX_PAGE; page++) { - retval = rmi_scan_pdt_page(rmi_dev, page, &empty_pages, + retval = rmi_scan_pdt_page(rmi_dev, page, &state, ctx, callback); if (retval != RMI_SCAN_CONTINUE) break; diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h index 1c6c6086c0e5..e1a5412f2f8f 100644 --- a/drivers/input/rmi4/rmi_driver.h +++ b/drivers/input/rmi4/rmi_driver.h @@ -46,6 +46,12 @@ struct pdt_entry { u8 function_number; }; +struct pdt_scan_state { + u8 empty_pages; + u8 pdt_count; + u8 pdts[254]; +}; + #define RMI_REG_DESC_PRESENSE_BITS (32 * BITS_PER_BYTE) #define RMI_REG_DESC_SUBPACKET_BITS (37 * BITS_PER_BYTE) From patchwork Sun Oct 15 21:11:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 733942 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 26DB0125C1 for ; Sun, 15 Oct 2023 21:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XDfpOewY" Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34A58E1 for ; Sun, 15 Oct 2023 14:12:03 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-32d81864e3fso3192589f8f.2 for ; Sun, 15 Oct 2023 14:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697404321; x=1698009121; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3J8RLHlqMUHOOwu0JAX+LHiZvvV4F3X/qYQjfJIsE2Q=; b=XDfpOewYfV2TrpTAOAnhUe0FqSl3rA5ql2d0CD9p3X9CTJYfp9xdmlZU/UdDdWu/20 CLMdg1SeGprGiVS8YyeiMvOMKOUwgKVGUB1y+LVDRFMdiDzQevOfO7L94invzzIViHZo tDLYo/p5sioJh23i4agOOyB7sEH8nuGZH1F0w6n7ViCt4tQ98prMCQfpt5iCLxYok1pX SlQv1uQd7huZ4vthTdEYyEhy3lUyrifzLPzCrwpztsnkvK7dBpNMquWzsoeYpZQ3ZMGE 5OlIRjj0RgAbD78/2frVw1DU51qgYdtyxRsoBK9no/gg2ltkcBJ7jujZGkKfeJ0tCAZI Eu0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697404321; x=1698009121; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3J8RLHlqMUHOOwu0JAX+LHiZvvV4F3X/qYQjfJIsE2Q=; b=GQoN0zBUPGSZL/tUeqnfmoI9uZb7q2kAxHGXVb0RkruGHkg929ixG3HjIKJWsxw3Ay JerGgFUI0SF3x36pFrqyT3E8XptwNg3Ozejtyer7Nj35jlVbiTKIhmfgHLFQKdIMK8Ii 3wZsuOr4AtubKrKHCjOr5Mx/aSejorey/hRKwCm/h1xMb8KkdoH/vzq0pSgr7CfbsAyS uNJEgtS71EJTAfx1Pqm82RXJlZUOaRcR/JJp5CeU+XdcgO3uJdKFEyFZSmrc13WVlYQ/ hioEfVVyYB7JNVoA/I6esrWitd4eEG+G1GXqV2D8rmpBeX8znsVnsDnuoCGomsHAD4Ci CLPQ== X-Gm-Message-State: AOJu0Yzm7sGW4jkF3C96eY+PWP+PF2ZgCMDwLvprTkgKouiRPe7zBOgK SfMyXtWJQs5S4G4Xdh6GnKUz9HR64psrWhPmDiB49Q== X-Google-Smtp-Source: AGHT+IE6OynCsb4GHRDPLUzWypJ6Y6PqyEO+HiftdXR6aDbCJR+OpGtqg4RrpAo0iMhD+ntyvB9yXA== X-Received: by 2002:a5d:5b0d:0:b0:32d:8401:4057 with SMTP id bx13-20020a5d5b0d000000b0032d84014057mr13258167wrb.15.1697404321568; Sun, 15 Oct 2023 14:12:01 -0700 (PDT) Received: from lion.localdomain (host-2-99-112-229.as13285.net. [2.99.112.229]) by smtp.gmail.com with ESMTPSA id z17-20020a5d4d11000000b0032d9548240fsm8456734wrt.82.2023.10.15.14.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 14:12:01 -0700 (PDT) From: Caleb Connolly Date: Sun, 15 Oct 2023 22:11:51 +0100 Subject: [PATCH v2 3/7] Input: synaptics-rmi4 - f12: use hardcoded values for aftermarket touch ICs Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230929-caleb-rmi4-quirks-v2-3-b227ac498d88@linaro.org> References: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> In-Reply-To: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> To: Dmitry Torokhov , Vincent Huang Cc: methanal , linux-input@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Caleb Connolly X-Mailer: b4 0.13-dev-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=6118; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=eWdxGMEpVfu6L9JxVtKHUtCsmiQeYQ0ms+XbRoDfZPY=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlSd0LnXrsVnxMb4KZgG8t1xkTKZpmmW/qJ3koXbtqQrk 3+tWre5o5SFQZCDQVZMkUX8xDLLprWX7TW2L7gAM4eVCWQIAxenAEwkNJ6RYePX6IerdGZHdoUm coTuDrz911CnVeCUhH7CadMNKs8uJTD8LxY9ePHGP4e5pyxDYs4ILz8+NeSB5HFOu7Wb391jVJS 0WgMA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: methanal Some replacement displays include third-party touch ICs which are devoid of register descriptors. Create a fake data register descriptor for such ICs and provide hardcoded default values. It isn't possible to reliably determine if the touch IC is original or not, so these fallback values are offered as an alternative to the error path when register descriptors aren't available. Signed-off-by: methanal [changes for readability / codeflow, checkpatch fixes] Signed-off-by: Caleb Connolly --- drivers/input/rmi4/rmi_f12.c | 117 +++++++++++++++++++++++++++++++++---------- 1 file changed, 91 insertions(+), 26 deletions(-) diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index 7e97944f7616..719ee3b42550 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c @@ -195,6 +195,41 @@ static void rmi_f12_process_objects(struct f12_data *f12, u8 *data1, int size) rmi_2d_sensor_abs_report(sensor, &sensor->objs[i], i); } +static void rmi_f12_set_hardcoded_desc(struct rmi_function *fn, struct f12_data *f12) +{ + struct rmi_2d_sensor *sensor = &f12->sensor; + struct rmi_register_desc_item *reg_desc; + + /* We have no f12->data_reg_desc, so the pkt_size is 0, override it with + * a somewhat sensible default (this corresponds to 10 fingers). + */ + sensor->pkt_size = 88; + + /* + * There are no register descriptors to get these values from. + * We set them to high values to either be overwritten by the clip + * properties from devicetree, or to just not get in the way. + */ + sensor->max_x = 65535; + sensor->max_y = 65535; + + /* + * Create the Data1 register descriptor so that touch events + * can work properly. + */ + reg_desc = devm_kcalloc(&fn->dev, 1, + sizeof(struct rmi_register_desc_item), GFP_KERNEL); + reg_desc->reg = 1; + reg_desc->reg_size = 80; + reg_desc->num_subpackets = 10; + + f12->data1 = reg_desc; + f12->data1_offset = 0; + sensor->nbr_fingers = reg_desc->num_subpackets; + sensor->report_abs = 1; + sensor->attn_size += reg_desc->reg_size; +} + static irqreturn_t rmi_f12_attention(int irq, void *ctx) { int retval; @@ -315,6 +350,40 @@ static int rmi_f12_config(struct rmi_function *fn) return 0; } +static int rmi_f12_sensor_init(struct rmi_function *fn, struct f12_data *f12) +{ + struct rmi_2d_sensor *sensor = &f12->sensor; + + sensor->fn = fn; + f12->data_addr = fn->fd.data_base_addr; + + /* On quirky devices that don't have a data_reg_desc we hardcode the packet + * in rmi_f12_set_hardcoded_desc(). Make sure not to set it to 0 here. + */ + if (!sensor->pkt_size) + sensor->pkt_size = rmi_register_desc_calc_size(&f12->data_reg_desc); + + sensor->axis_align = + f12->sensor_pdata.axis_align; + + sensor->x_mm = f12->sensor_pdata.x_mm; + sensor->y_mm = f12->sensor_pdata.y_mm; + sensor->dribble = f12->sensor_pdata.dribble; + + if (sensor->sensor_type == rmi_sensor_default) + sensor->sensor_type = + f12->sensor_pdata.sensor_type; + + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: data packet size: %d\n", __func__, + sensor->pkt_size); + + sensor->data_pkt = devm_kzalloc(&fn->dev, sensor->pkt_size, GFP_KERNEL); + if (!sensor->data_pkt) + return -ENOMEM; + + return 0; +} + static int rmi_f12_probe(struct rmi_function *fn) { struct f12_data *f12; @@ -328,6 +397,7 @@ static int rmi_f12_probe(struct rmi_function *fn) struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); u16 data_offset = 0; int mask_size; + bool hardcoded_desc_quirk = false; rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s\n", __func__); @@ -342,9 +412,9 @@ static int rmi_f12_probe(struct rmi_function *fn) ++query_addr; if (!(buf & BIT(0))) { - dev_err(&fn->dev, - "Behavior of F12 without register descriptors is undefined.\n"); - return -ENODEV; + rmi_dbg(RMI_DEBUG_FN, &fn->dev, + "No register descriptors defined for F12, using fallback\n"); + hardcoded_desc_quirk = true; } f12 = devm_kzalloc(&fn->dev, sizeof(struct f12_data) + mask_size * 2, @@ -352,6 +422,8 @@ static int rmi_f12_probe(struct rmi_function *fn) if (!f12) return -ENOMEM; + dev_set_drvdata(&fn->dev, f12); + f12->abs_mask = (unsigned long *)((char *)f12 + sizeof(struct f12_data)); f12->rel_mask = (unsigned long *)((char *)f12 @@ -370,6 +442,18 @@ static int rmi_f12_probe(struct rmi_function *fn) f12->sensor_pdata = pdata->sensor_pdata; } + sensor = &f12->sensor; + + if (hardcoded_desc_quirk) { + rmi_f12_set_hardcoded_desc(fn, f12); + + ret = rmi_f12_sensor_init(fn, f12); + if (ret) + return ret; + + goto skip_register_desc; + } + ret = rmi_read_register_desc(rmi_dev, query_addr, &f12->query_reg_desc); if (ret) { @@ -400,29 +484,9 @@ static int rmi_f12_probe(struct rmi_function *fn) } query_addr += 3; - sensor = &f12->sensor; - sensor->fn = fn; - f12->data_addr = fn->fd.data_base_addr; - sensor->pkt_size = rmi_register_desc_calc_size(&f12->data_reg_desc); - - sensor->axis_align = - f12->sensor_pdata.axis_align; - - sensor->x_mm = f12->sensor_pdata.x_mm; - sensor->y_mm = f12->sensor_pdata.y_mm; - sensor->dribble = f12->sensor_pdata.dribble; - - if (sensor->sensor_type == rmi_sensor_default) - sensor->sensor_type = - f12->sensor_pdata.sensor_type; - - rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: data packet size: %d\n", __func__, - sensor->pkt_size); - sensor->data_pkt = devm_kzalloc(&fn->dev, sensor->pkt_size, GFP_KERNEL); - if (!sensor->data_pkt) - return -ENOMEM; - - dev_set_drvdata(&fn->dev, f12); + ret = rmi_f12_sensor_init(fn, f12); + if (ret) + return ret; ret = rmi_f12_read_sensor_tuning(f12); if (ret) @@ -520,6 +584,7 @@ static int rmi_f12_probe(struct rmi_function *fn) data_offset += item->reg_size; } +skip_register_desc: /* allocate the in-kernel tracking buffers */ sensor->tracking_pos = devm_kcalloc(&fn->dev, sensor->nbr_fingers, sizeof(struct input_mt_pos), From patchwork Sun Oct 15 21:11:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 733941 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 95019134CE for ; Sun, 15 Oct 2023 21:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="S06nbPkH" Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2FE4E3 for ; Sun, 15 Oct 2023 14:12:03 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4075c58ac39so39800895e9.3 for ; Sun, 15 Oct 2023 14:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697404322; x=1698009122; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NtAKqaERolIHCTmRDg6aGz6W93ZG9oOqGRlldMnpGHM=; b=S06nbPkHKWbq8lMMpSQqliQ6fTwNMaZSNfSkkm3EpX2wjdDaK9BJFVoTbIbVN0p5QA SUKjV4fA3wr3w3PLMBblVBfD4gnVuACSThkuqjounaBgqygKswaeSDeeSo7sGgstsyJ2 jBeZbWPCI/kw04n1aegKD5sN1FJS0C/6tq7MSRy4/zVw707Cw7oD9bmribwyFce7gWWv NVFuDmyo7+cWi6Ts9qvqHdppZMJC+N00mt5VxMdWzevjwnrFpYpXrWU9tNF7DSj8KMC3 Ab23JiqANogCLBmQ3N4Afr7kZRypaGjAHy1YMFVAkrlpabP6ncMDH027IUvkujK9T5cA lUOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697404322; x=1698009122; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NtAKqaERolIHCTmRDg6aGz6W93ZG9oOqGRlldMnpGHM=; b=vwBHvaE7+NLqg5yj55KdsuaiopMQ/W0MWGsbS+3UowcVrLdAVKAlCo2IRHxaNk51EY 3hX//9jJEOzlUiqIupNMsMQV6YF/ZM6+PgpxwtyR5UcVn5bJIIC02Fr0nWOasGbsvUhx E0YR0hY4spsM0hVNujhL1jDXeAgg6QuuUJ8Iqd9ZgK1ooYp5vCP9B1OfdqWQ3Vvzicbf cX16l8AUhMYIcbrTN5nlBcg2AFW6M2lp/syNXnW1hnEEH+Zv16LpOj4sBW7rYMB9CiYy /uo54QDUhJyf/axHZxGKFXjosdYrqI/Ej1kG0ErPahz9Vk/5M8dXx9FqIHzX/oIg8m1R MQvg== X-Gm-Message-State: AOJu0YxDDXXhlM3qySDPL71Tko8TWFXVK9XLk0ny5eR2nwo8gv/JlqRh GfXHRVwd3PzIPyWjDZl8Pgb7vA== X-Google-Smtp-Source: AGHT+IFgQdfSVH6YmUAINQJ2B5pMcPmsn3hKh1y9h+A3RjF+VDAzauaNUq4tqJu8camKnrex2Y1Opw== X-Received: by 2002:adf:f103:0:b0:32d:9cd3:6a9d with SMTP id r3-20020adff103000000b0032d9cd36a9dmr6017864wro.25.1697404322388; Sun, 15 Oct 2023 14:12:02 -0700 (PDT) Received: from lion.localdomain (host-2-99-112-229.as13285.net. [2.99.112.229]) by smtp.gmail.com with ESMTPSA id z17-20020a5d4d11000000b0032d9548240fsm8456734wrt.82.2023.10.15.14.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 14:12:02 -0700 (PDT) From: Caleb Connolly Date: Sun, 15 Oct 2023 22:11:52 +0100 Subject: [PATCH v2 4/7] Input: synaptics-rmi4 - f55: handle zero electrode count Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230929-caleb-rmi4-quirks-v2-4-b227ac498d88@linaro.org> References: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> In-Reply-To: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> To: Dmitry Torokhov , Vincent Huang Cc: methanal , linux-input@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Caleb Connolly X-Mailer: b4 0.13-dev-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=1064; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=+4DaGg6VDRBPUbN6NHpCk9CFy1rQXCDvptUHWZJ41N4=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlSd0Llzrc/3fbiXJq5U8K9m8cPm6UWFBhuNWuo337/2k lNHZpNLRykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZjIBW2Gv8KiTStc2WtcmpSY Wfi2aURt9NuxMyOVQ2/rlMwrH/oCJRgZZgrNZbrEotG15Nx8E9tdnO/ZHLVWcPyVDSyzzxVgM0l 0AAA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: methanal Some third party ICs claim to support f55 but report an electrode count of 0. Catch this and bail out early so that we don't confuse the i2c bus with 0 sized reads. Signed-off-by: methanal [simplify code, adjust wording] Signed-off-by: Caleb Connolly --- drivers/input/rmi4/rmi_f55.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/input/rmi4/rmi_f55.c b/drivers/input/rmi4/rmi_f55.c index 488adaca4dd0..ad2ef14ae9f4 100644 --- a/drivers/input/rmi4/rmi_f55.c +++ b/drivers/input/rmi4/rmi_f55.c @@ -52,6 +52,11 @@ static int rmi_f55_detect(struct rmi_function *fn) f55->num_rx_electrodes = f55->qry[F55_NUM_RX_OFFSET]; f55->num_tx_electrodes = f55->qry[F55_NUM_TX_OFFSET]; + if (!f55->num_rx_electrodes || !f55->num_tx_electrodes) { + rmi_dbg(RMI_DEBUG_FN, &fn->dev, + "F55 query returned no electrodes, giving up\n"); + return 0; + } f55->cfg_num_rx_electrodes = f55->num_rx_electrodes; f55->cfg_num_tx_electrodes = f55->num_rx_electrodes; From patchwork Sun Oct 15 21:11:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 734703 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 38385134B1 for ; Sun, 15 Oct 2023 21:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rj01Tjaw" Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B42AA1 for ; Sun, 15 Oct 2023 14:12:04 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32db8f8441eso47126f8f.0 for ; Sun, 15 Oct 2023 14:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697404323; x=1698009123; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=AedAcjuUgBWTHFeLaxul+tdLLgXY9TFQqJmfe2wIWBo=; b=rj01TjawRDF1rnwTuo6L6vRU2I2bBRWrTIGm08u7MtNruszRqWJFZN3fQxzUAw7l3k 996LsoYfQBt+qydXjluvtLCVZT4U/ppZ2vM+VF8S5728ZCy+A6Ekt381R4U+nosvdMEI ycSTC4O5f02CDzZQNQZmsqthRdgip7XYZ+NkIyaHoRFj+qdtLuwL+F8ejHgQ2KhV5wKT 2UmB96CDN741Z9eBFgQG1pbi8go12HpUm63o+YQ2hxQgzGI6S457ar4WDErp9zv+Oqt3 /kaD8+/d1NFDvJKzQz0XFZ7/0n1S4l5BtFvA2kiNAWjUQSEurKCLaLezJMcO17+ESqIT fOVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697404323; x=1698009123; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AedAcjuUgBWTHFeLaxul+tdLLgXY9TFQqJmfe2wIWBo=; b=F2jQuEzUMyD6F7id1+HZF3MWuqFkVMg/ExUdWS/F53/J+hwpcslWGem5pMQPAeMjha yZY7Z+/WYkVPL44fQg3H7sIVrJK8+r0q1XoozEYkiSzbDCT+FzjxMX0q2Hi8/8z6RYG7 mkwmICl0IPRyT1VJEbcBS1JpyJ3l+0HZzYLgh6ZkQsrxBWnz0Kwjh2Tzr2jqEZdn1U6p mwylRaTAkXKHGzlBr6FsTzNmBbpvfjvg9nIREs3+PC3vJsVk8Wzu1y9QWix/kXQwO1St M+UsZwDaOU3ZgjXg7VceNJckItIMcxjdE0xDm5m6kbGaOsB9gfpjUrQVA35Gk1gl1N/m gkJw== X-Gm-Message-State: AOJu0Yw1lHisjvNtE1hicbjhuTDZY7LoLCZ7eFreE5kBTCXqWNI0Klqn 0Sjo2FncBIDRi2AkTZf9ZvQv1Q== X-Google-Smtp-Source: AGHT+IFGtaaSHr/fYdItsTeYh94JQPuopwM0WAo2Ur2Lhu2fZIQ/jZcsRTaTTdTrv3qzgCslNgvPTg== X-Received: by 2002:a5d:6b8a:0:b0:32d:a4fe:374 with SMTP id n10-20020a5d6b8a000000b0032da4fe0374mr3223214wrx.11.1697404323170; Sun, 15 Oct 2023 14:12:03 -0700 (PDT) Received: from lion.localdomain (host-2-99-112-229.as13285.net. [2.99.112.229]) by smtp.gmail.com with ESMTPSA id z17-20020a5d4d11000000b0032d9548240fsm8456734wrt.82.2023.10.15.14.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 14:12:02 -0700 (PDT) From: Caleb Connolly Date: Sun, 15 Oct 2023 22:11:53 +0100 Subject: [PATCH v2 5/7] Input: synaptics-rmi4 - don't do unaligned reads in IRQ context Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230929-caleb-rmi4-quirks-v2-5-b227ac498d88@linaro.org> References: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> In-Reply-To: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> To: Dmitry Torokhov , Vincent Huang Cc: methanal , linux-input@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Caleb Connolly X-Mailer: b4 0.13-dev-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=2502; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=9h6YnRppF0cn5B+ZZui15RkAbUhNx8UlzxkXST9vk6s=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlSd0Ll89xcduRq/Uelnc5nQ5O7Jdq0KT8s3HNBNsF20r p75wVKljlIWBkEOBlkxRRbxE8ssm9ZettfYvuACzBxWJpAhDFycAjCR55sZ/kdfOrz+kkOJ5dvp N6RtCvYb3hBn4q09NdOt79nz1ild2wMYGZZ/31y+IENSRDF9rhjLnup5fdemRFvdyuGeK2xaydr 3kQ8A X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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_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 From: methanal Some replacement displays include third-party touch ICs which incur a significant penalty (1-2 seconds) when doing certain unaligned reads. This is enough to break functionality when it happens in the hot path, so adjust the interrupt handler to not read from an unaligned address. Signed-off-by: methanal Signed-off-by: Caleb Connolly --- This solution does wind up doing the unaligned reads on the CPU instead, although I'm not sure how significant of a penalty this is in practise. --- drivers/input/rmi4/rmi_driver.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index cd3e4e77ab9b..22f0b35bb70b 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -136,9 +136,14 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) return 0; if (!data->attn_data.data) { + /* + * Read the device status register as well and ignore it. + * Some aftermarket ICs have issues with interrupt requests + * otherwise. + */ error = rmi_read_block(rmi_dev, - data->f01_container->fd.data_base_addr + 1, - data->irq_status, data->num_of_irq_regs); + data->f01_container->fd.data_base_addr, + (u8*)data->irq_status - 1, data->num_of_irq_regs + 1); if (error < 0) { dev_err(dev, "Failed to read irqs, code=%d\n", error); return error; @@ -1083,16 +1088,17 @@ int rmi_probe_interrupts(struct rmi_driver_data *data) data->num_of_irq_regs = (data->irq_count + 7) / 8; size = BITS_TO_LONGS(data->irq_count) * sizeof(unsigned long); - data->irq_memory = devm_kcalloc(dev, size, 4, GFP_KERNEL); + data->irq_memory = devm_kzalloc(dev, size * 4 + 1, GFP_KERNEL); if (!data->irq_memory) { dev_err(dev, "Failed to allocate memory for irq masks.\n"); return -ENOMEM; } - data->irq_status = data->irq_memory + size * 0; - data->fn_irq_bits = data->irq_memory + size * 1; - data->current_irq_mask = data->irq_memory + size * 2; - data->new_irq_mask = data->irq_memory + size * 3; + /* The first byte is reserved for the device status register */ + data->irq_status = data->irq_memory + size * 0 + 1; + data->fn_irq_bits = data->irq_memory + size * 1 + 1; + data->current_irq_mask = data->irq_memory + size * 2 + 1; + data->new_irq_mask = data->irq_memory + size * 3 + 1; return retval; } From patchwork Sun Oct 15 21:11:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 734702 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 B915B12B80 for ; Sun, 15 Oct 2023 21:12:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DRf658wD" Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2479D9 for ; Sun, 15 Oct 2023 14:12:05 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-405361bb9f7so39206685e9.2 for ; Sun, 15 Oct 2023 14:12:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697404324; x=1698009124; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=q1Huhh/OlwpXkMpXKcwHwnmwV8YpnbusYc64GlhC06k=; b=DRf658wDkUo/Cq3RXKfR4B3lt8c95B7YfnB3NEWGf/S0audpENPlvJqHwK7ZACJeOX UN+QixYdjK85RDnRmTeBcejdT1lDkINEikr6t+1hlRzHkvf3qUeiPdKKVfW/JCWhzNOj vmrBECazML6dGWjNxQpuwfB7yBh16I3IsU9zJWoCpqaSTdE9W+wD8jLmChSdUOqiyDyT lKVS5HicDrEYAukl9mfqn5WOMRW1WAyYyxGQ8jk4cZYAyaKHlNxDKzyamynBbSiA16FC hM2U3uXPzyePbjNMRdUmkVGLMfhoscwRcnyXDgvtwTvM4N3Wd6lqfKZny/LfkVamqoga atuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697404324; x=1698009124; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q1Huhh/OlwpXkMpXKcwHwnmwV8YpnbusYc64GlhC06k=; b=ATT1r0vC//S7Dvgxm8kuP98Js5lSps9zsN7RvuDBTPKKQlr5O4Og4MDHQtVC/Z0JY5 keWV8PkwNUJe5FKkdQ9kl9k35Xp4F6rFsaGZoTL261QVZI7iz9/jmrUdAo8OxZMlenHo n/60VrlaC65s8rhll6Dtng0Z3GoP5UOAvK1ZxfacQBMFD4BXPUozBaHP5u/SKyEbRIEX eSx4pXYg3Q/iJz+rf5KIzITszLj/cdSxRsv3a+97tmqg7tMZnORDf0VTvqJA6w0LkJNh gwGiX9iXJ+DWVUxB5ThHlauUNk/mnhmyUZ5i7s2ZuRJh4TQFQ34zbTphEXEMX47SIkMo +DvQ== X-Gm-Message-State: AOJu0Yx5cR2mGRLT+HOS6KqdLcMqE28oI9t1Hi9Kdn2dCVZzU2JiZTIq TRTg9wPoiZmfsA7ta2SxkxYYeg== X-Google-Smtp-Source: AGHT+IFd5LFspYZaIAwsfZI36kiOt4XmrUk4/kAFw3O4e0aQmvqumoqek4alpFIfgO52WOmTe1xs3g== X-Received: by 2002:a5d:4534:0:b0:32d:a3a0:e927 with SMTP id j20-20020a5d4534000000b0032da3a0e927mr3677866wra.58.1697404323892; Sun, 15 Oct 2023 14:12:03 -0700 (PDT) Received: from lion.localdomain (host-2-99-112-229.as13285.net. [2.99.112.229]) by smtp.gmail.com with ESMTPSA id z17-20020a5d4d11000000b0032d9548240fsm8456734wrt.82.2023.10.15.14.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 14:12:03 -0700 (PDT) From: Caleb Connolly Date: Sun, 15 Oct 2023 22:11:54 +0100 Subject: [PATCH v2 6/7] Input: synaptics-rmi4 - read product ID on aftermarket touch ICs Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230929-caleb-rmi4-quirks-v2-6-b227ac498d88@linaro.org> References: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> In-Reply-To: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> To: Dmitry Torokhov , Vincent Huang Cc: methanal , linux-input@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Caleb Connolly X-Mailer: b4 0.13-dev-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=1134; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=pgIIB7OL7EFg+Qrqe6fqxDg+RErXXrlo3Ql+ExoD2SI=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlSd0Lk//jQ0Xbyaa3CypEZL7anF1UdBe6VEuVdE3KhV8 hZvidbqKGVhEORgkBVTZBE/scyyae1le43tCy7AzGFlAhnCwMUpABOZ1MDwT/ns7u3z5vvXcLwR m/XI/XzZGh5Hvm/lVduMb8sa/xbs2MjI0Pd8GevCNU7HPP5pd6bOiteqEUgW1K1++kp1gtpFg/V l0wA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: methanal Some replacement displays include third-party touch ICs which do not report the product ID correctly unless we read directly from the product ID register. Add a check and a fallback read to handle this. Signed-off-by: methanal Signed-off-by: Caleb Connolly --- drivers/input/rmi4/rmi_f01.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c index d7603c50f864..4aee30d2dcde 100644 --- a/drivers/input/rmi4/rmi_f01.c +++ b/drivers/input/rmi4/rmi_f01.c @@ -250,6 +250,20 @@ static int rmi_f01_read_properties(struct rmi_device *rmi_dev, } } + /* + * Some aftermarket ICs put garbage into the product id field unless + * we read directly from the product id register. + */ + if (props->product_id[0] < 0x20) { + ret = rmi_read_block(rmi_dev, query_base_addr + 11, + props->product_id, RMI_PRODUCT_ID_LENGTH); + if (ret) { + dev_err(&rmi_dev->dev, + "Failed to read product id: %d\n", ret); + return ret; + } + } + return 0; } From patchwork Sun Oct 15 21:11:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 733940 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 159C413ADF for ; Sun, 15 Oct 2023 21:12:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KXFLYNrz" Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CBEEE5 for ; Sun, 15 Oct 2023 14:12:06 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4064876e8b8so42452585e9.0 for ; Sun, 15 Oct 2023 14:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697404324; x=1698009124; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IPbEl3a+GSATMX0xKBiAaSsckvKrX/yZx29OiKgfOoY=; b=KXFLYNrzBP3XG8vUv7Qbe+R1hjLRsIqAms2bO9LN8Vegz5NCA7qgUhxSK7QyuQSGkX AL7y3DiPrSeSMfkw4ZbPf7xpXXD6YIGT25Nu3afhuYeFjEg9B5somdQAQGqSgJOgFHWG HbzOTv7OAz5hswSKa90FBNj6yLBgSpnDOhckIxIM/U/FJ8FALtNXq0EVEbnLHLhe1Gc4 0d7h0tYuVOwvZyqsvWHV8q4503Ibwu45gX347cFDjZvRMWWSW4ZFiQEorwhDC/UC6iP4 nEVoihm5giG1MnMd/RbKomJT/Iq970mFehyN+6Y4Q6C1LkzdiFyNLnZ38trSUHC5Bci8 pFSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697404324; x=1698009124; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IPbEl3a+GSATMX0xKBiAaSsckvKrX/yZx29OiKgfOoY=; b=kWzKX3nYUUK+nNBlX3f0/R56H7stXtiAZ/5Sn7RQOOdn5SRHrukwbwusegx8LIBpgW PvyJHw+Hl4bYZnUs/bae7EYcFy3j/sJjGlcO5HnZwo3dmwkmhLdJjSIQt8BPcDDHWsnu LI3XXOnfTMtbF+r5nGZk2W1ijuoSqjR4HY/Gvyn2JLvSQUrrhLgmiF7/Zc8J+/0XHUp2 57+s19H6eOb0tc23Epn33jPDUOvQTOkWFZKXRANo1WdCb3iEywXqTO7M2OtdO6QynJu4 RaAjnWxiMtRjfik/91LsgJtBolxF+fkZRMbUh0U8B06snh8RVA+dYF7skSAhAzwKrVlB BUQw== X-Gm-Message-State: AOJu0YzACo49uJLxPb4CYp26q89NPl+SOcayWr3vZjc+Fk2AGZVE8weM FKtBD2nWmdvEsTSG0//4wkDUpw== X-Google-Smtp-Source: AGHT+IHLJHyAK/IO20D8onfVloDRBZUxAlFnFPYdQTpisAb4QgFcWRCH0lk29htFCqoCn4DWbBKf4g== X-Received: by 2002:adf:ec0f:0:b0:32d:9787:53b6 with SMTP id x15-20020adfec0f000000b0032d978753b6mr6634785wrn.44.1697404324598; Sun, 15 Oct 2023 14:12:04 -0700 (PDT) Received: from lion.localdomain (host-2-99-112-229.as13285.net. [2.99.112.229]) by smtp.gmail.com with ESMTPSA id z17-20020a5d4d11000000b0032d9548240fsm8456734wrt.82.2023.10.15.14.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 14:12:04 -0700 (PDT) From: Caleb Connolly Date: Sun, 15 Oct 2023 22:11:55 +0100 Subject: [PATCH v2 7/7] Input: synaptics-rmi4 - support fallback values for PDT descriptor bytes Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230929-caleb-rmi4-quirks-v2-7-b227ac498d88@linaro.org> References: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> In-Reply-To: <20230929-caleb-rmi4-quirks-v2-0-b227ac498d88@linaro.org> To: Dmitry Torokhov , Vincent Huang Cc: methanal , linux-input@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Caleb Connolly X-Mailer: b4 0.13-dev-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=5774; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=XfJQ2GHO50MV7MnlNjDjRwUK62lemo3DJeS3CYiDH+I=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlSd0LmvBLLdNWwX3vp/WSfrp/zSkOdvei56XD6c9+H8A 6f2TtWsjlIWBkEOBlkxRRbxE8ssm9ZettfYvuACzBxWJpAhDFycAjARpgaG/8kbZsrIOyv4uoc7 8NR5/DmnXbF2d+ixat5yaUFPjjzLdIb/Jc1PXvQ9CdybLueks5BVbv+nnMuBnqkc53tDmBguyoU /BwA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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_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 From: methanal Some replacement displays include third-party touch ICs which do not expose the function number and the interrupt status in its PDT entries. OnePlus 6 (original touch IC) rmi4_i2c 12-0020: read 6 bytes at 0x00e3: 0 (2b 22 0d 06 01 01) OnePlus 6 (aftermarket touch IC) rmi4_i2c 12-0020: read 6 bytes at 0x00e3: 0 (2c 23 0d 06 00 00) Introduce a new devicetree property `syna,pdt-desc` which can be used to provide platform-specific fallback values for users with a replacement display with an aftermarket touch IC. Signed-off-by: methanal [codeflow adjustments, checkpatch fixes, wording] Signed-off-by: Caleb Connolly --- drivers/input/rmi4/rmi_driver.c | 67 ++++++++++++++++++++++++++++++++++++++--- drivers/input/rmi4/rmi_driver.h | 2 ++ include/linux/rmi.h | 3 ++ 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 22f0b35bb70b..f1c09fdb8d73 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -461,9 +461,10 @@ static int rmi_driver_reset_handler(struct rmi_device *rmi_dev) return 0; } -static int rmi_read_pdt_entry(struct rmi_device *rmi_dev, - struct pdt_entry *entry, u16 pdt_address) +static int rmi_read_pdt_entry(struct rmi_device *rmi_dev, struct pdt_entry *entry, + struct pdt_scan_state *state, u16 pdt_address) { + const struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); u8 buf[RMI_PDT_ENTRY_SIZE]; int error; @@ -474,6 +475,21 @@ static int rmi_read_pdt_entry(struct rmi_device *rmi_dev, return error; } + if (pdata->pdt_fallback_size > state->pdt_count * RMI_OF_PDT_DESC_CELLS + 1) { + /* Use the description bytes from DT */ + buf[5] = pdata->pdt_fallback_desc[state->pdt_count * RMI_OF_PDT_DESC_CELLS]; + buf[4] = pdata->pdt_fallback_desc[state->pdt_count * RMI_OF_PDT_DESC_CELLS + 1]; + + error = rmi_read_block(rmi_dev, pdt_address, buf, + RMI_PDT_ENTRY_SIZE - 2); + if (error) { + dev_err(&rmi_dev->dev, + "Read PDT entry at %#06x failed, code: %d.\n", + pdt_address, error); + return error; + } + } + entry->page_start = pdt_address & RMI4_PAGE_MASK; entry->query_base_addr = buf[0]; entry->command_base_addr = buf[1]; @@ -551,7 +567,7 @@ static int rmi_scan_pdt_page(struct rmi_device *rmi_dev, int retval; for (addr = pdt_start; addr >= pdt_end; addr -= RMI_PDT_ENTRY_SIZE) { - error = rmi_read_pdt_entry(rmi_dev, &pdt_entry, addr); + error = rmi_read_pdt_entry(rmi_dev, &pdt_entry, state, addr); if (error) return error; @@ -1028,9 +1044,11 @@ static int rmi_driver_remove(struct device *dev) } #ifdef CONFIG_OF -static int rmi_driver_of_probe(struct device *dev, +static int rmi_driver_of_probe(struct rmi_device *rmi_dev, struct rmi_device_platform_data *pdata) { + struct device *dev = rmi_dev->xport->dev; + u8 buf[RMI_PDT_ENTRY_SIZE]; int retval; retval = rmi_of_property_read_u32(dev, &pdata->reset_delay_ms, @@ -1038,6 +1056,45 @@ static int rmi_driver_of_probe(struct device *dev, if (retval) return retval; + /* + * In some aftermerket touch ICs, the first PDT entry is empty and + * the function number register is 0. If so, the platform + * may have provided backup PDT entries in the device tree. + */ + + retval = rmi_read_block(rmi_dev, PDT_START_SCAN_LOCATION, + buf, RMI_PDT_ENTRY_SIZE); + if (retval) { + dev_err(dev, "Read PDT entry at %#06x failed, code: %d.\n", + PDT_START_SCAN_LOCATION, retval); + return retval; + } + + if (!RMI4_END_OF_PDT(buf[5])) + return 0; + + pdata->pdt_fallback_size = of_property_count_u8_elems(dev->of_node, + "syna,pdt-fallback-desc"); + + /* The rmi4 driver would fail later anyway, so just error out now. */ + if (pdata->pdt_fallback_size == -EINVAL) { + dev_err(dev, "First PDT entry is empty and no backup values provided\n"); + return -EINVAL; + } + + if (pdata->pdt_fallback_size < 0) { + dev_err(dev, "syna,pdt-fallback-desc property was not specified properly: %d\n", + pdata->pdt_fallback_size); + return pdata->pdt_fallback_size; + } + + pdata->pdt_fallback_desc = devm_kzalloc(dev, pdata->pdt_fallback_size, GFP_KERNEL); + + retval = of_property_read_u8_array(dev->of_node, "syna,pdt-fallback-desc", + pdata->pdt_fallback_desc, pdata->pdt_fallback_size); + if (retval < 0) + return retval; + return 0; } #else @@ -1163,7 +1220,7 @@ static int rmi_driver_probe(struct device *dev) pdata = rmi_get_platform_data(rmi_dev); if (rmi_dev->xport->dev->of_node) { - retval = rmi_driver_of_probe(rmi_dev->xport->dev, pdata); + retval = rmi_driver_of_probe(rmi_dev, pdata); if (retval) return retval; } diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h index e1a5412f2f8f..2531c32d6163 100644 --- a/drivers/input/rmi4/rmi_driver.h +++ b/drivers/input/rmi4/rmi_driver.h @@ -31,6 +31,8 @@ #define RMI_PDT_FUNCTION_VERSION_MASK 0x60 #define RMI_PDT_INT_SOURCE_COUNT_MASK 0x07 +#define RMI_OF_PDT_DESC_CELLS 2 + #define PDT_START_SCAN_LOCATION 0x00e9 #define PDT_END_SCAN_LOCATION 0x0005 #define RMI4_END_OF_PDT(id) ((id) == 0x00 || (id) == 0xff) diff --git a/include/linux/rmi.h b/include/linux/rmi.h index ab7eea01ab42..974597960b5e 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -214,6 +214,9 @@ struct rmi_device_platform_data { int reset_delay_ms; int irq; + u8 *pdt_fallback_desc; + int pdt_fallback_size; + struct rmi_device_platform_data_spi spi_data; /* function handler pdata */