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

Commit 65d7ac03 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Matthew Garrett
Browse files

platform-drivers: x86: pmic: Restore the dropped buslock/unlock



When I added the buslock/unlock mechanism to the pmic code in order to
get rid of the horrible work queue stuff, stupid me missed to add the
new callbacks to the irq_chip.

In consequence Andrew removed the unused functions, but I missed that.

Add them back and hook them up proper.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent fef34861
Loading
Loading
Loading
Loading
+39 −4
Original line number Diff line number Diff line
@@ -74,6 +74,19 @@ struct pmic_gpio {
	u32			trigger_type;
};

static void pmic_program_irqtype(int gpio, int type)
{
	if (type & IRQ_TYPE_EDGE_RISING)
		intel_scu_ipc_update_register(GPIO0 + gpio, 0x20, 0x20);
	else
		intel_scu_ipc_update_register(GPIO0 + gpio, 0x00, 0x20);

	if (type & IRQ_TYPE_EDGE_FALLING)
		intel_scu_ipc_update_register(GPIO0 + gpio, 0x10, 0x10);
	else
		intel_scu_ipc_update_register(GPIO0 + gpio, 0x00, 0x10);
};

static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{
	if (offset > 8) {
@@ -166,6 +179,26 @@ static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
	return pg->irq_base + offset;
}

static void pmic_bus_lock(struct irq_data *data)
{
	struct pmic_gpio *pg = irq_data_get_irq_chip_data(data);

	mutex_lock(&pg->buslock);
}

static void pmic_bus_sync_unlock(struct irq_data *data)
{
	struct pmic_gpio *pg = irq_data_get_irq_chip_data(data);

	if (pg->update_type) {
		unsigned int gpio = pg->update_type & ~GPIO_UPDATE_TYPE;

		pmic_program_irqtype(gpio, pg->trigger_type);
		pg->update_type = 0;
	}
	mutex_unlock(&pg->buslock);
}

/* the gpiointr register is read-clear, so just do nothing. */
static void pmic_irq_unmask(struct irq_data *data) { }

@@ -176,6 +209,8 @@ static struct irq_chip pmic_irqchip = {
	.irq_mask		= pmic_irq_mask,
	.irq_unmask		= pmic_irq_unmask,
	.irq_set_type		= pmic_irq_type,
	.irq_bus_lock		= pmic_irq_buslock,
	.irq_bus_sync_unlock	= pmic_bus_sync_unlock,
};

static irqreturn_t pmic_irq_handler(int irq, void *data)