diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-05-16 08:59:00 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-05-16 08:59:00 -0400 |
commit | a158f2b79ff1948c864a38296ea4249f7296362b (patch) | |
tree | e62d50376d29a63814cf9d26cbd4c522f6f9271a /sound/hda | |
parent | 581abbaa03367f0b1327521f30bd2b69b8075b2f (diff) | |
parent | 515511a7920c69aebf7f5fef0cb8e1df6767f34c (diff) |
Merge tag 'asoc-v4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v4.7
The updates this time around are almost all driver code:
- Further slow progress on the topology code.
- Substantial updates and improvements for the da7219, es8328, fsl-ssi
Intel and rcar drivers.
Diffstat (limited to 'sound/hda')
-rw-r--r-- | sound/hda/ext/hdac_ext_bus.c | 3 | ||||
-rw-r--r-- | sound/hda/ext/hdac_ext_controller.c | 66 | ||||
-rw-r--r-- | sound/hda/local.h | 10 |
3 files changed, 79 insertions, 0 deletions
diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c index 64de0a3d6d93..31b510c5ca0b 100644 --- a/sound/hda/ext/hdac_ext_bus.c +++ b/sound/hda/ext/hdac_ext_bus.c | |||
@@ -105,6 +105,9 @@ int snd_hdac_ext_bus_init(struct hdac_ext_bus *ebus, struct device *dev, | |||
105 | INIT_LIST_HEAD(&ebus->hlink_list); | 105 | INIT_LIST_HEAD(&ebus->hlink_list); |
106 | ebus->idx = idx++; | 106 | ebus->idx = idx++; |
107 | 107 | ||
108 | mutex_init(&ebus->lock); | ||
109 | ebus->cmd_dma_state = true; | ||
110 | |||
108 | return 0; | 111 | return 0; |
109 | } | 112 | } |
110 | EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init); | 113 | EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init); |
diff --git a/sound/hda/ext/hdac_ext_controller.c b/sound/hda/ext/hdac_ext_controller.c index 548cc1e4114b..860f8cad6602 100644 --- a/sound/hda/ext/hdac_ext_controller.c +++ b/sound/hda/ext/hdac_ext_controller.c | |||
@@ -186,6 +186,9 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *ebus) | |||
186 | hlink->lcaps = readl(hlink->ml_addr + AZX_REG_ML_LCAP); | 186 | hlink->lcaps = readl(hlink->ml_addr + AZX_REG_ML_LCAP); |
187 | hlink->lsdiid = readw(hlink->ml_addr + AZX_REG_ML_LSDIID); | 187 | hlink->lsdiid = readw(hlink->ml_addr + AZX_REG_ML_LSDIID); |
188 | 188 | ||
189 | /* since link in On, update the ref */ | ||
190 | hlink->ref_count = 1; | ||
191 | |||
189 | list_add_tail(&hlink->list, &ebus->hlink_list); | 192 | list_add_tail(&hlink->list, &ebus->hlink_list); |
190 | } | 193 | } |
191 | 194 | ||
@@ -327,3 +330,66 @@ int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus) | |||
327 | return 0; | 330 | return 0; |
328 | } | 331 | } |
329 | EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all); | 332 | EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all); |
333 | |||
334 | int snd_hdac_ext_bus_link_get(struct hdac_ext_bus *ebus, | ||
335 | struct hdac_ext_link *link) | ||
336 | { | ||
337 | int ret = 0; | ||
338 | |||
339 | mutex_lock(&ebus->lock); | ||
340 | |||
341 | /* | ||
342 | * if we move from 0 to 1, count will be 1 so power up this link | ||
343 | * as well, also check the dma status and trigger that | ||
344 | */ | ||
345 | if (++link->ref_count == 1) { | ||
346 | if (!ebus->cmd_dma_state) { | ||
347 | snd_hdac_bus_init_cmd_io(&ebus->bus); | ||
348 | ebus->cmd_dma_state = true; | ||
349 | } | ||
350 | |||
351 | ret = snd_hdac_ext_bus_link_power_up(link); | ||
352 | } | ||
353 | |||
354 | mutex_unlock(&ebus->lock); | ||
355 | return ret; | ||
356 | } | ||
357 | EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_get); | ||
358 | |||
359 | int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus, | ||
360 | struct hdac_ext_link *link) | ||
361 | { | ||
362 | int ret = 0; | ||
363 | struct hdac_ext_link *hlink; | ||
364 | bool link_up = false; | ||
365 | |||
366 | mutex_lock(&ebus->lock); | ||
367 | |||
368 | /* | ||
369 | * if we move from 1 to 0, count will be 0 | ||
370 | * so power down this link as well | ||
371 | */ | ||
372 | if (--link->ref_count == 0) { | ||
373 | ret = snd_hdac_ext_bus_link_power_down(link); | ||
374 | |||
375 | /* | ||
376 | * now check if all links are off, if so turn off | ||
377 | * cmd dma as well | ||
378 | */ | ||
379 | list_for_each_entry(hlink, &ebus->hlink_list, list) { | ||
380 | if (hlink->ref_count) { | ||
381 | link_up = true; | ||
382 | break; | ||
383 | } | ||
384 | } | ||
385 | |||
386 | if (!link_up) { | ||
387 | snd_hdac_bus_stop_cmd_io(&ebus->bus); | ||
388 | ebus->cmd_dma_state = false; | ||
389 | } | ||
390 | } | ||
391 | |||
392 | mutex_unlock(&ebus->lock); | ||
393 | return ret; | ||
394 | } | ||
395 | EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_put); | ||
diff --git a/sound/hda/local.h b/sound/hda/local.h index d692f417ddc0..0d5bb159d538 100644 --- a/sound/hda/local.h +++ b/sound/hda/local.h | |||
@@ -16,6 +16,16 @@ static inline int get_wcaps_type(unsigned int wcaps) | |||
16 | return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 16 | return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
17 | } | 17 | } |
18 | 18 | ||
19 | static inline unsigned int get_wcaps_channels(u32 wcaps) | ||
20 | { | ||
21 | unsigned int chans; | ||
22 | |||
23 | chans = (wcaps & AC_WCAP_CHAN_CNT_EXT) >> 13; | ||
24 | chans = (chans + 1) * 2; | ||
25 | |||
26 | return chans; | ||
27 | } | ||
28 | |||
19 | extern const struct attribute_group *hdac_dev_attr_groups[]; | 29 | extern const struct attribute_group *hdac_dev_attr_groups[]; |
20 | int hda_widget_sysfs_init(struct hdac_device *codec); | 30 | int hda_widget_sysfs_init(struct hdac_device *codec); |
21 | void hda_widget_sysfs_exit(struct hdac_device *codec); | 31 | void hda_widget_sysfs_exit(struct hdac_device *codec); |