Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4906249imm; Sun, 22 Jul 2018 08:29:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcv09ODKSlshIFu6Ofj+4o3aV8eTGFlcFV+Bcc+/ucCVOw313zVQMy1io4Hnj4/MkMkBiWx X-Received: by 2002:a17:902:9a4b:: with SMTP id x11-v6mr9343399plv.342.1532273392163; Sun, 22 Jul 2018 08:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532273392; cv=none; d=google.com; s=arc-20160816; b=IZubGvkwAnWo+ufGiBlxLdKqKIFdtEovmfAdPlftiIK6OlOzU1RThDnI9XJzI9iADW 4Da2JdOH1gZCZo9lnX9QO8WFNYirRlfBl+5gU+HXyQ5PV5qzjT4NfiCo8kNmW2Yhm48M go19gZAxtcZZK/Qe04XtmClL3HhlQr30bsluBsg6G3sQ7RyW6g6/2PCu1o5Ti3VNBBsD 60Yv1j5rvWrn+lDJOxfz4Yz03k5gKJ51rfRWPZMbyCg9VyfBNNfEaQJQsszGo6dySYwY YQ3LnuEgTYUNTVofWVNmnmqjWH8EXowUagthC4b4LEYOIX3wLfW1T9y1j3PXbkfDzoog FwdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=JESrPzg/2R4IXIvxbHg8XyFfp/Lbwi6Ahr+IYLXeBG4=; b=IojZrsIRdJ8zg9lszHxWkFO/4DaUHxz5AMJvUzwCw1O3Ra4Qmzoz/LYgzQ3iWyLMBY SNyIqRnqYuG91dV/4BMl1G3GdoqljzEs0hdyjmghlOGDsXWDcxc2zjGMbUogk3VpkPS4 1g6Mx3yanFIrudbaDpCZERTiG97IoAyFSwqc/6YsxQGseO+sxbJL3ZZph09Gyq9gxOAP Y2eustxfwFHnmC4OSsl910DHJ/avwOUZarfVIvi+9OTLVqpiyesMPjZJC/GKYTv8rM5k LkUZ4BviQZmXeNpdB0DFrnQGRAC51kHTeMR8qY+d3x3A/jh5PVg3P5RvKMzaur1kmJQX EKpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10-v6si6467235pge.674.2018.07.22.08.29.36; Sun, 22 Jul 2018 08:29:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729890AbeGVQZt (ORCPT + 99 others); Sun, 22 Jul 2018 12:25:49 -0400 Received: from smtprz14.163.net ([106.3.154.247]:2863 "EHLO smtp.tom.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728566AbeGVQZt (ORCPT ); Sun, 22 Jul 2018 12:25:49 -0400 Received: from antispam2.tom.com (unknown [172.25.16.56]) by freemail02.tom.com (Postfix) with ESMTP id 93FF2B00D4E for ; Sun, 22 Jul 2018 21:34:16 +0800 (CST) Received: from antispam2.tom.com (antispam2.tom.com [127.0.0.1]) by antispam2.tom.com (Postfix) with ESMTP id 3E87B81220 for ; Sun, 22 Jul 2018 21:34:16 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam2.tom.com Received: from antispam2.tom.com ([127.0.0.1]) by antispam2.tom.com (antispam2.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6exARlmtqmmV for ; Sun, 22 Jul 2018 21:34:14 +0800 (CST) Received: from localhost (unknown [222.209.18.46]) by antispam2.tom.com (Postfix) with ESMTPA id 1777E8053C; Sun, 22 Jul 2018 21:34:14 +0800 (CST) From: Liu Xiang To: sre@kernel.org Cc: pali.rohar@gmail.com, afd@ti.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, liuxiang_1999@126.com, Liu Xiang Subject: [PATCH] power: supply: bq27xxx: Add support for BQ27411 Date: Sun, 22 Jul 2018 21:33:56 +0800 Message-Id: <1532266436-20182-1-git-send-email-liu.xiang6@zte.com.cn> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to the datasheet, bq27411 is similar to bq27421. Signed-off-by: Liu Xiang --- Documentation/devicetree/bindings/power/supply/bq27xxx.txt | 1 + drivers/power/supply/bq27xxx_battery.c | 9 +++++++++ drivers/power/supply/bq27xxx_battery_i2c.c | 2 ++ include/linux/power/bq27xxx_battery.h | 1 + 4 files changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/bq27xxx.txt b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt index 37994fd..4fa8e08 100644 --- a/Documentation/devicetree/bindings/power/supply/bq27xxx.txt +++ b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt @@ -23,6 +23,7 @@ Required properties: * "ti,bq27546" - BQ27546 * "ti,bq27742" - BQ27742 * "ti,bq27545" - BQ27545 + * "ti,bq27411" - BQ27411 * "ti,bq27421" - BQ27421 * "ti,bq27425" - BQ27425 * "ti,bq27426" - BQ27426 diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index f022e1b..6dbbe95 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -432,6 +432,7 @@ enum bq27xxx_reg_index { [BQ27XXX_REG_AP] = 0x18, BQ27XXX_DM_REG_ROWS, }; +#define bq27411_regs bq27421_regs #define bq27425_regs bq27421_regs #define bq27426_regs bq27421_regs #define bq27441_regs bq27421_regs @@ -665,6 +666,7 @@ enum bq27xxx_reg_index { POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, POWER_SUPPLY_PROP_MANUFACTURER, }; +#define bq27411_props bq27421_props #define bq27425_props bq27421_props #define bq27426_props bq27421_props #define bq27441_props bq27421_props @@ -725,6 +727,12 @@ enum bq27xxx_dm_reg_id { #define bq27545_dm_regs 0 #endif +static struct bq27xxx_dm_reg bq27411_dm_regs[] = { + [BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 10, 2, 0, 32767 }, + [BQ27XXX_DM_DESIGN_ENERGY] = { 82, 12, 2, 0, 32767 }, + [BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 16, 2, 2800, 3700 }, +}; + static struct bq27xxx_dm_reg bq27421_dm_regs[] = { [BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 10, 2, 0, 8000 }, [BQ27XXX_DM_DESIGN_ENERGY] = { 82, 12, 2, 0, 32767 }, @@ -802,6 +810,7 @@ enum bq27xxx_dm_reg_id { [BQ27546] = BQ27XXX_DATA(bq27546, 0 , BQ27XXX_O_OTDC), [BQ27742] = BQ27XXX_DATA(bq27742, 0 , BQ27XXX_O_OTDC), [BQ27545] = BQ27XXX_DATA(bq27545, 0x04143672, BQ27XXX_O_OTDC), + [BQ27411] = BQ27XXX_DATA(bq27411, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), [BQ27421] = BQ27XXX_DATA(bq27421, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), [BQ27425] = BQ27XXX_DATA(bq27425, 0x04143672, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP), [BQ27426] = BQ27XXX_DATA(bq27426, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c index 4006912..2677c38 100644 --- a/drivers/power/supply/bq27xxx_battery_i2c.c +++ b/drivers/power/supply/bq27xxx_battery_i2c.c @@ -247,6 +247,7 @@ static int bq27xxx_battery_i2c_remove(struct i2c_client *client) { "bq27546", BQ27546 }, { "bq27742", BQ27742 }, { "bq27545", BQ27545 }, + { "bq27411", BQ27411 }, { "bq27421", BQ27421 }, { "bq27425", BQ27425 }, { "bq27426", BQ27426 }, @@ -279,6 +280,7 @@ static int bq27xxx_battery_i2c_remove(struct i2c_client *client) { .compatible = "ti,bq27546" }, { .compatible = "ti,bq27742" }, { .compatible = "ti,bq27545" }, + { .compatible = "ti,bq27411" }, { .compatible = "ti,bq27421" }, { .compatible = "ti,bq27425" }, { .compatible = "ti,bq27426" }, diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h index d6355f4..507c5e2 100644 --- a/include/linux/power/bq27xxx_battery.h +++ b/include/linux/power/bq27xxx_battery.h @@ -24,6 +24,7 @@ enum bq27xxx_chip { BQ27546, BQ27742, BQ27545, /* bq27545 */ + BQ27411, BQ27421, /* bq27421, bq27441, bq27621 */ BQ27425, BQ27426, -- 1.9.1