Message ID | 20220218010054.315026-7-marex@denx.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/bridge: tc358767: Add DSI-to-DPI mode support | expand |
Am Freitag, dem 18.02.2022 um 02:00 +0100 schrieb Marek Vasut: > The TC358767/TC358867/TC9595 are all capable of operating in multiple > modes, DPI-to-(e)DP, DSI-to-(e)DP, DSI-to-DPI. Only the first mode is > currently supported. In order to support the rest of the modes without > making the tc_probe() overly long, split the bridge endpoint parsing > into dedicated function, where the necessary logic to detect the bridge > mode based on which endpoints are connected, can be implemented. > > Signed-off-by: Marek Vasut <marex@denx.de> > Cc: Jonas Karlman <jonas@kwiboo.se> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> > Cc: Maxime Ripard <maxime@cerno.tech> > Cc: Neil Armstrong <narmstrong@baylibre.com> > Cc: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> > --- > V2: - Rename tc_probe_bridge_mode() to tc_probe_edp_bridge_endpoint() > to better reflect that it parses the (e)DP output endpoint > --- > drivers/gpu/drm/bridge/tc358767.c | 30 +++++++++++++++++++++--------- > 1 file changed, 21 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c > index 134c4d8621236..450a472888ba9 100644 > --- a/drivers/gpu/drm/bridge/tc358767.c > +++ b/drivers/gpu/drm/bridge/tc358767.c > @@ -1646,19 +1646,12 @@ static irqreturn_t tc_irq_handler(int irq, void *arg) > return IRQ_HANDLED; > } > > -static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) > +static int tc_probe_edp_bridge_endpoint(struct tc_data *tc) > { > - struct device *dev = &client->dev; > + struct device *dev = tc->dev; > struct drm_panel *panel; > - struct tc_data *tc; > int ret; > > - tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); > - if (!tc) > - return -ENOMEM; > - > - tc->dev = dev; > - > /* port@2 is the output port */ > ret = drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &panel, NULL); > if (ret && ret != -ENODEV) > @@ -1677,6 +1670,25 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) > tc->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; > } > > + return ret; > +} > + > +static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) > +{ > + struct device *dev = &client->dev; > + struct tc_data *tc; > + int ret; > + > + tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); > + if (!tc) > + return -ENOMEM; > + > + tc->dev = dev; > + > + ret = tc_probe_edp_bridge_endpoint(tc); > + if (ret) > + return ret; > + > /* Shut down GPIO is optional */ > tc->sd_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); > if (IS_ERR(tc->sd_gpio))
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 134c4d8621236..450a472888ba9 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1646,19 +1646,12 @@ static irqreturn_t tc_irq_handler(int irq, void *arg) return IRQ_HANDLED; } -static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) +static int tc_probe_edp_bridge_endpoint(struct tc_data *tc) { - struct device *dev = &client->dev; + struct device *dev = tc->dev; struct drm_panel *panel; - struct tc_data *tc; int ret; - tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); - if (!tc) - return -ENOMEM; - - tc->dev = dev; - /* port@2 is the output port */ ret = drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &panel, NULL); if (ret && ret != -ENODEV) @@ -1677,6 +1670,25 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) tc->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; } + return ret; +} + +static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct device *dev = &client->dev; + struct tc_data *tc; + int ret; + + tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); + if (!tc) + return -ENOMEM; + + tc->dev = dev; + + ret = tc_probe_edp_bridge_endpoint(tc); + if (ret) + return ret; + /* Shut down GPIO is optional */ tc->sd_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); if (IS_ERR(tc->sd_gpio))
The TC358767/TC358867/TC9595 are all capable of operating in multiple modes, DPI-to-(e)DP, DSI-to-(e)DP, DSI-to-DPI. Only the first mode is currently supported. In order to support the rest of the modes without making the tc_probe() overly long, split the bridge endpoint parsing into dedicated function, where the necessary logic to detect the bridge mode based on which endpoints are connected, can be implemented. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Jonas Karlman <jonas@kwiboo.se> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Cc: Maxime Ripard <maxime@cerno.tech> Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Sam Ravnborg <sam@ravnborg.org> --- V2: - Rename tc_probe_bridge_mode() to tc_probe_edp_bridge_endpoint() to better reflect that it parses the (e)DP output endpoint --- drivers/gpu/drm/bridge/tc358767.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)