drm/exynos/vidi: convert to struct drm_edid
Prefer the struct drm_edid based functions for storing the EDID and updating the connector. It would be better if the vidi connection ioctl passed in the EDID size separately instead of relying on the extension count specified in the EDID, but that's what we have to rely on. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
This commit is contained in:
parent
10b566f21b
commit
2210093478
@ -41,7 +41,7 @@ struct vidi_context {
|
|||||||
struct exynos_drm_crtc *crtc;
|
struct exynos_drm_crtc *crtc;
|
||||||
struct drm_connector connector;
|
struct drm_connector connector;
|
||||||
struct exynos_drm_plane planes[WINDOWS_NR];
|
struct exynos_drm_plane planes[WINDOWS_NR];
|
||||||
struct edid *raw_edid;
|
const struct drm_edid *raw_edid;
|
||||||
unsigned int clkdiv;
|
unsigned int clkdiv;
|
||||||
unsigned int connected;
|
unsigned int connected;
|
||||||
bool suspended;
|
bool suspended;
|
||||||
@ -245,23 +245,27 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vidi->connection) {
|
if (vidi->connection) {
|
||||||
struct edid *raw_edid;
|
const struct drm_edid *drm_edid;
|
||||||
|
const struct edid *raw_edid;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
raw_edid = (struct edid *)(unsigned long)vidi->edid;
|
raw_edid = (const struct edid *)(unsigned long)vidi->edid;
|
||||||
if (!drm_edid_is_valid(raw_edid)) {
|
size = (raw_edid->extensions + 1) * EDID_LENGTH;
|
||||||
|
|
||||||
|
drm_edid = drm_edid_alloc(raw_edid, size);
|
||||||
|
if (!drm_edid)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
if (!drm_edid_valid(drm_edid)) {
|
||||||
|
drm_edid_free(drm_edid);
|
||||||
DRM_DEV_DEBUG_KMS(ctx->dev,
|
DRM_DEV_DEBUG_KMS(ctx->dev,
|
||||||
"edid data is invalid.\n");
|
"edid data is invalid.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
ctx->raw_edid = drm_edid_duplicate(raw_edid);
|
ctx->raw_edid = drm_edid;
|
||||||
if (!ctx->raw_edid) {
|
|
||||||
DRM_DEV_DEBUG_KMS(ctx->dev,
|
|
||||||
"failed to allocate raw_edid.\n");
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/* with connection = 0, free raw_edid */
|
/* with connection = 0, free raw_edid */
|
||||||
kfree(ctx->raw_edid);
|
drm_edid_free(ctx->raw_edid);
|
||||||
ctx->raw_edid = NULL;
|
ctx->raw_edid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,18 +304,22 @@ static const struct drm_connector_funcs vidi_connector_funcs = {
|
|||||||
static int vidi_get_modes(struct drm_connector *connector)
|
static int vidi_get_modes(struct drm_connector *connector)
|
||||||
{
|
{
|
||||||
struct vidi_context *ctx = ctx_from_connector(connector);
|
struct vidi_context *ctx = ctx_from_connector(connector);
|
||||||
struct edid *edid;
|
const struct drm_edid *drm_edid;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
edid = drm_edid_duplicate(ctx->raw_edid ?: fake_edid_info);
|
if (ctx->raw_edid)
|
||||||
if (!edid)
|
drm_edid = drm_edid_dup(ctx->raw_edid);
|
||||||
|
else
|
||||||
|
drm_edid = drm_edid_alloc(fake_edid_info, sizeof(fake_edid_info));
|
||||||
|
|
||||||
|
if (!drm_edid)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
drm_connector_update_edid_property(connector, edid);
|
drm_edid_connector_update(connector, drm_edid);
|
||||||
|
|
||||||
count = drm_add_edid_modes(connector, edid);
|
count = drm_edid_connector_add_modes(connector);
|
||||||
|
|
||||||
kfree(edid);
|
drm_edid_free(drm_edid);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@ -451,7 +459,7 @@ static void vidi_remove(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct vidi_context *ctx = platform_get_drvdata(pdev);
|
struct vidi_context *ctx = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
kfree(ctx->raw_edid);
|
drm_edid_free(ctx->raw_edid);
|
||||||
ctx->raw_edid = NULL;
|
ctx->raw_edid = NULL;
|
||||||
|
|
||||||
component_del(&pdev->dev, &vidi_component_ops);
|
component_del(&pdev->dev, &vidi_component_ops);
|
||||||
|
Loading…
Reference in New Issue
Block a user