]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'topic/pcxhr' into for-linus
authorTakashi Iwai <tiwai@suse.de>
Mon, 23 Mar 2009 23:36:19 +0000 (00:36 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 23 Mar 2009 23:36:19 +0000 (00:36 +0100)
1  2 
sound/pci/pcxhr/pcxhr.c
sound/pci/pcxhr/pcxhr.h

diff --combined sound/pci/pcxhr/pcxhr.c
index 7f95459c8b1f4e149a1acc7f54c9adb21acf6e39,ca89106f8c5da255f1f0562ec2ae66fcb27512fc..80e064a3efff94d1c37c81276d15b7d95c9b5533
@@@ -1334,6 -1334,40 +1334,40 @@@ static void pcxhr_proc_sync(struct snd_
        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;
                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 */
  
@@@ -1510,12 -1551,12 +1551,12 @@@ static int __devinit pcxhr_probe(struc
  
                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);
diff --combined sound/pci/pcxhr/pcxhr.h
index 69d87dee6995f72e174940a44bd0a4f302b7e7f4,ac9c3b3bb4e8c2911722f7f42f57a9f016d69435..bda776c498845b7524ba16bdfc043010d07daca3
@@@ -27,8 -27,8 +27,8 @@@
  #include <linux/mutex.h>
  #include <sound/pcm.h>
  
- #define PCXHR_DRIVER_VERSION          0x000905        /* 0.9.5 */
- #define PCXHR_DRIVER_VERSION_STRING   "0.9.5"         /* 0.9.5 */
+ #define PCXHR_DRIVER_VERSION          0x000906        /* 0.9.6 */
+ #define PCXHR_DRIVER_VERSION_STRING   "0.9.6"         /* 0.9.6 */
  
  
  #define PCXHR_MAX_CARDS               6
@@@ -97,12 -97,12 +97,12 @@@ struct pcxhr_mgr 
        int capture_chips;
        int fw_file_set;
        int firmware_num;
 -      int is_hr_stereo:1;
 -      int board_has_aes1:1;   /* if 1 board has AES1 plug and SRC */
 -      int board_has_analog:1; /* if 0 the board is digital only */
 -      int board_has_mic:1;    /* if 1 the board has microphone input */
 -      int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */
 -      int mono_capture:1;     /* if 1 the board does mono capture */
 +      unsigned int is_hr_stereo:1;
 +      unsigned int board_has_aes1:1;  /* if 1 board has AES1 plug and SRC */
 +      unsigned int board_has_analog:1; /* if 0 the board is digital only */
 +      unsigned int board_has_mic:1; /* if 1 the board has microphone input */
 +      unsigned int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */
 +      unsigned int mono_capture:1; /* if 1 the board does mono capture */
  
        struct snd_dma_buffer hostport;
  
  
        unsigned char xlx_cfg;          /* copy of PCXHR_XLX_CFG register */
        unsigned char xlx_selmic;       /* copy of PCXHR_XLX_SELMIC register */
+       unsigned char dsp_reset;        /* copy of PCXHR_DSP_RESET register */
  };