Commit 66a8966a authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'for-linus' into for-next

Merge 5.4-devel branch for applying the further ALSA timer fixes.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parents 9ff77597 df37d941
...@@ -229,7 +229,8 @@ static int snd_timer_check_master(struct snd_timer_instance *master) ...@@ -229,7 +229,8 @@ static int snd_timer_check_master(struct snd_timer_instance *master)
return 0; return 0;
} }
static int snd_timer_close_locked(struct snd_timer_instance *timeri); static int snd_timer_close_locked(struct snd_timer_instance *timeri,
struct device **card_devp_to_put);
/* /*
* open a timer instance * open a timer instance
...@@ -241,6 +242,7 @@ int snd_timer_open(struct snd_timer_instance **ti, ...@@ -241,6 +242,7 @@ int snd_timer_open(struct snd_timer_instance **ti,
{ {
struct snd_timer *timer; struct snd_timer *timer;
struct snd_timer_instance *timeri = NULL; struct snd_timer_instance *timeri = NULL;
struct device *card_dev_to_put = NULL;
int err; int err;
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
...@@ -269,7 +271,7 @@ int snd_timer_open(struct snd_timer_instance **ti, ...@@ -269,7 +271,7 @@ int snd_timer_open(struct snd_timer_instance **ti,
num_slaves++; num_slaves++;
err = snd_timer_check_slave(timeri); err = snd_timer_check_slave(timeri);
if (err < 0) { if (err < 0) {
snd_timer_close_locked(timeri); snd_timer_close_locked(timeri, &card_dev_to_put);
timeri = NULL; timeri = NULL;
} }
goto unlock; goto unlock;
...@@ -290,11 +292,11 @@ int snd_timer_open(struct snd_timer_instance **ti, ...@@ -290,11 +292,11 @@ int snd_timer_open(struct snd_timer_instance **ti,
goto unlock; goto unlock;
} }
if (!list_empty(&timer->open_list_head)) { if (!list_empty(&timer->open_list_head)) {
timeri = list_entry(timer->open_list_head.next, struct snd_timer_instance *t =
list_entry(timer->open_list_head.next,
struct snd_timer_instance, open_list); struct snd_timer_instance, open_list);
if (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) { if (t->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) {
err = -EBUSY; err = -EBUSY;
timeri = NULL;
goto unlock; goto unlock;
} }
} }
...@@ -321,7 +323,7 @@ int snd_timer_open(struct snd_timer_instance **ti, ...@@ -321,7 +323,7 @@ int snd_timer_open(struct snd_timer_instance **ti,
timeri = NULL; timeri = NULL;
if (timer->card) if (timer->card)
put_device(&timer->card->card_dev); card_dev_to_put = &timer->card->card_dev;
module_put(timer->module); module_put(timer->module);
goto unlock; goto unlock;
} }
...@@ -331,12 +333,15 @@ int snd_timer_open(struct snd_timer_instance **ti, ...@@ -331,12 +333,15 @@ int snd_timer_open(struct snd_timer_instance **ti,
timer->num_instances++; timer->num_instances++;
err = snd_timer_check_master(timeri); err = snd_timer_check_master(timeri);
if (err < 0) { if (err < 0) {
snd_timer_close_locked(timeri); snd_timer_close_locked(timeri, &card_dev_to_put);
timeri = NULL; timeri = NULL;
} }
unlock: unlock:
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
/* put_device() is called after unlock for avoiding deadlock */
if (card_dev_to_put)
put_device(card_dev_to_put);
*ti = timeri; *ti = timeri;
return err; return err;
} }
...@@ -346,7 +351,8 @@ EXPORT_SYMBOL(snd_timer_open); ...@@ -346,7 +351,8 @@ EXPORT_SYMBOL(snd_timer_open);
* close a timer instance * close a timer instance
* call this with register_mutex down. * call this with register_mutex down.
*/ */
static int snd_timer_close_locked(struct snd_timer_instance *timeri) static int snd_timer_close_locked(struct snd_timer_instance *timeri,
struct device **card_devp_to_put)
{ {
struct snd_timer *timer = timeri->timer; struct snd_timer *timer = timeri->timer;
struct snd_timer_instance *slave, *tmp; struct snd_timer_instance *slave, *tmp;
...@@ -405,7 +411,7 @@ static int snd_timer_close_locked(struct snd_timer_instance *timeri) ...@@ -405,7 +411,7 @@ static int snd_timer_close_locked(struct snd_timer_instance *timeri)
timer->hw.close(timer); timer->hw.close(timer);
/* release a card refcount for safe disconnection */ /* release a card refcount for safe disconnection */
if (timer->card) if (timer->card)
put_device(&timer->card->card_dev); *card_devp_to_put = &timer->card->card_dev;
module_put(timer->module); module_put(timer->module);
} }
...@@ -417,14 +423,18 @@ static int snd_timer_close_locked(struct snd_timer_instance *timeri) ...@@ -417,14 +423,18 @@ static int snd_timer_close_locked(struct snd_timer_instance *timeri)
*/ */
int snd_timer_close(struct snd_timer_instance *timeri) int snd_timer_close(struct snd_timer_instance *timeri)
{ {
struct device *card_dev_to_put = NULL;
int err; int err;
if (snd_BUG_ON(!timeri)) if (snd_BUG_ON(!timeri))
return -ENXIO; return -ENXIO;
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
err = snd_timer_close_locked(timeri); err = snd_timer_close_locked(timeri, &card_dev_to_put);
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
/* put_device() is called after unlock for avoiding deadlock */
if (card_dev_to_put)
put_device(card_dev_to_put);
return err; return err;
} }
EXPORT_SYMBOL(snd_timer_close); EXPORT_SYMBOL(snd_timer_close);
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#define SAFFIRE_CLOCK_SOURCE_SPDIF 1 #define SAFFIRE_CLOCK_SOURCE_SPDIF 1
/* clock sources as returned from register of Saffire Pro 10 and 26 */ /* clock sources as returned from register of Saffire Pro 10 and 26 */
#define SAFFIREPRO_CLOCK_SOURCE_SELECT_MASK 0x000000ff
#define SAFFIREPRO_CLOCK_SOURCE_DETECT_MASK 0x0000ff00
#define SAFFIREPRO_CLOCK_SOURCE_INTERNAL 0 #define SAFFIREPRO_CLOCK_SOURCE_INTERNAL 0
#define SAFFIREPRO_CLOCK_SOURCE_SKIP 1 /* never used on hardware */ #define SAFFIREPRO_CLOCK_SOURCE_SKIP 1 /* never used on hardware */
#define SAFFIREPRO_CLOCK_SOURCE_SPDIF 2 #define SAFFIREPRO_CLOCK_SOURCE_SPDIF 2
...@@ -189,6 +191,7 @@ saffirepro_both_clk_src_get(struct snd_bebob *bebob, unsigned int *id) ...@@ -189,6 +191,7 @@ saffirepro_both_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
map = saffirepro_clk_maps[1]; map = saffirepro_clk_maps[1];
/* In a case that this driver cannot handle the value of register. */ /* In a case that this driver cannot handle the value of register. */
value &= SAFFIREPRO_CLOCK_SOURCE_SELECT_MASK;
if (value >= SAFFIREPRO_CLOCK_SOURCE_COUNT || map[value] < 0) { if (value >= SAFFIREPRO_CLOCK_SOURCE_COUNT || map[value] < 0) {
err = -EIO; err = -EIO;
goto end; goto end;
......
...@@ -7604,7 +7604,7 @@ static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb) ...@@ -7604,7 +7604,7 @@ static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb)
/* Delay enabling the HP amp, to let the mic-detection /* Delay enabling the HP amp, to let the mic-detection
* state machine run. * state machine run.
*/ */
cancel_delayed_work_sync(&spec->unsol_hp_work); cancel_delayed_work(&spec->unsol_hp_work);
schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500));
tbl = snd_hda_jack_tbl_get(codec, cb->nid); tbl = snd_hda_jack_tbl_get(codec, cb->nid);
if (tbl) if (tbl)
......
...@@ -145,6 +145,7 @@ struct hdmi_spec { ...@@ -145,6 +145,7 @@ struct hdmi_spec {
struct snd_array pins; /* struct hdmi_spec_per_pin */ struct snd_array pins; /* struct hdmi_spec_per_pin */
struct hdmi_pcm pcm_rec[16]; struct hdmi_pcm pcm_rec[16];
struct mutex pcm_lock; struct mutex pcm_lock;
struct mutex bind_lock; /* for audio component binding */
/* pcm_bitmap means which pcms have been assigned to pins*/ /* pcm_bitmap means which pcms have been assigned to pins*/
unsigned long pcm_bitmap; unsigned long pcm_bitmap;
int pcm_used; /* counter of pcm_rec[] */ int pcm_used; /* counter of pcm_rec[] */
...@@ -2267,7 +2268,7 @@ static int generic_hdmi_init(struct hda_codec *codec) ...@@ -2267,7 +2268,7 @@ static int generic_hdmi_init(struct hda_codec *codec)
struct hdmi_spec *spec = codec->spec; struct hdmi_spec *spec = codec->spec;
int pin_idx; int pin_idx;
mutex_lock(&spec->pcm_lock); mutex_lock(&spec->bind_lock);
spec->use_jack_detect = !codec->jackpoll_interval; spec->use_jack_detect = !codec->jackpoll_interval;
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
...@@ -2284,7 +2285,7 @@ static int generic_hdmi_init(struct hda_codec *codec) ...@@ -2284,7 +2285,7 @@ static int generic_hdmi_init(struct hda_codec *codec)
snd_hda_jack_detect_enable_callback(codec, pin_nid, snd_hda_jack_detect_enable_callback(codec, pin_nid,
jack_callback); jack_callback);
} }
mutex_unlock(&spec->pcm_lock); mutex_unlock(&spec->bind_lock);
return 0; return 0;
} }
...@@ -2391,6 +2392,7 @@ static int alloc_generic_hdmi(struct hda_codec *codec) ...@@ -2391,6 +2392,7 @@ static int alloc_generic_hdmi(struct hda_codec *codec)
spec->ops = generic_standard_hdmi_ops; spec->ops = generic_standard_hdmi_ops;
spec->dev_num = 1; /* initialize to 1 */ spec->dev_num = 1; /* initialize to 1 */
mutex_init(&spec->pcm_lock); mutex_init(&spec->pcm_lock);
mutex_init(&spec->bind_lock);
snd_hdac_register_chmap_ops(&codec->core, &spec->chmap); snd_hdac_register_chmap_ops(&codec->core, &spec->chmap);
spec->chmap.ops.get_chmap = hdmi_get_chmap; spec->chmap.ops.get_chmap = hdmi_get_chmap;
...@@ -2460,7 +2462,7 @@ static void generic_acomp_notifier_set(struct drm_audio_component *acomp, ...@@ -2460,7 +2462,7 @@ static void generic_acomp_notifier_set(struct drm_audio_component *acomp,
int i; int i;
spec = container_of(acomp->audio_ops, struct hdmi_spec, drm_audio_ops); spec = container_of(acomp->audio_ops, struct hdmi_spec, drm_audio_ops);
mutex_lock(&spec->pcm_lock); mutex_lock(&spec->bind_lock);
spec->use_acomp_notifier = use_acomp; spec->use_acomp_notifier = use_acomp;
spec->codec->relaxed_resume = use_acomp; spec->codec->relaxed_resume = use_acomp;
/* reprogram each jack detection logic depending on the notifier */ /* reprogram each jack detection logic depending on the notifier */
...@@ -2470,7 +2472,7 @@ static void generic_acomp_notifier_set(struct drm_audio_component *acomp, ...@@ -2470,7 +2472,7 @@ static void generic_acomp_notifier_set(struct drm_audio_component *acomp,
get_pin(spec, i)->pin_nid, get_pin(spec, i)->pin_nid,
use_acomp); use_acomp);
} }
mutex_unlock(&spec->pcm_lock); mutex_unlock(&spec->bind_lock);
} }
/* enable / disable the notifier via master bind / unbind */ /* enable / disable the notifier via master bind / unbind */
...@@ -2858,6 +2860,18 @@ static int patch_i915_icl_hdmi(struct hda_codec *codec) ...@@ -2858,6 +2860,18 @@ static int patch_i915_icl_hdmi(struct hda_codec *codec)
return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map)); return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map));
} }
static int patch_i915_tgl_hdmi(struct hda_codec *codec)
{
/*
* pin to port mapping table where the value indicate the pin number and
* the index indicate the port number with 1 base.
*/
static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map));
}
/* Intel Baytrail and Braswell; with eld notifier */ /* Intel Baytrail and Braswell; with eld notifier */
static int patch_i915_byt_hdmi(struct hda_codec *codec) static int patch_i915_byt_hdmi(struct hda_codec *codec)
{ {
...@@ -4160,6 +4174,7 @@ HDA_CODEC_ENTRY(0x8086280b, "Kabylake HDMI", patch_i915_hsw_hdmi), ...@@ -4160,6 +4174,7 @@ HDA_CODEC_ENTRY(0x8086280b, "Kabylake HDMI", patch_i915_hsw_hdmi),
HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi), HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi),
HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi),
HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi),
HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi),
HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi),
HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi), HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi),
HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi), HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment