diff mbox series

[v2,2/7] power: supply: bq24190_charger: add support for bq24192 variant

Message ID 20181101001149.13453-3-masneyb@onstation.org (mailing list archive)
State Not Applicable, archived
Headers show
Series ARM: qcom: msm8974-hammerhead: add USB OTG support | expand

Commit Message

Brian Masney Nov. 1, 2018, 12:11 a.m. UTC
From: Jonathan Marek <jonathan@marek.ca>

This patch adds support for the bq24192 variant to bq24190_charger.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
[masneyb@onstation.org: Changed if statement to a switch based on
feedback from Sebastian Reichel.]
Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 drivers/power/supply/bq24190_charger.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Sebastian Reichel Dec. 5, 2018, 9:56 p.m. UTC | #1
Hi,

On Wed, Oct 31, 2018 at 08:11:44PM -0400, Brian Masney wrote:
> From: Jonathan Marek <jonathan@marek.ca>
> 
> This patch adds support for the bq24192 variant to bq24190_charger.
> 
> Signed-off-by: Jonathan Marek <jonathan@marek.ca>
> [masneyb@onstation.org: Changed if statement to a switch based on
> feedback from Sebastian Reichel.]
> Signed-off-by: Brian Masney <masneyb@onstation.org>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/bq24190_charger.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
> index b58df04d03b3..44d3aff32885 100644
> --- a/drivers/power/supply/bq24190_charger.c
> +++ b/drivers/power/supply/bq24190_charger.c
> @@ -1637,8 +1637,12 @@ static int bq24190_hw_init(struct bq24190_dev_info *bdi)
>  	if (ret < 0)
>  		return ret;
>  
> -	if (v != BQ24190_REG_VPRS_PN_24190 &&
> -	    v != BQ24190_REG_VPRS_PN_24192I) {
> +	switch (v) {
> +	case BQ24190_REG_VPRS_PN_24190:
> +	case BQ24190_REG_VPRS_PN_24192:
> +	case BQ24190_REG_VPRS_PN_24192I:
> +		break;
> +	default:
>  		dev_err(bdi->dev, "Error unknown model: 0x%02x\n", v);
>  		return -ENODEV;
>  	}
> @@ -1931,6 +1935,7 @@ static const struct dev_pm_ops bq24190_pm_ops = {
>  
>  static const struct i2c_device_id bq24190_i2c_ids[] = {
>  	{ "bq24190" },
> +	{ "bq24192" },
>  	{ "bq24192i" },
>  	{ },
>  };
> @@ -1939,6 +1944,7 @@ MODULE_DEVICE_TABLE(i2c, bq24190_i2c_ids);
>  #ifdef CONFIG_OF
>  static const struct of_device_id bq24190_of_match[] = {
>  	{ .compatible = "ti,bq24190", },
> +	{ .compatible = "ti,bq24192", },
>  	{ .compatible = "ti,bq24192i", },
>  	{ },
>  };
> -- 
> 2.17.2
>
diff mbox series

Patch

diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
index b58df04d03b3..44d3aff32885 100644
--- a/drivers/power/supply/bq24190_charger.c
+++ b/drivers/power/supply/bq24190_charger.c
@@ -1637,8 +1637,12 @@  static int bq24190_hw_init(struct bq24190_dev_info *bdi)
 	if (ret < 0)
 		return ret;
 
-	if (v != BQ24190_REG_VPRS_PN_24190 &&
-	    v != BQ24190_REG_VPRS_PN_24192I) {
+	switch (v) {
+	case BQ24190_REG_VPRS_PN_24190:
+	case BQ24190_REG_VPRS_PN_24192:
+	case BQ24190_REG_VPRS_PN_24192I:
+		break;
+	default:
 		dev_err(bdi->dev, "Error unknown model: 0x%02x\n", v);
 		return -ENODEV;
 	}
@@ -1931,6 +1935,7 @@  static const struct dev_pm_ops bq24190_pm_ops = {
 
 static const struct i2c_device_id bq24190_i2c_ids[] = {
 	{ "bq24190" },
+	{ "bq24192" },
 	{ "bq24192i" },
 	{ },
 };
@@ -1939,6 +1944,7 @@  MODULE_DEVICE_TABLE(i2c, bq24190_i2c_ids);
 #ifdef CONFIG_OF
 static const struct of_device_id bq24190_of_match[] = {
 	{ .compatible = "ti,bq24190", },
+	{ .compatible = "ti,bq24192", },
 	{ .compatible = "ti,bq24192i", },
 	{ },
 };