Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 311963
b: refs/heads/master
c: 15aa5c7
h: refs/heads/master
i:
  311961: b92db6a
  311959: cbadbb0
v: v3
  • Loading branch information
Mattia Dongili authored and Matthew Garrett committed Jun 26, 2012
1 parent 936caa9 commit 796e1f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bb384b5295323ed58260aeaff22d8bbe32988396
refs/heads/master: 15aa5c75468a103cdee1a0e0ec26aad979bf71a5
41 changes: 21 additions & 20 deletions trunk/drivers/platform/x86/sony-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1916,32 +1916,33 @@ static ssize_t sony_nc_battery_care_limit_store(struct device *dev,
* bits 4,5: store the limit into the EC
* bits 6,7: store the limit into the battery
*/
cmd = 0;

/*
* handle 0x0115 should allow storing on battery too;
* handle 0x0136 same as 0x0115 + health status;
* handle 0x013f, same as 0x0136 but no storing on the battery
*
* Store only inside the EC for now, regardless the handle number
*/
if (value == 0)
/* disable limits */
cmd = 0x0;
if (value > 0) {
if (value <= 50)
cmd = 0x20;

else if (value <= 50)
cmd = 0x21;
else if (value <= 80)
cmd = 0x10;

else if (value <= 80)
cmd = 0x11;
else if (value <= 100)
cmd = 0x30;

else
return -EINVAL;

else if (value <= 100)
cmd = 0x31;
/*
* handle 0x0115 should allow storing on battery too;
* handle 0x0136 same as 0x0115 + health status;
* handle 0x013f, same as 0x0136 but no storing on the battery
*/
if (bcare_ctl->handle != 0x013f)
cmd = cmd | (cmd << 2);

else
return -EINVAL;
cmd = (cmd | 0x1) << 0x10;
}

if (sony_call_snc_handle(bcare_ctl->handle, (cmd << 0x10) | 0x0100,
&result))
if (sony_call_snc_handle(bcare_ctl->handle, cmd | 0x0100, &result))
return -EIO;

return count;
Expand Down

0 comments on commit 796e1f5

Please sign in to comment.