aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-09-24 01:15:48 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-09-24 01:15:48 -0400
commitaf8350c756cb48a738474738f7bf8c0e572fa057 (patch)
treee46fcb2b0eaf158759bfe75fc22fe01dd2556f3a
parent15a0580ced081a0f7dc2deea8a4812bdc5e9a109 (diff)
mmc: add led trigger
Add a led trigger for each host controller that indicates if there is a request active on the controller. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
-rw-r--r--drivers/mmc/core/core.c5
-rw-r--r--drivers/mmc/core/host.c5
-rw-r--r--include/linux/mmc/host.h6
3 files changed, 16 insertions, 0 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index bad39442f8fe..09435e0ec680 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -18,6 +18,7 @@
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/pagemap.h> 19#include <linux/pagemap.h>
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/leds.h>
21#include <asm/scatterlist.h> 22#include <asm/scatterlist.h>
22#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
23 24
@@ -92,6 +93,8 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
92 cmd->error = 0; 93 cmd->error = 0;
93 host->ops->request(host, mrq); 94 host->ops->request(host, mrq);
94 } else { 95 } else {
96 led_trigger_event(host->led, LED_OFF);
97
95 pr_debug("%s: req done (CMD%u): %d: %08x %08x %08x %08x\n", 98 pr_debug("%s: req done (CMD%u): %d: %08x %08x %08x %08x\n",
96 mmc_hostname(host), cmd->opcode, err, 99 mmc_hostname(host), cmd->opcode, err,
97 cmd->resp[0], cmd->resp[1], 100 cmd->resp[0], cmd->resp[1],
@@ -146,6 +149,8 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
146 149
147 WARN_ON(!host->claimed); 150 WARN_ON(!host->claimed);
148 151
152 led_trigger_event(host->led, LED_FULL);
153
149 mrq->cmd->error = 0; 154 mrq->cmd->error = 0;
150 mrq->cmd->mrq = mrq; 155 mrq->cmd->mrq = mrq;
151 if (mrq->data) { 156 if (mrq->data) {
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 37b761891d67..64fbc9759a30 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -15,6 +15,7 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/idr.h> 16#include <linux/idr.h>
17#include <linux/pagemap.h> 17#include <linux/pagemap.h>
18#include <linux/leds.h>
18 19
19#include <linux/mmc/host.h> 20#include <linux/mmc/host.h>
20 21
@@ -115,6 +116,8 @@ int mmc_add_host(struct mmc_host *host)
115 snprintf(host->class_dev.bus_id, BUS_ID_SIZE, 116 snprintf(host->class_dev.bus_id, BUS_ID_SIZE,
116 "mmc%d", host->index); 117 "mmc%d", host->index);
117 118
119 led_trigger_register_simple(host->class_dev.bus_id, &host->led);
120
118 err = device_add(&host->class_dev); 121 err = device_add(&host->class_dev);
119 if (err) 122 if (err)
120 return err; 123 return err;
@@ -140,6 +143,8 @@ void mmc_remove_host(struct mmc_host *host)
140 143
141 device_del(&host->class_dev); 144 device_del(&host->class_dev);
142 145
146 led_trigger_unregister(host->led);
147
143 spin_lock(&mmc_host_lock); 148 spin_lock(&mmc_host_lock);
144 idr_remove(&mmc_host_idr, host->index); 149 idr_remove(&mmc_host_idr, host->index);
145 spin_unlock(&mmc_host_lock); 150 spin_unlock(&mmc_host_lock);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 76eef94782f8..125eee1407ff 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -10,6 +10,8 @@
10#ifndef LINUX_MMC_HOST_H 10#ifndef LINUX_MMC_HOST_H
11#define LINUX_MMC_HOST_H 11#define LINUX_MMC_HOST_H
12 12
13#include <linux/leds.h>
14
13#include <linux/mmc/core.h> 15#include <linux/mmc/core.h>
14 16
15struct mmc_ios { 17struct mmc_ios {
@@ -133,6 +135,10 @@ struct mmc_host {
133 struct task_struct *sdio_irq_thread; 135 struct task_struct *sdio_irq_thread;
134 atomic_t sdio_irq_thread_abort; 136 atomic_t sdio_irq_thread_abort;
135 137
138#ifdef CONFIG_LEDS_TRIGGERS
139 struct led_trigger *led; /* activity led */
140#endif
141
136 unsigned long private[0] ____cacheline_aligned; 142 unsigned long private[0] ____cacheline_aligned;
137}; 143};
138 144