From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] Asus P5B Deluxe WiFi AP Sensors
Date: Wed, 06 Sep 2006 18:59:06 +0000 [thread overview]
Message-ID: <20060906205906.289e20a6.khali@linux-fr.org> (raw)
In-Reply-To: <20060822145643.GA5632@seahunt.dyndns.org>
Hi David,
> Here is a first shot at w83627dhg support. The datasheet files were
> very helpful, especially the file that showed just the differences
> between the EHF and DHG chips.
>
> @Jean: Could you give me some feedback on the attached patch? Thanks!
Here you go:
> diff -ur linux-2.6.18-rc4/drivers/hwmon/w83627ehf.c linux-2.6.18-rc4/drivers/hwmon/w83627ehf.c
> --- linux-2.6.18-rc4/drivers/hwmon/w83627ehf.c 2006-09-05 22:38:38.000000000 -0700
> +++ linux-2.6.18-rc4/drivers/hwmon/w83627ehf.c 2006-09-05 23:17:54.000000000 -0700
> @@ -34,6 +34,7 @@
>
> Chip #vin #fan #pwm #temp chip_id man_id
> w83627ehf 10 5 4 3 0x88,0xa1 0x5ca3
> + w83627dhg 9 5 4 3 0xa0,0xc1 0x5ca3
Where does the "0xa0" comes from? I only see 0xC1 in the datasheet.
> */
>
> #include <linux/module.h>
> @@ -115,9 +116,42 @@
>
> #define W83627EHF_REG_BANK 0x4E
> #define W83627EHF_REG_CONFIG 0x40
> -#define W83627EHF_REG_CHIP_ID 0x49
> +#define W83627EHF_REG_CHIP_ID 0x58
> #define W83627EHF_REG_MAN_ID 0x4F
Good catch.
>
> +/*
> + * Please remember when implementing more features that the following registers
> + * have different functions on the w83627ehf and w83627dhg. Registers may also
> + * have different power-on default values, but the BIOS has probably also set
> + * default values, so chip-specific differences are not important for that.
> + *
> + * ISA Register Explanation of difference
> + * ----------------- -------------------------
> + * 0x49 DHG only: selects temp used for SmartFan AUX fan, CPU fan0
> + * 0x4a not completely documented on EHF, and DHG docs assign
> + * different behavior to bits 7 and 6. Also EHF might only
> + * select temp input for SmartFan III, DHG selects temp input
> + * in any SmartFan mode. Further EHF testing is required.
> + * 0x50-0x55, bank 0 EHF docs say "Test Reg," DHG docs say "Reserved Reg"
> + * 0x50-0x57, bank 6 EHF docs say "Test Reg," DHG docs say "Reserved Reg"
"Test Reg" and "Reserved Reg" is really the same, not worth documenting.
> + * 0x58, bank 0 Chip ID, of course. EHF: 0xa1. DHG: 0xc1
> + * 0x5e, bank 0 DHG only: enable bits for current mode for thermal diodes
> + * and critical temperature protection feature
> + * 0x50, bank 4 EHF only: bit 3, vin4 over limit
> + * 0x5b, bank 4 EHF only: bit 3, vin4 under limit
> + * 0x52, bank 5 EHF only: vin4 from A/D
> + * 0x58, bank 5 EHF only: vin4 high limit
> + * 0x59, bank 5 EHF only: vin4 low limit
> + * 0x6b DHG only: SYS fan critical temperature limit
> + * 0x6c DHG only: CPU fan0 critical temperature limit
> + * 0x6d DHG only: AUX fan critical temperature limit
> + * 0x6e DHG only: CPU fan1 critical temperature limit
> + *
> + * The w83627dhg supports Intel PECI and SST interfaces for new CPU's (e.g.
> + * Intel Core). DHG queries PECI interface on CPU to read temps, and ICH8
> + * chipset can read DHG temp data and drive fans. SST is a 1-wire serial bus.
> + */
That's interesting documentation, but I'd move it to
Documentation/hwmon/w83627ehf. Also I think you can be more concise at
times, for example "DHG has no in9" summarizes 5 lines above. The
datasheet is there for the details, what we want in the documentation
is a summary of the differences that matter to us.
> +
> static const u16 W83627EHF_REG_FAN[] = { 0x28, 0x29, 0x2a, 0x3f, 0x553 };
> static const u16 W83627EHF_REG_FAN_MIN[] = { 0x3b, 0x3c, 0x3d, 0x3e, 0x55c };
>
> @@ -252,6 +286,7 @@
> u8 fan[5];
> u8 fan_min[5];
> u8 fan_div[5];
> + u8 num_in; /* 10 VIN for ehf, 9 VIN for dhg */
> u8 has_fan; /* some fan inputs can be disabled */
> s8 temp1;
> s8 temp1_max;
> @@ -425,7 +460,7 @@
> }
>
> /* Measured voltages and limits */
> - for (i = 0; i < 10; i++) {
> + for (i = 0; i < data->num_in; i++) {
> data->in[i] = w83627ehf_read_value(client,
> W83627EHF_REG_IN(i));
> data->in_min[i] = w83627ehf_read_value(client,
> @@ -1214,7 +1249,23 @@
> fan5pin = superio_inb(0x24) & 0x2;
> fan4pin = superio_inb(0x29) & 0x6;
> superio_exit();
> -
> +
> + /* Detect w83627ehf (10 VIN) and w83627dhg (9 VIN) */
> + i = w83627ehf_read_value(client, W83627EHF_REG_CHIP_ID);
> + if (i = 0xa1) { /* w83627ehf */
> + dev_dbg(dev, "detected W83627EHF/EHG (A1)\n");
> + data->num_in = 10;
> + }
> + else if (i = 0xc1) { /* w83627dhg */
> + dev_dbg(dev, "detected W83627DHG (C1)\n");
> + data->num_in = 9;
> + }
A1 and C1 are really only arbitrary hexadecimal numbers, I see little
benefit in exporting them to userspace.
> + else {
> + dev_err(dev, "unknown CHIP_ID (0x%02x)\n", i);
I'd make it a warning rather than an error. Nothing really bad happened.
> + err = -ENODEV;
> + goto exit_remove;
> + }
A switch/case might look better.
> +
> /* It looks like fan4 and fan5 pins can be alternatively used
> as fan on/off switches */
>
> @@ -1238,7 +1289,7 @@
> goto exit_remove;
> }
>
> - for (i = 0; i < 10; i++)
> + for (i = 0; i < data->num_in; i++)
> if ((err = device_create_file(dev, &sda_in_input[i].dev_attr))
> || (err = device_create_file(dev,
> &sda_in_alarm[i].dev_attr))
You don't use data->num for file removal... I agree it'll work
(removing a non-existing file isn't an error) but given that you have
the value available, using it looks both more logical and more
efficient.
Super-I/O detection of the W83627DHG is missing, so the patch won't
work, as I pointed out in a previous post already. Just add that and
your patch should work fine.
--
Jean Delvare
next prev parent reply other threads:[~2006-09-06 18:59 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-22 14:56 [lm-sensors] Asus P5B Deluxe WiFi AP Sensors Michael Nelson
2006-08-22 20:27 ` Rudolf Marek
2006-08-22 21:38 ` Michael Nelson
2006-08-23 1:09 ` Michael Nelson
2006-08-23 15:01 ` Jean Delvare
2006-08-23 16:25 ` Michael Nelson
2006-08-26 13:25 ` Michael Nelson
2006-08-26 21:21 ` Jean Delvare
2006-08-26 22:22 ` Michael Nelson
2006-09-01 13:12 ` Michael Nelson
2006-09-02 5:54 ` Jean Delvare
2006-09-02 6:24 ` David Hubbard
2006-09-02 11:04 ` Jean Delvare
2006-09-02 12:54 ` Michael Nelson
2006-09-02 16:04 ` David Hubbard
2006-09-05 9:10 ` Jean Delvare
2006-09-05 9:17 ` Yuan Mu
2006-09-05 15:05 ` David Hubbard
2006-09-05 15:09 ` Michael Nelson
2006-09-06 5:31 ` David Hubbard
2006-09-06 5:33 ` David Hubbard
2006-09-06 12:15 ` Michael Nelson
2006-09-06 13:43 ` Michael Nelson
2006-09-06 14:03 ` Jean Delvare
2006-09-06 14:07 ` Michael Nelson
2006-09-06 14:26 ` Michael Nelson
2006-09-06 14:40 ` Jean Delvare
2006-09-06 15:07 ` Michael Nelson
2006-09-06 15:28 ` Michael Nelson
2006-09-06 18:08 ` David Hubbard
2006-09-06 18:19 ` Michael Nelson
2006-09-06 18:38 ` Jean Delvare
2006-09-06 18:59 ` Jean Delvare [this message]
2006-09-06 21:42 ` David Hubbard
2006-09-06 23:02 ` Michael Walle
2006-09-07 1:37 ` Michael Nelson
2006-09-07 6:20 ` David Hubbard
2006-09-07 7:46 ` Jean Delvare
2006-09-07 7:59 ` Jean Delvare
2006-09-07 13:23 ` Michael Nelson
2006-09-07 19:34 ` Rudolf Marek
2006-09-07 21:12 ` Michael Walle
2006-09-08 1:12 ` Michael Nelson
2006-09-08 1:43 ` Michael Nelson
2006-09-10 17:52 ` Jean Delvare
2006-09-10 19:46 ` Michael Nelson
2006-09-10 20:13 ` Michael Nelson
2006-09-20 16:16 ` Jean Delvare
2006-09-21 18:22 ` David Hubbard
2006-09-22 13:51 ` Michael Nelson
2006-12-10 23:30 ` David Hubbard
2006-12-11 4:09 ` David Hubbard
2006-12-11 17:41 ` David Holl
2006-12-11 18:59 ` David Hubbard
2006-12-11 22:10 ` David Holl
2006-12-11 22:16 ` David Hubbard
2006-12-15 3:34 ` David Hubbard
2006-12-15 5:05 ` David Holl
2006-12-15 5:14 ` Con Kolivas
2006-12-15 5:48 ` David Hubbard
2006-12-16 5:48 ` David Holl
2006-12-17 9:50 ` Jean Delvare
2006-12-17 9:55 ` Jean Delvare
2006-12-17 9:59 ` Jean Delvare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060906205906.289e20a6.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.