Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3374051pxb; Mon, 4 Oct 2021 00:29:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6UstuD1LGxEM5u/fTRLe/+XEOGiddCxTIlGsyJ7kH2IB0uizI/ixgUHKa0j4iuJwUYTQ5 X-Received: by 2002:a05:6402:1a3a:: with SMTP id be26mr16353321edb.356.1633332593206; Mon, 04 Oct 2021 00:29:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633332593; cv=none; d=google.com; s=arc-20160816; b=cI1ZB4fkyGnunV1dgAkIDWFXrTLQwWmlf5Vw8gu3llq/olcXIMoGOyp/76oDm+iQsz /zMY4uqBfjlc0XdxmQjnuGxij+/yEaoYga78RsS94H+0QV9KGzDIDK0Y8r99PGgSFu2A crOKjxetufUvklPcwBtBtYRZjppWJQLS3ifO2vJwzAwtnVV+E1tRRTvl5OPdvG9bjuPe mVVOvNugKJq8QHQArKaayH0yW0oE+v2MoNibbGE1jRwDwEHX8BX2c6KII0+kBZbSnJjv BoDwB/V9Sb3lKqMZT2LiWcEwGbJPgQUemAvAzSVjyYNPVEaUKmuO4RcDCfMYqJ7fGlD7 y8uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=6C6zaB1jNdp6UOhCnI7B0HxRcxrCPnCqbX2padfNQ8U=; b=CGauQpuW/fFW2VzfzjS4NV0Sr2tgte1ZABYmL5qasPTYR7qOAdF8z/PR3UeYlPXOLS gh/MPvNQvJQYeA28CclgaVjGUyokUZM8NFgf1tXPusL+xnGK4D1sODwj99CWuQP55GRk ahYCjVK02xI6D4Lg83KjJcLULz7OG/h8hkClr6A15pRPuN4HNby6Qu5LxMSX4nrHuNO2 ItM/ohh0y5Wgil4SmJ3QCX3UzpXTzweL7GnZQuuGzIJGY4k7+b1Q5QcHO+g/Kj8R9Z7D bid8PbghROgQ1np1AexgJDCjkcflMQecW1O4dbI9/HXrbE+8l8Hm7MvHKmyJpmdIdcd7 4Tog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m23si8207066eje.259.2021.10.04.00.29.29; Mon, 04 Oct 2021 00:29:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230064AbhJDH34 (ORCPT + 99 others); Mon, 4 Oct 2021 03:29:56 -0400 Received: from honk.sigxcpu.org ([24.134.29.49]:34230 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229795AbhJDH3z (ORCPT ); Mon, 4 Oct 2021 03:29:55 -0400 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 5B2C5FB05; Mon, 4 Oct 2021 09:28:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yqJHGheaqiOJ; Mon, 4 Oct 2021 09:28:04 +0200 (CEST) From: =?UTF-8?q?Guido=20G=C3=BCnther?= To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Marek Vasut , Stefan Agner , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Thierry Reding , Sam Ravnborg , Ondrej Jirman , Lucas Stach , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/5] drm/bridge: nwl-dsi: Add atomic_get_input_bus_fmts Date: Mon, 4 Oct 2021 09:27:34 +0200 Message-Id: <07ab741922fb158d2ff53cdf26c9c55528d051ce.1633332399.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Components further up in the chain might ask us for supported formats. Without this MEDIA_BUS_FMT_FIXED is assumed which then breaks display output with mxsfb since it can't determine a proper bus format. We handle the bus formats that correspond to the DSI formats the bridge can potentially output (see chapter 13.6 of the i.MX 8MQ reference manual) - which matches what xsfb can input. Fixes: b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present") Signed-off-by: Guido Günther --- drivers/gpu/drm/bridge/nwl-dsi.c | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c index a251cc1f088f..27c80d36846b 100644 --- a/drivers/gpu/drm/bridge/nwl-dsi.c +++ b/drivers/gpu/drm/bridge/nwl-dsi.c @@ -1234,6 +1234,40 @@ static void nwl_dsi_bridge_detach(struct drm_bridge *bridge) drm_of_panel_bridge_remove(dsi->dev->of_node, 1, 0); } +static u32 *nwl_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + u32 *input_fmts, input_fmt; + + *num_input_fmts = 0; + + switch (output_fmt) { + /* If MEDIA_BUS_FMT_FIXED is tested, return default bus format */ + case MEDIA_BUS_FMT_FIXED: + input_fmt = MEDIA_BUS_FMT_RGB888_1X24; + break; + case MEDIA_BUS_FMT_RGB888_1X24: + case MEDIA_BUS_FMT_RGB666_1X18: + case MEDIA_BUS_FMT_RGB565_1X16: + input_fmt = output_fmt; + break; + default: + return NULL; + } + + input_fmts = kcalloc(1, sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + input_fmts[0] = input_fmt; + *num_input_fmts = 1; + + return input_fmts; +} + static const struct drm_bridge_funcs nwl_dsi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, @@ -1241,6 +1275,7 @@ static const struct drm_bridge_funcs nwl_dsi_bridge_funcs = { .atomic_check = nwl_dsi_bridge_atomic_check, .atomic_enable = nwl_dsi_bridge_atomic_enable, .atomic_disable = nwl_dsi_bridge_atomic_disable, + .atomic_get_input_bus_fmts = nwl_bridge_atomic_get_input_bus_fmts, .mode_set = nwl_dsi_bridge_mode_set, .mode_valid = nwl_dsi_bridge_mode_valid, .attach = nwl_dsi_bridge_attach, -- 2.33.0