Lines Matching full:sat
46 struct wf_sat *sat; member
55 struct wf_sat *sat; in smu_sat_get_sdb_partition() local
63 if (sat_id > 1 || (sat = sats[sat_id]) == NULL) in smu_sat_get_sdb_partition()
66 err = i2c_smbus_write_word_data(sat->i2c, 8, id << 8); in smu_sat_get_sdb_partition()
72 err = i2c_smbus_read_word_data(sat->i2c, 9); in smu_sat_get_sdb_partition()
90 err = i2c_smbus_read_i2c_block_data(sat->i2c, 0xa, 4, data); in smu_sat_get_sdb_partition()
102 printk(KERN_DEBUG "sat %d partition %x:", sat_id, id); in smu_sat_get_sdb_partition()
116 static int wf_sat_read_cache(struct wf_sat *sat) in wf_sat_read_cache() argument
120 err = i2c_smbus_read_i2c_block_data(sat->i2c, 0x3f, 16, sat->cache); in wf_sat_read_cache()
123 sat->last_read = jiffies; in wf_sat_read_cache()
130 16, 1, sat->cache, 16, false); in wf_sat_read_cache()
139 struct wf_sat *sat = sens->sat; in wf_sat_sensor_get() local
143 if (sat->i2c == NULL) in wf_sat_sensor_get()
146 mutex_lock(&sat->mutex); in wf_sat_sensor_get()
147 if (time_after(jiffies, (sat->last_read + MAX_AGE))) { in wf_sat_sensor_get()
148 err = wf_sat_read_cache(sat); in wf_sat_sensor_get()
154 val = ((sat->cache[i] << 8) + sat->cache[i+1]) << sens->shift; in wf_sat_sensor_get()
158 val = (val * ((sat->cache[i] << 8) + sat->cache[i+1])) >> 4; in wf_sat_sensor_get()
165 mutex_unlock(&sat->mutex); in wf_sat_sensor_get()
171 struct wf_sat *sat = container_of(ref, struct wf_sat, ref); in wf_sat_release() local
173 if (sat->nr >= 0) in wf_sat_release()
174 sats[sat->nr] = NULL; in wf_sat_release()
175 kfree(sat); in wf_sat_release()
181 struct wf_sat *sat = sens->sat; in wf_sat_sensor_release() local
184 kref_put(&sat->ref, wf_sat_release); in wf_sat_sensor_release()
197 struct wf_sat *sat; in wf_sat_probe() local
207 sat = kzalloc(sizeof(struct wf_sat), GFP_KERNEL); in wf_sat_probe()
208 if (sat == NULL) in wf_sat_probe()
210 sat->nr = -1; in wf_sat_probe()
211 sat->node = of_node_get(dev); in wf_sat_probe()
212 kref_init(&sat->ref); in wf_sat_probe()
213 mutex_init(&sat->mutex); in wf_sat_probe()
214 sat->i2c = client; in wf_sat_probe()
215 INIT_LIST_HEAD(&sat->sensors); in wf_sat_probe()
216 i2c_set_clientdata(client, sat); in wf_sat_probe()
244 if (sat->nr < 0) in wf_sat_probe()
245 sat->nr = chip; in wf_sat_probe()
246 else if (sat->nr != chip) { in wf_sat_probe()
248 "multiple CPU chips on one SAT (%s)\n", loc); in wf_sat_probe()
276 sens->sat = sat; in wf_sat_probe()
284 list_add(&sens->link, &sat->sensors); in wf_sat_probe()
285 kref_get(&sat->ref); in wf_sat_probe()
293 cpu = 2 * sat->nr + core; in wf_sat_probe()
303 sens->sat = sat; in wf_sat_probe()
311 list_add(&sens->link, &sat->sensors); in wf_sat_probe()
312 kref_get(&sat->ref); in wf_sat_probe()
316 if (sat->nr >= 0) in wf_sat_probe()
317 sats[sat->nr] = sat; in wf_sat_probe()
324 struct wf_sat *sat = i2c_get_clientdata(client); in wf_sat_remove() local
328 while(!list_empty(&sat->sensors)) { in wf_sat_remove()
329 sens = list_first_entry(&sat->sensors, in wf_sat_remove()
334 sat->i2c = NULL; in wf_sat_remove()
335 kref_put(&sat->ref, wf_sat_release); in wf_sat_remove()
341 { "MAC,smu-sat", 0 },
347 { .compatible = "smu-sat", },