Commit c6b035e6 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'imx-drm-fixes-2022-04-06' of git://git.pengutronix.de/pza/linux into drm-fixes

drm/imx: error handling and debug output fixes

Catch an EDID allocation failure in imx-ldb, fix a leaked drm display
mode on DT parsing error in parallel-display, properly remove the
dw_hdmi bridge in case the component_add fails in dw_hdmi-imx, and
fix the IPU clock frequency debug printout in ipu-di.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220406155101.1271845-1-p.zabel@pengutronix.de
parents 691b592a 070a88fd
...@@ -222,6 +222,7 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev) ...@@ -222,6 +222,7 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
const struct of_device_id *match = of_match_node(dw_hdmi_imx_dt_ids, np); const struct of_device_id *match = of_match_node(dw_hdmi_imx_dt_ids, np);
struct imx_hdmi *hdmi; struct imx_hdmi *hdmi;
int ret;
hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi) if (!hdmi)
...@@ -243,10 +244,15 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev) ...@@ -243,10 +244,15 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
hdmi->bridge = of_drm_find_bridge(np); hdmi->bridge = of_drm_find_bridge(np);
if (!hdmi->bridge) { if (!hdmi->bridge) {
dev_err(hdmi->dev, "Unable to find bridge\n"); dev_err(hdmi->dev, "Unable to find bridge\n");
dw_hdmi_remove(hdmi->hdmi);
return -ENODEV; return -ENODEV;
} }
return component_add(&pdev->dev, &dw_hdmi_imx_ops); ret = component_add(&pdev->dev, &dw_hdmi_imx_ops);
if (ret)
dw_hdmi_remove(hdmi->hdmi);
return ret;
} }
static int dw_hdmi_imx_remove(struct platform_device *pdev) static int dw_hdmi_imx_remove(struct platform_device *pdev)
......
...@@ -572,6 +572,8 @@ static int imx_ldb_panel_ddc(struct device *dev, ...@@ -572,6 +572,8 @@ static int imx_ldb_panel_ddc(struct device *dev,
edidp = of_get_property(child, "edid", &edid_len); edidp = of_get_property(child, "edid", &edid_len);
if (edidp) { if (edidp) {
channel->edid = kmemdup(edidp, edid_len, GFP_KERNEL); channel->edid = kmemdup(edidp, edid_len, GFP_KERNEL);
if (!channel->edid)
return -ENOMEM;
} else if (!channel->panel) { } else if (!channel->panel) {
/* fallback to display-timings node */ /* fallback to display-timings node */
ret = of_get_drm_display_mode(child, ret = of_get_drm_display_mode(child,
......
...@@ -75,8 +75,10 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) ...@@ -75,8 +75,10 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
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);
return ret; return ret;
}
drm_mode_copy(mode, &imxpd->mode); drm_mode_copy(mode, &imxpd->mode);
mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
......
...@@ -447,8 +447,9 @@ static void ipu_di_config_clock(struct ipu_di *di, ...@@ -447,8 +447,9 @@ static void ipu_di_config_clock(struct ipu_di *di,
error = rate / (sig->mode.pixelclock / 1000); error = rate / (sig->mode.pixelclock / 1000);
dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %d.%u%%\n", dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %c%d.%d%%\n",
rate, div, (signed)(error - 1000) / 10, error % 10); rate, div, error < 1000 ? '-' : '+',
abs(error - 1000) / 10, abs(error - 1000) % 10);
/* Allow a 1% error */ /* Allow a 1% error */
if (error < 1010 && error >= 990) { if (error < 1010 && error >= 990) {
......
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