* [PATCH v7.1 13/19] OMAPDSS: hdmi4: Remove callbacks for the old ASoC DAI driver
From: Jyri Sarha @ 2014-11-12 14:41 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
Removes the OMAP4 HDMI audio callbacks for the old external DAI driver.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi4.c | 113 ---------------------------------
1 file changed, 113 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 764443e..6f6764c 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -468,112 +468,6 @@ static int hdmi_read_edid(struct omap_dss_device *dssdev,
return r;
}
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
-static int hdmi_audio_enable(struct omap_dss_device *dssdev)
-{
- int r;
-
- mutex_lock(&hdmi.lock);
-
- if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
- r = -EPERM;
- goto err;
- }
-
- r = hdmi_wp_audio_enable(&hdmi.wp, true);
- if (r)
- goto err;
-
- mutex_unlock(&hdmi.lock);
- return 0;
-
-err:
- mutex_unlock(&hdmi.lock);
- return r;
-}
-
-static void hdmi_audio_disable(struct omap_dss_device *dssdev)
-{
- hdmi_wp_audio_enable(&hdmi.wp, false);
-}
-
-static int hdmi_audio_start(struct omap_dss_device *dssdev)
-{
- return hdmi4_audio_start(&hdmi.core, &hdmi.wp);
-}
-
-static void hdmi_audio_stop(struct omap_dss_device *dssdev)
-{
- hdmi4_audio_stop(&hdmi.core, &hdmi.wp);
-}
-
-static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
-{
- bool r;
-
- mutex_lock(&hdmi.lock);
-
- r = hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode);
-
- mutex_unlock(&hdmi.lock);
- return r;
-}
-
-static int hdmi_audio_config(struct omap_dss_device *dssdev,
- struct omap_dss_audio *audio)
-{
- int r;
- u32 pclk = hdmi.cfg.timings.pixelclock;
-
- mutex_lock(&hdmi.lock);
-
- if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
- r = -EPERM;
- goto err;
- }
-
- r = hdmi4_audio_config(&hdmi.core, &hdmi.wp, audio, pclk);
- if (r)
- goto err;
-
- mutex_unlock(&hdmi.lock);
- return 0;
-
-err:
- mutex_unlock(&hdmi.lock);
- return r;
-}
-#else
-static int hdmi_audio_enable(struct omap_dss_device *dssdev)
-{
- return -EPERM;
-}
-
-static void hdmi_audio_disable(struct omap_dss_device *dssdev)
-{
-}
-
-static int hdmi_audio_start(struct omap_dss_device *dssdev)
-{
- return -EPERM;
-}
-
-static void hdmi_audio_stop(struct omap_dss_device *dssdev)
-{
-}
-
-static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
-{
- return false;
-}
-
-static int hdmi_audio_config(struct omap_dss_device *dssdev,
- struct omap_dss_audio *audio)
-{
- return -EPERM;
-}
-#endif
-
static int hdmi_set_infoframe(struct omap_dss_device *dssdev,
const struct hdmi_avi_infoframe *avi)
{
@@ -602,13 +496,6 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
.read_edid = hdmi_read_edid,
.set_infoframe = hdmi_set_infoframe,
.set_hdmi_mode = hdmi_set_hdmi_mode,
-
- .audio_enable = hdmi_audio_enable,
- .audio_disable = hdmi_audio_disable,
- .audio_start = hdmi_audio_start,
- .audio_stop = hdmi_audio_stop,
- .audio_supported = hdmi_audio_supported,
- .audio_config = hdmi_audio_config,
};
static void hdmi_init_output(struct platform_device *pdev)
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 12/19] OMAPDSS: hdmi.h: Add members to hdmi drvdata for audio implementation
From: Jyri Sarha @ 2014-11-12 14:41 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
Adds display_enabled flag and audio_abort_cb callback to struct hdmi.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index 6d129f2..bfaaf2f 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -366,10 +366,12 @@ struct omap_hdmi {
struct regulator *vdda_reg;
bool core_enabled;
+ bool display_enabled;
struct omap_dss_device output;
struct platform_device *audio_pdev;
+ void (*audio_abort_cb)(struct device *dev);
};
#endif
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 11/19] OMAPDSS: hdmi: Make hdmi_mode_has_audio() more user friedly
From: Jyri Sarha @ 2014-11-12 14:41 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index a6e08ff..6d129f2 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -345,9 +345,9 @@ void hdmi_wp_audio_config_format(struct hdmi_wp_data *wp,
struct hdmi_audio_format *aud_fmt);
void hdmi_wp_audio_config_dma(struct hdmi_wp_data *wp,
struct hdmi_audio_dma *aud_dma);
-static inline bool hdmi_mode_has_audio(int mode)
+static inline bool hdmi_mode_has_audio(struct hdmi_config *cfg)
{
- return mode = HDMI_HDMI ? true : false;
+ return cfg->hdmi_dvi_mode = HDMI_HDMI ? true : false;
}
/* HDMI DRV data */
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 10/19] OMAPDSS: Kconfig: Remove HDMI audio booleans from Kconfig
From: Jyri Sarha @ 2014-11-12 14:41 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
The booleans are not used anymore. Just select SND_OMAP_SOC_HDMI_AUDIO
to enable OMAP HDMI audio support.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/Kconfig | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/Kconfig b/drivers/video/fbdev/omap2/dss/Kconfig
index 3d5eb6c..d1fa730 100644
--- a/drivers/video/fbdev/omap2/dss/Kconfig
+++ b/drivers/video/fbdev/omap2/dss/Kconfig
@@ -74,9 +74,6 @@ config OMAP4_DSS_HDMI
help
HDMI support for OMAP4 based SoCs.
-config OMAP4_DSS_HDMI_AUDIO
- bool
-
config OMAP5_DSS_HDMI
bool "HDMI support for OMAP5"
default n
@@ -86,10 +83,6 @@ config OMAP5_DSS_HDMI
Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
specification.
-config OMAP5_DSS_HDMI_AUDIO
- depends on OMAP5_DSS_HDMI
- bool
-
config OMAP2_DSS_SDI
bool "SDI support"
default n
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 09/19] ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio support
From: Jyri Sarha @ 2014-11-12 14:41 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
The platform device should only be registered from OMAPDSS HDMI
driver. The platform driver registers and unregisters all ASoC
components needed for OMAP HDMI audio.
The hdmi audio driver implements cpu-dai component using the callbacks
provided by OMAPDSS and registers the component under DSS HDMI
device. Omap-pcm is registered for platform component also under DSS
HDMI device. Dummy codec is used as as codec component. The hdmi audio
driver implements also the card and registers it under its own
platform device.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
include/sound/omap-hdmi-audio.h | 43 ++++
sound/soc/omap/Kconfig | 15 ++
sound/soc/omap/Makefile | 2 +
sound/soc/omap/omap-hdmi-audio.c | 407 ++++++++++++++++++++++++++++++++++++++
4 files changed, 467 insertions(+)
create mode 100644 include/sound/omap-hdmi-audio.h
create mode 100644 sound/soc/omap/omap-hdmi-audio.c
diff --git a/include/sound/omap-hdmi-audio.h b/include/sound/omap-hdmi-audio.h
new file mode 100644
index 0000000..afdb416
--- /dev/null
+++ b/include/sound/omap-hdmi-audio.h
@@ -0,0 +1,43 @@
+/*
+ * hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Author: Jyri Sarha <jsarha@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+
+#include <video/omapdss.h>
+
+#ifndef __OMAP_HDMI_AUDIO_H__
+#define __OMAP_HDMI_AUDIO_H__
+
+struct omap_hdmi_audio_ops {
+ int (*audio_startup)(struct device *dev,
+ void (*abort_cb)(struct device *dev));
+ int (*audio_shutdown)(struct device *dev);
+ int (*audio_start)(struct device *dev);
+ void (*audio_stop)(struct device *dev);
+ int (*audio_config)(struct device *dev,
+ struct omap_dss_audio *dss_audio);
+};
+
+/* HDMI audio initalization data */
+struct omap_hdmi_audio_pdata {
+ struct device *dev;
+ enum omapdss_version dss_version;
+ phys_addr_t audio_dma_addr;
+
+ const struct omap_hdmi_audio_ops *ops;
+};
+
+#endif /* __OMAP_HDMI_AUDIO_H__ */
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index d44463a..2b32b3e 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -15,6 +15,21 @@ config SND_OMAP_SOC_MCPDM
config SND_OMAP_SOC_HDMI
tristate
+config SND_OMAP_SOC_HDMI_AUDIO
+ tristate "HDMI audio support for OMAP4+ based SoCs"
+ depends on SND_OMAP_SOC
+ help
+ For HDMI audio to work OMAPDSS HDMI support should be
+ enabled.
+ The hdmi audio driver implements cpu-dai component using the
+ callbacks provided by OMAPDSS and registers the component
+ under DSS HDMI device. Omap-pcm is registered for platform
+ component also under DSS HDMI device. Dummy codec is used as
+ as codec component. The hdmi audio driver implements also
+ the card and registers it under its own platform device.
+ The device for the dirver is registered by OMAPDSS hdmi
+ driver.
+
config SND_OMAP_SOC_N810
tristate "SoC Audio support for Nokia N810"
depends on SND_OMAP_SOC && MACH_NOKIA_N810 && I2C
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index a725905..40688a6 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -4,12 +4,14 @@ snd-soc-omap-dmic-objs := omap-dmic.o
snd-soc-omap-mcbsp-objs := omap-mcbsp.o mcbsp.o
snd-soc-omap-mcpdm-objs := omap-mcpdm.o
snd-soc-omap-hdmi-objs := omap-hdmi.o
+snd-soc-omap-hdmi-audio-objs := omap-hdmi-audio.o
obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
+obj-$(CONFIG_SND_OMAP_SOC_HDMI_AUDIO) += snd-soc-omap-hdmi-audio.o
# OMAP Machine Support
snd-soc-n810-objs := n810.o
diff --git a/sound/soc/omap/omap-hdmi-audio.c b/sound/soc/omap/omap-hdmi-audio.c
new file mode 100644
index 0000000..3f9ac7d
--- /dev/null
+++ b/sound/soc/omap/omap-hdmi-audio.c
@@ -0,0 +1,407 @@
+/*
+ * omap-hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Author: Jyri Sarha <jsarha@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <sound/soc.h>
+#include <sound/pcm_params.h>
+#include <sound/dmaengine_pcm.h>
+#include <uapi/sound/asound.h>
+#include <sound/asoundef.h>
+#include <sound/omap-pcm.h>
+#include <sound/omap-hdmi-audio.h>
+#include <video/omapdss.h>
+
+#define DRV_NAME "omap-hdmi-audio"
+
+struct hdmi_audio_data {
+ struct snd_soc_card *card;
+
+ const struct omap_hdmi_audio_ops *ops;
+ struct device *dssdev;
+ struct snd_dmaengine_dai_dma_data dma_data;
+ struct omap_dss_audio dss_audio;
+ struct snd_aes_iec958 iec;
+ struct snd_cea_861_aud_if cea;
+
+ struct mutex current_stream_lock;
+ struct snd_pcm_substream *current_stream;
+};
+
+static
+struct hdmi_audio_data *card_drvdata_substream(struct snd_pcm_substream *ss)
+{
+ struct snd_soc_pcm_runtime *rtd = ss->private_data;
+
+ return snd_soc_card_get_drvdata(rtd->card);
+}
+
+static void hdmi_dai_abort(struct device *dev)
+{
+ struct hdmi_audio_data *ad = dev_get_drvdata(dev);
+
+ mutex_lock(&ad->current_stream_lock);
+ if (ad->current_stream && ad->current_stream->runtime &&
+ snd_pcm_running(ad->current_stream)) {
+ dev_err(dev, "HDMI display disabled, aborting playback\n");
+ snd_pcm_stream_lock_irq(ad->current_stream);
+ snd_pcm_stop(ad->current_stream, SNDRV_PCM_STATE_DISCONNECTED);
+ snd_pcm_stream_unlock_irq(ad->current_stream);
+ }
+ mutex_unlock(&ad->current_stream_lock);
+}
+
+static int hdmi_dai_startup(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct hdmi_audio_data *ad = card_drvdata_substream(substream);
+ int ret;
+ /*
+ * Make sure that the period bytes are multiple of the DMA packet size.
+ * Largest packet size we use is 32 32-bit words = 128 bytes
+ */
+ ret = snd_pcm_hw_constraint_step(substream->runtime, 0,
+ SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 128);
+ if (ret < 0) {
+ dev_err(dai->dev, "could not apply constraint\n");
+ return ret;
+ }
+
+ snd_soc_dai_set_dma_data(dai, substream, &ad->dma_data);
+
+ mutex_lock(&ad->current_stream_lock);
+ ad->current_stream = substream;
+ mutex_unlock(&ad->current_stream_lock);
+
+ ret = ad->ops->audio_startup(ad->dssdev, hdmi_dai_abort);
+
+ if (ret) {
+ mutex_lock(&ad->current_stream_lock);
+ ad->current_stream = NULL;
+ mutex_unlock(&ad->current_stream_lock);
+ }
+
+ return ret;
+}
+
+static int hdmi_dai_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct hdmi_audio_data *ad = card_drvdata_substream(substream);
+ struct snd_aes_iec958 *iec = &ad->iec;
+ struct snd_cea_861_aud_if *cea = &ad->cea;
+
+ WARN_ON(ad->current_stream != substream);
+
+ switch (params_format(params)) {
+ case SNDRV_PCM_FORMAT_S16_LE:
+ ad->dma_data.maxburst = 16;
+ break;
+ case SNDRV_PCM_FORMAT_S24_LE:
+ ad->dma_data.maxburst = 32;
+ break;
+ default:
+ dev_err(dai->dev, "format not supported!\n");
+ return -EINVAL;
+ }
+
+ ad->dss_audio.iec = iec;
+ ad->dss_audio.cea = cea;
+ /*
+ * fill the IEC-60958 channel status word
+ */
+ /* initialize the word bytes */
+ memset(iec->status, 0, sizeof(iec->status));
+
+ /* specify IEC-60958-3 (commercial use) */
+ iec->status[0] &= ~IEC958_AES0_PROFESSIONAL;
+
+ /* specify that the audio is LPCM*/
+ iec->status[0] &= ~IEC958_AES0_NONAUDIO;
+
+ iec->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT;
+
+ iec->status[0] |= IEC958_AES0_CON_EMPHASIS_NONE;
+
+ iec->status[0] |= IEC958_AES1_PRO_MODE_NOTID;
+
+ iec->status[1] = IEC958_AES1_CON_GENERAL;
+
+ iec->status[2] |= IEC958_AES2_CON_SOURCE_UNSPEC;
+
+ iec->status[2] |= IEC958_AES2_CON_CHANNEL_UNSPEC;
+
+ switch (params_rate(params)) {
+ case 32000:
+ iec->status[3] |= IEC958_AES3_CON_FS_32000;
+ break;
+ case 44100:
+ iec->status[3] |= IEC958_AES3_CON_FS_44100;
+ break;
+ case 48000:
+ iec->status[3] |= IEC958_AES3_CON_FS_48000;
+ break;
+ case 88200:
+ iec->status[3] |= IEC958_AES3_CON_FS_88200;
+ break;
+ case 96000:
+ iec->status[3] |= IEC958_AES3_CON_FS_96000;
+ break;
+ case 176400:
+ iec->status[3] |= IEC958_AES3_CON_FS_176400;
+ break;
+ case 192000:
+ iec->status[3] |= IEC958_AES3_CON_FS_192000;
+ break;
+ default:
+ dev_err(dai->dev, "rate not supported!\n");
+ return -EINVAL;
+ }
+
+ /* specify the clock accuracy */
+ iec->status[3] |= IEC958_AES3_CON_CLOCK_1000PPM;
+
+ /*
+ * specify the word length. The same word length value can mean
+ * two different lengths. Hence, we need to specify the maximum
+ * word length as well.
+ */
+ switch (params_format(params)) {
+ case SNDRV_PCM_FORMAT_S16_LE:
+ iec->status[4] |= IEC958_AES4_CON_WORDLEN_20_16;
+ iec->status[4] &= ~IEC958_AES4_CON_MAX_WORDLEN_24;
+ break;
+ case SNDRV_PCM_FORMAT_S24_LE:
+ iec->status[4] |= IEC958_AES4_CON_WORDLEN_24_20;
+ iec->status[4] |= IEC958_AES4_CON_MAX_WORDLEN_24;
+ break;
+ default:
+ dev_err(dai->dev, "format not supported!\n");
+ return -EINVAL;
+ }
+
+ /*
+ * Fill the CEA-861 audio infoframe (see spec for details)
+ */
+
+ cea->db1_ct_cc = (params_channels(params) - 1)
+ & CEA861_AUDIO_INFOFRAME_DB1CC;
+ cea->db1_ct_cc |= CEA861_AUDIO_INFOFRAME_DB1CT_FROM_STREAM;
+
+ cea->db2_sf_ss = CEA861_AUDIO_INFOFRAME_DB2SF_FROM_STREAM;
+ cea->db2_sf_ss |= CEA861_AUDIO_INFOFRAME_DB2SS_FROM_STREAM;
+
+ cea->db3 = 0; /* not used, all zeros */
+
+ /*
+ * The OMAP HDMI IP requires to use the 8-channel channel code when
+ * transmitting more than two channels.
+ */
+ if (params_channels(params) = 2)
+ cea->db4_ca = 0x0;
+ else
+ cea->db4_ca = 0x13;
+
+ cea->db5_dminh_lsv = CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED;
+ /* the expression is trivial but makes clear what we are doing */
+ cea->db5_dminh_lsv |= (0 & CEA861_AUDIO_INFOFRAME_DB5_LSV);
+
+ return ad->ops->audio_config(ad->dssdev, &ad->dss_audio);
+}
+
+static int hdmi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
+ struct snd_soc_dai *dai)
+{
+ struct hdmi_audio_data *ad = card_drvdata_substream(substream);
+ int err = 0;
+
+ WARN_ON(ad->current_stream != substream);
+
+ switch (cmd) {
+ case SNDRV_PCM_TRIGGER_START:
+ case SNDRV_PCM_TRIGGER_RESUME:
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+ err = ad->ops->audio_start(ad->dssdev);
+ break;
+ case SNDRV_PCM_TRIGGER_STOP:
+ case SNDRV_PCM_TRIGGER_SUSPEND:
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+ ad->ops->audio_stop(ad->dssdev);
+ break;
+ default:
+ err = -EINVAL;
+ }
+ return err;
+}
+
+static void hdmi_dai_shutdown(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct hdmi_audio_data *ad = card_drvdata_substream(substream);
+
+ WARN_ON(ad->current_stream != substream);
+
+ ad->ops->audio_shutdown(ad->dssdev);
+
+ mutex_lock(&ad->current_stream_lock);
+ ad->current_stream = NULL;
+ mutex_unlock(&ad->current_stream_lock);
+}
+
+static const struct snd_soc_dai_ops hdmi_dai_ops = {
+ .startup = hdmi_dai_startup,
+ .hw_params = hdmi_dai_hw_params,
+ .trigger = hdmi_dai_trigger,
+ .shutdown = hdmi_dai_shutdown,
+};
+
+static const struct snd_soc_component_driver omap_hdmi_component = {
+ .name = "omapdss_hdmi",
+};
+
+static struct snd_soc_dai_driver omap5_hdmi_dai = {
+ .name = "omap5-hdmi-dai",
+ .playback = {
+ .channels_min = 2,
+ .channels_max = 8,
+ .rates = (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
+ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 |
+ SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |
+ SNDRV_PCM_RATE_192000),
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ },
+ .ops = &hdmi_dai_ops,
+};
+
+static struct snd_soc_dai_driver omap4_hdmi_dai = {
+ .name = "omap4-hdmi-dai",
+ .playback = {
+ .channels_min = 2,
+ .channels_max = 8,
+ .rates = (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
+ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 |
+ SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |
+ SNDRV_PCM_RATE_192000),
+ .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
+ },
+ .ops = &hdmi_dai_ops,
+};
+
+static int omap_hdmi_audio_probe(struct platform_device *pdev)
+{
+ struct omap_hdmi_audio_pdata *ha = pdev->dev.platform_data;
+ struct device *dev = &pdev->dev;
+ struct hdmi_audio_data *ad;
+ struct snd_soc_dai_driver *dai_drv;
+ struct snd_soc_card *card;
+ int ret;
+
+ if (!ha) {
+ dev_err(dev, "No platform data\n");
+ return -EINVAL;
+ }
+
+ ad = devm_kzalloc(dev, sizeof(*ad), GFP_KERNEL);
+ if (!ad)
+ return -ENOMEM;
+ ad->dssdev = ha->dev;
+ ad->ops = ha->ops;
+ ad->dma_data.addr = ha->audio_dma_addr;
+ ad->dma_data.filter_data = "audio_tx";
+ ad->dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+ mutex_init(&ad->current_stream_lock);
+
+ switch (ha->dss_version) {
+ case OMAPDSS_VER_OMAP4430_ES1:
+ case OMAPDSS_VER_OMAP4430_ES2:
+ case OMAPDSS_VER_OMAP4:
+ dai_drv = &omap4_hdmi_dai;
+ break;
+ case OMAPDSS_VER_OMAP5:
+ dai_drv = &omap5_hdmi_dai;
+ break;
+ default:
+ return -EINVAL;
+ }
+ ret = snd_soc_register_component(ad->dssdev, &omap_hdmi_component,
+ dai_drv, 1);
+ if (ret)
+ return ret;
+
+ ret = omap_pcm_platform_register(ad->dssdev);
+ if (ret)
+ return ret;
+
+ card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
+ card->name = devm_kasprintf(dev, GFP_KERNEL,
+ "HDMI %s", dev_name(ad->dssdev));
+ card->owner = THIS_MODULE;
+ card->dai_link + devm_kzalloc(dev, sizeof(*(card->dai_link)), GFP_KERNEL);
+ card->dai_link->name = card->name;
+ card->dai_link->stream_name = card->name;
+ card->dai_link->cpu_dai_name = dev_name(ad->dssdev);
+ card->dai_link->platform_name = dev_name(ad->dssdev);
+ card->dai_link->codec_name = "snd-soc-dummy";
+ card->dai_link->codec_dai_name = "snd-soc-dummy-dai";
+ card->num_links = 1;
+ card->dev = dev;
+
+ ret = snd_soc_register_card(card);
+ if (ret) {
+ dev_err(dev, "snd_soc_register_card failed (%d)\n", ret);
+ snd_soc_unregister_component(ad->dssdev);
+ return ret;
+ }
+
+ ad->card = card;
+ snd_soc_card_set_drvdata(card, ad);
+
+ dev_set_drvdata(dev, ad);
+
+ return 0;
+}
+
+static int omap_hdmi_audio_remove(struct platform_device *pdev)
+{
+ struct hdmi_audio_data *ad = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(ad->card);
+ snd_soc_unregister_component(ad->dssdev);
+ return 0;
+}
+
+static struct platform_driver hdmi_audio_driver = {
+ .driver = {
+ .name = DRV_NAME,
+ .owner = THIS_MODULE,
+ },
+ .probe = omap_hdmi_audio_probe,
+ .remove = omap_hdmi_audio_remove,
+};
+
+module_platform_driver(hdmi_audio_driver);
+
+MODULE_AUTHOR("Jyri Sarha <jsarha@ti.com>");
+MODULE_DESCRIPTION("OMAP HDMI Audio Driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:" DRV_NAME);
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 08/19] OMAPDSS: hdmi: Add pdev pointer for audio_pdev in HDMI DRV data
From: Jyri Sarha @ 2014-11-12 14:40 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
This is used to store omap-hdmi-audio pdev for unregistering it.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index 6bf077b..a6e08ff 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -368,6 +368,8 @@ struct omap_hdmi {
bool core_enabled;
struct omap_dss_device output;
+
+ struct platform_device *audio_pdev;
};
#endif
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 07/19] OMAPDSS: hdmi: Make hdmi structure public
From: Jyri Sarha @ 2014-11-12 14:40 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
Unify the private anonymous struct in hdmi4.c and hdmi5.c, name it as
struct omap_hdmi, and make it public in hdmi.h.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi.h | 21 +++++++++++++++++++++
drivers/video/fbdev/omap2/dss/hdmi4.c | 31 ++++++++-----------------------
drivers/video/fbdev/omap2/dss/hdmi5.c | 20 ++------------------
3 files changed, 31 insertions(+), 41 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index 9ba7c1a..6bf077b 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -349,4 +349,25 @@ static inline bool hdmi_mode_has_audio(int mode)
{
return mode = HDMI_HDMI ? true : false;
}
+
+/* HDMI DRV data */
+struct omap_hdmi {
+ struct mutex lock;
+ struct platform_device *pdev;
+
+ struct hdmi_wp_data wp;
+ struct hdmi_pll_data pll;
+ struct hdmi_phy_data phy;
+ struct hdmi_core_data core;
+
+ struct hdmi_config cfg;
+
+ struct clk *sys_clk;
+ struct regulator *vdda_reg;
+
+ bool core_enabled;
+
+ struct omap_dss_device output;
+};
+
#endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 9a8713c..764443e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -37,25 +37,9 @@
#include "hdmi4_core.h"
#include "dss.h"
#include "dss_features.h"
+#include "hdmi.h"
-static struct {
- struct mutex lock;
- struct platform_device *pdev;
-
- struct hdmi_wp_data wp;
- struct hdmi_pll_data pll;
- struct hdmi_phy_data phy;
- struct hdmi_core_data core;
-
- struct hdmi_config cfg;
-
- struct clk *sys_clk;
- struct regulator *vdda_hdmi_dac_reg;
-
- bool core_enabled;
-
- struct omap_dss_device output;
-} hdmi;
+static struct omap_hdmi hdmi;
static int hdmi_runtime_get(void)
{
@@ -117,7 +101,7 @@ static int hdmi_init_regulator(void)
int r;
struct regulator *reg;
- if (hdmi.vdda_hdmi_dac_reg != NULL)
+ if (hdmi.vdda_reg != NULL)
return 0;
reg = devm_regulator_get(&hdmi.pdev->dev, "vdda");
@@ -137,7 +121,7 @@ static int hdmi_init_regulator(void)
}
}
- hdmi.vdda_hdmi_dac_reg = reg;
+ hdmi.vdda_reg = reg;
return 0;
}
@@ -146,7 +130,7 @@ static int hdmi_power_on_core(struct omap_dss_device *dssdev)
{
int r;
- r = regulator_enable(hdmi.vdda_hdmi_dac_reg);
+ r = regulator_enable(hdmi.vdda_reg);
if (r)
return r;
@@ -162,7 +146,7 @@ static int hdmi_power_on_core(struct omap_dss_device *dssdev)
return 0;
err_runtime_get:
- regulator_disable(hdmi.vdda_hdmi_dac_reg);
+ regulator_disable(hdmi.vdda_reg);
return r;
}
@@ -172,7 +156,7 @@ static void hdmi_power_off_core(struct omap_dss_device *dssdev)
hdmi.core_enabled = false;
hdmi_runtime_put();
- regulator_disable(hdmi.vdda_hdmi_dac_reg);
+ regulator_disable(hdmi.vdda_reg);
}
static int hdmi_power_on_full(struct omap_dss_device *dssdev)
@@ -678,6 +662,7 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
int irq;
hdmi.pdev = pdev;
+ dev_set_drvdata(&pdev->dev, &hdmi);
mutex_init(&hdmi.lock);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c
index 169b764..694cdee 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -43,24 +43,7 @@
#include "dss.h"
#include "dss_features.h"
-static struct {
- struct mutex lock;
- struct platform_device *pdev;
-
- struct hdmi_wp_data wp;
- struct hdmi_pll_data pll;
- struct hdmi_phy_data phy;
- struct hdmi_core_data core;
-
- struct hdmi_config cfg;
-
- struct clk *sys_clk;
- struct regulator *vdda_reg;
-
- bool core_enabled;
-
- struct omap_dss_device output;
-} hdmi;
+static struct omap_hdmi hdmi;
static int hdmi_runtime_get(void)
{
@@ -703,6 +686,7 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
int irq;
hdmi.pdev = pdev;
+ dev_set_drvdata(&pdev->dev, &hdmi);
mutex_init(&hdmi.lock);
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 06/19] OMAPDSS: hdmi_wp: Add function for getting audio dma address
From: Jyri Sarha @ 2014-11-12 14:40 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
The audio dma port is found in the hdmi_wp physical address space.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi.h | 2 ++
drivers/video/fbdev/omap2/dss/hdmi_wp.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index 03726b5..9ba7c1a 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -250,6 +250,7 @@ struct hdmi_core_audio_config {
struct hdmi_wp_data {
void __iomem *base;
+ phys_addr_t phys_base;
};
struct hdmi_pll_data {
@@ -317,6 +318,7 @@ void hdmi_wp_video_config_timing(struct hdmi_wp_data *wp,
void hdmi_wp_init_vid_fmt_timings(struct hdmi_video_format *video_fmt,
struct omap_video_timings *timings, struct hdmi_config *param);
int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp);
+phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp);
/* HDMI PLL funcs */
int hdmi_pll_enable(struct hdmi_pll_data *pll, struct hdmi_wp_data *wp);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_wp.c b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
index 4ead962..c15377e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_wp.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
@@ -249,6 +249,7 @@ int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp)
DSSERR("can't get WP mem resource\n");
return -EINVAL;
}
+ wp->phys_base = res->start;
wp->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(wp->base)) {
@@ -258,3 +259,8 @@ int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp)
return 0;
}
+
+phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp)
+{
+ return wp->phys_base + HDMI_WP_AUDIO_DATA;
+}
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 05/19] OMAPDSS: hdmi4_core: Remove unused hdmi4_audio_get_dma_port()
From: Jyri Sarha @ 2014-11-12 14:40 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
hdmi4_audio_get_dma_port() is unused and and broken.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi4_core.c | 9 ---------
drivers/video/fbdev/omap2/dss/hdmi4_core.h | 2 --
2 files changed, 11 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.c b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
index 3b448d9..7eafea5 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
@@ -874,15 +874,6 @@ void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp)
hdmi_wp_audio_core_req_enable(wp, false);
}
-int hdmi4_audio_get_dma_port(u32 *offset, u32 *size)
-{
- if (!offset || !size)
- return -EINVAL;
- *offset = HDMI_WP_AUDIO_DATA;
- *size = 4;
- return 0;
-}
-
int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
{
struct resource *res;
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.h b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
index c1959f7..a069f96 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
@@ -270,6 +270,4 @@ int hdmi4_audio_start(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
struct omap_dss_audio *audio, u32 pclk);
-int hdmi4_audio_get_dma_port(u32 *offset, u32 *size);
-
#endif
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 04/19] OMAPDSS: hdmi: Remove most of OMAP[45]_DSS_HDMI_AUDIO ifdefs
From: Jyri Sarha @ 2014-11-12 14:40 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
It does not waste too many bytes to compile all audio related core
functions always in with HDMI support. It should help readability and
in keeping the audio code in working shape. Leave the options just for
disabling and enabling the functionality in hdmi[45].c.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi.h | 3 +--
drivers/video/fbdev/omap2/dss/hdmi4_core.c | 5 -----
drivers/video/fbdev/omap2/dss/hdmi4_core.h | 2 --
drivers/video/fbdev/omap2/dss/hdmi5_core.c | 6 ------
drivers/video/fbdev/omap2/dss/hdmi5_core.h | 2 --
drivers/video/fbdev/omap2/dss/hdmi_common.c | 2 --
drivers/video/fbdev/omap2/dss/hdmi_wp.c | 2 --
7 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index 1f01068..03726b5 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -335,7 +335,7 @@ int hdmi_phy_parse_lanes(struct hdmi_phy_data *phy, const u32 *lanes);
int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep,
struct hdmi_phy_data *phy);
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) || defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
+/* Audio funcs */
int hdmi_compute_acr(u32 pclk, u32 sample_freq, u32 *n, u32 *cts);
int hdmi_wp_audio_enable(struct hdmi_wp_data *wp, bool enable);
int hdmi_wp_audio_core_req_enable(struct hdmi_wp_data *wp, bool enable);
@@ -348,4 +348,3 @@ static inline bool hdmi_mode_has_audio(int mode)
return mode = HDMI_HDMI ? true : false;
}
#endif
-#endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.c b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
index 4ad39cf..3b448d9 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
@@ -31,10 +31,8 @@
#include <linux/platform_device.h>
#include <linux/string.h>
#include <linux/seq_file.h>
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
#include <sound/asound.h>
#include <sound/asoundef.h>
-#endif
#include "hdmi4_core.h"
#include "dss_features.h"
@@ -530,7 +528,6 @@ void hdmi4_core_dump(struct hdmi_core_data *core, struct seq_file *s)
DUMPCOREAV(HDMI_CORE_AV_CEC_ADDR_ID);
}
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
static void hdmi_core_audio_config(struct hdmi_core_data *core,
struct hdmi_core_audio_config *cfg)
{
@@ -886,8 +883,6 @@ int hdmi4_audio_get_dma_port(u32 *offset, u32 *size)
return 0;
}
-#endif
-
int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
{
struct resource *res;
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.h b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
index 827909e..c1959f7 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
@@ -266,12 +266,10 @@ void hdmi4_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
void hdmi4_core_dump(struct hdmi_core_data *core, struct seq_file *s);
int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core);
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
int hdmi4_audio_start(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
struct omap_dss_audio *audio, u32 pclk);
int hdmi4_audio_get_dma_port(u32 *offset, u32 *size);
-#endif
#endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.c b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
index 9ffa805..a711579 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
@@ -30,10 +30,8 @@
#include <linux/string.h>
#include <linux/seq_file.h>
#include <drm/drm_edid.h>
-#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
#include <sound/asound.h>
#include <sound/asoundef.h>
-#endif
#include "hdmi5_core.h"
@@ -644,9 +642,6 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
hdmi_core_enable_interrupts(core);
}
-
-#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
-
static void hdmi5_core_audio_config(struct hdmi_core_data *core,
struct hdmi_core_audio_config *cfg)
{
@@ -897,7 +892,6 @@ int hdmi5_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
return 0;
}
-#endif
int hdmi5_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
{
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.h b/drivers/video/fbdev/omap2/dss/hdmi5_core.h
index ce7e9f3..f2f1022 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.h
@@ -299,8 +299,6 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
struct hdmi_config *cfg);
int hdmi5_core_init(struct platform_device *pdev, struct hdmi_core_data *core);
-#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
int hdmi5_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
struct omap_dss_audio *audio, u32 pclk);
#endif
-#endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_common.c b/drivers/video/fbdev/omap2/dss/hdmi_common.c
index 7d5f103..1b8fcc6 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_common.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_common.c
@@ -48,7 +48,6 @@ int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep,
return 0;
}
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
int hdmi_compute_acr(u32 pclk, u32 sample_freq, u32 *n, u32 *cts)
{
u32 deep_color;
@@ -147,4 +146,3 @@ int hdmi_compute_acr(u32 pclk, u32 sample_freq, u32 *n, u32 *cts)
return 0;
}
-#endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_wp.c b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
index 71b499e..4ead962 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_wp.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
@@ -185,7 +185,6 @@ void hdmi_wp_init_vid_fmt_timings(struct hdmi_video_format *video_fmt,
timings->interlace = param->timings.interlace;
}
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) || defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
void hdmi_wp_audio_config_format(struct hdmi_wp_data *wp,
struct hdmi_audio_format *aud_fmt)
{
@@ -240,7 +239,6 @@ int hdmi_wp_audio_core_req_enable(struct hdmi_wp_data *wp, bool enable)
return 0;
}
-#endif
int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp)
{
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 03/19] OMAPDSS: hdmi.h: Add HDMI_AUDIO_LAYOUT_6CH enum value
From: Jyri Sarha @ 2014-11-12 14:40 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
The OMAP5 HDMI audio implementation needs HDMI_AUDIO_LAYOUT_6CH in
hdmi_core_audio_layout enum. I found the correct value from ti-linux
3.8 tree.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index 262771b..1f01068 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -160,7 +160,8 @@ enum hdmi_audio_blk_strt_end_sig {
enum hdmi_core_audio_layout {
HDMI_AUDIO_LAYOUT_2CH = 0,
- HDMI_AUDIO_LAYOUT_8CH = 1
+ HDMI_AUDIO_LAYOUT_8CH = 1,
+ HDMI_AUDIO_LAYOUT_6CH = 2
};
enum hdmi_core_cts_mode {
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 02/19] OMAPDSS: hdmi5_core: Initialize mandatory sample_order parameter
From: Jyri Sarha @ 2014-11-12 14:40 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
The hdmi_wp_audio_config_format() expects sample_order of struct
hdmi_audio_format to be initialized. The only allowed value is
HDMI_AUDIO_SAMPLE_LEFT_FIRST.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi5_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.c b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
index 83acbf7..9ffa805 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
@@ -879,6 +879,9 @@ int hdmi5_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
/* only LPCM atm */
audio_format.type = HDMI_AUDIO_TYPE_LPCM;
+ /* only allowed option */
+ audio_format.sample_order = HDMI_AUDIO_SAMPLE_LEFT_FIRST;
+
/* disable start/stop signals of IEC 60958 blocks */
audio_format.en_sig_blk_strt_end = HDMI_AUDIO_BLOCK_SIG_STARTEND_ON;
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 01/19] OMAPDSS: hdmi_wp: Protect reserved bits in hdmi_wp_audio_config_format()
From: Jyri Sarha @ 2014-11-12 14:40 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
In-Reply-To: <cover.1415803064.git.jsarha@ti.com>
Only OMAP4 DSS has non reserved bits above 6th bit in HDMI_WP_AUDIO_CFG.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi_wp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_wp.c b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
index 496327e..71b499e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_wp.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
@@ -194,8 +194,12 @@ void hdmi_wp_audio_config_format(struct hdmi_wp_data *wp,
DSSDBG("Enter hdmi_wp_audio_config_format\n");
r = hdmi_read_reg(wp->base, HDMI_WP_AUDIO_CFG);
- r = FLD_MOD(r, aud_fmt->stereo_channels, 26, 24);
- r = FLD_MOD(r, aud_fmt->active_chnnls_msk, 23, 16);
+ if (omapdss_get_version() = OMAPDSS_VER_OMAP4430_ES1 ||
+ omapdss_get_version() = OMAPDSS_VER_OMAP4430_ES2 ||
+ omapdss_get_version() = OMAPDSS_VER_OMAP4) {
+ r = FLD_MOD(r, aud_fmt->stereo_channels, 26, 24);
+ r = FLD_MOD(r, aud_fmt->active_chnnls_msk, 23, 16);
+ }
r = FLD_MOD(r, aud_fmt->en_sig_blk_strt_end, 5, 5);
r = FLD_MOD(r, aud_fmt->type, 4, 4);
r = FLD_MOD(r, aud_fmt->justification, 3, 3);
--
1.7.9.5
^ permalink raw reply related
* [PATCH v7.1 00/19] Rework OMAP4+ HDMI audio support
From: Jyri Sarha @ 2014-11-12 14:40 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen,
Jyri Sarha
The patches are based on:
git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git for-next
The base, the patches, and couple of additional not-to-be-merged
omap2plus_defconfig patches can be found here:
https://github.com/jsarha/linux.git omap-hdmi-audio
It would make the most sense to get these in trough fbdev tree. So it
would be nice to get acked-bys (if the patches are Ok) for ASoC side
changes from appropriate maintainers.
Changes since v7:
- Squash:
- "OMAPDSS: omapdss.h: Remove audio_state member of struct omap_dss_device"
- into "OMAPDSS: Remove all references to obsolete HDMI audio callbacks"
Changes since v6:
- "ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio support"
- Fix Kconfig help text
- Remove #include <sound/simple_card.h>
- Use snd-soc-dummy codec instead of hdmi-audio-codec
- Add: OMAPDSS: hdmi_wp: Protect reserved bits in hdmi_wp_audio_config_format()
- Add: OMAPDSS: hdmi5_core: Initialize mandatory sample_order parameter
- Add: "OMAPDSS: omapdss.h: Remove audio_state member of struct omap_dss_device"
- "OMAPDSS: hdmi4: Register ASoC platform device for omap hdmi audio"
- Register "omap-hdmi-audio" with PLATFORM_DEVID_AUTO
- "OMAPDSS: hdmi5: Register ASoC platform device for omap hdmi audio"
- Register "omap-hdmi-audio" with PLATFORM_DEVID_AUTO
- Add: "OMAPDSS: hdmi5: Change hdmi_wp idlemode to to no_idle for audio playback"
Jyri Sarha (19):
OMAPDSS: hdmi_wp: Protect reserved bits in
hdmi_wp_audio_config_format()
OMAPDSS: hdmi5_core: Initialize mandatory sample_order parameter
OMAPDSS: hdmi.h: Add HDMI_AUDIO_LAYOUT_6CH enum value
OMAPDSS: hdmi: Remove most of OMAP[45]_DSS_HDMI_AUDIO ifdefs
OMAPDSS: hdmi4_core: Remove unused hdmi4_audio_get_dma_port()
OMAPDSS: hdmi_wp: Add function for getting audio dma address
OMAPDSS: hdmi: Make hdmi structure public
OMAPDSS: hdmi: Add pdev pointer for audio_pdev in HDMI DRV data
ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio
support
OMAPDSS: Kconfig: Remove HDMI audio booleans from Kconfig
OMAPDSS: hdmi: Make hdmi_mode_has_audio() more user friedly
OMAPDSS: hdmi.h: Add members to hdmi drvdata for audio implementation
OMAPDSS: hdmi4: Remove callbacks for the old ASoC DAI driver
OMAPDSS: hdmi4: Register ASoC platform device for omap hdmi audio
OMAPDSS: hdmi5: Remove callbacks for the old ASoC DAI driver
OMAPDSS: hdmi5: Register ASoC platform device for omap hdmi audio
ASoC: omap: Remove obsolete HDMI audio code and Kconfig options
OMAPDSS: Remove all references to obsolete HDMI audio callbacks
OMAPDSS: hdmi5: Change hdmi_wp idlemode to to no_idle for audio
playback
.../fbdev/omap2/displays-new/connector-hdmi.c | 99 -----
.../fbdev/omap2/displays-new/encoder-tpd12s015.c | 56 ---
drivers/video/fbdev/omap2/dss/Kconfig | 7 -
drivers/video/fbdev/omap2/dss/hdmi.h | 38 +-
drivers/video/fbdev/omap2/dss/hdmi4.c | 269 +++++++------
drivers/video/fbdev/omap2/dss/hdmi4_core.c | 14 -
drivers/video/fbdev/omap2/dss/hdmi4_core.h | 4 -
drivers/video/fbdev/omap2/dss/hdmi5.c | 265 ++++++-------
drivers/video/fbdev/omap2/dss/hdmi5_core.c | 9 +-
drivers/video/fbdev/omap2/dss/hdmi5_core.h | 2 -
drivers/video/fbdev/omap2/dss/hdmi_common.c | 2 -
drivers/video/fbdev/omap2/dss/hdmi_wp.c | 16 +-
include/sound/omap-hdmi-audio.h | 43 +++
include/video/omapdss.h | 40 --
sound/soc/omap/Kconfig | 26 +-
sound/soc/omap/Makefile | 6 +-
sound/soc/omap/omap-hdmi-audio.c | 407 ++++++++++++++++++++
sound/soc/omap/omap-hdmi-card.c | 87 -----
sound/soc/omap/omap-hdmi.c | 364 -----------------
sound/soc/omap/omap-hdmi.h | 38 --
20 files changed, 781 insertions(+), 1011 deletions(-)
create mode 100644 include/sound/omap-hdmi-audio.h
create mode 100644 sound/soc/omap/omap-hdmi-audio.c
delete mode 100644 sound/soc/omap/omap-hdmi-card.c
delete mode 100644 sound/soc/omap/omap-hdmi.c
delete mode 100644 sound/soc/omap/omap-hdmi.h
--
1.7.9.5
^ permalink raw reply
* Re: [PATCH v7 06/20] OMAPDSS: omapdss.h: Remove audio_state member of struct omap_dss_device
From: Jyri Sarha @ 2014-11-12 14:34 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, tomi.valkeinen
In-Reply-To: <2c129e22e96eba98ec1d825d01c25571272da13b.1415786458.git.jsarha@ti.com>
Damn, this patch should have gone to second last for it not not to break
bisect. I'll squash it into "OMAPDSS: Remove all references to obsolete
HDMI audio callbacks" an mail v7.1 patch-set shortly.
Best regards,
Jyri
On 11/12/2014 12:49 PM, Jyri Sarha wrote:
> The audio_state member is not used.
>
> Signed-off-by: Jyri Sarha <jsarha@ti.com>
> ---
> include/video/omapdss.h | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/include/video/omapdss.h b/include/video/omapdss.h
> index 069dfca..9f2699f 100644
> --- a/include/video/omapdss.h
> +++ b/include/video/omapdss.h
> @@ -166,13 +166,6 @@ enum omap_dss_display_state {
> OMAP_DSS_DISPLAY_ACTIVE,
> };
>
> -enum omap_dss_audio_state {
> - OMAP_DSS_AUDIO_DISABLED = 0,
> - OMAP_DSS_AUDIO_ENABLED,
> - OMAP_DSS_AUDIO_CONFIGURED,
> - OMAP_DSS_AUDIO_PLAYING,
> -};
> -
> struct omap_dss_audio {
> struct snd_aes_iec958 *iec;
> struct snd_cea_861_aud_if *cea;
> @@ -783,8 +776,6 @@ struct omap_dss_device {
>
> enum omap_dss_display_state state;
>
> - enum omap_dss_audio_state audio_state;
> -
> /* OMAP DSS output specific fields */
>
> struct list_head list;
>
^ permalink raw reply
* Re: [PATCH 1/4] video: omapdss: Add opa362 driver
From: Belisko Marek @ 2014-11-12 14:04 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <54636763.10605@ti.com>
Hi Tomi,
On Wed, Nov 12, 2014 at 2:57 PM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> Hi,
>
>
> On 03/11/14 23:59, Marek Belisko wrote:
>> opa362 is amplifier for videoand can be connected to the tvout pads
>> of the OMAP3. It has one gpio control for enable/disable of the output
>> (high impedance).
>>
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>> ---
>> drivers/video/fbdev/omap2/displays-new/Kconfig | 6 +
>> drivers/video/fbdev/omap2/displays-new/Makefile | 1 +
>> .../fbdev/omap2/displays-new/amplifier-opa362.c | 347 +++++++++++++++++++++
>> 3 files changed, 354 insertions(+)
>> create mode 100644 drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c
>
> This doesn't even compile:
>
> drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c:207:28: error:
> dereferencing pointer to incomplete type
> ddata->enable_gpio = pdata->enable_gpio;
Hmm sorry about that. I must mixed something up. I'll post updated version soon.
Thanks for review.
>
> And it seems to have fields for bypass and bypass which are handled in
> the devconf1 patch.
>
> Tomi
>
>
BR,
marek
--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer
Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
^ permalink raw reply
* Re: [PATCH 2/4] Documentation: DT: Add documentation for ti,opa362 bindings
From: Tomi Valkeinen @ 2014-11-12 14:00 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1415051968-4878-3-git-send-email-marek@goldelico.com>
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]
On 03/11/14 23:59, Marek Belisko wrote:
> Signed-off-by: Marek Belisko <marek@goldelico.com>
> ---
> .../devicetree/bindings/video/ti,opa362.txt | 38 ++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/video/ti,opa362.txt
>
> diff --git a/Documentation/devicetree/bindings/video/ti,opa362.txt b/Documentation/devicetree/bindings/video/ti,opa362.txt
> new file mode 100644
> index 0000000..d7ed11a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/ti,opa362.txt
> @@ -0,0 +1,38 @@
> +OPA362 analog video amplifier
> +
> +Required properties:
> +- compatible: "ti,opa362"
> +- gpio: enable/disable output gpio
> +
> +Required node:
> +- Video port 0 for opa362 input
> +- Video port 1 for opa362 output
> +
> +Example:
> +
> +tv_amp: opa362 {
> + compatible = "ti,opa362";
> + gpios = <&gpio1 23 0>; /* GPIO to enable video out amplifier */
> +
> + label = "opa362";
opa shouldn't have label property. label is meant for the
end-of-the-chain component, like the connector.
> + ports {
Hmm, I think there is extra space before 'ports', maybe below also.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH 1/4] video: omapdss: Add opa362 driver
From: Tomi Valkeinen @ 2014-11-12 13:57 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1415051968-4878-2-git-send-email-marek@goldelico.com>
[-- Attachment #1: Type: text/plain, Size: 915 bytes --]
Hi,
On 03/11/14 23:59, Marek Belisko wrote:
> opa362 is amplifier for videoand can be connected to the tvout pads
> of the OMAP3. It has one gpio control for enable/disable of the output
> (high impedance).
>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
> drivers/video/fbdev/omap2/displays-new/Kconfig | 6 +
> drivers/video/fbdev/omap2/displays-new/Makefile | 1 +
> .../fbdev/omap2/displays-new/amplifier-opa362.c | 347 +++++++++++++++++++++
> 3 files changed, 354 insertions(+)
> create mode 100644 drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c
This doesn't even compile:
drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c:207:28: error:
dereferencing pointer to incomplete type
ddata->enable_gpio = pdata->enable_gpio;
And it seems to have fields for bypass and bypass which are handled in
the devconf1 patch.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH 4/4] arm: dts: omap3-gta04: Add static configuration for devconf1 register
From: Tomi Valkeinen @ 2014-11-12 12:53 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1415051968-4878-5-git-send-email-marek@goldelico.com>
[-- Attachment #1: Type: text/plain, Size: 2183 bytes --]
Hi,
On 03/11/14 23:59, Marek Belisko wrote:
> gta04 board need for tvout enabled 2 bits in devconf1 register (tvbypass and acbias).
> Add single pinmux entry and enable it.
>
> Signed-off-by: Marek Belisko <marek@goldelico.com>
> ---
> arch/arm/boot/dts/omap3-gta04.dtsi | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
> index e4d05f0..a456d37 100644
> --- a/arch/arm/boot/dts/omap3-gta04.dtsi
> +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
> @@ -118,6 +118,17 @@
> };
> };
> };
> +
> + /* pinmux for devconf1 */
> + control_devconf1: pinmux@480022d8 {
> + compatible = "pinctrl-single";
> + reg = <0x480022d8 4>; /* single register */
> + #address-cells = <1>;
> + #size-cells = <0>;
> + pinctrl-single,bit-per-mux;
> + pinctrl-single,register-width = <32>;
> + pinctrl-single,function-mask = <0xfc0bd5>;
> + };
> };
>
> &omap3_pmx_core {
> @@ -497,3 +508,14 @@
> };
> };
> };
> +
> +&control_devconf1 {
> + pinctrl-name = "default";
> + pinctrl-0 = < &tv_acbias_pins>;
> +
> + tv_acbias_pins: pinmux_tv_acbias_pins {
> + pinctrl-single,bits = <
> + 0 0x40800 0x40800
I think it would be good to have a comment in the .dts above, mentioning
that TVOUTBYPASS and TVACEN bits are being set.
> + >;
> + };
> +};
>
OMAP3630 seems to have CONTROL_AVDAC1 and CONTROL_AVDAC2 registers. Did
you check if the SoC you use have those? It looks like they need
configuration also, if the exist.
So, I don't think tvbypass and acbias are really pinmux stuff, but it
does seem like an easy way to handle the devconf1 register, and I don't
see any issues with the setting being fixed.
However, devconf1 register seems to have bits for many devices,
including mcbsp, mmc, and even some "Force MPU writes to be nonposted" bit.
And, with a quick grep, I see CONTROL_DEVCONF1 touched in multiple
places in the kernel. I wonder if adding a pinmux entry for it could
cause some rather odd problems.
Tony, any idea about this? How should CONTROL_DEVCONFx registers be
accessed?
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH v7 18/20] ASoC: omap: Remove obsolete HDMI audio code and Kconfig options
From: Peter Ujfalusi @ 2014-11-12 12:04 UTC (permalink / raw)
To: Jyri Sarha, alsa-devel, linux-fbdev, linux-omap
Cc: broonie, liam.r.girdwood, tomi.valkeinen
In-Reply-To: <3b82bfccc11f3aefd34db578944b5447fcfa1d85.1415786458.git.jsarha@ti.com>
On 11/12/2014 12:49 PM, Jyri Sarha wrote:
> Removes omap-hdmi DAI driver, omap-hdmi-card driver, the related
> Kconfig options, and Makefile entries. The HDMI DAI drivers has been
> integrated directly to OMAP4+ HDMI drivers and simple-card driver is
> used instead of omap-hdmi-card driver.
>
> Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> sound/soc/omap/Kconfig | 13 --
> sound/soc/omap/Makefile | 4 -
> sound/soc/omap/omap-hdmi-card.c | 87 ----------
> sound/soc/omap/omap-hdmi.c | 364 ---------------------------------------
> sound/soc/omap/omap-hdmi.h | 38 ----
> 5 files changed, 506 deletions(-)
> delete mode 100644 sound/soc/omap/omap-hdmi-card.c
> delete mode 100644 sound/soc/omap/omap-hdmi.c
> delete mode 100644 sound/soc/omap/omap-hdmi.h
>
> diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
> index 2b32b3e..3dfcadf 100644
> --- a/sound/soc/omap/Kconfig
> +++ b/sound/soc/omap/Kconfig
> @@ -12,9 +12,6 @@ config SND_OMAP_SOC_MCBSP
> config SND_OMAP_SOC_MCPDM
> tristate
>
> -config SND_OMAP_SOC_HDMI
> - tristate
> -
> config SND_OMAP_SOC_HDMI_AUDIO
> tristate "HDMI audio support for OMAP4+ based SoCs"
> depends on SND_OMAP_SOC
> @@ -115,16 +112,6 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040
> - PandaBoard (4430)
> - PandaBoardES (4460)
>
> -config SND_OMAP_SOC_OMAP_HDMI
> - tristate "SoC Audio support for Texas Instruments OMAP HDMI"
> - depends on SND_OMAP_SOC && OMAP4_DSS_HDMI && OMAP2_DSS
> - select SND_OMAP_SOC_HDMI
> - select SND_SOC_HDMI_CODEC
> - select OMAP4_DSS_HDMI_AUDIO
> - help
> - Say Y if you want to add support for SoC HDMI audio on Texas Instruments
> - OMAP4 chips
> -
> config SND_OMAP_SOC_OMAP3_PANDORA
> tristate "SoC Audio support for OMAP3 Pandora"
> depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
> diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
> index 40688a6..db36fbd 100644
> --- a/sound/soc/omap/Makefile
> +++ b/sound/soc/omap/Makefile
> @@ -3,14 +3,12 @@ snd-soc-omap-objs := omap-pcm.o
> snd-soc-omap-dmic-objs := omap-dmic.o
> snd-soc-omap-mcbsp-objs := omap-mcbsp.o mcbsp.o
> snd-soc-omap-mcpdm-objs := omap-mcpdm.o
> -snd-soc-omap-hdmi-objs := omap-hdmi.o
> snd-soc-omap-hdmi-audio-objs := omap-hdmi-audio.o
>
> obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
> obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
> obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
> obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
> -obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
> obj-$(CONFIG_SND_OMAP_SOC_HDMI_AUDIO) += snd-soc-omap-hdmi-audio.o
>
> # OMAP Machine Support
> @@ -22,7 +20,6 @@ snd-soc-am3517evm-objs := am3517evm.o
> snd-soc-omap-abe-twl6040-objs := omap-abe-twl6040.o
> snd-soc-omap-twl4030-objs := omap-twl4030.o
> snd-soc-omap3pandora-objs := omap3pandora.o
> -snd-soc-omap-hdmi-card-objs := omap-hdmi-card.o
>
> obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
> obj-$(CONFIG_SND_OMAP_SOC_RX51) += snd-soc-rx51.o
> @@ -32,4 +29,3 @@ obj-$(CONFIG_SND_OMAP_SOC_AM3517EVM) += snd-soc-am3517evm.o
> obj-$(CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040) += snd-soc-omap-abe-twl6040.o
> obj-$(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) += snd-soc-omap-twl4030.o
> obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
> -obj-$(CONFIG_SND_OMAP_SOC_OMAP_HDMI) += snd-soc-omap-hdmi-card.o
> diff --git a/sound/soc/omap/omap-hdmi-card.c b/sound/soc/omap/omap-hdmi-card.c
> deleted file mode 100644
> index f649fe8..0000000
> --- a/sound/soc/omap/omap-hdmi-card.c
> +++ /dev/null
> @@ -1,87 +0,0 @@
> -/*
> - * omap-hdmi-card.c
> - *
> - * OMAP ALSA SoC machine driver for TI OMAP HDMI
> - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
> - * Author: Ricardo Neri <ricardo.neri@ti.com>
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * version 2 as published by the Free Software Foundation.
> - *
> - * 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.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA
> - *
> - */
> -
> -#include <linux/module.h>
> -#include <sound/pcm.h>
> -#include <sound/soc.h>
> -#include <asm/mach-types.h>
> -#include <video/omapdss.h>
> -
> -#define DRV_NAME "omap-hdmi-audio"
> -
> -static struct snd_soc_dai_link omap_hdmi_dai = {
> - .name = "HDMI",
> - .stream_name = "HDMI",
> - .cpu_dai_name = "omap-hdmi-audio-dai",
> - .platform_name = "omap-hdmi-audio-dai",
> - .codec_name = "hdmi-audio-codec",
> - .codec_dai_name = "hdmi-hifi",
> -};
> -
> -static struct snd_soc_card snd_soc_omap_hdmi = {
> - .name = "OMAPHDMI",
> - .owner = THIS_MODULE,
> - .dai_link = &omap_hdmi_dai,
> - .num_links = 1,
> -};
> -
> -static int omap_hdmi_probe(struct platform_device *pdev)
> -{
> - struct snd_soc_card *card = &snd_soc_omap_hdmi;
> - int ret;
> -
> - card->dev = &pdev->dev;
> -
> - ret = snd_soc_register_card(card);
> - if (ret) {
> - dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
> - card->dev = NULL;
> - return ret;
> - }
> - return 0;
> -}
> -
> -static int omap_hdmi_remove(struct platform_device *pdev)
> -{
> - struct snd_soc_card *card = platform_get_drvdata(pdev);
> -
> - snd_soc_unregister_card(card);
> - card->dev = NULL;
> - return 0;
> -}
> -
> -static struct platform_driver omap_hdmi_driver = {
> - .driver = {
> - .name = DRV_NAME,
> - .owner = THIS_MODULE,
> - },
> - .probe = omap_hdmi_probe,
> - .remove = omap_hdmi_remove,
> -};
> -
> -module_platform_driver(omap_hdmi_driver);
> -
> -MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
> -MODULE_DESCRIPTION("OMAP HDMI machine ASoC driver");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("platform:" DRV_NAME);
> diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c
> deleted file mode 100644
> index eb9c392..0000000
> --- a/sound/soc/omap/omap-hdmi.c
> +++ /dev/null
> @@ -1,364 +0,0 @@
> -/*
> - * omap-hdmi.c
> - *
> - * OMAP ALSA SoC DAI driver for HDMI audio on OMAP4 processors.
> - * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/
> - * Authors: Jorge Candelaria <jorge.candelaria@ti.com>
> - * Ricardo Neri <ricardo.neri@ti.com>
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * version 2 as published by the Free Software Foundation.
> - *
> - * 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.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA
> - *
> - */
> -
> -#include <linux/init.h>
> -#include <linux/module.h>
> -#include <linux/device.h>
> -#include <sound/core.h>
> -#include <sound/pcm.h>
> -#include <sound/pcm_params.h>
> -#include <sound/initval.h>
> -#include <sound/soc.h>
> -#include <sound/asound.h>
> -#include <sound/asoundef.h>
> -#include <sound/dmaengine_pcm.h>
> -#include <video/omapdss.h>
> -#include <sound/omap-pcm.h>
> -
> -#include "omap-hdmi.h"
> -
> -#define DRV_NAME "omap-hdmi-audio-dai"
> -
> -struct hdmi_priv {
> - struct snd_dmaengine_dai_dma_data dma_data;
> - unsigned int dma_req;
> - struct omap_dss_audio dss_audio;
> - struct snd_aes_iec958 iec;
> - struct snd_cea_861_aud_if cea;
> - struct omap_dss_device *dssdev;
> -};
> -
> -static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream,
> - struct snd_soc_dai *dai)
> -{
> - struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
> - int err;
> - /*
> - * Make sure that the period bytes are multiple of the DMA packet size.
> - * Largest packet size we use is 32 32-bit words = 128 bytes
> - */
> - err = snd_pcm_hw_constraint_step(substream->runtime, 0,
> - SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 128);
> - if (err < 0) {
> - dev_err(dai->dev, "could not apply constraint\n");
> - return err;
> - }
> -
> - if (!priv->dssdev->driver->audio_supported(priv->dssdev)) {
> - dev_err(dai->dev, "audio not supported\n");
> - return -ENODEV;
> - }
> -
> - snd_soc_dai_set_dma_data(dai, substream, &priv->dma_data);
> -
> - return 0;
> -}
> -
> -static int omap_hdmi_dai_prepare(struct snd_pcm_substream *substream,
> - struct snd_soc_dai *dai)
> -{
> - struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
> -
> - return priv->dssdev->driver->audio_enable(priv->dssdev);
> -}
> -
> -static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream,
> - struct snd_pcm_hw_params *params,
> - struct snd_soc_dai *dai)
> -{
> - struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
> - struct snd_aes_iec958 *iec = &priv->iec;
> - struct snd_cea_861_aud_if *cea = &priv->cea;
> - int err = 0;
> -
> - switch (params_format(params)) {
> - case SNDRV_PCM_FORMAT_S16_LE:
> - priv->dma_data.maxburst = 16;
> - break;
> - case SNDRV_PCM_FORMAT_S24_LE:
> - priv->dma_data.maxburst = 32;
> - break;
> - default:
> - dev_err(dai->dev, "format not supported!\n");
> - return -EINVAL;
> - }
> -
> - /*
> - * fill the IEC-60958 channel status word
> - */
> - /* initialize the word bytes */
> - memset(iec->status, 0, sizeof(iec->status));
> -
> - /* specify IEC-60958-3 (commercial use) */
> - iec->status[0] &= ~IEC958_AES0_PROFESSIONAL;
> -
> - /* specify that the audio is LPCM*/
> - iec->status[0] &= ~IEC958_AES0_NONAUDIO;
> -
> - iec->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT;
> -
> - iec->status[0] |= IEC958_AES0_CON_EMPHASIS_NONE;
> -
> - iec->status[0] |= IEC958_AES1_PRO_MODE_NOTID;
> -
> - iec->status[1] = IEC958_AES1_CON_GENERAL;
> -
> - iec->status[2] |= IEC958_AES2_CON_SOURCE_UNSPEC;
> -
> - iec->status[2] |= IEC958_AES2_CON_CHANNEL_UNSPEC;
> -
> - switch (params_rate(params)) {
> - case 32000:
> - iec->status[3] |= IEC958_AES3_CON_FS_32000;
> - break;
> - case 44100:
> - iec->status[3] |= IEC958_AES3_CON_FS_44100;
> - break;
> - case 48000:
> - iec->status[3] |= IEC958_AES3_CON_FS_48000;
> - break;
> - case 88200:
> - iec->status[3] |= IEC958_AES3_CON_FS_88200;
> - break;
> - case 96000:
> - iec->status[3] |= IEC958_AES3_CON_FS_96000;
> - break;
> - case 176400:
> - iec->status[3] |= IEC958_AES3_CON_FS_176400;
> - break;
> - case 192000:
> - iec->status[3] |= IEC958_AES3_CON_FS_192000;
> - break;
> - default:
> - dev_err(dai->dev, "rate not supported!\n");
> - return -EINVAL;
> - }
> -
> - /* specify the clock accuracy */
> - iec->status[3] |= IEC958_AES3_CON_CLOCK_1000PPM;
> -
> - /*
> - * specify the word length. The same word length value can mean
> - * two different lengths. Hence, we need to specify the maximum
> - * word length as well.
> - */
> - switch (params_format(params)) {
> - case SNDRV_PCM_FORMAT_S16_LE:
> - iec->status[4] |= IEC958_AES4_CON_WORDLEN_20_16;
> - iec->status[4] &= ~IEC958_AES4_CON_MAX_WORDLEN_24;
> - break;
> - case SNDRV_PCM_FORMAT_S24_LE:
> - iec->status[4] |= IEC958_AES4_CON_WORDLEN_24_20;
> - iec->status[4] |= IEC958_AES4_CON_MAX_WORDLEN_24;
> - break;
> - default:
> - dev_err(dai->dev, "format not supported!\n");
> - return -EINVAL;
> - }
> -
> - /*
> - * Fill the CEA-861 audio infoframe (see spec for details)
> - */
> -
> - cea->db1_ct_cc = (params_channels(params) - 1)
> - & CEA861_AUDIO_INFOFRAME_DB1CC;
> - cea->db1_ct_cc |= CEA861_AUDIO_INFOFRAME_DB1CT_FROM_STREAM;
> -
> - cea->db2_sf_ss = CEA861_AUDIO_INFOFRAME_DB2SF_FROM_STREAM;
> - cea->db2_sf_ss |= CEA861_AUDIO_INFOFRAME_DB2SS_FROM_STREAM;
> -
> - cea->db3 = 0; /* not used, all zeros */
> -
> - /*
> - * The OMAP HDMI IP requires to use the 8-channel channel code when
> - * transmitting more than two channels.
> - */
> - if (params_channels(params) = 2)
> - cea->db4_ca = 0x0;
> - else
> - cea->db4_ca = 0x13;
> -
> - cea->db5_dminh_lsv = CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED;
> - /* the expression is trivial but makes clear what we are doing */
> - cea->db5_dminh_lsv |= (0 & CEA861_AUDIO_INFOFRAME_DB5_LSV);
> -
> - priv->dss_audio.iec = iec;
> - priv->dss_audio.cea = cea;
> -
> - err = priv->dssdev->driver->audio_config(priv->dssdev,
> - &priv->dss_audio);
> -
> - return err;
> -}
> -
> -static int omap_hdmi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
> - struct snd_soc_dai *dai)
> -{
> - struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
> - int err = 0;
> -
> - switch (cmd) {
> - case SNDRV_PCM_TRIGGER_START:
> - case SNDRV_PCM_TRIGGER_RESUME:
> - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
> - err = priv->dssdev->driver->audio_start(priv->dssdev);
> - break;
> - case SNDRV_PCM_TRIGGER_STOP:
> - case SNDRV_PCM_TRIGGER_SUSPEND:
> - case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
> - priv->dssdev->driver->audio_stop(priv->dssdev);
> - break;
> - default:
> - err = -EINVAL;
> - }
> - return err;
> -}
> -
> -static void omap_hdmi_dai_shutdown(struct snd_pcm_substream *substream,
> - struct snd_soc_dai *dai)
> -{
> - struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
> -
> - priv->dssdev->driver->audio_disable(priv->dssdev);
> -}
> -
> -static const struct snd_soc_dai_ops omap_hdmi_dai_ops = {
> - .startup = omap_hdmi_dai_startup,
> - .hw_params = omap_hdmi_dai_hw_params,
> - .prepare = omap_hdmi_dai_prepare,
> - .trigger = omap_hdmi_dai_trigger,
> - .shutdown = omap_hdmi_dai_shutdown,
> -};
> -
> -static struct snd_soc_dai_driver omap_hdmi_dai = {
> - .playback = {
> - .channels_min = 2,
> - .channels_max = 8,
> - .rates = OMAP_HDMI_RATES,
> - .formats = OMAP_HDMI_FORMATS,
> - },
> - .ops = &omap_hdmi_dai_ops,
> -};
> -
> -static const struct snd_soc_component_driver omap_hdmi_component = {
> - .name = DRV_NAME,
> -};
> -
> -static int omap_hdmi_probe(struct platform_device *pdev)
> -{
> - int ret;
> - struct resource *hdmi_rsrc;
> - struct hdmi_priv *hdmi_data;
> - bool hdmi_dev_found = false;
> -
> - hdmi_data = devm_kzalloc(&pdev->dev, sizeof(*hdmi_data), GFP_KERNEL);
> - if (hdmi_data = NULL) {
> - dev_err(&pdev->dev, "Cannot allocate memory for HDMI data\n");
> - return -ENOMEM;
> - }
> -
> - hdmi_rsrc = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!hdmi_rsrc) {
> - dev_err(&pdev->dev, "Cannot obtain IORESOURCE_MEM HDMI\n");
> - return -ENODEV;
> - }
> -
> - hdmi_data->dma_data.addr = hdmi_rsrc->start + OMAP_HDMI_AUDIO_DMA_PORT;
> -
> - hdmi_rsrc = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> - if (!hdmi_rsrc) {
> - dev_err(&pdev->dev, "Cannot obtain IORESOURCE_DMA HDMI\n");
> - return -ENODEV;
> - }
> -
> - hdmi_data->dma_req = hdmi_rsrc->start;
> - hdmi_data->dma_data.filter_data = &hdmi_data->dma_req;
> - hdmi_data->dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> -
> - /*
> - * TODO: We assume that there is only one DSS HDMI device. Future
> - * OMAP implementations may support more than one HDMI devices and
> - * we should provided separate audio support for all of them.
> - */
> - /* Find an HDMI device. */
> - for_each_dss_dev(hdmi_data->dssdev) {
> - omap_dss_get_device(hdmi_data->dssdev);
> -
> - if (!hdmi_data->dssdev->driver) {
> - omap_dss_put_device(hdmi_data->dssdev);
> - continue;
> - }
> -
> - if (hdmi_data->dssdev->type = OMAP_DISPLAY_TYPE_HDMI) {
> - hdmi_dev_found = true;
> - break;
> - }
> - }
> -
> - if (!hdmi_dev_found) {
> - dev_err(&pdev->dev, "no driver for HDMI display found\n");
> - return -ENODEV;
> - }
> -
> - dev_set_drvdata(&pdev->dev, hdmi_data);
> - ret = snd_soc_register_component(&pdev->dev, &omap_hdmi_component,
> - &omap_hdmi_dai, 1);
> -
> - if (ret)
> - return ret;
> -
> - return omap_pcm_platform_register(&pdev->dev);
> -}
> -
> -static int omap_hdmi_remove(struct platform_device *pdev)
> -{
> - struct hdmi_priv *hdmi_data = dev_get_drvdata(&pdev->dev);
> -
> - snd_soc_unregister_component(&pdev->dev);
> -
> - if (hdmi_data = NULL) {
> - dev_err(&pdev->dev, "cannot obtain HDMi data\n");
> - return -ENODEV;
> - }
> -
> - omap_dss_put_device(hdmi_data->dssdev);
> - return 0;
> -}
> -
> -static struct platform_driver hdmi_dai_driver = {
> - .driver = {
> - .name = DRV_NAME,
> - .owner = THIS_MODULE,
> - },
> - .probe = omap_hdmi_probe,
> - .remove = omap_hdmi_remove,
> -};
> -
> -module_platform_driver(hdmi_dai_driver);
> -
> -MODULE_AUTHOR("Jorge Candelaria <jorge.candelaria@ti.com>");
> -MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
> -MODULE_DESCRIPTION("OMAP HDMI SoC Interface");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("platform:" DRV_NAME);
> diff --git a/sound/soc/omap/omap-hdmi.h b/sound/soc/omap/omap-hdmi.h
> deleted file mode 100644
> index 6ad2bf4..0000000
> --- a/sound/soc/omap/omap-hdmi.h
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -/*
> - * omap-hdmi.h
> - *
> - * Definitions for OMAP ALSA SoC DAI driver for HDMI audio on OMAP4 processors.
> - * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/
> - * Authors: Jorge Candelaria <jorge.candelaria@ti.com>
> - * Ricardo Neri <ricardo.neri@ti.com>
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * version 2 as published by the Free Software Foundation.
> - *
> - * 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.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA
> - *
> - */
> -
> -#ifndef __OMAP_HDMI_H__
> -#define __OMAP_HDMI_H__
> -
> -#define OMAP_HDMI_AUDIO_DMA_PORT 0x8c
> -
> -#define OMAP_HDMI_RATES (SNDRV_PCM_RATE_32000 | \
> - SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | \
> - SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | \
> - SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000)
> -
> -#define OMAP_HDMI_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
> - SNDRV_PCM_FMTBIT_S24_LE)
> -
> -#endif
>
--
Péter
^ permalink raw reply
* Re: [PATCH v7 10/20] ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio support
From: Peter Ujfalusi @ 2014-11-12 12:03 UTC (permalink / raw)
To: Jyri Sarha, alsa-devel, linux-fbdev, linux-omap
Cc: broonie, liam.r.girdwood, tomi.valkeinen
In-Reply-To: <0296c0174b951e083064f49762122a703a1ac2f9.1415786458.git.jsarha@ti.com>
On 11/12/2014 12:49 PM, Jyri Sarha wrote:
> The platform device should only be registered from OMAPDSS HDMI
> driver. The platform driver registers and unregisters all ASoC
> components needed for OMAP HDMI audio.
>
> The hdmi audio driver implements cpu-dai component using the callbacks
> provided by OMAPDSS and registers the component under DSS HDMI
> device. Omap-pcm is registered for platform component also under DSS
> HDMI device. Dummy codec is used as as codec component. The hdmi audio
> driver implements also the card and registers it under its own
> platform device.
>
> Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> include/sound/omap-hdmi-audio.h | 43 ++++
> sound/soc/omap/Kconfig | 15 ++
> sound/soc/omap/Makefile | 2 +
> sound/soc/omap/omap-hdmi-audio.c | 407 ++++++++++++++++++++++++++++++++++++++
> 4 files changed, 467 insertions(+)
> create mode 100644 include/sound/omap-hdmi-audio.h
> create mode 100644 sound/soc/omap/omap-hdmi-audio.c
>
> diff --git a/include/sound/omap-hdmi-audio.h b/include/sound/omap-hdmi-audio.h
> new file mode 100644
> index 0000000..afdb416
> --- /dev/null
> +++ b/include/sound/omap-hdmi-audio.h
> @@ -0,0 +1,43 @@
> +/*
> + * hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
> + *
> + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
> + *
> + * Author: Jyri Sarha <jsarha@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * 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.
> + *
> + */
> +
> +#include <video/omapdss.h>
> +
> +#ifndef __OMAP_HDMI_AUDIO_H__
> +#define __OMAP_HDMI_AUDIO_H__
> +
> +struct omap_hdmi_audio_ops {
> + int (*audio_startup)(struct device *dev,
> + void (*abort_cb)(struct device *dev));
> + int (*audio_shutdown)(struct device *dev);
> + int (*audio_start)(struct device *dev);
> + void (*audio_stop)(struct device *dev);
> + int (*audio_config)(struct device *dev,
> + struct omap_dss_audio *dss_audio);
> +};
> +
> +/* HDMI audio initalization data */
> +struct omap_hdmi_audio_pdata {
> + struct device *dev;
> + enum omapdss_version dss_version;
> + phys_addr_t audio_dma_addr;
> +
> + const struct omap_hdmi_audio_ops *ops;
> +};
> +
> +#endif /* __OMAP_HDMI_AUDIO_H__ */
> diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
> index d44463a..2b32b3e 100644
> --- a/sound/soc/omap/Kconfig
> +++ b/sound/soc/omap/Kconfig
> @@ -15,6 +15,21 @@ config SND_OMAP_SOC_MCPDM
> config SND_OMAP_SOC_HDMI
> tristate
>
> +config SND_OMAP_SOC_HDMI_AUDIO
> + tristate "HDMI audio support for OMAP4+ based SoCs"
> + depends on SND_OMAP_SOC
> + help
> + For HDMI audio to work OMAPDSS HDMI support should be
> + enabled.
> + The hdmi audio driver implements cpu-dai component using the
> + callbacks provided by OMAPDSS and registers the component
> + under DSS HDMI device. Omap-pcm is registered for platform
> + component also under DSS HDMI device. Dummy codec is used as
> + as codec component. The hdmi audio driver implements also
> + the card and registers it under its own platform device.
> + The device for the dirver is registered by OMAPDSS hdmi
> + driver.
> +
> config SND_OMAP_SOC_N810
> tristate "SoC Audio support for Nokia N810"
> depends on SND_OMAP_SOC && MACH_NOKIA_N810 && I2C
> diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
> index a725905..40688a6 100644
> --- a/sound/soc/omap/Makefile
> +++ b/sound/soc/omap/Makefile
> @@ -4,12 +4,14 @@ snd-soc-omap-dmic-objs := omap-dmic.o
> snd-soc-omap-mcbsp-objs := omap-mcbsp.o mcbsp.o
> snd-soc-omap-mcpdm-objs := omap-mcpdm.o
> snd-soc-omap-hdmi-objs := omap-hdmi.o
> +snd-soc-omap-hdmi-audio-objs := omap-hdmi-audio.o
>
> obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
> obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
> obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
> obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
> obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
> +obj-$(CONFIG_SND_OMAP_SOC_HDMI_AUDIO) += snd-soc-omap-hdmi-audio.o
>
> # OMAP Machine Support
> snd-soc-n810-objs := n810.o
> diff --git a/sound/soc/omap/omap-hdmi-audio.c b/sound/soc/omap/omap-hdmi-audio.c
> new file mode 100644
> index 0000000..3f9ac7d
> --- /dev/null
> +++ b/sound/soc/omap/omap-hdmi-audio.c
> @@ -0,0 +1,407 @@
> +/*
> + * omap-hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
> + *
> + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
> + *
> + * Author: Jyri Sarha <jsarha@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * 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.
> + *
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/err.h>
> +#include <linux/string.h>
> +#include <linux/platform_device.h>
> +#include <sound/soc.h>
> +#include <sound/pcm_params.h>
> +#include <sound/dmaengine_pcm.h>
> +#include <uapi/sound/asound.h>
> +#include <sound/asoundef.h>
> +#include <sound/omap-pcm.h>
> +#include <sound/omap-hdmi-audio.h>
> +#include <video/omapdss.h>
> +
> +#define DRV_NAME "omap-hdmi-audio"
> +
> +struct hdmi_audio_data {
> + struct snd_soc_card *card;
> +
> + const struct omap_hdmi_audio_ops *ops;
> + struct device *dssdev;
> + struct snd_dmaengine_dai_dma_data dma_data;
> + struct omap_dss_audio dss_audio;
> + struct snd_aes_iec958 iec;
> + struct snd_cea_861_aud_if cea;
> +
> + struct mutex current_stream_lock;
> + struct snd_pcm_substream *current_stream;
> +};
> +
> +static
> +struct hdmi_audio_data *card_drvdata_substream(struct snd_pcm_substream *ss)
> +{
> + struct snd_soc_pcm_runtime *rtd = ss->private_data;
> +
> + return snd_soc_card_get_drvdata(rtd->card);
> +}
> +
> +static void hdmi_dai_abort(struct device *dev)
> +{
> + struct hdmi_audio_data *ad = dev_get_drvdata(dev);
> +
> + mutex_lock(&ad->current_stream_lock);
> + if (ad->current_stream && ad->current_stream->runtime &&
> + snd_pcm_running(ad->current_stream)) {
> + dev_err(dev, "HDMI display disabled, aborting playback\n");
> + snd_pcm_stream_lock_irq(ad->current_stream);
> + snd_pcm_stop(ad->current_stream, SNDRV_PCM_STATE_DISCONNECTED);
> + snd_pcm_stream_unlock_irq(ad->current_stream);
> + }
> + mutex_unlock(&ad->current_stream_lock);
> +}
> +
> +static int hdmi_dai_startup(struct snd_pcm_substream *substream,
> + struct snd_soc_dai *dai)
> +{
> + struct hdmi_audio_data *ad = card_drvdata_substream(substream);
> + int ret;
> + /*
> + * Make sure that the period bytes are multiple of the DMA packet size.
> + * Largest packet size we use is 32 32-bit words = 128 bytes
> + */
> + ret = snd_pcm_hw_constraint_step(substream->runtime, 0,
> + SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 128);
> + if (ret < 0) {
> + dev_err(dai->dev, "could not apply constraint\n");
> + return ret;
> + }
> +
> + snd_soc_dai_set_dma_data(dai, substream, &ad->dma_data);
> +
> + mutex_lock(&ad->current_stream_lock);
> + ad->current_stream = substream;
> + mutex_unlock(&ad->current_stream_lock);
> +
> + ret = ad->ops->audio_startup(ad->dssdev, hdmi_dai_abort);
> +
> + if (ret) {
> + mutex_lock(&ad->current_stream_lock);
> + ad->current_stream = NULL;
> + mutex_unlock(&ad->current_stream_lock);
> + }
> +
> + return ret;
> +}
> +
> +static int hdmi_dai_hw_params(struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params,
> + struct snd_soc_dai *dai)
> +{
> + struct hdmi_audio_data *ad = card_drvdata_substream(substream);
> + struct snd_aes_iec958 *iec = &ad->iec;
> + struct snd_cea_861_aud_if *cea = &ad->cea;
> +
> + WARN_ON(ad->current_stream != substream);
> +
> + switch (params_format(params)) {
> + case SNDRV_PCM_FORMAT_S16_LE:
> + ad->dma_data.maxburst = 16;
> + break;
> + case SNDRV_PCM_FORMAT_S24_LE:
> + ad->dma_data.maxburst = 32;
> + break;
> + default:
> + dev_err(dai->dev, "format not supported!\n");
> + return -EINVAL;
> + }
> +
> + ad->dss_audio.iec = iec;
> + ad->dss_audio.cea = cea;
> + /*
> + * fill the IEC-60958 channel status word
> + */
> + /* initialize the word bytes */
> + memset(iec->status, 0, sizeof(iec->status));
> +
> + /* specify IEC-60958-3 (commercial use) */
> + iec->status[0] &= ~IEC958_AES0_PROFESSIONAL;
> +
> + /* specify that the audio is LPCM*/
> + iec->status[0] &= ~IEC958_AES0_NONAUDIO;
> +
> + iec->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT;
> +
> + iec->status[0] |= IEC958_AES0_CON_EMPHASIS_NONE;
> +
> + iec->status[0] |= IEC958_AES1_PRO_MODE_NOTID;
> +
> + iec->status[1] = IEC958_AES1_CON_GENERAL;
> +
> + iec->status[2] |= IEC958_AES2_CON_SOURCE_UNSPEC;
> +
> + iec->status[2] |= IEC958_AES2_CON_CHANNEL_UNSPEC;
> +
> + switch (params_rate(params)) {
> + case 32000:
> + iec->status[3] |= IEC958_AES3_CON_FS_32000;
> + break;
> + case 44100:
> + iec->status[3] |= IEC958_AES3_CON_FS_44100;
> + break;
> + case 48000:
> + iec->status[3] |= IEC958_AES3_CON_FS_48000;
> + break;
> + case 88200:
> + iec->status[3] |= IEC958_AES3_CON_FS_88200;
> + break;
> + case 96000:
> + iec->status[3] |= IEC958_AES3_CON_FS_96000;
> + break;
> + case 176400:
> + iec->status[3] |= IEC958_AES3_CON_FS_176400;
> + break;
> + case 192000:
> + iec->status[3] |= IEC958_AES3_CON_FS_192000;
> + break;
> + default:
> + dev_err(dai->dev, "rate not supported!\n");
> + return -EINVAL;
> + }
> +
> + /* specify the clock accuracy */
> + iec->status[3] |= IEC958_AES3_CON_CLOCK_1000PPM;
> +
> + /*
> + * specify the word length. The same word length value can mean
> + * two different lengths. Hence, we need to specify the maximum
> + * word length as well.
> + */
> + switch (params_format(params)) {
> + case SNDRV_PCM_FORMAT_S16_LE:
> + iec->status[4] |= IEC958_AES4_CON_WORDLEN_20_16;
> + iec->status[4] &= ~IEC958_AES4_CON_MAX_WORDLEN_24;
> + break;
> + case SNDRV_PCM_FORMAT_S24_LE:
> + iec->status[4] |= IEC958_AES4_CON_WORDLEN_24_20;
> + iec->status[4] |= IEC958_AES4_CON_MAX_WORDLEN_24;
> + break;
> + default:
> + dev_err(dai->dev, "format not supported!\n");
> + return -EINVAL;
> + }
> +
> + /*
> + * Fill the CEA-861 audio infoframe (see spec for details)
> + */
> +
> + cea->db1_ct_cc = (params_channels(params) - 1)
> + & CEA861_AUDIO_INFOFRAME_DB1CC;
> + cea->db1_ct_cc |= CEA861_AUDIO_INFOFRAME_DB1CT_FROM_STREAM;
> +
> + cea->db2_sf_ss = CEA861_AUDIO_INFOFRAME_DB2SF_FROM_STREAM;
> + cea->db2_sf_ss |= CEA861_AUDIO_INFOFRAME_DB2SS_FROM_STREAM;
> +
> + cea->db3 = 0; /* not used, all zeros */
> +
> + /*
> + * The OMAP HDMI IP requires to use the 8-channel channel code when
> + * transmitting more than two channels.
> + */
> + if (params_channels(params) = 2)
> + cea->db4_ca = 0x0;
> + else
> + cea->db4_ca = 0x13;
> +
> + cea->db5_dminh_lsv = CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED;
> + /* the expression is trivial but makes clear what we are doing */
> + cea->db5_dminh_lsv |= (0 & CEA861_AUDIO_INFOFRAME_DB5_LSV);
> +
> + return ad->ops->audio_config(ad->dssdev, &ad->dss_audio);
> +}
> +
> +static int hdmi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
> + struct snd_soc_dai *dai)
> +{
> + struct hdmi_audio_data *ad = card_drvdata_substream(substream);
> + int err = 0;
> +
> + WARN_ON(ad->current_stream != substream);
> +
> + switch (cmd) {
> + case SNDRV_PCM_TRIGGER_START:
> + case SNDRV_PCM_TRIGGER_RESUME:
> + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
> + err = ad->ops->audio_start(ad->dssdev);
> + break;
> + case SNDRV_PCM_TRIGGER_STOP:
> + case SNDRV_PCM_TRIGGER_SUSPEND:
> + case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
> + ad->ops->audio_stop(ad->dssdev);
> + break;
> + default:
> + err = -EINVAL;
> + }
> + return err;
> +}
> +
> +static void hdmi_dai_shutdown(struct snd_pcm_substream *substream,
> + struct snd_soc_dai *dai)
> +{
> + struct hdmi_audio_data *ad = card_drvdata_substream(substream);
> +
> + WARN_ON(ad->current_stream != substream);
> +
> + ad->ops->audio_shutdown(ad->dssdev);
> +
> + mutex_lock(&ad->current_stream_lock);
> + ad->current_stream = NULL;
> + mutex_unlock(&ad->current_stream_lock);
> +}
> +
> +static const struct snd_soc_dai_ops hdmi_dai_ops = {
> + .startup = hdmi_dai_startup,
> + .hw_params = hdmi_dai_hw_params,
> + .trigger = hdmi_dai_trigger,
> + .shutdown = hdmi_dai_shutdown,
> +};
> +
> +static const struct snd_soc_component_driver omap_hdmi_component = {
> + .name = "omapdss_hdmi",
> +};
> +
> +static struct snd_soc_dai_driver omap5_hdmi_dai = {
> + .name = "omap5-hdmi-dai",
> + .playback = {
> + .channels_min = 2,
> + .channels_max = 8,
> + .rates = (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
> + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 |
> + SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |
> + SNDRV_PCM_RATE_192000),
> + .formats = SNDRV_PCM_FMTBIT_S16_LE,
> + },
> + .ops = &hdmi_dai_ops,
> +};
> +
> +static struct snd_soc_dai_driver omap4_hdmi_dai = {
> + .name = "omap4-hdmi-dai",
> + .playback = {
> + .channels_min = 2,
> + .channels_max = 8,
> + .rates = (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
> + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 |
> + SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |
> + SNDRV_PCM_RATE_192000),
> + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
> + },
> + .ops = &hdmi_dai_ops,
> +};
> +
> +static int omap_hdmi_audio_probe(struct platform_device *pdev)
> +{
> + struct omap_hdmi_audio_pdata *ha = pdev->dev.platform_data;
> + struct device *dev = &pdev->dev;
> + struct hdmi_audio_data *ad;
> + struct snd_soc_dai_driver *dai_drv;
> + struct snd_soc_card *card;
> + int ret;
> +
> + if (!ha) {
> + dev_err(dev, "No platform data\n");
> + return -EINVAL;
> + }
> +
> + ad = devm_kzalloc(dev, sizeof(*ad), GFP_KERNEL);
> + if (!ad)
> + return -ENOMEM;
> + ad->dssdev = ha->dev;
> + ad->ops = ha->ops;
> + ad->dma_data.addr = ha->audio_dma_addr;
> + ad->dma_data.filter_data = "audio_tx";
> + ad->dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> + mutex_init(&ad->current_stream_lock);
> +
> + switch (ha->dss_version) {
> + case OMAPDSS_VER_OMAP4430_ES1:
> + case OMAPDSS_VER_OMAP4430_ES2:
> + case OMAPDSS_VER_OMAP4:
> + dai_drv = &omap4_hdmi_dai;
> + break;
> + case OMAPDSS_VER_OMAP5:
> + dai_drv = &omap5_hdmi_dai;
> + break;
> + default:
> + return -EINVAL;
> + }
> + ret = snd_soc_register_component(ad->dssdev, &omap_hdmi_component,
> + dai_drv, 1);
> + if (ret)
> + return ret;
> +
> + ret = omap_pcm_platform_register(ad->dssdev);
> + if (ret)
> + return ret;
> +
> + card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
> + card->name = devm_kasprintf(dev, GFP_KERNEL,
> + "HDMI %s", dev_name(ad->dssdev));
> + card->owner = THIS_MODULE;
> + card->dai_link > + devm_kzalloc(dev, sizeof(*(card->dai_link)), GFP_KERNEL);
> + card->dai_link->name = card->name;
> + card->dai_link->stream_name = card->name;
> + card->dai_link->cpu_dai_name = dev_name(ad->dssdev);
> + card->dai_link->platform_name = dev_name(ad->dssdev);
> + card->dai_link->codec_name = "snd-soc-dummy";
> + card->dai_link->codec_dai_name = "snd-soc-dummy-dai";
> + card->num_links = 1;
> + card->dev = dev;
> +
> + ret = snd_soc_register_card(card);
> + if (ret) {
> + dev_err(dev, "snd_soc_register_card failed (%d)\n", ret);
> + snd_soc_unregister_component(ad->dssdev);
> + return ret;
> + }
> +
> + ad->card = card;
> + snd_soc_card_set_drvdata(card, ad);
> +
> + dev_set_drvdata(dev, ad);
> +
> + return 0;
> +}
> +
> +static int omap_hdmi_audio_remove(struct platform_device *pdev)
> +{
> + struct hdmi_audio_data *ad = platform_get_drvdata(pdev);
> +
> + snd_soc_unregister_card(ad->card);
> + snd_soc_unregister_component(ad->dssdev);
> + return 0;
> +}
> +
> +static struct platform_driver hdmi_audio_driver = {
> + .driver = {
> + .name = DRV_NAME,
> + .owner = THIS_MODULE,
> + },
> + .probe = omap_hdmi_audio_probe,
> + .remove = omap_hdmi_audio_remove,
> +};
> +
> +module_platform_driver(hdmi_audio_driver);
> +
> +MODULE_AUTHOR("Jyri Sarha <jsarha@ti.com>");
> +MODULE_DESCRIPTION("OMAP HDMI Audio Driver");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:" DRV_NAME);
>
--
Péter
^ permalink raw reply
* [PATCH 22/22] OMAPDSS: features: remove unused DSI PLL features
From: Tomi Valkeinen @ 2014-11-12 11:52 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1415793144-11723-1-git-send-email-tomi.valkeinen@ti.com>
Now that the DSS has the common DSS PLL, we no longer use the DSI PLL
feature flags from dss_features.c.
Remove all the unused feature flags.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/fbdev/omap2/dss/dss_features.c | 38 ----------------------------
drivers/video/fbdev/omap2/dss/dss_features.h | 11 --------
2 files changed, 49 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/dss_features.c b/drivers/video/fbdev/omap2/dss/dss_features.c
index 7e7fcf450342..0e3da809473c 100644
--- a/drivers/video/fbdev/omap2/dss/dss_features.c
+++ b/drivers/video/fbdev/omap2/dss/dss_features.c
@@ -72,10 +72,6 @@ static const struct dss_reg_field omap2_dss_reg_fields[] = {
[FEAT_REG_HORIZONTALACCU] = { 9, 0 },
[FEAT_REG_VERTICALACCU] = { 25, 16 },
[FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
- [FEAT_REG_DSIPLL_REGN] = { 0, 0 },
- [FEAT_REG_DSIPLL_REGM] = { 0, 0 },
- [FEAT_REG_DSIPLL_REGM_DISPC] = { 0, 0 },
- [FEAT_REG_DSIPLL_REGM_DSI] = { 0, 0 },
};
static const struct dss_reg_field omap3_dss_reg_fields[] = {
@@ -87,10 +83,6 @@ static const struct dss_reg_field omap3_dss_reg_fields[] = {
[FEAT_REG_HORIZONTALACCU] = { 9, 0 },
[FEAT_REG_VERTICALACCU] = { 25, 16 },
[FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
- [FEAT_REG_DSIPLL_REGN] = { 7, 1 },
- [FEAT_REG_DSIPLL_REGM] = { 18, 8 },
- [FEAT_REG_DSIPLL_REGM_DISPC] = { 22, 19 },
- [FEAT_REG_DSIPLL_REGM_DSI] = { 26, 23 },
};
static const struct dss_reg_field am43xx_dss_reg_fields[] = {
@@ -113,10 +105,6 @@ static const struct dss_reg_field omap4_dss_reg_fields[] = {
[FEAT_REG_HORIZONTALACCU] = { 10, 0 },
[FEAT_REG_VERTICALACCU] = { 26, 16 },
[FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 },
- [FEAT_REG_DSIPLL_REGN] = { 8, 1 },
- [FEAT_REG_DSIPLL_REGM] = { 20, 9 },
- [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 },
- [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 },
};
static const struct dss_reg_field omap5_dss_reg_fields[] = {
@@ -128,10 +116,6 @@ static const struct dss_reg_field omap5_dss_reg_fields[] = {
[FEAT_REG_HORIZONTALACCU] = { 10, 0 },
[FEAT_REG_VERTICALACCU] = { 26, 16 },
[FEAT_REG_DISPC_CLK_SWITCH] = { 9, 7 },
- [FEAT_REG_DSIPLL_REGN] = { 8, 1 },
- [FEAT_REG_DSIPLL_REGM] = { 20, 9 },
- [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 },
- [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 },
};
static const enum omap_display_type omap2_dss_supported_displays[] = {
@@ -437,11 +421,6 @@ static const char * const omap5_dss_clk_source_names[] = {
static const struct dss_param_range omap2_dss_param_range[] = {
[FEAT_PARAM_DSS_FCK] = { 0, 133000000 },
[FEAT_PARAM_DSS_PCD] = { 2, 255 },
- [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
- [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
- [FEAT_PARAM_DSIPLL_REGM_HSDIV] = { 0, 0 },
- [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
- [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
[FEAT_PARAM_DOWNSCALE] = { 1, 2 },
/*
* Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
@@ -453,10 +432,6 @@ static const struct dss_param_range omap2_dss_param_range[] = {
static const struct dss_param_range omap3_dss_param_range[] = {
[FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
[FEAT_PARAM_DSS_PCD] = { 1, 255 },
- [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
- [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
- [FEAT_PARAM_DSIPLL_REGM_HSDIV] = { 0, (1 << 4) - 1 },
- [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
[FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
[FEAT_PARAM_DSI_FCK] = { 0, 173000000 },
[FEAT_PARAM_DOWNSCALE] = { 1, 4 },
@@ -473,10 +448,6 @@ static const struct dss_param_range am43xx_dss_param_range[] = {
static const struct dss_param_range omap4_dss_param_range[] = {
[FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
[FEAT_PARAM_DSS_PCD] = { 1, 255 },
- [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
- [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
- [FEAT_PARAM_DSIPLL_REGM_HSDIV] = { 0, (1 << 5) - 1 },
- [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
[FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
[FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
[FEAT_PARAM_DOWNSCALE] = { 1, 4 },
@@ -486,10 +457,6 @@ static const struct dss_param_range omap4_dss_param_range[] = {
static const struct dss_param_range omap5_dss_param_range[] = {
[FEAT_PARAM_DSS_FCK] = { 0, 209250000 },
[FEAT_PARAM_DSS_PCD] = { 1, 255 },
- [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
- [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
- [FEAT_PARAM_DSIPLL_REGM_HSDIV] = { 0, (1 << 5) - 1 },
- [FEAT_PARAM_DSIPLL_FINT] = { 150000, 52000000 },
[FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
[FEAT_PARAM_DSI_FCK] = { 0, 209250000 },
[FEAT_PARAM_DOWNSCALE] = { 1, 4 },
@@ -513,7 +480,6 @@ static const enum dss_feat_id omap3430_dss_feat_list[] = {
FEAT_LINEBUFFERSPLIT,
FEAT_ROWREPEATENABLE,
FEAT_RESIZECONF,
- FEAT_DSI_PLL_FREQSEL,
FEAT_DSI_REVERSE_TXCLKESC,
FEAT_VENC_REQUIRES_TV_DAC_CLK,
FEAT_CPR,
@@ -533,7 +499,6 @@ static const enum dss_feat_id am35xx_dss_feat_list[] = {
FEAT_LINEBUFFERSPLIT,
FEAT_ROWREPEATENABLE,
FEAT_RESIZECONF,
- FEAT_DSI_PLL_FREQSEL,
FEAT_DSI_REVERSE_TXCLKESC,
FEAT_VENC_REQUIRES_TV_DAC_CLK,
FEAT_CPR,
@@ -568,7 +533,6 @@ static const enum dss_feat_id omap3630_dss_feat_list[] = {
FEAT_ROWREPEATENABLE,
FEAT_RESIZECONF,
FEAT_DSI_PLL_PWR_BUG,
- FEAT_DSI_PLL_FREQSEL,
FEAT_CPR,
FEAT_PRELOAD,
FEAT_FIR_COEF_V,
@@ -650,8 +614,6 @@ static const enum dss_feat_id omap5_dss_feat_list[] = {
FEAT_ALPHA_FREE_ZORDER,
FEAT_FIFO_MERGE,
FEAT_BURST_2D,
- FEAT_DSI_PLL_SELFREQDCO,
- FEAT_DSI_PLL_REFSEL,
FEAT_DSI_PHY_DCC,
FEAT_MFLAG,
};
diff --git a/drivers/video/fbdev/omap2/dss/dss_features.h b/drivers/video/fbdev/omap2/dss/dss_features.h
index 05e8127d36b0..100f7a2d0638 100644
--- a/drivers/video/fbdev/omap2/dss/dss_features.h
+++ b/drivers/video/fbdev/omap2/dss/dss_features.h
@@ -41,7 +41,6 @@ enum dss_feat_id {
FEAT_LCD_CLK_SRC,
/* DSI-PLL power command 0x3 is not working */
FEAT_DSI_PLL_PWR_BUG,
- FEAT_DSI_PLL_FREQSEL,
FEAT_DSI_DCS_CMD_CONFIG_VC,
FEAT_DSI_VC_OCP_WIDTH,
FEAT_DSI_REVERSE_TXCLKESC,
@@ -61,8 +60,6 @@ enum dss_feat_id {
/* An unknown HW bug causing the normal FIFO thresholds not to work */
FEAT_OMAP3_DSI_FIFO_BUG,
FEAT_BURST_2D,
- FEAT_DSI_PLL_SELFREQDCO,
- FEAT_DSI_PLL_REFSEL,
FEAT_DSI_PHY_DCC,
FEAT_MFLAG,
};
@@ -77,19 +74,11 @@ enum dss_feat_reg_field {
FEAT_REG_HORIZONTALACCU,
FEAT_REG_VERTICALACCU,
FEAT_REG_DISPC_CLK_SWITCH,
- FEAT_REG_DSIPLL_REGN,
- FEAT_REG_DSIPLL_REGM,
- FEAT_REG_DSIPLL_REGM_DISPC,
- FEAT_REG_DSIPLL_REGM_DSI,
};
enum dss_range_param {
FEAT_PARAM_DSS_FCK,
FEAT_PARAM_DSS_PCD,
- FEAT_PARAM_DSIPLL_REGN,
- FEAT_PARAM_DSIPLL_REGM,
- FEAT_PARAM_DSIPLL_REGM_HSDIV,
- FEAT_PARAM_DSIPLL_FINT,
FEAT_PARAM_DSIPLL_LPDIV,
FEAT_PARAM_DSI_FCK,
FEAT_PARAM_DOWNSCALE,
--
2.1.3
^ permalink raw reply related
* [PATCH 21/22] OMAPDSS: HDMI: use common DSS PLL support
From: Tomi Valkeinen @ 2014-11-12 11:52 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1415793144-11723-1-git-send-email-tomi.valkeinen@ti.com>
Now that we have the common DSS PLL support, change HDMI to use it. This
results in quite a lot of changes, but almost all of them are trivial
name changes.
The function to program the PLL settings can be removed from hdmi_pll.c,
as the common PLL API contains the same functionality.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi.h | 24 +---
drivers/video/fbdev/omap2/dss/hdmi4.c | 55 +++-----
drivers/video/fbdev/omap2/dss/hdmi5.c | 56 +++-----
drivers/video/fbdev/omap2/dss/hdmi_pll.c | 225 ++++++++++++++-----------------
4 files changed, 146 insertions(+), 214 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index 7595274a9bcf..3c42823e934b 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -184,18 +184,6 @@ struct hdmi_config {
enum hdmi_core_hdmi_dvi hdmi_dvi_mode;
};
-/* HDMI PLL structure */
-struct hdmi_pll_info {
- u16 regn;
- u16 regm;
- u32 regmf;
- u16 regm2;
- u16 regsd;
-
- unsigned long clkdco;
- unsigned long clkout;
-};
-
struct hdmi_audio_format {
enum hdmi_stereo_channels stereo_channels;
u8 active_chnnls_msk;
@@ -246,11 +234,11 @@ struct hdmi_wp_data {
};
struct hdmi_pll_data {
+ struct dss_pll pll;
+
void __iomem *base;
struct hdmi_wp_data *wp;
-
- struct hdmi_pll_info info;
};
struct hdmi_phy_data {
@@ -314,14 +302,12 @@ void hdmi_wp_init_vid_fmt_timings(struct hdmi_video_format *video_fmt,
int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp);
/* HDMI PLL funcs */
-int hdmi_pll_enable(struct hdmi_pll_data *pll);
-void hdmi_pll_disable(struct hdmi_pll_data *pll);
-int hdmi_pll_set_config(struct hdmi_pll_data *pll);
void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s);
-void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin,
- unsigned long target_tmds);
+void hdmi_pll_compute(struct hdmi_pll_data *pll,
+ unsigned long target_tmds, struct dss_pll_clock_info *pi);
int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
struct hdmi_wp_data *wp);
+void hdmi_pll_uninit(struct hdmi_pll_data *hpll);
/* HDMI PHY funcs */
int hdmi_phy_configure(struct hdmi_phy_data *phy, unsigned long hfbitclk,
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 98aa910241b8..46dcc71ce058 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -49,7 +49,6 @@ static struct {
struct hdmi_config cfg;
- struct clk *sys_clk;
struct regulator *vdda_hdmi_dac_reg;
bool core_enabled;
@@ -181,6 +180,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)
struct omap_video_timings *p;
struct omap_overlay_manager *mgr = hdmi.output.manager;
struct hdmi_wp_data *wp = &hdmi.wp;
+ struct dss_pll_clock_info hdmi_cinfo = { 0 };
r = hdmi_power_on_core(dssdev);
if (r)
@@ -194,22 +194,22 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)
DSSDBG("hdmi_power_on x_res= %d y_res = %d\n", p->x_res, p->y_res);
- hdmi_pll_compute(&hdmi.pll, clk_get_rate(hdmi.sys_clk), p->pixelclock);
+ hdmi_pll_compute(&hdmi.pll, p->pixelclock, &hdmi_cinfo);
- r = hdmi_pll_enable(&hdmi.pll);
+ r = dss_pll_enable(&hdmi.pll.pll);
if (r) {
DSSERR("Failed to enable PLL\n");
goto err_pll_enable;
}
- r = hdmi_pll_set_config(&hdmi.pll);
+ r = dss_pll_set_config(&hdmi.pll.pll, &hdmi_cinfo);
if (r) {
DSSERR("Failed to configure PLL\n");
goto err_pll_cfg;
}
- r = hdmi_phy_configure(&hdmi.phy, hdmi.pll.info.clkdco,
- hdmi.pll.info.clkout);
+ r = hdmi_phy_configure(&hdmi.phy, hdmi_cinfo.clkdco,
+ hdmi_cinfo.clkout[0]);
if (r) {
DSSDBG("Failed to configure PHY\n");
goto err_phy_cfg;
@@ -247,7 +247,7 @@ err_phy_cfg:
hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF);
err_phy_pwr:
err_pll_cfg:
- hdmi_pll_disable(&hdmi.pll);
+ dss_pll_disable(&hdmi.pll.pll);
err_pll_enable:
hdmi_power_off_core(dssdev);
return -EIO;
@@ -265,7 +265,7 @@ static void hdmi_power_off_full(struct omap_dss_device *dssdev)
hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF);
- hdmi_pll_disable(&hdmi.pll);
+ dss_pll_disable(&hdmi.pll.pll);
hdmi_power_off_core(dssdev);
}
@@ -407,21 +407,6 @@ static void hdmi_core_disable(struct omap_dss_device *dssdev)
mutex_unlock(&hdmi.lock);
}
-static int hdmi_get_clocks(struct platform_device *pdev)
-{
- struct clk *clk;
-
- clk = devm_clk_get(&pdev->dev, "sys_clk");
- if (IS_ERR(clk)) {
- DSSERR("can't get sys_clk\n");
- return PTR_ERR(clk);
- }
-
- hdmi.sys_clk = clk;
-
- return 0;
-}
-
static int hdmi_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst)
{
@@ -700,22 +685,17 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
r = hdmi_phy_init(pdev, &hdmi.phy);
if (r)
- return r;
+ goto err;
r = hdmi4_core_init(pdev, &hdmi.core);
if (r)
- return r;
-
- r = hdmi_get_clocks(pdev);
- if (r) {
- DSSERR("can't get clocks\n");
- return r;
- }
+ goto err;
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
DSSERR("platform_get_irq failed\n");
- return -ENODEV;
+ r = -ENODEV;
+ goto err;
}
r = devm_request_threaded_irq(&pdev->dev, irq,
@@ -723,7 +703,7 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
IRQF_ONESHOT, "OMAP HDMI", &hdmi.wp);
if (r) {
DSSERR("HDMI IRQ request failed\n");
- return r;
+ goto err;
}
pm_runtime_enable(&pdev->dev);
@@ -733,12 +713,17 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
dss_debugfs_create_file("hdmi", hdmi_dump_regs);
return 0;
+err:
+ hdmi_pll_uninit(&hdmi.pll);
+ return r;
}
static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
{
hdmi_uninit_output(pdev);
+ hdmi_pll_uninit(&hdmi.pll);
+
pm_runtime_disable(&pdev->dev);
return 0;
@@ -746,8 +731,6 @@ static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
static int hdmi_runtime_suspend(struct device *dev)
{
- clk_disable_unprepare(hdmi.sys_clk);
-
dispc_runtime_put();
return 0;
@@ -761,8 +744,6 @@ static int hdmi_runtime_resume(struct device *dev)
if (r < 0)
return r;
- clk_prepare_enable(hdmi.sys_clk);
-
return 0;
}
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c
index facc4e070520..67facf87b370 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -54,8 +54,8 @@ static struct {
struct hdmi_config cfg;
- struct clk *sys_clk;
struct regulator *vdda_reg;
+ struct clk *sys_clk;
bool core_enabled;
@@ -198,6 +198,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)
int r;
struct omap_video_timings *p;
struct omap_overlay_manager *mgr = hdmi.output.manager;
+ struct dss_pll_clock_info hdmi_cinfo = { 0 };
r = hdmi_power_on_core(dssdev);
if (r)
@@ -207,27 +208,27 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)
DSSDBG("hdmi_power_on x_res= %d y_res = %d\n", p->x_res, p->y_res);
- hdmi_pll_compute(&hdmi.pll, clk_get_rate(hdmi.sys_clk), p->pixelclock);
+ hdmi_pll_compute(&hdmi.pll, p->pixelclock, &hdmi_cinfo);
/* disable and clear irqs */
hdmi_wp_clear_irqenable(&hdmi.wp, 0xffffffff);
hdmi_wp_set_irqstatus(&hdmi.wp,
hdmi_wp_get_irqstatus(&hdmi.wp));
- r = hdmi_pll_enable(&hdmi.pll);
+ r = dss_pll_enable(&hdmi.pll.pll);
if (r) {
DSSERR("Failed to enable PLL\n");
goto err_pll_enable;
}
- r = hdmi_pll_set_config(&hdmi.pll);
+ r = dss_pll_set_config(&hdmi.pll.pll, &hdmi_cinfo);
if (r) {
DSSERR("Failed to configure PLL\n");
goto err_pll_cfg;
}
- r = hdmi_phy_configure(&hdmi.phy, hdmi.pll.info.clkdco,
- hdmi.pll.info.clkout);
+ r = hdmi_phy_configure(&hdmi.phy, hdmi_cinfo.clkdco,
+ hdmi_cinfo.clkout[0]);
if (r) {
DSSDBG("Failed to start PHY\n");
goto err_phy_cfg;
@@ -265,7 +266,7 @@ err_vid_enable:
err_phy_pwr:
err_phy_cfg:
err_pll_cfg:
- hdmi_pll_disable(&hdmi.pll);
+ dss_pll_disable(&hdmi.pll.pll);
err_pll_enable:
hdmi_power_off_core(dssdev);
return -EIO;
@@ -283,7 +284,7 @@ static void hdmi_power_off_full(struct omap_dss_device *dssdev)
hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF);
- hdmi_pll_disable(&hdmi.pll);
+ dss_pll_disable(&hdmi.pll.pll);
hdmi_power_off_core(dssdev);
}
@@ -436,21 +437,6 @@ static void hdmi_core_disable(struct omap_dss_device *dssdev)
mutex_unlock(&hdmi.lock);
}
-static int hdmi_get_clocks(struct platform_device *pdev)
-{
- struct clk *clk;
-
- clk = devm_clk_get(&pdev->dev, "sys_clk");
- if (IS_ERR(clk)) {
- DSSERR("can't get sys_clk\n");
- return PTR_ERR(clk);
- }
-
- hdmi.sys_clk = clk;
-
- return 0;
-}
-
static int hdmi_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst)
{
@@ -729,22 +715,17 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
r = hdmi_phy_init(pdev, &hdmi.phy);
if (r)
- return r;
+ goto err;
r = hdmi5_core_init(pdev, &hdmi.core);
if (r)
- return r;
-
- r = hdmi_get_clocks(pdev);
- if (r) {
- DSSERR("can't get clocks\n");
- return r;
- }
+ goto err;
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
DSSERR("platform_get_irq failed\n");
- return -ENODEV;
+ r = -ENODEV;
+ goto err;
}
r = devm_request_threaded_irq(&pdev->dev, irq,
@@ -752,7 +733,7 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
IRQF_ONESHOT, "OMAP HDMI", &hdmi.wp);
if (r) {
DSSERR("HDMI IRQ request failed\n");
- return r;
+ goto err;
}
pm_runtime_enable(&pdev->dev);
@@ -762,12 +743,17 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
dss_debugfs_create_file("hdmi", hdmi_dump_regs);
return 0;
+err:
+ hdmi_pll_uninit(&hdmi.pll);
+ return r;
}
static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
{
hdmi_uninit_output(pdev);
+ hdmi_pll_uninit(&hdmi.pll);
+
pm_runtime_disable(&pdev->dev);
return 0;
@@ -775,8 +761,6 @@ static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
static int hdmi_runtime_suspend(struct device *dev)
{
- clk_disable_unprepare(hdmi.sys_clk);
-
dispc_runtime_put();
return 0;
@@ -790,8 +774,6 @@ static int hdmi_runtime_resume(struct device *dev)
if (r < 0)
return r;
- clk_prepare_enable(hdmi.sys_clk);
-
return 0;
}
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
index 92d22252f86a..87accdb59c81 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
@@ -15,22 +15,13 @@
#include <linux/err.h>
#include <linux/io.h>
#include <linux/platform_device.h>
+#include <linux/clk.h>
+
#include <video/omapdss.h>
#include "dss.h"
#include "hdmi.h"
-struct hdmi_pll_features {
- bool has_refsel;
- bool sys_reset;
- unsigned long fint_min, fint_max;
- u16 regm_max;
- unsigned long dcofreq_low_min, dcofreq_low_max;
- unsigned long dcofreq_high_min, dcofreq_high_max;
-};
-
-static const struct hdmi_pll_features *pll_feat;
-
void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s)
{
#define DUMPPLL(r) seq_printf(s, "%-35s %08x\n", #r,\
@@ -47,25 +38,28 @@ void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s)
DUMPPLL(PLLCTRL_CFG4);
}
-void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin,
- unsigned long target_tmds)
+void hdmi_pll_compute(struct hdmi_pll_data *pll,
+ unsigned long target_tmds, struct dss_pll_clock_info *pi)
{
- struct hdmi_pll_info *pi = &pll->info;
unsigned long fint, clkdco, clkout;
unsigned long target_bitclk, target_clkdco;
unsigned long min_dco;
unsigned n, m, mf, m2, sd;
+ unsigned long clkin;
+ const struct dss_pll_hw *hw = pll->pll.hw;
+
+ clkin = clk_get_rate(pll->pll.clkin);
DSSDBG("clkin %lu, target tmds %lu\n", clkin, target_tmds);
target_bitclk = target_tmds * 10;
/* Fint */
- n = DIV_ROUND_UP(clkin, pll_feat->fint_max);
+ n = DIV_ROUND_UP(clkin, hw->fint_max);
fint = clkin / n;
/* adjust m2 so that the clkdco will be high enough */
- min_dco = roundup(pll_feat->dcofreq_low_min, fint);
+ min_dco = roundup(hw->clkdco_min, fint);
m2 = DIV_ROUND_UP(min_dco, target_bitclk);
if (m2 = 0)
m2 = 1;
@@ -93,81 +87,20 @@ void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin,
n, m, mf, m2, sd);
DSSDBG("Fint %lu, clkdco %lu, clkout %lu\n", fint, clkdco, clkout);
- pi->regn = n;
- pi->regm = m;
- pi->regmf = mf;
- pi->regm2 = m2;
- pi->regsd = sd;
+ pi->n = n;
+ pi->m = m;
+ pi->mf = mf;
+ pi->mX[0] = m2;
+ pi->sd = sd;
+ pi->fint = fint;
pi->clkdco = clkdco;
- pi->clkout = clkout;
-}
-
-int hdmi_pll_set_config(struct hdmi_pll_data *pll)
-{
- u32 r;
- struct hdmi_pll_info *fmt = &pll->info;
-
- /* PLL start always use manual mode */
- REG_FLD_MOD(pll->base, PLLCTRL_PLL_CONTROL, 0x0, 0, 0);
-
- r = hdmi_read_reg(pll->base, PLLCTRL_CFG1);
- r = FLD_MOD(r, fmt->regm, 20, 9); /* CFG1_PLL_REGM */
- r = FLD_MOD(r, fmt->regn - 1, 8, 1); /* CFG1_PLL_REGN */
- hdmi_write_reg(pll->base, PLLCTRL_CFG1, r);
-
- r = hdmi_read_reg(pll->base, PLLCTRL_CFG2);
-
- r = FLD_MOD(r, 0x0, 12, 12); /* PLL_HIGHFREQ divide by 2 */
- r = FLD_MOD(r, 0x1, 13, 13); /* PLL_REFEN */
- r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */
- if (pll_feat->has_refsel)
- r = FLD_MOD(r, 0x3, 22, 21); /* REFSEL = SYSCLK */
-
- if (fmt->clkdco > pll_feat->dcofreq_low_max)
- r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */
- else
- r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */
-
- hdmi_write_reg(pll->base, PLLCTRL_CFG2, r);
-
- REG_FLD_MOD(pll->base, PLLCTRL_CFG3, fmt->regsd, 17, 10);
-
- r = hdmi_read_reg(pll->base, PLLCTRL_CFG4);
- r = FLD_MOD(r, fmt->regm2, 24, 18);
- r = FLD_MOD(r, fmt->regmf, 17, 0);
- hdmi_write_reg(pll->base, PLLCTRL_CFG4, r);
-
- /* go now */
- REG_FLD_MOD(pll->base, PLLCTRL_PLL_GO, 0x1, 0, 0);
-
- /* wait for bit change */
- if (hdmi_wait_for_bit_change(pll->base, PLLCTRL_PLL_GO,
- 0, 0, 0) != 0) {
- DSSERR("PLL GO bit not clearing\n");
- return -ETIMEDOUT;
- }
-
- /* Wait till the lock bit is set in PLL status */
- if (hdmi_wait_for_bit_change(pll->base,
- PLLCTRL_PLL_STATUS, 1, 1, 1) != 1) {
- DSSERR("cannot lock PLL\n");
- DSSERR("CFG1 0x%x\n",
- hdmi_read_reg(pll->base, PLLCTRL_CFG1));
- DSSERR("CFG2 0x%x\n",
- hdmi_read_reg(pll->base, PLLCTRL_CFG2));
- DSSERR("CFG4 0x%x\n",
- hdmi_read_reg(pll->base, PLLCTRL_CFG4));
- return -ETIMEDOUT;
- }
-
- DSSDBG("PLL locked!\n");
-
- return 0;
+ pi->clkout[0] = clkout;
}
-int hdmi_pll_enable(struct hdmi_pll_data *pll)
+static int hdmi_pll_enable(struct dss_pll *dsspll)
{
+ struct hdmi_pll_data *pll = container_of(dsspll, struct hdmi_pll_data, pll);
struct hdmi_wp_data *wp = pll->wp;
u16 r = 0;
@@ -178,64 +111,105 @@ int hdmi_pll_enable(struct hdmi_pll_data *pll)
return 0;
}
-void hdmi_pll_disable(struct hdmi_pll_data *pll)
+static void hdmi_pll_disable(struct dss_pll *dsspll)
{
+ struct hdmi_pll_data *pll = container_of(dsspll, struct hdmi_pll_data, pll);
struct hdmi_wp_data *wp = pll->wp;
hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_ALLOFF);
}
-static const struct hdmi_pll_features omap44xx_pll_feats = {
- .sys_reset = false,
- .fint_min = 500000,
- .fint_max = 2500000,
- .regm_max = 4095,
- .dcofreq_low_min = 500000000,
- .dcofreq_low_max = 1000000000,
- .dcofreq_high_min = 1000000000,
- .dcofreq_high_max = 2000000000,
+static const struct dss_pll_ops dsi_pll_ops = {
+ .enable = hdmi_pll_enable,
+ .disable = hdmi_pll_disable,
+ .set_config = dss_pll_write_config_type_b,
+};
+
+static const struct dss_pll_hw dss_omap4_hdmi_pll_hw = {
+ .n_max = 255,
+ .m_min = 20,
+ .m_max = 4095,
+ .mX_max = 127,
+ .fint_min = 500000,
+ .fint_max = 2500000,
+ .clkdco_max = 1800000000,
+
+ .clkdco_min = 500000000,
+ .clkdco_low = 1000000000,
+ .clkdco_max = 2000000000,
+
+ .n_msb = 8,
+ .n_lsb = 1,
+ .m_msb = 20,
+ .m_lsb = 9,
+
+ .mX_msb[0] = 24,
+ .mX_lsb[0] = 18,
+
+ .has_selfreqdco = true,
};
-static const struct hdmi_pll_features omap54xx_pll_feats = {
- .has_refsel = true,
- .sys_reset = true,
- .fint_min = 620000,
- .fint_max = 2500000,
- .regm_max = 2046,
- .dcofreq_low_min = 750000000,
- .dcofreq_low_max = 1500000000,
- .dcofreq_high_min = 1250000000,
- .dcofreq_high_max = 2500000000UL,
+static const struct dss_pll_hw dss_omap5_hdmi_pll_hw = {
+ .n_max = 255,
+ .m_min = 20,
+ .m_max = 2045,
+ .mX_max = 127,
+ .fint_min = 620000,
+ .fint_max = 2500000,
+ .clkdco_max = 1800000000,
+
+ .clkdco_min = 750000000,
+ .clkdco_low = 1500000000,
+ .clkdco_max = 2500000000UL,
+
+ .n_msb = 8,
+ .n_lsb = 1,
+ .m_msb = 20,
+ .m_lsb = 9,
+
+ .mX_msb[0] = 24,
+ .mX_lsb[0] = 18,
+
+ .has_selfreqdco = true,
+ .has_refsel = true,
};
-static int hdmi_pll_init_features(struct platform_device *pdev)
+static int dsi_init_pll_data(struct platform_device *pdev, struct hdmi_pll_data *hpll)
{
- struct hdmi_pll_features *dst;
- const struct hdmi_pll_features *src;
+ struct dss_pll *pll = &hpll->pll;
+ struct clk *clk;
+ int r;
- dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
- if (!dst) {
- dev_err(&pdev->dev, "Failed to allocate HDMI PHY Features\n");
- return -ENOMEM;
+ clk = devm_clk_get(&pdev->dev, "sys_clk");
+ if (IS_ERR(clk)) {
+ DSSERR("can't get sys_clk\n");
+ return PTR_ERR(clk);
}
+ pll->name = "hdmi";
+ pll->base = hpll->base;
+ pll->clkin = clk;
+
switch (omapdss_get_version()) {
case OMAPDSS_VER_OMAP4430_ES1:
case OMAPDSS_VER_OMAP4430_ES2:
case OMAPDSS_VER_OMAP4:
- src = &omap44xx_pll_feats;
+ pll->hw = &dss_omap4_hdmi_pll_hw;
break;
case OMAPDSS_VER_OMAP5:
- src = &omap54xx_pll_feats;
+ pll->hw = &dss_omap5_hdmi_pll_hw;
break;
default:
return -ENODEV;
}
- memcpy(dst, src, sizeof(*dst));
- pll_feat = dst;
+ pll->ops = &dsi_pll_ops;
+
+ r = dss_pll_register(pll);
+ if (r)
+ return r;
return 0;
}
@@ -248,10 +222,6 @@ int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
pll->wp = wp;
- r = hdmi_pll_init_features(pdev);
- if (r)
- return r;
-
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll");
if (!res) {
DSSERR("can't get PLL mem resource\n");
@@ -264,5 +234,18 @@ int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
return PTR_ERR(pll->base);
}
+ r = dsi_init_pll_data(pdev, pll);
+ if (r) {
+ DSSERR("failed to init HDMI PLL\n");
+ return r;
+ }
+
return 0;
}
+
+void hdmi_pll_uninit(struct hdmi_pll_data *hpll)
+{
+ struct dss_pll *pll = &hpll->pll;
+
+ dss_pll_unregister(pll);
+}
--
2.1.3
^ permalink raw reply related
* [PATCH 20/22] OMAPDSS: HDMI: remove extra poweroff
From: Tomi Valkeinen @ 2014-11-12 11:52 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1415793144-11723-1-git-send-email-tomi.valkeinen@ti.com>
hdmi_pll_enable powers off the PLL as the first thing it does. Right
after that, it enables the PLL powers.
The initial power-off is pointless, so let's remove it.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi_pll.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
index c14c3d132513..92d22252f86a 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
@@ -171,10 +171,6 @@ int hdmi_pll_enable(struct hdmi_pll_data *pll)
struct hdmi_wp_data *wp = pll->wp;
u16 r = 0;
- r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_ALLOFF);
- if (r)
- return r;
-
r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_BOTHON_ALLCLKS);
if (r)
return r;
--
2.1.3
^ permalink raw reply related
* [PATCH 19/22] OMAPDSS: HDMI: split PLL enable & config
From: Tomi Valkeinen @ 2014-11-12 11:52 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1415793144-11723-1-git-send-email-tomi.valkeinen@ti.com>
At the moment we have one function, hdmi_pll_enable, which enables the
PLL and writes the PLL configuration to registers.
To make the HDMI PLL ahere to the DSS PLL API, split the hdmi_pll_enable
into two parts: hdmi_pll_enable which enables the PLL HW, and
hdmi_pll_set_config which writes the config.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi.h | 1 +
drivers/video/fbdev/omap2/dss/hdmi4.c | 10 ++++++++--
drivers/video/fbdev/omap2/dss/hdmi5.c | 10 ++++++++--
drivers/video/fbdev/omap2/dss/hdmi_pll.c | 6 +-----
4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index 03761ecb81a6..7595274a9bcf 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -316,6 +316,7 @@ int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp);
/* HDMI PLL funcs */
int hdmi_pll_enable(struct hdmi_pll_data *pll);
void hdmi_pll_disable(struct hdmi_pll_data *pll);
+int hdmi_pll_set_config(struct hdmi_pll_data *pll);
void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s);
void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin,
unsigned long target_tmds);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 2094b6eae99e..98aa910241b8 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -196,13 +196,18 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)
hdmi_pll_compute(&hdmi.pll, clk_get_rate(hdmi.sys_clk), p->pixelclock);
- /* config the PLL and PHY hdmi_set_pll_pwrfirst */
r = hdmi_pll_enable(&hdmi.pll);
if (r) {
- DSSDBG("Failed to lock PLL\n");
+ DSSERR("Failed to enable PLL\n");
goto err_pll_enable;
}
+ r = hdmi_pll_set_config(&hdmi.pll);
+ if (r) {
+ DSSERR("Failed to configure PLL\n");
+ goto err_pll_cfg;
+ }
+
r = hdmi_phy_configure(&hdmi.phy, hdmi.pll.info.clkdco,
hdmi.pll.info.clkout);
if (r) {
@@ -241,6 +246,7 @@ err_vid_enable:
err_phy_cfg:
hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF);
err_phy_pwr:
+err_pll_cfg:
hdmi_pll_disable(&hdmi.pll);
err_pll_enable:
hdmi_power_off_core(dssdev);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c
index fb8c14507a4d..facc4e070520 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -214,13 +214,18 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)
hdmi_wp_set_irqstatus(&hdmi.wp,
hdmi_wp_get_irqstatus(&hdmi.wp));
- /* config the PLL and PHY hdmi_set_pll_pwrfirst */
r = hdmi_pll_enable(&hdmi.pll);
if (r) {
- DSSDBG("Failed to lock PLL\n");
+ DSSERR("Failed to enable PLL\n");
goto err_pll_enable;
}
+ r = hdmi_pll_set_config(&hdmi.pll);
+ if (r) {
+ DSSERR("Failed to configure PLL\n");
+ goto err_pll_cfg;
+ }
+
r = hdmi_phy_configure(&hdmi.phy, hdmi.pll.info.clkdco,
hdmi.pll.info.clkout);
if (r) {
@@ -259,6 +264,7 @@ err_vid_enable:
hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF);
err_phy_pwr:
err_phy_cfg:
+err_pll_cfg:
hdmi_pll_disable(&hdmi.pll);
err_pll_enable:
hdmi_power_off_core(dssdev);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
index 190bede1dcb9..c14c3d132513 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
@@ -103,7 +103,7 @@ void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin,
pi->clkout = clkout;
}
-static int hdmi_pll_config(struct hdmi_pll_data *pll)
+int hdmi_pll_set_config(struct hdmi_pll_data *pll)
{
u32 r;
struct hdmi_pll_info *fmt = &pll->info;
@@ -179,10 +179,6 @@ int hdmi_pll_enable(struct hdmi_pll_data *pll)
if (r)
return r;
- r = hdmi_pll_config(pll);
- if (r)
- return r;
-
return 0;
}
--
2.1.3
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox