Lines Matching +full:int +full:- +full:map +full:- +full:mask
1 // SPDX-License-Identifier: GPL-2.0
41 #define S5_STATUS_OFF 0x3664 /* Sensors 5-10 found on apq8064/msm8960 */
48 /* Original slope - 350 to compensate mC to C inaccuracy */
55 static int suspend_8960(struct tsens_priv *priv) in suspend_8960()
57 int ret; in suspend_8960()
58 unsigned int mask; in suspend_8960() local
59 struct regmap *map = priv->tm_map; in suspend_8960() local
61 ret = regmap_read(map, THRESHOLD_ADDR, &priv->ctx.threshold); in suspend_8960()
65 ret = regmap_read(map, CNTL_ADDR, &priv->ctx.control); in suspend_8960()
69 if (priv->num_sensors > 1) in suspend_8960()
70 mask = SLP_CLK_ENA | EN; in suspend_8960()
72 mask = SLP_CLK_ENA_8660 | EN; in suspend_8960()
74 ret = regmap_update_bits(map, CNTL_ADDR, mask, 0); in suspend_8960()
81 static int resume_8960(struct tsens_priv *priv) in resume_8960()
83 int ret; in resume_8960()
84 struct regmap *map = priv->tm_map; in resume_8960() local
86 ret = regmap_update_bits(map, CNTL_ADDR, SW_RST, SW_RST); in resume_8960()
94 if (priv->num_sensors > 1) { in resume_8960()
95 ret = regmap_update_bits(map, CONFIG_ADDR, CONFIG_MASK, CONFIG); in resume_8960()
100 ret = regmap_write(map, THRESHOLD_ADDR, priv->ctx.threshold); in resume_8960()
104 ret = regmap_write(map, CNTL_ADDR, priv->ctx.control); in resume_8960()
111 static int enable_8960(struct tsens_priv *priv, int id) in enable_8960()
113 int ret; in enable_8960()
114 u32 reg, mask = BIT(id); in enable_8960() local
116 ret = regmap_read(priv->tm_map, CNTL_ADDR, ®); in enable_8960()
123 * (Sensor 6-7 disabled, Sensor 3 disabled...) In the original driver, in enable_8960()
128 mask = GENMASK(10, 6); in enable_8960()
130 mask <<= SENSOR0_SHIFT; in enable_8960()
133 if ((reg & mask) == mask) in enable_8960()
136 ret = regmap_write(priv->tm_map, CNTL_ADDR, reg | SW_RST); in enable_8960()
142 if (priv->num_sensors > 1) in enable_8960()
143 reg |= mask | SLP_CLK_ENA | EN; in enable_8960()
145 reg |= mask | SLP_CLK_ENA_8660 | EN; in enable_8960()
147 ret = regmap_write(priv->tm_map, CNTL_ADDR, reg); in enable_8960()
156 int ret; in disable_8960()
158 u32 mask; in disable_8960() local
160 mask = GENMASK(priv->num_sensors - 1, 0); in disable_8960()
161 mask <<= SENSOR0_SHIFT; in disable_8960()
162 mask |= EN; in disable_8960()
164 ret = regmap_read(priv->tm_map, CNTL_ADDR, ®_cntl); in disable_8960()
168 reg_cntl &= ~mask; in disable_8960()
170 if (priv->num_sensors > 1) in disable_8960()
175 regmap_write(priv->tm_map, CNTL_ADDR, reg_cntl); in disable_8960()
178 static int calibrate_8960(struct tsens_priv *priv) in calibrate_8960()
180 int i; in calibrate_8960()
184 data = qfprom_read(priv->dev, "calib"); in calibrate_8960()
186 data = qfprom_read(priv->dev, "calib_backup"); in calibrate_8960()
190 for (i = 0; i < priv->num_sensors; i++) { in calibrate_8960()
192 priv->sensor[i].slope = tsens_msm8960_slope[i]; in calibrate_8960()
203 /* ----- SROT ------ */
212 /* ----- TM ------ */
221 * MIN_THRESH_0 -> CRIT_THRESH_1
222 * MAX_THRESH_0 -> CRIT_THRESH_0
276 .trip_min_temp = -40000,