mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-02 07:00:42 -04:00
media: aspeed: Fix dram hang at res-change
Dram hang could happen in the steps below: 1. start capture/compression 2. out-of-lock watchdog raise irq because of res-change. 3. aspeed_video_irq_res_change do clk-off At step3, capture/compression could be not accomplished yet. If clk-off in the middle of video operation, dram controller could hang at ast2500. Use reset rather than clk-off/on to avoid this problem. Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
committed by
Hans Verkuil
parent
43e5302d22
commit
e83f8dd668
@@ -26,6 +26,7 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
@@ -310,6 +311,7 @@ struct aspeed_video {
|
||||
void __iomem *base;
|
||||
struct clk *eclk;
|
||||
struct clk *vclk;
|
||||
struct reset_control *reset;
|
||||
|
||||
struct device *dev;
|
||||
struct v4l2_ctrl_handler ctrl_handler;
|
||||
@@ -720,6 +722,13 @@ static void aspeed_video_on(struct aspeed_video *video)
|
||||
set_bit(VIDEO_CLOCKS_ON, &video->flags);
|
||||
}
|
||||
|
||||
static void aspeed_video_reset(struct aspeed_video *v)
|
||||
{
|
||||
reset_control_assert(v->reset);
|
||||
usleep_range(100, 150);
|
||||
reset_control_deassert(v->reset);
|
||||
}
|
||||
|
||||
static void aspeed_video_bufs_done(struct aspeed_video *video,
|
||||
enum vb2_buffer_state state)
|
||||
{
|
||||
@@ -742,7 +751,9 @@ static void aspeed_video_irq_res_change(struct aspeed_video *video, ulong delay)
|
||||
|
||||
video->v4l2_input_status = V4L2_IN_ST_NO_SIGNAL;
|
||||
|
||||
aspeed_video_off(video);
|
||||
aspeed_video_write(video, VE_INTERRUPT_CTRL, 0);
|
||||
aspeed_video_write(video, VE_INTERRUPT_STATUS, 0xffffffff);
|
||||
aspeed_video_reset(video);
|
||||
aspeed_video_bufs_done(video, VB2_BUF_STATE_ERROR);
|
||||
|
||||
schedule_delayed_work(&video->res_work, delay);
|
||||
@@ -1984,8 +1995,7 @@ static void aspeed_video_stop_streaming(struct vb2_queue *q)
|
||||
* Need to force stop any DMA and try and get HW into a good
|
||||
* state for future calls to start streaming again.
|
||||
*/
|
||||
aspeed_video_off(video);
|
||||
aspeed_video_on(video);
|
||||
aspeed_video_reset(video);
|
||||
|
||||
aspeed_video_init_regs(video);
|
||||
|
||||
@@ -2230,6 +2240,12 @@ static int aspeed_video_init(struct aspeed_video *video)
|
||||
}
|
||||
dev_info(video->dev, "irq %d\n", irq);
|
||||
|
||||
video->reset = devm_reset_control_get(dev, NULL);
|
||||
if (IS_ERR(video->reset)) {
|
||||
dev_err(dev, "Unable to get reset\n");
|
||||
return PTR_ERR(video->reset);
|
||||
}
|
||||
|
||||
video->eclk = devm_clk_get(dev, "eclk");
|
||||
if (IS_ERR(video->eclk)) {
|
||||
dev_err(dev, "Unable to get ECLK\n");
|
||||
|
||||
Reference in New Issue
Block a user