AC Power handling broken for desktops
My G4/450 runs without AC Power, according to /proc/pmu/info:
PMU driver version : 2
PMU firmware version : 0c
AC Power : 0
Battery count : 0
It should report 1. Where is the best place to get the PMU_PWR_AC_PRESENT into ac_line_status?
Quoted 9 lines · Olaf Hering
My G4/450 runs without AC Power, according to
/proc/pmu/info:PMU driver version : 2
PMU firmware version : 0c
AC Power : 0
Battery count : 0It should report 1. Where is the best place to get the
PMU_PWR_AC_PRESENTintoac_line_status?
Do we get the bit set from the PMU ? If not, maybe we should hard code that value on non-laptops
Ben.
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 7 lines · Olaf Hering
My G4/450 runs without AC Power, according to
/proc/pmu/info:PMU driver version : 2
PMU firmware version : 0c
AC Power : 0
Battery count : 0
Quoted 5 lines
Quoted 2 lines
It should report 1. Where is the best place to get the
PMU_PWR_AC_PRESENTintoac_line_status?Do we get the bit set from the PMU ? If not, maybe we should hard code that value on non-laptops
Appearently not, how do I check it?
Quoted 10 lines · Olaf Hering
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 7 lines · Olaf Hering
My G4/450 runs without AC Power, according to
/proc/pmu/info:PMU driver version : 2
PMU firmware version : 0c
AC Power : 0
Battery count : 0
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
It should report 1. Where is the best place to get the
PMU_PWR_AC_PRESENTintoac_line_status?Do we get the bit set from the PMU ? If not, maybe we should hard code that value on non-laptops
Appearently not, how do I check it?
Not sure :) I don't fully know how to decode those power things in the device-tree... There are bits in darwin tho.
Ben
Quoted 2 lines · Benjamin Herrenschmidt
Not sure :) I don't fully know how to decode those power things in the device-tree... There are bits in darwin tho.
Maybe just check for !PowerBook and force PMU_PWR_AC_PRESENT in this case.
Quoted 6 lines · Olaf Hering
Quoted 2 lines · Benjamin Herrenschmidt
Not sure :) I don't fully know how to decode those power things in the device-tree... There are bits in darwin tho.
Maybe just check for !PowerBook and force
PMU_PWR_AC_PRESENTin this case.
Yah, you can check that with pmac_feature, there is a "mobile" flag.
Ben
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 6 lines · Olaf Hering
Quoted 2 lines · Benjamin Herrenschmidt
Not sure :) I don't fully know how to decode those power things in the device-tree... There are bits in darwin tho.
Maybe just check for !PowerBook and force
PMU_PWR_AC_PRESENTin this case.Yah, you can check that with
pmac_feature, there is a "mobile" flag.
Its not obvious how to get to that flag. Is this patch acceptable? No batteries present should mean AC Power == 1.
drivers/macintosh/apm_emu.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/macintosh/apm_emu.c +6 -2
@@ -430,8 +430,8 @@ static int apm_emu_get_info(char *buf, c-1: Unknown 8) min = minutes; sec = seconds */ -unsigned short ac_line_status =0xff ; -unsigned short battery_status =0xff ; +unsigned short ac_line_status; +unsigned short battery_status =0 ;unsigned short battery_flag =0xff ;int percentage =-1 ;int time_units =-1 ;
@@ -446,6 +446,7 @@ static int apm_emu_get_info(char *buf, c ac_line_status = ((pmu_power_flags &PMU_PWR_AC_PRESENT ) !=0 );for (i=0 ; i<pmu_battery_count; i++) {if (pmu_batteries[i].flags &PMU_BATT_PRESENT ) { + battery_status++;if (percentage <0 ) percentage =0 ;if (charge <0 )
@@ -461,6 +462,9 @@ static int apm_emu_get_info(char *buf, c charging++; } } +if (0 == battery_status) + ac_line_status =1 ; + battery_status =0xff ;if (real_count) {if (amperage <0 ) {if (btype ==PMU_BATT_TYPE_SMART )
Quoted 10 lines · Olaf Hering
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 6 lines · Olaf Hering
Quoted 2 lines · Benjamin Herrenschmidt
Not sure :) I don't fully know how to decode those power things in the device-tree... There are bits in darwin tho.
Maybe just check for !PowerBook and force
PMU_PWR_AC_PRESENTin this case.
Quoted 7 lines
Quoted 1 line
Yah, you can check that with
pmac_feature, there is a "mobile" flag.Its not obvious how to get to that flag. Is this patch acceptable? No batteries present should mean AC Power == 1.
drivers/macintosh/apm_emu.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
Looks good to me.
Ben
PATCH 1/1 AC Power handling broken for desktops
Currently, AC Power is 0 on a desktop G4.
No batteries present should mean AC Power == 1.
drivers/macintosh/apm_emu.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/macintosh/apm_emu.c +6 -2
@@ -430,8 +430,8 @@ static int apm_emu_get_info(char *buf, c-1: Unknown 8) min = minutes; sec = seconds */ -unsigned short ac_line_status =0xff ; -unsigned short battery_status =0xff ; +unsigned short ac_line_status; +unsigned short battery_status =0 ;unsigned short battery_flag =0xff ;int percentage =-1 ;int time_units =-1 ;
@@ -446,6 +446,7 @@ static int apm_emu_get_info(char *buf, c ac_line_status = ((pmu_power_flags &PMU_PWR_AC_PRESENT ) !=0 );for (i=0 ; i<pmu_battery_count; i++) {if (pmu_batteries[i].flags &PMU_BATT_PRESENT ) { + battery_status++;if (percentage <0 ) percentage =0 ;if (charge <0 )
@@ -461,6 +462,9 @@ static int apm_emu_get_info(char *buf, c charging++; } } +if (0 == battery_status) + ac_line_status =1 ; + battery_status =0xff ;if (real_count) {if (amperage <0 ) {if (btype ==PMU_BATT_TYPE_SMART )
Signature · 2 lines
short story of a lazy sysadmin: alias appserv=wotan
Quoted 4 lines
Quoted 2 lines
Not sure :) I don't fully know how to decode those power things in the device-tree... There are bits in darwin tho.
Maybe just check for !PowerBook and force
PMU_PWR_AC_PRESENTin this case.
Or just if battery count is 0, assume AC power ;-)
Segher