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

TOMOYO Linux Cross Reference
Linux/sound/drivers/pcsp/pcsp.h

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/drivers/pcsp/pcsp.h (Version linux-6.12-rc7) and /sound/drivers/pcsp/pcsp.h (Version linux-4.18.20)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*                                                  2 /*
  3  * PC-Speaker driver for Linux                      3  * PC-Speaker driver for Linux
  4  *                                                  4  *
  5  * Copyright (C) 1993-1997  Michael Beck            5  * Copyright (C) 1993-1997  Michael Beck
  6  * Copyright (C) 1997-2001  David Woodhouse         6  * Copyright (C) 1997-2001  David Woodhouse
  7  * Copyright (C) 2001-2008  Stas Sergeev            7  * Copyright (C) 2001-2008  Stas Sergeev
  8  */                                                 8  */
  9                                                     9 
 10 #ifndef __PCSP_H__                                 10 #ifndef __PCSP_H__
 11 #define __PCSP_H__                                 11 #define __PCSP_H__
 12                                                    12 
 13 #include <linux/hrtimer.h>                         13 #include <linux/hrtimer.h>
 14 #include <linux/i8253.h>                           14 #include <linux/i8253.h>
 15 #include <linux/timex.h>                           15 #include <linux/timex.h>
 16                                                    16 
 17 #define PCSP_SOUND_VERSION 0x400        /* rea     17 #define PCSP_SOUND_VERSION 0x400        /* read 4.00 */
 18 #define PCSP_DEBUG 0                               18 #define PCSP_DEBUG 0
 19                                                    19 
 20 /* default timer freq for PC-Speaker: 18643 Hz     20 /* default timer freq for PC-Speaker: 18643 Hz */
 21 #define DIV_18KHZ 64                               21 #define DIV_18KHZ 64
 22 #define MAX_DIV DIV_18KHZ                          22 #define MAX_DIV DIV_18KHZ
 23 #define CALC_DIV(d) (MAX_DIV >> (d))               23 #define CALC_DIV(d) (MAX_DIV >> (d))
 24 #define CUR_DIV() CALC_DIV(chip->treble)           24 #define CUR_DIV() CALC_DIV(chip->treble)
 25 #define PCSP_MAX_TREBLE 1                          25 #define PCSP_MAX_TREBLE 1
 26                                                    26 
 27 /* unfortunately, with hrtimers 37KHz does not     27 /* unfortunately, with hrtimers 37KHz does not work very well :( */
 28 #define PCSP_DEFAULT_TREBLE 0                      28 #define PCSP_DEFAULT_TREBLE 0
 29 #define MIN_DIV (MAX_DIV >> PCSP_MAX_TREBLE)       29 #define MIN_DIV (MAX_DIV >> PCSP_MAX_TREBLE)
 30                                                    30 
 31 /* wild guess */                                   31 /* wild guess */
 32 #define PCSP_MIN_LPJ 1000000                       32 #define PCSP_MIN_LPJ 1000000
 33 #define PCSP_DEFAULT_SDIV (DIV_18KHZ >> 1)         33 #define PCSP_DEFAULT_SDIV (DIV_18KHZ >> 1)
 34 #define PCSP_DEFAULT_SRATE (PIT_TICK_RATE / PC     34 #define PCSP_DEFAULT_SRATE (PIT_TICK_RATE / PCSP_DEFAULT_SDIV)
 35 #define PCSP_INDEX_INC() (1 << (PCSP_MAX_TREBL     35 #define PCSP_INDEX_INC() (1 << (PCSP_MAX_TREBLE - chip->treble))
 36 #define PCSP_CALC_RATE(i) (PIT_TICK_RATE / CAL     36 #define PCSP_CALC_RATE(i) (PIT_TICK_RATE / CALC_DIV(i))
 37 #define PCSP_RATE() PCSP_CALC_RATE(chip->trebl     37 #define PCSP_RATE() PCSP_CALC_RATE(chip->treble)
 38 #define PCSP_MIN_RATE__1 MAX_DIV/PIT_TICK_RATE     38 #define PCSP_MIN_RATE__1 MAX_DIV/PIT_TICK_RATE
 39 #define PCSP_MAX_RATE__1 MIN_DIV/PIT_TICK_RATE     39 #define PCSP_MAX_RATE__1 MIN_DIV/PIT_TICK_RATE
 40 #define PCSP_MAX_PERIOD_NS (1000000000ULL * PC     40 #define PCSP_MAX_PERIOD_NS (1000000000ULL * PCSP_MIN_RATE__1)
 41 #define PCSP_MIN_PERIOD_NS (1000000000ULL * PC     41 #define PCSP_MIN_PERIOD_NS (1000000000ULL * PCSP_MAX_RATE__1)
 42 #define PCSP_CALC_NS(div) ({ \                     42 #define PCSP_CALC_NS(div) ({ \
 43         u64 __val = 1000000000ULL * (div); \       43         u64 __val = 1000000000ULL * (div); \
 44         do_div(__val, PIT_TICK_RATE); \            44         do_div(__val, PIT_TICK_RATE); \
 45         __val; \                                   45         __val; \
 46 })                                                 46 })
 47 #define PCSP_PERIOD_NS() PCSP_CALC_NS(CUR_DIV(     47 #define PCSP_PERIOD_NS() PCSP_CALC_NS(CUR_DIV())
 48                                                    48 
 49 #define PCSP_MAX_PERIOD_SIZE    (64*1024)          49 #define PCSP_MAX_PERIOD_SIZE    (64*1024)
 50 #define PCSP_MAX_PERIODS        512                50 #define PCSP_MAX_PERIODS        512
 51 #define PCSP_BUFFER_SIZE        (128*1024)         51 #define PCSP_BUFFER_SIZE        (128*1024)
 52                                                    52 
 53 struct snd_pcsp {                                  53 struct snd_pcsp {
 54         struct snd_card *card;                     54         struct snd_card *card;
 55         struct snd_pcm *pcm;                       55         struct snd_pcm *pcm;
 56         struct input_dev *input_dev;               56         struct input_dev *input_dev;
 57         struct hrtimer timer;                      57         struct hrtimer timer;
 58         unsigned short port, irq, dma;             58         unsigned short port, irq, dma;
 59         spinlock_t substream_lock;                 59         spinlock_t substream_lock;
 60         struct snd_pcm_substream *playback_sub     60         struct snd_pcm_substream *playback_substream;
 61         unsigned int fmt_size;                     61         unsigned int fmt_size;
 62         unsigned int is_signed;                    62         unsigned int is_signed;
 63         size_t playback_ptr;                       63         size_t playback_ptr;
 64         size_t period_ptr;                         64         size_t period_ptr;
 65         atomic_t timer_active;                     65         atomic_t timer_active;
 66         int thalf;                                 66         int thalf;
 67         u64 ns_rem;                                67         u64 ns_rem;
 68         unsigned char val61;                       68         unsigned char val61;
 69         int enable;                                69         int enable;
 70         int max_treble;                            70         int max_treble;
 71         int treble;                                71         int treble;
 72         int pcspkr;                                72         int pcspkr;
 73 };                                                 73 };
 74                                                    74 
 75 extern struct snd_pcsp pcsp_chip;                  75 extern struct snd_pcsp pcsp_chip;
 76                                                    76 
 77 extern enum hrtimer_restart pcsp_do_timer(stru     77 extern enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle);
 78 extern void pcsp_sync_stop(struct snd_pcsp *ch     78 extern void pcsp_sync_stop(struct snd_pcsp *chip);
 79                                                    79 
 80 extern int snd_pcsp_new_pcm(struct snd_pcsp *c     80 extern int snd_pcsp_new_pcm(struct snd_pcsp *chip);
 81 extern int snd_pcsp_new_mixer(struct snd_pcsp      81 extern int snd_pcsp_new_mixer(struct snd_pcsp *chip, int nopcm);
 82                                                    82 
 83 #endif                                             83 #endif
 84                                                    84 

~ [ 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