From patchwork Thu Mar 22 10:24:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 132259 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp649050ljb; Thu, 22 Mar 2018 03:24:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELuZh068yaYFWa1QCIxgU2r9BE4csjckmdgr77Y2WjFMXAwWVLl2Wyo8VYl9jWGYIa9tx98k X-Received: by 2002:a17:902:20ca:: with SMTP id v10-v6mr25047215plg.9.1521714286867; Thu, 22 Mar 2018 03:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521714286; cv=none; d=google.com; s=arc-20160816; b=Xghtin3XTC5tL40XcwMSD+cJrS4O5L40xefF9RK95blkLMIVZcDLgrbKvR9lLRRL6M DOAORytOTkcpHj3xq8fBcvHlkQmh4NZoBJso66rC3T/YWUgKbGJKP/xqmh7TxJ9EZukZ Evl3hp9/4y06AoDDyRF15505rSqjy+yJFdvjbhJGoW1sH6fQFl8FgDuEZ+icQKbxB0rA IT7snDMbWBS/lE/ZeMmRWzuYFwB0bU3TFSjjwzkDTNhnEfUgrxPVE8RbJk0OX5oguwV7 hC8XwOweaRHA4G6+jz56B4UV9qByNndIAYBNZoR8VmxJlpXgGaNcjaoe6ZDUS6FH4reS tKLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=gkBhHPXCV2MrokUxlkUS22yRnEf8IyUVroplgKwWJEg=; b=0QZIqWKZPU8IyKTnFIs1H5s2B1lpJsinnb5hcshgaHhunEKlXE4Ek7gOKDHXQl8bDT Vr4VsDNcV/jzy7gqbHss/30n8Qcy0TmoH7Utn5A3BdWB0bmPhGKb6yaFdZ5vYL1B0Pni +LlAYrFaFCL8+dLfOiLPZC2fOTe8AyBVKzYIJOzIrEj4i0LkMmi0IIN5QHk7cNeaxwKD KbMp9PC3BGGEDH374TU1WZgKckYfZqePNBfNui4hre4UL7J1HYQLGe7KSi2uImgFreje j1isGxEmlOvkp0i+LvlPp/AXapetTkzbiTR9BAxJJmH+soWRucbkfSbETZ7PqDWWhwjO cFaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fqYRnzlY; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id u11si4270195pgo.695.2018.03.22.03.24.46; Thu, 22 Mar 2018 03:24:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fqYRnzlY; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 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 S1753656AbeCVKYp (ORCPT + 11 others); Thu, 22 Mar 2018 06:24:45 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:40680 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753413AbeCVKYo (ORCPT ); Thu, 22 Mar 2018 06:24:44 -0400 Received: by mail-pl0-f67.google.com with SMTP id x4-v6so4988919pln.7 for ; Thu, 22 Mar 2018 03:24:43 -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; bh=gkBhHPXCV2MrokUxlkUS22yRnEf8IyUVroplgKwWJEg=; b=fqYRnzlYWaT2vb0d9+FX1bMf8QQF9QfVCPMhGd9Q7KK+4XPDQHfULUsTjdPQbFaw4Z hBJV3PlmXvH/4f1vBCm7T3RyW3QhFMA5dIdLTbmVfL9lsJ2QgTSxyZPdZjOZosl7Nqoe EPCZPEqZeQPDjaWwrIwXirefrYCAnxHqEljJw= 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; bh=gkBhHPXCV2MrokUxlkUS22yRnEf8IyUVroplgKwWJEg=; b=SA0jhCXBWImbO2gREuLmOJqlG2KbQy5UqLX9TCed7MCk1DrmblhTAFvdk3nPBci2CR /1L6LWESo+e/oy7v/Wnp8MpRUwnh5g+4ir5Y32dLVJhDiSjY8tlFnf6z3awWQymQBS7B q9C+ec2EMRhyjxH3n9P4ViA/+p+vsOX9o8vkJ+mMEwTLZj6EAqZhlImMjKvJhAzBgM+I OR53076gRRa6ShO8od19TH/PKbkGhuzkdFFAX7ZTte6aMnoHBymgwBhcJYIGjuuAXdP6 v00XhvYS76KPbXEKv/ioTp6pVupYDNfinvvJ71cWcS3iRf0wNbFLTBQldsSr1mhQIrOV nHFw== X-Gm-Message-State: AElRT7FDZmJftc9TyyvtMer9F/NaDvlmsVDfyzyBRIjJZRt1GPVkfi0h 98nuXfLMKsLCEx1yZFYvIsBLqg== X-Received: by 2002:a17:902:a2:: with SMTP id a31-v6mr24363762pla.204.1521714283178; Thu, 22 Mar 2018 03:24:43 -0700 (PDT) Received: from genomnajs.solutionip.com (165084180235.ctinets.com. [165.84.180.235]) by smtp.gmail.com with ESMTPSA id h2sm13972213pfd.119.2018.03.22.03.24.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Mar 2018 03:24:42 -0700 (PDT) From: Linus Walleij To: Sebastian Reichel Cc: linux-pm@vger.kernel.org, Linus Walleij , Lee Jones , Loic Pallardy Subject: [PATCH] power: supply: ab8500: Drop AB8540/9540 support Date: Thu, 22 Mar 2018 11:24:35 +0100 Message-Id: <20180322102435.10240-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The AB8540 was an evolved version of the AB8500, but it was never mass produced or put into products, only reference designs exist. The upstream support was never completed and it is unlikely that this will happen so drop the support for now to simplify maintenance of the AB8500. Cc: Lee Jones Cc: Loic Pallardy Signed-off-by: Linus Walleij --- Lee: this hits some MFD-namespaced includes, so an ACK would be nice. I do not expect conflicts with MFD, as I plan to remove the AB8540 from the MFD only next merge window. --- drivers/power/supply/ab8500_bmdata.c | 63 -------------- drivers/power/supply/ab8500_btemp.c | 93 ++++----------------- drivers/power/supply/ab8500_charger.c | 131 ++---------------------------- drivers/power/supply/ab8500_fg.c | 12 +-- drivers/power/supply/abx500_chargalg.c | 62 -------------- include/linux/mfd/abx500.h | 1 - include/linux/mfd/abx500/ab8500-bm.h | 2 - include/linux/mfd/abx500/ux500_chargalg.h | 4 - 8 files changed, 30 insertions(+), 338 deletions(-) -- 2.14.3 Acked-by: Lee Jones diff --git a/drivers/power/supply/ab8500_bmdata.c b/drivers/power/supply/ab8500_bmdata.c index 4a7ed50d1dc5..7b2b69916f48 100644 --- a/drivers/power/supply/ab8500_bmdata.c +++ b/drivers/power/supply/ab8500_bmdata.c @@ -430,13 +430,6 @@ static const struct abx500_maxim_parameters ab8500_maxi_params = { .charger_curr_step = 100, }; -static const struct abx500_maxim_parameters abx540_maxi_params = { - .ena_maxi = true, - .chg_curr = 3000, - .wait_cycles = 10, - .charger_curr_step = 200, -}; - static const struct abx500_bm_charger_parameters chg = { .usb_volt_max = 5500, .usb_curr_max = 1500, @@ -453,17 +446,6 @@ static int ab8500_charge_output_curr_map[] = { 900, 1000, 1100, 1200, 1300, 1400, 1500, 1500, }; -static int ab8540_charge_output_curr_map[] = { - 0, 0, 0, 75, 100, 125, 150, 175, - 200, 225, 250, 275, 300, 325, 350, 375, - 400, 425, 450, 475, 500, 525, 550, 575, - 600, 625, 650, 675, 700, 725, 750, 775, - 800, 825, 850, 875, 900, 925, 950, 975, - 1000, 1025, 1050, 1075, 1100, 1125, 1150, 1175, - 1200, 1225, 1250, 1275, 1300, 1325, 1350, 1375, - 1400, 1425, 1450, 1500, 1600, 1700, 1900, 2000, -}; - /* * This array maps the raw hex value to charger input current used by the * AB8500 values @@ -473,17 +455,6 @@ static int ab8500_charge_input_curr_map[] = { 700, 800, 900, 1000, 1100, 1300, 1400, 1500, }; -static int ab8540_charge_input_curr_map[] = { - 25, 50, 75, 100, 125, 150, 175, 200, - 225, 250, 275, 300, 325, 350, 375, 400, - 425, 450, 475, 500, 525, 550, 575, 600, - 625, 650, 675, 700, 725, 750, 775, 800, - 825, 850, 875, 900, 925, 950, 975, 1000, - 1025, 1050, 1075, 1100, 1125, 1150, 1175, 1200, - 1225, 1250, 1275, 1300, 1325, 1350, 1375, 1400, - 1425, 1450, 1475, 1500, 1500, 1500, 1500, 1500, -}; - struct abx500_bm_data ab8500_bm_data = { .temp_under = 3, .temp_low = 8, @@ -518,40 +489,6 @@ struct abx500_bm_data ab8500_bm_data = { .n_chg_in_curr = ARRAY_SIZE(ab8500_charge_input_curr_map), }; -struct abx500_bm_data ab8540_bm_data = { - .temp_under = 3, - .temp_low = 8, - .temp_high = 43, - .temp_over = 48, - .main_safety_tmr_h = 4, - .temp_interval_chg = 20, - .temp_interval_nochg = 120, - .usb_safety_tmr_h = 4, - .bkup_bat_v = BUP_VCH_SEL_2P6V, - .bkup_bat_i = BUP_ICH_SEL_150UA, - .no_maintenance = false, - .capacity_scaling = false, - .adc_therm = ABx500_ADC_THERM_BATCTRL, - .chg_unknown_bat = false, - .enable_overshoot = false, - .fg_res = 100, - .cap_levels = &cap_levels, - .bat_type = bat_type_thermistor, - .n_btypes = ARRAY_SIZE(bat_type_thermistor), - .batt_id = 0, - .interval_charging = 5, - .interval_not_charging = 120, - .temp_hysteresis = 3, - .gnd_lift_resistance = 0, - .maxi = &abx540_maxi_params, - .chg_params = &chg, - .fg_params = &fg, - .chg_output_curr = ab8540_charge_output_curr_map, - .n_chg_out_curr = ARRAY_SIZE(ab8540_charge_output_curr_map), - .chg_input_curr = ab8540_charge_input_curr_map, - .n_chg_in_curr = ARRAY_SIZE(ab8540_charge_input_curr_map), -}; - int ab8500_bm_of_probe(struct device *dev, struct device_node *np, struct abx500_bm_data *bm) diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index f7a35ebfbab2..708fd58cd62b 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c @@ -214,22 +214,10 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, /* Only do this for batteries with internal NTC */ if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) { - if (is_ab8540(di->parent)) { - if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_60UA) - curr = BAT_CTRL_60U_ENA; - else - curr = BAT_CTRL_120U_ENA; - } else if (is_ab9540(di->parent) || is_ab8505(di->parent)) { - if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_16UA) - curr = BAT_CTRL_16U_ENA; - else - curr = BAT_CTRL_18U_ENA; - } else { - if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA) - curr = BAT_CTRL_7U_ENA; - else - curr = BAT_CTRL_20U_ENA; - } + if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA) + curr = BAT_CTRL_7U_ENA; + else + curr = BAT_CTRL_20U_ENA; dev_dbg(di->dev, "Set BATCTRL %duA\n", di->curr_source); @@ -260,28 +248,12 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, } else if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) { dev_dbg(di->dev, "Disable BATCTRL curr source\n"); - if (is_ab8540(di->parent)) { - /* Write 0 to the curr bits */ - ret = abx500_mask_and_set_register_interruptible( - di->dev, - AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, - BAT_CTRL_60U_ENA | BAT_CTRL_120U_ENA, - ~(BAT_CTRL_60U_ENA | BAT_CTRL_120U_ENA)); - } else if (is_ab9540(di->parent) || is_ab8505(di->parent)) { - /* Write 0 to the curr bits */ - ret = abx500_mask_and_set_register_interruptible( - di->dev, - AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, - BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA, - ~(BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA)); - } else { - /* Write 0 to the curr bits */ - ret = abx500_mask_and_set_register_interruptible( - di->dev, - AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, - BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA, - ~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA)); - } + /* Write 0 to the curr bits */ + ret = abx500_mask_and_set_register_interruptible( + di->dev, + AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, + BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA, + ~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA)); if (ret) { dev_err(di->dev, "%s failed disabling current source\n", @@ -324,25 +296,11 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, * if we got an error above */ disable_curr_source: - if (is_ab8540(di->parent)) { - /* Write 0 to the curr bits */ - ret = abx500_mask_and_set_register_interruptible(di->dev, - AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, - BAT_CTRL_60U_ENA | BAT_CTRL_120U_ENA, - ~(BAT_CTRL_60U_ENA | BAT_CTRL_120U_ENA)); - } else if (is_ab9540(di->parent) || is_ab8505(di->parent)) { - /* Write 0 to the curr bits */ - ret = abx500_mask_and_set_register_interruptible(di->dev, - AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, - BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA, - ~(BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA)); - } else { - /* Write 0 to the curr bits */ - ret = abx500_mask_and_set_register_interruptible(di->dev, - AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, - BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA, - ~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA)); - } + /* Write 0 to the curr bits */ + ret = abx500_mask_and_set_register_interruptible(di->dev, + AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, + BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA, + ~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA)); if (ret) { dev_err(di->dev, "%s failed disabling current source\n", @@ -556,13 +514,8 @@ static int ab8500_btemp_id(struct ab8500_btemp *di) { int res; u8 i; - if (is_ab8540(di->parent)) - di->curr_source = BTEMP_BATCTRL_CURR_SRC_60UA; - else if (is_ab9540(di->parent) || is_ab8505(di->parent)) - di->curr_source = BTEMP_BATCTRL_CURR_SRC_16UA; - else - di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA; + di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA; di->bm->batt_id = BATTERY_UNKNOWN; res = ab8500_btemp_get_batctrl_res(di); @@ -600,18 +553,8 @@ static int ab8500_btemp_id(struct ab8500_btemp *di) */ if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && di->bm->batt_id == 1) { - if (is_ab8540(di->parent)) { - dev_dbg(di->dev, - "Set BATCTRL current source to 60uA\n"); - di->curr_source = BTEMP_BATCTRL_CURR_SRC_60UA; - } else if (is_ab9540(di->parent) || is_ab8505(di->parent)) { - dev_dbg(di->dev, - "Set BATCTRL current source to 16uA\n"); - di->curr_source = BTEMP_BATCTRL_CURR_SRC_16UA; - } else { - dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n"); - di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA; - } + dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n"); + di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA; } return di->bm->batt_id; diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index 5a76c6d343de..ba0e97284ae5 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -58,9 +58,7 @@ #define MAIN_CH_INPUT_CURR_SHIFT 4 #define VBUS_IN_CURR_LIM_SHIFT 4 -#define AB8540_VBUS_IN_CURR_LIM_SHIFT 2 #define AUTO_VBUS_IN_CURR_LIM_SHIFT 4 -#define AB8540_AUTO_VBUS_IN_CURR_MASK 0x3F #define VBUS_IN_CURR_LIM_RETRY_SET_TIME 30 /* seconds */ #define LED_INDICATOR_PWM_ENA 0x01 @@ -1138,10 +1136,7 @@ static int ab8500_charger_set_current(struct ab8500_charger *di, no_stepping = true; break; case AB8500_USBCH_IPT_CRNTLVL_REG: - if (is_ab8540(di->parent)) - shift_value = AB8540_VBUS_IN_CURR_LIM_SHIFT; - else - shift_value = VBUS_IN_CURR_LIM_SHIFT; + shift_value = VBUS_IN_CURR_LIM_SHIFT; prev_curr_index = (reg_value >> shift_value); curr_index = ab8500_vbus_in_curr_to_regval(di, ich); step_udelay = STEP_UDELAY * 100; @@ -1865,67 +1860,6 @@ static int ab8500_charger_update_charger_current(struct ux500_charger *charger, return ret; } -/** - * ab8540_charger_power_path_enable() - enable usb power path mode - * @charger: pointer to the ux500_charger structure - * @enable: enable/disable flag - * - * Enable or disable the power path for usb mode - * Returns error code in case of failure else 0(on success) - */ -static int ab8540_charger_power_path_enable(struct ux500_charger *charger, - bool enable) -{ - int ret; - struct ab8500_charger *di; - - if (charger->psy->desc->type == POWER_SUPPLY_TYPE_USB) - di = to_ab8500_charger_usb_device_info(charger); - else - return -ENXIO; - - ret = abx500_mask_and_set_register_interruptible(di->dev, - AB8500_CHARGER, AB8540_USB_PP_MODE_REG, - BUS_POWER_PATH_MODE_ENA, enable); - if (ret) { - dev_err(di->dev, "%s write failed\n", __func__); - return ret; - } - - return ret; -} - - -/** - * ab8540_charger_usb_pre_chg_enable() - enable usb pre change - * @charger: pointer to the ux500_charger structure - * @enable: enable/disable flag - * - * Enable or disable the pre-chage for usb mode - * Returns error code in case of failure else 0(on success) - */ -static int ab8540_charger_usb_pre_chg_enable(struct ux500_charger *charger, - bool enable) -{ - int ret; - struct ab8500_charger *di; - - if (charger->psy->desc->type == POWER_SUPPLY_TYPE_USB) - di = to_ab8500_charger_usb_device_info(charger); - else - return -ENXIO; - - ret = abx500_mask_and_set_register_interruptible(di->dev, - AB8500_CHARGER, AB8540_USB_PP_CHR_REG, - BUS_POWER_PATH_PRECHG_ENA, enable); - if (ret) { - dev_err(di->dev, "%s write failed\n", __func__); - return ret; - } - - return ret; -} - static int ab8500_charger_get_ext_psy_data(struct device *dev, void *data) { struct power_supply *psy; @@ -2704,23 +2638,15 @@ static void ab8500_charger_vbus_drop_end_work(struct work_struct *work) abx500_set_register_interruptible(di->dev, AB8500_CHARGER, AB8500_CHARGER_CTRL, 0x01); - if (is_ab8540(di->parent)) - ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, - AB8540_CH_USBCH_STAT3_REG, ®_value); - else - ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, - AB8500_CH_USBCH_STAT2_REG, ®_value); + ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, + AB8500_CH_USBCH_STAT2_REG, ®_value); if (ret < 0) { dev_err(di->dev, "%s read failed\n", __func__); return; } - if (is_ab8540(di->parent)) - curr = di->bm->chg_input_curr[ - reg_value & AB8540_AUTO_VBUS_IN_CURR_MASK]; - else - curr = di->bm->chg_input_curr[ - reg_value >> AUTO_VBUS_IN_CURR_LIM_SHIFT]; + curr = di->bm->chg_input_curr[ + reg_value >> AUTO_VBUS_IN_CURR_LIM_SHIFT]; if (di->max_usb_in_curr.calculated_max != curr) { /* USB source is collapsing */ @@ -3097,14 +3023,9 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) goto out; } - if (is_ab8540(di->parent)) - ret = abx500_set_register_interruptible(di->dev, - AB8500_CHARGER, AB8500_CH_OPT_CRNTLVL_MAX_REG, - CH_OP_CUR_LVL_2P); - else - ret = abx500_set_register_interruptible(di->dev, - AB8500_CHARGER, AB8500_CH_OPT_CRNTLVL_MAX_REG, - CH_OP_CUR_LVL_1P6); + ret = abx500_set_register_interruptible(di->dev, + AB8500_CHARGER, AB8500_CH_OPT_CRNTLVL_MAX_REG, + CH_OP_CUR_LVL_1P6); if (ret) { dev_err(di->dev, "failed to set CH_OPT_CRNTLVL_MAX_REG\n"); @@ -3112,8 +3033,7 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) } } - if (is_ab9540_2p0(di->parent) || is_ab9540_3p0(di->parent) - || is_ab8505_2p0(di->parent) || is_ab8540(di->parent)) + if (is_ab8505_2p0(di->parent)) ret = abx500_mask_and_set_register_interruptible(di->dev, AB8500_CHARGER, AB8500_USBCH_CTRL2_REG, @@ -3205,17 +3125,6 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) dev_err(di->dev, "failed to setup backup battery charging\n"); goto out; } - if (is_ab8540(di->parent)) { - ret = abx500_set_register_interruptible(di->dev, - AB8500_RTC, - AB8500_RTC_CTRL1_REG, - bup_vch_range | vbup33_vrtcn); - if (ret) { - dev_err(di->dev, - "failed to setup backup battery charging\n"); - goto out; - } - } /* Enable backup battery charging */ ret = abx500_mask_and_set_register_interruptible(di->dev, @@ -3226,25 +3135,6 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) goto out; } - if (is_ab8540(di->parent)) { - ret = abx500_mask_and_set_register_interruptible(di->dev, - AB8500_CHARGER, AB8540_USB_PP_MODE_REG, - BUS_VSYS_VOL_SELECT_MASK, BUS_VSYS_VOL_SELECT_3P6V); - if (ret) { - dev_err(di->dev, - "failed to setup usb power path vsys voltage\n"); - goto out; - } - ret = abx500_mask_and_set_register_interruptible(di->dev, - AB8500_CHARGER, AB8540_USB_PP_CHR_REG, - BUS_PP_PRECHG_CURRENT_MASK, 0); - if (ret) { - dev_err(di->dev, - "failed to setup usb power path precharge current\n"); - goto out; - } - } - out: return ret; } @@ -3529,8 +3419,6 @@ static int ab8500_charger_probe(struct platform_device *pdev) di->usb_chg.ops.check_enable = &ab8500_charger_usb_check_enable; di->usb_chg.ops.kick_wd = &ab8500_charger_watchdog_kick; di->usb_chg.ops.update_curr = &ab8500_charger_update_charger_current; - di->usb_chg.ops.pp_enable = &ab8540_charger_power_path_enable; - di->usb_chg.ops.pre_chg_enable = &ab8540_charger_usb_pre_chg_enable; di->usb_chg.max_out_volt = ab8500_charger_voltage_map[ ARRAY_SIZE(ab8500_charger_voltage_map) - 1]; di->usb_chg.max_out_curr = @@ -3538,7 +3426,6 @@ static int ab8500_charger_probe(struct platform_device *pdev) di->usb_chg.wdt_refresh = CHG_WD_INTERVAL; di->usb_chg.enabled = di->bm->usb_enabled; di->usb_chg.external = false; - di->usb_chg.power_path = di->bm->usb_power_path; di->usb_state.usb_current = -1; /* Create a work queue for the charger */ diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index c569f82a0071..d83e5d8bfc7b 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -2326,9 +2326,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di) goto out; } - if (((is_ab8505(di->parent) || is_ab9540(di->parent)) && - abx500_get_chip_id(di->dev) >= AB8500_CUT2P0) - || is_ab8540(di->parent)) { + if (is_ab8505(di->parent)) { ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, AB8505_RTC_PCUT_MAX_TIME_REG, di->bm->fg_params->pcut_max_time); @@ -2915,9 +2913,7 @@ static int ab8500_fg_sysfs_psy_create_attrs(struct ab8500_fg *di) { unsigned int i; - if (((is_ab8505(di->parent) || is_ab9540(di->parent)) && - abx500_get_chip_id(di->dev) >= AB8500_CUT2P0) - || is_ab8540(di->parent)) { + if (is_ab8505(di->parent)) { for (i = 0; i < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); i++) if (device_create_file(&di->fg_psy->dev, &ab8505_fg_sysfs_psy_attrs[i])) @@ -2937,9 +2933,7 @@ static void ab8500_fg_sysfs_psy_remove_attrs(struct ab8500_fg *di) { unsigned int i; - if (((is_ab8505(di->parent) || is_ab9540(di->parent)) && - abx500_get_chip_id(di->dev) >= AB8500_CUT2P0) - || is_ab8540(di->parent)) { + if (is_ab8505(di->parent)) { for (i = 0; i < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); i++) (void)device_remove_file(&di->fg_psy->dev, &ab8505_fg_sysfs_psy_attrs[i]); diff --git a/drivers/power/supply/abx500_chargalg.c b/drivers/power/supply/abx500_chargalg.c index a4411d6bbc96..947709cdd14e 100644 --- a/drivers/power/supply/abx500_chargalg.c +++ b/drivers/power/supply/abx500_chargalg.c @@ -44,9 +44,6 @@ /* Five minutes expressed in seconds */ #define FIVE_MINUTES_IN_SECONDS 300 -/* Plus margin for the low battery threshold */ -#define BAT_PLUS_MARGIN (100) - #define CHARGALG_CURR_STEP_LOW 0 #define CHARGALG_CURR_STEP_HIGH 100 @@ -101,7 +98,6 @@ enum abx500_chargalg_states { STATE_HW_TEMP_PROTECT_INIT, STATE_HW_TEMP_PROTECT, STATE_NORMAL_INIT, - STATE_USB_PP_PRE_CHARGE, STATE_NORMAL, STATE_WAIT_FOR_RECHARGE_INIT, STATE_WAIT_FOR_RECHARGE, @@ -133,7 +129,6 @@ static const char *states[] = { "HW_TEMP_PROTECT_INIT", "HW_TEMP_PROTECT", "NORMAL_INIT", - "USB_PP_PRE_CHARGE", "NORMAL", "WAIT_FOR_RECHARGE_INIT", "WAIT_FOR_RECHARGE", @@ -603,37 +598,6 @@ static int abx500_chargalg_usb_en(struct abx500_chargalg *di, int enable, return di->usb_chg->ops.enable(di->usb_chg, enable, vset, iset); } - /** - * ab8540_chargalg_usb_pp_en() - Enable/ disable USB power path - * @di: pointer to the abx500_chargalg structure - * @enable: power path enable/disable - * - * The USB power path will be enable/ disable - */ -static int ab8540_chargalg_usb_pp_en(struct abx500_chargalg *di, bool enable) -{ - if (!di->usb_chg || !di->usb_chg->ops.pp_enable) - return -ENXIO; - - return di->usb_chg->ops.pp_enable(di->usb_chg, enable); -} - -/** - * ab8540_chargalg_usb_pre_chg_en() - Enable/ disable USB pre-charge - * @di: pointer to the abx500_chargalg structure - * @enable: USB pre-charge enable/disable - * - * The USB USB pre-charge will be enable/ disable - */ -static int ab8540_chargalg_usb_pre_chg_en(struct abx500_chargalg *di, - bool enable) -{ - if (!di->usb_chg || !di->usb_chg->ops.pre_chg_enable) - return -ENXIO; - - return di->usb_chg->ops.pre_chg_enable(di->usb_chg, enable); -} - /** * abx500_chargalg_update_chg_curr() - Update charger current * @di: pointer to the abx500_chargalg structure @@ -833,9 +797,6 @@ static void abx500_chargalg_end_of_charge(struct abx500_chargalg *di) di->batt_data.avg_curr > 0) { if (++di->eoc_cnt >= EOC_COND_CNT) { di->eoc_cnt = 0; - if ((di->chg_info.charger_type & USB_CHG) && - (di->usb_chg->power_path)) - ab8540_chargalg_usb_pp_en(di, true); di->charge_status = POWER_SUPPLY_STATUS_FULL; di->maintenance_chg = true; dev_dbg(di->dev, "EOC reached!\n"); @@ -1536,22 +1497,6 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) break; case STATE_NORMAL_INIT: - if ((di->chg_info.charger_type & USB_CHG) && - di->usb_chg->power_path) { - if (di->batt_data.volt > - (di->bm->fg_params->lowbat_threshold + - BAT_PLUS_MARGIN)) { - ab8540_chargalg_usb_pre_chg_en(di, false); - ab8540_chargalg_usb_pp_en(di, false); - } else { - ab8540_chargalg_usb_pp_en(di, true); - ab8540_chargalg_usb_pre_chg_en(di, true); - abx500_chargalg_state_to(di, - STATE_USB_PP_PRE_CHARGE); - break; - } - } - if (di->curr_status.curr_step == CHARGALG_CURR_STEP_LOW) abx500_chargalg_stop_charging(di); else { @@ -1575,13 +1520,6 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) break; - case STATE_USB_PP_PRE_CHARGE: - if (di->batt_data.volt > - (di->bm->fg_params->lowbat_threshold + - BAT_PLUS_MARGIN)) - abx500_chargalg_state_to(di, STATE_NORMAL_INIT); - break; - case STATE_NORMAL: handle_maxim_chg_curr(di); if (di->charge_status == POWER_SUPPLY_STATUS_FULL && diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 44412c9d26e1..aa09414756db 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -271,7 +271,6 @@ struct abx500_bm_data { bool autopower_cfg; bool ac_enabled; bool usb_enabled; - bool usb_power_path; bool no_maintenance; bool capacity_scaling; bool chg_unknown_bat; diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index e63681eb6c62..c06daf3d490a 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h @@ -248,8 +248,6 @@ enum bup_vch_sel { #define BAT_CTRL_20U_ENA 0x02 #define BAT_CTRL_18U_ENA 0x01 #define BAT_CTRL_16U_ENA 0x02 -#define BAT_CTRL_60U_ENA 0x01 -#define BAT_CTRL_120U_ENA 0x02 #define BAT_CTRL_CMP_ENA 0x04 #define FORCE_BAT_CTRL_CMP_HIGH 0x08 #define BAT_CTRL_PULL_UP_ENA 0x10 diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h index 67703f23e7ba..669894f434f5 100644 --- a/include/linux/mfd/abx500/ux500_chargalg.h +++ b/include/linux/mfd/abx500/ux500_chargalg.h @@ -25,8 +25,6 @@ struct ux500_charger_ops { int (*check_enable) (struct ux500_charger *, int, int); int (*kick_wd) (struct ux500_charger *); int (*update_curr) (struct ux500_charger *, int); - int (*pp_enable) (struct ux500_charger *, bool); - int (*pre_chg_enable) (struct ux500_charger *, bool); }; /** @@ -37,7 +35,6 @@ struct ux500_charger_ops { * @max_out_curr maximum output charger current in mA * @enabled indicates if this charger is used or not * @external external charger unit (pm2xxx) - * @power_path USB power path support */ struct ux500_charger { struct power_supply *psy; @@ -47,7 +44,6 @@ struct ux500_charger { int wdt_refresh; bool enabled; bool external; - bool power_path; }; extern struct blocking_notifier_head charger_notifier_list;