All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timo Kokkonen <timo.t.kokkonen@iki.fi>
To: linux-omap@vger.kernel.org, linux-media@vger.kernel.org
Subject: [PATCHv3 7/9] ir-rx51: Convert latency constraints to PM QoS API
Date: Thu, 30 Aug 2012 20:54:29 +0300	[thread overview]
Message-ID: <1346349271-28073-8-git-send-email-timo.t.kokkonen@iki.fi> (raw)
In-Reply-To: <1346349271-28073-1-git-send-email-timo.t.kokkonen@iki.fi>

Convert the driver from the obsolete omap_pm_set_max_mpu_wakeup_lat
API to the new PM QoS API. This allows the callback to be removed from
the platform data structure.

The latency requirements are also adjusted to prevent the MPU from
going into sleep mode. This is needed as the GP timers have no means
to wake up the MPU once it has gone into sleep. The "side effect" is
that from now on the driver actually works even if there is no
background load keeping the MPU awake.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Jean Pihet <j-pihet@ti.com>
---
 arch/arm/mach-omap2/board-rx51-peripherals.c |  2 --
 drivers/media/rc/ir-rx51.c                   | 17 ++++++++++++-----
 include/media/ir-rx51.h                      |  2 --
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index ca07264..e0750cb 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -34,7 +34,6 @@
 #include <plat/gpmc.h>
 #include <plat/onenand.h>
 #include <plat/gpmc-smc91x.h>
-#include <plat/omap-pm.h>
 
 #include <mach/board-rx51.h>
 
@@ -1227,7 +1226,6 @@ static void __init rx51_init_tsc2005(void)
 
 #if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
 static struct lirc_rx51_platform_data rx51_lirc_data = {
-	.set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
 	.pwm_timer = 9, /* Use GPT 9 for CIR */
 };
 
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index 6e1ffa6..96ed23d 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -25,6 +25,7 @@
 #include <linux/platform_device.h>
 #include <linux/sched.h>
 #include <linux/wait.h>
+#include <linux/pm_qos.h>
 
 #include <plat/dmtimer.h>
 #include <plat/clock.h>
@@ -49,6 +50,7 @@ struct lirc_rx51 {
 	struct omap_dm_timer *pulse_timer;
 	struct device	     *dev;
 	struct lirc_rx51_platform_data *pdata;
+	struct pm_qos_request	pm_qos_request;
 	wait_queue_head_t     wqueue;
 
 	unsigned long	fclk_khz;
@@ -268,10 +270,16 @@ static ssize_t lirc_rx51_write(struct file *file, const char *buf,
 		lirc_rx51->wbuf[count] = -1; /* Insert termination mark */
 
 	/*
-	 * Adjust latency requirements so the device doesn't go in too
-	 * deep sleep states
+	 * If the MPU is going into too deep sleep state while we are
+	 * transmitting the IR code, timers will not be able to wake
+	 * up the MPU. Thus, we need to set a strict enough latency
+	 * requirement in order to ensure the interrupts come though
+	 * properly. The 10us latency requirement is low enough to
+	 * keep MPU from sleeping and thus ensures the interrupts are
+	 * getting through properly.
 	 */
-	lirc_rx51->pdata->set_max_mpu_wakeup_lat(lirc_rx51->dev, 50);
+	pm_qos_add_request(&lirc_rx51->pm_qos_request,
+			PM_QOS_CPU_DMA_LATENCY,	10);
 
 	lirc_rx51_on(lirc_rx51);
 	lirc_rx51->wbuf_index = 1;
@@ -292,8 +300,7 @@ static ssize_t lirc_rx51_write(struct file *file, const char *buf,
 	 */
 	lirc_rx51_stop_tx(lirc_rx51);
 
-	/* We can sleep again */
-	lirc_rx51->pdata->set_max_mpu_wakeup_lat(lirc_rx51->dev, -1);
+	pm_qos_remove_request(&lirc_rx51->pm_qos_request);
 
 	return n;
 }
diff --git a/include/media/ir-rx51.h b/include/media/ir-rx51.h
index 104aa89..57523f2 100644
--- a/include/media/ir-rx51.h
+++ b/include/media/ir-rx51.h
@@ -3,8 +3,6 @@
 
 struct lirc_rx51_platform_data {
 	int pwm_timer;
-
-	int(*set_max_mpu_wakeup_lat)(struct device *dev, long t);
 };
 
 #endif
-- 
1.7.12


  parent reply	other threads:[~2012-08-30 17:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-30 17:54 [PATCHv3 0/9] Fixes in response to review comments Timo Kokkonen
2012-08-30 17:54 ` [PATCHv3 1/9] ir-rx51: Adjust dependencies Timo Kokkonen
2012-08-30 17:54 ` [PATCHv3 2/9] ir-rx51: Handle signals properly Timo Kokkonen
2012-09-01 17:14   ` Sakari Ailus
2012-09-02 14:54     ` Timo Kokkonen
2012-09-02 15:06       ` Sakari Ailus
2012-09-02 15:20         ` Timo Kokkonen
2012-09-02 19:41           ` Sakari Ailus
2012-09-02 20:08             ` Timo Kokkonen
2012-09-03 12:36               ` Sean Young
2012-09-03 21:41                 ` David Härdeman
2012-09-04 12:43                   ` Sean Young
2012-09-20  9:43                     ` David Härdeman
2012-09-14  7:58                 ` Timo Kokkonen
2012-09-16 19:42                   ` Sean Young
2012-08-30 17:54 ` [PATCHv3 3/9] ir-rx51: Trivial fixes Timo Kokkonen
2012-08-30 17:54 ` [PATCHv3 4/9] ir-rx51: Clean up timer initialization code Timo Kokkonen
2012-08-30 17:54 ` [PATCHv3 5/9] ir-rx51: Move platform data checking into probe function Timo Kokkonen
2012-08-30 17:54 ` [PATCHv3 6/9] ir-rx51: Replace module_{init,exit} macros with module_platform_driver Timo Kokkonen
2012-08-30 17:54 ` Timo Kokkonen [this message]
2012-08-30 17:54 ` [PATCHv3 8/9] ir-rx51: Remove useless variable from struct lirc_rx51 Timo Kokkonen
2012-08-30 17:54 ` [PATCHv3 9/9] ir-rx51: Add missing quote mark in Kconfig text Timo Kokkonen
2012-09-01 17:16   ` Sakari Ailus
2012-09-02 14:57     ` Timo Kokkonen
2012-09-02 20:06       ` Sakari Ailus

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=1346349271-28073-8-git-send-email-timo.t.kokkonen@iki.fi \
    --to=timo.t.kokkonen@iki.fi \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-omap@vger.kernel.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.