Commit 02ac4371 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-misc-next-fixes-2024-03-14' of...

Merge tag 'drm-misc-next-fixes-2024-03-14' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next

Short summary of fixes pull:

probe-helper:
- never return negative values from .get_modes() plus driver fixes

nouveau:
- clear bo resource bus after eviction
- documentation fixes
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240314082833.GA8761@localhost.localdomain
parents 341f7081 9dd81b2e
...@@ -441,23 +441,21 @@ lt8912_connector_mode_valid(struct drm_connector *connector, ...@@ -441,23 +441,21 @@ lt8912_connector_mode_valid(struct drm_connector *connector,
static int lt8912_connector_get_modes(struct drm_connector *connector) static int lt8912_connector_get_modes(struct drm_connector *connector)
{ {
const struct drm_edid *drm_edid; const struct drm_edid *drm_edid;
int ret = -1;
int num = 0;
struct lt8912 *lt = connector_to_lt8912(connector); struct lt8912 *lt = connector_to_lt8912(connector);
u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24; u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
int ret, num;
drm_edid = drm_bridge_edid_read(lt->hdmi_port, connector); drm_edid = drm_bridge_edid_read(lt->hdmi_port, connector);
drm_edid_connector_update(connector, drm_edid); drm_edid_connector_update(connector, drm_edid);
if (drm_edid) { if (!drm_edid)
num = drm_edid_connector_add_modes(connector); return 0;
} else {
return ret; num = drm_edid_connector_add_modes(connector);
}
ret = drm_display_info_set_bus_formats(&connector->display_info, ret = drm_display_info_set_bus_formats(&connector->display_info,
&bus_format, 1); &bus_format, 1);
if (ret) if (ret < 0)
num = ret; num = 0;
drm_edid_free(drm_edid); drm_edid_free(drm_edid);
return num; return num;
......
...@@ -294,8 +294,8 @@ static struct mipi_dsi_device *lt9611uxc_attach_dsi(struct lt9611uxc *lt9611uxc, ...@@ -294,8 +294,8 @@ static struct mipi_dsi_device *lt9611uxc_attach_dsi(struct lt9611uxc *lt9611uxc,
static int lt9611uxc_connector_get_modes(struct drm_connector *connector) static int lt9611uxc_connector_get_modes(struct drm_connector *connector)
{ {
struct lt9611uxc *lt9611uxc = connector_to_lt9611uxc(connector); struct lt9611uxc *lt9611uxc = connector_to_lt9611uxc(connector);
unsigned int count;
const struct drm_edid *drm_edid; const struct drm_edid *drm_edid;
int count;
drm_edid = drm_bridge_edid_read(&lt9611uxc->bridge, connector); drm_edid = drm_bridge_edid_read(&lt9611uxc->bridge, connector);
drm_edid_connector_update(connector, drm_edid); drm_edid_connector_update(connector, drm_edid);
......
...@@ -274,19 +274,24 @@ EXPORT_SYMBOL(drm_panel_disable); ...@@ -274,19 +274,24 @@ EXPORT_SYMBOL(drm_panel_disable);
* The modes probed from the panel are automatically added to the connector * The modes probed from the panel are automatically added to the connector
* that the panel is attached to. * that the panel is attached to.
* *
* Return: The number of modes available from the panel on success or a * Return: The number of modes available from the panel on success, or 0 on
* negative error code on failure. * failure (no modes).
*/ */
int drm_panel_get_modes(struct drm_panel *panel, int drm_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector) struct drm_connector *connector)
{ {
if (!panel) if (!panel)
return -EINVAL; return 0;
if (panel->funcs && panel->funcs->get_modes) if (panel->funcs && panel->funcs->get_modes) {
return panel->funcs->get_modes(panel, connector); int num;
return -EOPNOTSUPP; num = panel->funcs->get_modes(panel, connector);
if (num > 0)
return num;
}
return 0;
} }
EXPORT_SYMBOL(drm_panel_get_modes); EXPORT_SYMBOL(drm_panel_get_modes);
......
...@@ -422,6 +422,13 @@ static int drm_helper_probe_get_modes(struct drm_connector *connector) ...@@ -422,6 +422,13 @@ static int drm_helper_probe_get_modes(struct drm_connector *connector)
count = connector_funcs->get_modes(connector); count = connector_funcs->get_modes(connector);
/* The .get_modes() callback should not return negative values. */
if (count < 0) {
drm_err(connector->dev, ".get_modes() returned %pe\n",
ERR_PTR(count));
count = 0;
}
/* /*
* Fallback for when DDC probe failed in drm_get_edid() and thus skipped * Fallback for when DDC probe failed in drm_get_edid() and thus skipped
* override/firmware EDID. * override/firmware EDID.
......
...@@ -74,16 +74,15 @@ static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data, ...@@ -74,16 +74,15 @@ static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data,
{ {
struct exynos_dp_device *dp = to_dp(plat_data); struct exynos_dp_device *dp = to_dp(plat_data);
struct drm_display_mode *mode; struct drm_display_mode *mode;
int num_modes = 0;
if (dp->plat_data.panel) if (dp->plat_data.panel)
return num_modes; return 0;
mode = drm_mode_create(connector->dev); mode = drm_mode_create(connector->dev);
if (!mode) { if (!mode) {
DRM_DEV_ERROR(dp->dev, DRM_DEV_ERROR(dp->dev,
"failed to create a new display mode.\n"); "failed to create a new display mode.\n");
return num_modes; return 0;
} }
drm_display_mode_from_videomode(&dp->vm, mode); drm_display_mode_from_videomode(&dp->vm, mode);
...@@ -94,7 +93,7 @@ static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data, ...@@ -94,7 +93,7 @@ static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data,
drm_mode_set_name(mode); drm_mode_set_name(mode);
drm_mode_probed_add(connector, mode); drm_mode_probed_add(connector, mode);
return num_modes + 1; return 1;
} }
static int exynos_dp_bridge_attach(struct analogix_dp_plat_data *plat_data, static int exynos_dp_bridge_attach(struct analogix_dp_plat_data *plat_data,
......
...@@ -316,14 +316,14 @@ static int vidi_get_modes(struct drm_connector *connector) ...@@ -316,14 +316,14 @@ static int vidi_get_modes(struct drm_connector *connector)
*/ */
if (!ctx->raw_edid) { if (!ctx->raw_edid) {
DRM_DEV_DEBUG_KMS(ctx->dev, "raw_edid is null.\n"); DRM_DEV_DEBUG_KMS(ctx->dev, "raw_edid is null.\n");
return -EFAULT; return 0;
} }
edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH; edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH;
edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL); edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL);
if (!edid) { if (!edid) {
DRM_DEV_DEBUG_KMS(ctx->dev, "failed to allocate edid\n"); DRM_DEV_DEBUG_KMS(ctx->dev, "failed to allocate edid\n");
return -ENOMEM; return 0;
} }
drm_connector_update_edid_property(connector, edid); drm_connector_update_edid_property(connector, edid);
......
...@@ -887,11 +887,11 @@ static int hdmi_get_modes(struct drm_connector *connector) ...@@ -887,11 +887,11 @@ static int hdmi_get_modes(struct drm_connector *connector)
int ret; int ret;
if (!hdata->ddc_adpt) if (!hdata->ddc_adpt)
return -ENODEV; return 0;
edid = drm_get_edid(connector, hdata->ddc_adpt); edid = drm_get_edid(connector, hdata->ddc_adpt);
if (!edid) if (!edid)
return -ENODEV; return 0;
hdata->dvi_mode = !connector->display_info.is_hdmi; hdata->dvi_mode = !connector->display_info.is_hdmi;
DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n", DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n",
......
...@@ -72,14 +72,14 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) ...@@ -72,14 +72,14 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
int ret; int ret;
if (!mode) if (!mode)
return -EINVAL; return 0;
ret = of_get_drm_display_mode(np, &imxpd->mode, ret = of_get_drm_display_mode(np, &imxpd->mode,
&imxpd->bus_flags, &imxpd->bus_flags,
OF_USE_NATIVE_MODE); OF_USE_NATIVE_MODE);
if (ret) { if (ret) {
drm_mode_destroy(connector->dev, mode); drm_mode_destroy(connector->dev, mode);
return ret; return 0;
} }
drm_mode_copy(mode, &imxpd->mode); drm_mode_copy(mode, &imxpd->mode);
......
...@@ -1256,6 +1256,8 @@ nouveau_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resource *reg) ...@@ -1256,6 +1256,8 @@ nouveau_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resource *reg)
drm_vma_node_unmap(&nvbo->bo.base.vma_node, drm_vma_node_unmap(&nvbo->bo.base.vma_node,
bdev->dev_mapping); bdev->dev_mapping);
nouveau_ttm_io_mem_free_locked(drm, nvbo->bo.resource); nouveau_ttm_io_mem_free_locked(drm, nvbo->bo.resource);
nvbo->bo.resource->bus.offset = 0;
nvbo->bo.resource->bus.addr = NULL;
goto retry; goto retry;
} }
......
...@@ -1432,6 +1432,10 @@ r535_gsp_msg_post_event(void *priv, u32 fn, void *repv, u32 repc) ...@@ -1432,6 +1432,10 @@ r535_gsp_msg_post_event(void *priv, u32 fn, void *repv, u32 repc)
/** /**
* r535_gsp_msg_run_cpu_sequencer() -- process I/O commands from the GSP * r535_gsp_msg_run_cpu_sequencer() -- process I/O commands from the GSP
* @priv: gsp pointer
* @fn: function number (ignored)
* @repv: pointer to libos print RPC
* @repc: message size
* *
* The GSP sequencer is a list of I/O commands that the GSP can send to * The GSP sequencer is a list of I/O commands that the GSP can send to
* the driver to perform for various purposes. The most common usage is to * the driver to perform for various purposes. The most common usage is to
...@@ -1783,6 +1787,7 @@ static void create_pte_array(u64 *ptes, dma_addr_t addr, size_t size) ...@@ -1783,6 +1787,7 @@ static void create_pte_array(u64 *ptes, dma_addr_t addr, size_t size)
/** /**
* r535_gsp_libos_init() -- create the libos arguments structure * r535_gsp_libos_init() -- create the libos arguments structure
* @gsp: gsp pointer
* *
* The logging buffers are byte queues that contain encoded printf-like * The logging buffers are byte queues that contain encoded printf-like
* messages from GSP-RM. They need to be decoded by a special application * messages from GSP-RM. They need to be decoded by a special application
...@@ -1922,6 +1927,10 @@ nvkm_gsp_radix3_dtor(struct nvkm_gsp *gsp, struct nvkm_gsp_radix3 *rx3) ...@@ -1922,6 +1927,10 @@ nvkm_gsp_radix3_dtor(struct nvkm_gsp *gsp, struct nvkm_gsp_radix3 *rx3)
/** /**
* nvkm_gsp_radix3_sg - build a radix3 table from a S/G list * nvkm_gsp_radix3_sg - build a radix3 table from a S/G list
* @gsp: gsp pointer
* @sgt: S/G list to traverse
* @size: size of the image, in bytes
* @rx3: radix3 array to update
* *
* The GSP uses a three-level page table, called radix3, to map the firmware. * The GSP uses a three-level page table, called radix3, to map the firmware.
* Each 64-bit "pointer" in the table is either the bus address of an entry in * Each 64-bit "pointer" in the table is either the bus address of an entry in
......
...@@ -509,7 +509,7 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector) ...@@ -509,7 +509,7 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector)
edid = drm_get_edid(connector, vc4_hdmi->ddc); edid = drm_get_edid(connector, vc4_hdmi->ddc);
cec_s_phys_addr_from_edid(vc4_hdmi->cec_adap, edid); cec_s_phys_addr_from_edid(vc4_hdmi->cec_adap, edid);
if (!edid) if (!edid)
return -ENODEV; return 0;
drm_connector_update_edid_property(connector, edid); drm_connector_update_edid_property(connector, edid);
ret = drm_add_edid_modes(connector, edid); ret = drm_add_edid_modes(connector, edid);
......
...@@ -898,7 +898,8 @@ struct drm_connector_helper_funcs { ...@@ -898,7 +898,8 @@ struct drm_connector_helper_funcs {
* *
* RETURNS: * RETURNS:
* *
* The number of modes added by calling drm_mode_probed_add(). * The number of modes added by calling drm_mode_probed_add(). Return 0
* on failures (no modes) instead of negative error codes.
*/ */
int (*get_modes)(struct drm_connector *connector); int (*get_modes)(struct drm_connector *connector);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment