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

TOMOYO Linux Cross Reference
Linux/sound/pci/oxygen/xonar_hdmi.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/oxygen/xonar_hdmi.c (Architecture alpha) and /sound/pci/oxygen/xonar_hdmi.c (Architecture ppc)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*                                                  2 /*
  3  * helper functions for HDMI models (Xonar HDA      3  * helper functions for HDMI models (Xonar HDAV1.3/HDAV1.3 Slim)
  4  *                                                  4  *
  5  * Copyright (c) Clemens Ladisch <clemens@ladi      5  * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
  6  */                                                 6  */
  7                                                     7 
  8 #include <linux/pci.h>                              8 #include <linux/pci.h>
  9 #include <linux/delay.h>                            9 #include <linux/delay.h>
 10 #include <sound/asoundef.h>                        10 #include <sound/asoundef.h>
 11 #include <sound/control.h>                         11 #include <sound/control.h>
 12 #include <sound/core.h>                            12 #include <sound/core.h>
 13 #include <sound/pcm.h>                             13 #include <sound/pcm.h>
 14 #include <sound/pcm_params.h>                      14 #include <sound/pcm_params.h>
 15 #include <sound/tlv.h>                             15 #include <sound/tlv.h>
 16 #include "xonar.h"                                 16 #include "xonar.h"
 17                                                    17 
 18 static void hdmi_write_command(struct oxygen *     18 static void hdmi_write_command(struct oxygen *chip, u8 command,
 19                                unsigned int co     19                                unsigned int count, const u8 *params)
 20 {                                                  20 {
 21         unsigned int i;                            21         unsigned int i;
 22         u8 checksum;                               22         u8 checksum;
 23                                                    23 
 24         oxygen_write_uart(chip, 0xfb);             24         oxygen_write_uart(chip, 0xfb);
 25         oxygen_write_uart(chip, 0xef);             25         oxygen_write_uart(chip, 0xef);
 26         oxygen_write_uart(chip, command);          26         oxygen_write_uart(chip, command);
 27         oxygen_write_uart(chip, count);            27         oxygen_write_uart(chip, count);
 28         for (i = 0; i < count; ++i)                28         for (i = 0; i < count; ++i)
 29                 oxygen_write_uart(chip, params     29                 oxygen_write_uart(chip, params[i]);
 30         checksum = 0xfb + 0xef + command + cou     30         checksum = 0xfb + 0xef + command + count;
 31         for (i = 0; i < count; ++i)                31         for (i = 0; i < count; ++i)
 32                 checksum += params[i];             32                 checksum += params[i];
 33         oxygen_write_uart(chip, checksum);         33         oxygen_write_uart(chip, checksum);
 34 }                                                  34 }
 35                                                    35 
 36 static void xonar_hdmi_init_commands(struct ox     36 static void xonar_hdmi_init_commands(struct oxygen *chip,
 37                                      struct xo     37                                      struct xonar_hdmi *hdmi)
 38 {                                                  38 {
 39         u8 param;                                  39         u8 param;
 40                                                    40 
 41         oxygen_reset_uart(chip);                   41         oxygen_reset_uart(chip);
 42         param = 0;                                 42         param = 0;
 43         hdmi_write_command(chip, 0x61, 1, &par     43         hdmi_write_command(chip, 0x61, 1, &param);
 44         param = 1;                                 44         param = 1;
 45         hdmi_write_command(chip, 0x74, 1, &par     45         hdmi_write_command(chip, 0x74, 1, &param);
 46         hdmi_write_command(chip, 0x54, 5, hdmi     46         hdmi_write_command(chip, 0x54, 5, hdmi->params);
 47 }                                                  47 }
 48                                                    48 
 49 void xonar_hdmi_init(struct oxygen *chip, stru     49 void xonar_hdmi_init(struct oxygen *chip, struct xonar_hdmi *hdmi)
 50 {                                                  50 {
 51         hdmi->params[1] = IEC958_AES3_CON_FS_4     51         hdmi->params[1] = IEC958_AES3_CON_FS_48000;
 52         hdmi->params[4] = 1;                       52         hdmi->params[4] = 1;
 53         xonar_hdmi_init_commands(chip, hdmi);      53         xonar_hdmi_init_commands(chip, hdmi);
 54 }                                                  54 }
 55                                                    55 
 56 void xonar_hdmi_cleanup(struct oxygen *chip)       56 void xonar_hdmi_cleanup(struct oxygen *chip)
 57 {                                                  57 {
 58         u8 param = 0;                              58         u8 param = 0;
 59                                                    59 
 60         hdmi_write_command(chip, 0x74, 1, &par     60         hdmi_write_command(chip, 0x74, 1, &param);
 61 }                                                  61 }
 62                                                    62 
 63 void xonar_hdmi_resume(struct oxygen *chip, st     63 void xonar_hdmi_resume(struct oxygen *chip, struct xonar_hdmi *hdmi)
 64 {                                                  64 {
 65         xonar_hdmi_init_commands(chip, hdmi);      65         xonar_hdmi_init_commands(chip, hdmi);
 66 }                                                  66 }
 67                                                    67 
 68 void xonar_hdmi_pcm_hardware_filter(unsigned i     68 void xonar_hdmi_pcm_hardware_filter(unsigned int channel,
 69                                     struct snd     69                                     struct snd_pcm_hardware *hardware)
 70 {                                                  70 {
 71         if (channel == PCM_MULTICH) {              71         if (channel == PCM_MULTICH) {
 72                 hardware->rates = SNDRV_PCM_RA     72                 hardware->rates = SNDRV_PCM_RATE_44100 |
 73                                   SNDRV_PCM_RA     73                                   SNDRV_PCM_RATE_48000 |
 74                                   SNDRV_PCM_RA     74                                   SNDRV_PCM_RATE_96000 |
 75                                   SNDRV_PCM_RA     75                                   SNDRV_PCM_RATE_192000;
 76                 hardware->rate_min = 44100;        76                 hardware->rate_min = 44100;
 77         }                                          77         }
 78 }                                                  78 }
 79                                                    79 
 80 void xonar_set_hdmi_params(struct oxygen *chip     80 void xonar_set_hdmi_params(struct oxygen *chip, struct xonar_hdmi *hdmi,
 81                            struct snd_pcm_hw_p     81                            struct snd_pcm_hw_params *params)
 82 {                                                  82 {
 83         hdmi->params[0] = 0; /* 1 = non-audio      83         hdmi->params[0] = 0; /* 1 = non-audio */
 84         switch (params_rate(params)) {             84         switch (params_rate(params)) {
 85         case 44100:                                85         case 44100:
 86                 hdmi->params[1] = IEC958_AES3_     86                 hdmi->params[1] = IEC958_AES3_CON_FS_44100;
 87                 break;                             87                 break;
 88         case 48000:                                88         case 48000:
 89                 hdmi->params[1] = IEC958_AES3_     89                 hdmi->params[1] = IEC958_AES3_CON_FS_48000;
 90                 break;                             90                 break;
 91         default: /* 96000 */                       91         default: /* 96000 */
 92                 hdmi->params[1] = IEC958_AES3_     92                 hdmi->params[1] = IEC958_AES3_CON_FS_96000;
 93                 break;                             93                 break;
 94         case 192000:                               94         case 192000:
 95                 hdmi->params[1] = IEC958_AES3_     95                 hdmi->params[1] = IEC958_AES3_CON_FS_192000;
 96                 break;                             96                 break;
 97         }                                          97         }
 98         hdmi->params[2] = params_channels(para     98         hdmi->params[2] = params_channels(params) / 2 - 1;
 99         if (params_format(params) == SNDRV_PCM     99         if (params_format(params) == SNDRV_PCM_FORMAT_S16_LE)
100                 hdmi->params[3] = 0;              100                 hdmi->params[3] = 0;
101         else                                      101         else
102                 hdmi->params[3] = 0xc0;           102                 hdmi->params[3] = 0xc0;
103         hdmi->params[4] = 1; /* ? */              103         hdmi->params[4] = 1; /* ? */
104         hdmi_write_command(chip, 0x54, 5, hdmi    104         hdmi_write_command(chip, 0x54, 5, hdmi->params);
105 }                                                 105 }
106                                                   106 
107 void xonar_hdmi_uart_input(struct oxygen *chip    107 void xonar_hdmi_uart_input(struct oxygen *chip)
108 {                                                 108 {
109         if (chip->uart_input_count >= 2 &&        109         if (chip->uart_input_count >= 2 &&
110             chip->uart_input[chip->uart_input_    110             chip->uart_input[chip->uart_input_count - 2] == 'O' &&
111             chip->uart_input[chip->uart_input_    111             chip->uart_input[chip->uart_input_count - 1] == 'K') {
112                 dev_dbg(chip->card->dev, "mess    112                 dev_dbg(chip->card->dev, "message from HDMI chip received:\n");
113                 print_hex_dump_bytes("", DUMP_    113                 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
114                                      chip->uar    114                                      chip->uart_input, chip->uart_input_count);
115                 chip->uart_input_count = 0;       115                 chip->uart_input_count = 0;
116         }                                         116         }
117 }                                                 117 }
118                                                   118 

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