Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2088647rwb; Thu, 17 Nov 2022 06:26:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf53MqNFx3FG6b9Yp8vJ6v5q2yKQ28wFJ4mvzo+vuqC90TUTrzq6OAykI6POkb1R1tQP6Zzb X-Received: by 2002:a65:681a:0:b0:434:1b1b:5706 with SMTP id l26-20020a65681a000000b004341b1b5706mr2243100pgt.226.1668695201209; Thu, 17 Nov 2022 06:26:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668695201; cv=none; d=google.com; s=arc-20160816; b=uZUpqu7W5XfQEera+JiL0VqLQEpxOw9/Yp25IMDYHXLf7200RB5CMUViA73+KFHjMw TzmEqfIq3NrZF0lE+ZnakgZYcQ38+LRmS+9DDzXoOmtYe0T8/FVT3O7lSVF7gBgLLPxh cm4KcFWLsQznsy8WfGf7vO0I+DEqnSVDrZ0a1xb/yJUVeeDgitXpc4MecIUljjJskbOm V/kE+oSmu29rO6plu7RFj9OaMNKxMcuXS2vu6C92HzbpZq6qR6bGTmxD5b3D3L6IHC7q zN+2HV/s5FUhy180u3YMKy0xP2vDNHQq8kQ8rQeqIhLbZ4VOArdaLpllpdDUCPKfh7/p D5Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:sender:dkim-signature; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=l4lA/NPwj+QMMEAAup3M3HhCfFWoA7j15Jzij+qkp87BeL03omtX6eRLhZN/kG+yE+ a32Pzl9N7HqCmrVr75ynHiUox60JoRzOFNQkox+6BEnu4RS7tfnQR8jLX2/d7SiwMQfd PXIzle5+PgWo2KkYOmd2HmyDnUa9z5DGoEIcFvYplm4ZiJHzLwBQnn4zRYGJDtaez5xv JLup4sqYXGN3kplTm0s7ZzlRaAOpzkhD57SineEWvR0Jps/YF6BzkNxIiuOJT66v7Ctr AaIcbqKptTS9AzJww61mJXketQxoBmqjCLHfaUVmAVY52C9BHbTRZmfaA9YmjFk71oEd vTqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=b55P44Wa; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na11-20020a17090b4c0b00b0020addb2c6e7si5659180pjb.85.2022.11.17.06.26.29; Thu, 17 Nov 2022 06:26:41 -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=@gmail.com header.s=20210112 header.b=b55P44Wa; 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 S240175AbiKQNkS (ORCPT + 92 others); Thu, 17 Nov 2022 08:40:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240192AbiKQNkO (ORCPT ); Thu, 17 Nov 2022 08:40:14 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D6C4742DB; Thu, 17 Nov 2022 05:40:09 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id i10so5111968ejg.6; Thu, 17 Nov 2022 05:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=b55P44Wa551fN/B8v9btv1bZewuklhAEgqDACB3G4DxO/3tSA+sMxdYw79PP7i80z5 /sVk8z6Z/ARHsSepF2anN36AOd8gexjbGfhK26rciQbxdkKhb9vn8KyzriTRPVB2kMEM BHxe73XSue/R/bzTj2piXsRdJ5SgLqwV+E9Pwc/C5gHFgqdc1qJYwmqN7865ePorvG4M RDTmId2tnAr4IBFbw3VlRu9cYDr1GiOL16dxTuDfxgz2dLoLoThE0kNwsv+kdenLKzsY EH7hxIxJOu4fvN045NCztwjhhpGrImBWX5L/cRK2m6N45tm3ZYG/rqVRO252aDUQcpyQ gzMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=A/+2AkMG1eOm6Ay9p+vBKYHA7fxZFjRxaYwyZ2yhE2e7mV2TmnsYbqhqRoU931bCFK m96min/p4UGtJFQFJwXLRwGtGeLfJVVmeQFuMqoGmseOzbzwt668pNZaRNK2Va27HHyk 6O6206K3o3NUFIKyem9uenQopZp6zq8tR9QlfP7G4I3uxymked1GRJtGU1NlP1HEh5hk pxqOZb1k/XNeHyILnMyHMxPJirNGPpsltgkBTdgypnWSOcuLuExG4no8IksZEBH+261Z j2bm2IVm7hqQXbKH+s/7OnEHQ1UzzM+hQ2/JoM5aDovgETnwcurULS+r7RwN3usHqLR1 JnWg== X-Gm-Message-State: ANoB5pmvc/2B4eFHEUxxzCVCNdwLE5lfTDNCaoszlw5C+hCNZ+rmv0PZ mvnoyy0g9u8Cvw3YPaOFSYs= X-Received: by 2002:a17:907:767a:b0:7ad:e518:13fd with SMTP id kk26-20020a170907767a00b007ade51813fdmr2155160ejc.323.1668692407595; Thu, 17 Nov 2022 05:40:07 -0800 (PST) Received: from ?IPV6:2a0e:41a:894f:0:7a60:27eb:954c:5ab1? ([2a0e:41a:894f:0:7a60:27eb:954c:5ab1]) by smtp.gmail.com with ESMTPSA id bw10-20020a170906c1ca00b0078dce9984afsm373454ejb.220.2022.11.17.05.40.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Nov 2022 05:40:06 -0800 (PST) Sender: Carlo Caione From: Carlo Caione X-Google-Original-From: Carlo Caione Message-ID: Date: Thu, 17 Nov 2022 14:40:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH 2/3] drm/tiny: ili9486: Do not assume 8-bit only SPI controllers Content-Language: en-US To: Mark Brown Cc: Kamlesh Gurudasani , Neil Armstrong , Jerome Brunet , David Airlie , Martin Blumenstingl , Kevin Hilman , Daniel Vetter , 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 References: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> <20221116-s905x_spi_ili9486-v1-2-630401cb62d5@baylibre.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no 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 On 17/11/2022 12:09, Mark Brown wrote: > I don't understand what the commit log is saying here. The > meson-spicc driver advertises support for 8 bit words, if the driver > is sending data formatted as a byte stream everything should be fine. > It may be that there is some optimisation available from taking > advantage of the hardware's ability to handle larger word sizes but > there should be no data corruption issue. There is no data corruption but the 16-bit pixel data have per-pixel bytes swapped: for example 0x55AD is sent instead of 0xAD55 and this is causing the wrong color to be displayed on the panel. The problem is that the current code is sending data with an hardcoded bpw == 8 whether the data is swapped or not before the sending. For 8-bit only controllers the data is swapped by the MIPI DBI code but this is not true for controllers supporting 16-bit as well, but in both cases we are sending the data out the same way with an 8 bpw. So the same image is basically displayed differently whether the SPI controller supports 16 bpw or not. I'm trying to fix this by sending data with 16-bit bpw when the controller is supporting that. Please note that this is what it is done also by mipi_dbi_typec3_command(). >> + /* + * Check whether pixel data bytes needs to be swapped or not >> + */ + if (*cmd == MIPI_DCS_WRITE_MEMORY_START && >> !mipi->swap_bytes) + bpw = 16; + > > You should check the SPI controller compatibility here. This is already done in mipi_dbi_spi_init() by using spi_is_bpw_supported(). Cheers, -- Carlo Caione