From patchwork Thu Dec 7 13:06:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 751252 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Akh1dCwl" Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E65810E9 for ; Thu, 7 Dec 2023 05:07:08 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-50bf37fd2bbso853610e87.0 for ; Thu, 07 Dec 2023 05:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701954427; x=1702559227; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yLKGJjqVnU2Wm3Zgin7pA30JtWvao8SZmntEz34aPKQ=; b=Akh1dCwlDcrtKCApTT6PneXu4s2/ts4uOnJgXeSgMOO7Gcm/QGAYui5JCqQMW4j4o2 ejZLtfD9Od12r+HuUfYr0aGT0ovEPfgyKukji7meP0vgsXRpcUfIoCShYuNwpTg0QWAN buKVg1ELEetLWHHvyKAjrsxBbkuj1jyCt/WUnFMOw+V5Q400ZI10OnkeWxWyDJ7ENnkI 4jscXExq1pcXAH182V49rKCd5llp+j0e4sfQjDZKhDvpDKXiglsJohnSeJNCghLO/bA2 1KmqGogh06u2TNsy+SJ86kYYxq5g1zCGNhk+UfkvPaXmB7GhLwPwOBc2aows+LrMsrnj dIlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701954427; x=1702559227; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yLKGJjqVnU2Wm3Zgin7pA30JtWvao8SZmntEz34aPKQ=; b=L7qwP1dukT8/Osg7AIZUKT6zSnNXjS5UyV5eBlEUyksR2EhVTHVILEnStzl4ZwvGFf WvIwvFxsNQ1huxREWU9V5ZfQv/o8UgLhpUW04qp3BNORM8Ow4r8f04JINmRqg93cUhBR O1CEl1ySEzpdVLgI99h2WUGWPsS2cdiQUg04RztnMd9LGH0suUBjE4jZcj8RzNL3xEaq NFWd0HRsqHzE68hdyT+2BIOyY38syAe0SzPUU1skQ+ltBp2LBmpanqIOkxDGNLG2P5mk 5K0EGjYha632e4G738x+9emvqoLK0Ka/aTJkEffqA44Bc8XROQSgnDN+2/IupUW6Prw5 bdbg== X-Gm-Message-State: AOJu0Yx6/pUOsyHIlFmzYI8gyMqn4lxTurDUAIbtgu09RuxUHDBgLjgj Y/Nf7IKqXcYr6skWCp7dIuu71g== X-Google-Smtp-Source: AGHT+IGZ5PJupehTovqOBieFi4dd1mejoSpUIVv6UVfHefiU0RDKcsrTORGCYbNq7uWsVG8pvQADRg== X-Received: by 2002:a05:6512:ad5:b0:50c:1bc5:6a73 with SMTP id n21-20020a0565120ad500b0050c1bc56a73mr792071lfu.33.1701954426863; Thu, 07 Dec 2023 05:07:06 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j21-20020a056512109500b0050bc41caf04sm167685lfg.304.2023.12.07.05.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 05:07:06 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 03/10] soc: qcom: spm: add support for voltage regulator Date: Thu, 7 Dec 2023 16:06:56 +0300 Message-Id: <20231207130703.3322321-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231207130703.3322321-1-dmitry.baryshkov@linaro.org> References: <20231207130703.3322321-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The SPM / SAW2 device also provides a voltage regulator functionality with optional AVS (Adaptive Voltage Scaling) support. The exact register sequence and voltage ranges differs from device to device. Signed-off-by: Dmitry Baryshkov --- drivers/soc/qcom/spm.c | 221 ++++++++++++++++++++++++++++++++++++++++- include/soc/qcom/spm.h | 9 ++ 2 files changed, 225 insertions(+), 5 deletions(-) diff --git a/drivers/soc/qcom/spm.c b/drivers/soc/qcom/spm.c index 2f0b1bfe7658..595e2afb2141 100644 --- a/drivers/soc/qcom/spm.c +++ b/drivers/soc/qcom/spm.c @@ -6,20 +6,40 @@ * SAW power controller driver */ -#include +#include +#include #include #include +#include +#include +#include #include -#include #include -#include #include +#include +#include + +#include + #include +#define FIELD_SET(current, mask, val) \ + (((current) & ~(mask)) | FIELD_PREP((mask), (val))) + #define SPM_CTL_INDEX 0x7f #define SPM_CTL_INDEX_SHIFT 4 #define SPM_CTL_EN BIT(0) +/* These registers might be specific to SPM 1.1 */ +#define SPM_VCTL_VLVL GENMASK(7, 0) +#define SPM_PMIC_DATA_0_VLVL GENMASK(7, 0) +#define SPM_PMIC_DATA_1_MIN_VSEL GENMASK(5, 0) +#define SPM_PMIC_DATA_1_MAX_VSEL GENMASK(21, 16) + +#define SPM_1_1_AVS_CTL_AVS_ENABLED BIT(27) +#define SPM_AVS_CTL_MAX_VLVL GENMASK(22, 17) +#define SPM_AVS_CTL_MIN_VLVL GENMASK(15, 10) + enum spm_reg { SPM_REG_CFG, SPM_REG_SPM_CTL, @@ -29,10 +49,12 @@ enum spm_reg { SPM_REG_PMIC_DATA_1, SPM_REG_VCTL, SPM_REG_SEQ_ENTRY, - SPM_REG_SPM_STS, + SPM_REG_STS0, + SPM_REG_STS1, SPM_REG_PMIC_STS, SPM_REG_AVS_CTL, SPM_REG_AVS_LIMIT, + SPM_REG_RST, SPM_REG_NR, }; @@ -169,6 +191,10 @@ static const struct spm_reg_data spm_reg_8226_cpu = { static const u16 spm_reg_offset_v1_1[SPM_REG_NR] = { [SPM_REG_CFG] = 0x08, + [SPM_REG_STS0] = 0x0c, + [SPM_REG_STS1] = 0x10, + [SPM_REG_VCTL] = 0x14, + [SPM_REG_AVS_CTL] = 0x18, [SPM_REG_SPM_CTL] = 0x20, [SPM_REG_PMIC_DLY] = 0x24, [SPM_REG_PMIC_DATA_0] = 0x28, @@ -176,7 +202,12 @@ static const u16 spm_reg_offset_v1_1[SPM_REG_NR] = { [SPM_REG_SEQ_ENTRY] = 0x80, }; +static void smp_set_vdd_v1_1(void *data); + /* SPM register data for 8064 */ +static struct linear_range spm_v1_1_regulator_range = + REGULATOR_LINEAR_RANGE(700000, 0, 56, 12500); + static const struct spm_reg_data spm_reg_8064_cpu = { .reg_offset = spm_reg_offset_v1_1, .spm_cfg = 0x1F, @@ -187,6 +218,10 @@ static const struct spm_reg_data spm_reg_8064_cpu = { 0x10, 0x54, 0x30, 0x0C, 0x24, 0x30, 0x0F }, .start_index[PM_SLEEP_MODE_STBY] = 0, .start_index[PM_SLEEP_MODE_SPC] = 2, + .set_vdd = smp_set_vdd_v1_1, + .range = &spm_v1_1_regulator_range, + .init_uV = 1300000, + .ramp_delay = 1250, }; static inline void spm_register_write(struct spm_driver_data *drv, @@ -238,6 +273,181 @@ void spm_set_low_power_mode(struct spm_driver_data *drv, spm_register_write_sync(drv, SPM_REG_SPM_CTL, ctl_val); } +static int spm_set_voltage_sel(struct regulator_dev *rdev, unsigned int selector) +{ + struct spm_driver_data *drv = rdev_get_drvdata(rdev); + + drv->volt_sel = selector; + + /* Always do the SAW register writes on the corresponding CPU */ + return smp_call_function_single(drv->reg_cpu, drv->reg_data->set_vdd, drv, true); +} + +static int spm_get_voltage_sel(struct regulator_dev *rdev) +{ + struct spm_driver_data *drv = rdev_get_drvdata(rdev); + + return drv->volt_sel; +} + +static const struct regulator_ops spm_reg_ops = { + .set_voltage_sel = spm_set_voltage_sel, + .get_voltage_sel = spm_get_voltage_sel, + .list_voltage = regulator_list_voltage_linear_range, + .set_voltage_time_sel = regulator_set_voltage_time_sel, +}; + +static void smp_set_vdd_v1_1(void *data) +{ + struct spm_driver_data *drv = data; + unsigned int vctl, data0, data1, avs_ctl, sts; + unsigned int vlevel, volt_sel; + bool avs_enabled; + + volt_sel = drv->volt_sel; + vlevel = volt_sel | 0x80; /* band */ + + avs_ctl = spm_register_read(drv, SPM_REG_AVS_CTL); + vctl = spm_register_read(drv, SPM_REG_VCTL); + data0 = spm_register_read(drv, SPM_REG_PMIC_DATA_0); + data1 = spm_register_read(drv, SPM_REG_PMIC_DATA_1); + + avs_enabled = avs_ctl & SPM_1_1_AVS_CTL_AVS_ENABLED; + + /* If AVS is enabled, switch it off during the voltage change */ + if (avs_enabled) { + avs_ctl &= ~SPM_1_1_AVS_CTL_AVS_ENABLED; + spm_register_write(drv, SPM_REG_AVS_CTL, avs_ctl); + } + + /* Kick the state machine back to idle */ + spm_register_write(drv, SPM_REG_RST, 1); + + vctl = FIELD_SET(vctl, SPM_VCTL_VLVL, vlevel); + data0 = FIELD_SET(data0, SPM_PMIC_DATA_0_VLVL, vlevel); + data1 = FIELD_SET(data1, SPM_PMIC_DATA_1_MIN_VSEL, volt_sel); + data1 = FIELD_SET(data1, SPM_PMIC_DATA_1_MAX_VSEL, volt_sel); + + spm_register_write(drv, SPM_REG_VCTL, vctl); + spm_register_write(drv, SPM_REG_PMIC_DATA_0, data0); + spm_register_write(drv, SPM_REG_PMIC_DATA_1, data1); + + if (read_poll_timeout_atomic(spm_register_read, + sts, sts == vlevel, + 1, 200, false, + drv, SPM_REG_STS1)) { + dev_err_ratelimited(drv->dev, "timeout setting the voltage (%x %x)!\n", sts, vlevel); + goto enable_avs; + } + + if (avs_enabled) { + unsigned int max_avs = volt_sel; + unsigned int min_avs = max(max_avs, 4U) - 4; + + avs_ctl = FIELD_SET(avs_ctl, SPM_AVS_CTL_MIN_VLVL, min_avs); + avs_ctl = FIELD_SET(avs_ctl, SPM_AVS_CTL_MAX_VLVL, max_avs); + spm_register_write(drv, SPM_REG_AVS_CTL, avs_ctl); + } + +enable_avs: + if (avs_enabled) { + avs_ctl |= SPM_1_1_AVS_CTL_AVS_ENABLED; + spm_register_write(drv, SPM_REG_AVS_CTL, avs_ctl); + } +} + +static int spm_get_cpu(struct device *dev) +{ + int cpu; + bool found; + + for_each_possible_cpu(cpu) { + struct device_node *cpu_node, *saw_node; + + cpu_node = of_cpu_device_node_get(cpu); + if (!cpu_node) + continue; + + saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0); + found = (saw_node == dev->of_node); + of_node_put(saw_node); + of_node_put(cpu_node); + + if (found) + return cpu; + } + + /* L2 SPM is not bound to any CPU, tie it to CPU0 */ + + return 0; +} + +#ifdef CONFIG_REGULATOR +static int spm_register_regulator(struct device *dev, struct spm_driver_data *drv) +{ + struct regulator_config config = { + .dev = dev, + .driver_data = drv, + }; + struct regulator_desc *rdesc; + struct regulator_dev *rdev; + int ret; + bool found; + + if (!drv->reg_data->set_vdd) + return 0; + + rdesc = devm_kzalloc(dev, sizeof(*rdesc), GFP_KERNEL); + if (!rdesc) + return -ENOMEM; + + rdesc->name = "spm"; + rdesc->of_match = of_match_ptr("regulator"); + rdesc->type = REGULATOR_VOLTAGE; + rdesc->owner = THIS_MODULE; + rdesc->ops = &spm_reg_ops; + + rdesc->linear_ranges = drv->reg_data->range; + rdesc->n_linear_ranges = 1; + rdesc->n_voltages = rdesc->linear_ranges[rdesc->n_linear_ranges - 1].max_sel + 1; + rdesc->ramp_delay = drv->reg_data->ramp_delay; + + drv->reg_cpu = spm_get_cpu(dev); + dev_dbg(dev, "SAW2 bound to CPU %d\n", drv->reg_cpu); + + /* + * Program initial voltage, otherwise registration will also try + * setting the voltage, which might result in undervolting the CPU. + */ + drv->volt_sel = DIV_ROUND_UP(drv->reg_data->init_uV - rdesc->min_uV, + rdesc->uV_step); + ret = linear_range_get_selector_high(drv->reg_data->range, + drv->reg_data->init_uV, + &drv->volt_sel, + &found); + if (ret) { + dev_err(dev, "Initial uV value out of bounds\n"); + return ret; + } + + /* Always do the SAW register writes on the corresponding CPU */ + smp_call_function_single(drv->reg_cpu, drv->reg_data->set_vdd, drv, true); + + rdev = devm_regulator_register(dev, rdesc, &config); + if (IS_ERR(rdev)) { + dev_err(dev, "failed to register regulator\n"); + return PTR_ERR(rdev); + } + + return 0; +} +#else +static int spm_register_regulator(struct device *dev, struct spm_driver_data *drv) +{ + return 0; +} +#endif + static const struct of_device_id spm_match_table[] = { { .compatible = "qcom,sdm660-gold-saw2-v4.1-l2", .data = &spm_reg_660_gold_l2 }, @@ -288,6 +498,7 @@ static int spm_dev_probe(struct platform_device *pdev) return -ENODEV; drv->reg_data = match_id->data; + drv->dev = &pdev->dev; platform_set_drvdata(pdev, drv); /* Write the SPM sequences first.. */ @@ -315,7 +526,7 @@ static int spm_dev_probe(struct platform_device *pdev) if (drv->reg_data->reg_offset[SPM_REG_SPM_CTL]) spm_set_low_power_mode(drv, PM_SLEEP_MODE_STBY); - return 0; + return spm_register_regulator(&pdev->dev, drv); } static struct platform_driver spm_driver = { diff --git a/include/soc/qcom/spm.h b/include/soc/qcom/spm.h index 4951f9d8b0bd..9859ebe42003 100644 --- a/include/soc/qcom/spm.h +++ b/include/soc/qcom/spm.h @@ -30,11 +30,20 @@ struct spm_reg_data { u32 avs_limit; u8 seq[MAX_SEQ_DATA]; u8 start_index[PM_SLEEP_MODE_NR]; + + smp_call_func_t set_vdd; + /* for now we support only a single range */ + struct linear_range *range; + unsigned int ramp_delay; + unsigned int init_uV; }; struct spm_driver_data { void __iomem *reg_base; const struct spm_reg_data *reg_data; + struct device *dev; + unsigned int volt_sel; + int reg_cpu; }; void spm_set_low_power_mode(struct spm_driver_data *drv, From patchwork Thu Dec 7 13:06:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 751253 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xq9L9Een" 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 6540010CA for ; Thu, 7 Dec 2023 05:07:09 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-50bf26f8988so785524e87.2 for ; Thu, 07 Dec 2023 05:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701954427; x=1702559227; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9FxxKaDUsdyAhtM0TQDYaT6yIXjFwrV30U0/OXy94P4=; b=xq9L9EenRk+HiKn4VVqr0QgPIIUUAwCBvr2EsPhPCug0+IJ232tbVt94+0LaJP84eh vhCvL1121Cqu/2FDXESrBbFnHBUdQFOU/S/cZhlwe+GvkfTHtLh7BFycT8pAFuDSWAt8 7C1pg4T8jMgD4TvHe1fUlLZW2oLiEmmQxGGz3soNJkVRFJdocsZgMgLQV97VjxHg9Ric I/+y43YcqZOkBnf602ZaUgadxrWbc/IjcFD+TUV3ZYdX5h7Euo7k8HntQTiIWiuifk0M SWT2aBpuLO5XI8X8ZWI5nzDQwUdusadMmkUIOw5trauX/4V1obsTuCwjmw+UYZEat4ei SB6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701954427; x=1702559227; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9FxxKaDUsdyAhtM0TQDYaT6yIXjFwrV30U0/OXy94P4=; b=puRnd1K/c7CiRUmWdaAjlEx+MtDXLFWFTVHPZl0acO3435csaRz099fSroW6uKDmuQ H6gPL2sdsKMnvwTWIOxIk/NKv2HTmnxoHh/fjU0wndUliJmFD39pYiDiJQosVrf2KUNm jbWkQF+7nhdwATVAIDOuCl7Ij0RdloXrN5RCZlca8H57TJBi10Qg/Nnag+ISDyowrym0 E00Go+s+xhPHN1t6VzygbM5Kz1dle1e6fVaylrq1sYMP7VkuwSa0PwJeyH6dR6PPgCPn Q3GnMsWP0+A1M0z+PY1pu+2wDQ7x1IqGf7cQFTFkaqBRGAc/ZDx/qKeXbpkjhMyhbLRX +27Q== X-Gm-Message-State: AOJu0YxRh9RECIH0bN9zJzOKRVB0geOY1BHJr5ra3UTvhDY61/QN5sY5 /3ggldW0v27S/hrnlPxZJa25JQ== X-Google-Smtp-Source: AGHT+IHhksCOb3PhJ9OlFNczzGMelIZBCRQczjZ78/98MKoQf68cK4hKH4s0Jly3EzVz1RczI1gwWQ== X-Received: by 2002:a05:6512:48d9:b0:50b:c3b9:76e1 with SMTP id er25-20020a05651248d900b0050bc3b976e1mr1526075lfb.37.1701954427766; Thu, 07 Dec 2023 05:07:07 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j21-20020a056512109500b0050bc41caf04sm167685lfg.304.2023.12.07.05.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 05:07:07 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 04/10] ARM: dts: qcom: apq8064: rename SAW nodes to power-manager Date: Thu, 7 Dec 2023 16:06:57 +0300 Message-Id: <20231207130703.3322321-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231207130703.3322321-1-dmitry.baryshkov@linaro.org> References: <20231207130703.3322321-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Per the power-domain.yaml, the power-controller node name is reserved for power-domain providers. Rename SAW2 nodes to 'power-manager', the name which is suggested by qcom,spm.yaml Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- arch/arm/boot/dts/qcom/qcom-apq8064.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi index 95ac25e1a3b4..6832030c2c88 100644 --- a/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi +++ b/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi @@ -365,25 +365,25 @@ acc3: clock-controller@20b8000 { #clock-cells = <0>; }; - saw0: power-controller@2089000 { + saw0: power-manager@2089000 { compatible = "qcom,apq8064-saw2-v1.1-cpu", "qcom,saw2"; reg = <0x02089000 0x1000>, <0x02009000 0x1000>; regulator; }; - saw1: power-controller@2099000 { + saw1: power-manager@2099000 { compatible = "qcom,apq8064-saw2-v1.1-cpu", "qcom,saw2"; reg = <0x02099000 0x1000>, <0x02009000 0x1000>; regulator; }; - saw2: power-controller@20a9000 { + saw2: power-manager@20a9000 { compatible = "qcom,apq8064-saw2-v1.1-cpu", "qcom,saw2"; reg = <0x020a9000 0x1000>, <0x02009000 0x1000>; regulator; }; - saw3: power-controller@20b9000 { + saw3: power-manager@20b9000 { compatible = "qcom,apq8064-saw2-v1.1-cpu", "qcom,saw2"; reg = <0x020b9000 0x1000>, <0x02009000 0x1000>; regulator; From patchwork Thu Dec 7 13:06:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 751250 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="noT1QQ5J" Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CF6610E4 for ; Thu, 7 Dec 2023 05:07:11 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50be03cc8a3so846344e87.1 for ; Thu, 07 Dec 2023 05:07:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701954429; x=1702559229; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tRH0ltu/8xOeCYgi26zDqsTtGrYZ67tsC2xGcsHS4PY=; b=noT1QQ5JvJmco7Zx2DiaCaQZEPhdmbywAujcKJRNc6oUydwpcrLlDHpyvdfuhuUqfm Zmh8ALAr6Af/pR11aQ/JNNu3TTY8WfejXiiiJ8h8VMaIVjvbD2nABn3JOYc4qU0iqVmG Q22ry9NzyCKrP77rpxJmw1fyJa1WC4o21FYh0pvc7ME6DWaSbR42dCYrHNj0aQhXoMAj 81oJYO0QJ+Saj29bnHv1a705bgIVC/+EmLWfmuuwoR+w3A/LbIxa+Fg7FYiYxv9bC4Op EmXF2QKqhbj79zMvL3EePIT23YM/jtVlfA0zvF6OTDjoB/M254kpcV2WqMtWlkiJvKId HB6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701954429; x=1702559229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tRH0ltu/8xOeCYgi26zDqsTtGrYZ67tsC2xGcsHS4PY=; b=n6XRIhFDGXCAmj3tL30RF6iobsJLkSdqjD33cph6oQzf52aKc7UotSuoWvWB49UHlr akkNimUJUezBBpgQpyxROhw734Lw6Vq/mNHrwTz+rvDUnmjKRIWkft5szjl9VXzBZZkI nQnabXOJPoaEXN/5NTw8HYr2QCFaxuL5144KL2n7sBwtzIsZZCrWYPaMIziNpIheskBW UF58Uqi6zFH4z1+zMI7IoYgHOnZJoknpFuWEGfIqwGPa9YHaYFhbW+RPM37HXN8uyevC rOumQqMCWrrt87wejSwdfrp8dHrfY5ULYQVQOHdUHUgMZctAPm031X3DzjSRlU2TkRX/ sX+g== X-Gm-Message-State: AOJu0YzUCZD+thWH+r+2c4bOOG7O2BmDJksF3a1hAFxEWgBS5A5c+cc+ rUm9VTi3+t3V44qMWVtZeMBDwA== X-Google-Smtp-Source: AGHT+IEsyxo0MGyaQjyuCabGJdhhwA/ISqYGFHCfD0Cv0cJ6xp/BS7GC183ITUf6/GYMLLK663TFIA== X-Received: by 2002:a05:6512:3124:b0:50c:a39:ee37 with SMTP id p4-20020a056512312400b0050c0a39ee37mr1543140lfd.109.1701954429293; Thu, 07 Dec 2023 05:07:09 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j21-20020a056512109500b0050bc41caf04sm167685lfg.304.2023.12.07.05.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 05:07:08 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 06/10] ARM: dts: qcom: msm8960: declare SAW2 regulators Date: Thu, 7 Dec 2023 16:06:59 +0300 Message-Id: <20231207130703.3322321-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231207130703.3322321-1-dmitry.baryshkov@linaro.org> References: <20231207130703.3322321-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The SAW2 (SPM and AVS Wrapper) among other things is yet another way to handle CPU-related PMIC regulators. Provide a way to control voltage of these regulators. Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- arch/arm/boot/dts/qcom/qcom-msm8960.dtsi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi index f420740e068e..0ab340405784 100644 --- a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi +++ b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi @@ -223,13 +223,21 @@ acc1: clock-controller@2098000 { saw0: regulator@2089000 { compatible = "qcom,saw2"; reg = <0x02089000 0x1000>, <0x02009000 0x1000>; - regulator; + + saw0_vreg: regulator { + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <1300000>; + }; }; saw1: regulator@2099000 { compatible = "qcom,saw2"; reg = <0x02099000 0x1000>, <0x02009000 0x1000>; - regulator; + + saw1_vreg: regulator { + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <1300000>; + }; }; gsbi5: gsbi@16400000 { From patchwork Thu Dec 7 13:07:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 751251 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CYz6isMC" Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B946D10CC for ; Thu, 7 Dec 2023 05:07:11 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-50bdec453c8so772806e87.3 for ; Thu, 07 Dec 2023 05:07:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701954430; x=1702559230; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uwm1Y1yKYRC2h+rKhVRBCueR16O0EXSdEm7pH6xao2g=; b=CYz6isMC4XqKxXl2Izr2XBttNL+qp6C+gbDxjxxCAF5Y7XqLnKphXNM4MhkLL6c6ig TxazQVBh6VsS174iWamCB3Vc8PSe7gVhPXKHR9t6fyl6iGXkF2GCo2dzlFOJ4UqQPMnr q3F5Il0TULRlQFk3XGj9f4YsBpsVLa4A+bhgLWpYL4z/UOVKPLE6SJ/dy2EkDJd8Xs2q zbTDQWfJIXp0/e/6c5HfFuoe2z4YaPI4Z8sMBj1BVHUbzdHC03PAdtX6g+moAiykO/kd xEo1Pwc38jU9ef7/NtKPkO4tZfhlORzQfbgp9co1dcoGCx8TUGZexVHrhdXDSXLHfL1y Ejlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701954430; x=1702559230; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uwm1Y1yKYRC2h+rKhVRBCueR16O0EXSdEm7pH6xao2g=; b=P4ZD0+Jk/tdK3Pw8if4C3ruQu54t1eDkdiZO63Bd/YPP7CSRwRIBZ3wno0akkYdf9R tOf4gE/AF5oEa+PR5LDfQx5/wwV9rIf8aiiTh1UHmsVtT21pfxDlK0TJEhXefNMI1P9Q HnaCoN3YA7HFARX+0C6Lf1ILZwgQlG4YWkfOO7jrk8c9kBdvJIyUUXwt5+UrddzGOn2t qpXd/414BhYnxo3wT4SgrT7NgNMOR29pKatbh/V+n+3xwkKKWCfDmcpH5JNOzBP+kHev M4FYdBtG8H3N6lJiSk+b96Fi6MH+jY76EMjf8XfsJlTjdGOsAVwwV5uRAFoGxG2Upw7p OG0w== X-Gm-Message-State: AOJu0Yx7BZQlaAGMMv//vOPlQEHJghlethVOOw+searGryGqk+mbx/K+ elyYDNYrKuDHYru4atC2qf49ow== X-Google-Smtp-Source: AGHT+IEoYiX1iwS8glqG1IEYAQZrBhn9TOIMfG304nXtZ9/ea/nUt3pFlT1VP0RjtnpyvZpCvWGnPA== X-Received: by 2002:ac2:4ecd:0:b0:50b:f15e:3ee6 with SMTP id p13-20020ac24ecd000000b0050bf15e3ee6mr1658642lfr.13.1701954430111; Thu, 07 Dec 2023 05:07:10 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j21-20020a056512109500b0050bc41caf04sm167685lfg.304.2023.12.07.05.07.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 05:07:09 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 07/10] ARM: dts: qcom: apq8084: drop 'regulator' property from SAW2 device Date: Thu, 7 Dec 2023 16:07:00 +0300 Message-Id: <20231207130703.3322321-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231207130703.3322321-1-dmitry.baryshkov@linaro.org> References: <20231207130703.3322321-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The SAW2 device should describe the regulator constraints rather than just declaring that it has the regulator. Drop the 'regulator' property. If/when CPU voltage scaling is implemented for this platform, proper regulator node show be added instead. Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- arch/arm/boot/dts/qcom/qcom-apq8084.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/boot/dts/qcom/qcom-apq8084.dtsi b/arch/arm/boot/dts/qcom/qcom-apq8084.dtsi index 2b1f9d0fb510..24bc2cbfbd96 100644 --- a/arch/arm/boot/dts/qcom/qcom-apq8084.dtsi +++ b/arch/arm/boot/dts/qcom/qcom-apq8084.dtsi @@ -652,7 +652,6 @@ saw3: power-controller@f90b9000 { saw_l2: power-controller@f9012000 { compatible = "qcom,saw2"; reg = <0xf9012000 0x1000>; - regulator; }; acc0: power-manager@f9088000 { From patchwork Thu Dec 7 13:07:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 751249 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EPfspUHA" Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4C110E6 for ; Thu, 7 Dec 2023 05:07:13 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-50bfd8d5c77so768443e87.1 for ; Thu, 07 Dec 2023 05:07:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701954432; x=1702559232; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Rzx9Bm824S2wRWYFO7S2MdJvHvf/jzSVekqRFumNr7k=; b=EPfspUHAaW2n2DMq53kC5SqD0ittU+JLEp5tHIdXq65MemzEH5REBYMtZvRyLSg4eC uU+O77mXMv+WpWrsX1gCM9veFNGfBnLeWB6PHMVtROx07NPmhN7kU0AHz5WL1aXdlcLd NPw9bHKbARoEqsSi58yOEfUGw4tsydFUl7mwYyzxb+5jdVqURtqM+wflJUy/tFQkiMWx 45boftz/AFYH+GEdKpol3Ft3uaZiAUja8JAUAsQhT/N2OorZuNg7U8ylAI9QpOQFTDEm rGmcwoow+6s8hB84B+CBgNgX/jfnnUQOxWwpLHCdmD8BDrTiz9E7eRhtS24iLxRPbvQD 3LvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701954432; x=1702559232; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rzx9Bm824S2wRWYFO7S2MdJvHvf/jzSVekqRFumNr7k=; b=W6jjeGLHIQ/igFicu/Ynew9dSJ9YcGvC4GQ6eJzIJzxd/SN5jr8yJBiZRlFkbmemfb Ic0Fy4y5i/DWr4k00ZCoSiJFmEPvNDacuB0i8IJ0YQxD4q8qWyIEY6JXEnFmqzeXOPNw IiRpxgHme23ZwT+A2YV7LKFCbpDso4cEoV7PM3jjBQkPJTcklEAFosL5gcfBQCdy+uAl AOokmUsuea93zyxoKUzbI0FnDaZ2IjsXuSuuw+MdYMwaZI3/x7B1ju4Vcsm2Rz/qSBcf LV5HPhXg04UiXEnCachDqDYG59r4WNGA4f2Q7ci8p5WeReWIsZTJGRMiyyH+jpatZULu 9vMQ== X-Gm-Message-State: AOJu0YyTlaxCgAykHXTqFP2R2UHzn414KqsttPRGwBaiS2BV7fS0P9v1 28uYBfe5y78pTDnjTiS30SULmw== X-Google-Smtp-Source: AGHT+IEixdCLjEiNkYl5kW0kOJkWUb5tlY3oudtq5QiueW8AwcUOjFVFYhCiOZUnstWypxs6Zc71WA== X-Received: by 2002:a19:f018:0:b0:50b:e3c2:7e14 with SMTP id p24-20020a19f018000000b0050be3c27e14mr689094lfc.15.1701954432222; Thu, 07 Dec 2023 05:07:12 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j21-20020a056512109500b0050bc41caf04sm167685lfg.304.2023.12.07.05.07.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 05:07:11 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 10/10] ARM: dts: qcom: ipq8064: drop 'regulator' property from SAW2 devices Date: Thu, 7 Dec 2023 16:07:03 +0300 Message-Id: <20231207130703.3322321-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231207130703.3322321-1-dmitry.baryshkov@linaro.org> References: <20231207130703.3322321-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The SAW2 device should describe the regulator constraints rather than just declaring that it has the regulator. Drop the 'regulator' property. If/when CPU voltage scaling is implemented for this platform, proper regulator nodes show be added instead. Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- arch/arm/boot/dts/qcom/qcom-ipq8064.dtsi | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/boot/dts/qcom/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom/qcom-ipq8064.dtsi index c3677440b786..191d1cb27cb7 100644 --- a/arch/arm/boot/dts/qcom/qcom-ipq8064.dtsi +++ b/arch/arm/boot/dts/qcom/qcom-ipq8064.dtsi @@ -589,7 +589,6 @@ acc0: clock-controller@2088000 { saw0: regulator@2089000 { compatible = "qcom,saw2"; reg = <0x02089000 0x1000>, <0x02009000 0x1000>; - regulator; }; acc1: clock-controller@2098000 { @@ -604,7 +603,6 @@ acc1: clock-controller@2098000 { saw1: regulator@2099000 { compatible = "qcom,saw2"; reg = <0x02099000 0x1000>, <0x02009000 0x1000>; - regulator; }; nss_common: syscon@3000000 {