mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
drm/rockchip: vop2: Set correct possible_crtcs for writeback connector
We only register used vp. So the registered crtcs may less than
the total vp on vop.
Fix warning:
[ 0.495636][ T1] Bogus possible_crtcs: [ENCODER:345:Virtual-345]
possible_crtcs=0x7 (full crtc mask=0x3)
[ 0.495681][ T1] WARNING: CPU: 0 PID: 1 at
drivers/gpu/drm/drm_mode_config.c:638
drm_mode_config_validate+0x1f0/0x2e8
[ 0.495697][ T1] Modules linked in:
[ 0.495717][ T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.43
[ 0.495730][ T1] Hardware name: Rockchip RK3568 EVB1 DDR4 V10
Board (DT)
[ 0.495741][ T1] pstate: 60800009 (nZCv daif -PAN +UAO -TCO
BTYPE=--)
[ 0.495751][ T1] pc : drm_mode_config_validate+0x1f0/0x2e8
[ 0.495765][ T1] lr : drm_mode_config_validate+0x1f0/0x2e8
[ 0.495777][ T1] sp : ffffffc01003b8c0
[ 0.495786][ T1] x29: ffffffc01003b8d0 x28: 0000000000000000
[ 0.495804][ T1] x27: ffffff8003b23580 x26: 0000000000000001
[ 0.495823][ T1] x25: 000000000000000f x24: ffffff8003bc2750
[ 0.495839][ T1] x23: ffffffc0114aa4b8 x22: ffffffc0114aa438
[ 0.495851][ T1] x21: ffffff8003bb4368 x20: ffffff8003bb4368
[ 0.495863][ T1] x19: ffffff8003bb4360 x18: ffffffffffffffff
[ 0.495879][ T1] x17: 0000000000049705 x16: 00000000000d42dc
[ 0.495896][ T1] x15: 0000000000000113 x14: ffffffc01003b550
[ 0.495911][ T1] x13: 00000000ffffffea x12: ffffffc011bbb7b0
[ 0.495928][ T1] x11: 0000000000000001 x10: 0000000000000001
[ 0.495945][ T1] x9 : 0000000000000003 x8 : ffffffc011a5b808
[ 0.495961][ T1] x7 : ffffffc011bbb808 x6 : c0000000ffffbfff
[ 0.495977][ T1] x5 : 000000000005ffe8 x4 : 0000000000000000
[ 0.495993][ T1] x3 : 00000000ffffffff x2 : ffffffc011a5b788
[ 0.496008][ T1] x1 : 4effea469dba5e00 x0 : 0000000000000000
[ 0.496026][ T1] Call trace:
[ 0.496041][ T1] drm_mode_config_validate+0x1f0/0x2e8
[ 0.496057][ T1] drm_dev_register+0x16c/0x1f0
[ 0.496074][ T1] rockchip_drm_bind+0x4f4/0x568
[ 0.496087][ T1] try_to_bring_up_master+0x15c/0x1c8
[ 0.496096][ T1] __component_add+0xb0/0x198
[ 0.496104][ T1] component_add+0x10/0x18
[ 0.496120][ T1] dw_mipi_dsi_rockchip_host_attach+0x28/0xd8
[ 0.496136][ T1] dw_mipi_dsi_host_attach+0xd0/0x120
[ 0.496149][ T1] mipi_dsi_attach+0x24/0x38
[ 0.496165][ T1] panel_simple_dsi_probe+0x94/0x1c8
[ 0.496180][ T1] mipi_dsi_drv_probe+0x1c/0x28
[ 0.496195][ T1] really_probe+0x20c/0x3e8
[ 0.496209][ T1] driver_probe_device+0x54/0xb8
[ 0.496224][ T1] device_driver_attach+0x6c/0x78
[ 0.496238][ T1] __driver_attach+0xb0/0xf0
[ 0.496253][ T1] bus_for_each_dev+0x68/0xc8
[ 0.496267][ T1] driver_attach+0x20/0x28
[ 0.496281][ T1] bus_add_driver+0x168/0x1f8
[ 0.496296][ T1] driver_register+0x60/0x110
[ 0.496311][ T1] mipi_dsi_driver_register_full+0x54/0x60
[ 0.496328][ T1] panel_simple_init+0x30/0x44
[ 0.496339][ T1] do_one_initcall+0x48/0x2d8
[ 0.496349][ T1] kernel_init_freeable+0x254/0x2c4
[ 0.496365][ T1] kernel_init+0x10/0x108
[ 0.496380][ T1] ret_from_fork+0x10/0x18
Fixes: d8d8a665cd ("drm/rockchip: vop2: Only register used vp to drm")
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Change-Id: I537b953d5597eeae70110e218892edca1e83a243
This commit is contained in:
@@ -2178,13 +2178,13 @@ static const struct drm_connector_helper_funcs vop2_wb_connector_helper_funcs =
|
||||
};
|
||||
|
||||
|
||||
static int vop2_wb_connector_init(struct vop2 *vop2)
|
||||
static int vop2_wb_connector_init(struct vop2 *vop2, int nr_crtcs)
|
||||
{
|
||||
const struct vop2_data *vop2_data = vop2->data;
|
||||
int ret;
|
||||
|
||||
vop2->wb.regs = vop2_data->wb->regs;
|
||||
vop2->wb.conn.encoder.possible_crtcs = (1 << vop2_data->nr_vps) - 1;
|
||||
vop2->wb.conn.encoder.possible_crtcs = (1 << nr_crtcs) - 1;
|
||||
spin_lock_init(&vop2->wb.job_lock);
|
||||
drm_connector_helper_add(&vop2->wb.conn.base, &vop2_wb_connector_helper_funcs);
|
||||
|
||||
@@ -6159,6 +6159,10 @@ static int vop2_crtc_create_plane_mask_property(struct vop2 *vop2,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns:
|
||||
* Registered crtc number on success, negative error code on failure.
|
||||
*/
|
||||
static int vop2_create_crtc(struct vop2 *vop2)
|
||||
{
|
||||
const struct vop2_data *vop2_data = vop2->data;
|
||||
@@ -6369,7 +6373,7 @@ static int vop2_create_crtc(struct vop2 *vop2)
|
||||
DRM_WARN("failed to init overlay plane %s\n", win->name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return registered_num_crtcs;
|
||||
}
|
||||
|
||||
static void vop2_destroy_crtc(struct drm_crtc *crtc)
|
||||
@@ -6524,6 +6528,7 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)
|
||||
size_t alloc_size;
|
||||
int ret, i;
|
||||
int num_wins = 0;
|
||||
int registered_num_crtcs;
|
||||
struct device_node *vop_out_node;
|
||||
|
||||
vop2_data = of_device_get_match_data(dev);
|
||||
@@ -6629,14 +6634,14 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = vop2_create_crtc(vop2);
|
||||
if (ret)
|
||||
return ret;
|
||||
registered_num_crtcs = vop2_create_crtc(vop2);
|
||||
if (registered_num_crtcs <= 0)
|
||||
return -ENODEV;
|
||||
ret = vop2_gamma_init(vop2);
|
||||
if (ret)
|
||||
return ret;
|
||||
vop2_cubic_lut_init(vop2);
|
||||
vop2_wb_connector_init(vop2);
|
||||
vop2_wb_connector_init(vop2, registered_num_crtcs);
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user