From: Philipp Zabel <p.zabel@pengutronix.de> To: devel@driverdev.osuosl.org, Russell King <rmk+kernel@arm.linux.org.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Philipp Zabel <p.zabel@pengutronix.de> Subject: [PATCH 2/7] imx-drm: ipu-common: Add helpers to check for a busy IDMAC channel and to busywait for an interrupt Date: Mon, 14 Apr 2014 17:21:30 +0200 [thread overview] Message-ID: <1397488895-17930-3-git-send-email-p.zabel@pengutronix.de> (raw) In-Reply-To: <1397488895-17930-1-git-send-email-p.zabel@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> --- drivers/staging/imx-drm/ipu-v3/ipu-common.c | 22 ++++++++++++++++++++++ drivers/staging/imx-drm/ipu-v3/ipu-prv.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c b/drivers/staging/imx-drm/ipu-v3/ipu-common.c index 0585517..8fb4c20 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c +++ b/drivers/staging/imx-drm/ipu-v3/ipu-common.c @@ -697,6 +697,12 @@ int ipu_idmac_enable_channel(struct ipuv3_channel *channel) } EXPORT_SYMBOL_GPL(ipu_idmac_enable_channel); +bool ipu_idmac_channel_busy(struct ipu_soc *ipu, unsigned int chno) +{ + return (ipu_idmac_read(ipu, IDMAC_CHA_BUSY(chno)) & idma_mask(chno)); +} +EXPORT_SYMBOL_GPL(ipu_idmac_channel_busy); + int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms) { struct ipu_soc *ipu = channel->ipu; @@ -714,6 +720,22 @@ int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms) } EXPORT_SYMBOL_GPL(ipu_idmac_wait_busy); +int ipu_wait_interrupt(struct ipu_soc *ipu, int irq, int ms) +{ + unsigned long timeout; + + timeout = jiffies + msecs_to_jiffies(ms); + ipu_cm_write(ipu, BIT(irq % 32), IPU_INT_STAT(irq / 32)); + while (!(ipu_cm_read(ipu, IPU_INT_STAT(irq / 32) & BIT(irq % 32)))) { + if (time_after(jiffies, timeout)) + return -ETIMEDOUT; + cpu_relax(); + } + + return 0; +} +EXPORT_SYMBOL_GPL(ipu_wait_interrupt); + int ipu_idmac_disable_channel(struct ipuv3_channel *channel) { struct ipu_soc *ipu = channel->ipu; diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h b/drivers/staging/imx-drm/ipu-v3/ipu-prv.h index 4df0050..bfc1b33 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h +++ b/drivers/staging/imx-drm/ipu-v3/ipu-prv.h @@ -185,6 +185,9 @@ void ipu_srm_dp_sync_update(struct ipu_soc *ipu); int ipu_module_enable(struct ipu_soc *ipu, u32 mask); int ipu_module_disable(struct ipu_soc *ipu, u32 mask); +bool ipu_idmac_channel_busy(struct ipu_soc *ipu, unsigned int chno); +int ipu_wait_interrupt(struct ipu_soc *ipu, int irq, int ms); + int ipu_di_init(struct ipu_soc *ipu, struct device *dev, int id, unsigned long base, u32 module, struct clk *ipu_clk); void ipu_di_exit(struct ipu_soc *ipu, int id); -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Philipp Zabel <p.zabel@pengutronix.de> To: devel@driverdev.osuosl.org, Russell King <rmk+kernel@arm.linux.org.uk> Cc: kernel@pengutronix.de, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH 2/7] imx-drm: ipu-common: Add helpers to check for a busy IDMAC channel and to busywait for an interrupt Date: Mon, 14 Apr 2014 17:21:30 +0200 [thread overview] Message-ID: <1397488895-17930-3-git-send-email-p.zabel@pengutronix.de> (raw) In-Reply-To: <1397488895-17930-1-git-send-email-p.zabel@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> --- drivers/staging/imx-drm/ipu-v3/ipu-common.c | 22 ++++++++++++++++++++++ drivers/staging/imx-drm/ipu-v3/ipu-prv.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c b/drivers/staging/imx-drm/ipu-v3/ipu-common.c index 0585517..8fb4c20 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c +++ b/drivers/staging/imx-drm/ipu-v3/ipu-common.c @@ -697,6 +697,12 @@ int ipu_idmac_enable_channel(struct ipuv3_channel *channel) } EXPORT_SYMBOL_GPL(ipu_idmac_enable_channel); +bool ipu_idmac_channel_busy(struct ipu_soc *ipu, unsigned int chno) +{ + return (ipu_idmac_read(ipu, IDMAC_CHA_BUSY(chno)) & idma_mask(chno)); +} +EXPORT_SYMBOL_GPL(ipu_idmac_channel_busy); + int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms) { struct ipu_soc *ipu = channel->ipu; @@ -714,6 +720,22 @@ int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms) } EXPORT_SYMBOL_GPL(ipu_idmac_wait_busy); +int ipu_wait_interrupt(struct ipu_soc *ipu, int irq, int ms) +{ + unsigned long timeout; + + timeout = jiffies + msecs_to_jiffies(ms); + ipu_cm_write(ipu, BIT(irq % 32), IPU_INT_STAT(irq / 32)); + while (!(ipu_cm_read(ipu, IPU_INT_STAT(irq / 32) & BIT(irq % 32)))) { + if (time_after(jiffies, timeout)) + return -ETIMEDOUT; + cpu_relax(); + } + + return 0; +} +EXPORT_SYMBOL_GPL(ipu_wait_interrupt); + int ipu_idmac_disable_channel(struct ipuv3_channel *channel) { struct ipu_soc *ipu = channel->ipu; diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h b/drivers/staging/imx-drm/ipu-v3/ipu-prv.h index 4df0050..bfc1b33 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h +++ b/drivers/staging/imx-drm/ipu-v3/ipu-prv.h @@ -185,6 +185,9 @@ void ipu_srm_dp_sync_update(struct ipu_soc *ipu); int ipu_module_enable(struct ipu_soc *ipu, u32 mask); int ipu_module_disable(struct ipu_soc *ipu, u32 mask); +bool ipu_idmac_channel_busy(struct ipu_soc *ipu, unsigned int chno); +int ipu_wait_interrupt(struct ipu_soc *ipu, int irq, int ms); + int ipu_di_init(struct ipu_soc *ipu, struct device *dev, int id, unsigned long base, u32 module, struct clk *ipu_clk); void ipu_di_exit(struct ipu_soc *ipu, int id); -- 1.9.1
next prev parent reply other threads:[~2014-04-14 15:22 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-04-14 15:21 [PATCH 0/7] Reorder i.MX IPU display enable/disable sequence Philipp Zabel 2014-04-14 15:21 ` Philipp Zabel 2014-04-14 15:21 ` [PATCH 1/7] imx-drm: ipu-common: add ipu_map_irq to request non-IDMAC interrupts Philipp Zabel 2014-04-14 15:21 ` Philipp Zabel 2014-04-14 15:21 ` Philipp Zabel [this message] 2014-04-14 15:21 ` [PATCH 2/7] imx-drm: ipu-common: Add helpers to check for a busy IDMAC channel and to busywait for an interrupt Philipp Zabel 2014-04-14 15:21 ` [PATCH 3/7] imx-drm: ipu-dmfc: Wait for FIFOs to run empty before disabling Philipp Zabel 2014-04-14 15:21 ` Philipp Zabel 2014-04-14 15:21 ` [PATCH 4/7] imx-drm: ipu-dc: Wait for DC_FC_1 / DP_SF_END interrupt Philipp Zabel 2014-04-14 15:21 ` Philipp Zabel 2014-04-14 21:45 ` Russell King - ARM Linux 2014-04-14 21:45 ` Russell King - ARM Linux 2014-04-14 15:21 ` [PATCH 5/7] imx-drm: ipu-dp: Split disabling the DP foreground channel from disabling the DP module Philipp Zabel 2014-04-14 15:21 ` Philipp Zabel 2014-04-14 15:21 ` [PATCH 6/7] imx-drm: imx-dp: When disabling the DP foreground channel, wait until the DP background channel is finished before disabling the IDMAC channel Philipp Zabel 2014-04-14 15:21 ` Philipp Zabel 2014-04-14 15:21 ` [PATCH 7/7] imx-drm: ipuv3-crtc: Change display enable/disable order Philipp Zabel 2014-04-14 15:21 ` Philipp Zabel 2014-04-14 19:57 ` [PATCH 0/7] Reorder i.MX IPU display enable/disable sequence Russell King - ARM Linux 2014-04-14 19:57 ` Russell King - ARM Linux 2014-04-14 21:31 ` Russell King - ARM Linux 2014-04-14 21:31 ` Russell King - ARM Linux
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=1397488895-17930-3-git-send-email-p.zabel@pengutronix.de \ --to=p.zabel@pengutronix.de \ --cc=devel@driverdev.osuosl.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=gregkh@linuxfoundation.org \ --cc=kernel@pengutronix.de \ --cc=linux-kernel@vger.kernel.org \ --cc=rmk+kernel@arm.linux.org.uk \ /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: linkBe 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.