media: rockchip: vicap add intr mask for bandwidth, and mask bandwidth err per second

Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: Ie07d0c4d25bfc962f25a0b4b38f36557814e4a62
This commit is contained in:
Zefa Chen
2023-11-17 17:30:39 +08:00
committed by Tao Huang
parent 1ccf851a69
commit d2233bb509
3 changed files with 24 additions and 1 deletions
+10 -1
View File
@@ -3670,6 +3670,7 @@ static int rkcif_csi_channel_set(struct rkcif_stream *stream,
val &= ~CSI_HIGH_ALIGN;
rkcif_write_register(dev, get_reg_index_of_id_ctrl0(channel->id), val);
dev->intr_mask = rkcif_read_register(dev, CIF_REG_MIPI_LVDS_INTEN);
return 0;
}
@@ -4058,6 +4059,7 @@ static int rkcif_csi_channel_set_v1(struct rkcif_stream *stream,
RKCIF_YUV_ADDR_STATE_INIT,
channel->id);
}
dev->intr_mask = rkcif_read_register(dev, CIF_REG_MIPI_LVDS_INTEN);
return 0;
}
@@ -6020,6 +6022,7 @@ static int rkcif_stream_start(struct rkcif_stream *stream, unsigned int mode)
rkcif_write_register(dev, CIF_REG_DVP_CTRL,
AXI_BURST_16 | workmode | ENABLE_CAPTURE);
}
dev->intr_mask = rkcif_read_register(dev, CIF_REG_DVP_INTSTAT);
#if IS_ENABLED(CONFIG_CPU_RV1106)
rv1106_sdmmc_put_lock();
#endif
@@ -11008,9 +11011,15 @@ void rkcif_irq_pingpong_v1(struct rkcif_device *cif_dev)
return;
}
if (intstat & CSI_BANDWIDTH_LACK_V1) {
if (intstat & CSI_BANDWIDTH_LACK_V1 &&
cif_dev->intr_mask & CSI_BANDWIDTH_LACK_V1) {
cif_dev->irq_stats.csi_bwidth_lack_cnt++;
cif_dev->err_state |= RKCIF_ERR_BANDWIDTH_LACK;
if (cif_dev->irq_stats.csi_bwidth_lack_cnt > 10) {
rkcif_write_register_and(cif_dev, CIF_REG_MIPI_LVDS_INTEN, ~(CSI_BANDWIDTH_LACK_V1));
cif_dev->intr_mask &= ~(CSI_BANDWIDTH_LACK_V1);
schedule_delayed_work(&cif_dev->work_deal_err, msecs_to_jiffies(1000));
}
}
if (intstat & CSI_ALL_ERROR_INTEN_V1) {
+12
View File
@@ -1924,6 +1924,17 @@ void rkcif_set_sensor_stream(struct work_struct *work)
&sensor_work->on);
}
static void rkcif_deal_err_intr(struct work_struct *work)
{
struct delayed_work *dwork = to_delayed_work(work);
struct rkcif_device *cif_dev = container_of(dwork,
struct rkcif_device,
work_deal_err);
cif_dev->intr_mask |= CSI_BANDWIDTH_LACK_V1;
rkcif_write_register_or(cif_dev, CIF_REG_MIPI_LVDS_INTEN, CSI_BANDWIDTH_LACK_V1);
}
int rkcif_plat_init(struct rkcif_device *cif_dev, struct device_node *node, int inf_id)
{
struct device *dev = cif_dev->dev;
@@ -1965,6 +1976,7 @@ int rkcif_plat_init(struct rkcif_device *cif_dev, struct device_node *node, int
INIT_WORK(&cif_dev->err_state_work.work, rkcif_err_print_work);
INIT_WORK(&cif_dev->sensor_work.work, rkcif_set_sensor_stream);
INIT_DELAYED_WORK(&cif_dev->work_deal_err, rkcif_deal_err_intr);
if (cif_dev->chip_id < CHIP_RV1126_CIF) {
if (cif_dev->inf_id == RKCIF_MIPI_LVDS) {
@@ -906,6 +906,8 @@ struct rkcif_device {
u32 share_mem_size;
u32 thunderboot_sensor_num;
int sensor_state;
u32 intr_mask;
struct delayed_work work_deal_err;
};
extern struct platform_driver rkcif_plat_drv;