Lines Matching refs:nr
46 #define F75375_REG_VOLT(nr) (0x10 + (nr)) argument
47 #define F75375_REG_VOLT_HIGH(nr) (0x20 + (nr) * 2) argument
48 #define F75375_REG_VOLT_LOW(nr) (0x21 + (nr) * 2) argument
50 #define F75375_REG_TEMP(nr) (0x14 + (nr)) argument
51 #define F75387_REG_TEMP11_LSB(nr) (0x1a + (nr)) argument
52 #define F75375_REG_TEMP_HIGH(nr) (0x28 + (nr) * 2) argument
53 #define F75375_REG_TEMP_HYST(nr) (0x29 + (nr) * 2) argument
55 #define F75375_REG_FAN(nr) (0x16 + (nr) * 2) argument
56 #define F75375_REG_FAN_MIN(nr) (0x2C + (nr) * 2) argument
57 #define F75375_REG_FAN_FULL(nr) (0x70 + (nr) * 0x10) argument
58 #define F75375_REG_FAN_PWM_DUTY(nr) (0x76 + (nr) * 0x10) argument
59 #define F75375_REG_FAN_PWM_CLOCK(nr) (0x7D + (nr) * 0x10) argument
61 #define F75375_REG_FAN_EXP(nr) (0x74 + (nr) * 0x10) argument
62 #define F75375_REG_FAN_B_TEMP(nr, step) ((0xA0 + (nr) * 0x10) + (step)) argument
63 #define F75375_REG_FAN_B_SPEED(nr, step) \ argument
64 ((0xA5 + (nr) * 0x10) + (step) * 2)
71 #define F75375_FAN_CTRL_LINEAR(nr) (4 + nr) argument
72 #define F75387_FAN_CTRL_LINEAR(nr) (1 + ((nr) * 4)) argument
73 #define FAN_CTRL_MODE(nr) (4 + ((nr) * 2)) argument
74 #define F75387_FAN_DUTY_MODE(nr) (2 + ((nr) * 4)) argument
75 #define F75387_FAN_MANU_MODE(nr) ((nr) * 4) argument
166 static void f75375_write_pwm(struct i2c_client *client, int nr) in f75375_write_pwm() argument
170 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->pwm[nr]); in f75375_write_pwm()
172 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), in f75375_write_pwm()
173 data->pwm[nr]); in f75375_write_pwm()
180 int nr; in f75375_update_device() local
187 for (nr = 0; nr < 2; nr++) { in f75375_update_device()
188 data->temp_high[nr] = in f75375_update_device()
189 f75375_read8(client, F75375_REG_TEMP_HIGH(nr)); in f75375_update_device()
190 data->temp_max_hyst[nr] = in f75375_update_device()
191 f75375_read8(client, F75375_REG_TEMP_HYST(nr)); in f75375_update_device()
192 data->fan_max[nr] = in f75375_update_device()
193 f75375_read16(client, F75375_REG_FAN_FULL(nr)); in f75375_update_device()
194 data->fan_min[nr] = in f75375_update_device()
195 f75375_read16(client, F75375_REG_FAN_MIN(nr)); in f75375_update_device()
196 data->fan_target[nr] = in f75375_update_device()
197 f75375_read16(client, F75375_REG_FAN_EXP(nr)); in f75375_update_device()
199 for (nr = 0; nr < 4; nr++) { in f75375_update_device()
200 data->in_max[nr] = in f75375_update_device()
201 f75375_read8(client, F75375_REG_VOLT_HIGH(nr)); in f75375_update_device()
202 data->in_min[nr] = in f75375_update_device()
203 f75375_read8(client, F75375_REG_VOLT_LOW(nr)); in f75375_update_device()
212 for (nr = 0; nr < 2; nr++) { in f75375_update_device()
213 data->pwm[nr] = f75375_read8(client, in f75375_update_device()
214 F75375_REG_FAN_PWM_DUTY(nr)); in f75375_update_device()
216 data->temp11[nr] = in f75375_update_device()
217 f75375_read8(client, F75375_REG_TEMP(nr)) << 8; in f75375_update_device()
220 data->temp11[nr] |= in f75375_update_device()
222 F75387_REG_TEMP11_LSB(nr)); in f75375_update_device()
223 data->fan[nr] = in f75375_update_device()
224 f75375_read16(client, F75375_REG_FAN(nr)); in f75375_update_device()
226 for (nr = 0; nr < 4; nr++) in f75375_update_device()
227 data->in[nr] = in f75375_update_device()
228 f75375_read8(client, F75375_REG_VOLT(nr)); in f75375_update_device()
287 int nr = to_sensor_dev_attr(attr)->index; in set_fan_min() local
298 data->fan_min[nr] = rpm_to_reg(val); in set_fan_min()
299 f75375_write16(client, F75375_REG_FAN_MIN(nr), data->fan_min[nr]); in set_fan_min()
307 int nr = to_sensor_dev_attr(attr)->index; in set_fan_target() local
317 if (auto_mode_enabled(data->pwm_enable[nr])) in set_fan_target()
319 if (data->kind == f75387 && duty_mode_enabled(data->pwm_enable[nr])) in set_fan_target()
323 data->fan_target[nr] = rpm_to_reg(val); in set_fan_target()
324 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->fan_target[nr]); in set_fan_target()
332 int nr = to_sensor_dev_attr(attr)->index; in set_pwm() local
342 if (auto_mode_enabled(data->pwm_enable[nr]) || in set_pwm()
343 !duty_mode_enabled(data->pwm_enable[nr])) in set_pwm()
347 data->pwm[nr] = clamp_val(val, 0, 255); in set_pwm()
348 f75375_write_pwm(client, nr); in set_pwm()
356 int nr = to_sensor_dev_attr(attr)->index; in show_pwm_enable() local
358 return sprintf(buf, "%d\n", data->pwm_enable[nr]); in show_pwm_enable()
361 static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) in set_pwm_enable_direct() argument
372 if (duty_mode_enabled(data->pwm_enable[nr]) != in set_pwm_enable_direct()
376 fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
377 fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
380 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
381 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
382 data->pwm[nr] = 255; in set_pwm_enable_direct()
385 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
386 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
391 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
394 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
399 fanmode &= ~(3 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
402 fanmode |= (3 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
403 data->pwm[nr] = 255; in set_pwm_enable_direct()
406 fanmode |= (3 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
409 fanmode |= (1 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
419 data->pwm_enable[nr] = val; in set_pwm_enable_direct()
421 f75375_write_pwm(client, nr); in set_pwm_enable_direct()
428 int nr = to_sensor_dev_attr(attr)->index; in set_pwm_enable() local
439 err = set_pwm_enable_direct(client, nr, val); in set_pwm_enable()
447 int nr = to_sensor_dev_attr(attr)->index; in set_pwm_mode() local
469 ctrl = F75387_FAN_CTRL_LINEAR(nr); in set_pwm_mode()
472 ctrl = F75375_FAN_CTRL_LINEAR(nr); in set_pwm_mode()
483 data->pwm_mode[nr] = val; in set_pwm_mode()
491 int nr = to_sensor_dev_attr(attr)->index; in show_pwm() local
493 return sprintf(buf, "%d\n", data->pwm[nr]); in show_pwm()
499 int nr = to_sensor_dev_attr(attr)->index; in show_pwm_mode() local
501 return sprintf(buf, "%d\n", data->pwm_mode[nr]); in show_pwm_mode()
510 int nr = to_sensor_dev_attr(attr)->index; in show_in() local
512 return sprintf(buf, "%d\n", VOLT_FROM_REG(data->in[nr])); in show_in()
518 int nr = to_sensor_dev_attr(attr)->index; in show_in_max() local
520 return sprintf(buf, "%d\n", VOLT_FROM_REG(data->in_max[nr])); in show_in_max()
526 int nr = to_sensor_dev_attr(attr)->index; in show_in_min() local
528 return sprintf(buf, "%d\n", VOLT_FROM_REG(data->in_min[nr])); in show_in_min()
534 int nr = to_sensor_dev_attr(attr)->index; in set_in_max() local
546 data->in_max[nr] = val; in set_in_max()
547 f75375_write8(client, F75375_REG_VOLT_HIGH(nr), data->in_max[nr]); in set_in_max()
555 int nr = to_sensor_dev_attr(attr)->index; in set_in_min() local
567 data->in_min[nr] = val; in set_in_min()
568 f75375_write8(client, F75375_REG_VOLT_LOW(nr), data->in_min[nr]); in set_in_min()
579 int nr = to_sensor_dev_attr(attr)->index; in show_temp11() local
581 return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[nr])); in show_temp11()
587 int nr = to_sensor_dev_attr(attr)->index; in show_temp_max() local
589 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_high[nr])); in show_temp_max()
595 int nr = to_sensor_dev_attr(attr)->index; in show_temp_max_hyst() local
597 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max_hyst[nr])); in show_temp_max_hyst()
603 int nr = to_sensor_dev_attr(attr)->index; in set_temp_max() local
615 data->temp_high[nr] = val; in set_temp_max()
616 f75375_write8(client, F75375_REG_TEMP_HIGH(nr), data->temp_high[nr]); in set_temp_max()
624 int nr = to_sensor_dev_attr(attr)->index; in set_temp_max_hyst() local
636 data->temp_max_hyst[nr] = val; in set_temp_max_hyst()
637 f75375_write8(client, F75375_REG_TEMP_HYST(nr), in set_temp_max_hyst()
638 data->temp_max_hyst[nr]); in set_temp_max_hyst()
647 int nr = to_sensor_dev_attr(attr)->index;\
649 return sprintf(buf, "%d\n", rpm_from_reg(data->thing[nr])); \
755 int nr; in f75375_init() local
759 int nr; in f75375_init() local
763 for (nr = 0; nr < 2; nr++) { in f75375_init()
767 if (!(mode & (1 << F75387_FAN_CTRL_LINEAR(nr)))) in f75375_init()
768 data->pwm_mode[nr] = 1; in f75375_init()
770 manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1); in f75375_init()
771 duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1); in f75375_init()
774 data->pwm_enable[nr] = 4; in f75375_init()
777 data->pwm_enable[nr] = 3; in f75375_init()
780 data->pwm_enable[nr] = 2; in f75375_init()
783 data->pwm_enable[nr] = 1; in f75375_init()
785 if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr)))) in f75375_init()
786 data->pwm_mode[nr] = 1; in f75375_init()
788 switch ((mode >> FAN_CTRL_MODE(nr)) & 3) { in f75375_init()
790 data->pwm_enable[nr] = 3; in f75375_init()
793 data->pwm_enable[nr] = 2; in f75375_init()
796 data->pwm_enable[nr] = 1; in f75375_init()
806 for (nr = 0; nr < 2; nr++) { in f75375_init()
807 if (auto_mode_enabled(f75375s_pdata->pwm_enable[nr]) || in f75375_init()
808 !duty_mode_enabled(f75375s_pdata->pwm_enable[nr])) in f75375_init()
810 data->pwm[nr] = clamp_val(f75375s_pdata->pwm[nr], 0, 255); in f75375_init()
811 f75375_write_pwm(client, nr); in f75375_init()