File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 27
27
#define SNVS_HPSR_BTN BIT(6)
28
28
#define SNVS_LPSR_SPO BIT(18)
29
29
#define SNVS_LPCR_DEP_EN BIT(5)
30
+ #define SNVS_LPCR_BPT_SHIFT 16
31
+ #define SNVS_LPCR_BPT_MASK (3 << SNVS_LPCR_BPT_SHIFT)
30
32
31
33
#define DEBOUNCE_TIME 30
32
34
#define REPEAT_INTERVAL 60
@@ -114,6 +116,8 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
114
116
struct device_node * np ;
115
117
struct clk * clk ;
116
118
int error ;
119
+ unsigned int val ;
120
+ unsigned int bpt ;
117
121
u32 vid ;
118
122
119
123
/* Get SNVS register Page */
@@ -148,6 +152,27 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
148
152
if (pdata -> irq < 0 )
149
153
return - EINVAL ;
150
154
155
+ error = of_property_read_u32 (np , "power-off-time-sec" , & val );
156
+ if (!error ) {
157
+ switch (val ) {
158
+ case 0 :
159
+ bpt = 0x3 ;
160
+ break ;
161
+ case 5 :
162
+ case 10 :
163
+ case 15 :
164
+ bpt = (val / 5 ) - 1 ;
165
+ break ;
166
+ default :
167
+ dev_err (& pdev -> dev ,
168
+ "power-off-time-sec %d out of range\n" , val );
169
+ return - EINVAL ;
170
+ }
171
+
172
+ regmap_update_bits (pdata -> snvs , SNVS_LPCR_REG , SNVS_LPCR_BPT_MASK ,
173
+ bpt << SNVS_LPCR_BPT_SHIFT );
174
+ }
175
+
151
176
regmap_read (pdata -> snvs , SNVS_HPVIDR1_REG , & vid );
152
177
pdata -> minor_rev = vid & 0xff ;
153
178
You can’t perform that action at this time.
0 commit comments