compat: backport sdio power management API
authorLuis R. Rodriguez <mcgrof@frijolero.org>
Mon, 7 May 2012 19:54:04 +0000 (12:54 -0700)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Mon, 7 May 2012 19:54:04 +0000 (12:54 -0700)
This backports the patch below by simply ignoring support for it
for older kernels.

commit da68c4eb258cd9f3f0b8aeb7e46b8118bb6358b6
Author: Nicolas Pitre <nico@fluxnic.net>
Date:   Fri Mar 5 13:43:31 2010 -0800

    sdio: introduce API for special power management features

    This patch series provides the core changes needed to allow SDIO cards to
    remain powered and active while the host system is suspended, and let them
    wake up the host system when needed.  This is used to implement
    wake-on-lan with SDIO wireless cards at the moment.  Patches to add that
    support to the libertas driver will be posted separately.

    This patch:

    Some SDIO cards have the ability to keep on running autonomously when the
    host system is suspended, and wake it up when needed.  This however
    requires that the host controller preserve power to the card, and
    configure itself appropriately for wake-up.

    There is however 4 layers of abstractions involved: the host controller
    driver, the MMC core code, the SDIO card management code, and the actual
    SDIO function driver.  To make things simple and manageable, host drivers
    must advertise their PM capabilities with a feature bitmask, then function
    drivers can query and set those features from their suspend method.  Then
    each layer in the suspend call chain is expected to act upon those bits
    accordingly.

    [akpm@linux-foundation.org: fix typo in comment]
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mcgrof@tux ~/compat (git::master)$ ckmake
Trying kernel                  3.4.0-030400rc1-generic  [OK]
Trying kernel                  3.3.0-030300rc2-generic  [OK]
Trying kernel                     3.2.2-030202-generic  [OK]
Trying kernel                    3.1.10-030110-generic  [OK]
Trying kernel                    3.0.18-030018-generic  [OK]
Trying kernel                  2.6.39-02063904-generic  [OK]
Trying kernel                  2.6.38-02063808-generic  [OK]
Trying kernel                  2.6.37-02063706-generic  [OK]
Trying kernel                  2.6.36-02063604-generic  [OK]
Trying kernel                  2.6.35-02063512-generic  [OK]
Trying kernel                  2.6.34-02063410-generic  [OK]
Trying kernel                  2.6.33-02063305-generic  [OK]
Trying kernel                  2.6.32-02063255-generic  [OK]
Trying kernel                  2.6.31-02063113-generic  [OK]
Trying kernel                  2.6.30-02063010-generic  [OK]
Trying kernel                  2.6.29-02062906-generic  [OK]
Trying kernel                  2.6.28-02062810-generic  [OK]
Trying kernel                    2.6.27-020627-generic  [OK]
Trying kernel                    2.6.26-020626-generic  [OK]
Trying kernel                    2.6.25-020625-generic  [OK]
Trying kernel                    2.6.24-020624-generic  [OK]

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
compat/Makefile
compat/compat-2.6.34.h [new file with mode: 0644]
compat/main.c
include/linux/compat-2.6.34.h

index f2beca892368db656d5901cae6b9205fc53c3251..bda677b636cd180c8e1f98e557c65092faa76c61 100644 (file)
@@ -23,6 +23,7 @@ compat-$(CONFIG_COMPAT_KERNEL_2_6_28) += compat-2.6.28.o
 compat-$(CONFIG_COMPAT_KERNEL_2_6_29) += compat-2.6.29.o
 compat-$(CONFIG_COMPAT_KERNEL_2_6_32) += compat-2.6.32.o
 compat-$(CONFIG_COMPAT_KERNEL_2_6_33) += compat-2.6.33.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_34) += compat-2.6.34.o
 compat-$(CONFIG_COMPAT_KERNEL_2_6_35) += compat-2.6.35.o
 compat-$(CONFIG_COMPAT_KERNEL_2_6_36) += compat-2.6.36.o
 
diff --git a/compat/compat-2.6.34.h b/compat/compat-2.6.34.h
new file mode 100644 (file)
index 0000000..173fe52
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef LINUX_26_34_COMPAT_PRIVATE_H
+#define LINUX_26_34_COMPAT_PRIVATE_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34))
+
+#include <linux/mmc/sdio_func.h>
+
+void init_compat_mmc_pm_flags(void);
+
+#else /* Kernels >= 2.6.34 */
+
+static inline void init_compat_mmc_pm_flags(void)
+{
+}
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */
+
+#endif /* LINUX_26_34_COMPAT_PRIVATE_H */
index 30a4a1ee6e071a592aa99918ed9247822933ba6e..e04cc88a7c06999ac686f46a4f865760af8687b5 100644 (file)
@@ -37,11 +37,13 @@ void compat_dependency_symbol(void)
 }
 EXPORT_SYMBOL_GPL(compat_dependency_symbol);
 
+
 static int __init compat_init(void)
 {
        /* pm-qos for kernels <= 2.6.24, this is a no-op on newer kernels */
        compat_pm_qos_power_init();
        compat_system_workqueue_create();
+       init_compat_mmc_pm_flags();
 
        printk(KERN_INFO
               COMPAT_PROJECT " backport release: "
index da242ce05367f713964f999cdde563c9ce2d3ac5..b5a40e2a6102d3f8d4f4b463fc26b37c9d70e855 100644 (file)
@@ -7,6 +7,24 @@
 
 #include <linux/netdevice.h>
 #include <linux/usb.h>
+#include <linux/mmc/sdio_func.h>
+
+/*
+ * Backports da68c4eb25
+ * sdio: introduce API for special power management features
+ *
+ * We wimply carry around the data structures and flags, and
+ * make the host return no flags set by the driver.
+ */
+typedef unsigned int mmc_pm_flag_t;
+
+#define MMC_PM_KEEP_POWER      (1 << 0)        /* preserve card power during suspend */
+#define MMC_PM_WAKE_SDIO_IRQ   (1 << 1)        /* wake up host system on SDIO IRQ assertion */
+
+extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);
+extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
+
+void init_compat_mmc_pm_flags(void);
 
 #define netdev_mc_count(dev) ((dev)->mc_count)
 #define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0)
@@ -267,9 +285,6 @@ static inline int usb_enable_autosuspend(struct usb_device *udev)
 static inline int usb_disable_autosuspend(struct usb_device *udev)
 { return 0; }
 
-#define MMC_PM_KEEP_POWER      (1 << 0)        /* preserve card power during suspend */
-#define sdio_set_host_pm_flags(a, b) 0
-
 #define rcu_dereference_protected(p, c) (p)
 #define rcu_access_pointer(p)   ACCESS_ONCE(p)
 
@@ -304,6 +319,13 @@ static inline int lockdep_rtnl_is_held(void)
 }
 #endif /* #ifdef CONFIG_PROVE_LOCKING */
 
+#else /* Kernels >= 2.6.34 */
+
+static inline void init_compat_mmc_pm_flags(void)
+{
+}
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */
 
+
 #endif /* LINUX_26_34_COMPAT_H */