From: Rajendra Nayak <rnayak@codeaurora.org>
To: linux-arm-msm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org
Cc: Rajendra Nayak <rnayak@codeaurora.org>
Subject: [RFC/RFT 6/6] spi: qup: Get rid of clock handling as its done using runtime callbacks
Date: Thu, 23 Apr 2015 14:15:44 +0530 [thread overview]
Message-ID: <1429778744-13352-7-git-send-email-rnayak@codeaurora.org> (raw)
In-Reply-To: <1429778744-13352-1-git-send-email-rnayak@codeaurora.org>
Remove all clock handling from the driver as this is not handled from
within platform runtime callbacks.
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
drivers/spi/spi-qup.c | 54 ++++++++++-----------------------------------------
1 file changed, 10 insertions(+), 44 deletions(-)
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index 810a7fa..a95993b 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -131,7 +131,6 @@ struct spi_qup {
void __iomem *base;
struct device *dev;
struct clk *cclk; /* core clock */
- struct clk *iclk; /* interface clock */
int irq;
spinlock_t lock;
@@ -753,7 +752,7 @@ err_tx:
static int spi_qup_probe(struct platform_device *pdev)
{
struct spi_master *master;
- struct clk *iclk, *cclk;
+ struct clk *cclk;
struct spi_qup *controller;
struct resource *res;
struct device *dev;
@@ -775,10 +774,6 @@ static int spi_qup_probe(struct platform_device *pdev)
if (IS_ERR(cclk))
return PTR_ERR(cclk);
- iclk = devm_clk_get(dev, "iface");
- if (IS_ERR(iclk))
- return PTR_ERR(iclk);
-
/* This is optional parameter */
if (of_property_read_u32(dev->of_node, "spi-max-frequency", &max_freq))
max_freq = SPI_MAX_RATE;
@@ -788,23 +783,15 @@ static int spi_qup_probe(struct platform_device *pdev)
return -ENXIO;
}
- ret = clk_prepare_enable(cclk);
- if (ret) {
- dev_err(dev, "cannot enable core clock\n");
- return ret;
- }
-
- ret = clk_prepare_enable(iclk);
- if (ret) {
- clk_disable_unprepare(cclk);
- dev_err(dev, "cannot enable iface clock\n");
- return ret;
- }
+ pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
+ pm_runtime_use_autosuspend(dev);
+ pm_runtime_enable(dev);
+ pm_runtime_get_sync(dev);
master = spi_alloc_master(dev, sizeof(struct spi_qup));
if (!master) {
- clk_disable_unprepare(cclk);
- clk_disable_unprepare(iclk);
+ pm_runtime_set_suspended(dev);
+ pm_runtime_disable(dev);
dev_err(dev, "cannot allocate master\n");
return -ENOMEM;
}
@@ -832,7 +819,6 @@ static int spi_qup_probe(struct platform_device *pdev)
controller->dev = dev;
controller->base = base;
- controller->iclk = iclk;
controller->cclk = cclk;
controller->irq = irq;
@@ -904,24 +890,17 @@ static int spi_qup_probe(struct platform_device *pdev)
if (ret)
goto error_dma;
- pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
- pm_runtime_use_autosuspend(dev);
- pm_runtime_set_active(dev);
- pm_runtime_enable(dev);
-
ret = devm_spi_register_master(dev, master);
if (ret)
- goto disable_pm;
+ goto error_dma;
return 0;
-disable_pm:
- pm_runtime_disable(&pdev->dev);
error_dma:
spi_qup_release_dma(master);
error:
- clk_disable_unprepare(cclk);
- clk_disable_unprepare(iclk);
+ pm_runtime_set_suspended(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
spi_master_put(master);
return ret;
}
@@ -969,8 +948,6 @@ static int spi_qup_suspend(struct device *device)
if (ret)
return ret;
- clk_disable_unprepare(controller->cclk);
- clk_disable_unprepare(controller->iclk);
return 0;
}
@@ -980,14 +957,6 @@ static int spi_qup_resume(struct device *device)
struct spi_qup *controller = spi_master_get_devdata(master);
int ret;
- ret = clk_prepare_enable(controller->iclk);
- if (ret)
- return ret;
-
- ret = clk_prepare_enable(controller->cclk);
- if (ret)
- return ret;
-
ret = spi_qup_set_state(controller, QUP_STATE_RESET);
if (ret)
return ret;
@@ -1012,9 +981,6 @@ static int spi_qup_remove(struct platform_device *pdev)
spi_qup_release_dma(master);
- clk_disable_unprepare(controller->cclk);
- clk_disable_unprepare(controller->iclk);
-
pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev);
return 0;
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
WARNING: multiple messages have this Message-ID (diff)
From: rnayak@codeaurora.org (Rajendra Nayak)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/RFT 6/6] spi: qup: Get rid of clock handling as its done using runtime callbacks
Date: Thu, 23 Apr 2015 14:15:44 +0530 [thread overview]
Message-ID: <1429778744-13352-7-git-send-email-rnayak@codeaurora.org> (raw)
In-Reply-To: <1429778744-13352-1-git-send-email-rnayak@codeaurora.org>
Remove all clock handling from the driver as this is not handled from
within platform runtime callbacks.
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
drivers/spi/spi-qup.c | 54 ++++++++++-----------------------------------------
1 file changed, 10 insertions(+), 44 deletions(-)
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index 810a7fa..a95993b 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -131,7 +131,6 @@ struct spi_qup {
void __iomem *base;
struct device *dev;
struct clk *cclk; /* core clock */
- struct clk *iclk; /* interface clock */
int irq;
spinlock_t lock;
@@ -753,7 +752,7 @@ err_tx:
static int spi_qup_probe(struct platform_device *pdev)
{
struct spi_master *master;
- struct clk *iclk, *cclk;
+ struct clk *cclk;
struct spi_qup *controller;
struct resource *res;
struct device *dev;
@@ -775,10 +774,6 @@ static int spi_qup_probe(struct platform_device *pdev)
if (IS_ERR(cclk))
return PTR_ERR(cclk);
- iclk = devm_clk_get(dev, "iface");
- if (IS_ERR(iclk))
- return PTR_ERR(iclk);
-
/* This is optional parameter */
if (of_property_read_u32(dev->of_node, "spi-max-frequency", &max_freq))
max_freq = SPI_MAX_RATE;
@@ -788,23 +783,15 @@ static int spi_qup_probe(struct platform_device *pdev)
return -ENXIO;
}
- ret = clk_prepare_enable(cclk);
- if (ret) {
- dev_err(dev, "cannot enable core clock\n");
- return ret;
- }
-
- ret = clk_prepare_enable(iclk);
- if (ret) {
- clk_disable_unprepare(cclk);
- dev_err(dev, "cannot enable iface clock\n");
- return ret;
- }
+ pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
+ pm_runtime_use_autosuspend(dev);
+ pm_runtime_enable(dev);
+ pm_runtime_get_sync(dev);
master = spi_alloc_master(dev, sizeof(struct spi_qup));
if (!master) {
- clk_disable_unprepare(cclk);
- clk_disable_unprepare(iclk);
+ pm_runtime_set_suspended(dev);
+ pm_runtime_disable(dev);
dev_err(dev, "cannot allocate master\n");
return -ENOMEM;
}
@@ -832,7 +819,6 @@ static int spi_qup_probe(struct platform_device *pdev)
controller->dev = dev;
controller->base = base;
- controller->iclk = iclk;
controller->cclk = cclk;
controller->irq = irq;
@@ -904,24 +890,17 @@ static int spi_qup_probe(struct platform_device *pdev)
if (ret)
goto error_dma;
- pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
- pm_runtime_use_autosuspend(dev);
- pm_runtime_set_active(dev);
- pm_runtime_enable(dev);
-
ret = devm_spi_register_master(dev, master);
if (ret)
- goto disable_pm;
+ goto error_dma;
return 0;
-disable_pm:
- pm_runtime_disable(&pdev->dev);
error_dma:
spi_qup_release_dma(master);
error:
- clk_disable_unprepare(cclk);
- clk_disable_unprepare(iclk);
+ pm_runtime_set_suspended(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
spi_master_put(master);
return ret;
}
@@ -969,8 +948,6 @@ static int spi_qup_suspend(struct device *device)
if (ret)
return ret;
- clk_disable_unprepare(controller->cclk);
- clk_disable_unprepare(controller->iclk);
return 0;
}
@@ -980,14 +957,6 @@ static int spi_qup_resume(struct device *device)
struct spi_qup *controller = spi_master_get_devdata(master);
int ret;
- ret = clk_prepare_enable(controller->iclk);
- if (ret)
- return ret;
-
- ret = clk_prepare_enable(controller->cclk);
- if (ret)
- return ret;
-
ret = spi_qup_set_state(controller, QUP_STATE_RESET);
if (ret)
return ret;
@@ -1012,9 +981,6 @@ static int spi_qup_remove(struct platform_device *pdev)
spi_qup_release_dma(master);
- clk_disable_unprepare(controller->cclk);
- clk_disable_unprepare(controller->iclk);
-
pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev);
return 0;
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2015-04-23 8:46 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-23 8:45 [RFC/RFT 0/6] qcom: Add runtime PM support Rajendra Nayak
2015-04-23 8:45 ` Rajendra Nayak
2015-04-23 8:45 ` [RFC/RFT 1/6] PM / clock_ops: Make pm_clk_notify() do nothing in case DT passes power-domains Rajendra Nayak
2015-04-23 8:45 ` Rajendra Nayak
2015-04-23 8:45 ` [RFC/RFT 2/6] clk: qcom: Add runtime support to handle clocks using PM clocks Rajendra Nayak
2015-04-23 8:45 ` Rajendra Nayak
2015-04-24 10:03 ` Ulf Hansson
2015-04-24 10:03 ` Ulf Hansson
2015-04-24 10:58 ` Rajendra Nayak
2015-04-24 10:58 ` Rajendra Nayak
2015-04-26 8:49 ` Geert Uytterhoeven
2015-04-26 8:49 ` Geert Uytterhoeven
2015-04-27 20:02 ` Kevin Hilman
2015-04-27 20:02 ` Kevin Hilman
2015-04-28 2:52 ` Rajendra Nayak
2015-04-28 2:52 ` Rajendra Nayak
2015-04-28 7:25 ` Geert Uytterhoeven
2015-04-28 7:25 ` Geert Uytterhoeven
2015-04-29 9:49 ` Rajendra Nayak
2015-04-29 9:49 ` Rajendra Nayak
2015-04-29 11:30 ` Geert Uytterhoeven
2015-04-29 11:30 ` Geert Uytterhoeven
2015-04-29 12:31 ` Ulf Hansson
2015-04-29 12:31 ` Ulf Hansson
2015-04-29 13:08 ` Geert Uytterhoeven
2015-04-29 13:08 ` Geert Uytterhoeven
2015-04-30 6:21 ` Ulf Hansson
2015-04-30 6:21 ` Ulf Hansson
2015-04-30 9:02 ` Ulf Hansson
2015-04-30 9:02 ` Ulf Hansson
2015-04-27 7:08 ` Ulf Hansson
2015-04-27 7:08 ` Ulf Hansson
2015-04-23 8:45 ` [RFC/RFT 3/6] serial: msm: convert driver to use runtime PM apis Rajendra Nayak
2015-04-23 8:45 ` Rajendra Nayak
2015-04-29 0:16 ` Stephen Boyd
2015-04-29 0:16 ` Stephen Boyd
2015-04-29 3:15 ` Rajendra Nayak
2015-04-29 3:15 ` Rajendra Nayak
2015-04-23 8:45 ` [RFC/RFT 4/6] mmc: sdhci-msm: " Rajendra Nayak
2015-04-23 8:45 ` Rajendra Nayak
2015-04-23 13:21 ` Ulf Hansson
2015-04-23 13:21 ` Ulf Hansson
2015-04-23 13:42 ` Rajendra Nayak
2015-04-23 13:42 ` Rajendra Nayak
2015-04-23 21:15 ` Kevin Hilman
2015-04-23 21:15 ` Kevin Hilman
2015-04-24 0:45 ` Rajendra Nayak
2015-04-24 0:45 ` Rajendra Nayak
2015-04-23 13:43 ` Rajendra Nayak
2015-04-23 13:43 ` Rajendra Nayak
2015-04-23 8:45 ` [RFC/RFT 5/6] i2c: qup: Get rid of clock handling as its done using runtime callbacks Rajendra Nayak
2015-04-23 8:45 ` Rajendra Nayak
2015-04-23 21:16 ` Kevin Hilman
2015-04-23 21:16 ` Kevin Hilman
2015-04-24 2:32 ` Rajendra Nayak
2015-04-24 2:32 ` Rajendra Nayak
2015-04-25 7:01 ` Ivan T. Ivanov
2015-04-25 7:01 ` Ivan T. Ivanov
2015-04-27 2:36 ` Rajendra Nayak
2015-04-27 2:36 ` Rajendra Nayak
2015-04-23 8:45 ` Rajendra Nayak [this message]
2015-04-23 8:45 ` [RFC/RFT 6/6] spi: " Rajendra Nayak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429778744-13352-7-git-send-email-rnayak@codeaurora.org \
--to=rnayak@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.