linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/11] clk: Add fixed-rate clock
Date: Wed, 24 Aug 2011 14:15:51 +0100	[thread overview]
Message-ID: <1314191759-16941-3-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1314191759-16941-1-git-send-email-broonie@opensource.wolfsonmicro.com>

From: Jeremy Kerr <jeremy.kerr@canonical.com>

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/clk/Kconfig     |    4 ++++
 drivers/clk/Makefile    |    1 +
 drivers/clk/clk-fixed.c |   17 +++++++++++++++++
 include/linux/clk.h     |   14 ++++++++++++++
 4 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/clk-fixed.c

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index c53ed59..d8313d7 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -8,3 +8,7 @@ config HAVE_MACH_CLKDEV
 
 config GENERIC_CLK
 	bool
+
+config GENERIC_CLK_FIXED
+	bool
+	depends on GENERIC_CLK
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 570d5b9..9a3325a 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -1,3 +1,4 @@
 
 obj-$(CONFIG_CLKDEV_LOOKUP)	+= clkdev.o
 obj-$(CONFIG_GENERIC_CLK)	+= clk.o
+obj-$(CONFIG_GENERIC_CLK_FIXED)	+= clk-fixed.o
diff --git a/drivers/clk/clk-fixed.c b/drivers/clk/clk-fixed.c
new file mode 100644
index 0000000..47a27f9
--- /dev/null
+++ b/drivers/clk/clk-fixed.c
@@ -0,0 +1,17 @@
+
+#include <linux/clk.h>
+#include <linux/module.h>
+
+#define to_clk_fixed(c) container_of(c, struct clk_hw_fixed, hw)
+
+static unsigned long clk_fixed_recalc_rate(struct clk_hw *hw)
+{
+	return to_clk_fixed(hw)->rate;
+}
+
+struct clk_hw_ops clk_fixed_ops = {
+	.recalc_rate = clk_fixed_recalc_rate,
+};
+EXPORT_SYMBOL_GPL(clk_fixed_ops);
+
+
diff --git a/include/linux/clk.h b/include/linux/clk.h
index e0969d2..fd62e86 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -110,6 +110,20 @@ int clk_prepare(struct clk *clk);
  */
 void clk_unprepare(struct clk *clk);
 
+/* Base clock implementations. Platform clock implementations can use these
+ * directly, or 'subclass' as approprate */
+
+#ifdef CONFIG_GENERIC_CLK_FIXED
+
+struct clk_hw_fixed {
+	struct clk_hw	hw;
+	unsigned long	rate;
+};
+
+extern struct clk_hw_ops clk_fixed_ops;
+
+#endif /* CONFIG_GENERIC_CLK_FIXED */
+
 #else /* !CONFIG_GENERIC_CLK */
 
 /*
-- 
1.7.5.4

  parent reply	other threads:[~2011-08-24 13:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 13:13 [PATCH 0/11] generic struct clk patches Mark Brown
2011-08-24 13:15 ` [PATCH 01/11] clk: Add a generic clock infrastructure Mark Brown
2011-08-24 13:15   ` [PATCH 02/11] clk: Implement clk_set_rate Mark Brown
2011-08-26  8:53     ` Sascha Hauer
2011-08-26  8:55       ` Mark Brown
2011-08-26  8:58         ` Sascha Hauer
2011-08-26  9:01           ` Mark Brown
2011-08-26 23:45     ` Turquette, Mike
2011-09-13 19:03     ` Stephen Boyd
2011-08-24 13:15   ` Mark Brown [this message]
2011-08-24 13:15   ` [PATCH 04/11] clk: Add simple gated clock Mark Brown
2011-08-25 13:17     ` Jamie Iles
2011-09-13 19:03     ` Stephen Boyd
2011-08-24 13:15   ` [PATCH 05/11] clk: Prototype and document clk_register() Mark Brown
2011-09-13 19:03     ` Stephen Boyd
2011-08-24 13:15   ` [PATCH 06/11] clk: Provide a dummy clk_unregister() Mark Brown
2011-08-25 11:12     ` Jamie Iles
2011-08-24 13:15   ` [PATCH 07/11] clk: Constify struct clk_hw_ops Mark Brown
2011-08-24 13:15   ` [PATCH 08/11] clk: Avoid clock name collisions Mark Brown
2011-09-13 19:03     ` Stephen Boyd
2011-08-24 13:15   ` [PATCH 09/11] clk: Add Kconfig option to build all generic clk drivers Mark Brown
2011-08-24 13:15   ` [PATCH 10/11] clk: Add initial WM831x clock driver Mark Brown
2011-08-24 13:15   ` [PATCH 11/11] x86: Enable generic clk API on x86 Mark Brown
2011-09-13 19:03   ` [PATCH 01/11] clk: Add a generic clock infrastructure Stephen Boyd
     [not found]   ` <1314191759-16941-1-git-send-email-broonie@opensource.wolfsonmicro.com >
2011-09-14  2:22     ` Saravana Kannan
2011-09-14  9:41       ` 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=1314191759-16941-3-git-send-email-broonie@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.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).