From patchwork Thu Feb 24 20:02:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12759181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E1C3C433EF for ; Thu, 24 Feb 2022 20:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:From: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6i3GpSBDId1g7LskEsHCyXFW8IyvQ4p4hk8889F1FHA=; b=bhWfzZI/GhA3YD n5OCQNm+sdambeG/Y2XWcmPtnWy/a0wnHTWG19QJuV7xTu+frLWn2DwjLpNgXxKCM/UpmfwUFlQeg +7qtKX885mUNgtl6KGBnxuOF4EzhNtYFkp29JiXrMAIsjwi6M2yPyl7eQOqOn4BbpOytzlnu+eCG+ KM+xz7SxANZpq8MXvQ9V5tDSxbNZWjs/BgLuafuapML9/nLAneKCM5azhQ0/aqvD/7ROKDjVjPeTU 0tnbnEFrU/rLpMvGAYP9s1qXGLSlZ6tcyOEEzKA1HnUqNkO5L0nUaiM1HuyxGGnYpMQyDptaCrhTd rgGbD6vW14kuKyY15Mtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKJw-002GG0-8k; Thu, 24 Feb 2022 20:02:36 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKJd-002G90-HZ; Thu, 24 Feb 2022 20:02:18 +0000 Received: by mail-ej1-x631.google.com with SMTP id lw4so6578410ejb.12; Thu, 24 Feb 2022 12:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=XMOMyaP+5tw/NTE2jwKE8j7Rm2F5qsTyT92ajHBSVzE=; b=CO0fSRAek4bdCwTabHBOyTV//bomfxsKiwtf24TvCt3E/ghibT7nI1SwynRANTKZOH sJ5EwBa/MKMV0M7Ao2dpvFihZJ4Sp5cnH3tBViWUwjUPSBikbQVXGsZCO4+n3t3ikBb+ SCob2GZQT5W0WUeCOtSEQRImMwq59WQ4F4UowavJeojoDvMGtoyOgypJAYGw02O6rvVK iOD9aWd6bMTaN/0Kd3bVHT+8lw84NMZVfp+FuUwOKx4nJ/wtZ4Dv4xR5sRmH40p3T8Ja 0xeOHNlu6Zi7pxQQM0Z7ohNbwZ/P0XaRr00mOFcjfUH5Q4CMKWG5jxRiMI7uDHAQfUGt txng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=XMOMyaP+5tw/NTE2jwKE8j7Rm2F5qsTyT92ajHBSVzE=; b=4oDDan0mld7R+OnHJOA+WIPiLCPqqI9TRq8GwpBfsycuWPHy4kstpHzyC82cBhRMra LM9LdQnDldLL5iNiv4+pPg5v+FE5GhDBu2DlvaJqeswr2mz26XkH93KhD4LpOT+GhGD8 5gRS4ZOquPtY9vt6g/35S2u54tLLcwldy9ypIPqkE6KSzZSUvux8oi8bEoygmdTenw7Y 9/d8GsHRiB+vRPHcFgoCm8A7zOX5sda+MQ2pYEeBTluT8MqNnvNYGjK909JM4JOGJ7E1 S46W1BcgGH0YZKPsrDdrM6F4Nl5YFCrgq5HbFu1pPL7uuZf8kyvTjVYep3rZP3sV7BU3 eOVQ== X-Gm-Message-State: AOAM533m8bz9BQdKPAGfpZVKDDx0jg58WvF3FGH5k+P2P3U0gnTS4Sc5 MTZpi0RuRI9canT0I33JmHc= X-Google-Smtp-Source: ABdhPJwoQF7agrZ0iFxeuqZW1ispp3xWQbui3gq2JpfwyFy+q8EbyiXnrW3yIfB7IUj7ep7750dKaQ== X-Received: by 2002:a17:906:3b4b:b0:6d3:4b9f:1764 with SMTP id h11-20020a1709063b4b00b006d34b9f1764mr3423702ejf.345.1645732935531; Thu, 24 Feb 2022 12:02:15 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd? (p200300ea8f4d2b0070ade6bd1cea7edd.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd]) by smtp.googlemail.com with ESMTPSA id b22-20020aa7df96000000b0040fb8c4806fsm224276edy.93.2022.02.24.12.02.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Feb 2022 12:02:14 -0800 (PST) Message-ID: <0d3c7622-24c9-f348-010e-a98aca251986@gmail.com> Date: Thu, 24 Feb 2022 21:02:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: [PATCH v4 1/6] dt-bindings: vendor-prefixes: Add Titan Micro Electronics Content-Language: en-US From: Heiner Kallweit To: Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Miguel Ojeda Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." , Jerome Brunet , Martin Blumenstingl , Kevin Hilman , Neil Armstrong , Geert Uytterhoeven References: In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220224_120217_603786_702874BA X-CRM114-Status: UNSURE ( 6.35 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org From: Andreas Färber Assign vendor prefix "titanmec", matching their domain name. Acked-by: Rob Herring Signed-off-by: Andreas Färber Signed-off-by: Heiner Kallweit --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index e062a8187..6ffdec91f 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -1238,6 +1238,8 @@ patternProperties: description: Texas Instruments "^tianma,.*": description: Tianma Micro-electronics Co., Ltd. + "^titanmec,.*": + description: Shenzhen Titan Micro Electronics Co., Ltd. "^tlm,.*": description: Trusted Logic Mobility "^tmt,.*": From patchwork Thu Feb 24 20:03:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12759198 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3A59C433F5 for ; Thu, 24 Feb 2022 20:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:From: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QJygvHhZczcgB6Ox6dcHt2LybgCnfzDzKv3hH8CFCBA=; b=rMo7UGNbHvtJuk ddqbrXocz+YptkA4uH2A3BlWcek8ZTVaSOCu8gVLr1uWme5356k/iaNrPxa8Kto7EaWBHZTfQCCbQ YFr+PDrgdGQT0ZH8q/lFM5wZzt6CcqBnpHBWJoNb2IH5Jo2QnXP1pycvzXhOjOnopQbpN9iKasw6X /1juA048BjGZ0A3mNZr8EGvp0O1Y0bP8xvTwK4aFHTo70sOWVp3blJ04Cfqs6pID9zfNSs5yGwciI ocFgu1ZAUTZV2mp54tjCZq3RaGJlCyMQJ+SYcLRT36XHK7VPvgV+czdnePu8mzUsItj4AQ5eic58I GbujhArMZGp6dc3W7GIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKSm-002Hmg-96; Thu, 24 Feb 2022 20:11:44 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKSZ-002HiF-4c; Thu, 24 Feb 2022 20:11:32 +0000 Received: by mail-ej1-x633.google.com with SMTP id gb39so6711750ejc.1; Thu, 24 Feb 2022 12:11:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=LZieaA8IQfeUiT55cuSm8XlrpapnhQkbMv4PqrRswQs=; b=CaIYE4lGBxmhFUEqszNJ6ZfSr4qMhwZ2Ixf6B5itoz1D70RNdvcxI2uFwJmCMYV/1m tYs/RlOVekU9G4cjKo4Ywb0SXBGI9TOAX7q8kIyDnr190DbDGAS67pciIba+8udgjnv1 9r0fDMQhzZB/YbfDzdCHmYr53kSEDdmTRlvQW6VdNT2QDi29KpjgqKabEQSq5Twkx6Yh nZTb5HANbdVx929RxZE6+xekoynBmiTLUfHf7RsZ2s+K5AH1eDAwv0IpHwcqRcL68Qlq 2uJbk+4C3L0jDjIUG408NlBNM3qy30SuF91Jbhg44Joqs0yiEqnSy8MEkREidPUCNw8o kCQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=LZieaA8IQfeUiT55cuSm8XlrpapnhQkbMv4PqrRswQs=; b=CdXuWJ3hWoH4yoo3bGPz3bR4DI5vRSsm8TgCQ8ekmKCaxnf0cjYY/qGwVGbTx8Dv64 ydLITiDnzevnO5XV9SedfMenErgj0Q7JAq0C30+iz2uof66mrvHBgbJzIDgNnfYKlz9n ABJQYfG+j2VYHnQFnFToHH59dodJmuG2n/Qt3/LNUuZwnXa79HJZ0KpsZMRzcGuLCXEo rhIpFeO+K5RLYcL/dzdqnx71VqhWuZCka5DKW8GASSC+pgiE014FrnAVaMOdVXPCEyTn 7t4q6ZZwEAprkQ3aWGy/jc+Ol79QEeU/eSNyfppwjtXQbupP70826knt1pHHT3rLf82f wNlw== X-Gm-Message-State: AOAM531Xp0vj4F4XAGqvGfUkAY9wdqA67awd/hYN36Mqw86TkTFfOE+O SyGM18SHrnF86PqLpLLqDTYeLXk6V/A= X-Google-Smtp-Source: ABdhPJx0xxe9oOyj3twkXv1sgWzq1cLG+e4+ameBc800P5R31eA18NyH+o7mjr87HALk7kQXpbMjnw== X-Received: by 2002:a17:906:6716:b0:6cc:7d95:90af with SMTP id a22-20020a170906671600b006cc7d9590afmr3546734ejp.442.1645733489127; Thu, 24 Feb 2022 12:11:29 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd? (p200300ea8f4d2b0070ade6bd1cea7edd.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd]) by smtp.googlemail.com with ESMTPSA id hz20-20020a1709072cf400b006d1b5df5c1fsm140379ejc.17.2022.02.24.12.11.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Feb 2022 12:11:28 -0800 (PST) Message-ID: Date: Thu, 24 Feb 2022 21:03:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: [PATCH v4 2/6] dt-bindings: auxdisplay: Add Titan Micro Electronics TM1628 Content-Language: en-US From: Heiner Kallweit To: Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Miguel Ojeda Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." , Jerome Brunet , Martin Blumenstingl , Kevin Hilman , Neil Armstrong , Geert Uytterhoeven References: In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220224_121131_220928_19BF7752 X-CRM114-Status: GOOD ( 12.28 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Add a YAML schema binding for TM1628 auxdisplay (7/11-segment LED) controller. This patch is partially based on previous work from Andreas Färber . Co-developed-by: Andreas Färber Signed-off-by: Andreas Färber Signed-off-by: Heiner Kallweit --- .../bindings/auxdisplay/titanmec,tm1628.yaml | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml diff --git a/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml b/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml new file mode 100644 index 000000000..2a1ef692c --- /dev/null +++ b/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml @@ -0,0 +1,92 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/auxdisplay/titanmec,tm1628.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Titan Micro Electronics TM1628 LED controller + +maintainers: + - Andreas Färber + - Heiner Kallweit + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + const: titanmec,tm1628 + + reg: + maxItems: 1 + + grid: + description: + Mapping of display digit position to grid number. + This implicitly defines the display size. + $ref: /schemas/types.yaml#/definitions/uint8-array + minItems: 1 + maxItems: 7 + + segment-mapping: + description: + Mapping of 7 segment display segments A-G to bit numbers 1-12. + $ref: /schemas/types.yaml#/definitions/uint8-array + minItems: 7 + maxItems: 7 + + "#address-cells": + const: 2 + + "#size-cells": + const: 0 + +required: + - compatible + - reg + +patternProperties: + "^.*@[1-7],([1-9]|1[0-6])$": + type: object + $ref: /schemas/leds/common.yaml# + unevaluatedProperties: false + description: | + Properties for a single LED. + + properties: + reg: + description: | + 1-based grid number, followed by 1-based segment bit number. + maxItems: 1 + + required: + - reg + +unevaluatedProperties: false + +examples: + - | + #include + + spi { + #address-cells = <1>; + #size-cells = <0>; + + led-controller@0 { + compatible = "titanmec,tm1628"; + reg = <0>; + spi-3-wire; + spi-lsb-first; + spi-max-frequency = <500000>; + grid = /bits/ 8 <4 3 2 1>; + segment-mapping = /bits/ 8 <4 5 6 1 2 3 7>; + #address-cells = <2>; + #size-cells = <0>; + + alarmn@5,4 { + reg = <5 4>; + function = LED_FUNCTION_ALARM; + }; + }; + }; +... From patchwork Thu Feb 24 20:05:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12759199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 107B6C433EF for ; Thu, 24 Feb 2022 20:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:From: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=btZn9h1NgBo7HOgwlguGJ1FPxoneOev5enQF1IPEJAs=; b=GsX5liMJGqMsvj Nk8/16NrpUYNPcNfmRcrfDl00ZvWkj3BtOYmXZw/DdIpDIXwzaeuhslbmVXeyrTbhui2NA9Eyr05R s2iBXTLF/pKBl+yxLiJKZXKZNIGdUb19ewK6uY5aOAHGvHdbk3mC+m3fJDCX4A/+sIpyqQ93ePTPk 5+BcUJPJS3iOuhDbiId9iRcpTyYeWVK7/IcfGveB3nCC4ZWYW0+LNavfoxkFcuFbipN98VUHIRinx wkxJOJwOhxv5Kzu6gbRyuV35dIGZHBp7o5p4IVtRGfYUKHpzvBzFaZNNnJFbW8HhZo3D9Ty6NU1yX ckumLwD4PwuzZjAY6c/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKSz-002Hqs-J6; Thu, 24 Feb 2022 20:11:57 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKSa-002HiQ-Dp; Thu, 24 Feb 2022 20:11:33 +0000 Received: by mail-ej1-x634.google.com with SMTP id a23so6690701eju.3; Thu, 24 Feb 2022 12:11:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=UVQe4QpHFzuLZpN6vaQunZm/CaPTqOiqz/VUjJgbjIY=; b=m4GtAAGYO3BkIqRQzP7hsZcEyNeuyay3Jjo2z6wAqy8pzAlVvAWp/C010rUQJkb2bi je2GEOSuEPP9mc5TmrhyLEvNDelV/sql9bY2VPq5UPxFGP0PVTm9tlfWzZt8K70PajHT MnhbShrEp6d0xPUmQRBKBh1IK1Bqj4jqYTogPPzwl38IUzImWXvJlzs2vOOTd74RizAr NA6xSilGzlsaehEHCaPYpvSNs6fjGZa92kvg5nrGua0cSErkd5vC48RvHfteVRZMGQfy x2U0suYB2cpM+diRvAB3KGqJpJXFODFG46Op6NnicHkFHoHXwu22LKAzo433HMYFkhqS FspQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=UVQe4QpHFzuLZpN6vaQunZm/CaPTqOiqz/VUjJgbjIY=; b=ehgNv0C306tXfaIlbw5nQz/dkC5O4KLJ3ALSQXP7iZISjWxAkAc9JaL8UDTnbLhagK crk7yZh7hL0/kaG5I1wR4Eef7YZSUOmcs8aslJd/wmQ/dOOOyLmvNhMxa1dS62cu6u8v BAC1dIuWSgqQsqhEpRbukI4iAInJglFW0qprIGGuyPJBrnegMySLNDDAFRA13wqVKxRL AgFuKTEnYY3EZa9orFzJyJc0nrGFn6/eypS4LPAwEM3YarfWqKQHIc0+Qsrr8cGDW7Fy Ye+LGOhfMby2zpCLFAGctN30p1EZK/YmAODix+Gku2zJclJisvGoXnnsqq/+B98Wj1Rr cAxg== X-Gm-Message-State: AOAM533ZpaxtqB2sO1C2VeKd1388YmxYILOkssrZNXgTwjlFWm/m0WpR cvL+9a3Nk8y0W/lfH/PXHEw= X-Google-Smtp-Source: ABdhPJzObB3m8DZuDRS0hvPr1rvD8F041xotEfnMfzcSRpVuPmAYDkbJiI09GZqa/CJQgIuCX6towA== X-Received: by 2002:a17:906:7e52:b0:6ce:b94d:a97d with SMTP id z18-20020a1709067e5200b006ceb94da97dmr3672271ejr.4.1645733490776; Thu, 24 Feb 2022 12:11:30 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd? (p200300ea8f4d2b0070ade6bd1cea7edd.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd]) by smtp.googlemail.com with ESMTPSA id j18-20020a50d012000000b0040e3ea64d4asm264262edf.31.2022.02.24.12.11.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Feb 2022 12:11:30 -0800 (PST) Message-ID: <21a84254-ae31-3f4f-e1cf-5bd53043e64a@gmail.com> Date: Thu, 24 Feb 2022 21:05:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: [PATCH v4 3/6] docs: ABI: document tm1628 attribute display_text Content-Language: en-US From: Heiner Kallweit To: Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Miguel Ojeda Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." , Jerome Brunet , Martin Blumenstingl , Kevin Hilman , Neil Armstrong , Geert Uytterhoeven References: In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220224_121132_493430_44D34569 X-CRM114-Status: GOOD ( 10.17 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Document the attribute for reading / writing the text to be displayed on the 7 segment display. Signed-off-by: Heiner Kallweit --- Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 diff --git a/Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 b/Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 new file mode 100644 index 000000000..382757e72 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 @@ -0,0 +1,7 @@ +What: /sys/devices/.../display_text +Date: February 2022 +Contact: Heiner Kallweit +Description: + The text to be displayed on the 7 segment display. + Any printable character is allowed as input, but some + can not be displayed in a readable way with 7 segments. From patchwork Thu Feb 24 20:09:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12759200 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C7F4C433F5 for ; Thu, 24 Feb 2022 20:12:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:From: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NZjwTZkAeGlP+dtrqJz8ovZ83HL6manvuf146ME1CUk=; b=HNrhZD5X2jAwqW 6AD44bh5bwg5fY7dNbpcel7gwN9wvs4wywjk1RePrz97kQrrQh51M45sk+bnkjlsQZQAJvsVgGQrm CjwYlRLRHcu6aphqzBubdxKyy5ndR1iQKLw9mBUBjQru4ZB+qCG46dYXdW6iN8fg4G3m3D4Lkofqn HL89yxwPbj9Tw8NQKqZ+vOkCa6f6PNQSRDmEHF2GY6tgagQzOxuUZjHnlnSRv4WsMQH0bHGCE1YJW RaC/QuHFsJOQ6yXat2OsaZl7KajYnjxaQ2C4YMm4uR5mORR+O/2XnQ1bWmsqf6O8ajP5MdfIGKrNk sB2nD8+1f99KlFApn+og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKTK-002I2Q-UP; Thu, 24 Feb 2022 20:12:18 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKSc-002His-4V; Thu, 24 Feb 2022 20:11:36 +0000 Received: by mail-ed1-x534.google.com with SMTP id q17so4486110edd.4; Thu, 24 Feb 2022 12:11:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=7JZIHFAb4KOeDs9WfNdAmyk6iXnEi9VTQeKvvBrUngM=; b=nLKdNWaEVPfwBO2YQ1VRoFVZwqd2jo390JKGKeCU0bfJZWXaFlOhbEHFJEWvhhudJ+ /uKjgnPT9MQ+QDNM2QpYPEXKSw4Y8CPEdAt932o4lV/K5Kg25TfqqP9M6mxwtIcsP+nl eWgUPypu60FGZxAwb732O42IO6qMprwVOmC3Lv9/wAL9KOOXg4Rxrj+9YrUIaoJmxnQB dozwMavrotsbLtAotUBrgc1ZFEIqNzjdVpLj+Z7gj77yItGXc75mCCxC673imbLUwbD8 sAbMv1YLOT4UFV472LP7TbAtgqG71PMLcF5hWm/vbImBQNRwkBJUFFtCxnjXvGoMBTUl as0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=7JZIHFAb4KOeDs9WfNdAmyk6iXnEi9VTQeKvvBrUngM=; b=J05tRZRwhlxiO9jwEnrSNKAa2EB7ID/oHn1u6TVDnm7bDUe1e0Pgu8kOBL5CA7lzen cyt4wuJU5RhZYGU47AUvMgx1244ruvukQnScmMHdBeSkSjzIYrCtofLNep0WZIZP5yEM K+pdw7gkDDeh1WVzGz5uJnLjf2I+yPy9aoXR56nHgnFU4VDXx+lsrA2nrR2Ug5WITcN8 d0zUF5y5OzwIo4kIP56Lcw9kXvHLm72fvsSIa2Jdl7vHU9FSkFDLeQJdpxz/FMUISb99 g4XiD6i7vWLu/73rIEJF2Xyt0Q3WiVVXzp4d9uKVv07EGIHCveZ9MW+QWN8uiIvK4DAJ wGJw== X-Gm-Message-State: AOAM532ij5kYt6YCEv/6pD3O4E8NWxu2v/MRI0vtCRTurS5vQg1R1zT3 KAMWGWMlyCL0DRTLR70PvWM= X-Google-Smtp-Source: ABdhPJzYOKHonPYc8XDdre3OxKOTQaMQF5nBFuTWfKh9uPbcecMgZ++Nst3S1j3OBamdBZHSd00s5w== X-Received: by 2002:a50:9b45:0:b0:410:7cdb:5d3a with SMTP id a5-20020a509b45000000b004107cdb5d3amr4044134edj.275.1645733492161; Thu, 24 Feb 2022 12:11:32 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd? (p200300ea8f4d2b0070ade6bd1cea7edd.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd]) by smtp.googlemail.com with ESMTPSA id v5-20020a056402184500b00412e1a73c7bsm249780edy.61.2022.02.24.12.11.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Feb 2022 12:11:31 -0800 (PST) Message-ID: Date: Thu, 24 Feb 2022 21:09:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: [PATCH v4 4/6] auxdisplay: add support for Titanmec TM1628 7 segment display controller Content-Language: en-US From: Heiner Kallweit To: Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Miguel Ojeda Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." , Jerome Brunet , Martin Blumenstingl , Kevin Hilman , Neil Armstrong , Geert Uytterhoeven References: In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220224_121134_221161_972D7AE0 X-CRM114-Status: GOOD ( 29.44 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org This patch adds support for the Titanmec TM1628 7 segment display controller. It's based on previous RFC work from Andreas Färber. The RFC version placed the driver in the LED subsystem, but this was NAK'ed by the LED maintainer. Therefore I moved the driver to /drivers/auxdisplay what seems most reasonable to me. Further changes to the RFC version: - Driver can be built also w/o LED class support, for displays that don't have any symbols to be exposed as LED's. - Simplified the code and rewrote a lot of it. - Driver is now kind of a MVP, but functionality should be sufficient for most use cases. - Use the existing 7 segment support in uapi/linux/map_to_7segment.h as suggested by Geert Uytterhoeven. Note: There's a number of chips from other manufacturers that are almost identical, e.g. FD628, SM1628. Only difference I saw so far is that they partially support other display modes. TM1628: 6x12, 7x11 SM1628C: 4x13, 5x12, 6x11, 7x10 For typical displays on devices using these chips this difference shouldn't matter. Successfully tested on a TX3 Mini TV box that has an SM1628C and a display with 4 digits and 7 symbols. Co-developed-by: Andreas Färber Signed-off-by: Andreas Färber Signed-off-by: Heiner Kallweit --- v3: - use Co-Developed-by v4: - switch to Co-developed-by - style fixes - fix potential write beyond end in display_text_store() --- drivers/auxdisplay/Kconfig | 11 ++ drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/tm1628.c | 376 ++++++++++++++++++++++++++++++++++++ 3 files changed, 388 insertions(+) create mode 100644 drivers/auxdisplay/tm1628.c diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig index 64012cda4..2764afc5c 100644 --- a/drivers/auxdisplay/Kconfig +++ b/drivers/auxdisplay/Kconfig @@ -203,6 +203,17 @@ config ARM_CHARLCD line and the Linux version on the second line, but that's still useful. +config TM1628 + tristate "TM1628 driver for LED 7/11 segment displays" + depends on SPI + depends on OF || COMPILE_TEST + help + Say Y to enable support for Titan Micro Electronics TM1628 + LED controller. + + It's a 3-wire SPI device controlling a two-dimensional grid of + LEDs. Dimming is applied to all outputs through an internal PWM. + menuconfig PARPORT_PANEL tristate "Parallel port LCD/Keypad Panel support" depends on PARPORT diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile index 6968ed4d3..7728e17e1 100644 --- a/drivers/auxdisplay/Makefile +++ b/drivers/auxdisplay/Makefile @@ -14,3 +14,4 @@ obj-$(CONFIG_HT16K33) += ht16k33.o obj-$(CONFIG_PARPORT_PANEL) += panel.o obj-$(CONFIG_LCD2S) += lcd2s.o obj-$(CONFIG_LINEDISP) += line-display.o +obj-$(CONFIG_TM1628) += tm1628.o diff --git a/drivers/auxdisplay/tm1628.c b/drivers/auxdisplay/tm1628.c new file mode 100644 index 000000000..43d6f2626 --- /dev/null +++ b/drivers/auxdisplay/tm1628.c @@ -0,0 +1,376 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Titan Micro Electronics TM1628 LED controller + * + * Copyright (c) 2019 Andreas Färber + * Copyright (c) 2022 Heiner Kallweit + */ + +#include +#include +#include +#include +#include +#include +#include + +#define TM1628_CMD_DISPLAY_MODE (0 << 6) +#define TM1628_DISPLAY_MODE_6_12 0x02 +#define TM1628_DISPLAY_MODE_7_11 0x03 + +#define TM1628_CMD_DATA (1 << 6) +#define TM1628_DATA_TEST_MODE BIT(3) +#define TM1628_DATA_FIXED_ADDR BIT(2) +#define TM1628_DATA_WRITE_DATA 0x00 +#define TM1628_DATA_READ_DATA 0x02 + +#define TM1628_CMD_DISPLAY_CTRL (2 << 6) +#define TM1628_DISPLAY_CTRL_DISPLAY_ON BIT(3) + +#define TM1628_CMD_SET_ADDRESS (3 << 6) + +#define TM1628_BRIGHTNESS_MAX 7 +#define NUM_LED_SEGS 7 + +/* Physical limits, depending on the mode the chip may support less */ +#define MAX_GRID_SIZE 7 +#define MAX_SEGMENT_NUM 16 + +struct tm1628_led { + struct led_classdev leddev; + struct tm1628 *ctrl; + u32 grid; + u32 seg; +}; + +struct tm1628 { + struct spi_device *spi; + __le16 data[MAX_GRID_SIZE]; + struct mutex disp_lock; + char text[MAX_GRID_SIZE + 1]; + u8 segment_mapping[NUM_LED_SEGS]; + u8 grid[MAX_GRID_SIZE]; + int grid_size; + struct tm1628_led leds[]; +}; + +/* Command 1: Display Mode Setting */ +static int tm1628_set_display_mode(struct spi_device *spi, u8 grid_mode) +{ + const u8 cmd = TM1628_CMD_DISPLAY_MODE | grid_mode; + + return spi_write(spi, &cmd, 1); +} + +/* Command 3: Address Setting */ +static int tm1628_set_address(struct spi_device *spi, u8 offset) +{ + const u8 cmd = TM1628_CMD_SET_ADDRESS | (offset * sizeof(__le16)); + + return spi_write(spi, &cmd, 1); +} + +/* Command 2: Data Setting */ +static int tm1628_write_data(struct spi_device *spi, unsigned int offset, + unsigned int len) +{ + struct tm1628 *s = spi_get_drvdata(spi); + const u8 cmd = TM1628_CMD_DATA | TM1628_DATA_WRITE_DATA; + struct spi_transfer xfers[] = { + { + .tx_buf = &cmd, + .len = 1, + }, + { + .tx_buf = (__force void *)(s->data + offset), + .len = len * sizeof(__le16), + }, + }; + + if (offset + len > MAX_GRID_SIZE) { + dev_err(&spi->dev, "Invalid data address offset %u len %u\n", + offset, len); + return -EINVAL; + } + + tm1628_set_address(spi, offset); + + return spi_sync_transfer(spi, xfers, ARRAY_SIZE(xfers)); +} + +/* Command 4: Display Control */ +static int tm1628_set_display_ctrl(struct spi_device *spi, bool on) +{ + u8 cmd = TM1628_CMD_DISPLAY_CTRL | TM1628_BRIGHTNESS_MAX; + + if (on) + cmd |= TM1628_DISPLAY_CTRL_DISPLAY_ON; + + return spi_write(spi, &cmd, 1); +} + +static int tm1628_show_text(struct tm1628 *s) +{ + static SEG7_CONVERSION_MAP(map_seg7, MAP_ASCII7SEG_ALPHANUM); + int msg_len, i, ret; + + msg_len = strlen(s->text); + + mutex_lock(&s->disp_lock); + + for (i = 0; i < s->grid_size; i++) { + int pos = s->grid[i] - 1; + int j, char7_raw, char7; + + if (i >= msg_len) { + s->data[pos] = 0; + continue; + } + + char7_raw = map_to_seg7(&map_seg7, s->text[i]); + + for (j = 0, char7 = 0; j < NUM_LED_SEGS; j++) { + if (char7_raw & BIT(j)) + char7 |= BIT(s->segment_mapping[j] - 1); + } + + s->data[pos] = cpu_to_le16(char7); + } + + ret = tm1628_write_data(s->spi, 0, s->grid_size); + + mutex_unlock(&s->disp_lock); + + return ret; +} + +static int tm1628_led_set_brightness(struct led_classdev *led_cdev, + enum led_brightness brightness) +{ + struct tm1628_led *led = container_of(led_cdev, struct tm1628_led, leddev); + struct tm1628 *s = led->ctrl; + int ret, offset = led->grid - 1; + __le16 bit = cpu_to_le16(BIT(led->seg - 1)); + + mutex_lock(&s->disp_lock); + + if (brightness == LED_OFF) + s->data[offset] &= ~bit; + else + s->data[offset] |= bit; + + ret = tm1628_write_data(s->spi, offset, 1); + + mutex_unlock(&s->disp_lock); + + return ret; +} + +static enum led_brightness tm1628_led_get_brightness(struct led_classdev *led_cdev) +{ + struct tm1628_led *led = container_of(led_cdev, struct tm1628_led, leddev); + struct tm1628 *s = led->ctrl; + int offset = led->grid - 1; + __le16 bit = cpu_to_le16(BIT(led->seg - 1)); + bool on; + + mutex_lock(&s->disp_lock); + on = s->data[offset] & bit; + mutex_unlock(&s->disp_lock); + + return on ? LED_ON : LED_OFF; +} + +static int tm1628_register_led(struct tm1628 *s, struct fwnode_handle *node, + u32 grid, u32 seg, struct tm1628_led *led) +{ + struct device *dev = &s->spi->dev; + struct led_init_data init_data = { .fwnode = node }; + + led->ctrl = s; + led->grid = grid; + led->seg = seg; + led->leddev.max_brightness = LED_ON; + led->leddev.brightness_set_blocking = tm1628_led_set_brightness; + led->leddev.brightness_get = tm1628_led_get_brightness; + + return devm_led_classdev_register_ext(dev, &led->leddev, &init_data); +} + +static ssize_t display_text_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct tm1628 *s = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%s\n", s->text); +} + +static ssize_t display_text_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct tm1628 *s = dev_get_drvdata(dev); + int ret, i; + + for (i = 0; i < count && i < s->grid_size && isprint(buf[i]); i++) + s->text[i] = buf[i]; + + s->text[i] = '\0'; + + ret = tm1628_show_text(s); + if (ret < 0) + return ret; + + return count; +} + +static const DEVICE_ATTR_RW(display_text); + +static int tm1628_spi_probe(struct spi_device *spi) +{ + struct fwnode_handle *child; + unsigned int num_leds; + struct tm1628 *s; + int ret, i; + + num_leds = device_get_child_node_count(&spi->dev); + + s = devm_kzalloc(&spi->dev, struct_size(s, leds, num_leds), GFP_KERNEL); + if (!s) + return -ENOMEM; + + s->spi = spi; + spi_set_drvdata(spi, s); + + mutex_init(&s->disp_lock); + + /* According to TM1628 datasheet */ + msleep(200); + + /* Clear screen */ + ret = tm1628_write_data(spi, 0, MAX_GRID_SIZE); + if (ret) + return ret; + + /* For now we support 6x12 mode only. This should be sufficient for most use cases */ + ret = tm1628_set_display_mode(spi, TM1628_DISPLAY_MODE_6_12); + if (ret) + return ret; + + ret = tm1628_set_display_ctrl(spi, true); + if (ret) + return ret; + + num_leds = 0; + + if (!IS_REACHABLE(CONFIG_LEDS_CLASS)) + goto no_leds; + + device_for_each_child_node(&spi->dev, child) { + u32 reg[2]; + + ret = fwnode_property_read_u32_array(child, "reg", reg, 2); + if (ret) { + dev_err(&spi->dev, "Reading %s reg property failed (%d)\n", + fwnode_get_name(child), ret); + continue; + } + + if (reg[0] == 0 || reg[0] > MAX_GRID_SIZE) { + dev_err(&spi->dev, "Invalid grid %u at %s\n", + reg[0], fwnode_get_name(child)); + continue; + } + + if (reg[1] == 0 || reg[1] > MAX_SEGMENT_NUM) { + dev_err(&spi->dev, "Invalid segment %u at %s\n", + reg[1], fwnode_get_name(child)); + continue; + } + + ret = tm1628_register_led(s, child, reg[0], reg[1], s->leds + num_leds); + if (ret) { + dev_err(&spi->dev, "Failed to register LED %s (%d)\n", + fwnode_get_name(child), ret); + continue; + } + num_leds++; + } + +no_leds: + ret = device_property_count_u8(&spi->dev, "grid"); + if (ret < 1 || ret > MAX_GRID_SIZE) { + dev_err(&spi->dev, "Invalid display length (%d)\n", ret); + return -EINVAL; + } + + s->grid_size = ret; + + ret = device_property_read_u8_array(&spi->dev, "grid", s->grid, s->grid_size); + if (ret < 0) + return ret; + + for (i = 0; i < s->grid_size; i++) { + if (s->grid[i] < 1 || s->grid[i] > s->grid_size) + return -EINVAL; + } + + ret = device_property_read_u8_array(&spi->dev, "segment-mapping", + s->segment_mapping, NUM_LED_SEGS); + if (ret < 0) + return ret; + + for (i = 0; i < 7; i++) { + if (s->segment_mapping[i] < 1 || s->segment_mapping[i] > MAX_SEGMENT_NUM) + return -EINVAL; + } + + ret = device_create_file(&spi->dev, &dev_attr_display_text); + if (ret) + return ret; + + dev_info(&spi->dev, "Configured display with %u digits and %u symbols\n", + s->grid_size, num_leds); + + return 0; +} + +static void tm1628_spi_remove(struct spi_device *spi) +{ + device_remove_file(&spi->dev, &dev_attr_display_text); + tm1628_set_display_ctrl(spi, false); +} + +static void tm1628_spi_shutdown(struct spi_device *spi) +{ + tm1628_set_display_ctrl(spi, false); +} + +static const struct of_device_id tm1628_spi_of_matches[] = { + { .compatible = "titanmec,tm1628" }, + {} +}; +MODULE_DEVICE_TABLE(of, tm1628_spi_of_matches); + +static const struct spi_device_id tm1628_spi_id_table[] = { + { "tm1628" }, + {}, +}; +MODULE_DEVICE_TABLE(spi, tm1628_spi_id_table); + +static struct spi_driver tm1628_spi_driver = { + .probe = tm1628_spi_probe, + .remove = tm1628_spi_remove, + .shutdown = tm1628_spi_shutdown, + .id_table = tm1628_spi_id_table, + + .driver = { + .name = "tm1628", + .of_match_table = tm1628_spi_of_matches, + }, +}; +module_spi_driver(tm1628_spi_driver); + +MODULE_DESCRIPTION("TM1628 LED controller driver"); +MODULE_AUTHOR("Andreas Färber "); +MODULE_AUTHOR("Heiner Kallweit "); +MODULE_LICENSE("GPL"); From patchwork Thu Feb 24 20:10:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12759201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EC61C433F5 for ; Thu, 24 Feb 2022 20:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:From: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qh8VB7QvxruslWGcp3XuDCO6rwt/Kn55LLyc7qaGs0k=; b=IudXXBO0LLaJ50 BxGxBAK8j4N4ZoZDJ731s4xauC3ziW+bFoaQa+WJS9Lwr+s7z6ttfGUsxDNgypaHqlLeRDJE3ohox LLF4zuImYbS5az/Z/WrfnRD1mNG+B+kDOa/Yj+uaN8iDSGbV+ALkbo2CBueZ7dsQ8TGIm2YURbZLh hNneAasTXuqXd6MNXX9tuN7jfEX8fbx66YMiHjty/eZxMuKYXQYgcv9BFRL5QNh5uwciJperQHm/Q z5Xcf+7uYu+9zyy/B9Gd2bR/ipW439gg34UShslEX2iqLgRKnXhBphddD6uc9Hc0TepFJQeJku9CQ ZQJV7ZwiW0FFuT39kgjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKTh-002IDr-B7; Thu, 24 Feb 2022 20:12:41 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKSd-002HjV-Gg; Thu, 24 Feb 2022 20:11:36 +0000 Received: by mail-ed1-x535.google.com with SMTP id bq11so4497111edb.2; Thu, 24 Feb 2022 12:11:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=kKy0SIhSKIu0kr4V4JEIbxoglz4OmTrfglh5tt6nsYg=; b=QdhW2DCKhmJB5VXGZFJfH7ZF47QkssFORrQn+dwi6ampYfc6DbEvRiB00HukSiD/Xx xLmiCT2E+0K7MEAubTf+4e0pwdJIUhbpjdSNkBFiQM9oSLRRPyKxD+fJ9LpLvIGP0jHI gVpuP4MOmdWQXm7hdJ0juO9V3caTWucEcmf7YJYjMDHOm8Zhon1+lFFhYdophwymy1/R 2tfuko9MQKHhISTAmDY4Pk8RjadWxJOiNCLxJo9RN+c5fGuwOjOYy1xD9HcZ7r34HmwW 1KPwI/Y/yU1HE1nMsY/2lMK7LLYb+XfJatje+2/IjL056fag2LcCeBtt1ebuE76P9/Hb LxRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=kKy0SIhSKIu0kr4V4JEIbxoglz4OmTrfglh5tt6nsYg=; b=UOofJc0TVTvh/pIevSzK5wSEVVr2FY/sMNjHwzYvj2vcTnoq4m0OJBtStcQl0tFgYj fynhIQAiEi/QESp24+gg3wlBVf9BUPzkIRWZhOQbGbKv7vxgLvC6KIlQ0OzHpm8AidPR zpOPIaLIjjvfCNy1p7Ljs3yCu2h9R3jooFUJM+LH0cUsKJQABJMQieZDFj7USDyZDak4 2iTvsmx5svcY4slj9z3GvA7Gaj6j2mpckTfiMbPCbXQT1hNVIvsh5ewwIDLCOOBEihne qvmaaRK8tQ/+QiIJhwwJeVmBaXMbiVY5xOkxaKB7m/QaFzdcyovSaTwrt1COMpF1mKSi g7kQ== X-Gm-Message-State: AOAM531g4HhaYRX7jAKeOIQ2rbQAxXXWsCkhi0DQs5tVTdJoXm9MleUT YQafUZAJMTXavzWjYPrnB0c= X-Google-Smtp-Source: ABdhPJxCCcYxGn8Kcl7NsKJCzdQ4Vl6lcaApJwLzVwVutqb4KSaWgUcrjJg1sBfXDTuQvMAevfEsmA== X-Received: by 2002:a50:8e44:0:b0:40f:d71f:bdf5 with SMTP id 4-20020a508e44000000b0040fd71fbdf5mr4038143edx.166.1645733493712; Thu, 24 Feb 2022 12:11:33 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd? (p200300ea8f4d2b0070ade6bd1cea7edd.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd]) by smtp.googlemail.com with ESMTPSA id q15-20020a1709060e4f00b006cdf4535cf2sm130234eji.67.2022.02.24.12.11.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Feb 2022 12:11:33 -0800 (PST) Message-ID: Date: Thu, 24 Feb 2022 21:10:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: [PATCH v4 5/6] arm64: dts: meson-gxl-s905w-tx3-mini: add support for the 7 segment display Content-Language: en-US From: Heiner Kallweit To: Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Miguel Ojeda Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." , Jerome Brunet , Martin Blumenstingl , Kevin Hilman , Neil Armstrong , Geert Uytterhoeven References: In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220224_121135_618882_21760760 X-CRM114-Status: UNSURE ( 9.53 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org This patch adds support for the 7 segment display of the device. Signed-off-by: Heiner Kallweit --- .../dts/amlogic/meson-gxl-s905w-tx3-mini.dts | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts index 6705c2082..20bbd931e 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts @@ -10,6 +10,7 @@ #include "meson-gxl-s905x.dtsi" #include "meson-gx-p23x-q20x.dtsi" +#include / { compatible = "oranth,tx3-mini", "amlogic,s905w", "amlogic,meson-gxl"; @@ -19,6 +20,64 @@ memory@0 { device_type = "memory"; reg = <0x0 0x0 0x0 0x40000000>; /* 1 GiB or 2 GiB */ }; + + spi { + compatible = "spi-gpio"; + sck-gpios = <&gpio GPIODV_27 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio GPIODV_26 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; + num-chipselects = <1>; + #address-cells = <1>; + #size-cells = <0>; + + tm1628: led-controller@0 { + compatible = "titanmec,tm1628"; + reg = <0>; + spi-3wire; + spi-lsb-first; + spi-rx-delay-us = <1>; + spi-max-frequency = <500000>; + #address-cells = <2>; + #size-cells = <0>; + + segment-mapping = /bits/ 8 <4 5 6 1 2 3 7>; + grid = /bits/ 8 <4 3 2 1>; + + alarm@5,1 { + reg = <5 1>; + function = LED_FUNCTION_ALARM; + }; + + usb@5,2 { + reg = <5 2>; + function = LED_FUNCTION_USB; + }; + play@5,3 { + reg = <5 3>; + function = "play"; + }; + + pause@5,4 { + reg = <5 4>; + function = "pause"; + }; + + colon@5,5 { + reg = <5 5>; + function = "colon"; + }; + + lan@5,6 { + reg = <5 6>; + function = LED_FUNCTION_LAN; + }; + + wlan@5,7 { + reg = <5 7>; + function = LED_FUNCTION_WLAN; + }; + }; + }; }; &ir { From patchwork Thu Feb 24 20:11:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12759202 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B223C433EF for ; Thu, 24 Feb 2022 20:13:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:From: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lrbKSvIbzCvWx087feUH4nod33gfC4qSpQ+gf0UY7nE=; b=WCZ8MYPAxqDHiK nZwKWXGCQmfKCysCmuotrctikfs0HntskA0BrPZSOnMjFobFJQCFWuJWyeI6rGx9vU013MaovaVJv qtqImNQXqSbkav7/TDtmlVA59sn5BdeN2MbFv6dWZ8SdQ/6zvcE+tahYh0K7V8HDdsiKNMXPqcsDs jfbS8mBS3INBrJIQZFkcwUZnPPi2JWH3UnXnSdMwb/+7K8mWaPTPpHAYTYzdmv8z3AAtIHQSOBDtJ tco3E+HvQQ8dFNLGF4NtxQhZEasRsROqPU4z4Cpd2Hi+JZhn4jcnh9s7htlNEYQmF5NIQEACvtgg+ lFRJHAYqfWJtUnTa5m8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKU1-002IOE-FI; Thu, 24 Feb 2022 20:13:01 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNKSe-002Hjn-VZ; Thu, 24 Feb 2022 20:11:38 +0000 Received: by mail-ed1-x52b.google.com with SMTP id s1so4424396edd.13; Thu, 24 Feb 2022 12:11:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=e5NyuFcM6LQ6ck24zC5Lh3fqt3x4cs5RkTNn8b8l2Vk=; b=WW8m6ltpaXjzsUeL8mbZAG+qShtaE0rRC0oJsgH8l16Cgy1HBjPK4SjOi6cc9YXKLY FUJfNFr4zzbeWHGgcbrVYOkyb359yLsSYLIrICroCc8Dfz4N/OTVGEFeAQkxOPu1f4fW PdpD74HRc1Mh9mlT8MkTomiwLIow77sUEE7l5bCUAs1MTdH8+GjcMaAHlm/i3oW9N6lW Si0W3p3tf3bl4ssdMwkdDn6imwemZIgV1yNF8z8s2AjajQPK0btKxnLUyZkCK8p8XCxF Pw8OXgy/8d/mAVufBvqg3c7mwsawDB35XWDB57W2ZxP9rBvOon7fcgYsVtfbpk58Rlmf OfHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=e5NyuFcM6LQ6ck24zC5Lh3fqt3x4cs5RkTNn8b8l2Vk=; b=zp44qXw91Yy8eaqLjhU5fGUxnMmMonT2fHLNDt18Dm/sGDL3cqRIvmT/ELWshQnNga FxTrbzbdtgtAfvmQQUgy1TGqTBn1PkaZUg7rWPi79BLcWiUDSX4FIu8PArVMF+SERoZP LSJlSgHUGYrQO1iTzDWb1RTvi9LSTelB4M1ouT07Ayj2y8l+OSID1WWpsLYxV9gvBbJ9 8mVL3JbnPAtFDiLFFZyiL637GUG/zsBNm2gBef8IKSPf1GGqIfkvUEm+rkxy1tNoZwU5 VGZ96adXSBeTTdtTnmrCTZ9p9GnZ44hBzrsZnPayUp3PwxrVDzZ5s9Fadk1iOUievIf8 qV4g== X-Gm-Message-State: AOAM531au1ENac+r7vTPkB6AE1E57X9JFX8hVnltFOr/B9LHLtjghin2 q+6MTk9OhpsmX/4XQD3nHoc= X-Google-Smtp-Source: ABdhPJzgq2waSqW60Mpej34aIb3d1OVbopNz58VxC3hrhDTV4U4+trNRV9CIxszo/Xe4sDO01llm9A== X-Received: by 2002:a05:6402:c90:b0:410:a0a7:ca5b with SMTP id cm16-20020a0564020c9000b00410a0a7ca5bmr3812607edb.417.1645733495020; Thu, 24 Feb 2022 12:11:35 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd? (p200300ea8f4d2b0070ade6bd1cea7edd.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:70ad:e6bd:1cea:7edd]) by smtp.googlemail.com with ESMTPSA id b7-20020a50e787000000b00412d6970125sm229061edn.104.2022.02.24.12.11.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Feb 2022 12:11:34 -0800 (PST) Message-ID: <0cd06b4a-026b-5705-b36b-1914e63bbf0b@gmail.com> Date: Thu, 24 Feb 2022 21:11:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: [PATCH v4 6/6] MAINTAINERS: Add entry for tm1628 auxdisplay driver Content-Language: en-US From: Heiner Kallweit To: Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Miguel Ojeda Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." , Jerome Brunet , Martin Blumenstingl , Kevin Hilman , Neil Armstrong , Geert Uytterhoeven References: In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220224_121137_121421_82276712 X-CRM114-Status: UNSURE ( 6.60 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Add maintainer entry for tm1628 7-segment LED display driver. Signed-off-by: Heiner Kallweit --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index eb321d82f..d66da447d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19672,6 +19672,13 @@ W: http://sourceforge.net/projects/tlan/ F: Documentation/networking/device_drivers/ethernet/ti/tlan.rst F: drivers/net/ethernet/ti/tlan.* +TM1628 LED CONTROLLER DRIVER +M: Heiner Kallweit +S: Maintained +F: Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml +F: Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 +F: drivers/auxdisplay/tm1628.c + TM6000 VIDEO4LINUX DRIVER M: Mauro Carvalho Chehab L: linux-media@vger.kernel.org