Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1359295pxb; Sat, 30 Oct 2021 11:33:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvSnn0qETuPxu2GT5tPD95JVkQVxEc9N4ntu+r+KdGOInJlLAI85Jqdn9OvsZ/SF+qL0iZ X-Received: by 2002:a05:6402:524b:: with SMTP id t11mr7716561edd.334.1635618793378; Sat, 30 Oct 2021 11:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635618793; cv=none; d=google.com; s=arc-20160816; b=HG3QXsc4J0zZ3Qlaz74hexRt8sUwm+H4PgVEWijqegx36+Is/0vmYqtAQlpcVMwcB7 vtN+k4Ylxd6csi9Frvz8yG3V5JSvQGj5p9zg6ug8W++Dnh0RSs5QmpoM0ijRzMvbZLtM 2zhh2AP5VTb92a4ruQR2Lr38AWo3wKPhHJuDEyxMHUwCATJ0GjjWu0nM+VGOPlHafFwK JWSOm1z/ETS7cq1y6DriZcPHLwkD6xjJDe7uH9WJMthztaW/W2Dc99GPf5fKhtZeIutw iGGwXINi4HDmRLR12EYLegVp/sz9kNbMztyay2HnKhXN42ZhfDZQmCsttGnfqaSJ+UeW vKwA== 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=n3Mgk88GftykavhRfevxmb2OnrvVoUttarFCvaInBLI=; b=fdsBCShnY1CH50+cY8n1W17byAA3l4lfgc2TOmeA9Vydb8hR7EHkBcCeO4I6+Tb93B D1eAkLGZg2hmbJJ2nt18ARqulNpz0EE33bSHU/I6XuSiBC8RhEXm0wr9GifE2wCQK1zq EeDYTFJP1SduUJo4zN9QU7yaQJYDaWdenmwwOGjAL50OthxNdHPNfbSCohNj6fd4+KJa UFrRdiETnUR5YpjB2jW7Cl3P55yurmMjPNkW2lDyPJnMPjkmbsy2qgU2F2m1wkIWWC6p Q5lOqtzFiWe4BLQ4+mtw43C1JqMAwGiPK6CnmZQzMBW1pnKofXgNqeV9ZujpqpNg7wqG un5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JfBsF8em; 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 e7si15460914edk.440.2021.10.30.11.32.20; Sat, 30 Oct 2021 11:33:13 -0700 (PDT) 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=JfBsF8em; 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 S232040AbhJ3SbN (ORCPT + 99 others); Sat, 30 Oct 2021 14:31:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:39471 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231532AbhJ3SbG (ORCPT ); Sat, 30 Oct 2021 14:31:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635618515; 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=n3Mgk88GftykavhRfevxmb2OnrvVoUttarFCvaInBLI=; b=JfBsF8em/82hGxg6BGj7zdYnEYD7ZW1/ignvvFSFLeNT8jNykxXHT2LTexBvWc563lCTbR 4R53g6qCG+YENtvvtRNk50e0rcQr0kbpUvBSxxefu88L7TP0dQFDbEQL1BMLTOCw0KWd4C 6zO/f8R0bE7sa6TQK6+a0wSQN/w4hyw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-111-rdJLY_KoMXKy1ItcgdzG4w-1; Sat, 30 Oct 2021 14:28:32 -0400 X-MC-Unique: rdJLY_KoMXKy1ItcgdzG4w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F1D248018AC; Sat, 30 Oct 2021 18:28:29 +0000 (UTC) Received: from x1.localdomain (unknown [10.39.192.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3419C5F4E1; Sat, 30 Oct 2021 18:28:27 +0000 (UTC) From: Hans de Goede To: Mark Gross , Andy Shevchenko , Wolfram Sang , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel Cc: Hans de Goede , Yauhen Kharuzhy , Tsuchiya Yuto , platform-driver-x86@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: [PATCH 04/13] power: supply: bq25890: Fix initial setting of the F_CONV_RATE field Date: Sat, 30 Oct 2021 20:28:04 +0200 Message-Id: <20211030182813.116672-5-hdegoede@redhat.com> In-Reply-To: <20211030182813.116672-1-hdegoede@redhat.com> References: <20211030182813.116672-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The code doing the initial setting of the F_CONV_RATE field based on the bq->state.online flag. In order for this to work properly, this must be done after the initial bq25890_get_chip_state() call. Signed-off-by: Hans de Goede --- drivers/power/supply/bq25890_charger.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index 491d36a3811a..99497fdc73da 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -682,16 +682,16 @@ static int bq25890_hw_init(struct bq25890_device *bq) } } - /* Configure ADC for continuous conversions when charging */ - ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online); + ret = bq25890_get_chip_state(bq, &bq->state); if (ret < 0) { - dev_dbg(bq->dev, "Config ADC failed %d\n", ret); + dev_dbg(bq->dev, "Get state failed %d\n", ret); return ret; } - ret = bq25890_get_chip_state(bq, &bq->state); + /* Configure ADC for continuous conversions when charging */ + ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online); if (ret < 0) { - dev_dbg(bq->dev, "Get state failed %d\n", ret); + dev_dbg(bq->dev, "Config ADC failed %d\n", ret); return ret; } -- 2.31.1