From patchwork Tue Jan 10 02:47:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hermes Zhang X-Patchwork-Id: 41271 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2514362wrt; Mon, 9 Jan 2023 18:58:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXvgad/Y/ygdMX3VuRiYGAI9qW6ujcYGXq4TRThfgVVFJIGToJgbGFMse5eDhOyeUouZHA2H X-Received: by 2002:a17:906:6dce:b0:7c3:e3ef:bca1 with SMTP id j14-20020a1709066dce00b007c3e3efbca1mr55887104ejt.60.1673319489714; Mon, 09 Jan 2023 18:58:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673319489; cv=none; d=google.com; s=arc-20160816; b=cZHbxMv15Q0GsZZ+R+RfpC7GSBRGvJAfgM/DIFu8RkDF5XanY4wz8hBsYWVUaqj4je C5XtVsDW8c2QDl+z5RXSU4qqUaigEaEsFxl+Cs3V/XgihY60DMuUzWhGFHQLmZ+IB/nl uQw5yP4bwR24V3XiyKXItfpzWJkGXnSsAWEqG5UNZlSgyoMoflpMYyrYs3lHrkxpTsSO rbT0x6C5yLsHgkQAi9an0RxaZHOUqbeGs2fHzw66irLR9MapkvSlWgCSSWgGsLNPfrAT UH2aHhlMxiQUFjkaYPkmHkexF4z2gBzVl0WJBZyHgs4pPhogsv0jow8hBdWebKSloh0r oJNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=84Qqs7Rp9uTa2WHYoGwl6hURVvefJF0UiJ4y5h0kg4I=; b=B8xtbLGpcQhUj/zSrexgCuk4CSkm4ZkPJUgaKUl99EYXfitEE9nqjupP29xnq3LjkW HGG4b5AOQPwsmwx1iRxLJsbTTmdyJCeiQLEXQJKeqwH57vKiV+ZERl/R2zVHI8hOesmX nz/Qjwq2o6B1LzjqzZJa4BMlwoENsnRVFDohMavARNypHIbQ8BN03UsCJ6rQsjHgEc3z xPnRH9lYIVJVFAW6hzdwOsciCexMTlJbiE0XR/X5XXDfEODzBCGGnfol8lJvfngl6og3 LuOKJNt0JANk8NTyD2fV9ZrleEKPWtd6UFeYxLrJPd+edf4Bol2Njrufs7ZZN6dxqEko Dmxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=i8YcfZdT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di12-20020a170906730c00b0078e11cbb722si12537455ejc.92.2023.01.09.18.57.46; Mon, 09 Jan 2023 18:58:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=i8YcfZdT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229707AbjAJCsd (ORCPT + 99 others); Mon, 9 Jan 2023 21:48:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbjAJCsb (ORCPT ); Mon, 9 Jan 2023 21:48:31 -0500 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAA1233D42; Mon, 9 Jan 2023 18:48:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1673318910; x=1704854910; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=84Qqs7Rp9uTa2WHYoGwl6hURVvefJF0UiJ4y5h0kg4I=; b=i8YcfZdT7SGq1DiJiJIWcZLkEgJPDrYdffkrbQKfvRyYiLH03Oeyd0bu B5jXZziLcjANmWuyntnUHknD9QzTPwVf+MK9t0DS+SG4k4hXh/0i08x+R X7H8V1XHqCUXz2MAjdtf3QZW8EjKHPdMg2ein9k5AwS/ttV5KXgZZRsRY ujVjPTegd+Eg30Vh/hYWX+rUnxIqdTce68o/XXUjYskIRhFWSgXfailMR qMsaTpuLuQtQ0v35ckBeYhiKVG1KH7kmEBRjkeqPfbFnu46U09JMBT/OA z3sKRbgPp7IkCdKGSRJytM3G6fCk0Nv2qlUrP1ZZnh6lBWKBHOgMRAFlL Q==; From: Hermes Zhang To: Sebastian Reichel CC: , Hermes Zhang , , Subject: [PATCH v2] power: supply: bq256xx: Init ichg/vbat value with chip default value Date: Tue, 10 Jan 2023 10:47:46 +0800 Message-ID: <20230110024746.2701738-1-chenhuiz@axis.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754602657196762030?= X-GMAIL-MSGID: =?utf-8?q?1754602657196762030?= Init the ichg/vbat reg with chip default value instead of the max value used now. The max value set in driver will result an unsafe case (e.g. battery is over charging when in a hot environment) if no user space update the value later. Signed-off-by: Hermes Zhang --- Notes: V2 drivers/power/supply/bq256xx_charger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/bq256xx_charger.c b/drivers/power/supply/bq256xx_charger.c index 01ad84fd147c..6b5435bf2ed4 100644 --- a/drivers/power/supply/bq256xx_charger.c +++ b/drivers/power/supply/bq256xx_charger.c @@ -1563,7 +1563,7 @@ static int bq256xx_hw_init(struct bq256xx_device *bq) return ret; ret = bq->chip_info->bq256xx_set_ichg(bq, - bat_info->constant_charge_current_max_ua); + bq->chip_info->bq256xx_def_ichg); if (ret) return ret; @@ -1573,7 +1573,7 @@ static int bq256xx_hw_init(struct bq256xx_device *bq) return ret; ret = bq->chip_info->bq256xx_set_vbatreg(bq, - bat_info->constant_charge_voltage_max_uv); + bq->chip_info->bq256xx_def_vbatreg); if (ret) return ret;