From: Eddie James <eajames@linux.ibm.com>
To: openbmc@lists.ozlabs.org
Subject: [PATCH dev-5.0 v2 1/5] media: platform: Aspeed: Remove use of reset line
Date: Fri, 29 Mar 2019 21:15:39 +0000 [thread overview]
Message-ID: <1553894143-559-2-git-send-email-eajames@linux.ibm.com> (raw)
In-Reply-To: <1553894143-559-1-git-send-email-eajames@linux.ibm.com>
The reset line is toggled by enabling the clocks, so it's not necessary
to manually toggle the reset as well.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/media/platform/aspeed-video.c | 39 ++++++++++++++---------------------
1 file changed, 15 insertions(+), 24 deletions(-)
diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c
index 692e08e..9df38ad 100644
--- a/drivers/media/platform/aspeed-video.c
+++ b/drivers/media/platform/aspeed-video.c
@@ -14,7 +14,6 @@
#include <linux/of_irq.h>
#include <linux/of_reserved_mem.h>
#include <linux/platform_device.h>
-#include <linux/reset.h>
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/string.h>
@@ -46,9 +45,9 @@
#define NUM_POLARITY_CHECKS 10
#define INVALID_RESOLUTION_RETRIES 2
#define INVALID_RESOLUTION_DELAY msecs_to_jiffies(250)
-#define RESOLUTION_CHANGE_DELAY msecs_to_jiffies(500)
-#define MODE_DETECT_TIMEOUT msecs_to_jiffies(500)
-#define STOP_TIMEOUT msecs_to_jiffies(1000)
+#define RESOLUTION_CHANGE_DELAY msecs_to_jiffies(750)
+#define MODE_DETECT_TIMEOUT msecs_to_jiffies(1000)
+#define STOP_TIMEOUT msecs_to_jiffies(1500)
#define DIRECT_FETCH_THRESHOLD 0x0c0000 /* 1024 * 768 */
#define VE_MAX_SRC_BUFFER_SIZE 0x8ca000 /* 1920 * 1200, 32bpp */
@@ -208,7 +207,6 @@ struct aspeed_video {
void __iomem *base;
struct clk *eclk;
struct clk *vclk;
- struct reset_control *rst;
struct device *dev;
struct v4l2_ctrl_handler ctrl_handler;
@@ -483,19 +481,10 @@ static void aspeed_video_enable_mode_detect(struct aspeed_video *video)
aspeed_video_update(video, VE_SEQ_CTRL, 0, VE_SEQ_CTRL_TRIG_MODE_DET);
}
-static void aspeed_video_reset(struct aspeed_video *video)
-{
- /* Reset the engine */
- reset_control_assert(video->rst);
-
- /* Don't usleep here; function may be called in interrupt context */
- udelay(100);
- reset_control_deassert(video->rst);
-}
-
static void aspeed_video_off(struct aspeed_video *video)
{
- aspeed_video_reset(video);
+ /* Disable interrupts */
+ aspeed_video_write(video, VE_INTERRUPT_CTRL, 0);
/* Turn off the relevant clocks */
clk_disable_unprepare(video->vclk);
@@ -508,7 +497,13 @@ static void aspeed_video_on(struct aspeed_video *video)
clk_prepare_enable(video->eclk);
clk_prepare_enable(video->vclk);
- aspeed_video_reset(video);
+ /*
+ * Delay (and don't sleep in case in interrupt context) to let the
+ * clocks stabilize. Without this, mode detection sometimes fails.
+ * Possibly the registers don't update too soon after clocks are
+ * enabled.
+ */
+ udelay(100);
}
static void aspeed_video_bufs_done(struct aspeed_video *video,
@@ -1464,7 +1459,9 @@ 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_reset(video);
+ aspeed_video_off(video);
+ aspeed_video_on(video);
+
aspeed_video_init_regs(video);
aspeed_video_get_resolution(video);
@@ -1619,12 +1616,6 @@ static int aspeed_video_init(struct aspeed_video *video)
return PTR_ERR(video->vclk);
}
- video->rst = devm_reset_control_get_exclusive(dev, NULL);
- if (IS_ERR(video->rst)) {
- dev_err(dev, "Unable to get VE reset\n");
- return PTR_ERR(video->rst);
- }
-
rc = of_reserved_mem_device_init(dev);
if (rc) {
dev_err(dev, "Unable to reserve memory\n");
--
1.8.3.1
next prev parent reply other threads:[~2019-03-29 21:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 21:15 [PATCH dev-5.0 v2 0/5] Enable video engine Eddie James
2019-03-29 21:15 ` Eddie James [this message]
2019-03-29 23:54 ` [PATCH dev-5.0 v2 1/5] media: platform: Aspeed: Remove use of reset line Jae Hyun Yoo
2019-04-01 15:11 ` Eddie James
2019-04-01 17:25 ` Jae Hyun Yoo
2019-04-01 20:11 ` Eddie James
2019-04-01 20:18 ` Milton Miller II
2019-04-01 6:23 ` Joel Stanley
2019-04-01 14:32 ` Eddie James
2019-04-02 1:39 ` Joel Stanley
2019-04-02 2:01 ` Eddie James
2019-03-29 21:15 ` [PATCH dev-5.0 v2 2/5] clk: Aspeed: Setup video engine clocking Eddie James
2019-03-29 22:15 ` Jae Hyun Yoo
2019-03-29 21:15 ` [PATCH dev-5.0 v2 3/5] ARM: dts: aspeed-g5: Add video engine Eddie James
2019-03-29 21:15 ` [PATCH dev-5.0 v2 4/5] ARM: dts: witherspoon: Enable " Eddie James
2019-03-29 21:15 ` [PATCH dev-5.0 v2 5/5] ARM: dts: romulus: " Eddie James
2019-04-01 6:27 ` Joel Stanley
2019-04-01 15:13 ` Eddie James
2019-04-02 1:40 ` Joel Stanley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1553894143-559-2-git-send-email-eajames@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=openbmc@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.