Hi Marek, On Fri, Mar 4, 2022 at 5:55 AM Marek Vasut <marex@xxxxxxx> wrote: > > The driver currently hard-codes DSI lane count to two, however the chip > is capable of operating in 1..4 DSI lanes mode. Parse 'data-lanes' DT > property and program the result into DSI_CTRL register. > > Signed-off-by: Marek Vasut <marex@xxxxxxx> > Cc: Jagan Teki <jagan@xxxxxxxxxxxxxxxxxxxx> > Cc: Maxime Ripard <maxime@xxxxxxxxxx> > Cc: Robert Foss <robert.foss@xxxxxxxxxx> > Cc: Sam Ravnborg <sam@xxxxxxxxxxxx> > Cc: Thomas Zimmermann <tzimmermann@xxxxxxx> > To: dri-devel@xxxxxxxxxxxxxxxxxxxxx > --- > V2: Rebase on next-20220214 > V3: Default to 4 data lanes unless specified otherwise > --- > drivers/gpu/drm/bridge/chipone-icn6211.c | 45 +++++++++++++++++++++--- > 1 file changed, 41 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c > index 2ac8eb7e25f52..df8e75a068ad0 100644 > --- a/drivers/gpu/drm/bridge/chipone-icn6211.c > +++ b/drivers/gpu/drm/bridge/chipone-icn6211.c > @@ -136,10 +136,12 @@ struct chipone { > struct drm_bridge bridge; > struct drm_display_mode mode; > struct drm_bridge *panel_bridge; > + struct device_node *host_node; > struct gpio_desc *enable_gpio; > struct regulator *vdd1; > struct regulator *vdd2; > struct regulator *vdd3; > + int dsi_lanes; > }; > > static inline struct chipone *bridge_to_chipone(struct drm_bridge *bridge) > @@ -212,6 +214,11 @@ static void chipone_atomic_enable(struct drm_bridge *bridge, > /* dsi specific sequence */ > ICN6211_DSI(icn, SYNC_EVENT_DLY, 0x80); > ICN6211_DSI(icn, HFP_MIN, hfp & 0xff); > + > + /* DSI data lane count */ > + ICN6211_DSI(icn, DSI_CTRL, > + DSI_CTRL_UNKNOWN | DSI_CTRL_DSI_LANES(icn->dsi_lanes - 1)); > + > ICN6211_DSI(icn, MIPI_PD_CK_LANE, 0xa0); > ICN6211_DSI(icn, PLL_CTRL(12), 0xff); > > @@ -314,7 +321,9 @@ static const struct drm_bridge_funcs chipone_bridge_funcs = { > static int chipone_parse_dt(struct chipone *icn) > { > struct device *dev = icn->dev; > + struct device_node *endpoint; > struct drm_panel *panel; > + int dsi_lanes; > int ret; > > icn->vdd1 = devm_regulator_get_optional(dev, "vdd1"); > @@ -350,15 +359,42 @@ static int chipone_parse_dt(struct chipone *icn) > return PTR_ERR(icn->enable_gpio); > } > > + endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, 0); > + dsi_lanes = of_property_count_u32_elems(endpoint, "data-lanes"); > + icn->host_node = of_graph_get_remote_port_parent(endpoint); > + of_node_put(endpoint); > + > + if (!icn->host_node) > + return -ENODEV; The non-ports-based OF graph returns a -19 example on the Allwinner Display pipeline in R16 [1]. We need to have a helper to return host_node for non-ports as I have done it for drm_of_find_bridge. [1] https://patchwork.amarulasolutions.com/patch/1805/ Thanks, Jagan.