From patchwork Mon Feb 21 20:20: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: 12754115 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 70C7CC433EF for ; Mon, 21 Feb 2022 20:27:12 +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=SnnN1PzHfqu+elCrz2F+IHzjECtWuZ5sDHm+tPbi/Ms=; b=r4GJzM1Z6uUUMt Y1eDcAyPaiYWFyi/Zy/Rj7APhTS968IRNLkd3R7Q2r8LDjUCoCpAdSV5Eme2kM3alVwNtzfyvAOhW N7/oMZds6xPgeoiw31YUwWJXR2kmK0xukYtmfynow03bWHbCKHBcaNUPZVT09i2NB9KVwKkngbVKu /MsJkoejQ+4iJAeosxBc/waCpEAuMaj2NkjK7lc3KlJQzCKnxDpIPE3I4+XzFei1NXrPZEyir5wyK tHaBDIR8s9enxi3mh49hYnDnaUD8tPGOqWQoorseaL9GM2AD0OhgRVldeHeZE+qFDlpODOscoX+eQ sqOoxXu4kqXaPkK0FO2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMFH1-007B6x-7z; Mon, 21 Feb 2022 20:27:07 +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 1nMFGn-007B24-5s; Mon, 21 Feb 2022 20:26:54 +0000 Received: by mail-ed1-x531.google.com with SMTP id c6so28925459edk.12; Mon, 21 Feb 2022 12:26: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=RjPMctKZVhoEtXai563y+o3AHHthI9KS32P039dLMfk=; b=SfsZUk2M7qcqxUkjTJ5QfavmgyzPhsJixnMUI3gaxFpYaeZlzxmnyngXQogbe0tiMA WlXpTPz5Nldjh+i6WHccrSF0LyiydOymUlRdDrOWBhLsUPbiiSKie5skMKm4c9CUh/fK j/iSXF4lcJnQOA2luGfscPcsnKyD6LVI3wlbcEUurIHCoWNnVa3Y4aFm5TpsQuRHsriB 3sm2QB211MPU1ATTvZ1vdZdjNpcnVHIsKsdBfvlISZJYhoC7Y62UzWAbliI30nlIWI1c mHytIXPnplQDt0xL5l5VvE+k0V8uThOLdK+pW+MgEvrUdRSDPMJ7SmPwj6aF29nXfL3I 9esw== 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=RjPMctKZVhoEtXai563y+o3AHHthI9KS32P039dLMfk=; b=BzadGuL9qQyDrQK67qa+COG7hEtuLD4CZjsI5t41/qg7dAg5c5tTolk4NQFiR5HBC+ 6p8xlsV9SEQchVzS6WJezIodmdTEZd4kpyICviSJGOG0D0CZYVQEeBokxCTAvM6WfXvc 7xLpVGBpmU4pBMTJE5rnrCXJ67fwCc9LWAQYb2CTgdg3zNBDLQWFhe2B5DwBAifRrUgQ GEieOzjZXUB3JG7mtWwUIhAmQGoLiUtaTtQyuiHcxv0PuNxA1wQb/I/BBt/HNXhYmQoS Yl5BQJ9GZGUYfkpg5wjqcXi3rfUDDhU0KmS37fYAGAoSlt3mKFu/bxo65RKW5v0IAeT2 tJdw== X-Gm-Message-State: AOAM530pWFBIWfCoFHjefNwLCl8DDum58gbyGLUY+FrUdc6+x1xxFCyT c6hPw57RYxPaU94iA+xp1m4= X-Google-Smtp-Source: ABdhPJynRraUwluYQEbFA05yc6hpmw0TfvGgTwGFEVbljIPmKA/MOhfvZT0G1xeWqpd8aU6E73rhLg== X-Received: by 2002:a05:6402:4415:b0:410:d28b:1e14 with SMTP id y21-20020a056402441500b00410d28b1e14mr23074770eda.211.1645475211277; Mon, 21 Feb 2022 12:26:51 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:b141:a0d:4aad:2a06? (p200300ea8f4d2b00b1410a0d4aad2a06.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:b141:a0d:4aad:2a06]) by smtp.googlemail.com with ESMTPSA id bo11sm5444587ejb.24.2022.02.21.12.26.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Feb 2022 12:26:50 -0800 (PST) Message-ID: <6389315a-30ee-8106-209f-bf2462d12971@gmail.com> Date: Mon, 21 Feb 2022 21:20: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 v2 1/6] spi: gpio: Implement LSB First bitbang support Content-Language: en-US From: Heiner Kallweit To: Mark Brown , Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Geert Uytterhoeven , Miguel Ojeda , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." References: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> In-Reply-To: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220221_122653_255519_71B57D60 X-CRM114-Status: GOOD ( 16.19 ) 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 Add support for slave DT property spi-lsb-first, i.e., SPI_LSB_FIRST mode. Duplicate the inline helpers bitbang_txrx_be_cpha{0,1} as LE versions. Conditionally call them from all the spi-gpio txrx_word callbacks. Some alternatives to this implementation approach were discussed back then [0], but eventually it was considered reasonable. [0] https://lore.kernel.org/linux-arm-kernel/20191212033952.5967-8-afaerber@suse.de/ Signed-off-by: Andreas Färber Signed-off-by: Heiner Kallweit --- drivers/spi/spi-bitbang-txrx.h | 66 ++++++++++++++++++++++++++++++++++ drivers/spi/spi-gpio.c | 42 +++++++++++++++++----- 2 files changed, 99 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi-bitbang-txrx.h b/drivers/spi/spi-bitbang-txrx.h index ae61d72c7..267342dfa 100644 --- a/drivers/spi/spi-bitbang-txrx.h +++ b/drivers/spi/spi-bitbang-txrx.h @@ -41,6 +41,8 @@ * chips need ... there may be several reasons you'd need to tweak timings * in these routines, not just to make it faster or slower to match a * particular CPU clock rate. + * + * ToDo: Maybe the bitrev macros can be used to improve the code? */ static inline u32 @@ -106,3 +108,67 @@ bitbang_txrx_be_cpha1(struct spi_device *spi, } return word; } + +static inline u32 +bitbang_txrx_le_cpha0(struct spi_device *spi, + unsigned int nsecs, unsigned int cpol, unsigned int flags, + u32 word, u8 bits) +{ + /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */ + + u32 oldbit = !(word & 1); + /* clock starts at inactive polarity */ + for (; likely(bits); bits--) { + + /* setup LSB (to slave) on trailing edge */ + if ((flags & SPI_MASTER_NO_TX) == 0) { + if ((word & 1) != oldbit) { + setmosi(spi, word & 1); + oldbit = word & 1; + } + } + spidelay(nsecs); /* T(setup) */ + + setsck(spi, !cpol); + spidelay(nsecs); + + /* sample LSB (from slave) on leading edge */ + word >>= 1; + if ((flags & SPI_MASTER_NO_RX) == 0) + word |= getmiso(spi) << (bits - 1); + setsck(spi, cpol); + } + return word; +} + +static inline u32 +bitbang_txrx_le_cpha1(struct spi_device *spi, + unsigned int nsecs, unsigned int cpol, unsigned int flags, + u32 word, u8 bits) +{ + /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */ + + u32 oldbit = !(word & 1); + /* clock starts at inactive polarity */ + for (; likely(bits); bits--) { + + /* setup LSB (to slave) on leading edge */ + setsck(spi, !cpol); + if ((flags & SPI_MASTER_NO_TX) == 0) { + if ((word & 1) != oldbit) { + setmosi(spi, word & 1); + oldbit = word & 1; + } + } + spidelay(nsecs); /* T(setup) */ + + setsck(spi, cpol); + spidelay(nsecs); + + /* sample LSB (from slave) on trailing edge */ + word >>= 1; + if ((flags & SPI_MASTER_NO_RX) == 0) + word |= getmiso(spi) << (bits - 1); + } + return word; +} diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index 0584f4d2f..4b12c4964 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c @@ -135,25 +135,37 @@ static inline int getmiso(const struct spi_device *spi) static u32 spi_gpio_txrx_word_mode0(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits, unsigned flags) { - return bitbang_txrx_be_cpha0(spi, nsecs, 0, flags, word, bits); + if (unlikely(spi->mode & SPI_LSB_FIRST)) + return bitbang_txrx_le_cpha0(spi, nsecs, 0, flags, word, bits); + else + return bitbang_txrx_be_cpha0(spi, nsecs, 0, flags, word, bits); } static u32 spi_gpio_txrx_word_mode1(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits, unsigned flags) { - return bitbang_txrx_be_cpha1(spi, nsecs, 0, flags, word, bits); + if (unlikely(spi->mode & SPI_LSB_FIRST)) + return bitbang_txrx_le_cpha1(spi, nsecs, 0, flags, word, bits); + else + return bitbang_txrx_be_cpha1(spi, nsecs, 0, flags, word, bits); } static u32 spi_gpio_txrx_word_mode2(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits, unsigned flags) { - return bitbang_txrx_be_cpha0(spi, nsecs, 1, flags, word, bits); + if (unlikely(spi->mode & SPI_LSB_FIRST)) + return bitbang_txrx_le_cpha0(spi, nsecs, 1, flags, word, bits); + else + return bitbang_txrx_be_cpha0(spi, nsecs, 1, flags, word, bits); } static u32 spi_gpio_txrx_word_mode3(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits, unsigned flags) { - return bitbang_txrx_be_cpha1(spi, nsecs, 1, flags, word, bits); + if (unlikely(spi->mode & SPI_LSB_FIRST)) + return bitbang_txrx_le_cpha1(spi, nsecs, 1, flags, word, bits); + else + return bitbang_txrx_be_cpha1(spi, nsecs, 1, flags, word, bits); } /* @@ -170,28 +182,40 @@ static u32 spi_gpio_spec_txrx_word_mode0(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits, unsigned flags) { flags = spi->master->flags; - return bitbang_txrx_be_cpha0(spi, nsecs, 0, flags, word, bits); + if (unlikely(spi->mode & SPI_LSB_FIRST)) + return bitbang_txrx_le_cpha0(spi, nsecs, 0, flags, word, bits); + else + return bitbang_txrx_be_cpha0(spi, nsecs, 0, flags, word, bits); } static u32 spi_gpio_spec_txrx_word_mode1(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits, unsigned flags) { flags = spi->master->flags; - return bitbang_txrx_be_cpha1(spi, nsecs, 0, flags, word, bits); + if (unlikely(spi->mode & SPI_LSB_FIRST)) + return bitbang_txrx_le_cpha1(spi, nsecs, 0, flags, word, bits); + else + return bitbang_txrx_be_cpha1(spi, nsecs, 0, flags, word, bits); } static u32 spi_gpio_spec_txrx_word_mode2(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits, unsigned flags) { flags = spi->master->flags; - return bitbang_txrx_be_cpha0(spi, nsecs, 1, flags, word, bits); + if (unlikely(spi->mode & SPI_LSB_FIRST)) + return bitbang_txrx_le_cpha0(spi, nsecs, 1, flags, word, bits); + else + return bitbang_txrx_be_cpha0(spi, nsecs, 1, flags, word, bits); } static u32 spi_gpio_spec_txrx_word_mode3(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits, unsigned flags) { flags = spi->master->flags; - return bitbang_txrx_be_cpha1(spi, nsecs, 1, flags, word, bits); + if (unlikely(spi->mode & SPI_LSB_FIRST)) + return bitbang_txrx_le_cpha1(spi, nsecs, 1, flags, word, bits); + else + return bitbang_txrx_be_cpha1(spi, nsecs, 1, flags, word, bits); } /*----------------------------------------------------------------------*/ @@ -378,7 +402,7 @@ static int spi_gpio_probe(struct platform_device *pdev) master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32); master->mode_bits = SPI_3WIRE | SPI_3WIRE_HIZ | SPI_CPHA | SPI_CPOL | - SPI_CS_HIGH; + SPI_CS_HIGH | SPI_LSB_FIRST; if (!spi_gpio->mosi) { /* HW configuration without MOSI pin * From patchwork Mon Feb 21 20:21:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12754116 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 022F2C433F5 for ; Mon, 21 Feb 2022 20:27:24 +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=9P2YmFi7VkBGIiWNxblCdMzUtNeiWv75DZ/R9LfUKpk=; b=e0MfsrGhiLqXGr 4gZPboSy5XO016lm7FMGU59/tlQym9sS5ZEp3u0NQUu3kU0a2jV5gHI9KVvvhaGG+7yRH3W39Sj8q PJ+U+uL3fNEi0xu9MMACEclY/JgZ4CewFGXRS26MOB2DhrIMZ2T1k1LZ4LsAN8tZqrbGVfaYeOFmx CYsn8wZNsbeca+wJmdFh7ihR5r9zDzHmrB/XK91pvlc8J7GaeyHvXXi9O/lRiLFxzJsuehbm0GNt5 I+igWzpncxI/cmLUuntoJtiecJQGMl5HUTNPa+alK9V1ivtg9AWdpvQLhDQrG8LnW5NRlFBZujg6B 3O510mEaJ6dhhEAxOGUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMFHE-007BB0-GB; Mon, 21 Feb 2022 20:27:20 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMFGo-007B2A-Hz; Mon, 21 Feb 2022 20:26:55 +0000 Received: by mail-ej1-x629.google.com with SMTP id bg10so36132892ejb.4; Mon, 21 Feb 2022 12:26: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=fvuoOelNYUnuMw3RclEAhuWky9HY1ItIURN9LiLCtBE=; b=Ekao84nEYzAyOpyQKupv6ZcKea+mL7DmE2rbOlazS4zXeoeZendkPVkipjpYNRVRjm 5KDH5Fj1HBOoYLZqjRfoKxAvcbHWoxHKXoTAp389AkhrdjxXNRxgZuVOH1qoONBlO4xa p4MwPxryFN6gG1a9lyFLwCIg6xvBYHuCZs4+HAW9UGvkJ0vrDcsg2DV/UZriyfyHOMGX xXRBNQ+0itlmeUzExBxT+oZ2KRLG9VfUsMMCDhsLdQLVRasjfZn+3snZDrLDx9YIoqmL HWcGrwbdpLZMFJ+nxJqheV1SrNU/FyI15eJWgvf2Zmz3XyruSu/qQt07dusVeYQZKzj8 UZWQ== 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=fvuoOelNYUnuMw3RclEAhuWky9HY1ItIURN9LiLCtBE=; b=pqm7ckwIlxOw7zBViqFplNpBtB8Mb0wCETA9nuND/h6s/cpAVHl9L2nlEo9HFsR2/3 GScDNMACKM/tzuwfeJXYpGn+9M1/VO9q4vmjZAmQ2D2t8ga8G+xEQVuAr8izzY7CKlqn NKnvb9HI7kVUxajklSx4vNtxXSJpEkFpz+ZczaeMBJRjr8BJAQIiwhb0fGJRq1ztAm6D bmkV20RojVfdsg4ee6jsNT7+44+eTdcwFsWc+7u4XVUNWCMMKTCNyo53nZqRfwZKTQC8 Tah16nvwOJTXXkPgzxUQgKwTalkieyDmgiD02AZgnDAhp6FpdSzOuEIhKN+GXGEkNqIO KWCg== X-Gm-Message-State: AOAM530ZCcHaM7+xM4624rk15i/gHTrPIc18+VeyaRIqMf2Zn702DMKk D0/LQHP0V6M8lrXSwwG7oLw= X-Google-Smtp-Source: ABdhPJxbYvk+lqvBbfPU8LgrZy56/J92yjPQy18vAN4mgZsbd+WMc6R85IT5h5yTz2e6tBqJCcb7Ew== X-Received: by 2002:a17:906:3bc7:b0:6cc:493e:31e4 with SMTP id v7-20020a1709063bc700b006cc493e31e4mr16745224ejf.549.1645475212691; Mon, 21 Feb 2022 12:26:52 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:b141:a0d:4aad:2a06? (p200300ea8f4d2b00b1410a0d4aad2a06.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:b141:a0d:4aad:2a06]) by smtp.googlemail.com with ESMTPSA id o17sm2820552edc.16.2022.02.21.12.26.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Feb 2022 12:26:52 -0800 (PST) Message-ID: <358ccbef-4151-a0e6-fc4d-9859e4fdf2df@gmail.com> Date: Mon, 21 Feb 2022 21:21: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 v2 2/6] dt-bindings: vendor-prefixes: Add Titan Micro Electronics Content-Language: en-US From: Heiner Kallweit To: Mark Brown , Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Geert Uytterhoeven , Miguel Ojeda , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." References: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> In-Reply-To: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220221_122654_618694_C38E0EC8 X-CRM114-Status: UNSURE ( 6.97 ) 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 ebe294516..38bfb462c 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -1229,6 +1229,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 Mon Feb 21 20:23:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12754117 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 8369EC433EF for ; Mon, 21 Feb 2022 20:27: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=9UVYSLOyFyctKgOnw6+APMLXFoIbYNWlD1u3hJihffQ=; b=q4POyJ8eg7TldW J381N4P26ImjH7zlZwUg+kNeX9nwHqFoctFRyLiP0E/TDuXCbY3Idm8K8vvK47l+8oB61JMmJliF8 nvaervYTzZIldCQkszOc5i2qxbzE2lr1um4XYCmT2h83uBEW6Hyr/kMoX4Q7v1a4X8Uz1AAZWqQ97 so25UclyuJyKra+D/M9xkZGesnL1QJ2l38cnb8iZ0jZ4ZezYmd8c340fs/2dQLspjspbJG72Em01Y NR2wvlcca/u9Al8Y3JkRy5huVIV5PiP03ag32ZlX4+6Q8ksharw1o8+oeEkzO+Tjm+DcOYBymeTuX 0uYitx76zDYULOedneWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMFHV-007BIn-52; Mon, 21 Feb 2022 20:27:37 +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 1nMFGp-007B2l-Ds; Mon, 21 Feb 2022 20:26:57 +0000 Received: by mail-ed1-x531.google.com with SMTP id u18so31757264edt.6; Mon, 21 Feb 2022 12:26:55 -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=dd134NjBkl8fhO5WBxxq3dG4rqJRhX37CWmAE2Aj2VI=; b=WXhkfQHfRShc/s+qx4BbtexHkKdRaIoWOy/LMlFZ42d8AksTRQ17IKdh+0pvehhVlY 6MjmHpx0Z8Z8OBfHTF+TZ9MsoYsc6al6WUxse2drDxzKgXLtT64O2NWuA4nBlHXB3VWq PJJsxBQZLrzZg+wQ3gaQ9Csd/Z9OBS+hEsaEUTU82vuRcguAdNBEOZrUxy0JNL71H0iH OrKE6yHXGN9CpHkNtjQdpNdPruSrNeJOq/0pZ9tmB+KIFVr2tpy648wW3xIJOcQLkPoD JjZFClQ32xFW7MWj6oQJvI//ly9H/IEdsKTXhOc5oPAAcNfOJy+WS0fJyT2KEbkR21/i iyWg== 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=dd134NjBkl8fhO5WBxxq3dG4rqJRhX37CWmAE2Aj2VI=; b=wJLEJpVQmChvDcVUMfCR0Kbmeu9MxCiVgVitPisPClhGwMuytseaymPQzfrUDyVDoA A78MDQgmFepfPuRmGaIs9pRuyH7rXIuWOO7eHs/zcoUJT7DwY47WpjMQH/62VNj/QtWg PISv/bpqtMym9qa6MrqRnUh0iLEGtJrRCmH5MixelBYlVjDEoVUfC50axUu5DFIgnFaS UIoUJ3t/97EPNePVlLKC8fIDmZzwJit2RrSAX8AWSbuDWM/t8YHHUdp24Af9YS5snvrR EuGjbJ4PlO4l/cuJDS+JueFAq6kZwn0K5WYVHQVhKLESPBdafH58u30NfxeW5AeTVX2e 8VVw== X-Gm-Message-State: AOAM532GMPO7ZOqmTVdfWy0lYpeCOZMuW1MnbtR3vCLdS5s6IeaVlO7x U4sMClY78JOKDuqTnkIhcvM= X-Google-Smtp-Source: ABdhPJzaqueRJw3KgqhuWsxjs3QEClMbOXRm7JpJl1xJ3fl/7oVyk2YsuGp5uqbgdO+DWhTs9d6gEA== X-Received: by 2002:aa7:c612:0:b0:40f:2a41:bddb with SMTP id h18-20020aa7c612000000b0040f2a41bddbmr23081017edq.291.1645475214128; Mon, 21 Feb 2022 12:26:54 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:b141:a0d:4aad:2a06? (p200300ea8f4d2b00b1410a0d4aad2a06.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:b141:a0d:4aad:2a06]) by smtp.googlemail.com with ESMTPSA id v1sm5565278ejk.11.2022.02.21.12.26.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Feb 2022 12:26:53 -0800 (PST) Message-ID: <39d61ddb-4b54-4a13-fbb2-c0f88d9bf017@gmail.com> Date: Mon, 21 Feb 2022 21:23:18 +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 v2 3/6] dt-bindings: auxdisplay: Add Titan Micro Electronics TM1628 Content-Language: en-US From: Heiner Kallweit To: Mark Brown , Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Geert Uytterhoeven , Miguel Ojeda , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." References: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> In-Reply-To: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220221_122655_491537_688AE761 X-CRM114-Status: GOOD ( 12.67 ) 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 RFC work from Andreas Färber . Signed-off-by: Andreas Färber Signed-off-by: Heiner Kallweit --- v2: - (re-)add Andreas' SoB - fix YAML errors reported by Rob --- .../bindings/auxdisplay/titanmec,tm1628.yaml | 88 +++++++++++++++++++ 1 file changed, 88 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..da7cc16e7 --- /dev/null +++ b/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml @@ -0,0 +1,88 @@ +# 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 + +properties: + compatible: + enum: + - 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 + description: | + Properties for a single LED. + + properties: + reg: + description: | + 1-based grid number, followed by 1-based segment bit number. + maxItems: 1 + + required: + - reg + +additionalProperties: 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 Mon Feb 21 20:24:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12754118 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 0F146C433F5 for ; Mon, 21 Feb 2022 20:27:59 +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=ZXgpavqVawkgE7OejrjhqqzlT6/wyadfgrsNc41DVXk=; b=etLjJMBD3FYdvP RN5DktQJ5uw5RNfm6x/QJh9jiClh8Ps7yw8oVOupmFB/8UBRhFt9CbXSc8AO8rSxWccPUx7Jvp2l7 QdLE+s6WHmtmVj6AmGjtdp5TlkTOjaxImNwmk9/tHNwBeZBTRv2SiZkrEzeYyAIQ6vvOrO8oBPgan gXZ1AKem8yoPr/3wCWF/RCdYQYsjhF2ramGYNoSL5RocnxF+X3DUOK1eGpJaiNdm8IcPuc1ZhlTvJ WHFHG7nkd3EebiTTvpTfijwNuc0qTudM8tdCjJqIv7Kz3mO2lqMSew83iKbcUygNNs0OjhzqqKDOZ gS1WjwG/UeM+EiVwdLZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMFHn-007BSy-20; Mon, 21 Feb 2022 20:27:55 +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 1nMFGq-007B3U-OT; Mon, 21 Feb 2022 20:26:58 +0000 Received: by mail-ed1-x531.google.com with SMTP id s14so14369019edw.0; Mon, 21 Feb 2022 12:26:56 -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=6/CbbKb963ZeCrGB3DpHf3S/LmT0OSOkIfiP6ix0yNw=; b=CZ2cpSnJj/iYQkv+MnAaAe+Hi3/lKYxwLMWRl30vUsJBwPfghMR2i6Rw33lo63nd4L si7vTuHXPscr8e+B8mMHu+VGezXiWiq+inpaAqHLE368pE49xTWzhXVCcc/YAIYLEULK XDP6rnd1QriUbfHvlzSRzfXrOMY68uBsGfy20b3OEJkHS50VEJ00JWWGhS8Fm1120Wli UQjcl7l6ao+nrl/IWI88Eihp6WWAIEJvy8sPm9hZ3ZvJLYdMaQl6ALRjtT+HXSZWsMQt VZ0mTqFsM/wLO1aX4JjKvzC+j8jpE9mtrDpndGHuYRbGE0MnaQP3J9mcy4th4ql/0JiM PhZQ== 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=6/CbbKb963ZeCrGB3DpHf3S/LmT0OSOkIfiP6ix0yNw=; b=I7JnBxrm9mbkhJ2mwIA3EXSDP0qkJiy6u4p+rTUOo5ECf5CUJNW4Ao8jpUW5BvdGS0 Ymj1Sbk7lOWZcKlCacCU2dbq+SoADYAPQmBag2tnN5+Y+NACRiS9l16ht0clEmmofmlX vIv6znRmVcWKqoOTsE19vHUT1dQ8+jHc67pPUdE9A+QigbeW6an3IzSe5WG2NPDc7+Pm PmgBHcbXrOzTkdSakK7wZG61rTwGqOITSE26FmwDX3tD6cNc96cf/FnmYq+hu7WKzd0h at4If1uLELJEqUU7GyHqE5SuUWt0QMdGXnEHFoF6rYIPQN0j6f9R/W0tmhcn10o/JSyK GWtg== X-Gm-Message-State: AOAM532X8CbxyfCW4h+4xiD4Dp05NXYFHg2mZCLiLzPhdyNIcSIclEGF FMq0SDeq6q3pHTMk+LY/qOQ= X-Google-Smtp-Source: ABdhPJw5C8aS2uojppIF/KiB3IM1XbxzEZagKJMBWFLTCnt1ltvm5AtbsTjekE5NprGJ/F9a1Vpm7A== X-Received: by 2002:a05:6402:2159:b0:410:8098:b6cd with SMTP id bq25-20020a056402215900b004108098b6cdmr22582027edb.429.1645475215609; Mon, 21 Feb 2022 12:26:55 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:b141:a0d:4aad:2a06? (p200300ea8f4d2b00b1410a0d4aad2a06.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:b141:a0d:4aad:2a06]) by smtp.googlemail.com with ESMTPSA id e1sm5475062ejy.103.2022.02.21.12.26.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Feb 2022 12:26:55 -0800 (PST) Message-ID: <94ceeca1-3123-fc4b-8cc9-a86e9ad08863@gmail.com> Date: Mon, 21 Feb 2022 21:24:07 +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 v2 4/6] docs: ABI: document tm1628 attribute display-text Content-Language: en-US From: Heiner Kallweit To: Mark Brown , Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Geert Uytterhoeven , Miguel Ojeda , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." References: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> In-Reply-To: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220221_122656_872601_70A3D25E X-CRM114-Status: GOOD ( 10.90 ) 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 Mon Feb 21 20:25:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12754119 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 B4E6DC433F5 for ; Mon, 21 Feb 2022 20:28: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=bz1Sh+VMP4GUveX21tqXJknx68c8DmY+xKalgOw+lAg=; b=x6KwbKCGq1aYp9 i3Eh2XAIGvQrBNMRWCsEZLuMzVuQc4yOJv2oW52Om2HRBXugmYojjPJrsNaxHjLodCRgcJTAdRZk2 XDzcMVoDz9qDTVTRsSVS6x0iHgxDZggBHtpx55q+2dXKR7G8rfDrH6PYrAxS1uXkq5xZYBYLuKodS VjzzHqscOAgyktPWqngflj8ofj8PsVtq3Tl4L7YC23j66/9jdn7eT4Pegf7PMht+0IssvYhLeBYa2 pZce4H64R75c61LtxAZTGypmYQs+ZRRXz61Mkp1KFyVfQxnqWq1q1PSTnJDPt1tdL0s2Bm6BNetmm y9ARtcyyl34jr5UvzeBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMFIF-007Bjz-Et; Mon, 21 Feb 2022 20:28:23 +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 1nMFGs-007B4B-VC; Mon, 21 Feb 2022 20:27:01 +0000 Received: by mail-ed1-x534.google.com with SMTP id q17so31899596edd.4; Mon, 21 Feb 2022 12:26:58 -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=f54s1QNFfJCjG5iDYvLw8C940im9nMlBHjJVOUqHXNc=; b=fvZOp6+H9iTtbujgBKUPDoxhljH2zNj4zT+xFwml+WCOQkj9OXc5aRIMCYF0s25J0V jdEGI5CYpLOLLlXYCihYVM/AZVN88u+HRPyQAaAnsz748Msoc5t3uQ3ojmHjZVGK1m9F 8sHpWvG5bGpRFTGuRIWaMTlLSgJ3qrva8ZPazKzYdwRCHj125GvRfSaDxu9/29ycggnS BcAXAC6FBVcPDbRVv7lkCrJV4KNoqqhwxa14/wbM+Pl/jGNXbcROL0UuRgPI1HYk7xY+ nWML1VOE61jQt1lLCW/G20mzuznJwyyoaf4va9Jb8nWyGQJl1iAcUPUvv1LccSbl4qlT /p9g== 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=f54s1QNFfJCjG5iDYvLw8C940im9nMlBHjJVOUqHXNc=; b=g2vYGT4ewwUuWyCvGpt178kYb3gcybULwRtH10I35LTdJto7ysswvM+3sp/CwJyEeb V3jeSSfcz43lB27FjGxg5GEXgqLC+mDnR3VP6bnverlKodA3ldmhl13msZN8cMtY3a1E UucAYBGgr0jKb2HjTQE4vdODK139JkwNxXEnyAYnXNZhGJsHcfgiFORhcw/Zx7I8X1EJ 8Uo93uZEI7AUEg79uYtVbaFZUh6BbQWCUPQXbl4ZAo2z8NIdUZpPXrcgCFMttSsS53hk cqe1JIxo3rGilWGl8BPCF4hMt7jbdY6cpOu1p6WEfXR1qtj2NWtYR5kCD5kx+89WU2p8 ywVQ== X-Gm-Message-State: AOAM530Qqm8SuuGfdzlHVaUsPD40CVAutJxHDOcrEGGY46mxs5usdr34 88xwSHjR1HgbEeo3CWl9Kvk= X-Google-Smtp-Source: ABdhPJyGimAPuKCSRTEHAVrEE59NMqIp9PLTnGsJ602mqHGEDhc4wpic8DIHDnBwnUwF7ELwXKxYQQ== X-Received: by 2002:a05:6402:5242:b0:40f:6a4f:ff33 with SMTP id t2-20020a056402524200b0040f6a4fff33mr23582938edd.30.1645475217030; Mon, 21 Feb 2022 12:26:57 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:b141:a0d:4aad:2a06? (p200300ea8f4d2b00b1410a0d4aad2a06.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:b141:a0d:4aad:2a06]) by smtp.googlemail.com with ESMTPSA id p19sm5562744ejc.42.2022.02.21.12.26.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Feb 2022 12:26:56 -0800 (PST) Message-ID: <3facc242-0ce6-9170-1fee-a5ec0a66660a@gmail.com> Date: Mon, 21 Feb 2022 21:25:32 +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 v2 5/6] auxdisplay: add support for Titanmec TM1628 7 segment display controller Content-Language: en-US From: Heiner Kallweit To: Mark Brown , Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Geert Uytterhoeven , Miguel Ojeda , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." References: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> In-Reply-To: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220221_122659_054333_DCD3F27A X-CRM114-Status: GOOD ( 31.26 ) 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. Tested-by: Christian Hewitt Signed-off-by: Andreas Färber Signed-off-by: Heiner Kallweit --- v2: - include ctype.h explicitly - add info message in probe() - (re-)add Andreas' SoB --- drivers/auxdisplay/Kconfig | 10 + drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/tm1628.c | 376 ++++++++++++++++++++++++++++++++++++ 3 files changed, 387 insertions(+) create mode 100644 drivers/auxdisplay/tm1628.c diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig index 64012cda4..25ef2e452 100644 --- a/drivers/auxdisplay/Kconfig +++ b/drivers/auxdisplay/Kconfig @@ -203,6 +203,16 @@ 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..b802b5c30 --- /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 + */ + +#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 + +/* 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[7]; + 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) +{ + 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) +{ + 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); + 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 i, ret; + + int msg_len = strlen(s->text); + + mutex_lock(&s->disp_lock); + + for (i = 0; i < s->grid_size; i++) { + int pos = s->grid[i] - 1; + + if (i < msg_len) { + int char7_raw = map_to_seg7(&map_seg7, s->text[i]); + int j, char7; + + for (j = 0, char7 = 0; j < 7; j++) { + if (char7_raw & BIT(j)) + char7 |= BIT(s->segment_mapping[j] - 1); + } + + s->data[pos] = cpu_to_le16(char7); + } else { + s->data[pos] = 0; + } + } + + 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 offset, ret; + __le16 bit; + + offset = led->grid - 1; + 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; + __le16 bit; + bool on; + + offset = led->grid - 1; + bit = cpu_to_le16(BIT(led->seg - 1)); + + 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; + + if (count > s->grid_size + 1) /* consider trailing newline */ + return -E2BIG; + + for (i = 0; i < count && 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); + + msleep(200); /* according to TM1628 datasheet */ + + /* clear screen */ + ret = tm1628_write_data(spi, 0, MAX_GRID_SIZE); + if (ret) + return ret; + /* Assume that subsequent SPI transfers will be ok if first was ok */ + + /* For now we support 6x12 mode only. This should be sufficient for most use cases */ + tm1628_set_display_mode(spi, TM1628_DISPLAY_MODE_6_12); + + tm1628_set_display_ctrl(spi, true); + + if (!IS_REACHABLE(CONFIG_LEDS_CLASS)) + goto no_leds; + + num_leds = 0; + + 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, 7); + 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_LICENSE("GPL"); From patchwork Mon Feb 21 20:26:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12754132 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 CA44CC433EF for ; Mon, 21 Feb 2022 20:29: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=qh8VB7QvxruslWGcp3XuDCO6rwt/Kn55LLyc7qaGs0k=; b=EwbHlK/IgICBPn qsdy72SX3FlchxmPRhPXelnuFNGwe5Oo3qDOOdH4aZE9Ch+sq/3S6wBx579MDgWPrMmmfsaRkNv0q uaMgTa3qKRXf9uTV9BTKdZj++/Xbxj5kTEbFoZTUs3NbpNZSjHTY8HyvKBztggPuVx6momo9Xp5Dl dnfNyX3ydCVZQvCl66PjN1UiUQ5PtB6E4k1+UNAFvRE4X+2UXdz7xo5DmDNUOPcjNHfxtMslFUUew njKtsqHOVsXxbFzZUaLRciXYV9DItpzm5pjWjc4Dyrb6Z4+HwVPlHvr4PcsRoXuh5KkR2BfDVYFb0 1p+k2ejz2u5GnzVhsBog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMFIs-007C7w-Ag; Mon, 21 Feb 2022 20:29:02 +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 1nMFGu-007B4i-5X; Mon, 21 Feb 2022 20:27:01 +0000 Received: by mail-ej1-x634.google.com with SMTP id p9so36127541ejd.6; Mon, 21 Feb 2022 12:26:59 -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=QhVIXeLafiSQ+OusdmmLI0MIBGtvj3M481RJOUzvum6fl2yqAsuXwGTwQhoP9NLvat y4Y+vCs1VSsLIzMLQRF5NuFHG6V8TgmXXLxQ60lQBmu4dmRZV9ItYU/MX0mzMRxuwmwy EqyvBxAGVS5LUf+H9sO4IezQR9H3OsdG4GiTusuanzCvgMRXZ6pEPZwSgua6a+yohYwf 4by0nWAmB9lBf2uIB3ytC4/PhWqcpzzOQ46K8YahEYzftolz1Qf2npCeqtoAV1g3Zslo opN2I62ZXz/PAUFu+YXk+dQPE9Kepb5WHawTz8ll4C1CJXarImQ9pStdnL54hqxfPioq Criw== 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=fzJ0sH2faCnK7jNf40N25/aG9v+0A5dNqicyhWenfMxHxBFBuc2aOna1SS8qcwgPct evTZKEtkKjPoT6u28szbOJUKC/E+Cg42R9Kd6pUF9dekhrF4GniFZUMMvbwh/Dnm1A8U ajN1BAGbPXivPfJAOejjEJycXhSLmDN1KN3iG+3wa45w9kE1JEPu1YYsy1ngKiwTcuZ6 5zOEK9ucdWlzZPUn69VrMCD3HT7O3ysKUa9ELc2RmIsqCueEi7N9muJLiu+zbB9Nc4B8 PBHrcvenfIoTF6BTuC6iz1G1HfIkJLL7VTSvjgAfmKT08XgfxIED3kzYfPFQAHT9YIjK DEdg== X-Gm-Message-State: AOAM5309e21y0gOQkTL2ZjjTP0Vy0jg4kLrYOmXU33J1w5ETfkd34DHH 7cI/kvmDSb0qZaJEfIZVTzA= X-Google-Smtp-Source: ABdhPJzT/P9zjoUcLxnr99/r6mPFb4wbtKG9JwGOJjHBZorNZuyuG/B2BVUR3d7nISl8goaCC1aj/w== X-Received: by 2002:a17:906:a057:b0:6cf:2736:ba65 with SMTP id bg23-20020a170906a05700b006cf2736ba65mr16811745ejb.171.1645475218445; Mon, 21 Feb 2022 12:26:58 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:b141:a0d:4aad:2a06? (p200300ea8f4d2b00b1410a0d4aad2a06.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:b141:a0d:4aad:2a06]) by smtp.googlemail.com with ESMTPSA id y21sm5391986ejq.185.2022.02.21.12.26.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Feb 2022 12:26:58 -0800 (PST) Message-ID: Date: Mon, 21 Feb 2022 21:26:32 +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 v2 6/6] arm64: dts: meson-gxl-s905w-tx3-mini: add support for the 7 segment display Content-Language: en-US From: Heiner Kallweit To: Mark Brown , Rob Herring , Krzysztof Kozlowski , =?utf-8?q?Andreas_?= =?utf-8?q?F=C3=A4rber?= , Geert Uytterhoeven , Miguel Ojeda , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." References: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> In-Reply-To: <1f39432b-84e2-e6dc-a6b8-c48ad5cf2210@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220221_122700_242651_0C011330 X-CRM114-Status: GOOD ( 10.16 ) 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 {