drm/bridge: lt9611uxc: Switch to devm MIPI-DSI helpers
Let's switch to the new devm MIPI-DSI function to register and attach our secondary device. Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-10-maxime@cerno.tech
This commit is contained in:
@ -258,17 +258,18 @@ static struct mipi_dsi_device *lt9611uxc_attach_dsi(struct lt9611uxc *lt9611uxc,
|
|||||||
const struct mipi_dsi_device_info info = { "lt9611uxc", 0, NULL };
|
const struct mipi_dsi_device_info info = { "lt9611uxc", 0, NULL };
|
||||||
struct mipi_dsi_device *dsi;
|
struct mipi_dsi_device *dsi;
|
||||||
struct mipi_dsi_host *host;
|
struct mipi_dsi_host *host;
|
||||||
|
struct device *dev = lt9611uxc->dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
host = of_find_mipi_dsi_host_by_node(dsi_node);
|
host = of_find_mipi_dsi_host_by_node(dsi_node);
|
||||||
if (!host) {
|
if (!host) {
|
||||||
dev_err(lt9611uxc->dev, "failed to find dsi host\n");
|
dev_err(dev, "failed to find dsi host\n");
|
||||||
return ERR_PTR(-EPROBE_DEFER);
|
return ERR_PTR(-EPROBE_DEFER);
|
||||||
}
|
}
|
||||||
|
|
||||||
dsi = mipi_dsi_device_register_full(host, &info);
|
dsi = devm_mipi_dsi_device_register_full(dev, host, &info);
|
||||||
if (IS_ERR(dsi)) {
|
if (IS_ERR(dsi)) {
|
||||||
dev_err(lt9611uxc->dev, "failed to create dsi device\n");
|
dev_err(dev, "failed to create dsi device\n");
|
||||||
return dsi;
|
return dsi;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,10 +278,9 @@ static struct mipi_dsi_device *lt9611uxc_attach_dsi(struct lt9611uxc *lt9611uxc,
|
|||||||
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
|
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
|
||||||
MIPI_DSI_MODE_VIDEO_HSE;
|
MIPI_DSI_MODE_VIDEO_HSE;
|
||||||
|
|
||||||
ret = mipi_dsi_attach(dsi);
|
ret = devm_mipi_dsi_attach(dev, dsi);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(lt9611uxc->dev, "failed to attach dsi to host\n");
|
dev_err(dev, "failed to attach dsi to host\n");
|
||||||
mipi_dsi_device_unregister(dsi);
|
|
||||||
return ERR_PTR(ret);
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,19 +355,6 @@ static int lt9611uxc_connector_init(struct drm_bridge *bridge, struct lt9611uxc
|
|||||||
return drm_connector_attach_encoder(<9611uxc->connector, bridge->encoder);
|
return drm_connector_attach_encoder(<9611uxc->connector, bridge->encoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lt9611uxc_bridge_detach(struct drm_bridge *bridge)
|
|
||||||
{
|
|
||||||
struct lt9611uxc *lt9611uxc = bridge_to_lt9611uxc(bridge);
|
|
||||||
|
|
||||||
if (lt9611uxc->dsi1) {
|
|
||||||
mipi_dsi_detach(lt9611uxc->dsi1);
|
|
||||||
mipi_dsi_device_unregister(lt9611uxc->dsi1);
|
|
||||||
}
|
|
||||||
|
|
||||||
mipi_dsi_detach(lt9611uxc->dsi0);
|
|
||||||
mipi_dsi_device_unregister(lt9611uxc->dsi0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lt9611uxc_bridge_attach(struct drm_bridge *bridge,
|
static int lt9611uxc_bridge_attach(struct drm_bridge *bridge,
|
||||||
enum drm_bridge_attach_flags flags)
|
enum drm_bridge_attach_flags flags)
|
||||||
{
|
{
|
||||||
@ -388,19 +375,11 @@ static int lt9611uxc_bridge_attach(struct drm_bridge *bridge,
|
|||||||
/* Attach secondary DSI, if specified */
|
/* Attach secondary DSI, if specified */
|
||||||
if (lt9611uxc->dsi1_node) {
|
if (lt9611uxc->dsi1_node) {
|
||||||
lt9611uxc->dsi1 = lt9611uxc_attach_dsi(lt9611uxc, lt9611uxc->dsi1_node);
|
lt9611uxc->dsi1 = lt9611uxc_attach_dsi(lt9611uxc, lt9611uxc->dsi1_node);
|
||||||
if (IS_ERR(lt9611uxc->dsi1)) {
|
if (IS_ERR(lt9611uxc->dsi1))
|
||||||
ret = PTR_ERR(lt9611uxc->dsi1);
|
return PTR_ERR(lt9611uxc->dsi1);
|
||||||
goto err_unregister_dsi0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_unregister_dsi0:
|
|
||||||
mipi_dsi_detach(lt9611uxc->dsi0);
|
|
||||||
mipi_dsi_device_unregister(lt9611uxc->dsi0);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum drm_mode_status
|
static enum drm_mode_status
|
||||||
@ -544,7 +523,6 @@ static struct edid *lt9611uxc_bridge_get_edid(struct drm_bridge *bridge,
|
|||||||
|
|
||||||
static const struct drm_bridge_funcs lt9611uxc_bridge_funcs = {
|
static const struct drm_bridge_funcs lt9611uxc_bridge_funcs = {
|
||||||
.attach = lt9611uxc_bridge_attach,
|
.attach = lt9611uxc_bridge_attach,
|
||||||
.detach = lt9611uxc_bridge_detach,
|
|
||||||
.mode_valid = lt9611uxc_bridge_mode_valid,
|
.mode_valid = lt9611uxc_bridge_mode_valid,
|
||||||
.mode_set = lt9611uxc_bridge_mode_set,
|
.mode_set = lt9611uxc_bridge_mode_set,
|
||||||
.detect = lt9611uxc_bridge_detect,
|
.detect = lt9611uxc_bridge_detect,
|
||||||
|
Reference in New Issue
Block a user