* [PATCH] ALSA: hda - Fix missing ELD info when using jackpoll_ms parameter
@ 2013-12-04 2:19 David Henningsson
2013-12-04 7:17 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: David Henningsson @ 2013-12-04 2:19 UTC (permalink / raw)
To: tiwai, alsa-devel; +Cc: David Henningsson
In the case of using jackpoll_ms instead of unsol events, the jack
was correctly detected, but ELD info was not refreshed on plug-in.
And without ELD info, no proper restriction of pcm, which can in turn
break sound output on some devices.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
sound/pci/hda/patch_hdmi.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
@Takashi; feel free to add stable if you think it's worth it. (After all using
the jackpoll_ms parameter is not something we usually do.) It's still a bug fix
so sending to Linus tree should be okay, I believe.
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 4098196..f0a8ea8 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1142,32 +1142,34 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll);
-static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
+static void jack_callback(struct hda_codec *codec, struct hda_jack_tbl *jack)
{
struct hdmi_spec *spec = codec->spec;
+ int pin_idx = pin_nid_to_pin_index(spec, jack->nid);
+ if (pin_idx < 0)
+ return;
+
+ if (hdmi_present_sense(get_pin(spec, pin_idx), 1))
+ snd_hda_jack_report_sync(codec);
+}
+
+static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
+{
int tag = res >> AC_UNSOL_RES_TAG_SHIFT;
- int pin_nid;
- int pin_idx;
struct hda_jack_tbl *jack;
int dev_entry = (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT;
jack = snd_hda_jack_tbl_get_from_tag(codec, tag);
if (!jack)
return;
- pin_nid = jack->nid;
jack->jack_dirty = 1;
_snd_printd(SND_PR_VERBOSE,
"HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n",
- codec->addr, pin_nid, dev_entry, !!(res & AC_UNSOL_RES_IA),
+ codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA),
!!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV));
- pin_idx = pin_nid_to_pin_index(spec, pin_nid);
- if (pin_idx < 0)
- return;
-
- if (hdmi_present_sense(get_pin(spec, pin_idx), 1))
- snd_hda_jack_report_sync(codec);
+ jack_callback(codec, jack);
}
static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
@@ -2080,7 +2082,8 @@ static int generic_hdmi_init(struct hda_codec *codec)
hda_nid_t pin_nid = per_pin->pin_nid;
hdmi_init_pin(codec, pin_nid);
- snd_hda_jack_detect_enable(codec, pin_nid, pin_nid);
+ snd_hda_jack_detect_enable_callback(codec, pin_nid, pin_nid,
+ codec->jackpoll_interval > 0 ? jack_callback : NULL);
}
return 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: hda - Fix missing ELD info when using jackpoll_ms parameter
2013-12-04 2:19 [PATCH] ALSA: hda - Fix missing ELD info when using jackpoll_ms parameter David Henningsson
@ 2013-12-04 7:17 ` Takashi Iwai
2013-12-04 7:24 ` David Henningsson
0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2013-12-04 7:17 UTC (permalink / raw)
To: David Henningsson; +Cc: alsa-devel
At Wed, 4 Dec 2013 10:19:41 +0800,
David Henningsson wrote:
>
> In the case of using jackpoll_ms instead of unsol events, the jack
> was correctly detected, but ELD info was not refreshed on plug-in.
>
> And without ELD info, no proper restriction of pcm, which can in turn
> break sound output on some devices.
>
> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
> ---
> sound/pci/hda/patch_hdmi.c | 27 +++++++++++++++------------
> 1 file changed, 15 insertions(+), 12 deletions(-)
>
> @Takashi; feel free to add stable if you think it's worth it. (After all using
> the jackpoll_ms parameter is not something we usually do.) It's still a bug fix
> so sending to Linus tree should be okay, I believe.
Hrm, I vaguely remember that I gave a very similar patch for testing,
but it failed by some reason...
Takashi
>
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index 4098196..f0a8ea8 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -1142,32 +1142,34 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
>
> static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll);
>
> -static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
> +static void jack_callback(struct hda_codec *codec, struct hda_jack_tbl *jack)
> {
> struct hdmi_spec *spec = codec->spec;
> + int pin_idx = pin_nid_to_pin_index(spec, jack->nid);
> + if (pin_idx < 0)
> + return;
> +
> + if (hdmi_present_sense(get_pin(spec, pin_idx), 1))
> + snd_hda_jack_report_sync(codec);
> +}
> +
> +static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
> +{
> int tag = res >> AC_UNSOL_RES_TAG_SHIFT;
> - int pin_nid;
> - int pin_idx;
> struct hda_jack_tbl *jack;
> int dev_entry = (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT;
>
> jack = snd_hda_jack_tbl_get_from_tag(codec, tag);
> if (!jack)
> return;
> - pin_nid = jack->nid;
> jack->jack_dirty = 1;
>
> _snd_printd(SND_PR_VERBOSE,
> "HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n",
> - codec->addr, pin_nid, dev_entry, !!(res & AC_UNSOL_RES_IA),
> + codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA),
> !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV));
>
> - pin_idx = pin_nid_to_pin_index(spec, pin_nid);
> - if (pin_idx < 0)
> - return;
> -
> - if (hdmi_present_sense(get_pin(spec, pin_idx), 1))
> - snd_hda_jack_report_sync(codec);
> + jack_callback(codec, jack);
> }
>
> static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
> @@ -2080,7 +2082,8 @@ static int generic_hdmi_init(struct hda_codec *codec)
> hda_nid_t pin_nid = per_pin->pin_nid;
>
> hdmi_init_pin(codec, pin_nid);
> - snd_hda_jack_detect_enable(codec, pin_nid, pin_nid);
> + snd_hda_jack_detect_enable_callback(codec, pin_nid, pin_nid,
> + codec->jackpoll_interval > 0 ? jack_callback : NULL);
> }
> return 0;
> }
> --
> 1.7.9.5
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: hda - Fix missing ELD info when using jackpoll_ms parameter
2013-12-04 7:17 ` Takashi Iwai
@ 2013-12-04 7:24 ` David Henningsson
2013-12-04 7:42 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: David Henningsson @ 2013-12-04 7:24 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
2013-12-04 15:17, Takashi Iwai skrev:
> At Wed, 4 Dec 2013 10:19:41 +0800,
> David Henningsson wrote:
>> In the case of using jackpoll_ms instead of unsol events, the jack
>> was correctly detected, but ELD info was not refreshed on plug-in.
>>
>> And without ELD info, no proper restriction of pcm, which can in turn
>> break sound output on some devices.
>>
>> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
>> ---
>> sound/pci/hda/patch_hdmi.c | 27 +++++++++++++++------------
>> 1 file changed, 15 insertions(+), 12 deletions(-)
>>
>> @Takashi; feel free to add stable if you think it's worth it. (After all using
>> the jackpoll_ms parameter is not something we usually do.) It's still a bug fix
>> so sending to Linus tree should be okay, I believe.
> Hrm, I vaguely remember that I gave a very similar patch for testing,
> but it failed by some reason...
>
>
That indeed sounds vague. :-) At this point, is there anything required
on my part to help getting this bug fixed? We run into it when we're
backporting kernel features, i e, using graphics driver from one kernel
version and hda driver from another kernel version... (and in this weird
kernel mixup we haven't figured out why we don't get an interrupt, so as
a workaround I'm using jackpoll_ms until we've figured that out.)
--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: hda - Fix missing ELD info when using jackpoll_ms parameter
2013-12-04 7:24 ` David Henningsson
@ 2013-12-04 7:42 ` Takashi Iwai
2013-12-04 7:56 ` David Henningsson
0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2013-12-04 7:42 UTC (permalink / raw)
To: David Henningsson; +Cc: alsa-devel
At Wed, 04 Dec 2013 15:24:28 +0800,
David Henningsson wrote:
>
> 2013-12-04 15:17, Takashi Iwai skrev:
> > At Wed, 4 Dec 2013 10:19:41 +0800,
> > David Henningsson wrote:
> >> In the case of using jackpoll_ms instead of unsol events, the jack
> >> was correctly detected, but ELD info was not refreshed on plug-in.
> >>
> >> And without ELD info, no proper restriction of pcm, which can in turn
> >> break sound output on some devices.
> >>
> >> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
> >> ---
> >> sound/pci/hda/patch_hdmi.c | 27 +++++++++++++++------------
> >> 1 file changed, 15 insertions(+), 12 deletions(-)
> >>
> >> @Takashi; feel free to add stable if you think it's worth it. (After all using
> >> the jackpoll_ms parameter is not something we usually do.) It's still a bug fix
> >> so sending to Linus tree should be okay, I believe.
> > Hrm, I vaguely remember that I gave a very similar patch for testing,
> > but it failed by some reason...
> >
> >
>
> That indeed sounds vague. :-) At this point, is there anything required
> on my part to help getting this bug fixed? We run into it when we're
> backporting kernel features, i e, using graphics driver from one kernel
> version and hda driver from another kernel version... (and in this weird
> kernel mixup we haven't figured out why we don't get an interrupt, so as
> a workaround I'm using jackpoll_ms until we've figured that out.)
It's in a thread in June, about
[PATCH 1/2] ALSA: hdmi - poll eld at resume time
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: hda - Fix missing ELD info when using jackpoll_ms parameter
2013-12-04 7:42 ` Takashi Iwai
@ 2013-12-04 7:56 ` David Henningsson
2013-12-04 8:04 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: David Henningsson @ 2013-12-04 7:56 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
2013-12-04 15:42, Takashi Iwai skrev:
> At Wed, 04 Dec 2013 15:24:28 +0800,
> David Henningsson wrote:
>> 2013-12-04 15:17, Takashi Iwai skrev:
>>> At Wed, 4 Dec 2013 10:19:41 +0800,
>>> David Henningsson wrote:
>>>> In the case of using jackpoll_ms instead of unsol events, the jack
>>>> was correctly detected, but ELD info was not refreshed on plug-in.
>>>>
>>>> And without ELD info, no proper restriction of pcm, which can in turn
>>>> break sound output on some devices.
>>>>
>>>> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
>>>> ---
>>>> sound/pci/hda/patch_hdmi.c | 27 +++++++++++++++------------
>>>> 1 file changed, 15 insertions(+), 12 deletions(-)
>>>>
>>>> @Takashi; feel free to add stable if you think it's worth it. (After all using
>>>> the jackpoll_ms parameter is not something we usually do.) It's still a bug fix
>>>> so sending to Linus tree should be okay, I believe.
>>> Hrm, I vaguely remember that I gave a very similar patch for testing,
>>> but it failed by some reason...
>>>
>>>
>> That indeed sounds vague. :-) At this point, is there anything required
>> on my part to help getting this bug fixed? We run into it when we're
>> backporting kernel features, i e, using graphics driver from one kernel
>> version and hda driver from another kernel version... (and in this weird
>> kernel mixup we haven't figured out why we don't get an interrupt, so as
>> a workaround I'm using jackpoll_ms until we've figured that out.)
> It's in a thread in June, about
> [PATCH 1/2] ALSA: hdmi - poll eld at resume time
>
>
> Takashi
>
If you mean this patch:
http://mailman.alsa-project.org/pipermail/alsa-devel/2013-June/063336.html
...it would probably resolve this issue, but instead cause problems when
jackpoll is not used, because snd_hda_jack_report_sync does not call the
jack callback. Essentially, you need to call hdmi_jack_detect_cb from
hdmi_intrinsic_event and your patch should work too.
I think - this analysis is all done by quickly looking at your patch,
not by actual testing.
--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: hda - Fix missing ELD info when using jackpoll_ms parameter
2013-12-04 7:56 ` David Henningsson
@ 2013-12-04 8:04 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2013-12-04 8:04 UTC (permalink / raw)
To: David Henningsson; +Cc: alsa-devel
At Wed, 04 Dec 2013 15:56:05 +0800,
David Henningsson wrote:
>
> 2013-12-04 15:42, Takashi Iwai skrev:
> > At Wed, 04 Dec 2013 15:24:28 +0800,
> > David Henningsson wrote:
> >> 2013-12-04 15:17, Takashi Iwai skrev:
> >>> At Wed, 4 Dec 2013 10:19:41 +0800,
> >>> David Henningsson wrote:
> >>>> In the case of using jackpoll_ms instead of unsol events, the jack
> >>>> was correctly detected, but ELD info was not refreshed on plug-in.
> >>>>
> >>>> And without ELD info, no proper restriction of pcm, which can in turn
> >>>> break sound output on some devices.
> >>>>
> >>>> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
> >>>> ---
> >>>> sound/pci/hda/patch_hdmi.c | 27 +++++++++++++++------------
> >>>> 1 file changed, 15 insertions(+), 12 deletions(-)
> >>>>
> >>>> @Takashi; feel free to add stable if you think it's worth it. (After all using
> >>>> the jackpoll_ms parameter is not something we usually do.) It's still a bug fix
> >>>> so sending to Linus tree should be okay, I believe.
> >>> Hrm, I vaguely remember that I gave a very similar patch for testing,
> >>> but it failed by some reason...
> >>>
> >>>
> >> That indeed sounds vague. :-) At this point, is there anything required
> >> on my part to help getting this bug fixed? We run into it when we're
> >> backporting kernel features, i e, using graphics driver from one kernel
> >> version and hda driver from another kernel version... (and in this weird
> >> kernel mixup we haven't figured out why we don't get an interrupt, so as
> >> a workaround I'm using jackpoll_ms until we've figured that out.)
> > It's in a thread in June, about
> > [PATCH 1/2] ALSA: hdmi - poll eld at resume time
> >
> >
> > Takashi
> >
>
> If you mean this patch:
>
> http://mailman.alsa-project.org/pipermail/alsa-devel/2013-June/063336.html
>
> ...it would probably resolve this issue, but instead cause problems when
> jackpoll is not used, because snd_hda_jack_report_sync does not call the
> jack callback. Essentially, you need to call hdmi_jack_detect_cb from
> hdmi_intrinsic_event and your patch should work too.
>
> I think - this analysis is all done by quickly looking at your patch,
> not by actual testing.
OK, then I took your patch. It shouldn't break the things, at least,
through a quick glance.
thanks,
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-12-04 8:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-04 2:19 [PATCH] ALSA: hda - Fix missing ELD info when using jackpoll_ms parameter David Henningsson
2013-12-04 7:17 ` Takashi Iwai
2013-12-04 7:24 ` David Henningsson
2013-12-04 7:42 ` Takashi Iwai
2013-12-04 7:56 ` David Henningsson
2013-12-04 8:04 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.