@@ -126,119 +126,6 @@ static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
126
126
return __ti_thermal_get_temp (data , temp );
127
127
}
128
128
129
- /* Bind callback functions for thermal zone */
130
- static int ti_thermal_bind (struct thermal_zone_device * thermal ,
131
- struct thermal_cooling_device * cdev )
132
- {
133
- struct ti_thermal_data * data = thermal -> devdata ;
134
- int id ;
135
-
136
- if (!data || IS_ERR (data ))
137
- return - ENODEV ;
138
-
139
- /* check if this is the cooling device we registered */
140
- if (data -> cool_dev != cdev )
141
- return 0 ;
142
-
143
- id = data -> sensor_id ;
144
-
145
- /* Simple thing, two trips, one passive another critical */
146
- return thermal_zone_bind_cooling_device (thermal , 0 , cdev ,
147
- /* bind with min and max states defined by cpu_cooling */
148
- THERMAL_NO_LIMIT ,
149
- THERMAL_NO_LIMIT ,
150
- THERMAL_WEIGHT_DEFAULT );
151
- }
152
-
153
- /* Unbind callback functions for thermal zone */
154
- static int ti_thermal_unbind (struct thermal_zone_device * thermal ,
155
- struct thermal_cooling_device * cdev )
156
- {
157
- struct ti_thermal_data * data = thermal -> devdata ;
158
-
159
- if (!data || IS_ERR (data ))
160
- return - ENODEV ;
161
-
162
- /* check if this is the cooling device we registered */
163
- if (data -> cool_dev != cdev )
164
- return 0 ;
165
-
166
- /* Simple thing, two trips, one passive another critical */
167
- return thermal_zone_unbind_cooling_device (thermal , 0 , cdev );
168
- }
169
-
170
- /* Get mode callback functions for thermal zone */
171
- static int ti_thermal_get_mode (struct thermal_zone_device * thermal ,
172
- enum thermal_device_mode * mode )
173
- {
174
- struct ti_thermal_data * data = thermal -> devdata ;
175
-
176
- if (data )
177
- * mode = data -> mode ;
178
-
179
- return 0 ;
180
- }
181
-
182
- /* Set mode callback functions for thermal zone */
183
- static int ti_thermal_set_mode (struct thermal_zone_device * thermal ,
184
- enum thermal_device_mode mode )
185
- {
186
- struct ti_thermal_data * data = thermal -> devdata ;
187
- struct ti_bandgap * bgp ;
188
-
189
- bgp = data -> bgp ;
190
-
191
- if (!data -> ti_thermal ) {
192
- dev_notice (& thermal -> device , "thermal zone not registered\n" );
193
- return 0 ;
194
- }
195
-
196
- mutex_lock (& data -> ti_thermal -> lock );
197
-
198
- if (mode == THERMAL_DEVICE_ENABLED )
199
- data -> ti_thermal -> polling_delay = FAST_TEMP_MONITORING_RATE ;
200
- else
201
- data -> ti_thermal -> polling_delay = 0 ;
202
-
203
- mutex_unlock (& data -> ti_thermal -> lock );
204
-
205
- data -> mode = mode ;
206
- ti_bandgap_write_update_interval (bgp , data -> sensor_id ,
207
- data -> ti_thermal -> polling_delay );
208
- thermal_zone_device_update (data -> ti_thermal , THERMAL_EVENT_UNSPECIFIED );
209
- dev_dbg (& thermal -> device , "thermal polling set for duration=%d msec\n" ,
210
- data -> ti_thermal -> polling_delay );
211
-
212
- return 0 ;
213
- }
214
-
215
- /* Get trip type callback functions for thermal zone */
216
- static int ti_thermal_get_trip_type (struct thermal_zone_device * thermal ,
217
- int trip , enum thermal_trip_type * type )
218
- {
219
- if (!ti_thermal_is_valid_trip (trip ))
220
- return - EINVAL ;
221
-
222
- if (trip + 1 == OMAP_TRIP_NUMBER )
223
- * type = THERMAL_TRIP_CRITICAL ;
224
- else
225
- * type = THERMAL_TRIP_PASSIVE ;
226
-
227
- return 0 ;
228
- }
229
-
230
- /* Get trip temperature callback functions for thermal zone */
231
- static int ti_thermal_get_trip_temp (struct thermal_zone_device * thermal ,
232
- int trip , int * temp )
233
- {
234
- if (!ti_thermal_is_valid_trip (trip ))
235
- return - EINVAL ;
236
-
237
- * temp = ti_thermal_get_trip_value (trip );
238
-
239
- return 0 ;
240
- }
241
-
242
129
static int __ti_thermal_get_trend (void * p , int trip , enum thermal_trend * trend )
243
130
{
244
131
struct ti_thermal_data * data = p ;
@@ -262,38 +149,11 @@ static int __ti_thermal_get_trend(void *p, int trip, enum thermal_trend *trend)
262
149
return 0 ;
263
150
}
264
151
265
- /* Get the temperature trend callback functions for thermal zone */
266
- static int ti_thermal_get_trend (struct thermal_zone_device * thermal ,
267
- int trip , enum thermal_trend * trend )
268
- {
269
- return __ti_thermal_get_trend (thermal -> devdata , trip , trend );
270
- }
271
-
272
- /* Get critical temperature callback functions for thermal zone */
273
- static int ti_thermal_get_crit_temp (struct thermal_zone_device * thermal ,
274
- int * temp )
275
- {
276
- /* shutdown zone */
277
- return ti_thermal_get_trip_temp (thermal , OMAP_TRIP_NUMBER - 1 , temp );
278
- }
279
-
280
152
static const struct thermal_zone_of_device_ops ti_of_thermal_ops = {
281
153
.get_temp = __ti_thermal_get_temp ,
282
154
.get_trend = __ti_thermal_get_trend ,
283
155
};
284
156
285
- static struct thermal_zone_device_ops ti_thermal_ops = {
286
- .get_temp = ti_thermal_get_temp ,
287
- .get_trend = ti_thermal_get_trend ,
288
- .bind = ti_thermal_bind ,
289
- .unbind = ti_thermal_unbind ,
290
- .get_mode = ti_thermal_get_mode ,
291
- .set_mode = ti_thermal_set_mode ,
292
- .get_trip_type = ti_thermal_get_trip_type ,
293
- .get_trip_temp = ti_thermal_get_trip_temp ,
294
- .get_crit_temp = ti_thermal_get_crit_temp ,
295
- };
296
-
297
157
static struct ti_thermal_data
298
158
* ti_thermal_build_data (struct ti_bandgap * bgp , int id )
299
159
{
@@ -331,18 +191,10 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
331
191
data -> ti_thermal = devm_thermal_zone_of_sensor_register (bgp -> dev , id ,
332
192
data , & ti_of_thermal_ops );
333
193
if (IS_ERR (data -> ti_thermal )) {
334
- /* Create thermal zone */
335
- data -> ti_thermal = thermal_zone_device_register (domain ,
336
- OMAP_TRIP_NUMBER , 0 , data , & ti_thermal_ops ,
337
- NULL , FAST_TEMP_MONITORING_RATE ,
338
- FAST_TEMP_MONITORING_RATE );
339
- if (IS_ERR (data -> ti_thermal )) {
340
- dev_err (bgp -> dev , "thermal zone device is NULL\n" );
341
- return PTR_ERR (data -> ti_thermal );
342
- }
343
- data -> ti_thermal -> polling_delay = FAST_TEMP_MONITORING_RATE ;
344
- data -> our_zone = true;
194
+ dev_err (bgp -> dev , "thermal zone device is NULL\n" );
195
+ return PTR_ERR (data -> ti_thermal );
345
196
}
197
+
346
198
ti_bandgap_set_sensor_data (bgp , id , data );
347
199
ti_bandgap_write_update_interval (bgp , data -> sensor_id ,
348
200
data -> ti_thermal -> polling_delay );
0 commit comments