Skip to content

Commit

Permalink
sony-laptop: notify userspace of GFX switch position changes
Browse files Browse the repository at this point in the history
Some Vaios come with both integrated and discrete graphics, plus a
switch for choosing one of the two. When the switch position is changed,
a notification is generated.

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
  • Loading branch information
Marco Chiappero authored and Matthew Garrett committed Jun 26, 2012
1 parent 4069d6f commit bb384b5
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion drivers/platform/x86/sony-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,8 @@ static int sony_nc_hotkeys_decode(u32 event, unsigned int handle)
*/
enum event_types {
HOTKEY = 1,
KILLSWITCH
KILLSWITCH,
GFX_SWITCH
};
static void sony_nc_notify(struct acpi_device *device, u32 event)
{
Expand Down Expand Up @@ -1230,6 +1231,24 @@ static void sony_nc_notify(struct acpi_device *device, u32 event)

break;

case 0x0128:
case 0x0146:
/* Hybrid GFX switching */
sony_call_snc_handle(handle, 0x0000, &result);
dprintk("GFX switch event received (reason: %s)\n",
(result & 0x01) ?
"switch change" : "unknown");

/* verify the switch state
* 1: discrete GFX
* 0: integrated GFX
*/
sony_call_snc_handle(handle, 0x0100, &result);

ev_type = GFX_SWITCH;
real_ev = result & 0xff;
break;

default:
dprintk("Unknown event 0x%x for handle 0x%x\n",
event, handle);
Expand Down

0 comments on commit bb384b5

Please sign in to comment.