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

TOMOYO Linux Cross Reference
Linux/sound/soc/qcom/qdsp6/q6dsp-common.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 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 // Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
  3 // Copyright (c) 2018, Linaro Limited
  4 
  5 #include "q6dsp-common.h"
  6 #include <linux/kernel.h>
  7 #include <linux/module.h>
  8 #include <linux/string.h>
  9 #include <linux/errno.h>
 10 
 11 int q6dsp_map_channels(u8 ch_map[PCM_MAX_NUM_CHANNEL], int ch)
 12 {
 13         memset(ch_map, 0, PCM_MAX_NUM_CHANNEL);
 14 
 15         switch (ch) {
 16         case 1:
 17                 ch_map[0] = PCM_CHANNEL_FC;
 18                 break;
 19         case 2:
 20                 ch_map[0] = PCM_CHANNEL_FL;
 21                 ch_map[1] = PCM_CHANNEL_FR;
 22                 break;
 23         case 3:
 24                 ch_map[0] = PCM_CHANNEL_FL;
 25                 ch_map[1] = PCM_CHANNEL_FR;
 26                 ch_map[2] = PCM_CHANNEL_FC;
 27                 break;
 28         case 4:
 29                 ch_map[0] = PCM_CHANNEL_FL;
 30                 ch_map[1] = PCM_CHANNEL_FR;
 31                 ch_map[2] = PCM_CHANNEL_LS;
 32                 ch_map[3] = PCM_CHANNEL_RS;
 33                 break;
 34         case 5:
 35                 ch_map[0] = PCM_CHANNEL_FL;
 36                 ch_map[1] = PCM_CHANNEL_FR;
 37                 ch_map[2] = PCM_CHANNEL_FC;
 38                 ch_map[3] = PCM_CHANNEL_LS;
 39                 ch_map[4] = PCM_CHANNEL_RS;
 40                 break;
 41         case 6:
 42                 ch_map[0] = PCM_CHANNEL_FL;
 43                 ch_map[1] = PCM_CHANNEL_FR;
 44                 ch_map[2] = PCM_CHANNEL_LFE;
 45                 ch_map[3] = PCM_CHANNEL_FC;
 46                 ch_map[4] = PCM_CHANNEL_LS;
 47                 ch_map[5] = PCM_CHANNEL_RS;
 48                 break;
 49         case 8:
 50                 ch_map[0] = PCM_CHANNEL_FL;
 51                 ch_map[1] = PCM_CHANNEL_FR;
 52                 ch_map[2] = PCM_CHANNEL_LFE;
 53                 ch_map[3] = PCM_CHANNEL_FC;
 54                 ch_map[4] = PCM_CHANNEL_LS;
 55                 ch_map[5] = PCM_CHANNEL_RS;
 56                 ch_map[6] = PCM_CHANNEL_LB;
 57                 ch_map[7] = PCM_CHANNEL_RB;
 58                 break;
 59         default:
 60                 return -EINVAL;
 61         }
 62 
 63         return 0;
 64 }
 65 EXPORT_SYMBOL_GPL(q6dsp_map_channels);
 66 
 67 int q6dsp_get_channel_allocation(int channels)
 68 {
 69         int channel_allocation;
 70 
 71         /* HDMI spec CEA-861-E: Table 28 Audio InfoFrame Data Byte 4 */
 72         switch (channels) {
 73         case 2:
 74                 channel_allocation = 0;
 75                 break;
 76         case 3:
 77                 channel_allocation = 0x02;
 78                 break;
 79         case 4:
 80                 channel_allocation = 0x06;
 81                 break;
 82         case 5:
 83                 channel_allocation = 0x0A;
 84                 break;
 85         case 6:
 86                 channel_allocation = 0x0B;
 87                 break;
 88         case 7:
 89                 channel_allocation = 0x12;
 90                 break;
 91         case 8:
 92                 channel_allocation = 0x13;
 93                 break;
 94         default:
 95                 return -EINVAL;
 96         }
 97 
 98         return channel_allocation;
 99 }
100 EXPORT_SYMBOL_GPL(q6dsp_get_channel_allocation);
101 
102 MODULE_DESCRIPTION("ASoC MSM QDSP6 helper functions");
103 MODULE_LICENSE("GPL v2");
104 

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