media: rockchip: isp/ispp fix config of clk_dbg

Change-Id: I884474ffe2d5cf27600f20c4b8d005e317f3ec36
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
Cai YiWei
2021-01-18 10:00:59 +08:00
committed by Tao Huang
parent 8ad3589e44
commit fe63f20b12
8 changed files with 31 additions and 17 deletions

View File

@@ -35,6 +35,7 @@
#ifndef _RKISP_COMMON_H
#define _RKISP_COMMON_H
#include <linux/clk.h>
#include <linux/mutex.h>
#include <linux/media.h>
#include <media/media-device.h>
@@ -174,4 +175,6 @@ void rkisp_finish_buffer(struct rkisp_device *dev, struct rkisp_dummy_buffer *bu
int rkisp_attach_hw(struct rkisp_device *isp);
int rkisp_alloc_common_dummy_buf(struct rkisp_device *dev);
void rkisp_free_common_dummy_buf(struct rkisp_device *dev);
void rkisp_set_clk_rate(struct clk *clk, unsigned long rate);
#endif /* _RKISP_COMMON_H */

View File

@@ -74,6 +74,14 @@ MODULE_PARM_DESC(debug_reg, "rkisp debug register");
static DEFINE_MUTEX(rkisp_dev_mutex);
static LIST_HEAD(rkisp_device_list);
void rkisp_set_clk_rate(struct clk *clk, unsigned long rate)
{
if (rkisp_clk_dbg)
return;
clk_set_rate(clk, rate);
}
static int __maybe_unused __rkisp_clr_unready_dev(void)
{
struct rkisp_device *isp_dev;
@@ -154,9 +162,6 @@ static int __isp_pipeline_s_isp_clk(struct rkisp_pipeline *p)
u64 data_rate;
int i;
if (rkisp_clk_dbg)
return 0;
if (dev->isp_inp & (INP_RAWRD0 | INP_RAWRD1 | INP_RAWRD2 | INP_CIF)) {
for (i = 0; i < hw_dev->num_clk_rate_tbl; i++) {
if (w <= hw_dev->clk_rate_tbl[i].refer_data)
@@ -169,9 +174,8 @@ static int __isp_pipeline_s_isp_clk(struct rkisp_pipeline *p)
goto end;
}
if (dev->isp_inp == INP_DMARX_ISP) {
if (dev->hw_dev->clks[0])
clk_set_rate(hw_dev->clks[0], 400 * 1000000UL);
if (dev->isp_inp == INP_DMARX_ISP && dev->hw_dev->clks[0]) {
rkisp_set_clk_rate(hw_dev->clks[0], 400 * 1000000UL);
return 0;
}
@@ -211,7 +215,7 @@ static int __isp_pipeline_s_isp_clk(struct rkisp_pipeline *p)
i--;
end:
/* set isp clock rate */
clk_set_rate(hw_dev->clks[0], hw_dev->clk_rate_tbl[i].clk_rate * 1000000UL);
rkisp_set_clk_rate(hw_dev->clks[0], hw_dev->clk_rate_tbl[i].clk_rate * 1000000UL);
dev_dbg(hw_dev->dev, "set isp clk = %luHz\n", clk_get_rate(hw_dev->clks[0]));
return 0;

View File

@@ -604,8 +604,8 @@ static int enable_sys_clk(struct rkisp_hw_dev *dev)
}
}
clk_set_rate(dev->clks[0], dev->clk_rate_tbl[0].clk_rate * 1000000UL);
rkisp_set_clk_rate(dev->clks[0],
dev->clk_rate_tbl[0].clk_rate * 1000000UL);
rkisp_soft_reset(dev);
isp_config_clk(dev, true);

View File

@@ -4,6 +4,7 @@
#ifndef _RKISPP_COMMON_H
#define _RKISPP_COMMON_H
#include <linux/clk.h>
#include <linux/mutex.h>
#include <media/media-device.h>
#include <media/media-entity.h>
@@ -100,7 +101,6 @@ static inline struct vb2_queue *to_vb2_queue(struct file *file)
}
extern int rkispp_debug;
extern bool rkispp_clk_dbg;
extern bool rkispp_monitor;
extern bool rkispp_reg_withstream;
extern unsigned int rkispp_debug_reg;
@@ -130,4 +130,5 @@ int rkispp_find_regbuf_by_id(struct rkispp_device *ispp, struct rkisp_ispp_reg *
void rkispp_release_regbuf(struct rkispp_device *ispp, struct rkisp_ispp_reg *freebuf);
void rkispp_request_regbuf(struct rkispp_device *dev, struct rkisp_ispp_reg **free_buf);
bool rkispp_get_reg_withstream(void);
void rkispp_set_clk_rate(struct clk *clk, unsigned long rate);
#endif

View File

@@ -27,7 +27,7 @@ int rkispp_debug;
module_param_named(debug, rkispp_debug, int, 0644);
MODULE_PARM_DESC(debug, "Debug level (0-3)");
bool rkispp_clk_dbg;
static bool rkispp_clk_dbg;
module_param_named(clk_dbg, rkispp_clk_dbg, bool, 0644);
MODULE_PARM_DESC(clk_dbg, "rkispp clk set by user");
@@ -55,6 +55,14 @@ unsigned int rkispp_debug_reg = 0x1F;
module_param_named(debug_reg, rkispp_debug_reg, uint, 0644);
MODULE_PARM_DESC(debug_reg, "rkispp debug register");
void rkispp_set_clk_rate(struct clk *clk, unsigned long rate)
{
if (rkispp_clk_dbg)
return;
clk_set_rate(clk, rate);
}
static void get_remote_node_dev(struct rkispp_device *ispp_dev)
{
struct device *dev = ispp_dev->dev;

View File

@@ -42,7 +42,7 @@ static int fec_running(struct rkispp_fec_dev *fec,
buf->out_fourcc >> 16, buf->out_fourcc >> 24);
if (clk_get_rate(fec->hw->clks[0]) <= fec->hw->core_clk_min)
clk_set_rate(fec->hw->clks[0], fec->hw->core_clk_max);
rkispp_set_clk_rate(fec->hw->clks[0], fec->hw->core_clk_max);
init_completion(&fec->cmpl);
density = w > 1920 ? SW_MESH_DENSITY : 0;

View File

@@ -99,8 +99,6 @@ static int enable_sys_clk(struct rkispp_hw_dev *dev)
goto err;
}
if (rkispp_clk_dbg)
return 0;
for (i = 0; i < dev->clk_rate_tbl_num; i++)
if (w <= dev->clk_rate_tbl[i].refer_data)
break;
@@ -110,7 +108,7 @@ static int enable_sys_clk(struct rkispp_hw_dev *dev)
i = dev->clk_rate_tbl_num - 1;
dev->core_clk_max = dev->clk_rate_tbl[i].clk_rate * 1000000;
dev->core_clk_min = dev->clk_rate_tbl[0].clk_rate * 1000000;
clk_set_rate(dev->clks[0], dev->core_clk_min);
rkispp_set_clk_rate(dev->clks[0], dev->core_clk_min);
dev_dbg(dev->dev, "set ispp clk:%luHz\n", clk_get_rate(dev->clks[0]));
return 0;
err:

View File

@@ -1656,7 +1656,7 @@ static void rkispp_stop_streaming(struct vb2_queue *queue)
if (!atomic_read(&hw->refcnt) &&
!atomic_read(&dev->stream_vdev.refcnt))
clk_set_rate(hw->clks[0], hw->core_clk_min);
rkispp_set_clk_rate(hw->clks[0], hw->core_clk_min);
v4l2_dbg(1, rkispp_debug, &dev->v4l2_dev,
"%s id:%d exit\n", __func__, stream->id);
}
@@ -1757,7 +1757,7 @@ static int rkispp_start_streaming(struct vb2_queue *queue,
if (!atomic_read(&hw->refcnt) &&
!atomic_read(&dev->stream_vdev.refcnt) &&
clk_get_rate(hw->clks[0]) <= hw->core_clk_min)
clk_set_rate(hw->clks[0], hw->core_clk_max);
rkispp_set_clk_rate(hw->clks[0], hw->core_clk_max);
stream->is_upd = false;
stream->is_cfg = false;