From: "jay.xu@rock-chips.com" <jay.xu@rock-chips.com>
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Cc: "Heiko Stübner" <heiko@sntech.de>,
"linus.walleij" <linus.walleij@linaro.org>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
linux-gpio <linux-gpio@vger.kernel.org>,
"open list:ARM/Rockchip SoC..."
<linux-rockchip@lists.infradead.org>
Subject: Re: Re: [PATCH 6/6] gpio: rockchip: support acpi
Date: Tue, 13 Sep 2022 09:07:51 +0800 [thread overview]
Message-ID: <2022091309075125735265@rock-chips.com> (raw)
In-Reply-To: YxsV735hZmzr1xPp@smile.fi.intel.com
Hi Andy
--------------
jay.xu@rock-chips.com
>On Fri, Sep 09, 2022 at 05:05:58PM +0800, Jianqun Xu wrote:
>> The gpio driver for rockchip gpio controller is seperated from rockchip
>> pinctrl driver, at the first version, it keeps things original to make
>> the patch easy to be reviewed, such as the gpio driver must work with
>> the pinctrl dt node to be its parent node.
>>
>> This patch wants to fix driver to support acpi since gpio controller
>> should work well during acpi is enabled. But during upstream, driver is
>> better to fix other thing together includes:
>> - add 'clock-names' to allow driver to get clocks by devm_clk_get().
>> - get io resource and irq by platform common apis.
>> - use fwnode instead of of_node from device structure.
>
>The dependency patch is the part of another series. Dunno what will happen
>to that series. In either way we would need maintainer's (Rafael) tag.
Got it, thanks
>
>...
>
>> +static int rockchip_gpio_get_clocks(struct rockchip_pin_bank *bank)
>> +{
>> + struct device *dev = bank->dev;
>> + struct fwnode_handle *fwnode = dev_fwnode(dev);
>> + int ret;
>> +
>> + if (!is_of_node(fwnode))
>> + return 0;
>> +
>> + bank->clk = devm_clk_get(dev, "bus");
>> + if (IS_ERR(bank->clk)) {
>> + dev_err(dev, "fail to get apb clock\n");
>> + return PTR_ERR(bank->clk);
>> + }
>
>> + ret = clk_prepare_enable(bank->clk);
>> + if (ret < 0)
>> + return ret;
>
>Now, you are mixinig devm_ with non-devm_ APIs. Perhaps you wanted
>to use devm_clk_get_enabled()?
I take a try.
>
>> + bank->db_clk = devm_clk_get(dev, "db");
>> + if (IS_ERR(bank->db_clk)) {
>> + bank->db_clk = NULL;
>> + }
>> +
>> + ret = clk_prepare_enable(bank->db_clk);
>> + if (ret < 0) {
>> + clk_disable_unprepare(bank->clk);
>> + return ret;
>> + }
>>
>> return 0;
>> }
>
>...
>
>> + if (is_acpi_node(fwnode)) {
>> + if (!acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &uid))
>> + bank_id = (int)uid;
>
>It probably needs to be
>
> if (is_acpi_node(fwnode)) {
> ret = acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &uid);
> if (ret)
> return ret;
> bank_id = uid;
Got it, thanks
>> + } else {
>> + bank_id = of_alias_get_id(to_of_node(fwnode), "gpio");
>> + if (bank_id < 0)
>> + bank_id = gpio++;
>> + }
>
>--
>With Best Regards,
>Andy Shevchenko
>
>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2022-09-13 1:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-09 9:05 [PATCH v5 0/6] gpio: rockchip: support acpi Jianqun Xu
2022-09-09 9:05 ` [PATCH 1/6] ARM: dts: rockchip: add gpio alias for gpio dt nodes Jianqun Xu
2022-09-09 10:14 ` jay.xu
2022-09-10 21:09 ` kernel test robot
2022-09-09 9:05 ` [PATCH 2/6] ARM: dts: rockchip: add 'clock-names' " Jianqun Xu
2022-09-09 9:05 ` [PATCH 3/6] arm64: dts: rockchip: add gpio alias " Jianqun Xu
2022-09-09 9:05 ` [PATCH 4/6] arm64: dts: rockchip: add 'clock-names' " Jianqun Xu
2022-09-09 9:05 ` [PATCH 5/6] ACPI: utils: Add acpi_dev_uid_to_integer() helper to get _UID as integer Jianqun Xu
2022-09-09 9:05 ` [PATCH 6/6] gpio: rockchip: support acpi Jianqun Xu
2022-09-09 10:31 ` Andy Shevchenko
2022-09-13 1:07 ` jay.xu [this message]
2022-09-09 11:17 ` Johan Jonker
2022-09-13 1:12 ` jay.xu
2022-09-13 7:55 ` Johan Jonker
2022-09-13 1:14 ` jay.xu
2022-09-10 10:20 ` kernel test robot
2022-09-10 10:52 ` kernel test robot
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=2022091309075125735265@rock-chips.com \
--to=jay.xu@rock-chips.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=heiko@sntech.de \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).