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

Commit 4a508dd2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-2639-rc4/i2c-fixes' of git://git.fluff.org/bjdooks/linux

* 'for-2639-rc4/i2c-fixes' of git://git.fluff.org/bjdooks/linux:
  i2c-omap: fixup commit cb527ede whitespace
  i2c-omap: Double clear of ARDY status in IRQ handler
  i2c-omap: fix build for !CONFIG_SUSPEND
  i2c-omap: fix static suspend vs. runtime suspend
  i2c-stu300: make sure adapter-name is terminated
parents c6ad1217 a5a595cc
Loading
Loading
Loading
Loading
+34 −1
Original line number Diff line number Diff line
@@ -847,11 +847,15 @@ omap_i2c_isr(int this_irq, void *dev_id)
			dev_err(dev->dev, "Arbitration lost\n");
			err |= OMAP_I2C_STAT_AL;
		}
		/*
		 * ProDB0017052: Clear ARDY bit twice
		 */
		if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK |
					OMAP_I2C_STAT_AL)) {
			omap_i2c_ack_stat(dev, stat &
				(OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR |
				OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
				OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR |
				OMAP_I2C_STAT_ARDY));
			omap_i2c_complete_cmd(dev, err);
			return IRQ_HANDLED;
		}
@@ -1137,12 +1141,41 @@ omap_i2c_remove(struct platform_device *pdev)
	return 0;
}

#ifdef CONFIG_SUSPEND
static int omap_i2c_suspend(struct device *dev)
{
	if (!pm_runtime_suspended(dev))
		if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_suspend)
			dev->bus->pm->runtime_suspend(dev);

	return 0;
}

static int omap_i2c_resume(struct device *dev)
{
	if (!pm_runtime_suspended(dev))
		if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_resume)
			dev->bus->pm->runtime_resume(dev);

	return 0;
}

static struct dev_pm_ops omap_i2c_pm_ops = {
	.suspend = omap_i2c_suspend,
	.resume = omap_i2c_resume,
};
#define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops)
#else
#define OMAP_I2C_PM_OPS NULL
#endif

static struct platform_driver omap_i2c_driver = {
	.probe		= omap_i2c_probe,
	.remove		= omap_i2c_remove,
	.driver		= {
		.name	= "omap_i2c",
		.owner	= THIS_MODULE,
		.pm	= OMAP_I2C_PM_OPS,
	},
};

+1 −1
Original line number Diff line number Diff line
@@ -942,7 +942,7 @@ stu300_probe(struct platform_device *pdev)
	adap->owner = THIS_MODULE;
	/* DDC class but actually often used for more generic I2C */
	adap->class = I2C_CLASS_DDC;
	strncpy(adap->name, "ST Microelectronics DDC I2C adapter",
	strlcpy(adap->name, "ST Microelectronics DDC I2C adapter",
		sizeof(adap->name));
	adap->nr = bus_nr;
	adap->algo = &stu300_algo;