[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2d3073ce.16e2.18f6bec1d61.Coremail.andyshrk@163.com>
Date: Sun, 12 May 2024 16:29:47 +0800 (CST)
From: "Andy Yan" <andyshrk@....com>
To: "Maxime Ripard" <mripard@...nel.org>
Cc: "Maarten Lankhorst" <maarten.lankhorst@...ux.intel.com>,
"Thomas Zimmermann" <tzimmermann@...e.de>,
"David Airlie" <airlied@...il.com>,
"Daniel Vetter" <daniel@...ll.ch>,
"Jonathan Corbet" <corbet@....net>,
"Sandy Huang" <hjc@...k-chips.com>,
Heiko Stübner <heiko@...ech.de>,
"Chen-Yu Tsai" <wens@...e.org>,
"Jernej Skrabec" <jernej.skrabec@...il.com>,
"Samuel Holland" <samuel@...lland.org>,
"Andy Yan" <andy.yan@...k-chips.com>,
"Hans Verkuil" <hverkuil@...all.nl>,
"Sebastian Wick" <sebastian.wick@...hat.com>,
Ville Syrjälä <ville.syrjala@...ux.intel.com>,
dri-devel@...ts.freedesktop.org,
linux-arm-kernel@...ts.infradead.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
linux-rockchip@...ts.infradead.org, linux-sunxi@...ts.linux.dev
Subject: Re:[PATCH v13 27/28] drm/rockchip: inno_hdmi: Switch to HDMI
connector
Hi Maxime,
At 2024-05-07 21:17:45, "Maxime Ripard" <mripard@...nel.org> wrote:
>The new HDMI connector infrastructure allows to remove some boilerplate,
>especially to generate infoframes. Let's switch to it.
>
>Reviewed-by: Heiko Stuebner <heiko@...ech.de>
>Acked-by: Heiko Stuebner <heiko@...ech.de>
>Signed-off-by: Maxime Ripard <mripard@...nel.org>
>---
> drivers/gpu/drm/rockchip/Kconfig | 3 +
> drivers/gpu/drm/rockchip/inno_hdmi.c | 153 ++++++++++++---------------------
> drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 3 +
> 3 files changed, 61 insertions(+), 98 deletions(-)
>
>diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
>index 1bf3e2829cd0..7df875e38517 100644
>--- a/drivers/gpu/drm/rockchip/Kconfig
>+++ b/drivers/gpu/drm/rockchip/Kconfig
>@@ -72,10 +72,13 @@ config ROCKCHIP_DW_MIPI_DSI
> enable MIPI DSI on RK3288 or RK3399 based SoC, you should
> select this option.
>
> config ROCKCHIP_INNO_HDMI
> bool "Rockchip specific extensions for Innosilicon HDMI"
>+ select DRM_DISPLAY_HDMI_HELPER
>+ select DRM_DISPLAY_HDMI_STATE_HELPER
>+ select DRM_DISPLAY_HELPER
> help
> This selects support for Rockchip SoC specific extensions
> for the Innosilicon HDMI driver. If you want to enable
> HDMI on RK3036 based SoC, you should select this option.
>
>diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c
>index 3df2cfcf9998..5069403c3b80 100644
>--- a/drivers/gpu/drm/rockchip/inno_hdmi.c
>+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
>@@ -20,10 +20,13 @@
> #include <drm/drm_edid.h>
> #include <drm/drm_of.h>
> #include <drm/drm_probe_helper.h>
> #include <drm/drm_simple_kms_helper.h>
>
>+#include <drm/display/drm_hdmi_helper.h>
>+#include <drm/display/drm_hdmi_state_helper.h>
>+
......
>
> static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi)
> {
> struct drm_connector *connector = &hdmi->connector;
> struct drm_connector_state *conn_state = connector->state;
>@@ -359,12 +323,12 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi)
> value = v_VIDEO_INPUT_BITS(VIDEO_INPUT_8BITS) |
> v_VIDEO_OUTPUT_COLOR(0) |
> v_VIDEO_INPUT_CSP(0);
> hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL2, value);
>
>- if (inno_conn_state->enc_out_format == HDMI_COLORSPACE_RGB) {
>- if (inno_conn_state->rgb_limited_range) {
>+ if (conn_state->hdmi.output_format == HDMI_COLORSPACE_RGB) {
>+ if (conn_state->hdmi.is_limited_range) {
> csc_mode = CSC_RGB_0_255_TO_RGB_16_235_8BIT;
> auto_csc = AUTO_CSC_DISABLE;
> c0_c2_change = C0_C2_CHANGE_DISABLE;
> csc_enable = v_CSC_ENABLE;
>
>@@ -378,18 +342,18 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi)
> v_VIDEO_C0_C2_SWAP(C0_C2_CHANGE_DISABLE));
> return 0;
> }
> } else {
> if (inno_conn_state->colorimetry == HDMI_COLORIMETRY_ITU_601) {
>- if (inno_conn_state->enc_out_format == HDMI_COLORSPACE_YUV444) {
>+ if (conn_state->hdmi.output_format == HDMI_COLORSPACE_YUV444) {
> csc_mode = CSC_RGB_0_255_TO_ITU601_16_235_8BIT;
> auto_csc = AUTO_CSC_DISABLE;
> c0_c2_change = C0_C2_CHANGE_DISABLE;
> csc_enable = v_CSC_ENABLE;
> }
> } else {
>- if (inno_conn_state->enc_out_format == HDMI_COLORSPACE_YUV444) {
>+ if (conn_state->hdmi.output_format == HDMI_COLORSPACE_YUV444) {
> csc_mode = CSC_RGB_0_255_TO_ITU709_16_235_8BIT;
> auto_csc = AUTO_CSC_DISABLE;
> c0_c2_change = C0_C2_CHANGE_DISABLE;
> csc_enable = v_CSC_ENABLE;
> }
>@@ -460,14 +424,16 @@ static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi,
>
> return 0;
> }
>
> static int inno_hdmi_setup(struct inno_hdmi *hdmi,
>- struct drm_display_mode *mode)
>+ struct drm_crtc_state *new_crtc_state,
>+ struct drm_connector_state *new_conn_state)
> {
>- struct drm_display_info *display = &hdmi->connector.display_info;
>- unsigned long mpixelclock = mode->clock * 1000;
>+ struct drm_connector *connector = &hdmi->connector;
>+ struct drm_display_info *display = &connector->display_info;
>+ struct drm_display_mode *mode = &new_crtc_state->adjusted_mode;
>
> /* Mute video and audio output */
> hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK,
> v_AUDIO_MUTE(1) | v_VIDEO_MUTE(1));
>
>@@ -477,26 +443,26 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi,
>
> inno_hdmi_config_video_timing(hdmi, mode);
>
> inno_hdmi_config_video_csc(hdmi);
>
>- if (display->is_hdmi)
>- inno_hdmi_config_video_avi(hdmi, mode);
>+ drm_atomic_helper_connector_hdmi_update_infoframes(connector,
>+ new_conn_state->state);
>
new_conn_state->state will be set NULL in drm_atomic_helper_swap_state,
so this will cause a NULL pointer reference panic here.
> /*
> * When IP controller have configured to an accurate video
> * timing, then the TMDS clock source would be switched to
> * DCLK_LCDC, so we need to init the TMDS rate to mode pixel
> * clock rate, and reconfigure the DDC clock.
> */
>- inno_hdmi_i2c_init(hdmi, mpixelclock);
>+ inno_hdmi_i2c_init(hdmi, new_conn_state->hdmi.tmds_char_rate);
>
> /* Unmute video and audio output */
> hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK,
> v_AUDIO_MUTE(0) | v_VIDEO_MUTE(0));
>
>- inno_hdmi_power_up(hdmi, mpixelclock);
>+ inno_hdmi_power_up(hdmi, new_conn_state->hdmi.tmds_char_rate);
>
> return 0;
> }
>
>--
>2.45.0
>
>
>_______________________________________________
>linux-arm-kernel mailing list
>linux-arm-kernel@...ts.infradead.org
>http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Powered by blists - more mailing lists