Skip to content

Commit 8198003

Browse files
Laurent Pinchartsravnborg
authored andcommitted
drm: bridge: dw-hdmi: Pass drm_connector to internal functions as needed
To prepare for making connector creation optional in the driver, pass the drm_connector explicitly to the internal functions that require it. The functions that still access the connector from the dw_hdmi structure are dw_hdmi_connector_create() and __dw_hdmi_probe(). The former access is expected, as that's where the internal connector is created. The latter will be addressed separately. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Sam Ravnborg <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-22-laurent.pinchart+renesas@ideasonboard.com
1 parent ca7b6b7 commit 8198003

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

drivers/gpu/drm/bridge/synopsys/dw-hdmi.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,18 +1632,17 @@ static void hdmi_tx_hdcp_config(struct dw_hdmi *hdmi)
16321632
}
16331633

16341634
static void hdmi_config_AVI(struct dw_hdmi *hdmi,
1635+
const struct drm_connector *connector,
16351636
const struct drm_display_mode *mode)
16361637
{
16371638
struct hdmi_avi_infoframe frame;
16381639
u8 val;
16391640

16401641
/* Initialise info frame from DRM mode */
1641-
drm_hdmi_avi_infoframe_from_display_mode(&frame,
1642-
&hdmi->connector, mode);
1642+
drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
16431643

16441644
if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) {
1645-
drm_hdmi_avi_infoframe_quant_range(&frame, &hdmi->connector,
1646-
mode,
1645+
drm_hdmi_avi_infoframe_quant_range(&frame, connector, mode,
16471646
hdmi->hdmi_data.rgb_limited_range ?
16481647
HDMI_QUANTIZATION_RANGE_LIMITED :
16491648
HDMI_QUANTIZATION_RANGE_FULL);
@@ -1760,14 +1759,14 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi,
17601759
}
17611760

17621761
static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi,
1762+
const struct drm_connector *connector,
17631763
const struct drm_display_mode *mode)
17641764
{
17651765
struct hdmi_vendor_infoframe frame;
17661766
u8 buffer[10];
17671767
ssize_t err;
17681768

1769-
err = drm_hdmi_vendor_infoframe_from_display_mode(&frame,
1770-
&hdmi->connector,
1769+
err = drm_hdmi_vendor_infoframe_from_display_mode(&frame, connector,
17711770
mode);
17721771
if (err < 0)
17731772
/*
@@ -1813,9 +1812,10 @@ static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi,
18131812
HDMI_FC_DATAUTO0_VSD_MASK);
18141813
}
18151814

1816-
static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi)
1815+
static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi,
1816+
const struct drm_connector *connector)
18171817
{
1818-
const struct drm_connector_state *conn_state = hdmi->connector.state;
1818+
const struct drm_connector_state *conn_state = connector->state;
18191819
struct hdmi_drm_infoframe frame;
18201820
u8 buffer[30];
18211821
ssize_t err;
@@ -2118,9 +2118,9 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi)
21182118
}
21192119

21202120
static int dw_hdmi_setup(struct dw_hdmi *hdmi,
2121+
const struct drm_connector *connector,
21212122
const struct drm_display_mode *mode)
21222123
{
2123-
struct drm_connector *connector = &hdmi->connector;
21242124
int ret;
21252125

21262126
hdmi_disable_overflow_interrupts(hdmi);
@@ -2192,9 +2192,9 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi,
21922192
dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__);
21932193

21942194
/* HDMI Initialization Step F - Configure AVI InfoFrame */
2195-
hdmi_config_AVI(hdmi, mode);
2196-
hdmi_config_vendor_specific_infoframe(hdmi, mode);
2197-
hdmi_config_drm_infoframe(hdmi);
2195+
hdmi_config_AVI(hdmi, connector, mode);
2196+
hdmi_config_vendor_specific_infoframe(hdmi, connector, mode);
2197+
hdmi_config_drm_infoframe(hdmi, connector);
21982198
} else {
21992199
dev_dbg(hdmi->dev, "%s DVI mode\n", __func__);
22002200
}
@@ -2263,7 +2263,12 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi *hdmi)
22632263
static void dw_hdmi_poweron(struct dw_hdmi *hdmi)
22642264
{
22652265
hdmi->bridge_is_on = true;
2266-
dw_hdmi_setup(hdmi, &hdmi->previous_mode);
2266+
2267+
/*
2268+
* The curr_conn field is guaranteed to be valid here, as this function
2269+
* is only be called when !hdmi->disabled.
2270+
*/
2271+
dw_hdmi_setup(hdmi, hdmi->curr_conn, &hdmi->previous_mode);
22672272
}
22682273

22692274
static void dw_hdmi_poweroff(struct dw_hdmi *hdmi)

0 commit comments

Comments
 (0)