From patchwork Thu Nov 17 08:47:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlo Caione X-Patchwork-Id: 21509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp285895wrr; Thu, 17 Nov 2022 00:48:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf6gUfpR6ED55aK+ytOb9IOzQwkG3S0Pt+LQk9dr4IBfcBtvwL+JQoUOeFbDtw2dzj7WbSl8 X-Received: by 2002:a05:6402:541a:b0:463:be84:5283 with SMTP id ev26-20020a056402541a00b00463be845283mr1292083edb.7.1668674926664; Thu, 17 Nov 2022 00:48:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668674926; cv=none; d=google.com; s=arc-20160816; b=ErBkxoDWYqG0T2mrhkb0xcdVK09GjEtEMxSxPeVhazgGrRaCZrwZtH0hTRbKAj46t0 jZRS1cmj0UT/fyeCQYAeHpNjGyPJ50HT9amlB3f2U8xgzeUgIILBFw8BUEi737n98zDf rbhXw4qQMGdpBd44F8M5ICOlMILPPeS6/5305WRipZR2shAL6hojkXqUkTfQutWlbOdy +Ha8WsMYyf9vJjcw+6nxzCd8dSGKOPEbkAC6WtNVqngksDx2Nmn9J7adWTRxCTgaKXok TNV0eM11tQ4dndPdfxSx7az4eWJMD8kxhykQED6mLGXxhlZkZKWOjoULyHSGa4DoWnES gmuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=kplxU2lR5aG0mBiBv43tp2KK14DvgQ3747TCEeV3JMg=; b=FfKUwdBRh5P3TOQmzL1b7UImCglxr2Mb54aL9DqFj9iDVjodxL1PDQv7fmfn5b7RIU dp3hV9jwIxREKLb7BWt021j4AoN6W2QBsI3i1qgXHNQ0BDtJ9ZlEeVH7kPLzE2P8pL7x iWy3aLqRLIW4FuUhFbvtfiumdLj5mnuYwLgUNzD5gzHHjYNF9g+y1ljNAFMDnJYY8j5M BQv59f8dq94EQaPwbCIPw3k40OivffVY+W2uwW9MPGmW4SOkqX3AnoOTIoVy3f+f0maB B3GugyPHm2uoop5P4bbDAjnQmVXrQrITQSJYzq9O6dJwtVtQEmjcElJVUSTiayBKzTdC bJpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=JJZviyNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa31-20020a1709076d1f00b0078dfe6dc4d2si171856ejc.33.2022.11.17.00.48.23; Thu, 17 Nov 2022 00:48:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=JJZviyNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239645AbiKQIr6 (ORCPT + 99 others); Thu, 17 Nov 2022 03:47:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239338AbiKQIry (ORCPT ); Thu, 17 Nov 2022 03:47:54 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DA662DCC for ; Thu, 17 Nov 2022 00:47:54 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id x102so1607328ede.0 for ; Thu, 17 Nov 2022 00:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=kplxU2lR5aG0mBiBv43tp2KK14DvgQ3747TCEeV3JMg=; b=JJZviyNTe3aoLaHC8gnS2B6ZcTQTNzqCo1CNL5fhLhh/Q21pISItv3OuImIZPearuW bcPv8/v3zDuo0hQF1Lxl2dF61VnCzkP4spsZMx9z8F5hpwlR6u9zM/SndG3dLHBBLnY0 k6htMUas9GgLlqwNVv8haDJ1k1sKtjozX77I+aljOtKJKGPtB+BuHZSWCo+mN29Ll9Qi CRzV4Z8IPLuKuq3E4NgPh9PssxWg2C/4fGnvj7vEgj1k5ujzzy4ewWa9SM19CUNImdn/ LvG4iiIh9BzZTOLPVDG0udI2RexERIauevvSdRle0EGIrUaKj+OeJ5HOXjqL5Qsc/vat CR4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kplxU2lR5aG0mBiBv43tp2KK14DvgQ3747TCEeV3JMg=; b=pe+k9ki4/If9vNG5ITsm7BMRRsHk8aWfnPFIwh2rn2mYGNGgPlf8gbzqs1vuWwa86N zWtXK+ntuotBp2GLH06SSSKPIz7AkLjS9iMHX4CVQWWmzpy8Kml3658U8s4c7enI17eF 9hiNBJnR7S2K88VS2831f/i9W0ETlb6b+1xih+Rz7P2WyzMpCXCzrag8ASyBX/p7SRgG H1UE6kygdoFaD+PxuMXxK7LXVL6GpwTJh3zt9jGhC1ae7uRYcEfI1mCeIyF4vPSWdgd5 jmLSrx36HdglpCDysaY8VwR2heFa2uxE6RPVmG0XR7yczEHjerD+hurtBPZhO94LioIN trKA== X-Gm-Message-State: ANoB5pmUINXTCCuwuX/mVYTm7YyOvo16du/qmrmfnfYnvwZ/38keLM+a lU47ojRbfexj2Yl+hVG/fgTiXQ== X-Received: by 2002:a05:6402:4d6:b0:458:789b:c1b0 with SMTP id n22-20020a05640204d600b00458789bc1b0mr1277535edw.89.1668674872601; Thu, 17 Nov 2022 00:47:52 -0800 (PST) Received: from [127.0.1.1] ([2a0e:41a:894f:0:7a60:27eb:954c:5ab1]) by smtp.gmail.com with ESMTPSA id s22-20020a1709067b9600b0077205dd15basm77332ejo.66.2022.11.17.00.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 00:47:52 -0800 (PST) From: Carlo Caione Date: Thu, 17 Nov 2022 09:47:39 +0100 Subject: [PATCH 1/3] drm/tiny: rpi-lcd-35: Enable driver module autoloading MIME-Version: 1.0 Message-Id: <20221116-s905x_spi_ili9486-v1-1-630401cb62d5@baylibre.com> References: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> In-Reply-To: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> To: Kamlesh Gurudasani , Mark Brown , Neil Armstrong , Jerome Brunet , David Airlie , Martin Blumenstingl , Kevin Hilman , Daniel Vetter Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, dri-devel@lists.freedesktop.org, Carlo Caione X-Mailer: b4 0.10.1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749732479984491754?= X-GMAIL-MSGID: =?utf-8?q?1749732479984491754?= SPI devices use the spi_device_id for module autoloading even on systems using device tree. Add the spi_device_id entry to enable autoloading for the 3.5inch RPi Display (rpi-lcd-35). Signed-off-by: Carlo Caione --- drivers/gpu/drm/tiny/ili9486.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c index 1bb847466b10..bd37dfe8dd05 100644 --- a/drivers/gpu/drm/tiny/ili9486.c +++ b/drivers/gpu/drm/tiny/ili9486.c @@ -183,6 +183,7 @@ MODULE_DEVICE_TABLE(of, ili9486_of_match); static const struct spi_device_id ili9486_id[] = { { "ili9486", 0 }, + { "rpi-lcd-35", 0 }, { } }; MODULE_DEVICE_TABLE(spi, ili9486_id); From patchwork Thu Nov 17 08:47:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlo Caione X-Patchwork-Id: 21510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp285960wrr; Thu, 17 Nov 2022 00:49:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf7PZts7ZmZ/mAzO8KxtyIsNeqHOcHnShMsoS3rUbTG76VeUa0m+PnXCMt2DIACawhJQ54Pb X-Received: by 2002:a17:906:814f:b0:7b2:86d6:292d with SMTP id z15-20020a170906814f00b007b286d6292dmr1253322ejw.714.1668674943243; Thu, 17 Nov 2022 00:49:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668674943; cv=none; d=google.com; s=arc-20160816; b=JAT2239D0ibTA5WxNRwK0rkupgkF8BMxxyjhWmR/KUe5k+qfduFPHsdYNTtEHhVahq uhjr180Uh6/PCynUtEN//+eWEon9zv/EQhVGbnbVS1sppEopcj7F8KgRKiqmeZOodCEZ rbaeGSBwKdE3XGeAh390RgD9aOmNi3dXRC/Erp134FlPR2hPoWJVaC6I1Ujm9vwQAMpD xFesBOvALZEFjTlp0CVSsNBE5hfsc9s4nl3bX6hso980lINNkrHGEm23giuqmRQPZcco mRGOGHS7Q2egTtCqVYpWKiTP+ugIPFMEeaSTbH4qexITzT8w3tbG4RPDD1EKORvk1/Vw EEOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=90zm8/9EgVKMcm+GcVTwlECGEPSG+I41CMXM1RTutaE=; b=z0NXNgu3s+4oL2psYz90MI1cjJvLe6nVEgoST04oNlalL+x/NsH0YyREo5a1BKRFxo +q/SQoSqYgina4j69YHyHhWQmenReMVTc3pMKAfzlQ9Y+6S3EN6U62rBled9tRwUATtX 1R5IGDkjSnuFHGfRC9uuLVQmsLz48JpcthAIUSg4D0j5CCtcz/5/vi+a1N/WjrzCqVHA vZtPPDqQ8yLf2wvcIp/7YaPg/O59+WYll93quZ7Bvf36pqs3dG+llwke74BU5ffOEnrm sBBu4C2jI02q+piXOje6w4w/E288EPKAxSuiku5k2uN04bJFYpbXRqXyaY1RJinoOXVD hDGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=UnkavLeF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et19-20020a170907295300b0078d9cec6a5asi105216ejc.191.2022.11.17.00.48.39; Thu, 17 Nov 2022 00:49:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=UnkavLeF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239665AbiKQIsC (ORCPT + 99 others); Thu, 17 Nov 2022 03:48:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239401AbiKQIr4 (ORCPT ); Thu, 17 Nov 2022 03:47:56 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E45E9101F0 for ; Thu, 17 Nov 2022 00:47:54 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id a5so1501260edb.11 for ; Thu, 17 Nov 2022 00:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=90zm8/9EgVKMcm+GcVTwlECGEPSG+I41CMXM1RTutaE=; b=UnkavLeF63kWpP4dt3DH3oo2hhLFs7VsnslG4t92oUQapu5uMsW0U6XFO9MEi+swRX /ohsTvFbJwQ0scQ1IYNcwQ/z036JyCSL0TqusFH7ceidILUrvk9jSNNs0P9hFMLeNW+V FGnwjC0/0OhODR4CMHeGQJEp+HL0G5XlSqf8wbQ4bMqMUukKA+CgfLE/W1wbO98Xf7iN k06oxVsEINbbzZzifkn9cqEmMGs7wwacRRZd+8Ve+L2FKO7hiz1X87dxyTl4uoSBMU72 YNLwzVDpkjjxtc3OOUB8AyHI7mAPRzIMpufnKutmnF3+8449KHQfp5KX81vW6GMUPufg IU7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=90zm8/9EgVKMcm+GcVTwlECGEPSG+I41CMXM1RTutaE=; b=rBdN8QRBbWRxqa3XmvqVC9sUn8TU+6dsITy6/mpq3YnUO234PlcrmN/V/qx8+z8tPV JfXeRKR8f8HD0xrkfP/KGt0XGeqWwuzur4/DgLHC7xEd7OgXSTumkbQYWg3vfo8Qpqt+ XK7AQ+9F3lvD8gxEwU1bOjKytUgDpexBn/b31KCqfp0+f2oR+8aiLAvRF830OgsFE5JT 5I3YRUCQwnhGKMLlyvtjk9kZc+2RubjJHf+FhT6+QU8t667FZ96I17q6hLob8W2kHoWC 6so6roc/TnHQHd8kPKFxdrMziGJFC7QYnhs8McAaN19tZWuJwhbuCMr0o7jzdEG51dZ7 9HZw== X-Gm-Message-State: ANoB5pnOr7wAL1JeRFAbJz9tUXGbi+Y1loycTArH+WQBlZQgUOJI1NcM fbjlwbGq0cfw/BjUrkSN6CUERg== X-Received: by 2002:aa7:d1c5:0:b0:461:dd11:c1bd with SMTP id g5-20020aa7d1c5000000b00461dd11c1bdmr1207044edp.406.1668674873463; Thu, 17 Nov 2022 00:47:53 -0800 (PST) Received: from [127.0.1.1] ([2a0e:41a:894f:0:7a60:27eb:954c:5ab1]) by smtp.gmail.com with ESMTPSA id s22-20020a1709067b9600b0077205dd15basm77332ejo.66.2022.11.17.00.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 00:47:53 -0800 (PST) From: Carlo Caione Date: Thu, 17 Nov 2022 09:47:40 +0100 Subject: [PATCH 2/3] drm/tiny: ili9486: Do not assume 8-bit only SPI controllers MIME-Version: 1.0 Message-Id: <20221116-s905x_spi_ili9486-v1-2-630401cb62d5@baylibre.com> References: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> In-Reply-To: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> To: Kamlesh Gurudasani , Mark Brown , Neil Armstrong , Jerome Brunet , David Airlie , Martin Blumenstingl , Kevin Hilman , Daniel Vetter Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, dri-devel@lists.freedesktop.org, Carlo Caione X-Mailer: b4 0.10.1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749732497110556974?= X-GMAIL-MSGID: =?utf-8?q?1749732497110556974?= The ILI9486 driver is wrongly assuming that the SPI panel is interfaced only with 8-bit SPI controllers and consequently that the pixel data passed by the MIPI DBI subsystem are already swapped before being sent over SPI using 8 bits-per-word. This is not always true for all the SPI controllers. Make the command function more general to not only support 8-bit only SPI controllers and support sending un-swapped data over SPI using 16 bits-per-word when dealing with pixel data. Signed-off-by: Carlo Caione --- drivers/gpu/drm/tiny/ili9486.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c index bd37dfe8dd05..4d80a413338f 100644 --- a/drivers/gpu/drm/tiny/ili9486.c +++ b/drivers/gpu/drm/tiny/ili9486.c @@ -43,6 +43,7 @@ static int waveshare_command(struct mipi_dbi *mipi, u8 *cmd, u8 *par, size_t num) { struct spi_device *spi = mipi->spi; + unsigned int bpw = 8; void *data = par; u32 speed_hz; int i, ret; @@ -56,8 +57,6 @@ static int waveshare_command(struct mipi_dbi *mipi, u8 *cmd, u8 *par, * The displays are Raspberry Pi HATs and connected to the 8-bit only * SPI controller, so 16-bit command and parameters need byte swapping * before being transferred as 8-bit on the big endian SPI bus. - * Pixel data bytes have already been swapped before this function is - * called. */ buf[0] = cpu_to_be16(*cmd); gpiod_set_value_cansleep(mipi->dc, 0); @@ -71,12 +70,18 @@ static int waveshare_command(struct mipi_dbi *mipi, u8 *cmd, u8 *par, for (i = 0; i < num; i++) buf[i] = cpu_to_be16(par[i]); num *= 2; - speed_hz = mipi_dbi_spi_cmd_max_speed(spi, num); data = buf; } + /* + * Check whether pixel data bytes needs to be swapped or not + */ + if (*cmd == MIPI_DCS_WRITE_MEMORY_START && !mipi->swap_bytes) + bpw = 16; + gpiod_set_value_cansleep(mipi->dc, 1); - ret = mipi_dbi_spi_transfer(spi, speed_hz, 8, data, num); + speed_hz = mipi_dbi_spi_cmd_max_speed(spi, num); + ret = mipi_dbi_spi_transfer(spi, speed_hz, bpw, data, num); free: kfree(buf); From patchwork Thu Nov 17 08:47:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlo Caione X-Patchwork-Id: 21511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp286147wrr; Thu, 17 Nov 2022 00:49:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf7jilRo9dXzyT6wyPsDHspIsKth3Xh/QibSaQSpeQIGBEu2KEVNZgw54PDkFSXLHMqsBtB0 X-Received: by 2002:a05:6402:910:b0:468:74:9668 with SMTP id g16-20020a056402091000b0046800749668mr1237903edz.394.1668674978117; Thu, 17 Nov 2022 00:49:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668674978; cv=none; d=google.com; s=arc-20160816; b=f+VhEe+oB2cbwOlV1NZvE3J03Gjxy8yXV8pujnaFP+xQBXY3RIn/PdNatS2bpoJRXO pwwI6ZmTe4YlQGqiWCj+QLEa4zCEcmXrJG83pkvsJlFlLUzrQDQKxhGNwSu7mvxJzn29 Uy47gpy+L3G+mwPvpqLn4fIZ66XYp6iPlaG9Ot6YV8kHj1F30MOeceVTh+tHaUpJ3UcN DQtReIjKmf55GkiMJnslcVO2rRmGmChbVlipr3e2JA0dik7ieM7YIz6aslkjfiIUEK6T /xykgKAG4Zobko+bN/GvutS9AAaJyOTLF5ABxypFq/SbWbFx9PC45s1azk5yDYnjtWt7 Ro4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=idox2DWf9CfxY6np+xVajajSNgisazAtYo+m3/oXIzQ=; b=1K1u7sLGItYDZ/Qrm/V17zy28q16FkTJ9PtIutl2qooPupe2CbmGVxmBNmXcO4urj0 9gIP9vtMDhHPt7dJIoNNSq5cf1tBM4u8O8Lno/McZTlKDRh1+d8UVN7WJKVXOYLxImda hre+TNOTisl5TzEDRoCjwVHBKlbzz2h1pPqaSbVmrUhP+4dXL3Xpbi7dWkthTADkRm+H 2wgYejAQd7kMQ46o29z+PfA5Cp5Gxw/QMBsoN5KVz+qi+NULszBASmeOcZBvXyhR2Dr0 LaIsalHsL3vY1cgBSUDNsHI5HMSBWOwaO2rWtYXZkc9x5bxc/iCXmo7JAPtAQ7YvxVkP AXeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=YJtoDwNe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a056402320e00b0046687667ea9si423257eda.466.2022.11.17.00.49.14; Thu, 17 Nov 2022 00:49:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=YJtoDwNe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239624AbiKQIsM (ORCPT + 99 others); Thu, 17 Nov 2022 03:48:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239556AbiKQIr5 (ORCPT ); Thu, 17 Nov 2022 03:47:57 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCF1F140C9 for ; Thu, 17 Nov 2022 00:47:55 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id 21so1548882edv.3 for ; Thu, 17 Nov 2022 00:47:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=idox2DWf9CfxY6np+xVajajSNgisazAtYo+m3/oXIzQ=; b=YJtoDwNevsDYE56TfvpY13pJKKdr1ptUtkThXpzJvzyqFNfQ0lQAYsHeD/G6ijoQb9 FzNX3VDp0JST+f3q3q97kt/nU09VpZOu7LMruQ2aOWiPdjy515rP0ho3XAzk1xer9fUN oo8Xij8p06FD8ZWJk/LZaY9rS8uvkmH0Z1QGAUQbauZoRhXRKl8mkUxO/VfQ94d/bxDO 0PA707ZmvAL0b7U1IDRpV2graHjHktcAA/oqFa82GZMPJbLgLQQ8+eIAE7kVfLldaMqZ ih7RbpltfyVp99rBOpxzOCYnMi64Up3c/VX8yVq0MmjyQIqG90pWGWBylHcJm+0gLN/P +P2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=idox2DWf9CfxY6np+xVajajSNgisazAtYo+m3/oXIzQ=; b=a3fXgH0qNsGPMXqJp/M89tqtJRSp46aWvzjjKnLLVfRgKSGyPXreeaQZF7s+3PT9u1 l9nqeITPdLZXpzTTooLSMnBRssJ7pVxJOFXWcINoF9S8j0YyaEWX9YNgwRU8ciSWgW+3 WJ6n0tJJEfuPQVwC2KHAoAGVbZJlRNhzbZn7zcwF+mamSc2Z25tct62+w4xbwdzeAauq rVdhDNaDYdUW+dyrVYHj1p3Ylmsx2IGn0KcYU422v+Eg6ZRMUCldpmhhZzB+mhCyLF60 H2kB1mf49q2hvpFWbixLYHoNBS6IHX56naAdAB2XvLHNTjoXt/+yxW7vWAUGkXKKhCke HS2g== X-Gm-Message-State: ANoB5pnvpVUoS6ESA/K3yaUHwSrPNhqz1BYS/GzrNLgopYSTsm1H5LII bDKUgwk/dtD9jRwFmQoYDIY77g== X-Received: by 2002:a05:6402:3707:b0:467:6847:83d3 with SMTP id ek7-20020a056402370700b00467684783d3mr1257987edb.247.1668674874355; Thu, 17 Nov 2022 00:47:54 -0800 (PST) Received: from [127.0.1.1] ([2a0e:41a:894f:0:7a60:27eb:954c:5ab1]) by smtp.gmail.com with ESMTPSA id s22-20020a1709067b9600b0077205dd15basm77332ejo.66.2022.11.17.00.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 00:47:54 -0800 (PST) From: Carlo Caione Date: Thu, 17 Nov 2022 09:47:41 +0100 Subject: [PATCH 3/3] spi: meson-spicc: Lower CS between bursts MIME-Version: 1.0 Message-Id: <20221116-s905x_spi_ili9486-v1-3-630401cb62d5@baylibre.com> References: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> In-Reply-To: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> To: Kamlesh Gurudasani , Mark Brown , Neil Armstrong , Jerome Brunet , David Airlie , Martin Blumenstingl , Kevin Hilman , Daniel Vetter Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, dri-devel@lists.freedesktop.org, Carlo Caione X-Mailer: b4 0.10.1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749732533867067418?= X-GMAIL-MSGID: =?utf-8?q?1749732533867067418?= On some hardware (reproduced on S905X) when a large payload is transmitted over SPI in bursts at the end of each burst, the clock line briefly fluctuates creating spurious clock transitions that are being recognised by the connected device as a genuine pulses, creating an offset in the data being transmitted. Lower the GPIO CS between bursts to avoid the clock being interpreted as valid. Signed-off-by: Carlo Caione --- drivers/spi/spi-meson-spicc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index d47f2623a60f..af8d74b53519 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -291,6 +291,10 @@ static inline void meson_spicc_setup_burst(struct meson_spicc_device *spicc) static irqreturn_t meson_spicc_irq(int irq, void *data) { struct meson_spicc_device *spicc = (void *) data; + struct spi_device *spi_dev; + + spi_dev = spicc->message->spi; + gpiod_set_value(spi_dev->cs_gpiod, 0); writel_bits_relaxed(SPICC_TC, SPICC_TC, spicc->base + SPICC_STATREG); @@ -309,6 +313,8 @@ static irqreturn_t meson_spicc_irq(int irq, void *data) /* Setup burst */ meson_spicc_setup_burst(spicc); + gpiod_set_value(spi_dev->cs_gpiod, 1); + /* Start burst */ writel_bits_relaxed(SPICC_XCH, SPICC_XCH, spicc->base + SPICC_CONREG);