Blame view

include/sound/intel-nhlt.h 2.71 KB
8e8e69d67   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-only */
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
2
  /*
303681f43   Pierre-Louis Bossart   ALSA: hda: move p...
3
   *  intel-nhlt.h - Intel HDA Platform NHLT header
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
4
   *
303681f43   Pierre-Louis Bossart   ALSA: hda: move p...
5
   *  Copyright (c) 2015-2019 Intel Corporation
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
6
   */
303681f43   Pierre-Louis Bossart   ALSA: hda: move p...
7
8
9
  
  #ifndef __INTEL_NHLT_H__
  #define __INTEL_NHLT_H__
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
10

aba3dd5ac   Jeeja KP   ASoC: Intel: Skyl...
11
  #include <linux/acpi.h>
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
12

303681f43   Pierre-Louis Bossart   ALSA: hda: move p...
13
  #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_INTEL_NHLT)
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  struct wav_fmt {
  	u16 fmt_tag;
  	u16 channels;
  	u32 samples_per_sec;
  	u32 avg_bytes_per_sec;
  	u16 block_align;
  	u16 bits_per_sample;
  	u16 cb_size;
  } __packed;
  
  struct wav_fmt_ext {
  	struct wav_fmt fmt;
  	union samples {
  		u16 valid_bits_per_sample;
  		u16 samples_per_block;
  		u16 reserved;
  	} sample;
  	u32 channel_mask;
  	u8 sub_fmt[16];
  } __packed;
  
  enum nhlt_link_type {
  	NHLT_LINK_HDA = 0,
  	NHLT_LINK_DSP = 1,
  	NHLT_LINK_DMIC = 2,
  	NHLT_LINK_SSP = 3,
  	NHLT_LINK_INVALID
  };
  
  enum nhlt_device_type {
  	NHLT_DEVICE_BT = 0,
  	NHLT_DEVICE_DMIC = 1,
  	NHLT_DEVICE_I2S = 4,
  	NHLT_DEVICE_INVALID
  };
  
  struct nhlt_specific_cfg {
  	u32 size;
9ad06ebb9   Gustavo A. R. Silva   ALSA: Replace zer...
52
  	u8 caps[];
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
53
54
55
56
57
58
59
60
61
  } __packed;
  
  struct nhlt_fmt_cfg {
  	struct wav_fmt_ext fmt_ext;
  	struct nhlt_specific_cfg config;
  } __packed;
  
  struct nhlt_fmt {
  	u8 fmt_count;
9ad06ebb9   Gustavo A. R. Silva   ALSA: Replace zer...
62
  	struct nhlt_fmt_cfg fmt_config[];
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  } __packed;
  
  struct nhlt_endpoint {
  	u32  length;
  	u8   linktype;
  	u8   instance_id;
  	u16  vendor_id;
  	u16  device_id;
  	u16  revision_id;
  	u32  subsystem_id;
  	u8   device_type;
  	u8   direction;
  	u8   virtual_bus_id;
  	struct nhlt_specific_cfg config;
  } __packed;
  
  struct nhlt_acpi_table {
aba3dd5ac   Jeeja KP   ASoC: Intel: Skyl...
80
  	struct acpi_table_header header;
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
81
  	u8 endpoint_count;
9ad06ebb9   Gustavo A. R. Silva   ALSA: Replace zer...
82
  	struct nhlt_endpoint desc[];
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
83
84
85
86
87
88
89
90
91
92
93
  } __packed;
  
  struct nhlt_resource_desc  {
  	u32 extra;
  	u16 flags;
  	u64 addr_spc_gra;
  	u64 min_addr;
  	u64 max_addr;
  	u64 addr_trans_offset;
  	u64 length;
  } __packed;
f65cf7d66   Yong Zhi   ASoC: Intel: Skyl...
94
95
  #define MIC_ARRAY_2CH 2
  #define MIC_ARRAY_4CH 4
7a33ea70e   Pierre-Louis Bossart   ALSA: hda: intel-...
96
  struct nhlt_device_specific_config {
f65cf7d66   Yong Zhi   ASoC: Intel: Skyl...
97
98
99
100
101
  	u8 virtual_slot;
  	u8 config_type;
  } __packed;
  
  struct nhlt_dmic_array_config {
7a33ea70e   Pierre-Louis Bossart   ALSA: hda: intel-...
102
  	struct nhlt_device_specific_config device_config;
f65cf7d66   Yong Zhi   ASoC: Intel: Skyl...
103
104
  	u8 array_type;
  } __packed;
7a33ea70e   Pierre-Louis Bossart   ALSA: hda: intel-...
105
106
107
108
109
  struct nhlt_vendor_dmic_array_config {
  	struct nhlt_dmic_array_config dmic_config;
  	u8 nb_mics;
  	/* TODO add vendor mic config */
  } __packed;
f65cf7d66   Yong Zhi   ASoC: Intel: Skyl...
110
111
112
113
114
115
116
117
  enum {
  	NHLT_MIC_ARRAY_2CH_SMALL = 0xa,
  	NHLT_MIC_ARRAY_2CH_BIG = 0xb,
  	NHLT_MIC_ARRAY_4CH_1ST_GEOM = 0xc,
  	NHLT_MIC_ARRAY_4CH_L_SHAPED = 0xd,
  	NHLT_MIC_ARRAY_4CH_2ND_GEOM = 0xe,
  	NHLT_MIC_ARRAY_VENDOR_DEFINED = 0xf,
  };
303681f43   Pierre-Louis Bossart   ALSA: hda: move p...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
  struct nhlt_acpi_table *intel_nhlt_init(struct device *dev);
  
  void intel_nhlt_free(struct nhlt_acpi_table *addr);
  
  int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt);
  
  #else
  
  struct nhlt_acpi_table;
  
  static inline struct nhlt_acpi_table *intel_nhlt_init(struct device *dev)
  {
  	return NULL;
  }
  
  static inline void intel_nhlt_free(struct nhlt_acpi_table *addr)
  {
  }
  
  static inline int intel_nhlt_get_dmic_geo(struct device *dev,
  					  struct nhlt_acpi_table *nhlt)
  {
  	return 0;
  }
  #endif
473eb87ad   Jeeja KP   ASoC: Intel: Skyl...
143
  #endif