Based on 1 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation version 2 of the license this program
is distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-only
has been chosen to replace the boilerplate/reference in 100 file(s).
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141900.918357685@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This is an implementation of PCM streaming with only 1 period.
Since the hardware requires the refresh of BDs after each BD
processing finishes, we'd need at least two BDs. The trick is that
both BDs point to the same content: the address of the PCM buffer
head, and the whole buffer size. Then it loops over to the whole
buffer again after it finished once.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
The driver sets card->driver name string over its size (16 bytes).
Shorten the name string to fit with it.
Also, set more verbose string to card->shortname and ->longname.
This doesn't have to be identical with card->driver at all.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
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>
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>
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>
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>
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>
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>
Instead of referring to the global hlpe_pdev variable, pass the
platform device object to each function properly. Accessing to the
global object is really ugly and error-prone.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
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>
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>
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>
The v1 code refers to Medfield/Clovertrail. It's not used at all in
the current driver, and probably won't be ever. Let's clean this up,
then we can go to the next stage of cleanup tasks.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
On Baytrail and Cherrytrail, HDaudio may be fused out or disabled
by the BIOS. This driver enables an alternate path to the i915
display registers and DMA.
Although there is no hardware path between i915 display and LPE/SST
audio clusters, this HDMI capability is referred to in the documentation
as "HDMI LPE Audio" so we keep the name for consistency. There is no
hardware path or control dependencies with the LPE/SST DSP functionality.
The hdmi-lpe-audio driver will be probed when the i915 driver creates
a child platform device.
Since this driver is neither SoC nor PCI, a new x86 folder is added
Additional indirections in the code will be cleaned up in the next series
to aid smoother DP integration
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>