From: Takashi Iwai <tiwai@suse.de>
To: Vinod Koul <vinod.koul@intel.com>
Cc: alsa-devel@alsa-project.org,
Mengdong Lin <mengdong.lin@linux.intel.com>,
intel-gfx@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@intel.com>,
David Henningsson <david.henningsson@canonical.com>
Subject: Re: [PATCH 5/7] ALSA: hda - Use component ops for i915 HDMI/DP audio jack handling
Date: Mon, 30 Nov 2015 17:44:48 +0100 [thread overview]
Message-ID: <s5hbnabqvwf.wl-tiwai@suse.de> (raw)
In-Reply-To: <20151130164233.GI3901@localhost>
On Mon, 30 Nov 2015 17:42:33 +0100,
Vinod Koul wrote:
>
> On Mon, Nov 30, 2015 at 02:37:49PM +0100, Takashi Iwai wrote:
> > Since we have a new audio component ops to fetch the current ELD and
> > state now, we can reduce the usage of unsol event of HDMI/DP pins.
> > The unsol event isn't only unreliable, but it also needs the power
> > up/down of the codec and link at each time, which is a significant
> > power and time loss.
> >
> > In this patch, the jack creation and unsol/jack event handling are
> > modified to use the audio component for the dedicated Intel chips.
> >
> > The jack handling got slightly more codes than a simple usage of
> > hda_jack layer since we need to deal directly with snd_jack object;
> > the hda_jack layer is basically designed for the pin sense read and
> > unsol events, both of which aren't used any longer in our case.
> >
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> > sound/pci/hda/patch_hdmi.c | 84 ++++++++++++++++++++++++++++++++++++++++++++--
> > 1 file changed, 82 insertions(+), 2 deletions(-)
> >
> > diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> > index 28684aa86408..8378c31e0b4f 100644
> > --- a/sound/pci/hda/patch_hdmi.c
> > +++ b/sound/pci/hda/patch_hdmi.c
> > @@ -83,6 +83,7 @@ struct hdmi_spec_per_pin {
> > struct mutex lock;
> > struct delayed_work work;
> > struct snd_kcontrol *eld_ctl;
> > + struct snd_jack *acomp_jack; /* jack via audio component */
> > int repoll_count;
> > bool setup; /* the stream has been set up by prepare callback */
> > int channels; /* current number of channels */
> > @@ -141,6 +142,7 @@ struct hdmi_spec {
> > struct hdmi_ops ops;
> >
> > bool dyn_pin_out;
> > + bool use_acomp; /* use audio component for ELD notify/update */
> >
> > /*
> > * Non-generic VIA/NVIDIA specific
> > @@ -1580,6 +1582,9 @@ static void update_eld(struct hda_codec *codec,
> > &per_pin->eld_ctl->id);
> > }
> >
> > +static void sync_eld_via_acomp(struct hda_codec *codec,
> > + struct hdmi_spec_per_pin *per_pin);
> > +
> > static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
> > {
> > struct hda_jack_tbl *jack;
> > @@ -1599,6 +1604,11 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
> > int present;
> > bool ret;
> >
> > + if (spec->use_acomp) {
> > + sync_eld_via_acomp(codec, per_pin);
> > + return false; /* don't call snd_hda_jack_report_sync() */
> > + }
> > +
> > snd_hda_power_up_pm(codec);
> > present = snd_hda_pin_sense(codec, pin_nid);
> >
> > @@ -2091,6 +2101,68 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
> > return 0;
> > }
> >
> > +/* update ELD and jack state via audio component */
> > +static void sync_eld_via_acomp(struct hda_codec *codec,
> > + struct hdmi_spec_per_pin *per_pin)
> > +{
> > + struct i915_audio_component *acomp = codec->bus->core.audio_component;
> > + struct hdmi_spec *spec = codec->spec;
> > + struct hdmi_eld *eld = &spec->temp_eld;
> > + int size;
> > +
> > + if (acomp && acomp->ops && acomp->ops->get_eld) {
> > + mutex_lock(&per_pin->lock);
> > + size = acomp->ops->get_eld(acomp->dev,
> > + intel_pin2port(per_pin->pin_nid),
> > + &eld->monitor_present,
> > + eld->eld_buffer,
> > + ELD_MAX_SIZE);
> > + if (size > 0) {
> > + memset(&eld->info, 0, sizeof(eld->info));
> > + if (snd_hdmi_parse_eld(codec, &eld->info,
> > + eld->eld_buffer, size) < 0)
> > + size = -EINVAL;
> > + }
> > +
> > + if (size > 0) {
> > + eld->eld_valid = true;
> > + eld->eld_size = size;
> > + } else {
> > + eld->eld_valid = false;
> > + eld->eld_size = 0;
> > + }
> > +
> > + update_eld(codec, per_pin, eld);
> > + snd_jack_report(per_pin->acomp_jack,
> > + eld->monitor_present ? SND_JACK_AVOUT : 0);
> > + mutex_unlock(&per_pin->lock);
> > + }
> > +}
>
> IMO This and the rest can be moved to sound/hda/ so that other can reuse
> this code, as the code will be same for other users too..
We have no per_pin or HDMI specific stuff there yet.
What we can reuse at most is only the acomp->ops... call itself, so
far. hdac_i915.c is a thin wrapper, and it doesn't handle anything
deep wrt HDMI/DP by itself.
Takashi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-11-30 16:44 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-30 13:37 [PATCH 0/7] Add get_eld audio component for i915/HD-audio Takashi Iwai
2015-11-30 13:37 ` [PATCH 1/7] drm/i915: Remove superfluous NULL check Takashi Iwai
2015-11-30 13:37 ` [PATCH 2/7] drm/i915: Add get_eld audio component Takashi Iwai
2015-11-30 14:11 ` Daniel Vetter
2015-11-30 14:17 ` Daniel Vetter
2015-11-30 15:55 ` Takashi Iwai
2015-11-30 16:31 ` Daniel Vetter
2015-11-30 14:54 ` Takashi Iwai
2015-11-30 15:24 ` Ville Syrjälä
2015-11-30 15:29 ` Takashi Iwai
2015-11-30 15:34 ` David Henningsson
2015-11-30 15:45 ` Takashi Iwai
2015-11-30 16:09 ` Ville Syrjälä
2015-11-30 16:34 ` Daniel Vetter
2015-11-30 16:48 ` Ville Syrjälä
2015-11-30 16:53 ` Takashi Iwai
2015-11-30 13:37 ` [PATCH 3/7] drm/i915: refactoring audio component functions Takashi Iwai
2015-11-30 14:14 ` Daniel Vetter
2015-11-30 14:57 ` Takashi Iwai
2015-11-30 13:37 ` [PATCH 4/7] ALSA: hda - Split ELD update code from hdmi_present_sense() Takashi Iwai
2015-11-30 16:00 ` Vinod Koul
2015-11-30 16:03 ` Takashi Iwai
2015-11-30 13:37 ` [PATCH 5/7] ALSA: hda - Use component ops for i915 HDMI/DP audio jack handling Takashi Iwai
2015-11-30 16:42 ` Vinod Koul
2015-11-30 16:44 ` Takashi Iwai [this message]
2015-11-30 13:37 ` [PATCH 6/7] ALSA: hda - Do zero-clear in snd_hdmi_parse_eld() itself Takashi Iwai
2015-11-30 13:37 ` [PATCH 7/7] ALSA: hda - Skip ELD notification during PM process Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hbnabqvwf.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=daniel.vetter@intel.com \
--cc=david.henningsson@canonical.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mengdong.lin@linux.intel.com \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox