mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
mfd: max96755f: Enable regcache
Signed-off-by: Guochun Huang <hero.huang@rock-chips.com> Change-Id: I1554f964da231b2b0557010fee31dcfbeda3997a
This commit is contained in:
@@ -37,11 +37,33 @@ static const struct mfd_cell max96755f_devs[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static bool max96755f_volatile_reg(struct device *dev, unsigned int reg)
|
||||
{
|
||||
switch (reg) {
|
||||
case 0x0002:
|
||||
case 0x0010:
|
||||
case 0x0013:
|
||||
case 0x0053:
|
||||
case 0x0057:
|
||||
case 0x02be ... 0x02fc:
|
||||
case 0x0311:
|
||||
case 0x032a:
|
||||
case 0x0330 ... 0x0331:
|
||||
case 0x0385 ... 0x0387:
|
||||
case 0x03a4 ... 0x03ae:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct regmap_config max96755f_regmap_config = {
|
||||
.name = "max96755f",
|
||||
.reg_bits = 16,
|
||||
.val_bits = 8,
|
||||
.max_register = 0x1b17,
|
||||
.volatile_reg = max96755f_volatile_reg,
|
||||
.cache_type = REGCACHE_RBTREE,
|
||||
};
|
||||
|
||||
static int max96755f_select(struct i2c_mux_core *muxc, u32 chan)
|
||||
@@ -309,6 +331,28 @@ static void max96755f_i2c_shutdown(struct i2c_client *client)
|
||||
max96755f_power_off(max96755f);
|
||||
}
|
||||
|
||||
static int __maybe_unused max96755f_suspend(struct device *dev)
|
||||
{
|
||||
struct max96755f *max96755f = dev_get_drvdata(dev);
|
||||
|
||||
regcache_mark_dirty(max96755f->regmap);
|
||||
regcache_cache_only(max96755f->regmap, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused max96755f_resume(struct device *dev)
|
||||
{
|
||||
struct max96755f *max96755f = dev_get_drvdata(dev);
|
||||
|
||||
regcache_cache_only(max96755f->regmap, false);
|
||||
regcache_sync(max96755f->regmap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(max96755f_pm_ops, max96755f_suspend, max96755f_resume);
|
||||
|
||||
static const struct of_device_id max96755f_of_match[] = {
|
||||
{ .compatible = "maxim,max96755f", },
|
||||
{}
|
||||
@@ -319,6 +363,7 @@ static struct i2c_driver max96755f_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "max96755f",
|
||||
.of_match_table = max96755f_of_match,
|
||||
.pm = &max96755f_pm_ops,
|
||||
},
|
||||
.probe_new = max96755f_i2c_probe,
|
||||
.remove = max96755f_i2c_remove,
|
||||
|
||||
Reference in New Issue
Block a user