Commit Graph

19 Commits

Author SHA1 Message Date
Takashi Iwai d0e9b1a23c ALSA: x86: Drop flag_underrun field
The flag_underrun flag is used to indicate to escalate the XRUN
reporting at the next position inquiry, but there is a much simpler
method to achieve it: just call snd_pcm_stop_xrun().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:35:17 +01:00
Takashi Iwai 8f8d1d7fe0 ALSA: x86: Fix racy access to chmap
The access to chmap can be racy against the hotplug process, where it
recreates the chmap on the fly.  For protecting against it, a mutex is
introduced in this patch.  It's also used for protecting the change /
reference of eld and state fields, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:35:07 +01:00
Takashi Iwai 4151ee845a ALSA: x86: Remove _v[12] suffices
Although we dropped the most of the obsoleted *_v1 definitions and
codes, some codes still keep the _v1 or _v2 suffices.  Now they are
ripped off.

The only thing to be done carefully here is the definition of control
offsets.  The original code defines enum hdmi_ctrl_reg_offset_v1 and
a few new elements just for v2 on its top.  After this cleanup, we
remove the old AUD_HDMI_STATUS and AUD_HDMIW_INFOFR definitions and
replace with the v2 values.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:34:40 +01:00
Takashi Iwai e9d65abfa6 ALSA: x86: Drop unused fields from snd_intelhad struct
Also change the flag_underrun to bool to be clearer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:33:28 +01:00
Takashi Iwai df76df12f1 ALSA: x86: Remove indirect call of snd_pcm_period_elapsed()
Again another indirect call...  Let's straighten it up.
Also define the had_stream field with a proper type instead of a void
pointer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:33:13 +01:00
Takashi Iwai 372d855f87 ALSA: x86: Fold intel_hdmi_audio_if.c into main file
As the very last step, we fold intel_hdmi_audio_if.c into the main
file, intel_hdmi_audio.c.  This is merely a cleanup, and no functional
change.

By this move, we can mark all functions and variables as static, which
allows the compiler more optimizations.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:31:54 +01:00
Takashi Iwai da86480974 ALSA: x86: Flatten two abstraction layers
This is the final stage for a big clean-up series.  Here we flatten
the two layers into one.  Formerly, the implementation was split to
HDMI "shell" that talks with the platform device, and HDMI audio part
that communicates via caps and other event handlers.  All these would
be good if there were multiple instantiations or if there were data
protection.  But neither are true in our case.  That said, it'll be
easier to have a flat driver structure in the end.

In this patch, the former struct hdmi_lpe_audio_ctx is forged into the
existing struct snd_intelhad.  The latter has already a few members
that are basically the copy from the former.  Only a few new members
for the lowlevel I/O are added by this change.

Then, the had_get_caps() and had_set_caps() are simply replaced with
the direct calls to copy the data in the struct fields.  Also, the
had_event_handler() calls are replaced with the direct call for each
event as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:31:35 +01:00
Takashi Iwai eeb756c5bf ALSA: x86: Drop unused hdmi_audio_query()
It's used nowhere.  Kill it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:31:26 +01:00
Takashi Iwai 5647aec266 ALSA: x86: Embed snd_intelhad into snd_card
Instead of allocating snd_intelhad struct, use the card's private_data
and embed it.  It simplifies the code a lot.

While we're at it, embed had_stream into snd_intelhad struct instead
of individually allocating, and rename had_pvt_data to a bit more
specific name, had_stream_data.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:30:26 +01:00
Takashi Iwai 0e18060f99 ALSA: x86: Drop unused hw_silence field
It's nowhere used.  Let's drop it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:25:43 +01:00
Takashi Iwai 6ddb3ab66f ALSA: x86: Move the global underrun_count to struct snd_intelhad
The last one is in intel_hdmi_audio.c, underrun_count: this can be
embedded in snd_intelhad object.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:25:30 +01:00
Takashi Iwai 437af8f294 ALSA: x86: Call event callback directly
Currently the driver calls the event callback stored in its ctx
pointer, but it's obviously inefficient.  Replace it with the direct
calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:23:15 +01:00
Takashi Iwai 79dda75a2c ALSA: x86: Pass snd_intelhad object to helpers
For reducing the global variable reference, keep snd_intelhad object
in the context and pass it to each helper.  It's a preliminary change
for further cleanup.

This also includes the simplification of the probe procedure: the LPE
platform driver directly gets the created snd_intelhad object by
hdmi_audio_probe(), and passes it to each helper and destructor,
hdmi_audio_remove().  The hdmi_audio_probe() function doesn't call the
back-registration any longer, which is fairly useless.  The LPE
platform driver initializes the stuff instead at the right place, and
calls the wq after the object creation in the probe function itself.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:22:16 +01:00
Takashi Iwai 6f9ecc76f4 ALSA: x86: Drop snd_intel_had_interface indirect calls
Yet another indirection is killed: at this time, it's
snd_intel_had_interface.  It contains also the name string, but it's
nowhere used, thus we can kill it, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:21:57 +01:00
Takashi Iwai 9eca88c881 ALSA: x86: Replace indirect query_ops with direct calls
Like the previous patch, this replaces the indirect query_ops calls
via direct function calls.  They are only get_caps and set_caps, so
fairly straightforward at this time.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:21:41 +01:00
Takashi Iwai f23df8071b ALSA: x86: Replace indirect register ops with direct calls
Now about the indirect register ops: they are replaced with direct
calls, too.

The read / write / modify ops are simply replaced with the
corresponding functions.  The difference is that we calculate the
offset inside the function now.  So all the had_config_offset
references in the caller side are dropped.  This also simplifies the
DP-audio check in hdmi_audio_write() and hdmi_audio_rmw().

The hdmi_audio_get_register_base is dropped since it's no longer used
when the base address and config offset are referred in the read/write
functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:21:17 +01:00
Takashi Iwai 76296ef0ec ALSA: x86: Drop indirect calls of had_ops
We have only a single implementation of had_ops, hence there is no
merit to use the indirect calls at all.  Let's replace it with the
direct calls -- which allows the compiler more optimizations.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03 17:20:58 +01:00
Pierre-Louis Bossart 964ca8083c ALSA: x86: intel_hdmi: add definitions and logic for DP audio
Imported from legacy patches

Note: the new code doesn't assume a modified ELD but
an explicit notification that DP is present. It appears
that the i915 code does change the ELD so we could use
the ELD-based tests to check for DP audio

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-01 16:22:24 +01:00
Jerome Anand 5dab11d897 ALSA: x86: hdmi: Add audio support for BYT and CHT
Hdmi audio driver based on the child platform device
created by gfx driver is implemented.
This audio driver is derived from legacy intel
hdmi audio driver.

The interfaces for interaction between gfx and audio
are updated and the driver implementation updated to
derive interrupts in its own address space based on
irq chip framework

The changes to calculate sub-period positions was triggered
by David Henningsson <david.henningsson@canonical.com> and is
accomodated in this patch

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jerome Anand <jerome.anand@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-01-25 14:24:08 +01:00