mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-27 20:48:22 +00:00
add multiple VRM support to adm1025
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1383 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
446b758ca1
commit
e0a1889044
6 files changed
+59
-14
No files matched your search
+26
-5
@@ -34,6 +34,7 @@
|
||||
#include <linux/i2c.h>
|
||||
#include "version.h"
|
||||
#include "sensors.h"
|
||||
#include "sensors_vid.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
@@ -116,9 +117,6 @@ SENSORS_INSMOD_1(adm1025);
|
||||
|
||||
#define ALARMS_FROM_REG(val) (val)
|
||||
|
||||
#define VID_FROM_REG(val) ((val)==0x1f?0:(val)>=0x10?510-(val)*10:\
|
||||
205-(val)*5)
|
||||
|
||||
/* Initial limits */
|
||||
#define ADM1025_INIT_IN_0 190
|
||||
#define ADM1025_INIT_IN_1 190
|
||||
@@ -188,6 +186,7 @@ struct adm1025_data {
|
||||
u16 alarms; /* Register encoding, combined */
|
||||
u8 analog_out; /* Register value */
|
||||
u8 vid; /* Register value combined */
|
||||
u8 vrm;
|
||||
};
|
||||
|
||||
|
||||
@@ -228,6 +227,8 @@ static void adm1025_alarms(struct i2c_client *client, int operation,
|
||||
long *results);*/
|
||||
static void adm1025_vid(struct i2c_client *client, int operation,
|
||||
int ctl_name, int *nrels_mag, long *results);
|
||||
static void adm1025_vrm(struct i2c_client *client, int operation,
|
||||
int ctl_name, int *nrels_mag, long *results);
|
||||
|
||||
/* I choose here for semi-static ADM1025 allocation. Complete dynamic
|
||||
allocation could also be used; the code needed for this would probably
|
||||
@@ -277,6 +278,8 @@ static ctl_table adm1025_dir_table_template[] = {
|
||||
&i2c_sysctl_real, NULL, &adm1025_analog_out},*/
|
||||
{ADM1025_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real,
|
||||
&i2c_sysctl_real, NULL, &adm1025_vid},
|
||||
{ADM1025_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real,
|
||||
&i2c_sysctl_real, NULL, &adm1025_vrm},
|
||||
{0}
|
||||
};
|
||||
|
||||
@@ -449,6 +452,9 @@ int adm1025_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
/* Called when we have found a new ADM1025. It should set limits, etc. */
|
||||
void adm1025_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct adm1025_data *data = client->data;
|
||||
|
||||
data->vrm = DEFAULT_VRM;
|
||||
/* Reset all except Watchdog values and last conversion values
|
||||
This sets fan-divs to 2, among others. This makes most other
|
||||
initializations unnecessary */
|
||||
@@ -694,14 +700,29 @@ void adm1025_vid(struct i2c_client *client, int operation, int ctl_name,
|
||||
struct adm1025_data *data = client->data;
|
||||
|
||||
if (operation == SENSORS_PROC_REAL_INFO)
|
||||
*nrels_mag = 2;
|
||||
*nrels_mag = 3;
|
||||
else if (operation == SENSORS_PROC_REAL_READ) {
|
||||
adm1025_update_client(client);
|
||||
results[0] = VID_FROM_REG(data->vid);
|
||||
results[0] = vid_from_reg(data->vid, data->vrm);
|
||||
*nrels_mag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void adm1025_vrm(struct i2c_client *client, int operation, int ctl_name,
|
||||
int *nrels_mag, long *results)
|
||||
{
|
||||
struct adm1025_data *data = client->data;
|
||||
if (operation == SENSORS_PROC_REAL_INFO)
|
||||
*nrels_mag = 1;
|
||||
else if (operation == SENSORS_PROC_REAL_READ) {
|
||||
results[0] = data->vrm;
|
||||
*nrels_mag = 1;
|
||||
} else if (operation == SENSORS_PROC_REAL_WRITE) {
|
||||
if (*nrels_mag >= 1)
|
||||
data->vrm = results[0];
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_adm1025_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
@@ -258,6 +258,7 @@
|
||||
#define ADM1025_SYSCTL_ALARMS 2001 /* bitvector */
|
||||
#define ADM1025_SYSCTL_ANALOG_OUT 2002
|
||||
#define ADM1025_SYSCTL_VID 2003
|
||||
#define ADM1025_SYSCTL_VRM 2004
|
||||
|
||||
#define ADM1025_ALARM_IN0 0x0001
|
||||
#define ADM1025_ALARM_IN1 0x0002
|
||||
|
||||
Reference in new issue
Block a user