From patchwork Fri Feb 25 21:10:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12760962 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 E8420C433F5 for ; Fri, 25 Feb 2022 21:25:28 +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=gAkR+UTIIO31F5GLTlWBQ2Fym5ALe7w5uEtcj9w9N18=; b=f2Ap6uh9fOMNM4 kPL3m6LQ3TkwSsDbNCrmmVIlMatx7ZTF6XC7N++ijwaQfUxndopyE6SJWHmfkq3Liu1BjtG9gWZ7v sskOJnDYNw8JvSJybnd1xzv3rmZfAM0v0K4FILAFQo+TtDDQxcGELoMk/WubWVD0MvpRa1m4+aTnS bdii42HGVXQ3HuG15E8SxGwmv+/i0rDGsJ9CbqfJ5YeVWz4nsrtwmm3/dpIQD/ORRLNPpBx4FBmNq OpgewhcZygVl5ttcckZElEMsfKG3UuKD6GO1NxYVeGjkMke1CybhuRSkiauPaHwS+S6fpoQot7D0b WPvjgcqesZsRgJY0bD/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi4L-0070WB-4s; Fri, 25 Feb 2022 21:24:05 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi46-0070Qw-MC; Fri, 25 Feb 2022 21:23:52 +0000 Received: by mail-ej1-x62f.google.com with SMTP id bg10so13268379ejb.4; Fri, 25 Feb 2022 13:23:50 -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=IjNy65ihmU+6AEvk3BdFsxIrkof69TC3Pxon5+csXTU78W9JB1ejc+cmw81jqxkZbP ViMqvn7ttZp9FOPHUXH0y592rsX8cVkQyzrN2uLRYYInqTE4k0A2PvRx6c7kXj4UqrjK MEcLwHeO2eaMhj4ClKTqofOqdKWHBRR7w7XGD+LtCubXBUFXcHQtYSSKAU65uI2X7uWD EBlfSmCZ6G9OQMImiK0lVp/P4kkenpQAUrSEqyRNX0sFMly9sK2d9NqT6a8M8BH9HajS S3rC1U09VDscCN81zwZ607P5R8p57OjobrRXy9fS8HpMc0B8a4GWZdMS/KUL1N7QJiP4 ai2g== 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=e+Jc33ncYcudfoaRSEmyDdts/izXwZuZkwLtjVqj6BoXxEnMBlknzNtxHZclBsswg7 ydOfepcc9S7cOg/bA7GhAakEkMQmCnR7lMhIPb4Y1aZObd/zODFYkmkIRjdn4RGF4LjI da+2dSkARiSRcl3ccFH6F28svPnYUKiOi9GQY5uYb1lddMpJuGs5w7kc+cOfgqgqUA4e LbFqVhX1SCZ53XXGwXPFJ2+oKhwUGxYRNMAZ/Tmrrqjz6xsVaWZJD0GM2zMOBoC9T2Rh EBwUzFNAF9d0aouh7cxAiI/f8uql9o8HlkUeBSoyBkJaPCW8RJM2uOF6TQJVokImzsai l/Qw== X-Gm-Message-State: AOAM532LBh0UomlLdT2pzk8RJ8cdq3A9uZr9SnYuOgaV3bureZzLm95v u+uFLZDDJmYA15QpsnXrrQA= X-Google-Smtp-Source: ABdhPJz7EKJhsLg03UN9iq/z6v8bEQ6eCSnzB0QD7Ao+asSXXmsuw5PyGkcL9GCrBqQ6giKMfyQzIQ== X-Received: by 2002:a17:906:9b88:b0:6d0:f843:4068 with SMTP id dd8-20020a1709069b8800b006d0f8434068mr7369328ejc.678.1645824227108; Fri, 25 Feb 2022 13:23:47 -0800 (PST) Received: from ?IPV6:2a01:c22:7326:e100:c9d3:3c62:2c99:d44b? (dynamic-2a01-0c22-7326-e100-c9d3-3c62-2c99-d44b.c22.pool.telefonica.de. [2a01:c22:7326:e100:c9d3:3c62:2c99:d44b]) by smtp.googlemail.com with ESMTPSA id bd3-20020a056402206300b00410a4ac2802sm1878229edb.66.2022.02.25.13.23.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Feb 2022 13:23:46 -0800 (PST) Message-ID: Date: Fri, 25 Feb 2022 22:10:06 +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 v5 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: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> In-Reply-To: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220225_132350_748775_8A262653 X-CRM114-Status: UNSURE ( 6.38 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 Fri Feb 25 21:13:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12760964 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 E2914C433EF for ; Fri, 25 Feb 2022 21:25:32 +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=v2RZpeflLCBqFAUHYMwCwB89P51NevF2y9VMcrQxAUQ=; b=QKRsUKauuRBIqd 7ZaoEzF5vxJOunkv0w0wilBD/KNIdLV/Baf88jcDaxCrgv08J7/ZU11WzdJPoz7mgPaDo8JdDYFD2 oCqz0um23XCn+mya4SqGfDZDW6/VQdEKC5eB2lonEtVYh8UA2aqG0kbfOi6hr7YXabtcIXC8tO2xh xM/yI1u3u/wsBPLO2muft19jq0x1Q1vgHT2+xLtyG/6KDcmV9YiMOKEAD2AE0Ial1/BdBrRWM9dTO xVKB3AHR6KNmcfzQGOCi3oiZL+7wBpuMIpmd311cmDhbDxeCTmqvM+MCDMhZ1jfK7KQlKfRHh6GdF LssRg9B7j8jHj2FuV/Ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi4A-0070SU-02; Fri, 25 Feb 2022 21:23:54 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi45-0070Qu-Lg; Fri, 25 Feb 2022 21:23:51 +0000 Received: by mail-ed1-x531.google.com with SMTP id h15so9139428edv.7; Fri, 25 Feb 2022 13:23:49 -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=QFvRzvIdRv3xplrJSGk7DMQfwafyCoO+jIxn5A7f+Mo=; b=geFvYOtYlAzZW5zPxS0omthKPQef/gERvsIFmb0VHNW6XMnc+Z5ob5eozbesva5yPr 72J4JMaInvqxY2jqPbpaI1UkEjzb4uzUPFcZXW48EeYT4cbfennd8+ZOH2vQF4LExoOo xt8I0sW+fKIPcboP/lp6KEpt5b8ve0SgyvFiel7TFGIRpGvz+lY7qejjkxbkDq7hkQcG CtOCaK2tSj4Qeg+kYGLwwMgfzrbNVPnX+UK4yVGcxhtPNHoOKuAl15GkXT04mzr2VAgl nBsMcjStzMttlCxfjct7DaL5VmhC+r7JnzZrLhHRxLZzOo8I2TyC3NsS0mSkEZ8rU8cb gEgA== 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=QFvRzvIdRv3xplrJSGk7DMQfwafyCoO+jIxn5A7f+Mo=; b=e9MxXl98LNUU0dwErtmFmbfS4EuKHtXkfHYU9CAcTaCC5uvkGwcdsVAfPef36DqErl sujE6uYtj4armBa/qlL5SWIsyyy/1DMaDVuzF8vP/0xF5VCjZJvNiJxPxR+2n/WrDvfV l76vAM/rBJV2BFOySLGwkyWg/DOv2nMdbVqeEwKIkHS3xzxO0MDWBgyKSyG24c2pS1Zq 8gY8DZLeMX3ZRxRAR9RE1KkNsf9vKd3ioITmIfUSmcWl10//gJ4Su9W504skXl+yJJxh RxQ/FL9GOe/8uooaVsCYywkkB1eZ+fiMrnnW93nKWcynDXSTXp8fulvwAqzzY3lAX/HM Nzcg== X-Gm-Message-State: AOAM532zF4xcoqugzs+7Puc6xmEPAuxY0zf0dHjvxhDZHZ71ocY+V8DV aihcl4mHBIcOiDJqQW4yAdM= X-Google-Smtp-Source: ABdhPJybxPWcIY7zb9JmvYjISMMVpmpNYRzrKQ7c/vcl+xvi88vo5XSX1q9NnfQSZTQIWu8iqUMpJA== X-Received: by 2002:a05:6402:6da:b0:3fd:cacb:f4b2 with SMTP id n26-20020a05640206da00b003fdcacbf4b2mr9055727edy.332.1645824228405; Fri, 25 Feb 2022 13:23:48 -0800 (PST) Received: from ?IPV6:2a01:c22:7326:e100:c9d3:3c62:2c99:d44b? (dynamic-2a01-0c22-7326-e100-c9d3-3c62-2c99-d44b.c22.pool.telefonica.de. [2a01:c22:7326:e100:c9d3:3c62:2c99:d44b]) by smtp.googlemail.com with ESMTPSA id c17-20020a05640227d100b00410ece2072dsm1999591ede.95.2022.02.25.13.23.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Feb 2022 13:23:47 -0800 (PST) Message-ID: <2671e6e3-8f18-8b70-244b-9e1415bfdf8f@gmail.com> Date: Fri, 25 Feb 2022 22:13: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 v5 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: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> In-Reply-To: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220225_132349_749150_470CB1BA X-CRM114-Status: GOOD ( 12.49 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 Reviewed-by: Rob Herring --- v5: - add vendor prefix to driver-specific properties --- .../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 + + titanmec,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 + + titanmec,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>; + titanmec,grid = /bits/ 8 <4 3 2 1>; + titanmec,segment-mapping = /bits/ 8 <4 5 6 1 2 3 7>; + #address-cells = <2>; + #size-cells = <0>; + + alarm@5,4 { + reg = <5 4>; + function = LED_FUNCTION_ALARM; + }; + }; + }; +... From patchwork Fri Feb 25 21:16:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12760963 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 2BA82C433F5 for ; Fri, 25 Feb 2022 21:25:32 +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=Ytq4t8gXgH666g00ilbkovMzkHxKU4UrH9CXlf2bVl8=; b=POU2mCxJG6TeCf 7mztlWJLoepjhaRzS30IJ+LU52l+C23Afn1+CXzgPe02vaeFKdIk+IL7acVsRjnUGqYevCuo0Jaru QB5z7vGBUzQR+rCjdeB1U/9NExGfVxBDboXwnCCgpBBjDi3khykxXkHfOCnS7cUGGNoJYrIXeOgan Xh+G70ngK28hmS9JzhmeDKBR5LTFaSpWJVeHtmKV3Lr6XYEt9t3QTpqBT+RY6WkrQaBUTHnGQ5Iaf rHgu7ZWadL313J7JVhKp/rg+7OjSCk/vRm3vQaoWaLwN+FSN9Y8xPCglqBUsyjalnKaT/9jzfQdoq iI7IUBIP2tjfCC9Ez2nw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi4X-0070Zr-Kq; Fri, 25 Feb 2022 21:24:17 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi47-0070RC-EK; Fri, 25 Feb 2022 21:23:52 +0000 Received: by mail-ed1-x529.google.com with SMTP id h15so9139520edv.7; Fri, 25 Feb 2022 13:23:51 -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=kaIHl/LJkdJS1GsMcUT8EPAy28bkiKpgVIuR7Ckd8pBLs7N9Ps7oK7Zg1IABnceVjk wBVwWlmP0ZVa5tEQxlnKMN2IheP35af6KLq3O6YncNLr4b4/IHOSoe4gjuPwPjuro4+x ty1cGK+HJD5urjdLI0xAj8st0OE7QYNHU6cZlnKhM6lGkSib5SB+H5YoTKPPpZMpUmJR QJKTxYYU9d0F0jV4rNTkD7ctoPZMpvNWn/NrXqcsA80NcwFy8yFfL9rz5seMq7Z3HayK nPLsP86VzXFoYFrFHYY2bIrYByBu+upgFFSezqO3RptCToX2Qa+oV635kPJbr/F0wyc3 8JnQ== 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=72QQZfSmMRd9Yzov1o4d/IsdX+k1m4C6FGA1cTeTjS3PcGxhecA0YB6mZUO2cEeOuF eKrAGbkEuS6vK7m3y759cmP65Kd19iPR3VJCDwrPNI02MEuD1+Hk+Sl8FuXJqdUe9LU+ 9ckex6+6LmZ8NRhF+ErlfXbCJWzaMydJn/E85ayiUmh8/auEBQmEXJTXXZIGyKkFby/6 c8DRVLseUxC11TyeESy2ucnZv44sv6dcS1yHMQs2Ku4PJhNMV8xNGBVa9EtV1rxCkQyD TwLnAokT/pscUfZXgSCI8mQhVFoQHSt9Er975nubeizxz/EFkOXufYNTskti90Z7vbPH tBzA== X-Gm-Message-State: AOAM531E13Zyh7K4EbABJHLdh6umzLNi2PvD8G8tGvD6Mt/ulYne7XQJ 24+PPKr3/AKpY85QgciCQWs= X-Google-Smtp-Source: ABdhPJzVIlBCczq4S+kTfnqXgmTqkiY8UrCJ1lwdNVQJ0089sdMxaAY8UWYBfi5xnmZiKwi563Lnhg== X-Received: by 2002:a05:6402:1148:b0:413:11e0:1f58 with SMTP id g8-20020a056402114800b0041311e01f58mr9009941edw.113.1645824229928; Fri, 25 Feb 2022 13:23:49 -0800 (PST) Received: from ?IPV6:2a01:c22:7326:e100:c9d3:3c62:2c99:d44b? (dynamic-2a01-0c22-7326-e100-c9d3-3c62-2c99-d44b.c22.pool.telefonica.de. [2a01:c22:7326:e100:c9d3:3c62:2c99:d44b]) by smtp.googlemail.com with ESMTPSA id ka6-20020a170907990600b006ce54c95e3csm1435030ejc.161.2022.02.25.13.23.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Feb 2022 13:23:49 -0800 (PST) Message-ID: <95c57066-82b4-1c32-4324-77f9a79451c0@gmail.com> Date: Fri, 25 Feb 2022 22:16:55 +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 v5 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: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> In-Reply-To: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220225_132351_537568_65CD51FD X-CRM114-Status: GOOD ( 10.28 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 Fri Feb 25 21:20:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12760965 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 11ED6C433EF for ; Fri, 25 Feb 2022 21:25:58 +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=bmAABflHIkujviH+Ug/K33vP6EOU4nvcQ60QlhLDLcg=; b=GA0dtoM3BrXEQi yYu8C1oAL8spHbwtC/FiWPZjserQfAz58i7uIlgdEBJwUJhwGYWIfT1+Z7XorAhYwhjfXO8CjHrF4 7JGqxtd/oWzSZbeXfPy6v//HBygaouQcvpH7FL00A41CJwTvU+gpaWUAgcJcgL42KvIhK2TJ64kIn UULjdHKbIdNIWn+qT70kSWmpBNU9NipJcvmCiK1HY063QdLVEvX8driybWLedRAgyQxdDsshBZ6VG AMI3LhCU5opQKpi5Asr+8v0dJ9gR9oOloMHYkggmWof++Oax9Eq0HDLBIr4pM5ttBos/OzKOv81vP fLUlJAPqaOFKDEzd+PuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi4n-0070gn-17; Fri, 25 Feb 2022 21:24:33 +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 1nNi48-0070Ro-RM; Fri, 25 Feb 2022 21:23:55 +0000 Received: by mail-ed1-x535.google.com with SMTP id x5so9120949edd.11; Fri, 25 Feb 2022 13:23:52 -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=zB0IQwhpSo0cJZN1tV91D8ol1+twM69HpJzwRaIzseo=; b=VLqwuiKdqRj1gs6Ceugkk1+FYDAxeNCBkwtCR0B/dBGeKHKUFdCYnmmtYX3fDKeEQ4 l8AjMrAqK283f0zn8VCZTAGorRxWZ3dMTRAJQ1sLVs5snRIA2StZYuMiX82+pOZgDXmM zMMpI/qqqMxhHTZGs+Af1QiQUOPgzr3KO1Sp8kxPEd9FdGaFCLR9NrFoIroYSCgfDuqj lTEAAhPNxmCYJXnZ9u//I55xRW6Wyx13vFT50+LGFxrPg5wLHMtJ7DsO4mRSXiTs7PjZ GsEZlSvOdwPY8jbXYRZTYuow8+UDL/Y4MEwr28icibrLbKu2kQoZ7c95uA/MK2PMWB6Z OeSg== 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=zB0IQwhpSo0cJZN1tV91D8ol1+twM69HpJzwRaIzseo=; b=3BQDygeuSrSqPXWnSKpnIV9URn+LRndl7It2zAOTf8GdK64uc5vlEsZjqDWRRU2OFA xQdxu95q4+kEkM+IoXv2uemEusWk+5Qqxde4rp6U7vaEcfDbuIvoSYLh68E6Bkwqu97j IGNBS5x8+OiZZP2miM2s4LtrgSk7rPdHNrkllNctbtkno3cG72DTOmjVo8iqjsZ2S6zl E9xXCZnflMVhhohnrDs/Sr8CaRd4be62JFrBijGx8bMQGk40zXl6d2U71Fq6aoQktUNx govFInQ744D7O9tbHgaKgb3wO+1co2CnUiWGRkajJjT3W8C8rK25iI7pcOvcw7sJqg0x YcFQ== X-Gm-Message-State: AOAM531YXcRoBHumGc4FnLW266XifJYDhCFsgnVQ8ajG1BIrLvEy8pD0 et7uhpBNGdWVtyyc09T+BKQWNld1/0Q= X-Google-Smtp-Source: ABdhPJwx5cXGnvVwiw2ht5bb96nMciSKHq6LCDUl0pZjw8s1gsU3c+WFayK9PF2VG3FsOHJb0O8jww== X-Received: by 2002:a05:6402:510a:b0:413:1a1a:6f5c with SMTP id m10-20020a056402510a00b004131a1a6f5cmr8755201edd.430.1645824231337; Fri, 25 Feb 2022 13:23:51 -0800 (PST) Received: from ?IPV6:2a01:c22:7326:e100:c9d3:3c62:2c99:d44b? (dynamic-2a01-0c22-7326-e100-c9d3-3c62-2c99-d44b.c22.pool.telefonica.de. [2a01:c22:7326:e100:c9d3:3c62:2c99:d44b]) by smtp.googlemail.com with ESMTPSA id bm24-20020a0564020b1800b004129263ff24sm1869261edb.68.2022.02.25.13.23.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Feb 2022 13:23:50 -0800 (PST) Message-ID: <4d06e187-3edc-565a-c1ce-a4f2d16f0179@gmail.com> Date: Fri, 25 Feb 2022 22:20:24 +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 v5 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: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> In-Reply-To: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220225_132352_925784_A280870F X-CRM114-Status: GOOD ( 28.80 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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() v5: - add vendor prefix to controller-specific properties --- 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, "titanmec,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, "titanmec,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, "titanmec,segment-mapping", + s->segment_mapping, NUM_LED_SEGS); + if (ret < 0) + return ret; + + for (i = 0; i < NUM_LED_SEGS; 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 Fri Feb 25 21:22:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12760966 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 C5852C433F5 for ; Fri, 25 Feb 2022 21:26:08 +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=QB0fezuqND070kHlUjPD1bbx4P2jL+2bxAMEjpPdPfg=; b=No/BMX2W+E6PJ9 hG+7+7HIGIZoyyGxNih+BQddDKXFURV0wz0sF4nJlwlOYFbT7QuX+nFOP6o9Ji4KvLq26+cGH8hne xj3n0FhZcrzERc80XYdKKH1pl/9vZi2lbS8dSPWoF9jCzNBC7EG69sHGUHR9CMP9CekVKCNN19Jsx SY6UbZCZejvRxtqL/eLmA+PwZWd4oPr9AAW2+rRl6+xUJ57c43SUXYMTUg3lV0JNtLoR+PpXN9WTa y+B7QC5LXytR+U8tVTYQ5nl2pOaPsA9SyqrZqVhIjzZPJb13XRYc5AURDousrVaWoCiZmaXa5cglI 8erWkC3UpCvE1QibM2JQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi53-0070qE-Ud; Fri, 25 Feb 2022 21:24:50 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi4A-0070SS-1D; Fri, 25 Feb 2022 21:23:56 +0000 Received: by mail-ej1-x636.google.com with SMTP id vz16so13343322ejb.0; Fri, 25 Feb 2022 13:23:53 -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=ITwZ2iGGWJevAmm+W8iPYQ6tiXhFibH5anmi49Qig/0=; b=Gb0HgBQ6y0KAx0MSz95w+dOzfqWoOCxdTtZ0naa5y9d3oA1he40MqTBHqREx+YMwNU tM/Q/K3hAumLvQYlfTu26FOVzJwt43lzSEQTfo+PLKk/fiqCZDrhfDaaWH+cPkigp0fE 5ZdlX2MmPgxC7ENnsE1z50WTkvm2w657wb0tw/oiM8spb8CKjua2D8ABbyKnR3+RqffV PnnoUygFBnQZGjeEQrT/aShIt0tdhUzY/IuOlXFN8DPBEUSdioAdPXhHMUwIN/TgQkkz UbTx0JtBkSdGpAJfHPjnyEuEo9si5XU3qAjcWkOCbbJQRQ3UbHOuY8Nslq8aMYoOq45l tElg== 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=ITwZ2iGGWJevAmm+W8iPYQ6tiXhFibH5anmi49Qig/0=; b=NV1wR7v/UHjx/2eiu6dl1jJypI7XqTfYVqmdlcJXX40AZVJNGW79Ybk+xSGuWoAe0x QZ3GzyijypnGmxlxIjEcIaMl+UXuOXKlIyC9bv/K4lmehlGxBgSAgzAz1H7DaCrX98KV JVwQ2dndARb/IrGhvxBxy4WxFQ882jHdLRzjOqC6dgJh1D7xr9fTB5Z1h1lIHZU8Q+KT Dyxx8zf7LqPzm/4XlRuWDz+ocTe1Rv/t0m7pkGf8kL4PyK+6Pu9rn15MH6vG3wSk9gov aNB7EB3Xf6KkJl0PVNphuL5YkazUFsUD79MxVDe1sQb66k506YSIdEmJWV364sy8P3C1 0cAw== X-Gm-Message-State: AOAM530AoUx3g3W70ReX4BKU48JbkGaXUafHmBJsKldGNkXv6PHeCrqG aJtTTCQGDIJnuE39gCsdGJ4= X-Google-Smtp-Source: ABdhPJzUs0H4TCgOlY3vFGZehzz7PcJuULHzTp7dFQgUPHtVX+kHpnMTtDX6gtT/li+x4ea7DXdsEA== X-Received: by 2002:a17:906:d977:b0:6ce:7097:b8ab with SMTP id rp23-20020a170906d97700b006ce7097b8abmr7317116ejb.766.1645824232592; Fri, 25 Feb 2022 13:23:52 -0800 (PST) Received: from ?IPV6:2a01:c22:7326:e100:c9d3:3c62:2c99:d44b? (dynamic-2a01-0c22-7326-e100-c9d3-3c62-2c99-d44b.c22.pool.telefonica.de. [2a01:c22:7326:e100:c9d3:3c62:2c99:d44b]) by smtp.googlemail.com with ESMTPSA id j2-20020aa7c0c2000000b00412b6b79d1asm1914186edp.10.2022.02.25.13.23.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Feb 2022 13:23:52 -0800 (PST) Message-ID: <98b09fc5-5de7-ab71-cbfc-843f1c83239b@gmail.com> Date: Fri, 25 Feb 2022 22:22: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 v5 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: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> In-Reply-To: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220225_132354_183219_5A1551FF X-CRM114-Status: UNSURE ( 9.71 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch adds support for the 7 segment display of the device. Signed-off-by: Heiner Kallweit --- v5: - add vendor prefix to controller-specific properties --- .../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>; + + titanmec,segment-mapping = /bits/ 8 <4 5 6 1 2 3 7>; + titanmec,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 Fri Feb 25 21:22:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12760967 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 0E352C433EF for ; Fri, 25 Feb 2022 21:26:32 +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=GndwZ71DI7KyfzQM6/hRF2OG1aY8J9jvXEmpE6nDajM=; b=ThbBWg7fKAKkdm KTJ36vIbSYWy7ar0d2ZSr5MrtQ+ZYepOUNoVmq60HbxaRgrQUC9PLAfRTyc9YKNac3kIrJp7Gkt0q OhDth7zz57fDzNXMzS7AT1O+t1E64Pa+pZhB0jDtAKaNTv9rIx5jgeafc+aap3nMeZJzuL++2X1GB JayZeuLMQJXeTZRx8EZcScs+hCSREUmcmjhXB8rZGgNNN2lFa8GZcfIT32dO4/13kMfewVpE/Sr6/ WggOJ5dIZ9LAIYlnF5vpAisSfJZAU7jSS7O7+pAb3747KHMwJRXlJVMT1O8StsFz2yD9wAjiJOnL3 IjLGsgSnjZgt8yE6NBlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi5W-00716Z-6w; Fri, 25 Feb 2022 21:25:18 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNi4B-0070T0-AG; Fri, 25 Feb 2022 21:23:57 +0000 Received: by mail-ed1-x533.google.com with SMTP id c6so9106243edk.12; Fri, 25 Feb 2022 13:23:54 -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=nfqVpMsDeMm4Dl6KEyxiRu7U3Ug1Y0nrCDl3R9Adamk=; b=mn/5WQpvX8UpDXsx+/RJi1a8Tq3ZBpyGuoVhfX1+uduashZxSvh0nFqa/wMhTAVV3F 1ZNVsQmqkwlppgH4A3GWHsWS/ZXCuP23r0F/B3CDsO+eevrdIkwp/gXhFCwrZj9QI96t 8PnD/Vk1/Y9fui67586scyCpkFBBmkU/puggcxVpcDLLHCDLtnq0yx3xCUvhE0eb1fNJ 3MX92ovkDtLjTtEyHMaMoeYmynZ6wClfOoydJ01+jLRa2u1IINXAlYDaheefX27dG/2X FcAQaM+1d+B5iuxuIXGHZkESgKKkVD//CTDR/7fxNqwYiAVNV2jEbIWvmHb1igWgwtUh oWdg== 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=nfqVpMsDeMm4Dl6KEyxiRu7U3Ug1Y0nrCDl3R9Adamk=; b=gBqEzjjcME4pGcBU3eRBTesLCzSv6eHFRwamhVWPTfpH4yt4szoLc8TVxjU1S5AxM7 rq5JWicphlWV/mSnB5AFNcyUM8PJvHcx+EOKLOu0oEL5dNKO6QV47HLHHpffNybldUbF pN2ajmXiyGtsJP8NQ7QT132aa5dKuwPORiihefsM3XjQnnBXo+ECQDdMh82C4uE7vGrb 82Yo6VMRFtQqYhC2XrbEEVv2Qn28xLYKT18T17kS7V2g/QMs/xXwbAmQr2w/oBtEnaKm dM770TqjcDl88yi4FEsdagMGdme4/uiRPoP9bxCGIRHRGu56K0OT7aEaQ2QmLX9+QrcZ +AmA== X-Gm-Message-State: AOAM533uO/hvS1pX88DQAkXpTsenGQLw+TsO6agljFhH7Ej8b0eGzEHj Tq2YqbmYUvrrn6u11KDrAQE= X-Google-Smtp-Source: ABdhPJxeuoGcGF6Eo+InxvhSFmSvajf4aKhd1YO+sL7RSrUZuHGA4+z5ze+zFBMxCjC0GO00VQk0RQ== X-Received: by 2002:aa7:df86:0:b0:413:2d4a:5358 with SMTP id b6-20020aa7df86000000b004132d4a5358mr8888580edy.21.1645824233893; Fri, 25 Feb 2022 13:23:53 -0800 (PST) Received: from ?IPV6:2a01:c22:7326:e100:c9d3:3c62:2c99:d44b? (dynamic-2a01-0c22-7326-e100-c9d3-3c62-2c99-d44b.c22.pool.telefonica.de. [2a01:c22:7326:e100:c9d3:3c62:2c99:d44b]) by smtp.googlemail.com with ESMTPSA id u10-20020a50d94a000000b004131aa2525esm1948050edj.49.2022.02.25.13.23.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Feb 2022 13:23:53 -0800 (PST) Message-ID: <1c1fe4e6-3c73-1445-e766-0dba264d4581@gmail.com> Date: Fri, 25 Feb 2022 22:22:56 +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 v5 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: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> In-Reply-To: <90668779-b53d-b3e7-5327-af11ff4a1d18@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220225_132355_443564_71C1594D X-CRM114-Status: UNSURE ( 6.77 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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