• Home
  • Raw
  • Download

Lines Matching refs:sattr

330 	struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);  in voltage_show()  local
336 switch (sattr->nr) { in voltage_show()
339 (data->alarms >> sattr->index) & 1); in voltage_show()
341 val = data->voltage[sattr->nr][sattr->index]; in voltage_show()
343 reg2volt(sattr->index, val, data->bypass_attn)); in voltage_show()
352 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in voltage_store() local
363 data->voltage[sattr->nr][sattr->index] = in voltage_store()
364 volt2reg(sattr->index, val, data->bypass_attn); in voltage_store()
366 if (sattr->index < ADT7475_VOLTAGE_COUNT) { in voltage_store()
367 if (sattr->nr == MIN) in voltage_store()
368 reg = VOLTAGE_MIN_REG(sattr->index); in voltage_store()
370 reg = VOLTAGE_MAX_REG(sattr->index); in voltage_store()
372 if (sattr->nr == MIN) in voltage_store()
379 data->voltage[sattr->nr][sattr->index] >> 2); in voltage_store()
389 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in temp_show() local
395 switch (sattr->nr) { in temp_show()
398 out = data->temp[sattr->nr][sattr->index]; in temp_show()
399 if (sattr->index != 1) in temp_show()
407 out = reg2temp(data, data->temp[THERM][sattr->index]) - in temp_show()
418 out = (s8)data->temp[sattr->nr][sattr->index]; in temp_show()
427 out = (data->alarms >> (sattr->index + 4)) & 1; in temp_show()
432 out = !!(data->alarms & (sattr->index ? 0x8000 : 0x4000)); in temp_show()
437 out = reg2temp(data, data->temp[sattr->nr][sattr->index]); in temp_show()
446 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in temp_store() local
462 switch (sattr->nr) { in temp_store()
466 out = data->temp[OFFSET][sattr->index] = val / 1000; in temp_store()
469 out = data->temp[OFFSET][sattr->index] = val / 500; in temp_store()
480 data->temp[THERM][sattr->index] = in temp_store()
481 adt7475_read(TEMP_THERM_REG(sattr->index)) << 2; in temp_store()
484 temp = reg2temp(data, data->temp[THERM][sattr->index]); in temp_store()
488 if (sattr->index != 1) { in temp_store()
489 data->temp[HYSTERSIS][sattr->index] &= 0x0F; in temp_store()
490 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4; in temp_store()
492 data->temp[HYSTERSIS][sattr->index] &= 0xF0; in temp_store()
493 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF); in temp_store()
496 out = data->temp[HYSTERSIS][sattr->index]; in temp_store()
500 data->temp[sattr->nr][sattr->index] = temp2reg(data, val); in temp_store()
506 out = (u8) (data->temp[sattr->nr][sattr->index] >> 2); in temp_store()
509 switch (sattr->nr) { in temp_store()
511 reg = TEMP_MIN_REG(sattr->index); in temp_store()
514 reg = TEMP_MAX_REG(sattr->index); in temp_store()
517 reg = TEMP_OFFSET_REG(sattr->index); in temp_store()
520 reg = TEMP_TMIN_REG(sattr->index); in temp_store()
523 reg = TEMP_THERM_REG(sattr->index); in temp_store()
526 if (sattr->index != 2) in temp_store()
548 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in temp_st_show() local
552 switch (sattr->index) { in temp_st_show()
575 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in temp_st_store() local
585 switch (sattr->index) { in temp_st_store()
636 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in point2_show() local
643 out = (data->range[sattr->index] >> 4) & 0x0F; in point2_show()
644 val = reg2temp(data, data->temp[AUTOMIN][sattr->index]); in point2_show()
655 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in point2_store() local
666 data->temp[AUTOMIN][sattr->index] = in point2_store()
667 adt7475_read(TEMP_TMIN_REG(sattr->index)) << 2; in point2_store()
668 data->range[sattr->index] = in point2_store()
669 adt7475_read(TEMP_TRANGE_REG(sattr->index)); in point2_store()
675 temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]); in point2_store()
683 data->range[sattr->index] &= ~0xF0; in point2_store()
684 data->range[sattr->index] |= val << 4; in point2_store()
686 i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index), in point2_store()
687 data->range[sattr->index]); in point2_store()
697 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in tach_show() local
703 if (sattr->nr == ALARM) in tach_show()
704 out = (data->alarms >> (sattr->index + 10)) & 1; in tach_show()
706 out = tach2rpm(data->tach[sattr->nr][sattr->index]); in tach_show()
715 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in tach_store() local
725 data->tach[MIN][sattr->index] = rpm2tach(val); in tach_store()
727 adt7475_write_word(client, TACH_MIN_REG(sattr->index), in tach_store()
728 data->tach[MIN][sattr->index]); in tach_store()
738 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in pwm_show() local
743 return sprintf(buf, "%d\n", data->pwm[sattr->nr][sattr->index]); in pwm_show()
750 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in pwmchan_show() local
755 return sprintf(buf, "%d\n", data->pwmchan[sattr->index]); in pwmchan_show()
762 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in pwmctrl_show() local
767 return sprintf(buf, "%d\n", data->pwmctl[sattr->index]); in pwmctrl_show()
774 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in pwm_store() local
785 switch (sattr->nr) { in pwm_store()
788 data->pwm[CONTROL][sattr->index] = in pwm_store()
789 adt7475_read(PWM_CONFIG_REG(sattr->index)); in pwm_store()
795 if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) { in pwm_store()
800 reg = PWM_REG(sattr->index); in pwm_store()
804 reg = PWM_MIN_REG(sattr->index); in pwm_store()
808 reg = PWM_MAX_REG(sattr->index); in pwm_store()
812 data->pwm[sattr->nr][sattr->index] = clamp_val(val, 0, 0xFF); in pwm_store()
814 data->pwm[sattr->nr][sattr->index]); in pwm_store()
823 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in stall_disable_show() local
826 u8 mask = BIT(5 + sattr->index); in stall_disable_show()
835 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in stall_disable_store() local
839 u8 mask = BIT(5 + sattr->index); in stall_disable_store()
919 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in pwmchan_store() local
930 adt7475_read_pwm(client, sattr->index); in pwmchan_store()
931 r = hw_set_pwm(client, sattr->index, data->pwmctl[sattr->index], val); in pwmchan_store()
943 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in pwmctrl_store() local
954 adt7475_read_pwm(client, sattr->index); in pwmctrl_store()
955 r = hw_set_pwm(client, sattr->index, val, data->pwmchan[sattr->index]); in pwmctrl_store()
972 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in pwmfreq_show() local
977 idx = clamp_val(data->range[sattr->index] & 0xf, 0, in pwmfreq_show()
987 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); in pwmfreq_store() local
1000 data->range[sattr->index] = in pwmfreq_store()
1001 adt7475_read(TEMP_TRANGE_REG(sattr->index)); in pwmfreq_store()
1002 data->range[sattr->index] &= ~0xf; in pwmfreq_store()
1003 data->range[sattr->index] |= out; in pwmfreq_store()
1005 i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index), in pwmfreq_store()
1006 data->range[sattr->index]); in pwmfreq_store()