aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/csr/sdio_events.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-19 16:15:42 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-19 16:37:01 -0700
commit635d2b00e5070378e7bf812acf47fb135c6ab928 (patch)
tree7048a0a511f3d221aa2dfe40aa3a401991f1b175 /drivers/staging/csr/sdio_events.c
parent15a4bc17b7f4e85cb019e683f14e834078ec2208 (diff)
Staging: add CSR wifi module
This consists of two modules, the driver, and a "helper" module that is just a wrapper around common kernel functions. The wrapper module will be removed soon, but for now it's needed. These files were based on the csr-linux-wifi-5.0.3-oss.tar.gz package provided by CSR and Blue Giga, and is covered under the license specified in the LICENSE.txt file (basically dual BSD and GPLv2). The files were flattened out of the deep directory mess they were originally in, and a few EXPORT_SYMBOL_GPL() were added in order for everything to link properly with the helper module setup. Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com> Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com> Cc: Riku Mettälä <riku.mettala@bluegiga.com> Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/csr/sdio_events.c')
-rw-r--r--drivers/staging/csr/sdio_events.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/drivers/staging/csr/sdio_events.c b/drivers/staging/csr/sdio_events.c
new file mode 100644
index 00000000000..e4f2d0d82fb
--- /dev/null
+++ b/drivers/staging/csr/sdio_events.c
@@ -0,0 +1,87 @@
+/*
+ * ---------------------------------------------------------------------------
+ * FILE: sdio_events.c
+ *
+ * PURPOSE:
+ * Process the events received by the SDIO glue layer.
+ * Optional part of the porting exercise.
+ *
+ * Copyright (C) 2009 by Cambridge Silicon Radio Ltd.
+ *
+ * Refer to LICENSE.txt included with this source code for details on
+ * the license terms.
+ *
+ * ---------------------------------------------------------------------------
+ */
+#include "unifi_priv.h"
+
+
+/*
+ * Porting Notes:
+ * There are two ways to support the suspend/resume system events in a driver.
+ * In some operating systems these events are delivered to the OS driver
+ * directly from the system. In this case, the OS driver needs to pass these
+ * events to the API described in the CSR SDIO Abstration API document.
+ * In Linux, and other embedded operating systems, the suspend/resume events
+ * come from the SDIO driver. In this case, simply get these events in the
+ * SDIO glue layer and notify the OS layer.
+ *
+ * In either case, typically, the events are processed by the SME.
+ * Use the unifi_sys_suspend_ind() and unifi_sys_resume_ind() to pass
+ * the events to the SME.
+ */
+
+/*
+ * ---------------------------------------------------------------------------
+ * unifi_suspend
+ *
+ * Handles a suspend request from the SDIO driver.
+ *
+ * Arguments:
+ * ospriv Pointer to OS driver context.
+ *
+ * ---------------------------------------------------------------------------
+ */
+void unifi_suspend(void *ospriv)
+{
+ unifi_priv_t *priv = ospriv;
+ int interfaceTag=0;
+
+ /* Stop network traffic. */
+ /* need to stop all the netdevices*/
+ for( interfaceTag=0;interfaceTag<CSR_WIFI_NUM_INTERFACES;interfaceTag++)
+ {
+ netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
+ if (interfacePriv->netdev_registered == 1)
+ {
+ netif_carrier_off(priv->netdev[interfaceTag]);
+ UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[interfaceTag]);
+ }
+ }
+ sme_sys_suspend(priv);
+} /* unifi_suspend() */
+
+
+/*
+ * ---------------------------------------------------------------------------
+ * unifi_resume
+ *
+ * Handles a resume request from the SDIO driver.
+ *
+ * Arguments:
+ * ospriv Pointer to OS driver context.
+ *
+ * ---------------------------------------------------------------------------
+ */
+void unifi_resume(void *ospriv)
+{
+ unifi_priv_t *priv = ospriv;
+ int r;
+
+ r = sme_sys_resume(priv);
+ if (r) {
+ unifi_error(priv, "Failed to resume UniFi\n");
+ }
+
+} /* unifi_resume() */
+