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:44:34 -0600 [thread overview]
Message-ID: <567178D2.30002@amd.com> (raw)
In-Reply-To: <20151216142810.GW1762@lahna.fi.intel.com>
On 12/16/2015 08:28 AM, Mika Westerberg wrote:
> On Wed, Dec 16, 2015 at 08:11:12AM -0600, Suravee Suthikulpanit wrote:
>>> 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.
>
> Indeed it seems that when you have CONFIG_COMMON_CLK selected the clock
> framework starts returning errors if the clock is not found.
>
> Since we need the clock for Intel LPSS I2C host controllers (and they
> may have *CNT methods), I think you just need to provide the clock for
> AMD I2C host controller in similar way than we do in
> drivers/acpi/acpi_lpss.c.
I am trying to avoid having to hard-coded clock frequency value in the
driver. Would it be alright to not return w/ error, and just do the
following?
dev->clk = devm_clk_get(&pdev->dev, NULL);
if (!IS_ERR(dev->clk))
dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
This should work for the Intel case when clock is also provided.
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:44:34 -0600 [thread overview]
Message-ID: <567178D2.30002@amd.com> (raw)
In-Reply-To: <20151216142810.GW1762@lahna.fi.intel.com>
On 12/16/2015 08:28 AM, Mika Westerberg wrote:
> On Wed, Dec 16, 2015 at 08:11:12AM -0600, Suravee Suthikulpanit wrote:
>>> 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.
>
> Indeed it seems that when you have CONFIG_COMMON_CLK selected the clock
> framework starts returning errors if the clock is not found.
>
> Since we need the clock for Intel LPSS I2C host controllers (and they
> may have *CNT methods), I think you just need to provide the clock for
> AMD I2C host controller in similar way than we do in
> drivers/acpi/acpi_lpss.c.
I am trying to avoid having to hard-coded clock frequency value in the
driver. Would it be alright to not return w/ error, and just do the
following?
dev->clk = devm_clk_get(&pdev->dev, NULL);
if (!IS_ERR(dev->clk))
dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
This should work for the Intel case when clock is also provided.
Thanks,
Suravee
next prev parent reply other threads:[~2015-12-16 14:44 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
2015-12-16 14:11 ` Suravee Suthikulpanit
2015-12-16 14:28 ` Mika Westerberg
2015-12-16 14:44 ` Suravee Suthikulpanit [this message]
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=567178D2.30002@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.