forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-20 ea08eeccae9297f7aabd2ef7f0c2517ac4549acc
kernel/drivers/regulator/rc5t583-regulator.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Regulator driver for RICOH RC5T583 power management chip.
34 *
....@@ -6,20 +7,6 @@
67 *
78 * based on code
89 * Copyright (C) 2011 RICOH COMPANY,LTD
9
- *
10
- *
11
- * This program is free software; you can redistribute it and/or modify it
12
- * under the terms and conditions of the GNU General Public License,
13
- * version 2, as published by the Free Software Foundation.
14
- *
15
- * This program is distributed in the hope it will be useful, but WITHOUT
16
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18
- * more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
22
- *
2310 */
2411
2512 #include <linux/module.h>
....@@ -47,18 +34,13 @@
4734 struct regulator_desc desc;
4835 };
4936
50
-struct rc5t583_regulator {
51
- struct rc5t583_regulator_info *reg_info;
52
- struct regulator_dev *rdev;
53
-};
54
-
5537 static int rc5t583_regulator_enable_time(struct regulator_dev *rdev)
5638 {
57
- struct rc5t583_regulator *reg = rdev_get_drvdata(rdev);
39
+ struct rc5t583_regulator_info *reg_info = rdev_get_drvdata(rdev);
5840 int vsel = regulator_get_voltage_sel_regmap(rdev);
5941 int curr_uV = regulator_list_voltage_linear(rdev, vsel);
6042
61
- return DIV_ROUND_UP(curr_uV, reg->reg_info->enable_uv_per_us);
43
+ return DIV_ROUND_UP(curr_uV, reg_info->enable_uv_per_us);
6244 }
6345
6446 static const struct regulator_ops rc5t583_ops = {
....@@ -120,8 +102,6 @@
120102 struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent);
121103 struct rc5t583_platform_data *pdata = dev_get_platdata(rc5t583->dev);
122104 struct regulator_config config = { };
123
- struct rc5t583_regulator *reg = NULL;
124
- struct rc5t583_regulator *regs;
125105 struct regulator_dev *rdev;
126106 struct rc5t583_regulator_info *ri;
127107 int ret;
....@@ -132,18 +112,8 @@
132112 return -ENODEV;
133113 }
134114
135
- regs = devm_kcalloc(&pdev->dev,
136
- RC5T583_REGULATOR_MAX,
137
- sizeof(struct rc5t583_regulator),
138
- GFP_KERNEL);
139
- if (!regs)
140
- return -ENOMEM;
141
-
142
-
143115 for (id = 0; id < RC5T583_REGULATOR_MAX; ++id) {
144
- reg = &regs[id];
145116 ri = &rc5t583_reg_info[id];
146
- reg->reg_info = ri;
147117
148118 if (ri->deepsleep_id == RC5T583_DS_NONE)
149119 goto skip_ext_pwr_config;
....@@ -163,7 +133,7 @@
163133 skip_ext_pwr_config:
164134 config.dev = &pdev->dev;
165135 config.init_data = pdata->reg_init_data[id];
166
- config.driver_data = reg;
136
+ config.driver_data = ri;
167137 config.regmap = rc5t583->regmap;
168138
169139 rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config);
....@@ -172,9 +142,7 @@
172142 ri->desc.name);
173143 return PTR_ERR(rdev);
174144 }
175
- reg->rdev = rdev;
176145 }
177
- platform_set_drvdata(pdev, regs);
178146 return 0;
179147 }
180148