mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yakir Yang <ykk@rock-chips.com>
To: Yakir Yang <ykk@rock-chips.com>
Cc: "Philipp Zabel" <p.zabel@pengutronix.de>,
	Zubair.Kakakhel@imgtec.com,
	"Fabio Estevam" <fabio.estevam@freescale.com>,
	"Shawn Guo" <shawn.guo@linaro.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Daniel Kurtz" <djkurtz@chromium.org>,
	"Sonny Rao" <sonnyrao@chromium.org>,
	"Dylan Reid" <dgreid@chromium.org>,
	"Xu Jianqun" <jay.xu@rock-chips.com>,
	"Stéphane Marchesin" <marcheu@chromium.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Brian Austin" <brian.austin@cirrus.com>,
	"Bard Liao" <bardliao@realtek.com>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	"Oder Chiou" <oder_chiou@realtek.com>,
	"David Airlie" <airlied@linux.ie>,
	"Russell King" <rmk+kernel@arm.linux.org.uk>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: [PATCH 1/6] drm: bridge/dw_hdmi: add hdmi audio config interfaces
Date: Mon, 15 Dec 2014 10:11:29 +0800	[thread overview]
Message-ID: <1418609494-15820-2-git-send-email-ykk@rock-chips.com> (raw)
In-Reply-To: <1418609494-15820-1-git-send-email-ykk@rock-chips.com>

creat dw-hdmi-audio device in probe function, and support
some interfaces to dw-hdmi-audio driver for setting hdmi
audio format.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
---

 drivers/gpu/drm/bridge/dw_hdmi.c | 28 ++++++++++++++++++++++++++++
 include/drm/bridge/dw_hdmi.h     | 12 ++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index 01c95a8..9ba96de 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -106,6 +106,7 @@ struct dw_hdmi {
 	struct drm_encoder *encoder;
 	struct drm_bridge *bridge;
 
+	struct platform_device *audio_pdev;
 	enum dw_hdmi_devtype dev_type;
 	struct device *dev;
 	struct clk *isfr_clk;
@@ -369,6 +370,11 @@ static void hdmi_clk_regenerator_update_pixel_clock(struct dw_hdmi *hdmi)
 	hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mpixelclock);
 }
 
+static void hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int sample_rate)
+{
+	hdmi->sample_rate = sample_rate;
+	hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mpixelclock);
+}
 /*
  * this submodule is responsible for the video data synchronization.
  * for example, for RGB 4:4:4 input, the data map is defined as
@@ -1558,6 +1564,8 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
 		 struct resource *iores, int irq,
 		 const struct dw_hdmi_plat_data *plat_data)
 {
+	struct platform_device_info pdevinfo;
+	struct dw_hdmi_audio_data audio;
 	struct drm_device *drm = data;
 	struct device_node *np = dev->of_node;
 	struct device_node *ddc_node;
@@ -1679,6 +1687,23 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
 
 	dev_set_drvdata(dev, hdmi);
 
+	memset(&pdevinfo, 0, sizeof(pdevinfo));
+	pdevinfo.parent = dev;
+	pdevinfo.id = PLATFORM_DEVID_NONE;
+
+	audio.irq = irq;
+	audio.dw = hdmi;
+	audio.mod = hdmi_modb;
+	audio.read = hdmi_readb;
+	audio.write = hdmi_writeb;
+	audio.set_sample_rate = hdmi_set_sample_rate;
+
+	pdevinfo.name = "dw-hdmi-audio";
+	pdevinfo.data = &audio;
+	pdevinfo.size_data = sizeof(audio);
+	pdevinfo.dma_mask = DMA_BIT_MASK(32);
+	hdmi->audio_pdev = platform_device_register_full(&pdevinfo);
+
 	return 0;
 
 err_iahb:
@@ -1694,6 +1719,9 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data)
 {
 	struct dw_hdmi *hdmi = dev_get_drvdata(dev);
 
+	if (!IS_ERR(hdmi->audio_pdev))
+		platform_device_unregister(hdmi->audio_pdev);
+
 	/* Disable all interrupts */
 	hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0);
 
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index 5a4f490..82750f6 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -19,6 +19,18 @@ enum {
 	DW_HDMI_RES_MAX,
 };
 
+struct dw_hdmi;
+
+struct dw_hdmi_audio_data {
+	int irq;
+	struct dw_hdmi *dw;
+
+	u8 (*read)(struct dw_hdmi *hdmi, int offset);
+	void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
+	void (*mod)(struct dw_hdmi *hdmi, u8 data, u8 mask, unsigned reg);
+	void (*set_sample_rate)(struct dw_hdmi *hdmi, unsigned int rate);
+};
+
 enum dw_hdmi_devtype {
 	IMX6Q_HDMI,
 	IMX6DL_HDMI,
-- 
2.1.2



  reply	other threads:[~2014-12-15  2:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15  2:11 [RFC PATCH 0/6] Those patches is used for dw_hdmi audio Yakir Yang
2014-12-15  2:11 ` Yakir Yang [this message]
2014-12-15  2:11 ` [PATCH 2/6] drm: bridge/bridge: add support for rk3288 hdmi-audio Yakir Yang
2014-12-15  2:11 ` [PATCH 3/6] ASoC: dw-hdmi-audio: add codec driver for dw hdmi audio Yakir Yang
2014-12-15  2:11 ` [PATCH 4/6] ASoC: rockchip-hdmi-audio: add sound driver for " Yakir Yang
2014-12-15  2:55 ` [PATCH 5/6] dt-bindings: Add documentation for Rockchip hdmi-audio Yakir Yang
2014-12-15  9:02   ` Lars-Peter Clausen
2014-12-15  9:46     ` Kuankuan.Yang
2014-12-15 10:40   ` Russell King - ARM Linux
2014-12-15 12:02     ` Mark Brown
2014-12-15 13:10       ` Kuankuan.Yang
2014-12-15 16:18         ` Mark Brown
2014-12-16  2:14           ` Kuankuan.Yang
2014-12-16  2:38           ` Kuankuan.Yang
2014-12-16  6:17           ` Kuankuan.Yang
2014-12-16  9:34             ` Russell King - ARM Linux
2014-12-16  9:48               ` Kuankuan.Yang
2014-12-15  2:56 ` [PATCH 6/6] ARM: dts: rockchip: add hdmi audio nodes Yakir Yang
2014-12-15 10:38 ` [RFC PATCH 0/6] Those patches is used for dw_hdmi audio Russell King - ARM Linux
     [not found]   ` <548EC9E1.5040206@rock-chips.com>
2014-12-15 11:52     ` Kuankuan.Yang
2014-12-15 12:00       ` Russell King - ARM Linux
2014-12-15 12:46         ` Kuankuan.Yang
2014-12-15 15:48         ` Jean-Francois Moine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418609494-15820-2-git-send-email-ykk@rock-chips.com \
    --to=ykk@rock-chips.com \
    --cc=Zubair.Kakakhel@imgtec.com \
    --cc=airlied@linux.ie \
    --cc=bardliao@realtek.com \
    --cc=brian.austin@cirrus.com \
    --cc=dgreid@chromium.org \
    --cc=djkurtz@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabio.estevam@freescale.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko@sntech.de \
    --cc=jay.xu@rock-chips.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcheu@chromium.org \
    --cc=oder_chiou@realtek.com \
    --cc=p.zabel@pengutronix.de \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=shawn.guo@linaro.org \
    --cc=sonnyrao@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®