From e58de7baf7de11f01a675cbbf6ecc8a2758b9ca5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 28 Dec 2008 16:44:30 +0100 Subject: ALSA: Convert to snd_card_create() in sound/pci/* Convert from snd_card_new() to the new snd_card_create() function in sound/pci/*. Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound/pci/pcxhr/pcxhr.c') diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 27cf2c28d11..7f95459c8b1 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -1510,12 +1510,12 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : card_name, i); - card = snd_card_new(idx, tmpid, THIS_MODULE, 0); + err = snd_card_create(idx, tmpid, THIS_MODULE, 0, &card); - if (! card) { + if (err < 0) { snd_printk(KERN_ERR "cannot allocate the card %d\n", i); pcxhr_free(mgr); - return -ENOMEM; + return err; } strcpy(card->driver, DRIVER_NAME); -- cgit From 55aef4508598d59c2baea7e2a3e6dfed415bbfc0 Mon Sep 17 00:00:00 2001 From: Markus Bollinger Date: Fri, 23 Jan 2009 14:45:41 +0100 Subject: ALSA: pcxhr - add support for gpio ports and minor bug fix - add support for gpio ports (2 GPI, 2 GPO) of pcxhr stereo cards - minor bugfixes : allow setting clock to internal by the mixer even if there is no stream (but monitoring) Signed-off-by: Markus Bollinger Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'sound/pci/pcxhr/pcxhr.c') diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 27cf2c28d11..ca89106f8c5 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -1334,6 +1334,40 @@ static void pcxhr_proc_sync(struct snd_info_entry *entry, snd_iprintf(buffer, "\n"); } +static void pcxhr_proc_gpio_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) +{ + struct snd_pcxhr *chip = entry->private_data; + struct pcxhr_mgr *mgr = chip->mgr; + /* commands available when embedded DSP is running */ + if (mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX)) { + /* gpio ports on stereo boards only available */ + int value = 0; + hr222_read_gpio(mgr, 1, &value); /* GPI */ + snd_iprintf(buffer, "GPI: 0x%x\n", value); + hr222_read_gpio(mgr, 0, &value); /* GP0 */ + snd_iprintf(buffer, "GPO: 0x%x\n", value); + } else + snd_iprintf(buffer, "no firmware loaded\n"); + snd_iprintf(buffer, "\n"); +} +static void pcxhr_proc_gpo_write(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) +{ + struct snd_pcxhr *chip = entry->private_data; + struct pcxhr_mgr *mgr = chip->mgr; + char line[64]; + int value; + /* commands available when embedded DSP is running */ + if (!(mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX))) + return; + while (!snd_info_get_line(buffer, line, sizeof(line))) { + if (sscanf(line, "GPO: 0x%x", &value) != 1) + continue; + hr222_write_gpo(mgr, value); /* GP0 */ + } +} + static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip) { struct snd_info_entry *entry; @@ -1342,6 +1376,13 @@ static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip) snd_info_set_text_ops(entry, chip, pcxhr_proc_info); if (! snd_card_proc_new(chip->card, "sync", &entry)) snd_info_set_text_ops(entry, chip, pcxhr_proc_sync); + /* gpio available on stereo sound cards only */ + if (chip->mgr->is_hr_stereo && + !snd_card_proc_new(chip->card, "gpio", &entry)) { + snd_info_set_text_ops(entry, chip, pcxhr_proc_gpio_read); + entry->c.text.write = pcxhr_proc_gpo_write; + entry->mode |= S_IWUSR; + } } /* end of proc interface */ -- cgit