* [BK PATCH] I2C fixes for 2.6.10-rc1
@ 2005-05-19 6:25 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2004-11-12 23:26 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-kernel, sensors
Hi,
Here are a few small i2c bugfixes for 2.6.10-rc1
Please pull from: bk://kernel.bkbits.net/gregkh/linux/i2c-2.6
Individual patches will follow, sent to the sensors and linux-kernel
lists.
That's it, bug fixes only from me for now till 2.6.10 is out :)
thanks,
greg k-h
Documentation/i2c/dev-interface | 4 +--
drivers/i2c/chips/rtc8564.c | 3 ++
drivers/i2c/i2c-core.c | 19 +++++++++++++++++-
drivers/i2c/i2c-dev.c | 2 -
drivers/i2c/i2c-sensor-detect.c | 2 -
include/linux/i2c.h | 16 +++------------
sound/ppc/daca.c | 24 ++++++++++++-----------
sound/ppc/pmac.h | 2 -
sound/ppc/tumbler.c | 41 ++++++++++++++++++++++------------------
9 files changed, 65 insertions(+), 48 deletions(-)
-----
Gabriel Paubert:
o I2C: Recent I2C "dead code removal" breaks pmac sound
Greg Kroah-Hartman:
o I2C: fix up rtc8564 which should not have been changed in my previous cleanups
o I2C: fix up some out of date Documentation
Jean Delvare:
o I2C: Missing newlines in debug messages
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] I2C fixes for 2.6.10-rc1
2005-05-19 6:25 ` Greg KH
@ 2005-05-19 6:25 ` Greg KH
-1 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2004-11-12 23:26 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.2095, 2004/11/12 13:20:15-08:00, khali@linux-fr.org
[PATCH] I2C: Missing newlines in debug messages
As discussed on IRC, this simple patch fixes broken debug messages
missing their trailing newlines. I just applied something similar to
CVS, and will prepare patches for 2.4 as well.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/i2c/i2c-core.c | 2 +-
drivers/i2c/i2c-dev.c | 2 +-
drivers/i2c/i2c-sensor-detect.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c 2004-11-12 15:22:38 -08:00
+++ b/drivers/i2c/i2c-core.c 2004-11-12 15:22:38 -08:00
@@ -760,7 +760,7 @@
if (addr == address_data->normal_i2c[i]) {
found = 1;
dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, "
- "addr %02x", adap_id,addr);
+ "addr %02x\n", adap_id, addr);
}
}
diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c 2004-11-12 15:22:38 -08:00
+++ b/drivers/i2c/i2c-dev.c 2004-11-12 15:22:38 -08:00
@@ -539,7 +539,7 @@
out_unreg_chrdev:
unregister_chrdev(I2C_MAJOR, "i2c");
out:
- printk(KERN_ERR "%s: Driver Initialisation failed", __FILE__);
+ printk(KERN_ERR "%s: Driver Initialisation failed\n", __FILE__);
return res;
}
diff -Nru a/drivers/i2c/i2c-sensor-detect.c b/drivers/i2c/i2c-sensor-detect.c
--- a/drivers/i2c/i2c-sensor-detect.c 2004-11-12 15:22:38 -08:00
+++ b/drivers/i2c/i2c-sensor-detect.c 2004-11-12 15:22:38 -08:00
@@ -115,7 +115,7 @@
for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) {
if (addr == normal_i2c[i]) {
found = 1;
- dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x", adapter_id, addr);
+ dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr);
}
}
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] I2C fixes for 2.6.10-rc1
2005-05-19 6:25 ` Greg KH
@ 2005-05-19 6:25 ` Greg KH
-1 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2004-11-12 23:26 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.2096, 2004/11/12 13:21:22-08:00, paubert@iram.es
[PATCH] I2C: Recent I2C "dead code removal" breaks pmac sound.
> Put the function back, and change the pmac.h file to delete the #define,
> and replace the snd_pmac_keywest_write function with a real call to
> i2c_smbus_write_block_data so things like this don't happen again.
>
> Care to write a patch to do this?
It follows, along with an update of the include/linux/i2c.h to only
declare functions that actually exist, but grepping the whole sound
subtree shows that at least sound/oss/dmasound/tas_common.h defines
a few inline functions that call i2c_smbus_write_{byte,block}_data.
[I2C part]
Ressuscitate i2c_smbus_write_block_data since it's actually
used. Update include/linux/i2c.h to reflect the existing
functions.
[Sound part]
Remove snd_pmac_keywest_write* wrapper macros and directly
call the i2c_smbus_* functions instead.
Signed-off-by: Gabriel Paubert <paubert@iram.es>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
===== include/linux/i2c.h 1.41 vs edited =====
drivers/i2c/i2c-core.c | 17 +++++++++++++++++
include/linux/i2c.h | 16 ++++------------
sound/ppc/daca.c | 24 +++++++++++++-----------
sound/ppc/pmac.h | 2 --
sound/ppc/tumbler.c | 41 +++++++++++++++++++++++------------------
5 files changed, 57 insertions(+), 43 deletions(-)
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c 2004-11-12 15:22:30 -08:00
+++ b/drivers/i2c/i2c-core.c 2004-11-12 15:22:30 -08:00
@@ -1021,6 +1021,22 @@
I2C_SMBUS_WORD_DATA,&data);
}
+/* Returns the number of bytes transferred */
+s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command,
+ u8 length, u8 *values)
+{
+ union i2c_smbus_data data;
+ int i;
+ if (length > I2C_SMBUS_BLOCK_MAX)
+ length = I2C_SMBUS_BLOCK_MAX;
+ for (i = 1; i <= length; i++)
+ data.block[i] = values[i-1];
+ data.block[0] = length;
+ return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
+ I2C_SMBUS_WRITE,command,
+ I2C_SMBUS_BLOCK_DATA,&data);
+}
+
/* Returns the number of read bytes */
s32 i2c_smbus_block_process_call(struct i2c_client *client, u8 command, u8 length, u8 *values)
{
@@ -1279,6 +1295,7 @@
EXPORT_SYMBOL(i2c_smbus_write_byte_data);
EXPORT_SYMBOL(i2c_smbus_read_word_data);
EXPORT_SYMBOL(i2c_smbus_write_word_data);
+EXPORT_SYMBOL(i2c_smbus_write_block_data);
EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data);
EXPORT_SYMBOL(i2c_get_functionality);
diff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h 2004-11-12 15:22:30 -08:00
+++ b/include/linux/i2c.h 2004-11-12 15:22:30 -08:00
@@ -88,20 +88,12 @@
extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
u8 command, u16 value);
-extern s32 i2c_smbus_process_call(struct i2c_client * client,
- u8 command, u16 value);
-/* Returns the number of read bytes */
-extern s32 i2c_smbus_read_block_data(struct i2c_client * client,
- u8 command, u8 *values);
+/* Returns the number of bytes transferred */
extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
- u8 command, u8 length,
- u8 *values);
+ u8 command, u8 length,
+ u8 *values);
extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
- u8 command, u8 *values);
-extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
- u8 command, u8 length,
- u8 *values);
-
+ u8 command, u8 *values);
/*
* A driver is capable of handling one or more physical devices present on
diff -Nru a/sound/ppc/daca.c b/sound/ppc/daca.c
--- a/sound/ppc/daca.c 2004-11-12 15:22:30 -08:00
+++ b/sound/ppc/daca.c 2004-11-12 15:22:30 -08:00
@@ -56,10 +56,11 @@
unsigned short wdata = 0x00;
/* SR: no swap, 1bit delay, 32-48kHz */
/* GCFG: power amp inverted, DAC on */
- if (snd_pmac_keywest_write_byte(i2c, DACA_REG_SR, 0x08) < 0 ||
- snd_pmac_keywest_write_byte(i2c, DACA_REG_GCFG, 0x05) < 0)
+ if (i2c_smbus_write_byte_data(i2c->client, DACA_REG_SR, 0x08) < 0 ||
+ i2c_smbus_write_byte_data(i2c->client, DACA_REG_GCFG, 0x05) < 0)
return -EINVAL;
- return snd_pmac_keywest_write(i2c, DACA_REG_AVOL, 2, (unsigned char*)&wdata);
+ return i2c_smbus_write_block_data(i2c->client, DACA_REG_AVOL,
+ 2, (unsigned char*)&wdata);
}
/*
@@ -81,9 +82,10 @@
else
data[1] = mix->right_vol;
data[1] |= mix->deemphasis ? 0x40 : 0;
- if (snd_pmac_keywest_write(&mix->i2c, DACA_REG_AVOL, 2, data) < 0) {
- snd_printk("failed to set volume \n");
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, DACA_REG_AVOL,
+ 2, data) < 0) {
+ snd_printk("failed to set volume \n");
+ return -EINVAL;
}
return 0;
}
@@ -188,8 +190,8 @@
change = mix->amp_on != ucontrol->value.integer.value[0];
if (change) {
mix->amp_on = ucontrol->value.integer.value[0];
- snd_pmac_keywest_write_byte(&mix->i2c, DACA_REG_GCFG,
- mix->amp_on ? 0x05 : 0x04);
+ i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG,
+ mix->amp_on ? 0x05 : 0x04);
}
return change;
}
@@ -220,9 +222,9 @@
static void daca_resume(pmac_t *chip)
{
pmac_daca_t *mix = chip->mixer_data;
- snd_pmac_keywest_write_byte(&mix->i2c, DACA_REG_SR, 0x08);
- snd_pmac_keywest_write_byte(&mix->i2c, DACA_REG_GCFG,
- mix->amp_on ? 0x05 : 0x04);
+ i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_SR, 0x08);
+ i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG,
+ mix->amp_on ? 0x05 : 0x04);
daca_set_volume(mix);
}
#endif /* CONFIG_PMAC_PBOOK */
diff -Nru a/sound/ppc/pmac.h b/sound/ppc/pmac.h
--- a/sound/ppc/pmac.h 2004-11-12 15:22:30 -08:00
+++ b/sound/ppc/pmac.h 2004-11-12 15:22:30 -08:00
@@ -199,8 +199,6 @@
int snd_pmac_keywest_init(pmac_keywest_t *i2c);
void snd_pmac_keywest_cleanup(pmac_keywest_t *i2c);
-#define snd_pmac_keywest_write(i2c,cmd,len,data) i2c_smbus_write_block_data((i2c)->client, cmd, len, data)
-#define snd_pmac_keywest_write_byte(i2c,cmd,data) i2c_smbus_write_byte_data((i2c)->client, cmd, data)
/* misc */
int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo);
diff -Nru a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
--- a/sound/ppc/tumbler.c 2004-11-12 15:22:30 -08:00
+++ b/sound/ppc/tumbler.c 2004-11-12 15:22:30 -08:00
@@ -109,7 +109,8 @@
while (*regs > 0) {
int err, count = 10;
do {
- err = snd_pmac_keywest_write_byte(i2c, regs[0], regs[1]);
+ err = i2c_smbus_write_byte_data(i2c->client,
+ regs[0], regs[1]);
if (err >= 0)
break;
mdelay(10);
@@ -220,9 +221,10 @@
block[4] = (right_vol >> 8) & 0xff;
block[5] = (right_vol >> 0) & 0xff;
- if (snd_pmac_keywest_write(&mix->i2c, TAS_REG_VOL, 6, block) < 0) {
- snd_printk("failed to set volume \n");
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_VOL,
+ 6, block) < 0) {
+ snd_printk("failed to set volume \n");
+ return -EINVAL;
}
return 0;
}
@@ -320,9 +322,10 @@
val[1] = 0;
}
- if (snd_pmac_keywest_write(&mix->i2c, TAS_REG_DRC, 2, val) < 0) {
- snd_printk("failed to set DRC\n");
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC,
+ 2, val) < 0) {
+ snd_printk("failed to set DRC\n");
+ return -EINVAL;
}
return 0;
}
@@ -355,9 +358,10 @@
val[4] = 0x60;
val[5] = 0xa0;
- if (snd_pmac_keywest_write(&mix->i2c, TAS_REG_DRC, 6, val) < 0) {
- snd_printk("failed to set DRC\n");
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC,
+ 6, val) < 0) {
+ snd_printk("failed to set DRC\n");
+ return -EINVAL;
}
return 0;
}
@@ -459,9 +463,10 @@
vol = info->table[vol];
for (i = 0; i < info->bytes; i++)
block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff;
- if (snd_pmac_keywest_write(&mix->i2c, info->reg, info->bytes, block) < 0) {
- snd_printk("failed to set mono volume %d\n", info->index);
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, info->reg,
+ info->bytes, block) < 0) {
+ snd_printk("failed to set mono volume %d\n", info->index);
+ return -EINVAL;
}
return 0;
}
@@ -588,9 +593,9 @@
for (j = 0; j < 3; j++)
block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff;
}
- if (snd_pmac_keywest_write(&mix->i2c, reg, 9, block) < 0) {
- snd_printk("failed to set mono volume %d\n", reg);
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, reg, 9, block) < 0) {
+ snd_printk("failed to set mono volume %d\n", reg);
+ return -EINVAL;
}
return 0;
}
@@ -689,8 +694,8 @@
{
if (! mix->i2c.client)
return -ENODEV;
- return snd_pmac_keywest_write_byte(&mix->i2c, TAS_REG_ACS,
- mix->capture_source ? 2 : 0);
+ return i2c_smbus_write_byte_data(mix->i2c.client, TAS_REG_ACS,
+ mix->capture_source ? 2 : 0);
}
static int snapper_info_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] I2C fixes for 2.6.10-rc1
2005-05-19 6:25 ` Greg KH
@ 2005-05-19 6:25 ` Greg KH
-1 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2004-11-12 23:26 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.2093, 2004/11/12 11:39:51-08:00, greg@kroah.com
I2C: fix up some out of date Documentation
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Documentation/i2c/dev-interface | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff -Nru a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface
--- a/Documentation/i2c/dev-interface 2004-11-12 15:22:53 -08:00
+++ b/Documentation/i2c/dev-interface 2004-11-12 15:22:53 -08:00
@@ -3,7 +3,7 @@
the /dev interface. You need to load module i2c-dev for this.
Each registered i2c adapter gets a number, counting from 0. You can
-examine /proc/bus/i2c to see what number corresponds to which adapter.
+examine /sys/class/i2c-dev/ to see what number corresponds to which adapter.
I2C device files are character device files with major device number 89
and a minor device number corresponding to the number assigned as
explained above. They should be called "i2c-%d" (i2c-0, i2c-1, ...,
@@ -19,7 +19,7 @@
knows about i2c, there is not much choice.
Now, you have to decide which adapter you want to access. You should
-inspect /proc/bus/i2c to decide this. Adapter numbers are assigned
+inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned
somewhat dynamically, so you can not even assume /dev/i2c-0 is the
first adapter.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] I2C fixes for 2.6.10-rc1
2005-05-19 6:25 ` Greg KH
@ 2005-05-19 6:25 ` Greg KH
-1 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2004-11-12 23:26 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.2094, 2004/11/12 11:40:22-08:00, greg@kroah.com
I2C: fix up rtc8564 which should not have been changed in my previous cleanups.
This fixes a reported oops.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/i2c/chips/rtc8564.c | 3 +++
1 files changed, 3 insertions(+)
diff -Nru a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c
--- a/drivers/i2c/chips/rtc8564.c 2004-11-12 15:22:45 -08:00
+++ b/drivers/i2c/chips/rtc8564.c 2004-11-12 15:22:45 -08:00
@@ -66,8 +66,11 @@
static struct i2c_client_address_data addr_data = {
.normal_i2c = normal_addr,
+ .normal_i2c_range = ignore,
.probe = ignore,
+ .probe_range = ignore,
.ignore = ignore,
+ .ignore_range = ignore,
.force = ignore,
};
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] I2C fixes for 2.6.10-rc1
@ 2005-05-19 6:25 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2005-05-19 6:25 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.2094, 2004/11/12 11:40:22-08:00, greg@kroah.com
I2C: fix up rtc8564 which should not have been changed in my previous cleanups.
This fixes a reported oops.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/i2c/chips/rtc8564.c | 3 +++
1 files changed, 3 insertions(+)
diff -Nru a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c
--- a/drivers/i2c/chips/rtc8564.c 2004-11-12 15:22:45 -08:00
+++ b/drivers/i2c/chips/rtc8564.c 2004-11-12 15:22:45 -08:00
@@ -66,8 +66,11 @@
static struct i2c_client_address_data addr_data = {
.normal_i2c = normal_addr,
+ .normal_i2c_range = ignore,
.probe = ignore,
+ .probe_range = ignore,
.ignore = ignore,
+ .ignore_range = ignore,
.force = ignore,
};
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] I2C fixes for 2.6.10-rc1
@ 2005-05-19 6:25 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2005-05-19 6:25 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.2093, 2004/11/12 11:39:51-08:00, greg@kroah.com
I2C: fix up some out of date Documentation
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Documentation/i2c/dev-interface | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff -Nru a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface
--- a/Documentation/i2c/dev-interface 2004-11-12 15:22:53 -08:00
+++ b/Documentation/i2c/dev-interface 2004-11-12 15:22:53 -08:00
@@ -3,7 +3,7 @@
the /dev interface. You need to load module i2c-dev for this.
Each registered i2c adapter gets a number, counting from 0. You can
-examine /proc/bus/i2c to see what number corresponds to which adapter.
+examine /sys/class/i2c-dev/ to see what number corresponds to which adapter.
I2C device files are character device files with major device number 89
and a minor device number corresponding to the number assigned as
explained above. They should be called "i2c-%d" (i2c-0, i2c-1, ...,
@@ -19,7 +19,7 @@
knows about i2c, there is not much choice.
Now, you have to decide which adapter you want to access. You should
-inspect /proc/bus/i2c to decide this. Adapter numbers are assigned
+inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned
somewhat dynamically, so you can not even assume /dev/i2c-0 is the
first adapter.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] I2C fixes for 2.6.10-rc1
@ 2005-05-19 6:25 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2005-05-19 6:25 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.2095, 2004/11/12 13:20:15-08:00, khali@linux-fr.org
[PATCH] I2C: Missing newlines in debug messages
As discussed on IRC, this simple patch fixes broken debug messages
missing their trailing newlines. I just applied something similar to
CVS, and will prepare patches for 2.4 as well.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/i2c/i2c-core.c | 2 +-
drivers/i2c/i2c-dev.c | 2 +-
drivers/i2c/i2c-sensor-detect.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c 2004-11-12 15:22:38 -08:00
+++ b/drivers/i2c/i2c-core.c 2004-11-12 15:22:38 -08:00
@@ -760,7 +760,7 @@
if (addr = address_data->normal_i2c[i]) {
found = 1;
dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, "
- "addr %02x", adap_id,addr);
+ "addr %02x\n", adap_id, addr);
}
}
diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c 2004-11-12 15:22:38 -08:00
+++ b/drivers/i2c/i2c-dev.c 2004-11-12 15:22:38 -08:00
@@ -539,7 +539,7 @@
out_unreg_chrdev:
unregister_chrdev(I2C_MAJOR, "i2c");
out:
- printk(KERN_ERR "%s: Driver Initialisation failed", __FILE__);
+ printk(KERN_ERR "%s: Driver Initialisation failed\n", __FILE__);
return res;
}
diff -Nru a/drivers/i2c/i2c-sensor-detect.c b/drivers/i2c/i2c-sensor-detect.c
--- a/drivers/i2c/i2c-sensor-detect.c 2004-11-12 15:22:38 -08:00
+++ b/drivers/i2c/i2c-sensor-detect.c 2004-11-12 15:22:38 -08:00
@@ -115,7 +115,7 @@
for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) {
if (addr = normal_i2c[i]) {
found = 1;
- dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x", adapter_id, addr);
+ dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr);
}
}
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] I2C fixes for 2.6.10-rc1
@ 2005-05-19 6:25 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2005-05-19 6:25 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.2096, 2004/11/12 13:21:22-08:00, paubert@iram.es
[PATCH] I2C: Recent I2C "dead code removal" breaks pmac sound.
> Put the function back, and change the pmac.h file to delete the #define,
> and replace the snd_pmac_keywest_write function with a real call to
> i2c_smbus_write_block_data so things like this don't happen again.
>
> Care to write a patch to do this?
It follows, along with an update of the include/linux/i2c.h to only
declare functions that actually exist, but grepping the whole sound
subtree shows that at least sound/oss/dmasound/tas_common.h defines
a few inline functions that call i2c_smbus_write_{byte,block}_data.
[I2C part]
Ressuscitate i2c_smbus_write_block_data since it's actually
used. Update include/linux/i2c.h to reflect the existing
functions.
[Sound part]
Remove snd_pmac_keywest_write* wrapper macros and directly
call the i2c_smbus_* functions instead.
Signed-off-by: Gabriel Paubert <paubert@iram.es>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
=== include/linux/i2c.h 1.41 vs edited ==
drivers/i2c/i2c-core.c | 17 +++++++++++++++++
include/linux/i2c.h | 16 ++++------------
sound/ppc/daca.c | 24 +++++++++++++-----------
sound/ppc/pmac.h | 2 --
sound/ppc/tumbler.c | 41 +++++++++++++++++++++++------------------
5 files changed, 57 insertions(+), 43 deletions(-)
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c 2004-11-12 15:22:30 -08:00
+++ b/drivers/i2c/i2c-core.c 2004-11-12 15:22:30 -08:00
@@ -1021,6 +1021,22 @@
I2C_SMBUS_WORD_DATA,&data);
}
+/* Returns the number of bytes transferred */
+s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command,
+ u8 length, u8 *values)
+{
+ union i2c_smbus_data data;
+ int i;
+ if (length > I2C_SMBUS_BLOCK_MAX)
+ length = I2C_SMBUS_BLOCK_MAX;
+ for (i = 1; i <= length; i++)
+ data.block[i] = values[i-1];
+ data.block[0] = length;
+ return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
+ I2C_SMBUS_WRITE,command,
+ I2C_SMBUS_BLOCK_DATA,&data);
+}
+
/* Returns the number of read bytes */
s32 i2c_smbus_block_process_call(struct i2c_client *client, u8 command, u8 length, u8 *values)
{
@@ -1279,6 +1295,7 @@
EXPORT_SYMBOL(i2c_smbus_write_byte_data);
EXPORT_SYMBOL(i2c_smbus_read_word_data);
EXPORT_SYMBOL(i2c_smbus_write_word_data);
+EXPORT_SYMBOL(i2c_smbus_write_block_data);
EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data);
EXPORT_SYMBOL(i2c_get_functionality);
diff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h 2004-11-12 15:22:30 -08:00
+++ b/include/linux/i2c.h 2004-11-12 15:22:30 -08:00
@@ -88,20 +88,12 @@
extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
u8 command, u16 value);
-extern s32 i2c_smbus_process_call(struct i2c_client * client,
- u8 command, u16 value);
-/* Returns the number of read bytes */
-extern s32 i2c_smbus_read_block_data(struct i2c_client * client,
- u8 command, u8 *values);
+/* Returns the number of bytes transferred */
extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
- u8 command, u8 length,
- u8 *values);
+ u8 command, u8 length,
+ u8 *values);
extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
- u8 command, u8 *values);
-extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
- u8 command, u8 length,
- u8 *values);
-
+ u8 command, u8 *values);
/*
* A driver is capable of handling one or more physical devices present on
diff -Nru a/sound/ppc/daca.c b/sound/ppc/daca.c
--- a/sound/ppc/daca.c 2004-11-12 15:22:30 -08:00
+++ b/sound/ppc/daca.c 2004-11-12 15:22:30 -08:00
@@ -56,10 +56,11 @@
unsigned short wdata = 0x00;
/* SR: no swap, 1bit delay, 32-48kHz */
/* GCFG: power amp inverted, DAC on */
- if (snd_pmac_keywest_write_byte(i2c, DACA_REG_SR, 0x08) < 0 ||
- snd_pmac_keywest_write_byte(i2c, DACA_REG_GCFG, 0x05) < 0)
+ if (i2c_smbus_write_byte_data(i2c->client, DACA_REG_SR, 0x08) < 0 ||
+ i2c_smbus_write_byte_data(i2c->client, DACA_REG_GCFG, 0x05) < 0)
return -EINVAL;
- return snd_pmac_keywest_write(i2c, DACA_REG_AVOL, 2, (unsigned char*)&wdata);
+ return i2c_smbus_write_block_data(i2c->client, DACA_REG_AVOL,
+ 2, (unsigned char*)&wdata);
}
/*
@@ -81,9 +82,10 @@
else
data[1] = mix->right_vol;
data[1] |= mix->deemphasis ? 0x40 : 0;
- if (snd_pmac_keywest_write(&mix->i2c, DACA_REG_AVOL, 2, data) < 0) {
- snd_printk("failed to set volume \n");
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, DACA_REG_AVOL,
+ 2, data) < 0) {
+ snd_printk("failed to set volume \n");
+ return -EINVAL;
}
return 0;
}
@@ -188,8 +190,8 @@
change = mix->amp_on != ucontrol->value.integer.value[0];
if (change) {
mix->amp_on = ucontrol->value.integer.value[0];
- snd_pmac_keywest_write_byte(&mix->i2c, DACA_REG_GCFG,
- mix->amp_on ? 0x05 : 0x04);
+ i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG,
+ mix->amp_on ? 0x05 : 0x04);
}
return change;
}
@@ -220,9 +222,9 @@
static void daca_resume(pmac_t *chip)
{
pmac_daca_t *mix = chip->mixer_data;
- snd_pmac_keywest_write_byte(&mix->i2c, DACA_REG_SR, 0x08);
- snd_pmac_keywest_write_byte(&mix->i2c, DACA_REG_GCFG,
- mix->amp_on ? 0x05 : 0x04);
+ i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_SR, 0x08);
+ i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG,
+ mix->amp_on ? 0x05 : 0x04);
daca_set_volume(mix);
}
#endif /* CONFIG_PMAC_PBOOK */
diff -Nru a/sound/ppc/pmac.h b/sound/ppc/pmac.h
--- a/sound/ppc/pmac.h 2004-11-12 15:22:30 -08:00
+++ b/sound/ppc/pmac.h 2004-11-12 15:22:30 -08:00
@@ -199,8 +199,6 @@
int snd_pmac_keywest_init(pmac_keywest_t *i2c);
void snd_pmac_keywest_cleanup(pmac_keywest_t *i2c);
-#define snd_pmac_keywest_write(i2c,cmd,len,data) i2c_smbus_write_block_data((i2c)->client, cmd, len, data)
-#define snd_pmac_keywest_write_byte(i2c,cmd,data) i2c_smbus_write_byte_data((i2c)->client, cmd, data)
/* misc */
int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo);
diff -Nru a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
--- a/sound/ppc/tumbler.c 2004-11-12 15:22:30 -08:00
+++ b/sound/ppc/tumbler.c 2004-11-12 15:22:30 -08:00
@@ -109,7 +109,8 @@
while (*regs > 0) {
int err, count = 10;
do {
- err = snd_pmac_keywest_write_byte(i2c, regs[0], regs[1]);
+ err = i2c_smbus_write_byte_data(i2c->client,
+ regs[0], regs[1]);
if (err >= 0)
break;
mdelay(10);
@@ -220,9 +221,10 @@
block[4] = (right_vol >> 8) & 0xff;
block[5] = (right_vol >> 0) & 0xff;
- if (snd_pmac_keywest_write(&mix->i2c, TAS_REG_VOL, 6, block) < 0) {
- snd_printk("failed to set volume \n");
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_VOL,
+ 6, block) < 0) {
+ snd_printk("failed to set volume \n");
+ return -EINVAL;
}
return 0;
}
@@ -320,9 +322,10 @@
val[1] = 0;
}
- if (snd_pmac_keywest_write(&mix->i2c, TAS_REG_DRC, 2, val) < 0) {
- snd_printk("failed to set DRC\n");
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC,
+ 2, val) < 0) {
+ snd_printk("failed to set DRC\n");
+ return -EINVAL;
}
return 0;
}
@@ -355,9 +358,10 @@
val[4] = 0x60;
val[5] = 0xa0;
- if (snd_pmac_keywest_write(&mix->i2c, TAS_REG_DRC, 6, val) < 0) {
- snd_printk("failed to set DRC\n");
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC,
+ 6, val) < 0) {
+ snd_printk("failed to set DRC\n");
+ return -EINVAL;
}
return 0;
}
@@ -459,9 +463,10 @@
vol = info->table[vol];
for (i = 0; i < info->bytes; i++)
block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff;
- if (snd_pmac_keywest_write(&mix->i2c, info->reg, info->bytes, block) < 0) {
- snd_printk("failed to set mono volume %d\n", info->index);
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, info->reg,
+ info->bytes, block) < 0) {
+ snd_printk("failed to set mono volume %d\n", info->index);
+ return -EINVAL;
}
return 0;
}
@@ -588,9 +593,9 @@
for (j = 0; j < 3; j++)
block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff;
}
- if (snd_pmac_keywest_write(&mix->i2c, reg, 9, block) < 0) {
- snd_printk("failed to set mono volume %d\n", reg);
- return -EINVAL;
+ if (i2c_smbus_write_block_data(mix->i2c.client, reg, 9, block) < 0) {
+ snd_printk("failed to set mono volume %d\n", reg);
+ return -EINVAL;
}
return 0;
}
@@ -689,8 +694,8 @@
{
if (! mix->i2c.client)
return -ENODEV;
- return snd_pmac_keywest_write_byte(&mix->i2c, TAS_REG_ACS,
- mix->capture_source ? 2 : 0);
+ return i2c_smbus_write_byte_data(mix->i2c.client, TAS_REG_ACS,
+ mix->capture_source ? 2 : 0);
}
static int snapper_info_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [BK PATCH] I2C fixes for 2.6.10-rc1
@ 2005-05-19 6:25 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2005-05-19 6:25 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-kernel, sensors
Hi,
Here are a few small i2c bugfixes for 2.6.10-rc1
Please pull from: bk://kernel.bkbits.net/gregkh/linux/i2c-2.6
Individual patches will follow, sent to the sensors and linux-kernel
lists.
That's it, bug fixes only from me for now till 2.6.10 is out :)
thanks,
greg k-h
Documentation/i2c/dev-interface | 4 +--
drivers/i2c/chips/rtc8564.c | 3 ++
drivers/i2c/i2c-core.c | 19 +++++++++++++++++-
drivers/i2c/i2c-dev.c | 2 -
drivers/i2c/i2c-sensor-detect.c | 2 -
include/linux/i2c.h | 16 +++------------
sound/ppc/daca.c | 24 ++++++++++++-----------
sound/ppc/pmac.h | 2 -
sound/ppc/tumbler.c | 41 ++++++++++++++++++++++------------------
9 files changed, 65 insertions(+), 48 deletions(-)
-----
Gabriel Paubert:
o I2C: Recent I2C "dead code removal" breaks pmac sound
Greg Kroah-Hartman:
o I2C: fix up rtc8564 which should not have been changed in my previous cleanups
o I2C: fix up some out of date Documentation
Jean Delvare:
o I2C: Missing newlines in debug messages
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-05-19 6:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-12 23:26 [BK PATCH] I2C fixes for 2.6.10-rc1 Greg KH
2005-05-19 6:25 ` Greg KH
2004-11-12 23:26 ` [PATCH] " Greg KH
2005-05-19 6:25 ` Greg KH
2004-11-12 23:26 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-11-12 23:26 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-11-12 23:26 ` Greg KH
2005-05-19 6:25 ` Greg KH
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.