Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp615848pxb; Tue, 1 Feb 2022 07:04:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRkUYyxz2BwioHml6NVakfNPrwKiKEu6ZrhH1/F4Zlx4MvnwZz402jSfbaWh14hKlZJx7x X-Received: by 2002:a17:906:c5b:: with SMTP id t27mr21330082ejf.317.1643727876674; Tue, 01 Feb 2022 07:04:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643727876; cv=none; d=google.com; s=arc-20160816; b=sdkyLKo2POgQmQQ/rZcH+3mMBw7W4Cq9l2B4J3w01DNtHmUHMBhpzAlUi6z3W2wA0F PFfrlu0jkDVyWHvpSiDKWTeBZHkuuH/FrB0iQ5azi8TM0MM8DUxBTm3J87wfhTr+CvDN QK5cEQmut+NyT9FlqSXgILtPtFYW7zfTD5xR2VwRHf8G8bWEUojrYhEjmOgQh9BbZqlP 5sM3SKwShkpDGnzWZ9EXcsz3d4KWhJragzL5LTQ57aCsgvpwiZPM6iw7fwhgFEbqji3m g26UBxSWE3tVbYS/3AofsQLiUmJ/dl5e5scaUYuGrji0eivlITozQOxZlCdVqp+1H0An VB0w== 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=z0KY+INVdVwsnOFWOvZroFlL4EVFzOquUSMZhHLXyX0=; b=ZAUOPSTj7agzHx0sV0BqV2Qkzq1FPvqtKMwM54BOw9yzIA+v5k3HQqqRHyNnzW9V0A Z39KXbb2IzXjJhmdMEMLuQqTVGVrGO4P6sAPFi9eKwoihV6xOQZLqzTuphlyHvbm/Pmg 2fx6TEgWtVnAvjADNyUFj1am9iEn6pC2J93PecErz9JH58KXuM9h1a3PGXqJhwED3rff RxTH1SoQ1TnWt6+zBM7NnbzpIloyFL/A12VzGW8PzuQ22zreg79uab1tLleu82rU9spP UZzH6jcdGBWPXjUiOeFQ9ZbaUR7VcN11mOvtXewfoQzSDrdM/ZY8t6JAg6m7rxyMxPc/ mMPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jKwesObR; 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 z18si9503362edb.609.2022.02.01.07.04.10; Tue, 01 Feb 2022 07:04:36 -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=jKwesObR; 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 S1356223AbiA3Uq7 (ORCPT + 99 others); Sun, 30 Jan 2022 15:46:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41563 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356222AbiA3Uq5 (ORCPT ); Sun, 30 Jan 2022 15:46:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643575616; 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=z0KY+INVdVwsnOFWOvZroFlL4EVFzOquUSMZhHLXyX0=; b=jKwesObRUu089C5KON6a6hfnnGZ/ZxBHsPW42D9iaX34FujwwCNd53YXSInl9SJu5pjPgY BCY+jNDtEYsf5AxqEGh9rCDierpeMvAWDUbhPn+F+Z74GAT1ITOay8Zc+p60Reo2dYFMfB MUUxY7kd3xDSDib96oTypMT3/mhc23g= 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-336-uf3WxaqpPxy4gmpGqrO2VQ-1; Sun, 30 Jan 2022 15:46:51 -0500 X-MC-Unique: uf3WxaqpPxy4gmpGqrO2VQ-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 2C21A1083F62; Sun, 30 Jan 2022 20:46:49 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5F2D61093; Sun, 30 Jan 2022 20:46:38 +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 06/20] power: supply: bq25890: Add support to read back the settings from the chip Date: Sun, 30 Jan 2022 21:45:43 +0100 Message-Id: <20220130204557.15662-7-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 there is no devicetree to supply the necessary init-data. Instead the firmware already fully initializes the bq25890 charger at boot. To support this, add support for reading back the settings from the chip through a new "linux,read-back-settings" boolean. 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,skip-reset" patch this patch replaces the "ti,skip-init" patch from v1 --- drivers/power/supply/bq25890_charger.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index cd80d748df92..f758e28046e5 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -111,6 +111,7 @@ struct bq25890_device { struct regmap_field *rmap_fields[F_MAX_FIELDS]; bool skip_reset; + bool read_back_init_data; enum bq25890_chip_version chip_version; struct bq25890_init_data init_data; struct bq25890_state state; @@ -696,7 +697,7 @@ static int bq25890_chip_reset(struct bq25890_device *bq) static int bq25890_rw_init_data(struct bq25890_device *bq) { - bool write = true; + bool write = !bq->read_back_init_data; int ret; int i; @@ -981,6 +982,10 @@ static int bq25890_fw_probe(struct bq25890_device *bq) struct bq25890_init_data *init = &bq->init_data; bq->skip_reset = device_property_read_bool(bq->dev, "linux,skip-reset"); + bq->read_back_init_data = device_property_read_bool(bq->dev, + "linux,read-back-settings"); + if (bq->read_back_init_data) + return 0; ret = bq25890_fw_read_u32_props(bq); if (ret < 0) -- 2.33.1