summaryrefslogtreecommitdiff
path: root/sound/x86/intel_hdmi_audio.h
AgeCommit message (Collapse)Author
2017-05-03ALSA: x86: Register multiple PCM devices for the LPE audio cardVille Syrjälä
Now that everything is in place let's register a PCM device for each port of the display engine. This will make it possible to actually output audio to multiple displays at the same time. And it avoids modesets on unrelated displays from clobbering up the ELD and whatnot for the display currently doing the playback. v2: Add a PCM per port instead of per pipe v3: Fix off by one error with port numbers (Pierre-Louis) Fix .notify_audio_lpe() prototype (Pierre-Louis) Cc: Takashi Iwai <tiwai@suse.de> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170427160231.13337-12-ville.syrjala@linux.intel.com Reviewed-by: Takashi Iwai <tiwai@suse.de>
2017-05-03ALSA: x86: Split snd_intelhad into card and PCM specific structuresVille Syrjälä
To allow multiple PCM devices to be registered for the LPE audio card, split the private data into card and PCM specific chunks. For now we'll stick to just one PCM device as before. v2: Rework to do a pcm device per port instead of per pipe Cc: Takashi Iwai <tiwai@suse.de> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170427160231.13337-11-ville.syrjala@linux.intel.com Reviewed-by: Takashi Iwai <tiwai@suse.de>
2017-02-16ALSA: x86: Implement jack controlTakashi Iwai
This patch implements a jack interface for notifying HDMI/DP connection. PA listens to this, so it can handle the monitor connection more gracefully. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-13ALSA: x86: Drop unused stream.running fieldTakashi Iwai
The pcm_stream_info.running field is only set in the PCM trigger callback but never referred, thus it can be safely removed. Also, properly cover the spinlock in both the trigger START and STOP to protect had_enable_audio() calls. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-13ALSA: x86: Handle reset at prepare callbackTakashi Iwai
Currently the driver handles some reset procedure at the trigger STOP and the underrun functions, where both are executed in the interrupt context. Especially the underrun function has a sync-loop to clear the UNDERRUN status bit, and this is supposed to be one of plausible causes of GPU hangup. Since the job to be done in the interrupt handler should be minimum, we move the reset function out of trigger and underrun, and push it into the prepare (and hw_free) callbacks instead. Here a new flag, need_reset, is introduced to indicate the requirement of the reset procedure. This is for avoiding the multiple resets when PCM prepare is called sequentially. Also in the UNDERRUN bit-clear sync loop, take a longer pause to be in the safer side. Taking a longer delay is no longer a problem now because we're running in the normal context. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-07ALSA: x86: Cache AUD_CONFIG register valueTakashi Iwai
At enabling the audio, we modify AUD_CONFIG register bit 0. So far, it does read-modify-write procedure with a special hack for the channel bits due to the silicon bug. But we can optimize it by remembering the AUD_CONFIG register value privately. This simplifies the things a lot. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-07ALSA: x86: Rearrange definesTakashi Iwai
We have two header files and everything is mixed up chaotically. Move the chip-specific definitions like the hardware registers to intel_hdmi_lpe_audio.h, and the rest, the implementation specific stuff into intel_hdmi_audio.h. In addition, put some more comments to the register fields, and fix the incorrect name prefix for AUD_HDMI_STATUS bits, too. The whole changes are merely a code shuffling, and there is no functional change. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-06ALSA: x86: Refactor PCM process engineTakashi Iwai
This is again a big rewrite of the driver; now it touches the code to process PCM stream transfers. The most fundamental change is that the driver may support more than four periods. Instead of keeping the same index between both the ring buffer (with the fixed four buffer descriptors) and the PCM buffer periods, we keep difference indices for both (bd_head and pcm_head fields). In addition, when the periods are more than four, we need to track both head and next indices. That is, we now have three indices: bd_head, pcm_head and pcm_filled. Also, the driver works better for periods < 4, too: the remaining BDs out of four are marked as invalid, so that the hardware skips those BDs in its loop. By this flexibility, we can use even ALSA-lib dmix plugin, which requires 16 periods as default. The buffer size could be up to 20bit, so the max buffer size was increased accordingly. However, the buffer pre-allocation is kept as the old value (600kB) as default. The reason is the limited number of BDs: since it doesn't suffice for the useful SG page management that can fit with the usual page allocator like some other drivers, we have to still allocate continuous pages, hence we shouldn't take too big memories there. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Rename drv_status to connectedTakashi Iwai
After the rewrite of the runtime PM code, we have only two driver status: CONNECTED and DISCONNECTED. So it's clearer to use a boolean flag, and name it easier one, "connected". Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Clean up unused defines and inclusionsTakashi Iwai
Many defines and constants are left unused. Clean them up. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Reduce redundant register field namesTakashi Iwai
Currently each register definition contains the own prefix in the union struct itself; for example, union aud_ch_status_0 has status_0_regx and status_0_regval fields. These are simply superfluous, since usually the type of the variable is seen in its declaration or in its name. In this patch, we cut off these prefixes. Now all register definitions have regx and regval fields consistently, instead. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Use the standard ELD bytes definitionsTakashi Iwai
We have some constants defined in drm/drm_edid.h, and clean up our own definitions. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Move stream status into pcm_stream_infoTakashi Iwai
The only remaining field in struct had_stream_data is stream_type that holds the current stream status. Such information fits better in struct pcm_stream_info, so move it as a boolean "running" field to be clearer. This allows us to get rid or had_stream_data definition and references. Also, the superfluous status check get removed in a couple of places where we can call PCM helpers in anyway. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Properly manage PCM substream lifetypeTakashi Iwai
The PCM substream is referred not only in the PCM callbacks but also in the irq handler and in the hotplug/unplug codes. The latter code paths don't take the PCM lock, thus the PCM may be released unexpectedly while calling PCM helper functions or accessing pcm->runtime fields. This patch implements a simple refcount to assure the PCM substream accessibility while the other codes are accessing. It needed some code refactoring in the relevant functions for avoiding the doubly spinlocks. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Drop unused fields from pcm_stream_infoTakashi Iwai
The struct pcm_stream_info contains a few unused or useless fields. str_id is always zero, buffer_ptr is volatile, never read, and sfreq is nowhere referred. Kill them. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Drop redundant had_stream_pvtTakashi Iwai
The had_stream_pvt struct assigned to PCM runtime private data tracks merely the stream running status, and the very same information is carried by had_stream->stream_type. Kill it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Drop superfluous state fieldTakashi Iwai
The state field keeps the connection state and it's basically as same as drv_status field. Drop this redundancy. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Drop flag_underrun fieldTakashi Iwai
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-03ALSA: x86: Fix racy access to chmapTakashi Iwai
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-03ALSA: x86: Remove _v[12] sufficesTakashi Iwai
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-03ALSA: x86: Drop unused fields from snd_intelhad structTakashi Iwai
Also change the flag_underrun to bool to be clearer. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Remove indirect call of snd_pcm_period_elapsed()Takashi Iwai
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-03ALSA: x86: Fold intel_hdmi_audio_if.c into main fileTakashi Iwai
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-03ALSA: x86: Flatten two abstraction layersTakashi Iwai
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-03ALSA: x86: Drop unused hdmi_audio_query()Takashi Iwai
It's used nowhere. Kill it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Embed snd_intelhad into snd_cardTakashi Iwai
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-03ALSA: x86: Drop unused hw_silence fieldTakashi Iwai
It's nowhere used. Let's drop it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-03ALSA: x86: Move the global underrun_count to struct snd_intelhadTakashi Iwai
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-03ALSA: x86: Call event callback directlyTakashi Iwai
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-03ALSA: x86: Pass snd_intelhad object to helpersTakashi Iwai
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-03ALSA: x86: Drop snd_intel_had_interface indirect callsTakashi Iwai
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-03ALSA: x86: Replace indirect query_ops with direct callsTakashi Iwai
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-03ALSA: x86: Replace indirect register ops with direct callsTakashi Iwai
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-03ALSA: x86: Drop indirect calls of had_opsTakashi Iwai
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-01ALSA: x86: intel_hdmi: add definitions and logic for DP audioPierre-Louis Bossart
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-01-25ALSA: x86: hdmi: Add audio support for BYT and CHTJerome Anand
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>