|
From: <z7...@us...> - 2007-02-25 17:56:50
|
Revision: 873
http://svn.sourceforge.net/hackndev/?rev=873&view=rev
Author: z72ka
Date: 2007-02-25 09:56:35 -0800 (Sun, 25 Feb 2007)
Log Message:
-----------
Added a new LED MMC card trigger for pxamci (now used in Palm Z72)
Modified Paths:
--------------
linux4palm/linux/trunk/drivers/leds/Kconfig
linux4palm/linux/trunk/drivers/leds/Makefile
linux4palm/linux/trunk/drivers/mmc/pxamci.c
linux4palm/linux/trunk/include/linux/leds.h
Added Paths:
-----------
linux4palm/linux/trunk/drivers/leds/ledtrig-mmc-card.c
Modified: linux4palm/linux/trunk/drivers/leds/Kconfig
===================================================================
--- linux4palm/linux/trunk/drivers/leds/Kconfig 2007-02-24 01:37:32 UTC (rev 872)
+++ linux4palm/linux/trunk/drivers/leds/Kconfig 2007-02-25 17:56:35 UTC (rev 873)
@@ -158,6 +158,13 @@
This allows LEDs to be controlled by IDE disk activity.
If unsure, say Y.
+config LEDS_TRIGGER_MMC_CARD
+ bool "LED MMC Card Trigger"
+ depends on LEDS_TRIGGERS && MMC_PXA && ARCH_PXA
+ help
+ This allows LEDs to be controlled by MMC card activity on Intel PXA 25x/26x/27x MMC interface .
+ If unsure, say Y.
+
config LEDS_TRIGGER_HEARTBEAT
tristate "LED Heartbeat Trigger"
depends on LEDS_TRIGGERS
Modified: linux4palm/linux/trunk/drivers/leds/Makefile
===================================================================
--- linux4palm/linux/trunk/drivers/leds/Makefile 2007-02-24 01:37:32 UTC (rev 872)
+++ linux4palm/linux/trunk/drivers/leds/Makefile 2007-02-25 17:56:35 UTC (rev 873)
@@ -30,3 +30,4 @@
obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o
obj-$(CONFIG_LEDS_TRIGGER_SHARED) += ledtrig-shared.o
+obj-$(CONFIG_LEDS_TRIGGER_MMC_CARD) += ledtrig-mmc-card.o
Added: linux4palm/linux/trunk/drivers/leds/ledtrig-mmc-card.c
===================================================================
--- linux4palm/linux/trunk/drivers/leds/ledtrig-mmc-card.c (rev 0)
+++ linux4palm/linux/trunk/drivers/leds/ledtrig-mmc-card.c 2007-02-25 17:56:35 UTC (rev 873)
@@ -0,0 +1,63 @@
+/*
+ * LED MMC-Card Activity Trigger
+ *
+ * Author: Jan Herman <2h...@se...>
+ *
+ * Based on code IDE-disk Trigger from Richard Purdie <rp...@op...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/timer.h>
+#include <linux/leds.h>
+
+static void ledtrig_mmc_timerfunc(unsigned long data);
+
+DEFINE_LED_TRIGGER(ledtrig_mmc);
+static DEFINE_TIMER(ledtrig_mmc_timer, ledtrig_mmc_timerfunc, 0, 0);
+static int mmc_activity;
+static int mmc_lastactivity;
+
+void ledtrig_mmc_activity(void)
+{
+ mmc_activity++;
+ if (!timer_pending(&ledtrig_mmc_timer))
+ mod_timer(&ledtrig_mmc_timer, jiffies + msecs_to_jiffies(10));
+}
+EXPORT_SYMBOL(ledtrig_mmc_activity);
+
+static void ledtrig_mmc_timerfunc(unsigned long data)
+{
+ if (mmc_lastactivity != mmc_activity) {
+ mmc_lastactivity = mmc_activity;
+ led_trigger_event(ledtrig_mmc, LED_FULL);
+ mod_timer(&ledtrig_mmc_timer, jiffies + msecs_to_jiffies(10));
+ } else {
+ led_trigger_event(ledtrig_mmc, LED_OFF);
+ }
+}
+
+static int __init ledtrig_mmc_init(void)
+{
+ led_trigger_register_simple("mmc-card", &ledtrig_mmc);
+ return 0;
+}
+
+static void __exit ledtrig_mmc_exit(void)
+{
+ led_trigger_unregister_simple(ledtrig_mmc);
+}
+
+module_init(ledtrig_mmc_init);
+module_exit(ledtrig_mmc_exit);
+
+MODULE_AUTHOR("Jan Herman <2h...@se...>");
+MODULE_DESCRIPTION("LED MMC Card Activity Trigger");
+MODULE_LICENSE("GPL");
Modified: linux4palm/linux/trunk/drivers/mmc/pxamci.c
===================================================================
--- linux4palm/linux/trunk/drivers/mmc/pxamci.c 2007-02-24 01:37:32 UTC (rev 872)
+++ linux4palm/linux/trunk/drivers/mmc/pxamci.c 2007-02-25 17:56:35 UTC (rev 873)
@@ -25,6 +25,7 @@
#include <linux/dma-mapping.h>
#include <linux/mmc/host.h>
#include <linux/mmc/protocol.h>
+#include <linux/leds.h>
#include <asm/dma.h>
#include <asm/io.h>
@@ -263,6 +264,8 @@
{
struct mmc_data *data = host->data;
+ ledtrig_mmc_activity();
+
if (!data)
return 0;
Modified: linux4palm/linux/trunk/include/linux/leds.h
===================================================================
--- linux4palm/linux/trunk/include/linux/leds.h 2007-02-24 01:37:32 UTC (rev 872)
+++ linux4palm/linux/trunk/include/linux/leds.h 2007-02-25 17:56:35 UTC (rev 873)
@@ -140,5 +140,10 @@
#else
#define ledtrig_ide_activity() do {} while(0)
#endif
+#ifdef CONFIG_LEDS_TRIGGER_MMC_CARD
+extern void ledtrig_mmc_activity(void);
+#else
+#define ledtrig_mmc_activity() do {} while(0)
+#endif
#endif /* __LINUX_LEDS_H_INCLUDED */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|