Lines Matching refs:bdreg
141 static int bd9571mwv_bkup_mode_read(struct bd9571mwv_reg *bdreg, in bd9571mwv_bkup_mode_read() argument
146 ret = regmap_read(bdreg->regmap, BD9571MWV_BKUP_MODE_CNT, mode); in bd9571mwv_bkup_mode_read()
148 dev_err(regmap_get_device(bdreg->regmap), in bd9571mwv_bkup_mode_read()
156 static int bd9571mwv_bkup_mode_write(struct bd9571mwv_reg *bdreg, in bd9571mwv_bkup_mode_write() argument
161 ret = regmap_write(bdreg->regmap, BD9571MWV_BKUP_MODE_CNT, mode); in bd9571mwv_bkup_mode_write()
163 dev_err(regmap_get_device(bdreg->regmap), in bd9571mwv_bkup_mode_write()
175 struct bd9571mwv_reg *bdreg = dev_get_drvdata(dev); in backup_mode_show() local
177 return sysfs_emit(buf, "%s\n", bdreg->bkup_mode_enabled ? "on" : "off"); in backup_mode_show()
184 struct bd9571mwv_reg *bdreg = dev_get_drvdata(dev); in backup_mode_store() local
191 ret = kstrtobool(buf, &bdreg->bkup_mode_enabled); in backup_mode_store()
195 if (!bdreg->rstbmode_level) in backup_mode_store()
202 ret = bd9571mwv_bkup_mode_read(bdreg, &mode); in backup_mode_store()
207 if (bdreg->bkup_mode_enabled) in backup_mode_store()
208 mode |= bdreg->bkup_mode_cnt_keepon; in backup_mode_store()
210 ret = bd9571mwv_bkup_mode_write(bdreg, mode); in backup_mode_store()
221 struct bd9571mwv_reg *bdreg = dev_get_drvdata(dev); in bd9571mwv_suspend() local
225 if (!bdreg->bkup_mode_enabled) in bd9571mwv_suspend()
229 ret = bd9571mwv_bkup_mode_read(bdreg, &mode); in bd9571mwv_suspend()
233 bdreg->bkup_mode_cnt_saved = mode; in bd9571mwv_suspend()
235 if (!bdreg->rstbmode_pulse) in bd9571mwv_suspend()
240 mode |= bdreg->bkup_mode_cnt_keepon; in bd9571mwv_suspend()
242 if (mode != bdreg->bkup_mode_cnt_saved) in bd9571mwv_suspend()
243 return bd9571mwv_bkup_mode_write(bdreg, mode); in bd9571mwv_suspend()
250 struct bd9571mwv_reg *bdreg = dev_get_drvdata(dev); in bd9571mwv_resume() local
252 if (!bdreg->bkup_mode_enabled) in bd9571mwv_resume()
256 return bd9571mwv_bkup_mode_write(bdreg, bdreg->bkup_mode_cnt_saved); in bd9571mwv_resume()
276 struct bd9571mwv_reg *bdreg; in bd9571mwv_regulator_probe() local
282 bdreg = devm_kzalloc(&pdev->dev, sizeof(*bdreg), GFP_KERNEL); in bd9571mwv_regulator_probe()
283 if (!bdreg) in bd9571mwv_regulator_probe()
286 bdreg->regmap = dev_get_regmap(pdev->dev.parent, NULL); in bd9571mwv_regulator_probe()
288 platform_set_drvdata(pdev, bdreg); in bd9571mwv_regulator_probe()
292 config.driver_data = bdreg; in bd9571mwv_regulator_probe()
293 config.regmap = bdreg->regmap; in bd9571mwv_regulator_probe()
315 bdreg->bkup_mode_cnt_keepon = val; in bd9571mwv_regulator_probe()
317 bdreg->rstbmode_level = of_property_read_bool(config.dev->of_node, in bd9571mwv_regulator_probe()
319 bdreg->rstbmode_pulse = of_property_read_bool(config.dev->of_node, in bd9571mwv_regulator_probe()
321 if (bdreg->rstbmode_level && bdreg->rstbmode_pulse) { in bd9571mwv_regulator_probe()
327 if (bdreg->bkup_mode_cnt_keepon) { in bd9571mwv_regulator_probe()
334 bdreg->bkup_mode_enabled = bdreg->rstbmode_pulse; in bd9571mwv_regulator_probe()