Commit fa0d938c authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branches 'acpi-pmic', 'acpi-battery' and 'acpi-numa'

Merge ACPI PMIC driver changes, updates related to the ACPI battery and
SBS drivers and NUMA-related ACPI updates for 6.11-rc1:

 - Clean up the ACPI PMIC driver in multiple ways (Andy
   Shevchenko, Christophe JAILLET).

 - Add support for charge limiting state to the ACPI battery driver
   and update _OSC to indicate support for it (Armin Wolf).

 - Clean up the sysfs interface in the ACPI battery, SBS (smart battery
   subsystem) and AC drivers (Thomas Weißschuh).

 - Coordinate header includes in the ACPI NUMA code and make it use
   ACCESS_COORDINATE_CPU when appropriate (Huang Ying, Thorsten Blum).

* acpi-pmic:
  ACPI: PMIC: Constify struct pmic_table
  ACPI: PMIC: Replace open coded be16_to_cpu()
  ACPI: PMIC: Convert pr_*() to dev_*() printing macros
  ACPI: PMIC: Use sizeof() instead of hard coded value

* acpi-battery:
  ACPI: bus: Indicate support for battery charge limiting thru _OSC
  ACPI: battery: Add support for charge limiting state
  ACPI: SBS: manage alarm sysfs attribute through psy core
  ACPI: battery: create alarm sysfs attribute atomically
  ACPI: battery: use sysfs_emit over sprintf
  ACPI: battery: constify powersupply properties
  ACPI: SBS: constify powersupply properties
  ACPI: AC: constify powersupply properties

* acpi-numa:
  ACPI: NUMA: Consolidate header includes
  ACPI: HMAT: Use ACCESS_COORDINATE_CPU when appropriate
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ static int get_ac_property(struct power_supply *psy,
	return 0;
}

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

+24 −13
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#define ACPI_BATTERY_STATE_DISCHARGING		0x1
#define ACPI_BATTERY_STATE_CHARGING		0x2
#define ACPI_BATTERY_STATE_CRITICAL		0x4
#define ACPI_BATTERY_STATE_CHARGE_LIMITING	0x8

#define MAX_STRING_LENGTH	64

@@ -155,7 +156,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery);

static int acpi_battery_is_charged(struct acpi_battery *battery)
{
	/* charging, discharging or critical low */
	/* charging, discharging, critical low or charge limited */
	if (battery->state != 0)
		return 0;

@@ -215,6 +216,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
			val->intval = acpi_battery_handle_discharging(battery);
		else if (battery->state & ACPI_BATTERY_STATE_CHARGING)
			val->intval = POWER_SUPPLY_STATUS_CHARGING;
		else if (battery->state & ACPI_BATTERY_STATE_CHARGE_LIMITING)
			val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
		else if (acpi_battery_is_charged(battery))
			val->intval = POWER_SUPPLY_STATUS_FULL;
		else
@@ -308,7 +311,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
	return ret;
}

static enum power_supply_property charge_battery_props[] = {
static const enum power_supply_property charge_battery_props[] = {
	POWER_SUPPLY_PROP_STATUS,
	POWER_SUPPLY_PROP_PRESENT,
	POWER_SUPPLY_PROP_TECHNOLOGY,
@@ -326,7 +329,7 @@ static enum power_supply_property charge_battery_props[] = {
	POWER_SUPPLY_PROP_SERIAL_NUMBER,
};

static enum power_supply_property charge_battery_full_cap_broken_props[] = {
static const enum power_supply_property charge_battery_full_cap_broken_props[] = {
	POWER_SUPPLY_PROP_STATUS,
	POWER_SUPPLY_PROP_PRESENT,
	POWER_SUPPLY_PROP_TECHNOLOGY,
@@ -340,7 +343,7 @@ static enum power_supply_property charge_battery_full_cap_broken_props[] = {
	POWER_SUPPLY_PROP_SERIAL_NUMBER,
};

static enum power_supply_property energy_battery_props[] = {
static const enum power_supply_property energy_battery_props[] = {
	POWER_SUPPLY_PROP_STATUS,
	POWER_SUPPLY_PROP_PRESENT,
	POWER_SUPPLY_PROP_TECHNOLOGY,
@@ -358,7 +361,7 @@ static enum power_supply_property energy_battery_props[] = {
	POWER_SUPPLY_PROP_SERIAL_NUMBER,
};

static enum power_supply_property energy_battery_full_cap_broken_props[] = {
static const enum power_supply_property energy_battery_full_cap_broken_props[] = {
	POWER_SUPPLY_PROP_STATUS,
	POWER_SUPPLY_PROP_PRESENT,
	POWER_SUPPLY_PROP_TECHNOLOGY,
@@ -661,7 +664,7 @@ static ssize_t acpi_battery_alarm_show(struct device *dev,
{
	struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));

	return sprintf(buf, "%d\n", battery->alarm * 1000);
	return sysfs_emit(buf, "%d\n", battery->alarm * 1000);
}

static ssize_t acpi_battery_alarm_store(struct device *dev,
@@ -678,12 +681,18 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
	return count;
}

static const struct device_attribute alarm_attr = {
static struct device_attribute alarm_attr = {
	.attr = {.name = "alarm", .mode = 0644},
	.show = acpi_battery_alarm_show,
	.store = acpi_battery_alarm_store,
};

static struct attribute *acpi_battery_attrs[] = {
	&alarm_attr.attr,
	NULL
};
ATTRIBUTE_GROUPS(acpi_battery);

/*
 * The Battery Hooking API
 *
@@ -823,7 +832,10 @@ static void __exit battery_hook_exit(void)

static int sysfs_add_battery(struct acpi_battery *battery)
{
	struct power_supply_config psy_cfg = { .drv_data = battery, };
	struct power_supply_config psy_cfg = {
		.drv_data = battery,
		.attr_grp = acpi_battery_groups,
	};
	bool full_cap_broken = false;

	if (!ACPI_BATTERY_CAPACITY_VALID(battery->full_charge_capacity) &&
@@ -868,7 +880,7 @@ static int sysfs_add_battery(struct acpi_battery *battery)
		return result;
	}
	battery_hook_add_battery(battery);
	return device_create_file(&battery->bat->dev, &alarm_attr);
	return 0;
}

static void sysfs_remove_battery(struct acpi_battery *battery)
@@ -879,7 +891,6 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
		return;
	}
	battery_hook_remove_battery(battery);
	device_remove_file(&battery->bat->dev, &alarm_attr);
	power_supply_unregister(battery->bat);
	battery->bat = NULL;
	mutex_unlock(&battery->sysfs_lock);
+2 −0
Original line number Diff line number Diff line
@@ -329,6 +329,8 @@ static void acpi_bus_osc_negotiate_platform_control(void)
		capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT;
	if (IS_ENABLED(CONFIG_ACPI_THERMAL))
		capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_FAST_THERMAL_SAMPLING_SUPPORT;
	if (IS_ENABLED(CONFIG_ACPI_BATTERY))
		capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_BATTERY_CHARGE_LIMITING_SUPPORT;

	capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
	capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT;
+3 −3
Original line number Diff line number Diff line
@@ -408,7 +408,7 @@ static __init void hmat_update_target(unsigned int tgt_pxm, unsigned int init_px
	if (target && target->processor_pxm == init_pxm) {
		hmat_update_target_access(target, type, value,
					  ACCESS_COORDINATE_LOCAL);
		/* If the node has a CPU, update access 1 */
		/* If the node has a CPU, update access ACCESS_COORDINATE_CPU */
		if (node_state(pxm_to_node(init_pxm), N_CPU))
			hmat_update_target_access(target, type, value,
						  ACCESS_COORDINATE_CPU);
@@ -948,7 +948,7 @@ static int hmat_set_default_dram_perf(void)
		target = find_mem_target(pxm);
		if (!target)
			continue;
		attrs = &target->coord[1];
		attrs = &target->coord[ACCESS_COORDINATE_CPU];
		rc = mt_set_default_dram_perf(nid, attrs, "ACPI HMAT");
		if (rc)
			return rc;
@@ -975,7 +975,7 @@ static int hmat_calculate_adistance(struct notifier_block *self,
	hmat_update_target_attrs(target, p_nodes, ACCESS_COORDINATE_CPU);
	mutex_unlock(&target_lock);

	perf = &target->coord[1];
	perf = &target->coord[ACCESS_COORDINATE_CPU];

	if (mt_perf_to_adistance(perf, adist))
		return NOTIFY_OK;
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ struct intel_pmic_opregion {

static struct intel_pmic_opregion *intel_pmic_opregion;

static int pmic_get_reg_bit(int address, struct pmic_table *table,
static int pmic_get_reg_bit(int address, const struct pmic_table *table,
			    int count, int *reg, int *bit)
{
	int i;
Loading