Skip to contentSkip to conversation

ARM: OMAP: dmtimers improvements.

PATCH In review NeilBrown 3 participants 5 messages Oct 24, 2013 – Oct 25, 2013

Subsystems (10)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

cover ARM: OMAP: dmtimers improvements.

I would like to use omap dmtimer for a PWM driver (for the backlight on my display).
But there are two difficulties.

Unfortunately Jon Hunter (who has helped me with dmtimers before) seems to have disappeared. So I guess I get to do it myself :-)

Following two patches make dmtimers more usable.

1/ allow the counter to be set even when the timer isn't counting. 2/ move the include file to a more useful location

Any help you can provide in getting these fixes upstream would be appreciated.

Thanks,
NeilBrown

---

NeilBrown (2):
ARM: OMAP2+: dmtimer: allow counter to be set at any time.
ARM: OMAP: move dmtimer.h from plat-omap/include/plat to include/linux

 arch/arm/mach-omap1/pm.c                           |    2 
 arch/arm/mach-omap1/timer.c                        |    2 
 arch/arm/mach-omap2/omap_hwmod_2420_data.c         |    2 
 arch/arm/mach-omap2/omap_hwmod_2430_data.c         |    2 
 arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c |    2 
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c         |    2 
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |    2 
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c         |    2 
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c          |    2 
 arch/arm/mach-omap2/timer.c                        |    2 
 arch/arm/plat-omap/dmtimer.c                       |   11 -
 arch/arm/plat-omap/include/plat/dmtimer.h          |  415 --------------------
 drivers/media/rc/ir-rx51.c                         |    2 
 drivers/pwm/pwm-omap.c                             |    2 
 drivers/staging/tidspbridge/core/dsp-clock.c       |    2 
 include/linux/omap-dmtimer.h                       |  415 ++++++++++++++++++++
 16 files changed, 434 insertions(+), 433 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/plat/dmtimer.h
 create mode 100644 include/linux/omap-dmtimer.h
Signature · 1 line
Signature
author
#1 lore raw

PATCH 1/2 ARM: OMAP2+: dmtimer: allow counter to be set at any time.

It is perfectly appropriate to set the counter register when the timer isn't running. The value set will be where the counter starts counting from.

---
 arch/arm/plat-omap/dmtimer.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arm/plat-omap/dmtimer.c +4 -3
index 869254c..d80d2c4 100644
@@ -752,15 +752,16 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_read_counter);
 
 int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value)
 {
-	if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
-		pr_err("%s: timer not available or enabled.\n", __func__);
+	if (unlikely(!timer))
 		return -EINVAL;
-	}
+
+	omap_dm_timer_enable(timer);
 
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, value);
 
 	/* Save the context */
 	timer->context.tcrr = value;
+	omap_dm_timer_disable(timer);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_write_counter);
author
#2 lore raw

PATCH 2/2 ARM: OMAP: move dmtimer.h from plat-omap/include/plat to include/linux

In reply to NeilBrown

This is no need for dmtimer.h to be in the 'plat' include directory, and it makes it hard to write drivers which use it (such as a PWM driver). So move it to linux/omap-dmtimer.h.

---
 arch/arm/mach-omap1/pm.c                           |    2 
 arch/arm/mach-omap1/timer.c                        |    2 
 arch/arm/mach-omap2/omap_hwmod_2420_data.c         |    2 
 arch/arm/mach-omap2/omap_hwmod_2430_data.c         |    2 
 arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c |    2 
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c         |    2 
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |    2 
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c         |    2 
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c          |    2 
 arch/arm/mach-omap2/timer.c                        |    2 
 arch/arm/plat-omap/dmtimer.c                       |    4 
 arch/arm/plat-omap/include/plat/dmtimer.h          |  415 --------------------
 drivers/media/rc/ir-rx51.c                         |    2 
 drivers/pwm/pwm-omap.c                             |    2 
 drivers/staging/tidspbridge/core/dsp-clock.c       |    2 
 include/linux/omap-dmtimer.h                       |  415 ++++++++++++++++++++
 16 files changed, 430 insertions(+), 430 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/plat/dmtimer.h
 create mode 100644 include/linux/omap-dmtimer.h
arch/arm/mach-omap1/pm.c +1 -1
index 358b82c..d0c7415 100644
@@ -55,7 +55,7 @@
 #include <mach/tc.h>
 #include <mach/mux.h>
 #include <linux/omap-dma.h>
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 
 #include <mach/irqs.h>
 
arch/arm/mach-omap1/timer.c +1 -1
index bde7a35..bcd49ca 100644
@@ -29,7 +29,7 @@
 
 #include <mach/irqs.h>
 
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 
 #define OMAP1610_GPTIMER1_BASE		0xfffb1400
 #define OMAP1610_GPTIMER2_BASE		0xfffb1c00
arch/arm/mach-omap2/omap_hwmod_2420_data.c +1 -1
index d8b9d60..e519203 100644
@@ -17,7 +17,7 @@
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/omap-dma.h>
 #include <linux/platform_data/mailbox-omap.h>
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 
 #include "omap_hwmod.h"
 #include "l3_2xxx.h"
arch/arm/mach-omap2/omap_hwmod_2430_data.c +1 -1
index 5b90834..183e99f 100644
@@ -18,7 +18,7 @@
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/omap-dma.h>
 #include <linux/platform_data/mailbox-omap.h>
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 
 #include "omap_hwmod.h"
 #include "mmc.h"
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c +1 -1
index 56cebb0..c78893d 100644
@@ -11,7 +11,7 @@
 
 #include <linux/platform_data/gpio-omap.h>
 #include <linux/omap-dma.h>
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 
 #include "omap_hwmod.h"
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +1 -1
index 0c3a427..e5d6d5a 100644
@@ -26,7 +26,7 @@
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/iommu-omap.h>
 #include <linux/platform_data/mailbox-omap.h>
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 
 #include "am35xx.h"
 
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
index 9c3b504..2a023a3 100644
@@ -30,7 +30,7 @@
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
 #include <linux/platform_data/iommu-omap.h>
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 
 #include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
arch/arm/mach-omap2/omap_hwmod_54xx_data.c +1 -1
index cde4155..11fbb51 100644
@@ -25,7 +25,7 @@
 #include <linux/omap-dma.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 
 #include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
arch/arm/mach-omap2/omap_hwmod_7xx_data.c +1 -1
index db32d53..157a365 100644
@@ -25,7 +25,7 @@
 #include <linux/omap-dma.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 
 #include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
arch/arm/mach-omap2/timer.c +1 -1
index ead48fa..ab654a9 100644
@@ -49,7 +49,7 @@
 #include "omap_hwmod.h"
 #include "omap_device.h"
 #include <plat/counter-32k.h>
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 #include "omap-pm.h"
 
 #include "soc.h"
arch/arm/plat-omap/dmtimer.c +2 -2
index d80d2c4..1804e3e 100644
@@ -46,7 +46,7 @@
 #include <linux/platform_device.h>
 #include <linux/platform_data/dmtimer-omap.h>
 
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 
 static u32 omap_reserved_systimers;
 static LIST_HEAD(omap_timer_list);
@@ -292,7 +292,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_request_specific);
  * @cap:	Bit mask of capabilities to match
  *
  * Find a timer based upon capabilities bit mask. Callers of this function
- * should use the definitions found in the plat/dmtimer.h file under the
+ * should use the definitions found in the linux/omap-dmtimer.h file under the
  * comment "timer capabilities used in hwmod database". Returns pointer to
  * timer handle on success and a NULL pointer on failure.
  */
arch/arm/plat-omap/include/plat/dmtimer.h deleted +0 -415

415 lines not on this page · raw message

drivers/media/rc/ir-rx51.c +1 -1
index 31b955b..bc09fe1 100644
@@ -26,7 +26,7 @@
 #include <linux/sched.h>
 #include <linux/wait.h>
 
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 #include <plat/clock.h>
 
 #include <media/lirc.h>
drivers/pwm/pwm-omap.c +1 -1
index 30470aa..41d42f4 100644
@@ -26,7 +26,7 @@
 #include <linux/module.h>
 #include <linux/platform_data/omap-pwm.h>
 
-#include <../arch/arm/plat-omap/include/plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 
 #define DM_TIMER_LOAD_MIN		0xFFFFFFFE
 
drivers/staging/tidspbridge/core/dsp-clock.c +1 -1
index 2f084e18..ca1a6d9 100644
@@ -22,7 +22,7 @@
 
 /*  ----------------------------------- Host OS */
 #include <dspbridge/host_os.h>
-#include <plat/dmtimer.h>
+#include <linux/omap-dmtimer.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
 
 /*  ----------------------------------- DSP/BIOS Bridge */
include/linux/omap-dmtimer.h new file +415 -0

415 lines not on this page · raw message

#3 lore raw
In reply to NeilBrown

Sorry for top posting .... Probably we should move the dmtimer to drivers/misc or create drivers/timer/ This has been pending for quite some time now....

Tony, what you say ?
________________________________________
From: linux-arm-kernel [linux-arm-kernel-bounces at lists.infradead.org] on behalf of NeilBrown [neilb at suse.de]
Sent: Thursday, October 24, 2013 2:57 AM
To: Tony Lindgren; Russell King
Cc: Belisko Marek; linux-omap at vger.kernel.org; linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; Dr. H. Nikolaus Schaller
Subject: [PATCH 0/2] ARM: OMAP: dmtimers improvements.

I would like to use omap dmtimer for a PWM driver (for the backlight on my display).
But there are two difficulties.

Unfortunately Jon Hunter (who has helped me with dmtimers before) seems to have disappeared. So I guess I get to do it myself :-)

Following two patches make dmtimers more usable.

1/ allow the counter to be set even when the timer isn't counting. 2/ move the include file to a more useful location

Any help you can provide in getting these fixes upstream would be appreciated.

Thanks,
NeilBrown

---

NeilBrown (2):
ARM: OMAP2+: dmtimer: allow counter to be set at any time.
ARM: OMAP: move dmtimer.h from plat-omap/include/plat to include/linux

 arch/arm/mach-omap1/pm.c                           |    2
 arch/arm/mach-omap1/timer.c                        |    2
 arch/arm/mach-omap2/omap_hwmod_2420_data.c         |    2
 arch/arm/mach-omap2/omap_hwmod_2430_data.c         |    2
 arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c |    2
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c         |    2
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |    2
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c         |    2
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c          |    2
 arch/arm/mach-omap2/timer.c                        |    2
 arch/arm/plat-omap/dmtimer.c                       |   11 -
 arch/arm/plat-omap/include/plat/dmtimer.h          |  415 --------------------
 drivers/media/rc/ir-rx51.c                         |    2
 drivers/pwm/pwm-omap.c                             |    2
 drivers/staging/tidspbridge/core/dsp-clock.c       |    2
 include/linux/omap-dmtimer.h                       |  415 ++++++++++++++++++++
 16 files changed, 434 insertions(+), 433 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/plat/dmtimer.h
 create mode 100644 include/linux/omap-dmtimer.h

--
Signature

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#4 lore raw
Quoted 4 lines · Shilimkar, Santosh

Sorry for top posting .... Probably we should move the dmtimer to drivers/misc or create drivers/timer/ This has been pending for quite some time now....

Tony, what you say ?

Yes that should be done and we should cc Thomas Gleixner to see if he has any better ideas for some of those exported functions. Things that can be done with hrtimer should be done with hrtimer, but at least the coprocessor use of timers and PWM need to use timers directly.

Regards,

Tony