[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6ffd2b8c-00f4-211e-de57-23d5159ae7d4@redhat.com>
Date: Mon, 8 Nov 2021 17:06:50 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Mark Gross <markgross@...nel.org>,
Andy Shevchenko <andy@...radead.org>,
Wolfram Sang <wsa@...-dreams.de>,
Sebastian Reichel <sre@...nel.org>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Ard Biesheuvel <ardb@...nel.org>,
Yauhen Kharuzhy <jekhor@...il.com>,
Tsuchiya Yuto <kitakar@...il.com>,
Platform Driver <platform-driver-x86@...r.kernel.org>,
linux-i2c <linux-i2c@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-efi <linux-efi@...r.kernel.org>
Subject: Re: [PATCH 10/13] power: supply: bq25890: Add support for registering
the Vbus boost converter as a regulator
Hi,
On 10/31/21 00:13, Andy Shevchenko wrote:
> On Sat, Oct 30, 2021 at 9:28 PM Hans de Goede <hdegoede@...hat.com> wrote:
>>
>> The bq25890_charger code supports enabling/disabling the boost converter
>> based on usb-phy notifications. But the usb-phy framework is not used on
>> all boards/platforms. At support for registering the Vbus boost converter
>> as a standard regulator when there is no usb-phy on the board.
>>
>> Also add support for providing regulator_init_data through platform_data
>> for use on boards where device-tree is not used and the platform code must
>> thus provide the regulator_init_data.
>
> ...
>
>> @@ -1018,6 +1059,21 @@ static int bq25890_probe(struct i2c_client *client,
>> INIT_WORK(&bq->usb_work, bq25890_usb_work);
>> bq->usb_nb.notifier_call = bq25890_usb_notifier;
>> usb_register_notifier(bq->usb_phy, &bq->usb_nb);
>> +#ifdef CONFIG_REGULATOR
>> + } else {
>> + struct bq25890_platform_data *pdata = dev_get_platdata(dev);
>> + struct regulator_config cfg = { };
>> + struct regulator_dev *reg;
>> +
>> + cfg.dev = dev;
>> + cfg.driver_data = bq;
>> + if (pdata)
>> + cfg.init_data = pdata->regulator_init_data;
>> +
>> + reg = devm_regulator_register(dev, &bq25890_vbus_desc, &cfg);
>> + if (IS_ERR(reg))
>> + return dev_err_probe(dev, PTR_ERR(reg), "registering regulator");
>> +#endif
>> }
>
> }
> #ifdef
> else {
> ...
> }
> #endif
>
> is a bit better to maintain (less error prone in case of new code).
>
> ...
>
>> +#ifndef _BQ25890_CHARGER_H_
>> +#define _BQ25890_CHARGER_H_
>
>> +#include <linux/regulator/machine.h>
>
> struct regulator_init_data;
>
> should be sufficient, no header is needed.
Thanks, I've fixed both for v2 of the patch-set.
Regards,
Hans
>
>> +struct bq25890_platform_data {
>> + const struct regulator_init_data *regulator_init_data;
>> +};
>> +
>> +#endif
>
Powered by blists - more mailing lists