Commit 71137bfd authored by Dariusz Marcinkiewicz's avatar Dariusz Marcinkiewicz Committed by Hans Verkuil

drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register

Use the new cec_notifier_conn_(un)register() functions to
(un)register the notifier for the HDMI connector, and fill in
the cec_connector_info.

Changes since v7:
	- err_runtime_disable -> err_rpm_disable
Changes since v2:
	- removed unnecessary call to invalidate phys address before
	deregistering the notifier,
	- use cec_notifier_phys_addr_invalidate instead of setting
	invalid address on a notifier.
Signed-off-by: default avatarDariusz Marcinkiewicz <darekm@google.com>
Tested-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: use 'if (!hdata->notifier)' instead of '== NULL']
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Link: https://patchwork.freedesktop.org/patch/msgid/20190828123415.139441-1-darekm@google.com
parent 7ac1573e
...@@ -853,6 +853,10 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector, ...@@ -853,6 +853,10 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector,
static void hdmi_connector_destroy(struct drm_connector *connector) static void hdmi_connector_destroy(struct drm_connector *connector)
{ {
struct hdmi_context *hdata = connector_to_hdmi(connector);
cec_notifier_conn_unregister(hdata->notifier);
drm_connector_unregister(connector); drm_connector_unregister(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
} }
...@@ -936,6 +940,7 @@ static int hdmi_create_connector(struct drm_encoder *encoder) ...@@ -936,6 +940,7 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
{ {
struct hdmi_context *hdata = encoder_to_hdmi(encoder); struct hdmi_context *hdata = encoder_to_hdmi(encoder);
struct drm_connector *connector = &hdata->connector; struct drm_connector *connector = &hdata->connector;
struct cec_connector_info conn_info;
int ret; int ret;
connector->interlace_allowed = true; connector->interlace_allowed = true;
...@@ -958,6 +963,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder) ...@@ -958,6 +963,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
DRM_DEV_ERROR(hdata->dev, "Failed to attach bridge\n"); DRM_DEV_ERROR(hdata->dev, "Failed to attach bridge\n");
} }
cec_fill_conn_info_from_drm(&conn_info, connector);
hdata->notifier = cec_notifier_conn_register(hdata->dev, NULL,
&conn_info);
if (!hdata->notifier) {
ret = -ENOMEM;
DRM_DEV_ERROR(hdata->dev, "Failed to allocate CEC notifier\n");
}
return ret; return ret;
} }
...@@ -1529,8 +1543,8 @@ static void hdmi_disable(struct drm_encoder *encoder) ...@@ -1529,8 +1543,8 @@ static void hdmi_disable(struct drm_encoder *encoder)
*/ */
mutex_unlock(&hdata->mutex); mutex_unlock(&hdata->mutex);
cancel_delayed_work(&hdata->hotplug_work); cancel_delayed_work(&hdata->hotplug_work);
cec_notifier_set_phys_addr(hdata->notifier, if (hdata->notifier)
CEC_PHYS_ADDR_INVALID); cec_notifier_phys_addr_invalidate(hdata->notifier);
return; return;
} }
...@@ -2007,12 +2021,6 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2007,12 +2021,6 @@ static int hdmi_probe(struct platform_device *pdev)
} }
} }
hdata->notifier = cec_notifier_get(&pdev->dev);
if (hdata->notifier == NULL) {
ret = -ENOMEM;
goto err_hdmiphy;
}
pm_runtime_enable(dev); pm_runtime_enable(dev);
audio_infoframe = &hdata->audio.infoframe; audio_infoframe = &hdata->audio.infoframe;
...@@ -2024,7 +2032,7 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2024,7 +2032,7 @@ static int hdmi_probe(struct platform_device *pdev)
ret = hdmi_register_audio_device(hdata); ret = hdmi_register_audio_device(hdata);
if (ret) if (ret)
goto err_notifier_put; goto err_rpm_disable;
ret = component_add(&pdev->dev, &hdmi_component_ops); ret = component_add(&pdev->dev, &hdmi_component_ops);
if (ret) if (ret)
...@@ -2035,8 +2043,7 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2035,8 +2043,7 @@ static int hdmi_probe(struct platform_device *pdev)
err_unregister_audio: err_unregister_audio:
platform_device_unregister(hdata->audio.pdev); platform_device_unregister(hdata->audio.pdev);
err_notifier_put: err_rpm_disable:
cec_notifier_put(hdata->notifier);
pm_runtime_disable(dev); pm_runtime_disable(dev);
err_hdmiphy: err_hdmiphy:
...@@ -2055,12 +2062,10 @@ static int hdmi_remove(struct platform_device *pdev) ...@@ -2055,12 +2062,10 @@ static int hdmi_remove(struct platform_device *pdev)
struct hdmi_context *hdata = platform_get_drvdata(pdev); struct hdmi_context *hdata = platform_get_drvdata(pdev);
cancel_delayed_work_sync(&hdata->hotplug_work); cancel_delayed_work_sync(&hdata->hotplug_work);
cec_notifier_set_phys_addr(hdata->notifier, CEC_PHYS_ADDR_INVALID);
component_del(&pdev->dev, &hdmi_component_ops); component_del(&pdev->dev, &hdmi_component_ops);
platform_device_unregister(hdata->audio.pdev); platform_device_unregister(hdata->audio.pdev);
cec_notifier_put(hdata->notifier);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
if (!IS_ERR(hdata->reg_hdmi_en)) if (!IS_ERR(hdata->reg_hdmi_en))
......
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