it87.c (75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37) | it87.c (9d2227bb9bd4ae799e77c0575452e7e5716658ea) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * it87.c - Part of lm_sensors, Linux kernel modules for hardware 4 * monitoring. 5 * 6 * The IT8705F is an LPC-based Super I/O part that contains UARTs, a 7 * parallel port, an IR port, a MIDI port, a floppy controller, etc., in 8 * addition to an Environment Controller (Enhanced Hardware Monitor and --- 1967 unchanged lines hidden (view full) --- 1976static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1); 1977static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 2); 1978/* AVCC3 */ 1979static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 3); 1980 1981static umode_t it87_in_is_visible(struct kobject *kobj, 1982 struct attribute *attr, int index) 1983{ | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * it87.c - Part of lm_sensors, Linux kernel modules for hardware 4 * monitoring. 5 * 6 * The IT8705F is an LPC-based Super I/O part that contains UARTs, a 7 * parallel port, an IR port, a MIDI port, a floppy controller, etc., in 8 * addition to an Environment Controller (Enhanced Hardware Monitor and --- 1967 unchanged lines hidden (view full) --- 1976static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1); 1977static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 2); 1978/* AVCC3 */ 1979static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 3); 1980 1981static umode_t it87_in_is_visible(struct kobject *kobj, 1982 struct attribute *attr, int index) 1983{ |
1984 struct device *dev = container_of(kobj, struct device, kobj); | 1984 struct device *dev = kobj_to_dev(kobj); |
1985 struct it87_data *data = dev_get_drvdata(dev); 1986 int i = index / 5; /* voltage index */ 1987 int a = index % 5; /* attribute index */ 1988 1989 if (index >= 40) { /* in8 and higher only have input attributes */ 1990 i = index - 40 + 8; 1991 a = 0; 1992 } --- 67 unchanged lines hidden (view full) --- 2060static const struct attribute_group it87_group_in = { 2061 .attrs = it87_attributes_in, 2062 .is_visible = it87_in_is_visible, 2063}; 2064 2065static umode_t it87_temp_is_visible(struct kobject *kobj, 2066 struct attribute *attr, int index) 2067{ | 1985 struct it87_data *data = dev_get_drvdata(dev); 1986 int i = index / 5; /* voltage index */ 1987 int a = index % 5; /* attribute index */ 1988 1989 if (index >= 40) { /* in8 and higher only have input attributes */ 1990 i = index - 40 + 8; 1991 a = 0; 1992 } --- 67 unchanged lines hidden (view full) --- 2060static const struct attribute_group it87_group_in = { 2061 .attrs = it87_attributes_in, 2062 .is_visible = it87_in_is_visible, 2063}; 2064 2065static umode_t it87_temp_is_visible(struct kobject *kobj, 2066 struct attribute *attr, int index) 2067{ |
2068 struct device *dev = container_of(kobj, struct device, kobj); | 2068 struct device *dev = kobj_to_dev(kobj); |
2069 struct it87_data *data = dev_get_drvdata(dev); 2070 int i = index / 7; /* temperature index */ 2071 int a = index % 7; /* attribute index */ 2072 2073 if (index >= 21) { 2074 i = index - 21 + 3; 2075 a = 0; 2076 } --- 44 unchanged lines hidden (view full) --- 2121static const struct attribute_group it87_group_temp = { 2122 .attrs = it87_attributes_temp, 2123 .is_visible = it87_temp_is_visible, 2124}; 2125 2126static umode_t it87_is_visible(struct kobject *kobj, 2127 struct attribute *attr, int index) 2128{ | 2069 struct it87_data *data = dev_get_drvdata(dev); 2070 int i = index / 7; /* temperature index */ 2071 int a = index % 7; /* attribute index */ 2072 2073 if (index >= 21) { 2074 i = index - 21 + 3; 2075 a = 0; 2076 } --- 44 unchanged lines hidden (view full) --- 2121static const struct attribute_group it87_group_temp = { 2122 .attrs = it87_attributes_temp, 2123 .is_visible = it87_temp_is_visible, 2124}; 2125 2126static umode_t it87_is_visible(struct kobject *kobj, 2127 struct attribute *attr, int index) 2128{ |
2129 struct device *dev = container_of(kobj, struct device, kobj); | 2129 struct device *dev = kobj_to_dev(kobj); |
2130 struct it87_data *data = dev_get_drvdata(dev); 2131 2132 if ((index == 2 || index == 3) && !data->has_vid) 2133 return 0; 2134 2135 if (index > 3 && !(data->in_internal & BIT(index - 4))) 2136 return 0; 2137 --- 15 unchanged lines hidden (view full) --- 2153static const struct attribute_group it87_group = { 2154 .attrs = it87_attributes, 2155 .is_visible = it87_is_visible, 2156}; 2157 2158static umode_t it87_fan_is_visible(struct kobject *kobj, 2159 struct attribute *attr, int index) 2160{ | 2130 struct it87_data *data = dev_get_drvdata(dev); 2131 2132 if ((index == 2 || index == 3) && !data->has_vid) 2133 return 0; 2134 2135 if (index > 3 && !(data->in_internal & BIT(index - 4))) 2136 return 0; 2137 --- 15 unchanged lines hidden (view full) --- 2153static const struct attribute_group it87_group = { 2154 .attrs = it87_attributes, 2155 .is_visible = it87_is_visible, 2156}; 2157 2158static umode_t it87_fan_is_visible(struct kobject *kobj, 2159 struct attribute *attr, int index) 2160{ |
2161 struct device *dev = container_of(kobj, struct device, kobj); | 2161 struct device *dev = kobj_to_dev(kobj); |
2162 struct it87_data *data = dev_get_drvdata(dev); 2163 int i = index / 5; /* fan index */ 2164 int a = index % 5; /* attribute index */ 2165 2166 if (index >= 15) { /* fan 4..6 don't have divisor attributes */ 2167 i = (index - 15) / 4 + 3; 2168 a = (index - 15) % 4; 2169 } --- 54 unchanged lines hidden (view full) --- 2224static const struct attribute_group it87_group_fan = { 2225 .attrs = it87_attributes_fan, 2226 .is_visible = it87_fan_is_visible, 2227}; 2228 2229static umode_t it87_pwm_is_visible(struct kobject *kobj, 2230 struct attribute *attr, int index) 2231{ | 2162 struct it87_data *data = dev_get_drvdata(dev); 2163 int i = index / 5; /* fan index */ 2164 int a = index % 5; /* attribute index */ 2165 2166 if (index >= 15) { /* fan 4..6 don't have divisor attributes */ 2167 i = (index - 15) / 4 + 3; 2168 a = (index - 15) % 4; 2169 } --- 54 unchanged lines hidden (view full) --- 2224static const struct attribute_group it87_group_fan = { 2225 .attrs = it87_attributes_fan, 2226 .is_visible = it87_fan_is_visible, 2227}; 2228 2229static umode_t it87_pwm_is_visible(struct kobject *kobj, 2230 struct attribute *attr, int index) 2231{ |
2232 struct device *dev = container_of(kobj, struct device, kobj); | 2232 struct device *dev = kobj_to_dev(kobj); |
2233 struct it87_data *data = dev_get_drvdata(dev); 2234 int i = index / 4; /* pwm index */ 2235 int a = index % 4; /* attribute index */ 2236 2237 if (!(data->has_pwm & BIT(i))) 2238 return 0; 2239 2240 /* pwmX_auto_channels_temp is only writable if auto pwm is supported */ --- 44 unchanged lines hidden (view full) --- 2285static const struct attribute_group it87_group_pwm = { 2286 .attrs = it87_attributes_pwm, 2287 .is_visible = it87_pwm_is_visible, 2288}; 2289 2290static umode_t it87_auto_pwm_is_visible(struct kobject *kobj, 2291 struct attribute *attr, int index) 2292{ | 2233 struct it87_data *data = dev_get_drvdata(dev); 2234 int i = index / 4; /* pwm index */ 2235 int a = index % 4; /* attribute index */ 2236 2237 if (!(data->has_pwm & BIT(i))) 2238 return 0; 2239 2240 /* pwmX_auto_channels_temp is only writable if auto pwm is supported */ --- 44 unchanged lines hidden (view full) --- 2285static const struct attribute_group it87_group_pwm = { 2286 .attrs = it87_attributes_pwm, 2287 .is_visible = it87_pwm_is_visible, 2288}; 2289 2290static umode_t it87_auto_pwm_is_visible(struct kobject *kobj, 2291 struct attribute *attr, int index) 2292{ |
2293 struct device *dev = container_of(kobj, struct device, kobj); | 2293 struct device *dev = kobj_to_dev(kobj); |
2294 struct it87_data *data = dev_get_drvdata(dev); 2295 int i = index / 11; /* pwm index */ 2296 int a = index % 11; /* attribute index */ 2297 2298 if (index >= 33) { /* pwm 4..6 */ 2299 i = (index - 33) / 6 + 3; 2300 a = (index - 33) % 6 + 4; 2301 } --- 1068 unchanged lines hidden --- | 2294 struct it87_data *data = dev_get_drvdata(dev); 2295 int i = index / 11; /* pwm index */ 2296 int a = index % 11; /* attribute index */ 2297 2298 if (index >= 33) { /* pwm 4..6 */ 2299 i = (index - 33) / 6 + 3; 2300 a = (index - 33) % 6 + 4; 2301 } --- 1068 unchanged lines hidden --- |