09 Jul, 2008

2 commits

  • rfkill_add_switch() calls rfkill_toggle_radio() to set the state of a
    recently registered rfkill class to the current global state [for that
    rfkill->type].

    The rfkill_toggle_radio() call is going to error out if the hardware is
    RFKILL_STATE_HARD_BLOCKED, and the global state is RFKILL_STATE_UNBLOCKED.

    That is a quite normal situation which I missed to account for. As things
    stand, the error return from rfkill_toggle_radio ends up causing
    rfkill_register to bail out with an error (de-registering the new switch in
    the process), which is Not Nice.

    Change rfkill_add_switch() to not return errors because of a failed call to
    rfkill_toggle_radio(). We can go back to returning errors again (if that's
    indeed the right thing to do) if we define the exact error codes the
    rfkill->toggle_radio callbacks are to return in each situation, so that we
    can ignore the right ones only.

    Bug reported by "kionez ".

    Signed-off-by: Henrique de Moraes Holschuh
    Cc: kionez
    Acked-by: Ivo van Doorn
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • Improve rfkill_toggle_radio's kernel-doc header a bit.

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     

27 Jun, 2008

12 commits

  • The current naming of rfkill_state causes a lot of confusion: not only the
    "kill" in rfkill suggests negative logic, but also the fact that rfkill cannot
    turn anything on (it can just force something off or stop forcing something
    off) is often forgotten.

    Rename RFKILL_STATE_OFF to RFKILL_STATE_SOFT_BLOCKED (transmitter is blocked
    and will not operate; state can be changed by a toggle_radio request), and
    RFKILL_STATE_ON to RFKILL_STATE_UNBLOCKED (transmitter is not blocked, and may
    operate).

    Also, add a new third state, RFKILL_STATE_HARD_BLOCKED (transmitter is blocked
    and will not operate; state cannot be changed through a toggle_radio request),
    which is used by drivers to indicate a wireless transmiter was blocked by a
    hardware rfkill line that accepts no overrides.

    Keep the old names as #defines, but document them as deprecated. This way,
    drivers can be converted to the new names *and* verified to actually use rfkill
    correctly one by one.

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • SW_RFKILL_ALL is the "emergency power-off all radios" input event. It must
    be handled, and must always do the same thing as far as the rfkill system
    is concerned: all transmitters are to go *immediately* offline.

    For safety, do NOT allow userspace to override EV_SW SW_RFKILL_ALL OFF. As
    long as rfkill-input is loaded, that event will *always* be processed, and
    it will *always* force all rfkill switches to disable all wireless
    transmitters, regardless of user_claim attribute or anything else.

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Cc: Dmitry Torokhov
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • The whole current_state thing seems completely useless and a source of
    problems in rfkill-input, since state comparison is already done in rfkill,
    and rfkill-input is more than likely to become out of sync with the real
    state.

    Signed-off-by: Fabien Crespel
    Acked-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Cc: Dmitry Torokhov
    Signed-off-by: John W. Linville

    Fabien Crespel
     
  • Use the notification chains to also send uevents, so that userspace can be
    notified of state changes of every rfkill switch.

    Userspace should use these events for OSD/status report applications and
    rfkill GUI frontends. HAL might want to broadcast them over DBUS, for
    example. It might be also useful for userspace implementations of
    rfkill-input, or to use HAL as the platform driver which promotes rfkill
    switch change events into input events (to synchronize all other switches)
    when necessary for platforms that lack a convenient platform-specific
    kernel module to do it.

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Cc: Dmitry Torokhov
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • We will need access to the rfkill switch type in string format for more
    than just sysfs. Therefore, move it to a generic helper.

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • Add a notifier chain for use by the rfkill class. This notifier chain
    signals the following events (more to be added when needed):

    1. rfkill: rfkill device state has changed

    A pointer to the rfkill struct will be passed as a parameter.

    The notifier message types have been added to include/linux/rfkill.h
    instead of to include/linux/notifier.h in order to avoid the madness of
    modifying a header used globally (and that triggers an almost full tree
    rebuild every time it is touched) with information that is of interest only
    to code that includes the rfkill.h header.

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • The resume handler should reset the wireless transmitter rfkill
    state to exactly what it was when the system was suspended. Do it,
    and do it using the normal routines for state change while at it.

    The suspend handler should force-switch the transmitter to blocked
    state, ignoring caches. Do it.

    Also take an opportunity shot to rfkill_remove_switch() and also
    force the transmitter to blocked state there, bypassing caches.

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • Unfortunately, instead of adding a generic Wireless WAN type, a technology-
    specific type (WiMAX) was added. That's useless for other WWAN devices,
    such as EDGE, UMTS, X-RTT and other such radios.

    Add a WWAN rfkill type for generic wireless WAN devices. No keys are added
    as most devices really want to use KEY_WLAN for WWAN control (in a cycle of
    none, WLAN, WWAN, WLAN+WWAN) and need no specific keycode added.

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Cc: Iñaky Pérez-González
    Cc: David S. Miller
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • Currently, rfkill support for read/write rfkill switches is hacked through
    a round-trip over the input layer and rfkill-input to let a driver sync
    rfkill->state to hardware changes.

    This is buggy and sub-optimal. It causes real problems. It is best to
    think of the rfkill class as supporting only write-only switches at the
    moment.

    In order to implement the read/write functionality properly:

    Add a get_state() hook that is called by the class every time it needs to
    fetch the current state of the switch. Add a call to this hook every time
    the *current* state of the radio plays a role in a decision.

    Also add a force_state() method that can be used to forcefully syncronize
    the class' idea of the current state of the switch. This allows for a
    faster implementation of the read/write functionality, as a driver which
    get events on switch changes can avoid the need for a get_state() hook.

    If the get_state() hook is left as NULL, current behaviour is maintained,
    so this change is fully backwards compatible with the current rfkill
    drivers.

    For hardware that issues events when the rfkill state changes, leave
    get_state() NULL in the rfkill struct, set the initial state properly
    before registering with the rfkill class, and use the force_state() method
    in the driver to keep the rfkill interface up-to-date.

    get_state() can be called by the class from atomic context. It must not
    sleep.

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Cc: Dmitry Torokhov
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • Currently, radios are always enabled when their rfkill interface is
    registered. This is not optimal, the safest state for a radio is to be
    offline unless the user turns it on.

    Add a module parameter that causes all radios to be disabled when their
    rfkill interface is registered. The module default is not changed so
    unless the parameter is used, radios will still be forced to their enabled
    state when they are registered.

    The new rfkill module parameter is called "default_state".

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • Teach rfkill-input how to handle SW_RFKILL_ALL events (new name for the
    SW_RADIO event).

    SW_RFKILL_ALL is an absolute enable-or-disable command that is tied to all
    radios in a system.

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Cc: Dmitry Torokhov
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     
  • Fix a minor typo in an exported function documentation

    Signed-off-by: Henrique de Moraes Holschuh
    Acked-by: Ivo van Doorn
    Cc: Dmitry Torokhov
    Signed-off-by: John W. Linville

    Henrique de Moraes Holschuh
     

16 Apr, 2008

1 commit

  • rfkill_switch_all() is supposed to only switch all the interfaces of a
    given type, but does not actually do this; instead, it just switches
    everything currently in the same state.

    Add the necessary type check in.

    (This fixes a bug I've been seeing while developing an rfkill laptop
    driver, with both bluetooth and wireless simultaneously changing state
    after only pressing either KEY_WLAN or KEY_BLUETOOTH).

    Signed-off-by: Carlos Corbacho
    Signed-off-by: John W. Linville

    Carlos Corbacho
     

24 Feb, 2008

1 commit

  • During the last step of hibernation in the "platform" mode (with the
    help of ACPI) we use the suspend code, including the devices'
    ->suspend() methods, to prepare the system for entering the ACPI S4
    system sleep state.

    But at least for some devices the operations performed by the
    ->suspend() callback in that case must be different from its operations
    during regular suspend.

    For this reason, introduce the new PM event type PM_EVENT_HIBERNATE and
    pass it to the device drivers' ->suspend() methods during the last phase
    of hibernation, so that they can distinguish this case and handle it as
    appropriate. Modify the drivers that handle PM_EVENT_SUSPEND in a
    special way and need to handle PM_EVENT_HIBERNATE in the same way.

    These changes are necessary to fix a hibernation regression related
    to the i915 driver (ref. http://lkml.org/lkml/2008/2/22/488).

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Tested-by: Jeff Chua
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     

03 Feb, 2008

1 commit


01 Feb, 2008

1 commit

  • Teach rfkill about wimax radios.

    Had to define a KEY_WIMAX as a 'key for disabling only wimax radios',
    as other radio technologies have. This makes sense as hardware has
    specific keys for disabling specific radios.

    The RFKILL enabling part is, otherwise, a copy and paste of any other
    radio technology.

    Signed-off-by: Inaky Perez-Gonzalez
    Signed-off-by: Ivo van Doorn
    Signed-off-by: John W. Linville
    Signed-off-by: David S. Miller

    Iñaky Pérez-González
     

21 Jan, 2008

1 commit


30 Nov, 2007

1 commit

  • rfkill_toggle_radio is called from functions where
    rfkill->mutex is already aquired.

    Remove the lock from rfkill_toggle_radio() and add it to
    the only calling function that calls it without the lock held.

    Signed-off-by: Michael Buesch
    Acked-by: Ivo van Doorn
    Signed-off-by: John W. Linville

    Michael Buesch
     

11 Nov, 2007

4 commits


20 Oct, 2007

1 commit

  • get rid of input BIT* duplicate defines

    use newly global defined macros for input layer. Also remove includes of
    input.h from non-input sources only for BIT macro definiton. Define the
    macro temporarily in local manner, all those local definitons will be
    removed further in this patchset (to not break bisecting).
    BIT macro will be globally defined (1<
    Cc:
    Acked-by: Jiri Kosina
    Cc:
    Acked-by: Marcel Holtmann
    Cc:
    Acked-by: Mauro Carvalho Chehab
    Cc:
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiri Slaby
     

11 Oct, 2007

5 commits

  • Buttons that work directly on hardware cannot support
    the "user_claim" functionality. Add a flag to signal
    this and return -EOPNOTSUPP in this case.
    b43 is such a device.

    Signed-off-by: Michael Buesch
    Acked-by: Ivo van Doorn
    Signed-off-by: John W. Linville
    Signed-off-by: David S. Miller

    Michael Buesch
     
  • This adds a LED trigger.

    Signed-off-by: Michael Buesch
    Acked-by: Ivo van Doorn
    Signed-off-by: John W. Linville
    Signed-off-by: David S. Miller

    Michael Buesch
     
  • rfkill_switch_all shouldn't be called by drivers directly,
    instead they should send a signal over the input device.

    To prevent confusion for driver developers, move the
    function into a rfkill private header.

    Signed-off-by: Ivo van Doorn
    Signed-off-by: David S. Miller

    Ivo van Doorn
     
  • This patch will add support for UWB keys to rfkill,
    support for this has been requested by Inaky.

    Signed-off-by: Ivo van Doorn
    Signed-off-by: David S. Miller

    Ivo van Doorn
     
  • As Dmitry pointed out earlier, rfkill-input.c
    doesn't support irda because there are no users
    and we shouldn't add unrequired KEY_ defines.

    However, RFKILL_TYPE_IRDA was defined in the
    rfkill.h header file and would confuse people
    about whether it is implemented or not.

    This patch removes IRDA support completely,
    so it can be added whenever a driver wants the
    feature.

    Signed-off-by: Ivo van Doorn
    Signed-off-by: David S. Miller

    Ivo van Doorn
     

19 Jul, 2007

2 commits


15 Jul, 2007

1 commit

  • Subject: [patch] net/input: fix net/rfkill/rfkill-input.c bug on 64-bit systems

    this recent commit:

    commit cf4328cd949c2086091c62c5685f1580fe9b55e4
    Author: Ivo van Doorn
    Date: Mon May 7 00:34:20 2007 -0700

    [NET]: rfkill: add support for input key to control wireless radio

    added this 64-bit bug:

    ....
    unsigned int flags;

    spin_lock_irqsave(&task->lock, flags);
    ....

    irq 'flags' must be unsigned long, not unsigned int. The -rt tree has
    strict checks about this on 64-bit so this triggered a build failure.

    Signed-off-by: Ingo Molnar
    Signed-off-by: David S. Miller

    Ingo Molnar
     

20 May, 2007

1 commit


07 May, 2007

1 commit