From patchwork Sat Sep 30 15:32:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 146962 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp529224vqb; Sat, 30 Sep 2023 11:36:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBPoMZRZOuwF/LindGvKTFceRny9Zg0I1xLq3T8hy/YSx9lZKtTjmzqE3srY3nZeuROh2J X-Received: by 2002:a17:902:f80e:b0:1c7:3156:ca3d with SMTP id ix14-20020a170902f80e00b001c73156ca3dmr7602557plb.57.1696098991603; Sat, 30 Sep 2023 11:36:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696098991; cv=pass; d=google.com; s=arc-20160816; b=HyqfA9OJcpUOj/T2xivwTBv4ZIVKi0sIQ57aPfQ9/FjRRfV29awFpWUEjrXDilgo9B 2V0KixAFWKbS4ql700ox+4dHOq5/zfL7qQ+/eME1E9nw+f5vZM0o1u6MEgTrK4ScOn3s /pFElbyA8DYaDjZ59CNCvTZvtlz0CV6V6X6U+//e0M6cQgSZ77O5Rjm5xoLTLAKzzn/i zciY7Iyd0/UqGpyWud9NLy0z8CFHzG+iDm/Has//iCz/6kuRnhPhManYKZHgntz/z/QI fx6A7whNPrmhSZcLaslzK5FTUhNGzw+n9VBklfwYz3Ebk66ovBqaLstwquALScIvlvhd 1A5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature:dkim-signature; bh=lUzNzqc8pnjA19u06jBcBi2HrnJlfBUjIE0lrHSoBuU=; fh=H4F8PtkBoYP1ArzA3bm8hSQ/P8f+7HD296M+UpmB+dE=; b=Q2S1s4DPF5UN9fIS8WmNRoQpFERfWoNZF0i3xY11G6jhMbXT8lyOLgt28tr3jBSe7z VL8At2AEuZZk8kcdkA7A+9z0ZiSKCfDy+4m9AH+IZL4q15WcYWEUj9irTKdt97UennXq KklpARnzcNHWlKPeS86hhhCuQLHvGsquBb+6NvMmnStjhWH1j2RUl5q/7n44oknzaAVp 7MG9S+WkZQvkyS/OXtJT9XYCWvJPlag2jH8/qjBNQOOUFEXYvNBA0DnMhynSgx4qIiMa G5QwzA5Mv48bQg0IazR/3jaJXZY7fF06wpFOLA6nNqH+9Gf689aWZVnBDFBOM/dEzk2z zK3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=N8aOspzk; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003 header.b=tODsa4OM; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id l16-20020a170903121000b001c62e465391si1476817plh.147.2023.09.30.11.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 11:36:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=N8aOspzk; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003 header.b=tODsa4OM; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 1F71681A9983; Sat, 30 Sep 2023 08:33:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234294AbjI3Pcs (ORCPT + 20 others); Sat, 30 Sep 2023 11:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234194AbjI3Pco (ORCPT ); Sat, 30 Sep 2023 11:32:44 -0400 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [81.169.146.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C49EE6; Sat, 30 Sep 2023 08:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696087943; cv=none; d=strato.com; s=strato-dkim-0002; b=PO+IflfTAql3V+GGvnVr1MW4fk7Y2EOLB+yXPCfXGaKY9llJNy19YW5fwJrMVyqD7B lmNSvHM7a3vyFGy21auCz70rBVOmHfcrV/tJfhPQNGKtcoQu3cYqTLaXBZbaHtIAgSwq cuW/2d8I81hJJhtW8CAukcNuRqRroq2WLsHYLCHXS7TvNFMdhOcUfArpt4K4OgNlm2G2 7iQXYgohTgnkgeGq2TLAlyPHyXZMLePG5SYOZCgY/uK4DC2edvqNbxuzTHUcNy5LQhIY 4+qXe4C7eossLhmG6KZTSUPzQXb5AUYotL5peFi21MJu7jAoQ99/o6ylTCdu0aMBpsgZ JnOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1696087943; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=lUzNzqc8pnjA19u06jBcBi2HrnJlfBUjIE0lrHSoBuU=; b=SZovMR2J3GFg4ZaEGZmVEiIfFsn2wxDD8NUZncXW5L1XKnpbnsPgvP02FhUwaY5PRE 1/GplIw4hoRTjWuAaTmtAkMmctx9thT06Q6IgS43VBbRvON+il6zojGUs5yvWU+Xxdtr 2gbJ+EP2d2O/IGKzpMejm43kkJM5blQBlwvPIT6JRg6iHqWq5IX29jDy0xamx4GNX7h1 J7945RaHJORoXAxuO+95u3P3JGOVFUB/B4uwn7+PFbAu8BVjRsiaDuCayFFBUd3gjmpU DgpNZyQ3sUR5XnA2SfCDU6Fpjbt+W/Mk+I4PazJJ3y15R/LPwrZkYYKSUxuOVVQdFgQ6 wDOw== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1696087943; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=lUzNzqc8pnjA19u06jBcBi2HrnJlfBUjIE0lrHSoBuU=; b=N8aOspzkomxdBHfCJb2xiJMnBdmQx9U5aTQLhkn1s/VgFNH5h+hTJKS+BzRjeOS5Z4 QCbRQH8AHFWPeM6th/UqMLcFUjsOesZvpzrMwvadEw3bYGAbd8kzEy0rWgIogimaB9dg bMUFgBJFCQylwhcsvS8yeRwMfkgcIDvxOchf/MBDRh/bilEHtlOcBsUHwC9Gz1I4GNFV izi+Y24bCY8a6Y8HpGKexwh2WCTPSBQMUE/2MA1e6Rhqm67f40mtx8ojhWkylolR+QrR VXtRIU8a5b4oCPnJHZ5VP64sRsl/fxd6m1Jgq4jbE4RjzzWvJkpZEdAxZCK2jFNWZA+d yuXA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1696087943; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=lUzNzqc8pnjA19u06jBcBi2HrnJlfBUjIE0lrHSoBuU=; b=tODsa4OMuslrCCAI7bwyow0oV2U6K2H4jvO3P9G1ANXSgo9ANz/ITGn/cXWjPbSGoZ 5Yb6gPcdfH21Jcwe22CQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4l+/zY=" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.8.2 DYNA|AUTH) with ESMTPSA id R04c57z8UFWNtXR (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 30 Sep 2023 17:32:23 +0200 (CEST) From: Stephan Gerhold Date: Sat, 30 Sep 2023 17:32:00 +0200 Subject: [PATCH v2 1/2] dt-bindings: input: touchscreen: document Himax HX852x(ES) MIME-Version: 1.0 Message-Id: <20230930-hx852x-v2-1-c5821947b225@gerhold.net> References: <20230930-hx852x-v2-0-c5821947b225@gerhold.net> In-Reply-To: <20230930-hx852x-v2-0-c5821947b225@gerhold.net> To: Dmitry Torokhov Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff LaBundy , Christophe JAILLET , Jonathan Albrieux , Stephan Gerhold , Krzysztof Kozlowski X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 30 Sep 2023 08:33:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778488695889344726 X-GMAIL-MSGID: 1778488695889344726 Himax HX852x(ES) is a touch panel controller with optional support for capacitive touch keys. Unfortunately, the model naming is quite unclear and confusing. There seems to be a distinction between models (e.g. HX8526) and the "series" suffix (e.g. -A, -B, -C, -D, -E, -ES). But this doesn't seem to be applied very consistently because e.g. HX8527-E(44) actually seems to belong to the -ES series. The compatible consists of the actual part number followed by the "series" as fallback compatible. Typically only the latter will be interesting for drivers as there is no relevant difference on the driver side. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Stephan Gerhold --- .../bindings/input/touchscreen/himax,hx852es.yaml | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/himax,hx852es.yaml b/Documentation/devicetree/bindings/input/touchscreen/himax,hx852es.yaml new file mode 100644 index 000000000000..40a60880111d --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/himax,hx852es.yaml @@ -0,0 +1,81 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/touchscreen/himax,hx852es.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Himax HX852x(ES) touch panel controller + +maintainers: + - Stephan Gerhold + +allOf: + - $ref: touchscreen.yaml# + +properties: + compatible: + items: + - enum: + - himax,hx8525e + - himax,hx8526e + - himax,hx8527e + - const: himax,hx852es + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + description: Touch Screen Interrupt (TSIX), active low + + reset-gpios: + maxItems: 1 + description: External Reset (XRES), active low + + vcca-supply: + description: Analog power supply (VCCA) + + vccd-supply: + description: Digital power supply (VCCD) + + touchscreen-inverted-x: true + touchscreen-inverted-y: true + touchscreen-size-x: true + touchscreen-size-y: true + touchscreen-swapped-x-y: true + + linux,keycodes: + minItems: 1 + maxItems: 4 + +required: + - compatible + - reg + - interrupts + - reset-gpios + +additionalProperties: false + +examples: + - | + #include + #include + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + touchscreen@48 { + compatible = "himax,hx8527e", "himax,hx852es"; + reg = <0x48>; + interrupt-parent = <&tlmm>; + interrupts = <13 IRQ_TYPE_LEVEL_LOW>; + reset-gpios = <&tlmm 12 GPIO_ACTIVE_LOW>; + vcca-supply = <®_ts_vcca>; + vccd-supply = <&pm8916_l6>; + linux,keycodes = ; + }; + }; + +... From patchwork Sat Sep 30 15:32:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 146951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp485956vqb; Sat, 30 Sep 2023 09:50:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF2I8mpTVbgI1fgboHNXRaG4S6p3w4FovV/Pr9nZc3VHKDWwCzvy0oTPPyOAy9RDcr80EtI X-Received: by 2002:a05:6870:8a1f:b0:1c8:c128:c38e with SMTP id p31-20020a0568708a1f00b001c8c128c38emr9181875oaq.15.1696092624345; Sat, 30 Sep 2023 09:50:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696092624; cv=pass; d=google.com; s=arc-20160816; b=j3vU8hsN00JQ2gx3JLwRLOE2BvKTa01TR/KbgMsB9gpPwnl4/wB19VE3Rm7/EQ42h1 +T22AheBESCH22X4qMwruFH4ItjWy6tfliXjYO+8HZDzDxhjyHqD0m5e0VZDlK8avtEO BoffUNthWja2jNw24aY4UXbuOiSMiyn/cGYof+ChOXWpXiwXF74OEHNQhOgYqxTaj87+ v8aRoyWniPPbf7CMkfUJ3XbrPn48Fqf35pkzTI/0pjMWFhx44KrSQcAyff/yndDJijfH RAsK8OoY4ex+ECMmnKSZ1kzoOL3M5TbnqmQ0wBQQt+cBj9xqg1G0X8/+bYYSmsd2xs2w fDEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature:dkim-signature; bh=ICjAlxPMwRm9nHLgQhJuVIpLe8Cfi3yjIuQ60zBJvws=; fh=F7Hz7q8qzJxWcZ6ISL4LjA/KpoQBrPXiujnTIrth8F4=; b=iAjeoyUpzvxS3LPB9IIfD4d3OAKF+T6hIRuT0kAYqiVkaezs6s0Bgcv+xe1QhRxfjg COXVK5OzHxXZi3sm/4vHXgp5YdPefX85dqR+a6LgqQfNh59X2sEp74UNjhjXIPRkR94G HDfls2wp1WZ98x6NFyVC9GxSM6HDgdnYQNRFp7DldyMKaK+35uLJs03FL7VYb6JcCv3e IRc+ovNdBeXFHvXDKJIsrUnueqfIPObhKoLtdcCTHHH8i5pt0qpmIOImfCI+7ozQ4sUx oZpPcQtvDKmP3kBl/w6nRNnNpyrC9RJsvJKAlXFnEmdVBaPM+NGijEFPDKrPIRRT1VVp Ltkg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=Vor+ekzQ; dkim=neutral (no key) header.i=@gerhold.net; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id fd9-20020a056a002e8900b006930471d220si14339212pfb.397.2023.09.30.09.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 09:50:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=Vor+ekzQ; dkim=neutral (no key) header.i=@gerhold.net; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BD6E08026ADD; Sat, 30 Sep 2023 08:33:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234356AbjI3Pcx (ORCPT + 20 others); Sat, 30 Sep 2023 11:32:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234304AbjI3Pcs (ORCPT ); Sat, 30 Sep 2023 11:32:48 -0400 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62BACBE; Sat, 30 Sep 2023 08:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696087943; cv=none; d=strato.com; s=strato-dkim-0002; b=Pj4/j/emqmpqoCErow/fokS75+Vcb2VsHQzp+bcBZE5HJoBcB7g4WmuzmZlurg+K4r +BRxT9ZI3I9Q9QgJ3TVo88rTxxDF7K+Nac7EI4j9zf7Jw58DMvVO695MIyaQfX3hj26O OW6GF1MPHlnO1gQdMxsivBK8vNfoDmXXF5fJSZpTbPHoM02nTJS14Bou4E9jfpTDQ/iF lmsZZ2SAfigObk6pKfcWmUqEzv8N2/xsI36b5QmhjgrAUelv3odqoeA4f7snDAbmblo3 cq3O0AlkM5FMgKI7oM28EcnoDLX46phK8n+hBaJzxFR91+bqomW2WmQUOmJjyU4sJVvq x1Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1696087943; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=ICjAlxPMwRm9nHLgQhJuVIpLe8Cfi3yjIuQ60zBJvws=; b=s+nzZkHCqxD2245Lr2W0v67fMRIDprkHVRSL5IgiPHgNget9/lwfdL1lU8Q5fH+IzF 22x5dsRFFMIT/yZopZkgXFPumB9xK7ZgF8/F5+Epftj7eT6Bn/LF69Y1RKRrewQ+oHJ8 CeWAkdsERMlAi5Yv+7z7AKpU6dCPT5f/sMk5ohoTHrk0TZK0T5zJC1XssjfsEAh5k7Qw XOELPDFCHDXtuZmYAnWhLetKN8e3y/GfqScfddOVCxrIt6Nm3WMu7SJ3c3DeTZz0Il34 /730mXg/3t++I1G1TULKYnA0BjZHpXdXhTBYh6ZSRr6TLusdQ9534abq05rSkRHJe2Za bF0w== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1696087943; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=ICjAlxPMwRm9nHLgQhJuVIpLe8Cfi3yjIuQ60zBJvws=; b=Vor+ekzQPQfovTCHX3IDj/4FGzuOqiNYNW72UmqIRL1DcZapf+ZuydMjCKckBW04ZG b/uhkq/FN1oC4VTIfCxUGiWnhrYZOH2NA1QWacz9PMOKgheaQoJ1924bbKb9i94N8TKw PPwwP31qUJuNC2PJrepuR0/6/NjJsVdAMLKr/UO7rzSmZHdlX+nRQBQUSy6qLgIzqNk+ bq3erDrkTTQzRPmDZuHE65H4V0CIdIvqGNMGXoegB4ttY4SGVLjkQwSV9SRWgD1g40kq s4LC2R5q2DtEtnhBHWXuXsPdf1W7OSSqwY2mk+MJw35RpCLkXOdrwvoYjNqhq0IDh2zr ubdA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1696087943; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=ICjAlxPMwRm9nHLgQhJuVIpLe8Cfi3yjIuQ60zBJvws=; b=6MabIHVGY/2gIZ6UNMIPda5RnL6cZTfwEjV6RtEmtgZXf+SZT4E4OABFABWlyRktLO NbGhzKuLVtrNZuxRgvCg== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4l+/zY=" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.8.2 DYNA|AUTH) with ESMTPSA id R04c57z8UFWNtXS (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 30 Sep 2023 17:32:23 +0200 (CEST) From: Stephan Gerhold Date: Sat, 30 Sep 2023 17:32:01 +0200 Subject: [PATCH v2 2/2] Input: add Himax HX852x(ES) touchscreen driver MIME-Version: 1.0 Message-Id: <20230930-hx852x-v2-2-c5821947b225@gerhold.net> References: <20230930-hx852x-v2-0-c5821947b225@gerhold.net> In-Reply-To: <20230930-hx852x-v2-0-c5821947b225@gerhold.net> To: Dmitry Torokhov Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff LaBundy , Christophe JAILLET , Jonathan Albrieux , Stephan Gerhold X-Mailer: b4 0.12.3 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_PASS,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 30 Sep 2023 08:33:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778482019667278981 X-GMAIL-MSGID: 1778482019667278981 From: Jonathan Albrieux Add a simple driver for the Himax HX852x(ES) touch panel controller, with support for multi-touch and capacitive touch keys. The driver is somewhat based on sample code from Himax. However, that code was so extremely confusing that we spent a significant amount of time just trying to understand the packet format and register commands. In this driver they are described with clean structs and defines rather than lots of magic numbers and offset calculations. Signed-off-by: Jonathan Albrieux Co-developed-by: Stephan Gerhold Signed-off-by: Stephan Gerhold --- MAINTAINERS | 7 + drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/himax_hx852x.c | 499 +++++++++++++++++++++++++++++++ 4 files changed, 517 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 90f13281d297..c551c60b0598 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9331,6 +9331,13 @@ S: Maintained F: Documentation/devicetree/bindings/input/touchscreen/himax,hx83112b.yaml F: drivers/input/touchscreen/himax_hx83112b.c +HIMAX HX852X TOUCHSCREEN DRIVER +M: Stephan Gerhold +L: linux-input@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/input/touchscreen/himax,hx852es.yaml +F: drivers/input/touchscreen/himax_hx852x.c + HIPPI M: Jes Sorensen L: linux-hippi@sunsite.dk diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index e3e2324547b9..8e5667ae5dab 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -427,6 +427,16 @@ config TOUCHSCREEN_HIDEEP To compile this driver as a module, choose M here : the module will be called hideep_ts. +config TOUCHSCREEN_HIMAX_HX852X + tristate "Himax HX852x(ES) touchscreen" + depends on I2C + help + Say Y here if you have a Himax HX852x(ES) touchscreen. + If unsure, say N. + + To compile this driver as a module, choose M here: the module + will be called himax_hx852x. + config TOUCHSCREEN_HYCON_HY46XX tristate "Hycon hy46xx touchscreen support" depends on I2C diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 62bd24f3ac8e..f42a87faa86c 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -48,6 +48,7 @@ obj-$(CONFIG_TOUCHSCREEN_EXC3000) += exc3000.o obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o obj-$(CONFIG_TOUCHSCREEN_GOODIX) += goodix_ts.o obj-$(CONFIG_TOUCHSCREEN_HIDEEP) += hideep.o +obj-$(CONFIG_TOUCHSCREEN_HIMAX_HX852X) += himax_hx852x.o obj-$(CONFIG_TOUCHSCREEN_HYNITRON_CSTXXX) += hynitron_cstxxx.o obj-$(CONFIG_TOUCHSCREEN_ILI210X) += ili210x.o obj-$(CONFIG_TOUCHSCREEN_ILITEK) += ilitek_ts_i2c.o diff --git a/drivers/input/touchscreen/himax_hx852x.c b/drivers/input/touchscreen/himax_hx852x.c new file mode 100644 index 000000000000..98a55be7891d --- /dev/null +++ b/drivers/input/touchscreen/himax_hx852x.c @@ -0,0 +1,499 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Himax HX852x(ES) Touchscreen Driver + * Copyright (c) 2020-2023 Stephan Gerhold + * Copyright (c) 2020 Jonathan Albrieux + * + * Based on the Himax Android Driver Sample Code Ver 0.3 for HMX852xES chipset: + * Copyright (c) 2014 Himax Corporation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define HX852X_COORD_SIZE(fingers) ((fingers) * sizeof(struct hx852x_coord)) +#define HX852X_WIDTH_SIZE(fingers) ALIGN(fingers, 4) +#define HX852X_BUF_SIZE(fingers) (HX852X_COORD_SIZE(fingers) + \ + HX852X_WIDTH_SIZE(fingers) + \ + sizeof(struct hx852x_touch_info)) + +#define HX852X_MAX_FINGERS 12 +#define HX852X_MAX_KEY_COUNT 4 +#define HX852X_MAX_BUF_SIZE HX852X_BUF_SIZE(HX852X_MAX_FINGERS) + +#define HX852X_TS_SLEEP_IN 0x80 +#define HX852X_TS_SLEEP_OUT 0x81 +#define HX852X_TS_SENSE_OFF 0x82 +#define HX852X_TS_SENSE_ON 0x83 +#define HX852X_READ_ONE_EVENT 0x85 +#define HX852X_READ_ALL_EVENTS 0x86 +#define HX852X_READ_LATEST_EVENT 0x87 +#define HX852X_CLEAR_EVENT_STACK 0x88 + +#define HX852X_REG_SRAM_SWITCH 0x8c +#define HX852X_REG_SRAM_ADDR 0x8b +#define HX852X_REG_FLASH_RPLACE 0x5a + +#define HX852X_SRAM_SWITCH_TEST_MODE 0x14 +#define HX852X_SRAM_ADDR_CONFIG 0x7000 + +struct hx852x { + struct i2c_client *client; + struct input_dev *input_dev; + struct touchscreen_properties props; + struct gpio_desc *reset_gpiod; + struct regulator_bulk_data supplies[2]; + unsigned int max_fingers; + unsigned int keycount; + unsigned int keycodes[HX852X_MAX_KEY_COUNT]; +}; + +struct hx852x_config { + u8 rx_num; + u8 tx_num; + u8 max_pt; + u8 padding1[3]; + __be16 x_res; + __be16 y_res; + u8 padding2[2]; +} __packed __aligned(4); + +struct hx852x_coord { + __be16 x; + __be16 y; +} __packed __aligned(4); + +struct hx852x_touch_info { + u8 finger_num; + __le16 finger_pressed; + u8 padding; +} __packed __aligned(4); + +static int hx852x_i2c_read(struct hx852x *hx, u8 cmd, void *data, u16 len) +{ + struct i2c_client *client = hx->client; + int ret; + + struct i2c_msg msg[] = { + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = &cmd, + }, + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = len, + .buf = data, + } + }; + + ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); + if (ret != ARRAY_SIZE(msg)) { + dev_err(&client->dev, "failed to read %#x: %d\n", cmd, ret); + return ret; + } + + return 0; +} + +static int hx852x_power_on(struct hx852x *hx) +{ + struct device *dev = &hx->client->dev; + int error; + + error = regulator_bulk_enable(ARRAY_SIZE(hx->supplies), hx->supplies); + if (error) { + dev_err(dev, "failed to enable regulators: %d\n", error); + return error; + } + + gpiod_set_value_cansleep(hx->reset_gpiod, 1); + msleep(20); + gpiod_set_value_cansleep(hx->reset_gpiod, 0); + msleep(20); + + return 0; +} + +static int hx852x_start(struct hx852x *hx) +{ + struct device *dev = &hx->client->dev; + int error; + + error = i2c_smbus_write_byte(hx->client, HX852X_TS_SLEEP_OUT); + if (error) { + dev_err(dev, "failed to send TS_SLEEP_OUT: %d\n", error); + return error; + } + msleep(30); + + error = i2c_smbus_write_byte(hx->client, HX852X_TS_SENSE_ON); + if (error) { + dev_err(dev, "failed to send TS_SENSE_ON: %d\n", error); + return error; + } + msleep(20); + + return 0; +} + +static int hx852x_stop(struct hx852x *hx) +{ + struct device *dev = &hx->client->dev; + int error; + + error = i2c_smbus_write_byte(hx->client, HX852X_TS_SENSE_OFF); + if (error) { + dev_err(dev, "failed to send TS_SENSE_OFF: %d\n", error); + return error; + } + msleep(20); + + error = i2c_smbus_write_byte(hx->client, HX852X_TS_SLEEP_IN); + if (error) { + dev_err(dev, "failed to send TS_SLEEP_IN: %d\n", error); + return error; + } + msleep(30); + + return 0; +} + +static int hx852x_power_off(struct hx852x *hx) +{ + struct device *dev = &hx->client->dev; + int error; + + error = regulator_bulk_disable(ARRAY_SIZE(hx->supplies), hx->supplies); + if (error) + dev_err(dev, "failed to disable regulators: %d\n", error); + return error; +} + +static int hx852x_read_config(struct hx852x *hx) +{ + struct device *dev = &hx->client->dev; + struct hx852x_config conf; + int x_res, y_res; + int error; + + error = hx852x_power_on(hx); + if (error) + return error; + + /* Sensing must be turned on briefly to load the config */ + error = hx852x_start(hx); + if (error) + goto err_power_off; + + error = hx852x_stop(hx); + if (error) + goto err_power_off; + + error = i2c_smbus_write_byte_data(hx->client, HX852X_REG_SRAM_SWITCH, + HX852X_SRAM_SWITCH_TEST_MODE); + if (error) + goto err_power_off; + + error = i2c_smbus_write_word_data(hx->client, HX852X_REG_SRAM_ADDR, + HX852X_SRAM_ADDR_CONFIG); + if (error) + goto err_test_mode; + + error = hx852x_i2c_read(hx, HX852X_REG_FLASH_RPLACE, &conf, sizeof(conf)); + if (error) + goto err_test_mode; + + x_res = be16_to_cpu(conf.x_res); + y_res = be16_to_cpu(conf.y_res); + hx->max_fingers = (conf.max_pt & 0xf0) >> 4; + dev_dbg(dev, "x res: %u, y res: %u, max fingers: %u\n", + x_res, y_res, hx->max_fingers); + + if (hx->max_fingers > HX852X_MAX_FINGERS) { + dev_err(dev, "max supported fingers: %u, found: %u\n", + HX852X_MAX_FINGERS, hx->max_fingers); + error = -EINVAL; + goto err_test_mode; + } + + if (x_res && y_res) { + input_set_abs_params(hx->input_dev, ABS_MT_POSITION_X, 0, x_res - 1, 0, 0); + input_set_abs_params(hx->input_dev, ABS_MT_POSITION_Y, 0, y_res - 1, 0, 0); + } + + error = i2c_smbus_write_byte_data(hx->client, HX852X_REG_SRAM_SWITCH, 0); + if (error) + goto err_power_off; + + return hx852x_power_off(hx); + +err_test_mode: + i2c_smbus_write_byte_data(hx->client, HX852X_REG_SRAM_SWITCH, 0); +err_power_off: + hx852x_power_off(hx); + return error; +} + +static int hx852x_handle_events(struct hx852x *hx) +{ + /* + * The event packets have variable size, depending on the amount of + * supported fingers (hx->max_fingers). They are laid out as follows: + * - struct hx852x_coord[hx->max_fingers]: Coordinates for each finger + * - u8[ALIGN(hx->max_fingers, 4)]: Touch width for each finger + * with padding for 32-bit alignment + * - struct hx852x_touch_info + * + * Load everything into a 32-bit aligned buffer so the coordinates + * can be assigned directly, without using get_unaligned_*(). + */ + u8 buf[HX852X_MAX_BUF_SIZE] __aligned(4); + struct hx852x_coord *coord = (struct hx852x_coord *)buf; + u8 *width = &buf[HX852X_COORD_SIZE(hx->max_fingers)]; + struct hx852x_touch_info *info = (struct hx852x_touch_info *) + &width[HX852X_WIDTH_SIZE(hx->max_fingers)]; + unsigned long finger_pressed, key_pressed; + unsigned int i, x, y, w; + int error; + + error = hx852x_i2c_read(hx, HX852X_READ_ALL_EVENTS, buf, + HX852X_BUF_SIZE(hx->max_fingers)); + if (error) + return error; + + finger_pressed = get_unaligned_le16(&info->finger_pressed); + key_pressed = finger_pressed >> HX852X_MAX_FINGERS; + + /* All bits are set when no touch is detected */ + if (info->finger_num == 0xff || !(info->finger_num & 0x0f)) + finger_pressed = 0; + if (key_pressed == 0xf) + key_pressed = 0; + + for_each_set_bit(i, &finger_pressed, hx->max_fingers) { + x = be16_to_cpu(coord[i].x); + y = be16_to_cpu(coord[i].y); + w = width[i]; + + input_mt_slot(hx->input_dev, i); + input_mt_report_slot_state(hx->input_dev, MT_TOOL_FINGER, 1); + touchscreen_report_pos(hx->input_dev, &hx->props, x, y, true); + input_report_abs(hx->input_dev, ABS_MT_TOUCH_MAJOR, w); + } + input_mt_sync_frame(hx->input_dev); + + for (i = 0; i < hx->keycount; i++) + input_report_key(hx->input_dev, hx->keycodes[i], key_pressed & BIT(i)); + + input_sync(hx->input_dev); + return 0; +} + +static irqreturn_t hx852x_interrupt(int irq, void *ptr) +{ + struct hx852x *hx = ptr; + int error; + + error = hx852x_handle_events(hx); + if (error) { + dev_err_ratelimited(&hx->client->dev, "failed to handle events: %d\n", error); + return IRQ_NONE; + } + + return IRQ_HANDLED; +} + +static int hx852x_input_open(struct input_dev *dev) +{ + struct hx852x *hx = input_get_drvdata(dev); + int error; + + error = hx852x_power_on(hx); + if (error) + return error; + + error = hx852x_start(hx); + if (error) { + hx852x_power_off(hx); + return error; + } + + enable_irq(hx->client->irq); + return 0; +} + +static void hx852x_input_close(struct input_dev *dev) +{ + struct hx852x *hx = input_get_drvdata(dev); + + hx852x_stop(hx); + disable_irq(hx->client->irq); + hx852x_power_off(hx); +} + +static int hx852x_parse_properties(struct hx852x *hx) +{ + struct device *dev = &hx->client->dev; + int error; + + hx->keycount = device_property_count_u32(dev, "linux,keycodes"); + if (hx->keycount <= 0) { + hx->keycount = 0; + return 0; + } + + if (hx->keycount > HX852X_MAX_KEY_COUNT) { + dev_err(dev, "max supported keys: %u, found: %u\n", + HX852X_MAX_KEY_COUNT, hx->keycount); + return -EINVAL; + } + + error = device_property_read_u32_array(dev, "linux,keycodes", + hx->keycodes, hx->keycount); + if (error) + dev_err(dev, "failed to read linux,keycodes: %d\n", error); + + return error; +} + +static int hx852x_probe(struct i2c_client *client) +{ + struct device *dev = &client->dev; + struct hx852x *hx; + int error, i; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C | + I2C_FUNC_SMBUS_WRITE_BYTE | + I2C_FUNC_SMBUS_WRITE_BYTE_DATA | + I2C_FUNC_SMBUS_WRITE_WORD_DATA)) { + dev_err(dev, "not all required i2c functionality supported\n"); + return -ENXIO; + } + + hx = devm_kzalloc(dev, sizeof(*hx), GFP_KERNEL); + if (!hx) + return -ENOMEM; + + hx->client = client; + hx->input_dev = devm_input_allocate_device(dev); + if (!hx->input_dev) + return -ENOMEM; + + hx->input_dev->name = "Himax HX852x"; + hx->input_dev->id.bustype = BUS_I2C; + hx->input_dev->open = hx852x_input_open; + hx->input_dev->close = hx852x_input_close; + + i2c_set_clientdata(client, hx); + input_set_drvdata(hx->input_dev, hx); + + hx->supplies[0].supply = "vcca"; + hx->supplies[1].supply = "vccd"; + error = devm_regulator_bulk_get(dev, ARRAY_SIZE(hx->supplies), hx->supplies); + if (error) + return dev_err_probe(dev, error, "failed to get regulators\n"); + + hx->reset_gpiod = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(hx->reset_gpiod)) + return dev_err_probe(dev, PTR_ERR(hx->reset_gpiod), + "failed to get reset gpio\n"); + + error = devm_request_threaded_irq(dev, client->irq, NULL, hx852x_interrupt, + IRQF_ONESHOT | IRQF_NO_AUTOEN, NULL, hx); + if (error) + return dev_err_probe(dev, error, "failed to request irq %d", client->irq); + + error = hx852x_read_config(hx); + if (error) + return error; + + input_set_capability(hx->input_dev, EV_ABS, ABS_MT_POSITION_X); + input_set_capability(hx->input_dev, EV_ABS, ABS_MT_POSITION_Y); + input_set_abs_params(hx->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); + + touchscreen_parse_properties(hx->input_dev, true, &hx->props); + error = hx852x_parse_properties(hx); + if (error) + return error; + + hx->input_dev->keycode = hx->keycodes; + hx->input_dev->keycodemax = hx->keycount; + hx->input_dev->keycodesize = sizeof(hx->keycodes[0]); + for (i = 0; i < hx->keycount; i++) + input_set_capability(hx->input_dev, EV_KEY, hx->keycodes[i]); + + error = input_mt_init_slots(hx->input_dev, hx->max_fingers, + INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); + if (error) + return dev_err_probe(dev, error, "failed to init MT slots\n"); + + error = input_register_device(hx->input_dev); + if (error) + return dev_err_probe(dev, error, "failed to register input device\n"); + + return 0; +} + +static int hx852x_suspend(struct device *dev) +{ + struct hx852x *hx = dev_get_drvdata(dev); + + mutex_lock(&hx->input_dev->mutex); + if (input_device_enabled(hx->input_dev)) + hx852x_stop(hx); + mutex_unlock(&hx->input_dev->mutex); + + return 0; +} + +static int hx852x_resume(struct device *dev) +{ + struct hx852x *hx = dev_get_drvdata(dev); + int error = 0; + + mutex_lock(&hx->input_dev->mutex); + if (input_device_enabled(hx->input_dev)) + error = hx852x_start(hx); + mutex_unlock(&hx->input_dev->mutex); + + return error; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(hx852x_pm_ops, hx852x_suspend, hx852x_resume); + +#ifdef CONFIG_OF +static const struct of_device_id hx852x_of_match[] = { + { .compatible = "himax,hx852es" }, + { } +}; +MODULE_DEVICE_TABLE(of, hx852x_of_match); +#endif + +static struct i2c_driver hx852x_driver = { + .probe = hx852x_probe, + .driver = { + .name = "himax_hx852x", + .pm = pm_sleep_ptr(&hx852x_pm_ops), + .of_match_table = of_match_ptr(hx852x_of_match), + }, +}; +module_i2c_driver(hx852x_driver); + +MODULE_DESCRIPTION("Himax HX852x(ES) Touchscreen Driver"); +MODULE_AUTHOR("Jonathan Albrieux "); +MODULE_AUTHOR("Stephan Gerhold "); +MODULE_LICENSE("GPL");