Skip to content

Commit 2bd2afe

Browse files
6by9pelwell
authored andcommitted
drm/vc4: PV1 can be driven via any HVS channel, so adapt to allow it
It was noted that if PV1 was in use to drive DSI1, then the writeback connector could not be used as HVS channel 2 was already in use. The HVS allows PV1 (HVS output 2) to be driven by any HVS channel via the DSP3_MUX setting, but that was hardcoded to be either 2 (for PV1) or disabled for TXP. Expand the available channels field for PV1, and configure DSP3_MUX accordingly. Signed-off-by: Dave Stevenson <[email protected]>
1 parent 2071c30 commit 2bd2afe

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

Diff for: drivers/gpu/drm/vc4/vc4_crtc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ const struct vc4_pv_data bcm2835_pv1_data = {
12231223
.base = {
12241224
.name = "pixelvalve-1",
12251225
.debugfs_name = "crtc1_regs",
1226-
.hvs_available_channels = BIT(2),
1226+
.hvs_available_channels = BIT(0) | BIT(1) | BIT(2),
12271227
.hvs_output = 2,
12281228
},
12291229
.fifo_depth = 64,

Diff for: drivers/gpu/drm/vc4/vc4_kms.c

+15-14
Original file line numberDiff line numberDiff line change
@@ -224,39 +224,40 @@ static void vc4_hvs_pv_muxing_commit(struct vc4_dev *vc4,
224224
struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
225225
struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc_state);
226226
u32 dispctrl;
227-
u32 dsp3_mux_pri;
228227

229228
if (!crtc_state->active)
230229
continue;
231230

232-
if (vc4_state->assigned_channel != 2)
231+
if (vc4_crtc->data->hvs_output != 2)
233232
continue;
234233

235234
/*
236235
* SCALER_DISPCTRL_DSP3 = X, where X < 2 means 'connect DSP3 to
237236
* FIFO X'.
238237
* SCALER_DISPCTRL_DSP3 = 3 means 'disable DSP 3'.
239238
*
240-
* DSP3 is connected to FIFO2 unless the transposer is
241-
* enabled. In this case, FIFO 2 is directly accessed by the
242-
* TXP IP, and we need to disable the FIFO2 -> pixelvalve1
243-
* route.
239+
* It is more likely that we want the TXP than 3 displays, so
240+
* handle the mapping of DSP3 to any available FIFO.
244241
*
245242
* TXP can also run with a lower panic level than a live display,
246243
* as it doesn't have the same real-time constraint.
247244
*/
245+
dispctrl = HVS_READ(SCALER_DISPCTRL) &
246+
~SCALER_DISPCTRL_PANIC2_MASK;
247+
248248
if (vc4_crtc->feeds_txp) {
249-
dsp3_mux_pri = VC4_SET_FIELD(3, SCALER_DISPCTRL_DSP3_MUX);
250-
dsp3_mux_pri |= VC4_SET_FIELD(0, SCALER_DISPCTRL_PANIC2);
249+
dispctrl |= VC4_SET_FIELD(0, SCALER_DISPCTRL_PANIC2);
250+
drm_WARN_ON(&vc4->base,
251+
VC4_GET_FIELD(HVS_READ(SCALER_DISPCTRL),
252+
SCALER_DISPCTRL_DSP3_MUX) == 2);
251253
} else {
252-
dsp3_mux_pri = VC4_SET_FIELD(2, SCALER_DISPCTRL_DSP3_MUX);
253-
dsp3_mux_pri |= VC4_SET_FIELD(2, SCALER_DISPCTRL_PANIC2);
254+
dispctrl &= ~SCALER_DISPCTRL_DSP3_MUX_MASK;
255+
dispctrl |= VC4_SET_FIELD(vc4_state->assigned_channel,
256+
SCALER_DISPCTRL_DSP3_MUX);
257+
dispctrl |= VC4_SET_FIELD(2, SCALER_DISPCTRL_PANIC2);
254258
}
255259

256-
dispctrl = HVS_READ(SCALER_DISPCTRL) &
257-
~(SCALER_DISPCTRL_DSP3_MUX_MASK |
258-
SCALER_DISPCTRL_PANIC2_MASK);
259-
HVS_WRITE(SCALER_DISPCTRL, dispctrl | dsp3_mux_pri);
260+
HVS_WRITE(SCALER_DISPCTRL, dispctrl);
260261
}
261262
}
262263

0 commit comments

Comments
 (0)