Skip to content

Commit

Permalink
xo1-rfkill: only act when blocked state is changed
Browse files Browse the repository at this point in the history
The XO-1 rfkill driver should only send EC commands when changing
between blocked/unblocked state.

The rfkill switch is asked to be unblocked on every resume (even when
the card was never blocked before) and sending a EC_WLAN_LEAVE_RESET
command here upsets the resume sequence of the libertas driver. Adding
the check to avoid the spurious EC_WLAN_LEAVE_RESET fixes the wifi resume
behaviour.

The rfkill state is maintained by the hardware over suspend/resume
so no extra consideration is needed here.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
  • Loading branch information
Daniel Drake authored and Matthew Garrett committed May 31, 2012
1 parent 14b234b commit bc7ab49
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/platform/x86/xo1-rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,26 @@

#include <asm/olpc.h>

static bool card_blocked;

static int rfkill_set_block(void *data, bool blocked)
{
unsigned char cmd;
int r;

if (blocked == card_blocked)
return 0;

if (blocked)
cmd = EC_WLAN_ENTER_RESET;
else
cmd = EC_WLAN_LEAVE_RESET;

return olpc_ec_cmd(cmd, NULL, 0, NULL, 0);
r = olpc_ec_cmd(cmd, NULL, 0, NULL, 0);
if (r == 0)
card_blocked = blocked;

return r;
}

static const struct rfkill_ops rfkill_ops = {
Expand Down

0 comments on commit bc7ab49

Please sign in to comment.