Skip to content

Commit 7be390d

Browse files
Laurent Pinchartsravnborg
authored andcommitted
drm: bridge: dw-hdmi: Pass drm_display_info to dw_hdmi_support_scdc()
To prepare for making connector creation optional in the driver, pass the drm_display_info explicitly to dw_hdmi_support_scdc(). The pointer is passed to the callers where required, particularly to the dw_hdmi_phy_ops .init() function. 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-19-laurent.pinchart+renesas@ideasonboard.com
1 parent 9fbfa32 commit 7be390d

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

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

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,10 +1241,9 @@ void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data,
12411241
EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write);
12421242

12431243
/* Filter out invalid setups to avoid configuring SCDC and scrambling */
1244-
static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi)
1244+
static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi,
1245+
const struct drm_display_info *display)
12451246
{
1246-
struct drm_display_info *display = &hdmi->connector.display_info;
1247-
12481247
/* Completely disable SCDC support for older controllers */
12491248
if (hdmi->version < 0x200a)
12501249
return false;
@@ -1282,12 +1281,13 @@ static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi)
12821281
* helper should called right before enabling the TMDS Clock and Data in
12831282
* the PHY configuration callback.
12841283
*/
1285-
void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi)
1284+
void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi,
1285+
const struct drm_display_info *display)
12861286
{
12871287
unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock;
12881288

12891289
/* Control for TMDS Bit Period/TMDS Clock-Period Ratio */
1290-
if (dw_hdmi_support_scdc(hdmi)) {
1290+
if (dw_hdmi_support_scdc(hdmi, display)) {
12911291
if (mtmdsclock > HDMI14_MAX_TMDSCLK)
12921292
drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1);
12931293
else
@@ -1490,7 +1490,8 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi,
14901490
return 0;
14911491
}
14921492

1493-
static int hdmi_phy_configure(struct dw_hdmi *hdmi)
1493+
static int hdmi_phy_configure(struct dw_hdmi *hdmi,
1494+
const struct drm_display_info *display)
14941495
{
14951496
const struct dw_hdmi_phy_data *phy = hdmi->phy.data;
14961497
const struct dw_hdmi_plat_data *pdata = hdmi->plat_data;
@@ -1500,7 +1501,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi)
15001501

15011502
dw_hdmi_phy_power_off(hdmi);
15021503

1503-
dw_hdmi_set_high_tmds_clock_ratio(hdmi);
1504+
dw_hdmi_set_high_tmds_clock_ratio(hdmi, display);
15041505

15051506
/* Leave low power consumption mode by asserting SVSRET. */
15061507
if (phy->has_svsret)
@@ -1531,6 +1532,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi)
15311532
}
15321533

15331534
static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
1535+
const struct drm_display_info *display,
15341536
const struct drm_display_mode *mode)
15351537
{
15361538
int i, ret;
@@ -1540,7 +1542,7 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
15401542
dw_hdmi_phy_sel_data_en_pol(hdmi, 1);
15411543
dw_hdmi_phy_sel_interface_control(hdmi, 0);
15421544

1543-
ret = hdmi_phy_configure(hdmi);
1545+
ret = hdmi_phy_configure(hdmi, display);
15441546
if (ret)
15451547
return ret;
15461548
}
@@ -1846,10 +1848,11 @@ static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi)
18461848
}
18471849

18481850
static void hdmi_av_composer(struct dw_hdmi *hdmi,
1851+
const struct drm_display_info *display,
18491852
const struct drm_display_mode *mode)
18501853
{
18511854
u8 inv_val, bytes;
1852-
struct drm_hdmi_info *hdmi_info = &hdmi->connector.display_info.hdmi;
1855+
const struct drm_hdmi_info *hdmi_info = &display->hdmi;
18531856
struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode;
18541857
int hblank, vblank, h_de_hs, v_de_vs, hsync_len, vsync_len;
18551858
unsigned int vdisplay, hdisplay;
@@ -1882,7 +1885,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
18821885

18831886
/* Set up HDMI_FC_INVIDCONF */
18841887
inv_val = (hdmi->hdmi_data.hdcp_enable ||
1885-
(dw_hdmi_support_scdc(hdmi) &&
1888+
(dw_hdmi_support_scdc(hdmi, display) &&
18861889
(vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
18871890
hdmi_info->scdc.scrambling.low_rates)) ?
18881891
HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE :
@@ -1950,7 +1953,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
19501953
}
19511954

19521955
/* Scrambling Control */
1953-
if (dw_hdmi_support_scdc(hdmi)) {
1956+
if (dw_hdmi_support_scdc(hdmi, display)) {
19541957
if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
19551958
hdmi_info->scdc.scrambling.low_rates) {
19561959
/*
@@ -2116,6 +2119,7 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi)
21162119
static int dw_hdmi_setup(struct dw_hdmi *hdmi,
21172120
const struct drm_display_mode *mode)
21182121
{
2122+
struct drm_connector *connector = &hdmi->connector;
21192123
int ret;
21202124

21212125
hdmi_disable_overflow_interrupts(hdmi);
@@ -2161,10 +2165,12 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi,
21612165
hdmi->hdmi_data.video_mode.mdataenablepolarity = true;
21622166

21632167
/* HDMI Initialization Step B.1 */
2164-
hdmi_av_composer(hdmi, mode);
2168+
hdmi_av_composer(hdmi, &connector->display_info, mode);
21652169

21662170
/* HDMI Initializateion Step B.2 */
2167-
ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data, &hdmi->previous_mode);
2171+
ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data,
2172+
&connector->display_info,
2173+
&hdmi->previous_mode);
21682174
if (ret)
21692175
return ret;
21702176
hdmi->phy.enabled = true;

drivers/gpu/drm/meson/meson_dw_hdmi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ static void dw_hdmi_set_vclk(struct meson_dw_hdmi *dw_hdmi,
427427
}
428428

429429
static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
430+
const struct drm_display_info *display,
430431
const struct drm_display_mode *mode)
431432
{
432433
struct meson_dw_hdmi *dw_hdmi = (struct meson_dw_hdmi *)data;
@@ -496,7 +497,7 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
496497
/* Disable clock, fifo, fifo_wr */
497498
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0);
498499

499-
dw_hdmi_set_high_tmds_clock_ratio(hdmi);
500+
dw_hdmi_set_high_tmds_clock_ratio(hdmi, display);
500501

501502
msleep(100);
502503

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ static const struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_fun
312312
};
313313

314314
static int dw_hdmi_rockchip_genphy_init(struct dw_hdmi *dw_hdmi, void *data,
315+
const struct drm_display_info *display,
315316
const struct drm_display_mode *mode)
316317
{
317318
struct rockchip_hdmi *hdmi = (struct rockchip_hdmi *)data;

drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ static int sun8i_hdmi_phy_config_h3(struct dw_hdmi *hdmi,
341341
}
342342

343343
static int sun8i_hdmi_phy_config(struct dw_hdmi *hdmi, void *data,
344+
const struct drm_display_info *display,
344345
const struct drm_display_mode *mode)
345346
{
346347
struct sun8i_hdmi_phy *phy = (struct sun8i_hdmi_phy *)data;

include/drm/bridge/dw_hdmi.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ struct dw_hdmi_phy_config {
114114

115115
struct dw_hdmi_phy_ops {
116116
int (*init)(struct dw_hdmi *hdmi, void *data,
117+
const struct drm_display_info *display,
117118
const struct drm_display_mode *mode);
118119
void (*disable)(struct dw_hdmi *hdmi, void *data);
119120
enum drm_connector_status (*read_hpd)(struct dw_hdmi *hdmi, void *data);
@@ -174,7 +175,8 @@ void dw_hdmi_set_channel_status(struct dw_hdmi *hdmi, u8 *channel_status);
174175
void dw_hdmi_set_channel_allocation(struct dw_hdmi *hdmi, unsigned int ca);
175176
void dw_hdmi_audio_enable(struct dw_hdmi *hdmi);
176177
void dw_hdmi_audio_disable(struct dw_hdmi *hdmi);
177-
void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi);
178+
void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi,
179+
const struct drm_display_info *display);
178180

179181
/* PHY configuration */
180182
void dw_hdmi_phy_i2c_set_addr(struct dw_hdmi *hdmi, u8 address);

0 commit comments

Comments
 (0)