~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/pci/emu10k1/timer.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /sound/pci/emu10k1/timer.c (Version linux-6.12-rc7) and /sound/pci/emu10k1/timer.c (Version linux-5.8.18)


  1 // SPDX-License-Identifier: GPL-2.0-or-later        1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*                                                  2 /*
  3  *  Copyright (c) by Lee Revell <rlrevell@joe-      3  *  Copyright (c) by Lee Revell <rlrevell@joe-job.com>
  4  *                   Clemens Ladisch <clemens@      4  *                   Clemens Ladisch <clemens@ladisch.de>
  5  *                   Oswald Buddenhagen <oswal << 
  6  *                                             << 
  7  *  Routines for control of EMU10K1 chips           5  *  Routines for control of EMU10K1 chips
                                                   >>   6  *
                                                   >>   7  *  BUGS:
                                                   >>   8  *    --
                                                   >>   9  *
                                                   >>  10  *  TODO:
                                                   >>  11  *    --
  8  */                                                12  */
  9                                                    13 
 10 #include <linux/time.h>                            14 #include <linux/time.h>
 11 #include <sound/core.h>                            15 #include <sound/core.h>
 12 #include <sound/emu10k1.h>                         16 #include <sound/emu10k1.h>
 13                                                    17 
 14 static int snd_emu10k1_timer_start(struct snd_     18 static int snd_emu10k1_timer_start(struct snd_timer *timer)
 15 {                                                  19 {
 16         struct snd_emu10k1 *emu;                   20         struct snd_emu10k1 *emu;
                                                   >>  21         unsigned long flags;
 17         unsigned int delay;                        22         unsigned int delay;
 18                                                    23 
 19         emu = snd_timer_chip(timer);               24         emu = snd_timer_chip(timer);
 20         delay = timer->sticks - 1;                 25         delay = timer->sticks - 1;
 21         if (delay < 5 ) /* minimum time is 5 t     26         if (delay < 5 ) /* minimum time is 5 ticks */
 22                 delay = 5;                         27                 delay = 5;
                                                   >>  28         spin_lock_irqsave(&emu->reg_lock, flags);
 23         snd_emu10k1_intr_enable(emu, INTE_INTE     29         snd_emu10k1_intr_enable(emu, INTE_INTERVALTIMERENB);
 24         outw(delay & TIMER_RATE_MASK, emu->por     30         outw(delay & TIMER_RATE_MASK, emu->port + TIMER);
                                                   >>  31         spin_unlock_irqrestore(&emu->reg_lock, flags);
 25         return 0;                                  32         return 0;
 26 }                                                  33 }
 27                                                    34 
 28 static int snd_emu10k1_timer_stop(struct snd_t     35 static int snd_emu10k1_timer_stop(struct snd_timer *timer)
 29 {                                                  36 {
 30         struct snd_emu10k1 *emu;                   37         struct snd_emu10k1 *emu;
                                                   >>  38         unsigned long flags;
 31                                                    39 
 32         emu = snd_timer_chip(timer);               40         emu = snd_timer_chip(timer);
                                                   >>  41         spin_lock_irqsave(&emu->reg_lock, flags);
 33         snd_emu10k1_intr_disable(emu, INTE_INT     42         snd_emu10k1_intr_disable(emu, INTE_INTERVALTIMERENB);
                                                   >>  43         spin_unlock_irqrestore(&emu->reg_lock, flags);
 34         return 0;                                  44         return 0;
 35 }                                                  45 }
 36                                                    46 
 37 static unsigned long snd_emu10k1_timer_c_resol << 
 38 {                                              << 
 39         struct snd_emu10k1 *emu = snd_timer_ch << 
 40                                                << 
 41         if (emu->card_capabilities->emu_model  << 
 42             emu->emu1010.word_clock == 44100)  << 
 43                 return 22676;  // 1 sample @ 4 << 
 44         else                                   << 
 45                 return 20833;  // 1 sample @ 4 << 
 46 }                                              << 
 47                                                << 
 48 static int snd_emu10k1_timer_precise_resolutio     47 static int snd_emu10k1_timer_precise_resolution(struct snd_timer *timer,
 49                                                    48                                                unsigned long *num, unsigned long *den)
 50 {                                                  49 {
 51         struct snd_emu10k1 *emu = snd_timer_ch << 
 52                                                << 
 53         *num = 1;                                  50         *num = 1;
 54         if (emu->card_capabilities->emu_model) !!  51         *den = 48000;
 55                 *den = emu->emu1010.word_clock << 
 56         else                                   << 
 57                 *den = 48000;                  << 
 58         return 0;                                  52         return 0;
 59 }                                                  53 }
 60                                                    54 
 61 static const struct snd_timer_hardware snd_emu     55 static const struct snd_timer_hardware snd_emu10k1_timer_hw = {
 62         .flags = SNDRV_TIMER_HW_AUTO,              56         .flags = SNDRV_TIMER_HW_AUTO,
                                                   >>  57         .resolution = 20833, /* 1 sample @ 48KHZ = 20.833...us */
 63         .ticks = 1024,                             58         .ticks = 1024,
 64         .start = snd_emu10k1_timer_start,          59         .start = snd_emu10k1_timer_start,
 65         .stop = snd_emu10k1_timer_stop,            60         .stop = snd_emu10k1_timer_stop,
 66         .c_resolution = snd_emu10k1_timer_c_re << 
 67         .precise_resolution = snd_emu10k1_time     61         .precise_resolution = snd_emu10k1_timer_precise_resolution,
 68 };                                                 62 };
 69                                                    63 
 70 int snd_emu10k1_timer(struct snd_emu10k1 *emu,     64 int snd_emu10k1_timer(struct snd_emu10k1 *emu, int device)
 71 {                                                  65 {
 72         struct snd_timer *timer = NULL;            66         struct snd_timer *timer = NULL;
 73         struct snd_timer_id tid;                   67         struct snd_timer_id tid;
 74         int err;                                   68         int err;
 75                                                    69 
 76         tid.dev_class = SNDRV_TIMER_CLASS_CARD     70         tid.dev_class = SNDRV_TIMER_CLASS_CARD;
 77         tid.dev_sclass = SNDRV_TIMER_SCLASS_NO     71         tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE;
 78         tid.card = emu->card->number;              72         tid.card = emu->card->number;
 79         tid.device = device;                       73         tid.device = device;
 80         tid.subdevice = 0;                         74         tid.subdevice = 0;
 81         err = snd_timer_new(emu->card, "EMU10K !!  75         if ((err = snd_timer_new(emu->card, "EMU10K1", &tid, &timer)) >= 0) {
 82         if (err >= 0) {                        << 
 83                 strcpy(timer->name, "EMU10K1 t     76                 strcpy(timer->name, "EMU10K1 timer");
 84                 timer->private_data = emu;         77                 timer->private_data = emu;
 85                 timer->hw = snd_emu10k1_timer_     78                 timer->hw = snd_emu10k1_timer_hw;
 86         }                                          79         }
 87         emu->timer = timer;                        80         emu->timer = timer;
 88         return err;                                81         return err;
 89 }                                                  82 }
 90                                                    83 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php