misc: bt rfkill: toggle power GPIO based on current power state
Nagarjuna Kristam [Mon, 14 May 2012 06:50:05 +0000 (11:50 +0530)]
check if requested state and current BT power state is same,
if yes, do not toggle BT power GPIO's.
if not, set requested power state.

Bug 982600
Bug 928604

Change-Id: I82c65fd6d43940c86cc3de440295ba179a4ade33
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: http://git-master/r/102190
Reviewed-by: Rakesh Kumar <krakesh@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/misc/bcm4329_rfkill.c

index a077326..cf56768 100644 (file)
@@ -44,6 +44,13 @@ static struct bcm4329_rfkill_data *bcm4329_rfkill;
 
 static int bcm4329_bt_rfkill_set_power(void *data, bool blocked)
 {
+       /*
+        * check if BT gpio_shutdown line status and current request are same.
+        * If same, then return, else perform requested operation.
+        */
+       if (gpio_get_value(bcm4329_rfkill->gpio_shutdown) && !blocked)
+               return 0;
+
        if (blocked) {
                if (bcm4329_rfkill->gpio_shutdown)
                        gpio_direction_output(bcm4329_rfkill->gpio_shutdown, 0);