Skip to content

Commit 9a9b13d

Browse files
committed
Merge branch 'topic/hda-core-intel' into topic/hda-acomp
2 parents c5a59d2 + cb04ba3 commit 9a9b13d

15 files changed

Lines changed: 605 additions & 674 deletions

File tree

‎include/sound/hdaudio.h‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ struct hdac_driver {
188188
const struct hda_device_id *id_table;
189189
int (*match)(struct hdac_device *dev, struct hdac_driver *drv);
190190
void (*unsol_event)(struct hdac_device *dev, unsigned int event);
191+
192+
/* fields used by ext bus APIs */
193+
int (*probe)(struct hdac_device *dev);
194+
int (*remove)(struct hdac_device *dev);
195+
void (*shutdown)(struct hdac_device *dev);
191196
};
192197

193198
#define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
@@ -208,6 +213,14 @@ struct hdac_bus_ops {
208213
int (*link_power)(struct hdac_bus *bus, bool enable);
209214
};
210215

216+
/*
217+
* ops used for ASoC HDA codec drivers
218+
*/
219+
struct hdac_ext_bus_ops {
220+
int (*hdev_attach)(struct hdac_device *hdev);
221+
int (*hdev_detach)(struct hdac_device *hdev);
222+
};
223+
211224
/*
212225
* Lowlevel I/O operators
213226
*/
@@ -250,11 +263,17 @@ struct hdac_rb {
250263
* @mlcap: MultiLink capabilities pointer
251264
* @gtscap: gts capabilities pointer
252265
* @drsmcap: dma resume capabilities pointer
266+
* @num_streams: streams supported
267+
* @idx: HDA link index
268+
* @hlink_list: link list of HDA links
269+
* @lock: lock for link mgmt
270+
* @cmd_dma_state: state of cmd DMAs: CORB and RIRB
253271
*/
254272
struct hdac_bus {
255273
struct device *dev;
256274
const struct hdac_bus_ops *ops;
257275
const struct hdac_io_ops *io_ops;
276+
const struct hdac_ext_bus_ops *ext_ops;
258277

259278
/* h/w resources */
260279
unsigned long addr;
@@ -317,6 +336,16 @@ struct hdac_bus {
317336
/* i915 component interface */
318337
struct i915_audio_component *audio_component;
319338
int i915_power_refcount;
339+
340+
/* parameters required for enhanced capabilities */
341+
int num_streams;
342+
int idx;
343+
344+
struct list_head hlink_list;
345+
346+
struct mutex lock;
347+
bool cmd_dma_state;
348+
320349
};
321350

322351
int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,

‎include/sound/hdaudio_ext.h‎

Lines changed: 29 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,16 @@
44

55
#include <sound/hdaudio.h>
66

7-
/**
8-
* hdac_ext_bus: HDAC extended bus for extended HDA caps
9-
*
10-
* @bus: hdac bus
11-
* @num_streams: streams supported
12-
* @hlink_list: link list of HDA links
13-
* @lock: lock for link mgmt
14-
* @cmd_dma_state: state of cmd DMAs: CORB and RIRB
15-
*/
16-
struct hdac_ext_bus {
17-
struct hdac_bus bus;
18-
int num_streams;
19-
int idx;
20-
21-
struct list_head hlink_list;
22-
23-
struct mutex lock;
24-
bool cmd_dma_state;
25-
};
26-
27-
int snd_hdac_ext_bus_init(struct hdac_ext_bus *sbus, struct device *dev,
7+
int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
288
const struct hdac_bus_ops *ops,
29-
const struct hdac_io_ops *io_ops);
9+
const struct hdac_io_ops *io_ops,
10+
const struct hdac_ext_bus_ops *ext_ops);
3011

31-
void snd_hdac_ext_bus_exit(struct hdac_ext_bus *sbus);
32-
int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *sbus, int addr);
12+
void snd_hdac_ext_bus_exit(struct hdac_bus *bus);
13+
int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr,
14+
struct hdac_device *hdev);
3315
void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev);
34-
void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus);
35-
36-
#define ebus_to_hbus(ebus) (&(ebus)->bus)
37-
#define hbus_to_ebus(_bus) \
38-
container_of(_bus, struct hdac_ext_bus, bus)
16+
void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus);
3917

4018
#define HDA_CODEC_REV_EXT_ENTRY(_vid, _rev, _name, drv_data) \
4119
{ .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \
@@ -44,14 +22,14 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus);
4422
#define HDA_CODEC_EXT_ENTRY(_vid, _revid, _name, _drv_data) \
4523
HDA_CODEC_REV_EXT_ENTRY(_vid, _revid, _name, _drv_data)
4624

47-
void snd_hdac_ext_bus_ppcap_enable(struct hdac_ext_bus *chip, bool enable);
48-
void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_ext_bus *chip, bool enable);
25+
void snd_hdac_ext_bus_ppcap_enable(struct hdac_bus *chip, bool enable);
26+
void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_bus *chip, bool enable);
4927

50-
void snd_hdac_ext_stream_spbcap_enable(struct hdac_ext_bus *chip,
28+
void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *chip,
5129
bool enable, int index);
5230

53-
int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *bus);
54-
struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *bus,
31+
int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus);
32+
struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,
5533
const char *codec_name);
5634

5735
enum hdac_ext_stream_type {
@@ -100,28 +78,28 @@ struct hdac_ext_stream {
10078
#define stream_to_hdac_ext_stream(s) \
10179
container_of(s, struct hdac_ext_stream, hstream)
10280

103-
void snd_hdac_ext_stream_init(struct hdac_ext_bus *bus,
81+
void snd_hdac_ext_stream_init(struct hdac_bus *bus,
10482
struct hdac_ext_stream *stream, int idx,
10583
int direction, int tag);
106-
int snd_hdac_ext_stream_init_all(struct hdac_ext_bus *ebus, int start_idx,
84+
int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx,
10785
int num_stream, int dir);
108-
void snd_hdac_stream_free_all(struct hdac_ext_bus *ebus);
109-
void snd_hdac_link_free_all(struct hdac_ext_bus *ebus);
110-
struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_ext_bus *bus,
86+
void snd_hdac_stream_free_all(struct hdac_bus *bus);
87+
void snd_hdac_link_free_all(struct hdac_bus *bus);
88+
struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus,
11189
struct snd_pcm_substream *substream,
11290
int type);
11391
void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type);
114-
void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *bus,
92+
void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
11593
struct hdac_ext_stream *azx_dev, bool decouple);
116-
void snd_hdac_ext_stop_streams(struct hdac_ext_bus *sbus);
94+
void snd_hdac_ext_stop_streams(struct hdac_bus *bus);
11795

118-
int snd_hdac_ext_stream_set_spib(struct hdac_ext_bus *ebus,
96+
int snd_hdac_ext_stream_set_spib(struct hdac_bus *bus,
11997
struct hdac_ext_stream *stream, u32 value);
120-
int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_ext_bus *ebus,
98+
int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_bus *bus,
12199
struct hdac_ext_stream *stream);
122-
void snd_hdac_ext_stream_drsm_enable(struct hdac_ext_bus *ebus,
100+
void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus,
123101
bool enable, int index);
124-
int snd_hdac_ext_stream_set_dpibr(struct hdac_ext_bus *ebus,
102+
int snd_hdac_ext_stream_set_dpibr(struct hdac_bus *bus,
125103
struct hdac_ext_stream *stream, u32 value);
126104
int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value);
127105

@@ -144,17 +122,15 @@ struct hdac_ext_link {
144122

145123
int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *link);
146124
int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *link);
147-
int snd_hdac_ext_bus_link_power_up_all(struct hdac_ext_bus *ebus);
148-
int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus);
125+
int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus);
126+
int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus);
149127
void snd_hdac_ext_link_set_stream_id(struct hdac_ext_link *link,
150128
int stream);
151129
void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link,
152130
int stream);
153131

154-
int snd_hdac_ext_bus_link_get(struct hdac_ext_bus *ebus,
155-
struct hdac_ext_link *link);
156-
int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus,
157-
struct hdac_ext_link *link);
132+
int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *link);
133+
int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *link);
158134

159135
/* update register macro */
160136
#define snd_hdac_updatel(addr, reg, mask, val) \
@@ -181,53 +157,12 @@ struct hda_dai_map {
181157
u32 maxbps;
182158
};
183159

184-
#define HDA_MAX_NIDS 16
185-
186-
/**
187-
* struct hdac_ext_device - HDAC Ext device
188-
*
189-
* @hdac: hdac core device
190-
* @nid_list - the dai map which matches the dai-name with the nid
191-
* @map_cur_idx - the idx in use in dai_map
192-
* @ops - the hda codec ops common to all codec drivers
193-
* @pvt_data - private data, for asoc contains asoc codec object
194-
*/
195-
struct hdac_ext_device {
196-
struct hdac_device hdev;
197-
struct hdac_ext_bus *ebus;
198-
199-
/* soc-dai to nid map */
200-
struct hda_dai_map nid_list[HDA_MAX_NIDS];
201-
unsigned int map_cur_idx;
202-
203-
/* codec ops */
204-
struct hdac_ext_codec_ops ops;
205-
206-
struct snd_card *card;
207-
void *scodec;
208-
void *private_data;
209-
};
210-
211160
struct hdac_ext_dma_params {
212161
u32 format;
213162
u8 stream_tag;
214163
};
215-
#define to_ehdac_device(dev) (container_of((dev), \
216-
struct hdac_ext_device, hdev))
217-
/*
218-
* HD-audio codec base driver
219-
*/
220-
struct hdac_ext_driver {
221-
struct hdac_driver hdac;
222-
223-
int (*probe)(struct hdac_ext_device *dev);
224-
int (*remove)(struct hdac_ext_device *dev);
225-
void (*shutdown)(struct hdac_ext_device *dev);
226-
};
227-
228-
int snd_hda_ext_driver_register(struct hdac_ext_driver *drv);
229-
void snd_hda_ext_driver_unregister(struct hdac_ext_driver *drv);
230164

231-
#define to_ehdac_driver(_drv) container_of(_drv, struct hdac_ext_driver, hdac)
165+
int snd_hda_ext_driver_register(struct hdac_driver *drv);
166+
void snd_hda_ext_driver_unregister(struct hdac_driver *drv);
232167

233168
#endif /* __SOUND_HDAUDIO_EXT_H */

0 commit comments

Comments
 (0)