--- v4
+++ v2
@@ -6,32 +6,24 @@
Changes in v2:
Added this patch newly in this patch series.
-Changes in v3:
- No changes.
+ drivers/iio/adc/ti_adc.c | 32 ++++++++++++++++++++++++++++++++
+ drivers/input/touchscreen/ti_tsc.c | 33 +++++++++++++++++++++++++++++++++
+ drivers/mfd/ti_tscadc.c | 33 ++++++++++++++++++++++++++++++++-
+ include/linux/mfd/ti_tscadc.h | 3 +++
+ 4 files changed, 100 insertions(+), 1 deletions(-)
-Changes in v4:
- Replaced suspend/resume callbacks with dev_pm_ops.
-
- drivers/iio/adc/ti_am335x_adc.c | 42 +++++++++++++++++++++++++++++
- drivers/input/touchscreen/ti_am335x_tsc.c | 42 +++++++++++++++++++++++++++++
- drivers/mfd/ti_am335x_tscadc.c | 41 +++++++++++++++++++++++++++-
- include/linux/mfd/ti_am335x_tscadc.h | 3 ++
- 4 files changed, 127 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
-index 9e1b3ac..b16f944 100644
---- a/drivers/iio/adc/ti_am335x_adc.c
-+++ b/drivers/iio/adc/ti_am335x_adc.c
-@@ -200,10 +200,52 @@ static int __devexit tiadc_remove(struct platform_device *pdev)
+diff --git a/drivers/iio/adc/ti_adc.c b/drivers/iio/adc/ti_adc.c
+index d2e621c..14601f0 100644
+--- a/drivers/iio/adc/ti_adc.c
++++ b/drivers/iio/adc/ti_adc.c
+@@ -200,6 +200,36 @@ static int __devexit tiadc_remove(struct platform_device *pdev)
return 0;
}
-+#ifdef CONFIG_PM
-+static int tiadc_suspend(struct device *dev)
++static int adc_suspend(struct platform_device *pdev, pm_message_t state)
+{
-+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
-+ struct tiadc_device *adc_dev = iio_priv(indio_dev);
-+ struct ti_tscadc_dev *tscadc_dev = dev->platform_data;
++ struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data;
++ struct adc_device *adc_dev = tscadc_dev->adc;
+ unsigned int idle;
+
+ if (!device_may_wakeup(tscadc_dev->dev)) {
@@ -43,10 +35,10 @@
+ return 0;
+}
+
-+static int tiadc_resume(struct device *dev)
++static int adc_resume(struct platform_device *pdev)
+{
-+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
-+ struct tiadc_device *adc_dev = iio_priv(indio_dev);
++ struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data;
++ struct adc_device *adc_dev = tscadc_dev->adc;
+ unsigned int restore;
+
+ /* Make sure ADC is powered up */
@@ -58,36 +50,30 @@
+ return 0;
+}
+
-+static const struct dev_pm_ops tiadc_pm_ops = {
-+ .suspend = tiadc_suspend,
-+ .resume = tiadc_resume,
-+};
-+#define TIADC_PM_OPS (&tiadc_pm_ops)
-+#else
-+#define TIADC_PM_OPS NULL
-+#endif
-+
static struct platform_driver tiadc_driver = {
.driver = {
.name = "tiadc",
- .owner = THIS_MODULE,
-+ .pm = TIADC_PM_OPS,
+@@ -207,6 +237,8 @@ static struct platform_driver tiadc_driver = {
},
.probe = tiadc_probe,
.remove = __devexit_p(tiadc_remove),
-diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
-index 2d9dec1..b17dbe4 100644
---- a/drivers/input/touchscreen/ti_am335x_tsc.c
-+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
-@@ -338,12 +338,54 @@ static int __devexit tscadc_remove(struct platform_device *pdev)
++ .suspend = adc_suspend,
++ .resume = adc_resume,
+ };
+
+ module_platform_driver(tiadc_driver);
+diff --git a/drivers/input/touchscreen/ti_tsc.c b/drivers/input/touchscreen/ti_tsc.c
+index ca8ce73..f103e5f 100644
+--- a/drivers/input/touchscreen/ti_tsc.c
++++ b/drivers/input/touchscreen/ti_tsc.c
+@@ -338,6 +338,37 @@ static int __devexit tscadc_remove(struct platform_device *pdev)
return 0;
}
-+#ifdef CONFIG_PM
-+static int titsc_suspend(struct device *dev)
++static int tsc_suspend(struct platform_device *pdev, pm_message_t state)
+{
-+ struct ti_tscadc_dev *tscadc_dev = dev->platform_data;
-+ struct tscadc *ts_dev = tscadc_dev->tsc;
++ struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data;
++ struct tscadc *ts_dev = tscadc_dev->tsc;
+ unsigned int idle;
+
+ if (device_may_wakeup(tscadc_dev->dev)) {
@@ -99,10 +85,10 @@
+ return 0;
+}
+
-+static int titsc_resume(struct device *dev)
++static int tsc_resume(struct platform_device *pdev)
+{
-+ struct ti_tscadc_dev *tscadc_dev = dev->platform_data;
-+ struct tscadc *ts_dev = tscadc_dev->tsc;
++ struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data;
++ struct tscadc *ts_dev = tscadc_dev->tsc;
+
+ if (device_may_wakeup(tscadc_dev->dev)) {
+ tscadc_writel(ts_dev, REG_IRQWAKEUP,
@@ -115,29 +101,22 @@
+ return 0;
+}
+
-+static const struct dev_pm_ops titsc_pm_ops = {
-+ .suspend = titsc_suspend,
-+ .resume = titsc_resume,
-+};
-+#define TITSC_PM_OPS (&titsc_pm_ops)
-+#else
-+#define TITSC_PM_OPS NULL
-+#endif
-+
static struct platform_driver ti_tsc_driver = {
.probe = tscadc_probe,
.remove = __devexit_p(tscadc_remove),
- .driver = {
+@@ -345,6 +376,8 @@ static struct platform_driver ti_tsc_driver = {
.name = "tsc",
.owner = THIS_MODULE,
-+ .pm = TITSC_PM_OPS,
},
++ .suspend = tsc_suspend,
++ .resume = tsc_resume,
};
module_platform_driver(ti_tsc_driver);
-diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
-index 45d66e5..7e949e8 100644
---- a/drivers/mfd/ti_am335x_tscadc.c
-+++ b/drivers/mfd/ti_am335x_tscadc.c
+
+diff --git a/drivers/mfd/ti_tscadc.c b/drivers/mfd/ti_tscadc.c
+index 9dbd6d0..2c84aed 100644
+--- a/drivers/mfd/ti_tscadc.c
++++ b/drivers/mfd/ti_tscadc.c
@@ -170,6 +170,7 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
if (err < 0)
goto err_disable_clk;
@@ -146,26 +125,25 @@
platform_set_drvdata(pdev, tscadc);
return 0;
-@@ -203,14 +204,52 @@ static int __devexit ti_tscadc_remove(struct platform_device *pdev)
+@@ -203,6 +204,35 @@ static int __devexit ti_tscadc_remove(struct platform_device *pdev)
return 0;
}
-+#ifdef CONFIG_PM
-+static int tscadc_suspend(struct device *dev)
++static int tscadc_suspend(struct platform_device *pdev, pm_message_t state)
+{
-+ struct ti_tscadc_dev *tscadc_dev = dev_get_drvdata(dev);
++ struct ti_tscadc_dev *tscadc_dev = platform_get_drvdata(pdev);
+
+ tscadc_writel(tscadc_dev, REG_SE, 0x00);
-+ pm_runtime_put_sync(dev);
++ pm_runtime_put_sync(&pdev->dev);
+ return 0;
+}
+
-+static int tscadc_resume(struct device *dev)
++static int tscadc_resume(struct platform_device *pdev)
+{
-+ struct ti_tscadc_dev *tscadc_dev = dev_get_drvdata(dev);
++ struct ti_tscadc_dev *tscadc_dev = platform_get_drvdata(pdev);
+ unsigned int restore, ctrl;
+
-+ pm_runtime_get_sync(dev);
++ pm_runtime_get_sync(&pdev->dev);
+
+ /* context restore */
+ ctrl = CNTRLREG_STEPCONFIGWRT | CNTRLREG_TSCENB |
@@ -176,34 +154,27 @@
+ restore = tscadc_readl(tscadc_dev, REG_CTRL);
+ tscadc_writel(tscadc_dev, REG_CTRL,
+ (restore | CNTRLREG_TSCSSENB));
++
+ return 0;
+}
-+
-+static const struct dev_pm_ops tscadc_pm_ops = {
-+ .suspend = tscadc_suspend,
-+ .resume = tscadc_resume,
-+};
-+#define TSCADC_PM_OPS (&tscadc_pm_ops)
-+#else
-+#define TSCADC_PM_OPS NULL
-+#endif
+
static struct platform_driver ti_tscadc_driver = {
.driver = {
.name = "ti_tscadc",
- .owner = THIS_MODULE,
-+ .pm = TSCADC_PM_OPS,
+@@ -210,7 +240,8 @@ static struct platform_driver ti_tscadc_driver = {
},
.probe = ti_tscadc_probe,
.remove = __devexit_p(ti_tscadc_remove),
-
++ .suspend = tscadc_suspend,
++ .resume = tscadc_resume,
};
module_platform_driver(ti_tscadc_driver);
-diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
-index bd9fe1d..c7facdc 100644
---- a/include/linux/mfd/ti_am335x_tscadc.h
-+++ b/include/linux/mfd/ti_am335x_tscadc.h
+diff --git a/include/linux/mfd/ti_tscadc.h b/include/linux/mfd/ti_tscadc.h
+index 3414883..e0a6437 100644
+--- a/include/linux/mfd/ti_tscadc.h
++++ b/include/linux/mfd/ti_tscadc.h
@@ -40,6 +40,9 @@
#define REG_FIFO1 0x200
@@ -215,5 +186,5 @@
#define STEPENB_MASK (0x1FFFF << 0)
#define STEPENB(val) ((val) << 0)
--
-1.7.0.4
+1.7.1