| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 2016 Linaro Ltd. |
|---|
| 3 | 4 | * Copyright 2016 ZTE Corporation. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 7 | | - * published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | 5 | */ |
|---|
| 10 | 6 | |
|---|
| 11 | 7 | #include <linux/clk.h> |
|---|
| .. | .. |
|---|
| 20 | 16 | #include <linux/of_device.h> |
|---|
| 21 | 17 | |
|---|
| 22 | 18 | #include <drm/drm_atomic_helper.h> |
|---|
| 23 | | -#include <drm/drm_crtc_helper.h> |
|---|
| 24 | 19 | #include <drm/drm_edid.h> |
|---|
| 25 | 20 | #include <drm/drm_of.h> |
|---|
| 26 | | -#include <drm/drmP.h> |
|---|
| 21 | +#include <drm/drm_probe_helper.h> |
|---|
| 22 | +#include <drm/drm_print.h> |
|---|
| 23 | +#include <drm/drm_simple_kms_helper.h> |
|---|
| 27 | 24 | |
|---|
| 28 | 25 | #include <sound/hdmi-codec.h> |
|---|
| 29 | 26 | |
|---|
| .. | .. |
|---|
| 125 | 122 | union hdmi_infoframe frame; |
|---|
| 126 | 123 | int ret; |
|---|
| 127 | 124 | |
|---|
| 128 | | - ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false); |
|---|
| 125 | + ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, |
|---|
| 126 | + &hdmi->connector, |
|---|
| 127 | + mode); |
|---|
| 129 | 128 | if (ret) { |
|---|
| 130 | 129 | DRM_DEV_ERROR(hdmi->dev, "failed to get avi infoframe: %d\n", |
|---|
| 131 | 130 | ret); |
|---|
| .. | .. |
|---|
| 256 | 255 | .mode_set = zx_hdmi_encoder_mode_set, |
|---|
| 257 | 256 | }; |
|---|
| 258 | 257 | |
|---|
| 259 | | -static const struct drm_encoder_funcs zx_hdmi_encoder_funcs = { |
|---|
| 260 | | - .destroy = drm_encoder_cleanup, |
|---|
| 261 | | -}; |
|---|
| 262 | | - |
|---|
| 263 | 258 | static int zx_hdmi_connector_get_modes(struct drm_connector *connector) |
|---|
| 264 | 259 | { |
|---|
| 265 | 260 | struct zx_hdmi *hdmi = to_zx_hdmi(connector); |
|---|
| .. | .. |
|---|
| 315 | 310 | |
|---|
| 316 | 311 | encoder->possible_crtcs = VOU_CRTC_MASK; |
|---|
| 317 | 312 | |
|---|
| 318 | | - drm_encoder_init(drm, encoder, &zx_hdmi_encoder_funcs, |
|---|
| 319 | | - DRM_MODE_ENCODER_TMDS, NULL); |
|---|
| 313 | + drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); |
|---|
| 320 | 314 | drm_encoder_helper_add(encoder, &zx_hdmi_encoder_helper_funcs); |
|---|
| 321 | 315 | |
|---|
| 322 | 316 | hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD; |
|---|
| 323 | 317 | |
|---|
| 324 | | - drm_connector_init(drm, &hdmi->connector, &zx_hdmi_connector_funcs, |
|---|
| 325 | | - DRM_MODE_CONNECTOR_HDMIA); |
|---|
| 318 | + drm_connector_init_with_ddc(drm, &hdmi->connector, |
|---|
| 319 | + &zx_hdmi_connector_funcs, |
|---|
| 320 | + DRM_MODE_CONNECTOR_HDMIA, |
|---|
| 321 | + &hdmi->ddc->adap); |
|---|
| 326 | 322 | drm_connector_helper_add(&hdmi->connector, |
|---|
| 327 | 323 | &zx_hdmi_connector_helper_funcs); |
|---|
| 328 | 324 | |
|---|
| .. | .. |
|---|
| 443 | 439 | return zx_hdmi_infoframe_trans(hdmi, &frame, FSEL_AUDIO); |
|---|
| 444 | 440 | } |
|---|
| 445 | 441 | |
|---|
| 446 | | -static int zx_hdmi_audio_digital_mute(struct device *dev, void *data, |
|---|
| 447 | | - bool enable) |
|---|
| 442 | +static int zx_hdmi_audio_mute(struct device *dev, void *data, |
|---|
| 443 | + bool enable, int direction) |
|---|
| 448 | 444 | { |
|---|
| 449 | 445 | struct zx_hdmi *hdmi = dev_get_drvdata(dev); |
|---|
| 450 | 446 | |
|---|
| .. | .. |
|---|
| 472 | 468 | .audio_startup = zx_hdmi_audio_startup, |
|---|
| 473 | 469 | .hw_params = zx_hdmi_audio_hw_params, |
|---|
| 474 | 470 | .audio_shutdown = zx_hdmi_audio_shutdown, |
|---|
| 475 | | - .digital_mute = zx_hdmi_audio_digital_mute, |
|---|
| 471 | + .mute_stream = zx_hdmi_audio_mute, |
|---|
| 476 | 472 | .get_eld = zx_hdmi_audio_get_eld, |
|---|
| 473 | + .no_capture_mute = 1, |
|---|
| 477 | 474 | }; |
|---|
| 478 | 475 | |
|---|
| 479 | 476 | static struct hdmi_codec_pdata zx_hdmi_codec_pdata = { |
|---|