two regression fixups

- Check a null pointer instead of IS_ERR().
 - Rework initialization code of Exynos MIC driver.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEGaM000JtH4Vhbu4NZMZxZtnUbQkFAmKolrMACgkQZMZxZtnU
 bQm1pQ/+KAPxM125H/eZXeo2FfKV0Fx5Lb/YzcWBVCc+HP7ZpdI8C7skWRrAnFFs
 46vBmVasvdnA2tfy3ohuBSU8jqtV5EGQc84a3aTM/EHLVcAxuaVIERX9OAG0LWTw
 zPSWvXcCd8cg7TJitQ74UT3xh1liaK8mTctYIeAlL/24SSQTzLTlmq9LEBu+nv5I
 wS5RVDLUfY8G+uiP+LnKLkFzvNya+8Ubr0ZNvjeqwqjAlLzzDrEKAtj3+XyDJfeH
 L/3B4OojKHMJoH6EZjaSjB2o20yhtIgWYvjvnaKl7WR/i/N48yqvos/FbHRDV/Sv
 CjlUs2Z1r6Te24lAsD1JkKRnBGV7xwqcwfvwjfNf2eoV9ceK62jabM+txFdbhvgS
 XjQKoGEbVRSImo9sFHRUEh6llsOP3MaySGH6jmnFyY9zD5khZT+CexqdfVQ+NWek
 KDYsNDDyax6UYjcMBXgeaHcPLBsUX9APM7nI9F+pGDMQMqNWSnxz2d6qVTGYj/bR
 Yl0rKsxotACAApTLhup8zFURtMZF2teTp6x4O8hV4T9sMAnSD3Z6VfTEIBb0yNlc
 EGBVgmcfTj9BNqNPXYpiosyUZ8h5EDH6UsbUcH4e5WEfq7AliqNrXalrnDxaIYy8
 kqyLDH2D8vkDNb8T1qgPsqeOF8dqvnIQDXuPeVwRA7DvFgD9pmw=
 =p+Ct
 -----END PGP SIGNATURE-----

Merge tag 'exynos-drm-fixes-v5.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-fixes

two regression fixups
- Check a null pointer instead of IS_ERR().
- Rework initialization code of Exynos MIC driver.

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

From: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220614141336.88614-1-inki.dae@samsung.com
This commit is contained in:
Dave Airlie 2022-06-17 11:32:22 +10:00
commit 65cf7c02cf
2 changed files with 15 additions and 33 deletions

View File

@ -176,15 +176,15 @@ static struct exynos_drm_driver_info exynos_drm_drivers[] = {
}, { }, {
DRV_PTR(mixer_driver, CONFIG_DRM_EXYNOS_MIXER), DRV_PTR(mixer_driver, CONFIG_DRM_EXYNOS_MIXER),
DRM_COMPONENT_DRIVER DRM_COMPONENT_DRIVER
}, {
DRV_PTR(mic_driver, CONFIG_DRM_EXYNOS_MIC),
DRM_COMPONENT_DRIVER
}, { }, {
DRV_PTR(dp_driver, CONFIG_DRM_EXYNOS_DP), DRV_PTR(dp_driver, CONFIG_DRM_EXYNOS_DP),
DRM_COMPONENT_DRIVER DRM_COMPONENT_DRIVER
}, { }, {
DRV_PTR(dsi_driver, CONFIG_DRM_EXYNOS_DSI), DRV_PTR(dsi_driver, CONFIG_DRM_EXYNOS_DSI),
DRM_COMPONENT_DRIVER DRM_COMPONENT_DRIVER
}, {
DRV_PTR(mic_driver, CONFIG_DRM_EXYNOS_MIC),
DRM_COMPONENT_DRIVER
}, { }, {
DRV_PTR(hdmi_driver, CONFIG_DRM_EXYNOS_HDMI), DRV_PTR(hdmi_driver, CONFIG_DRM_EXYNOS_HDMI),
DRM_COMPONENT_DRIVER DRM_COMPONENT_DRIVER

View File

@ -26,6 +26,7 @@
#include <drm/drm_print.h> #include <drm/drm_print.h>
#include "exynos_drm_drv.h" #include "exynos_drm_drv.h"
#include "exynos_drm_crtc.h"
/* Sysreg registers for MIC */ /* Sysreg registers for MIC */
#define DSD_CFG_MUX 0x1004 #define DSD_CFG_MUX 0x1004
@ -100,9 +101,7 @@ struct exynos_mic {
bool i80_mode; bool i80_mode;
struct videomode vm; struct videomode vm;
struct drm_encoder *encoder;
struct drm_bridge bridge; struct drm_bridge bridge;
struct drm_bridge *next_bridge;
bool enabled; bool enabled;
}; };
@ -229,8 +228,6 @@ static void mic_set_reg_on(struct exynos_mic *mic, bool enable)
writel(reg, mic->reg + MIC_OP); writel(reg, mic->reg + MIC_OP);
} }
static void mic_disable(struct drm_bridge *bridge) { }
static void mic_post_disable(struct drm_bridge *bridge) static void mic_post_disable(struct drm_bridge *bridge)
{ {
struct exynos_mic *mic = bridge->driver_private; struct exynos_mic *mic = bridge->driver_private;
@ -297,34 +294,30 @@ unlock:
mutex_unlock(&mic_mutex); mutex_unlock(&mic_mutex);
} }
static void mic_enable(struct drm_bridge *bridge) { }
static int mic_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{
struct exynos_mic *mic = bridge->driver_private;
return drm_bridge_attach(bridge->encoder, mic->next_bridge,
&mic->bridge, flags);
}
static const struct drm_bridge_funcs mic_bridge_funcs = { static const struct drm_bridge_funcs mic_bridge_funcs = {
.disable = mic_disable,
.post_disable = mic_post_disable, .post_disable = mic_post_disable,
.mode_set = mic_mode_set, .mode_set = mic_mode_set,
.pre_enable = mic_pre_enable, .pre_enable = mic_pre_enable,
.enable = mic_enable,
.attach = mic_attach,
}; };
static int exynos_mic_bind(struct device *dev, struct device *master, static int exynos_mic_bind(struct device *dev, struct device *master,
void *data) void *data)
{ {
struct exynos_mic *mic = dev_get_drvdata(dev); struct exynos_mic *mic = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
struct exynos_drm_crtc *crtc = exynos_drm_crtc_get_by_type(drm_dev,
EXYNOS_DISPLAY_TYPE_LCD);
struct drm_encoder *e, *encoder = NULL;
drm_for_each_encoder(e, drm_dev)
if (e->possible_crtcs == drm_crtc_mask(&crtc->base))
encoder = e;
if (!encoder)
return -ENODEV;
mic->bridge.driver_private = mic; mic->bridge.driver_private = mic;
return 0; return drm_bridge_attach(encoder, &mic->bridge, NULL, 0);
} }
static void exynos_mic_unbind(struct device *dev, struct device *master, static void exynos_mic_unbind(struct device *dev, struct device *master,
@ -388,7 +381,6 @@ static int exynos_mic_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct exynos_mic *mic; struct exynos_mic *mic;
struct device_node *remote;
struct resource res; struct resource res;
int ret, i; int ret, i;
@ -432,16 +424,6 @@ static int exynos_mic_probe(struct platform_device *pdev)
} }
} }
remote = of_graph_get_remote_node(dev->of_node, 1, 0);
mic->next_bridge = of_drm_find_bridge(remote);
if (IS_ERR(mic->next_bridge)) {
DRM_DEV_ERROR(dev, "mic: Failed to find next bridge\n");
ret = PTR_ERR(mic->next_bridge);
goto err;
}
of_node_put(remote);
platform_set_drvdata(pdev, mic); platform_set_drvdata(pdev, mic);
mic->bridge.funcs = &mic_bridge_funcs; mic->bridge.funcs = &mic_bridge_funcs;