Commit 367636e8 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] powerpc: Fix sound driver use of i2c

The PowerMac sound drivers used to rely on a "bug" of the i2c-keywest
driver that implemented I2C_SMBUS_BLOCK_DATA incorrectly, that is it did
what I2C_SMBUS_I2C_BLOCK_DATA should have done. The new i2c-powermac
driver that replaces keywest has this bug fixed, thus the sound drivers
must be fixed too.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent fe691021
...@@ -178,10 +178,10 @@ tas_write_register( struct tas_data_t *self, ...@@ -178,10 +178,10 @@ tas_write_register( struct tas_data_t *self,
if (write_mode & WRITE_SHADOW) if (write_mode & WRITE_SHADOW)
memcpy(self->shadow[reg_num],data,reg_width); memcpy(self->shadow[reg_num],data,reg_width);
if (write_mode & WRITE_HW) { if (write_mode & WRITE_HW) {
rc=i2c_smbus_write_block_data(self->client, rc=i2c_smbus_write_i2c_block_data(self->client,
reg_num, reg_num,
reg_width, reg_width,
data); data);
if (rc < 0) { if (rc < 0) {
printk("tas: I2C block write failed \n"); printk("tas: I2C block write failed \n");
return rc; return rc;
...@@ -199,10 +199,10 @@ tas_sync_register( struct tas_data_t *self, ...@@ -199,10 +199,10 @@ tas_sync_register( struct tas_data_t *self,
if (reg_width==0 || self==NULL) if (reg_width==0 || self==NULL)
return -EINVAL; return -EINVAL;
rc=i2c_smbus_write_block_data(self->client, rc=i2c_smbus_write_i2c_block_data(self->client,
reg_num, reg_num,
reg_width, reg_width,
self->shadow[reg_num]); self->shadow[reg_num]);
if (rc < 0) { if (rc < 0) {
printk("tas: I2C block write failed \n"); printk("tas: I2C block write failed \n");
return rc; return rc;
......
...@@ -66,7 +66,7 @@ static int snd_pmac_dbdma_alloc(struct snd_pmac *chip, struct pmac_dbdma *rec, i ...@@ -66,7 +66,7 @@ static int snd_pmac_dbdma_alloc(struct snd_pmac *chip, struct pmac_dbdma *rec, i
static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec) static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec)
{ {
if (rec) { if (rec->space) {
unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1);
dma_free_coherent(&chip->pdev->dev, rsize, rec->space, rec->dma_base); dma_free_coherent(&chip->pdev->dev, rsize, rec->space, rec->dma_base);
...@@ -881,6 +881,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip) ...@@ -881,6 +881,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
chip->can_capture = 1; chip->can_capture = 1;
chip->num_freqs = ARRAY_SIZE(awacs_freqs); chip->num_freqs = ARRAY_SIZE(awacs_freqs);
chip->freq_table = awacs_freqs; chip->freq_table = awacs_freqs;
chip->pdev = NULL;
chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */ chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */
......
...@@ -239,8 +239,8 @@ static int tumbler_set_master_volume(struct pmac_tumbler *mix) ...@@ -239,8 +239,8 @@ static int tumbler_set_master_volume(struct pmac_tumbler *mix)
block[4] = (right_vol >> 8) & 0xff; block[4] = (right_vol >> 8) & 0xff;
block[5] = (right_vol >> 0) & 0xff; block[5] = (right_vol >> 0) & 0xff;
if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_VOL, if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_VOL, 6,
6, block) < 0) { block) < 0) {
snd_printk("failed to set volume \n"); snd_printk("failed to set volume \n");
return -EINVAL; return -EINVAL;
} }
...@@ -345,8 +345,8 @@ static int tumbler_set_drc(struct pmac_tumbler *mix) ...@@ -345,8 +345,8 @@ static int tumbler_set_drc(struct pmac_tumbler *mix)
val[1] = 0; val[1] = 0;
} }
if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC, if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC,
2, val) < 0) { 2, val) < 0) {
snd_printk("failed to set DRC\n"); snd_printk("failed to set DRC\n");
return -EINVAL; return -EINVAL;
} }
...@@ -381,8 +381,8 @@ static int snapper_set_drc(struct pmac_tumbler *mix) ...@@ -381,8 +381,8 @@ static int snapper_set_drc(struct pmac_tumbler *mix)
val[4] = 0x60; val[4] = 0x60;
val[5] = 0xa0; val[5] = 0xa0;
if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC, if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC,
6, val) < 0) { 6, val) < 0) {
snd_printk("failed to set DRC\n"); snd_printk("failed to set DRC\n");
return -EINVAL; return -EINVAL;
} }
...@@ -492,8 +492,8 @@ static int tumbler_set_mono_volume(struct pmac_tumbler *mix, ...@@ -492,8 +492,8 @@ static int tumbler_set_mono_volume(struct pmac_tumbler *mix,
vol = info->table[vol]; vol = info->table[vol];
for (i = 0; i < info->bytes; i++) for (i = 0; i < info->bytes; i++)
block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff; block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff;
if (i2c_smbus_write_block_data(mix->i2c.client, info->reg, if (i2c_smbus_write_i2c_block_data(mix->i2c.client, info->reg,
info->bytes, block) < 0) { info->bytes, block) < 0) {
snd_printk("failed to set mono volume %d\n", info->index); snd_printk("failed to set mono volume %d\n", info->index);
return -EINVAL; return -EINVAL;
} }
...@@ -625,7 +625,8 @@ static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int r ...@@ -625,7 +625,8 @@ static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int r
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff; block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff;
} }
if (i2c_smbus_write_block_data(mix->i2c.client, reg, 9, block) < 0) { if (i2c_smbus_write_i2c_block_data(mix->i2c.client, reg,
9, block) < 0) {
snd_printk("failed to set mono volume %d\n", reg); snd_printk("failed to set mono volume %d\n", reg);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment