* [PATCH 01/13] ARM: omap4.dtsi: Add audio related parametes to hdmi node
From: Jyri Sarha @ 2014-05-23 19:07 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha@ti.com>
Adds HDMI audio sDMA properties.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
arch/arm/boot/dts/omap4.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 649b5cd..335ed54 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -919,6 +919,8 @@
ti,hwmods = "dss_hdmi";
clocks = <&dss_48mhz_clk>, <&dss_sys_clk>;
clock-names = "fck", "sys_clk";
+ dmas = <&sdma 76>;
+ dma-names = "audio_tx";
};
};
};
--
1.7.9.5
^ permalink raw reply related
* [PATCH 02/13] ARM: omap5.dtsi: Add audio related parameters to hdmi node
From: Jyri Sarha @ 2014-05-23 19:07 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha@ti.com>
Adds HDMI audio sDMA properties.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
arch/arm/boot/dts/omap5.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 32c02ce..279a9c7 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -937,6 +937,8 @@
ti,hwmods = "dss_hdmi";
clocks = <&dss_48mhz_clk>, <&dss_sys_clk>;
clock-names = "fck", "sys_clk";
+ dmas = <&sdma 76>;
+ dma-names = "audio_tx";
};
};
};
--
1.7.9.5
^ permalink raw reply related
* [PATCH 03/13] ARM: OMAP2+: Remove non working OMAP HDMI audio initialization
From: Jyri Sarha @ 2014-05-23 19:07 UTC (permalink / raw)
To: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: peter.ujfalusi-l0cyMroinI0, broonie-DgEjT+Ai2ygdnm+yROfE0A,
liam.r.girdwood-VuQAYsv1563Yd54FQh9/CA,
bcousson-rdvid1DuHRBWk0Htik3J/w, tomi.valkeinen-l0cyMroinI0,
detheridge-l0cyMroinI0, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha-l0cyMroinI0@public.gmane.org>
This code is not working currently and it can be removed. There is a
conflict in sharing resources with the actual HDMI driver and with
the ASoC HDMI audio DAI driver.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
arch/arm/mach-omap2/devices.c | 28 ----------------------------
1 file changed, 28 deletions(-)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index e58609b..4bab682 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -330,33 +330,6 @@ static void omap_init_audio(void)
static inline void omap_init_audio(void) {}
#endif
-#if defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI) || \
- defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI_MODULE)
-
-static struct platform_device omap_hdmi_audio = {
- .name = "omap-hdmi-audio",
- .id = -1,
-};
-
-static void __init omap_init_hdmi_audio(void)
-{
- struct omap_hwmod *oh;
- struct platform_device *pdev;
-
- oh = omap_hwmod_lookup("dss_hdmi");
- if (!oh)
- return;
-
- pdev = omap_device_build("omap-hdmi-audio-dai", -1, oh, NULL, 0);
- WARN(IS_ERR(pdev),
- "Can't build omap_device for omap-hdmi-audio-dai.\n");
-
- platform_device_register(&omap_hdmi_audio);
-}
-#else
-static inline void omap_init_hdmi_audio(void) {}
-#endif
-
#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
#include <linux/platform_data/spi-omap2-mcspi.h>
@@ -492,7 +465,6 @@ static int __init omap2_init_devices(void)
*/
omap_init_audio();
omap_init_camera();
- omap_init_hdmi_audio();
omap_init_mbox();
/* If dtb is there, the devices will be created dynamically */
if (!of_have_populated_dt()) {
--
1.7.9.5
^ permalink raw reply related
* [PATCH 04/13] OMAPDSS: hdmi_wp: Add function for getting hdmi_wp physical base address
From: Jyri Sarha @ 2014-05-23 19:07 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha@ti.com>
The hdmi_wp physical base address is needed for hdmi audio dma.
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 fbee078..f644bc8 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -341,6 +341,7 @@ struct hdmi_core_infoframe_avi {
struct hdmi_wp_data {
void __iomem *base;
+ phys_addr_t phys_base;
};
struct hdmi_pll_data {
@@ -410,6 +411,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_phys_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 a16a190..bee6df3 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_wp.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
@@ -264,6 +264,7 @@ int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp)
temp_res.end = temp_res.start + WP_SIZE - 1;
res = &temp_res;
}
+ wp->phys_base = res->start;
wp->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
if (!wp->base) {
@@ -273,3 +274,8 @@ int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp)
return 0;
}
+
+phys_addr_t hdmi_wp_get_phys_addr(struct hdmi_wp_data *wp)
+{
+ return wp->phys_base;
+}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 05/13] OMAPDSS: hdmi_audio: Add hdmi_audio.c for registering HDMI audio support
From: Jyri Sarha @ 2014-05-23 19:07 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha@ti.com>
HDMI audio is implemented using ASoC component drivers. The drivers
were earlier registered from under mach-omap2 but that code had
problems with sharing the HDMI resources. This commit adds functions
for registering the ASoC drivers needed for HDMI audio from HDMI
driver itself.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/Makefile | 2 +-
drivers/video/fbdev/omap2/dss/hdmi.h | 12 ++++
drivers/video/fbdev/omap2/dss/hdmi_audio.c | 92 ++++++++++++++++++++++++++++
3 files changed, 105 insertions(+), 1 deletion(-)
create mode 100644 drivers/video/fbdev/omap2/dss/hdmi_audio.c
diff --git a/drivers/video/fbdev/omap2/dss/Makefile b/drivers/video/fbdev/omap2/dss/Makefile
index 390ab74..7ea2d7c 100644
--- a/drivers/video/fbdev/omap2/dss/Makefile
+++ b/drivers/video/fbdev/omap2/dss/Makefile
@@ -11,7 +11,7 @@ omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o
omapdss-$(CONFIG_OMAP2_DSS_HDMI_COMMON) += hdmi_common.o hdmi_wp.o hdmi_pll.o \
- hdmi_phy.o
+ hdmi_phy.o hdmi_audio.o
omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi4.o hdmi4_core.o
omapdss-$(CONFIG_OMAP5_DSS_HDMI) += hdmi5.o hdmi5_core.o
ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index f644bc8..3ddb5f8 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -434,6 +434,18 @@ 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)
+struct hdmi_audio_data {
+ struct platform_device *cpudai_pdev;
+ struct platform_device *codec_pdev;
+ struct platform_device *card_pdev;
+};
+
+int hdmi_audio_register(struct platform_device *pdev,
+ struct hdmi_audio_data *data,
+ struct omap_dss_device *hdmi,
+ struct hdmi_wp_data *wp);
+void hdmi_audio_unregister(struct hdmi_audio_data *data);
+
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);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_audio.c b/drivers/video/fbdev/omap2/dss/hdmi_audio.c
new file mode 100644
index 0000000..2a485f7
--- /dev/null
+++ b/drivers/video/fbdev/omap2/dss/hdmi_audio.c
@@ -0,0 +1,92 @@
+/*
+ * OMAP4+ HDMI audio
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated
+ *
+ * Authors: 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 <linux/of_dma.h>
+#include <linux/dmaengine.h>
+#include <sound/omap-hdmi-dai-pdata.h>
+#include <sound/omap-hdmi-card-pdata.h>
+
+#include "hdmi.h"
+
+static struct asoc_omap_hdmi_dai_pdata dai_pdata;
+struct asoc_omap_hdmi_card_pdata card_pdata;
+
+int hdmi_audio_register(struct platform_device *pdev,
+ struct hdmi_audio_data *data,
+ struct omap_dss_device *hdmi,
+ struct hdmi_wp_data *wp)
+{
+ struct device_node *np = pdev->dev.of_node;
+ struct device *dev = &pdev->dev;
+ struct dma_chan *dma_ch;
+ struct resource *res;
+
+ dai_pdata.dssdev = hdmi;
+ dai_pdata.dma_addr = hdmi_wp_get_phys_addr(wp) + HDMI_WP_AUDIO_DATA;
+
+ dma_ch = of_dma_request_slave_channel(np, "audio_tx");
+ if (IS_ERR(dma_ch)) {
+ dev_info(dev, "Could not get dma request channel from dts.\n");
+ /* Revert to hard coding. The DMA req channel is the
+ same on all supported hw. */
+ dai_pdata.dma_req = 76;
+ } else {
+ dai_pdata.dma_req = dma_ch->chan_id;
+ /* We only peeked the chan_id for pdata and let dai
+ driver take the DMA channel. */
+ dma_release_channel(dma_ch);
+ }
+
+ data->cpudai_pdev + platform_device_register_data(dev, "omap-hdmi-audio-dai", 0,
+ &dai_pdata, sizeof(dai_pdata));
+ if (IS_ERR(data->cpudai_pdev))
+ return PTR_ERR(data->cpudai_pdev);
+
+ data->codec_pdev + platform_device_register_data(dev, "hdmi-audio-codec",
+ 0, NULL, 0);
+ if (IS_ERR(data->codec_pdev)) {
+ platform_device_unregister(data->cpudai_pdev);
+ return PTR_ERR(data->codec_pdev);
+ }
+
+ card_pdata.cpudai_name = dev_name(&data->cpudai_pdev->dev);
+ card_pdata.codec_name = dev_name(&data->codec_pdev->dev);
+ data->card_pdev + platform_device_register_data(dev, "omap-hdmi-audio", 0,
+ &card_pdata, sizeof(card_pdata));
+ if (IS_ERR(data->card_pdev)) {
+ platform_device_unregister(data->cpudai_pdev);
+ platform_device_unregister(data->codec_pdev);
+ return PTR_ERR(data->card_pdev);
+ }
+ return 0;
+}
+
+void hdmi_audio_unregister(struct hdmi_audio_data *data)
+{
+ platform_device_unregister(data->cpudai_pdev);
+ platform_device_unregister(data->codec_pdev);
+ platform_device_unregister(data->card_pdev);
+}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 06/13] ASoC: omap-hdmi-dai: Add platform data struct for omap-hdmi-dai driver
From: Jyri Sarha @ 2014-05-23 19:07 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha@ti.com>
Provide the means to pass OMAPDSS HDMI resources over to omap-hdmi-dai
driver when the OMAPDSS driver registers the DAI driver.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
include/sound/omap-hdmi-dai-pdata.h | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 include/sound/omap-hdmi-dai-pdata.h
diff --git a/include/sound/omap-hdmi-dai-pdata.h b/include/sound/omap-hdmi-dai-pdata.h
new file mode 100644
index 0000000..337c859
--- /dev/null
+++ b/include/sound/omap-hdmi-dai-pdata.h
@@ -0,0 +1,31 @@
+/*
+ * omap-hdmi-dai-pdata.h
+ *
+ * Platform data for OMAP ALSA SoC DAI driver for HDMI audio on OMAP4+
+ * processors.
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ * Authors: 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.
+ *
+ */
+
+#ifndef __OMAP_HDMI_DAI_PDATA_H__
+#define __OMAP_HDMI_DAI_PDATA_H__
+
+struct omap_dss_device;
+
+struct asoc_omap_hdmi_dai_pdata {
+ struct omap_dss_device *dssdev;
+ dma_addr_t dma_addr;
+ unsigned int dma_req;
+};
+
+#endif
--
1.7.9.5
^ permalink raw reply related
* [PATCH 07/13] ASoC: omap-hdmi-card: Add platform data stuct for omap-hdmi-card driver
From: Jyri Sarha @ 2014-05-23 19:07 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha@ti.com>
The names of the needed ASoC component drivers need to be passed to
the omap-hdmi-card driver for it to find them.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
include/sound/omap-hdmi-card-pdata.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 include/sound/omap-hdmi-card-pdata.h
diff --git a/include/sound/omap-hdmi-card-pdata.h b/include/sound/omap-hdmi-card-pdata.h
new file mode 100644
index 0000000..f70495b
--- /dev/null
+++ b/include/sound/omap-hdmi-card-pdata.h
@@ -0,0 +1,28 @@
+/*
+ * omap-hdmi-card-pdata.h
+ *
+ * Platform data for OMAP ALSA SoC card driver for HDMI audio on OMAP4+
+ * processors.
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ * Authors: 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.
+ *
+ */
+
+#ifndef __OMAP_HDMI_CARD_PDATA_H__
+#define __OMAP_HDMI_CARD_PDATA_H__
+
+struct asoc_omap_hdmi_card_pdata {
+ const char *cpudai_name;
+ const char *codec_name;
+};
+
+#endif
--
1.7.9.5
^ permalink raw reply related
* [PATCH 08/13] ASoC: omap-hdmi: Changes for registeing the driver from OMAPDSS
From: Jyri Sarha @ 2014-05-23 19:07 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha@ti.com>
The old OMAP HDMI audio registering from arch/arm/mach-omap2/devices.c
was broken. The new approach is to register it from OMAPDSS HDMI
driver. The commit does the necessary changes for this approach to
omap-hdmi-dai driver.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
sound/soc/omap/omap-hdmi.c | 65 ++++++++++++--------------------------------
1 file changed, 17 insertions(+), 48 deletions(-)
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c
index 537a1ec..ed0a37c 100644
--- a/sound/soc/omap/omap-hdmi.c
+++ b/sound/soc/omap/omap-hdmi.c
@@ -35,6 +35,7 @@
#include <sound/dmaengine_pcm.h>
#include <video/omapdss.h>
+#include <sound/omap-hdmi-dai-pdata.h>
#include "omap-hdmi.h"
#include "omap-pcm.h"
@@ -65,7 +66,7 @@ static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream,
return err;
}
- if (!priv->dssdev->driver->audio_supported(priv->dssdev)) {
+ if (!priv->dssdev->ops.hdmi->audio_supported(priv->dssdev)) {
dev_err(dai->dev, "audio not supported\n");
return -ENODEV;
}
@@ -80,7 +81,7 @@ static int omap_hdmi_dai_prepare(struct snd_pcm_substream *substream,
{
struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
- return priv->dssdev->driver->audio_enable(priv->dssdev);
+ return priv->dssdev->ops.hdmi->audio_enable(priv->dssdev);
}
static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream,
@@ -206,7 +207,7 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream,
priv->dss_audio.iec = iec;
priv->dss_audio.cea = cea;
- err = priv->dssdev->driver->audio_config(priv->dssdev,
+ err = priv->dssdev->ops.hdmi->audio_config(priv->dssdev,
&priv->dss_audio);
return err;
@@ -222,12 +223,12 @@ static int omap_hdmi_dai_trigger(struct snd_pcm_substream *substream, int 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);
+ err = priv->dssdev->ops.hdmi->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);
+ priv->dssdev->ops.hdmi->audio_stop(priv->dssdev);
break;
default:
err = -EINVAL;
@@ -240,7 +241,7 @@ static void omap_hdmi_dai_shutdown(struct snd_pcm_substream *substream,
{
struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
- priv->dssdev->driver->audio_disable(priv->dssdev);
+ priv->dssdev->ops.hdmi->audio_disable(priv->dssdev);
}
static const struct snd_soc_dai_ops omap_hdmi_dai_ops = {
@@ -267,10 +268,14 @@ static const struct snd_soc_component_driver omap_hdmi_component = {
static int omap_hdmi_probe(struct platform_device *pdev)
{
- int ret;
- struct resource *hdmi_rsrc;
+ struct asoc_omap_hdmi_dai_pdata *pdata = pdev->dev.platform_data;
struct hdmi_priv *hdmi_data;
- bool hdmi_dev_found = false;
+ int ret;
+
+ if (!pdata) {
+ dev_err(&pdev->dev, "No platform data, bailing out\n");
+ return -ENODEV;
+ }
hdmi_data = devm_kzalloc(&pdev->dev, sizeof(*hdmi_data), GFP_KERNEL);
if (hdmi_data = NULL) {
@@ -278,48 +283,12 @@ static int omap_hdmi_probe(struct platform_device *pdev)
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.addr = pdata->dma_addr;
+ hdmi_data->dma_req = pdata->dma_req;
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;
- }
+ hdmi_data->dssdev = pdata->dssdev;
dev_set_drvdata(&pdev->dev, hdmi_data);
ret = snd_soc_register_component(&pdev->dev, &omap_hdmi_component,
--
1.7.9.5
^ permalink raw reply related
* [PATCH 09/13] ASoC: omap-hdmi-card: Changes for registeing the driver from OMAPDSS
From: Jyri Sarha @ 2014-05-23 19:07 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha@ti.com>
The old OMAP HDMI audio registering from arch/arm/mach-omap2/devices.c
was broken. The new approach is to register the drivers from OMAPDSS HDMI
driver. The commit does the necessary changes for this approach.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
sound/soc/omap/omap-hdmi-card.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/sound/soc/omap/omap-hdmi-card.c b/sound/soc/omap/omap-hdmi-card.c
index f649fe8..56c0055 100644
--- a/sound/soc/omap/omap-hdmi-card.c
+++ b/sound/soc/omap/omap-hdmi-card.c
@@ -26,15 +26,13 @@
#include <sound/soc.h>
#include <asm/mach-types.h>
#include <video/omapdss.h>
+#include <sound/omap-hdmi-card-pdata.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",
};
@@ -47,14 +45,28 @@ static struct snd_soc_card snd_soc_omap_hdmi = {
static int omap_hdmi_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
+ struct asoc_omap_hdmi_card_pdata *pdata = dev->platform_data;
struct snd_soc_card *card = &snd_soc_omap_hdmi;
int ret;
+ if (!pdata) {
+ dev_err(dev, "No platform data, bailing out\n");
+ return -ENODEV;
+ }
+
card->dev = &pdev->dev;
+ omap_hdmi_dai.cpu_dai_name + devm_kstrdup(dev, pdata->cpudai_name, GFP_KERNEL);
+ omap_hdmi_dai.platform_name + devm_kstrdup(dev, pdata->cpudai_name, GFP_KERNEL);
+ omap_hdmi_dai.codec_name + devm_kstrdup(dev, pdata->codec_name, GFP_KERNEL);
+
ret = snd_soc_register_card(card);
if (ret) {
- dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
+ dev_err(dev, "snd_soc_register_card failed (%d)\n", ret);
card->dev = NULL;
return ret;
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 10/13] OMAPDSS: hdmi4: Register HDMI audio ASoC drivers from HDMI driver
From: Jyri Sarha @ 2014-05-23 19:07 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha@ti.com>
The registering is best done here to share the resources owned by OMAPDSS
HDMI driver with ASoC DAI and platform drivers.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi4.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 626aad2..62ad1d9 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -52,6 +52,9 @@ static struct {
struct clk *sys_clk;
struct regulator *vdda_hdmi_dac_reg;
+#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
+ struct hdmi_audio_data audio;
+#endif
bool core_enabled;
struct omap_dss_device output;
@@ -736,6 +739,15 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
hdmi_init_output(pdev);
+#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
+ r = hdmi_audio_register(pdev, &hdmi.audio, &hdmi.output, &hdmi.wp);
+ if (r) {
+ DSSERR("Registering HDMI audio failed\n");
+ hdmi_uninit_output(pdev);
+ pm_runtime_disable(&pdev->dev);
+ return r;
+ }
+#endif
dss_debugfs_create_file("hdmi", hdmi_dump_regs);
return 0;
@@ -743,6 +755,9 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
{
+#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
+ hdmi_audio_unregister(&hdmi.audio);
+#endif
hdmi_uninit_output(pdev);
pm_runtime_disable(&pdev->dev);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 11/13] OMAPDSS: hdmi.h: Add HDMI_AUDIO_LAYOUT_6CH enum value
From: Jyri Sarha @ 2014-05-23 19:08 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.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 3ddb5f8..c9efc92 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -159,7 +159,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 12/13] OMAPDSS: hdmi5: Register HDMI audio ASoC drivers from HDMI driver
From: Jyri Sarha @ 2014-05-23 19:08 UTC (permalink / raw)
To: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: peter.ujfalusi-l0cyMroinI0, broonie-DgEjT+Ai2ygdnm+yROfE0A,
liam.r.girdwood-VuQAYsv1563Yd54FQh9/CA,
bcousson-rdvid1DuHRBWk0Htik3J/w, tomi.valkeinen-l0cyMroinI0,
detheridge-l0cyMroinI0, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha-l0cyMroinI0@public.gmane.org>
The registering is best done here to share the resources owned by OMAPDSS
HDMI driver with ASoC DAI and platform drivers.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/video/fbdev/omap2/dss/hdmi5.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c
index c468b9e..1ba387b 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -57,6 +57,9 @@ static struct {
struct clk *sys_clk;
struct regulator *vdda_reg;
+#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
+ struct hdmi_audio_data audio;
+#endif
bool core_enabled;
struct omap_dss_device output;
@@ -761,6 +764,15 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
hdmi_init_output(pdev);
+#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
+ r = hdmi_audio_register(pdev, &hdmi.audio, &hdmi.output, &hdmi.wp);
+ if (r) {
+ DSSERR("Registering HDMI audio failed\n");
+ hdmi_uninit_output(pdev);
+ pm_runtime_disable(&pdev->dev);
+ return r;
+ }
+#endif
dss_debugfs_create_file("hdmi", hdmi_dump_regs);
return 0;
@@ -768,6 +780,9 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
{
+#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
+ hdmi_audio_unregister(&hdmi.audio);
+#endif
hdmi_uninit_output(pdev);
pm_runtime_disable(&pdev->dev);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 13/13] ASoC: omap: Add Kconfig option for OMAP5 HDMI audio
From: Jyri Sarha @ 2014-05-23 19:08 UTC (permalink / raw)
To: alsa-devel, linux-fbdev, devicetree, linux-omap
Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson,
tomi.valkeinen, detheridge, Jyri Sarha
In-Reply-To: <cover.1400871999.git.jsarha@ti.com>
Adds SND_OMAP_SOC_OMAP5_HDMI config option for OMAP5 HDMI audio support.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
sound/soc/omap/Kconfig | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index d44463a..697e1b8 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -101,7 +101,7 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040
- PandaBoardES (4460)
config SND_OMAP_SOC_OMAP_HDMI
- tristate "SoC Audio support for Texas Instruments OMAP HDMI"
+ tristate "SoC Audio support for Texas Instruments OMAP4 HDMI"
depends on SND_OMAP_SOC && OMAP4_DSS_HDMI && OMAP2_DSS
select SND_OMAP_SOC_HDMI
select SND_SOC_HDMI_CODEC
@@ -110,6 +110,17 @@ config SND_OMAP_SOC_OMAP_HDMI
Say Y if you want to add support for SoC HDMI audio on Texas Instruments
OMAP4 chips
+
+config SND_OMAP_SOC_OMAP5_HDMI
+ tristate "SoC Audio support for Texas Instruments OMAP5 HDMI"
+ depends on SND_OMAP_SOC && OMAP5_DSS_HDMI && OMAP2_DSS
+ select SND_OMAP_SOC_HDMI
+ select SND_SOC_HDMI_CODEC
+ select OMAP5_DSS_HDMI_AUDIO
+ help
+ Say Y if you want to add support for SoC HDMI audio on Texas Instruments
+ OMAP5 chips
+
config SND_OMAP_SOC_OMAP3_PANDORA
tristate "SoC Audio support for OMAP3 Pandora"
depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/2] video: clps711x: Add new Cirrus Logic CLPS711X framebuffer driver
From: Alexander Shiyan @ 2014-05-24 5:41 UTC (permalink / raw)
To: linux-fbdev
This adds support for the framebuffer available in the Cirrus
Logic CLPS711X CPUs.
FB features:
- 1-2-4 bits per pixel.
- Programmable panel size to a maximum of 1024x256 at 4 bps.
- Relocatible Frame Buffer (SRAM or SDRAM).
- Programmable refresh rates.
- 16 gray scale values.
This new driver is designed to usage with devicetree only.
The driver have been tested with custom board equipped
Cirrus Logic EP7312.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/video/fbdev/Kconfig | 15 ++
drivers/video/fbdev/Makefile | 1 +
drivers/video/fbdev/clps711x-fb.c | 393 ++++++++++++++++++++++++++++++++++++++
3 files changed, 409 insertions(+)
create mode 100644 drivers/video/fbdev/clps711x-fb.c
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 59c98bf..c97b059 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -304,6 +304,7 @@ config FB_ACORN
config FB_CLPS711X
bool "CLPS711X LCD support"
depends on (FB = y) && ARM && ARCH_CLPS711X
+ depends on !ARCH_MULTIPLATFORM
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
@@ -311,6 +312,20 @@ config FB_CLPS711X
Say Y to enable the Framebuffer driver for the CLPS7111 and
EP7212 processors.
+config FB_CLPS711XDT
+ tristate "CLPS711X LCD support"
+ depends on FB && (ARCH_CLPS711X || COMPILE_TEST)
+ select BACKLIGHT_LCD_SUPPORT
+ select FB_MODE_HELPERS
+ select FB_SYS_FILLRECT
+ select FB_SYS_COPYAREA
+ select FB_SYS_IMAGEBLIT
+ select LCD_CLASS_DEVICE
+ select VIDEOMODE_HELPERS
+ help
+ Say Y to enable the Framebuffer driver for the Cirrus Logic
+ CLPS711X CPUs.
+
config FB_SA1100
bool "SA-1100 LCD support"
depends on (FB = y) && ARM && ARCH_SA1100
diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile
index 0284f2a..102bded 100644
--- a/drivers/video/fbdev/Makefile
+++ b/drivers/video/fbdev/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o
obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o
obj-$(CONFIG_FB_ARC) += arcfb.o
obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o
+obj-$(CONFIG_FB_CLPS711XDT) += clps711x-fb.o
obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o
obj-$(CONFIG_FB_GRVGA) += grvga.o
obj-$(CONFIG_FB_PM2) += pm2fb.o
diff --git a/drivers/video/fbdev/clps711x-fb.c b/drivers/video/fbdev/clps711x-fb.c
new file mode 100644
index 0000000..8513c06
--- /dev/null
+++ b/drivers/video/fbdev/clps711x-fb.c
@@ -0,0 +1,393 @@
+/*
+ * Cirrus Logic CLPS711X FB driver
+ *
+ * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
+ * Based on driver by Russell King <rmk@arm.linux.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/clk.h>
+#include <linux/fb.h>
+#include <linux/io.h>
+#include <linux/lcd.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+#include <linux/mfd/syscon/clps711x.h>
+#include <linux/regulator/consumer.h>
+#include <video/of_display_timing.h>
+
+#define CLPS711X_FB_NAME "clps711x-fb"
+#define CLPS711X_FB_BPP_MAX (4)
+
+/* Registers relative to LCDCON */
+#define CLPS711X_LCDCON (0x0000)
+# define LCDCON_GSEN BIT(30)
+# define LCDCON_GSMD BIT(31)
+#define CLPS711X_PALLSW (0x0280)
+#define CLPS711X_PALMSW (0x02c0)
+#define CLPS711X_FBADDR (0x0d40)
+
+struct clps711x_fb_info {
+ struct clk *clk;
+ void __iomem *base;
+ struct regmap *syscon;
+ resource_size_t buffsize;
+ struct fb_videomode mode;
+ struct regulator *lcd_pwr;
+ u32 ac_prescale;
+ bool cmap_invert;
+};
+
+static int clps711x_fb_setcolreg(u_int regno, u_int red, u_int green,
+ u_int blue, u_int transp, struct fb_info *info)
+{
+ struct clps711x_fb_info *cfb = info->par;
+ u32 level, mask, shift;
+
+ if (regno >= BIT(info->var.bits_per_pixel))
+ return -EINVAL;
+
+ shift = 4 * (regno & 7);
+ mask = 0xf << shift;
+ /* gray = 0.30*R + 0.58*G + 0.11*B */
+ level = (((red * 77 + green * 151 + blue * 28) >> 20) << shift) & mask;
+ if (cfb->cmap_invert)
+ level = 0xf - level;
+
+ regno = (regno < 8) ? CLPS711X_PALLSW : CLPS711X_PALMSW;
+
+ writel((readl(cfb->base + regno) & ~mask) | level, cfb->base + regno);
+
+ return 0;
+}
+
+static int clps711x_fb_check_var(struct fb_var_screeninfo *var,
+ struct fb_info *info)
+{
+ u32 val;
+
+ if (var->bits_per_pixel < 1 ||
+ var->bits_per_pixel > CLPS711X_FB_BPP_MAX)
+ return -EINVAL;
+
+ if (!var->pixclock)
+ return -EINVAL;
+
+ val = DIV_ROUND_UP(var->xres, 16) - 1;
+ if (val < 0x01 || val > 0x3f)
+ return -EINVAL;
+
+ val = DIV_ROUND_UP(var->yres * var->xres * var->bits_per_pixel, 128);
+ val--;
+ if (val < 0x001 || val > 0x1fff)
+ return -EINVAL;
+
+ var->transp.msb_right = 0;
+ var->transp.offset = 0;
+ var->transp.length = 0;
+ var->red.msb_right = 0;
+ var->red.offset = 0;
+ var->red.length = var->bits_per_pixel;
+ var->green = var->red;
+ var->blue = var->red;
+ var->grayscale = var->bits_per_pixel > 1;
+
+ return 0;
+}
+
+static int clps711x_fb_set_par(struct fb_info *info)
+{
+ struct clps711x_fb_info *cfb = info->par;
+ resource_size_t size;
+ u32 lcdcon, pps;
+
+ size = (info->var.xres * info->var.yres * info->var.bits_per_pixel) / 8;
+ if (size > cfb->buffsize)
+ return -EINVAL;
+
+ switch (info->var.bits_per_pixel) {
+ case 1:
+ info->fix.visual = FB_VISUAL_MONO01;
+ break;
+ case 2:
+ case 4:
+ info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ info->fix.line_length = info->var.xres * info->var.bits_per_pixel / 8;
+ info->fix.smem_len = size;
+
+ lcdcon = (info->var.xres * info->var.yres *
+ info->var.bits_per_pixel) / 128 - 1;
+ lcdcon |= ((info->var.xres / 16) - 1) << 13;
+ lcdcon |= (cfb->ac_prescale & 0x1f) << 25;
+
+ pps = clk_get_rate(cfb->clk) / (PICOS2KHZ(info->var.pixclock) * 1000);
+ if (pps)
+ pps--;
+ lcdcon |= (pps & 0x3f) << 19;
+
+ if (info->var.bits_per_pixel = 4)
+ lcdcon |= LCDCON_GSMD;
+ if (info->var.bits_per_pixel >= 2)
+ lcdcon |= LCDCON_GSEN;
+
+ /* LCDCON must only be changed while the LCD is disabled */
+ regmap_update_bits(cfb->syscon, SYSCON_OFFSET, SYSCON1_LCDEN, 0);
+ writel(lcdcon, cfb->base + CLPS711X_LCDCON);
+ regmap_update_bits(cfb->syscon, SYSCON_OFFSET,
+ SYSCON1_LCDEN, SYSCON1_LCDEN);
+
+ return 0;
+}
+
+static int clps711x_fb_blank(int blank, struct fb_info *info)
+{
+ /* Return happy */
+ return 0;
+}
+
+static struct fb_ops clps711x_fb_ops = {
+ .owner = THIS_MODULE,
+ .fb_setcolreg = clps711x_fb_setcolreg,
+ .fb_check_var = clps711x_fb_check_var,
+ .fb_set_par = clps711x_fb_set_par,
+ .fb_blank = clps711x_fb_blank,
+ .fb_fillrect = sys_fillrect,
+ .fb_copyarea = sys_copyarea,
+ .fb_imageblit = sys_imageblit,
+};
+
+static int clps711x_lcd_check_fb(struct lcd_device *lcddev, struct fb_info *fi)
+{
+ struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev);
+
+ return (!fi || fi->par = cfb) ? 1 : 0;
+}
+
+static int clps711x_lcd_get_power(struct lcd_device *lcddev)
+{
+ struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev);
+
+ if (!IS_ERR_OR_NULL(cfb->lcd_pwr))
+ return regulator_is_enabled(cfb->lcd_pwr);
+
+ return 1;
+}
+
+static int clps711x_lcd_set_power(struct lcd_device *lcddev, int power)
+{
+ struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev);
+
+ if (!IS_ERR_OR_NULL(cfb->lcd_pwr)) {
+ if (power)
+ return regulator_enable(cfb->lcd_pwr);
+ else
+ return regulator_disable(cfb->lcd_pwr);
+ }
+
+ return 0;
+}
+
+static struct lcd_ops clps711x_lcd_ops = {
+ .check_fb = clps711x_lcd_check_fb,
+ .get_power = clps711x_lcd_get_power,
+ .set_power = clps711x_lcd_set_power,
+};
+
+static int clps711x_fb_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct device_node *disp, *np = dev->of_node;
+ struct clps711x_fb_info *cfb;
+ struct lcd_device *lcd;
+ struct fb_info *info;
+ struct resource *res;
+ int ret = -ENOENT;
+ u32 val;
+
+ if (fb_get_options(CLPS711X_FB_NAME, NULL))
+ return -ENODEV;
+
+ info = framebuffer_alloc(sizeof(*cfb), dev);
+ if (!info)
+ return -ENOMEM;
+
+ cfb = info->par;
+ platform_set_drvdata(pdev, info);
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ goto out_fb_release;
+ cfb->base = devm_ioremap(dev, res->start, resource_size(res));
+ if (!cfb->base) {
+ ret = -ENOMEM;
+ goto out_fb_release;
+ }
+
+ info->fix.mmio_start = res->start;
+ info->fix.mmio_len = resource_size(res);
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ info->screen_base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(info->screen_base)) {
+ ret = PTR_ERR(info->screen_base);
+ goto out_fb_release;
+ }
+
+ /* Physical address should be aligned to 256 MiB */
+ if (res->start & 0x0fffffff) {
+ ret = -EINVAL;
+ goto out_fb_release;
+ }
+
+ info->apertures = alloc_apertures(1);
+ if (!info->apertures) {
+ ret = -ENOMEM;
+ goto out_fb_release;
+ }
+
+ cfb->buffsize = resource_size(res);
+ info->fix.smem_start = res->start;
+ info->apertures->ranges[0].base = info->fix.smem_start;
+ info->apertures->ranges[0].size = cfb->buffsize;
+
+ cfb->clk = devm_clk_get(dev, NULL);
+ if (IS_ERR(cfb->clk)) {
+ ret = PTR_ERR(cfb->clk);
+ goto out_fb_release;
+ }
+
+ cfb->syscon + syscon_regmap_lookup_by_compatible("cirrus,clps711x-syscon1");
+ if (IS_ERR(cfb->syscon)) {
+ ret = PTR_ERR(cfb->syscon);
+ goto out_fb_release;
+ }
+
+ disp = of_parse_phandle(np, "display", 0);
+ if (!disp) {
+ dev_err(&pdev->dev, "No display defined\n");
+ ret = -ENODATA;
+ goto out_fb_release;
+ }
+
+ ret = of_get_fb_videomode(disp, &cfb->mode, OF_USE_NATIVE_MODE);
+ if (ret)
+ goto out_fb_release;
+
+ of_property_read_u32(disp, "ac-prescale", &cfb->ac_prescale);
+ cfb->cmap_invert = of_property_read_bool(disp, "cmap-invert");
+
+ ret = of_property_read_u32(disp, "bits-per-pixel",
+ &info->var.bits_per_pixel);
+ if (ret)
+ goto out_fb_release;
+
+ /* Force disable LCD on any mismatch */
+ if (info->fix.smem_start != (readb(cfb->base + CLPS711X_FBADDR) << 28))
+ regmap_update_bits(cfb->syscon, SYSCON_OFFSET,
+ SYSCON1_LCDEN, 0);
+
+ ret = regmap_read(cfb->syscon, SYSCON_OFFSET, &val);
+ if (ret)
+ goto out_fb_release;
+
+ if (!(val & SYSCON1_LCDEN)) {
+ /* Setup start FB address */
+ writeb(info->fix.smem_start >> 28, cfb->base + CLPS711X_FBADDR);
+ /* Clean FB memory */
+ memset(info->screen_base, 0, cfb->buffsize);
+ }
+
+ cfb->lcd_pwr = devm_regulator_get(dev, "lcd");
+ if (PTR_ERR(cfb->lcd_pwr) = -EPROBE_DEFER) {
+ ret = -EPROBE_DEFER;
+ goto out_fb_release;
+ }
+
+ info->fbops = &clps711x_fb_ops;
+ info->flags = FBINFO_DEFAULT;
+ info->var.activate = FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW;
+ info->var.height = -1;
+ info->var.width = -1;
+ info->var.vmode = FB_VMODE_NONINTERLACED;
+ info->fix.type = FB_TYPE_PACKED_PIXELS;
+ info->fix.accel = FB_ACCEL_NONE;
+ strlcpy(info->fix.id, CLPS711X_FB_NAME, sizeof(info->fix.id));
+ fb_videomode_to_var(&info->var, &cfb->mode);
+
+ ret = fb_alloc_cmap(&info->cmap, BIT(CLPS711X_FB_BPP_MAX), 0);
+ if (ret)
+ goto out_fb_release;
+
+ ret = fb_set_var(info, &info->var);
+ if (ret)
+ goto out_fb_dealloc_cmap;
+
+ ret = register_framebuffer(info);
+ if (ret)
+ goto out_fb_dealloc_cmap;
+
+ lcd = devm_lcd_device_register(dev, "clps711x-lcd", dev, cfb,
+ &clps711x_lcd_ops);
+ if (!IS_ERR(lcd))
+ return 0;
+
+ ret = PTR_ERR(lcd);
+ unregister_framebuffer(info);
+
+out_fb_dealloc_cmap:
+ regmap_update_bits(cfb->syscon, SYSCON_OFFSET, SYSCON1_LCDEN, 0);
+ fb_dealloc_cmap(&info->cmap);
+
+out_fb_release:
+ framebuffer_release(info);
+
+ return ret;
+}
+
+static int clps711x_fb_remove(struct platform_device *pdev)
+{
+ struct fb_info *info = platform_get_drvdata(pdev);
+ struct clps711x_fb_info *cfb = info->par;
+
+ regmap_update_bits(cfb->syscon, SYSCON_OFFSET, SYSCON1_LCDEN, 0);
+
+ unregister_framebuffer(info);
+ fb_dealloc_cmap(&info->cmap);
+ framebuffer_release(info);
+
+ return 0;
+}
+
+static const struct of_device_id clps711x_fb_dt_ids[] = {
+ { .compatible = "cirrus,clps711x-fb", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, clps711x_fb_dt_ids);
+
+static struct platform_driver clps711x_fb_driver = {
+ .driver = {
+ .name = CLPS711X_FB_NAME,
+ .owner = THIS_MODULE,
+ .of_match_table = clps711x_fb_dt_ids,
+ },
+ .probe = clps711x_fb_probe,
+ .remove = clps711x_fb_remove,
+};
+module_platform_driver(clps711x_fb_driver);
+
+MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
+MODULE_DESCRIPTION("Cirrus Logic CLPS711X FB driver");
+MODULE_LICENSE("GPL");
--
1.8.5.5
^ permalink raw reply related
* [PATCH 2/2] video: clps711x: Add bindings documentation for CLPS711X framebuffer
From: Alexander Shiyan @ 2014-05-24 5:41 UTC (permalink / raw)
To: linux-fbdev-u79uwXL29TY76Z2rM5mHXA
Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Arnd Bergmann,
devicetree-u79uwXL29TY76Z2rM5mHXA, Alexander Shiyan
Add OF document for Cirrus Logic CLPS711X framebuffer driver.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
.../bindings/video/cirrus,clps711x-fb.txt | 47 ++++++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt
diff --git a/Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt b/Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt
new file mode 100644
index 0000000..6fc3c6a
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt
@@ -0,0 +1,47 @@
+* Currus Logic CLPS711X Framebuffer
+
+Required properties:
+- compatible: Shall contain "cirrus,clps711x-fb".
+- reg : Physical base address and length of the controller's registers +
+ location and size of the framebuffer memory.
+- clocks : phandle + clock specifier pair of the FB reference clock.
+- display : phandle to a display node as described in
+ Documentation/devicetree/bindings/video/display-timing.txt.
+ Additionally, the display node has to define properties:
+ - bits-per-pixel: Bits per pixel.
+ - ac-prescale : LCD AC bias frequency. This frequency is the required
+ AC bias frequency for a given manufacturer's LCD plate.
+ - cmap-invert : Invert the color levels (Optional).
+
+Optional properties:
+- lcd-supply: Regulator for LCD supply voltage.
+
+Example:
+ fb: fb@800002c0 {
+ compatible = "cirrus,ep7312-fb", "cirrus,clps711x-fb";
+ reg = <0x800002c0 0xd44>, <0x60000000 0xc000>;
+ clocks = <&clks 2>;
+ lcd-supply = <®5v0>;
+ display = <&display>;
+ };
+
+ display: display {
+ model = "320x240x4";
+ native-mode = <&timing0>;
+ bits-per-pixel = <4>;
+ ac-prescale = <17>;
+
+ display-timings {
+ timing0: 320x240 {
+ hactive = <320>;
+ hback-porch = <0>;
+ hfront-porch = <0>;
+ hsync-len = <0>;
+ vactive = <240>;
+ vback-porch = <0>;
+ vfront-porch = <0>;
+ vsync-len = <0>;
+ clock-frequency = <6500000>;
+ };
+ };
+ };
--
1.8.5.5
^ permalink raw reply related
* [PATCH] video: Introduce the use of the managed version of kzalloc
From: Himangi Saraogi @ 2014-05-25 10:52 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
linux-kernel
Cc: julia.lawall
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. Also, linux/device.h is added to make sure the devm_*()
routine declarations are unambiguously available. The function
mddi_dummy_remove is removed as it is no longer required after
removing the kfree. The variable ret is also done away with.
The following Coccinelle semantic patch was used for making a part of
the change:
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
.probe = probefn,
.remove = removefn,
};
@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
<+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
...
?-kfree(e);
...+>
}
@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
<...
- kfree(e);
...>
}
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
drivers/video/fbdev/msm/mddi_client_dummy.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/video/fbdev/msm/mddi_client_dummy.c b/drivers/video/fbdev/msm/mddi_client_dummy.c
index f1b0dfc..cdb8f69 100644
--- a/drivers/video/fbdev/msm/mddi_client_dummy.c
+++ b/drivers/video/fbdev/msm/mddi_client_dummy.c
@@ -15,6 +15,7 @@
* GNU General Public License for more details.
*/
+#include <linux/device.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/kernel.h>
@@ -51,8 +52,7 @@ static int mddi_dummy_probe(struct platform_device *pdev)
{
struct msm_mddi_client_data *client_data = pdev->dev.platform_data;
struct panel_info *panel - kzalloc(sizeof(struct panel_info), GFP_KERNEL);
- int ret;
+ devm_kzalloc(&pdev->dev, sizeof(struct panel_info), GFP_KERNEL);
if (!panel)
return -ENOMEM;
platform_set_drvdata(pdev, panel);
@@ -67,24 +67,11 @@ static int mddi_dummy_probe(struct platform_device *pdev)
client_data->fb_resource, 1);
panel->panel_data.fb_data = client_data->private_client_data;
panel->pdev.dev.platform_data = &panel->panel_data;
- ret = platform_device_register(&panel->pdev);
- if (ret) {
- kfree(panel);
- return ret;
- }
- return 0;
-}
-
-static int mddi_dummy_remove(struct platform_device *pdev)
-{
- struct panel_info *panel = platform_get_drvdata(pdev);
- kfree(panel);
- return 0;
+ return platform_device_register(&panel->pdev);
}
static struct platform_driver mddi_client_dummy = {
.probe = mddi_dummy_probe,
- .remove = mddi_dummy_remove,
.driver = { .name = "mddi_c_dummy" },
};
--
1.9.1
^ permalink raw reply related
* Re: [PATCH resend 2/4] backlight: Add backlight device (un)registration notification
From: Jingoo Han @ 2014-05-26 3:03 UTC (permalink / raw)
To: 'Lee Jones', 'Hans de Goede'
Cc: 'Aaron Lu', linux-fbdev, 'Bryan Wu',
'Rafael J. Wysocki', dri-devel, linux-acpi,
'Tomi Valkeinen', 'Ben Skeggs',
'Zhang Rui', 'Jean-Christophe Plagniol-Villard',
'Len Brown'
In-Reply-To: <20140522090215.GO6679@lee--X1>
On Thursday, May 22, 2014 6:02 PM, Lee Jones wrote:
> On Thursday, May 22, 2014 5:45 PM, Hans de Goede wrote:
> > On Thursday, May 22, 2014 8:31 AM, Rafael J. Wysocki wrote:
> > > On Wednesday, May 21, 2014 10:40 PM, Hans de Goede wrote:
> > >> Some firmware drivers, ie acpi-video want to get themselves out of the
> > >> way (in some cases) when their also is a raw backlight device available.
> > >>
> > >> Due to module loading ordering being unknown, acpi-video cannot be certain
> > >> that the backlight_device_registered(BACKLIGHT_RAW) it does for this is
> > >> the final verdict wrt there being a BACKLIGHT_RAW device.
> > >>
> > >> By adding notification acpi-video can listen for backlight devices showing
> > >> up after it has loaded, and unregister its backlight device if desired.
> > >>
> > >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> > >
> > > Backlight maintainer's ACK is requisite here.
> >
> > Agreed, which is why I send this set to all 3 the backlight maintainers
> > directly on both postings.
> >
> > What may be helpful for them is to hear from you if you're ok with the
> > acpi-video bits which are actually going to use this, since those will
> > be the only user of the new backlight api (for now).
>
> I'm happy to apply any Backlight patches which have either Bryan or
> Jingoo's Ack, as they are the reviewers for the BL subsystem.
Acked-by: Jingoo Han <jg1.han@samsung.com>
Lee Jones,
Would you merge this patch into your backlight git tree?
Thank you.
Best regards,
Jingoo Han
>
> > >> ---
> > >> drivers/video/backlight/backlight.c | 40 +++++++++++++++++++++++++++++++++++++
> > >> include/linux/backlight.h | 7 +++++++
> > >> 2 files changed, 47 insertions(+)
> > >>
> > >> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
> > >> index bd2172c..4280890 100644
> > >> --- a/drivers/video/backlight/backlight.c
> > >> +++ b/drivers/video/backlight/backlight.c
> > >> @@ -23,6 +23,7 @@
> > >>
> > >> static struct list_head backlight_dev_list;
> > >> static struct mutex backlight_dev_list_mutex;
> > >> +static struct blocking_notifier_head backlight_notifier;
> > >>
> > >> static const char *const backlight_types[] = {
> > >> [BACKLIGHT_RAW] = "raw",
> > >> @@ -370,6 +371,9 @@ struct backlight_device *backlight_device_register(const char *name,
> > >> list_add(&new_bd->entry, &backlight_dev_list);
> > >> mutex_unlock(&backlight_dev_list_mutex);
> > >>
> > >> + blocking_notifier_call_chain(&backlight_notifier,
> > >> + BACKLIGHT_REGISTERED, new_bd);
> > >> +
> > >> return new_bd;
> > >> }
> > >> EXPORT_SYMBOL(backlight_device_register);
> > >> @@ -413,6 +417,10 @@ void backlight_device_unregister(struct backlight_device *bd)
> > >> pmac_backlight = NULL;
> > >> mutex_unlock(&pmac_backlight_mutex);
> > >> #endif
> > >> +
> > >> + blocking_notifier_call_chain(&backlight_notifier,
> > >> + BACKLIGHT_UNREGISTERED, bd);
> > >> +
> > >> mutex_lock(&bd->ops_lock);
> > >> bd->ops = NULL;
> > >> mutex_unlock(&bd->ops_lock);
> > >> @@ -438,6 +446,36 @@ static int devm_backlight_device_match(struct device *dev, void *res,
> > >> }
> > >>
> > >> /**
> > >> + * backlight_register_notifier - get notified of backlight (un)registration
> > >> + * @nb: notifier block with the notifier to call on backlight (un)registration
> > >> + *
> > >> + * @return 0 on success, otherwise a negative error code
> > >> + *
> > >> + * Register a notifier to get notified when backlight devices get registered
> > >> + * or unregistered.
> > >> + */
> > >> +int backlight_register_notifier(struct notifier_block *nb)
> > >> +{
> > >> + return blocking_notifier_chain_register(&backlight_notifier, nb);
> > >> +}
> > >> +EXPORT_SYMBOL(backlight_register_notifier);
> > >> +
> > >> +/**
> > >> + * backlight_unregister_notifier - unregister a backlight notifier
> > >> + * @nb: notifier block to unregister
> > >> + *
> > >> + * @return 0 on success, otherwise a negative error code
> > >> + *
> > >> + * Register a notifier to get notified when backlight devices get registered
> > >> + * or unregistered.
> > >> + */
> > >> +int backlight_unregister_notifier(struct notifier_block *nb)
> > >> +{
> > >> + return blocking_notifier_chain_unregister(&backlight_notifier, nb);
> > >> +}
> > >> +EXPORT_SYMBOL(backlight_unregister_notifier);
> > >> +
> > >> +/**
> > >> * devm_backlight_device_register - resource managed backlight_device_register()
> > >> * @dev: the device to register
> > >> * @name: the name of the device
> > >> @@ -544,6 +582,8 @@ static int __init backlight_class_init(void)
> > >> backlight_class->pm = &backlight_class_dev_pm_ops;
> > >> INIT_LIST_HEAD(&backlight_dev_list);
> > >> mutex_init(&backlight_dev_list_mutex);
> > >> + BLOCKING_INIT_NOTIFIER_HEAD(&backlight_notifier);
> > >> +
> > >> return 0;
> > >> }
> > >>
> > >> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
> > >> index 7264742..adb14a8 100644
> > >> --- a/include/linux/backlight.h
> > >> +++ b/include/linux/backlight.h
> > >> @@ -40,6 +40,11 @@ enum backlight_type {
> > >> BACKLIGHT_TYPE_MAX,
> > >> };
> > >>
> > >> +enum backlight_notification {
> > >> + BACKLIGHT_REGISTERED,
> > >> + BACKLIGHT_UNREGISTERED,
> > >> +};
> > >> +
> > >> struct backlight_device;
> > >> struct fb_info;
> > >>
> > >> @@ -133,6 +138,8 @@ extern void devm_backlight_device_unregister(struct device *dev,
> > >> extern void backlight_force_update(struct backlight_device *bd,
> > >> enum backlight_update_reason reason);
> > >> extern bool backlight_device_registered(enum backlight_type type);
> > >> +extern int backlight_register_notifier(struct notifier_block *nb);
> > >> +extern int backlight_unregister_notifier(struct notifier_block *nb);
> > >>
> > >> #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
^ permalink raw reply
* Re: [PATCH resend 2/4] backlight: Add backlight device (un)registration notification
From: Rafael J. Wysocki @ 2014-05-26 10:46 UTC (permalink / raw)
To: Jingoo Han
Cc: 'Lee Jones', 'Hans de Goede', 'Aaron Lu',
'Bryan Wu', 'Jean-Christophe Plagniol-Villard',
'Tomi Valkeinen', 'Ben Skeggs',
'David Airlie', 'Zhang Rui', 'Len Brown',
linux-acpi, linux-fbdev, dri-devel
In-Reply-To: <000301cf788f$1a59e870$4f0db950$%han@samsung.com>
On Monday, May 26, 2014 12:03:43 PM Jingoo Han wrote:
> On Thursday, May 22, 2014 6:02 PM, Lee Jones wrote:
> > On Thursday, May 22, 2014 5:45 PM, Hans de Goede wrote:
> > > On Thursday, May 22, 2014 8:31 AM, Rafael J. Wysocki wrote:
> > > > On Wednesday, May 21, 2014 10:40 PM, Hans de Goede wrote:
> > > >> Some firmware drivers, ie acpi-video want to get themselves out of the
> > > >> way (in some cases) when their also is a raw backlight device available.
> > > >>
> > > >> Due to module loading ordering being unknown, acpi-video cannot be certain
> > > >> that the backlight_device_registered(BACKLIGHT_RAW) it does for this is
> > > >> the final verdict wrt there being a BACKLIGHT_RAW device.
> > > >>
> > > >> By adding notification acpi-video can listen for backlight devices showing
> > > >> up after it has loaded, and unregister its backlight device if desired.
> > > >>
> > > >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> > > >
> > > > Backlight maintainer's ACK is requisite here.
> > >
> > > Agreed, which is why I send this set to all 3 the backlight maintainers
> > > directly on both postings.
> > >
> > > What may be helpful for them is to hear from you if you're ok with the
> > > acpi-video bits which are actually going to use this, since those will
> > > be the only user of the new backlight api (for now).
> >
> > I'm happy to apply any Backlight patches which have either Bryan or
> > Jingoo's Ack, as they are the reviewers for the BL subsystem.
>
> Acked-by: Jingoo Han <jg1.han@samsung.com>
>
> Lee Jones,
> Would you merge this patch into your backlight git tree?
Hans, does this series depend on things that I've applied already? If so,
I'd very much prefer to take this series too as a whole.
Rafael
^ permalink raw reply
* Re: [PATCH resend 2/4] backlight: Add backlight device (un)registration notification
From: Hans de Goede @ 2014-05-26 11:21 UTC (permalink / raw)
To: Rafael J. Wysocki, Jingoo Han
Cc: 'Lee Jones', 'Aaron Lu', 'Bryan Wu',
'Jean-Christophe Plagniol-Villard',
'Tomi Valkeinen', 'Ben Skeggs',
'David Airlie', 'Zhang Rui', 'Len Brown',
linux-acpi, linux-fbdev, dri-devel
In-Reply-To: <2139692.XxRO5tdkik@vostro.rjw.lan>
Hi,
On 05/26/2014 01:03 PM, Rafael J. Wysocki wrote:
> On Monday, May 26, 2014 12:03:43 PM Jingoo Han wrote:
>> On Thursday, May 22, 2014 6:02 PM, Lee Jones wrote:
>>> On Thursday, May 22, 2014 5:45 PM, Hans de Goede wrote:
>>>> On Thursday, May 22, 2014 8:31 AM, Rafael J. Wysocki wrote:
>>>>> On Wednesday, May 21, 2014 10:40 PM, Hans de Goede wrote:
>>>>>> Some firmware drivers, ie acpi-video want to get themselves out of the
>>>>>> way (in some cases) when their also is a raw backlight device available.
>>>>>>
>>>>>> Due to module loading ordering being unknown, acpi-video cannot be certain
>>>>>> that the backlight_device_registered(BACKLIGHT_RAW) it does for this is
>>>>>> the final verdict wrt there being a BACKLIGHT_RAW device.
>>>>>>
>>>>>> By adding notification acpi-video can listen for backlight devices showing
>>>>>> up after it has loaded, and unregister its backlight device if desired.
>>>>>>
>>>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>>>
>>>>> Backlight maintainer's ACK is requisite here.
>>>>
>>>> Agreed, which is why I send this set to all 3 the backlight maintainers
>>>> directly on both postings.
>>>>
>>>> What may be helpful for them is to hear from you if you're ok with the
>>>> acpi-video bits which are actually going to use this, since those will
>>>> be the only user of the new backlight api (for now).
>>>
>>> I'm happy to apply any Backlight patches which have either Bryan or
>>> Jingoo's Ack, as they are the reviewers for the BL subsystem.
>>
>> Acked-by: Jingoo Han <jg1.han@samsung.com>
>>
>> Lee Jones,
>> Would you merge this patch into your backlight git tree?
>
> Hans, does this series depend on things that I've applied already? If so,
> I'd very much prefer to take this series too as a whole.
The 3th patch in this series:
" acpi-video: Unregister the backlight device if a raw one shows up later"
depends on my "acpi-video: Add an acpi_video_unregister_backlight function"
patch, which you've applied to your linux-next branch already.
As well as on the 2nd patch in this series:
"backlight: Add backlight device (un)registration notification"
So I agree that it is a good idea to take the whole series through your tree.
Thanks & Regards,
Hans
^ permalink raw reply
* [PATCH v2 0/5] Move IPUv3 core out of staging, add CSI support
From: Philipp Zabel @ 2014-05-26 14:19 UTC (permalink / raw)
To: Greg Kroah-Hartman, Russell King, Dave Airlie
Cc: devel, linux-fbdev, dri-devel, drm-devel, Tomi Valkeinen, kernel
Hi,
This is a rebased version of the earlier RFC series. It is
mostly about the first patch, which moves the IPUv3 core code
(drivers/staging/imx-drm/ipu-v3) to drivers/gpu.
host1x, which serves a similar purpose, already sits there.
I'd like to move the IPUv3 core code out of staging so that we can
start submitting V4L2 code for video capture and scaling / colorspace
conversion.
The other four patches add necessary preparations for CSI and SMFC
handling. These are used by the V4L2 CSI & capture drivers.
This series is based on the current staging-next tree, it is otherwise
nearly unchanged. I hope we can get this move in before the approaching
merge window so that we have a base for submitting the CSI V4L2 patches
in the following round.
regards
Philipp
---
Changes since RFC:
- Rebased onto current staging-next
- Streamlined destaging patch a bit
---
Philipp Zabel (5):
gpu: ipu-v3: Move i.MX IPUv3 core driver out of staging
gpu: ipu-v3: Add SMFC code
gpu: ipu-v3: Add ipu_idmac_get_current_buffer function
gpu: ipu-v3: Add CSI and SMFC module enable wrappers
gpu: ipu-v3: Register the CSI modules
drivers/gpu/Makefile | 1 +
drivers/gpu/ipu-v3/Kconfig | 7 ++
drivers/{staging/imx-drm => gpu}/ipu-v3/Makefile | 4 +-
.../{staging/imx-drm => gpu}/ipu-v3/ipu-common.c | 82 ++++++++++++++++--
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dc.c | 3 +-
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-di.c | 2 +-
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dmfc.c | 2 +-
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dp.c | 2 +-
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-prv.h | 8 +-
drivers/gpu/ipu-v3/ipu-smfc.c | 97 ++++++++++++++++++++++
drivers/staging/imx-drm/Kconfig | 11 +--
drivers/staging/imx-drm/Makefile | 1 -
drivers/staging/imx-drm/imx-hdmi.c | 2 +-
drivers/staging/imx-drm/imx-tve.c | 2 +-
drivers/staging/imx-drm/ipuv3-crtc.c | 2 +-
drivers/staging/imx-drm/ipuv3-plane.c | 2 +-
drivers/video/Kconfig | 1 +
.../imx-drm/ipu-v3 => include/video}/imx-ipu-v3.h | 16 ++++
18 files changed, 216 insertions(+), 29 deletions(-)
create mode 100644 drivers/gpu/ipu-v3/Kconfig
rename drivers/{staging/imx-drm => gpu}/ipu-v3/Makefile (51%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-common.c (94%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dc.c (99%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-di.c (99%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dmfc.c (99%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dp.c (99%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-prv.h (96%)
create mode 100644 drivers/gpu/ipu-v3/ipu-smfc.c
rename {drivers/staging/imx-drm/ipu-v3 => include/video}/imx-ipu-v3.h (95%)
--
2.0.0.rc2
^ permalink raw reply
* [PATCH v2 1/5] gpu: ipu-v3: Move i.MX IPUv3 core driver out of staging
From: Philipp Zabel @ 2014-05-26 14:19 UTC (permalink / raw)
To: Greg Kroah-Hartman, Russell King, Dave Airlie
Cc: devel, linux-fbdev, dri-devel, drm-devel, Tomi Valkeinen, kernel
In-Reply-To: <1401113983-23132-1-git-send-email-p.zabel@pengutronix.de>
The i.MX Image Processing Unit (IPU) contains a number of image processing
blocks that sit right in the middle between DRM and V4L2. Some of the modules,
such as Display Controller, Processor, and Interface (DC, DP, DI) or CMOS
Sensor Interface (CSI) and their FIFOs could be assigned to either framework,
but others, such as the dma controller (IDMAC) and image converter (IC) can
be used by both.
The IPUv3 core driver provides an internal API to access the modules, to be
used by both DRM and V4L2 IPUv3 drivers.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
Changes since RFC:
- Rebased onto current staging-next
- Removed an unrelated change to ipu_pixelformat_to_colorspace
- Avoided moving around the IPU_PIX_FMT_GBR24 #define
---
drivers/gpu/Makefile | 1 +
drivers/gpu/ipu-v3/Kconfig | 7 +++++++
drivers/{staging/imx-drm => gpu}/ipu-v3/Makefile | 2 +-
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-common.c | 2 +-
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dc.c | 3 +--
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-di.c | 2 +-
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dmfc.c | 2 +-
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dp.c | 2 +-
drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-prv.h | 2 +-
drivers/staging/imx-drm/Kconfig | 11 +----------
drivers/staging/imx-drm/Makefile | 1 -
drivers/staging/imx-drm/imx-hdmi.c | 2 +-
drivers/staging/imx-drm/imx-tve.c | 2 +-
drivers/staging/imx-drm/ipuv3-crtc.c | 2 +-
drivers/staging/imx-drm/ipuv3-plane.c | 2 +-
drivers/video/Kconfig | 1 +
.../staging/imx-drm/ipu-v3 => include/video}/imx-ipu-v3.h | 0
17 files changed, 21 insertions(+), 23 deletions(-)
create mode 100644 drivers/gpu/ipu-v3/Kconfig
rename drivers/{staging/imx-drm => gpu}/ipu-v3/Makefile (59%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-common.c (99%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dc.c (99%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-di.c (99%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dmfc.c (99%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dp.c (99%)
rename drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-prv.h (99%)
rename {drivers/staging/imx-drm/ipu-v3 => include/video}/imx-ipu-v3.h (100%)
diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile
index d8a22c2..70da9eb 100644
--- a/drivers/gpu/Makefile
+++ b/drivers/gpu/Makefile
@@ -1,2 +1,3 @@
obj-y += drm/ vga/
obj-$(CONFIG_TEGRA_HOST1X) += host1x/
+obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/
diff --git a/drivers/gpu/ipu-v3/Kconfig b/drivers/gpu/ipu-v3/Kconfig
new file mode 100644
index 0000000..2f228a2
--- /dev/null
+++ b/drivers/gpu/ipu-v3/Kconfig
@@ -0,0 +1,7 @@
+config IMX_IPUV3_CORE
+ tristate "IPUv3 core support"
+ depends on SOC_IMX5 || SOC_IMX6Q || SOC_IMX6SL || ARCH_MULTIPLATFORM
+ depends on RESET_CONTROLLER
+ help
+ Choose this if you have a i.MX5/6 system and want to use the Image
+ Processing Unit. This option only enables IPU base support.
diff --git a/drivers/staging/imx-drm/ipu-v3/Makefile b/drivers/gpu/ipu-v3/Makefile
similarity index 59%
rename from drivers/staging/imx-drm/ipu-v3/Makefile
rename to drivers/gpu/ipu-v3/Makefile
index 28ed72e..d21cc37 100644
--- a/drivers/staging/imx-drm/ipu-v3/Makefile
+++ b/drivers/gpu/ipu-v3/Makefile
@@ -1,3 +1,3 @@
-obj-$(CONFIG_DRM_IMX_IPUV3_CORE) += imx-ipu-v3.o
+obj-$(CONFIG_IMX_IPUV3_CORE) += imx-ipu-v3.o
imx-ipu-v3-objs := ipu-common.o ipu-dc.o ipu-di.o ipu-dp.o ipu-dmfc.o
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
similarity index 99%
rename from drivers/staging/imx-drm/ipu-v3/ipu-common.c
rename to drivers/gpu/ipu-v3/ipu-common.c
index a1f7b20..ad99477 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -31,7 +31,7 @@
#include <drm/drm_fourcc.h>
-#include "imx-ipu-v3.h"
+#include <video/imx-ipu-v3.h>
#include "ipu-prv.h"
static inline u32 ipu_cm_read(struct ipu_soc *ipu, unsigned offset)
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c b/drivers/gpu/ipu-v3/ipu-dc.c
similarity index 99%
rename from drivers/staging/imx-drm/ipu-v3/ipu-dc.c
rename to drivers/gpu/ipu-v3/ipu-dc.c
index 784a4a1..2326c75 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
+++ b/drivers/gpu/ipu-v3/ipu-dc.c
@@ -21,8 +21,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
-#include "../imx-drm.h"
-#include "imx-ipu-v3.h"
+#include <video/imx-ipu-v3.h>
#include "ipu-prv.h"
#define DC_MAP_CONF_PTR(n) (0x108 + ((n) & ~0x1) * 2)
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-di.c b/drivers/gpu/ipu-v3/ipu-di.c
similarity index 99%
rename from drivers/staging/imx-drm/ipu-v3/ipu-di.c
rename to drivers/gpu/ipu-v3/ipu-di.c
index 849b3e120..c490ba4 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-di.c
+++ b/drivers/gpu/ipu-v3/ipu-di.c
@@ -20,7 +20,7 @@
#include <linux/err.h>
#include <linux/platform_device.h>
-#include "imx-ipu-v3.h"
+#include <video/imx-ipu-v3.h>
#include "ipu-prv.h"
struct ipu_di {
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c b/drivers/gpu/ipu-v3/ipu-dmfc.c
similarity index 99%
rename from drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
rename to drivers/gpu/ipu-v3/ipu-dmfc.c
index 59f182b..042c395 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
+++ b/drivers/gpu/ipu-v3/ipu-dmfc.c
@@ -17,7 +17,7 @@
#include <linux/errno.h>
#include <linux/io.h>
-#include "imx-ipu-v3.h"
+#include <video/imx-ipu-v3.h>
#include "ipu-prv.h"
#define DMFC_RD_CHAN 0x0000
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dp.c b/drivers/gpu/ipu-v3/ipu-dp.c
similarity index 99%
rename from drivers/staging/imx-drm/ipu-v3/ipu-dp.c
rename to drivers/gpu/ipu-v3/ipu-dp.c
index d90f82a..98686ed 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dp.c
+++ b/drivers/gpu/ipu-v3/ipu-dp.c
@@ -19,7 +19,7 @@
#include <linux/io.h>
#include <linux/err.h>
-#include "imx-ipu-v3.h"
+#include <video/imx-ipu-v3.h>
#include "ipu-prv.h"
#define DP_SYNC 0
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h b/drivers/gpu/ipu-v3/ipu-prv.h
similarity index 99%
rename from drivers/staging/imx-drm/ipu-v3/ipu-prv.h
rename to drivers/gpu/ipu-v3/ipu-prv.h
index bfc1b33..72e1158 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h
+++ b/drivers/gpu/ipu-v3/ipu-prv.h
@@ -22,7 +22,7 @@ struct ipu_soc;
#include <linux/clk.h>
#include <linux/platform_device.h>
-#include "imx-ipu-v3.h"
+#include <video/imx-ipu-v3.h>
#define IPUV3_CHANNEL_CSI0 0
#define IPUV3_CHANNEL_CSI1 1
diff --git a/drivers/staging/imx-drm/Kconfig b/drivers/staging/imx-drm/Kconfig
index c6e8ba7..82fb758 100644
--- a/drivers/staging/imx-drm/Kconfig
+++ b/drivers/staging/imx-drm/Kconfig
@@ -39,19 +39,10 @@ config DRM_IMX_LDB
Choose this to enable the internal LVDS Display Bridge (LDB)
found on i.MX53 and i.MX6 processors.
-config DRM_IMX_IPUV3_CORE
- tristate "IPUv3 core support"
- depends on DRM_IMX
- depends on RESET_CONTROLLER
- help
- Choose this if you have a i.MX5/6 system and want
- to use the IPU. This option only enables IPU base
- support.
-
config DRM_IMX_IPUV3
tristate "DRM Support for i.MX IPUv3"
depends on DRM_IMX
- depends on DRM_IMX_IPUV3_CORE
+ depends on IMX_IPUV3_CORE
help
Choose this if you have a i.MX5 or i.MX6 processor.
diff --git a/drivers/staging/imx-drm/Makefile b/drivers/staging/imx-drm/Makefile
index 129e3a3..582c438 100644
--- a/drivers/staging/imx-drm/Makefile
+++ b/drivers/staging/imx-drm/Makefile
@@ -6,7 +6,6 @@ obj-$(CONFIG_DRM_IMX) += imxdrm.o
obj-$(CONFIG_DRM_IMX_PARALLEL_DISPLAY) += parallel-display.o
obj-$(CONFIG_DRM_IMX_TVE) += imx-tve.o
obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o
-obj-$(CONFIG_DRM_IMX_IPUV3_CORE) += ipu-v3/
imx-ipuv3-crtc-objs := ipuv3-crtc.o ipuv3-plane.o
obj-$(CONFIG_DRM_IMX_IPUV3) += imx-ipuv3-crtc.o
diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
index 1b44048..e7f3de5 100644
--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -27,8 +27,8 @@
#include <drm/drm_crtc_helper.h>
#include <drm/drm_edid.h>
#include <drm/drm_encoder_slave.h>
+#include <video/imx-ipu-v3.h>
-#include "ipu-v3/imx-ipu-v3.h"
#include "imx-hdmi.h"
#include "imx-drm.h"
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c
index a23f4f7..b12fb17 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -30,8 +30,8 @@
#include <drm/drmP.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_crtc_helper.h>
+#include <video/imx-ipu-v3.h>
-#include "ipu-v3/imx-ipu-v3.h"
#include "imx-drm.h"
#define TVE_COM_CONF_REG 0x00
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c
index 47bec5e..720868b 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -30,7 +30,7 @@
#include <drm/drm_gem_cma_helper.h>
#include <drm/drm_fb_cma_helper.h>
-#include "ipu-v3/imx-ipu-v3.h"
+#include <video/imx-ipu-v3.h>
#include "imx-drm.h"
#include "ipuv3-plane.h"
diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c
index 5697e59..6f393a1 100644
--- a/drivers/staging/imx-drm/ipuv3-plane.c
+++ b/drivers/staging/imx-drm/ipuv3-plane.c
@@ -17,7 +17,7 @@
#include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_cma_helper.h>
-#include "ipu-v3/imx-ipu-v3.h"
+#include "video/imx-ipu-v3.h"
#include "ipuv3-plane.h"
#define to_ipu_plane(x) container_of(x, struct ipu_plane, base)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index c7b4f0f..8bf495f 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -20,6 +20,7 @@ source "drivers/char/agp/Kconfig"
source "drivers/gpu/vga/Kconfig"
source "drivers/gpu/host1x/Kconfig"
+source "drivers/gpu/ipu-v3/Kconfig"
menu "Direct Rendering Manager"
source "drivers/gpu/drm/Kconfig"
diff --git a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
similarity index 100%
rename from drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
rename to include/video/imx-ipu-v3.h
--
2.0.0.rc2
^ permalink raw reply related
* [PATCH v2 2/5] gpu: ipu-v3: Add SMFC code
From: Philipp Zabel @ 2014-05-26 14:19 UTC (permalink / raw)
To: Greg Kroah-Hartman, Russell King, Dave Airlie
Cc: devel, linux-fbdev, dri-devel, drm-devel, Tomi Valkeinen, kernel
In-Reply-To: <1401113983-23132-1-git-send-email-p.zabel@pengutronix.de>
The Sensor Multi Fifo Controller (SMFC) is used as a buffer between
the two CSIs (writing simultaneously) and up to four IDMAC channels.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
drivers/gpu/ipu-v3/Makefile | 2 +-
drivers/gpu/ipu-v3/ipu-common.c | 10 +++++
drivers/gpu/ipu-v3/ipu-prv.h | 6 +++
drivers/gpu/ipu-v3/ipu-smfc.c | 97 +++++++++++++++++++++++++++++++++++++++++
include/video/imx-ipu-v3.h | 6 +++
5 files changed, 120 insertions(+), 1 deletion(-)
create mode 100644 drivers/gpu/ipu-v3/ipu-smfc.c
diff --git a/drivers/gpu/ipu-v3/Makefile b/drivers/gpu/ipu-v3/Makefile
index d21cc37..1887972b 100644
--- a/drivers/gpu/ipu-v3/Makefile
+++ b/drivers/gpu/ipu-v3/Makefile
@@ -1,3 +1,3 @@
obj-$(CONFIG_IMX_IPUV3_CORE) += imx-ipu-v3.o
-imx-ipu-v3-objs := ipu-common.o ipu-dc.o ipu-di.o ipu-dp.o ipu-dmfc.o
+imx-ipu-v3-objs := ipu-common.o ipu-dc.o ipu-di.o ipu-dp.o ipu-dmfc.o ipu-smfc.o
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index ad99477..6b3f4f1 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -896,8 +896,17 @@ static int ipu_submodules_init(struct ipu_soc *ipu,
goto err_dp;
}
+ ret = ipu_smfc_init(ipu, dev, ipu_base +
+ devtype->cm_ofs + IPU_CM_SMFC_REG_OFS);
+ if (ret) {
+ unit = "smfc";
+ goto err_smfc;
+ }
+
return 0;
+err_smfc:
+ ipu_dp_exit(ipu);
err_dp:
ipu_dmfc_exit(ipu);
err_dmfc:
@@ -977,6 +986,7 @@ EXPORT_SYMBOL_GPL(ipu_idmac_channel_irq);
static void ipu_submodules_exit(struct ipu_soc *ipu)
{
+ ipu_smfc_exit(ipu);
ipu_dp_exit(ipu);
ipu_dmfc_exit(ipu);
ipu_dc_exit(ipu);
diff --git a/drivers/gpu/ipu-v3/ipu-prv.h b/drivers/gpu/ipu-v3/ipu-prv.h
index 72e1158..c93f50e 100644
--- a/drivers/gpu/ipu-v3/ipu-prv.h
+++ b/drivers/gpu/ipu-v3/ipu-prv.h
@@ -151,6 +151,8 @@ struct ipuv3_channel {
struct ipu_dc_priv;
struct ipu_dmfc_priv;
struct ipu_di;
+struct ipu_smfc_priv;
+
struct ipu_devtype;
struct ipu_soc {
@@ -178,6 +180,7 @@ struct ipu_soc {
struct ipu_dp_priv *dp_priv;
struct ipu_dmfc_priv *dmfc_priv;
struct ipu_di *di_priv[2];
+ struct ipu_smfc_priv *smfc_priv;
};
void ipu_srm_dp_sync_update(struct ipu_soc *ipu);
@@ -206,4 +209,7 @@ void ipu_dc_exit(struct ipu_soc *ipu);
int ipu_cpmem_init(struct ipu_soc *ipu, struct device *dev, unsigned long base);
void ipu_cpmem_exit(struct ipu_soc *ipu);
+int ipu_smfc_init(struct ipu_soc *ipu, struct device *dev, unsigned long base);
+void ipu_smfc_exit(struct ipu_soc *ipu);
+
#endif /* __IPU_PRV_H__ */
diff --git a/drivers/gpu/ipu-v3/ipu-smfc.c b/drivers/gpu/ipu-v3/ipu-smfc.c
new file mode 100644
index 0000000..e4f85ad
--- /dev/null
+++ b/drivers/gpu/ipu-v3/ipu-smfc.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+#define DEBUG
+#include <linux/export.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/errno.h>
+#include <linux/spinlock.h>
+#include <linux/delay.h>
+#include <linux/clk.h>
+#include <video/imx-ipu-v3.h>
+
+#include "ipu-prv.h"
+
+struct ipu_smfc_priv {
+ void __iomem *base;
+ spinlock_t lock;
+};
+
+/*SMFC Registers */
+#define SMFC_MAP 0x0000
+#define SMFC_WMC 0x0004
+#define SMFC_BS 0x0008
+
+int ipu_smfc_set_burstsize(struct ipu_soc *ipu, int channel, int burstsize)
+{
+ struct ipu_smfc_priv *smfc = ipu->smfc_priv;
+ unsigned long flags;
+ u32 val, shift;
+
+ spin_lock_irqsave(&smfc->lock, flags);
+
+ shift = channel * 4;
+ val = readl(smfc->base + SMFC_BS);
+ val &= ~(0xf << shift);
+ val |= burstsize << shift;
+ writel(val, smfc->base + SMFC_BS);
+
+ spin_unlock_irqrestore(&smfc->lock, flags);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(ipu_smfc_set_burstsize);
+
+int ipu_smfc_map_channel(struct ipu_soc *ipu, int channel, int csi_id, int mipi_id)
+{
+ struct ipu_smfc_priv *smfc = ipu->smfc_priv;
+ unsigned long flags;
+ u32 val, shift;
+
+ spin_lock_irqsave(&smfc->lock, flags);
+
+ shift = channel * 3;
+ val = readl(smfc->base + SMFC_MAP);
+ val &= ~(0x7 << shift);
+ val |= ((csi_id << 2) | mipi_id) << shift;
+ writel(val, smfc->base + SMFC_MAP);
+
+ spin_unlock_irqrestore(&smfc->lock, flags);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(ipu_smfc_map_channel);
+
+int ipu_smfc_init(struct ipu_soc *ipu, struct device *dev,
+ unsigned long base)
+{
+ struct ipu_smfc_priv *smfc;
+
+ smfc = devm_kzalloc(dev, sizeof(*smfc), GFP_KERNEL);
+ if (!smfc)
+ return -ENOMEM;
+
+ ipu->smfc_priv = smfc;
+ spin_lock_init(&smfc->lock);
+
+ smfc->base = devm_ioremap(dev, base, PAGE_SIZE);
+ if (!smfc->base)
+ return -ENOMEM;
+
+ pr_debug("%s: ioremap 0x%08lx -> %p\n", __func__, base, smfc->base);
+
+ return 0;
+}
+
+void ipu_smfc_exit(struct ipu_soc *ipu)
+{
+}
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index c2c6fab..2c71ba7 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -165,6 +165,12 @@ int ipu_dp_set_window_pos(struct ipu_dp *, u16 x_pos, u16 y_pos);
int ipu_dp_set_global_alpha(struct ipu_dp *dp, bool enable, u8 alpha,
bool bg_chan);
+/*
+ * IPU Sensor Multiple FIFO Controller (SMFC) functions
+ */
+int ipu_smfc_map_channel(struct ipu_soc *ipu, int channel, int csi_id, int mipi_id);
+int ipu_smfc_set_burstsize(struct ipu_soc *ipu, int channel, int burstsize);
+
#define IPU_CPMEM_WORD(word, ofs, size) ((((word) * 160 + (ofs)) << 8) | (size))
#define IPU_FIELD_UBO IPU_CPMEM_WORD(0, 46, 22)
--
2.0.0.rc2
^ permalink raw reply related
* [PATCH v2 3/5] gpu: ipu-v3: Add ipu_idmac_get_current_buffer function
From: Philipp Zabel @ 2014-05-26 14:19 UTC (permalink / raw)
To: Greg Kroah-Hartman, Russell King, Dave Airlie
Cc: devel, linux-fbdev, dri-devel, drm-devel, Tomi Valkeinen, kernel
In-Reply-To: <1401113983-23132-1-git-send-email-p.zabel@pengutronix.de>
This function returns the currently active buffer (0 or 1)
of a double buffered IDMAC channel. It is to be used by the
CSI driver.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
drivers/gpu/ipu-v3/ipu-common.c | 9 +++++++++
include/video/imx-ipu-v3.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index 6b3f4f1..706a6f2 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -661,6 +661,15 @@ int ipu_module_disable(struct ipu_soc *ipu, u32 mask)
}
EXPORT_SYMBOL_GPL(ipu_module_disable);
+int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel)
+{
+ struct ipu_soc *ipu = channel->ipu;
+ unsigned int chno = channel->num;
+
+ return (ipu_cm_read(ipu, IPU_CHA_CUR_BUF(chno)) & idma_mask(chno)) ? 1 : 0;
+}
+EXPORT_SYMBOL_GPL(ipu_idmac_get_current_buffer);
+
void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num)
{
struct ipu_soc *ipu = channel->ipu;
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index 2c71ba7..a7edf6a 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -104,6 +104,7 @@ int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms);
void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
bool doublebuffer);
+int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel);
void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num);
/*
--
2.0.0.rc2
^ permalink raw reply related
* [PATCH v2 4/5] gpu: ipu-v3: Add CSI and SMFC module enable wrappers
From: Philipp Zabel @ 2014-05-26 14:19 UTC (permalink / raw)
To: Greg Kroah-Hartman, Russell King, Dave Airlie
Cc: devel, linux-fbdev, dri-devel, drm-devel, Tomi Valkeinen, kernel
In-Reply-To: <1401113983-23132-1-git-send-email-p.zabel@pengutronix.de>
IPU_CONF_..._EN bits are implementation details, not to be made public.
Add wrappers around ipu_module_enable/disable, so the CSI V4L2 driver
can enable/disable the CSI and SMFC modules.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
drivers/gpu/ipu-v3/ipu-common.c | 24 ++++++++++++++++++++++++
include/video/imx-ipu-v3.h | 8 ++++++++
2 files changed, 32 insertions(+)
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index 706a6f2..03f48b7 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -661,6 +661,30 @@ int ipu_module_disable(struct ipu_soc *ipu, u32 mask)
}
EXPORT_SYMBOL_GPL(ipu_module_disable);
+int ipu_csi_enable(struct ipu_soc *ipu, int csi)
+{
+ return ipu_module_enable(ipu, csi ? IPU_CONF_CSI1_EN : IPU_CONF_CSI0_EN);
+}
+EXPORT_SYMBOL_GPL(ipu_csi_enable);
+
+int ipu_csi_disable(struct ipu_soc *ipu, int csi)
+{
+ return ipu_module_disable(ipu, csi ? IPU_CONF_CSI1_EN : IPU_CONF_CSI0_EN);
+}
+EXPORT_SYMBOL_GPL(ipu_csi_disable);
+
+int ipu_smfc_enable(struct ipu_soc *ipu)
+{
+ return ipu_module_enable(ipu, IPU_CONF_SMFC_EN);
+}
+EXPORT_SYMBOL_GPL(ipu_smfc_enable);
+
+int ipu_smfc_disable(struct ipu_soc *ipu)
+{
+ return ipu_module_disable(ipu, IPU_CONF_SMFC_EN);
+}
+EXPORT_SYMBOL_GPL(ipu_smfc_disable);
+
int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel)
{
struct ipu_soc *ipu = channel->ipu;
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index a7edf6a..ac7fbfa 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -167,8 +167,16 @@ int ipu_dp_set_global_alpha(struct ipu_dp *dp, bool enable, u8 alpha,
bool bg_chan);
/*
+ * IPU CMOS Sensor Interface (csi) functions
+ */
+int ipu_csi_enable(struct ipu_soc *ipu, int csi);
+int ipu_csi_disable(struct ipu_soc *ipu, int csi);
+
+/*
* IPU Sensor Multiple FIFO Controller (SMFC) functions
*/
+int ipu_smfc_enable(struct ipu_soc *ipu);
+int ipu_smfc_disable(struct ipu_soc *ipu);
int ipu_smfc_map_channel(struct ipu_soc *ipu, int channel, int csi_id, int mipi_id);
int ipu_smfc_set_burstsize(struct ipu_soc *ipu, int channel, int burstsize);
--
2.0.0.rc2
^ permalink raw reply related
* [PATCH v2 5/5] gpu: ipu-v3: Register the CSI modules
From: Philipp Zabel @ 2014-05-26 14:19 UTC (permalink / raw)
To: Greg Kroah-Hartman, Russell King, Dave Airlie
Cc: devel, linux-fbdev, dri-devel, drm-devel, Tomi Valkeinen, kernel
In-Reply-To: <1401113983-23132-1-git-send-email-p.zabel@pengutronix.de>
This patch registers the two CSI platform devices per IPU.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
Changes since RFC:
- Rebased onto current staging-next
---
drivers/gpu/ipu-v3/ipu-common.c | 37 ++++++++++++++++++++++++++++++++-----
include/video/imx-ipu-v3.h | 1 +
2 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index 03f48b7..04e7b2e 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -1044,6 +1044,7 @@ static void platform_device_unregister_children(struct platform_device *pdev)
struct ipu_platform_reg {
struct ipu_client_platformdata pdata;
const char *name;
+ int reg_offset;
};
static const struct ipu_platform_reg client_reg[] = {
@@ -1065,13 +1066,29 @@ static const struct ipu_platform_reg client_reg[] = {
.dma[1] = -EINVAL,
},
.name = "imx-ipuv3-crtc",
+ }, {
+ .pdata = {
+ .csi = 0,
+ .dma[0] = IPUV3_CHANNEL_CSI0,
+ .dma[1] = -EINVAL,
+ },
+ .reg_offset = IPU_CM_CSI0_REG_OFS,
+ .name = "imx-ipuv3-camera",
+ }, {
+ .pdata = {
+ .csi = 1,
+ .dma[0] = IPUV3_CHANNEL_CSI1,
+ .dma[1] = -EINVAL,
+ },
+ .reg_offset = IPU_CM_CSI1_REG_OFS,
+ .name = "imx-ipuv3-camera",
},
};
static DEFINE_MUTEX(ipu_client_id_mutex);
static int ipu_client_id;
-static int ipu_add_client_devices(struct ipu_soc *ipu)
+static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
{
struct device *dev = ipu->dev;
unsigned i;
@@ -1085,9 +1102,19 @@ static int ipu_add_client_devices(struct ipu_soc *ipu)
for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
const struct ipu_platform_reg *reg = &client_reg[i];
struct platform_device *pdev;
-
- pdev = platform_device_register_data(dev, reg->name,
- id++, ®->pdata, sizeof(reg->pdata));
+ struct resource res;
+
+ if (reg->reg_offset) {
+ memset(&res, 0, sizeof(res));
+ res.flags = IORESOURCE_MEM;
+ res.start = ipu_base + ipu->devtype->cm_ofs + reg->reg_offset;
+ res.end = res.start + PAGE_SIZE - 1;
+ pdev = platform_device_register_resndata(dev, reg->name,
+ id++, &res, 1, ®->pdata, sizeof(reg->pdata));
+ } else {
+ pdev = platform_device_register_data(dev, reg->name,
+ id++, ®->pdata, sizeof(reg->pdata));
+ }
if (IS_ERR(pdev))
goto err_register;
@@ -1284,7 +1311,7 @@ static int ipu_probe(struct platform_device *pdev)
if (ret)
goto failed_submodules_init;
- ret = ipu_add_client_devices(ipu);
+ ret = ipu_add_client_devices(ipu, ipu_base);
if (ret) {
dev_err(&pdev->dev, "adding client devices failed with %d\n",
ret);
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index ac7fbfa..3e43e22 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -336,6 +336,7 @@ static inline void ipu_cpmem_set_burstsize(struct ipu_ch_param __iomem *p,
};
struct ipu_client_platformdata {
+ int csi;
int di;
int dc;
int dp;
--
2.0.0.rc2
^ 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