ALSA: Add definitions for CEA-861 Audio InfoFrames

Along with the IEC-60958 channel status word, CEA-861 Audio InfoFrames
are used in HDMI and DisplayPort to describe the parameters of the audio
stream. Hence, drivers for such devices may use these definitions to, for
instance, fill a CEA-861 data structure and pass it to a display driver.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: Provide interface for audio support in DSS

There exist several display technologies and standards that support audio as
well. Hence, it is relevant to update the DSS device driver to provide an audio
interface that may be used by an audio or any other driver interested in the
functionality.

The DSS audio functions are intended to be used as follows:

The audio_enable function is intended to prepare the relevant IP for playback
(e.g., enabling an audio FIFO, taking out of reset some IP, etc).

While the display may support audio, it is possible that for certain
configurations audio is not supported (e.g., an HDMI display using a VESA video
timing). The audio_detect function is intended to query whether the current
configuration of the display supports audio.

The audio_config function is intended to configure all the relevant audio
parameters of the display. In order to make the function independent of any DSS
device driver or IP, it takes an IEC-60958 channel status word struct as well
as a CEA-861 audio infoframe struct. At the moment, this should be enough to
support HDMI and DisplayPort, as both are based on CEA-861 and IEC-60958.

The audio_start function is intended to effectively start/stop audio playback
after the configuration has taken place.

Please note that asound.h is #included only to pass the relevant data
structures to the DSS device driver. The DSS device driver should
not link to any ALSA function as DSS and ALSA are built in separate modules.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: HDMI: Remove ASoC codec

Instead of having an ASoC codec embedded into DSS code, use the generic DSS
device driverinterface for audio support. This allows to any potential user,
including an ASoC driver, take advantage of the HDMI audio functionality.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: HDMI: OMAP4: Remove CEA-861 audio infoframe and IEC-60958 enums

In order to avoid duplication of definitions. Use the definitions provided
by asoundef.h. Furthermore, as CEA-861 and IEC-60958 are used by both
DisplayPort and HDMI, this helps to make the code more generic.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: HDMI: OMAP4: Correcty typo in I2S definitions

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: HDMI: OMAP4: Decouple wrapper enable and audio start

Decouple the enablement of the HDMI audio wrapper from audio start.
Otherwise, an audio FIFO underflow may occur. The audio wrapper
enablement must be done after configuration and before audio playback
is started.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: HDMI: Decouple HDMI audio from ASoC

Instead of having OMAPDSS HDMI audio functionality depending on the
ASoC HDMI audio driver, use a new config option so that
potential users, including ASoC,  may select if needed.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: HDMI: OMAP4: Expand configuration for IEC-60958 audio

Utilize a snd_aes_iec958 struct to write the parameters of the IEC-60958
channel status word into the HDMI IP registers. Hence, the user of the
driver has full control of what parameters are written in the word.

Also, some of the paramters of the I2S structure have been removed
as they belong to IEC-60958 parameteres.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: HDMI: Relocate N/CTS calculation

The N and CTS parameters are relevant to all HDMI implmentations and
not specific to a given IP. Hence, the calculation is relocated
into the generic HDMI driver.

Also, deep color is not queried but it is still considered in the
calculation of N. This is to be changed when deep color functionality is
implemented in the driver.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: HDMI: Add support for more audio sample rates in N/CTS calculation

Add support for more sample rates when calculating N and CTS. This
covers all the audio sample rates that an HDMI source is allowed
to transmit according to the HDMI 1.4a specification.

Also, reorganize the logic for the calculation when using deep color.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: HDMI: OMAP4: Add an audio configuration function

The generic HDMI driver does not need to know about the specific
settings of a given IP. Hence, it just passes the audio configuration
and the IP library parses such configuration and sets the IP
accordingly. This patch introduces an IP-specific audio configuration
function. Also the DMA, format and core config functions are no longer
exposed to the generic HDMI driver as they are IP-specific.

The audio configuration functions caters for 16-bit through 24-bit
audio samples with sample rates from 32kHz and up to 192kHz as well
as up to 8 audio channels.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
OMAPDSS: HDMI: Implement DSS driver interface for audio

Implement the DSS device driver audio support interface in the HDMI
panel driver and generic driver. The implementation relies on the
IP-specific functions that are defined at DSS probe time.

A HW-safe spinlock is used to protect the audio functions. This is because
the audio functions may be called while holding a lock; in such case,
the panel's driver mutex is not suitable. Functions should be used
to set registers and should not wait for any other event.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
ASoC: OMAP: HDMI: Select DSS HDMI audio support

This is to build support for HDMI audio as provided by DSS.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
ASoC: OMAP: HDMI: Change error values in HDMI CPU DAI

When getting the needed resources fails, return ENODEV. This is more
in line with other drivers do and it gives a more descriptive error.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
ASoC: OMAP: HDMI: Introduce codec

Introduce codec for HDMI. At the moment, this is a dummy codec. In the
future it will parse the EDID to modify the supported parameters, such
as the number of channels and the sample rates. At the moment, it blindly
supports all the sample rates and audio channels described in the HDMI
1.4a specification.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
ASoC: OMAP: Update Kconfig and Makefile files for HDMI audio codec

Update Makefile and Kconfig to select and build the HDMI audio codec.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
ASoC: OMAP: HDMI: Rename codec and codec_dai names

This is required to work with the dummy codec for HDMI.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
ASoC: OMAP: HDMI: Update CPU DAI configuration and ops

Add operations to the CPU DAI. This is to configure the HDMI IP
using DSS functionality.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
ASoC: OMAP: HDMI: Expand capabilities of the HDMI DAI

According to the HDMI specification, a source is permitted to
transmit L-PCM audio in the following sample rates: 32kHz, 44.1kHz,
48kHz, 88.2kHz, 96kHz, 176.4kHz or 192kHz.

It also supports up to 8 audio channels.

The sink may not necessarily support all these sample rates and
channels. However, as this CPU DAI describes the HDMI source, it
makes sense to include them. The limitation of capabilities as
supported by the sink should be done in the ASoC HDMI codec.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>