Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Chen-Yu Tsai and committed by
Mark Brown
9f3bec54 c631494a

+6 -7
+6 -7
drivers/regulator/mt6358-regulator.c
··· 13 13 #include <linux/regulator/mt6358-regulator.h> 14 14 #include <linux/regulator/of_regulator.h> 15 15 16 - #define MT6358_BUCK_MODE_AUTO 0 17 - #define MT6358_BUCK_MODE_FORCE_PWM 1 16 + #include <dt-bindings/regulator/mediatek,mt6397-regulator.h> 18 17 19 18 /* 20 19 * MT6358 regulators' information ··· 325 326 326 327 static unsigned int mt6358_map_mode(unsigned int mode) 327 328 { 328 - return mode == MT6358_BUCK_MODE_AUTO ? 329 + return mode == MT6397_BUCK_MODE_AUTO ? 329 330 REGULATOR_MODE_NORMAL : REGULATOR_MODE_FAST; 330 331 } 331 332 ··· 370 371 371 372 switch (mode) { 372 373 case REGULATOR_MODE_FAST: 373 - val = MT6358_BUCK_MODE_FORCE_PWM; 374 + val = MT6397_BUCK_MODE_FORCE_PWM; 374 375 break; 375 376 case REGULATOR_MODE_NORMAL: 376 - val = MT6358_BUCK_MODE_AUTO; 377 + val = MT6397_BUCK_MODE_AUTO; 377 378 break; 378 379 default: 379 380 return -EINVAL; ··· 401 402 } 402 403 403 404 switch ((regval & info->modeset_mask) >> (ffs(info->modeset_mask) - 1)) { 404 - case MT6358_BUCK_MODE_AUTO: 405 + case MT6397_BUCK_MODE_AUTO: 405 406 return REGULATOR_MODE_NORMAL; 406 - case MT6358_BUCK_MODE_FORCE_PWM: 407 + case MT6397_BUCK_MODE_FORCE_PWM: 407 408 return REGULATOR_MODE_FAST; 408 409 default: 409 410 return -EINVAL;