summaryrefslogtreecommitdiff
path: root/sound/pci/pcxhr/pcxhr.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-03-24 00:36:19 +0100
committerTakashi Iwai <tiwai@suse.de>2009-03-24 00:36:19 +0100
commit7df4f694356a125e4553ca35b215fd9e88e858c5 (patch)
treeb153e8aeb6439c3f7bc150ad9e6e3ff9d57849a0 /sound/pci/pcxhr/pcxhr.c
parentb54fc8dd2c43888f2754505cca2b6e88604a8ffa (diff)
parentd563ffa6b319a4e401d096db9014a947590ca081 (diff)
Merge branch 'topic/pcxhr' into for-linus
Diffstat (limited to 'sound/pci/pcxhr/pcxhr.c')
-rw-r--r--sound/pci/pcxhr/pcxhr.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 7f95459c8b1f..80e064a3efff 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 */