All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: linux-media@vger.kernel.org
Cc: linux-omap@vger.kernel.org, tony@atomide.com, sre@kernel.org,
	pali.rohar@gmail.com, laurent.pinchart@ideasonboard.com
Subject: [PATCH v2 04/15] omap3isp: DT support for clocks
Date: Thu, 26 Mar 2015 00:57:28 +0200	[thread overview]
Message-ID: <1427324259-18438-5-git-send-email-sakari.ailus@iki.fi> (raw)
In-Reply-To: <1427324259-18438-1-git-send-email-sakari.ailus@iki.fi>

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/platform/omap3isp/isp.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index f694615..82499cd 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -279,9 +279,21 @@ static const struct clk_init_data isp_xclk_init_data = {
 	.num_parents = 1,
 };
 
+static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void *data)
+{
+	unsigned int idx = clkspec->args[0];
+	struct isp_device *isp = data;
+
+	if (idx >= ARRAY_SIZE(isp->xclks))
+		return ERR_PTR(-ENOENT);
+
+	return isp->xclks[idx].clk;
+}
+
 static int isp_xclk_init(struct isp_device *isp)
 {
 	struct isp_platform_data *pdata = isp->pdata;
+	struct device_node *np = isp->dev->of_node;
 	struct clk_init_data init;
 	unsigned int i;
 
@@ -312,6 +324,12 @@ static int isp_xclk_init(struct isp_device *isp)
 		if (IS_ERR(xclk->clk))
 			return PTR_ERR(xclk->clk);
 
+		/* When instantiated from DT we don't need to register clock
+		 * aliases.
+		 */
+		if (np)
+			continue;
+
 		if (pdata->xclks[i].con_id == NULL &&
 		    pdata->xclks[i].dev_id == NULL)
 			continue;
@@ -327,13 +345,20 @@ static int isp_xclk_init(struct isp_device *isp)
 		clkdev_add(xclk->lookup);
 	}
 
+	if (np)
+		of_clk_add_provider(np, isp_xclk_src_get, isp);
+
 	return 0;
 }
 
 static void isp_xclk_cleanup(struct isp_device *isp)
 {
+	struct device_node *np = isp->dev->of_node;
 	unsigned int i;
 
+	if (np)
+		of_clk_del_provider(np);
+
 	for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) {
 		struct isp_xclk *xclk = &isp->xclks[i];
 
-- 
1.7.10.4


  parent reply	other threads:[~2015-03-25 22:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25 22:57 [PATCH v2 00/15] omap3isp driver DT support Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 01/15] omap3isp: Fix error handling in probe Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 02/15] omap3isp: Avoid a BUG_ON() in media_entity_create_link() Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 03/15] omap3isp: Separate external link creation from platform data parsing Sakari Ailus
2015-03-25 22:57 ` Sakari Ailus [this message]
2015-03-25 22:57 ` [PATCH v2 05/15] omap3isp: Platform data could be NULL Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 06/15] omap3isp: Refactor device configuration structs for Device Tree Sakari Ailus
2015-03-25 23:21   ` Tony Lindgren
2015-03-25 22:57 ` [PATCH v2 07/15] omap3isp: Rename regulators to better suit the " Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 08/15] omap3isp: Calculate vpclk_div for CSI-2 Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 09/15] omap3isp: Replace mmio_base_phys array with the histogram block base Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 10/15] omap3isp: Move the syscon register out of the ISP register maps Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 11/15] omap3isp: Replace many MMIO regions by two Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 12/15] dt: bindings: Add lane-polarity property to endpoint nodes Sakari Ailus
2015-04-24 19:41   ` Benoit Parrot
2015-04-24 19:41     ` Benoit Parrot
2015-04-24 19:49     ` Sakari Ailus
2015-04-24 19:53       ` Benoit Parrot
2015-04-24 19:53         ` Benoit Parrot
2015-03-25 22:57 ` [PATCH v2 13/15] v4l: of: Read lane-polarities endpoint property Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 14/15] omap3isp: Add support for the Device Tree Sakari Ailus
2015-03-30 17:41   ` Sebastian Reichel
2015-03-30 21:17     ` Sakari Ailus
2015-03-30 23:13     ` [PATCH 1/1] omap3isp: Don't pass uninitialised arguments to of_graph_get_next_endpoint() Sakari Ailus
2015-03-31  1:37       ` Sebastian Reichel
2015-04-01 22:41         ` Sakari Ailus
2015-03-25 22:57 ` [PATCH v2 15/15] omap3isp: Deprecate platform data support Sakari Ailus

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=1427324259-18438-5-git-send-email-sakari.ailus@iki.fi \
    --to=sakari.ailus@iki.fi \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=sre@kernel.org \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.