Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 201943
b: refs/heads/master
c: 3f23a81
h: refs/heads/master
i:
  201941: 47aa1ed
  201939: 188fce3
  201935: 6110093
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Aug 2, 2010
1 parent 21623c9 commit 7da6c23
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: faa7c13481a1d73e93456b1e2a0d95c4f89ad518
refs/heads/master: 3f23a81a101889711e878240908a2b81b94a268a
49 changes: 28 additions & 21 deletions trunk/drivers/staging/tm6000/tm6000-alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ static int _tm6000_start_audio_dma(struct snd_tm6000_card *chip)
struct tm6000_core *core = chip->core;
int val;

dprintk(1, "Starting audio DMA\n");

/* Enables audio */
val = tm6000_get_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x0);
val |= 0x20;
Expand Down Expand Up @@ -237,7 +239,9 @@ static int snd_tm6000_hw_params(struct snd_pcm_substream *substream,
*/
static int snd_tm6000_hw_free(struct snd_pcm_substream *substream)
{
dsp_buffer_free(substream);
struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream);

_tm6000_stop_audio_dma(chip);

return 0;
}
Expand All @@ -247,6 +251,11 @@ static int snd_tm6000_hw_free(struct snd_pcm_substream *substream)
*/
static int snd_tm6000_prepare(struct snd_pcm_substream *substream)
{
struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream);

chip->buf_pos = 0;
chip->period_pos = 0;

return 0;
}

Expand Down Expand Up @@ -284,12 +293,8 @@ static int snd_tm6000_card_trigger(struct snd_pcm_substream *substream, int cmd)
static snd_pcm_uframes_t snd_tm6000_pointer(struct snd_pcm_substream *substream)
{
struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
u16 count;

count = atomic_read(&chip->count);

return runtime->period_size * (count & (runtime->periods-1));
return chip->buf_pos;
}

/*
Expand Down Expand Up @@ -342,41 +347,43 @@ int tm6000_audio_init(struct tm6000_core *dev)
snd_printk(KERN_ERR "cannot create card instance %d\n", devnr);
return rc;
}
strcpy(card->driver, "tm6000-alsa");
strcpy(card->shortname, "TM5600/60x0");
sprintf(card->longname, "TM5600/60x0 Audio at bus %d device %d",
dev->udev->bus->busnum, dev->udev->devnum);

sprintf(component, "USB%04x:%04x",
le16_to_cpu(dev->udev->descriptor.idVendor),
le16_to_cpu(dev->udev->descriptor.idProduct));
snd_component_add(card, component);
snd_card_set_dev(card, &dev->udev->dev);

chip = kzalloc(sizeof(struct snd_tm6000_card), GFP_KERNEL);
if (!chip) {
rc = -ENOMEM;
goto error;
}

sprintf(component, "USB%04x:%04x",
le16_to_cpu(dev->udev->descriptor.idVendor),
le16_to_cpu(dev->udev->descriptor.idProduct));
snd_component_add(card, component);

chip->core = dev;
chip->card = card;
dev->adev = chip;
spin_lock_init(&chip->reg_lock);

rc = snd_pcm_new(card, "TM6000 Audio", 0, 0, 1, &pcm);
if (rc < 0)
goto error;

snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_tm6000_pcm_ops);
pcm->info_flags = 0;
pcm->private_data = dev;
pcm->private_data = chip;
strcpy(pcm->name, "Trident TM5600/60x0");
strcpy(card->driver, "tm6000-alsa");
strcpy(card->shortname, "TM5600/60x0");
sprintf(card->longname, "TM5600/60x0 Audio at bus %d device %d",
dev->udev->bus->busnum, dev->udev->devnum);

snd_card_set_dev(card, &dev->udev->dev);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_tm6000_pcm_ops);

rc = snd_card_register(card);
if (rc < 0)
goto error;

chip->core = dev;
chip->card = card;
dev->adev = chip;
dprintk(1,"Registered audio driver for %s\n", card->longname);

return 0;

Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/staging/tm6000/tm6000-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,10 @@ int tm6000_register_extension(struct tm6000_ops *ops)
mutex_lock(&tm6000_extension_devlist_lock);
list_add_tail(&ops->next, &tm6000_extension_devlist);
list_for_each_entry(dev, &tm6000_devlist, devlist) {
if (dev)
ops->init(dev);
ops->init(dev);
printk(KERN_INFO "%s: Initialized (%s) extension\n",
dev->name, ops->name);
}
printk(KERN_INFO "tm6000: Initialized (%s) extension\n", ops->name);
mutex_unlock(&tm6000_extension_devlist_lock);
mutex_unlock(&tm6000_devlist_mutex);
return 0;
Expand Down
5 changes: 4 additions & 1 deletion trunk/drivers/staging/tm6000/tm6000.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ struct tm6000_dvb {
struct snd_tm6000_card {
struct snd_card *card;
spinlock_t reg_lock;
atomic_t count;
struct tm6000_core *core;
struct snd_pcm_substream *substream;

/* temporary data for buffer fill processing */
unsigned buf_pos;
unsigned period_pos;
};

struct tm6000_endpoint {
Expand Down

0 comments on commit 7da6c23

Please sign in to comment.