Received: by 10.213.65.68 with SMTP id h4csp1667119imn; Mon, 26 Mar 2018 12:05:02 -0700 (PDT) X-Google-Smtp-Source: AG47ELsmfZzmXgmuwv4kuSkKoDiMw1bOS/wWc695z4BrzjBU37VtCMXwP5XB3ww0eLDmV2hoUFG6 X-Received: by 2002:a17:902:b691:: with SMTP id c17-v6mr41952085pls.308.1522091102238; Mon, 26 Mar 2018 12:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522091102; cv=none; d=google.com; s=arc-20160816; b=Cpa4GIFzrGEY+j10dN5LXyG+oERB+aPI9AZv4ynqn3aLJMg3GtnzbjckVx/W5RIJhX TGZryR0lFIn0tjoCkvX2aK1dyyDY94+w2/kUgXcMMRt4RkS6WP6lvc2dfTzX9BgVZBgb CgTJe5F5ngX9kjeHNPZMXoZByodm4Htg7pCJjy0zi3letnD8Tn0/mz+WjrMdRSbwxBBh HwYKiKuNQK12nCVrRhm9+6dvMnpcY9Ea6+ZeJuowNNOH5k+oSL4Ze75BTDmQF/a0bNb7 AbcULKFtxiHVgrpAN3EvpoG6guwJ3jjiT1KcaMpDttR0fkY5dKo68Gn2/5eu8nqEwkmn P8BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=PcnTCofbyp79jQn+hZ89A1QtNC6+fHCjzbjv39QDvXs=; b=EkejKHNFW9JmkWtk9tecD6elLqCPlBh66BGkm7Vhp3fZ2bGnWefXhJmq9tMJKQn+17 lBkCWnUjxfXkQNsUiE7ogzzX7XqRqs5sPrtaxFJ75k2rih6I1z9wz1PELfCvm08xEyJN Ds8UbQ1ChiPNcZ1O5j6o+UaarwtSW7xO/W4yuro1KN4AxPlh5ARg8yfT4eRnm54GInar dBO2d0w85Q0HUMItnq61iOmg0B9rAQ7Bo+WCPq3axO399qcShpnMpC+cmUFRSpb0apoJ xz5Lfl64TYoGEx3fTdkgoZQ4MSYJkKOOjsTdj4gnjxfoMN22SdNVbShy5+EBruaWya60 4J8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=wAQJ5PfK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si11933443pfk.125.2018.03.26.12.04.47; Mon, 26 Mar 2018 12:05:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=wAQJ5PfK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752154AbeCZTDg (ORCPT + 99 others); Mon, 26 Mar 2018 15:03:36 -0400 Received: from galahad.ideasonboard.com ([185.26.127.97]:44866 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750983AbeCZTDe (ORCPT ); Mon, 26 Mar 2018 15:03:34 -0400 Received: from avalon.localnet (unknown [210.3.99.147]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id A635420381; Mon, 26 Mar 2018 21:01:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1522090868; bh=q+aelPkcP0UqCscVqAyOAfHEKzUnnW5I1NE7wQGheD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wAQJ5PfKtGMbJZ+zrvj7eqf8mfXLxH6UXBzWgYORXIobPlSf8zVrQoHBAgu2B1SpG PfRodnQyYTZ+m9DZdER2/7kdPPSFShY5kL/oJ4gGLpR11rUc2Q+c9HD62ZDnxz80ze BSWRayU9tE6uuwx0sCGsMVHttG6i9wbr1nz24DQw= From: Laurent Pinchart To: Peter Rosin Cc: linux-kernel@vger.kernel.org, David Airlie , Rob Herring , Mark Rutland , Archit Taneja , Andrzej Hajda , Daniel Vetter , Gustavo Padovan , Sean Paul , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Jacopo Mondi Subject: Re: [RFC PATCH 2/3] drm: bridge: panel: allow override of the bus format Date: Mon, 26 Mar 2018 22:03:31 +0300 Message-ID: <1986009.iWteaM7My3@avalon> Organization: Ideas on Board Oy In-Reply-To: References: <20180317221525.18534-1-peda@axentia.se> <7015227.p44CVkfgjM@avalon> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, (CC'ing Jacopo Mondi) On Sunday, 25 March 2018 15:01:11 EEST Peter Rosin wrote: > On 2018-03-20 14:56, Laurent Pinchart wrote: > > Hi Peter, > > > > Thank you for the patch. > > > > On Sunday, 18 March 2018 00:15:24 EET Peter Rosin wrote: > >> Useful if the bridge does some kind of conversion of the bus format. > >> > >> Signed-off-by: Peter Rosin > >> --- > >> > >> drivers/gpu/drm/bridge/panel.c | 22 +++++++++++++++++++++- > >> include/drm/drm_bridge.h | 1 + > >> 2 files changed, 22 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/gpu/drm/bridge/panel.c > >> b/drivers/gpu/drm/bridge/panel.c index 6d99d4a3beb3..ccef0283ff41 100644 > >> --- a/drivers/gpu/drm/bridge/panel.c > >> +++ b/drivers/gpu/drm/bridge/panel.c > >> @@ -22,6 +22,7 @@ struct panel_bridge { > >> struct drm_connector connector; > >> struct drm_panel *panel; > >> u32 connector_type; > >> + u32 bus_format; > >> }; > >> > >> static inline struct panel_bridge * > >> @@ -40,8 +41,15 @@ static int panel_bridge_connector_get_modes(struct > >> drm_connector *connector) { > >> struct panel_bridge *panel_bridge = > >> drm_connector_to_panel_bridge(connector); > >> > >> + int ret; > >> + > >> + ret = drm_panel_get_modes(panel_bridge->panel); > >> + > >> + if (panel_bridge->bus_format) > >> + drm_display_info_set_bus_formats(&connector->display_info, > >> + &panel_bridge->bus_format, 1); > > > > While I agree with the problem statement and, to some extent, the DT > > bindings, I don't think this is the right implementation. You've > > correctly noted that display controller shouldn't blindly use the formats > > reported by the panel through the connector formats, and that hacking the > > panel driver to override the formats isn't a good idea, so I wouldn't > > override the formats reported by the connector. I would instead extend > > the drm_bridge API to report formats at bridge inputs. This would be more > > generic and allow each bridge to configure itself according to the next > > bridge in the chain. > > > > I'm not sure whether this API extension should be in the form of a new > > bridge function, or if the formats should be stored in the drm_bridge > > structure directly as done for connectors in the display info structure. > > I'm tempted by the former, but I'm open to discussions. > > Ok, I can look into that, but let me check if I got this right. From the > very little of the code that I have looked at, I have gathered that display > controllers handle bridges explicitly, right? That's correct, yes. Or, rather, they handle the first bridge in the chain, and then other bridges are handled recursively. > If so, by extending the bridge (with either a new function or new data) you > impose changes to all display controllers wanting to handle this new bridge > input-format. If so, I assume I can leave out the changes to all display > controllers that I do not care about. Correct? That's correct. > Also, don't hold your breath waiting for a v2, but I'll try to get to it :-) I won't hold my breath, but Jacopo might :-) He has a similar issue to solve (reporting the LVDS modes supported by the bridge). > >> - return drm_panel_get_modes(panel_bridge->panel); > >> + return ret; > >> } > >> > >> static const struct drm_connector_helper_funcs > >> @@ -203,6 +211,18 @@ void drm_panel_bridge_remove(struct drm_bridge > >> *bridge) > >> } > >> EXPORT_SYMBOL(drm_panel_bridge_remove); > >> > >> +void drm_panel_bridge_set_bus_format(struct drm_bridge *bridge, u32 > >> bus_format) > >> +{ > >> + struct panel_bridge *panel_bridge; > >> + > >> + if (!bridge) > >> + return; > >> + > >> + panel_bridge = drm_bridge_to_panel_bridge(bridge); > >> + panel_bridge->bus_format = bus_format; > >> +} > >> +EXPORT_SYMBOL(drm_panel_bridge_set_bus_format); > >> + > >> static void devm_drm_panel_bridge_release(struct device *dev, void *res) > >> { > >> struct drm_bridge **bridge = res; > >> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h > >> index 682d01ba920c..81903b92f187 100644 > >> --- a/include/drm/drm_bridge.h > >> +++ b/include/drm/drm_bridge.h > >> @@ -268,6 +268,7 @@ void drm_bridge_enable(struct drm_bridge *bridge); > >> struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel, > >> u32 connector_type); > >> void drm_panel_bridge_remove(struct drm_bridge *bridge); > >> +void drm_panel_bridge_set_bus_format(struct drm_bridge *bridge, u32 > >> bus_format); > >> struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev, > >> struct drm_panel *panel, > >> u32 connector_type); -- Regards, Laurent Pinchart