diff mbox

[v4,06/10] s5p-fimc: Use pinctrl API for camera ports configuration

Message ID 1359745771-23684-7-git-send-email-s.nawrocki@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Before the camera ports can be used the pinmux needs to be configured
properly. This patch adds a function to set the camera ports pinctrl
to a default state within the media driver's probe().
The camera port(s) are then configured for the video bus operation.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

Changes since v3:
 - removed the "inactive" pinctrl state, it will be added later if required
---
 .../devicetree/bindings/media/soc/samsung-fimc.txt |    7 +++++++
 drivers/media/platform/s5p-fimc/fimc-mdevice.c     |    9 +++++++++
 2 files changed, 16 insertions(+)

Comments

Stephen Warren Feb. 6, 2013, 11:44 p.m. UTC | #1
On 02/01/2013 12:09 PM, Sylwester Nawrocki wrote:
> Before the camera ports can be used the pinmux needs to be configured
> properly. This patch adds a function to set the camera ports pinctrl
> to a default state within the media driver's probe().
> The camera port(s) are then configured for the video bus operation.

> diff --git a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt

> +- pinctrl-names    : pinctrl names for camera port pinmux control, at least
> +		     "default" needs to be specified.
> +- pinctrl-0...N	   : pinctrl properties corresponding to pinctrl-names
> +

A reference to the binding document describing the pin control bindings
would be appropriate here. Given that reference, I'm not sure if
spelling out the property names makes sense since it feels a little like
duplication; an alternative might be simply:

The pinctrl bindings defined in ../../../pinctrl/pinctrl-bindings.txt
must be used to define a pinctrl state named "default".

However, this isn't a big deal; it's fine either way.
Sylwester Nawrocki Feb. 8, 2013, 11:30 p.m. UTC | #2
On 02/07/2013 12:44 AM, Stephen Warren wrote:
> On 02/01/2013 12:09 PM, Sylwester Nawrocki wrote:
>> Before the camera ports can be used the pinmux needs to be configured
>> properly. This patch adds a function to set the camera ports pinctrl
>> to a default state within the media driver's probe().
>> The camera port(s) are then configured for the video bus operation.
>
>> diff --git a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt
>
>> +- pinctrl-names    : pinctrl names for camera port pinmux control, at least
>> +		     "default" needs to be specified.
>> +- pinctrl-0...N	   : pinctrl properties corresponding to pinctrl-names
>> +
>
> A reference to the binding document describing the pin control bindings
> would be appropriate here. Given that reference, I'm not sure if
> spelling out the property names makes sense since it feels a little like
> duplication; an alternative might be simply:
>
> The pinctrl bindings defined in ../../../pinctrl/pinctrl-bindings.txt
> must be used to define a pinctrl state named "default".

OK, I will add a reference to the pinctrl bindings instead.

> However, this isn't a big deal; it's fine either way.

--

Thanks.
Sylwester
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt
index 6b81ad1..3788305 100644
--- a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt
+++ b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt
@@ -18,6 +18,10 @@  Required properties:
 
 - compatible	   : must be "samsung,fimc", "simple-bus"
 
+- pinctrl-names    : pinctrl names for camera port pinmux control, at least
+		     "default" needs to be specified.
+- pinctrl-0...N	   : pinctrl properties corresponding to pinctrl-names
+
 The 'camera' node must include at least one 'fimc' child node.
 
 
@@ -133,6 +137,9 @@  Example:
 		#size-cells = <1>;
 		status = "okay";
 
+		pinctrl-names = "default";
+		pinctrl-0 = <&cam_port_a_clk_active>;
+
 		/* parallel camera ports */
 		parallel-ports {
 			/* camera A input */
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
index 2bb501f..6c2c9e3 100644
--- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
+++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
@@ -21,6 +21,7 @@ 
 #include <linux/of_platform.h>
 #include <linux/of_device.h>
 #include <linux/of_i2c.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/types.h>
@@ -1197,6 +1198,14 @@  static int fimc_md_probe(struct platform_device *pdev)
 	/* Protect the media graph while we're registering entities */
 	mutex_lock(&fmd->media_dev.graph_mutex);
 
+	if (dev->of_node) {
+		struct pinctrl *pctl = devm_pinctrl_get_select_default(dev);
+		if (IS_ERR(pctl)) {
+			ret = PTR_ERR(pctl);
+			goto err_unlock;
+		}
+	}
+
 	if (fmd->pdev->dev.of_node)
 		ret = fimc_md_register_of_platform_entities(fmd, dev->of_node);
 	else