diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-02-07 23:04:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-07 23:33:36 -0500 |
commit | 367636e8a9ef250d5b255f9d299e1c27cb3d7ea3 (patch) | |
tree | 19a8a96154d2a318a2dbd02d5dfab8530e0b8606 | |
parent | fe69102188cde0700cddd8d4cda0b77d68284884 (diff) |
[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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | sound/oss/dmasound/tas_common.h | 16 | ||||
-rw-r--r-- | sound/ppc/pmac.c | 3 | ||||
-rw-r--r-- | sound/ppc/tumbler.c | 19 |
3 files changed, 20 insertions, 18 deletions
diff --git a/sound/oss/dmasound/tas_common.h b/sound/oss/dmasound/tas_common.h index 3a6d48666db0..0741c28e56ce 100644 --- a/sound/oss/dmasound/tas_common.h +++ b/sound/oss/dmasound/tas_common.h | |||
@@ -178,10 +178,10 @@ tas_write_register( struct tas_data_t *self, | |||
178 | if (write_mode & WRITE_SHADOW) | 178 | if (write_mode & WRITE_SHADOW) |
179 | memcpy(self->shadow[reg_num],data,reg_width); | 179 | memcpy(self->shadow[reg_num],data,reg_width); |
180 | if (write_mode & WRITE_HW) { | 180 | if (write_mode & WRITE_HW) { |
181 | rc=i2c_smbus_write_block_data(self->client, | 181 | rc=i2c_smbus_write_i2c_block_data(self->client, |
182 | reg_num, | 182 | reg_num, |
183 | reg_width, | 183 | reg_width, |
184 | data); | 184 | data); |
185 | if (rc < 0) { | 185 | if (rc < 0) { |
186 | printk("tas: I2C block write failed \n"); | 186 | printk("tas: I2C block write failed \n"); |
187 | return rc; | 187 | return rc; |
@@ -199,10 +199,10 @@ tas_sync_register( struct tas_data_t *self, | |||
199 | 199 | ||
200 | if (reg_width==0 || self==NULL) | 200 | if (reg_width==0 || self==NULL) |
201 | return -EINVAL; | 201 | return -EINVAL; |
202 | rc=i2c_smbus_write_block_data(self->client, | 202 | rc=i2c_smbus_write_i2c_block_data(self->client, |
203 | reg_num, | 203 | reg_num, |
204 | reg_width, | 204 | reg_width, |
205 | self->shadow[reg_num]); | 205 | self->shadow[reg_num]); |
206 | if (rc < 0) { | 206 | if (rc < 0) { |
207 | printk("tas: I2C block write failed \n"); | 207 | printk("tas: I2C block write failed \n"); |
208 | return rc; | 208 | return rc; |
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 4988f873a7ba..aa57170101fd 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
@@ -66,7 +66,7 @@ static int snd_pmac_dbdma_alloc(struct snd_pmac *chip, struct pmac_dbdma *rec, i | |||
66 | 66 | ||
67 | static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec) | 67 | static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec) |
68 | { | 68 | { |
69 | if (rec) { | 69 | if (rec->space) { |
70 | unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); | 70 | unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); |
71 | 71 | ||
72 | dma_free_coherent(&chip->pdev->dev, rsize, rec->space, rec->dma_base); | 72 | 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 | chip->can_capture = 1; | 881 | chip->can_capture = 1; |
882 | chip->num_freqs = ARRAY_SIZE(awacs_freqs); | 882 | chip->num_freqs = ARRAY_SIZE(awacs_freqs); |
883 | chip->freq_table = awacs_freqs; | 883 | chip->freq_table = awacs_freqs; |
884 | chip->pdev = NULL; | ||
884 | 885 | ||
885 | chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */ | 886 | chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */ |
886 | 887 | ||
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 15c63cb2ccba..838fc113c441 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -239,8 +239,8 @@ static int tumbler_set_master_volume(struct pmac_tumbler *mix) | |||
239 | block[4] = (right_vol >> 8) & 0xff; | 239 | block[4] = (right_vol >> 8) & 0xff; |
240 | block[5] = (right_vol >> 0) & 0xff; | 240 | block[5] = (right_vol >> 0) & 0xff; |
241 | 241 | ||
242 | if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_VOL, | 242 | if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_VOL, 6, |
243 | 6, block) < 0) { | 243 | block) < 0) { |
244 | snd_printk("failed to set volume \n"); | 244 | snd_printk("failed to set volume \n"); |
245 | return -EINVAL; | 245 | return -EINVAL; |
246 | } | 246 | } |
@@ -345,8 +345,8 @@ static int tumbler_set_drc(struct pmac_tumbler *mix) | |||
345 | val[1] = 0; | 345 | val[1] = 0; |
346 | } | 346 | } |
347 | 347 | ||
348 | if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC, | 348 | if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC, |
349 | 2, val) < 0) { | 349 | 2, val) < 0) { |
350 | snd_printk("failed to set DRC\n"); | 350 | snd_printk("failed to set DRC\n"); |
351 | return -EINVAL; | 351 | return -EINVAL; |
352 | } | 352 | } |
@@ -381,8 +381,8 @@ static int snapper_set_drc(struct pmac_tumbler *mix) | |||
381 | val[4] = 0x60; | 381 | val[4] = 0x60; |
382 | val[5] = 0xa0; | 382 | val[5] = 0xa0; |
383 | 383 | ||
384 | if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC, | 384 | if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC, |
385 | 6, val) < 0) { | 385 | 6, val) < 0) { |
386 | snd_printk("failed to set DRC\n"); | 386 | snd_printk("failed to set DRC\n"); |
387 | return -EINVAL; | 387 | return -EINVAL; |
388 | } | 388 | } |
@@ -492,8 +492,8 @@ static int tumbler_set_mono_volume(struct pmac_tumbler *mix, | |||
492 | vol = info->table[vol]; | 492 | vol = info->table[vol]; |
493 | for (i = 0; i < info->bytes; i++) | 493 | for (i = 0; i < info->bytes; i++) |
494 | block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff; | 494 | block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff; |
495 | if (i2c_smbus_write_block_data(mix->i2c.client, info->reg, | 495 | if (i2c_smbus_write_i2c_block_data(mix->i2c.client, info->reg, |
496 | info->bytes, block) < 0) { | 496 | info->bytes, block) < 0) { |
497 | snd_printk("failed to set mono volume %d\n", info->index); | 497 | snd_printk("failed to set mono volume %d\n", info->index); |
498 | return -EINVAL; | 498 | return -EINVAL; |
499 | } | 499 | } |
@@ -625,7 +625,8 @@ static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int r | |||
625 | for (j = 0; j < 3; j++) | 625 | for (j = 0; j < 3; j++) |
626 | block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff; | 626 | block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff; |
627 | } | 627 | } |
628 | if (i2c_smbus_write_block_data(mix->i2c.client, reg, 9, block) < 0) { | 628 | if (i2c_smbus_write_i2c_block_data(mix->i2c.client, reg, |
629 | 9, block) < 0) { | ||
629 | snd_printk("failed to set mono volume %d\n", reg); | 630 | snd_printk("failed to set mono volume %d\n", reg); |
630 | return -EINVAL; | 631 | return -EINVAL; |
631 | } | 632 | } |