From patchwork Sat Jan 23 22:19:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 369465 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2688144jam; Sat, 23 Jan 2021 14:21:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgSI2w5kdJr24FWm0780RVyJ5bLwaMEJloRiEr6HDDHE7GXx0uYONCwyoOqBSg0osfAZA/ X-Received: by 2002:aa7:c983:: with SMTP id c3mr892222edt.327.1611440518806; Sat, 23 Jan 2021 14:21:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611440518; cv=none; d=google.com; s=arc-20160816; b=O9T8bpFj3SVmfYwPHljYdlG8q/4aOQYZ2vVZ6+mb9R+bizL6WjvRn7c6llZcGu5kMk 1xNgX6pI5OCANaGiZqEo97efbId1T3n1cuorVEo0oEgZ0SQO0wQt8TIl+b44PEuJQIFS 2DsP8QisGVJl7JTXSL9TtfTOG0HRcr++H8VFx8ENHqTcPeF1jt5BbDkOTGs1xpnzO0R+ /E0tpkIh7XPfT1LTKCWyCVu1csRl57fsyWJrM6hLXWPICXP/9UOGMEQh54OYzPTPCaFg tjjaMTaGd6GVnzsTqL49r+YB8CAKnYRHlVnQHj18t3o3QtEEgPyZoFH0gfH7Dn3pCvgc /5nA== 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=lDw2Zywr4IODkv/lha2OrxYzfa5j2Qq3VpSO78JP/jI=; b=Ak+00vdGzh+2mjezcXAVGC+5y9kr/Cvw6ZH2sOO3tGl2KJoDujPFLkaRQxZmGM1nk0 qkEvx8P/h1SNUwNo6Zdb2jZjmlmlV14cDWq7fJZ1myvQzeUKSckG5miAyHdVbN1DwC5O sHkFgXWR4SGQb38qt49iSEG1CpDkgeE4pOCMCpHmibIdGkOBFIxh6YQyqGTu8tAxd/ax 9G0F9oTkqb9xROwL+Lv9DB3T7PFhHhRUvNjeHgq1CWnbJWuPnzUMvoj3z3CVz5A0DZpx gIvLbw+CyJS4Y5qSOYGxNNhzhYwzr96ZqvT280hYFlloVl2PF8U9wBdN6BU0Tw/tcIoh kb3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wxlZkpLK; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gw11si4392384ejb.414.2021.01.23.14.21.58; Sat, 23 Jan 2021 14:21:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-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=@linaro.org header.s=google header.b=wxlZkpLK; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726344AbhAWWUm (ORCPT + 7 others); Sat, 23 Jan 2021 17:20:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726316AbhAWWUk (ORCPT ); Sat, 23 Jan 2021 17:20:40 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BD3AC0617AA for ; Sat, 23 Jan 2021 14:19:31 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id f19so1862022ljn.5 for ; Sat, 23 Jan 2021 14:19:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lDw2Zywr4IODkv/lha2OrxYzfa5j2Qq3VpSO78JP/jI=; b=wxlZkpLKQypG9keotJoMSErJwz4HsGAkAPy0XhgVe3QNxXFrGVc4XYS5TaJOEAeYQ4 wGqtn+yXkX/hcGLgBjByRtpp1+xe+Ol4OJPn0kNbCfWJJbT4PeoD+EKpej17cpPhiTgL FNKqtWNdKV2LMNcr7RbKVO9YJwg8j+D8+NSCGC9oh9+tb9yf/N5tCPCRGXc18KlDTRYR YEPkoKH8MoN7zB1jJz4oy6QGJeqZGLuy+Flj8RPTAqRagTXrFmyETGRn+h7ANMvpn9Z2 c+ac+pPTxG60TGLafo7Bb3ztG5sLxHYnJxVN//H/cv7VpdDedWOrrQmzASGXYr9YbhET LpUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lDw2Zywr4IODkv/lha2OrxYzfa5j2Qq3VpSO78JP/jI=; b=HU7+8HzMLTv8DqsnB0AhWp4fnAuJJL+WF2BZY2Dsyr6W6wEI5pYUlDfgt2R0JBhPVl tIUVC/hBa6z/oIBAu/4NgWyRNDnfNiujmaLXP3bBqrIEu4GCJcUZUio9yGWaevqHAglV r5SFrOjZWYvVyNVMaW2BamRR0DbFuMG5vpEDblE35UT/4+4Q0UFX7DobqISGIp+I93OW FvQicDBkEXD618Kp5EWqUHBkCZxq0aJ+dLtdaGIy2X2/yD/P9CupC244MMtJc4jQanTg /fFXmfRqj0zaL3HKIH0DNAEQBYPGsto6hhQ6PBqbXVYW5d8HdsuKodR0/BN8+eujNNZQ 2Pig== X-Gm-Message-State: AOAM532fQGKeDuxRRqnE/PtoMRfuNhRj9yTvRxBhi4FI2ZqQWjcYoRnJ L9X2U0S5NydiJNcqnyKjQBFoDMPWsEqogCv/ X-Received: by 2002:a2e:585:: with SMTP id 127mr135724ljf.131.1611440369780; Sat, 23 Jan 2021 14:19:29 -0800 (PST) Received: from localhost.localdomain (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id x17sm1313956lfg.0.2021.01.23.14.19.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 14:19:29 -0800 (PST) From: Linus Walleij To: Sebastian Reichel , Lee Jones , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 08/10] power: supply: ab8500: Enable USB and AC Date: Sat, 23 Jan 2021 23:19:06 +0100 Message-Id: <20210123221908.2993388-9-linus.walleij@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210123221908.2993388-1-linus.walleij@linaro.org> References: <20210123221908.2993388-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 --- drivers/power/supply/ab8500-bm.h | 2 -- drivers/power/supply/ab8500_charger.c | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) -- 2.29.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 158131ed8b80..832e01f56a62 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 */