From nobody Sun Dec 14 19:10:58 2025 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2907916F828; Fri, 10 May 2024 12:06:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.130.44.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342816; cv=none; b=UvmLQHqDtNwwrSVooVomqcP2HU3cS5bK0etNGr/L9O6vgbNa7vPtgnrOoZ5bkmr5IIcJ/paoJVL4Y4UwZdWtbykvtMFTF1bcg47JreQ/E0/+GhGuAI5XPK0LBjEZ58ok4UQv1LHbfnk1Lfv64o86gEsmIlXwSix6J/SgLZk5tIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342816; c=relaxed/simple; bh=ugfhxS6NfouHW0TkE1Zbx397Zm/0WaEpbf+orXPTHU8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ovA9l2l1mANP7tXFyDbJQaphPU+ec3GRRCT3cGATXfEWNlGZh6L7s3IX6XYs7jJPnfkKDtN6crrd6Trrtb9YQRhwn9arMapc1W91EcThi1WM8DHfxulT0QuXzK9qICO/0BTzmWTnFOMgUJDL8rsxNectdaZLf2B76FoucEWNBKc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com; spf=pass smtp.mailfrom=richtek.com; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b=Fmpp/4qf; arc=none smtp.client-ip=220.130.44.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=richtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b="Fmpp/4qf" X-MailGates: (SIP:2,PASS,NONE)(compute_score:DELIVER,40,3) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=richtek.com; s=richtek; t=1715342804; bh=CGiHV5oBAFTeIyuaYGSoPD1MsyxRCD2d/PDCN6B6NUE=; l=3946; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Fmpp/4qfpzEimJFNaGfsscGnfi5k7jIK64N0I8rApN/I4sd6a3iDAgVrerphlTu9q jRxmp0HXI+ydad3u8R9SJZQ5tmgJnmFxOyoB9fL8129Y7XppmndgZpBcdRB8LyuO7J 2qrtQ0jmHR/GDLx0nwM+e4vtZAJPfGys5piRI+gswOtIcVmz+3x/qv5gVS8s7T3cw/ J/dqOw2KusMdzPWckwAlBMJ04zrEBKYofHHE/rv9Msr07EDdAMtifyGxbrb+E+wS1t GGi6xtr15x3mzdDsRzAV0Qbw/ksu/WgeWuuQfQgu4EuNU1FNM7kkEVVCB1TJ6XtHxp o3YVTJEicXnRQ== Received: from 192.168.10.46 by mg.richtek.com with MailGates ESMTPS Server V6.0(3213203:0:AUTH_RELAY) (envelope-from ) (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256/256); Fri, 10 May 2024 20:06:30 +0800 (CST) Received: from ex3.rt.l (192.168.10.46) by ex3.rt.l (192.168.10.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 10 May 2024 20:06:29 +0800 Received: from linuxcarl2.richtek.com (192.168.10.154) by ex3.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 10 May 2024 20:06:29 +0800 From: Alina Yu To: , , , , CC: , , , , Subject: [PATCH v3 1/6] regulator: rtq2208: Fix invalid memory access when devm_of_regulator_put_matches is called Date: Fri, 10 May 2024 20:06:20 +0800 Message-ID: <636cbe817ad61a18f291b5ec8938e79043b8a646.1715340537.git.alina_yu@richtek.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In this patch, a software bug has been fixed. rtq2208_ldo_match is no longer a local variable. It prevents invalid memory access when devm_of_regulator_put_matches is called. Signed-off-by: Alina Yu --- v3 - Move Fixes to the start of the series --- drivers/regulator/rtq2208-regulator.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/regulator/rtq2208-regulator.c b/drivers/regulator/rtq2= 208-regulator.c index 2d54844..dfa293a 100644 --- a/drivers/regulator/rtq2208-regulator.c +++ b/drivers/regulator/rtq2208-regulator.c @@ -224,6 +224,11 @@ static const struct regulator_ops rtq2208_regulator_ld= o_ops =3D { .set_suspend_disable =3D rtq2208_set_suspend_disable, }; =20 +static struct of_regulator_match rtq2208_ldo_match[] =3D { + {.name =3D "ldo2", }, + {.name =3D "ldo1", }, +}; + static unsigned int rtq2208_of_map_mode(unsigned int mode) { switch (mode) { @@ -335,8 +340,7 @@ static const struct linear_range rtq2208_vout_range[] = =3D { REGULATOR_LINEAR_RANGE(1310000, 181, 255, 10000), }; =20 -static int rtq2208_of_get_fixed_voltage(struct device *dev, - struct of_regulator_match *rtq2208_ldo_match, int n_fixed) +static int rtq2208_of_get_ldo_dvs_ability(struct device *dev) { struct device_node *np; struct of_regulator_match *match; @@ -351,14 +355,14 @@ static int rtq2208_of_get_fixed_voltage(struct device= *dev, if (!np) np =3D dev->of_node; =20 - ret =3D of_regulator_match(dev, np, rtq2208_ldo_match, n_fixed); + ret =3D of_regulator_match(dev, np, rtq2208_ldo_match, ARRAY_SIZE(rtq2208= _ldo_match)); =20 of_node_put(np); =20 if (ret < 0) return ret; =20 - for (i =3D 0; i < n_fixed; i++) { + for (i =3D 0; i < ARRAY_SIZE(rtq2208_ldo_match); i++) { match =3D rtq2208_ldo_match + i; init_data =3D match->init_data; rdesc =3D (struct rtq2208_regulator_desc *)match->driver_data; @@ -373,8 +377,7 @@ static int rtq2208_of_get_fixed_voltage(struct device *= dev, return 0; } =20 -static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rde= sc, int mtp_sel, - int idx, struct of_regulator_match *rtq2208_ldo_match, int *ldo_idx) +static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rde= sc, int mtp_sel, int idx) { struct regulator_desc *desc; static const struct { @@ -432,10 +435,6 @@ static void rtq2208_init_regulator_desc(struct rtq2208= _regulator_desc *rdesc, in desc->n_voltages =3D 1; desc->active_discharge_reg =3D LDO_RG_SHIFT(curr_info->base, 2); =20 - rtq2208_ldo_match[*ldo_idx].name =3D desc->name; - rtq2208_ldo_match[*ldo_idx].driver_data =3D rdesc; - rtq2208_ldo_match[(*ldo_idx)++].desc =3D desc; - rdesc->suspend_config_reg =3D curr_info->base; rdesc->suspend_enable_mask =3D RTQ2208_LDO_EN_STR_MASK; } @@ -444,8 +443,7 @@ static void rtq2208_init_regulator_desc(struct rtq2208_= regulator_desc *rdesc, in static int rtq2208_parse_regulator_dt_data(int n_regulator, const unsigned= int *regulator_idx_table, struct rtq2208_regulator_desc *rdesc[RTQ2208_LDO_MAX], struct device *de= v) { - struct of_regulator_match rtq2208_ldo_match[2]; - int mtp_sel, ret, i, idx, ldo_idx =3D 0; + int mtp_sel, i, idx, ret; =20 /* get mtp_sel0 or mtp_sel1 */ mtp_sel =3D device_property_read_bool(dev, "richtek,mtp-sel-high"); @@ -457,11 +455,15 @@ static int rtq2208_parse_regulator_dt_data(int n_regu= lator, const unsigned int * if (!rdesc[i]) return -ENOMEM; =20 - rtq2208_init_regulator_desc(rdesc[i], mtp_sel, idx, rtq2208_ldo_match, &= ldo_idx); + rtq2208_init_regulator_desc(rdesc[i], mtp_sel, idx); + + /* init ldo dvs ability */ + if (idx >=3D RTQ2208_LDO2) + rtq2208_ldo_match[idx - RTQ2208_LDO2].desc =3D &rdesc[i]->desc; } =20 /* init ldo fixed_uV */ - ret =3D rtq2208_of_get_fixed_voltage(dev, rtq2208_ldo_match, ldo_idx); + ret =3D rtq2208_of_get_ldo_dvs_ability(dev); if (ret) return dev_err_probe(dev, ret, "Failed to get ldo fixed_uV\n"); =20 --=20 2.7.4 From nobody Sun Dec 14 19:10:58 2025 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1518716F833; Fri, 10 May 2024 12:06:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.130.44.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342817; cv=none; b=LwNCNCHwAVdq7pynbcZ/bMeGgoj98dnyoLhOfaoA5wUOnZjl4s742IIKGmZdGWuTaBdJTtI8Fypo2udZJ1D6Man3l9NgQHUDRPLIXZfh65UXkzjIhoLStGlssXUwkmgkhH9LjgNualAvdOiz8UdDmhu1uk8YUaL4DWrCQ90nXdA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342817; c=relaxed/simple; bh=SodOLMEczseNnZ3JbfHd9iSXYjJP7Qfm0BowqUDFc00=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nqxaQ4HMGoULv6NQ1ueE4RxNEO8xyaI6XAyY3IVRVmtmIxloV2w3BW27TsLz7RYyzTSF6dKWbgfZeIEEW/kVgJCrDCkEJYeUNRvGZlCnHRbVgwJZU/k9+vJPLHTOde8gMO56F7Xek9O1kj+Cv672f3ka+ArflQ8MTJPgyYGNbFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com; spf=pass smtp.mailfrom=richtek.com; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b=uEsUTIqh; arc=none smtp.client-ip=220.130.44.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=richtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b="uEsUTIqh" X-MailGates: (SIP:2,PASS,NONE)(compute_score:DELIVER,40,3) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=richtek.com; s=richtek; t=1715342805; bh=gh5Lh7Hg/rcjFCRbEYF4ksiO92kWgeeyLMZW4KpRyc4=; l=4370; h=From:To:Subject:Date:Message-ID:MIME-Version; b=uEsUTIqhzYgzYo2wMa9KXU1+2jAOZV2M9CEgNkqS6D2hti44nrrmawdoeEpM48TYp ULakRfDRYF3CGrtaW1HHX9mZZwrTK5GTrlBClYeoXJm1iLC9SX0b/GtQEMIi4DYbRK lbaHJTJ6iqKs/zv7gonBU7f7Gdki/zdsdOD0BmHXEzughsgDf8mBfXYf/GU/quWDMw 38Y+TG3mlRcdnpQ0W5LOX9h5WujaLk8wj/Q6WvHhbqnW5+Xahi5ebin+4H2x8at34t bcNdOvBQm7bV2avtNMI7+P2cS80AyVJ0GZUrQooXwfop8musI/VGBdsAwow6P91Nsh DJ6wtZZ0k1w2Q== Received: from 192.168.10.47 by mg.richtek.com with MailGates ESMTPS Server V6.0(3213196:0:AUTH_RELAY) (envelope-from ) (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256/256); Fri, 10 May 2024 20:06:31 +0800 (CST) Received: from ex3.rt.l (192.168.10.46) by ex4.rt.l (192.168.10.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 10 May 2024 20:06:30 +0800 Received: from linuxcarl2.richtek.com (192.168.10.154) by ex3.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 10 May 2024 20:06:30 +0800 From: Alina Yu To: , , , , CC: , , , , Subject: [PATCH v3 2/6] regulator: rtq2208: Fix LDO vsel setting Date: Fri, 10 May 2024 20:06:21 +0800 Message-ID: <4886c4fdf645433ce436708479fd0375db0838dc.1715340537.git.alina_yu@richtek.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The LDO's Vout is adjustable if the hardware setting allows it, and it can be set either 1800mv or 3300mv. Signed-off-by: Alina Yu --- v3 - Seperate LDO vsel and discharge change to seperate patches --- drivers/regulator/rtq2208-regulator.c | 56 ++++++++++++++++++++++---------= ---- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/drivers/regulator/rtq2208-regulator.c b/drivers/regulator/rtq2= 208-regulator.c index dfa293a..00da787 100644 --- a/drivers/regulator/rtq2208-regulator.c +++ b/drivers/regulator/rtq2208-regulator.c @@ -26,6 +26,7 @@ #define RTQ2208_REG_BUCK_H_CFG0 0xA2 #define RTQ2208_REG_LDO1_CFG 0xB1 #define RTQ2208_REG_LDO2_CFG 0xC1 +#define RTQ2208_REG_LDO_DVS_CTRL 0xD0 =20 /* Mask */ #define RTQ2208_BUCK_NR_MTP_SEL_MASK GENMASK(7, 0) @@ -40,6 +41,8 @@ #define RTQ2208_EN_DIS_MASK BIT(0) #define RTQ2208_BUCK_RAMP_SEL_MASK GENMASK(2, 0) #define RTQ2208_HD_INT_MASK BIT(0) +#define RTQ2208_LDO1_VOSEL_SD_MASK BIT(5) +#define RTQ2208_LDO2_VOSEL_SD_MASK BIT(7) =20 /* Size */ #define RTQ2208_VOUT_MAXNUM 256 @@ -323,14 +326,23 @@ static irqreturn_t rtq2208_irq_handler(int irqno, voi= d *devid) return IRQ_HANDLED; } =20 -#define RTQ2208_REGULATOR_INFO(_name, _base) \ -{ \ - .name =3D #_name, \ - .base =3D _base, \ +#define BUCK_INFO(_name, _id) \ +{ \ + .name =3D _name, \ + .base =3D RTQ2208_REG_BUCK_##_id##_CFG0, \ + .enable_reg =3D BUCK_RG_SHIFT(RTQ2208_REG_BUCK_##_id##_CFG0, 2), \ + .dis_reg =3D RTQ2208_REG_BUCK_##_id##_CFG0, \ } -#define BUCK_RG_BASE(_id) RTQ2208_REG_BUCK_##_id##_CFG0 + +#define LDO_INFO(_name, _id) \ +{ \ + .name =3D _name, \ + .base =3D RTQ2208_REG_LDO##_id##_CFG, \ + .enable_reg =3D RTQ2208_REG_LDO##_id##_CFG, \ + .vsel_mask =3D RTQ2208_LDO##_id##_VOSEL_SD_MASK, \ +} + #define BUCK_RG_SHIFT(_base, _shift) (_base + _shift) -#define LDO_RG_BASE(_id) RTQ2208_REG_LDO##_id##_CFG #define LDO_RG_SHIFT(_base, _shift) (_base + _shift) #define VSEL_SHIFT(_sel) (_sel ? 3 : 1) #define MTP_SEL_MASK(_sel) RTQ2208_BUCK_EN_NR_MTP_SEL##_sel##_MASK @@ -383,17 +395,22 @@ static void rtq2208_init_regulator_desc(struct rtq220= 8_regulator_desc *rdesc, in static const struct { char *name; int base; + int enable_reg; + int dis_reg; + int dis_mask; + int dis_on; + int vsel_mask; } regulator_info[] =3D { - RTQ2208_REGULATOR_INFO(buck-b, BUCK_RG_BASE(B)), - RTQ2208_REGULATOR_INFO(buck-c, BUCK_RG_BASE(C)), - RTQ2208_REGULATOR_INFO(buck-d, BUCK_RG_BASE(D)), - RTQ2208_REGULATOR_INFO(buck-a, BUCK_RG_BASE(A)), - RTQ2208_REGULATOR_INFO(buck-f, BUCK_RG_BASE(F)), - RTQ2208_REGULATOR_INFO(buck-g, BUCK_RG_BASE(G)), - RTQ2208_REGULATOR_INFO(buck-h, BUCK_RG_BASE(H)), - RTQ2208_REGULATOR_INFO(buck-e, BUCK_RG_BASE(E)), - RTQ2208_REGULATOR_INFO(ldo2, LDO_RG_BASE(2)), - RTQ2208_REGULATOR_INFO(ldo1, LDO_RG_BASE(1)), + BUCK_INFO("buck-b", B), + BUCK_INFO("buck-c", C), + BUCK_INFO("buck-d", D), + BUCK_INFO("buck-a", A), + BUCK_INFO("buck-f", F), + BUCK_INFO("buck-g", G), + BUCK_INFO("buck-h", H), + BUCK_INFO("buck-e", E), + LDO_INFO("ldo2", 2), + LDO_INFO("ldo1", 1), }, *curr_info; =20 curr_info =3D regulator_info + idx; @@ -408,12 +425,12 @@ static void rtq2208_init_regulator_desc(struct rtq220= 8_regulator_desc *rdesc, in desc->active_discharge_on =3D RTQ2208_EN_DIS_MASK; desc->active_discharge_off =3D 0; desc->active_discharge_mask =3D RTQ2208_EN_DIS_MASK; + desc->enable_reg =3D curr_info->enable_reg; =20 rdesc->mode_mask =3D RTQ2208_BUCK_NRMODE_MASK; =20 if (idx >=3D RTQ2208_BUCK_B && idx <=3D RTQ2208_BUCK_E) { /* init buck desc */ - desc->enable_reg =3D BUCK_RG_SHIFT(curr_info->base, 2); desc->ops =3D &rtq2208_regulator_buck_ops; desc->vsel_reg =3D curr_info->base + VSEL_SHIFT(mtp_sel); desc->vsel_mask =3D RTQ2208_BUCK_NR_MTP_SEL_MASK; @@ -430,10 +447,9 @@ static void rtq2208_init_regulator_desc(struct rtq2208= _regulator_desc *rdesc, in rdesc->suspend_mode_mask =3D RTQ2208_BUCK_STRMODE_MASK; } else { /* init ldo desc */ - desc->enable_reg =3D curr_info->base; - desc->ops =3D &rtq2208_regulator_ldo_ops; - desc->n_voltages =3D 1; desc->active_discharge_reg =3D LDO_RG_SHIFT(curr_info->base, 2); + desc->vsel_reg =3D RTQ2208_REG_LDO_DVS_CTRL; + desc->vsel_mask =3D curr_info->vsel_mask; =20 rdesc->suspend_config_reg =3D curr_info->base; rdesc->suspend_enable_mask =3D RTQ2208_LDO_EN_STR_MASK; --=20 2.7.4 From nobody Sun Dec 14 19:10:58 2025 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28FDC14F12B; Fri, 10 May 2024 12:06:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.130.44.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342815; cv=none; b=MhD0TH0ImTWH2e7AUmG/h0hGpfP6WrzdkOQAbg+g+zSjly8wjvno8HQdhn+Y3bk5QiLSDke/NfeAI4NpViUJh48e7iwYQgzznhci1UWEQmfyxQe3a5bSoLmdQh53WB5BmcCRByLK5jlXoptAUbs5G1bURsTsPNuwGPJNRrOVYV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342815; c=relaxed/simple; bh=Tf5eDTSwc8EbTpl4ozjcwy7DapiyJLkYoTlSUSGDLcM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PATEezTDTDCPlwoiTQ5oRGbh2d1iLNQCczpjJQc/6Ugb0/YaKX2yA0lfD0ZYHEUqapQAsQ06ywIHVhFFFMTxSBrhkc2aoYOAtC3+wZHSq1IfJB5NrxSEAwWjW4+F44y9H4fKvN9R7r40FhLcxg7sspVoxvLdFDFUiHJpgSD3AnE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com; spf=pass smtp.mailfrom=richtek.com; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b=ZjZZtOMr; arc=none smtp.client-ip=220.130.44.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=richtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b="ZjZZtOMr" X-MailGates: (SIP:2,PASS,NONE)(compute_score:DELIVER,40,3) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=richtek.com; s=richtek; t=1715342805; bh=SL/RjOhtIhnXMH6vwoa+9BEm372k7ntr2/TkWKgZrZ0=; l=3203; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ZjZZtOMrJGNs69C5YeecOKXpjN71O96jx/btRZ1x4gphc55+YDlalB4LwwyxBAFYS /2hasy+p3CP01XjflbDNMRUhJE58E37O1j0os80FTVcmr2LdmmOScjUS+7n+WPkSpO FftNxL014T6zUHBbELdscVe1FxBml9h2QsfiYJdpriwj+YX+ac90mCU+P8Fdcde1Ls Q/dqxMfawSz1o6aTR1Do+05I/V347gH81svKvs9hylDCc9hgEmS5f0079AdF3R8coL jqDyjRB7Rv/2yijaFYXCNSSAB4ZdzKsfeFYXDdAvJD0VuYRFAHSyg0Fm2BFEHOZvVw HU1l2pqWgRkpw== Received: from 192.168.10.47 by mg.richtek.com with MailGates ESMTPS Server V6.0(3213201:0:AUTH_RELAY) (envelope-from ) (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256/256); Fri, 10 May 2024 20:06:32 +0800 (CST) Received: from ex3.rt.l (192.168.10.46) by ex4.rt.l (192.168.10.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 10 May 2024 20:06:31 +0800 Received: from linuxcarl2.richtek.com (192.168.10.154) by ex3.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 10 May 2024 20:06:31 +0800 From: Alina Yu To: , , , , CC: , , , , Subject: [PATCH v3 3/6] regulator: rtq2208: Fix LDO discharge register Date: Fri, 10 May 2024 20:06:22 +0800 Message-ID: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since the discharge register has been moved to another position, the modification is to fit the new register setting. Signed-off-by: Alina Yu --- v3 - Seperate LDO vsel and discharge change to seperate patches --- drivers/regulator/rtq2208-regulator.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/rtq2208-regulator.c b/drivers/regulator/rtq2= 208-regulator.c index 00da787..cea8e77 100644 --- a/drivers/regulator/rtq2208-regulator.c +++ b/drivers/regulator/rtq2208-regulator.c @@ -41,7 +41,9 @@ #define RTQ2208_EN_DIS_MASK BIT(0) #define RTQ2208_BUCK_RAMP_SEL_MASK GENMASK(2, 0) #define RTQ2208_HD_INT_MASK BIT(0) +#define RTQ2208_LDO1_DISCHG_EN_MASK BIT(4) #define RTQ2208_LDO1_VOSEL_SD_MASK BIT(5) +#define RTQ2208_LDO2_DISCHG_EN_MASK BIT(6) #define RTQ2208_LDO2_VOSEL_SD_MASK BIT(7) =20 /* Size */ @@ -339,11 +341,12 @@ static irqreturn_t rtq2208_irq_handler(int irqno, voi= d *devid) .name =3D _name, \ .base =3D RTQ2208_REG_LDO##_id##_CFG, \ .enable_reg =3D RTQ2208_REG_LDO##_id##_CFG, \ + .dis_mask =3D RTQ2208_LDO##_id##_DISCHG_EN_MASK, \ + .dis_on =3D RTQ2208_LDO##_id##_DISCHG_EN_MASK, \ .vsel_mask =3D RTQ2208_LDO##_id##_VOSEL_SD_MASK, \ } =20 #define BUCK_RG_SHIFT(_base, _shift) (_base + _shift) -#define LDO_RG_SHIFT(_base, _shift) (_base + _shift) #define VSEL_SHIFT(_sel) (_sel ? 3 : 1) #define MTP_SEL_MASK(_sel) RTQ2208_BUCK_EN_NR_MTP_SEL##_sel##_MASK =20 @@ -422,9 +425,7 @@ static void rtq2208_init_regulator_desc(struct rtq2208_= regulator_desc *rdesc, in desc->owner =3D THIS_MODULE; desc->type =3D REGULATOR_VOLTAGE; desc->enable_mask =3D mtp_sel ? MTP_SEL_MASK(1) : MTP_SEL_MASK(0); - desc->active_discharge_on =3D RTQ2208_EN_DIS_MASK; desc->active_discharge_off =3D 0; - desc->active_discharge_mask =3D RTQ2208_EN_DIS_MASK; desc->enable_reg =3D curr_info->enable_reg; =20 rdesc->mode_mask =3D RTQ2208_BUCK_NRMODE_MASK; @@ -438,8 +439,10 @@ static void rtq2208_init_regulator_desc(struct rtq2208= _regulator_desc *rdesc, in desc->linear_ranges =3D rtq2208_vout_range; desc->n_linear_ranges =3D ARRAY_SIZE(rtq2208_vout_range); desc->ramp_reg =3D BUCK_RG_SHIFT(curr_info->base, 5); - desc->active_discharge_reg =3D curr_info->base; desc->of_map_mode =3D rtq2208_of_map_mode; + desc->active_discharge_reg =3D curr_info->dis_reg; + desc->active_discharge_on =3D RTQ2208_EN_DIS_MASK; + desc->active_discharge_mask =3D RTQ2208_EN_DIS_MASK; =20 rdesc->mode_reg =3D BUCK_RG_SHIFT(curr_info->base, 2); rdesc->suspend_config_reg =3D BUCK_RG_SHIFT(curr_info->base, 4); @@ -447,9 +450,11 @@ static void rtq2208_init_regulator_desc(struct rtq2208= _regulator_desc *rdesc, in rdesc->suspend_mode_mask =3D RTQ2208_BUCK_STRMODE_MASK; } else { /* init ldo desc */ - desc->active_discharge_reg =3D LDO_RG_SHIFT(curr_info->base, 2); desc->vsel_reg =3D RTQ2208_REG_LDO_DVS_CTRL; desc->vsel_mask =3D curr_info->vsel_mask; + desc->active_discharge_reg =3D RTQ2208_REG_LDO_DVS_CTRL; + desc->active_discharge_on =3D curr_info->dis_on; + desc->active_discharge_mask =3D curr_info->dis_mask; =20 rdesc->suspend_config_reg =3D curr_info->base; rdesc->suspend_enable_mask =3D RTQ2208_LDO_EN_STR_MASK; --=20 2.7.4 From nobody Sun Dec 14 19:10:58 2025 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 132D116F82A; Fri, 10 May 2024 12:06:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.130.44.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342817; cv=none; b=WNbQjN/Pc3pFUdROP6/jNRIMb8+Vl0BvDjqpz1djcbXgrICaojtPc81JNHmIalupBDez039zQhEWSJryqOv3fSaXs8WF5XLl2rvlT7BilJ5L/oNYrk/jV4X0orKp95JeoIzklRHw+2dniQOc4Y544nrlRAlKmkSi5e4smZW+zOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342817; c=relaxed/simple; bh=alAAcYWNGVr0LO9THbHu1S/9Bb/OIKBbEuXmlziafj0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dWCVELJdEwvTA02xYpdqU9rYZjRDkc6vnlGWLbWKEW6wyCvkutH+uQb0pJ/ifSr9GKZKZlfvKfQslOlZM5ZISwg4NtqYv44lEaVsNUVwTz2pfOCfF5vNe7O/eu7D/MeNPZ8uaGDupPWJVmu2aCdkYJXC7EMmZgVVWRSF3e8Sy5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com; spf=pass smtp.mailfrom=richtek.com; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b=rSp4xsks; arc=none smtp.client-ip=220.130.44.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=richtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b="rSp4xsks" X-MailGates: (SIP:2,PASS,NONE)(compute_score:DELIVER,40,3) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=richtek.com; s=richtek; t=1715342805; bh=CyjaSK4ROBhTrLFjC+OEFF7KNjcR72P0QQWCODQsyf8=; l=1305; h=From:To:Subject:Date:Message-ID:MIME-Version; b=rSp4xskspn2afF4ottBCrarrQXdhxnmclugK41/q/gjJgBdQCorKnXU+BuHguOTKz V7UtFt/ejnBpoBsrMRgFA/18tI711qXDKgqpb8cWZGevo/8Fa80ogU3ZyWW+aMsWFk jEakmFi2bl9LUm7jaEE9iT3CikLpq7GyNWJY9KpWjI6JTCOPh0zE40rCatk4KXlNT/ 47un43UgvPhFkIhjPEHFaI6YD10+Opmtdkut6FkYq6qnGVqvVRTuJmqvRX8GEHF6pY U/tbxeuqFElEZxDq4Bo4jo5X+XSd73FsdDHXf7c6WIEFePW9w3/I73DhD8L2Y6FKHx tsWncPCDKGzqg== Received: from 192.168.10.47 by mg.richtek.com with MailGates ESMTPS Server V6.0(3213196:0:AUTH_RELAY) (envelope-from ) (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256/256); Fri, 10 May 2024 20:06:32 +0800 (CST) Received: from ex3.rt.l (192.168.10.46) by ex4.rt.l (192.168.10.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 10 May 2024 20:06:32 +0800 Received: from linuxcarl2.richtek.com (192.168.10.154) by ex3.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 10 May 2024 20:06:32 +0800 From: Alina Yu To: , , , , CC: , , , , Subject: [PATCH v3 4/6] regulator: rtq2208: Fix the BUCK ramp_delay range to maximum of 16mVstep/us Date: Fri, 10 May 2024 20:06:23 +0800 Message-ID: <77fc604a10f4a3055c2c29ff6aa7a253a8b9bc7f.1715340537.git.alina_yu@richtek.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The maximum ramp up and down range of BUCK are shorten from 64mVstep/us to 16mVstep/us. Therefore, the RTQ2208_RAMP_VALUE_MAX_uV is modified to 16000uV in this version. Signed-off-by: Alina Yu --- drivers/regulator/rtq2208-regulator.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/rtq2208-regulator.c b/drivers/regulator/rtq2= 208-regulator.c index cea8e77..2e9387f 100644 --- a/drivers/regulator/rtq2208-regulator.c +++ b/drivers/regulator/rtq2208-regulator.c @@ -53,7 +53,7 @@ =20 /* Value */ #define RTQ2208_RAMP_VALUE_MIN_uV 500 -#define RTQ2208_RAMP_VALUE_MAX_uV 64000 +#define RTQ2208_RAMP_VALUE_MAX_uV 16000 =20 #define RTQ2208_BUCK_MASK(uv_irq, ov_irq) (1 << ((uv_irq) % 8) | 1 << ((ov= _irq) % 8)) =20 @@ -147,12 +147,11 @@ static int rtq2208_set_ramp_delay(struct regulator_de= v *rdev, int ramp_delay) * Because the relation of seleltion and value is like that * * seletion: value - * 000: 64mv - * 001: 32mv + * 010: 16mv * ... * 111: 0.5mv * - * For example, if I would like to select 64mv, the fls(ramp_delay) - 1 w= ill be 0b111, + * For example, if I would like to select 16mv, the fls(ramp_delay) - 1 w= ill be 0b010, * and I need to use 0b111 - sel to do the shifting */ =20 --=20 2.7.4 From nobody Sun Dec 14 19:10:58 2025 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB3F816F296; Fri, 10 May 2024 12:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.130.44.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342818; cv=none; b=q4OZFfNVzDepReH4TpSbQfw7Q8pZXUrpIFG5u8MEgr7+uxPKrG8rNBWAkziCOpRSKw2BFMqC6BbDtX7EyQ+lwTckJ3R/OvazDeWfnsUrFl8FdcXFbaXFEUt6NnDSWdFbzmHD4H0hM44Qvmtt3i3P6RGk8fdV85afcDAy2HQsCDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342818; c=relaxed/simple; bh=g4vwY7Rm39oLvhxj4PQq6HqNHGET+DLV/YkHzXIxdHU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=e6bEMNhPBODdrpWtV3oVyPFHpzPvMAwJZrD8vEIn7Ftvw+N8WjV/Fake+Pv0YfywJnGoU2aKAikO75zUU208P9Hzk6WNky5uYDISimfwseR3ZkoRvravxXvVm3YLe2vG/wvQlnU9nlxqDZyP0PnYswbS+8RlTe+6d5gQdg+rRng= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com; spf=pass smtp.mailfrom=richtek.com; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b=R/4RG5DX; arc=none smtp.client-ip=220.130.44.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=richtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b="R/4RG5DX" X-MailGates: (SIP:2,PASS,NONE)(compute_score:DELIVER,40,3) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=richtek.com; s=richtek; t=1715342807; bh=kaxYcbrb/9Pnuq7HbvF6NNsDEjH/9/v3t51VOdwTq+s=; l=3451; h=From:To:Subject:Date:Message-ID:MIME-Version; b=R/4RG5DX87sAnovzHbiNuoNjR7l4h77JzrCqhUOLrcQLNyYOJhTUh61ZHTJRm7ABt C2l1kPubmfUsqY87rZSfobdlPey8j7/zV38R0YWUvKRhT0/V4cp4eb+d4IPE3p4PfI UAu9uVHAuFEhVZBMFCHxexMrWQp1HuILQjHKVIBmxFU3a1dMvCBjM33pPwr16oun3B aq2iPnxrzWvSiFJ8sPyT9qp92frVNzL9hazZ/JUna3nJfdtC6MY3idOAE9j6CG9o/M zSU9yQzutV3mXayvOb2WOL/HxWSNbbnJvYCECrT4otFlucgZhrwhe/A/46QgyHa151 PJVnKNp4PVYAg== Received: from 192.168.10.47 by mg.richtek.com with MailGates ESMTPS Server V6.0(3213204:0:AUTH_RELAY) (envelope-from ) (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256/256); Fri, 10 May 2024 20:06:33 +0800 (CST) Received: from ex3.rt.l (192.168.10.46) by ex4.rt.l (192.168.10.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 10 May 2024 20:06:33 +0800 Received: from linuxcarl2.richtek.com (192.168.10.154) by ex3.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 10 May 2024 20:06:33 +0800 From: Alina Yu To: , , , , CC: , , , , Subject: [PATCH v3 5/6] regulator: rtq2208: Fix LDO to be compatible with both fixed and adjustable vout Date: Fri, 10 May 2024 20:06:24 +0800 Message-ID: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In this patch, LDO's adjustable and fixed Vout settings are compatible. The LDO Vout ability depends on "richtek,fixed-microvolt". If adjustable, the Vout can be set to either 1800mV or 3300mV. Signed-off-by: Alina Yu --- v3 - Add "richtek,fixed-microvolt" to specify LDO fixed voltage - Check specified desc->fixed_uV matches with constraints->min_uV and const= raints->max_uV --- drivers/regulator/rtq2208-regulator.c | 43 ++++++++++++++++++++++++++++++-= ---- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/drivers/regulator/rtq2208-regulator.c b/drivers/regulator/rtq2= 208-regulator.c index 2e9387f..c2c1689 100644 --- a/drivers/regulator/rtq2208-regulator.c +++ b/drivers/regulator/rtq2208-regulator.c @@ -219,7 +219,7 @@ static const struct regulator_ops rtq2208_regulator_buc= k_ops =3D { .set_suspend_mode =3D rtq2208_set_suspend_mode, }; =20 -static const struct regulator_ops rtq2208_regulator_ldo_ops =3D { +static const struct regulator_ops rtq2208_regulator_ldo_fix_ops =3D { .enable =3D regulator_enable_regmap, .disable =3D regulator_disable_regmap, .is_enabled =3D regulator_is_enabled_regmap, @@ -228,6 +228,23 @@ static const struct regulator_ops rtq2208_regulator_ld= o_ops =3D { .set_suspend_disable =3D rtq2208_set_suspend_disable, }; =20 +static const struct regulator_ops rtq2208_regulator_ldo_adj_ops =3D { + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .is_enabled =3D regulator_is_enabled_regmap, + .list_voltage =3D regulator_list_voltage_table, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_active_discharge =3D regulator_set_active_discharge_regmap, + .set_suspend_enable =3D rtq2208_set_suspend_enable, + .set_suspend_disable =3D rtq2208_set_suspend_disable, +}; + +static const unsigned int rtq2208_ldo_volt_table[] =3D { + 1800000, + 3300000, +}; + static struct of_regulator_match rtq2208_ldo_match[] =3D { {.name =3D "ldo2", }, {.name =3D "ldo1", }, @@ -358,8 +375,9 @@ static int rtq2208_of_get_ldo_dvs_ability(struct device= *dev) { struct device_node *np; struct of_regulator_match *match; - struct rtq2208_regulator_desc *rdesc; + struct regulator_desc *desc; struct regulator_init_data *init_data; + u32 fixed_uV; int ret, i; =20 if (!dev->of_node) @@ -379,13 +397,26 @@ static int rtq2208_of_get_ldo_dvs_ability(struct devi= ce *dev) for (i =3D 0; i < ARRAY_SIZE(rtq2208_ldo_match); i++) { match =3D rtq2208_ldo_match + i; init_data =3D match->init_data; - rdesc =3D (struct rtq2208_regulator_desc *)match->driver_data; + desc =3D (struct regulator_desc *)match->desc; =20 - if (!init_data || !rdesc) + if (!init_data || !desc) continue; =20 - if (init_data->constraints.min_uV =3D=3D init_data->constraints.max_uV) - rdesc->desc.fixed_uV =3D init_data->constraints.min_uV; + /* specify working fixed voltage if the propery exists */ + ret =3D of_property_read_u32(match->of_node, "richtek,fixed-microvolt", = &fixed_uV); + + if (!ret) { + if (fixed_uV !=3D init_data->constraints.min_uV || + fixed_uV !=3D init_data->constraints.max_uV) + return -EINVAL; + desc->n_voltages =3D 1; + desc->fixed_uV =3D fixed_uV; + desc->ops =3D &rtq2208_regulator_ldo_fix_ops; + } else { + desc->n_voltages =3D ARRAY_SIZE(rtq2208_ldo_volt_table); + desc->volt_table =3D rtq2208_ldo_volt_table; + desc->ops =3D &rtq2208_regulator_ldo_adj_ops; + } } =20 return 0; --=20 2.7.4 From nobody Sun Dec 14 19:10:58 2025 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1021E16F823; Fri, 10 May 2024 12:06:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.130.44.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342815; cv=none; b=jhRwxOSBwE+Ov00D75NiqA0Re18Z1h5fToSSNrsLKegU8UNgF1/KlG4v5jLtwlKrzZt/d+JWAIGs/fNC6RTct7E7H7G64GMnhI1dFWq3bloeI7IXtZ0tfSeLBKFP/4NZ0jGS/kql8JAPqZaf7Etn8cnBBG6695VQYGcSRI4caUI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715342815; c=relaxed/simple; bh=Kri6ApUcgAkurOUKOhlGUuyZiQZb5rFxf6NIPTgDDB4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=anmCe0IyOiHrLV5pxQUJDOCJccrbdLYbHCYncUIMo+QSuKdNFO0ohFZMbnwm1Lndh4miSfO5y9cznzFxyEGoxz7o9M7EA7n61vxAyrnSynJoXq3YN0wc9ysgMUIHZdYgDXa86cACu7ZYGnmrKf/J42viia6njH1vCCfuigdFE1A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com; spf=pass smtp.mailfrom=richtek.com; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b=wuDlwXBs; arc=none smtp.client-ip=220.130.44.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=richtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=richtek.com header.i=@richtek.com header.b="wuDlwXBs" X-MailGates: (SIP:2,PASS,NONE)(compute_score:DELIVER,40,3) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=richtek.com; s=richtek; t=1715342806; bh=NE7r2aCsiikDYhywBG+j93zq4aaWUUtMLU/H8m9LS8U=; l=1265; h=From:To:Subject:Date:Message-ID:MIME-Version; b=wuDlwXBslgrrplB8jFJPeA3Q/uFWO6/TA3UBDM8jsvSmnZCU+wXce7YlOwSkdt7Ep 3bpFFjTLR+n0x2A0SPI/f+a2X1YOLfDNx3OsH7flghfOvb0uVi43cjel1LEUnWy4GW zuN1yHUjpIm8mfGoHmKhy7buz7kLmcmCaur95NAwtoB3CzCZmI6l1Ai/931Thn7D+5 7N7ABAPJ9b+IVbroOrV0JIoxdYMx4AfriGW+oPEJRVuc4imYQ+NAjSY9AhEMPlULVv ocjpH4hgL6L6MFt/OvbKXZCqckJ7GF3k0Ju5uLboaT9Sxq+d64eD30eaNUkBgVjuHg U26HZQYNjHW6Q== Received: from 192.168.10.47 by mg.richtek.com with MailGates ESMTPS Server V6.0(3213191:0:AUTH_RELAY) (envelope-from ) (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256/256); Fri, 10 May 2024 20:06:35 +0800 (CST) Received: from ex3.rt.l (192.168.10.46) by ex4.rt.l (192.168.10.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 10 May 2024 20:06:35 +0800 Received: from linuxcarl2.richtek.com (192.168.10.154) by ex3.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 10 May 2024 20:06:35 +0800 From: Alina Yu To: , , , , CC: , , , , Subject: [PATCH v3 6/6] regulator: dt-bindings: rtq2208: Add property to get ldo of RTQ2208 is adjustable or not Date: Fri, 10 May 2024 20:06:25 +0800 Message-ID: <6a3a90d9aa2022dfb92e124e417f3e72c2f28b0b.1715340537.git.alina_yu@richtek.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since there is no way to check is ldo is adjustable or not. As discussing in v2 series, 'richtek,fixed-microvolt' is added for that. user is supposed to know whether vout of ldo is adjustable. Signed-off-by: Alina Yu --- Documentation/devicetree/bindings/regulator/richtek,rtq2208.yaml | 8 +++++= +++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/richtek,rtq2208.ya= ml b/Documentation/devicetree/bindings/regulator/richtek,rtq2208.yaml index 609c066..6212f44 100644 --- a/Documentation/devicetree/bindings/regulator/richtek,rtq2208.yaml +++ b/Documentation/devicetree/bindings/regulator/richtek,rtq2208.yaml @@ -75,6 +75,13 @@ properties: description: regulator description for ldo[1-2]. =20 + properties: + richtek,fixed-microvolt: + description: | + If it exists, the voltage is unadjustable. + There is no risk-free method for software to determine wheth= er the ldo vout is fixed or not. + Therefore, it can only be done in this way. + required: - compatible - reg @@ -177,6 +184,7 @@ examples: }; }; ldo1 { + richtek,fixed-microvolt =3D <1200000>; regulator-min-microvolt =3D <1200000>; regulator-max-microvolt =3D <1200000>; regulator-always-on; --=20 2.7.4