drm/rockchip: vop: update VOP_GRF_SET() func to support different grf domains

Change-Id: Ibafb0458d13ab4b8c397e888fff1e43266777a79
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
This commit is contained in:
Damon Ding
2024-01-29 15:40:00 +08:00
committed by Tao Huang
parent 039fcfd05c
commit ba3a77c3b7
3 changed files with 21 additions and 22 deletions

View File

@@ -145,10 +145,10 @@
#define VOP_WIN_TO_INDEX(vop_win) \
((vop_win) - (vop_win)->vop->win)
#define VOP_GRF_SET(vop, reg, v) \
#define VOP_GRF_SET(vop, grf, reg, v) \
do { \
if (vop->data->grf_ctrl) { \
vop_grf_writel(vop, vop->data->grf_ctrl->reg, v); \
if (vop->data->grf) { \
vop_grf_writel(vop->grf, vop->data->grf->reg, v); \
} \
} while (0)
@@ -355,16 +355,16 @@ static void vop_unlock(struct vop *vop)
mutex_unlock(&vop->vop_lock);
}
static inline void vop_grf_writel(struct vop *vop, struct vop_reg reg, u32 v)
static inline void vop_grf_writel(struct regmap *regmap, struct vop_reg reg, u32 v)
{
u32 val = 0;
if (IS_ERR_OR_NULL(vop->grf))
if (IS_ERR_OR_NULL(regmap))
return;
if (VOP_REG_SUPPORT(vop, reg)) {
if (reg.mask) {
val = (v << reg.shift) | (reg.mask << (reg.shift + 16));
regmap_write(vop->grf, reg.offset, val);
regmap_write(regmap, reg.offset, val);
}
}
@@ -1657,7 +1657,7 @@ static void vop_initial(struct drm_crtc *crtc)
vop_enable_debug_irq(crtc);
if (vop->version == VOP_VERSION(2, 0xd)) {
VOP_GRF_SET(vop, grf_vopl_sel, 1);
VOP_GRF_SET(vop, grf, grf_vopl_sel, 1);
VOP_CTRL_SET(vop, enable, 1);
}
}
@@ -3559,7 +3559,7 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc,
VOP_CTRL_SET(vop, lvds_en, 1);
VOP_CTRL_SET(vop, lvds_pin_pol, val);
VOP_CTRL_SET(vop, lvds_dclk_pol, dclk_inv);
VOP_GRF_SET(vop, grf_dclk_inv, dclk_inv);
VOP_GRF_SET(vop, grf, grf_dclk_inv, dclk_inv);
if (s->output_if & VOP_OUTPUT_IF_BT1120) {
VOP_CTRL_SET(vop, bt1120_en, 1);
yc_swap = is_yc_swap(s->bus_format);
@@ -5254,10 +5254,9 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
if (IS_ERR(vop->lut_regs))
return PTR_ERR(vop->lut_regs);
}
vop->grf = syscon_regmap_lookup_by_phandle(dev->of_node,
"rockchip,grf");
if (IS_ERR(vop->grf))
dev_err(dev, "missing rockchip,grf property\n");
vop->grf = syscon_regmap_lookup_by_phandle_optional(dev->of_node, "rockchip,grf");
vop->hclk = devm_clk_get(vop->dev, "hclk_vop");
if (IS_ERR(vop->hclk)) {
dev_err(vop->dev, "failed to get hclk source\n");

View File

@@ -1229,7 +1229,7 @@ struct vop_data {
const struct vop_win_data *win;
const struct vop_csc_table *csc_table;
const struct vop_hdr_table *hdr_table;
const struct vop_grf_ctrl *grf_ctrl;
const struct vop_grf_ctrl *grf;
unsigned int win_size;
uint32_t version;
struct vop_rect max_input;

View File

@@ -423,7 +423,7 @@ static const struct vop_data rk3288_vop_big = {
.max_input = {4096, 8192},
.max_output = {3840, 2160},
.intr = &rk3288_vop_intr,
.grf_ctrl = &rk3288_vop_big_grf_ctrl,
.grf = &rk3288_vop_big_grf_ctrl,
.ctrl = &rk3288_ctrl_data,
.win = rk3288_vop_win_data,
.win_size = ARRAY_SIZE(rk3288_vop_win_data),
@@ -437,7 +437,7 @@ static const struct vop_data rk3288_vop_lit = {
.max_input = {4096, 8192},
.max_output = {2560, 1600},
.intr = &rk3288_vop_intr,
.grf_ctrl = &rk3288_vop_lit_grf_ctrl,
.grf = &rk3288_vop_lit_grf_ctrl,
.ctrl = &rk3288_ctrl_data,
.win = rk3288_vop_win_data,
.win_size = ARRAY_SIZE(rk3288_vop_win_data),
@@ -575,7 +575,7 @@ static const struct vop_data rk3366_vop = {
.max_input = {4096, 8192},
.max_output = {4096, 2160},
.intr = &rk3366_vop_intr,
.grf_ctrl = &rk3368_vop_grf_ctrl,
.grf = &rk3368_vop_grf_ctrl,
.ctrl = &rk3288_ctrl_data,
.win = rk3368_vop_win_data,
.win_size = ARRAY_SIZE(rk3368_vop_win_data),
@@ -1682,7 +1682,7 @@ static const struct vop_data px30_vop_lit = {
.max_output = {1920, 1080},
.ctrl = &px30_ctrl_data,
.intr = &rk3366_lit_intr,
.grf_ctrl = &px30_grf_ctrl,
.grf = &px30_grf_ctrl,
.win = px30_vop_lit_win_data,
.win_size = ARRAY_SIZE(px30_vop_lit_win_data),
};
@@ -1695,7 +1695,7 @@ static const struct vop_data px30_vop_big = {
.max_output = {1920, 1080},
.ctrl = &px30_ctrl_data,
.intr = &rk3366_lit_intr,
.grf_ctrl = &px30_grf_ctrl,
.grf = &px30_grf_ctrl,
.win = px30_vop_big_win_data,
.win_size = ARRAY_SIZE(px30_vop_big_win_data),
};
@@ -1899,7 +1899,7 @@ static const struct vop_data rv1126_vop = {
.max_output = {1920, 1080},
.ctrl = &rv1126_ctrl_data,
.intr = &rk3366_lit_intr,
.grf_ctrl = &rv1126_grf_ctrl,
.grf = &rv1126_grf_ctrl,
.win = rv1126_vop_win_data,
.win_size = ARRAY_SIZE(rv1126_vop_win_data),
};
@@ -1986,7 +1986,7 @@ static const struct vop_data rv1106_vop = {
.max_output = {1280, 1280},
.ctrl = &rv1106_ctrl_data,
.intr = &rk3366_lit_intr,
.grf_ctrl = &rv1106_grf_ctrl,
.grf = &rv1106_grf_ctrl,
.win = rv1106_vop_win_data,
.win_size = ARRAY_SIZE(rv1106_vop_win_data),
};
@@ -2108,7 +2108,7 @@ static const struct vop_data rk3576_vop_lit = {
.max_output = {1920, 1920},
.ctrl = &rk3576_lit_ctrl_data,
.intr = &rk3576_lit_intr,
.grf_ctrl = &rk3576_lit_grf_ctrl,
.grf = &rk3576_lit_grf_ctrl,
.win = rk3576_lit_win_data,
.win_size = ARRAY_SIZE(rk3576_lit_win_data),
};