|
@@ -9,6 +9,7 @@
|
|
|
#include "gpioregs.h"
|
|
#include "gpioregs.h"
|
|
|
|
|
|
|
|
extern struct kobject *hwmon_kobj;
|
|
extern struct kobject *hwmon_kobj;
|
|
|
|
|
+int sysfs_power_off_flag = 0;
|
|
|
|
|
|
|
|
static int wait_ibf(void)
|
|
static int wait_ibf(void)
|
|
|
{
|
|
{
|
|
@@ -87,6 +88,10 @@ static ssize_t ac_power_show(struct kobject *kobj, struct kobj_attribute *attr,
|
|
|
if (oem_ec_read_ram(2, 0x36, &val) < 0)
|
|
if (oem_ec_read_ram(2, 0x36, &val) < 0)
|
|
|
return -1;
|
|
return -1;
|
|
|
ac_power_flag = (val & 0x03) ? 1 : 0;
|
|
ac_power_flag = (val & 0x03) ? 1 : 0;
|
|
|
|
|
+ if(sysfs_power_off_flag == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ ac_power_flag = 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return sprintf(buf, "%d\n", ac_power_flag);
|
|
return sprintf(buf, "%d\n", ac_power_flag);
|
|
|
}
|
|
}
|
|
@@ -94,7 +99,28 @@ static ssize_t ac_power_show(struct kobject *kobj, struct kobj_attribute *attr,
|
|
|
static ssize_t ac_power_store(struct kobject *kobj, struct kobj_attribute *attr,
|
|
static ssize_t ac_power_store(struct kobject *kobj, struct kobj_attribute *attr,
|
|
|
const char *buf, size_t count)
|
|
const char *buf, size_t count)
|
|
|
{
|
|
{
|
|
|
- return -EINVAL;
|
|
|
|
|
|
|
+ u32 val;
|
|
|
|
|
+ int ret;
|
|
|
|
|
+
|
|
|
|
|
+ ret = kstrtou32(buf, 10, &val);
|
|
|
|
|
+ if (ret < 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ pr_err("ac_power_store format error\n");
|
|
|
|
|
+ return ret;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(val != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ pr_err("ac_power_store only support 0\n");
|
|
|
|
|
+ return -EINVAL;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(val == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ sysfs_power_off_flag = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return count;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static struct kobj_attribute ac_power =
|
|
static struct kobj_attribute ac_power =
|