From: Yang Li <yang.li@amlogic.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Bartosz Golaszewski <brgl@bgdev.pl>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH 2/3] power: sequenceing: Add power sequence for Amlogic WCN chips
Date: Mon, 8 Jul 2024 15:41:27 +0800 [thread overview]
Message-ID: <00fe66b7-1c04-48ec-a8ed-404e941dfeab@amlogic.com> (raw)
In-Reply-To: <5c1658a1-3290-48c3-a39a-9e5c837bdb70@kernel.org>
Dear Krzysztof
Thanks for your comments.
> On 05/07/2024 13:13, Yang Li via B4 Relay wrote:
>> From: Yang Li <yang.li@amlogic.com>
>>
>> Add power sequence for Bluetooth and Wi-Fi respectively, including chip_en
>> pull-up and bt_en pull-up, and generation of the 32.768 clock.
>>
>> Signed-off-by: Yang Li <yang.li@amlogic.com>
>> +#include <linux/clk.h>
>> +#include <linux/delay.h>
>> +#include <linux/device.h>
>> +#include <linux/mod_devicetable.h>
>> +#include <linux/module.h>
>> +#include <linux/mutex.h>
>> +#include <linux/of.h>
>> +#include <linux/gpio.h>
>> +#include <linux/of_gpio.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/pwrseq/provider.h>
>> +#include <linux/string.h>
>> +#include <linux/types.h>
>> +
>> +struct pwrseq_aml_wcn_ctx {
>> + struct pwrseq_device *pwrseq;
>> + int bt_enable_gpio;
> Why? It's never used... or you use wrong API. Confusing code.
Well, I will used the "struct gpio_desc" replace current method.
>
>> + int chip_enable_gpio;
>> + struct clk *lpo_clk;
>> + unsigned int pwr_count;
>> +};
>> +
>> +static DEFINE_MUTEX(pwrseq_lock);
> Why this is not part of structure above?
Sorry, I referenced some outdated examples.
And I will put it in structure of pwrseq_aml_wcn_ctx.
>> +
>
> ...
>
>> +
>> +static int pwrseq_aml_wcn_match(struct pwrseq_device *pwrseq,
>> + struct device *dev)
>> +{
>> + struct device_node *dev_node = dev->of_node;
>> +
>> + if (!of_property_present(dev_node, "amlogic,wcn-pwrseq"))
> You cannot have undocumented properties, sorry, that's a NAK.
About the match () function I also have some doubts, the
drivers/power/sequence/core.c requirements need to be defined match ()
function is used to determine whether a potential consumers actually
related to the sequencer. So, I need to add a meaningless node
"amlogic,wcn-pwrseq" to both the consumer dt-binding and the provider
dt-binding.
Right now, I add "amlogic,wcn-pwrseq" in binding file of
"amlogic,w155s2-bt.yaml" only, may I need to add this properties
("amlogic,wcn-pwrseq") in the binding file of "amlogic,w155s2-pwrseq.yaml"?
>> + return 0;
>> +
>> + return 1;
>> +}
>> +
>> +static int pwrseq_aml_wcn_probe(struct platform_device *pdev)
>> +{
>> + struct device *dev = &pdev->dev;
>> + struct pwrseq_aml_wcn_ctx *ctx;
>> + struct pwrseq_config config;
>> +
>> + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
>> + if (!ctx)
>> + return -ENOMEM;
>> +
>> + ctx->bt_enable_gpio = of_get_named_gpio(dev->of_node,
>> + "amlogic,bt-enable-gpios", 0);
>> + if (!gpio_is_valid(ctx->bt_enable_gpio))
>> + return dev_err_probe(dev, ctx->bt_enable_gpio,
>> + "Failed to get the bt enable GPIO");
>> +
>> + ctx->chip_enable_gpio = of_get_named_gpio(dev->of_node,
>> + "amlogic,chip-enable-gpios", 0);
>> + if (!gpio_is_valid(ctx->chip_enable_gpio))
>> + return dev_err_probe(dev, ctx->bt_enable_gpio,
>> + "Failed to get the chip enable GPIO");
>> +
>> + ctx->lpo_clk = devm_clk_get_optional(dev, NULL);
> Clock is not optional, according to you binding.
Yes, I will used API of devm_clk_get(dev, "extclk") to relace it.
>
>> + if (IS_ERR(ctx->lpo_clk))
>> + return dev_err_probe(dev, PTR_ERR(ctx->lpo_clk),
>> + "Failed to get the clock source");
>> +
>> + memset(&config, 0, sizeof(config));
> Just initialize it on the stack with 0.
Okay, I will delete this line and set config to zero when initializing.
>
>
>
> Best regards,
> Krzysztof
>
next prev parent reply other threads:[~2024-07-08 7:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-05 11:13 [PATCH 0/3] Add power sequence for Amlogic WCN chips Yang Li via B4 Relay
2024-07-05 11:13 ` [PATCH 1/3] dt-bindings: power: Add power sequence for Amloigc " Yang Li via B4 Relay
2024-07-05 13:34 ` Bartosz Golaszewski
2024-07-08 6:12 ` Yang Li
2024-07-07 12:59 ` Krzysztof Kozlowski
2024-07-08 6:04 ` Yang Li
2024-07-08 6:11 ` Krzysztof Kozlowski
2024-07-08 6:32 ` Yang Li
2024-07-08 7:32 ` Krzysztof Kozlowski
2024-07-08 8:21 ` Yang Li
2024-07-08 9:10 ` Krzysztof Kozlowski
2024-07-08 9:36 ` Bartosz Golaszewski
2024-07-05 11:13 ` [PATCH 2/3] power: sequenceing: Add power sequence for Amlogic " Yang Li via B4 Relay
2024-07-05 13:46 ` Bartosz Golaszewski
2024-07-10 3:00 ` Yang Li
2024-07-07 13:02 ` Krzysztof Kozlowski
2024-07-08 7:41 ` Yang Li [this message]
2024-07-05 11:13 ` [PATCH 3/3] MAINTAINERS: Add an entry for Amlogic WCN power sequence Yang Li via B4 Relay
2024-07-07 13:04 ` Krzysztof Kozlowski
2024-07-08 6:34 ` Yang Li
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=00fe66b7-1c04-48ec-a8ed-404e941dfeab@amlogic.com \
--to=yang.li@amlogic.com \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox