static void pmic_irqtype_work(struct work_struct *work)
{
	struct pmic_gpio_irq *t =
		container_of(work, struct pmic_gpio_irq, work);
	unsigned long flags;
	int i;
	u16 type;

	spin_lock_irqsave(&t->lock, flags);
	/* As we drop the lock, we may need multiple scans if we race the
	   pmic_irq_type function */
	while (t->dirty) {
		/*
		 *	For each pin that has the dirty bit set send an IPC
		 *	message to configure the hardware via the PMIC
		 */
		for (i = 0; i < NUM_GPIO; i++) {
			if (!(t->dirty & (1 << i)))
				continue;
			t->dirty &= ~(1 << i);
			/* We can't trust the array entry or dirty
			   once the lock is dropped */
			type = t->trigger[i];
			spin_unlock_irqrestore(&t->lock, flags);
			pmic_program_irqtype(i, type);
			spin_lock_irqsave(&t->lock, flags);
		}
	}
	spin_unlock_irqrestore(&t->lock, flags);
}
Example #2
0
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);
}