[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9a8f4a3e-c94a-b5bf-2715-03b0439f9fe7@linux.intel.com>
Date: Thu, 25 Jun 2020 16:59:51 +0800
From: "Tanwar, Rahul" <rahul.tanwar@...ux.intel.com>
To: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Cc: Philipp Zabel <p.zabel@...gutronix.de>, linux-pwm@...r.kernel.org,
thierry.reding@...il.com, robh+dt@...nel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
andriy.shevchenko@...el.com, songjun.Wu@...el.com,
cheol.yong.kim@...el.com, qi-ming.wu@...el.com,
rahul.tanwar.linux@...il.com
Subject: Re: [PATCH v2 2/2] Add PWM fan controller driver for LGM SoC
On 25/6/2020 1:58 pm, Uwe Kleine-König wrote:
> On Thu, Jun 25, 2020 at 12:23:54PM +0800, Tanwar, Rahul wrote:
>> Hi Philipp,
>>
>> On 18/6/2020 8:25 pm, Philipp Zabel wrote:
>>> Hi Rahul,
>>>
>>> On Thu, 2020-06-18 at 20:05 +0800, Rahul Tanwar wrote:
>>>> Intel Lightning Mountain(LGM) SoC contains a PWM fan controller.
>>>> This PWM controller does not have any other consumer, it is a
>>>> dedicated PWM controller for fan attached to the system. Add
>>>> driver for this PWM fan controller.
>>>>
>>>> Signed-off-by: Rahul Tanwar <rahul.tanwar@...ux.intel.com>
>>>> ---
>>>> drivers/pwm/Kconfig | 9 +
>>>> drivers/pwm/Makefile | 1 +
>>>> drivers/pwm/pwm-intel-lgm.c | 400 ++++++++++++++++++++++++++++++++++++++++++++
>>>> 3 files changed, 410 insertions(+)
>>>> create mode 100644 drivers/pwm/pwm-intel-lgm.c
>>>>
>>> [...]
>>>> diff --git a/drivers/pwm/pwm-intel-lgm.c b/drivers/pwm/pwm-intel-lgm.c
>>>> new file mode 100644
>>>> index 000000000000..3c7077acb161
>>>> --- /dev/null
>>>> +++ b/drivers/pwm/pwm-intel-lgm.c
>>>> @@ -0,0 +1,400 @@
>>> [...]
>>>> +static int lgm_pwm_probe(struct platform_device *pdev)
>>>> +{
>>>> + struct lgm_pwm_chip *pc;
>>>> + struct device *dev = &pdev->dev;
>>>> + void __iomem *io_base;
>>>> + int ret;
>>>> +
>>>> + pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL);
>>>> + if (!pc)
>>>> + return -ENOMEM;
>>>> +
>>>> + io_base = devm_platform_ioremap_resource(pdev, 0);
>>>> + if (IS_ERR(io_base))
>>>> + return PTR_ERR(io_base);
>>>> +
>>>> + pc->regmap = devm_regmap_init_mmio(dev, io_base, &pwm_regmap_config);
>>>> + if (IS_ERR(pc->regmap)) {
>>>> + ret = PTR_ERR(pc->regmap);
>>>> + dev_err(dev, "failed to init register map: %pe\n", pc->regmap);
>>>> + return ret;
>>>> + }
>>>> +
>>>> + pc->clk = devm_clk_get(dev, NULL);
>>>> + if (IS_ERR(pc->clk)) {
>>>> + ret = PTR_ERR(pc->clk);
>>>> + dev_err(dev, "failed to get clock: %pe\n", pc->clk);
>>>> + return ret;
>>>> + }
>>>> +
>>>> + pc->rst = devm_reset_control_get(dev, NULL);
>>>> + if (IS_ERR(pc->rst)) {
>>>> + ret = PTR_ERR(pc->rst);
>>>> + dev_err(dev, "failed to get reset control: %pe\n", pc->rst);
>>>> + return ret;
>>>> + }
>>> Please use devm_reset_control_get_exclusive() to make it explicit an
>>> that exclusive reset control is requested. Given how the reset control
>>> is used, I think this driver could also use
>>> devm_reset_control_get_shared() to potentially allow sharing a reset
>>> line with other devices.
>> devm_reset_control_get() is a wrapper for devm_reset_control_get_exclusive().
>> Code as below:
>> static inline struct reset_control *devm_reset_control_get(
>> struct device *dev, const char *id)
>> {
>> return devm_reset_control_get_exclusive(dev, id);
>> }
>> Am i missing something else?
> Obviously you're missing the comment above of_reset_control_get about
> some functions being compatibility wrappers.
Oops, so sorry totally missed/overlooked that. Will update in v3. Thanks.
Regards,
Rahul
Powered by blists - more mailing lists