• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/sound/oss/

Lines Matching refs:devc

83  *	devc->open_lock is a semaphore that is used to enforce the
89 * The semaphore devc->io_mutex serializes PCM I/O syscalls. This
100 * devc->mix_mutex serializes all mixer ioctls. This is also
1441 * devc->io_mutex protects: swstate, sw_*, swb_[iu]_idx.
1445 * combination of devc->open_mutex and devc->io_mutex.
1615 * Locking: called with devc->io_mutex held.
1620 static int pcm_setup(vwsnd_dev_t *devc,
1628 DBGEV("(devc=0x%p, rport=0x%p, wport=0x%p)\n", devc, rport, wport);
1747 &devc->lith,
1753 ad1843_setup_adc(&devc->lith,
1757 li_enable_interrupts(&devc->lith, READ_INTR_MASK);
1775 &devc->lith,
1781 ad1843_setup_dac(&devc->lith,
1785 li_enable_interrupts(&devc->lith, WRITE_INTR_MASK);
1796 static void pcm_shutdown_port(vwsnd_dev_t *devc,
1819 li_disable_interrupts(&devc->lith, mask);
1820 if (aport == &devc->rport)
1821 ad1843_shutdown_adc(&devc->lith);
1822 else /* aport == &devc->wport) */
1823 ad1843_shutdown_dac(&devc->lith);
1835 static void pcm_shutdown(vwsnd_dev_t *devc,
1839 DBGEV("(devc=0x%p, rport=0x%p, wport=0x%p)\n", devc, rport, wport);
1843 pcm_shutdown_port(devc, rport, READ_INTR_MASK);
1847 pcm_shutdown_port(devc, wport, WRITE_INTR_MASK);
1919 static void pcm_output(vwsnd_dev_t *devc, int erflown, int nb)
1921 vwsnd_port_t *wport = &devc->wport;
1928 DBGEV("(devc=0x%p, erflown=%d, nb=%d)\n", devc, erflown, nb);
2043 static void pcm_input(vwsnd_dev_t *devc, int erflown, int nb)
2045 vwsnd_port_t *rport = &devc->rport;
2052 DBGEV("(devc=0x%p, erflown=%d, nb=%d)\n", devc, erflown, nb);
2139 static void pcm_flush_frag(vwsnd_dev_t *devc)
2141 vwsnd_port_t *wport = &devc->wport;
2156 pcm_output(devc, 0, nb);
2167 static void pcm_write_sync(vwsnd_dev_t *devc)
2169 vwsnd_port_t *wport = &devc->wport;
2174 DBGEV("(devc=0x%p)\n", devc);
2200 static void vwsnd_audio_read_intr(vwsnd_dev_t *devc, unsigned int status)
2205 pcm_input(devc, overflown, 0);
2208 static void vwsnd_audio_write_intr(vwsnd_dev_t *devc, unsigned int status)
2213 pcm_output(devc, underflown, 0);
2218 vwsnd_dev_t *devc = dev_id;
2223 status = li_get_clear_intr_status(&devc->lith);
2224 vwsnd_audio_read_intr(devc, status);
2225 vwsnd_audio_write_intr(devc, status);
2234 vwsnd_dev_t *devc = file->private_data;
2236 &devc->rport : NULL);
2247 &devc->wport : NULL;
2248 ret = pcm_setup(devc, rport, wport);
2277 pcm_input(devc, 0, 0);
2298 vwsnd_dev_t *devc = file->private_data;
2301 mutex_lock(&devc->io_mutex);
2303 mutex_unlock(&devc->io_mutex);
2312 vwsnd_dev_t *devc = file->private_data;
2314 &devc->wport : NULL);
2325 &devc->rport : NULL;
2326 ret = pcm_setup(devc, rport, wport);
2359 pcm_output(devc, 0, nb);
2373 vwsnd_dev_t *devc = file->private_data;
2376 mutex_lock(&devc->io_mutex);
2378 mutex_unlock(&devc->io_mutex);
2386 vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data;
2388 &devc->rport : NULL;
2390 &devc->wport : NULL;
2416 vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data;
2418 &devc->rport : NULL;
2420 &devc->wport : NULL;
2509 ival = pcm_setup(devc, rport, wport);
2620 ival = pcm_setup(devc, rport, wport);
2639 ival = pcm_setup(devc, rport, wport);
2668 pcm_output(devc, 0, 0);
2669 pcm_write_sync(devc);
2671 pcm_shutdown(devc, rport, wport);
2677 pcm_flush_frag(devc);
2678 pcm_write_sync(devc);
2680 pcm_shutdown(devc, rport, wport);
2687 pcm_flush_frag(devc);
2834 pcm_setup(devc, rport, wport);
2852 pcm_output(devc, 0, 0);
2870 vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data;
2873 mutex_lock(&devc->io_mutex);
2875 mutex_unlock(&devc->io_mutex);
2895 vwsnd_dev_t *devc;
2902 for (devc = vwsnd_dev_list; devc; devc = devc->next_dev)
2903 if ((devc->audio_minor & ~0x0F) == (minor & ~0x0F))
2906 if (devc == NULL) {
2911 mutex_lock(&devc->open_mutex);
2912 while (devc->open_mode & file->f_mode) {
2913 mutex_unlock(&devc->open_mutex);
2918 interruptible_sleep_on(&devc->open_wait);
2923 mutex_lock(&devc->open_mutex);
2925 devc->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
2926 mutex_unlock(&devc->open_mutex);
2942 mutex_lock(&devc->io_mutex);
2945 devc->rport.swstate = SW_INITIAL;
2946 devc->rport.flags = 0;
2947 devc->rport.sw_channels = 1;
2948 devc->rport.sw_samplefmt = sw_samplefmt;
2949 devc->rport.sw_framerate = 8000;
2950 devc->rport.sw_fragshift = DEFAULT_FRAGSHIFT;
2951 devc->rport.sw_fragcount = DEFAULT_FRAGCOUNT;
2952 devc->rport.sw_subdivshift = DEFAULT_SUBDIVSHIFT;
2953 devc->rport.byte_count = 0;
2954 devc->rport.frag_count = 0;
2957 devc->wport.swstate = SW_INITIAL;
2958 devc->wport.flags = 0;
2959 devc->wport.sw_channels = 1;
2960 devc->wport.sw_samplefmt = sw_samplefmt;
2961 devc->wport.sw_framerate = 8000;
2962 devc->wport.sw_fragshift = DEFAULT_FRAGSHIFT;
2963 devc->wport.sw_fragcount = DEFAULT_FRAGCOUNT;
2964 devc->wport.sw_subdivshift = DEFAULT_SUBDIVSHIFT;
2965 devc->wport.byte_count = 0;
2966 devc->wport.frag_count = 0;
2969 mutex_unlock(&devc->io_mutex);
2971 file->private_data = devc;
2982 vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data;
2987 mutex_lock(&devc->io_mutex);
2992 rport = &devc->rport;
2994 wport = &devc->wport;
2995 pcm_flush_frag(devc);
2996 pcm_write_sync(devc);
2998 pcm_shutdown(devc, rport, wport);
3004 mutex_unlock(&devc->io_mutex);
3006 mutex_lock(&devc->open_mutex);
3008 devc->open_mode &= ~file->f_mode;
3010 mutex_unlock(&devc->open_mutex);
3011 wake_up(&devc->open_wait);
3037 vwsnd_dev_t *devc;
3042 for (devc = vwsnd_dev_list; devc; devc = devc->next_dev)
3043 if (devc->mixer_minor == iminor(inode))
3046 if (devc == NULL) {
3050 file->private_data = devc;
3065 static int mixer_read_ioctl(vwsnd_dev_t *devc, unsigned int nr, void __user *arg)
3069 DBGEV("(devc=0x%p, nr=0x%x, arg=0x%p)\n", devc, nr, arg);
3097 val = ad1843_get_gain(&devc->lith, &ad1843_gain_PCM);
3101 val = ad1843_get_gain(&devc->lith, &ad1843_gain_LINE);
3105 val = ad1843_get_gain(&devc->lith, &ad1843_gain_MIC);
3109 val = ad1843_get_gain(&devc->lith, &ad1843_gain_CD);
3113 val = ad1843_get_gain(&devc->lith, &ad1843_gain_RECLEV);
3117 val = ad1843_get_recsrc(&devc->lith);
3121 val = ad1843_get_outsrc(&devc->lith);
3132 static int mixer_write_ioctl(vwsnd_dev_t *devc, unsigned int nr, void __user *arg)
3137 DBGEV("(devc=0x%p, nr=0x%x, arg=0x%p)\n", devc, nr, arg);
3144 val = ad1843_set_gain(&devc->lith, &ad1843_gain_PCM, val);
3148 val = ad1843_set_gain(&devc->lith, &ad1843_gain_LINE, val);
3152 val = ad1843_set_gain(&devc->lith, &ad1843_gain_MIC, val);
3156 val = ad1843_set_gain(&devc->lith, &ad1843_gain_CD, val);
3160 val = ad1843_set_gain(&devc->lith, &ad1843_gain_RECLEV, val);
3164 if (devc->rport.swbuf || devc->wport.swbuf)
3166 val = ad1843_set_recsrc(&devc->lith, val);
3170 val = ad1843_set_outsrc(&devc->lith, val);
3188 vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data;
3193 DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg);
3195 mutex_lock(&devc->mix_mutex);
3198 retval = mixer_read_ioctl(devc, nr, (void __user *) arg);
3200 retval = mixer_write_ioctl(devc, nr, (void __user *) arg);
3204 mutex_unlock(&devc->mix_mutex);
3275 vwsnd_dev_t *devc = NULL;
3280 devc = kmalloc(sizeof (vwsnd_dev_t), GFP_KERNEL);
3281 if (devc == NULL)
3284 err = li_create(&devc->lith, hw_config->io_base);
3288 init_waitqueue_head(&devc->open_wait);
3290 devc->rport.hwbuf_size = HWBUF_SIZE;
3291 devc->rport.hwbuf_vaddr = __get_free_pages(GFP_KERNEL, HWBUF_ORDER);
3292 if (!devc->rport.hwbuf_vaddr)
3294 devc->rport.hwbuf = (void *) devc->rport.hwbuf_vaddr;
3295 devc->rport.hwbuf_paddr = virt_to_phys(devc->rport.hwbuf);
3310 li_writel(&devc->lith, LI_COMM1_BASE,
3311 devc->rport.hwbuf_paddr >> 8 | 1 << (37 - 8));
3313 devc->wport.hwbuf_size = HWBUF_SIZE;
3314 devc->wport.hwbuf_vaddr = __get_free_pages(GFP_KERNEL, HWBUF_ORDER);
3315 if (!devc->wport.hwbuf_vaddr)
3317 devc->wport.hwbuf = (void *) devc->wport.hwbuf_vaddr;
3318 devc->wport.hwbuf_paddr = virt_to_phys(devc->wport.hwbuf);
3319 DBGP("wport hwbuf = 0x%p\n", devc->wport.hwbuf);
3322 err = ad1843_init(&devc->lith);
3329 err = request_irq(hw_config->irq, vwsnd_audio_intr, 0, "vwsnd", devc);
3335 devc->audio_minor = register_sound_dsp(&vwsnd_audio_fops, -1);
3336 if ((err = devc->audio_minor) < 0) {
3342 devc->mixer_minor = register_sound_mixer(&vwsnd_mixer_fops,
3343 devc->audio_minor >> 4);
3344 if ((err = devc->mixer_minor) < 0) {
3353 hw_config->slots[0] = devc->audio_minor;
3355 /* Initialize as much of *devc as possible */
3357 mutex_init(&devc->open_mutex);
3358 mutex_init(&devc->io_mutex);
3359 mutex_init(&devc->mix_mutex);
3360 devc->open_mode = 0;
3361 spin_lock_init(&devc->rport.lock);
3362 init_waitqueue_head(&devc->rport.queue);
3363 devc->rport.swstate = SW_OFF;
3364 devc->rport.hwstate = HW_STOPPED;
3365 devc->rport.flags = 0;
3366 devc->rport.swbuf = NULL;
3367 spin_lock_init(&devc->wport.lock);
3368 init_waitqueue_head(&devc->wport.queue);
3369 devc->wport.swstate = SW_OFF;
3370 devc->wport.hwstate = HW_STOPPED;
3371 devc->wport.flags = 0;
3372 devc->wport.swbuf = NULL;
3376 devc->next_dev = vwsnd_dev_list;
3377 vwsnd_dev_list = devc;
3378 return devc->audio_minor;
3383 unregister_sound_dsp(devc->audio_minor);
3385 free_irq(hw_config->irq, devc);
3388 free_pages(devc->wport.hwbuf_vaddr, HWBUF_ORDER);
3390 free_pages(devc->rport.hwbuf_vaddr, HWBUF_ORDER);
3392 li_destroy(&devc->lith);
3394 kfree(devc);
3401 vwsnd_dev_t *devc, **devcp;
3406 while ((devc = *devcp)) {
3407 if (devc->audio_minor == hw_config->slots[0]) {
3408 *devcp = devc->next_dev;
3411 devcp = &devc->next_dev;
3414 if (!devc)
3417 unregister_sound_mixer(devc->mixer_minor);
3418 unregister_sound_dsp(devc->audio_minor);
3419 free_irq(hw_config->irq, devc);
3420 free_pages(devc->wport.hwbuf_vaddr, HWBUF_ORDER);
3421 free_pages(devc->rport.hwbuf_vaddr, HWBUF_ORDER);
3422 li_destroy(&devc->lith);
3423 kfree(devc);