From patchwork Mon Apr 10 08:47:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Cheo Fusi X-Patchwork-Id: 2852 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id F21FE3F25A for ; Mon, 10 Apr 2023 10:50:11 +0200 (CEST) Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-946832a17f9sf206140066b.2 for ; Mon, 10 Apr 2023 01:50:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681116611; cv=pass; d=google.com; s=arc-20160816; b=kss7orx+cz3hb7z0fU8mE8itHNDzjyqCwJwFqG+cQ83r8j1WMkGx+fky1OxR9TTjRj oQDMIT4B4VcS5mxi6N6X2PA7QIs3cLRoTf1FEIn+ql7Un5dgZAaY7xjtL17cvWMULSqZ UOFgw5hmQJioClGqJE0VWZc+vKFMdo1lg55Q9OYoRFmZ7dvTIWvJ/eWqWyTQVDrtn1Hm qBk6HNSoYviP8oU0OQ4mzEHxIYAU0Fs7SFPvz/5SFs1sd8veoGO+UWz2+YjbuH6J/MwR ec/pxXNl0WNDPg+wt0JFDaAj0ZVDpu5urs4fHi+Rym1dl2TwQ2kOouJjccT0v1I/k/lX hkcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=OUl5Eft7bSmi5+Ec9VRLE3axJG21ZHkfDxUJ5g5/pGE=; b=EWlKysKsyXKpXuWz6GFIy7VZB2siAxY3A1t6ralUvSIy8XpT9UHyJ9vlwJGOEHdsZN 6U97TufcqH8ZScHssHY4JE+lVC5Ru3WCmNGh9PlgETGvrylRiQa6W3d7m14plQZMah97 0kOvns1nf8TdngB5Pc6zdR2HsGZbN1/DfVI0s6V1aFKU+b1sIL5Ea2UY6h8QIwcQdr7G 1Ro3UT7lDq9ewy0oG079mHL82xkR4XYsP36dwe+0gNe5qxuPJFBpfBFzrr1G3YJLy5DQ wi0gdKVUPWHJw7PlfU2nKEPimesx+zWm1C+UutqShZnw3bY1qLR+Bxk7mbld1EmwnzA/ pf6Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LGokBRfw; spf=pass (google.com: domain of fusibrandon13@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=fusibrandon13@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1681116611; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=OUl5Eft7bSmi5+Ec9VRLE3axJG21ZHkfDxUJ5g5/pGE=; b=JPkEzIV/jt3IaoFTb1cQcM8dvEFKNAcmvfrVRUC3q5e2Gf//5FxjAk4PeyjgVOesso TKLmmVr4UbdU4fZKiowBFsAJbsLH4dJLpp5hCtZuEda1zAGYieMUkV73GnPsdZGw9IDW zNjDRQNeKLdGh5LbOpK1dljICFZ0VN7O462Y4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681116611; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=OUl5Eft7bSmi5+Ec9VRLE3axJG21ZHkfDxUJ5g5/pGE=; b=0xh89d8W10RgHrQ4vFgEKKI8TRPFuq0/lKWmKsZhjungW6i+dSa3LKQQCxEJfOSp1R bjbarSUNByl0NJ0GyJtz8/giYAEq+ribHhq2q1WS+snDWcOALsZMZp9ayLVIiCkm7pfi HaELJjU9DRlFODhls96ivlH4PNxU5DDsvx/4/F5Nd8xeFWfrnHVFZXP4I5wphhXV33Pp NwBTAExNT/YGu0swRlY9Bwe+LLI+xqDN21s8eQSY617453s9CjyeTXuGgTZ8VNST+YkM 5d1DpWaKW/dI+3rm/vJPId8CSMiYKy3AA65JwNP6MeX/vXv17cqsXpY8/H2GUepViY79 +qvg== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AAQBX9eDs9vLR3v5Wd2MbToQKxDIivrzgJK9GvXsrkbxRM24l5PGPKgS eTq9z1KPf1IteFYtuKX6MWPI8aM3 X-Google-Smtp-Source: AKy350a94YuHA/uTJ6hCp4Zo6T22tdZDqozwY655b/4VQIJQIF+XbvTeU0N/M4wln5HNdlEw6L4AWg== X-Received: by 2002:a50:d71e:0:b0:504:9c1f:1c65 with SMTP id t30-20020a50d71e000000b005049c1f1c65mr1598275edi.6.1681116611800; Mon, 10 Apr 2023 01:50:11 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:b1d4:b0:931:f9f8:d13e with SMTP id bv20-20020a170906b1d400b00931f9f8d13els17963959ejb.8.-pod-prod-gmail; Mon, 10 Apr 2023 01:50:10 -0700 (PDT) X-Received: by 2002:a17:906:68d3:b0:94a:8ada:d109 with SMTP id y19-20020a17090668d300b0094a8adad109mr2153789ejr.77.1681116610223; Mon, 10 Apr 2023 01:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681116610; cv=none; d=google.com; s=arc-20160816; b=JbJFmtoQU2rzgVv2L/BJFP/oPfMuN4nY4yAK2Z5jppQuoPQyQisR+Ny5m3yhzFONO9 1tdyNLANlMbvAp3Zg20sQLNSICdivk+oG27CubVzefFF8urA0RzQH2jI303LH5Cnjb1B Q0WcHykeGZ0mg9RQL+iQaVR177QziGiOoIWl/q09ZG4pVLSxzaWziX6hyuMYkt08Ms3y xUrl0AEDJVbrybrMjKBdB6wXOTbscKBsn6XWmYrGMUCD84QmkNHuwOkXcXR7jbOjCXq4 qT1PgTqvHRUE2xZjty6w3VGFBYKonWOPKKwUZub1Y8SCLWR7y614qysbizGTJe/HQR2a LwiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=w1PPutowbE1ddcNuSAkCSkroxKYobdEeWd9KbxPUEEU=; b=MJSW3hKEfeccp8n73i+OwFWXVsGR0u/brRciA7U50H0DscXpRDqZqRzvIkJSoJnohy /Azf+sw9uCi8vGLInaDhVdRxAGDdTZrju+xLSUI6TDB1CGf6xLHP/p/E3q5k5+51hnOQ qbav8eQmIPSlgwJjIOhxuJJMb0E0ONpB4I9flgdYIuJ09j+g4KryYbfSl6Ycs4S8stN7 mGB34NlJN2E11NNVv/DlpyQytZFhIPYEbbQ8YNIJ/AerdIxz+GaDmwHKj3vUAa/idu/Y tVMWjCD/A6SFv6C+FKpoOr+dp8AyisHxl/h8bqmN4rjMlwPdkrCq1mO+psqrFtmeQ8j/ B7cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LGokBRfw; spf=pass (google.com: domain of fusibrandon13@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=fusibrandon13@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id c15-20020a50f60f000000b005047dd10142sor2903126edn.4.2023.04.10.01.50.10 (Google Transport Security); Mon, 10 Apr 2023 01:50:10 -0700 (PDT) Received-SPF: pass (google.com: domain of fusibrandon13@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:aa7:d697:0:b0:504:852a:6856 with SMTP id d23-20020aa7d697000000b00504852a6856mr7280281edr.16.1681116609374; Mon, 10 Apr 2023 01:50:09 -0700 (PDT) Received: from localhost.localdomain ([154.72.161.184]) by smtp.gmail.com with ESMTPSA id v13-20020a50954d000000b004fc649481basm4709962eda.58.2023.04.10.01.49.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 01:50:08 -0700 (PDT) From: Brandon Cheo Fusi To: maxime@cerno.tech Cc: airlied@gmail.com, andrzej.hajda@intel.com, daniel@ffwll.ch, dave.stevenson@raspberrypi.com, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, jagan@amarulasolutions.com, jernej.skrabec@gmail.com, krzysztof.kozlowski+dt@linaro.org, linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, maarten.lankhorst@linux.intel.com, marex@denx.de, neil.armstrong@linaro.org, rfoss@kernel.org, robh+dt@kernel.org, sam@ravnborg.org, samuel@sholland.org, tzimmermann@suse.de, wens@csie.org, Brandon Cheo Fusi Subject: [PATCH 1/2] drm: sun4i/dsi: factor out DSI PHY poweron and poweroff Date: Mon, 10 Apr 2023 09:47:49 +0100 Message-Id: <20230410084750.164016-2-fusibrandon13@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230410084750.164016-1-fusibrandon13@gmail.com> References: <20230410084750.164016-1-fusibrandon13@gmail.com> MIME-Version: 1.0 X-Original-Sender: fusibrandon13@gmail.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LGokBRfw; spf=pass (google.com: domain of fusibrandon13@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=fusibrandon13@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Factor out PHY poweron and poweroff sequences from sun6i_dsi_encoder_enable and sun6i_dsi_encoder_disable.This leaves nothing to be be done in sun6i_dsi_encoder_disable, so get rid of that. Also remove drm_panel_ as these would be invoked the modeset helpers. Signed-off-by: Brandon Cheo Fusi --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 64 ++++++++++++-------------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 4 ++ 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 760ff05ea..4dc92109e 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -713,7 +713,7 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi, return 0; } -static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) +void sun6i_dsi_phy_power_on(const struct drm_encoder *encoder) { struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); @@ -768,43 +768,12 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) phy_set_mode(dsi->dphy, PHY_MODE_MIPI_DPHY); phy_configure(dsi->dphy, &opts); phy_power_on(dsi->dphy); - - if (dsi->panel) - drm_panel_prepare(dsi->panel); - - /* - * FIXME: This should be moved after the switch to HS mode. - * - * Unfortunately, once in HS mode, it seems like we're not - * able to send DCS commands anymore, which would prevent any - * panel to send any DCS command as part as their enable - * method, which is quite common. - * - * I haven't seen any artifact due to that sub-optimal - * ordering on the panels I've tested it with, so I guess this - * will do for now, until that IP is better understood. - */ - if (dsi->panel) - drm_panel_enable(dsi->panel); - - sun6i_dsi_start(dsi, DSI_START_HSC); - - udelay(1000); - - sun6i_dsi_start(dsi, DSI_START_HSD); } -static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder) +void sun6i_dsi_phy_power_off(const struct drm_encoder *encoder) { struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); - DRM_DEBUG_DRIVER("Disabling DSI output\n"); - - if (dsi->panel) { - drm_panel_disable(dsi->panel); - drm_panel_unprepare(dsi->panel); - } - phy_power_off(dsi->dphy); phy_exit(dsi->dphy); @@ -813,6 +782,34 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder) regulator_disable(dsi->regulator); } +static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder, struct drm_atomic_state *old_state) +{ + struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); + + DRM_DEBUG_DRIVER("Enabling DSI output\n"); + + sun6i_dsi_start(dsi, DSI_START_HSC); + + udelay(1000); + + sun6i_dsi_start(dsi, DSI_START_HSD); + + /* + * NOTE + * + * Unfortunately, once in HS mode, it seems like we're not + * able to send DCS commands anymore, which would prevent any + * panel to send any DCS command as part as their enable + * method, which is quite common. + * + * So maybe panels/bridges should send any init DCS commands in their + * prepare/pre_enable methods? This should work as the DSI PHY is active + * before those hooks are called. + * + * This will do for now, until that IP is better understood. + */ +} + static int sun6i_dsi_get_modes(struct drm_connector *connector) { struct sun6i_dsi *dsi = connector_to_sun6i_dsi(connector); @@ -843,7 +840,6 @@ static const struct drm_connector_funcs sun6i_dsi_connector_funcs = { }; static const struct drm_encoder_helper_funcs sun6i_dsi_enc_helper_funcs = { - .disable = sun6i_dsi_encoder_disable, .enable = sun6i_dsi_encoder_enable, }; diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index f1ddefe0f..a0b541f48 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -40,6 +40,10 @@ struct sun6i_dsi { const struct sun6i_dsi_variant *variant; }; +void sun6i_dsi_phy_power_on(const struct drm_encoder *encoder); + +void sun6i_dsi_phy_power_off(const struct drm_encoder *encoder); + static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host) { return container_of(host, struct sun6i_dsi, host); From patchwork Mon Apr 10 08:47:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Cheo Fusi X-Patchwork-Id: 2853 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8F3DF3F25A for ; Mon, 10 Apr 2023 10:52:11 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-50489d24dc3sf718332a12.2 for ; Mon, 10 Apr 2023 01:52:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681116731; cv=pass; d=google.com; s=arc-20160816; b=DtpjPVw2fki3kt3BoSVifPFJTMk181x/UrS9+BflJ9DQNnP88tiqEsTGGWkbuhcX8J kb3wzKtGBbxpMSVW13iqwpLKfFsvyEA4F9lV2a9Y7WfQfbkP2iz6tsDzKrsp3L/u7mNH C2Wdk+7E8s03P8fE4cv0hJn4WfjD9gbwC1MjCtzVYMQsL4zo80i62mWLbsT/rdFpeLc5 T0BJTZRPBL9e7eIhicaVuFfgMJyQm+lqu09CCkAj+wp3F1zaSSRBIDfseV7LhHLyJMHt zc0gQt3LiewbSnLd6Bu/O7FeJ9KF/WxFDecSxq6a6bIrXX4bW8l1CGzpE9xjSDSgCLTl THag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=y9flLzPVdeEFO/aKuPN6hmBZhmjaxWfChBawsK84qMg=; b=kagc/M6nvwMgIOc7kDy1B94Om1h3LFpJg9qvSx2bG5MwsACytWFCIIsewE5RGarrXy omymtcnmtvTwYb4ZKOvXCP9hWABFDpgvMAyMTHeRNRR4kMDgRkO/n7oPmgAS1YP8WiR3 dzpSYm8nNw129/Z/bKyWzSVFEU/wAKddIc1Mr6m0MeDioDJSUaS1848QDCov1FSIuah+ DHeXb1gZjHkg3gOICyM0sW2mVtNihB+L7Ia7Ptaw4IYMnAaexaatQ1Q7LDW9/4DKy6h0 x9O/arkRqXeQuvVFd3votEE+h+Dhnj+9m0Rgsrx/fxH6K0hzHx1kY+qvfmZTFklvOAM3 FCLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Y/dl73EC"; spf=pass (google.com: domain of fusibrandon13@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=fusibrandon13@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1681116731; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=y9flLzPVdeEFO/aKuPN6hmBZhmjaxWfChBawsK84qMg=; b=VvcGUAEw6zZrF5ty+akHr/rrzrYthcRPYMUh64H82080ciiWCci67Xw0Frps9dxRfx 8nXdw4+9a3Imp61E+P2+veIlu4C1GP/srM/kGs3ido4PmvcICfDhBayf02Jcruofke73 p55zzAx6tJfMi+tPBlX3f57vlLc6QkU8dKBEA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681116731; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=y9flLzPVdeEFO/aKuPN6hmBZhmjaxWfChBawsK84qMg=; b=3Qnz1Xe1lewtqgo5+QohI8gOX+dIHF1koln0MCZFyrn8WzD8XdaFCjj6xsaxbLaw+e pcSItJfumFR6/vKrvvT+mbKeqSQBaVjbzDFAN+UOWQQjelwikdQNeBbH8xdzg+kZmEnN GM94LpJAda/wMtXshGfMivgiYQxA2AQMMX2MoN/5mhG8FW3/uwxBmrImvVEKFsrYU4/H YJS6/+2GTVM37kUH0ItDg2QqhYWUy3OY5uJfYc3MXJ9Tb7MbAUtgzNAQmTdQClkzr55M 4li81VCa6yiq8+V5j0ujORxng9S70Xz/rVvxOzZNvUbXx9GT6f6xPZfwh1HoByDbPGTw Cshw== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AAQBX9f5y7RnkQUqnxUCLmL8L7RDFUcmmq046SJrpUUx15H6E83aZBXi 9U3GurbLtRKGO8KkCJW9109aopdG X-Google-Smtp-Source: AKy350amG52i+qC0nu730VRzN5FYX4KEX4c6tOr5U4Zoldseao4TUigJ81aQqquZ2a57YS2Eo9iz/Q== X-Received: by 2002:a50:bb04:0:b0:4fb:4a9f:eb95 with SMTP id y4-20020a50bb04000000b004fb4a9feb95mr2902058ede.2.1681116731040; Mon, 10 Apr 2023 01:52:11 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:51d4:b0:504:9a87:717e with SMTP id r20-20020a05640251d400b005049a87717els157805edd.0.-pod-prod-gmail; Mon, 10 Apr 2023 01:52:09 -0700 (PDT) X-Received: by 2002:aa7:d850:0:b0:504:b5a8:dcc8 with SMTP id f16-20020aa7d850000000b00504b5a8dcc8mr121315eds.4.1681116729235; Mon, 10 Apr 2023 01:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681116729; cv=none; d=google.com; s=arc-20160816; b=nZ7PkjIuLpa3ddKkz6A7+ctD9vc2C03XmrwvvIKjWtzZnGgQLNQycIkqao9Wb3oNgB 54KuYtwWICTSEEXtpRJ8vsOIYWqixjGsSFYmu6tN9v5pMmheY6cGFPimtBHxaHjtcG/I 1VG9RUzYYI6gVTn9HYm6YheY72XlIOeJx4Flf7XPB+8F/pbM8FFCsWs0sVmLgp17O0YV 50aSLw32+Zv+DK16BEYwNbDjneBnWi9LKPV6kd/tvsu2KWbvJIl4i9wBXlbazZsr6+kq G99QuXdvgvIWHOqgvm3IJCwgkD/9bFi42i9ZthcyzN9LLFFuNNwjFLp7LEwhi1/9ainU +PYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=qCvx4T7aanPiUqpFl/M0cMKkdvIDQFWcCiUFxZeM/NU=; b=m3rQiAmH+5rmrkOmn3uhSqMxa0Npydv+nasMvpSH8QmwkkiE4MnB386B3n3nnGD8qc u/wS+cT4wtZDcUX5KaWPmWwmfQHZLZryEDg9VE+sQxKemFuI4FalISVc2V3pbNaJ/xpo ncDNsZoVxdMWKF8ftlGidGQc4BjGPRj665izY1BtfMgFKc5ZCxPCBwdkhaYjfvaESzYE bTPgNe7ILDHbOz/TwwzRX4nmqFFUPUry3e/wKUGZoNVCDOfzSxEZg1T8Q+3cfyA2jySl 7TVSEsxiJZ9OShMLlIVMHS1nfoFtuFGW9PAwevGXkNQruziPamDDu+If0QClOv1Rm8qg p1RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Y/dl73EC"; spf=pass (google.com: domain of fusibrandon13@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=fusibrandon13@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id e13-20020a50a68d000000b004bf4e5813a9sor4268369edc.46.2023.04.10.01.52.09 (Google Transport Security); Mon, 10 Apr 2023 01:52:09 -0700 (PDT) Received-SPF: pass (google.com: domain of fusibrandon13@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6402:138e:b0:504:8c4a:d1e with SMTP id b14-20020a056402138e00b005048c4a0d1emr5611231edv.8.1681116728661; Mon, 10 Apr 2023 01:52:08 -0700 (PDT) Received: from localhost.localdomain ([154.72.161.184]) by smtp.gmail.com with ESMTPSA id v13-20020a50954d000000b004fc649481basm4709962eda.58.2023.04.10.01.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 01:52:08 -0700 (PDT) From: Brandon Cheo Fusi To: maxime@cerno.tech Cc: airlied@gmail.com, andrzej.hajda@intel.com, daniel@ffwll.ch, dave.stevenson@raspberrypi.com, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, jagan@amarulasolutions.com, jernej.skrabec@gmail.com, krzysztof.kozlowski+dt@linaro.org, linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, maarten.lankhorst@linux.intel.com, marex@denx.de, neil.armstrong@linaro.org, rfoss@kernel.org, robh+dt@kernel.org, sam@ravnborg.org, samuel@sholland.org, tzimmermann@suse.de, wens@csie.org, Brandon Cheo Fusi Subject: [PATCH 2/2] drm: sun4i: tie DSI PHY Poweron/off to crtc enable/disable Date: Mon, 10 Apr 2023 09:47:50 +0100 Message-Id: <20230410084750.164016-3-fusibrandon13@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230410084750.164016-1-fusibrandon13@gmail.com> References: <20230410084750.164016-1-fusibrandon13@gmail.com> MIME-Version: 1.0 X-Original-Sender: fusibrandon13@gmail.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Y/dl73EC"; spf=pass (google.com: domain of fusibrandon13@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=fusibrandon13@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Poweron/off the DSI PHY when the crtc is enabled/disabled. This allows the modeset helpers to manage the DSI sink while preserving the old drm_panel_ and drm_panel_ sequences. Signed-off-by: Brandon Cheo Fusi --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 523a6d787..6f50dc66a 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -190,7 +190,7 @@ void sun4i_tcon_set_status(struct sun4i_tcon *tcon, const struct drm_encoder *encoder, bool enabled) { - bool is_lvds = false; + bool is_lvds = false, is_dsi = false; int channel; switch (encoder->encoder_type) { @@ -198,6 +198,8 @@ void sun4i_tcon_set_status(struct sun4i_tcon *tcon, is_lvds = true; fallthrough; case DRM_MODE_ENCODER_DSI: + is_dsi = true; + fallthrough; case DRM_MODE_ENCODER_NONE: channel = 0; break; @@ -221,6 +223,12 @@ void sun4i_tcon_set_status(struct sun4i_tcon *tcon, sun4i_tcon_lvds_set_status(tcon, encoder, true); sun4i_tcon_channel_set_status(tcon, channel, enabled); + + if (is_dsi) { + /* turn DSI phy on or off */ + (enabled) ? sun6i_dsi_phy_power_on(encoder) + : sun6i_dsi_phy_power_off(encoder); + } } void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable)