Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[sfrench/cifs-2.6.git] / sound / soc / intel / skylake / skl-nhlt.h
1 /*
2  *  skl-nhlt.h - Intel HDA Platform NHLT header
3  *
4  *  Copyright (C) 2015 Intel Corp
5  *  Author: Sanjiv Kumar <sanjiv.kumar@intel.com>
6  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; version 2 of the License.
11  *
12  *  This program is distributed in the hope that it will be useful, but
13  *  WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  General Public License for more details.
16  *
17  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18  *
19  */
20 #ifndef __SKL_NHLT_H__
21 #define __SKL_NHLT_H__
22
23 #include <linux/acpi.h>
24
25 struct wav_fmt {
26         u16 fmt_tag;
27         u16 channels;
28         u32 samples_per_sec;
29         u32 avg_bytes_per_sec;
30         u16 block_align;
31         u16 bits_per_sample;
32         u16 cb_size;
33 } __packed;
34
35 struct wav_fmt_ext {
36         struct wav_fmt fmt;
37         union samples {
38                 u16 valid_bits_per_sample;
39                 u16 samples_per_block;
40                 u16 reserved;
41         } sample;
42         u32 channel_mask;
43         u8 sub_fmt[16];
44 } __packed;
45
46 enum nhlt_link_type {
47         NHLT_LINK_HDA = 0,
48         NHLT_LINK_DSP = 1,
49         NHLT_LINK_DMIC = 2,
50         NHLT_LINK_SSP = 3,
51         NHLT_LINK_INVALID
52 };
53
54 enum nhlt_device_type {
55         NHLT_DEVICE_BT = 0,
56         NHLT_DEVICE_DMIC = 1,
57         NHLT_DEVICE_I2S = 4,
58         NHLT_DEVICE_INVALID
59 };
60
61 struct nhlt_specific_cfg {
62         u32 size;
63         u8 caps[0];
64 } __packed;
65
66 struct nhlt_fmt_cfg {
67         struct wav_fmt_ext fmt_ext;
68         struct nhlt_specific_cfg config;
69 } __packed;
70
71 struct nhlt_fmt {
72         u8 fmt_count;
73         struct nhlt_fmt_cfg fmt_config[0];
74 } __packed;
75
76 struct nhlt_endpoint {
77         u32  length;
78         u8   linktype;
79         u8   instance_id;
80         u16  vendor_id;
81         u16  device_id;
82         u16  revision_id;
83         u32  subsystem_id;
84         u8   device_type;
85         u8   direction;
86         u8   virtual_bus_id;
87         struct nhlt_specific_cfg config;
88 } __packed;
89
90 struct nhlt_acpi_table {
91         struct acpi_table_header header;
92         u8 endpoint_count;
93         struct nhlt_endpoint desc[0];
94 } __packed;
95
96 struct nhlt_resource_desc  {
97         u32 extra;
98         u16 flags;
99         u64 addr_spc_gra;
100         u64 min_addr;
101         u64 max_addr;
102         u64 addr_trans_offset;
103         u64 length;
104 } __packed;
105
106 #define MIC_ARRAY_2CH 2
107 #define MIC_ARRAY_4CH 4
108
109 struct nhlt_tdm_config {
110         u8 virtual_slot;
111         u8 config_type;
112 } __packed;
113
114 struct nhlt_dmic_array_config {
115         struct nhlt_tdm_config tdm_config;
116         u8 array_type;
117 } __packed;
118
119 enum {
120         NHLT_MIC_ARRAY_2CH_SMALL = 0xa,
121         NHLT_MIC_ARRAY_2CH_BIG = 0xb,
122         NHLT_MIC_ARRAY_4CH_1ST_GEOM = 0xc,
123         NHLT_MIC_ARRAY_4CH_L_SHAPED = 0xd,
124         NHLT_MIC_ARRAY_4CH_2ND_GEOM = 0xe,
125         NHLT_MIC_ARRAY_VENDOR_DEFINED = 0xf,
126 };
127
128 #endif