diff mbox series

[3/7] power: supply: sbs-battery: add force_load as a dts property

Message ID 20191101190705.13393-3-jeff.dagenais@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show
Series [1/7] power: supply: sbs-battery: use octal permissions on module param | expand

Commit Message

Jean-François Dagenais Nov. 1, 2019, 7:07 p.m. UTC
This extends the behaviour of the existing module param so that system
integrators can specify the flag in device-tree.

Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
---
 drivers/power/supply/sbs-battery.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Sebastian Reichel Dec. 19, 2019, 1:19 a.m. UTC | #1
Hi,

On Fri, Nov 01, 2019 at 03:07:01PM -0400, Jean-Francois Dagenais wrote:
> This extends the behaviour of the existing module param so that system
> integrators can specify the flag in device-tree.
> 
> Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
> ---

sbs,force-load is not a hardware description and does not belong
into DT. OTOH "hot-plug-capable;" would be a hardware description
and carry the same information. Please respin the patch(es) and CC
Rob Herring <robh+dt@kernel.org> and devicetree@vger.kernel.org.

-- Sebastian

>  drivers/power/supply/sbs-battery.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
> index f9e8c14ac830..f92b98d900d2 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -814,6 +814,7 @@ static int sbs_probe(struct i2c_client *client,
>  	struct power_supply_desc *sbs_desc;
>  	struct sbs_platform_data *pdata = client->dev.platform_data;
>  	struct power_supply_config psy_cfg = {};
> +	bool force_load;
>  	int rc;
>  	int irq;
>  
> @@ -858,6 +859,9 @@ static int sbs_probe(struct i2c_client *client,
>  	}
>  	chip->i2c_retry_count = chip->i2c_retry_count + 1;
>  
> +	force_load = of_property_read_bool(client->dev.of_node,
> +					   "sbs,force-load");
> +
>  	chip->gpio_detect = devm_gpiod_get_optional(&client->dev,
>  			"sbs,battery-detect", GPIOD_IN);
>  	if (IS_ERR(chip->gpio_detect)) {
> @@ -890,7 +894,7 @@ static int sbs_probe(struct i2c_client *client,
>  	 * Before we register, we might need to make sure we can actually talk
>  	 * to the battery.
>  	 */
> -	if (!(param_force_load || chip->gpio_detect)) {
> +	if (!(param_force_load || force_load || chip->gpio_detect)) {
>  		rc = sbs_read_word_data(client, sbs_data[REG_STATUS].addr);
>  
>  		if (rc < 0) {
> -- 
> 2.23.0
>
diff mbox series

Patch

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index f9e8c14ac830..f92b98d900d2 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -814,6 +814,7 @@  static int sbs_probe(struct i2c_client *client,
 	struct power_supply_desc *sbs_desc;
 	struct sbs_platform_data *pdata = client->dev.platform_data;
 	struct power_supply_config psy_cfg = {};
+	bool force_load;
 	int rc;
 	int irq;
 
@@ -858,6 +859,9 @@  static int sbs_probe(struct i2c_client *client,
 	}
 	chip->i2c_retry_count = chip->i2c_retry_count + 1;
 
+	force_load = of_property_read_bool(client->dev.of_node,
+					   "sbs,force-load");
+
 	chip->gpio_detect = devm_gpiod_get_optional(&client->dev,
 			"sbs,battery-detect", GPIOD_IN);
 	if (IS_ERR(chip->gpio_detect)) {
@@ -890,7 +894,7 @@  static int sbs_probe(struct i2c_client *client,
 	 * Before we register, we might need to make sure we can actually talk
 	 * to the battery.
 	 */
-	if (!(param_force_load || chip->gpio_detect)) {
+	if (!(param_force_load || force_load || chip->gpio_detect)) {
 		rc = sbs_read_word_data(client, sbs_data[REG_STATUS].addr);
 
 		if (rc < 0) {