Lines Matching +full:pin14 +full:- +full:function
1 // SPDX-License-Identifier: GPL-2.0-only
3 * adt7475 - Thermal sensor driver for the ADT7475 chip and derivatives
4 * Copyright (C) 2007-2008, Advanced Micro Devices, Inc.
17 #include <linux/hwmon-sysfs.h>
18 #include <linux/hwmon-vid.h>
36 * These are unique identifiers for the sysfs functions - unlike the
232 if (!(data->config5 & CONFIG5_TWOSCOMP)) { in temp2reg()
233 val = clamp_val(val, -64000, 191000); in temp2reg()
236 val = clamp_val(val, -128000, 127000); in temp2reg()
237 if (val < -500) in temp2reg()
250 if (data->config5 & CONFIG5_TWOSCOMP) { in reg2temp()
252 return (reg - 1024) * 250; in reg2temp()
256 return (reg - 256) * 250; in reg2temp()
337 switch (sattr->nr) { in voltage_show()
340 (data->alarms >> sattr->index) & 1); in voltage_show()
342 val = data->voltage[sattr->nr][sattr->index]; in voltage_show()
344 reg2volt(sattr->index, val, data->bypass_attn)); in voltage_show()
355 struct i2c_client *client = data->client; in voltage_store()
360 return -EINVAL; in voltage_store()
362 mutex_lock(&data->lock); in voltage_store()
364 data->voltage[sattr->nr][sattr->index] = in voltage_store()
365 volt2reg(sattr->index, val, data->bypass_attn); in voltage_store()
367 if (sattr->index < ADT7475_VOLTAGE_COUNT) { in voltage_store()
368 if (sattr->nr == MIN) in voltage_store()
369 reg = VOLTAGE_MIN_REG(sattr->index); in voltage_store()
371 reg = VOLTAGE_MAX_REG(sattr->index); in voltage_store()
373 if (sattr->nr == MIN) in voltage_store()
380 data->voltage[sattr->nr][sattr->index] >> 2); in voltage_store()
381 mutex_unlock(&data->lock); in voltage_store()
396 switch (sattr->nr) { in temp_show()
398 mutex_lock(&data->lock); in temp_show()
399 out = data->temp[sattr->nr][sattr->index]; in temp_show()
400 if (sattr->index != 1) in temp_show()
408 out = reg2temp(data, data->temp[THERM][sattr->index]) - in temp_show()
410 mutex_unlock(&data->lock); in temp_show()
418 mutex_lock(&data->lock); in temp_show()
419 out = (s8)data->temp[sattr->nr][sattr->index]; in temp_show()
420 if (data->config5 & CONFIG5_TEMPOFFSET) in temp_show()
424 mutex_unlock(&data->lock); in temp_show()
428 out = (data->alarms >> (sattr->index + 4)) & 1; in temp_show()
432 /* Note - only for remote1 and remote2 */ in temp_show()
433 out = !!(data->alarms & (sattr->index ? 0x8000 : 0x4000)); in temp_show()
438 out = reg2temp(data, data->temp[sattr->nr][sattr->index]); in temp_show()
449 struct i2c_client *client = data->client; in temp_store()
456 return -EINVAL; in temp_store()
458 mutex_lock(&data->lock); in temp_store()
460 /* We need the config register in all cases for temp <-> reg conv. */ in temp_store()
461 data->config5 = adt7475_read(REG_CONFIG5); in temp_store()
463 switch (sattr->nr) { in temp_store()
465 if (data->config5 & CONFIG5_TEMPOFFSET) { in temp_store()
466 val = clamp_val(val, -63000, 127000); in temp_store()
467 out = data->temp[OFFSET][sattr->index] = val / 1000; in temp_store()
469 val = clamp_val(val, -63000, 64000); in temp_store()
470 out = data->temp[OFFSET][sattr->index] = val / 500; in temp_store()
481 data->temp[THERM][sattr->index] = in temp_store()
482 adt7475_read(TEMP_THERM_REG(sattr->index)) << 2; in temp_store()
485 temp = reg2temp(data, data->temp[THERM][sattr->index]); in temp_store()
486 val = clamp_val(val, temp - 15000, temp); in temp_store()
487 val = (temp - val) / 1000; in temp_store()
489 if (sattr->index != 1) { in temp_store()
490 data->temp[HYSTERSIS][sattr->index] &= 0x0F; in temp_store()
491 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4; in temp_store()
493 data->temp[HYSTERSIS][sattr->index] &= 0xF0; in temp_store()
494 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF); in temp_store()
497 out = data->temp[HYSTERSIS][sattr->index]; in temp_store()
501 data->temp[sattr->nr][sattr->index] = temp2reg(data, val); in temp_store()
505 * - shift those back off before writing the value in temp_store()
507 out = (u8) (data->temp[sattr->nr][sattr->index] >> 2); in temp_store()
510 switch (sattr->nr) { in temp_store()
512 reg = TEMP_MIN_REG(sattr->index); in temp_store()
515 reg = TEMP_MAX_REG(sattr->index); in temp_store()
518 reg = TEMP_OFFSET_REG(sattr->index); in temp_store()
521 reg = TEMP_TMIN_REG(sattr->index); in temp_store()
524 reg = TEMP_THERM_REG(sattr->index); in temp_store()
527 if (sattr->index != 2) in temp_store()
537 mutex_unlock(&data->lock); in temp_store()
553 switch (sattr->index) { in temp_st_show()
555 val = data->enh_acoustics[0] & 0xf; in temp_st_show()
558 val = data->enh_acoustics[1] & 0xf; in temp_st_show()
562 val = (data->enh_acoustics[1] >> 4) & 0xf; in temp_st_show()
578 struct i2c_client *client = data->client; in temp_st_store()
584 return -EINVAL; in temp_st_store()
586 switch (sattr->index) { in temp_st_store()
611 mutex_lock(&data->lock); in temp_st_store()
613 data->enh_acoustics[idx] &= ~(0xf << shift); in temp_st_store()
614 data->enh_acoustics[idx] |= (val << shift); in temp_st_store()
616 i2c_smbus_write_byte_data(client, reg, data->enh_acoustics[idx]); in temp_st_store()
618 mutex_unlock(&data->lock); in temp_st_store()
624 * Table of autorange values - the user will write the value in millidegrees,
643 mutex_lock(&data->lock); in point2_show()
644 out = (data->range[sattr->index] >> 4) & 0x0F; in point2_show()
645 val = reg2temp(data, data->temp[AUTOMIN][sattr->index]); in point2_show()
646 mutex_unlock(&data->lock); in point2_show()
655 struct i2c_client *client = data->client; in point2_store()
661 return -EINVAL; in point2_store()
663 mutex_lock(&data->lock); in point2_store()
666 data->config5 = adt7475_read(REG_CONFIG5); in point2_store()
667 data->temp[AUTOMIN][sattr->index] = in point2_store()
668 adt7475_read(TEMP_TMIN_REG(sattr->index)) << 2; in point2_store()
669 data->range[sattr->index] = in point2_store()
670 adt7475_read(TEMP_TRANGE_REG(sattr->index)); in point2_store()
676 temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]); in point2_store()
678 temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]); in point2_store()
679 val -= temp; in point2_store()
684 data->range[sattr->index] &= ~0xF0; in point2_store()
685 data->range[sattr->index] |= val << 4; in point2_store()
687 i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index), in point2_store()
688 data->range[sattr->index]); in point2_store()
690 mutex_unlock(&data->lock); in point2_store()
704 if (sattr->nr == ALARM) in tach_show()
705 out = (data->alarms >> (sattr->index + 10)) & 1; in tach_show()
707 out = tach2rpm(data->tach[sattr->nr][sattr->index]); in tach_show()
718 struct i2c_client *client = data->client; in tach_store()
722 return -EINVAL; in tach_store()
724 mutex_lock(&data->lock); in tach_store()
726 data->tach[MIN][sattr->index] = rpm2tach(val); in tach_store()
728 adt7475_write_word(client, TACH_MIN_REG(sattr->index), in tach_store()
729 data->tach[MIN][sattr->index]); in tach_store()
731 mutex_unlock(&data->lock); in tach_store()
744 return sprintf(buf, "%d\n", data->pwm[sattr->nr][sattr->index]); in pwm_show()
756 return sprintf(buf, "%d\n", data->pwmchan[sattr->index]); in pwmchan_show()
768 return sprintf(buf, "%d\n", data->pwmctl[sattr->index]); in pwmctrl_show()
777 struct i2c_client *client = data->client; in pwm_store()
782 return -EINVAL; in pwm_store()
784 mutex_lock(&data->lock); in pwm_store()
786 switch (sattr->nr) { in pwm_store()
789 data->pwm[CONTROL][sattr->index] = in pwm_store()
790 adt7475_read(PWM_CONFIG_REG(sattr->index)); in pwm_store()
796 if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) { in pwm_store()
797 mutex_unlock(&data->lock); in pwm_store()
801 reg = PWM_REG(sattr->index); in pwm_store()
805 reg = PWM_MIN_REG(sattr->index); in pwm_store()
809 reg = PWM_MAX_REG(sattr->index); in pwm_store()
813 data->pwm[sattr->nr][sattr->index] = clamp_val(val, 0, 0xFF); in pwm_store()
815 data->pwm[sattr->nr][sattr->index]); in pwm_store()
816 mutex_unlock(&data->lock); in pwm_store()
827 u8 mask = BIT(5 + sattr->index); in stall_disable_show()
829 return sprintf(buf, "%d\n", !!(data->enh_acoustics[0] & mask)); in stall_disable_show()
838 struct i2c_client *client = data->client; in stall_disable_store()
840 u8 mask = BIT(5 + sattr->index); in stall_disable_store()
843 return -EINVAL; in stall_disable_store()
845 mutex_lock(&data->lock); in stall_disable_store()
847 data->enh_acoustics[0] &= ~mask; in stall_disable_store()
849 data->enh_acoustics[0] |= mask; in stall_disable_store()
852 data->enh_acoustics[0]); in stall_disable_store()
854 mutex_unlock(&data->lock); in stall_disable_store()
897 return -EINVAL; in hw_set_pwm()
901 return -EINVAL; in hw_set_pwm()
904 data->pwmctl[index] = pwmctl; in hw_set_pwm()
905 data->pwmchan[index] = pwmchan; in hw_set_pwm()
907 data->pwm[CONTROL][index] &= ~0xE0; in hw_set_pwm()
908 data->pwm[CONTROL][index] |= (val & 7) << 5; in hw_set_pwm()
911 data->pwm[CONTROL][index]); in hw_set_pwm()
922 struct i2c_client *client = data->client; in pwmchan_store()
927 return -EINVAL; in pwmchan_store()
929 mutex_lock(&data->lock); in pwmchan_store()
931 adt7475_read_pwm(client, sattr->index); in pwmchan_store()
932 r = hw_set_pwm(client, sattr->index, data->pwmctl[sattr->index], val); in pwmchan_store()
935 mutex_unlock(&data->lock); in pwmchan_store()
946 struct i2c_client *client = data->client; in pwmctrl_store()
951 return -EINVAL; in pwmctrl_store()
953 mutex_lock(&data->lock); in pwmctrl_store()
955 adt7475_read_pwm(client, sattr->index); in pwmctrl_store()
956 r = hw_set_pwm(client, sattr->index, val, data->pwmchan[sattr->index]); in pwmctrl_store()
959 mutex_unlock(&data->lock); in pwmctrl_store()
978 idx = clamp_val(data->range[sattr->index] & 0xf, 0, in pwmfreq_show()
979 ARRAY_SIZE(pwmfreq_table) - 1); in pwmfreq_show()
990 struct i2c_client *client = data->client; in pwmfreq_store()
995 return -EINVAL; in pwmfreq_store()
999 mutex_lock(&data->lock); in pwmfreq_store()
1001 data->range[sattr->index] = in pwmfreq_store()
1002 adt7475_read(TEMP_TRANGE_REG(sattr->index)); in pwmfreq_store()
1003 data->range[sattr->index] &= ~0xf; in pwmfreq_store()
1004 data->range[sattr->index] |= out; in pwmfreq_store()
1006 i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index), in pwmfreq_store()
1007 data->range[sattr->index]); in pwmfreq_store()
1009 mutex_unlock(&data->lock); in pwmfreq_store()
1022 return sprintf(buf, "%d\n", !!(data->config4 & CONFIG4_MAXDUTY)); in pwm_use_point2_pwm_at_crit_show()
1030 struct i2c_client *client = data->client; in pwm_use_point2_pwm_at_crit_store()
1034 return -EINVAL; in pwm_use_point2_pwm_at_crit_store()
1036 return -EINVAL; in pwm_use_point2_pwm_at_crit_store()
1038 mutex_lock(&data->lock); in pwm_use_point2_pwm_at_crit_store()
1039 data->config4 = i2c_smbus_read_byte_data(client, REG_CONFIG4); in pwm_use_point2_pwm_at_crit_store()
1041 data->config4 |= CONFIG4_MAXDUTY; in pwm_use_point2_pwm_at_crit_store()
1043 data->config4 &= ~CONFIG4_MAXDUTY; in pwm_use_point2_pwm_at_crit_store()
1044 i2c_smbus_write_byte_data(client, REG_CONFIG4, data->config4); in pwm_use_point2_pwm_at_crit_store()
1045 mutex_unlock(&data->lock); in pwm_use_point2_pwm_at_crit_store()
1054 return sprintf(buf, "%d\n", (int)data->vrm); in vrm_show()
1064 return -EINVAL; in vrm_store()
1066 return -EINVAL; in vrm_store()
1067 data->vrm = val; in vrm_store()
1080 return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); in cpu0_vid_show()
1173 /* Non-standard name, might need revisiting */
1315 struct i2c_adapter *adapter = client->adapter; in adt7475_detect()
1320 return -ENODEV; in adt7475_detect()
1326 return -ENODEV; in adt7475_detect()
1331 else if (devid == 0x75 && client->addr == 0x2e) in adt7475_detect()
1338 dev_dbg(&adapter->dev, in adt7475_detect()
1340 "0x%02x\n", (unsigned int)client->addr); in adt7475_detect()
1341 return -ENODEV; in adt7475_detect()
1344 strscpy(info->type, name, I2C_NAME_SIZE); in adt7475_detect()
1358 data->config4 = ret; in adt7475_update_limits()
1363 data->config5 = ret; in adt7475_update_limits()
1366 if (!(data->has_voltage & (1 << i))) in adt7475_update_limits()
1372 data->voltage[MIN][i] = ret << 2; in adt7475_update_limits()
1377 data->voltage[MAX][i] = ret << 2; in adt7475_update_limits()
1380 if (data->has_voltage & (1 << 5)) { in adt7475_update_limits()
1384 data->voltage[MIN][5] = ret << 2; in adt7475_update_limits()
1389 data->voltage[MAX][5] = ret << 2; in adt7475_update_limits()
1397 data->temp[MIN][i] = ret << 2; in adt7475_update_limits()
1402 data->temp[MAX][i] = ret << 2; in adt7475_update_limits()
1407 data->temp[AUTOMIN][i] = ret << 2; in adt7475_update_limits()
1412 data->temp[THERM][i] = ret << 2; in adt7475_update_limits()
1417 data->temp[OFFSET][i] = ret; in adt7475_update_limits()
1422 if (i == 3 && !data->has_fan4) in adt7475_update_limits()
1427 data->tach[MIN][i] = ret; in adt7475_update_limits()
1431 if (i == 1 && !data->has_pwm2) in adt7475_update_limits()
1436 data->pwm[MAX][i] = ret; in adt7475_update_limits()
1441 data->pwm[MIN][i] = ret; in adt7475_update_limits()
1449 data->range[0] = ret; in adt7475_update_limits()
1454 data->range[1] = ret; in adt7475_update_limits()
1459 data->range[2] = ret; in adt7475_update_limits()
1466 const char *function; in load_config3() local
1470 ret = device_property_read_string(&client->dev, propname, &function); in load_config3()
1477 if (!strcmp("pwm2", function)) in load_config3()
1479 else if (!strcmp("smbalert#", function)) in load_config3()
1482 return -EINVAL; in load_config3()
1492 const char *function; in load_config4() local
1496 ret = device_property_read_string(&client->dev, propname, &function); in load_config4()
1504 if (!strcmp("tach4", function)) in load_config4()
1506 else if (!strcmp("therm#", function)) in load_config4()
1508 else if (!strcmp("smbalert#", function)) in load_config4()
1510 else if (!strcmp("gpio", function)) in load_config4()
1513 return -EINVAL; in load_config4()
1529 prop1 = "adi,pin5-function"; in load_config()
1530 prop2 = "adi,pin9-function"; in load_config()
1534 prop1 = "adi,pin10-function"; in load_config()
1535 prop2 = "adi,pin14-function"; in load_config()
1541 dev_err(&client->dev, "failed to configure %s\n", prop1); in load_config()
1547 dev_err(&client->dev, "failed to configure %s\n", prop2); in load_config()
1558 int ret = device_property_read_u32(&client->dev, property, in set_property_bit()
1577 set_property_bit(client, "adi,bypass-attenuator-in0", in load_attenuators()
1578 &data->config4, 4); in load_attenuators()
1579 set_property_bit(client, "adi,bypass-attenuator-in1", in load_attenuators()
1580 &data->config4, 5); in load_attenuators()
1581 set_property_bit(client, "adi,bypass-attenuator-in3", in load_attenuators()
1582 &data->config4, 6); in load_attenuators()
1583 set_property_bit(client, "adi,bypass-attenuator-in4", in load_attenuators()
1584 &data->config4, 7); in load_attenuators()
1587 data->config4); in load_attenuators()
1590 set_property_bit(client, "adi,bypass-attenuator-in1", in load_attenuators()
1591 &data->config2, 5); in load_attenuators()
1594 data->config2); in load_attenuators()
1606 ret = device_property_read_u32_array(&client->dev, in adt7475_set_pwm_polarity()
1607 "adi,pwm-active-state", states, in adt7475_set_pwm_polarity()
1646 data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); in adt7475_probe()
1648 return -ENOMEM; in adt7475_probe()
1650 mutex_init(&data->lock); in adt7475_probe()
1651 data->client = client; in adt7475_probe()
1654 if (client->dev.of_node) in adt7475_probe()
1655 chip = (uintptr_t)of_device_get_match_data(&client->dev); in adt7475_probe()
1657 chip = id->driver_data; in adt7475_probe()
1659 /* Initialize device-specific values */ in adt7475_probe()
1662 data->has_voltage = 0x0e; /* in1 to in3 */ in adt7475_probe()
1666 data->has_voltage = 0x3e; /* in1 to in5 */ in adt7475_probe()
1672 data->has_voltage = 0x06; /* in1, in2 */ in adt7475_probe()
1683 data->has_pwm2 = 1; in adt7475_probe()
1684 /* Meaning of this bit is inverted for the ADT7473-1 */ in adt7475_probe()
1685 if (id->driver_data == adt7473 && revision >= 1) in adt7475_probe()
1686 data->has_pwm2 = !data->has_pwm2; in adt7475_probe()
1688 data->config4 = adt7475_read(REG_CONFIG4); in adt7475_probe()
1690 if ((data->config4 & CONFIG4_PINFUNC) == 0x0) in adt7475_probe()
1691 data->has_fan4 = 1; in adt7475_probe()
1696 * this function in adt7475_probe()
1698 if (id->driver_data == adt7490) { in adt7475_probe()
1699 if ((data->config4 & CONFIG4_PINFUNC) == 0x1 && in adt7475_probe()
1701 data->has_fan4 = 1; in adt7475_probe()
1703 if (id->driver_data == adt7476 || id->driver_data == adt7490) { in adt7475_probe()
1705 (data->config4 & CONFIG4_PINFUNC) == 0x1) in adt7475_probe()
1706 data->has_voltage |= (1 << 0); /* in0 */ in adt7475_probe()
1713 if (id->driver_data == adt7476) { in adt7475_probe()
1716 data->has_voltage |= (1 << 4); /* in4 */ in adt7475_probe()
1718 data->has_vid = !(adt7475_read(REG_CONFIG5) & CONFIG5_VIDGPIO); in adt7475_probe()
1722 data->config2 = adt7475_read(REG_CONFIG2); in adt7475_probe()
1725 dev_warn(&client->dev, "Error configuring attenuator bypass\n"); in adt7475_probe()
1727 if (data->config2 & CONFIG2_ATTN) { in adt7475_probe()
1728 data->bypass_attn = (0x3 << 3) | 0x3; in adt7475_probe()
1730 data->bypass_attn = ((data->config4 & CONFIG4_ATTN_IN10) >> 4) | in adt7475_probe()
1731 ((data->config4 & CONFIG4_ATTN_IN43) >> 3); in adt7475_probe()
1733 data->bypass_attn &= data->has_voltage; in adt7475_probe()
1743 if (ret && ret != -EINVAL) in adt7475_probe()
1744 dev_warn(&client->dev, "Error configuring pwm polarity\n"); in adt7475_probe()
1757 data->groups[group_num++] = &adt7475_attr_group; in adt7475_probe()
1760 if (data->has_fan4) { in adt7475_probe()
1761 data->groups[group_num++] = &fan4_attr_group; in adt7475_probe()
1763 if (data->has_pwm2) { in adt7475_probe()
1764 data->groups[group_num++] = &pwm2_attr_group; in adt7475_probe()
1766 if (data->has_voltage & (1 << 0)) { in adt7475_probe()
1767 data->groups[group_num++] = &in0_attr_group; in adt7475_probe()
1769 if (data->has_voltage & (1 << 3)) { in adt7475_probe()
1770 data->groups[group_num++] = &in3_attr_group; in adt7475_probe()
1772 if (data->has_voltage & (1 << 4)) { in adt7475_probe()
1773 data->groups[group_num++] = &in4_attr_group; in adt7475_probe()
1775 if (data->has_voltage & (1 << 5)) { in adt7475_probe()
1776 data->groups[group_num++] = &in5_attr_group; in adt7475_probe()
1778 if (data->has_vid) { in adt7475_probe()
1779 data->vrm = vid_which_vrm(); in adt7475_probe()
1780 data->groups[group_num] = &vid_attr_group; in adt7475_probe()
1784 hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev, in adt7475_probe()
1785 client->name, data, in adt7475_probe()
1786 data->groups); in adt7475_probe()
1793 dev_info(&client->dev, "%s device, revision %d\n", in adt7475_probe()
1794 names[id->driver_data], revision); in adt7475_probe()
1795 if ((data->has_voltage & 0x11) || data->has_fan4 || data->has_pwm2) in adt7475_probe()
1796 dev_info(&client->dev, "Optional features:%s%s%s%s%s\n", in adt7475_probe()
1797 (data->has_voltage & (1 << 0)) ? " in0" : "", in adt7475_probe()
1798 (data->has_voltage & (1 << 4)) ? " in4" : "", in adt7475_probe()
1799 data->has_fan4 ? " fan4" : "", in adt7475_probe()
1800 data->has_pwm2 ? " pwm2" : "", in adt7475_probe()
1801 data->has_vid ? " vid" : ""); in adt7475_probe()
1802 if (data->bypass_attn) in adt7475_probe()
1803 dev_info(&client->dev, "Bypassing attenuators on:%s%s%s%s\n", in adt7475_probe()
1804 (data->bypass_attn & (1 << 0)) ? " in0" : "", in adt7475_probe()
1805 (data->bypass_attn & (1 << 1)) ? " in1" : "", in adt7475_probe()
1806 (data->bypass_attn & (1 << 3)) ? " in3" : "", in adt7475_probe()
1807 (data->bypass_attn & (1 << 4)) ? " in4" : ""); in adt7475_probe()
1833 data->temp[HYSTERSIS][0] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS); in adt7475_read_hystersis()
1834 data->temp[HYSTERSIS][1] = data->temp[HYSTERSIS][0]; in adt7475_read_hystersis()
1835 data->temp[HYSTERSIS][2] = (u16) adt7475_read(REG_REMOTE2_HYSTERSIS); in adt7475_read_hystersis()
1843 data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index)); in adt7475_read_pwm()
1849 v = (data->pwm[CONTROL][index] >> 5) & 7; in adt7475_read_pwm()
1852 data->pwmctl[index] = 0; in adt7475_read_pwm()
1854 data->pwmctl[index] = 1; in adt7475_read_pwm()
1857 * The fan is disabled - we don't want to in adt7475_read_pwm()
1861 data->pwm[INPUT][index] = 0; in adt7475_read_pwm()
1862 data->pwm[CONTROL][index] &= ~0xE0; in adt7475_read_pwm()
1863 data->pwm[CONTROL][index] |= (7 << 5); in adt7475_read_pwm()
1866 data->pwm[INPUT][index]); in adt7475_read_pwm()
1869 data->pwm[CONTROL][index]); in adt7475_read_pwm()
1871 data->pwmctl[index] = 1; in adt7475_read_pwm()
1873 data->pwmctl[index] = 2; in adt7475_read_pwm()
1877 data->pwmchan[index] = 1; in adt7475_read_pwm()
1880 data->pwmchan[index] = 2; in adt7475_read_pwm()
1883 data->pwmchan[index] = 4; in adt7475_read_pwm()
1886 data->pwmchan[index] = 6; in adt7475_read_pwm()
1889 data->pwmchan[index] = 7; in adt7475_read_pwm()
1898 struct i2c_client *client = data->client; in adt7475_update_measure()
1906 data->alarms = ret << 8; in adt7475_update_measure()
1911 data->alarms |= ret; in adt7475_update_measure()
1926 if (!(data->has_voltage & (1 << i))) in adt7475_update_measure()
1931 data->voltage[INPUT][i] = in adt7475_update_measure()
1940 data->temp[INPUT][i] = in adt7475_update_measure()
1945 if (data->has_voltage & (1 << 5)) { in adt7475_update_measure()
1949 data->alarms |= ret << 24; in adt7475_update_measure()
1959 data->voltage[INPUT][5] = ret << 2 | in adt7475_update_measure()
1964 if (i == 3 && !data->has_fan4) in adt7475_update_measure()
1969 data->tach[INPUT][i] = ret; in adt7475_update_measure()
1974 if (i == 1 && !data->has_pwm2) in adt7475_update_measure()
1979 data->pwm[INPUT][i] = ret; in adt7475_update_measure()
1982 if (data->has_vid) { in adt7475_update_measure()
1986 data->vid = ret & 0x3f; in adt7475_update_measure()
1997 mutex_lock(&data->lock); in adt7475_update_device()
2000 if (time_after(jiffies, data->measure_updated + HZ * 2) || in adt7475_update_device()
2001 !data->valid) { in adt7475_update_device()
2004 data->valid = false; in adt7475_update_device()
2005 mutex_unlock(&data->lock); in adt7475_update_device()
2008 data->measure_updated = jiffies; in adt7475_update_device()
2009 data->valid = true; in adt7475_update_device()
2012 mutex_unlock(&data->lock); in adt7475_update_device()