linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ch.naveen@samsung.com (Naveen Krishna Chatradhi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] ARM: EXYNOS4: Add sclk_spdif clocks
Date: Fri, 10 Jun 2011 12:04:24 +0530	[thread overview]
Message-ID: <1307687667-9127-3-git-send-email-ch.naveen@samsung.com> (raw)
In-Reply-To: <1307687667-9127-1-git-send-email-ch.naveen@samsung.com>

Add the sclk_spdif clock is of type 'struct clksrc_clk' clock.
Also, add clk_spdifcdclk clocks of type 'struct clk' clock.

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
---
 arch/arm/mach-exynos4/clock.c |   70 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 7aa4aef..57ca356 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -73,6 +73,11 @@ static struct clk clk_audiocdclk2 = {
 	.id		= 2,
 };
 
+static struct clk clk_spdifcdclk = {
+	.name		= "spdifcdclk",
+	.id		= -1,
+};
+
 static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
 {
 	return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable);
@@ -592,6 +597,11 @@ static struct clk init_clocks_off[] = {
 		.enable		= exynos4_clk_ip_peril_ctrl,
 		.ctrlbit	= (1 << 21),
 	}, {
+		.name		= "spdif",
+		.id		= -1,
+		.enable		= exynos4_clk_ip_peril_ctrl,
+		.ctrlbit	= (1 << 26),
+	}, {
 		.name		= "ac97",
 		.id		= -1,
 		.enable		= exynos4_clk_ip_peril_ctrl,
@@ -858,6 +868,65 @@ static struct clk init_clocks[] = {
 	}
 };
 
+static int exynos4_spdif_set_rate(struct clk *clk, unsigned long rate)
+{
+	struct clk *pclk;
+	int ret;
+
+	pclk = clk_get_parent(clk);
+	if (IS_ERR(pclk))
+		return -EINVAL;
+
+	ret = pclk->ops->set_rate(pclk, rate);
+	clk_put(pclk);
+
+	return ret;
+}
+
+static unsigned long exynos4_spdif_get_rate(struct clk *clk)
+{
+	struct clk *pclk;
+	int rate;
+
+	pclk = clk_get_parent(clk);
+	if (IS_ERR(pclk))
+		return -EINVAL;
+
+	rate = pclk->ops->get_rate(clk);
+	clk_put(pclk);
+
+	return rate;
+}
+
+static struct clk_ops exynos4_sclk_spdif_ops = {
+	.set_rate	= exynos4_spdif_set_rate,
+	.get_rate	= exynos4_spdif_get_rate,
+};
+
+static struct clk *clkset_sclk_spdif_list[] = {
+	[0] = &clk_sclk_audio0.clk,
+	[1] = &clk_sclk_audio1.clk,
+	[2] = &clk_sclk_audio2.clk,
+	[3] = &clk_spdifcdclk,
+};
+
+static struct clksrc_sources clkset_sclk_spdif = {
+	.sources	= clkset_sclk_spdif_list,
+	.nr_sources	= ARRAY_SIZE(clkset_sclk_spdif_list),
+};
+
+static struct clksrc_clk clk_sclk_spdif = {
+	.clk	= {
+		.name		= "sclk_spdif",
+		.id		= -1,
+		.enable		= exynos4_clksrc_mask_peril1_ctrl,
+		.ctrlbit	= (1 << 8),
+		.ops		= &exynos4_sclk_spdif_ops,
+	},
+		.sources = &clkset_sclk_spdif,
+		.reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 8, .size = 2 },
+};
+
 static struct clk *clkset_group_list[] = {
 	[0] = &clk_ext_xtal_mux,
 	[1] = &clk_xusbxti,
@@ -1274,6 +1343,7 @@ static struct clksrc_clk *sysclks[] = {
 	&clk_sclk_audio0,
 	&clk_sclk_audio1,
 	&clk_sclk_audio2,
+	&clk_sclk_spdif,
 };
 
 static u32 epll_div[][6] = {
-- 
1.7.2.3

  parent reply	other threads:[~2011-06-10  6:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-10  6:34 [PATCH 0/5] ARM: Add SPDIF support for EXYNOS4 Naveen Krishna Chatradhi
2011-06-10  6:34 ` [PATCH 1/5] ARM: EXYNOS4: Add EPLL clock operations Naveen Krishna Chatradhi
2011-06-14  5:33   ` Kukjin Kim
2011-06-14  6:59     ` Naveen Krishna Ch
2011-06-10  6:34 ` Naveen Krishna Chatradhi [this message]
2011-06-14  5:47   ` [PATCH 2/5] ARM: EXYNOS4: Add sclk_spdif clocks Kukjin Kim
2011-06-14  6:31     ` Naveen Krishna Ch
2011-06-10  6:34 ` [PATCH 3/5] ARM: EXYNOS4: fix improper gpio configuration Naveen Krishna Chatradhi
2011-06-10  6:43   ` Jassi Brar
2011-06-14  6:53   ` Kukjin Kim
2011-06-10  6:34 ` [PATCH 4/5] ARM: EXYNOS4: Add SPDIF for SMDKV310 Naveen Krishna Chatradhi
2011-06-10  6:44   ` Jassi Brar
2011-07-18  6:23     ` Kukjin Kim
2011-06-10  6:34 ` [PATCH 5/5] ASoC: SMDKV310: Enable SPDIF device Naveen Krishna Chatradhi
2011-06-10  6:47   ` Jassi Brar
2011-06-10 14:07   ` Mark Brown

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=1307687667-9127-3-git-send-email-ch.naveen@samsung.com \
    --to=ch.naveen@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).