From patchwork Sat Feb 19 13:15:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12752291 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 C8099C433EF for ; Sat, 19 Feb 2022 13:21:52 +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=biZNHCDC7kJK3r2Ppvny+MeTbGgHwO6y5SSdK03SjIk=; b=UP2F6ur5yplqbf W2YcxEecK3NzK3jFpY9HFCh+ttMGTHRPlV6S0rHM+uArRgkdFrn6Pq0nQIlznocy7Fif9rkInCOYC eLoTibfJ7CqEDIX/hCyGAxJAnrw9G335pcvspc/RPxXfD0231fg0U7tPT2ieRj4IB3hSa3Yx5bErX Xr86BRK5gcvU19vGS651mUcANakPOzUbV4Rl/jNUGDqKKgd7ak+TQIvPSwTt+XXP5UNJCWVt4rBNo ITHqpPIqw+yWi19JJziufbl6KdUeSjQGSOR4EXxbbXz33angip8/K+cHLgDqqIUZn0ArCjTt7sPZ0 BMqlrhT3widYY3+EULNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPgJ-00Gwe0-GR; Sat, 19 Feb 2022 13:21:47 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPg4-00GwYO-VZ; Sat, 19 Feb 2022 13:21:35 +0000 Received: by mail-ed1-x52b.google.com with SMTP id u18so20206691edt.6; Sat, 19 Feb 2022 05:21:32 -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=p5g7EqTNRVEGJHBm+irbcgUZNOH9MJijO1bkbt1rfpzfDq9RUEvYTxpQcSK/PZ+BPs VzbLF20uY5UmkO67j5Ne01IDs1HjTAZNygX5DC7kj57Ky4mqKpP0LJKOKAXDIJjvmy+q AC+m2FV/7kgtLiII/lamTyYIuHGSfsttmztZrGfYyG+0uqaqBjQUiRQYJJ62hM+/d9hN hO15Vtqw9L9heD36fmqYalqodZQY7nyWlxmF64AUIgeqhhZGngy0pNYSLwWgyS/dfk5Y +mx+aDqFSsEpxndlXnW9ehLWWBJc5zsLV9DoPvS34jEHHUiTaa0/0u4/9M0IsHL4BSEt mSeg== 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=JibjC9WPBoxr3omslHU54Oy6ZqxwiXDksQI8J10eId0+Q5iA3PxL7tfvt7w87iEgLZ O/bBMfDEMnVFRE+eF53w/npx9UsbeHruMx/vOL4Ky826I3QELGFphKuQn11qvbpYOQt2 KINATQkk+ac+KVQI8Q/NbOSYa3ATkhFNQx9c/oyb0e1DCaG2SPhnUIg7Led5lC/URpAn /74DQDY1s3+NQBrA5NBTaxtLJy5rqteCY+6ro5VqbJUZF0UZ/xlFmkMbnK6QMDs+Z0nf AQhWJk4E3y5xBAP+mFJ8Eglg1fJRAveXcHEg9TPRcYEyASz9ZDoyuFAlhzklUIZPMUwN moFA== X-Gm-Message-State: AOAM530MFvFyzGQfVEOOy5yGzhaqS6t812pcbVMlxlTVxGdhzSoK7Jah wHlnaPCkI0mABm4T53Jt/vkhZucPJuU= X-Google-Smtp-Source: ABdhPJy28n6lGEbuHefJ/j2tXDefEJrO4AuySKKkPDOs7GpEnD5En7td3ozqZSJw/cLIAucF12KaPg== X-Received: by 2002:aa7:df1a:0:b0:409:5174:68a9 with SMTP id c26-20020aa7df1a000000b00409517468a9mr13048317edy.145.1645276890948; Sat, 19 Feb 2022 05:21:30 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d? (p200300ea8f4d2b005cf9df09c1b3d44d.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d]) by smtp.googlemail.com with ESMTPSA id eq19sm5538204edb.36.2022.02.19.05.21.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Feb 2022 05:21:30 -0800 (PST) Message-ID: Date: Sat, 19 Feb 2022 14:15:48 +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 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: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> In-Reply-To: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220219_052133_063431_94A3AEDC X-CRM114-Status: GOOD ( 16.47 ) 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 Sat Feb 19 13:16:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12752292 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 C4797C433EF for ; Sat, 19 Feb 2022 13:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:From: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6fbPYpi3ixU5EOaeB6F4W/eaXSYxd5DdQbkDNHz91k0=; b=4eZz3eXOHMUifY k/M5YqRPgc+GpJNJViNvp6dCPp4P/qomKKuZYH64zz/k/oEer6vyHRufas9pi8EJ23OmnvOV1rdih zB2/q+vONxCVCFqtS6a882X1Eg/ae5xyHMttM4LBcfDHa7+OxpLHDMoN0ZUqyGIi9EcHCK3A8UZfI 1SNRbfuqOJk/F8U/9dSLMgeRCFDawneYStgUaVsFokli7uBWHZvI0MJ2T6toq4F17vHq2eKyqTuS6 BYnbn/8aY0t4F4krS2LnkpJvkIB2QBR+8M1dhlZep/hrl4vH7SPbC9On1JCN0tNix1rd+35/WuXNp IEodPz3562hIdgfnMmJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPgU-00GwgT-Bx; Sat, 19 Feb 2022 13:21:58 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPg6-00GwYf-4y; Sat, 19 Feb 2022 13:21:35 +0000 Received: by mail-ej1-x630.google.com with SMTP id d10so21430558eje.10; Sat, 19 Feb 2022 05:21:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=fvuoOelNYUnuMw3RclEAhuWky9HY1ItIURN9LiLCtBE=; b=A9baqpgIaLoiyIClgnlI8nQkXVzJwoe0eugY7NROFOJ6j8QraPv2HwSPS/Z323hdck KavmMKJuF6uLw59HQ9kMEyaEGryARBpJXKIW3mu6/G75KoOVw6U2NG1dH5toDfhnxFLA pF4h1GyD+88QxRW2+8oyG3rShvVYC3jdoSB73HcZ6iHRjFm54hRrQtAxveTXRkqWKmFc NUgFVy2HEZV8iRguDefeh0sj97PKbvK2KnxCjyAM2qE9qW1zUayw9Vyl31M/01U/iWPh TrkVZvfxCoygGUKgzysP3PA+x97+LTYB492XeYz5DTFWjw5F2w66DpFVa93gOtHxeDAw kK6g== 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=3zIKElxEvF9HlunHY5wqizJG8xQj+6ZgNT7vcW7kkrRMdtNZczeL4NV/sqZdOQQegf 280psqP974Y4XszpXgQuiou4R7a/FyIREM1QgMiWgK8uMn6MnQi0EfulciS+ISqzwLIa 3VK3F4Rrkp8a4iW0ryY7jVAZSarOCAL0JLuPrENMAIDjagtMoGAnr+7v6sJgY6bwp2Iu Jq/iY4zU/QfiEbofIPGIC0wrhEwIfxOHdgXxK3DYEic6lOdHv/RApVieJXdqRLvzsZsN mdFM9FbyOHdBvlNIbmFOCqrbxsQ1EMfydQhCgCz4QUTB4JP9SYvB3nNnvOFz39DIlKHr hWJw== X-Gm-Message-State: AOAM533Yq4Q+8ilhJYBAPbkmsn2uvRQZ9FpB6auHoorqIZd7UQD8Plps zGNHPSc5T1M0zu1xjnuLz1E= X-Google-Smtp-Source: ABdhPJzqpPkqjcbqzzs0Iy+XWNBKleezaBJfKQY7AcpRwS61+T49RYqYpFuYKzO7oARcEK8qWX0Sjg== X-Received: by 2002:a17:906:ad90:b0:6cf:74f1:a34 with SMTP id la16-20020a170906ad9000b006cf74f10a34mr9780970ejb.175.1645276892319; Sat, 19 Feb 2022 05:21:32 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d? (p200300ea8f4d2b005cf9df09c1b3d44d.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d]) by smtp.googlemail.com with ESMTPSA id o21sm1302818ejh.114.2022.02.19.05.21.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Feb 2022 05:21:31 -0800 (PST) Message-ID: Date: Sat, 19 Feb 2022 14:16:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: [PATCH 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: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> In-Reply-To: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220219_052134_216019_DB0AF2CE X-CRM114-Status: UNSURE ( 7.38 ) 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 Sat Feb 19 13:17:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12752293 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 3BE06C433F5 for ; Sat, 19 Feb 2022 13:22:16 +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=TvYsYHM0WBbsXSbpnoOYEJqrV4imMt0bonxc0ViR32g=; b=d3faux9/C2Jw9P TlEtr7/+LB8/EQdbJSXzbyZxK7bLnl4C2vfVZVMM1qN4hZe68q7Xu4KQkgyk+fw9QgqaLZse8iBHi /WvznjZLW25aHVfSiuvabg9cYGpyw35BiAzioUt7VCXXh+2G/IBmKx4LGr5KHpdBcgrxKwqxiJS8t 4+JIuw6tmr73rfx+Eqv4bfEgDDQdiuxJVtFHacDteBz8JbrzanutWqrfQrEWA/85lzNIL8XruApC3 Owk4RdxBflmas1EFY3tpT81G7uYSXEGL+v8YLqUJUrTgt0kkYND3fjt0+5aHO42Zqp46TyVHwRZYL K4wsVvZlSv9zMzgWe5Eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPgi-00GwmD-4T; Sat, 19 Feb 2022 13:22:12 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPg7-00GwZG-O5; Sat, 19 Feb 2022 13:21:37 +0000 Received: by mail-ed1-x536.google.com with SMTP id h15so3248157edv.7; Sat, 19 Feb 2022 05:21:35 -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=fpauG+TRD67lEqkFOUl8ovsHrrNt32JAGPgb9gRTuM8=; b=I/9sZ1OlbKLvWG4qtIMulQQCHX0woCYxCWVD+KGU+EVfwIa6zMU8zx4F83avXtbBQ6 f01FSr/FPuSp8Ipyy5Y+HkHOmsiS4V0DLXhC8YHCBWPvze4MnUs5QoaOpJjKf7FI+o1S Vuin6ENVt8OBCEfS0OQpSqoG16g58qzQImmEjAzAqWlz0KGAcwz703LG32JhWzWmbrYp d4oXy4FGqOBwOp3yMy4iNHlBk1H4sZ5SvMphtk/XCFCyejKkZVUv/mx5YyYcgo3xCngL 79z+yRe8gujGZYFXO3uvDaHkREF9m6nxdi3H8ksBjYYU9BZVRS4EjetYRwsdjy5VCtzn 108w== 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=fpauG+TRD67lEqkFOUl8ovsHrrNt32JAGPgb9gRTuM8=; b=wHmFB0sd6V3D7Zeyu4F6AVIpd/ESWfAeeWfXYuNkmiYssfeJ9QFp487Mdx0ZmX90Fm JkbC0f/L0eOCZk/zJyYDQ4V3dwj/J0HcANcLJ2bkazkGFCdUmCiwm9lZ02fk91FIl9Hu 0QZs3YT3IAsVPgK5V/GvECJ6YrOlofKJnxwSSw7Jg7noe2ETw8cRRct5ikxaeQaHvbVx l7mKKbI+WS3XGe26rC7Iho7W5Y0pPHtoQoxUP3JZz6NeBQBwFjiGDB4bB9AdiXr0w+ja 1QU2ZqdsuU+c9V3cVpDsDByxasNWBoD6K6GHlN57G2XhX5D/93o0lR170dUa3AWHsRGv liQQ== X-Gm-Message-State: AOAM531GtgPq+mafbUD+8YO+rGXJAuhFDLoz1s2ghicEqetRc77V8YEq HQ0nYMCMwWUcVMn9PGg3r58= X-Google-Smtp-Source: ABdhPJyMdwhFMviXX9vaz5IRwMK3brlTzx8iFzc1fr7HKR2rhSXRpPUyZaN8i6BBGVmPmevkmF7BpA== X-Received: by 2002:a50:8713:0:b0:410:db7a:4b2a with SMTP id i19-20020a508713000000b00410db7a4b2amr12665564edb.140.1645276893863; Sat, 19 Feb 2022 05:21:33 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d? (p200300ea8f4d2b005cf9df09c1b3d44d.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d]) by smtp.googlemail.com with ESMTPSA id y23sm3287387ejk.153.2022.02.19.05.21.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Feb 2022 05:21:33 -0800 (PST) Message-ID: Date: Sat, 19 Feb 2022 14:17:54 +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 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: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> In-Reply-To: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220219_052135_807992_3D7A42EB X-CRM114-Status: GOOD ( 13.05 ) 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: Heiner Kallweit --- .../bindings/auxdisplay/titanmec,tm1628.yaml | 82 +++++++++++++++++++ 1 file changed, 82 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..d9cbbc950 --- /dev/null +++ b/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml @@ -0,0 +1,82 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/titanmec,tm1628.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Titan Micro Electronics TM1628 LED controller + +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 + +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 Sat Feb 19 13:18:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12752294 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 C8B92C433EF for ; Sat, 19 Feb 2022 13:22:31 +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=AYAXvkghDwbawW Z8D3aazeOG7T2rSo5Myh1tv7F+ZqO9r92BNNuV9dqXdnOzW0kRCPAFaqjy0//rGf7PlwvcOBTkM2f F7E8A84mfBxri805lMx2hZLRGS/FWTI5iCvgwVUJkOxa9qmts8ZoTuPWAzrycSoSz1oFOyduaLxev 752bBMebTHRybVKZa9uFINIot1ydpOZUB4Xzx332RH8ikKvOpKKiVVZKI9zLIY80TguWpQFZj6DUm 0drXCBBEhWTQWz9v5/tBmZteftbr38Qnd6ATHKPO1FH4GKkPW+fC0wOpKhaNSP13Ww0cpD/GyL2EU eLiWrueS/zQnS2svIM5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPgx-00Gwuh-AL; Sat, 19 Feb 2022 13:22:27 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPg9-00GwZq-0a; Sat, 19 Feb 2022 13:21:38 +0000 Received: by mail-ej1-x62e.google.com with SMTP id qx21so21408304ejb.13; Sat, 19 Feb 2022 05:21:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=6/CbbKb963ZeCrGB3DpHf3S/LmT0OSOkIfiP6ix0yNw=; b=g8yJlYskzqTuBRAAEoQM+HWpp7cbLRi4aY04uw1k85i8g9VrN7PveuKbxE0xjXz4W4 0m8evUE7XQDbQU2cJ/aNI445xwopOp7kGMWScIfUk9veu3ArqpGJ4skEVEV4M7czBpdJ HZVLz0XIreUBuFamppgdxrnMECREn1Nw2b8TeOcc6WmwgnmdWYPKlTb3nW3w778z+FrG 1wMKa7bVwyw8ke4zopRSHWr4XCEV+19sHsOqDY7CBrIwTFReTdSdG/TvSVYJ4AshYgsA t9HyUZi+py5V9U9rKO8qcYoy/lHN8XeJsoLit22RP2uMU4w+jnswk+NZysuVCJ7NNVLn cj3w== 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=LWOrskuWU7pqH78EoWvhv27QHz+zgaJi3T55GMU4H/tuKLwQm6jNbEzF3YrDuDDK1P FwVQ3nfjWigUi6J2Igx0hgEwT8teE+Hxz631CCnSycmfb2CuF8d1ssRufUMS1zvPx4nD Ht4HzOjFZrFOqMr5egQMx0NPMtrP8hLXYT8BtX7YQTIFwvuVzuDrtb7HJ25TNKZ+air4 3HE8BP1W6oGZKt6cR4EJg39fnKKaaPRpqcreEXF5dyO7+oL1/0ya5UXlrm6IEVtn8q0c Nf8y0T2JJsIrj9ij2R9EabnGQ6dOMsM/ZRlZ4cXIURAGvI5MCUVdLbx6R+QORHJPydUJ n80g== X-Gm-Message-State: AOAM5314SHfEG9prTy/2g5Zg7K5nUyjSIvDzN1B3KEP2MT18VttWxfFE QRoQYsUmH+05W9IiEUwT0fI= X-Google-Smtp-Source: ABdhPJzhAyytukio3fsv22UT9/mGIL0fYpo82E0oO6KLYaHugboccaHhai7rq9lexRYpVBewgQTSaA== X-Received: by 2002:a17:906:6b8e:b0:6cd:7d22:e5b6 with SMTP id l14-20020a1709066b8e00b006cd7d22e5b6mr10437171ejr.259.1645276895195; Sat, 19 Feb 2022 05:21:35 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d? (p200300ea8f4d2b005cf9df09c1b3d44d.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d]) by smtp.googlemail.com with ESMTPSA id p9sm3272675ejn.104.2022.02.19.05.21.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Feb 2022 05:21:34 -0800 (PST) Message-ID: Date: Sat, 19 Feb 2022 14:18: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 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: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> In-Reply-To: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220219_052137_081344_A940CCF7 X-CRM114-Status: GOOD ( 11.08 ) 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 Sat Feb 19 13:19: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: 12752295 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 0EECFC433EF for ; Sat, 19 Feb 2022 13:22:57 +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=Jf9lrFql//zjRIDHhcqUbli5WrCc26J31PXoaQ3MOV8=; b=laxjejrLj2UOe2 InCpkRWqubPdcbLamUNwPHKWHfF/3pgmx7/8Cq+7GQbBS51/lROxSxIqVqfFkZ7mywYHV/lqdSam/ HNO/euK2aprI6gWApZfLrRxNJEHiXg1RT5qvZiAsjSmAENaJPOX2GqcEy+vUb0EJGnQ5pch6+KDs9 w4rIoEnpil9fRde2PKtIG/Bhf6HIGqOiTzKnqDDb2k2cOzEvI7Uz7QnBEUz5Ou77bZ3FHgJ60buFY rwiQIGD6muewD9sGgTL/Dqwu4CXYbLzYPzDGwU6QkMfNnQriBMpfynwDik12b487U90KuwefPXMFl 6uEXYgIVXKM8otcGhsxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPhL-00Gx8i-Dr; Sat, 19 Feb 2022 13:22:51 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPg9-00GwaN-T5; Sat, 19 Feb 2022 13:21:40 +0000 Received: by mail-ej1-x630.google.com with SMTP id a23so21493568eju.3; Sat, 19 Feb 2022 05:21:37 -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=KpQK1gfePu1e2tBX2grUcsGjzBBgRCeFnQOH8xBSly4=; b=N33+xmC05XyjZ7JqPO53Tl5+bN+omEhOoSoHrGodc4YDdJ2hdF2O1T6ybNcgO4Ri3S sMmbb5pdN3oGapsNfAQWveuL/ad7dSRuLuyTagF3uKVkVNfdYOEYz+uLk+0raJ/irzBS HBZKZLvWetxKM0NY5QM17MkCqtpTp6JuWfYUmIUXkpnjOZNWC2knvECHIyyAqKFu5O2L f7JP+XkhViGsxr6zXA/4Bthw6RpakTqqrAIhTqV4sCplC3ojGQ6iZ94rYBEIPpxFnL6G O+igroZ08sQDeGynHxeR2al3gcWC15TB6+ZaBAmMgLDj7nMvHRxiAPxBreqb6pZCeC/l fcwA== 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=KpQK1gfePu1e2tBX2grUcsGjzBBgRCeFnQOH8xBSly4=; b=68KxKqHRdQpWxu6hh5xcXL6mMXVA5wqZwT+aIcxm0XPHgX3gqhwHHFPymOs0EYQdg1 DeEKyj4MsZm9V3a/zki+WPMYOeRFQAVn0MGyGrGAofEFjzUj9khQTV2d4lKwqFYXS0LX HVS6SULA2slkegdT/eL1Q4VhO+pfbe7/iBUPjLZcH7iEKuM5vMWWLPHy7s8cnaKjJWrV d3QNd1c3Y3IUOh8e5cVNMPKjF8GvwxjcTRocmkHc0dKZjx0380kDVCLg3Agcq/Gt7IdS wWMDe7VmlRg6MVvycdAYyNhIvb2AgXuOL3w3Ku5WVMtQAKaE8ujuyIlP2OiZiWcENbBj ivxg== X-Gm-Message-State: AOAM532OuU5PfEF4SrbQzI3CnTD8pJspeHC/YQ8/gaZTPcUu84If0/r7 9PB4JiKVwjJDflNgk8tWc6c= X-Google-Smtp-Source: ABdhPJyQUYYa50pDp0HZpcKIg/sd7iNu5qS06WWWtvShT3O8EdTQh0geqDD0oXQHImOYAq9H3Vw/cA== X-Received: by 2002:a17:906:3905:b0:6cf:7ef5:fee0 with SMTP id f5-20020a170906390500b006cf7ef5fee0mr9721904eje.307.1645276896577; Sat, 19 Feb 2022 05:21:36 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d? (p200300ea8f4d2b005cf9df09c1b3d44d.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d]) by smtp.googlemail.com with ESMTPSA id bl12sm3208813ejb.75.2022.02.19.05.21.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Feb 2022 05:21:36 -0800 (PST) Message-ID: Date: Sat, 19 Feb 2022 14:19: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 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: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> In-Reply-To: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220219_052138_075988_4801BC4D X-CRM114-Status: GOOD ( 31.53 ) 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. Signed-off-by: Heiner Kallweit --- drivers/auxdisplay/Kconfig | 10 + drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/tm1628.c | 368 ++++++++++++++++++++++++++++++++++++ 3 files changed, 379 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..a39b63828 --- /dev/null +++ b/drivers/auxdisplay/tm1628.c @@ -0,0 +1,368 @@ +// 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 + +#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; + struct tm1628_led *leds; + 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; + + leds = s->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], leds++); + if (ret) { + dev_err(&spi->dev, "Failed to register LED %s (%d)\n", + fwnode_get_name(child), ret); + continue; + } + } + +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; + } + + return device_create_file(&spi->dev, &dev_attr_display_text); +} + +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 Sat Feb 19 13:21: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: 12752296 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 9EE92C433EF for ; Sat, 19 Feb 2022 13:23:16 +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=ntY0Y7dTU3F4WL i4+AeDJJfQL9+ZTed/2iuwcESDgr1UY+kdL9Q/TomAeYVgsBLZH8xZw3bm/JQ/Unn9ISdQpnelyAs /ttrRwb0UZPJI8CMhwjTG+W6RNaDX7np63/ReW/5ybyfBByxwKvYslcGaKudWSyH+OpnQ3IPZLuO1 OsTKVCwCppLxmbbF/uuGaUKmXQH4fzQfHfbGSAuBs2IF8LZuGRchOkm7cNhe++WgPPDXomTOg63Nd IDIxfB0uk2uDeWb5I8SUvNHfLn0aCMOiCZBkGlOVrvr36WpiGOw1W8MI8I1Le+rIISOwfVhviHZ1v Zk7KTXQZZi1QJXbol1WA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPhg-00GxLn-M5; Sat, 19 Feb 2022 13:23:12 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLPgB-00Gwb0-Nh; Sat, 19 Feb 2022 13:21:41 +0000 Received: by mail-ed1-x52f.google.com with SMTP id m17so20128127edc.13; Sat, 19 Feb 2022 05:21:39 -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=HvdT9JAucpWhsLeiyKmZWgMiivw42j1g4brDgT0HYkHdFm7cuv08RqQ+Yd7vR0Am++ eniGJ6ZcwKrAnunlIdeCJXU+CjPjTpl2zpBARlxoLXIARrfRdv8neQr7BLaE6r9+irr1 ACXnsYsARFhvAIbZCqmGVB+57xjfnRFtrpPTm+2BvIwgepvw+QvR+CdIHrMs8cvmrvYc 9t+W1y11Ppjg6LwczhsFqJjtXrMRwUWliOP6oTIxfWbJ8mbP6e2Txa3FM56WwoSx7+ZF HZ7eaSq61l4YPu7po20/tBL6w8LN9cqSNExUf8/VzCNBMLf2xo0gD9fadPzDq3s8yWgG GsSQ== 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=brECBaH/Sc8QjOwfBAzzV9zmUc327z1bAIS/6amJKPwjptkDiwOQC+Gpm7YAasIHui 4i6LqQpS5YFeYOjyWhrW2b6zlEywSZsoYjKq/+Tn2nLtXYRC3b8FjCauPctRKN0frG9G Hh3tSzC22SIj4oHbsp+IA1+Mb0CM5Hry5djqOZ2CWgELwB+K43xUup2HABi2MsMiA0Mw T8Jrb6ZP1byrj6EPglDyzwELZomMVPjPIIKis4XB1mDMY7W2GLPPpP4mudv1ypfHM3s9 5elSojbv++XZeGK7OORWhjiBb1d4Id8Ipoe7003Dw/O+bhKqKxIIDG6H+FEZ+wtS0ehT gnRg== X-Gm-Message-State: AOAM5300iazwzV6r8hn7bSY3gELqqXkJ4Da+BmBRlZQEMa02zYgeDbWQ 9ClV6mEaDUZ2LkhmFJLWxHQ= X-Google-Smtp-Source: ABdhPJxRPAPD6aXevcaRSr1YCJIxTII7mV9dKRp/d1qVz1sKSq4robgQqCvKDvV7unC3MvnXWu+JOA== X-Received: by 2002:aa7:d592:0:b0:410:b9f9:90f2 with SMTP id r18-20020aa7d592000000b00410b9f990f2mr12921325edq.327.1645276897910; Sat, 19 Feb 2022 05:21:37 -0800 (PST) Received: from ?IPV6:2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d? (p200300ea8f4d2b005cf9df09c1b3d44d.dip0.t-ipconnect.de. [2003:ea:8f4d:2b00:5cf9:df09:c1b3:d44d]) by smtp.googlemail.com with ESMTPSA id h5sm3194476ejo.124.2022.02.19.05.21.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Feb 2022 05:21:37 -0800 (PST) Message-ID: <251a8c26-4b6e-e0ac-059e-94bb40c673f2@gmail.com> Date: Sat, 19 Feb 2022 14:21: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 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: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> In-Reply-To: <4172e59f-b9d5-d87d-9dbd-a6f683a2173c@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220219_052139_809121_D61D7CE4 X-CRM114-Status: GOOD ( 10.71 ) 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 {