Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3151dbb0 authored by Zhang Rui's avatar Zhang Rui Committed by Len Brown
Browse files

ACPI ac: update AC status upon sysfs query

parent e8a7e48b
Loading
Loading
Loading
Loading
+29 −17
Original line number Original line Diff line number Diff line
@@ -100,24 +100,7 @@ static const struct file_operations acpi_ac_fops = {
	.release = single_release,
	.release = single_release,
};
};
#endif
#endif
static int get_ac_property(struct power_supply *psy,
			   enum power_supply_property psp,
			   union power_supply_propval *val)
{
	struct acpi_ac *ac = to_acpi_ac(psy);
	switch (psp) {
	case POWER_SUPPLY_PROP_ONLINE:
		val->intval = ac->state;
		break;
	default:
		return -EINVAL;
	}
	return 0;
}


static enum power_supply_property ac_props[] = {
	POWER_SUPPLY_PROP_ONLINE,
};
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
                               AC Adapter Management
                               AC Adapter Management
   -------------------------------------------------------------------------- */
   -------------------------------------------------------------------------- */
@@ -140,6 +123,35 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
	return 0;
	return 0;
}
}


/* --------------------------------------------------------------------------
                            sysfs I/F
   -------------------------------------------------------------------------- */
static int get_ac_property(struct power_supply *psy,
			   enum power_supply_property psp,
			   union power_supply_propval *val)
{
	struct acpi_ac *ac = to_acpi_ac(psy);

	if (!ac)
		return -ENODEV;

	if (acpi_ac_get_state(ac))
		return -ENODEV;

	switch (psp) {
	case POWER_SUPPLY_PROP_ONLINE:
		val->intval = ac->state;
		break;
	default:
		return -EINVAL;
	}
	return 0;
}

static enum power_supply_property ac_props[] = {
	POWER_SUPPLY_PROP_ONLINE,
};

#ifdef CONFIG_ACPI_PROCFS_POWER
#ifdef CONFIG_ACPI_PROCFS_POWER
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
                              FS Interface (/proc)
                              FS Interface (/proc)