Skip to content

Commit 9f3bec5

Browse files
wensbroonie
authored andcommitted
regulator: mt6358: Use mt6397-regulator.h binding header for buck mode macros
The (undocumented) possible values for the buck operating modes on the MT6358 are the same as those on the MT6397, both for the device tree bindings and the actual hardware register values. Reuse the macros for the MT6397 PMIC in the MT6358 regulator driver by including the mt6397-regulator.h binding header and replacing the existing macros. This aligns it with other PMIC. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230928085537.3246669-7-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent c631494 commit 9f3bec5

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

drivers/regulator/mt6358-regulator.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#include <linux/regulator/mt6358-regulator.h>
1414
#include <linux/regulator/of_regulator.h>
1515

16-
#define MT6358_BUCK_MODE_AUTO 0
17-
#define MT6358_BUCK_MODE_FORCE_PWM 1
16+
#include <dt-bindings/regulator/mediatek,mt6397-regulator.h>
1817

1918
/*
2019
* MT6358 regulators' information
@@ -326,7 +325,7 @@ static const struct linear_range vldo28_ranges[] = {
326325

327326
static unsigned int mt6358_map_mode(unsigned int mode)
328327
{
329-
return mode == MT6358_BUCK_MODE_AUTO ?
328+
return mode == MT6397_BUCK_MODE_AUTO ?
330329
REGULATOR_MODE_NORMAL : REGULATOR_MODE_FAST;
331330
}
332331

@@ -371,10 +370,10 @@ static int mt6358_regulator_set_mode(struct regulator_dev *rdev,
371370

372371
switch (mode) {
373372
case REGULATOR_MODE_FAST:
374-
val = MT6358_BUCK_MODE_FORCE_PWM;
373+
val = MT6397_BUCK_MODE_FORCE_PWM;
375374
break;
376375
case REGULATOR_MODE_NORMAL:
377-
val = MT6358_BUCK_MODE_AUTO;
376+
val = MT6397_BUCK_MODE_AUTO;
378377
break;
379378
default:
380379
return -EINVAL;
@@ -402,9 +401,9 @@ static unsigned int mt6358_regulator_get_mode(struct regulator_dev *rdev)
402401
}
403402

404403
switch ((regval & info->modeset_mask) >> (ffs(info->modeset_mask) - 1)) {
405-
case MT6358_BUCK_MODE_AUTO:
404+
case MT6397_BUCK_MODE_AUTO:
406405
return REGULATOR_MODE_NORMAL;
407-
case MT6358_BUCK_MODE_FORCE_PWM:
406+
case MT6397_BUCK_MODE_FORCE_PWM:
408407
return REGULATOR_MODE_FAST;
409408
default:
410409
return -EINVAL;

0 commit comments

Comments
 (0)