Lines Matching full: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
141 static void f75375_write_pwm(struct i2c_client *client, int nr) in f75375_write_pwm() argument
145 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->pwm[nr]); in f75375_write_pwm()
147 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), in f75375_write_pwm()
148 data->pwm[nr]); in f75375_write_pwm()
155 int nr; in f75375_update_device() local
162 for (nr = 0; nr < 2; nr++) { in f75375_update_device()
163 data->temp_high[nr] = in f75375_update_device()
164 f75375_read8(client, F75375_REG_TEMP_HIGH(nr)); in f75375_update_device()
165 data->temp_max_hyst[nr] = in f75375_update_device()
166 f75375_read8(client, F75375_REG_TEMP_HYST(nr)); in f75375_update_device()
167 data->fan_max[nr] = in f75375_update_device()
168 f75375_read16(client, F75375_REG_FAN_FULL(nr)); in f75375_update_device()
169 data->fan_min[nr] = in f75375_update_device()
170 f75375_read16(client, F75375_REG_FAN_MIN(nr)); in f75375_update_device()
171 data->fan_target[nr] = in f75375_update_device()
172 f75375_read16(client, F75375_REG_FAN_EXP(nr)); in f75375_update_device()
174 for (nr = 0; nr < 4; nr++) { in f75375_update_device()
175 data->in_max[nr] = in f75375_update_device()
176 f75375_read8(client, F75375_REG_VOLT_HIGH(nr)); in f75375_update_device()
177 data->in_min[nr] = in f75375_update_device()
178 f75375_read8(client, F75375_REG_VOLT_LOW(nr)); in f75375_update_device()
187 for (nr = 0; nr < 2; nr++) { in f75375_update_device()
188 data->pwm[nr] = f75375_read8(client, in f75375_update_device()
189 F75375_REG_FAN_PWM_DUTY(nr)); in f75375_update_device()
191 data->temp11[nr] = in f75375_update_device()
192 f75375_read8(client, F75375_REG_TEMP(nr)) << 8; in f75375_update_device()
195 data->temp11[nr] |= in f75375_update_device()
197 F75387_REG_TEMP11_LSB(nr)); in f75375_update_device()
198 data->fan[nr] = in f75375_update_device()
199 f75375_read16(client, F75375_REG_FAN(nr)); in f75375_update_device()
201 for (nr = 0; nr < 4; nr++) in f75375_update_device()
202 data->in[nr] = in f75375_update_device()
203 f75375_read8(client, F75375_REG_VOLT(nr)); in f75375_update_device()
262 int nr = to_sensor_dev_attr(attr)->index; in set_fan_min() local
273 data->fan_min[nr] = rpm_to_reg(val); in set_fan_min()
274 f75375_write16(client, F75375_REG_FAN_MIN(nr), data->fan_min[nr]); in set_fan_min()
282 int nr = to_sensor_dev_attr(attr)->index; in set_fan_target() local
292 if (auto_mode_enabled(data->pwm_enable[nr])) in set_fan_target()
294 if (data->kind == f75387 && duty_mode_enabled(data->pwm_enable[nr])) in set_fan_target()
298 data->fan_target[nr] = rpm_to_reg(val); in set_fan_target()
299 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->fan_target[nr]); in set_fan_target()
307 int nr = to_sensor_dev_attr(attr)->index; in set_pwm() local
317 if (auto_mode_enabled(data->pwm_enable[nr]) || in set_pwm()
318 !duty_mode_enabled(data->pwm_enable[nr])) in set_pwm()
322 data->pwm[nr] = clamp_val(val, 0, 255); in set_pwm()
323 f75375_write_pwm(client, nr); in set_pwm()
331 int nr = to_sensor_dev_attr(attr)->index; in show_pwm_enable() local
333 return sprintf(buf, "%d\n", data->pwm_enable[nr]); in show_pwm_enable()
336 static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) in set_pwm_enable_direct() argument
347 if (duty_mode_enabled(data->pwm_enable[nr]) != in set_pwm_enable_direct()
351 fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
352 fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
355 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
356 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
357 data->pwm[nr] = 255; in set_pwm_enable_direct()
360 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
361 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
366 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); in set_pwm_enable_direct()
369 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); in set_pwm_enable_direct()
374 fanmode &= ~(3 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
377 fanmode |= (3 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
378 data->pwm[nr] = 255; in set_pwm_enable_direct()
381 fanmode |= (3 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
384 fanmode |= (1 << FAN_CTRL_MODE(nr)); in set_pwm_enable_direct()
394 data->pwm_enable[nr] = val; in set_pwm_enable_direct()
396 f75375_write_pwm(client, nr); in set_pwm_enable_direct()
403 int nr = to_sensor_dev_attr(attr)->index; in set_pwm_enable() local
414 err = set_pwm_enable_direct(client, nr, val); in set_pwm_enable()
422 int nr = to_sensor_dev_attr(attr)->index; in set_pwm_mode() local
444 ctrl = F75387_FAN_CTRL_LINEAR(nr); in set_pwm_mode()
447 ctrl = F75375_FAN_CTRL_LINEAR(nr); in set_pwm_mode()
458 data->pwm_mode[nr] = val; in set_pwm_mode()
466 int nr = to_sensor_dev_attr(attr)->index; in show_pwm() local
468 return sprintf(buf, "%d\n", data->pwm[nr]); in show_pwm()
474 int nr = to_sensor_dev_attr(attr)->index; in show_pwm_mode() local
476 return sprintf(buf, "%d\n", data->pwm_mode[nr]); in show_pwm_mode()
485 int nr = to_sensor_dev_attr(attr)->index; in show_in() local
487 return sprintf(buf, "%d\n", VOLT_FROM_REG(data->in[nr])); in show_in()
493 int nr = to_sensor_dev_attr(attr)->index; in show_in_max() local
495 return sprintf(buf, "%d\n", VOLT_FROM_REG(data->in_max[nr])); in show_in_max()
501 int nr = to_sensor_dev_attr(attr)->index; in show_in_min() local
503 return sprintf(buf, "%d\n", VOLT_FROM_REG(data->in_min[nr])); in show_in_min()
509 int nr = to_sensor_dev_attr(attr)->index; in set_in_max() local
521 data->in_max[nr] = val; in set_in_max()
522 f75375_write8(client, F75375_REG_VOLT_HIGH(nr), data->in_max[nr]); in set_in_max()
530 int nr = to_sensor_dev_attr(attr)->index; in set_in_min() local
542 data->in_min[nr] = val; in set_in_min()
543 f75375_write8(client, F75375_REG_VOLT_LOW(nr), data->in_min[nr]); in set_in_min()
554 int nr = to_sensor_dev_attr(attr)->index; in show_temp11() local
556 return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[nr])); in show_temp11()
562 int nr = to_sensor_dev_attr(attr)->index; in show_temp_max() local
564 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_high[nr])); in show_temp_max()
570 int nr = to_sensor_dev_attr(attr)->index; in show_temp_max_hyst() local
572 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max_hyst[nr])); in show_temp_max_hyst()
578 int nr = to_sensor_dev_attr(attr)->index; in set_temp_max() local
590 data->temp_high[nr] = val; in set_temp_max()
591 f75375_write8(client, F75375_REG_TEMP_HIGH(nr), data->temp_high[nr]); in set_temp_max()
599 int nr = to_sensor_dev_attr(attr)->index; in set_temp_max_hyst() local
611 data->temp_max_hyst[nr] = val; in set_temp_max_hyst()
612 f75375_write8(client, F75375_REG_TEMP_HYST(nr), in set_temp_max_hyst()
613 data->temp_max_hyst[nr]); in set_temp_max_hyst()
622 int nr = to_sensor_dev_attr(attr)->index;\
624 return sprintf(buf, "%d\n", rpm_from_reg(data->thing[nr])); \
730 int nr; in f75375_init() local
734 int nr; in f75375_init() local
738 for (nr = 0; nr < 2; nr++) { in f75375_init()
742 if (!(mode & (1 << F75387_FAN_CTRL_LINEAR(nr)))) in f75375_init()
743 data->pwm_mode[nr] = 1; in f75375_init()
745 manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1); in f75375_init()
746 duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1); in f75375_init()
749 data->pwm_enable[nr] = 4; in f75375_init()
752 data->pwm_enable[nr] = 3; in f75375_init()
755 data->pwm_enable[nr] = 2; in f75375_init()
758 data->pwm_enable[nr] = 1; in f75375_init()
760 if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr)))) in f75375_init()
761 data->pwm_mode[nr] = 1; in f75375_init()
763 switch ((mode >> FAN_CTRL_MODE(nr)) & 3) { in f75375_init()
765 data->pwm_enable[nr] = 3; in f75375_init()
768 data->pwm_enable[nr] = 2; in f75375_init()
771 data->pwm_enable[nr] = 1; in f75375_init()
781 for (nr = 0; nr < 2; nr++) { in f75375_init()
782 if (auto_mode_enabled(f75375s_pdata->pwm_enable[nr]) || in f75375_init()
783 !duty_mode_enabled(f75375s_pdata->pwm_enable[nr])) in f75375_init()
785 data->pwm[nr] = clamp_val(f75375s_pdata->pwm[nr], 0, 255); in f75375_init()
786 f75375_write_pwm(client, nr); in f75375_init()