diff options
| -rw-r--r-- | drivers/hid/wacom_sys.c | 2 | ||||
| -rw-r--r-- | drivers/hid/wacom_wac.c | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index dfa4be7eac8c..955ce7ceda89 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
| @@ -977,6 +977,8 @@ static int wacom_battery_get_property(struct power_supply *psy, | |||
| 977 | else if (wacom->wacom_wac.battery_capacity == 100 && | 977 | else if (wacom->wacom_wac.battery_capacity == 100 && |
| 978 | wacom->wacom_wac.ps_connected) | 978 | wacom->wacom_wac.ps_connected) |
| 979 | val->intval = POWER_SUPPLY_STATUS_FULL; | 979 | val->intval = POWER_SUPPLY_STATUS_FULL; |
| 980 | else if (wacom->wacom_wac.ps_connected) | ||
| 981 | val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; | ||
| 980 | else | 982 | else |
| 981 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; | 983 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; |
| 982 | break; | 984 | break; |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 726fedb87a16..57faf5b68b3d 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
| @@ -1917,7 +1917,7 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) | |||
| 1917 | 1917 | ||
| 1918 | connected = data[1] & 0x01; | 1918 | connected = data[1] & 0x01; |
| 1919 | if (connected) { | 1919 | if (connected) { |
| 1920 | int pid, battery, ps_connected, charging; | 1920 | int pid, battery, charging; |
| 1921 | 1921 | ||
| 1922 | if ((wacom->shared->type == INTUOSHT) && | 1922 | if ((wacom->shared->type == INTUOSHT) && |
| 1923 | wacom->shared->touch_input && | 1923 | wacom->shared->touch_input && |
| @@ -1929,16 +1929,14 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) | |||
| 1929 | 1929 | ||
| 1930 | pid = get_unaligned_be16(&data[6]); | 1930 | pid = get_unaligned_be16(&data[6]); |
| 1931 | battery = (data[5] & 0x3f) * 100 / 31; | 1931 | battery = (data[5] & 0x3f) * 100 / 31; |
| 1932 | ps_connected = !!(data[5] & 0x80); | 1932 | charging = !!(data[5] & 0x80); |
| 1933 | charging = ps_connected && wacom->battery_capacity < 100; | ||
| 1934 | if (wacom->pid != pid) { | 1933 | if (wacom->pid != pid) { |
| 1935 | wacom->pid = pid; | 1934 | wacom->pid = pid; |
| 1936 | wacom_schedule_work(wacom); | 1935 | wacom_schedule_work(wacom); |
| 1937 | } | 1936 | } |
| 1938 | 1937 | ||
| 1939 | if (wacom->shared->type) | 1938 | if (wacom->shared->type) |
| 1940 | wacom_notify_battery(wacom, battery, charging, | 1939 | wacom_notify_battery(wacom, battery, charging, 0); |
| 1941 | ps_connected); | ||
| 1942 | 1940 | ||
| 1943 | } else if (wacom->pid != 0) { | 1941 | } else if (wacom->pid != 0) { |
| 1944 | /* disconnected while previously connected */ | 1942 | /* disconnected while previously connected */ |
| @@ -1969,12 +1967,10 @@ static int wacom_status_irq(struct wacom_wac *wacom_wac, size_t len) | |||
| 1969 | 1967 | ||
| 1970 | if (data[9] & 0x02) { /* wireless module is attached */ | 1968 | if (data[9] & 0x02) { /* wireless module is attached */ |
| 1971 | int battery = (data[8] & 0x3f) * 100 / 31; | 1969 | int battery = (data[8] & 0x3f) * 100 / 31; |
| 1972 | bool ps_connected = !!(data[8] & 0x80); | 1970 | bool charging = !!(data[8] & 0x80); |
| 1973 | bool charging = ps_connected && | ||
| 1974 | wacom_wac->battery_capacity < 100; | ||
| 1975 | 1971 | ||
| 1976 | wacom_notify_battery(wacom_wac, battery, charging, | 1972 | wacom_notify_battery(wacom_wac, battery, charging, |
| 1977 | ps_connected); | 1973 | 1); |
| 1978 | 1974 | ||
| 1979 | if (!wacom->battery.dev && | 1975 | if (!wacom->battery.dev && |
| 1980 | !(features->quirks & WACOM_QUIRK_BATTERY)) { | 1976 | !(features->quirks & WACOM_QUIRK_BATTERY)) { |
