Skip to content

Commit 551c818

Browse files
committed
Merge branch 'drm-misc-fixes' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
(I've pulled from a non-tag to get the ttm regression fix) drm-misc-fixes-2021-02-10: * dp_mst: Don't report un-attached ports as connected * sun4i: tcon1 sync polarity fix; Always set HDMI clock rate; Fix H6 HDMI PHY config; Fix H6 max frequency * vc4: Fix buffer overflow * xlnx: Fix memory leak * ttm: page pool regression fix. Signed-off-by: Dave Airlie <[email protected]> From: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/YCPo6g3gDxD3P//h@linux-uq9g
2 parents 0594bc7 + 811ee9d commit 551c818

File tree

9 files changed

+75
-37
lines changed

9 files changed

+75
-37
lines changed

drivers/gpu/drm/drm_dp_mst_topology.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4224,6 +4224,7 @@ drm_dp_mst_detect_port(struct drm_connector *connector,
42244224

42254225
switch (port->pdt) {
42264226
case DP_PEER_DEVICE_NONE:
4227+
break;
42274228
case DP_PEER_DEVICE_MST_BRANCHING:
42284229
if (!port->mcs)
42294230
ret = connector_status_connected;

drivers/gpu/drm/sun4i/sun4i_tcon.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,30 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
689689
SUN4I_TCON1_BASIC5_V_SYNC(vsync) |
690690
SUN4I_TCON1_BASIC5_H_SYNC(hsync));
691691

692+
/* Setup the polarity of multiple signals */
693+
if (tcon->quirks->polarity_in_ch0) {
694+
val = 0;
695+
696+
if (mode->flags & DRM_MODE_FLAG_PHSYNC)
697+
val |= SUN4I_TCON0_IO_POL_HSYNC_POSITIVE;
698+
699+
if (mode->flags & DRM_MODE_FLAG_PVSYNC)
700+
val |= SUN4I_TCON0_IO_POL_VSYNC_POSITIVE;
701+
702+
regmap_write(tcon->regs, SUN4I_TCON0_IO_POL_REG, val);
703+
} else {
704+
/* according to vendor driver, this bit must be always set */
705+
val = SUN4I_TCON1_IO_POL_UNKNOWN;
706+
707+
if (mode->flags & DRM_MODE_FLAG_PHSYNC)
708+
val |= SUN4I_TCON1_IO_POL_HSYNC_POSITIVE;
709+
710+
if (mode->flags & DRM_MODE_FLAG_PVSYNC)
711+
val |= SUN4I_TCON1_IO_POL_VSYNC_POSITIVE;
712+
713+
regmap_write(tcon->regs, SUN4I_TCON1_IO_POL_REG, val);
714+
}
715+
692716
/* Map output pins to channel 1 */
693717
regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG,
694718
SUN4I_TCON_GCTL_IOMAP_MASK,
@@ -1517,6 +1541,7 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = {
15171541

15181542
static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = {
15191543
.has_channel_1 = true,
1544+
.polarity_in_ch0 = true,
15201545
.set_mux = sun8i_r40_tcon_tv_set_mux,
15211546
};
15221547

drivers/gpu/drm/sun4i/sun4i_tcon.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@
153153
#define SUN4I_TCON1_BASIC5_V_SYNC(height) (((height) - 1) & 0x3ff)
154154

155155
#define SUN4I_TCON1_IO_POL_REG 0xf0
156+
/* there is no documentation about this bit */
157+
#define SUN4I_TCON1_IO_POL_UNKNOWN BIT(26)
158+
#define SUN4I_TCON1_IO_POL_HSYNC_POSITIVE BIT(25)
159+
#define SUN4I_TCON1_IO_POL_VSYNC_POSITIVE BIT(24)
160+
156161
#define SUN4I_TCON1_IO_TRI_REG 0xf4
157162

158163
#define SUN4I_TCON_ECC_FIFO_REG 0xf8
@@ -235,6 +240,7 @@ struct sun4i_tcon_quirks {
235240
bool needs_de_be_mux; /* sun6i needs mux to select backend */
236241
bool needs_edp_reset; /* a80 edp reset needed for tcon0 access */
237242
bool supports_lvds; /* Does the TCON support an LVDS output? */
243+
bool polarity_in_ch0; /* some tcon1 channels have polarity bits in tcon0 pol register */
238244
u8 dclk_min_div; /* minimum divider for TCON0 DCLK */
239245

240246
/* callback to handle tcon muxing options */

drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ static void sun8i_dw_hdmi_encoder_mode_set(struct drm_encoder *encoder,
2121
{
2222
struct sun8i_dw_hdmi *hdmi = encoder_to_sun8i_dw_hdmi(encoder);
2323

24-
if (hdmi->quirks->set_rate)
25-
clk_set_rate(hdmi->clk_tmds, mode->crtc_clock * 1000);
24+
clk_set_rate(hdmi->clk_tmds, mode->crtc_clock * 1000);
2625
}
2726

2827
static const struct drm_encoder_helper_funcs
@@ -48,11 +47,9 @@ sun8i_dw_hdmi_mode_valid_h6(struct dw_hdmi *hdmi, void *data,
4847
{
4948
/*
5049
* Controller support maximum of 594 MHz, which correlates to
51-
* 4K@60Hz 4:4:4 or RGB. However, for frequencies greater than
52-
* 340 MHz scrambling has to be enabled. Because scrambling is
53-
* not yet implemented, just limit to 340 MHz for now.
50+
* 4K@60Hz 4:4:4 or RGB.
5451
*/
55-
if (mode->clock > 340000)
52+
if (mode->clock > 594000)
5653
return MODE_CLOCK_HIGH;
5754

5855
return MODE_OK;
@@ -295,7 +292,6 @@ static int sun8i_dw_hdmi_remove(struct platform_device *pdev)
295292

296293
static const struct sun8i_dw_hdmi_quirks sun8i_a83t_quirks = {
297294
.mode_valid = sun8i_dw_hdmi_mode_valid_a83t,
298-
.set_rate = true,
299295
};
300296

301297
static const struct sun8i_dw_hdmi_quirks sun50i_h6_quirks = {

drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ struct sun8i_dw_hdmi_quirks {
179179
enum drm_mode_status (*mode_valid)(struct dw_hdmi *hdmi, void *data,
180180
const struct drm_display_info *info,
181181
const struct drm_display_mode *mode);
182-
unsigned int set_rate : 1;
183182
unsigned int use_drm_infoframe : 1;
184183
};
185184

drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,29 +104,21 @@ static const struct dw_hdmi_mpll_config sun50i_h6_mpll_cfg[] = {
104104

105105
static const struct dw_hdmi_curr_ctrl sun50i_h6_cur_ctr[] = {
106106
/* pixelclk bpp8 bpp10 bpp12 */
107-
{ 25175000, { 0x0000, 0x0000, 0x0000 }, },
108107
{ 27000000, { 0x0012, 0x0000, 0x0000 }, },
109-
{ 59400000, { 0x0008, 0x0008, 0x0008 }, },
110-
{ 72000000, { 0x0008, 0x0008, 0x001b }, },
111-
{ 74250000, { 0x0013, 0x0013, 0x0013 }, },
112-
{ 90000000, { 0x0008, 0x001a, 0x001b }, },
113-
{ 118800000, { 0x001b, 0x001a, 0x001b }, },
114-
{ 144000000, { 0x001b, 0x001a, 0x0034 }, },
115-
{ 180000000, { 0x001b, 0x0033, 0x0034 }, },
116-
{ 216000000, { 0x0036, 0x0033, 0x0034 }, },
117-
{ 237600000, { 0x0036, 0x0033, 0x001b }, },
118-
{ 288000000, { 0x0036, 0x001b, 0x001b }, },
119-
{ 297000000, { 0x0019, 0x001b, 0x0019 }, },
120-
{ 330000000, { 0x0036, 0x001b, 0x001b }, },
121-
{ 594000000, { 0x003f, 0x001b, 0x001b }, },
108+
{ 74250000, { 0x0013, 0x001a, 0x001b }, },
109+
{ 148500000, { 0x0019, 0x0033, 0x0034 }, },
110+
{ 297000000, { 0x0019, 0x001b, 0x001b }, },
111+
{ 594000000, { 0x0010, 0x001b, 0x001b }, },
122112
{ ~0UL, { 0x0000, 0x0000, 0x0000 }, }
123113
};
124114

125115
static const struct dw_hdmi_phy_config sun50i_h6_phy_config[] = {
126116
/*pixelclk symbol term vlev*/
127-
{ 74250000, 0x8009, 0x0004, 0x0232},
128-
{ 148500000, 0x8029, 0x0004, 0x0273},
129-
{ 594000000, 0x8039, 0x0004, 0x014a},
117+
{ 27000000, 0x8009, 0x0007, 0x02b0 },
118+
{ 74250000, 0x8009, 0x0006, 0x022d },
119+
{ 148500000, 0x8029, 0x0006, 0x0270 },
120+
{ 297000000, 0x8039, 0x0005, 0x01ab },
121+
{ 594000000, 0x8029, 0x0000, 0x008a },
130122
{ ~0UL, 0x0000, 0x0000, 0x0000}
131123
};
132124

drivers/gpu/drm/ttm/ttm_pool.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include <linux/module.h>
3535
#include <linux/dma-mapping.h>
36+
#include <linux/highmem.h>
3637

3738
#ifdef CONFIG_X86
3839
#include <asm/set_memory.h>
@@ -218,6 +219,15 @@ static void ttm_pool_unmap(struct ttm_pool *pool, dma_addr_t dma_addr,
218219
/* Give pages into a specific pool_type */
219220
static void ttm_pool_type_give(struct ttm_pool_type *pt, struct page *p)
220221
{
222+
unsigned int i, num_pages = 1 << pt->order;
223+
224+
for (i = 0; i < num_pages; ++i) {
225+
if (PageHighMem(p))
226+
clear_highpage(p + i);
227+
else
228+
clear_page(page_address(p + i));
229+
}
230+
221231
spin_lock(&pt->lock);
222232
list_add(&p->lru, &pt->pages);
223233
spin_unlock(&pt->lock);

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static void vc4_plane_reset(struct drm_plane *plane)
220220
__drm_atomic_helper_plane_reset(plane, &vc4_state->base);
221221
}
222222

223-
static void vc4_dlist_write(struct vc4_plane_state *vc4_state, u32 val)
223+
static void vc4_dlist_counter_increment(struct vc4_plane_state *vc4_state)
224224
{
225225
if (vc4_state->dlist_count == vc4_state->dlist_size) {
226226
u32 new_size = max(4u, vc4_state->dlist_count * 2);
@@ -235,7 +235,15 @@ static void vc4_dlist_write(struct vc4_plane_state *vc4_state, u32 val)
235235
vc4_state->dlist_size = new_size;
236236
}
237237

238-
vc4_state->dlist[vc4_state->dlist_count++] = val;
238+
vc4_state->dlist_count++;
239+
}
240+
241+
static void vc4_dlist_write(struct vc4_plane_state *vc4_state, u32 val)
242+
{
243+
unsigned int idx = vc4_state->dlist_count;
244+
245+
vc4_dlist_counter_increment(vc4_state);
246+
vc4_state->dlist[idx] = val;
239247
}
240248

241249
/* Returns the scl0/scl1 field based on whether the dimensions need to
@@ -978,8 +986,10 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
978986
* be set when calling vc4_plane_allocate_lbm().
979987
*/
980988
if (vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
981-
vc4_state->y_scaling[1] != VC4_SCALING_NONE)
982-
vc4_state->lbm_offset = vc4_state->dlist_count++;
989+
vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
990+
vc4_state->lbm_offset = vc4_state->dlist_count;
991+
vc4_dlist_counter_increment(vc4_state);
992+
}
983993

984994
if (num_planes > 1) {
985995
/* Emit Cb/Cr as channel 0 and Y as channel

drivers/gpu/drm/xlnx/zynqmp_disp.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,19 +1396,11 @@ static void zynqmp_disp_enable(struct zynqmp_disp *disp)
13961396
*/
13971397
static void zynqmp_disp_disable(struct zynqmp_disp *disp)
13981398
{
1399-
struct drm_crtc *crtc = &disp->crtc;
1400-
14011399
zynqmp_disp_audio_disable(&disp->audio);
14021400

14031401
zynqmp_disp_avbuf_disable_audio(&disp->avbuf);
14041402
zynqmp_disp_avbuf_disable_channels(&disp->avbuf);
14051403
zynqmp_disp_avbuf_disable(&disp->avbuf);
1406-
1407-
/* Mark the flip is done as crtc is disabled anyway */
1408-
if (crtc->state->event) {
1409-
complete_all(crtc->state->event->base.completion);
1410-
crtc->state->event = NULL;
1411-
}
14121404
}
14131405

14141406
static inline struct zynqmp_disp *crtc_to_disp(struct drm_crtc *crtc)
@@ -1499,6 +1491,13 @@ zynqmp_disp_crtc_atomic_disable(struct drm_crtc *crtc,
14991491

15001492
drm_crtc_vblank_off(&disp->crtc);
15011493

1494+
spin_lock_irq(&crtc->dev->event_lock);
1495+
if (crtc->state->event) {
1496+
drm_crtc_send_vblank_event(crtc, crtc->state->event);
1497+
crtc->state->event = NULL;
1498+
}
1499+
spin_unlock_irq(&crtc->dev->event_lock);
1500+
15021501
clk_disable_unprepare(disp->pclk);
15031502
pm_runtime_put_sync(disp->dev);
15041503
}

0 commit comments

Comments
 (0)