Commit 29bbb930 authored by Maxime Ripard's avatar Maxime Ripard

drm/vc4: hvs: Introduce a function to get the assigned FIFO

At boot time, if we detect that a pixelvalve has been enabled, we need to
be able to retrieve the HVS channel it has been assigned to so that we can
disable that channel too. Let's create that function that returns the FIFO
or an error from a given output.
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Tested-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
Tested-by: default avatarHoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/178192d90874559b8386139f2226e773347729fc.1599120059.git-series.maxime@cerno.tech
parent 50e9d6cb
......@@ -908,6 +908,7 @@ void vc4_irq_reset(struct drm_device *dev);
/* vc4_hvs.c */
extern struct platform_driver vc4_hvs_driver;
void vc4_hvs_stop_channel(struct drm_device *dev, unsigned int output);
int vc4_hvs_get_fifo_from_output(struct drm_device *dev, unsigned int output);
int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
void vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
......
......@@ -19,6 +19,7 @@
* each CRTC.
*/
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/component.h>
#include <linux/platform_device.h>
......@@ -196,6 +197,59 @@ static void vc4_hvs_update_gamma_lut(struct drm_crtc *crtc)
vc4_hvs_lut_load(crtc);
}
int vc4_hvs_get_fifo_from_output(struct drm_device *dev, unsigned int output)
{
struct vc4_dev *vc4 = to_vc4_dev(dev);
u32 reg;
int ret;
if (!vc4->hvs->hvs5)
return output;
switch (output) {
case 0:
return 0;
case 1:
return 1;
case 2:
reg = HVS_READ(SCALER_DISPECTRL);
ret = FIELD_GET(SCALER_DISPECTRL_DSP2_MUX_MASK, reg);
if (ret == 0)
return 2;
return 0;
case 3:
reg = HVS_READ(SCALER_DISPCTRL);
ret = FIELD_GET(SCALER_DISPCTRL_DSP3_MUX_MASK, reg);
if (ret == 3)
return -EPIPE;
return ret;
case 4:
reg = HVS_READ(SCALER_DISPEOLN);
ret = FIELD_GET(SCALER_DISPEOLN_DSP4_MUX_MASK, reg);
if (ret == 3)
return -EPIPE;
return ret;
case 5:
reg = HVS_READ(SCALER_DISPDITHER);
ret = FIELD_GET(SCALER_DISPDITHER_DSP5_MUX_MASK, reg);
if (ret == 3)
return -EPIPE;
return ret;
default:
return -EPIPE;
}
}
static int vc4_hvs_init_channel(struct vc4_dev *vc4, struct drm_crtc *crtc,
struct drm_display_mode *mode, bool oneshot)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment