From nobody Tue Nov 26 04:02:15 2024 Received: from sonic313-21.consmr.mail.ir2.yahoo.com (sonic313-21.consmr.mail.ir2.yahoo.com [77.238.179.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A62851CC146 for ; Tue, 22 Oct 2024 21:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=77.238.179.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729633442; cv=none; b=Nz9aGwuBg5wr44Y7PAacF6oJ7plWzuvhQ7z9mfFalDZMhmCYWjhcBhjoZmcYsHQB474nga5f1EllAFTSSP8RA7GFfRCTtaDWKZhIoPUwd7YVTY+wKqNJtcsOIsm7UOQDTOk886tS91EownrL2ojcHplvkEcSMBN2p3alBhVszjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729633442; c=relaxed/simple; bh=zOMyIwvrjWngB9XpgRClzT6LO2z3ccv2zShnUyLoYHQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pSEdY9etzRshGtuPQnrx+EJ2xNMTuyFQgdjFw/xNhrz7LIdCME4NHaOn+Ipo1PNlv1KLvw+U6B0ya85z1QqtvhG7fgzzsZIukfEQJNuPnF2R5j796hUJ34TchDj7pRm7PPW3AGSQjWulKqiKWksHq1FDNlusFi+kcJXngm34hTA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rocketmail.com; spf=pass smtp.mailfrom=rocketmail.com; dkim=pass (2048-bit key) header.d=rocketmail.com header.i=@rocketmail.com header.b=VEuwTKej; arc=none smtp.client-ip=77.238.179.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rocketmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rocketmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rocketmail.com header.i=@rocketmail.com header.b="VEuwTKej" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1729633439; bh=vFxp6V7ftU2GOHcy5DZ1sostkzSaRPaYmJbs4yP+a9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=VEuwTKej4ZF+gI4jYj8H5B1MDwmXWDsD2rdVDKHNIilJMDnVvNIrt9NwU9p0oRV7XLxsBJH7HBW2y22PBcUV6dKVOCWhyi29XUpv/Bdx5NLzQ0LBlb/STn6gBOyHJ39mCr4IaHSGHhlJ+rG/nq+CaNda2nMDsKt90W0GKS9pabgoi0tggl1Xxqt+IFucNgCOSJN8pgHuZISBVP4sj5lO3y1WM5xNlIkR1uV2/RmShHRvqvkWHjKktKlwNMYgDye+gwn7/noXj6kPJA1fGOlAJR/2SSttU5tr9DqkyuZdAu9P0K9pL9/biupyEbYa94wl2KoL/X3Mhu0G1n6R5o4CLg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1729633439; bh=7T9JWWScoQVtDJ9bYXEecpBdkt1Ura0grOiuwZqUP/4=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=NmOoYw1K9jGFR3WMCd5Gg/ayDVPPrysKZZKZlEznBGuM9b0ZWYPw47rIjyxuEa19kbJ3QaFSf7WSE2JtJEv3OOIFFhVpL7kcM0xw72I6pgiVC2r1Elxg1LaGo3zr1ImSUQl6zz2/ygRND9xIak9KeUi0MSsdb3Wo1zgNt9U6zUDp5IrgbZyPbOgHzR1Z96+Wj2KuXKIrsO5X444QO5Z7FCBtNLKRH4qYS/+0aCPHArnm5zEsUXAy6E6ibBXXcGdFSCjTwaUgi7Q7QPXXOqbxNCcaugiHihel5G8DIgSoKJTtQOI6qmCDhEf2TsedH2AtFGnBJSkNosvgpcfbchzVFQ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Y9ryDbmguD4.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 sonic313.consmr.mail.ir2.yahoo.com with HTTP; Tue, 22 Oct 2024 21:43:59 +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: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/pane= l-samsung-s6e8aa0.c#L103 [2] https://github.com/torvalds/linux/blob/v6.11/drivers/gpu/drm/panel/pane= l-samsung-s6e8aa0.c#L207-L211 [3] https://github.com/torvalds/linux/blob/v6.11/drivers/gpu/drm/panel/pane= l-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-L= 74 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/dri= vers/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; }; =20 const struct regulator_bulk_data s6e88a0_ams427ap24_supplies[] =3D { @@ -538,6 +539,10 @@ static int s6e88a0_ams427ap24_on(struct s6e88a0_ams427= ap24 *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); =20 @@ -672,6 +677,15 @@ static int s6e88a0_ams427ap24_register_backlight(struc= t s6e88a0_ams427ap24 *ctx) return ret; } =20 +static void s6e88a0_ams427ap24_parse_dt(struct s6e88a0_ams427ap24 *ctx) +{ + struct mipi_dsi_device *dsi =3D ctx->dsi; + struct device *dev =3D &dsi->dev; + struct device_node *np =3D dev->of_node; + + ctx->flip_horizontal =3D of_property_read_bool(np, "flip-horizontal"); +} + static int s6e88a0_ams427ap24_probe(struct mipi_dsi_device *dsi) { struct device *dev =3D &dsi->dev; @@ -706,6 +720,8 @@ static int s6e88a0_ams427ap24_probe(struct mipi_dsi_dev= ice *dsi) DRM_MODE_CONNECTOR_DSI); ctx->panel.prepare_prev_first =3D true; =20 + s6e88a0_ams427ap24_parse_dt(ctx); + ret =3D s6e88a0_ams427ap24_register_backlight(ctx); if (ret < 0) return ret; --=20 2.39.5