A few fixes for the next merge window, with some build fixes for anx7625

and lt8912b bridges, incorrect error handling for lt8912b and TTM, and
 one fix for TTM page limit accounting.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYIGlOAAKCRDj7w1vZxhR
 xRJzAPwNsgToXKXGoq2brUpoupZH7AB6BEaNQtjF9HGLKYpcaAD+M7+h4PdKmzlC
 ijwQTg8vHkjFRWSppSGwnH3K0wdr1gQ=
 =MKnu
 -----END PGP SIGNATURE-----

Merge tag 'drm-misc-next-fixes-2021-04-22' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

A few fixes for the next merge window, with some build fixes for anx7625
and lt8912b bridges, incorrect error handling for lt8912b and TTM, and
one fix for TTM page limit accounting.

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210422163329.dvbuwre3akwdmzjt@gilmour
This commit is contained in:
Dave Airlie 2021-04-23 12:56:21 +10:00
commit a1a1ca70de
4 changed files with 40 additions and 25 deletions

View File

@ -66,6 +66,7 @@ config DRM_LONTIUM_LT8912B
depends on OF depends on OF
select DRM_PANEL_BRIDGE select DRM_PANEL_BRIDGE
select DRM_KMS_HELPER select DRM_KMS_HELPER
select DRM_MIPI_DSI
select REGMAP_I2C select REGMAP_I2C
help help
Driver for Lontium LT8912B DSI to HDMI bridge Driver for Lontium LT8912B DSI to HDMI bridge
@ -81,6 +82,7 @@ config DRM_LONTIUM_LT9611
depends on OF depends on OF
select DRM_PANEL_BRIDGE select DRM_PANEL_BRIDGE
select DRM_KMS_HELPER select DRM_KMS_HELPER
select DRM_MIPI_DSI
select REGMAP_I2C select REGMAP_I2C
help help
Driver for Lontium LT9611 DSI to HDMI bridge Driver for Lontium LT9611 DSI to HDMI bridge
@ -94,6 +96,7 @@ config DRM_LONTIUM_LT9611UXC
depends on OF depends on OF
select DRM_PANEL_BRIDGE select DRM_PANEL_BRIDGE
select DRM_KMS_HELPER select DRM_KMS_HELPER
select DRM_MIPI_DSI
select REGMAP_I2C select REGMAP_I2C
help help
Driver for Lontium LT9611UXC DSI to HDMI bridge Driver for Lontium LT9611UXC DSI to HDMI bridge

View File

@ -30,6 +30,7 @@ config DRM_ANALOGIX_ANX7625
tristate "Analogix Anx7625 MIPI to DP interface support" tristate "Analogix Anx7625 MIPI to DP interface support"
depends on DRM depends on DRM
depends on OF depends on OF
select DRM_MIPI_DSI
help help
ANX7625 is an ultra-low power 4K mobile HD transmitter ANX7625 is an ultra-low power 4K mobile HD transmitter
designed for portable devices. It converts MIPI/DPI to designed for portable devices. It converts MIPI/DPI to

View File

@ -622,7 +622,8 @@ static int lt8912_parse_dt(struct lt8912 *lt)
{ {
struct gpio_desc *gp_reset; struct gpio_desc *gp_reset;
struct device *dev = lt->dev; struct device *dev = lt->dev;
int ret = 0; int ret;
int data_lanes;
struct device_node *port_node; struct device_node *port_node;
struct device_node *endpoint; struct device_node *endpoint;
@ -636,19 +637,21 @@ static int lt8912_parse_dt(struct lt8912 *lt)
lt->gp_reset = gp_reset; lt->gp_reset = gp_reset;
endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1); endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
if (IS_ERR(endpoint)) { if (!endpoint)
ret = PTR_ERR(endpoint); return -ENODEV;
goto end;
}
lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes"); data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
of_node_put(endpoint); of_node_put(endpoint);
if (data_lanes < 0) {
dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
return data_lanes;
}
lt->data_lanes = data_lanes;
lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1); lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
if (!lt->host_node) { if (!lt->host_node) {
dev_err(lt->dev, "%s: Failed to get remote port\n", __func__); dev_err(lt->dev, "%s: Failed to get remote port\n", __func__);
ret = -ENODEV; return -ENODEV;
goto end;
} }
port_node = of_graph_get_remote_node(dev->of_node, 1, -1); port_node = of_graph_get_remote_node(dev->of_node, 1, -1);
@ -659,24 +662,23 @@ static int lt8912_parse_dt(struct lt8912 *lt)
} }
lt->hdmi_port = of_drm_find_bridge(port_node); lt->hdmi_port = of_drm_find_bridge(port_node);
if (IS_ERR(lt->hdmi_port)) { if (!lt->hdmi_port) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__); dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
ret = PTR_ERR(lt->hdmi_port); ret = -ENODEV;
of_node_put(lt->host_node); goto err_free_host_node;
goto end;
} }
if (!of_device_is_compatible(port_node, "hdmi-connector")) { if (!of_device_is_compatible(port_node, "hdmi-connector")) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__); dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
ret = -EINVAL; ret = -EINVAL;
goto err_free_host_node;
} }
of_node_put(port_node); of_node_put(port_node);
return 0;
end:
return ret;
err_free_host_node: err_free_host_node:
of_node_put(port_node);
of_node_put(lt->host_node); of_node_put(lt->host_node);
return ret; return ret;
} }

View File

@ -317,16 +317,19 @@ int ttm_tt_populate(struct ttm_device *bdev,
if (ttm_tt_is_populated(ttm)) if (ttm_tt_is_populated(ttm))
return 0; return 0;
if (!(ttm->page_flags & TTM_PAGE_FLAG_SG)) {
atomic_long_add(ttm->num_pages, &ttm_pages_allocated); atomic_long_add(ttm->num_pages, &ttm_pages_allocated);
if (bdev->pool.use_dma32) if (bdev->pool.use_dma32)
atomic_long_add(ttm->num_pages, &ttm_dma32_pages_allocated); atomic_long_add(ttm->num_pages,
&ttm_dma32_pages_allocated);
}
while (atomic_long_read(&ttm_pages_allocated) > ttm_pages_limit || while (atomic_long_read(&ttm_pages_allocated) > ttm_pages_limit ||
atomic_long_read(&ttm_dma32_pages_allocated) > atomic_long_read(&ttm_dma32_pages_allocated) >
ttm_dma32_pages_limit) { ttm_dma32_pages_limit) {
ret = ttm_global_swapout(ctx, GFP_KERNEL); ret = ttm_global_swapout(ctx, GFP_KERNEL);
if (ret) if (ret < 0)
goto error; goto error;
} }
@ -350,9 +353,12 @@ int ttm_tt_populate(struct ttm_device *bdev,
return 0; return 0;
error: error:
if (!(ttm->page_flags & TTM_PAGE_FLAG_SG)) {
atomic_long_sub(ttm->num_pages, &ttm_pages_allocated); atomic_long_sub(ttm->num_pages, &ttm_pages_allocated);
if (bdev->pool.use_dma32) if (bdev->pool.use_dma32)
atomic_long_sub(ttm->num_pages, &ttm_dma32_pages_allocated); atomic_long_sub(ttm->num_pages,
&ttm_dma32_pages_allocated);
}
return ret; return ret;
} }
EXPORT_SYMBOL(ttm_tt_populate); EXPORT_SYMBOL(ttm_tt_populate);
@ -382,9 +388,12 @@ void ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm)
else else
ttm_pool_free(&bdev->pool, ttm); ttm_pool_free(&bdev->pool, ttm);
if (!(ttm->page_flags & TTM_PAGE_FLAG_SG)) {
atomic_long_sub(ttm->num_pages, &ttm_pages_allocated); atomic_long_sub(ttm->num_pages, &ttm_pages_allocated);
if (bdev->pool.use_dma32) if (bdev->pool.use_dma32)
atomic_long_sub(ttm->num_pages, &ttm_dma32_pages_allocated); atomic_long_sub(ttm->num_pages,
&ttm_dma32_pages_allocated);
}
ttm->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED; ttm->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED;
} }