forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/soundwire/cadence_master.h
....@@ -1,14 +1,16 @@
1
-// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
2
-// Copyright(c) 2015-17 Intel Corporation.
1
+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
2
+/* Copyright(c) 2015-17 Intel Corporation. */
33 #include <sound/soc.h>
44
55 #ifndef __SDW_CADENCE_H
66 #define __SDW_CADENCE_H
77
8
+#define SDW_CADENCE_GSYNC_KHZ 4 /* 4 kHz */
9
+#define SDW_CADENCE_GSYNC_HZ (SDW_CADENCE_GSYNC_KHZ * 1000)
10
+
811 /**
912 * struct sdw_cdns_pdi: PDI (Physical Data Interface) instance
1013 *
11
- * @assigned: pdi assigned
1214 * @num: pdi number
1315 * @intel_alh_id: link identifier
1416 * @l_ch_num: low channel for PDI
....@@ -18,7 +20,6 @@
1820 * @type: stream type, PDM or PCM
1921 */
2022 struct sdw_cdns_pdi {
21
- bool assigned;
2223 int num;
2324 int intel_alh_id;
2425 int l_ch_num;
....@@ -26,23 +27,6 @@
2627 int ch_count;
2728 enum sdw_data_direction dir;
2829 enum sdw_stream_type type;
29
-};
30
-
31
-/**
32
- * struct sdw_cdns_port: Cadence port structure
33
- *
34
- * @num: port number
35
- * @assigned: port assigned
36
- * @ch: channel count
37
- * @direction: data port direction
38
- * @pdi: pdi for this port
39
- */
40
-struct sdw_cdns_port {
41
- unsigned int num;
42
- bool assigned;
43
- unsigned int ch;
44
- enum sdw_data_direction direction;
45
- struct sdw_cdns_pdi *pdi;
4630 };
4731
4832 /**
....@@ -95,20 +79,23 @@
9579 * struct sdw_cdns_dma_data: Cadence DMA data
9680 *
9781 * @name: SoundWire stream name
98
- * @nr_ports: Number of ports
99
- * @port: Ports
82
+ * @stream: stream runtime
83
+ * @pdi: PDI used for this dai
10084 * @bus: Bus handle
10185 * @stream_type: Stream type
10286 * @link_id: Master link id
87
+ * @hw_params: hw_params to be applied in .prepare step
88
+ * @suspended: status set when suspended, to be used in .prepare
10389 */
10490 struct sdw_cdns_dma_data {
10591 char *name;
10692 struct sdw_stream_runtime *stream;
107
- int nr_ports;
108
- struct sdw_cdns_port **port;
93
+ struct sdw_cdns_pdi *pdi;
10994 struct sdw_bus *bus;
11095 enum sdw_stream_type stream_type;
11196 int link_id;
97
+ struct snd_pcm_hw_params *hw_params;
98
+ bool suspended;
11299 };
113100
114101 /**
....@@ -146,6 +133,11 @@
146133
147134 bool link_up;
148135 unsigned int msg_count;
136
+ bool interrupt_enabled;
137
+
138
+ struct work_struct work;
139
+
140
+ struct list_head list;
149141 };
150142
151143 #define bus_to_cdns(_bus) container_of(_bus, struct sdw_cdns, bus)
....@@ -160,24 +152,23 @@
160152
161153 int sdw_cdns_init(struct sdw_cdns *cdns);
162154 int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
163
- struct sdw_cdns_stream_config config);
164
-int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns);
155
+ struct sdw_cdns_stream_config config);
156
+int sdw_cdns_exit_reset(struct sdw_cdns *cdns);
157
+int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns, bool state);
165158
166
-int sdw_cdns_get_stream(struct sdw_cdns *cdns,
167
- struct sdw_cdns_streams *stream,
168
- u32 ch, u32 dir);
169
-int sdw_cdns_alloc_stream(struct sdw_cdns *cdns,
170
- struct sdw_cdns_streams *stream,
171
- struct sdw_cdns_port *port, u32 ch, u32 dir);
172
-void sdw_cdns_config_stream(struct sdw_cdns *cdns, struct sdw_cdns_port *port,
173
- u32 ch, u32 dir, struct sdw_cdns_pdi *pdi);
159
+bool sdw_cdns_is_clock_stop(struct sdw_cdns *cdns);
160
+int sdw_cdns_clock_stop(struct sdw_cdns *cdns, bool block_wake);
161
+int sdw_cdns_clock_restart(struct sdw_cdns *cdns, bool bus_reset);
174162
175
-void sdw_cdns_shutdown(struct snd_pcm_substream *substream,
176
- struct snd_soc_dai *dai);
177
-int sdw_cdns_pcm_set_stream(struct snd_soc_dai *dai,
178
- void *stream, int direction);
179
-int sdw_cdns_pdm_set_stream(struct snd_soc_dai *dai,
180
- void *stream, int direction);
163
+#ifdef CONFIG_DEBUG_FS
164
+void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root);
165
+#endif
166
+
167
+struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns,
168
+ struct sdw_cdns_streams *stream,
169
+ u32 ch, u32 dir, int dai_id);
170
+void sdw_cdns_config_stream(struct sdw_cdns *cdns,
171
+ u32 ch, u32 dir, struct sdw_cdns_pdi *pdi);
181172
182173 enum sdw_command_response
183174 cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num);
....@@ -187,7 +178,7 @@
187178
188179 enum sdw_command_response
189180 cdns_xfer_msg_defer(struct sdw_bus *bus,
190
- struct sdw_msg *msg, struct sdw_defer *defer);
181
+ struct sdw_msg *msg, struct sdw_defer *defer);
191182
192183 enum sdw_command_response
193184 cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num);
....@@ -195,5 +186,5 @@
195186 int cdns_bus_conf(struct sdw_bus *bus, struct sdw_bus_params *params);
196187
197188 int cdns_set_sdw_stream(struct snd_soc_dai *dai,
198
- void *stream, bool pcm, int direction);
189
+ void *stream, bool pcm, int direction);
199190 #endif /* __SDW_CADENCE_H */