@@ -32,11 +32,31 @@ static const struct mfd_cell max96745_devs[] = {
32
32
},
33
33
};
34
34
35
+ static bool max96745_volatile_reg (struct device * dev , unsigned int reg )
36
+ {
37
+ switch (reg ) {
38
+ case 0x0028 ... 0x0029 :
39
+ case 0x0032 ... 0x0033 :
40
+ case 0x0076 :
41
+ case 0x0086 :
42
+ case 0x0100 :
43
+ case 0x0200 ... 0x02ce :
44
+ case 0x7000 :
45
+ case 0x7070 :
46
+ case 0x7074 :
47
+ return false;
48
+ default :
49
+ return true;
50
+ }
51
+ }
52
+
35
53
static const struct regmap_config max96745_regmap_config = {
36
54
.name = "max96745" ,
37
55
.reg_bits = 16 ,
38
56
.val_bits = 8 ,
39
57
.max_register = 0x8000 ,
58
+ .volatile_reg = max96745_volatile_reg ,
59
+ .cache_type = REGCACHE_RBTREE ,
40
60
};
41
61
42
62
static int max96745_select (struct i2c_mux_core * muxc , u32 chan )
@@ -101,7 +121,6 @@ static int max96745_power_on(struct max96745 *max96745)
101
121
regmap_update_bits (max96745 -> regmap , 0x0086 , DIS_REM_CC ,
102
122
FIELD_PREP (DIS_REM_CC , 1 ));
103
123
104
-
105
124
return 0 ;
106
125
}
107
126
@@ -192,6 +211,28 @@ static void max96745_i2c_shutdown(struct i2c_client *client)
192
211
max96745_power_off (max96745 );
193
212
}
194
213
214
+ static int __maybe_unused max96745_suspend (struct device * dev )
215
+ {
216
+ struct max96745 * max96745 = dev_get_drvdata (dev );
217
+
218
+ regcache_mark_dirty (max96745 -> regmap );
219
+ regcache_cache_only (max96745 -> regmap , true);
220
+
221
+ return 0 ;
222
+ }
223
+
224
+ static int __maybe_unused max96745_resume (struct device * dev )
225
+ {
226
+ struct max96745 * max96745 = dev_get_drvdata (dev );
227
+
228
+ regcache_cache_only (max96745 -> regmap , false);
229
+ regcache_sync (max96745 -> regmap );
230
+
231
+ return 0 ;
232
+ }
233
+
234
+ static SIMPLE_DEV_PM_OPS (max96745_pm_ops , max96745_suspend , max96745_resume ) ;
235
+
195
236
static const struct of_device_id max96745_of_match [] = {
196
237
{ .compatible = "maxim,max96745" , },
197
238
{}
@@ -202,6 +243,7 @@ static struct i2c_driver max96745_i2c_driver = {
202
243
.driver = {
203
244
.name = "max96745" ,
204
245
.of_match_table = max96745_of_match ,
246
+ .pm = & max96745_pm_ops ,
205
247
},
206
248
.probe_new = max96745_i2c_probe ,
207
249
.remove = max96745_i2c_remove ,
0 commit comments