[PATCH] pcmcia: add SS_COMA state to distinguish between insert and resume events.

Rodolfo Giometti giometti at enneenne.com
Tue Apr 14 11:26:34 EDT 2009


From: Rodolfo Giometti <giometti at linux.it>

On some boards "turn off" mean "enter suspend mode" but on others mean
"turn off and remove power". Currently there are no ways to know if we
are inserting or resuming a device into per PCMCIA controller's
configure_socket() function. This new state flag should resolve this
issue.

Note that if the PCMCIA card is substituted during sleeping the system
should detect it thanks to the verify_cis_cache() function.

Signed-off-by: Rodolfo Giometti <giometti at linux.it>
---
 drivers/pcmcia/cs.c |   10 +++++++---
 include/pcmcia/ss.h |    1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 0660ad1..f7f1bbb 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -77,6 +77,10 @@ socket_state_t dead_socket = {
 	.csc_mask	= SS_DETECT,
 };
 EXPORT_SYMBOL(dead_socket);
+socket_state_t coma_socket = {
+	.flags		= SS_COMA,
+	.csc_mask	= SS_DETECT,
+};
 
 
 /* List of all sockets, protected by a rwsem */
@@ -471,7 +475,6 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
 	if (skt->power_hook)
 		skt->power_hook(skt, HOOK_POWER_PRE);
 
-	skt->socket.flags = 0;
 	skt->ops->set_socket(skt, &skt->socket);
 
 	/*
@@ -506,6 +509,7 @@ static int socket_insert(struct pcmcia_socket *skt)
 	if (!cs_socket_get(skt))
 		return -ENODEV;
 
+	skt->socket.flags = 0;
 	ret = socket_setup(skt, setup_delay);
 	if (ret == 0) {
 		skt->state |= SOCKET_PRESENT;
@@ -537,7 +541,7 @@ static int socket_suspend(struct pcmcia_socket *skt)
 		return -EBUSY;
 
 	send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW);
-	skt->socket = dead_socket;
+	skt->socket = coma_socket;
 	skt->ops->set_socket(skt, &skt->socket);
 	if (skt->ops->suspend)
 		skt->ops->suspend(skt);
@@ -558,7 +562,7 @@ static int socket_resume(struct pcmcia_socket *skt)
 	if (!(skt->state & SOCKET_SUSPEND))
 		return -EBUSY;
 
-	skt->socket = dead_socket;
+	skt->socket = coma_socket;
 	skt->ops->init(skt);
 	skt->ops->set_socket(skt, &skt->socket);
 
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 9b4ac93..e24d17a 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -68,6 +68,7 @@ extern socket_state_t dead_socket;
 #define SS_DMA_MODE	0x0080
 #define SS_SPKR_ENA	0x0100
 #define SS_OUTPUT_ENA	0x0200
+#define SS_COMA		0x0400
 
 /* Flags for I/O port and memory windows */
 #define MAP_ACTIVE	0x01
-- 
1.5.6.3




More information about the linux-pcmcia mailing list