Lines Matching refs:nr
60 #define F75375_REG_VOLT(nr) (0x10 + (nr)) argument
61 #define F75375_REG_VOLT_HIGH(nr) (0x20 + (nr) * 2) argument
62 #define F75375_REG_VOLT_LOW(nr) (0x21 + (nr) * 2) argument
64 #define F75375_REG_TEMP(nr) (0x14 + (nr)) argument
65 #define F75387_REG_TEMP11_LSB(nr) (0x1a + (nr)) argument
66 #define F75375_REG_TEMP_HIGH(nr) (0x28 + (nr) * 2) argument
67 #define F75375_REG_TEMP_HYST(nr) (0x29 + (nr) * 2) argument
69 #define F75375_REG_FAN(nr) (0x16 + (nr) * 2) argument
70 #define F75375_REG_FAN_MIN(nr) (0x2C + (nr) * 2) argument
71 #define F75375_REG_FAN_FULL(nr) (0x70 + (nr) * 0x10) argument
72 #define F75375_REG_FAN_PWM_DUTY(nr) (0x76 + (nr) * 0x10) argument
73 #define F75375_REG_FAN_PWM_CLOCK(nr) (0x7D + (nr) * 0x10) argument
75 #define F75375_REG_FAN_EXP(nr) (0x74 + (nr) * 0x10) argument
76 #define F75375_REG_FAN_B_TEMP(nr, step) ((0xA0 + (nr) * 0x10) + (step)) argument
77 #define F75375_REG_FAN_B_SPEED(nr, step) \ argument
78 ((0xA5 + (nr) * 0x10) + (step) * 2)
85 #define F75375_FAN_CTRL_LINEAR(nr) (4 + nr) argument
86 #define F75387_FAN_CTRL_LINEAR(nr) (1 + ((nr) * 4)) argument
87 #define FAN_CTRL_MODE(nr) (4 + ((nr) * 2)) argument
88 #define F75387_FAN_DUTY_MODE(nr) (2 + ((nr) * 4)) argument
89 #define F75387_FAN_MANU_MODE(nr) ((nr) * 4) argument
181 static void f75375_write_pwm(struct i2c_client *client, int nr) in f75375_write_pwm() argument
185 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->pwm[nr]); in f75375_write_pwm()
187 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), in f75375_write_pwm()
188 data->pwm[nr]); in f75375_write_pwm()
195 int nr; in f75375_update_device() local
202 for (nr = 0; nr < 2; nr++) { in f75375_update_device()
203 data->temp_high[nr] = in f75375_update_device()
204 f75375_read8(client, F75375_REG_TEMP_HIGH(nr)); in f75375_update_device()
205 data->temp_max_hyst[nr] = in f75375_update_device()
206 f75375_read8(client, F75375_REG_TEMP_HYST(nr)); in f75375_update_device()
207 data->fan_max[nr] = in f75375_update_device()
208 f75375_read16(client, F75375_REG_FAN_FULL(nr)); in f75375_update_device()
209 data->fan_min[nr] = in f75375_update_device()
210 f75375_read16(client, F75375_REG_FAN_MIN(nr)); in f75375_update_device()
211 data->fan_target[nr] = in f75375_update_device()
212 f75375_read16(client, F75375_REG_FAN_EXP(nr)); in f75375_update_device()
214 for (nr = 0; nr < 4; nr++) { in f75375_update_device()
215 data->in_max[nr] = in f75375_update_device()
216 f75375_read8(client, F75375_REG_VOLT_HIGH(nr)); in f75375_update_device()
217 data->in_min[nr] = in f75375_update_device()
218 f75375_read8(client, F75375_REG_VOLT_LOW(nr)); in f75375_update_device()
227 for (nr = 0; nr < 2; nr++) { in f75375_update_device()
228 data->pwm[nr] = f75375_read8(client, in f75375_update_device()
229 F75375_REG_FAN_PWM_DUTY(nr)); in f75375_update_device()
231 data->temp11[nr] = in f75375_update_device()
232 f75375_read8(client, F75375_REG_TEMP(nr)) << 8; in f75375_update_device()
235 data->temp11[nr] |= in f75375_update_device()
237 F75387_REG_TEMP11_LSB(nr)); in f75375_update_device()
238 data->fan[nr] = in f75375_update_device()
239 f75375_read16(client, F75375_REG_FAN(nr)); in f75375_update_device()
241 for (nr = 0; nr < 4; nr++) in f75375_update_device()
242 data->in[nr] = in f75375_update_device()
243 f75375_read8(client, F75375_REG_VOLT(nr)); in f75375_update_device()
302 int nr = to_sensor_dev_attr(attr)->index; in set_fan_min() local
313 data->fan_min[nr] = rpm_to_reg(val); in set_fan_min()
314 f75375_write16(client, F75375_REG_FAN_MIN(nr), data->fan_min[nr]); in set_fan_min()
322 int nr = to_sensor_dev_attr(attr)->index; in set_fan_target() local
332 if (auto_mode_enabled(data->pwm_enable[nr])) in set_fan_target()
334 if (data->kind == f75387 && duty_mode_enabled(data->pwm_enable[nr])) in set_fan_target()
338 data->fan_target[nr] = rpm_to_reg(val); in set_fan_target()
339 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->fan_target[nr]); in set_fan_target()
347 int nr = to_sensor_dev_attr(attr)->index; in set_pwm() local
357 if (auto_mode_enabled(data->pwm_enable[nr]) || in set_pwm()
358 !duty_mode_enabled(data->pwm_enable[nr])) in set_pwm()
362 data->pwm[nr] = clamp_val(val, 0, 255); in set_pwm()
363 f75375_write_pwm(client, nr); in set_pwm()
371 int nr = to_sensor_dev_attr(attr)->index; in show_pwm_enable() local
373 return sprintf(buf, "%d\n", data->pwm_enable[nr]); in show_pwm_enable()
376 static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) in set_pwm_enable_direct() argument
387 if (duty_mode_enabled(data->pwm_enable[nr]) != in set_pwm_enable_direct()
391 fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
392 fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
395 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
396 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
397 data->pwm[nr] = 255; in set_pwm_enable_direct()
400 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
401 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
406 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
409 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
414 fanmode &= ~(3 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
417 fanmode |= (3 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
418 data->pwm[nr] = 255; in set_pwm_enable_direct()
421 fanmode |= (3 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
424 fanmode |= (1 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
434 data->pwm_enable[nr] = val; in set_pwm_enable_direct()
436 f75375_write_pwm(client, nr); in set_pwm_enable_direct()
443 int nr = to_sensor_dev_attr(attr)->index; in set_pwm_enable() local
454 err = set_pwm_enable_direct(client, nr, val); in set_pwm_enable()
462 int nr = to_sensor_dev_attr(attr)->index; in set_pwm_mode() local
484 ctrl = F75387_FAN_CTRL_LINEAR(nr); in set_pwm_mode()
487 ctrl = F75375_FAN_CTRL_LINEAR(nr); in set_pwm_mode()
498 data->pwm_mode[nr] = val; in set_pwm_mode()
506 int nr = to_sensor_dev_attr(attr)->index; in show_pwm() local
508 return sprintf(buf, "%d\n", data->pwm[nr]); in show_pwm()
514 int nr = to_sensor_dev_attr(attr)->index; in show_pwm_mode() local
516 return sprintf(buf, "%d\n", data->pwm_mode[nr]); in show_pwm_mode()
525 int nr = to_sensor_dev_attr(attr)->index; in show_in() local
527 return sprintf(buf, "%d\n", VOLT_FROM_REG(data->in[nr])); in show_in()
533 int nr = to_sensor_dev_attr(attr)->index; in show_in_max() local
535 return sprintf(buf, "%d\n", VOLT_FROM_REG(data->in_max[nr])); in show_in_max()
541 int nr = to_sensor_dev_attr(attr)->index; in show_in_min() local
543 return sprintf(buf, "%d\n", VOLT_FROM_REG(data->in_min[nr])); in show_in_min()
549 int nr = to_sensor_dev_attr(attr)->index; in set_in_max() local
561 data->in_max[nr] = val; in set_in_max()
562 f75375_write8(client, F75375_REG_VOLT_HIGH(nr), data->in_max[nr]); in set_in_max()
570 int nr = to_sensor_dev_attr(attr)->index; in set_in_min() local
582 data->in_min[nr] = val; in set_in_min()
583 f75375_write8(client, F75375_REG_VOLT_LOW(nr), data->in_min[nr]); in set_in_min()
594 int nr = to_sensor_dev_attr(attr)->index; in show_temp11() local
596 return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[nr])); in show_temp11()
602 int nr = to_sensor_dev_attr(attr)->index; in show_temp_max() local
604 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_high[nr])); in show_temp_max()
610 int nr = to_sensor_dev_attr(attr)->index; in show_temp_max_hyst() local
612 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max_hyst[nr])); in show_temp_max_hyst()
618 int nr = to_sensor_dev_attr(attr)->index; in set_temp_max() local
630 data->temp_high[nr] = val; in set_temp_max()
631 f75375_write8(client, F75375_REG_TEMP_HIGH(nr), data->temp_high[nr]); in set_temp_max()
639 int nr = to_sensor_dev_attr(attr)->index; in set_temp_max_hyst() local
651 data->temp_max_hyst[nr] = val; in set_temp_max_hyst()
652 f75375_write8(client, F75375_REG_TEMP_HYST(nr), in set_temp_max_hyst()
653 data->temp_max_hyst[nr]); in set_temp_max_hyst()
662 int nr = to_sensor_dev_attr(attr)->index;\
664 return sprintf(buf, "%d\n", rpm_from_reg(data->thing[nr])); \
770 int nr; in f75375_init() local
774 int nr; in f75375_init() local
778 for (nr = 0; nr < 2; nr++) { in f75375_init()
782 if (!(mode & (1 << F75387_FAN_CTRL_LINEAR(nr)))) in f75375_init()
783 data->pwm_mode[nr] = 1; in f75375_init()
785 manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1); in f75375_init()
786 duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1); in f75375_init()
789 data->pwm_enable[nr] = 4; in f75375_init()
792 data->pwm_enable[nr] = 3; in f75375_init()
795 data->pwm_enable[nr] = 2; in f75375_init()
798 data->pwm_enable[nr] = 1; in f75375_init()
800 if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr)))) in f75375_init()
801 data->pwm_mode[nr] = 1; in f75375_init()
803 switch ((mode >> FAN_CTRL_MODE(nr)) & 3) { in f75375_init()
805 data->pwm_enable[nr] = 3; in f75375_init()
808 data->pwm_enable[nr] = 2; in f75375_init()
811 data->pwm_enable[nr] = 1; in f75375_init()
821 for (nr = 0; nr < 2; nr++) { in f75375_init()
822 if (auto_mode_enabled(f75375s_pdata->pwm_enable[nr]) || in f75375_init()
823 !duty_mode_enabled(f75375s_pdata->pwm_enable[nr])) in f75375_init()
825 data->pwm[nr] = clamp_val(f75375s_pdata->pwm[nr], 0, 255); in f75375_init()
826 f75375_write_pwm(client, nr); in f75375_init()