From patchwork Tue Oct 22 21:33:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 13846198 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 85513CDD0EA for ; Tue, 22 Oct 2024 21:33:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0028610E6E0; Tue, 22 Oct 2024 21:33:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=rocketmail.com header.i=@rocketmail.com header.b="EA/FAPsO"; dkim-atps=neutral Received: from sonic306-21.consmr.mail.ir2.yahoo.com (sonic306-21.consmr.mail.ir2.yahoo.com [77.238.176.207]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8DEAA10E6E2 for ; Tue, 22 Oct 2024 21:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1729632831; bh=vFxp6V7ftU2GOHcy5DZ1sostkzSaRPaYmJbs4yP+a9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=EA/FAPsO0aan5AjfdOWPC31ENdXkBcPbrZACOIh5dWkcklaW4I3jIen1JCWZ/CU/2Xva6Rj0tE71rSrnk8Shjd6KPo/f4eWgWWTR/dqSfAXBydoXapDiJgo0qhn/AcU0c3mG5MsMO5xmw7pEiKnYZCrLJT0ikMG+uzo+bF1h/WdU3xyyxecfYEn6tlLSjtse+6LNlJ1lxtywtT4d1Wl1JVX44Lmp+62yl/uWwvkk7FABDrE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QFjoWJz8QPqCczysrCW9qVXuHbNdsWNJ8CLhWDfXhlnKL8wB74UOs3 exZAf8U9YM1Qptam0WD3RKbi.jEqo9qfZxpccDrT7_B9rvGwsYSVe6FABAaFDloIbzQ9OBoWipCo 2V31TRs0J8yVNPrdYw5_Q57dPqPwWbcy0dnFEiXA2t0kxl5EewFp_udiXZ0Au4t.1LXToXSwkj4o YRwm_7MRYe19JpZZ0uf37GXKyu6HUQPf87XIucRlsKhkqjUvFah8jTCOkyV35L9HK3nQ1dr7m5Wk MYygUhFmF__oeXpJ4mgTJPhr7qvFVeKUbAn0gfxW49tetIkrTGj8iXe_zkOymAQzcEK4oWRce3PV 1a2OF5ppEN_aUfwBLtMx02ie.tHSAOu_DYDT.LpzeWfHCL.NJmj6LeqJe2fit0HdARKuEZByhn2O tC7UamdJzQhN0PlutSe8ln2SfJ.NWnYSbkkMQU5TU.e48Uncb7J_KM8W.EesvBtPkNPkTjqdW8JF VmbqY77Bq0pJjWQ2GNxl2aRrxO84TMuFoyYEw9zPWpfYSGA4nUAPrKwp2.rmZzV971uomhACOn9i SjrUbirSY9ryDbmguD4.WYH4wNL5kLGHPsCOF7SYFiaYpd6n_DZIJW5IN9Xo5v4xnD6Dd9eYjaE5 5i_tlx_pGzN18EIvewWslysQkwkI1aBu.IlNvfGXSzBAzmGtmRKPJ822IcbTBmtAgX.GC4AjmqWc idvB4eeqmNtBhjQSPaGnVbuYTOaHLrDML6.FIy2Qzk0htBk8FXzbcnvogDMPhlEf3ZgF5rJ1Y4.1 M9aM.NX6FZVg17L9dcuIB8jxew6tpXpkhgLg6ttMlqFNyL.QK9V2foA-- X-Sonic-MF: X-Sonic-ID: 395ddffb-acb6-449b-9b75-1ae2036c4cac Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ir2.yahoo.com with HTTP; Tue, 22 Oct 2024 21:33:51 +0000 Received: by hermes--production-ir2-c694d79d9-qjs6q (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 00a5d0a4af66107c7c1614b6d685cac8; Tue, 22 Oct 2024 21:33:48 +0000 (UTC) From: Jakob Hauser To: Neil Armstrong , Jessica Zhang , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Thierry Reding , Laurent Pinchart , Andrzej Hajda , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Jakob Hauser Subject: [PATCH v2 5/5] drm/panel: samsung-s6e88a0-ams427ap24: Add flip option Date: Tue, 22 Oct 2024 23:33:39 +0200 Message-Id: <57a8498440695218d095cb037a5dc818d6fe7355.1729630039.git.jahau@rocketmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The way of implementing a flip option follows the existing panel-samsung-s6e8aa0.c [1][2][3]. The value to flip the screen is taken from a downstream kernel file of a similar but older panel [4]. The mipi clock [5] for the new panel samsung-s6e88a0-ams427ap24 matches 461 MHz and a hardware read-out of the 0xcb values corresponds to revision R01 of that older panel [6]. Although for samsung-s6e88a0-ams427ap24 that's in non-flipped state while in this older driver it seems to be the other way around. Further up there is a hint [7] basically saying for revision R01 to change the first word of the 0xcb command from 0x06 to 0x0e, which is actually setting BIT(3) of that word. This causes a horizontal flip. [1] https://github.com/torvalds/linux/blob/v6.11/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c#L103 [2] https://github.com/torvalds/linux/blob/v6.11/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c#L207-L211 [3] https://github.com/torvalds/linux/blob/v6.11/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c#L954-L974 [4] https://github.com/LineageOS/android_kernel_samsung_msm8930-common/blob/lineage-15.1/drivers/video/msm/mipi_samsung_oled_video_qhd_pt-8930.c [5] https://github.com/LineageOS/android_kernel_samsung_msm8930-common/blob/lineage-15.1/drivers/video/msm/mipi_samsung_oled_video_qhd_pt-8930.c#L2027-L2028 [6] https://github.com/LineageOS/android_kernel_samsung_msm8930-common/blob/lineage-15.1/drivers/video/msm/mipi_samsung_oled_video_qhd_pt-8930.c#L137-L151 [7] https://github.com/LineageOS/android_kernel_samsung_msm8930-common/blob/lineage-15.1/drivers/video/msm/mipi_samsung_oled_video_qhd_pt-8930.c#L66-L74 Signed-off-by: Jakob Hauser Reviewed-by: Neil Armstrong --- .../drm/panel/panel-samsung-s6e88a0-ams427ap24.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c index 6e02b881434d..8372d0d307c8 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c @@ -32,6 +32,7 @@ struct s6e88a0_ams427ap24 { struct mipi_dsi_device *dsi; struct regulator_bulk_data *supplies; struct gpio_desc *reset_gpio; + bool flip_horizontal; }; const struct regulator_bulk_data s6e88a0_ams427ap24_supplies[] = { @@ -538,6 +539,10 @@ static int s6e88a0_ams427ap24_on(struct s6e88a0_ams427ap24 *ctx) mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xcc, 0x4c); mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf2, 0x03, 0x0d); mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf1, 0xa5, 0xa5); + + if (ctx->flip_horizontal) + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xcb, 0x0e); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5); mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfc, 0xa5, 0xa5); @@ -672,6 +677,15 @@ static int s6e88a0_ams427ap24_register_backlight(struct s6e88a0_ams427ap24 *ctx) return ret; } +static void s6e88a0_ams427ap24_parse_dt(struct s6e88a0_ams427ap24 *ctx) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + struct device_node *np = dev->of_node; + + ctx->flip_horizontal = of_property_read_bool(np, "flip-horizontal"); +} + static int s6e88a0_ams427ap24_probe(struct mipi_dsi_device *dsi) { struct device *dev = &dsi->dev; @@ -706,6 +720,8 @@ static int s6e88a0_ams427ap24_probe(struct mipi_dsi_device *dsi) DRM_MODE_CONNECTOR_DSI); ctx->panel.prepare_prev_first = true; + s6e88a0_ams427ap24_parse_dt(ctx); + ret = s6e88a0_ams427ap24_register_backlight(ctx); if (ret < 0) return ret;