Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp615787pxb; Tue, 1 Feb 2022 07:04:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyn+IyMGpvRc0P78snaK5fc+8HrOeo311EwoZ/vT2thSsYtti0CSFDdS6hYk053Thpexr5i X-Received: by 2002:a17:907:2162:: with SMTP id rl2mr21101236ejb.467.1643727873154; Tue, 01 Feb 2022 07:04:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643727873; cv=none; d=google.com; s=arc-20160816; b=0hMP5Vow43i6xj1va5febvO7mAG93tp/7fqMP3HxiQd70NHEeUOVnVsm3TNj7XUTTw h4waI20srv0wabNBYx+Gm1hnmykMO5Yi65lTDBb7SJKOgFv9M9BLCzLKwimHy1M4yfhY 7ZsbeklCTLuUfYbfj1jDn/xViJNhNAjBgcHmqKn8J6HeL1Ekf9paWZWF7j8BH/EUEfTY 37yBnszJhrq/9GNov/DxISLirvfgLROn4HGkM7wxZp/OgMa63hO0Al5pA+oQxRI1qkkj 4PQmzS+9QETtWMYD6ganULcgPGt3JXMA1tZHdbC6iPPyA7lD2ouSAC2wL/GHVA3yOtlh RJhA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fANyvle+meUJ4owjhpqvoJKR2AJ1xpjSPkIqPG9nFHk=; b=k+oE+HfoyaWDaYnL8AVR5DAOz5GM/m93MF23dfeOiefcl6ZGXZjX7PW7iA7LnFH540 j8NZmgnOWMFVMrJFYM07tsa9bUxyGPJO4CUFUTo/8cyfrJxlXVkXPdUPDF+3dbwQkyRX QqBANDeDrhtJEmnnCcEN4TbasHhloHOXT6lEkF8NdlKxRqK+A9MyXmAXwre17L1EPTxn luHbbFPkm5krjpTnfuoGjDnon9aS3JuCcyOumDNRVgHlejceFHoJQAW5PD0lhJGM9kJl 6QllY5uJRp42hm6RQnjpBoZzC2PTklGzY3bgnGWsBIfJr6dElJgLH440dTXgzXAJcu+W i7iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R4pWQBUB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si9623868ede.453.2022.02.01.07.04.03; Tue, 01 Feb 2022 07:04:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R4pWQBUB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356215AbiA3Uqs (ORCPT + 99 others); Sun, 30 Jan 2022 15:46:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31318 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356202AbiA3Uqq (ORCPT ); Sun, 30 Jan 2022 15:46:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643575606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fANyvle+meUJ4owjhpqvoJKR2AJ1xpjSPkIqPG9nFHk=; b=R4pWQBUBWyGCseSNnqhyxt/L95/xJJnrX3XmH96++sCRwvnaBXurvi3JQgx9p5aphiBc1Y hqsfA5hXM3mDT/TnszS2ZRwrrFMP22Jk0DVyov1cQyWZKpR60D2SDO5nqibJ2ynpxqPwpF +967dGwz+6grk5obvsFPg93rlpXs+5A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-270-ReAHBULvPaafvSUp0GZmng-1; Sun, 30 Jan 2022 15:46:40 -0500 X-MC-Unique: ReAHBULvPaafvSUp0GZmng-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E1C718397B3; Sun, 30 Jan 2022 20:46:38 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C58A61093; Sun, 30 Jan 2022 20:46:25 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Mika Westerberg , Mark Gross , Andy Shevchenko , Wolfram Sang , Lee Jones , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel Cc: Hans de Goede , Len Brown , linux-acpi@vger.kernel.org, Yauhen Kharuzhy , Tsuchiya Yuto , Fabio Aiuto , platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: [PATCH v4 05/20] power: supply: bq25890: Add support to skip reset at probe() / remove() Date: Sun, 30 Jan 2022 21:45:42 +0100 Message-Id: <20220130204557.15662-6-hdegoede@redhat.com> In-Reply-To: <20220130204557.15662-1-hdegoede@redhat.com> References: <20220130204557.15662-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On most x86/ACPI devices the firmware already fully initializes the bq25890 charger at boot, in this case it is best to not reset it at probe() time. At support for a new "linux,skip-reset" boolean property to support this. So far this new property is only used on x86/ACPI (non devicetree) devs, IOW it is not used in actual devicetree files. The devicetree-bindings maintainers have requested properties like these to not be added to the devicetree-bindings, so the new property is deliberately not added to the existing devicetree-bindings. Signed-off-by: Hans de Goede --- Changes in v2: - New patch in v2 of this series, together with the "linux,read-back-settings" patch, this patch replaces the "ti,skip-init" patch from v1 --- drivers/power/supply/bq25890_charger.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index eaf0400b632f..cd80d748df92 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -110,6 +110,7 @@ struct bq25890_device { struct regmap *rmap; struct regmap_field *rmap_fields[F_MAX_FIELDS]; + bool skip_reset; enum bq25890_chip_version chip_version; struct bq25890_init_data init_data; struct bq25890_state state; @@ -739,10 +740,12 @@ static int bq25890_hw_init(struct bq25890_device *bq) { int ret; - ret = bq25890_chip_reset(bq); - if (ret < 0) { - dev_dbg(bq->dev, "Reset failed %d\n", ret); - return ret; + if (!bq->skip_reset) { + ret = bq25890_chip_reset(bq); + if (ret < 0) { + dev_dbg(bq->dev, "Reset failed %d\n", ret); + return ret; + } } /* disable watchdog */ @@ -977,6 +980,8 @@ static int bq25890_fw_probe(struct bq25890_device *bq) int ret; struct bq25890_init_data *init = &bq->init_data; + bq->skip_reset = device_property_read_bool(bq->dev, "linux,skip-reset"); + ret = bq25890_fw_read_u32_props(bq); if (ret < 0) return ret; @@ -1089,8 +1094,10 @@ static int bq25890_remove(struct i2c_client *client) if (!IS_ERR_OR_NULL(bq->usb_phy)) usb_unregister_notifier(bq->usb_phy, &bq->usb_nb); - /* reset all registers to default values */ - bq25890_chip_reset(bq); + if (!bq->skip_reset) { + /* reset all registers to default values */ + bq25890_chip_reset(bq); + } return 0; } -- 2.33.1