hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
....@@ -422,14 +422,18 @@
422422
423423 if (hdmi->bridge.dev) {
424424 bool change;
425
+ void *data = hdmi->plat_data->phy_data;
425426
426427 change = drm_helper_hpd_irq_event(hdmi->bridge.dev);
427428
428
- if (change && hdmi->cec_adap &&
429
- hdmi->cec_adap->devnode.registered)
430
- cec_queue_pin_hpd_event(hdmi->cec_adap,
431
- hdmi->hpd_state,
432
- ktime_get());
429
+ if (change) {
430
+ if (hdmi->plat_data->set_ddc_io)
431
+ hdmi->plat_data->set_ddc_io(data, hdmi->hpd_state);
432
+ if (hdmi->cec_adap->devnode.registered)
433
+ cec_queue_pin_hpd_event(hdmi->cec_adap,
434
+ hdmi->hpd_state,
435
+ ktime_get());
436
+ }
433437 drm_bridge_hpd_notify(&hdmi->bridge, status);
434438 }
435439 }
....@@ -535,10 +539,12 @@
535539 hdmi_writeb(hdmi, HDMI_IH_I2CM_STAT0_ERROR | HDMI_IH_I2CM_STAT0_DONE,
536540 HDMI_IH_MUTE_I2CM_STAT0);
537541
538
- /* set SDA high level holding time */
539
- hdmi_writeb(hdmi, 0x48, HDMI_I2CM_SDA_HOLD);
540
-
541
- dw_hdmi_i2c_set_divs(hdmi);
542
+ /* Only configure when we use the internal I2C controller */
543
+ if (hdmi->i2c) {
544
+ /* set SDA high level holding time */
545
+ hdmi_writeb(hdmi, 0x48, HDMI_I2CM_SDA_HOLD);
546
+ dw_hdmi_i2c_set_divs(hdmi);
547
+ }
542548 }
543549
544550 static bool dw_hdmi_i2c_unwedge(struct dw_hdmi *hdmi)
....@@ -643,11 +649,7 @@
643649
644650 while (retry > 0) {
645651 if (!(hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD)) {
646
- void *data = hdmi->plat_data->phy_data;
647
-
648652 dev_dbg(hdmi->dev, "hdmi disconnect, stop ddc read\n");
649
- if (hdmi->plat_data->set_ddc_io)
650
- hdmi->plat_data->set_ddc_io(data, false);
651653 return -EPERM;
652654 }
653655
....@@ -726,11 +728,7 @@
726728
727729 while (retry > 0) {
728730 if (!(hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD)) {
729
- void *data = hdmi->plat_data->phy_data;
730
-
731731 dev_dbg(hdmi->dev, "hdmi disconnect, stop ddc write\n");
732
- if (hdmi->plat_data->set_ddc_io)
733
- hdmi->plat_data->set_ddc_io(data, false);
734732 return -EPERM;
735733 }
736734
....@@ -775,7 +773,6 @@
775773 struct dw_hdmi *hdmi = i2c_get_adapdata(adap);
776774 struct dw_hdmi_i2c *i2c = hdmi->i2c;
777775 u8 addr = msgs[0].addr;
778
- void *data = hdmi->plat_data->phy_data;
779776 int i, ret = 0;
780777
781778 if (addr == DDC_CI_ADDR)
....@@ -799,9 +796,6 @@
799796 }
800797
801798 mutex_lock(&i2c->lock);
802
-
803
- if (hdmi->plat_data->set_ddc_io)
804
- hdmi->plat_data->set_ddc_io(data, true);
805799
806800 hdmi_writeb(hdmi, 0, HDMI_I2CM_SOFTRSTZ);
807801 udelay(100);
....@@ -2425,9 +2419,6 @@
24252419
24262420 vmode->previous_pixelclock = vmode->mpixelclock;
24272421 vmode->mpixelclock = mode->crtc_clock * 1000;
2428
- if ((mode->flags & DRM_MODE_FLAG_3D_MASK) ==
2429
- DRM_MODE_FLAG_3D_FRAME_PACKING)
2430
- vmode->mpixelclock *= 2;
24312422 dev_dbg(hdmi->dev, "final pixclk = %d\n", vmode->mpixelclock);
24322423
24332424 vmode->previous_tmdsclock = vmode->mtmdsclock;
....@@ -3993,7 +3984,6 @@
39933984 struct drm_bridge_state *old_state)
39943985 {
39953986 struct dw_hdmi *hdmi = bridge->driver_private;
3996
- void *data = hdmi->plat_data->phy_data;
39973987
39983988 mutex_lock(&hdmi->mutex);
39993989 hdmi->disabled = true;
....@@ -4004,11 +3994,6 @@
40043994 if (hdmi->plat_data->dclk_set)
40053995 hdmi->plat_data->dclk_set(hdmi->plat_data->phy_data, false, 0);
40063996 mutex_unlock(&hdmi->mutex);
4007
-
4008
- mutex_lock(&hdmi->i2c->lock);
4009
- if (hdmi->plat_data->set_ddc_io)
4010
- hdmi->plat_data->set_ddc_io(data, false);
4011
- mutex_unlock(&hdmi->i2c->lock);
40123997 }
40133998
40143999 static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge,
....@@ -4338,8 +4323,7 @@
43384323 * Even if we are using a separate i2c adapter doing this doesn't
43394324 * hurt.
43404325 */
4341
- if (hdmi->i2c)
4342
- dw_hdmi_i2c_init(hdmi);
4326
+ dw_hdmi_i2c_init(hdmi);
43434327
43444328 if (hdmi->phy.ops->setup_hpd)
43454329 hdmi->phy.ops->setup_hpd(hdmi, hdmi->phy.data);
....@@ -5008,6 +4992,7 @@
50084992 audio.get_eld = hdmi_audio_get_eld;
50094993 audio.write = hdmi_writeb;
50104994 audio.read = hdmi_readb;
4995
+ audio.mod = hdmi_modb;
50114996 hdmi->enable_audio = dw_hdmi_i2s_audio_enable;
50124997 hdmi->disable_audio = dw_hdmi_i2s_audio_disable;
50134998
....@@ -5227,8 +5212,7 @@
52275212 pinctrl_pm_select_default_state(hdmi->dev);
52285213 mutex_lock(&hdmi->mutex);
52295214 dw_hdmi_reg_initial(hdmi);
5230
- if (hdmi->i2c)
5231
- dw_hdmi_i2c_init(hdmi);
5215
+ dw_hdmi_i2c_init(hdmi);
52325216 if (hdmi->irq)
52335217 enable_irq(hdmi->irq);
52345218 /*