From patchwork Tue Jul 13 15:27:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 474684 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4073932jao; Tue, 13 Jul 2021 08:29:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzz2IHIO0seegUK2JxNW0vRCxW6OErODnt0sVSO01WUhKLUdb2usshVpX7eHim8zicRGq6N X-Received: by 2002:aa7:cb86:: with SMTP id r6mr6394985edt.181.1626190158528; Tue, 13 Jul 2021 08:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626190158; cv=none; d=google.com; s=arc-20160816; b=JdYt+hoQGx8swDClPgJrKBs8PudSy+IYK/Yaz020zepmExmiuSIJQssO650fJqJ5pJ PEBzM+TQzj4oYvQYNJ0L1T/NCR+UPzjkLZ0n0lzDoqZPXgkKM5Lk4Sn7tfirWQuMF2sM Z2nV4YHGizOVP06/gJ4Dnr8/IyDMlMK+Dzr7rST5ervbxd5UEwdsuQgj7SkI5ARJKsXd Pt7eFa08pbnWuj6Xb2bu+MzwIntEnZkPuZ46JQcsDecf0zpq/7BLq1F4qs2hFRGU77aY V9xk/ci+KK7wywFdH5wPP9oJPcHdmy460mEnqHAOcKAGSgDNlfweIGlev2Ag8egNK0U3 jY0Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=HqnU72MCKRWkDij27ChHkC29ca9CD/06UjhFYrEKl70=; b=QU5LNFJ0+O2cv9PEr1QpkeoSSiePsekpcZzeCoTRav15ZNN04iMz1IrNTeXlYtO4Uu l9p/RjqDKovMVQ3lMUYE5s37lHZy6zyhkXE9fwu9avHZPyJ1EuJmEcOWGTacKuQfHooy rZDeXa1XoOmWIxvV1sTZklE4dnA7WdM08x1VNqbxRSiY0G3TGMb6DArwtZv9ICS7BA9O 4x86brcaUU/UFO5qeOQO91maDBhM6g+K/9Uoc/hmGdsg+qdrlsvO8YMcOsTQLxmB1kgT IR2oViDivA2EQrL1fJbVWvlq1m1KmVqbLL9h7+L5ngId/EC7nm3wOheeistbD2qk3rit QWyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TreSgl8k; 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 g16si21947515edv.472.2021.07.13.08.29.18; Tue, 13 Jul 2021 08:29:18 -0700 (PDT) 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=TreSgl8k; 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 S237082AbhGMPcH (ORCPT + 8 others); Tue, 13 Jul 2021 11:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237077AbhGMPcH (ORCPT ); Tue, 13 Jul 2021 11:32:07 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C484EC0613DD for ; Tue, 13 Jul 2021 08:29:16 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id h19so19678614ljl.4 for ; Tue, 13 Jul 2021 08:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HqnU72MCKRWkDij27ChHkC29ca9CD/06UjhFYrEKl70=; b=TreSgl8kmqxD4VKHIVh6U9S203qK2CpVrcyKRJa8znF1KCiexVpplHTCciqPwq+Igf dOxxtEkeQuufansYNB8MVZciBcN02ZRB1InUD0RXtVitYMaY+hFFYd211egtc/fK9ZI4 4/vbqtvuFfQvt9Kq47KpvHRaEnCfEicrEJNb6V1zVwUGW6R6fWTlCT5rFfQFiZmC2/nA DPRh5aiWZ2i01miOdeOYWfswvpJE0Xo6KiV4XfLJNHar34S9/oV+GZx8Ubh2Vk002/sx RX9uJ1LbA7QzJ1Gn2xPD5CknSqOGsq0ZQ1eWcce6dWGPEyCtpFFDj8H93PH8wDKeXmFG BRQQ== 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:mime-version :content-transfer-encoding; bh=HqnU72MCKRWkDij27ChHkC29ca9CD/06UjhFYrEKl70=; b=LAjww++i34HLQlW6lOd2MmLa9oUiQDOImRRBLvrac/cTHiwk//6DbKY1jqLT42qeMw cvr053QieqFoCxfjbjXbJ/v7dmef0u0JHGjK0M9BwvVQY+lqs5eekms++KG5DQ+VugAx 9rJ2QECPrtQcmllt1JzRg95J4zEKE+bOvcyYYHjOVEDdXo7P0KwVtQAbiSjYt3Rje8rg zPITG69E0Xm8BeBD8bGyiTWEGz1QPiTVpY95fbH9/YCumYfcZEeDW/+P7C23VDsluMl0 lPGe0/gApJpC+qUFjZMGa99Q2MOhhuOvr7xvwgK52IuTGR1S7dY/RGwITSpVKxu3bKyP MpYg== X-Gm-Message-State: AOAM533k9GppXXSulrakmYIVP8F5UHzpW3g/e6+Um5I2xhRyrUqjZgSV CDyb+GDrbtjmm06AE0nWVX5ZlA== X-Received: by 2002:a2e:a78d:: with SMTP id c13mr4773538ljf.12.1626190155119; Tue, 13 Jul 2021 08:29:15 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id d8sm827395ljg.86.2021.07.13.08.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 08:29:14 -0700 (PDT) From: Linus Walleij To: Sebastian Reichel , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 1/5] power: supply: ab8500: Use library interpolation Date: Tue, 13 Jul 2021 17:27:05 +0200 Message-Id: <20210713152709.871833-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The kernel already has a static inline for linear interpolation so use that instead of rolling our own. Signed-off-by: Linus Walleij --- drivers/power/supply/ab8500_btemp.c | 6 ++++-- drivers/power/supply/ab8500_fg.c | 14 +++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) -- 2.31.1 diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index dbdcff32f353..24958b935d39 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "ab8500-bm.h" @@ -437,8 +438,9 @@ static int ab8500_btemp_res_to_temp(struct ab8500_btemp *di, i++; } - return tbl[i].temp + ((tbl[i + 1].temp - tbl[i].temp) * - (res - tbl[i].resist)) / (tbl[i + 1].resist - tbl[i].resist); + return fixp_linear_interpolate(tbl[i].resist, tbl[i].temp, + tbl[i + 1].resist, tbl[i + 1].temp, + res); } /** diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index 3d45ed0157c6..bdbf3f13bee0 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "ab8500-bm.h" @@ -56,9 +57,6 @@ /* FG constants */ #define BATT_OVV 0x01 -#define interpolate(x, x1, y1, x2, y2) \ - ((y1) + ((((y2) - (y1)) * ((x) - (x1))) / ((x2) - (x1)))); - /** * struct ab8500_fg_interrupts - ab8500 fg interrupts * @name: name of the interrupt @@ -868,11 +866,12 @@ static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage) } if ((i > 0) && (i < tbl_size)) { - cap = interpolate(voltage, + cap = fixp_linear_interpolate( tbl[i].voltage, tbl[i].capacity * 10, tbl[i-1].voltage, - tbl[i-1].capacity * 10); + tbl[i-1].capacity * 10, + voltage); } else if (i == 0) { cap = 1000; } else { @@ -920,11 +919,12 @@ static int ab8500_fg_battery_resistance(struct ab8500_fg *di) } if ((i > 0) && (i < tbl_size)) { - resist = interpolate(di->bat_temp / 10, + resist = fixp_linear_interpolate( tbl[i].temp, tbl[i].resist, tbl[i-1].temp, - tbl[i-1].resist); + tbl[i-1].resist, + di->bat_temp / 10); } else if (i == 0) { resist = tbl[0].resist; } else { From patchwork Tue Jul 13 15:27: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: 474685 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4073978jao; Tue, 13 Jul 2021 08:29:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwK2EISltyaWVhsCac1IvoiishNEIopYyhIYvimgNS7WCSBd6aVOi3dhN2Z78UOq6M3rxd X-Received: by 2002:a05:6402:40cf:: with SMTP id z15mr6730555edb.175.1626190162439; Tue, 13 Jul 2021 08:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626190162; cv=none; d=google.com; s=arc-20160816; b=iR2J0K2L62nQ7sWv84+wHcVR/YQpMGV0EtL7XKoUqZfDq5fpAtW4yJ8PiUv23s8Vnr jaoVnxd35zB3J0eILd52kibMVSq6L7mLu+nsAvuxU7zENIM5Zusm4sEX+b9zmWmtCKN+ cg8ZnODJC/k+S/jFX9G5IcMMqo8vxRka1kaHGew+P4ExPnN53K9+Gj2wdooI+8WKKTgi rxLHlN0chVgFyZgK1jhRDfl9P0WsXKEbBZvUhc+esiUEG/ASvF5TtvaBzj9YDd765ckg 7VIYcjKwB4dyXiQzRVI3UChe6MqG94L0kLKQwMoDyIR9ufbmRZNrrdhOIpf0aVHF0eKE 3LYA== 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=jRIkBor+dLf/mXS62PVv67j2O2Wnf6OkbnjKlx3XXVo=; b=BFSW6EQQZ62FlH3t15CFo9MHt4ZRdQxqQzNqA5MIrXUVJYQBsJpG8RMKkbpU5aEh1G WI1tA9iWB2Ueg7ppkb19Yvw0/UYuqm1AcONiosIiObz0loWlH+tCCLCcdSrHro4TJGmn cminuvVym5qQa9aOYXvpdEo9L1mWpptmuITj9f4FghooeO73GVq0Xvd1ukcfh/Xw0g6J RVWH/mjlulpQ4I8jlAWGJC42qXlBCQzNbAyxnCVKx2SqjKsSi0R8ff9RxRvtJjVjpzM1 yZTWm0I3yXIkZHQTYgC+nAppzzOph1LSUzMxp5gatg1F+cY0i16lVONDvHqcatr3cyfr penQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oVPWOqKw; 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 g16si21947515edv.472.2021.07.13.08.29.22; Tue, 13 Jul 2021 08:29:22 -0700 (PDT) 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=oVPWOqKw; 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 S237077AbhGMPcL (ORCPT + 8 others); Tue, 13 Jul 2021 11:32:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237096AbhGMPcK (ORCPT ); Tue, 13 Jul 2021 11:32:10 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19DF8C0613DD for ; Tue, 13 Jul 2021 08:29:20 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id t17so51035550lfq.0 for ; Tue, 13 Jul 2021 08:29:20 -0700 (PDT) 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=jRIkBor+dLf/mXS62PVv67j2O2Wnf6OkbnjKlx3XXVo=; b=oVPWOqKw+Wy9M6QCBRdxdqvcOU1ZDZbNWQGySUk9lsGLZvXYhsa7UIywgupIf5OKIA PP2UPzDVUy96ygQnJMfShjtI122oiH6XS3AMbZY2XNaFJ6re7yCisYQr/cWYT45I8YPg hOUrAbYRgEaoC1devemv8Ep3eMOEw+1+e/tRBIwPpFND3zdLsFQC3KMzFctmCooM+9DV zIo3m2vGwSIgoG2OJgwlioiRYXpMJ9iKYZ6tN009V7XUvkhcDLT1X7RDoyRlQsv4bxA9 mPvUUIedW27UN4Kffc4f/X3gQPt82lx9R73T6kjpa+MgfQoMcNJYLVXrdK4uO8ZdBfzb EtsA== 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=jRIkBor+dLf/mXS62PVv67j2O2Wnf6OkbnjKlx3XXVo=; b=WByqU41dYiYR91iHgJgtdnADhSiBlmxKCbRSSX0nEZqXtbOMC6NUBtWzBVHNA5fztb 067Ir9y99BiahzMU2+PpeOgS6JZiRBJeAAtYwdqaWodpytPC3qjts/tHkYAPueeeNMa/ lx/Y/FNdV66L4ntCBcCYY2m6HIP6a62w+/Yfz329HgQQHbiZxRKZOUpc+8o4eYwIpFp/ PbUi8BCPDIoPaPV55vJvzcoI5OmLFL2oXxlqerjO6hSyIlvnh8oG8TE1rHRdtmyO8N63 4gW8og9KHRZClQyArcbX4wVmgv6sUaoBQheOohN8vqF6c9PNwQ17LvB1qRmOqJrVBA3/ igKA== X-Gm-Message-State: AOAM532L/gqozzk9fK0n+sPUIEpY6weTD8qVecFFQrXM+YgdEOhAX1kd 7fJozKSkVyqZMAJjk/nGfZqf0g== X-Received: by 2002:ac2:5d2f:: with SMTP id i15mr3936072lfb.134.1626190158108; Tue, 13 Jul 2021 08:29:18 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id d8sm827395ljg.86.2021.07.13.08.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 08:29:17 -0700 (PDT) From: Linus Walleij To: Sebastian Reichel , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 2/5] power: supply: ab8500: Rename charging algorithm symbols Date: Tue, 13 Jul 2021 17:27:06 +0200 Message-Id: <20210713152709.871833-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210713152709.871833-1-linus.walleij@linaro.org> References: <20210713152709.871833-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The "abx500" name on the charging algorithm stems from the ambition to produce a series of these analog basebands, re-using the same charging algorithm driver. No ASICs beside AB8500 and AB8505 were ever produced so this terminology is confusing. Rename the algorithm file and symbols to reflect the more narrow scope. Signed-off-by: Linus Walleij --- drivers/power/supply/Makefile | 2 +- drivers/power/supply/ab8500-bm.h | 2 +- .../{abx500_chargalg.c => ab8500_chargalg.c} | 576 +++++++++--------- drivers/power/supply/ab8500_charger.c | 2 +- 4 files changed, 291 insertions(+), 291 deletions(-) rename drivers/power/supply/{abx500_chargalg.c => ab8500_chargalg.c} (75%) -- 2.31.1 diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile index 33059a91f60c..dde138bc1591 100644 --- a/drivers/power/supply/Makefile +++ b/drivers/power/supply/Makefile @@ -60,7 +60,7 @@ obj-$(CONFIG_BATTERY_TWL4030_MADC) += twl4030_madc_battery.o obj-$(CONFIG_CHARGER_88PM860X) += 88pm860x_charger.o obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o obj-$(CONFIG_BATTERY_RX51) += rx51_battery.o -obj-$(CONFIG_AB8500_BM) += ab8500_bmdata.o ab8500_charger.o ab8500_fg.o ab8500_btemp.o abx500_chargalg.o +obj-$(CONFIG_AB8500_BM) += ab8500_bmdata.o ab8500_charger.o ab8500_fg.o ab8500_btemp.o ab8500_chargalg.o obj-$(CONFIG_CHARGER_CPCAP) += cpcap-charger.o obj-$(CONFIG_CHARGER_ISP1704) += isp1704_charger.o obj-$(CONFIG_CHARGER_MAX8903) += max8903_charger.o diff --git a/drivers/power/supply/ab8500-bm.h b/drivers/power/supply/ab8500-bm.h index 0c940571e5b0..4e417fbae60c 100644 --- a/drivers/power/supply/ab8500-bm.h +++ b/drivers/power/supply/ab8500-bm.h @@ -729,6 +729,6 @@ int ab8500_bm_of_probe(struct device *dev, extern struct platform_driver ab8500_fg_driver; extern struct platform_driver ab8500_btemp_driver; -extern struct platform_driver abx500_chargalg_driver; +extern struct platform_driver ab8500_chargalg_driver; #endif /* _AB8500_CHARGER_H_ */ diff --git a/drivers/power/supply/abx500_chargalg.c b/drivers/power/supply/ab8500_chargalg.c similarity index 75% rename from drivers/power/supply/abx500_chargalg.c rename to drivers/power/supply/ab8500_chargalg.c index a17849bfacbf..b0bbb1c4b83a 100644 --- a/drivers/power/supply/abx500_chargalg.c +++ b/drivers/power/supply/ab8500_chargalg.c @@ -3,7 +3,7 @@ * Copyright (C) ST-Ericsson SA 2012 * Copyright (c) 2012 Sony Mobile Communications AB * - * Charging algorithm driver for abx500 variants + * Charging algorithm driver for AB8500 * * Authors: * Johan Palsson @@ -49,18 +49,18 @@ #define CHARGALG_CURR_STEP_LOW 0 #define CHARGALG_CURR_STEP_HIGH 100 -enum abx500_chargers { +enum ab8500_chargers { NO_CHG, AC_CHG, USB_CHG, }; -struct abx500_chargalg_charger_info { - enum abx500_chargers conn_chg; - enum abx500_chargers prev_conn_chg; - enum abx500_chargers online_chg; - enum abx500_chargers prev_online_chg; - enum abx500_chargers charger_type; +struct ab8500_chargalg_charger_info { + enum ab8500_chargers conn_chg; + enum ab8500_chargers prev_conn_chg; + enum ab8500_chargers online_chg; + enum ab8500_chargers prev_online_chg; + enum ab8500_chargers charger_type; bool usb_chg_ok; bool ac_chg_ok; int usb_volt; @@ -73,18 +73,18 @@ struct abx500_chargalg_charger_info { int ac_iset; }; -struct abx500_chargalg_suspension_status { +struct ab8500_chargalg_suspension_status { bool suspended_change; bool ac_suspended; bool usb_suspended; }; -struct abx500_chargalg_current_step_status { +struct ab8500_chargalg_current_step_status { bool curr_step_change; int curr_step; }; -struct abx500_chargalg_battery_data { +struct ab8500_chargalg_battery_data { int temp; int volt; int avg_curr; @@ -92,7 +92,7 @@ struct abx500_chargalg_battery_data { int percent; }; -enum abx500_chargalg_states { +enum ab8500_chargalg_states { STATE_HANDHELD_INIT, STATE_HANDHELD, STATE_CHG_NOT_OK_INIT, @@ -154,7 +154,7 @@ static const char *states[] = { "WD_EXPIRED", }; -struct abx500_chargalg_events { +struct ab8500_chargalg_events { bool batt_unknown; bool mainextchnotok; bool batt_ovv; @@ -176,7 +176,7 @@ struct abx500_chargalg_events { }; /** - * struct abx500_charge_curr_maximization - Charger maximization parameters + * struct ab8500_charge_curr_maximization - Charger maximization parameters * @original_iset: the non optimized/maximised charger current * @current_iset: the charging current used at this moment * @test_delta_i: the delta between the current we want to charge and the @@ -190,7 +190,7 @@ struct abx500_chargalg_events { * @level: tells in how many steps the charging current has been increased */ -struct abx500_charge_curr_maximization { +struct ab8500_charge_curr_maximization { int original_iset; int current_iset; int test_delta_i; @@ -207,7 +207,7 @@ enum maxim_ret { }; /** - * struct abx500_chargalg - abx500 Charging algorithm device information + * struct ab8500_chargalg - ab8500 Charging algorithm device information * @dev: pointer to the structure device * @charge_status: battery operating status * @eoc_cnt: counter used to determine end-of_charge @@ -223,7 +223,7 @@ enum maxim_ret { * @susp_status: current charger suspension status * @bm: Platform specific battery management information * @curr_status: Current step status for over-current protection - * @parent: pointer to the struct abx500 + * @parent: pointer to the struct ab8500 * @chargalg_psy: structure that holds the battery properties exposed by * the charging algorithm * @events: structure for information about events triggered @@ -235,25 +235,25 @@ enum maxim_ret { * @maintenance_timer: maintenance charging timer * @chargalg_kobject: structure of type kobject */ -struct abx500_chargalg { +struct ab8500_chargalg { struct device *dev; int charge_status; int eoc_cnt; bool maintenance_chg; int t_hyst_norm; int t_hyst_lowhigh; - enum abx500_chargalg_states charge_state; - struct abx500_charge_curr_maximization ccm; - struct abx500_chargalg_charger_info chg_info; - struct abx500_chargalg_battery_data batt_data; - struct abx500_chargalg_suspension_status susp_status; + enum ab8500_chargalg_states charge_state; + struct ab8500_charge_curr_maximization ccm; + struct ab8500_chargalg_charger_info chg_info; + struct ab8500_chargalg_battery_data batt_data; + struct ab8500_chargalg_suspension_status susp_status; struct ab8500 *parent; - struct abx500_chargalg_current_step_status curr_status; + struct ab8500_chargalg_current_step_status curr_status; struct abx500_bm_data *bm; struct power_supply *chargalg_psy; struct ux500_charger *ac_chg; struct ux500_charger *usb_chg; - struct abx500_chargalg_events events; + struct ab8500_chargalg_events events; struct workqueue_struct *chargalg_wq; struct delayed_work chargalg_periodic_work; struct delayed_work chargalg_wd_work; @@ -267,28 +267,28 @@ struct abx500_chargalg { BLOCKING_NOTIFIER_HEAD(charger_notifier_list); /* Main battery properties */ -static enum power_supply_property abx500_chargalg_props[] = { +static enum power_supply_property ab8500_chargalg_props[] = { POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_HEALTH, }; -struct abx500_chargalg_sysfs_entry { +struct ab8500_chargalg_sysfs_entry { struct attribute attr; - ssize_t (*show)(struct abx500_chargalg *, char *); - ssize_t (*store)(struct abx500_chargalg *, const char *, size_t); + ssize_t (*show)(struct ab8500_chargalg *, char *); + ssize_t (*store)(struct ab8500_chargalg *, const char *, size_t); }; /** - * abx500_chargalg_safety_timer_expired() - Expiration of the safety timer + * ab8500_chargalg_safety_timer_expired() - Expiration of the safety timer * @timer: pointer to the hrtimer structure * * This function gets called when the safety timer for the charger * expires */ static enum hrtimer_restart -abx500_chargalg_safety_timer_expired(struct hrtimer *timer) +ab8500_chargalg_safety_timer_expired(struct hrtimer *timer) { - struct abx500_chargalg *di = container_of(timer, struct abx500_chargalg, + struct ab8500_chargalg *di = container_of(timer, struct ab8500_chargalg, safety_timer); dev_err(di->dev, "Safety timer expired\n"); di->events.safety_timer_expired = true; @@ -300,7 +300,7 @@ abx500_chargalg_safety_timer_expired(struct hrtimer *timer) } /** - * abx500_chargalg_maintenance_timer_expired() - Expiration of + * ab8500_chargalg_maintenance_timer_expired() - Expiration of * the maintenance timer * @timer: pointer to the timer structure * @@ -308,10 +308,10 @@ abx500_chargalg_safety_timer_expired(struct hrtimer *timer) * expires */ static enum hrtimer_restart -abx500_chargalg_maintenance_timer_expired(struct hrtimer *timer) +ab8500_chargalg_maintenance_timer_expired(struct hrtimer *timer) { - struct abx500_chargalg *di = container_of(timer, struct abx500_chargalg, + struct ab8500_chargalg *di = container_of(timer, struct ab8500_chargalg, maintenance_timer); dev_dbg(di->dev, "Maintenance timer expired\n"); @@ -324,13 +324,13 @@ abx500_chargalg_maintenance_timer_expired(struct hrtimer *timer) } /** - * abx500_chargalg_state_to() - Change charge state - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_state_to() - Change charge state + * @di: pointer to the ab8500_chargalg structure * * This function gets called when a charge state change should occur */ -static void abx500_chargalg_state_to(struct abx500_chargalg *di, - enum abx500_chargalg_states state) +static void ab8500_chargalg_state_to(struct ab8500_chargalg *di, + enum ab8500_chargalg_states state) { dev_dbg(di->dev, "State changed: %s (From state: [%d] %s =to=> [%d] %s )\n", @@ -343,7 +343,7 @@ static void abx500_chargalg_state_to(struct abx500_chargalg *di, di->charge_state = state; } -static int abx500_chargalg_check_charger_enable(struct abx500_chargalg *di) +static int ab8500_chargalg_check_charger_enable(struct ab8500_chargalg *di) { switch (di->charge_state) { case STATE_NORMAL: @@ -368,13 +368,13 @@ static int abx500_chargalg_check_charger_enable(struct abx500_chargalg *di) } /** - * abx500_chargalg_check_charger_connection() - Check charger connection change - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_check_charger_connection() - Check charger connection change + * @di: pointer to the ab8500_chargalg structure * * This function will check if there is a change in the charger connection * and change charge state accordingly. AC has precedence over USB. */ -static int abx500_chargalg_check_charger_connection(struct abx500_chargalg *di) +static int ab8500_chargalg_check_charger_connection(struct ab8500_chargalg *di) { if (di->chg_info.conn_chg != di->chg_info.prev_conn_chg || di->susp_status.suspended_change) { @@ -387,23 +387,23 @@ static int abx500_chargalg_check_charger_connection(struct abx500_chargalg *di) dev_dbg(di->dev, "Charging source is AC\n"); if (di->chg_info.charger_type != AC_CHG) { di->chg_info.charger_type = AC_CHG; - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); } } else if ((di->chg_info.conn_chg & USB_CHG) && !di->susp_status.usb_suspended) { dev_dbg(di->dev, "Charging source is USB\n"); di->chg_info.charger_type = USB_CHG; - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); } else if (di->chg_info.conn_chg && (di->susp_status.ac_suspended || di->susp_status.usb_suspended)) { dev_dbg(di->dev, "Charging is suspended\n"); di->chg_info.charger_type = NO_CHG; - abx500_chargalg_state_to(di, STATE_SUSPENDED_INIT); + ab8500_chargalg_state_to(di, STATE_SUSPENDED_INIT); } else { dev_dbg(di->dev, "Charging source is OFF\n"); di->chg_info.charger_type = NO_CHG; - abx500_chargalg_state_to(di, STATE_HANDHELD_INIT); + ab8500_chargalg_state_to(di, STATE_HANDHELD_INIT); } di->chg_info.prev_conn_chg = di->chg_info.conn_chg; di->susp_status.suspended_change = false; @@ -412,29 +412,29 @@ static int abx500_chargalg_check_charger_connection(struct abx500_chargalg *di) } /** - * abx500_chargalg_check_current_step_status() - Check charging current + * ab8500_chargalg_check_current_step_status() - Check charging current * step status. - * @di: pointer to the abx500_chargalg structure + * @di: pointer to the ab8500_chargalg structure * * This function will check if there is a change in the charging current step * and change charge state accordingly. */ -static void abx500_chargalg_check_current_step_status - (struct abx500_chargalg *di) +static void ab8500_chargalg_check_current_step_status + (struct ab8500_chargalg *di) { if (di->curr_status.curr_step_change) - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); di->curr_status.curr_step_change = false; } /** - * abx500_chargalg_start_safety_timer() - Start charging safety timer - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_start_safety_timer() - Start charging safety timer + * @di: pointer to the ab8500_chargalg structure * * The safety timer is used to avoid overcharging of old or bad batteries. * There are different timers for AC and USB */ -static void abx500_chargalg_start_safety_timer(struct abx500_chargalg *di) +static void ab8500_chargalg_start_safety_timer(struct ab8500_chargalg *di) { /* Charger-dependent expiration time in hours*/ int timer_expiration = 0; @@ -461,27 +461,27 @@ static void abx500_chargalg_start_safety_timer(struct abx500_chargalg *di) } /** - * abx500_chargalg_stop_safety_timer() - Stop charging safety timer - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_stop_safety_timer() - Stop charging safety timer + * @di: pointer to the ab8500_chargalg structure * * The safety timer is stopped whenever the NORMAL state is exited */ -static void abx500_chargalg_stop_safety_timer(struct abx500_chargalg *di) +static void ab8500_chargalg_stop_safety_timer(struct ab8500_chargalg *di) { if (hrtimer_try_to_cancel(&di->safety_timer) >= 0) di->events.safety_timer_expired = false; } /** - * abx500_chargalg_start_maintenance_timer() - Start charging maintenance timer - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_start_maintenance_timer() - Start charging maintenance timer + * @di: pointer to the ab8500_chargalg structure * @duration: duration of ther maintenance timer in hours * * The maintenance timer is used to maintain the charge in the battery once * the battery is considered full. These timers are chosen to match the * discharge curve of the battery */ -static void abx500_chargalg_start_maintenance_timer(struct abx500_chargalg *di, +static void ab8500_chargalg_start_maintenance_timer(struct ab8500_chargalg *di, int duration) { hrtimer_set_expires_range(&di->maintenance_timer, @@ -492,26 +492,26 @@ static void abx500_chargalg_start_maintenance_timer(struct abx500_chargalg *di, } /** - * abx500_chargalg_stop_maintenance_timer() - Stop maintenance timer - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_stop_maintenance_timer() - Stop maintenance timer + * @di: pointer to the ab8500_chargalg structure * * The maintenance timer is stopped whenever maintenance ends or when another * state is entered */ -static void abx500_chargalg_stop_maintenance_timer(struct abx500_chargalg *di) +static void ab8500_chargalg_stop_maintenance_timer(struct ab8500_chargalg *di) { if (hrtimer_try_to_cancel(&di->maintenance_timer) >= 0) di->events.maintenance_timer_expired = false; } /** - * abx500_chargalg_kick_watchdog() - Kick charger watchdog - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_kick_watchdog() - Kick charger watchdog + * @di: pointer to the ab8500_chargalg structure * * The charger watchdog have to be kicked periodically whenever the charger is * on, else the ABB will reset the system */ -static int abx500_chargalg_kick_watchdog(struct abx500_chargalg *di) +static int ab8500_chargalg_kick_watchdog(struct ab8500_chargalg *di) { /* Check if charger exists and kick watchdog if charging */ if (di->ac_chg && di->ac_chg->ops.kick_wd && @@ -535,8 +535,8 @@ static int abx500_chargalg_kick_watchdog(struct abx500_chargalg *di) } /** - * abx500_chargalg_ac_en() - Turn on/off the AC charger - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_ac_en() - Turn on/off the AC charger + * @di: pointer to the ab8500_chargalg structure * @enable: charger on/off * @vset: requested charger output voltage * @iset: requested charger output current @@ -544,10 +544,10 @@ static int abx500_chargalg_kick_watchdog(struct abx500_chargalg *di) * The AC charger will be turned on/off with the requested charge voltage and * current */ -static int abx500_chargalg_ac_en(struct abx500_chargalg *di, int enable, +static int ab8500_chargalg_ac_en(struct ab8500_chargalg *di, int enable, int vset, int iset) { - static int abx500_chargalg_ex_ac_enable_toggle; + static int ab8500_chargalg_ex_ac_enable_toggle; if (!di->ac_chg || !di->ac_chg->ops.enable) return -ENXIO; @@ -563,18 +563,18 @@ static int abx500_chargalg_ac_en(struct abx500_chargalg *di, int enable, /* Enable external charger */ if (enable && di->ac_chg->external && - !abx500_chargalg_ex_ac_enable_toggle) { + !ab8500_chargalg_ex_ac_enable_toggle) { blocking_notifier_call_chain(&charger_notifier_list, 0, di->dev); - abx500_chargalg_ex_ac_enable_toggle++; + ab8500_chargalg_ex_ac_enable_toggle++; } return di->ac_chg->ops.enable(di->ac_chg, enable, vset, iset); } /** - * abx500_chargalg_usb_en() - Turn on/off the USB charger - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_usb_en() - Turn on/off the USB charger + * @di: pointer to the ab8500_chargalg structure * @enable: charger on/off * @vset: requested charger output voltage * @iset: requested charger output current @@ -582,7 +582,7 @@ static int abx500_chargalg_ac_en(struct abx500_chargalg *di, int enable, * The USB charger will be turned on/off with the requested charge voltage and * current */ -static int abx500_chargalg_usb_en(struct abx500_chargalg *di, int enable, +static int ab8500_chargalg_usb_en(struct ab8500_chargalg *di, int enable, int vset, int iset) { if (!di->usb_chg || !di->usb_chg->ops.enable) @@ -601,14 +601,14 @@ static int abx500_chargalg_usb_en(struct abx500_chargalg *di, int enable, } /** - * abx500_chargalg_update_chg_curr() - Update charger current - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_update_chg_curr() - Update charger current + * @di: pointer to the ab8500_chargalg structure * @iset: requested charger output current * * The charger output current will be updated for the charger * that is currently in use */ -static int abx500_chargalg_update_chg_curr(struct abx500_chargalg *di, +static int ab8500_chargalg_update_chg_curr(struct ab8500_chargalg *di, int iset) { /* Check if charger exists and update current if charging */ @@ -642,19 +642,19 @@ static int abx500_chargalg_update_chg_curr(struct abx500_chargalg *di, } /** - * abx500_chargalg_stop_charging() - Stop charging - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_stop_charging() - Stop charging + * @di: pointer to the ab8500_chargalg structure * * This function is called from any state where charging should be stopped. * All charging is disabled and all status parameters and timers are changed * accordingly */ -static void abx500_chargalg_stop_charging(struct abx500_chargalg *di) +static void ab8500_chargalg_stop_charging(struct ab8500_chargalg *di) { - abx500_chargalg_ac_en(di, false, 0, 0); - abx500_chargalg_usb_en(di, false, 0, 0); - abx500_chargalg_stop_safety_timer(di); - abx500_chargalg_stop_maintenance_timer(di); + ab8500_chargalg_ac_en(di, false, 0, 0); + ab8500_chargalg_usb_en(di, false, 0, 0); + ab8500_chargalg_stop_safety_timer(di); + ab8500_chargalg_stop_maintenance_timer(di); di->charge_status = POWER_SUPPLY_STATUS_NOT_CHARGING; di->maintenance_chg = false; cancel_delayed_work(&di->chargalg_wd_work); @@ -662,19 +662,19 @@ static void abx500_chargalg_stop_charging(struct abx500_chargalg *di) } /** - * abx500_chargalg_hold_charging() - Pauses charging - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_hold_charging() - Pauses charging + * @di: pointer to the ab8500_chargalg structure * * This function is called in the case where maintenance charging has been * disabled and instead a battery voltage mode is entered to check when the * battery voltage has reached a certain recharge voltage */ -static void abx500_chargalg_hold_charging(struct abx500_chargalg *di) +static void ab8500_chargalg_hold_charging(struct ab8500_chargalg *di) { - abx500_chargalg_ac_en(di, false, 0, 0); - abx500_chargalg_usb_en(di, false, 0, 0); - abx500_chargalg_stop_safety_timer(di); - abx500_chargalg_stop_maintenance_timer(di); + ab8500_chargalg_ac_en(di, false, 0, 0); + ab8500_chargalg_usb_en(di, false, 0, 0); + ab8500_chargalg_stop_safety_timer(di); + ab8500_chargalg_stop_maintenance_timer(di); di->charge_status = POWER_SUPPLY_STATUS_CHARGING; di->maintenance_chg = false; cancel_delayed_work(&di->chargalg_wd_work); @@ -682,30 +682,30 @@ static void abx500_chargalg_hold_charging(struct abx500_chargalg *di) } /** - * abx500_chargalg_start_charging() - Start the charger - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_start_charging() - Start the charger + * @di: pointer to the ab8500_chargalg structure * @vset: requested charger output voltage * @iset: requested charger output current * * A charger will be enabled depending on the requested charger type that was * detected previously. */ -static void abx500_chargalg_start_charging(struct abx500_chargalg *di, +static void ab8500_chargalg_start_charging(struct ab8500_chargalg *di, int vset, int iset) { switch (di->chg_info.charger_type) { case AC_CHG: dev_dbg(di->dev, "AC parameters: Vset %d, Ich %d\n", vset, iset); - abx500_chargalg_usb_en(di, false, 0, 0); - abx500_chargalg_ac_en(di, true, vset, iset); + ab8500_chargalg_usb_en(di, false, 0, 0); + ab8500_chargalg_ac_en(di, true, vset, iset); break; case USB_CHG: dev_dbg(di->dev, "USB parameters: Vset %d, Ich %d\n", vset, iset); - abx500_chargalg_ac_en(di, false, 0, 0); - abx500_chargalg_usb_en(di, true, vset, iset); + ab8500_chargalg_ac_en(di, false, 0, 0); + ab8500_chargalg_usb_en(di, true, vset, iset); break; default: @@ -715,13 +715,13 @@ static void abx500_chargalg_start_charging(struct abx500_chargalg *di, } /** - * abx500_chargalg_check_temp() - Check battery temperature ranges - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_check_temp() - Check battery temperature ranges + * @di: pointer to the ab8500_chargalg structure * * The battery temperature is checked against the predefined limits and the * charge state is changed accordingly */ -static void abx500_chargalg_check_temp(struct abx500_chargalg *di) +static void ab8500_chargalg_check_temp(struct ab8500_chargalg *di) { if (di->batt_data.temp > (di->bm->temp_low + di->t_hyst_norm) && di->batt_data.temp < (di->bm->temp_high - di->t_hyst_norm)) { @@ -760,12 +760,12 @@ static void abx500_chargalg_check_temp(struct abx500_chargalg *di) } /** - * abx500_chargalg_check_charger_voltage() - Check charger voltage - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_check_charger_voltage() - Check charger voltage + * @di: pointer to the ab8500_chargalg structure * * Charger voltage is checked against maximum limit */ -static void abx500_chargalg_check_charger_voltage(struct abx500_chargalg *di) +static void ab8500_chargalg_check_charger_voltage(struct ab8500_chargalg *di) { if (di->chg_info.usb_volt > di->bm->chg_params->usb_volt_max) di->chg_info.usb_chg_ok = false; @@ -780,14 +780,14 @@ static void abx500_chargalg_check_charger_voltage(struct abx500_chargalg *di) } /** - * abx500_chargalg_end_of_charge() - Check if end-of-charge criteria is fulfilled - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_end_of_charge() - Check if end-of-charge criteria is fulfilled + * @di: pointer to the ab8500_chargalg structure * * End-of-charge criteria is fulfilled when the battery voltage is above a * certain limit and the battery current is below a certain limit for a * predefined number of consecutive seconds. If true, the battery is full */ -static void abx500_chargalg_end_of_charge(struct abx500_chargalg *di) +static void ab8500_chargalg_end_of_charge(struct ab8500_chargalg *di) { if (di->charge_status == POWER_SUPPLY_STATUS_CHARGING && di->charge_state == STATE_NORMAL && @@ -815,7 +815,7 @@ static void abx500_chargalg_end_of_charge(struct abx500_chargalg *di) } } -static void init_maxim_chg_curr(struct abx500_chargalg *di) +static void init_maxim_chg_curr(struct ab8500_chargalg *di) { di->ccm.original_iset = di->bm->bat_type[di->bm->batt_id].normal_cur_lvl; @@ -828,15 +828,15 @@ static void init_maxim_chg_curr(struct abx500_chargalg *di) } /** - * abx500_chargalg_chg_curr_maxim - increases the charger current to + * ab8500_chargalg_chg_curr_maxim - increases the charger current to * compensate for the system load - * @di pointer to the abx500_chargalg structure + * @di pointer to the ab8500_chargalg structure * * This maximization function is used to raise the charger current to get the * battery current as close to the optimal value as possible. The battery * current during charging is affected by the system load */ -static enum maxim_ret abx500_chargalg_chg_curr_maxim(struct abx500_chargalg *di) +static enum maxim_ret ab8500_chargalg_chg_curr_maxim(struct ab8500_chargalg *di) { int delta_i; @@ -908,21 +908,21 @@ static enum maxim_ret abx500_chargalg_chg_curr_maxim(struct abx500_chargalg *di) } } -static void handle_maxim_chg_curr(struct abx500_chargalg *di) +static void handle_maxim_chg_curr(struct ab8500_chargalg *di) { enum maxim_ret ret; int result; - ret = abx500_chargalg_chg_curr_maxim(di); + ret = ab8500_chargalg_chg_curr_maxim(di); switch (ret) { case MAXIM_RET_CHANGE: - result = abx500_chargalg_update_chg_curr(di, + result = ab8500_chargalg_update_chg_curr(di, di->ccm.current_iset); if (result) dev_err(di->dev, "failed to set chg curr\n"); break; case MAXIM_RET_IBAT_TOO_HIGH: - result = abx500_chargalg_update_chg_curr(di, + result = ab8500_chargalg_update_chg_curr(di, di->bm->bat_type[di->bm->batt_id].normal_cur_lvl); if (result) dev_err(di->dev, "failed to set chg curr\n"); @@ -935,12 +935,12 @@ static void handle_maxim_chg_curr(struct abx500_chargalg *di) } } -static int abx500_chargalg_get_ext_psy_data(struct device *dev, void *data) +static int ab8500_chargalg_get_ext_psy_data(struct device *dev, void *data) { struct power_supply *psy; struct power_supply *ext = dev_get_drvdata(dev); const char **supplicants = (const char **)ext->supplied_to; - struct abx500_chargalg *di; + struct ab8500_chargalg *di; union power_supply_propval ret; int j; bool capacity_updated = false; @@ -1259,7 +1259,7 @@ static int abx500_chargalg_get_ext_psy_data(struct device *dev, void *data) } /** - * abx500_chargalg_external_power_changed() - callback for power supply changes + * ab8500_chargalg_external_power_changed() - callback for power supply changes * @psy: pointer to the structure power_supply * * This function is the entry point of the pointer external_power_changed @@ -1267,9 +1267,9 @@ static int abx500_chargalg_get_ext_psy_data(struct device *dev, void *data) * This function gets executed when there is a change in any external power * supply that this driver needs to be notified of. */ -static void abx500_chargalg_external_power_changed(struct power_supply *psy) +static void ab8500_chargalg_external_power_changed(struct power_supply *psy) { - struct abx500_chargalg *di = power_supply_get_drvdata(psy); + struct ab8500_chargalg *di = power_supply_get_drvdata(psy); /* * Trigger execution of the algorithm instantly and read @@ -1279,14 +1279,14 @@ static void abx500_chargalg_external_power_changed(struct power_supply *psy) } /** - * abx500_chargalg_algorithm() - Main function for the algorithm - * @di: pointer to the abx500_chargalg structure + * ab8500_chargalg_algorithm() - Main function for the algorithm + * @di: pointer to the ab8500_chargalg structure * * This is the main control function for the charging algorithm. * It is called periodically or when something happens that will * trigger a state change */ -static void abx500_chargalg_algorithm(struct abx500_chargalg *di) +static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di) { int charger_status; int ret; @@ -1294,17 +1294,17 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) /* Collect data from all power_supply class devices */ class_for_each_device(power_supply_class, NULL, - di->chargalg_psy, abx500_chargalg_get_ext_psy_data); + di->chargalg_psy, ab8500_chargalg_get_ext_psy_data); - abx500_chargalg_end_of_charge(di); - abx500_chargalg_check_temp(di); - abx500_chargalg_check_charger_voltage(di); + ab8500_chargalg_end_of_charge(di); + ab8500_chargalg_check_temp(di); + ab8500_chargalg_check_charger_voltage(di); - charger_status = abx500_chargalg_check_charger_connection(di); - abx500_chargalg_check_current_step_status(di); + charger_status = ab8500_chargalg_check_charger_connection(di); + ab8500_chargalg_check_current_step_status(di); if (is_ab8500(di->parent)) { - ret = abx500_chargalg_check_charger_enable(di); + ret = ab8500_chargalg_check_charger_enable(di); if (ret < 0) dev_err(di->dev, "Checking charger is enabled error" ": Returned Value %d\n", ret); @@ -1319,7 +1319,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) (di->events.batt_unknown && !di->bm->chg_unknown_bat)) { if (di->charge_state != STATE_HANDHELD) { di->events.safety_timer_expired = false; - abx500_chargalg_state_to(di, STATE_HANDHELD_INIT); + ab8500_chargalg_state_to(di, STATE_HANDHELD_INIT); } } @@ -1332,7 +1332,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) /* Safety timer expiration */ else if (di->events.safety_timer_expired) { if (di->charge_state != STATE_SAFETY_TIMER_EXPIRED) - abx500_chargalg_state_to(di, + ab8500_chargalg_state_to(di, STATE_SAFETY_TIMER_EXPIRED_INIT); } /* @@ -1343,7 +1343,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) /* Battery removed */ else if (di->events.batt_rem) { if (di->charge_state != STATE_BATT_REMOVED) - abx500_chargalg_state_to(di, STATE_BATT_REMOVED_INIT); + ab8500_chargalg_state_to(di, STATE_BATT_REMOVED_INIT); } /* Main or USB charger not ok. */ else if (di->events.mainextchnotok || di->events.usbchargernotok) { @@ -1353,7 +1353,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) */ if (di->charge_state != STATE_CHG_NOT_OK && !di->events.vbus_collapsed) - abx500_chargalg_state_to(di, STATE_CHG_NOT_OK_INIT); + ab8500_chargalg_state_to(di, STATE_CHG_NOT_OK_INIT); } /* VBUS, Main or VBAT OVV. */ else if (di->events.vbus_ovv || @@ -1362,31 +1362,31 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) !di->chg_info.usb_chg_ok || !di->chg_info.ac_chg_ok) { if (di->charge_state != STATE_OVV_PROTECT) - abx500_chargalg_state_to(di, STATE_OVV_PROTECT_INIT); + ab8500_chargalg_state_to(di, STATE_OVV_PROTECT_INIT); } /* USB Thermal, stop charging */ else if (di->events.main_thermal_prot || di->events.usb_thermal_prot) { if (di->charge_state != STATE_HW_TEMP_PROTECT) - abx500_chargalg_state_to(di, + ab8500_chargalg_state_to(di, STATE_HW_TEMP_PROTECT_INIT); } /* Battery temp over/under */ else if (di->events.btemp_underover) { if (di->charge_state != STATE_TEMP_UNDEROVER) - abx500_chargalg_state_to(di, + ab8500_chargalg_state_to(di, STATE_TEMP_UNDEROVER_INIT); } /* Watchdog expired */ else if (di->events.ac_wd_expired || di->events.usb_wd_expired) { if (di->charge_state != STATE_WD_EXPIRED) - abx500_chargalg_state_to(di, STATE_WD_EXPIRED_INIT); + ab8500_chargalg_state_to(di, STATE_WD_EXPIRED_INIT); } /* Battery temp high/low */ else if (di->events.btemp_lowhigh) { if (di->charge_state != STATE_TEMP_LOWHIGH) - abx500_chargalg_state_to(di, STATE_TEMP_LOWHIGH_INIT); + ab8500_chargalg_state_to(di, STATE_TEMP_LOWHIGH_INIT); } dev_dbg(di->dev, @@ -1418,9 +1418,9 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) switch (di->charge_state) { case STATE_HANDHELD_INIT: - abx500_chargalg_stop_charging(di); + ab8500_chargalg_stop_charging(di); di->charge_status = POWER_SUPPLY_STATUS_DISCHARGING; - abx500_chargalg_state_to(di, STATE_HANDHELD); + ab8500_chargalg_state_to(di, STATE_HANDHELD); fallthrough; case STATE_HANDHELD: @@ -1428,14 +1428,14 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) case STATE_SUSPENDED_INIT: if (di->susp_status.ac_suspended) - abx500_chargalg_ac_en(di, false, 0, 0); + ab8500_chargalg_ac_en(di, false, 0, 0); if (di->susp_status.usb_suspended) - abx500_chargalg_usb_en(di, false, 0, 0); - abx500_chargalg_stop_safety_timer(di); - abx500_chargalg_stop_maintenance_timer(di); + ab8500_chargalg_usb_en(di, false, 0, 0); + ab8500_chargalg_stop_safety_timer(di); + ab8500_chargalg_stop_maintenance_timer(di); di->charge_status = POWER_SUPPLY_STATUS_NOT_CHARGING; di->maintenance_chg = false; - abx500_chargalg_state_to(di, STATE_SUSPENDED); + ab8500_chargalg_state_to(di, STATE_SUSPENDED); power_supply_changed(di->chargalg_psy); fallthrough; @@ -1444,29 +1444,29 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) break; case STATE_BATT_REMOVED_INIT: - abx500_chargalg_stop_charging(di); - abx500_chargalg_state_to(di, STATE_BATT_REMOVED); + ab8500_chargalg_stop_charging(di); + ab8500_chargalg_state_to(di, STATE_BATT_REMOVED); fallthrough; case STATE_BATT_REMOVED: if (!di->events.batt_rem) - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); break; case STATE_HW_TEMP_PROTECT_INIT: - abx500_chargalg_stop_charging(di); - abx500_chargalg_state_to(di, STATE_HW_TEMP_PROTECT); + ab8500_chargalg_stop_charging(di); + ab8500_chargalg_state_to(di, STATE_HW_TEMP_PROTECT); fallthrough; case STATE_HW_TEMP_PROTECT: if (!di->events.main_thermal_prot && !di->events.usb_thermal_prot) - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); break; case STATE_OVV_PROTECT_INIT: - abx500_chargalg_stop_charging(di); - abx500_chargalg_state_to(di, STATE_OVV_PROTECT); + ab8500_chargalg_stop_charging(di); + ab8500_chargalg_state_to(di, STATE_OVV_PROTECT); fallthrough; case STATE_OVV_PROTECT: @@ -1475,23 +1475,23 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) !di->events.batt_ovv && di->chg_info.usb_chg_ok && di->chg_info.ac_chg_ok) - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); break; case STATE_CHG_NOT_OK_INIT: - abx500_chargalg_stop_charging(di); - abx500_chargalg_state_to(di, STATE_CHG_NOT_OK); + ab8500_chargalg_stop_charging(di); + ab8500_chargalg_state_to(di, STATE_CHG_NOT_OK); fallthrough; case STATE_CHG_NOT_OK: if (!di->events.mainextchnotok && !di->events.usbchargernotok) - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); break; case STATE_SAFETY_TIMER_EXPIRED_INIT: - abx500_chargalg_stop_charging(di); - abx500_chargalg_state_to(di, STATE_SAFETY_TIMER_EXPIRED); + ab8500_chargalg_stop_charging(di); + ab8500_chargalg_state_to(di, STATE_SAFETY_TIMER_EXPIRED); fallthrough; case STATE_SAFETY_TIMER_EXPIRED: @@ -1500,20 +1500,20 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) case STATE_NORMAL_INIT: if (di->curr_status.curr_step == CHARGALG_CURR_STEP_LOW) - abx500_chargalg_stop_charging(di); + ab8500_chargalg_stop_charging(di); else { curr_step_lvl = di->bm->bat_type[ di->bm->batt_id].normal_cur_lvl * di->curr_status.curr_step / CHARGALG_CURR_STEP_HIGH; - abx500_chargalg_start_charging(di, + ab8500_chargalg_start_charging(di, di->bm->bat_type[di->bm->batt_id] .normal_vol_lvl, curr_step_lvl); } - abx500_chargalg_state_to(di, STATE_NORMAL); - abx500_chargalg_start_safety_timer(di); - abx500_chargalg_stop_maintenance_timer(di); + ab8500_chargalg_state_to(di, STATE_NORMAL); + ab8500_chargalg_start_safety_timer(di); + ab8500_chargalg_stop_maintenance_timer(di); init_maxim_chg_curr(di); di->charge_status = POWER_SUPPLY_STATUS_CHARGING; di->eoc_cnt = 0; @@ -1527,104 +1527,104 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) if (di->charge_status == POWER_SUPPLY_STATUS_FULL && di->maintenance_chg) { if (di->bm->no_maintenance) - abx500_chargalg_state_to(di, + ab8500_chargalg_state_to(di, STATE_WAIT_FOR_RECHARGE_INIT); else - abx500_chargalg_state_to(di, + ab8500_chargalg_state_to(di, STATE_MAINTENANCE_A_INIT); } break; /* This state will be used when the maintenance state is disabled */ case STATE_WAIT_FOR_RECHARGE_INIT: - abx500_chargalg_hold_charging(di); - abx500_chargalg_state_to(di, STATE_WAIT_FOR_RECHARGE); + ab8500_chargalg_hold_charging(di); + ab8500_chargalg_state_to(di, STATE_WAIT_FOR_RECHARGE); fallthrough; case STATE_WAIT_FOR_RECHARGE: if (di->batt_data.percent <= di->bm->bat_type[di->bm->batt_id]. recharge_cap) - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); break; case STATE_MAINTENANCE_A_INIT: - abx500_chargalg_stop_safety_timer(di); - abx500_chargalg_start_maintenance_timer(di, + ab8500_chargalg_stop_safety_timer(di); + ab8500_chargalg_start_maintenance_timer(di, di->bm->bat_type[ di->bm->batt_id].maint_a_chg_timer_h); - abx500_chargalg_start_charging(di, + ab8500_chargalg_start_charging(di, di->bm->bat_type[ di->bm->batt_id].maint_a_vol_lvl, di->bm->bat_type[ di->bm->batt_id].maint_a_cur_lvl); - abx500_chargalg_state_to(di, STATE_MAINTENANCE_A); + ab8500_chargalg_state_to(di, STATE_MAINTENANCE_A); power_supply_changed(di->chargalg_psy); fallthrough; case STATE_MAINTENANCE_A: if (di->events.maintenance_timer_expired) { - abx500_chargalg_stop_maintenance_timer(di); - abx500_chargalg_state_to(di, STATE_MAINTENANCE_B_INIT); + ab8500_chargalg_stop_maintenance_timer(di); + ab8500_chargalg_state_to(di, STATE_MAINTENANCE_B_INIT); } break; case STATE_MAINTENANCE_B_INIT: - abx500_chargalg_start_maintenance_timer(di, + ab8500_chargalg_start_maintenance_timer(di, di->bm->bat_type[ di->bm->batt_id].maint_b_chg_timer_h); - abx500_chargalg_start_charging(di, + ab8500_chargalg_start_charging(di, di->bm->bat_type[ di->bm->batt_id].maint_b_vol_lvl, di->bm->bat_type[ di->bm->batt_id].maint_b_cur_lvl); - abx500_chargalg_state_to(di, STATE_MAINTENANCE_B); + ab8500_chargalg_state_to(di, STATE_MAINTENANCE_B); power_supply_changed(di->chargalg_psy); fallthrough; case STATE_MAINTENANCE_B: if (di->events.maintenance_timer_expired) { - abx500_chargalg_stop_maintenance_timer(di); - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_stop_maintenance_timer(di); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); } break; case STATE_TEMP_LOWHIGH_INIT: - abx500_chargalg_start_charging(di, + ab8500_chargalg_start_charging(di, di->bm->bat_type[ di->bm->batt_id].low_high_vol_lvl, di->bm->bat_type[ di->bm->batt_id].low_high_cur_lvl); - abx500_chargalg_stop_maintenance_timer(di); + ab8500_chargalg_stop_maintenance_timer(di); di->charge_status = POWER_SUPPLY_STATUS_CHARGING; - abx500_chargalg_state_to(di, STATE_TEMP_LOWHIGH); + ab8500_chargalg_state_to(di, STATE_TEMP_LOWHIGH); power_supply_changed(di->chargalg_psy); fallthrough; case STATE_TEMP_LOWHIGH: if (!di->events.btemp_lowhigh) - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); break; case STATE_WD_EXPIRED_INIT: - abx500_chargalg_stop_charging(di); - abx500_chargalg_state_to(di, STATE_WD_EXPIRED); + ab8500_chargalg_stop_charging(di); + ab8500_chargalg_state_to(di, STATE_WD_EXPIRED); fallthrough; case STATE_WD_EXPIRED: if (!di->events.ac_wd_expired && !di->events.usb_wd_expired) - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); break; case STATE_TEMP_UNDEROVER_INIT: - abx500_chargalg_stop_charging(di); - abx500_chargalg_state_to(di, STATE_TEMP_UNDEROVER); + ab8500_chargalg_stop_charging(di); + ab8500_chargalg_state_to(di, STATE_TEMP_UNDEROVER); fallthrough; case STATE_TEMP_UNDEROVER: if (!di->events.btemp_underover) - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); break; } @@ -1636,17 +1636,17 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) } /** - * abx500_chargalg_periodic_work() - Periodic work for the algorithm + * ab8500_chargalg_periodic_work() - Periodic work for the algorithm * @work: pointer to the work_struct structure * * Work queue function for the charging algorithm */ -static void abx500_chargalg_periodic_work(struct work_struct *work) +static void ab8500_chargalg_periodic_work(struct work_struct *work) { - struct abx500_chargalg *di = container_of(work, - struct abx500_chargalg, chargalg_periodic_work.work); + struct ab8500_chargalg *di = container_of(work, + struct ab8500_chargalg, chargalg_periodic_work.work); - abx500_chargalg_algorithm(di); + ab8500_chargalg_algorithm(di); /* * If a charger is connected then the battery has to be monitored @@ -1663,20 +1663,20 @@ static void abx500_chargalg_periodic_work(struct work_struct *work) } /** - * abx500_chargalg_wd_work() - periodic work to kick the charger watchdog + * ab8500_chargalg_wd_work() - periodic work to kick the charger watchdog * @work: pointer to the work_struct structure * * Work queue function for kicking the charger watchdog */ -static void abx500_chargalg_wd_work(struct work_struct *work) +static void ab8500_chargalg_wd_work(struct work_struct *work) { int ret; - struct abx500_chargalg *di = container_of(work, - struct abx500_chargalg, chargalg_wd_work.work); + struct ab8500_chargalg *di = container_of(work, + struct ab8500_chargalg, chargalg_wd_work.work); - dev_dbg(di->dev, "abx500_chargalg_wd_work\n"); + dev_dbg(di->dev, "ab8500_chargalg_wd_work\n"); - ret = abx500_chargalg_kick_watchdog(di); + ret = ab8500_chargalg_kick_watchdog(di); if (ret < 0) dev_err(di->dev, "failed to kick watchdog\n"); @@ -1685,21 +1685,21 @@ static void abx500_chargalg_wd_work(struct work_struct *work) } /** - * abx500_chargalg_work() - Work to run the charging algorithm instantly + * ab8500_chargalg_work() - Work to run the charging algorithm instantly * @work: pointer to the work_struct structure * * Work queue function for calling the charging algorithm */ -static void abx500_chargalg_work(struct work_struct *work) +static void ab8500_chargalg_work(struct work_struct *work) { - struct abx500_chargalg *di = container_of(work, - struct abx500_chargalg, chargalg_work); + struct ab8500_chargalg *di = container_of(work, + struct ab8500_chargalg, chargalg_work); - abx500_chargalg_algorithm(di); + ab8500_chargalg_algorithm(di); } /** - * abx500_chargalg_get_property() - get the chargalg properties + * ab8500_chargalg_get_property() - get the chargalg properties * @psy: pointer to the power_supply structure * @psp: pointer to the power_supply_property structure * @val: pointer to the power_supply_propval union @@ -1710,11 +1710,11 @@ static void abx500_chargalg_work(struct work_struct *work) * health: health of the battery * Returns error code in case of failure else 0 on success */ -static int abx500_chargalg_get_property(struct power_supply *psy, +static int ab8500_chargalg_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) { - struct abx500_chargalg *di = power_supply_get_drvdata(psy); + struct ab8500_chargalg *di = power_supply_get_drvdata(psy); switch (psp) { case POWER_SUPPLY_PROP_STATUS: @@ -1743,13 +1743,13 @@ static int abx500_chargalg_get_property(struct power_supply *psy, /* Exposure to the sysfs interface */ -static ssize_t abx500_chargalg_curr_step_show(struct abx500_chargalg *di, +static ssize_t ab8500_chargalg_curr_step_show(struct ab8500_chargalg *di, char *buf) { return sprintf(buf, "%d\n", di->curr_status.curr_step); } -static ssize_t abx500_chargalg_curr_step_store(struct abx500_chargalg *di, +static ssize_t ab8500_chargalg_curr_step_store(struct ab8500_chargalg *di, const char *buf, size_t length) { long int param; @@ -1774,7 +1774,7 @@ static ssize_t abx500_chargalg_curr_step_store(struct abx500_chargalg *di, } -static ssize_t abx500_chargalg_en_show(struct abx500_chargalg *di, +static ssize_t ab8500_chargalg_en_show(struct ab8500_chargalg *di, char *buf) { return sprintf(buf, "%d\n", @@ -1782,7 +1782,7 @@ static ssize_t abx500_chargalg_en_show(struct abx500_chargalg *di, di->susp_status.usb_suspended); } -static ssize_t abx500_chargalg_en_store(struct abx500_chargalg *di, +static ssize_t ab8500_chargalg_en_store(struct ab8500_chargalg *di, const char *buf, size_t length) { long int param; @@ -1829,22 +1829,22 @@ static ssize_t abx500_chargalg_en_store(struct abx500_chargalg *di, return strlen(buf); } -static struct abx500_chargalg_sysfs_entry abx500_chargalg_en_charger = - __ATTR(chargalg, 0644, abx500_chargalg_en_show, - abx500_chargalg_en_store); +static struct ab8500_chargalg_sysfs_entry ab8500_chargalg_en_charger = + __ATTR(chargalg, 0644, ab8500_chargalg_en_show, + ab8500_chargalg_en_store); -static struct abx500_chargalg_sysfs_entry abx500_chargalg_curr_step = - __ATTR(chargalg_curr_step, 0644, abx500_chargalg_curr_step_show, - abx500_chargalg_curr_step_store); +static struct ab8500_chargalg_sysfs_entry ab8500_chargalg_curr_step = + __ATTR(chargalg_curr_step, 0644, ab8500_chargalg_curr_step_show, + ab8500_chargalg_curr_step_store); -static ssize_t abx500_chargalg_sysfs_show(struct kobject *kobj, +static ssize_t ab8500_chargalg_sysfs_show(struct kobject *kobj, struct attribute *attr, char *buf) { - struct abx500_chargalg_sysfs_entry *entry = container_of(attr, - struct abx500_chargalg_sysfs_entry, attr); + struct ab8500_chargalg_sysfs_entry *entry = container_of(attr, + struct ab8500_chargalg_sysfs_entry, attr); - struct abx500_chargalg *di = container_of(kobj, - struct abx500_chargalg, chargalg_kobject); + struct ab8500_chargalg *di = container_of(kobj, + struct ab8500_chargalg, chargalg_kobject); if (!entry->show) return -EIO; @@ -1852,14 +1852,14 @@ static ssize_t abx500_chargalg_sysfs_show(struct kobject *kobj, return entry->show(di, buf); } -static ssize_t abx500_chargalg_sysfs_charger(struct kobject *kobj, +static ssize_t ab8500_chargalg_sysfs_charger(struct kobject *kobj, struct attribute *attr, const char *buf, size_t length) { - struct abx500_chargalg_sysfs_entry *entry = container_of(attr, - struct abx500_chargalg_sysfs_entry, attr); + struct ab8500_chargalg_sysfs_entry *entry = container_of(attr, + struct ab8500_chargalg_sysfs_entry, attr); - struct abx500_chargalg *di = container_of(kobj, - struct abx500_chargalg, chargalg_kobject); + struct ab8500_chargalg *di = container_of(kobj, + struct ab8500_chargalg, chargalg_kobject); if (!entry->store) return -EIO; @@ -1867,47 +1867,47 @@ static ssize_t abx500_chargalg_sysfs_charger(struct kobject *kobj, return entry->store(di, buf, length); } -static struct attribute *abx500_chargalg_chg[] = { - &abx500_chargalg_en_charger.attr, - &abx500_chargalg_curr_step.attr, +static struct attribute *ab8500_chargalg_chg[] = { + &ab8500_chargalg_en_charger.attr, + &ab8500_chargalg_curr_step.attr, NULL, }; -static const struct sysfs_ops abx500_chargalg_sysfs_ops = { - .show = abx500_chargalg_sysfs_show, - .store = abx500_chargalg_sysfs_charger, +static const struct sysfs_ops ab8500_chargalg_sysfs_ops = { + .show = ab8500_chargalg_sysfs_show, + .store = ab8500_chargalg_sysfs_charger, }; -static struct kobj_type abx500_chargalg_ktype = { - .sysfs_ops = &abx500_chargalg_sysfs_ops, - .default_attrs = abx500_chargalg_chg, +static struct kobj_type ab8500_chargalg_ktype = { + .sysfs_ops = &ab8500_chargalg_sysfs_ops, + .default_attrs = ab8500_chargalg_chg, }; /** - * abx500_chargalg_sysfs_exit() - de-init of sysfs entry - * @di: pointer to the struct abx500_chargalg + * ab8500_chargalg_sysfs_exit() - de-init of sysfs entry + * @di: pointer to the struct ab8500_chargalg * * This function removes the entry in sysfs. */ -static void abx500_chargalg_sysfs_exit(struct abx500_chargalg *di) +static void ab8500_chargalg_sysfs_exit(struct ab8500_chargalg *di) { kobject_del(&di->chargalg_kobject); } /** - * abx500_chargalg_sysfs_init() - init of sysfs entry - * @di: pointer to the struct abx500_chargalg + * ab8500_chargalg_sysfs_init() - init of sysfs entry + * @di: pointer to the struct ab8500_chargalg * * This function adds an entry in sysfs. * Returns error code in case of failure else 0(on success) */ -static int abx500_chargalg_sysfs_init(struct abx500_chargalg *di) +static int ab8500_chargalg_sysfs_init(struct ab8500_chargalg *di) { int ret = 0; ret = kobject_init_and_add(&di->chargalg_kobject, - &abx500_chargalg_ktype, - NULL, "abx500_chargalg"); + &ab8500_chargalg_ktype, + NULL, "ab8500_chargalg"); if (ret < 0) dev_err(di->dev, "failed to create sysfs entry\n"); @@ -1915,9 +1915,9 @@ static int abx500_chargalg_sysfs_init(struct abx500_chargalg *di) } /* Exposure to the sysfs interface <> */ -static int __maybe_unused abx500_chargalg_resume(struct device *dev) +static int __maybe_unused ab8500_chargalg_resume(struct device *dev) { - struct abx500_chargalg *di = dev_get_drvdata(dev); + struct ab8500_chargalg *di = dev_get_drvdata(dev); /* Kick charger watchdog if charging (any charger online) */ if (di->chg_info.online_chg) @@ -1932,9 +1932,9 @@ static int __maybe_unused abx500_chargalg_resume(struct device *dev) return 0; } -static int __maybe_unused abx500_chargalg_suspend(struct device *dev) +static int __maybe_unused ab8500_chargalg_suspend(struct device *dev) { - struct abx500_chargalg *di = dev_get_drvdata(dev); + struct ab8500_chargalg *di = dev_get_drvdata(dev); if (di->chg_info.online_chg) cancel_delayed_work_sync(&di->chargalg_wd_work); @@ -1948,22 +1948,22 @@ static char *supply_interface[] = { "ab8500_fg", }; -static const struct power_supply_desc abx500_chargalg_desc = { +static const struct power_supply_desc ab8500_chargalg_desc = { .name = "abx500_chargalg", .type = POWER_SUPPLY_TYPE_BATTERY, - .properties = abx500_chargalg_props, - .num_properties = ARRAY_SIZE(abx500_chargalg_props), - .get_property = abx500_chargalg_get_property, - .external_power_changed = abx500_chargalg_external_power_changed, + .properties = ab8500_chargalg_props, + .num_properties = ARRAY_SIZE(ab8500_chargalg_props), + .get_property = ab8500_chargalg_get_property, + .external_power_changed = ab8500_chargalg_external_power_changed, }; -static int abx500_chargalg_bind(struct device *dev, struct device *master, +static int ab8500_chargalg_bind(struct device *dev, struct device *master, void *data) { - struct abx500_chargalg *di = dev_get_drvdata(dev); + struct ab8500_chargalg *di = dev_get_drvdata(dev); /* Create a work queue for the chargalg */ - di->chargalg_wq = alloc_ordered_workqueue("abx500_chargalg_wq", + di->chargalg_wq = alloc_ordered_workqueue("ab8500_chargalg_wq", WQ_MEM_RECLAIM); if (di->chargalg_wq == NULL) { dev_err(di->dev, "failed to create work queue\n"); @@ -1976,10 +1976,10 @@ static int abx500_chargalg_bind(struct device *dev, struct device *master, return 0; } -static void abx500_chargalg_unbind(struct device *dev, struct device *master, +static void ab8500_chargalg_unbind(struct device *dev, struct device *master, void *data) { - struct abx500_chargalg *di = dev_get_drvdata(dev); + struct ab8500_chargalg *di = dev_get_drvdata(dev); /* Stop all timers and work */ hrtimer_cancel(&di->safety_timer); @@ -1994,16 +1994,16 @@ static void abx500_chargalg_unbind(struct device *dev, struct device *master, flush_scheduled_work(); } -static const struct component_ops abx500_chargalg_component_ops = { - .bind = abx500_chargalg_bind, - .unbind = abx500_chargalg_unbind, +static const struct component_ops ab8500_chargalg_component_ops = { + .bind = ab8500_chargalg_bind, + .unbind = ab8500_chargalg_unbind, }; -static int abx500_chargalg_probe(struct platform_device *pdev) +static int ab8500_chargalg_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct power_supply_config psy_cfg = {}; - struct abx500_chargalg *di; + struct ab8500_chargalg *di; int ret = 0; di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); @@ -2022,28 +2022,28 @@ static int abx500_chargalg_probe(struct platform_device *pdev) /* Initilialize safety timer */ hrtimer_init(&di->safety_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); - di->safety_timer.function = abx500_chargalg_safety_timer_expired; + di->safety_timer.function = ab8500_chargalg_safety_timer_expired; /* Initilialize maintenance timer */ hrtimer_init(&di->maintenance_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); di->maintenance_timer.function = - abx500_chargalg_maintenance_timer_expired; + ab8500_chargalg_maintenance_timer_expired; /* Init work for chargalg */ INIT_DEFERRABLE_WORK(&di->chargalg_periodic_work, - abx500_chargalg_periodic_work); + ab8500_chargalg_periodic_work); INIT_DEFERRABLE_WORK(&di->chargalg_wd_work, - abx500_chargalg_wd_work); + ab8500_chargalg_wd_work); /* Init work for chargalg */ - INIT_WORK(&di->chargalg_work, abx500_chargalg_work); + INIT_WORK(&di->chargalg_work, ab8500_chargalg_work); /* To detect charger at startup */ di->chg_info.prev_conn_chg = -1; /* Register chargalg power supply class */ di->chargalg_psy = devm_power_supply_register(di->dev, - &abx500_chargalg_desc, + &ab8500_chargalg_desc, &psy_cfg); if (IS_ERR(di->chargalg_psy)) { dev_err(di->dev, "failed to register chargalg psy\n"); @@ -2053,7 +2053,7 @@ static int abx500_chargalg_probe(struct platform_device *pdev) platform_set_drvdata(pdev, di); /* sysfs interface to enable/disable charging from user space */ - ret = abx500_chargalg_sysfs_init(di); + ret = ab8500_chargalg_sysfs_init(di); if (ret) { dev_err(di->dev, "failed to create sysfs entry\n"); return ret; @@ -2061,38 +2061,38 @@ static int abx500_chargalg_probe(struct platform_device *pdev) di->curr_status.curr_step = CHARGALG_CURR_STEP_HIGH; dev_info(di->dev, "probe success\n"); - return component_add(dev, &abx500_chargalg_component_ops); + return component_add(dev, &ab8500_chargalg_component_ops); } -static int abx500_chargalg_remove(struct platform_device *pdev) +static int ab8500_chargalg_remove(struct platform_device *pdev) { - struct abx500_chargalg *di = platform_get_drvdata(pdev); + struct ab8500_chargalg *di = platform_get_drvdata(pdev); - component_del(&pdev->dev, &abx500_chargalg_component_ops); + component_del(&pdev->dev, &ab8500_chargalg_component_ops); /* sysfs interface to enable/disable charging from user space */ - abx500_chargalg_sysfs_exit(di); + ab8500_chargalg_sysfs_exit(di); return 0; } -static SIMPLE_DEV_PM_OPS(abx500_chargalg_pm_ops, abx500_chargalg_suspend, abx500_chargalg_resume); +static SIMPLE_DEV_PM_OPS(ab8500_chargalg_pm_ops, ab8500_chargalg_suspend, ab8500_chargalg_resume); static const struct of_device_id ab8500_chargalg_match[] = { { .compatible = "stericsson,ab8500-chargalg", }, { }, }; -struct platform_driver abx500_chargalg_driver = { - .probe = abx500_chargalg_probe, - .remove = abx500_chargalg_remove, +struct platform_driver ab8500_chargalg_driver = { + .probe = ab8500_chargalg_probe, + .remove = ab8500_chargalg_remove, .driver = { - .name = "ab8500-chargalg", + .name = "ab8500_chargalg", .of_match_table = ab8500_chargalg_match, - .pm = &abx500_chargalg_pm_ops, + .pm = &ab8500_chargalg_pm_ops, }, }; MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Johan Palsson, Karl Komierowski"); -MODULE_ALIAS("platform:abx500-chargalg"); -MODULE_DESCRIPTION("abx500 battery charging algorithm"); +MODULE_ALIAS("platform:ab8500-chargalg"); +MODULE_DESCRIPTION("ab8500 battery charging algorithm"); diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index fa49e12e5a60..e0d3d6bd8b8c 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3388,7 +3388,7 @@ static const struct component_master_ops ab8500_charger_comp_ops = { static struct platform_driver *const ab8500_charger_component_drivers[] = { &ab8500_fg_driver, &ab8500_btemp_driver, - &abx500_chargalg_driver, + &ab8500_chargalg_driver, }; static int ab8500_charger_compare_dev(struct device *dev, void *data) From patchwork Tue Jul 13 15:27:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 474686 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4074012jao; Tue, 13 Jul 2021 08:29:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxcLWz/gGaEEfqLhNa3zw2cfBgOeoioRIafsAQndkpvn73WYBqgRhvdinO18+vqE34Qf9y X-Received: by 2002:a17:907:2151:: with SMTP id rk17mr6255257ejb.3.1626190164316; Tue, 13 Jul 2021 08:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626190164; cv=none; d=google.com; s=arc-20160816; b=P/Ji/poTvoLf0sfiWqnjUf1yjiW1isXOazqxneU9h1w8g0TzC7xDycE3Ii30Gv8Mer 4CGtvnRCQHtFppiu8JTwJkEl8gqwOYAn1zDYyFu3Xyf5jAQBXN5LZuHemBtb3Av16h/F ml160RyHRkr+Cmoy34FaJIOBDpJ1fDIEqgdBTMdNF7ernwsP1L/jL24CuJHK9D6sFAXV yKeG08IgNp2prsjQ6ganLVxFX0q6F4m8mWQtU2hMlcJCKUuTit0RTFO3HJho19PXX8K8 7Jksicrqie9sRHrlyuDxGTzzExPVDFSZD3cugyDfROz3sDWPBbazxemmJ600fFrKtEin zYrg== 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=LmxdaGsAsudey2ufxDHAxSAjpnXiJVfRjociqDoVWnE=; b=tFf8nYG2AgAz5eTZLE+2Mk+IH96Wm1oE0b2KSkHZeHdhwokkCYrghyhdUlhmT0lTjV ZNNVmCBkLBMxU0j1qbc2KI+7aMCdY/7CaQpsWjoxOAcOlWyWp37TquQvj8j0ZAIa9L8a qoA2yPrn+P/VFV+aXDqYXjKkR7vKlA3CGlDss31VZgv2ZHHz0DBUHmSSy422Wyns99rn j2nQJeBGPy8vEa4kZvRHKd8nf2fRCRuX9caUSWZyJn9uV+WPBO4389PhppMMr7P7Bioo WFXyZsQet58f56B2d9QNkpJxz3URW311HgYTw2nOL8QtWyjNlJNrxjFKElb+xpFhXB7H Q+mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jfJyLn0L; 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 g16si21947515edv.472.2021.07.13.08.29.24; Tue, 13 Jul 2021 08:29:24 -0700 (PDT) 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=jfJyLn0L; 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 S237097AbhGMPcN (ORCPT + 8 others); Tue, 13 Jul 2021 11:32:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237095AbhGMPcM (ORCPT ); Tue, 13 Jul 2021 11:32:12 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24716C0613E9 for ; Tue, 13 Jul 2021 08:29:22 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id n14so50964187lfu.8 for ; Tue, 13 Jul 2021 08:29:22 -0700 (PDT) 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=LmxdaGsAsudey2ufxDHAxSAjpnXiJVfRjociqDoVWnE=; b=jfJyLn0LdyUPw477v1S6i453LdyNff1v3+fvnTRFIXA+iK/FXsJuRI24VDSHxLqMsm AUsPJqVN8l9oB5WlIlV5kL1Vos+LB5wsaDDmcHDtROCmBm6y4EEREKo0FPsL5Gv2zuWJ X5C4fpH3R0BXRN3kxSYphACThVvzw5xmzWYpBoCpukvclk2HqBbEsY0+rYcNqyf0Xb78 CqNoHEs+jXvaPC2QQkcItdNoqmtYNDWj1wOLmJmEJKaXR8Qc440l8xldM2c+cV1KClYS sN+0bcBoChv+cj7qzX07dz8LKqbOpXiWYmQUxEDGmCeYCvWJxnrIeirM6IMYp4vuI4Yv TbeQ== 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=LmxdaGsAsudey2ufxDHAxSAjpnXiJVfRjociqDoVWnE=; b=OQe8saytha2+nj/DLnWJhgpsBv5rRPQuz6ujtx8XcOYOVO7fZrHnn2crXkHRN6jPA0 IAIGtCxWc52av/OwW3V9OySdur4EGhY36SIsAd9OeAJyVbd7S9y0b5XxovmBDolMI8r3 8NE2rlBpOhX7dUys7CR8WYNy4EFmDgc1QRaGcvxxa0nyRGPmqOvSXx1rL6VV66U6iXqY uhOupM5MwkS4KFUIgN8jOBPrzsLlyabwPVq7Kc5GgVDRVNf8dBX1Rgsj6Ghxajzo9XqL bfi1+FM/xdA+A0On3Qi/Nh09K8thVjkM6tEwvuCE0L0kYkGHGEZ9Q7rMDH1V0pSg0Y7d r9Ig== X-Gm-Message-State: AOAM530oJGiE9D0K1HsB0UeWJnLAo3FEYAWQNTPcJBM88za7SYCERTxG Qs9TJi+qF1T98eoJ61jVwXMovA== X-Received: by 2002:a19:e04a:: with SMTP id g10mr4011103lfj.561.1626190159552; Tue, 13 Jul 2021 08:29:19 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id d8sm827395ljg.86.2021.07.13.08.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 08:29:19 -0700 (PDT) From: Linus Walleij To: Sebastian Reichel , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 3/5] power: supply: ab8500: Drop abx500 concept Date: Tue, 13 Jul 2021 17:27:07 +0200 Message-Id: <20210713152709.871833-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210713152709.871833-1-linus.walleij@linaro.org> References: <20210713152709.871833-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Drop the entire idea with abx500 being abstract and different from ab8500 in the AB8500 charging drivers. This rids the two identical definitions of a slew of structs in ab8500-bm.h and makes things less confusion and easier to understand. Signed-off-by: Linus Walleij --- drivers/power/supply/ab8500-bm.h | 217 ++++--------------------- drivers/power/supply/ab8500_bmdata.c | 32 ++-- drivers/power/supply/ab8500_btemp.c | 16 +- drivers/power/supply/ab8500_chargalg.c | 2 +- drivers/power/supply/ab8500_charger.c | 2 +- drivers/power/supply/ab8500_fg.c | 6 +- 6 files changed, 61 insertions(+), 214 deletions(-) -- 2.31.1 diff --git a/drivers/power/supply/ab8500-bm.h b/drivers/power/supply/ab8500-bm.h index 4e417fbae60c..d11405b7ee1a 100644 --- a/drivers/power/supply/ab8500-bm.h +++ b/drivers/power/supply/ab8500-bm.h @@ -269,43 +269,43 @@ enum bup_vch_sel { /* * ADC for the battery thermistor. - * When using the ABx500_ADC_THERM_BATCTRL the battery ID resistor is combined + * When using the AB8500_ADC_THERM_BATCTRL the battery ID resistor is combined * with a NTC resistor to both identify the battery and to measure its * temperature. Different phone manufactures uses different techniques to both * identify the battery and to read its temperature. */ -enum abx500_adc_therm { - ABx500_ADC_THERM_BATCTRL, - ABx500_ADC_THERM_BATTEMP, +enum ab8500_adc_therm { + AB8500_ADC_THERM_BATCTRL, + AB8500_ADC_THERM_BATTEMP, }; /** - * struct abx500_res_to_temp - defines one point in a temp to res curve. To + * struct ab8500_res_to_temp - defines one point in a temp to res curve. To * be used in battery packs that combines the identification resistor with a * NTC resistor. * @temp: battery pack temperature in Celsius * @resist: NTC resistor net total resistance */ -struct abx500_res_to_temp { +struct ab8500_res_to_temp { int temp; int resist; }; /** - * struct abx500_v_to_cap - Table for translating voltage to capacity + * struct ab8500_v_to_cap - Table for translating voltage to capacity * @voltage: Voltage in mV * @capacity: Capacity in percent */ -struct abx500_v_to_cap { +struct ab8500_v_to_cap { int voltage; int capacity; }; /* Forward declaration */ -struct abx500_fg; +struct ab8500_fg; /** - * struct abx500_fg_parameters - Fuel gauge algorithm parameters, in seconds + * struct ab8500_fg_parameters - Fuel gauge algorithm parameters, in seconds * if not specified * @recovery_sleep_timer: Time between measurements while recovering * @recovery_total_time: Total recovery time @@ -333,7 +333,7 @@ struct abx500_fg; * @pcut_max_restart: Max number of restarts * @pcut_debounce_time: Sets battery debounce time */ -struct abx500_fg_parameters { +struct ab8500_fg_parameters { int recovery_sleep_timer; int recovery_total_time; int init_timer; @@ -357,13 +357,13 @@ struct abx500_fg_parameters { }; /** - * struct abx500_charger_maximization - struct used by the board config. + * struct ab8500_charger_maximization - struct used by the board config. * @use_maxi: Enable maximization for this battery type * @maxi_chg_curr: Maximum charger current allowed * @maxi_wait_cycles: cycles to wait before setting charger current * @charger_curr_step delta between two charger current settings (mA) */ -struct abx500_maxim_parameters { +struct ab8500_maxim_parameters { bool ena_maxi; int chg_curr; int wait_cycles; @@ -371,7 +371,7 @@ struct abx500_maxim_parameters { }; /** - * struct abx500_battery_type - different batteries supported + * struct ab8500_battery_type - different batteries supported * @name: battery technology * @resis_high: battery upper resistance limit * @resis_low: battery lower resistance limit @@ -400,7 +400,7 @@ struct abx500_maxim_parameters { * @n_batres_tbl_elements number of elements in the batres_tbl * @batres_tbl battery internal resistance vs temperature table */ -struct abx500_battery_type { +struct ab8500_battery_type { int name; int resis_high; int resis_low; @@ -421,22 +421,22 @@ struct abx500_battery_type { int low_high_vol_lvl; int battery_resistance; int n_temp_tbl_elements; - const struct abx500_res_to_temp *r_to_t_tbl; + const struct ab8500_res_to_temp *r_to_t_tbl; int n_v_cap_tbl_elements; - const struct abx500_v_to_cap *v_to_cap_tbl; + const struct ab8500_v_to_cap *v_to_cap_tbl; int n_batres_tbl_elements; const struct batres_vs_temp *batres_tbl; }; /** - * struct abx500_bm_capacity_levels - abx500 capacity level data + * struct ab8500_bm_capacity_levels - ab8500 capacity level data * @critical: critical capacity level in percent * @low: low capacity level in percent * @normal: normal capacity level in percent * @high: high capacity level in percent * @full: full capacity level in percent */ -struct abx500_bm_capacity_levels { +struct ab8500_bm_capacity_levels { int critical; int low; int normal; @@ -445,13 +445,13 @@ struct abx500_bm_capacity_levels { }; /** - * struct abx500_bm_charger_parameters - Charger specific parameters + * struct ab8500_bm_charger_parameters - Charger specific parameters * @usb_volt_max: maximum allowed USB charger voltage in mV * @usb_curr_max: maximum allowed USB charger current in mA * @ac_volt_max: maximum allowed AC charger voltage in mV * @ac_curr_max: maximum allowed AC charger current in mA */ -struct abx500_bm_charger_parameters { +struct ab8500_bm_charger_parameters { int usb_volt_max; int usb_curr_max; int ac_volt_max; @@ -459,7 +459,7 @@ struct abx500_bm_charger_parameters { }; /** - * struct abx500_bm_data - abx500 battery management data + * struct ab8500_bm_data - ab8500 battery management data * @temp_under under this temp, charging is stopped * @temp_low between this temp and temp_under charging is reduced * @temp_high between this temp and temp_over charging is reduced @@ -473,7 +473,7 @@ struct abx500_bm_charger_parameters { * @bkup_bat_i current which we charge the backup battery with * @no_maintenance indicates that maintenance charging is disabled * @capacity_scaling indicates whether capacity scaling is to be used - * @abx500_adc_therm placement of thermistor, batctrl or battemp adc + * @ab8500_adc_therm placement of thermistor, batctrl or battemp adc * @chg_unknown_bat flag to enable charging of unknown batteries * @enable_overshoot flag to enable VBAT overshoot control * @auto_trig flag to enable auto adc trigger @@ -494,7 +494,7 @@ struct abx500_bm_charger_parameters { * @chg_params charger parameters * @fg_params fuel gauge parameters */ -struct abx500_bm_data { +struct ab8500_bm_data { int temp_under; int temp_low; int temp_high; @@ -511,7 +511,7 @@ struct abx500_bm_data { bool chg_unknown_bat; bool enable_overshoot; bool auto_trig; - enum abx500_adc_therm adc_therm; + enum ab8500_adc_therm adc_therm; int fg_res; int n_btypes; int batt_id; @@ -523,11 +523,11 @@ struct abx500_bm_data { int n_chg_in_curr; int *chg_output_curr; int *chg_input_curr; - const struct abx500_maxim_parameters *maxi; - const struct abx500_bm_capacity_levels *cap_levels; - struct abx500_battery_type *bat_type; - const struct abx500_bm_charger_parameters *chg_params; - const struct abx500_fg_parameters *fg_params; + const struct ab8500_maxim_parameters *maxi; + const struct ab8500_bm_capacity_levels *cap_levels; + struct ab8500_battery_type *bat_type; + const struct ab8500_bm_charger_parameters *chg_params; + const struct ab8500_fg_parameters *fg_params; }; enum { @@ -561,160 +561,7 @@ struct batres_vs_temp { /* Forward declaration */ struct ab8500_fg; -/** - * struct ab8500_fg_parameters - Fuel gauge algorithm parameters, in seconds - * if not specified - * @recovery_sleep_timer: Time between measurements while recovering - * @recovery_total_time: Total recovery time - * @init_timer: Measurement interval during startup - * @init_discard_time: Time we discard voltage measurement at startup - * @init_total_time: Total init time during startup - * @high_curr_time: Time current has to be high to go to recovery - * @accu_charging: FG accumulation time while charging - * @accu_high_curr: FG accumulation time in high current mode - * @high_curr_threshold: High current threshold, in mA - * @lowbat_threshold: Low battery threshold, in mV - * @battok_falling_th_sel0 Threshold in mV for battOk signal sel0 - * Resolution in 50 mV step. - * @battok_raising_th_sel1 Threshold in mV for battOk signal sel1 - * Resolution in 50 mV step. - * @user_cap_limit Capacity reported from user must be within this - * limit to be considered as sane, in percentage - * points. - * @maint_thres This is the threshold where we stop reporting - * battery full while in maintenance, in per cent - * @pcut_enable: Enable power cut feature in ab8505 - * @pcut_max_time: Max time threshold - * @pcut_flag_time: Flagtime threshold - * @pcut_max_restart: Max number of restarts - * @pcut_debunce_time: Sets battery debounce time - */ -struct ab8500_fg_parameters { - int recovery_sleep_timer; - int recovery_total_time; - int init_timer; - int init_discard_time; - int init_total_time; - int high_curr_time; - int accu_charging; - int accu_high_curr; - int high_curr_threshold; - int lowbat_threshold; - int battok_falling_th_sel0; - int battok_raising_th_sel1; - int user_cap_limit; - int maint_thres; - bool pcut_enable; - u8 pcut_max_time; - u8 pcut_flag_time; - u8 pcut_max_restart; - u8 pcut_debunce_time; -}; - -/** - * struct ab8500_charger_maximization - struct used by the board config. - * @use_maxi: Enable maximization for this battery type - * @maxi_chg_curr: Maximum charger current allowed - * @maxi_wait_cycles: cycles to wait before setting charger current - * @charger_curr_step delta between two charger current settings (mA) - */ -struct ab8500_maxim_parameters { - bool ena_maxi; - int chg_curr; - int wait_cycles; - int charger_curr_step; -}; - -/** - * struct ab8500_bm_capacity_levels - ab8500 capacity level data - * @critical: critical capacity level in percent - * @low: low capacity level in percent - * @normal: normal capacity level in percent - * @high: high capacity level in percent - * @full: full capacity level in percent - */ -struct ab8500_bm_capacity_levels { - int critical; - int low; - int normal; - int high; - int full; -}; - -/** - * struct ab8500_bm_charger_parameters - Charger specific parameters - * @usb_volt_max: maximum allowed USB charger voltage in mV - * @usb_curr_max: maximum allowed USB charger current in mA - * @ac_volt_max: maximum allowed AC charger voltage in mV - * @ac_curr_max: maximum allowed AC charger current in mA - */ -struct ab8500_bm_charger_parameters { - int usb_volt_max; - int usb_curr_max; - int ac_volt_max; - int ac_curr_max; -}; - -/** - * struct ab8500_bm_data - ab8500 battery management data - * @temp_under under this temp, charging is stopped - * @temp_low between this temp and temp_under charging is reduced - * @temp_high between this temp and temp_over charging is reduced - * @temp_over over this temp, charging is stopped - * @temp_interval_chg temperature measurement interval in s when charging - * @temp_interval_nochg temperature measurement interval in s when not charging - * @main_safety_tmr_h safety timer for main charger - * @usb_safety_tmr_h safety timer for usb charger - * @bkup_bat_v voltage which we charge the backup battery with - * @bkup_bat_i current which we charge the backup battery with - * @no_maintenance indicates that maintenance charging is disabled - * @capacity_scaling indicates whether capacity scaling is to be used - * @adc_therm placement of thermistor, batctrl or battemp adc - * @chg_unknown_bat flag to enable charging of unknown batteries - * @enable_overshoot flag to enable VBAT overshoot control - * @fg_res resistance of FG resistor in 0.1mOhm - * @n_btypes number of elements in array bat_type - * @batt_id index of the identified battery in array bat_type - * @interval_charging charge alg cycle period time when charging (sec) - * @interval_not_charging charge alg cycle period time when not charging (sec) - * @temp_hysteresis temperature hysteresis - * @gnd_lift_resistance Battery ground to phone ground resistance (mOhm) - * @maxi: maximization parameters - * @cap_levels capacity in percent for the different capacity levels - * @bat_type table of supported battery types - * @chg_params charger parameters - * @fg_params fuel gauge parameters - */ -struct ab8500_bm_data { - int temp_under; - int temp_low; - int temp_high; - int temp_over; - int temp_interval_chg; - int temp_interval_nochg; - int main_safety_tmr_h; - int usb_safety_tmr_h; - int bkup_bat_v; - int bkup_bat_i; - bool no_maintenance; - bool capacity_scaling; - bool chg_unknown_bat; - bool enable_overshoot; - enum abx500_adc_therm adc_therm; - int fg_res; - int n_btypes; - int batt_id; - int interval_charging; - int interval_not_charging; - int temp_hysteresis; - int gnd_lift_resistance; - const struct ab8500_maxim_parameters *maxi; - const struct ab8500_bm_capacity_levels *cap_levels; - const struct ab8500_bm_charger_parameters *chg_params; - const struct ab8500_fg_parameters *fg_params; -}; - -extern struct abx500_bm_data ab8500_bm_data; +extern struct ab8500_bm_data ab8500_bm_data; void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); struct ab8500_fg *ab8500_fg_get(void); @@ -725,7 +572,7 @@ int ab8500_fg_inst_curr_started(struct ab8500_fg *di); int ab8500_fg_inst_curr_done(struct ab8500_fg *di); int ab8500_bm_of_probe(struct device *dev, struct device_node *np, - struct abx500_bm_data *bm); + struct ab8500_bm_data *bm); extern struct platform_driver ab8500_fg_driver; extern struct platform_driver ab8500_btemp_driver; diff --git a/drivers/power/supply/ab8500_bmdata.c b/drivers/power/supply/ab8500_bmdata.c index c2b8c0bb77e2..f705c19ef359 100644 --- a/drivers/power/supply/ab8500_bmdata.c +++ b/drivers/power/supply/ab8500_bmdata.c @@ -13,7 +13,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[] = { +const struct ab8500_res_to_temp ab8500_temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -35,7 +35,7 @@ EXPORT_SYMBOL(ab8500_temp_tbl_a_thermistor); const int ab8500_temp_tbl_a_size = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor); EXPORT_SYMBOL(ab8500_temp_tbl_a_size); -const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[] = { +const struct ab8500_res_to_temp ab8500_temp_tbl_b_thermistor[] = { {-5, 200000}, { 0, 159024}, { 5, 151921}, @@ -57,7 +57,7 @@ EXPORT_SYMBOL(ab8500_temp_tbl_b_thermistor); const int ab8500_temp_tbl_b_size = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor); EXPORT_SYMBOL(ab8500_temp_tbl_b_size); -static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { +static const struct ab8500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -80,7 +80,7 @@ static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {3247, 0}, }; -static const struct abx500_v_to_cap cap_tbl_b_thermistor[] = { +static const struct ab8500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -103,7 +103,7 @@ static const struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {3250, 0}, }; -static const struct abx500_v_to_cap cap_tbl[] = { +static const struct ab8500_v_to_cap cap_tbl[] = { {4186, 100}, {4163, 99}, {4114, 95}, @@ -134,7 +134,7 @@ static const struct abx500_v_to_cap cap_tbl[] = { * Note that the res_to_temp table must be strictly sorted by falling * resistance values to work. */ -static const struct abx500_res_to_temp temp_tbl[] = { +static const struct ab8500_res_to_temp temp_tbl[] = { {-5, 214834}, { 0, 162943}, { 5, 124820}, @@ -191,7 +191,7 @@ static const struct batres_vs_temp temp_to_batres_tbl_9100[] = { {-20, 180}, }; -static struct abx500_battery_type bat_type_thermistor[] = { +static struct ab8500_battery_type bat_type_thermistor[] = { [BATTERY_UNKNOWN] = { /* First element always represent the UNKNOWN battery */ .name = POWER_SUPPLY_TECHNOLOGY_UNKNOWN, @@ -277,7 +277,7 @@ static struct abx500_battery_type bat_type_thermistor[] = { }, }; -static struct abx500_battery_type bat_type_ext_thermistor[] = { +static struct ab8500_battery_type bat_type_ext_thermistor[] = { [BATTERY_UNKNOWN] = { /* First element always represent the UNKNOWN battery */ .name = POWER_SUPPLY_TECHNOLOGY_UNKNOWN, @@ -394,7 +394,7 @@ static struct abx500_battery_type bat_type_ext_thermistor[] = { }, }; -static const struct abx500_bm_capacity_levels cap_levels = { +static const struct ab8500_bm_capacity_levels cap_levels = { .critical = 2, .low = 10, .normal = 70, @@ -402,7 +402,7 @@ static const struct abx500_bm_capacity_levels cap_levels = { .full = 100, }; -static const struct abx500_fg_parameters fg = { +static const struct ab8500_fg_parameters fg = { .recovery_sleep_timer = 10, .recovery_total_time = 100, .init_timer = 1, @@ -424,14 +424,14 @@ static const struct abx500_fg_parameters fg = { .pcut_debounce_time = 2, }; -static const struct abx500_maxim_parameters ab8500_maxi_params = { +static const struct ab8500_maxim_parameters ab8500_maxi_params = { .ena_maxi = true, .chg_curr = 910, .wait_cycles = 10, .charger_curr_step = 100, }; -static const struct abx500_bm_charger_parameters chg = { +static const struct ab8500_bm_charger_parameters chg = { .usb_volt_max = 5500, .usb_curr_max = 1500, .ac_volt_max = 7500, @@ -456,7 +456,7 @@ static int ab8500_charge_input_curr_map[] = { 700, 800, 900, 1000, 1100, 1300, 1400, 1500, }; -struct abx500_bm_data ab8500_bm_data = { +struct ab8500_bm_data ab8500_bm_data = { .temp_under = 3, .temp_low = 8, .temp_high = 43, @@ -469,7 +469,7 @@ struct abx500_bm_data ab8500_bm_data = { .bkup_bat_i = BUP_ICH_SEL_150UA, .no_maintenance = false, .capacity_scaling = false, - .adc_therm = ABx500_ADC_THERM_BATCTRL, + .adc_therm = AB8500_ADC_THERM_BATCTRL, .chg_unknown_bat = false, .enable_overshoot = false, .fg_res = 100, @@ -492,7 +492,7 @@ struct abx500_bm_data ab8500_bm_data = { int ab8500_bm_of_probe(struct device *dev, struct device_node *np, - struct abx500_bm_data *bm) + struct ab8500_bm_data *bm) { const struct batres_vs_temp *tmp_batres_tbl; struct device_node *battery_node; @@ -531,7 +531,7 @@ int ab8500_bm_of_probe(struct device *dev, } else { bm->n_btypes = 4; bm->bat_type = bat_type_ext_thermistor; - bm->adc_therm = ABx500_ADC_THERM_BATTEMP; + bm->adc_therm = AB8500_ADC_THERM_BATTEMP; tmp_batres_tbl = temp_to_batres_tbl_ext_thermistor; } diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index 24958b935d39..b6c9111d77d7 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c @@ -103,7 +103,7 @@ struct ab8500_btemp { struct iio_channel *btemp_ball; struct iio_channel *bat_ctrl; struct ab8500_fg *fg; - struct abx500_bm_data *bm; + struct ab8500_bm_data *bm; struct power_supply *btemp_psy; struct ab8500_btemp_events events; struct ab8500_btemp_ranges btemp_ranges; @@ -145,7 +145,7 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di, return (450000 * (v_batctrl)) / (1800 - v_batctrl); } - if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL) { + if (di->bm->adc_therm == AB8500_ADC_THERM_BATCTRL) { /* * If the battery has internal NTC, we use the current * source to calculate the resistance. @@ -207,7 +207,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, return 0; /* Only do this for batteries with internal NTC */ - if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) { + if (di->bm->adc_therm == AB8500_ADC_THERM_BATCTRL && enable) { if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA) curr = BAT_CTRL_7U_ENA; @@ -240,7 +240,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, __func__); goto disable_curr_source; } - } else if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) { + } else if (di->bm->adc_therm == AB8500_ADC_THERM_BATCTRL && !enable) { dev_dbg(di->dev, "Disable BATCTRL curr source\n"); /* Write 0 to the curr bits */ @@ -418,7 +418,7 @@ static int ab8500_btemp_get_batctrl_res(struct ab8500_btemp *di) * based on the NTC resistance. */ static int ab8500_btemp_res_to_temp(struct ab8500_btemp *di, - const struct abx500_res_to_temp *tbl, int tbl_size, int res) + const struct ab8500_res_to_temp *tbl, int tbl_size, int res) { int i; /* @@ -458,7 +458,7 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di) id = di->bm->batt_id; - if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && + if (di->bm->adc_therm == AB8500_ADC_THERM_BATCTRL && id != BATTERY_UNKNOWN) { rbat = ab8500_btemp_get_batctrl_res(di); @@ -527,7 +527,7 @@ static int ab8500_btemp_id(struct ab8500_btemp *di) dev_dbg(di->dev, "Battery detected on %s" " low %d < res %d < high: %d" " index: %d\n", - di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL ? + di->bm->adc_therm == AB8500_ADC_THERM_BATCTRL ? "BATCTRL" : "BATTEMP", di->bm->bat_type[i].resis_low, res, di->bm->bat_type[i].resis_high, i); @@ -547,7 +547,7 @@ static int ab8500_btemp_id(struct ab8500_btemp *di) * We only have to change current source if the * detected type is Type 1. */ - if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && + if (di->bm->adc_therm == AB8500_ADC_THERM_BATCTRL && di->bm->batt_id == 1) { dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n"); di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA; diff --git a/drivers/power/supply/ab8500_chargalg.c b/drivers/power/supply/ab8500_chargalg.c index b0bbb1c4b83a..8dd66eb18fd5 100644 --- a/drivers/power/supply/ab8500_chargalg.c +++ b/drivers/power/supply/ab8500_chargalg.c @@ -249,7 +249,7 @@ struct ab8500_chargalg { struct ab8500_chargalg_suspension_status susp_status; struct ab8500 *parent; struct ab8500_chargalg_current_step_status curr_status; - struct abx500_bm_data *bm; + struct ab8500_bm_data *bm; struct power_supply *chargalg_psy; struct ux500_charger *ac_chg; struct ux500_charger *usb_chg; diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index e0d3d6bd8b8c..15eadaf46f14 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -292,7 +292,7 @@ struct ab8500_charger { struct iio_channel *adc_main_charger_c; struct iio_channel *adc_vbus_v; struct iio_channel *adc_usb_charger_c; - struct abx500_bm_data *bm; + struct ab8500_bm_data *bm; struct ab8500_charger_event_flags flags; struct ab8500_charger_usb_state usb_state; struct ab8500_charger_max_usb_in_curr max_usb_in_curr; diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index bdbf3f13bee0..21bb2fd6725b 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -225,7 +225,7 @@ struct ab8500_fg { struct ab8500_fg_avg_cap avg_cap; struct ab8500 *parent; struct iio_channel *main_bat_v; - struct abx500_bm_data *bm; + struct ab8500_bm_data *bm; struct power_supply *fg_psy; struct workqueue_struct *fg_wq; struct delayed_work fg_periodic_work; @@ -854,7 +854,7 @@ static int ab8500_fg_bat_voltage(struct ab8500_fg *di) static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage) { int i, tbl_size; - const struct abx500_v_to_cap *tbl; + const struct ab8500_v_to_cap *tbl; int cap = 0; tbl = di->bm->bat_type[di->bm->batt_id].v_to_cap_tbl; @@ -2233,7 +2233,7 @@ static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data) case POWER_SUPPLY_TYPE_BATTERY: if (!di->flags.batt_id_received && di->bm->batt_id != BATTERY_UNKNOWN) { - const struct abx500_battery_type *b; + const struct ab8500_battery_type *b; b = &(di->bm->bat_type[di->bm->batt_id]); From patchwork Tue Jul 13 15:27:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 474687 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4074027jao; Tue, 13 Jul 2021 08:29:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTsFvxEc19s5SKIt6lcdrORlKgDuBCmkWMsiUuIg6ic+X2pJjxir6qstYrYjzAmHCIwQ1E X-Received: by 2002:a17:906:c1d0:: with SMTP id bw16mr6516592ejb.146.1626190165270; Tue, 13 Jul 2021 08:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626190165; cv=none; d=google.com; s=arc-20160816; b=MjLjzw3nvB1co7/KDVhSdUj+MvhwR5oAgHqSAGq6rXeN27dH4eRhuju9ajWWjhVYPv 6L9J+wH14BrbH/Ducb9ROq0O+ZgWnx57xRv+ESQXTyn8nhlfMUs0FYOiNuRneSeum9g7 nwJelaDEDii7X7LS+kWB8fr5U00SIH1LMf+Uru0gNxe9kuAQL3ef0lN66dhCd1zJZ+7v Jp1sHoZXmixpTSU91ET4pSapsl4eSxUnHF3gy7Rx3tJ/jAoisstCPfc13IpSvWWX+z4e 2FdTgsqm1CqD7zzFrd54Ap6Rhfwv3D6NXd7/XRzFCvBek1c14ZfQZCUjU9PBXsAs0pGk 87Cw== 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=5q425n9ymaCPEVjgvM4iZ7bBThsuqoFN+1RD50teW8U=; b=ewXZn0SCVZZUKAEHo7h9VV3eH4qe+5TDoi86Z90TdOen3778/GFuEt3V1P3s/pnfnI fjeC/6wR/0/LDx1hc1uUVCS/EmPloH7xXqxkXdZ7/n7Tl6sTaGQqbCmeEe+Q4660dBtp LCRswJFpfRkcsXIDIU3utCja05bnATzGVv0m8kOxIz79LFVTQnZyxVkCuD2iVySv2lOO sXwoECxhAk+ThNdOxtDWeU+XqBd0f1uTEp38QamaoqTvjfmmikYH7KbJkjCEyj0vFSv4 Ok2KanbcE9mGXcJlKAkcQz1yUVPKefJ5JhamLLQvb8CYXZpII62MTEtdEYMZAvKC1am9 V15Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tj4sP0+y; 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 g16si21947515edv.472.2021.07.13.08.29.25; Tue, 13 Jul 2021 08:29:25 -0700 (PDT) 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=Tj4sP0+y; 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 S237094AbhGMPcO (ORCPT + 8 others); Tue, 13 Jul 2021 11:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236932AbhGMPcN (ORCPT ); Tue, 13 Jul 2021 11:32:13 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F4222C0613DD for ; Tue, 13 Jul 2021 08:29:22 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id u13so11745793lfs.11 for ; Tue, 13 Jul 2021 08:29:22 -0700 (PDT) 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=5q425n9ymaCPEVjgvM4iZ7bBThsuqoFN+1RD50teW8U=; b=Tj4sP0+yN7IDleqAJWiIE+R0oM1P/yFTSj7PX1wzUikRSNh1pLiGrHlKTQOvICSmXg FATMYvrz9cTVpUJ+9YWpvkjG32c9oX5X5EMNNZOVKDh72DnWRM8CxA8xQlnqf+M8EKrB Pl9H47gn0B+HDbBOC7EYWQEZQoaEBn2v07V6LpZlcaeOP7QIVRY1ou+ol3HGVy7f8gq5 tT5A5l+5u1N6+SjgFcM0xaUqEw7cSLzr/NQk8VPNhBWrVadO/6bEun82GI31aboUly0E 3ftcrbsB1Ss9MJUdZjKIrng932/HgkS93Lg+BDc2b9ZRgvdluoRMaCFUgXY8T4QbN/oX yHHQ== 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=5q425n9ymaCPEVjgvM4iZ7bBThsuqoFN+1RD50teW8U=; b=J6MXajVyynJk1qVPG106CwPafcGN25wh8/uDJ46nCCWEsE8SBHd9cL7avD0kpnrcuZ p+3zjH6zvIygE6FrsDybXeYmP194lc1Br6W3ObaEzkh+RKpitmbHCXOZRKI4QGPnskNU zlAJM91UpxK4FjxtjS8uicsDGeXY0n0By+jmsDmTpCe1rPqCwJpbmonvB6VYxYi3mWib RGY0a9KdxiYAimxyERvcL1ApHdqKaohJUWzOIUZxmSCGnkVysnj/nH919XXd6zy9Lq4c wXxkL5w7Sa4LNu7HiDZkfUG6cSWk8Jx33Qp/2P60kCEUMjpzTZCa0r76pDJZjIjhOof7 Utvw== X-Gm-Message-State: AOAM531mdxnu7/vZXtgROZlXmqiH11FFlszpBRc27ogsAYm/1aqmikPg pOJI0ZdoB4bW7ODYsjnbPEtjsg== X-Received: by 2002:ac2:4da5:: with SMTP id h5mr3906366lfe.239.1626190161296; Tue, 13 Jul 2021 08:29:21 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id d8sm827395ljg.86.2021.07.13.08.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 08:29:20 -0700 (PDT) From: Linus Walleij To: Sebastian Reichel , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 4/5] power: supply: ab8500: Rename charging algorithm psy Date: Tue, 13 Jul 2021 17:27:08 +0200 Message-Id: <20210713152709.871833-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210713152709.871833-1-linus.walleij@linaro.org> References: <20210713152709.871833-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org If we rename the "abx500_chargalg" supply to "ab8500_chargalg" as it should be named, the existing supplies are supplying that supply but that was obviously not working since it had the wrong name. Now that the dependency kicks in we get a bunch of NULL references from ab8500_chargalg_external_power_changed() so check that the workqueue is allocated before we try to queue work on it. Signed-off-by: Linus Walleij --- drivers/power/supply/ab8500_chargalg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.31.1 diff --git a/drivers/power/supply/ab8500_chargalg.c b/drivers/power/supply/ab8500_chargalg.c index 8dd66eb18fd5..4ef34f64e9c0 100644 --- a/drivers/power/supply/ab8500_chargalg.c +++ b/drivers/power/supply/ab8500_chargalg.c @@ -1275,7 +1275,8 @@ static void ab8500_chargalg_external_power_changed(struct power_supply *psy) * Trigger execution of the algorithm instantly and read * all power_supply properties there instead */ - queue_work(di->chargalg_wq, &di->chargalg_work); + if (di->chargalg_wq) + queue_work(di->chargalg_wq, &di->chargalg_work); } /** @@ -1949,7 +1950,7 @@ static char *supply_interface[] = { }; static const struct power_supply_desc ab8500_chargalg_desc = { - .name = "abx500_chargalg", + .name = "ab8500_chargalg", .type = POWER_SUPPLY_TYPE_BATTERY, .properties = ab8500_chargalg_props, .num_properties = ARRAY_SIZE(ab8500_chargalg_props), From patchwork Tue Jul 13 15:27:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 474688 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4074033jao; Tue, 13 Jul 2021 08:29:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB1ovYCp4d4kNRc2LsOzDSuZJZZrkojiC6T/Lvli6H56HITTIxxaYC5bOxDaKef8WGCo0D X-Received: by 2002:a17:907:9602:: with SMTP id gb2mr6438541ejc.354.1626190165931; Tue, 13 Jul 2021 08:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626190165; cv=none; d=google.com; s=arc-20160816; b=gPp9bLLlV8rFN3ANrDJmG6CPlRJzQcVMmMSx+XeOmQq2LT9KMOfEHf74Ic4QiH78Kg 0LC61fDoPfIWJtNxzCFgOhTgDLXOf/TQpxIkSRWQB4ly5TKVaZtJxOqR8i/d8vBkaQP9 a48FWKD5kvZVOPlEDQTpJwYoz5TlL30sR7EkwLKhnbVptAuGlvtNL+weMaIBy1XCsB36 uudYyo0zv584EOHal8/EuUGqmlaocUvAejW2VxxX/re/y2A7Xv49n38CKMAVQVgOQZfh Gzz9TNoAsOnR8j3Vrx6CGVS1i7sRqbX/FUehoMll+egtA87E9456Um662M7daRtjZ+PU P5Cg== 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=BH1R2YDByvxjcRj7+sjhYJFEOJey1VxQapoVe6e4nvk=; b=sVQ7NqNEZWaVFmwRCR+1LvXdYJshG8vDl8fL4j2LGuJrlBqVFH4jWK8CcBrk8ePt8p nhfqdI/atGySR7d4TUy/zU5gup0OAiELI0ZvZfkpvDxMINUo3MAP3aeNfsFD/gnkg9EX d3ofel+3KHGSZp17hTYQqfJLEIGw7uaNgZIp+oiHG17+VSpdXFaLjVMojXgGhtXyaenW EU0qLMGDsRgD/yC9D35J7Y9tnIBo3zb/yoX2vRPu8lYOEDGujiITP/KfZ75rb86j3Zg4 G4nrmnHCsm7TlUCZSYj5HVYb5QrLqweOeF7XgWlrioj2o6/m+U7xtOrHyp60SYQayxuV N85A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fk8Ubdjr; 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 g16si21947515edv.472.2021.07.13.08.29.25; Tue, 13 Jul 2021 08:29:25 -0700 (PDT) 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=Fk8Ubdjr; 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 S237098AbhGMPcP (ORCPT + 8 others); Tue, 13 Jul 2021 11:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236932AbhGMPcO (ORCPT ); Tue, 13 Jul 2021 11:32:14 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49DE5C0613E9 for ; Tue, 13 Jul 2021 08:29:24 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id a6so30596281ljq.3 for ; Tue, 13 Jul 2021 08:29:24 -0700 (PDT) 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=BH1R2YDByvxjcRj7+sjhYJFEOJey1VxQapoVe6e4nvk=; b=Fk8Ubdjr48N+SiJ92d5G02R+GXD5TIvyBPz5yH7VNVUGrBdAsTjgR8hPWqUmhvSaDr pHE8wKmnn9lFFukjPeZwrkdzNBoirsYK1Le4zm4ykuqmXDoyMzIld2ymdExx0zs3Lv6f GocJbqueVB0qRmaYamMRJfNscPc11wJlQ3uMM9aX8ofSo0seiSZqo9+cmSWAY4MRbq8/ 4m8Bl9rYKcFMKXLSlMRTY/2Ht0dJO8h/jG/4poBFYT2lPaFDeMivs0O10NfVW3IfHH9B Rn2ss0oqWl8GclRC23qS0Aqwe5Z5JKypJL7dcJyC2tMr1+7BPrAnW56WCxGqCB+DOMsk KfUw== 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=BH1R2YDByvxjcRj7+sjhYJFEOJey1VxQapoVe6e4nvk=; b=rTUFaEgdP6USVbYTWLpkvflaIpRQcieZZlXQFqJnsuvq3X7aQM94mg9NNFa51/49gE vzRv0nlrq4wzbqJC+oSzj8JFrSlLz2DqVqZ4sgIdqOnxdQYXgw62g+5kzOOr0cbE3YxA cbd7FpNucoDX08mxvXviIQ4v4KKr9I+hDlgJ3jSaULY1FgV5cfcUKjhZc+rzK1QUuy57 00ZSH1O4wmltDsEtfsA3p06xhkGdr25pR5j61ytWpY6NF3hrnjIM+Yh0m6XXCbs7zVtj H8bXZkjFMw1niu87GFa0aADMnllm538Wp0WfcSC2NIWlWXBcet4GhwCDhoX96AVdz4Pc BBnA== X-Gm-Message-State: AOAM531KrKHrG+84frQMuIuaSzk1ys7rG1HDIUDgtXLQRx2v+bLgP4CW Pi2GIy919v6n9KHIkFZWtpOKdw== X-Received: by 2002:a2e:b5b5:: with SMTP id f21mr4743065ljn.479.1626190162678; Tue, 13 Jul 2021 08:29:22 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id d8sm827395ljg.86.2021.07.13.08.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 08:29:22 -0700 (PDT) From: Linus Walleij To: Sebastian Reichel , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 5/5] power: supply: ab8500: Drop some includes from bmdata Date: Tue, 13 Jul 2021 17:27:09 +0200 Message-Id: <20210713152709.871833-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210713152709.871833-1-linus.walleij@linaro.org> References: <20210713152709.871833-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This file isn't using any AB8500 symbols so drop these includes. Signed-off-by: Linus Walleij --- drivers/power/supply/ab8500_bmdata.c | 2 -- 1 file changed, 2 deletions(-) -- 2.31.1 diff --git a/drivers/power/supply/ab8500_bmdata.c b/drivers/power/supply/ab8500_bmdata.c index f705c19ef359..6f5fb794042c 100644 --- a/drivers/power/supply/ab8500_bmdata.c +++ b/drivers/power/supply/ab8500_bmdata.c @@ -2,8 +2,6 @@ #include #include #include -#include -#include #include "ab8500-bm.h"