aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/adm1026.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/chips/adm1026.c')
-rw-r--r--drivers/i2c/chips/adm1026.c578
1 files changed, 269 insertions, 309 deletions
diff --git a/drivers/i2c/chips/adm1026.c b/drivers/i2c/chips/adm1026.c
index 39e2f4a900bf..3c85fe150cd7 100644
--- a/drivers/i2c/chips/adm1026.c
+++ b/drivers/i2c/chips/adm1026.c
@@ -23,7 +23,6 @@
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24*/ 24*/
25 25
26#include <linux/config.h>
27#include <linux/module.h> 26#include <linux/module.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/slab.h> 28#include <linux/slab.h>
@@ -31,6 +30,7 @@
31#include <linux/i2c.h> 30#include <linux/i2c.h>
32#include <linux/i2c-sensor.h> 31#include <linux/i2c-sensor.h>
33#include <linux/i2c-vid.h> 32#include <linux/i2c-vid.h>
33#include <linux/hwmon-sysfs.h>
34 34
35/* Addresses to scan */ 35/* Addresses to scan */
36static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 36static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
@@ -711,19 +711,27 @@ static struct adm1026_data *adm1026_update_device(struct device *dev)
711 return data; 711 return data;
712} 712}
713 713
714static ssize_t show_in(struct device *dev, char *buf, int nr) 714static ssize_t show_in(struct device *dev, struct device_attribute *attr,
715 char *buf)
715{ 716{
717 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
718 int nr = sensor_attr->index;
716 struct adm1026_data *data = adm1026_update_device(dev); 719 struct adm1026_data *data = adm1026_update_device(dev);
717 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in[nr])); 720 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in[nr]));
718} 721}
719static ssize_t show_in_min(struct device *dev, char *buf, int nr) 722static ssize_t show_in_min(struct device *dev, struct device_attribute *attr,
723 char *buf)
720{ 724{
725 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
726 int nr = sensor_attr->index;
721 struct adm1026_data *data = adm1026_update_device(dev); 727 struct adm1026_data *data = adm1026_update_device(dev);
722 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_min[nr])); 728 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_min[nr]));
723} 729}
724static ssize_t set_in_min(struct device *dev, const char *buf, 730static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,
725 size_t count, int nr) 731 const char *buf, size_t count)
726{ 732{
733 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
734 int nr = sensor_attr->index;
727 struct i2c_client *client = to_i2c_client(dev); 735 struct i2c_client *client = to_i2c_client(dev);
728 struct adm1026_data *data = i2c_get_clientdata(client); 736 struct adm1026_data *data = i2c_get_clientdata(client);
729 int val = simple_strtol(buf, NULL, 10); 737 int val = simple_strtol(buf, NULL, 10);
@@ -734,14 +742,19 @@ static ssize_t set_in_min(struct device *dev, const char *buf,
734 up(&data->update_lock); 742 up(&data->update_lock);
735 return count; 743 return count;
736} 744}
737static ssize_t show_in_max(struct device *dev, char *buf, int nr) 745static ssize_t show_in_max(struct device *dev, struct device_attribute *attr,
746 char *buf)
738{ 747{
748 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
749 int nr = sensor_attr->index;
739 struct adm1026_data *data = adm1026_update_device(dev); 750 struct adm1026_data *data = adm1026_update_device(dev);
740 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_max[nr])); 751 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_max[nr]));
741} 752}
742static ssize_t set_in_max(struct device *dev, const char *buf, 753static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,
743 size_t count, int nr) 754 const char *buf, size_t count)
744{ 755{
756 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
757 int nr = sensor_attr->index;
745 struct i2c_client *client = to_i2c_client(dev); 758 struct i2c_client *client = to_i2c_client(dev);
746 struct adm1026_data *data = i2c_get_clientdata(client); 759 struct adm1026_data *data = i2c_get_clientdata(client);
747 int val = simple_strtol(buf, NULL, 10); 760 int val = simple_strtol(buf, NULL, 10);
@@ -753,34 +766,13 @@ static ssize_t set_in_max(struct device *dev, const char *buf,
753 return count; 766 return count;
754} 767}
755 768
756#define in_reg(offset) \ 769#define in_reg(offset) \
757static ssize_t show_in##offset (struct device *dev, char *buf) \ 770static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in, \
758{ \ 771 NULL, offset); \
759 return show_in(dev, buf, offset); \ 772static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
760} \ 773 show_in_min, set_in_min, offset); \
761static ssize_t show_in##offset##_min (struct device *dev, char *buf) \ 774static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
762{ \ 775 show_in_max, set_in_max, offset);
763 return show_in_min(dev, buf, offset); \
764} \
765static ssize_t set_in##offset##_min (struct device *dev, \
766 const char *buf, size_t count) \
767{ \
768 return set_in_min(dev, buf, count, offset); \
769} \
770static ssize_t show_in##offset##_max (struct device *dev, char *buf) \
771{ \
772 return show_in_max(dev, buf, offset); \
773} \
774static ssize_t set_in##offset##_max (struct device *dev, \
775 const char *buf, size_t count) \
776{ \
777 return set_in_max(dev, buf, count, offset); \
778} \
779static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL); \
780static DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
781 show_in##offset##_min, set_in##offset##_min); \
782static DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
783 show_in##offset##_max, set_in##offset##_max);
784 776
785 777
786in_reg(0); 778in_reg(0);
@@ -800,19 +792,19 @@ in_reg(13);
800in_reg(14); 792in_reg(14);
801in_reg(15); 793in_reg(15);
802 794
803static ssize_t show_in16(struct device *dev, char *buf) 795static ssize_t show_in16(struct device *dev, struct device_attribute *attr, char *buf)
804{ 796{
805 struct adm1026_data *data = adm1026_update_device(dev); 797 struct adm1026_data *data = adm1026_update_device(dev);
806 return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in[16]) - 798 return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in[16]) -
807 NEG12_OFFSET); 799 NEG12_OFFSET);
808} 800}
809static ssize_t show_in16_min(struct device *dev, char *buf) 801static ssize_t show_in16_min(struct device *dev, struct device_attribute *attr, char *buf)
810{ 802{
811 struct adm1026_data *data = adm1026_update_device(dev); 803 struct adm1026_data *data = adm1026_update_device(dev);
812 return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in_min[16]) 804 return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in_min[16])
813 - NEG12_OFFSET); 805 - NEG12_OFFSET);
814} 806}
815static ssize_t set_in16_min(struct device *dev, const char *buf, size_t count) 807static ssize_t set_in16_min(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
816{ 808{
817 struct i2c_client *client = to_i2c_client(dev); 809 struct i2c_client *client = to_i2c_client(dev);
818 struct adm1026_data *data = i2c_get_clientdata(client); 810 struct adm1026_data *data = i2c_get_clientdata(client);
@@ -824,13 +816,13 @@ static ssize_t set_in16_min(struct device *dev, const char *buf, size_t count)
824 up(&data->update_lock); 816 up(&data->update_lock);
825 return count; 817 return count;
826} 818}
827static ssize_t show_in16_max(struct device *dev, char *buf) 819static ssize_t show_in16_max(struct device *dev, struct device_attribute *attr, char *buf)
828{ 820{
829 struct adm1026_data *data = adm1026_update_device(dev); 821 struct adm1026_data *data = adm1026_update_device(dev);
830 return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in_max[16]) 822 return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in_max[16])
831 - NEG12_OFFSET); 823 - NEG12_OFFSET);
832} 824}
833static ssize_t set_in16_max(struct device *dev, const char *buf, size_t count) 825static ssize_t set_in16_max(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
834{ 826{
835 struct i2c_client *client = to_i2c_client(dev); 827 struct i2c_client *client = to_i2c_client(dev);
836 struct adm1026_data *data = i2c_get_clientdata(client); 828 struct adm1026_data *data = i2c_get_clientdata(client);
@@ -843,30 +835,38 @@ static ssize_t set_in16_max(struct device *dev, const char *buf, size_t count)
843 return count; 835 return count;
844} 836}
845 837
846static DEVICE_ATTR(in16_input, S_IRUGO, show_in16, NULL); 838static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, show_in16, NULL, 16);
847static DEVICE_ATTR(in16_min, S_IRUGO | S_IWUSR, show_in16_min, set_in16_min); 839static SENSOR_DEVICE_ATTR(in16_min, S_IRUGO | S_IWUSR, show_in16_min, set_in16_min, 16);
848static DEVICE_ATTR(in16_max, S_IRUGO | S_IWUSR, show_in16_max, set_in16_max); 840static SENSOR_DEVICE_ATTR(in16_max, S_IRUGO | S_IWUSR, show_in16_max, set_in16_max, 16);
849 841
850 842
851 843
852 844
853/* Now add fan read/write functions */ 845/* Now add fan read/write functions */
854 846
855static ssize_t show_fan(struct device *dev, char *buf, int nr) 847static ssize_t show_fan(struct device *dev, struct device_attribute *attr,
848 char *buf)
856{ 849{
850 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
851 int nr = sensor_attr->index;
857 struct adm1026_data *data = adm1026_update_device(dev); 852 struct adm1026_data *data = adm1026_update_device(dev);
858 return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan[nr], 853 return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan[nr],
859 data->fan_div[nr])); 854 data->fan_div[nr]));
860} 855}
861static ssize_t show_fan_min(struct device *dev, char *buf, int nr) 856static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr,
857 char *buf)
862{ 858{
859 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
860 int nr = sensor_attr->index;
863 struct adm1026_data *data = adm1026_update_device(dev); 861 struct adm1026_data *data = adm1026_update_device(dev);
864 return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan_min[nr], 862 return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan_min[nr],
865 data->fan_div[nr])); 863 data->fan_div[nr]));
866} 864}
867static ssize_t set_fan_min(struct device *dev, const char *buf, 865static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
868 size_t count, int nr) 866 const char *buf, size_t count)
869{ 867{
868 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
869 int nr = sensor_attr->index;
870 struct i2c_client *client = to_i2c_client(dev); 870 struct i2c_client *client = to_i2c_client(dev);
871 struct adm1026_data *data = i2c_get_clientdata(client); 871 struct adm1026_data *data = i2c_get_clientdata(client);
872 int val = simple_strtol(buf, NULL, 10); 872 int val = simple_strtol(buf, NULL, 10);
@@ -879,23 +879,11 @@ static ssize_t set_fan_min(struct device *dev, const char *buf,
879 return count; 879 return count;
880} 880}
881 881
882#define fan_offset(offset) \ 882#define fan_offset(offset) \
883static ssize_t show_fan_##offset (struct device *dev, char *buf) \ 883static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan, NULL, \
884{ \ 884 offset - 1); \
885 return show_fan(dev, buf, offset - 1); \ 885static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
886} \ 886 show_fan_min, set_fan_min, offset - 1);
887static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \
888{ \
889 return show_fan_min(dev, buf, offset - 1); \
890} \
891static ssize_t set_fan_##offset##_min (struct device *dev, \
892 const char *buf, size_t count) \
893{ \
894 return set_fan_min(dev, buf, count, offset - 1); \
895} \
896static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, NULL); \
897static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
898 show_fan_##offset##_min, set_fan_##offset##_min);
899 887
900fan_offset(1); 888fan_offset(1);
901fan_offset(2); 889fan_offset(2);
@@ -926,14 +914,19 @@ static void fixup_fan_min(struct device *dev, int fan, int old_div)
926} 914}
927 915
928/* Now add fan_div read/write functions */ 916/* Now add fan_div read/write functions */
929static ssize_t show_fan_div(struct device *dev, char *buf, int nr) 917static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr,
918 char *buf)
930{ 919{
920 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
921 int nr = sensor_attr->index;
931 struct adm1026_data *data = adm1026_update_device(dev); 922 struct adm1026_data *data = adm1026_update_device(dev);
932 return sprintf(buf,"%d\n", data->fan_div[nr]); 923 return sprintf(buf,"%d\n", data->fan_div[nr]);
933} 924}
934static ssize_t set_fan_div(struct device *dev, const char *buf, 925static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
935 size_t count, int nr) 926 const char *buf, size_t count)
936{ 927{
928 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
929 int nr = sensor_attr->index;
937 struct i2c_client *client = to_i2c_client(dev); 930 struct i2c_client *client = to_i2c_client(dev);
938 struct adm1026_data *data = i2c_get_clientdata(client); 931 struct adm1026_data *data = i2c_get_clientdata(client);
939 int val,orig_div,new_div,shift; 932 int val,orig_div,new_div,shift;
@@ -967,17 +960,8 @@ static ssize_t set_fan_div(struct device *dev, const char *buf,
967} 960}
968 961
969#define fan_offset_div(offset) \ 962#define fan_offset_div(offset) \
970static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ 963static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \
971{ \ 964 show_fan_div, set_fan_div, offset - 1);
972 return show_fan_div(dev, buf, offset - 1); \
973} \
974static ssize_t set_fan_##offset##_div (struct device *dev, \
975 const char *buf, size_t count) \
976{ \
977 return set_fan_div(dev, buf, count, offset - 1); \
978} \
979static DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \
980 show_fan_##offset##_div, set_fan_##offset##_div);
981 965
982fan_offset_div(1); 966fan_offset_div(1);
983fan_offset_div(2); 967fan_offset_div(2);
@@ -989,19 +973,27 @@ fan_offset_div(7);
989fan_offset_div(8); 973fan_offset_div(8);
990 974
991/* Temps */ 975/* Temps */
992static ssize_t show_temp(struct device *dev, char *buf, int nr) 976static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
977 char *buf)
993{ 978{
979 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
980 int nr = sensor_attr->index;
994 struct adm1026_data *data = adm1026_update_device(dev); 981 struct adm1026_data *data = adm1026_update_device(dev);
995 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp[nr])); 982 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp[nr]));
996} 983}
997static ssize_t show_temp_min(struct device *dev, char *buf, int nr) 984static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr,
985 char *buf)
998{ 986{
987 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
988 int nr = sensor_attr->index;
999 struct adm1026_data *data = adm1026_update_device(dev); 989 struct adm1026_data *data = adm1026_update_device(dev);
1000 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_min[nr])); 990 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_min[nr]));
1001} 991}
1002static ssize_t set_temp_min(struct device *dev, const char *buf, 992static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
1003 size_t count, int nr) 993 const char *buf, size_t count)
1004{ 994{
995 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
996 int nr = sensor_attr->index;
1005 struct i2c_client *client = to_i2c_client(dev); 997 struct i2c_client *client = to_i2c_client(dev);
1006 struct adm1026_data *data = i2c_get_clientdata(client); 998 struct adm1026_data *data = i2c_get_clientdata(client);
1007 int val = simple_strtol(buf, NULL, 10); 999 int val = simple_strtol(buf, NULL, 10);
@@ -1013,14 +1005,19 @@ static ssize_t set_temp_min(struct device *dev, const char *buf,
1013 up(&data->update_lock); 1005 up(&data->update_lock);
1014 return count; 1006 return count;
1015} 1007}
1016static ssize_t show_temp_max(struct device *dev, char *buf, int nr) 1008static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr,
1009 char *buf)
1017{ 1010{
1011 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1012 int nr = sensor_attr->index;
1018 struct adm1026_data *data = adm1026_update_device(dev); 1013 struct adm1026_data *data = adm1026_update_device(dev);
1019 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr])); 1014 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr]));
1020} 1015}
1021static ssize_t set_temp_max(struct device *dev, const char *buf, 1016static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
1022 size_t count, int nr) 1017 const char *buf, size_t count)
1023{ 1018{
1019 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1020 int nr = sensor_attr->index;
1024 struct i2c_client *client = to_i2c_client(dev); 1021 struct i2c_client *client = to_i2c_client(dev);
1025 struct adm1026_data *data = i2c_get_clientdata(client); 1022 struct adm1026_data *data = i2c_get_clientdata(client);
1026 int val = simple_strtol(buf, NULL, 10); 1023 int val = simple_strtol(buf, NULL, 10);
@@ -1032,48 +1029,34 @@ static ssize_t set_temp_max(struct device *dev, const char *buf,
1032 up(&data->update_lock); 1029 up(&data->update_lock);
1033 return count; 1030 return count;
1034} 1031}
1035#define temp_reg(offset) \ 1032
1036static ssize_t show_temp_##offset (struct device *dev, char *buf) \ 1033#define temp_reg(offset) \
1037{ \ 1034static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp, \
1038 return show_temp(dev, buf, offset - 1); \ 1035 NULL, offset - 1); \
1039} \ 1036static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \
1040static ssize_t show_temp_##offset##_min (struct device *dev, char *buf) \ 1037 show_temp_min, set_temp_min, offset - 1); \
1041{ \ 1038static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
1042 return show_temp_min(dev, buf, offset - 1); \ 1039 show_temp_max, set_temp_max, offset - 1);
1043} \
1044static ssize_t show_temp_##offset##_max (struct device *dev, char *buf) \
1045{ \
1046 return show_temp_max(dev, buf, offset - 1); \
1047} \
1048static ssize_t set_temp_##offset##_min (struct device *dev, \
1049 const char *buf, size_t count) \
1050{ \
1051 return set_temp_min(dev, buf, count, offset - 1); \
1052} \
1053static ssize_t set_temp_##offset##_max (struct device *dev, \
1054 const char *buf, size_t count) \
1055{ \
1056 return set_temp_max(dev, buf, count, offset - 1); \
1057} \
1058static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp_##offset, NULL); \
1059static DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \
1060 show_temp_##offset##_min, set_temp_##offset##_min); \
1061static DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
1062 show_temp_##offset##_max, set_temp_##offset##_max);
1063 1040
1064 1041
1065temp_reg(1); 1042temp_reg(1);
1066temp_reg(2); 1043temp_reg(2);
1067temp_reg(3); 1044temp_reg(3);
1068 1045
1069static ssize_t show_temp_offset(struct device *dev, char *buf, int nr) 1046static ssize_t show_temp_offset(struct device *dev,
1047 struct device_attribute *attr, char *buf)
1070{ 1048{
1049 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1050 int nr = sensor_attr->index;
1071 struct adm1026_data *data = adm1026_update_device(dev); 1051 struct adm1026_data *data = adm1026_update_device(dev);
1072 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_offset[nr])); 1052 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_offset[nr]));
1073} 1053}
1074static ssize_t set_temp_offset(struct device *dev, const char *buf, 1054static ssize_t set_temp_offset(struct device *dev,
1075 size_t count, int nr) 1055 struct device_attribute *attr, const char *buf,
1056 size_t count)
1076{ 1057{
1058 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1059 int nr = sensor_attr->index;
1077 struct i2c_client *client = to_i2c_client(dev); 1060 struct i2c_client *client = to_i2c_client(dev);
1078 struct adm1026_data *data = i2c_get_clientdata(client); 1061 struct adm1026_data *data = i2c_get_clientdata(client);
1079 int val = simple_strtol(buf, NULL, 10); 1062 int val = simple_strtol(buf, NULL, 10);
@@ -1086,46 +1069,45 @@ static ssize_t set_temp_offset(struct device *dev, const char *buf,
1086 return count; 1069 return count;
1087} 1070}
1088 1071
1089#define temp_offset_reg(offset) \ 1072#define temp_offset_reg(offset) \
1090static ssize_t show_temp_##offset##_offset (struct device *dev, char *buf) \ 1073static SENSOR_DEVICE_ATTR(temp##offset##_offset, S_IRUGO | S_IWUSR, \
1091{ \ 1074 show_temp_offset, set_temp_offset, offset - 1);
1092 return show_temp_offset(dev, buf, offset - 1); \
1093} \
1094static ssize_t set_temp_##offset##_offset (struct device *dev, \
1095 const char *buf, size_t count) \
1096{ \
1097 return set_temp_offset(dev, buf, count, offset - 1); \
1098} \
1099static DEVICE_ATTR(temp##offset##_offset, S_IRUGO | S_IWUSR, \
1100 show_temp_##offset##_offset, set_temp_##offset##_offset);
1101 1075
1102temp_offset_reg(1); 1076temp_offset_reg(1);
1103temp_offset_reg(2); 1077temp_offset_reg(2);
1104temp_offset_reg(3); 1078temp_offset_reg(3);
1105 1079
1106static ssize_t show_temp_auto_point1_temp_hyst(struct device *dev, char *buf, 1080static ssize_t show_temp_auto_point1_temp_hyst(struct device *dev,
1107 int nr) 1081 struct device_attribute *attr, char *buf)
1108{ 1082{
1083 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1084 int nr = sensor_attr->index;
1109 struct adm1026_data *data = adm1026_update_device(dev); 1085 struct adm1026_data *data = adm1026_update_device(dev);
1110 return sprintf(buf,"%d\n", TEMP_FROM_REG( 1086 return sprintf(buf,"%d\n", TEMP_FROM_REG(
1111 ADM1026_FAN_ACTIVATION_TEMP_HYST + data->temp_tmin[nr])); 1087 ADM1026_FAN_ACTIVATION_TEMP_HYST + data->temp_tmin[nr]));
1112} 1088}
1113static ssize_t show_temp_auto_point2_temp(struct device *dev, char *buf, 1089static ssize_t show_temp_auto_point2_temp(struct device *dev,
1114 int nr) 1090 struct device_attribute *attr, char *buf)
1115{ 1091{
1092 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1093 int nr = sensor_attr->index;
1116 struct adm1026_data *data = adm1026_update_device(dev); 1094 struct adm1026_data *data = adm1026_update_device(dev);
1117 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_tmin[nr] + 1095 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_tmin[nr] +
1118 ADM1026_FAN_CONTROL_TEMP_RANGE)); 1096 ADM1026_FAN_CONTROL_TEMP_RANGE));
1119} 1097}
1120static ssize_t show_temp_auto_point1_temp(struct device *dev, char *buf, 1098static ssize_t show_temp_auto_point1_temp(struct device *dev,
1121 int nr) 1099 struct device_attribute *attr, char *buf)
1122{ 1100{
1101 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1102 int nr = sensor_attr->index;
1123 struct adm1026_data *data = adm1026_update_device(dev); 1103 struct adm1026_data *data = adm1026_update_device(dev);
1124 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_tmin[nr])); 1104 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_tmin[nr]));
1125} 1105}
1126static ssize_t set_temp_auto_point1_temp(struct device *dev, const char *buf, 1106static ssize_t set_temp_auto_point1_temp(struct device *dev,
1127 size_t count, int nr) 1107 struct device_attribute *attr, const char *buf, size_t count)
1128{ 1108{
1109 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1110 int nr = sensor_attr->index;
1129 struct i2c_client *client = to_i2c_client(dev); 1111 struct i2c_client *client = to_i2c_client(dev);
1130 struct adm1026_data *data = i2c_get_clientdata(client); 1112 struct adm1026_data *data = i2c_get_clientdata(client);
1131 int val = simple_strtol(buf, NULL, 10); 1113 int val = simple_strtol(buf, NULL, 10);
@@ -1138,46 +1120,27 @@ static ssize_t set_temp_auto_point1_temp(struct device *dev, const char *buf,
1138 return count; 1120 return count;
1139} 1121}
1140 1122
1141#define temp_auto_point(offset) \ 1123#define temp_auto_point(offset) \
1142static ssize_t show_temp##offset##_auto_point1_temp (struct device *dev, \ 1124static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp, S_IRUGO | S_IWUSR, \
1143 char *buf) \ 1125 show_temp_auto_point1_temp, set_temp_auto_point1_temp, \
1144{ \ 1126 offset - 1); \
1145 return show_temp_auto_point1_temp(dev, buf, offset - 1); \ 1127static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp_hyst, S_IRUGO, \
1146} \ 1128 show_temp_auto_point1_temp_hyst, NULL, offset - 1); \
1147static ssize_t set_temp##offset##_auto_point1_temp (struct device *dev, \ 1129static SENSOR_DEVICE_ATTR(temp##offset##_auto_point2_temp, S_IRUGO, \
1148 const char *buf, size_t count) \ 1130 show_temp_auto_point2_temp, NULL, offset - 1);
1149{ \
1150 return set_temp_auto_point1_temp(dev, buf, count, offset - 1); \
1151} \
1152static ssize_t show_temp##offset##_auto_point1_temp_hyst (struct device \
1153 *dev, char *buf) \
1154{ \
1155 return show_temp_auto_point1_temp_hyst(dev, buf, offset - 1); \
1156} \
1157static ssize_t show_temp##offset##_auto_point2_temp (struct device *dev, \
1158 char *buf) \
1159{ \
1160 return show_temp_auto_point2_temp(dev, buf, offset - 1); \
1161} \
1162static DEVICE_ATTR(temp##offset##_auto_point1_temp, S_IRUGO | S_IWUSR, \
1163 show_temp##offset##_auto_point1_temp, \
1164 set_temp##offset##_auto_point1_temp); \
1165static DEVICE_ATTR(temp##offset##_auto_point1_temp_hyst, S_IRUGO, \
1166 show_temp##offset##_auto_point1_temp_hyst, NULL); \
1167static DEVICE_ATTR(temp##offset##_auto_point2_temp, S_IRUGO, \
1168 show_temp##offset##_auto_point2_temp, NULL);
1169 1131
1170temp_auto_point(1); 1132temp_auto_point(1);
1171temp_auto_point(2); 1133temp_auto_point(2);
1172temp_auto_point(3); 1134temp_auto_point(3);
1173 1135
1174static ssize_t show_temp_crit_enable(struct device *dev, char *buf) 1136static ssize_t show_temp_crit_enable(struct device *dev,
1137 struct device_attribute *attr, char *buf)
1175{ 1138{
1176 struct adm1026_data *data = adm1026_update_device(dev); 1139 struct adm1026_data *data = adm1026_update_device(dev);
1177 return sprintf(buf,"%d\n", (data->config1 & CFG1_THERM_HOT) >> 4); 1140 return sprintf(buf,"%d\n", (data->config1 & CFG1_THERM_HOT) >> 4);
1178} 1141}
1179static ssize_t set_temp_crit_enable(struct device *dev, const char *buf, 1142static ssize_t set_temp_crit_enable(struct device *dev,
1180 size_t count) 1143 struct device_attribute *attr, const char *buf, size_t count)
1181{ 1144{
1182 struct i2c_client *client = to_i2c_client(dev); 1145 struct i2c_client *client = to_i2c_client(dev);
1183 struct adm1026_data *data = i2c_get_clientdata(client); 1146 struct adm1026_data *data = i2c_get_clientdata(client);
@@ -1193,24 +1156,27 @@ static ssize_t set_temp_crit_enable(struct device *dev, const char *buf,
1193 return count; 1156 return count;
1194} 1157}
1195 1158
1196static DEVICE_ATTR(temp1_crit_enable, S_IRUGO | S_IWUSR, 1159#define temp_crit_enable(offset) \
1197 show_temp_crit_enable, set_temp_crit_enable); 1160static DEVICE_ATTR(temp##offset##_crit_enable, S_IRUGO | S_IWUSR, \
1198
1199static DEVICE_ATTR(temp2_crit_enable, S_IRUGO | S_IWUSR,
1200 show_temp_crit_enable, set_temp_crit_enable);
1201
1202static DEVICE_ATTR(temp3_crit_enable, S_IRUGO | S_IWUSR,
1203 show_temp_crit_enable, set_temp_crit_enable); 1161 show_temp_crit_enable, set_temp_crit_enable);
1204 1162
1163temp_crit_enable(1);
1164temp_crit_enable(2);
1165temp_crit_enable(3);
1205 1166
1206static ssize_t show_temp_crit(struct device *dev, char *buf, int nr) 1167static ssize_t show_temp_crit(struct device *dev,
1168 struct device_attribute *attr, char *buf)
1207{ 1169{
1170 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1171 int nr = sensor_attr->index;
1208 struct adm1026_data *data = adm1026_update_device(dev); 1172 struct adm1026_data *data = adm1026_update_device(dev);
1209 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_crit[nr])); 1173 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_crit[nr]));
1210} 1174}
1211static ssize_t set_temp_crit(struct device *dev, const char *buf, 1175static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr,
1212 size_t count, int nr) 1176 const char *buf, size_t count)
1213{ 1177{
1178 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1179 int nr = sensor_attr->index;
1214 struct i2c_client *client = to_i2c_client(dev); 1180 struct i2c_client *client = to_i2c_client(dev);
1215 struct adm1026_data *data = i2c_get_clientdata(client); 1181 struct adm1026_data *data = i2c_get_clientdata(client);
1216 int val = simple_strtol(buf, NULL, 10); 1182 int val = simple_strtol(buf, NULL, 10);
@@ -1223,29 +1189,20 @@ static ssize_t set_temp_crit(struct device *dev, const char *buf,
1223 return count; 1189 return count;
1224} 1190}
1225 1191
1226#define temp_crit_reg(offset) \ 1192#define temp_crit_reg(offset) \
1227static ssize_t show_temp_##offset##_crit (struct device *dev, char *buf) \ 1193static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \
1228{ \ 1194 show_temp_crit, set_temp_crit, offset - 1);
1229 return show_temp_crit(dev, buf, offset - 1); \
1230} \
1231static ssize_t set_temp_##offset##_crit (struct device *dev, \
1232 const char *buf, size_t count) \
1233{ \
1234 return set_temp_crit(dev, buf, count, offset - 1); \
1235} \
1236static DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \
1237 show_temp_##offset##_crit, set_temp_##offset##_crit);
1238 1195
1239temp_crit_reg(1); 1196temp_crit_reg(1);
1240temp_crit_reg(2); 1197temp_crit_reg(2);
1241temp_crit_reg(3); 1198temp_crit_reg(3);
1242 1199
1243static ssize_t show_analog_out_reg(struct device *dev, char *buf) 1200static ssize_t show_analog_out_reg(struct device *dev, struct device_attribute *attr, char *buf)
1244{ 1201{
1245 struct adm1026_data *data = adm1026_update_device(dev); 1202 struct adm1026_data *data = adm1026_update_device(dev);
1246 return sprintf(buf,"%d\n", DAC_FROM_REG(data->analog_out)); 1203 return sprintf(buf,"%d\n", DAC_FROM_REG(data->analog_out));
1247} 1204}
1248static ssize_t set_analog_out_reg(struct device *dev, const char *buf, 1205static ssize_t set_analog_out_reg(struct device *dev, struct device_attribute *attr, const char *buf,
1249 size_t count) 1206 size_t count)
1250{ 1207{
1251 struct i2c_client *client = to_i2c_client(dev); 1208 struct i2c_client *client = to_i2c_client(dev);
@@ -1262,20 +1219,21 @@ static ssize_t set_analog_out_reg(struct device *dev, const char *buf,
1262static DEVICE_ATTR(analog_out, S_IRUGO | S_IWUSR, show_analog_out_reg, 1219static DEVICE_ATTR(analog_out, S_IRUGO | S_IWUSR, show_analog_out_reg,
1263 set_analog_out_reg); 1220 set_analog_out_reg);
1264 1221
1265static ssize_t show_vid_reg(struct device *dev, char *buf) 1222static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf)
1266{ 1223{
1267 struct adm1026_data *data = adm1026_update_device(dev); 1224 struct adm1026_data *data = adm1026_update_device(dev);
1268 return sprintf(buf,"%d\n", vid_from_reg(data->vid & 0x3f, data->vrm)); 1225 return sprintf(buf,"%d\n", vid_from_reg(data->vid & 0x3f, data->vrm));
1269} 1226}
1270 1227/* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */
1271static DEVICE_ATTR(vid, S_IRUGO, show_vid_reg, NULL); 1228static DEVICE_ATTR(vid, S_IRUGO, show_vid_reg, NULL);
1229static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL);
1272 1230
1273static ssize_t show_vrm_reg(struct device *dev, char *buf) 1231static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf)
1274{ 1232{
1275 struct adm1026_data *data = adm1026_update_device(dev); 1233 struct adm1026_data *data = adm1026_update_device(dev);
1276 return sprintf(buf,"%d\n", data->vrm); 1234 return sprintf(buf,"%d\n", data->vrm);
1277} 1235}
1278static ssize_t store_vrm_reg(struct device *dev, const char *buf, 1236static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf,
1279 size_t count) 1237 size_t count)
1280{ 1238{
1281 struct i2c_client *client = to_i2c_client(dev); 1239 struct i2c_client *client = to_i2c_client(dev);
@@ -1287,7 +1245,7 @@ static ssize_t store_vrm_reg(struct device *dev, const char *buf,
1287 1245
1288static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); 1246static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg);
1289 1247
1290static ssize_t show_alarms_reg(struct device *dev, char *buf) 1248static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf)
1291{ 1249{
1292 struct adm1026_data *data = adm1026_update_device(dev); 1250 struct adm1026_data *data = adm1026_update_device(dev);
1293 return sprintf(buf, "%ld\n", (long) (data->alarms)); 1251 return sprintf(buf, "%ld\n", (long) (data->alarms));
@@ -1295,12 +1253,12 @@ static ssize_t show_alarms_reg(struct device *dev, char *buf)
1295 1253
1296static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); 1254static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
1297 1255
1298static ssize_t show_alarm_mask(struct device *dev, char *buf) 1256static ssize_t show_alarm_mask(struct device *dev, struct device_attribute *attr, char *buf)
1299{ 1257{
1300 struct adm1026_data *data = adm1026_update_device(dev); 1258 struct adm1026_data *data = adm1026_update_device(dev);
1301 return sprintf(buf,"%ld\n", data->alarm_mask); 1259 return sprintf(buf,"%ld\n", data->alarm_mask);
1302} 1260}
1303static ssize_t set_alarm_mask(struct device *dev, const char *buf, 1261static ssize_t set_alarm_mask(struct device *dev, struct device_attribute *attr, const char *buf,
1304 size_t count) 1262 size_t count)
1305{ 1263{
1306 struct i2c_client *client = to_i2c_client(dev); 1264 struct i2c_client *client = to_i2c_client(dev);
@@ -1331,12 +1289,12 @@ static DEVICE_ATTR(alarm_mask, S_IRUGO | S_IWUSR, show_alarm_mask,
1331 set_alarm_mask); 1289 set_alarm_mask);
1332 1290
1333 1291
1334static ssize_t show_gpio(struct device *dev, char *buf) 1292static ssize_t show_gpio(struct device *dev, struct device_attribute *attr, char *buf)
1335{ 1293{
1336 struct adm1026_data *data = adm1026_update_device(dev); 1294 struct adm1026_data *data = adm1026_update_device(dev);
1337 return sprintf(buf,"%ld\n", data->gpio); 1295 return sprintf(buf,"%ld\n", data->gpio);
1338} 1296}
1339static ssize_t set_gpio(struct device *dev, const char *buf, 1297static ssize_t set_gpio(struct device *dev, struct device_attribute *attr, const char *buf,
1340 size_t count) 1298 size_t count)
1341{ 1299{
1342 struct i2c_client *client = to_i2c_client(dev); 1300 struct i2c_client *client = to_i2c_client(dev);
@@ -1359,12 +1317,12 @@ static ssize_t set_gpio(struct device *dev, const char *buf,
1359static DEVICE_ATTR(gpio, S_IRUGO | S_IWUSR, show_gpio, set_gpio); 1317static DEVICE_ATTR(gpio, S_IRUGO | S_IWUSR, show_gpio, set_gpio);
1360 1318
1361 1319
1362static ssize_t show_gpio_mask(struct device *dev, char *buf) 1320static ssize_t show_gpio_mask(struct device *dev, struct device_attribute *attr, char *buf)
1363{ 1321{
1364 struct adm1026_data *data = adm1026_update_device(dev); 1322 struct adm1026_data *data = adm1026_update_device(dev);
1365 return sprintf(buf,"%ld\n", data->gpio_mask); 1323 return sprintf(buf,"%ld\n", data->gpio_mask);
1366} 1324}
1367static ssize_t set_gpio_mask(struct device *dev, const char *buf, 1325static ssize_t set_gpio_mask(struct device *dev, struct device_attribute *attr, const char *buf,
1368 size_t count) 1326 size_t count)
1369{ 1327{
1370 struct i2c_client *client = to_i2c_client(dev); 1328 struct i2c_client *client = to_i2c_client(dev);
@@ -1386,12 +1344,12 @@ static ssize_t set_gpio_mask(struct device *dev, const char *buf,
1386 1344
1387static DEVICE_ATTR(gpio_mask, S_IRUGO | S_IWUSR, show_gpio_mask, set_gpio_mask); 1345static DEVICE_ATTR(gpio_mask, S_IRUGO | S_IWUSR, show_gpio_mask, set_gpio_mask);
1388 1346
1389static ssize_t show_pwm_reg(struct device *dev, char *buf) 1347static ssize_t show_pwm_reg(struct device *dev, struct device_attribute *attr, char *buf)
1390{ 1348{
1391 struct adm1026_data *data = adm1026_update_device(dev); 1349 struct adm1026_data *data = adm1026_update_device(dev);
1392 return sprintf(buf,"%d\n", PWM_FROM_REG(data->pwm1.pwm)); 1350 return sprintf(buf,"%d\n", PWM_FROM_REG(data->pwm1.pwm));
1393} 1351}
1394static ssize_t set_pwm_reg(struct device *dev, const char *buf, 1352static ssize_t set_pwm_reg(struct device *dev, struct device_attribute *attr, const char *buf,
1395 size_t count) 1353 size_t count)
1396{ 1354{
1397 struct i2c_client *client = to_i2c_client(dev); 1355 struct i2c_client *client = to_i2c_client(dev);
@@ -1407,12 +1365,12 @@ static ssize_t set_pwm_reg(struct device *dev, const char *buf,
1407 } 1365 }
1408 return count; 1366 return count;
1409} 1367}
1410static ssize_t show_auto_pwm_min(struct device *dev, char *buf) 1368static ssize_t show_auto_pwm_min(struct device *dev, struct device_attribute *attr, char *buf)
1411{ 1369{
1412 struct adm1026_data *data = adm1026_update_device(dev); 1370 struct adm1026_data *data = adm1026_update_device(dev);
1413 return sprintf(buf,"%d\n", data->pwm1.auto_pwm_min); 1371 return sprintf(buf,"%d\n", data->pwm1.auto_pwm_min);
1414} 1372}
1415static ssize_t set_auto_pwm_min(struct device *dev, const char *buf, 1373static ssize_t set_auto_pwm_min(struct device *dev, struct device_attribute *attr, const char *buf,
1416 size_t count) 1374 size_t count)
1417{ 1375{
1418 struct i2c_client *client = to_i2c_client(dev); 1376 struct i2c_client *client = to_i2c_client(dev);
@@ -1429,16 +1387,16 @@ static ssize_t set_auto_pwm_min(struct device *dev, const char *buf,
1429 up(&data->update_lock); 1387 up(&data->update_lock);
1430 return count; 1388 return count;
1431} 1389}
1432static ssize_t show_auto_pwm_max(struct device *dev, char *buf) 1390static ssize_t show_auto_pwm_max(struct device *dev, struct device_attribute *attr, char *buf)
1433{ 1391{
1434 return sprintf(buf,"%d\n", ADM1026_PWM_MAX); 1392 return sprintf(buf,"%d\n", ADM1026_PWM_MAX);
1435} 1393}
1436static ssize_t show_pwm_enable(struct device *dev, char *buf) 1394static ssize_t show_pwm_enable(struct device *dev, struct device_attribute *attr, char *buf)
1437{ 1395{
1438 struct adm1026_data *data = adm1026_update_device(dev); 1396 struct adm1026_data *data = adm1026_update_device(dev);
1439 return sprintf(buf,"%d\n", data->pwm1.enable); 1397 return sprintf(buf,"%d\n", data->pwm1.enable);
1440} 1398}
1441static ssize_t set_pwm_enable(struct device *dev, const char *buf, 1399static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, const char *buf,
1442 size_t count) 1400 size_t count)
1443{ 1401{
1444 struct i2c_client *client = to_i2c_client(dev); 1402 struct i2c_client *client = to_i2c_client(dev);
@@ -1597,118 +1555,120 @@ int adm1026_detect(struct i2c_adapter *adapter, int address,
1597 adm1026_init_client(new_client); 1555 adm1026_init_client(new_client);
1598 1556
1599 /* Register sysfs hooks */ 1557 /* Register sysfs hooks */
1600 device_create_file(&new_client->dev, &dev_attr_in0_input); 1558 device_create_file(&new_client->dev, &sensor_dev_attr_in0_input.dev_attr);
1601 device_create_file(&new_client->dev, &dev_attr_in0_max); 1559 device_create_file(&new_client->dev, &sensor_dev_attr_in0_max.dev_attr);
1602 device_create_file(&new_client->dev, &dev_attr_in0_min); 1560 device_create_file(&new_client->dev, &sensor_dev_attr_in0_min.dev_attr);
1603 device_create_file(&new_client->dev, &dev_attr_in1_input); 1561 device_create_file(&new_client->dev, &sensor_dev_attr_in1_input.dev_attr);
1604 device_create_file(&new_client->dev, &dev_attr_in1_max); 1562 device_create_file(&new_client->dev, &sensor_dev_attr_in1_max.dev_attr);
1605 device_create_file(&new_client->dev, &dev_attr_in1_min); 1563 device_create_file(&new_client->dev, &sensor_dev_attr_in1_min.dev_attr);
1606 device_create_file(&new_client->dev, &dev_attr_in2_input); 1564 device_create_file(&new_client->dev, &sensor_dev_attr_in2_input.dev_attr);
1607 device_create_file(&new_client->dev, &dev_attr_in2_max); 1565 device_create_file(&new_client->dev, &sensor_dev_attr_in2_max.dev_attr);
1608 device_create_file(&new_client->dev, &dev_attr_in2_min); 1566 device_create_file(&new_client->dev, &sensor_dev_attr_in2_min.dev_attr);
1609 device_create_file(&new_client->dev, &dev_attr_in3_input); 1567 device_create_file(&new_client->dev, &sensor_dev_attr_in3_input.dev_attr);
1610 device_create_file(&new_client->dev, &dev_attr_in3_max); 1568 device_create_file(&new_client->dev, &sensor_dev_attr_in3_max.dev_attr);
1611 device_create_file(&new_client->dev, &dev_attr_in3_min); 1569 device_create_file(&new_client->dev, &sensor_dev_attr_in3_min.dev_attr);
1612 device_create_file(&new_client->dev, &dev_attr_in4_input); 1570 device_create_file(&new_client->dev, &sensor_dev_attr_in4_input.dev_attr);
1613 device_create_file(&new_client->dev, &dev_attr_in4_max); 1571 device_create_file(&new_client->dev, &sensor_dev_attr_in4_max.dev_attr);
1614 device_create_file(&new_client->dev, &dev_attr_in4_min); 1572 device_create_file(&new_client->dev, &sensor_dev_attr_in4_min.dev_attr);
1615 device_create_file(&new_client->dev, &dev_attr_in5_input); 1573 device_create_file(&new_client->dev, &sensor_dev_attr_in5_input.dev_attr);
1616 device_create_file(&new_client->dev, &dev_attr_in5_max); 1574 device_create_file(&new_client->dev, &sensor_dev_attr_in5_max.dev_attr);
1617 device_create_file(&new_client->dev, &dev_attr_in5_min); 1575 device_create_file(&new_client->dev, &sensor_dev_attr_in5_min.dev_attr);
1618 device_create_file(&new_client->dev, &dev_attr_in6_input); 1576 device_create_file(&new_client->dev, &sensor_dev_attr_in6_input.dev_attr);
1619 device_create_file(&new_client->dev, &dev_attr_in6_max); 1577 device_create_file(&new_client->dev, &sensor_dev_attr_in6_max.dev_attr);
1620 device_create_file(&new_client->dev, &dev_attr_in6_min); 1578 device_create_file(&new_client->dev, &sensor_dev_attr_in6_min.dev_attr);
1621 device_create_file(&new_client->dev, &dev_attr_in7_input); 1579 device_create_file(&new_client->dev, &sensor_dev_attr_in7_input.dev_attr);
1622 device_create_file(&new_client->dev, &dev_attr_in7_max); 1580 device_create_file(&new_client->dev, &sensor_dev_attr_in7_max.dev_attr);
1623 device_create_file(&new_client->dev, &dev_attr_in7_min); 1581 device_create_file(&new_client->dev, &sensor_dev_attr_in7_min.dev_attr);
1624 device_create_file(&new_client->dev, &dev_attr_in8_input); 1582 device_create_file(&new_client->dev, &sensor_dev_attr_in8_input.dev_attr);
1625 device_create_file(&new_client->dev, &dev_attr_in8_max); 1583 device_create_file(&new_client->dev, &sensor_dev_attr_in8_max.dev_attr);
1626 device_create_file(&new_client->dev, &dev_attr_in8_min); 1584 device_create_file(&new_client->dev, &sensor_dev_attr_in8_min.dev_attr);
1627 device_create_file(&new_client->dev, &dev_attr_in9_input); 1585 device_create_file(&new_client->dev, &sensor_dev_attr_in9_input.dev_attr);
1628 device_create_file(&new_client->dev, &dev_attr_in9_max); 1586 device_create_file(&new_client->dev, &sensor_dev_attr_in9_max.dev_attr);
1629 device_create_file(&new_client->dev, &dev_attr_in9_min); 1587 device_create_file(&new_client->dev, &sensor_dev_attr_in9_min.dev_attr);
1630 device_create_file(&new_client->dev, &dev_attr_in10_input); 1588 device_create_file(&new_client->dev, &sensor_dev_attr_in10_input.dev_attr);
1631 device_create_file(&new_client->dev, &dev_attr_in10_max); 1589 device_create_file(&new_client->dev, &sensor_dev_attr_in10_max.dev_attr);
1632 device_create_file(&new_client->dev, &dev_attr_in10_min); 1590 device_create_file(&new_client->dev, &sensor_dev_attr_in10_min.dev_attr);
1633 device_create_file(&new_client->dev, &dev_attr_in11_input); 1591 device_create_file(&new_client->dev, &sensor_dev_attr_in11_input.dev_attr);
1634 device_create_file(&new_client->dev, &dev_attr_in11_max); 1592 device_create_file(&new_client->dev, &sensor_dev_attr_in11_max.dev_attr);
1635 device_create_file(&new_client->dev, &dev_attr_in11_min); 1593 device_create_file(&new_client->dev, &sensor_dev_attr_in11_min.dev_attr);
1636 device_create_file(&new_client->dev, &dev_attr_in12_input); 1594 device_create_file(&new_client->dev, &sensor_dev_attr_in12_input.dev_attr);
1637 device_create_file(&new_client->dev, &dev_attr_in12_max); 1595 device_create_file(&new_client->dev, &sensor_dev_attr_in12_max.dev_attr);
1638 device_create_file(&new_client->dev, &dev_attr_in12_min); 1596 device_create_file(&new_client->dev, &sensor_dev_attr_in12_min.dev_attr);
1639 device_create_file(&new_client->dev, &dev_attr_in13_input); 1597 device_create_file(&new_client->dev, &sensor_dev_attr_in13_input.dev_attr);
1640 device_create_file(&new_client->dev, &dev_attr_in13_max); 1598 device_create_file(&new_client->dev, &sensor_dev_attr_in13_max.dev_attr);
1641 device_create_file(&new_client->dev, &dev_attr_in13_min); 1599 device_create_file(&new_client->dev, &sensor_dev_attr_in13_min.dev_attr);
1642 device_create_file(&new_client->dev, &dev_attr_in14_input); 1600 device_create_file(&new_client->dev, &sensor_dev_attr_in14_input.dev_attr);
1643 device_create_file(&new_client->dev, &dev_attr_in14_max); 1601 device_create_file(&new_client->dev, &sensor_dev_attr_in14_max.dev_attr);
1644 device_create_file(&new_client->dev, &dev_attr_in14_min); 1602 device_create_file(&new_client->dev, &sensor_dev_attr_in14_min.dev_attr);
1645 device_create_file(&new_client->dev, &dev_attr_in15_input); 1603 device_create_file(&new_client->dev, &sensor_dev_attr_in15_input.dev_attr);
1646 device_create_file(&new_client->dev, &dev_attr_in15_max); 1604 device_create_file(&new_client->dev, &sensor_dev_attr_in15_max.dev_attr);
1647 device_create_file(&new_client->dev, &dev_attr_in15_min); 1605 device_create_file(&new_client->dev, &sensor_dev_attr_in15_min.dev_attr);
1648 device_create_file(&new_client->dev, &dev_attr_in16_input); 1606 device_create_file(&new_client->dev, &sensor_dev_attr_in16_input.dev_attr);
1649 device_create_file(&new_client->dev, &dev_attr_in16_max); 1607 device_create_file(&new_client->dev, &sensor_dev_attr_in16_max.dev_attr);
1650 device_create_file(&new_client->dev, &dev_attr_in16_min); 1608 device_create_file(&new_client->dev, &sensor_dev_attr_in16_min.dev_attr);
1651 device_create_file(&new_client->dev, &dev_attr_fan1_input); 1609 device_create_file(&new_client->dev, &sensor_dev_attr_fan1_input.dev_attr);
1652 device_create_file(&new_client->dev, &dev_attr_fan1_div); 1610 device_create_file(&new_client->dev, &sensor_dev_attr_fan1_div.dev_attr);
1653 device_create_file(&new_client->dev, &dev_attr_fan1_min); 1611 device_create_file(&new_client->dev, &sensor_dev_attr_fan1_min.dev_attr);
1654 device_create_file(&new_client->dev, &dev_attr_fan2_input); 1612 device_create_file(&new_client->dev, &sensor_dev_attr_fan2_input.dev_attr);
1655 device_create_file(&new_client->dev, &dev_attr_fan2_div); 1613 device_create_file(&new_client->dev, &sensor_dev_attr_fan2_div.dev_attr);
1656 device_create_file(&new_client->dev, &dev_attr_fan2_min); 1614 device_create_file(&new_client->dev, &sensor_dev_attr_fan2_min.dev_attr);
1657 device_create_file(&new_client->dev, &dev_attr_fan3_input); 1615 device_create_file(&new_client->dev, &sensor_dev_attr_fan3_input.dev_attr);
1658 device_create_file(&new_client->dev, &dev_attr_fan3_div); 1616 device_create_file(&new_client->dev, &sensor_dev_attr_fan3_div.dev_attr);
1659 device_create_file(&new_client->dev, &dev_attr_fan3_min); 1617 device_create_file(&new_client->dev, &sensor_dev_attr_fan3_min.dev_attr);
1660 device_create_file(&new_client->dev, &dev_attr_fan4_input); 1618 device_create_file(&new_client->dev, &sensor_dev_attr_fan4_input.dev_attr);
1661 device_create_file(&new_client->dev, &dev_attr_fan4_div); 1619 device_create_file(&new_client->dev, &sensor_dev_attr_fan4_div.dev_attr);
1662 device_create_file(&new_client->dev, &dev_attr_fan4_min); 1620 device_create_file(&new_client->dev, &sensor_dev_attr_fan4_min.dev_attr);
1663 device_create_file(&new_client->dev, &dev_attr_fan5_input); 1621 device_create_file(&new_client->dev, &sensor_dev_attr_fan5_input.dev_attr);
1664 device_create_file(&new_client->dev, &dev_attr_fan5_div); 1622 device_create_file(&new_client->dev, &sensor_dev_attr_fan5_div.dev_attr);
1665 device_create_file(&new_client->dev, &dev_attr_fan5_min); 1623 device_create_file(&new_client->dev, &sensor_dev_attr_fan5_min.dev_attr);
1666 device_create_file(&new_client->dev, &dev_attr_fan6_input); 1624 device_create_file(&new_client->dev, &sensor_dev_attr_fan6_input.dev_attr);
1667 device_create_file(&new_client->dev, &dev_attr_fan6_div); 1625 device_create_file(&new_client->dev, &sensor_dev_attr_fan6_div.dev_attr);
1668 device_create_file(&new_client->dev, &dev_attr_fan6_min); 1626 device_create_file(&new_client->dev, &sensor_dev_attr_fan6_min.dev_attr);
1669 device_create_file(&new_client->dev, &dev_attr_fan7_input); 1627 device_create_file(&new_client->dev, &sensor_dev_attr_fan7_input.dev_attr);
1670 device_create_file(&new_client->dev, &dev_attr_fan7_div); 1628 device_create_file(&new_client->dev, &sensor_dev_attr_fan7_div.dev_attr);
1671 device_create_file(&new_client->dev, &dev_attr_fan7_min); 1629 device_create_file(&new_client->dev, &sensor_dev_attr_fan7_min.dev_attr);
1672 device_create_file(&new_client->dev, &dev_attr_fan8_input); 1630 device_create_file(&new_client->dev, &sensor_dev_attr_fan8_input.dev_attr);
1673 device_create_file(&new_client->dev, &dev_attr_fan8_div); 1631 device_create_file(&new_client->dev, &sensor_dev_attr_fan8_div.dev_attr);
1674 device_create_file(&new_client->dev, &dev_attr_fan8_min); 1632 device_create_file(&new_client->dev, &sensor_dev_attr_fan8_min.dev_attr);
1675 device_create_file(&new_client->dev, &dev_attr_temp1_input); 1633 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_input.dev_attr);
1676 device_create_file(&new_client->dev, &dev_attr_temp1_max); 1634 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_max.dev_attr);
1677 device_create_file(&new_client->dev, &dev_attr_temp1_min); 1635 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_min.dev_attr);
1678 device_create_file(&new_client->dev, &dev_attr_temp2_input); 1636 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_input.dev_attr);
1679 device_create_file(&new_client->dev, &dev_attr_temp2_max); 1637 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_max.dev_attr);
1680 device_create_file(&new_client->dev, &dev_attr_temp2_min); 1638 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_min.dev_attr);
1681 device_create_file(&new_client->dev, &dev_attr_temp3_input); 1639 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_input.dev_attr);
1682 device_create_file(&new_client->dev, &dev_attr_temp3_max); 1640 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_max.dev_attr);
1683 device_create_file(&new_client->dev, &dev_attr_temp3_min); 1641 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_min.dev_attr);
1684 device_create_file(&new_client->dev, &dev_attr_temp1_offset); 1642 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_offset.dev_attr);
1685 device_create_file(&new_client->dev, &dev_attr_temp2_offset); 1643 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_offset.dev_attr);
1686 device_create_file(&new_client->dev, &dev_attr_temp3_offset); 1644 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_offset.dev_attr);
1687 device_create_file(&new_client->dev, 1645 device_create_file(&new_client->dev,
1688 &dev_attr_temp1_auto_point1_temp); 1646 &sensor_dev_attr_temp1_auto_point1_temp.dev_attr);
1689 device_create_file(&new_client->dev, 1647 device_create_file(&new_client->dev,
1690 &dev_attr_temp2_auto_point1_temp); 1648 &sensor_dev_attr_temp2_auto_point1_temp.dev_attr);
1691 device_create_file(&new_client->dev, 1649 device_create_file(&new_client->dev,
1692 &dev_attr_temp3_auto_point1_temp); 1650 &sensor_dev_attr_temp3_auto_point1_temp.dev_attr);
1693 device_create_file(&new_client->dev, 1651 device_create_file(&new_client->dev,
1694 &dev_attr_temp1_auto_point1_temp_hyst); 1652 &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr);
1695 device_create_file(&new_client->dev, 1653 device_create_file(&new_client->dev,
1696 &dev_attr_temp2_auto_point1_temp_hyst); 1654 &sensor_dev_attr_temp2_auto_point1_temp_hyst.dev_attr);
1697 device_create_file(&new_client->dev, 1655 device_create_file(&new_client->dev,
1698 &dev_attr_temp3_auto_point1_temp_hyst); 1656 &sensor_dev_attr_temp3_auto_point1_temp_hyst.dev_attr);
1699 device_create_file(&new_client->dev, 1657 device_create_file(&new_client->dev,
1700 &dev_attr_temp1_auto_point2_temp); 1658 &sensor_dev_attr_temp1_auto_point2_temp.dev_attr);
1701 device_create_file(&new_client->dev, 1659 device_create_file(&new_client->dev,
1702 &dev_attr_temp2_auto_point2_temp); 1660 &sensor_dev_attr_temp2_auto_point2_temp.dev_attr);
1703 device_create_file(&new_client->dev, 1661 device_create_file(&new_client->dev,
1704 &dev_attr_temp3_auto_point2_temp); 1662 &sensor_dev_attr_temp3_auto_point2_temp.dev_attr);
1705 device_create_file(&new_client->dev, &dev_attr_temp1_crit); 1663 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_crit.dev_attr);
1706 device_create_file(&new_client->dev, &dev_attr_temp2_crit); 1664 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_crit.dev_attr);
1707 device_create_file(&new_client->dev, &dev_attr_temp3_crit); 1665 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_crit.dev_attr);
1708 device_create_file(&new_client->dev, &dev_attr_temp1_crit_enable); 1666 device_create_file(&new_client->dev, &dev_attr_temp1_crit_enable);
1709 device_create_file(&new_client->dev, &dev_attr_temp2_crit_enable); 1667 device_create_file(&new_client->dev, &dev_attr_temp2_crit_enable);
1710 device_create_file(&new_client->dev, &dev_attr_temp3_crit_enable); 1668 device_create_file(&new_client->dev, &dev_attr_temp3_crit_enable);
1669 /* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */
1711 device_create_file(&new_client->dev, &dev_attr_vid); 1670 device_create_file(&new_client->dev, &dev_attr_vid);
1671 device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
1712 device_create_file(&new_client->dev, &dev_attr_vrm); 1672 device_create_file(&new_client->dev, &dev_attr_vrm);
1713 device_create_file(&new_client->dev, &dev_attr_alarms); 1673 device_create_file(&new_client->dev, &dev_attr_alarms);
1714 device_create_file(&new_client->dev, &dev_attr_alarm_mask); 1674 device_create_file(&new_client->dev, &dev_attr_alarm_mask);