devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add compatible support for RT5733
@ 2023-06-29 14:29 cy_huang
  2023-06-29 14:29 ` [PATCH v2 1/2] regulator: dt-bindings: rt5739: Add compatible for rt5733 cy_huang
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: cy_huang @ 2023-06-29 14:29 UTC (permalink / raw)
  To: broonie, krzysztof.kozlowski+dt, conor+dt
  Cc: robh+dt, lgirdwood, cy_huang, devicetree, linux-kernel

From: ChiYuan Huang <cy_huang@richtek.com>

This series is to add the compatible support for rt5733 based on rt5739.

Version change listed below each comment message.

ChiYuan Huang (2):
  regulator: dt-bindings: rt5739: Add compatible for rt5733
  regulator: rt5739: Add DID check and compatible for rt5733

 .../bindings/regulator/richtek,rt5739.yaml    |  1 +
 drivers/regulator/rt5739.c                    | 36 +++++++++++++++----
 2 files changed, 30 insertions(+), 7 deletions(-)


base-commit: 6995e2de6891c724bfeb2db33d7b87775f913ad1
-- 
2.40.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] regulator: dt-bindings: rt5739: Add compatible for rt5733
  2023-06-29 14:29 [PATCH v2 0/2] Add compatible support for RT5733 cy_huang
@ 2023-06-29 14:29 ` cy_huang
  2023-06-29 14:29 ` [PATCH v2 2/2] regulator: rt5739: Add DID check and " cy_huang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: cy_huang @ 2023-06-29 14:29 UTC (permalink / raw)
  To: broonie, krzysztof.kozlowski+dt, conor+dt
  Cc: robh+dt, lgirdwood, cy_huang, devicetree, linux-kernel

From: ChiYuan Huang <cy_huang@richtek.com>

Add compatible string for rt5733.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml b/Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml
index 358297dd3fb7..e95e046e9ed6 100644
--- a/Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml
+++ b/Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml
@@ -21,6 +21,7 @@ allOf:
 properties:
   compatible:
     enum:
+      - richtek,rt5733
       - richtek,rt5739
 
   reg:
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] regulator: rt5739: Add DID check and compatible for rt5733
  2023-06-29 14:29 [PATCH v2 0/2] Add compatible support for RT5733 cy_huang
  2023-06-29 14:29 ` [PATCH v2 1/2] regulator: dt-bindings: rt5739: Add compatible for rt5733 cy_huang
@ 2023-06-29 14:29 ` cy_huang
  2023-07-10  1:47 ` [PATCH v2 0/2] Add compatible support for RT5733 ChiYuan Huang
  2023-07-12 14:29 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: cy_huang @ 2023-06-29 14:29 UTC (permalink / raw)
  To: broonie, krzysztof.kozlowski+dt, conor+dt
  Cc: robh+dt, lgirdwood, cy_huang, devicetree, linux-kernel

From: ChiYuan Huang <cy_huang@richtek.com>

Add compatible and use DID to check rt5733.

The only difference bwtween rt5733 and rt5739 is the output range and
voltage step. These two chips can be distinguished from the DIE id.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
---
v2:
- Remove DID check in 'set_suspend_voltage' callback, use desc member to
  check min/max and vsel calculation
- Use switch case to check DID for the future variation
---
 drivers/regulator/rt5739.c | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/drivers/regulator/rt5739.c b/drivers/regulator/rt5739.c
index 74fc5bf6d87e..ca5f9b05331c 100644
--- a/drivers/regulator/rt5739.c
+++ b/drivers/regulator/rt5739.c
@@ -31,10 +31,17 @@
 #define RT5739_MODEVSEL1_MASK	BIT(1)
 #define RT5739_MODEVSEL0_MASK	BIT(0)
 #define RT5739_VID_MASK		GENMASK(7, 5)
+#define RT5739_DID_MASK		GENMASK(3, 0)
 #define RT5739_ACTD_MASK	BIT(7)
 #define RT5739_ENVSEL1_MASK	BIT(1)
 #define RT5739_ENVSEL0_MASK	BIT(0)
 
+#define RT5733_CHIPDIE_ID	0x1
+#define RT5733_VOLT_MINUV	270000
+#define RT5733_VOLT_MAXUV	1401250
+#define RT5733_VOLT_STPUV	6250
+#define RT5733_N_VOLTS		182
+
 #define RT5739_VOLT_MINUV	300000
 #define RT5739_VOLT_MAXUV	1300000
 #define RT5739_VOLT_STPUV	5000
@@ -93,8 +100,11 @@ static int rt5739_set_suspend_voltage(struct regulator_dev *rdev, int uV)
 	const struct regulator_desc *desc = rdev->desc;
 	struct regmap *regmap = rdev_get_regmap(rdev);
 	unsigned int reg, vsel;
+	int max_uV;
+
+	max_uV = desc->min_uV + desc->uV_step * (desc->n_voltages - 1);
 
-	if (uV < RT5739_VOLT_MINUV || uV > RT5739_VOLT_MAXUV)
+	if (uV < desc->min_uV || uV > max_uV)
 		return -EINVAL;
 
 	if (desc->vsel_reg == RT5739_REG_NSEL0)
@@ -102,7 +112,7 @@ static int rt5739_set_suspend_voltage(struct regulator_dev *rdev, int uV)
 	else
 		reg = RT5739_REG_NSEL0;
 
-	vsel = (uV - RT5739_VOLT_MINUV) / RT5739_VOLT_STPUV;
+	vsel = (uV - desc->min_uV) / desc->uV_step;
 	return regmap_write(regmap, reg, vsel);
 }
 
@@ -189,15 +199,12 @@ static unsigned int rt5739_of_map_mode(unsigned int mode)
 }
 
 static void rt5739_init_regulator_desc(struct regulator_desc *desc,
-				       bool vsel_active_high)
+				       bool vsel_active_high, u8 did)
 {
 	/* Fixed */
 	desc->name = "rt5739-regulator";
 	desc->owner = THIS_MODULE;
 	desc->ops = &rt5739_regulator_ops;
-	desc->n_voltages = RT5739_N_VOLTS;
-	desc->min_uV = RT5739_VOLT_MINUV;
-	desc->uV_step = RT5739_VOLT_STPUV;
 	desc->vsel_mask = RT5739_VSEL_MASK;
 	desc->enable_reg = RT5739_REG_CNTL2;
 	desc->active_discharge_reg = RT5739_REG_CNTL1;
@@ -213,6 +220,20 @@ static void rt5739_init_regulator_desc(struct regulator_desc *desc,
 		desc->vsel_reg = RT5739_REG_NSEL0;
 		desc->enable_mask = RT5739_ENVSEL0_MASK;
 	}
+
+	/* Assigned by CHIPDIE ID */
+	switch (did) {
+	case RT5733_CHIPDIE_ID:
+		desc->n_voltages = RT5733_N_VOLTS;
+		desc->min_uV = RT5733_VOLT_MINUV;
+		desc->uV_step = RT5733_VOLT_STPUV;
+		break;
+	default:
+		desc->n_voltages = RT5739_N_VOLTS;
+		desc->min_uV = RT5739_VOLT_MINUV;
+		desc->uV_step = RT5739_VOLT_STPUV;
+		break;
+	}
 }
 
 static const struct regmap_config rt5739_regmap_config = {
@@ -258,7 +279,7 @@ static int rt5739_probe(struct i2c_client *i2c)
 
 	vsel_acth = device_property_read_bool(dev, "richtek,vsel-active-high");
 
-	rt5739_init_regulator_desc(desc, vsel_acth);
+	rt5739_init_regulator_desc(desc, vsel_acth, vid & RT5739_DID_MASK);
 
 	cfg.dev = dev;
 	cfg.of_node = dev_of_node(dev);
@@ -271,6 +292,7 @@ static int rt5739_probe(struct i2c_client *i2c)
 }
 
 static const struct of_device_id rt5739_device_table[] = {
+	{ .compatible = "richtek,rt5733" },
 	{ .compatible = "richtek,rt5739" },
 	{ /* sentinel */ }
 };
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Add compatible support for RT5733
  2023-06-29 14:29 [PATCH v2 0/2] Add compatible support for RT5733 cy_huang
  2023-06-29 14:29 ` [PATCH v2 1/2] regulator: dt-bindings: rt5739: Add compatible for rt5733 cy_huang
  2023-06-29 14:29 ` [PATCH v2 2/2] regulator: rt5739: Add DID check and " cy_huang
@ 2023-07-10  1:47 ` ChiYuan Huang
  2023-07-10  6:55   ` Krzysztof Kozlowski
  2023-07-12 14:29 ` Mark Brown
  3 siblings, 1 reply; 8+ messages in thread
From: ChiYuan Huang @ 2023-07-10  1:47 UTC (permalink / raw)
  To: broonie, krzysztof.kozlowski+dt, conor+dt
  Cc: robh+dt, lgirdwood, devicetree, linux-kernel

On Thu, Jun 29, 2023 at 10:29:54PM +0800, cy_huang@richtek.com wrote:
Hi,
> From: ChiYuan Huang <cy_huang@richtek.com>
> 
> This series is to add the compatible support for rt5733 based on rt5739.
> 
Sorry, not intend to ping, just want to check the current review status.

Any comment about this patch series?
> Version change listed below each comment message.
> 
> ChiYuan Huang (2):
>   regulator: dt-bindings: rt5739: Add compatible for rt5733
>   regulator: rt5739: Add DID check and compatible for rt5733
> 
>  .../bindings/regulator/richtek,rt5739.yaml    |  1 +
>  drivers/regulator/rt5739.c                    | 36 +++++++++++++++----
>  2 files changed, 30 insertions(+), 7 deletions(-)
> 
> 
> base-commit: 6995e2de6891c724bfeb2db33d7b87775f913ad1
> -- 
> 2.40.1
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Add compatible support for RT5733
  2023-07-10  1:47 ` [PATCH v2 0/2] Add compatible support for RT5733 ChiYuan Huang
@ 2023-07-10  6:55   ` Krzysztof Kozlowski
  2023-07-10  7:09     ` ChiYuan Huang
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-10  6:55 UTC (permalink / raw)
  To: ChiYuan Huang, broonie, krzysztof.kozlowski+dt, conor+dt
  Cc: robh+dt, lgirdwood, devicetree, linux-kernel

On 10/07/2023 03:47, ChiYuan Huang wrote:
> On Thu, Jun 29, 2023 at 10:29:54PM +0800, cy_huang@richtek.com wrote:
> Hi,
>> From: ChiYuan Huang <cy_huang@richtek.com>
>>
>> This series is to add the compatible support for rt5733 based on rt5739.
>>
> Sorry, not intend to ping, just want to check the current review status.
> 
> Any comment about this patch series?

You sent it during merge window, so what do you expect? What should
happen during the merge window?

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Add compatible support for RT5733
  2023-07-10  6:55   ` Krzysztof Kozlowski
@ 2023-07-10  7:09     ` ChiYuan Huang
  2023-07-10  7:27       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 8+ messages in thread
From: ChiYuan Huang @ 2023-07-10  7:09 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: broonie, krzysztof.kozlowski+dt, conor+dt, robh+dt, lgirdwood,
	devicetree, linux-kernel

On Mon, Jul 10, 2023 at 08:55:17AM +0200, Krzysztof Kozlowski wrote:
> On 10/07/2023 03:47, ChiYuan Huang wrote:
> > On Thu, Jun 29, 2023 at 10:29:54PM +0800, cy_huang@richtek.com wrote:
> > Hi,
> >> From: ChiYuan Huang <cy_huang@richtek.com>
> >>
> >> This series is to add the compatible support for rt5733 based on rt5739.
> >>
> > Sorry, not intend to ping, just want to check the current review status.
> > 
> > Any comment about this patch series?
> 
> You sent it during merge window, so what do you expect? What should
> happen during the merge window?
>
Since I do not know it's merge windows period, sorry to bother you guys.

Thanks for the notice. 
> Best regards,
> Krzysztof
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Add compatible support for RT5733
  2023-07-10  7:09     ` ChiYuan Huang
@ 2023-07-10  7:27       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-10  7:27 UTC (permalink / raw)
  To: ChiYuan Huang
  Cc: broonie, krzysztof.kozlowski+dt, conor+dt, robh+dt, lgirdwood,
	devicetree, linux-kernel

On 10/07/2023 09:09, ChiYuan Huang wrote:
> On Mon, Jul 10, 2023 at 08:55:17AM +0200, Krzysztof Kozlowski wrote:
>> On 10/07/2023 03:47, ChiYuan Huang wrote:
>>> On Thu, Jun 29, 2023 at 10:29:54PM +0800, cy_huang@richtek.com wrote:
>>> Hi,
>>>> From: ChiYuan Huang <cy_huang@richtek.com>
>>>>
>>>> This series is to add the compatible support for rt5733 based on rt5739.
>>>>
>>> Sorry, not intend to ping, just want to check the current review status.
>>>
>>> Any comment about this patch series?
>>
>> You sent it during merge window, so what do you expect? What should
>> happen during the merge window?
>>
> Since I do not know it's merge windows period, sorry to bother you guys.
> 

Release of Linux kernel (so v6.4) is the opening of merge window. You
can also check here:
https://phb-crystal-ball.sipsolutions.net/

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Add compatible support for RT5733
  2023-06-29 14:29 [PATCH v2 0/2] Add compatible support for RT5733 cy_huang
                   ` (2 preceding siblings ...)
  2023-07-10  1:47 ` [PATCH v2 0/2] Add compatible support for RT5733 ChiYuan Huang
@ 2023-07-12 14:29 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2023-07-12 14:29 UTC (permalink / raw)
  To: krzysztof.kozlowski+dt, conor+dt, cy_huang
  Cc: robh+dt, lgirdwood, devicetree, linux-kernel

On Thu, 29 Jun 2023 22:29:54 +0800, cy_huang@richtek.com wrote:
> This series is to add the compatible support for rt5733 based on rt5739.
> 
> Version change listed below each comment message.
> 
> ChiYuan Huang (2):
>   regulator: dt-bindings: rt5739: Add compatible for rt5733
>   regulator: rt5739: Add DID check and compatible for rt5733
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/2] regulator: dt-bindings: rt5739: Add compatible for rt5733
      commit: 8978af5ef662541bc0a5a7722ad6942cd19daed0
[2/2] regulator: rt5739: Add DID check and compatible for rt5733
      commit: 6f5e285839845729858b8f6ca7cf3dd35e1f9a29

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-07-12 14:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-29 14:29 [PATCH v2 0/2] Add compatible support for RT5733 cy_huang
2023-06-29 14:29 ` [PATCH v2 1/2] regulator: dt-bindings: rt5739: Add compatible for rt5733 cy_huang
2023-06-29 14:29 ` [PATCH v2 2/2] regulator: rt5739: Add DID check and " cy_huang
2023-07-10  1:47 ` [PATCH v2 0/2] Add compatible support for RT5733 ChiYuan Huang
2023-07-10  6:55   ` Krzysztof Kozlowski
2023-07-10  7:09     ` ChiYuan Huang
2023-07-10  7:27       ` Krzysztof Kozlowski
2023-07-12 14:29 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).