Commit f30b0716feaedc0cf432ed8eca82c46104d64c0d

Authored by Laxman Dewangan
Committed by Mark Brown
1 parent 844775ef98

regulator: tps65910: Sleep off rails when ext sleep configured

Keep the rails OFF in sleep mode only when the rails are
controlled by external sleep control.
The devices tps65910 and tps65911, both has the sleep input.
The tps65911's sleep input is not same as tps65910's EN3 and hence
taking care of SLEEP input as separate external sleep control input.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Showing 2 changed files with 15 additions and 7 deletions Side-by-side Diff

drivers/regulator/tps65910-regulator.c
... ... @@ -28,7 +28,8 @@
28 28 #define TPS65910_SUPPLY_STATE_ENABLED 0x1
29 29 #define EXT_SLEEP_CONTROL (TPS65910_SLEEP_CONTROL_EXT_INPUT_EN1 | \
30 30 TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2 | \
31   - TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3)
  31 + TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 | \
  32 + TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP)
32 33  
33 34 /* supported VIO voltages in milivolts */
34 35 static const u16 VIO_VSEL_table[] = {
... ... @@ -922,6 +923,8 @@
922 923 TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2) != 0);
923 924 en_count += ((ext_sleep_config &
924 925 TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3) != 0);
  926 + en_count += ((ext_sleep_config &
  927 + TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP) != 0);
925 928 if (en_count > 1) {
926 929 dev_err(mfd->dev,
927 930 "External sleep control flag is not proper\n");
928 931  
... ... @@ -1018,12 +1021,18 @@
1018 1021  
1019 1022 ret = tps65910_clear_bits(mfd,
1020 1023 TPS65910_SLEEP_KEEP_LDO_ON + regoffs, bit_pos);
1021   - if (!ret)
1022   - ret = tps65910_set_bits(mfd,
1023   - TPS65910_SLEEP_SET_LDO_OFF + regoffs, bit_pos);
  1024 + if (!ret) {
  1025 + if (ext_sleep_config & TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP)
  1026 + ret = tps65910_set_bits(mfd,
  1027 + TPS65910_SLEEP_SET_LDO_OFF + regoffs, bit_pos);
  1028 + else
  1029 + ret = tps65910_clear_bits(mfd,
  1030 + TPS65910_SLEEP_SET_LDO_OFF + regoffs, bit_pos);
  1031 + }
1024 1032 if (ret < 0)
1025 1033 dev_err(mfd->dev,
1026 1034 "Error in configuring SLEEP register\n");
  1035 +
1027 1036 return ret;
1028 1037 }
1029 1038  
include/linux/mfd/tps65910.h
... ... @@ -768,12 +768,11 @@
768 768 /* Max number of TPS65910/11 regulators */
769 769 #define TPS65910_NUM_REGS 13
770 770  
771   -/* External sleep controls through EN1/EN2/EN3 inputs*/
  771 +/* External sleep controls through EN1/EN2/EN3/SLEEP inputs */
772 772 #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN1 0x1
773 773 #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2 0x2
774 774 #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 0x4
775   -/* TPS65911 names the EN3 signal as SLEEP */
776   -#define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x4
  775 +#define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x8
777 776  
778 777 /**
779 778 * struct tps65910_board