Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3068273rwd; Mon, 29 May 2023 05:24:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ilqrH8/5/XRsTfNXJWIVgyFpV8fqb5Fp5tLuw2oernLvic/VmAhHc7ZM/xSHhIc0gch+m X-Received: by 2002:a17:903:1105:b0:1af:cbe4:d953 with SMTP id n5-20020a170903110500b001afcbe4d953mr14296764plh.60.1685363070236; Mon, 29 May 2023 05:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685363070; cv=none; d=google.com; s=arc-20160816; b=KO6lvpxPQtMM4SQ2XM4sT7HIxS7EoFf2a7nWCx+Ilr2EdIsRzJlCYHz9Qi7iTq1/N2 Dj/ClzsAwHH8y9ChH1Aa/zd7Cy3B29Mb+SvInWQ5YdFG2xwQB/0/E6WVHvgUBOscX/vS sTym7Z+BPs6fEO/lr8iC+xtL5uW1WxoKuW0U/YD2K1OK5GFbF23hMOl6YGTWpc6kVJdX RlaK3boSpgy9tQWWQ0OTx9pHtmJdVWJOP+sfHragmE2tfIgPldGwHHLMRoikHJrPeXL3 h0g3AFQXIaHhQMzvev+ronFCouUSLo0yuFwQ/36SyPTo8loIc+gjI7EaCM2UQT/B7xYO uewQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MJnRGb61x91ZNH0NNPHAc4AxKhxzg4Z5JFxNHDSzfcg=; b=JVWW0U7KIAjt4sh14e6Xzgsp4TnPhE5dc5WS4NEkOCm8vy/WG8KQ0hehuTOGS8p8BK JRY2M8vr322L6L/tP4ZWDQcfpHswo7Wb2fQh4+kIPm+Dlz6TyjHvncL7UhLDfrmTPx7B Gtbbm/SL5SiVBCApAxEwm07e2Dprk4JAFaO0SyEX+VIhDozRvgFmGPRqXpmCGbUn3NE3 g97wSfd2F15hKEKG/DPO+m2aj+DID4eAiFGn//QF0oUm/+53YnLcEiww42NYjMMLxRNG M/OpzhD0pUYkUd1eDCgveD5V8paVgL88rCNYogWMkBzsN9EfpMJ3XI4tu8Ms97dxU3c0 5sWw== ARC-Authentication-Results: i=1; mx.google.com; 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 q21-20020a170902b11500b001ab2337ecf5si2778197plr.467.2023.05.29.05.24.16; Mon, 29 May 2023 05:24:30 -0700 (PDT) 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; 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 S231648AbjE2MJl (ORCPT + 99 others); Mon, 29 May 2023 08:09:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230342AbjE2MJj (ORCPT ); Mon, 29 May 2023 08:09:39 -0400 Received: from relay01.th.seeweb.it (relay01.th.seeweb.it [IPv6:2001:4b7a:2000:18::162]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CC0CC7 for ; Mon, 29 May 2023 05:09:38 -0700 (PDT) Received: from SoMainline.org (94-211-6-86.cable.dynamic.v4.ziggo.nl [94.211.6.86]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r1.th.seeweb.it (Postfix) with ESMTPSA id 56C1F200BB; Mon, 29 May 2023 14:09:35 +0200 (CEST) Date: Mon, 29 May 2023 14:09:34 +0200 From: Marijn Suijten To: Neil Armstrong Cc: Jessica Zhang , Dmitry Baryshkov , devicetree@vger.kernel.org, Sam Ravnborg , Abhinav Kumar , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Rob Herring , Krzysztof Kozlowski Subject: Re: [PATCH 2/2] drm/panel: Add driver for Visionox r66451 panel Message-ID: <6enrlcmw6a2vxwzocsdbcx7yaltzh3kv4w3yiydzx7ylrtdozn@xzwdj35uj7na> References: <20230516-b4-r66451-panel-driver-v1-0-4210bcbb1649@quicinc.com> <20230516-b4-r66451-panel-driver-v1-2-4210bcbb1649@quicinc.com> <3cca2809-fa26-f0cf-2ccc-6737d150b43d@linaro.org> <2d9d7454-0e7d-b6f2-93ff-9eca69380e47@quicinc.com> <9d50bc4e-e747-47fa-03cf-4dbd33f778dd@quicinc.com> <5becf303-8a23-6ace-2379-0a002e9b48f7@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5becf303-8a23-6ace-2379-0a002e9b48f7@linaro.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 2023-05-26 09:32:45, Neil Armstrong wrote: > >>>>> +static int visionox_r66451_bl_update_status(struct backlight_device *bl) > >>>>> +{ > >>>>> +??? struct mipi_dsi_device *dsi = bl_get_data(bl); > >>>>> +??? u16 brightness = backlight_get_brightness(bl); > >>>>> + > >>>>> +??? return mipi_dsi_dcs_set_display_brightness(dsi, cpu_to_le16(brightness)); > >>>> > >>>> mipi_dsi_dcs_set_display_brightness() already converts the brightness, > >>>> so you don't need cpu_to_le16 here. > >>> > >>> Tread carefully here: we've had the same issue and conversation on our > >>> Sony panels where this extra inversion is required. > >>> set_display_brightness() sends the bytes as little-endian to the panel > >>> (and it even assumes little-endian in get_display_brightness()) but the > >>> spec for 16-bit brightness values states that they have to be sent in > >>> big-endian.? This is why c9d27c6be518b ("drm/mipi-dsi: Fix byte order of > >>> 16-bit DCS set/get brightness") added > >>> mipi_dsi_dcs_set_display_brightness_large(). > >>> > >>> Jessica, if you need to have the endian swap here (should be very easy > >>> to test with a real panel, but it should be given the max_brightness > >>> value being over 8 bits) please switch to the _large() variant. > >> > >> Got it, thanks for the heads up! > > > > Hi Marijn, > > > > Just wanted to update this thread -- I've checked the backlight brightness values in the sysfs and it matches the value being given in the panel driver (255), so I think it should be fine to use *_set_display_brightness() without the _large() variant. > > Sure, I was also misleaded by you using cpu_to_le16() but as Dmitry said it's already > done in mipi_dsi_dcs_set_display_brightness() and a no-op on LE arm64 platforms anyway. Yuck, right, it's cpu_to_le16 here and not cpu_to_be16. @Jessica, can you please remove this misleading conversion? mipi_dsi_dcs_set_display_brightness() takes a native u16, not a specific __le16. - Marijn