Skip to content

Commit fdda131

Browse files
Ansueldlezcano
authored andcommitted
thermal/drivers/tsens: Use init_common for msm8960
Use init_common and drop custom init for msm8960. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> Reviewed-by: Thara Gopinath <thara.gopinath@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20210420183343.2272-5-ansuelsmth@gmail.com
1 parent 53e2a20 commit fdda131

1 file changed

Lines changed: 1 addition & 51 deletions

File tree

drivers/thermal/qcom/tsens-8960.c

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -173,56 +173,6 @@ static void disable_8960(struct tsens_priv *priv)
173173
regmap_write(priv->tm_map, CNTL_ADDR, reg_cntl);
174174
}
175175

176-
static int init_8960(struct tsens_priv *priv)
177-
{
178-
int ret, i;
179-
u32 reg_cntl;
180-
181-
priv->tm_map = dev_get_regmap(priv->dev, NULL);
182-
if (!priv->tm_map)
183-
return -ENODEV;
184-
185-
/*
186-
* The status registers for each sensor are discontiguous
187-
* because some SoCs have 5 sensors while others have more
188-
* but the control registers stay in the same place, i.e
189-
* directly after the first 5 status registers.
190-
*/
191-
for (i = 0; i < priv->num_sensors; i++) {
192-
if (i >= 5)
193-
priv->sensor[i].status = S0_STATUS_OFF + 40;
194-
priv->sensor[i].status += i * 4;
195-
}
196-
197-
reg_cntl = SW_RST;
198-
ret = regmap_update_bits(priv->tm_map, CNTL_ADDR, SW_RST, reg_cntl);
199-
if (ret)
200-
return ret;
201-
202-
if (priv->num_sensors > 1) {
203-
reg_cntl |= SLP_CLK_ENA | (MEASURE_PERIOD << 18);
204-
reg_cntl &= ~SW_RST;
205-
ret = regmap_update_bits(priv->tm_map, CONFIG_ADDR,
206-
CONFIG_MASK, CONFIG);
207-
} else {
208-
reg_cntl |= SLP_CLK_ENA_8660 | (MEASURE_PERIOD << 16);
209-
reg_cntl &= ~CONFIG_MASK_8660;
210-
reg_cntl |= CONFIG_8660 << CONFIG_SHIFT_8660;
211-
}
212-
213-
reg_cntl |= GENMASK(priv->num_sensors - 1, 0) << SENSOR0_SHIFT;
214-
ret = regmap_write(priv->tm_map, CNTL_ADDR, reg_cntl);
215-
if (ret)
216-
return ret;
217-
218-
reg_cntl |= EN;
219-
ret = regmap_write(priv->tm_map, CNTL_ADDR, reg_cntl);
220-
if (ret)
221-
return ret;
222-
223-
return 0;
224-
}
225-
226176
static int calibrate_8960(struct tsens_priv *priv)
227177
{
228178
int i;
@@ -338,7 +288,7 @@ static const struct reg_field tsens_8960_regfields[MAX_REGFIELDS] = {
338288
};
339289

340290
static const struct tsens_ops ops_8960 = {
341-
.init = init_8960,
291+
.init = init_common,
342292
.calibrate = calibrate_8960,
343293
.get_temp = get_temp_8960,
344294
.enable = enable_8960,

0 commit comments

Comments
 (0)