From patchwork Mon Jul 19 14:51:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 480007 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4276703jao; Mon, 19 Jul 2021 09:17:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxz6tFBU6sTDEnuzOG3M2ejc8fwZCrPwXg4ijiJq55y7AIvuF0SQ/wBGJsneQFm1wrSA+O3 X-Received: by 2002:a17:906:39d7:: with SMTP id i23mr27789814eje.121.1626711471230; Mon, 19 Jul 2021 09:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626711471; cv=none; d=google.com; s=arc-20160816; b=wfT1+KpNAjD/M4vE77E2+M2qtIKOXKQjTNTjl7Ejc67VgoEcG3koFh2U2yq/8xJvQL WUagFVEPsvjwIQm3mgTjTKg18dnL0/luqD0+MPcm2h7Gbgr8Bu8sF+4X6QsE29pD77qt hXAnXS7QNQtIIzcFb86Y9mbDNdbqWNUln+8lP7Yj2/mElhed4mEsz0JfQ5qO5x9TItJu icC1j5i53VkH2wTReJ+0919TyEybKKwMzrSqjpMOBwoDWuSIyu5WzhNNDBQvnXHUBQ1q EOsGxx3ioTMKsSux82bra1K81ibEiciiRstuAfrUwRYuUPPk2MljODhvTuumYq+Dk/vt dpUQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0y8kQLAqicJbM9W/F2lvGGqq9O6pQRY0jo33OBsqVfE=; b=mH2Ilu6hV7cefZ+HnVFb6Sv2wGmOihw2DZWRQV0bU86qJFBoHQmFmgkb32QA/0rKEF +TNMxAKS6oslgJhmwN+F0Wy0e8WNCz+29k++hdzXm511MKNebkOuAvV1EpPiTHcs0Jjb Qu7BSRvGfkErolNXrOUvX5GVi2/WkZKxcpOTew7e8amI3+jekjjhRy5Wg5bbhvatRW1z xCg+a39QnTUnUdDedOb1nILRSIbSJKmjOoQAF7MondShWUGXSxBoAfMILshpJAKcQh8s QBLMQL37u3pBgBeJMw6833TXRgTSLEIa5TScL7imWhrtIiStJsjEUVwMsXz6nJdclXMm tXHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GnDyzOPI; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id la14si22045543ejc.142.2021.07.19.09.17.51; Mon, 19 Jul 2021 09:17:51 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b=GnDyzOPI; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237142AbhGSPcy (ORCPT + 12 others); Mon, 19 Jul 2021 11:32:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:43790 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346701AbhGSP2M (ORCPT ); Mon, 19 Jul 2021 11:28:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8F60D61396; Mon, 19 Jul 2021 16:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626710909; bh=HxbYvG5Rj6h4UHhku3DIzRD+CcvctKcna1ezGhDmGWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GnDyzOPI9qGzsY8ZVbXPf6phVfdfq7Zyoq+pZtbl9l968nMulEsHWe/8ngQnUk+sb e49dG9GnDroeWt3EqOR7RGrINHSSbPRhbAzuqMDuXHhrquoZziCIadEn4JSZD7ZErQ Y/iShhy5CiVji94nkgiIMsHtEhPSDT6FLF/oXQug= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.13 154/351] power: supply: ab8500: Enable USB and AC Date: Mon, 19 Jul 2021 16:51:40 +0200 Message-Id: <20210719144950.069165370@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144944.537151528@linuxfoundation.org> References: <20210719144944.537151528@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit f9184a228d7a60ad56b810d549a7debb355f1be6 ] The vendor code tree supplies platform data to enable he USB charging for AB8500 and AB8500 and disable the AC charging on the AB8505. This was missed when the driver was submitted to the mainline kernel. Fix this by doing what the vendor kernel does: always register the USB charger, do not register the AC charger on the AB8505. Signed-off-by: Linus Walleij Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/ab8500-bm.h | 2 -- drivers/power/supply/ab8500_charger.c | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) -- 2.30.2 diff --git a/drivers/power/supply/ab8500-bm.h b/drivers/power/supply/ab8500-bm.h index 012595a9d269..871bdc1f5cbd 100644 --- a/drivers/power/supply/ab8500-bm.h +++ b/drivers/power/supply/ab8500-bm.h @@ -507,8 +507,6 @@ struct abx500_bm_data { int bkup_bat_v; int bkup_bat_i; bool autopower_cfg; - bool ac_enabled; - bool usb_enabled; bool no_maintenance; bool capacity_scaling; bool chg_unknown_bat; diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index 57fbfe3d8c03..e6f23ae05f95 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3511,7 +3511,14 @@ static int ab8500_charger_probe(struct platform_device *pdev) di->ac_chg.max_out_curr = di->bm->chg_output_curr[di->bm->n_chg_out_curr - 1]; di->ac_chg.wdt_refresh = CHG_WD_INTERVAL; - di->ac_chg.enabled = di->bm->ac_enabled; + /* + * The AB8505 only supports USB charging. If we are not the + * AB8505, register an AC charger. + * + * TODO: if this should be opt-in, add DT properties for this. + */ + if (!is_ab8505(di->parent)) + di->ac_chg.enabled = true; di->ac_chg.external = false; /* USB supply */ @@ -3525,7 +3532,6 @@ static int ab8500_charger_probe(struct platform_device *pdev) di->usb_chg.max_out_curr = di->bm->chg_output_curr[di->bm->n_chg_out_curr - 1]; di->usb_chg.wdt_refresh = CHG_WD_INTERVAL; - di->usb_chg.enabled = di->bm->usb_enabled; di->usb_chg.external = false; di->usb_state.usb_current = -1; @@ -3599,14 +3605,12 @@ static int ab8500_charger_probe(struct platform_device *pdev) } /* Register USB charger class */ - if (di->usb_chg.enabled) { - di->usb_chg.psy = devm_power_supply_register(dev, - &ab8500_usb_chg_desc, - &usb_psy_cfg); - if (IS_ERR(di->usb_chg.psy)) { - dev_err(dev, "failed to register USB charger\n"); - return PTR_ERR(di->usb_chg.psy); - } + di->usb_chg.psy = devm_power_supply_register(dev, + &ab8500_usb_chg_desc, + &usb_psy_cfg); + if (IS_ERR(di->usb_chg.psy)) { + dev_err(dev, "failed to register USB charger\n"); + return PTR_ERR(di->usb_chg.psy); } /* Identify the connected charger types during startup */