tps65217-regulator.c (98817a84ff1c755c347ac633ff017a623a631fad) tps65217-regulator.c (2ca76b3e4954ea6bbb365005edc8d5237b488cf1)
1/*
2 * tps65217-regulator.c
3 *
4 * Regulator driver for TPS65217 PMIC
5 *
1/*
2 * tps65217-regulator.c
3 *
4 * Regulator driver for TPS65217 PMIC
5 *
6 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

--- 104 unchanged lines hidden (view full) ---

119 return ret;
120}
121
122static int tps65217_pmic_set_suspend_enable(struct regulator_dev *dev)
123{
124 struct tps65217 *tps = rdev_get_drvdata(dev);
125 unsigned int rid = rdev_get_id(dev);
126
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

--- 104 unchanged lines hidden (view full) ---

119 return ret;
120}
121
122static int tps65217_pmic_set_suspend_enable(struct regulator_dev *dev)
123{
124 struct tps65217 *tps = rdev_get_drvdata(dev);
125 unsigned int rid = rdev_get_id(dev);
126
127 if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4)
127 if (rid > TPS65217_LDO_4)
128 return -EINVAL;
129
130 return tps65217_clear_bits(tps, dev->desc->bypass_reg,
131 dev->desc->bypass_mask,
132 TPS65217_PROTECT_L1);
133}
134
135static int tps65217_pmic_set_suspend_disable(struct regulator_dev *dev)
136{
137 struct tps65217 *tps = rdev_get_drvdata(dev);
138 unsigned int rid = rdev_get_id(dev);
139
128 return -EINVAL;
129
130 return tps65217_clear_bits(tps, dev->desc->bypass_reg,
131 dev->desc->bypass_mask,
132 TPS65217_PROTECT_L1);
133}
134
135static int tps65217_pmic_set_suspend_disable(struct regulator_dev *dev)
136{
137 struct tps65217 *tps = rdev_get_drvdata(dev);
138 unsigned int rid = rdev_get_id(dev);
139
140 if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4)
140 if (rid > TPS65217_LDO_4)
141 return -EINVAL;
142
143 if (!tps->strobes[rid])
144 return -EINVAL;
145
146 return tps65217_set_bits(tps, dev->desc->bypass_reg,
147 dev->desc->bypass_mask,
148 tps->strobes[rid], TPS65217_PROTECT_L1);

--- 100 unchanged lines hidden (view full) ---

249 if (IS_ERR(rdev)) {
250 dev_err(tps->dev, "failed to register %s regulator\n",
251 pdev->name);
252 return PTR_ERR(rdev);
253 }
254
255 /* Store default strobe info */
256 ret = tps65217_reg_read(tps, regulators[i].bypass_reg, &val);
141 return -EINVAL;
142
143 if (!tps->strobes[rid])
144 return -EINVAL;
145
146 return tps65217_set_bits(tps, dev->desc->bypass_reg,
147 dev->desc->bypass_mask,
148 tps->strobes[rid], TPS65217_PROTECT_L1);

--- 100 unchanged lines hidden (view full) ---

249 if (IS_ERR(rdev)) {
250 dev_err(tps->dev, "failed to register %s regulator\n",
251 pdev->name);
252 return PTR_ERR(rdev);
253 }
254
255 /* Store default strobe info */
256 ret = tps65217_reg_read(tps, regulators[i].bypass_reg, &val);
257 if (ret)
258 return ret;
259
257 tps->strobes[i] = val & regulators[i].bypass_mask;
258 }
259
260 return 0;
261}
262
263static struct platform_driver tps65217_regulator_driver = {
264 .driver = {

--- 21 unchanged lines hidden ---
260 tps->strobes[i] = val & regulators[i].bypass_mask;
261 }
262
263 return 0;
264}
265
266static struct platform_driver tps65217_regulator_driver = {
267 .driver = {

--- 21 unchanged lines hidden ---