All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajendra Nayak <rnayak@codeaurora.org>
To: "Ivan T. Ivanov" <iivanov@mm-sol.com>
Cc: linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org
Subject: Re: [RFC/RFT 5/6] i2c: qup: Get rid of clock handling as its done using runtime callbacks
Date: Mon, 27 Apr 2015 08:06:39 +0530	[thread overview]
Message-ID: <553DA0B7.8090900@codeaurora.org> (raw)
In-Reply-To: <70706FC9-46A8-4A34-9E11-558ECD23EDE2@mm-sol.com>

Hi Ivan,

On 04/25/2015 12:31 PM, Ivan T. Ivanov wrote:
> Hi Rajendra,
>
>> On Apr 23, 2015, at 11:45 AM, Rajendra Nayak <rnayak@codeaurora.org> wrote:
>>
>> 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/i2c/busses/i2c-qup.c | 74 ++++++++++----------------------------------
>> 1 file changed, 16 insertions(+), 58 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
>> index fdcbdab..465a2b2 100644
>> --- a/drivers/i2c/busses/i2c-qup.c
>> +++ b/drivers/i2c/busses/i2c-qup.c
>> @@ -104,7 +104,6 @@ struct qup_i2c_dev {
>> 	void __iomem		*base;
>> 	int			irq;
>> 	struct clk		*clk;
>> -	struct clk		*pclk;
>> 	struct i2c_adapter	adap;
>>
>> 	int			clk_ctl;
>> @@ -532,24 +531,6 @@ static struct i2c_adapter_quirks qup_i2c_quirks = {
>> 	.max_read_len = QUP_READ_LIMIT,
>> };
>>
>> -static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup)
>> -{
>> -	clk_prepare_enable(qup->clk);
>> -	clk_prepare_enable(qup->pclk);
>> -}
>> -
>> -static void qup_i2c_disable_clocks(struct qup_i2c_dev *qup)
>> -{
>> -	u32 config;
>> -
>> -	qup_i2c_change_state(qup, QUP_RESET_STATE);
>> -	clk_disable_unprepare(qup->clk);
>> -	config = readl(qup->base + QUP_CONFIG);
>> -	config |= QUP_CLOCK_AUTO_GATE;
>> -	writel(config, qup->base + QUP_CONFIG);
>> -	clk_disable_unprepare(qup->pclk);
>> -}
>> -
>> static int qup_i2c_probe(struct platform_device *pdev)
>> {
>> 	static const int blk_sizes[] = {4, 16, 32};
>> @@ -596,13 +577,10 @@ static int qup_i2c_probe(struct platform_device *pdev)
>> 		return PTR_ERR(qup->clk);
>> 	}
>>
>> -	qup->pclk = devm_clk_get(qup->dev, "iface");
>> -	if (IS_ERR(qup->pclk)) {
>> -		dev_err(qup->dev, "Could not get iface clock\n");
>> -		return PTR_ERR(qup->pclk);
>> -	}
>> -
>> -	qup_i2c_enable_clocks(qup);
>> +	pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC);
>> +	pm_runtime_use_autosuspend(qup->dev);
>> +	pm_runtime_enable(qup->dev);
>> +	pm_runtime_get_sync(qup->dev);
>>
>> 	/*
>> 	 * Bootloaders might leave a pending interrupt on certain QUP's,
>> @@ -673,22 +651,15 @@ static int qup_i2c_probe(struct platform_device *pdev)
>> 	qup->adap.dev.of_node = pdev->dev.of_node;
>> 	strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name));
>>
>> -	pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC);
>> -	pm_runtime_use_autosuspend(qup->dev);
>> -	pm_runtime_set_active(qup->dev);
>> -	pm_runtime_enable(qup->dev);
>> -
>> 	ret = i2c_add_adapter(&qup->adap);
>> 	if (ret)
>> -		goto fail_runtime;
>> +		goto fail;
>>
>> 	return 0;
>>
>> -fail_runtime:
>> +fail:
>> 	pm_runtime_disable(qup->dev);
>> 	pm_runtime_set_suspended(qup->dev);
>> -fail:
>> -	qup_i2c_disable_clocks(qup);
>> 	return ret;
>> }
>
>
> Same thing like in MMC driver. Clocks should be explicitly
> enabled because CONFIG_PM could be off.

Like I responded on the mmc driver patch thread [1], pm_clk_notify()
already takes care of enabling all clocks (during driver bind) in
case CONFIG_PM is disabled.

[1] http://www.spinics.net/lists/arm-kernel/msg413898.html

regards,
Rajendra

WARNING: multiple messages have this Message-ID (diff)
From: rnayak@codeaurora.org (Rajendra Nayak)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/RFT 5/6] i2c: qup: Get rid of clock handling as its done using runtime callbacks
Date: Mon, 27 Apr 2015 08:06:39 +0530	[thread overview]
Message-ID: <553DA0B7.8090900@codeaurora.org> (raw)
In-Reply-To: <70706FC9-46A8-4A34-9E11-558ECD23EDE2@mm-sol.com>

Hi Ivan,

On 04/25/2015 12:31 PM, Ivan T. Ivanov wrote:
> Hi Rajendra,
>
>> On Apr 23, 2015, at 11:45 AM, Rajendra Nayak <rnayak@codeaurora.org> wrote:
>>
>> 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/i2c/busses/i2c-qup.c | 74 ++++++++++----------------------------------
>> 1 file changed, 16 insertions(+), 58 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
>> index fdcbdab..465a2b2 100644
>> --- a/drivers/i2c/busses/i2c-qup.c
>> +++ b/drivers/i2c/busses/i2c-qup.c
>> @@ -104,7 +104,6 @@ struct qup_i2c_dev {
>> 	void __iomem		*base;
>> 	int			irq;
>> 	struct clk		*clk;
>> -	struct clk		*pclk;
>> 	struct i2c_adapter	adap;
>>
>> 	int			clk_ctl;
>> @@ -532,24 +531,6 @@ static struct i2c_adapter_quirks qup_i2c_quirks = {
>> 	.max_read_len = QUP_READ_LIMIT,
>> };
>>
>> -static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup)
>> -{
>> -	clk_prepare_enable(qup->clk);
>> -	clk_prepare_enable(qup->pclk);
>> -}
>> -
>> -static void qup_i2c_disable_clocks(struct qup_i2c_dev *qup)
>> -{
>> -	u32 config;
>> -
>> -	qup_i2c_change_state(qup, QUP_RESET_STATE);
>> -	clk_disable_unprepare(qup->clk);
>> -	config = readl(qup->base + QUP_CONFIG);
>> -	config |= QUP_CLOCK_AUTO_GATE;
>> -	writel(config, qup->base + QUP_CONFIG);
>> -	clk_disable_unprepare(qup->pclk);
>> -}
>> -
>> static int qup_i2c_probe(struct platform_device *pdev)
>> {
>> 	static const int blk_sizes[] = {4, 16, 32};
>> @@ -596,13 +577,10 @@ static int qup_i2c_probe(struct platform_device *pdev)
>> 		return PTR_ERR(qup->clk);
>> 	}
>>
>> -	qup->pclk = devm_clk_get(qup->dev, "iface");
>> -	if (IS_ERR(qup->pclk)) {
>> -		dev_err(qup->dev, "Could not get iface clock\n");
>> -		return PTR_ERR(qup->pclk);
>> -	}
>> -
>> -	qup_i2c_enable_clocks(qup);
>> +	pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC);
>> +	pm_runtime_use_autosuspend(qup->dev);
>> +	pm_runtime_enable(qup->dev);
>> +	pm_runtime_get_sync(qup->dev);
>>
>> 	/*
>> 	 * Bootloaders might leave a pending interrupt on certain QUP's,
>> @@ -673,22 +651,15 @@ static int qup_i2c_probe(struct platform_device *pdev)
>> 	qup->adap.dev.of_node = pdev->dev.of_node;
>> 	strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name));
>>
>> -	pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC);
>> -	pm_runtime_use_autosuspend(qup->dev);
>> -	pm_runtime_set_active(qup->dev);
>> -	pm_runtime_enable(qup->dev);
>> -
>> 	ret = i2c_add_adapter(&qup->adap);
>> 	if (ret)
>> -		goto fail_runtime;
>> +		goto fail;
>>
>> 	return 0;
>>
>> -fail_runtime:
>> +fail:
>> 	pm_runtime_disable(qup->dev);
>> 	pm_runtime_set_suspended(qup->dev);
>> -fail:
>> -	qup_i2c_disable_clocks(qup);
>> 	return ret;
>> }
>
>
> Same thing like in MMC driver. Clocks should be explicitly
> enabled because CONFIG_PM could be off.

Like I responded on the mmc driver patch thread [1], pm_clk_notify()
already takes care of enabling all clocks (during driver bind) in
case CONFIG_PM is disabled.

[1] http://www.spinics.net/lists/arm-kernel/msg413898.html

regards,
Rajendra

  reply	other threads:[~2015-04-27  2:36 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 [this message]
2015-04-27  2:36       ` Rajendra Nayak
2015-04-23  8:45 ` [RFC/RFT 6/6] spi: " Rajendra Nayak
2015-04-23  8:45   ` 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=553DA0B7.8090900@codeaurora.org \
    --to=rnayak@codeaurora.org \
    --cc=iivanov@mm-sol.com \
    --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.