From patchwork Wed Apr 6 09:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 12802980 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 CE24FC433F5 for ; Wed, 6 Apr 2022 09:29:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1BEB410E175; Wed, 6 Apr 2022 09:29:50 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by gabe.freedesktop.org (Postfix) with ESMTPS id EC41410E175 for ; Wed, 6 Apr 2022 09:29:48 +0000 (UTC) Received: from tr.lan (ip-89-176-112-137.net.upcbroadband.cz [89.176.112.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id D7ECF83C08; Wed, 6 Apr 2022 11:29:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1649237387; bh=tJ2q/2AQXa+4QBAdgJ8e/FGBxSU2RNOflzxUe4ox/hw=; h=From:To:Cc:Subject:Date:From; b=AK8cb71pz7fOAI0WmNehRRqX37Z5mt6sp0cSVRyYmmYdIf5j4p+PiQEj4JHHdOhWW viOEzZ5hS4xdbANnjmqYG7UPIflf7sAf/KZB8BoSsbfSjnMhJ0L3V/ewydvpNvwAY+ 1yW7KKXKTGvwXbo6ZcNv+kStHmJ3V+UZWiVyDuyAZBhi6pUMVpIqrJd6s9WYAPWGlU dSuAvdUWJpg0e9vXJH1RQXugS8UXaOQezc1DxJzvjSizBVI5SBf52Hs23BhaS4XoD9 8GuvIHq8Xi7G1LqkF89FsOCNMRMpbutY4Gs75RhjogzvDOPEEAeS9qVyU1SnWbYZrc oDgMPI6eyW3og== From: Marek Vasut To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: mxsfb: Obtain bus flags from bridge state Date: Wed, 6 Apr 2022 11:29:29 +0200 Message-Id: <20220406092929.17498-1-marex@denx.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean 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: , Cc: Marek Vasut , Peng Fan , Alexander Stein , robert.foss@linaro.org, Laurent Pinchart , Robby Cai , Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In case the MXSFB is connected to a bridge, attempt to obtain bus flags from that bridge state too. The bus flags may specify e.g. the DE signal polarity. Signed-off-by: Marek Vasut Cc: Alexander Stein Cc: Laurent Pinchart Cc: Lucas Stach Cc: Peng Fan Cc: Robby Cai Cc: Sam Ravnborg Cc: Stefan Agner Acked-by: Alexander Stein --- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c index 4baa3db1f3d10..c7f14ef1edc25 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c @@ -298,6 +298,7 @@ static int mxsfb_reset_block(struct mxsfb_drm_private *mxsfb) } static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, + struct drm_bridge_state *bridge_state, const u32 bus_format) { struct drm_device *drm = mxsfb->crtc.dev; @@ -307,6 +308,8 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, if (mxsfb->bridge && mxsfb->bridge->timings) bus_flags = mxsfb->bridge->timings->input_bus_flags; + else if (bridge_state) + bus_flags = bridge_state->input_bus_cfg.flags; DRM_DEV_DEBUG_DRIVER(drm->dev, "Pixel clock: %dkHz (actual: %dkHz)\n", m->crtc_clock, @@ -365,7 +368,7 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, { struct mxsfb_drm_private *mxsfb = to_mxsfb_drm_private(crtc->dev); struct drm_display_mode *m = &mxsfb->crtc.state->adjusted_mode; - struct drm_bridge_state *bridge_state; + struct drm_bridge_state *bridge_state = NULL; struct drm_device *drm = mxsfb->drm; u32 bus_format = 0; @@ -399,7 +402,7 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, pm_runtime_get_sync(drm->dev); - mxsfb_crtc_mode_set_nofb(mxsfb, bus_format); + mxsfb_crtc_mode_set_nofb(mxsfb, bridge_state, bus_format); /* Write cur_buf as well to avoid an initial corrupt frame */ mxsfb_update_buffer(mxsfb, crtc->primary, true);