[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MN2PR03MB516865804044A798AEB5B6C0E7D09@MN2PR03MB5168.namprd03.prod.outlook.com>
Date: Tue, 31 Jan 2023 09:27:48 +0000
From: "Sahin, Okan" <Okan.Sahin@...log.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC: Lee Jones <lee@...nel.org>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
ChiYuan Huang <cy_huang@...htek.com>,
"Bolboaca, Ramona" <Ramona.Bolboaca@...log.com>,
Caleb Connolly <caleb.connolly@...aro.org>,
William Breathitt Gray <william.gray@...aro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>
Subject: RE: [PATCH v3 3/5] drivers: regulator: Add ADI MAX77541/MAX77540
Regulator Support
Hi Andy,
Sorry for second question. I do not want to bother you, but I realized that I need to be sure about driver_data before sending new patch. You said that you need to use pointers directly for driver_data then I fixed that part in mfd, but I do not need or use driver_data in regulator since chip_id comes from mfd device so I think using like below should be enough for my implementation.
static const struct platform_device_id max77541_regulator_platform_id[] = {
{ "max77540-regulator", },
{ "max77541-regulator", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, max77541_regulator_platform_id);
static const struct of_device_id max77541_regulator_of_id[] = {
{ .compatible = "adi,max77540-regulator", },
{ .compatible = "adi,max77541-regulator", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, max77541_regulator_of_id);
What do you think?
On Tue, Jan 31, 2023 at 10:21 AM +0300, Okan Sahin wrote:
>Hi Andy,
>
>Thank you for your feedback and efforts. I have a question below.
>
>On Wed, 18 Jan 2022 11:20 AM
>Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
>
>>On Wed, Jan 18, 2023 at 09:38:10AM +0300, Okan Sahin wrote:
>>> Regulator driver for both MAX77541 and MAX77540.
>>> The MAX77541 is a high-efficiency step-down converter with two 3A
>>> switching phases for single-cell Li+ battery and 5VDC systems.
>>>
>>> The MAX77540 is a high-efficiency step-down converter with two 3A
>>> switching phases.
>>
>>...
>>
>>> + * Copyright (c) 2022 Analog Devices, Inc.
>>
>>Happy New Year!
>>
>>...
>>
>>> +static int max77541_regulator_probe(struct platform_device *pdev) {
>>> + struct max77541 *max77541 = dev_get_drvdata(pdev->dev.parent);
>>> + struct regulator_config config = {};
>>> + const struct regulator_desc *desc;
>>> + struct device *dev = &pdev->dev;
>>
>>You may rearrange this a bit
>>
>> struct max77541 *max77541 = dev_get_drvdata(dev->parent);
>>
>>> + struct regulator_dev *rdev;
>>> + int i;
>>
>>> + config.dev = pdev->dev.parent;
>>
>>dev->parent
>>
>>> +
>>> + if (max77541->id == MAX77540)
>>> + desc = max77540_regulators_desc;
>>> + else if (max77541->id == MAX77541)
>>> + desc = max77541_regulators_desc;
>>> + else
>>> + return -EINVAL;
>>> +
>>> + for (i = 0; i < MAX77541_MAX_REGULATORS; i++) {
>>
>>> + rdev = devm_regulator_register(dev,
>>> + &desc[i], &config);
>>
>>This is perfectly one line.
>Thank you, I will arrange it.
>>
>>> + if (IS_ERR(rdev))
>>> + return dev_err_probe(dev, PTR_ERR(rdev),
>>> + "Failed to register regulator\n");
>>> + }
>>> +
>>> + return 0;
>>> +}
>>
>>...
>However, this one is not fit when I set max-line-length argument as 80 in
>checkpatch script. What do you suggest? This line has 99 characters.
>>
>>> +static const struct of_device_id max77541_regulator_of_id[] = {
>>> + {
>>> + .compatible = "adi,max77540-regulator",
>>> + .data = (void *)MAX77540,
>>> + },
>>> + {
>>> + .compatible = "adi,max77541-regulator",
>>> + .data = (void *)MAX77541,
>>> + },
>>> + { /* sentinel */ }
>>
>>As pointed out, better to use pointers directly.
>>
>>> +};
>>
>>--
>>With Best Regards,
>>Andy Shevchenko
>>
>
>Regards,
>Okan Sahin
Regards,
Okan
Powered by blists - more mailing lists