All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: wsa@the-dreams.de, lho@apm.com, Ken.Xue@amd.com,
	linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH] i2c: designware: Do not require clock when SSCN and FFCN are provided
Date: Wed, 16 Dec 2015 08:11:12 -0600	[thread overview]
Message-ID: <56717100.3020602@amd.com> (raw)
In-Reply-To: <20151216094202.GR1762@lahna.fi.intel.com>

Hi Mika,

On 12/16/2015 03:42 AM, Mika Westerberg wrote:
> +Jarkko and Andy
>
> On Tue, Dec 15, 2015 at 04:38:58PM -0600, Suravee Suthikulpanit wrote:
>> The current driver uses input clock source frequency to calculate
>> values for [SS|FS]_[HC|LC] registers. However, when booting ACPI, we do not
>> currently have a good way to provide the frequency information.
>> Instead, we can leverage the SSCN and FFCN ACPI methods, which can be used
>> to directly provide these values.
>>
>> So, this patch removes the clock requirement when SSCN and FFCN
>> are provided.
>
> Actually I think the only thing you need to change is i2c_dw_init() so
> that it does not call dev->get_clk_rate_khz(dev) if *CNT values are
> already provided.

Please see below.

>
> The clk framework should work fine if the returned clock is NULL (which
> I think is your case).
>
> The driver gates clocks when the device is suspended and on Intel LPSS
> there actually is a clock that gets gated.
>
>> [..]
>> @@ -203,13 +223,11 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
>>   		dev->master_cfg =  DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE |
>>   			DW_IC_CON_RESTART_EN | DW_IC_CON_SPEED_FAST;
>>
>> -	dev->clk = devm_clk_get(&pdev->dev, NULL);
>> -	dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
>> -	if (IS_ERR(dev->clk))
>> -		return PTR_ERR(dev->clk);

Actually, if we don't provide the clock (which is the case for ACPI), 
this would also return and cause the probing to fail.

Thanks,
Suravee

WARNING: multiple messages have this Message-ID (diff)
From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: <wsa@the-dreams.de>, <lho@apm.com>, <Ken.Xue@amd.com>,
	<linux-i2c@vger.kernel.org>, <linux-acpi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH] i2c: designware: Do not require clock when SSCN and FFCN are provided
Date: Wed, 16 Dec 2015 08:11:12 -0600	[thread overview]
Message-ID: <56717100.3020602@amd.com> (raw)
In-Reply-To: <20151216094202.GR1762@lahna.fi.intel.com>

Hi Mika,

On 12/16/2015 03:42 AM, Mika Westerberg wrote:
> +Jarkko and Andy
>
> On Tue, Dec 15, 2015 at 04:38:58PM -0600, Suravee Suthikulpanit wrote:
>> The current driver uses input clock source frequency to calculate
>> values for [SS|FS]_[HC|LC] registers. However, when booting ACPI, we do not
>> currently have a good way to provide the frequency information.
>> Instead, we can leverage the SSCN and FFCN ACPI methods, which can be used
>> to directly provide these values.
>>
>> So, this patch removes the clock requirement when SSCN and FFCN
>> are provided.
>
> Actually I think the only thing you need to change is i2c_dw_init() so
> that it does not call dev->get_clk_rate_khz(dev) if *CNT values are
> already provided.

Please see below.

>
> The clk framework should work fine if the returned clock is NULL (which
> I think is your case).
>
> The driver gates clocks when the device is suspended and on Intel LPSS
> there actually is a clock that gets gated.
>
>> [..]
>> @@ -203,13 +223,11 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
>>   		dev->master_cfg =  DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE |
>>   			DW_IC_CON_RESTART_EN | DW_IC_CON_SPEED_FAST;
>>
>> -	dev->clk = devm_clk_get(&pdev->dev, NULL);
>> -	dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
>> -	if (IS_ERR(dev->clk))
>> -		return PTR_ERR(dev->clk);

Actually, if we don't provide the clock (which is the case for ACPI), 
this would also return and cause the probing to fail.

Thanks,
Suravee

  reply	other threads:[~2015-12-16 14:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15 22:38 [PATCH] i2c: designware: Do not require clock when SSCN and FFCN are provided Suravee Suthikulpanit
2015-12-15 22:38 ` Suravee Suthikulpanit
2015-12-16  9:42 ` Mika Westerberg
2015-12-16 14:11   ` Suravee Suthikulpanit [this message]
2015-12-16 14:11     ` Suravee Suthikulpanit
2015-12-16 14:28     ` Mika Westerberg
2015-12-16 14:44       ` Suravee Suthikulpanit
2015-12-16 14:44         ` Suravee Suthikulpanit
2015-12-16 15:04         ` Mika Westerberg
2015-12-17  0:55 ` Loc Ho

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=56717100.3020602@amd.com \
    --to=suravee.suthikulpanit@amd.com \
    --cc=Ken.Xue@amd.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=lho@apm.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=wsa@the-dreams.de \
    /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.