mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-30 13:00:30 +00:00
(Phil) Beginning of Voodoo3 I2C bus and BT869 driver are working!
Voodoo3 I2C notes (or short commings): * only one type of read supported: type 'byte' (no 'command') * only one type of write supported: type 'byte_data' (The two above are more the limitation of the BT869 rather than the I2C bus.) * I used the SMBus 'model' rather than the 'bit' model because I thought it was easier this way. * failed bus transactions yeild 0xFF, not an error! So, this means that many drivers instantly latch onto this adapter because all reads and writes succeed without error. Without the datasheet for the chip, I can't do much to fix this. (Amazing I got this far!) BT869/868 notes: * the BT869 has lots and lots of registers (~50), but can only read 3 (fairly uninteresting) status registers(!). Right now all three status registers are read through the 'status' file, but I haven't decided on the best method for writing to the rest of the registers. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@448 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
6a83949e74
commit
3855d1aeea
2 files changed
+10
-8
No files matched your search
@@ -260,7 +260,7 @@ static int voodoo3_setup(void)
|
||||
s32 voodoo3_access(u8 addr, char read_write,
|
||||
u8 command, int size, union smbus_data * data)
|
||||
{
|
||||
if (size == SMBUS_BYTE_DATA) {
|
||||
if ((size == SMBUS_BYTE_DATA) || (size == SMBUS_BYTE)) {
|
||||
addr=((addr & 0x7f) << 1) | (read_write & 0x01);
|
||||
if (read_write == SMBUS_READ) {
|
||||
data->byte=Voodoo3_I2CRead(addr,command);
|
||||
|
||||
@@ -165,9 +165,11 @@ printk("bt869.o: probing address %d .\n",address);
|
||||
new_client->driver = &bt869_driver;
|
||||
|
||||
/* Now, we do the remaining detection. It is lousy. */
|
||||
cur = smbus_read_word_data(adapter,address,0);
|
||||
printk("bt869.o: testing-->%d\n",cur);
|
||||
if ((cur | 0x20) != 0x21)
|
||||
smbus_write_byte_data(new_client->adapter,
|
||||
new_client->addr,0xC4,0); /* set status bank 0 */
|
||||
cur = smbus_read_byte_data(adapter,address,0);
|
||||
printk("bt869.o: address 0x%X testing-->0x%X\n",address,cur);
|
||||
if ((cur | 0x27) != 0x27)
|
||||
goto ERROR1;
|
||||
|
||||
/* Determine the chip type */
|
||||
@@ -285,15 +287,15 @@ u16 swap_bytes(u16 val)
|
||||
return (val >> 8) | (val << 8);
|
||||
}
|
||||
|
||||
/* All registers are word-sized, except for the configuration register.
|
||||
/* All registers are byte-sized.
|
||||
bt869 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int bt869_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return smbus_read_byte_data(client->adapter,client->addr,reg);
|
||||
return smbus_read_byte(client->adapter,client->addr);
|
||||
}
|
||||
|
||||
/* All registers are word-sized, except for the configuration register.
|
||||
/* All registers are byte-sized.
|
||||
bt869 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int bt869_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
@@ -342,7 +344,7 @@ void bt869_status(struct i2c_client *client, int operation, int ctl_name,
|
||||
{
|
||||
struct bt869_data *data = client->data;
|
||||
if (operation == SENSORS_PROC_REAL_INFO)
|
||||
*nrels_mag = 1;
|
||||
*nrels_mag = 0;
|
||||
else if (operation == SENSORS_PROC_REAL_READ) {
|
||||
bt869_update_client(client);
|
||||
results[0] = data->status[0];
|
||||
|
||||
Reference in new issue
Block a user