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

Merge branches 'acpi-scan', 'acpi-ec' and 'acpi-lpss'

* acpi-scan:
  ACPI: Run fixed event device notifications in process context
  ACPI / scan: Allow ACPI drivers to bind to PNP device objects

* acpi-ec:
  ACPI / EC: Add support to disallow QR_EC to be issued before completing previous QR_EC
  ACPI / EC: Add support to disallow QR_EC to be issued when SCI_EVT isn't set

* acpi-lpss:
  ACPI / LPSS: Add ACPI IDs for Intel Braswell
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -196,6 +196,17 @@ static struct lpss_device_desc byt_i2c_dev_desc = {
	.setup = lpss_i2c_setup,
};

static struct lpss_shared_clock bsw_pwm_clock = {
	.name = "pwm_clk",
	.rate = 19200000,
};

static struct lpss_device_desc bsw_pwm_dev_desc = {
	.clk_required = true,
	.save_ctx = true,
	.shared_clock = &bsw_pwm_clock,
};

#else

#define LPSS_ADDR(desc) (0UL)
@@ -225,6 +236,12 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
	{ "INT33B2", },
	{ "INT33FC", },

	/* Braswell LPSS devices */
	{ "80862288", LPSS_ADDR(bsw_pwm_dev_desc) },
	{ "8086228A", LPSS_ADDR(byt_uart_dev_desc) },
	{ "8086228E", LPSS_ADDR(byt_spi_dev_desc) },
	{ "808622C1", LPSS_ADDR(byt_i2c_dev_desc) },

	{ "INT3430", LPSS_ADDR(lpt_dev_desc) },
	{ "INT3431", LPSS_ADDR(lpt_dev_desc) },
	{ "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) },
+18 −3
Original line number Diff line number Diff line
@@ -197,6 +197,8 @@ static bool advance_transaction(struct acpi_ec *ec)
				t->rdata[t->ri++] = acpi_ec_read_data(ec);
				if (t->rlen == t->ri) {
					t->flags |= ACPI_EC_COMMAND_COMPLETE;
					if (t->command == ACPI_EC_COMMAND_QUERY)
						pr_debug("hardware QR_EC completion\n");
					wakeup = true;
				}
			} else
@@ -208,7 +210,20 @@ static bool advance_transaction(struct acpi_ec *ec)
		}
		return wakeup;
	} else {
		if ((status & ACPI_EC_FLAG_IBF) == 0) {
		/*
		 * There is firmware refusing to respond QR_EC when SCI_EVT
		 * is not set, for which case, we complete the QR_EC
		 * without issuing it to the firmware.
		 * https://bugzilla.kernel.org/show_bug.cgi?id=86211
		 */
		if (!(status & ACPI_EC_FLAG_SCI) &&
		    (t->command == ACPI_EC_COMMAND_QUERY)) {
			t->flags |= ACPI_EC_COMMAND_POLL;
			t->rdata[t->ri++] = 0x00;
			t->flags |= ACPI_EC_COMMAND_COMPLETE;
			pr_debug("software QR_EC completion\n");
			wakeup = true;
		} else if ((status & ACPI_EC_FLAG_IBF) == 0) {
			acpi_ec_write_cmd(ec, t->command);
			t->flags |= ACPI_EC_COMMAND_POLL;
		} else
@@ -288,11 +303,11 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
	/* following two actions should be kept atomic */
	ec->curr = t;
	start_transaction(ec);
	if (ec->curr->command == ACPI_EC_COMMAND_QUERY)
		clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
	spin_unlock_irqrestore(&ec->lock, tmp);
	ret = ec_poll(ec);
	spin_lock_irqsave(&ec->lock, tmp);
	if (ec->curr->command == ACPI_EC_COMMAND_QUERY)
		clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
	ec->curr = NULL;
	spin_unlock_irqrestore(&ec->lock, tmp);
	return ret;
+11 −6
Original line number Diff line number Diff line
@@ -922,12 +922,17 @@ static void acpi_device_notify(acpi_handle handle, u32 event, void *data)
	device->driver->ops.notify(device, event);
}

static acpi_status acpi_device_notify_fixed(void *data)
static void acpi_device_notify_fixed(void *data)
{
	struct acpi_device *device = data;

	/* Fixed hardware devices have no handles */
	acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device);
}

static acpi_status acpi_device_fixed_event(void *data)
{
	acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data);
	return AE_OK;
}

@@ -938,12 +943,12 @@ static int acpi_device_install_notify_handler(struct acpi_device *device)
	if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON)
		status =
		    acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
						     acpi_device_notify_fixed,
						     acpi_device_fixed_event,
						     device);
	else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON)
		status =
		    acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
						     acpi_device_notify_fixed,
						     acpi_device_fixed_event,
						     device);
	else
		status = acpi_install_notify_handler(device->handle,
@@ -960,10 +965,10 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
{
	if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON)
		acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
						acpi_device_notify_fixed);
						acpi_device_fixed_event);
	else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON)
		acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
						acpi_device_notify_fixed);
						acpi_device_fixed_event);
	else
		acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
					   acpi_device_notify);
@@ -975,7 +980,7 @@ static int acpi_device_probe(struct device *dev)
	struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver);
	int ret;

	if (acpi_dev->handler)
	if (acpi_dev->handler && !acpi_is_pnp_device(acpi_dev))
		return -EINVAL;

	if (!acpi_drv->ops.add)