Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1308542ybg; Fri, 18 Oct 2019 15:38:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqykl7CpOn5yaJOKFFI7lCaQE7lXwJPr1k7htWWPllhaia8Us3XFFgN54Xh6X9x7opZFDxgL X-Received: by 2002:a50:8dc5:: with SMTP id s5mr12277838edh.115.1571438290744; Fri, 18 Oct 2019 15:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571438290; cv=none; d=google.com; s=arc-20160816; b=oarbjU2NuJrd4pHKOODgbvZIrde2OMh/EknX655kmV+T+GXA8qwJU0nXya5lq6PbtY 2Khvs8vDGzPf2Q7pHDsyLnDqTqEj+/G34wX5bvITrrZyp/kFoCYqi5aWcOg8JLR+jqsX /+KEDrmCpNRmlxtqskbFTRReAjEKXzEpnYik6B8nzPILBozBSDjO0Z84tsIc5AMl1rVM HoopFQHi8vvC9zDy2GhtPpBa78AzCDpvDw40tdxs8b8uhRm/uwymttiAsjHTATwQMaKo UC4JKYCaJyOZzmgD+Ppv00QdS+2fFVCBS0pR5nX/Db6eZN6+xQ0HAXorueQ9RfZxfs+E DcEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jDq5W42aFu1uYq0Wf8hvxLigwHa6+BiXckCc47UbuNo=; b=dWS/zoqI6EPUPzsujfq8+PPWGaE2xq0FQMS/MgvDryJMHDXdtfAMCovhdMajw3jhl6 auB2zPA7riZb6t3bJabtZMW8CYvASAKcre3ZRATspeeRgEAArVSNmz5Rc3NE9AKZ6wJW VXmccP545wzG3NZ6gLs5l4y5igKxawe2x8YAE7ec1GZiI3NZ0GO7dI3S2IWZkE9bjyO2 MGL9oYhT+42Si271SmuGbjh9/JjQ5jfsze9zz9pXDnpTsbFrkkniQIavyLnkF70DEIX3 6DJh5UkpmoPvNfSvVf27tq/f2V8oX47Zkkd1sQHkj0R6zUt0NUDF9vRu+DEdWQHkG4lH 63bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pwVGwpyv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 d32si4978484eda.266.2019.10.18.15.37.47; Fri, 18 Oct 2019 15:38:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=pwVGwpyv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S2438380AbfJRFYL (ORCPT + 99 others); Fri, 18 Oct 2019 01:24:11 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:39793 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395042AbfJRFYK (ORCPT ); Fri, 18 Oct 2019 01:24:10 -0400 Received: by mail-pf1-f195.google.com with SMTP id v4so3112736pff.6 for ; Thu, 17 Oct 2019 22:24:10 -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=jDq5W42aFu1uYq0Wf8hvxLigwHa6+BiXckCc47UbuNo=; b=pwVGwpyvQv+pshWx85LTbypti0ekQXXbxw/w/zZDphsXBvkSuLrySfri6X+lvRjV7h nClLK/yOUe7XNSihPqlLnE94DyXPhNlUmpufyT5aTtKMpbsDctNH9upkqD0akX9BaghO nva/hRKa/F2qh8c5AHFeNg/SJYT7fStW+H0c7oEZlONcl3bPHhCVVqMS1/MB+OCE2EqJ 2SdnSUZcub8AxIvp1baJmgKYKpaJPEjWFFf6oe8QcG/FIzl/Wh/Lb4C0j+B+xYfGsvVJ gY95+KKx0ad0wMuuD/8V2Q8n1uw9BqYeYwehpOXYbWqVzpyGArmAmWC1Pp3tm0VhLdK3 lCHg== 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=jDq5W42aFu1uYq0Wf8hvxLigwHa6+BiXckCc47UbuNo=; b=NvqrjdP/2+ufGWKYPc7YWET75qifrrbKMN9wQ7LV52CqVvQT9h+X66JEPa1WeJA6UG Qv+wOeqxY4OHUN2FdmMlN6P4ox1KNOl2cRipwBNQ4Jf5UfQubrYy3zrgme7jJf1V0+jS j1/y6N/AuSFrAwDXAyzsPrehTvBKG2v81+BkWsikcAux2Dkm9gXvB9gIqyTUQ4iqhl2d QOeBS9UKPjw+e1VAkmpY+qm40oSeUGCZuO0ySNY2CfKNBQlLfcHQgcuHqReNb8Jk8uxQ zPe0ohHGPrSqCO3Ob53c5TnkVsWnY2+VLp7Gi1xzd8f2EiN+xkp7VkKLCyAbbqHgch/q vUgg== X-Gm-Message-State: APjAAAWl10GxJiMmFuVeyR+twa/1OY3TE4fLdSkKoV4pW9wuf2yZZ30v vSa/t0qSUTVM56Y72wKZm0EQYA== X-Received: by 2002:a62:1a15:: with SMTP id a21mr4491058pfa.5.1571376249793; Thu, 17 Oct 2019 22:24:09 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id u11sm2178760pgc.61.2019.10.17.22.24.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 22:24:09 -0700 (PDT) From: Bjorn Andersson To: Marcel Holtmann , Johan Hedberg Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffrey Hugo , linux-arm-msm@vger.kernel.org Subject: [PATCH 1/4] Bluetooth: hci_qca: Update regulator_set_load() usage Date: Thu, 17 Oct 2019 22:24:01 -0700 Message-Id: <20191018052405.3693555-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191018052405.3693555-1-bjorn.andersson@linaro.org> References: <20191018052405.3693555-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the introduction of '5451781dadf8 ("regulator: core: Only count load for enabled consumers")' in v5.0, the requested load of a regulator consumer is only accounted for when said consumer is voted enabled. So there's no need to vote for load ever time the regulator is enabled or disabled. Signed-off-by: Bjorn Andersson --- drivers/bluetooth/hci_qca.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index e3164c200eac..c07c529b0d81 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1393,13 +1393,6 @@ static int qca_enable_regulator(struct qca_vreg vregs, if (ret) return ret; - if (vregs.load_uA) - ret = regulator_set_load(regulator, - vregs.load_uA); - - if (ret) - return ret; - return regulator_enable(regulator); } @@ -1409,8 +1402,6 @@ static void qca_disable_regulator(struct qca_vreg vregs, { regulator_disable(regulator); regulator_set_voltage(regulator, 0, vregs.max_uV); - if (vregs.load_uA) - regulator_set_load(regulator, 0); } @@ -1462,18 +1453,30 @@ static int qca_power_setup(struct hci_uart *hu, bool on) static int qca_init_regulators(struct qca_power *qca, const struct qca_vreg *vregs, size_t num_vregs) { + struct regulator_bulk_data *bulk; + int ret; int i; - qca->vreg_bulk = devm_kcalloc(qca->dev, num_vregs, - sizeof(struct regulator_bulk_data), - GFP_KERNEL); - if (!qca->vreg_bulk) + bulk = devm_kcalloc(qca->dev, num_vregs, sizeof(*bulk), GFP_KERNEL); + if (!bulk) return -ENOMEM; for (i = 0; i < num_vregs; i++) - qca->vreg_bulk[i].supply = vregs[i].name; + bulk[i].supply = vregs[i].name; + + ret = devm_regulator_bulk_get(qca->dev, num_vregs, bulk); + if (ret < 0) + return ret; - return devm_regulator_bulk_get(qca->dev, num_vregs, qca->vreg_bulk); + for (i = 0; i < num_vregs; i++) { + ret = regulator_set_load(bulk[i].consumer, vregs[i].load_uA); + if (ret) + return ret; + } + + qca->vreg_bulk = bulk; + + return 0; } static int qca_serdev_probe(struct serdev_device *serdev) -- 2.23.0