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: 641590 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A69BDC5479D for ; Tue, 10 Jan 2023 02:48:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbjAJCsc (ORCPT ); Mon, 9 Jan 2023 21:48:32 -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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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;