Skip to content

Commit 004e822

Browse files
darekm1thierryreding
authored andcommitted
drm/tegra: 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. Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com> Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent 051172e commit 004e822

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

‎drivers/gpu/drm/tegra/output.c‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force)
7070

7171
void tegra_output_connector_destroy(struct drm_connector *connector)
7272
{
73+
struct tegra_output *output = connector_to_output(connector);
74+
75+
if (output->cec)
76+
cec_notifier_conn_unregister(output->cec);
77+
7378
drm_connector_unregister(connector);
7479
drm_connector_cleanup(connector);
7580
}
@@ -163,18 +168,11 @@ int tegra_output_probe(struct tegra_output *output)
163168
disable_irq(output->hpd_irq);
164169
}
165170

166-
output->cec = cec_notifier_get(output->dev);
167-
if (!output->cec)
168-
return -ENOMEM;
169-
170171
return 0;
171172
}
172173

173174
void tegra_output_remove(struct tegra_output *output)
174175
{
175-
if (output->cec)
176-
cec_notifier_put(output->cec);
177-
178176
if (output->hpd_gpio)
179177
free_irq(output->hpd_irq, output);
180178

@@ -184,6 +182,7 @@ void tegra_output_remove(struct tegra_output *output)
184182

185183
int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
186184
{
185+
int connector_type;
187186
int err;
188187

189188
if (output->panel) {
@@ -199,6 +198,21 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
199198
if (output->hpd_gpio)
200199
enable_irq(output->hpd_irq);
201200

201+
connector_type = output->connector.connector_type;
202+
/*
203+
* Create a CEC notifier for HDMI connector.
204+
*/
205+
if (connector_type == DRM_MODE_CONNECTOR_HDMIA ||
206+
connector_type == DRM_MODE_CONNECTOR_HDMIB) {
207+
struct cec_connector_info conn_info;
208+
209+
cec_fill_conn_info_from_drm(&conn_info, &output->connector);
210+
output->cec = cec_notifier_conn_register(output->dev, NULL,
211+
&conn_info);
212+
if (!output->cec)
213+
return -ENOMEM;
214+
}
215+
202216
return 0;
203217
}
204218

0 commit comments

Comments
 (0)