aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83795.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-10-28 14:31:48 -0400
committerJean Delvare <khali@endymion.delvare>2010-10-28 14:31:48 -0400
commit5f7b77cbd4599b6a90d18981d9883a3e20e689fb (patch)
treea0ff470ba43eb83aaad460a227bbb3635a275caf /drivers/hwmon/w83795.c
parent39deb6993e7c22274c272c95013eef886f7004e8 (diff)
hwmon: (w83795) Don't pre-read values we'll update later
There is no point in reading registers during initialization if we will refresh the values in the update function later. This is only slowing down the driver loading with no benefit, stop doing it. This change saves 480 ms on driver load on my test system. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r--drivers/hwmon/w83795.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index 07e8de58dcd4..a1d884bb58ad 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -1903,7 +1903,7 @@ static int w83795_probe(struct i2c_client *client,
1903 } 1903 }
1904 } 1904 }
1905 1905
1906 /* First update the voltages measured value and limits */ 1906 /* Read the voltage limits */
1907 for (i = 0; i < ARRAY_SIZE(data->in); i++) { 1907 for (i = 0; i < ARRAY_SIZE(data->in); i++) {
1908 if (!(data->has_in & (1 << i))) 1908 if (!(data->has_in & (1 << i)))
1909 continue; 1909 continue;
@@ -1911,9 +1911,6 @@ static int w83795_probe(struct i2c_client *client,
1911 w83795_read(client, W83795_REG_IN[i][IN_MAX]); 1911 w83795_read(client, W83795_REG_IN[i][IN_MAX]);
1912 data->in[i][IN_LOW] = 1912 data->in[i][IN_LOW] =
1913 w83795_read(client, W83795_REG_IN[i][IN_LOW]); 1913 w83795_read(client, W83795_REG_IN[i][IN_LOW]);
1914 tmp = w83795_read(client, W83795_REG_IN[i][IN_READ]) << 2;
1915 tmp |= w83795_read(client, W83795_REG_VRLSB) >> 6;
1916 data->in[i][IN_READ] = tmp;
1917 } 1914 }
1918 for (i = 0; i < ARRAY_SIZE(data->in_lsb); i++) { 1915 for (i = 0; i < ARRAY_SIZE(data->in_lsb); i++) {
1919 if ((i == 2 && data->chip_type == w83795adg) || 1916 if ((i == 2 && data->chip_type == w83795adg) ||
@@ -1926,7 +1923,7 @@ static int w83795_probe(struct i2c_client *client,
1926 } 1923 }
1927 data->has_gain = w83795_read(client, W83795_REG_VMIGB_CTRL) & 0x0f; 1924 data->has_gain = w83795_read(client, W83795_REG_VMIGB_CTRL) & 0x0f;
1928 1925
1929 /* First update fan and limits */ 1926 /* Read the fan limits */
1930 for (i = 0; i < ARRAY_SIZE(data->fan); i++) { 1927 for (i = 0; i < ARRAY_SIZE(data->fan); i++) {
1931 /* Each register contains LSB for 2 fans, but we want to 1928 /* Each register contains LSB for 2 fans, but we want to
1932 * read it only once to save time */ 1929 * read it only once to save time */
@@ -1939,11 +1936,9 @@ static int w83795_probe(struct i2c_client *client,
1939 w83795_read(client, W83795_REG_FAN_MIN_HL(i)) << 4; 1936 w83795_read(client, W83795_REG_FAN_MIN_HL(i)) << 4;
1940 data->fan_min[i] |= 1937 data->fan_min[i] |=
1941 (tmp >> W83795_REG_FAN_MIN_LSB_SHIFT(i)) & 0x0F; 1938 (tmp >> W83795_REG_FAN_MIN_LSB_SHIFT(i)) & 0x0F;
1942 data->fan[i] = w83795_read(client, W83795_REG_FAN(i)) << 4;
1943 data->fan[i] |= w83795_read(client, W83795_REG_VRLSB) >> 4;
1944 } 1939 }
1945 1940
1946 /* temperature and limits */ 1941 /* Read the temperature limits */
1947 for (i = 0; i < ARRAY_SIZE(data->temp); i++) { 1942 for (i = 0; i < ARRAY_SIZE(data->temp); i++) {
1948 if (!(data->has_temp & (1 << i))) 1943 if (!(data->has_temp & (1 << i)))
1949 continue; 1944 continue;
@@ -1955,13 +1950,9 @@ static int w83795_probe(struct i2c_client *client,
1955 w83795_read(client, W83795_REG_TEMP[i][TEMP_WARN]); 1950 w83795_read(client, W83795_REG_TEMP[i][TEMP_WARN]);
1956 data->temp[i][TEMP_WARN_HYST] = 1951 data->temp[i][TEMP_WARN_HYST] =
1957 w83795_read(client, W83795_REG_TEMP[i][TEMP_WARN_HYST]); 1952 w83795_read(client, W83795_REG_TEMP[i][TEMP_WARN_HYST]);
1958 data->temp[i][TEMP_READ] =
1959 w83795_read(client, W83795_REG_TEMP[i][TEMP_READ]);
1960 data->temp_read_vrlsb[i] =
1961 w83795_read(client, W83795_REG_VRLSB);
1962 } 1953 }
1963 1954
1964 /* dts temperature and limits */ 1955 /* Read the DTS limits */
1965 if (data->enable_dts != 0) { 1956 if (data->enable_dts != 0) {
1966 data->dts_ext[DTS_CRIT] = 1957 data->dts_ext[DTS_CRIT] =
1967 w83795_read(client, W83795_REG_DTS_EXT(DTS_CRIT)); 1958 w83795_read(client, W83795_REG_DTS_EXT(DTS_CRIT));
@@ -1971,13 +1962,6 @@ static int w83795_probe(struct i2c_client *client,
1971 w83795_read(client, W83795_REG_DTS_EXT(DTS_WARN)); 1962 w83795_read(client, W83795_REG_DTS_EXT(DTS_WARN));
1972 data->dts_ext[DTS_WARN_HYST] = 1963 data->dts_ext[DTS_WARN_HYST] =
1973 w83795_read(client, W83795_REG_DTS_EXT(DTS_WARN_HYST)); 1964 w83795_read(client, W83795_REG_DTS_EXT(DTS_WARN_HYST));
1974 for (i = 0; i < ARRAY_SIZE(data->dts); i++) {
1975 if (!(data->has_dts & (1 << i)))
1976 continue;
1977 data->dts[i] = w83795_read(client, W83795_REG_DTS(i));
1978 data->dts_read_vrlsb[i] =
1979 w83795_read(client, W83795_REG_VRLSB);
1980 }
1981 } 1965 }
1982 1966
1983 /* First update temp source selction */ 1967 /* First update temp source selction */
@@ -1995,10 +1979,9 @@ static int w83795_probe(struct i2c_client *client,
1995 data->pwm_tfmr[i] = w83795_read(client, W83795_REG_TFMR(i)); 1979 data->pwm_tfmr[i] = w83795_read(client, W83795_REG_TFMR(i));
1996 data->pwm_fomc = w83795_read(client, W83795_REG_FOMC); 1980 data->pwm_fomc = w83795_read(client, W83795_REG_FOMC);
1997 for (i = 0; i < data->has_pwm; i++) { 1981 for (i = 0; i < data->has_pwm; i++) {
1998 for (tmp = 0; tmp < 5; tmp++) { 1982 for (tmp = PWM_START; tmp <= PWM_FREQ; tmp++)
1999 data->pwm[i][tmp] = 1983 data->pwm[i][tmp] =
2000 w83795_read(client, W83795_REG_PWM(i, tmp)); 1984 w83795_read(client, W83795_REG_PWM(i, tmp));
2001 }
2002 } 1985 }
2003 for (i = 0; i < 8; i++) { 1986 for (i = 0; i < 8; i++) {
2004 data->target_speed[i] = 1987 data->target_speed[i] =
@@ -2033,11 +2016,9 @@ static int w83795_probe(struct i2c_client *client,
2033 w83795_read(client, W83795_REG_SETUP_PWM(i)); 2016 w83795_read(client, W83795_REG_SETUP_PWM(i));
2034 } 2017 }
2035 2018
2036 /* alarm and beep */ 2019 /* Read beep settings */
2037 for (i = 0; i < ARRAY_SIZE(data->alarms); i++) { 2020 for (i = 0; i < ARRAY_SIZE(data->beeps); i++)
2038 data->alarms[i] = w83795_read(client, W83795_REG_ALARM(i));
2039 data->beeps[i] = w83795_read(client, W83795_REG_BEEP(i)); 2021 data->beeps[i] = w83795_read(client, W83795_REG_BEEP(i));
2040 }
2041 2022
2042 err = w83795_handle_files(dev, device_create_file); 2023 err = w83795_handle_files(dev, device_create_file);
2043 if (err) 2024 if (err)