From patchwork Tue May 30 14:16:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boerge Struempfel X-Patchwork-Id: 13260197 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 0C0F1C7EE2C for ; Tue, 30 May 2023 14:17:48 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=zsP8gVN8US6N9EKQzCWNPRm25o6e8bot0b7Z/ZYh3kc=; b=2HaXHEZyZ7jKJW cD34eiCjF18NeIWe/USyolGCSogpHk1lVN8kRCXQKPY4Wk4KAqwWGO+Ku+hhYa9IId4X0NSrwgN/l BgX4yFWK7Ux+0sm8ZnOSYL2aMmFGm5w4WxTCLq+OZZUob1MTSITNvT/xwh8S2LsMyaDo+tIAIfJP5 mZOoc7AL6G2x6qw3rek5zBq0nDjyJXlmowjxFQEnmwwayTWEKJ3gmPI7xShvW0NbP4pyMoGp/VpNi f7Roh6L5qPoITAFUNWjL3M+JR9jHNMQGg2YigZbHXFteMRqCVQI+2YikddtHsSOTwU0aOXbnH0bY4 HskPIgZTT2bKqHXRceOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q40A4-00EChB-18; Tue, 30 May 2023 14:17:20 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q40A1-00ECec-15 for linux-arm-kernel@lists.infradead.org; Tue, 30 May 2023 14:17:18 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-514924ca903so4997385a12.2 for ; Tue, 30 May 2023 07:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685456233; x=1688048233; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=GI3jhV+Vj7XpnF0lh8amuDJfzIo0HvGNKEWD6ZzT4hk=; b=InHsCi99/gMi1BBPKYIhmcEGOct3pxWnS2wKLY42I0CbMyqFx6ma+JjiZJ3QZB+iMZ Ds+CXOqrRnKCTP7WAhGCmL+xLS5Diu3AIoon10Q3uOBgjBNRYbqBy+xBgXpep4hXS8E4 RtiGV1g5l0/tkM8rCp2TtmdP2PJ+F5urls5NAr8elczFfPnhHATqbpaTk3Z10gHKPttl 5X/UUCB3YRQ1zp/Kw5FBqU12/muJuYEVTw4o8KwnhSQbT7HoqUCgNABXPYrzI5R4Laa2 p+3zqcVmATGucC8RLZqdwA6KZJarDPF3nJOxGUlrzWhg8IXDoQZzdIqN7OyEhyOAT/sR /Qpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685456233; x=1688048233; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GI3jhV+Vj7XpnF0lh8amuDJfzIo0HvGNKEWD6ZzT4hk=; b=gcLcelEUrCfHM2FJZngtsQ+3Vfl2WUVyzysIbZiD+CK5m/z2ZNv4Xif5k+zKZgANfu YOxP5qcJouFalkFCcsO/U1Tuk8UkapRoOyyBsg+6IVsxnDkT5/4adhfF0ghkQnlpv490 hK5ljHYm0hnXfPE7AOj74AARo1KG+wZ66u8EilLdao9PVbgx9xAknvjWZctHjs1e0lvW 1lr7qoSb5nqnktvpU8Sjs7/0nJ73Eq2Ccrz/lgu2UpNLFJ0ZPtO5HRKN6u2FZnH7rqdy TOzW7DY/Cp6Ex6hmXiO7aTsFbBcm6gYghYHQWPiJ3mniyrDz6cPQej4gz4BSbWTe5ONv ziTg== X-Gm-Message-State: AC+VfDwiNtKSLH0M2i/8yeXo+Q39mmYA10R4oBZlbjlUQk1AmrQc9iWD 6PJyL5niuJD35IRugmNgUYs= X-Google-Smtp-Source: ACHHUZ5htGFef6Q921aVNSnqK3yVVjnGL91bR0YghMLaO2Prvqo7GUT3xS6fLQnHhSCxy6YCop7OQg== X-Received: by 2002:a17:906:fe48:b0:96f:4927:7a96 with SMTP id wz8-20020a170906fe4800b0096f49277a96mr2397732ejb.70.1685456232630; Tue, 30 May 2023 07:17:12 -0700 (PDT) Received: from wslxew193.ultratronik.de (p200300c78700c900796a998533c043af.dip0.t-ipconnect.de. [2003:c7:8700:c900:796a:9985:33c0:43af]) by smtp.gmail.com with ESMTPSA id n20-20020a170906089400b0094e96e46cc0sm7354359eje.69.2023.05.30.07.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 07:17:12 -0700 (PDT) From: Boerge Struempfel To: Cc: boerge.struempfel@gmail.com, bstruempfel@ultratronik.de, andy.shevchenko@gmail.com, festevam@gmail.com, amit.kumar-mahapatra@amd.com, broonie@kernel.org, Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 0/5] spi: add SPI_MOSI_IDLE_LOW mode bit Date: Tue, 30 May 2023 16:16:36 +0200 Message-Id: <20230530141641.1155691-1-boerge.struempfel@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230530_071717_371284_CDFE696F X-CRM114-Status: GOOD ( 15.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some spi controller switch the mosi line to high, whenever they are idle. This may not be desired in all use cases. For example neopixel leds can get confused and flicker due to misinterpreting the idle state. Therefore, we introduce a new spi-mode bit, with which the idle behaviour can be overwritten on a per device basis. --- Link for versions: v1 and v2: https://lore.kernel.org/linux-spi/20230511135632.78344-1-bstruempfel@ultratronik.de/ v3: https://lore.kernel.org/linux-spi/20230517103007.26287-1-boerge.struempfel@gmail.com/T/#t v4: https://lore.kernel.org/linux-spi/CAEktqctboF3=ykVNtPsifcmHzF6dWwoEcVh+O4H1u-R=TT6gHg@mail.gmail.com/T/#t v5: https://lore.kernel.org/linux-spi/20230520190856.34720-1-boerge.struempfel@gmail.com/T/#t v6: https://lore.kernel.org/linux-spi/20230524091948.41779-1-boerge.struempfel@gmail.com/T/#t Changes from V6: - Adjusted the patches for next/master Changes from V5: - Added a patch to reorder the command line options for spidev_test in order to increase usability. The indentation fixes were also done in this patch. Changes from V4: - Added the SPI_3WIRE_HIZ mode bit to spidev - Added the SPI_MOSI_IDLE_LOW mode bit to the spidev_test userspace tool and added the two other missing spi mode bits (SPI_3WIRE_HIZ and SPI_RX_CPHA_FLIP) to it as well. Changes from V3: - Added missing paranthesis which caused builderrors Changes from V2: - Removed the device-tree binding since this should not be managed by the DT but by the device itself. - Replaced all occurences of spi->chip_select with the corresponding macro spi_get_chipselect(spi,0) Changes from V1: - Added patch, introducing the new devicetree binding flag - Split the generic spi part of the patch from the imx-spi specific part - Replaced SPI_CPOL and SPI_CPHA by the combined SPI_MODE_X_MASK bit in the imx-spi.c modebits. - Added the SPI_MOSI_IDLE_LOW bit to spidev Boerge Struempfel (5): spi: add SPI_MOSI_IDLE_LOW mode bit spi: spi-imx: add support for SPI_MOSI_IDLE_LOW mode bit spi: spidev: add two new spi mode bits spi: spidev_test: Sorted the options into logical groups spi: spidev_test Add three missing spi mode bits drivers/spi/spi-imx.c | 9 ++- drivers/spi/spidev.c | 3 +- include/uapi/linux/spi/spi.h | 3 +- tools/spi/spidev_test.c | 107 +++++++++++++++++++++-------------- 4 files changed, 76 insertions(+), 46 deletions(-)