linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3]  drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup
@ 2014-09-15 13:13 Vivek Gautam
  2014-09-15 13:13 ` [PATCH 1/3] phy: exynos-dp-video: Use syscon support to control pmu register Vivek Gautam
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Vivek Gautam @ 2014-09-15 13:13 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc, devicetree, linux-kernel
  Cc: inki.dae, seanpaul, kishon, ajaykumar.rs, Vivek Gautam

These patches are based on 'for-next' branch of kgene's linux-samsung tree.

Refactoring the exynos-dp-video phy to use pmu-system-controller handle
and access the register using mfd-syscon and regmap.
Simultaneously, removing the support for older dptx-phy, since it's obsolete
now and noone uses it.

Vivek Gautam (3):
  phy: exynos-dp-video: Use syscon support to control pmu register
  drm/exynos: dp: Remove support for unused dptx-phy
  arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy

 .../devicetree/bindings/phy/samsung-phy.txt        |    7 +-
 arch/arm/boot/dts/exynos5250.dtsi                  |    2 +-
 arch/arm/boot/dts/exynos5420.dtsi                  |    4 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c            |   58 ++++-----------
 drivers/gpu/drm/exynos/exynos_dp_core.h            |    2 -
 drivers/phy/phy-exynos-dp-video.c                  |   76 ++++++++++++++------
 6 files changed, 75 insertions(+), 74 deletions(-)

-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/3] phy: exynos-dp-video: Use syscon support to control pmu register
  2014-09-15 13:13 [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup Vivek Gautam
@ 2014-09-15 13:13 ` Vivek Gautam
  2014-09-15 13:13 ` [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy Vivek Gautam
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Vivek Gautam @ 2014-09-15 13:13 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc, devicetree, linux-kernel
  Cc: inki.dae, seanpaul, kishon, ajaykumar.rs, Vivek Gautam, Jingoo Han

Currently the DP_PHY_ENABLE register is mapped in the driver,
and accessed to control power to the PHY.
With mfd-syscon and regmap interface available at our disposal,
it's wise to use that instead of using a 'reg' property for the
controller and allocating a memory resource for that.

To facilitate this, we have added another compatible string
for Exynso5420 SoC to acquire driver data which contains
different DP-PHY-CONTROL register offset.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
---
 .../devicetree/bindings/phy/samsung-phy.txt        |    7 +-
 drivers/phy/phy-exynos-dp-video.c                  |   76 ++++++++++++++------
 2 files changed, 59 insertions(+), 24 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt
index 7a6feea..15e0f2c 100644
--- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
+++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
@@ -17,8 +17,11 @@ Samsung EXYNOS SoC series Display Port PHY
 -------------------------------------------------
 
 Required properties:
-- compatible : should be "samsung,exynos5250-dp-video-phy";
-- reg : offset and length of the Display Port PHY register set;
+- compatible : should be one of the following supported values:
+	 - "samsung,exynos5250-dp-video-phy"
+	 - "samsung,exynos5420-dp-video-phy"
+- samsung,pmu-syscon: phandle for PMU system controller interface, used to
+		      control pmu registers for power isolation.
 - #phy-cells : from the generic PHY bindings, must be 0;
 
 Samsung S5P/EXYNOS SoC series USB PHY
diff --git a/drivers/phy/phy-exynos-dp-video.c b/drivers/phy/phy-exynos-dp-video.c
index 8b3026e..f093719 100644
--- a/drivers/phy/phy-exynos-dp-video.c
+++ b/drivers/phy/phy-exynos-dp-video.c
@@ -13,44 +13,58 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mfd/syscon.h>
+#include <linux/mfd/syscon/exynos5-pmu.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/regmap.h>
 
 /* DPTX_PHY_CONTROL register */
 #define EXYNOS_DPTX_PHY_ENABLE		(1 << 0)
 
+struct exynos_dp_video_phy_drvdata {
+	u32 phy_ctrl_offset;
+};
+
 struct exynos_dp_video_phy {
 	void __iomem *regs;
+	const struct exynos_dp_video_phy_drvdata *drvdata;
 };
 
-static int __set_phy_state(struct exynos_dp_video_phy *state, unsigned int on)
+static void exynos_dp_video_phy_pwr_isol(struct exynos_dp_video_phy *state,
+							unsigned int on)
 {
-	u32 reg;
+	unsigned int val;
 
-	reg = readl(state->regs);
-	if (on)
-		reg |= EXYNOS_DPTX_PHY_ENABLE;
-	else
-		reg &= ~EXYNOS_DPTX_PHY_ENABLE;
-	writel(reg, state->regs);
+	if (IS_ERR(state->regs))
+		return;
 
-	return 0;
+	val = on ? 0 : EXYNOS_DPTX_PHY_ENABLE;
+
+	regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset,
+			   EXYNOS_DPTX_PHY_ENABLE, val);
 }
 
 static int exynos_dp_video_phy_power_on(struct phy *phy)
 {
 	struct exynos_dp_video_phy *state = phy_get_drvdata(phy);
 
-	return __set_phy_state(state, 1);
+	/* Disable power isolation on DP-PHY */
+	exynos_dp_video_phy_pwr_isol(state, 0);
+
+	return 0;
 }
 
 static int exynos_dp_video_phy_power_off(struct phy *phy)
 {
 	struct exynos_dp_video_phy *state = phy_get_drvdata(phy);
 
-	return __set_phy_state(state, 0);
+	/* Enable power isolation on DP-PHY */
+	exynos_dp_video_phy_pwr_isol(state, 1);
+
+	return 0;
 }
 
 static struct phy_ops exynos_dp_video_phy_ops = {
@@ -59,11 +73,31 @@ static struct phy_ops exynos_dp_video_phy_ops = {
 	.owner		= THIS_MODULE,
 };
 
+static const struct exynos_dp_video_phy_drvdata exynos5250_dp_video_phy = {
+	.phy_ctrl_offset	= EXYNOS5_DPTX_PHY_CONTROL,
+};
+
+static const struct exynos_dp_video_phy_drvdata exynos5420_dp_video_phy = {
+	.phy_ctrl_offset	= EXYNOS5420_DPTX_PHY_CONTROL,
+};
+
+static const struct of_device_id exynos_dp_video_phy_of_match[] = {
+	{
+		.compatible = "samsung,exynos5250-dp-video-phy",
+		.data = &exynos5250_dp_video_phy,
+	}, {
+		.compatible = "samsung,exynos5420-dp-video-phy",
+		.data = &exynos5420_dp_video_phy,
+	},
+	{ },
+};
+MODULE_DEVICE_TABLE(of, exynos_dp_video_phy_of_match);
+
 static int exynos_dp_video_phy_probe(struct platform_device *pdev)
 {
 	struct exynos_dp_video_phy *state;
 	struct device *dev = &pdev->dev;
-	struct resource *res;
+	const struct of_device_id *match;
 	struct phy_provider *phy_provider;
 	struct phy *phy;
 
@@ -71,11 +105,15 @@ static int exynos_dp_video_phy_probe(struct platform_device *pdev)
 	if (!state)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-	state->regs = devm_ioremap_resource(dev, res);
-	if (IS_ERR(state->regs))
+	state->regs = syscon_regmap_lookup_by_phandle(dev->of_node,
+						      "samsung,pmu-syscon");
+	if (IS_ERR(state->regs)) {
+		dev_err(dev, "Failed to lookup PMU regmap\n");
 		return PTR_ERR(state->regs);
+	}
+
+	match = of_match_node(exynos_dp_video_phy_of_match, dev->of_node);
+	state->drvdata = match->data;
 
 	phy = devm_phy_create(dev, NULL, &exynos_dp_video_phy_ops, NULL);
 	if (IS_ERR(phy)) {
@@ -89,12 +127,6 @@ static int exynos_dp_video_phy_probe(struct platform_device *pdev)
 	return PTR_ERR_OR_ZERO(phy_provider);
 }
 
-static const struct of_device_id exynos_dp_video_phy_of_match[] = {
-	{ .compatible = "samsung,exynos5250-dp-video-phy" },
-	{ },
-};
-MODULE_DEVICE_TABLE(of, exynos_dp_video_phy_of_match);
-
 static struct platform_driver exynos_dp_video_phy_driver = {
 	.probe	= exynos_dp_video_phy_probe,
 	.driver = {
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy
  2014-09-15 13:13 [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup Vivek Gautam
  2014-09-15 13:13 ` [PATCH 1/3] phy: exynos-dp-video: Use syscon support to control pmu register Vivek Gautam
@ 2014-09-15 13:13 ` Vivek Gautam
  2014-10-08  2:57   ` Vivek Gautam
  2014-10-30 12:20   ` Inki Dae
  2014-09-15 13:13 ` [PATCH 3/3] arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy Vivek Gautam
  2014-10-09 10:18 ` [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup Ajay kumar
  3 siblings, 2 replies; 13+ messages in thread
From: Vivek Gautam @ 2014-09-15 13:13 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc, devicetree, linux-kernel
  Cc: inki.dae, seanpaul, kishon, ajaykumar.rs, Vivek Gautam, Jingoo Han

Now that we have moved to generic phy based bindings,
we don't need to have any code related to older dptx-phy.
Nobody is using this dptx-phy anymore, so removing the
same.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Jingoo Han <jg1.han@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
 drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
 2 files changed, 13 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 4f3c7eb..5ffc1b2 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
 
 static void exynos_dp_phy_init(struct exynos_dp_device *dp)
 {
-	if (dp->phy) {
+	if (dp->phy)
 		phy_power_on(dp->phy);
-	} else if (dp->phy_addr) {
-		u32 reg;
-
-		reg = __raw_readl(dp->phy_addr);
-		reg |= dp->enable_mask;
-		__raw_writel(reg, dp->phy_addr);
-	}
 }
 
 static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
 {
-	if (dp->phy) {
+	if (dp->phy)
 		phy_power_off(dp->phy);
-	} else if (dp->phy_addr) {
-		u32 reg;
-
-		reg = __raw_readl(dp->phy_addr);
-		reg &= ~(dp->enable_mask);
-		__raw_writel(reg, dp->phy_addr);
-	}
 }
 
 static void exynos_dp_poweron(struct exynos_drm_display *display)
@@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
 
 static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
 {
-	struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
-	u32 phy_base;
 	int ret = 0;
 
-	dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
-	if (!dp_phy_node) {
-		dp->phy = devm_phy_get(dp->dev, "dp");
-		return PTR_ERR_OR_ZERO(dp->phy);
-	}
-
-	if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
-		dev_err(dp->dev, "failed to get reg for dptx-phy\n");
-		ret = -EINVAL;
-		goto err;
-	}
-
-	if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
-				&dp->enable_mask)) {
-		dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
-		ret = -EINVAL;
-		goto err;
-	}
-
-	dp->phy_addr = ioremap(phy_base, SZ_4);
-	if (!dp->phy_addr) {
-		dev_err(dp->dev, "failed to ioremap dp-phy\n");
-		ret = -ENOMEM;
-		goto err;
+	dp->phy = devm_phy_get(dp->dev, "dp");
+	if (IS_ERR(dp->phy)) {
+		ret = PTR_ERR(dp->phy);
+		if (ret == -ENOSYS || ret == -ENODEV) {
+			dp->phy = NULL;
+		} else if (ret == -EPROBE_DEFER) {
+			return ret;
+		} else {
+			dev_err(dp->dev, "no DP phy configured\n");
+			return ret;
+		}
 	}
 
-err:
-	of_node_put(dp_phy_node);
-
 	return ret;
 }
 
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
index a1aee69..6426201 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.h
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
@@ -153,8 +153,6 @@ struct exynos_dp_device {
 	struct clk		*clock;
 	unsigned int		irq;
 	void __iomem		*reg_base;
-	void __iomem		*phy_addr;
-	unsigned int		enable_mask;
 
 	struct video_info	*video_info;
 	struct link_train	link_train;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/3] arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy
  2014-09-15 13:13 [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup Vivek Gautam
  2014-09-15 13:13 ` [PATCH 1/3] phy: exynos-dp-video: Use syscon support to control pmu register Vivek Gautam
  2014-09-15 13:13 ` [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy Vivek Gautam
@ 2014-09-15 13:13 ` Vivek Gautam
  2014-10-08  2:59   ` Vivek Gautam
  2014-10-09 10:18 ` [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup Ajay kumar
  3 siblings, 1 reply; 13+ messages in thread
From: Vivek Gautam @ 2014-09-15 13:13 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc, devicetree, linux-kernel
  Cc: inki.dae, seanpaul, kishon, ajaykumar.rs, Vivek Gautam, Jingoo Han

DP PHY now require pmu-system-controller to handle PMU register
to control PHY's power isolation. Adding the same to dp-phy
node.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Jingoo Han <jg1.han@samsung.com>
---
 arch/arm/boot/dts/exynos5250.dtsi |    2 +-
 arch/arm/boot/dts/exynos5420.dtsi |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index f21b9aa..9b85a2b 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -732,7 +732,7 @@
 
 	dp_phy: video-phy@10040720 {
 		compatible = "samsung,exynos5250-dp-video-phy";
-		reg = <0x10040720 4>;
+		samsung,pmu-syscon = <&pmu_system_controller>;
 		#phy-cells = <0>;
 	};
 
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index bfe056d..a677812 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -503,8 +503,8 @@
 	};
 
 	dp_phy: video-phy@10040728 {
-		compatible = "samsung,exynos5250-dp-video-phy";
-		reg = <0x10040728 4>;
+		compatible = "samsung,exynos5420-dp-video-phy";
+		samsung,pmu-syscon = <&pmu_system_controller>;
 		#phy-cells = <0>;
 	};
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy
  2014-09-15 13:13 ` [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy Vivek Gautam
@ 2014-10-08  2:57   ` Vivek Gautam
  2014-10-08  3:00     ` Vivek Gautam
  2014-10-08  3:10     ` Inki Dae
  2014-10-30 12:20   ` Inki Dae
  1 sibling, 2 replies; 13+ messages in thread
From: Vivek Gautam @ 2014-10-08  2:57 UTC (permalink / raw)
  To: inki.dae, dri-devel, linux-samsung-soc, devicetree, linux-kernel
  Cc: Sean Paul, kishon, ajaykumar.rs, Vivek Gautam, Jingoo Han

Hi,


On Mon, Sep 15, 2014 at 6:43 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
> Now that we have moved to generic phy based bindings,
> we don't need to have any code related to older dptx-phy.
> Nobody is using this dptx-phy anymore, so removing the
> same.
>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> Cc: Jingoo Han <jg1.han@samsung.com>
> ---

Is someone taking care of this patch ? We already have got the corresponsding
dp-phy patch merged, so we should also get this patch in.

>  drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
>  drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
>  2 files changed, 13 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index 4f3c7eb..5ffc1b2 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>
>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>  {
> -       if (dp->phy) {
> +       if (dp->phy)
>                 phy_power_on(dp->phy);
> -       } else if (dp->phy_addr) {
> -               u32 reg;
> -
> -               reg = __raw_readl(dp->phy_addr);
> -               reg |= dp->enable_mask;
> -               __raw_writel(reg, dp->phy_addr);
> -       }
>  }
>
>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>  {
> -       if (dp->phy) {
> +       if (dp->phy)
>                 phy_power_off(dp->phy);
> -       } else if (dp->phy_addr) {
> -               u32 reg;
> -
> -               reg = __raw_readl(dp->phy_addr);
> -               reg &= ~(dp->enable_mask);
> -               __raw_writel(reg, dp->phy_addr);
> -       }
>  }
>
>  static void exynos_dp_poweron(struct exynos_drm_display *display)
> @@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
>
>  static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
>  {
> -       struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
> -       u32 phy_base;
>         int ret = 0;
>
> -       dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
> -       if (!dp_phy_node) {
> -               dp->phy = devm_phy_get(dp->dev, "dp");
> -               return PTR_ERR_OR_ZERO(dp->phy);
> -       }
> -
> -       if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
> -               dev_err(dp->dev, "failed to get reg for dptx-phy\n");
> -               ret = -EINVAL;
> -               goto err;
> -       }
> -
> -       if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
> -                               &dp->enable_mask)) {
> -               dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
> -               ret = -EINVAL;
> -               goto err;
> -       }
> -
> -       dp->phy_addr = ioremap(phy_base, SZ_4);
> -       if (!dp->phy_addr) {
> -               dev_err(dp->dev, "failed to ioremap dp-phy\n");
> -               ret = -ENOMEM;
> -               goto err;
> +       dp->phy = devm_phy_get(dp->dev, "dp");
> +       if (IS_ERR(dp->phy)) {
> +               ret = PTR_ERR(dp->phy);
> +               if (ret == -ENOSYS || ret == -ENODEV) {
> +                       dp->phy = NULL;
> +               } else if (ret == -EPROBE_DEFER) {
> +                       return ret;
> +               } else {
> +                       dev_err(dp->dev, "no DP phy configured\n");
> +                       return ret;
> +               }
>         }
>
> -err:
> -       of_node_put(dp_phy_node);
> -
>         return ret;
>  }
>
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
> index a1aee69..6426201 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
> @@ -153,8 +153,6 @@ struct exynos_dp_device {
>         struct clk              *clock;
>         unsigned int            irq;
>         void __iomem            *reg_base;
> -       void __iomem            *phy_addr;
> -       unsigned int            enable_mask;
>
>         struct video_info       *video_info;
>         struct link_train       link_train;
> --
> 1.7.10.4
>



-- 
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy
  2014-09-15 13:13 ` [PATCH 3/3] arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy Vivek Gautam
@ 2014-10-08  2:59   ` Vivek Gautam
  0 siblings, 0 replies; 13+ messages in thread
From: Vivek Gautam @ 2014-10-08  2:59 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc, devicetree, linux-kernel
  Cc: inki.dae, Sean Paul, kishon, ajaykumar.rs, Vivek Gautam,
	Jingoo Han, Kukjin Kim

Hi,

CC'ing Kukjin,
my bad, missed him while sending the patch. :-(

On Mon, Sep 15, 2014 at 6:43 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
> DP PHY now require pmu-system-controller to handle PMU register
> to control PHY's power isolation. Adding the same to dp-phy
> node.
>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> Cc: Jingoo Han <jg1.han@samsung.com>
> ---

Is someone taking care of this patch ? We already have got the corresponsding
dp-phy patch merged, so we should also get this patch in.

>  arch/arm/boot/dts/exynos5250.dtsi |    2 +-
>  arch/arm/boot/dts/exynos5420.dtsi |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
> index f21b9aa..9b85a2b 100644
> --- a/arch/arm/boot/dts/exynos5250.dtsi
> +++ b/arch/arm/boot/dts/exynos5250.dtsi
> @@ -732,7 +732,7 @@
>
>         dp_phy: video-phy@10040720 {
>                 compatible = "samsung,exynos5250-dp-video-phy";
> -               reg = <0x10040720 4>;
> +               samsung,pmu-syscon = <&pmu_system_controller>;
>                 #phy-cells = <0>;
>         };
>
> diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
> index bfe056d..a677812 100644
> --- a/arch/arm/boot/dts/exynos5420.dtsi
> +++ b/arch/arm/boot/dts/exynos5420.dtsi
> @@ -503,8 +503,8 @@
>         };
>
>         dp_phy: video-phy@10040728 {
> -               compatible = "samsung,exynos5250-dp-video-phy";
> -               reg = <0x10040728 4>;
> +               compatible = "samsung,exynos5420-dp-video-phy";
> +               samsung,pmu-syscon = <&pmu_system_controller>;
>                 #phy-cells = <0>;
>         };
>
> --
> 1.7.10.4
>



-- 
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy
  2014-10-08  2:57   ` Vivek Gautam
@ 2014-10-08  3:00     ` Vivek Gautam
  2014-10-08  3:10     ` Inki Dae
  1 sibling, 0 replies; 13+ messages in thread
From: Vivek Gautam @ 2014-10-08  3:00 UTC (permalink / raw)
  To: inki.dae, dri-devel, linux-samsung-soc, devicetree, linux-kernel
  Cc: Sean Paul, kishon, ajaykumar.rs, Vivek Gautam, Jingoo Han, Kukjin Kim

Hi,


CC'ing Kukjin,
my bad, missed him while sending the patch. :-(

On Wed, Oct 8, 2014 at 8:27 AM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
> Hi,
>
>
> On Mon, Sep 15, 2014 at 6:43 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
>> Now that we have moved to generic phy based bindings,
>> we don't need to have any code related to older dptx-phy.
>> Nobody is using this dptx-phy anymore, so removing the
>> same.
>>
>> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>> Cc: Jingoo Han <jg1.han@samsung.com>
>> ---
>
> Is someone taking care of this patch ? We already have got the corresponsding
> dp-phy patch merged, so we should also get this patch in.
>
>>  drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
>>  drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
>>  2 files changed, 13 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> index 4f3c7eb..5ffc1b2 100644
>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> @@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>>
>>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>>  {
>> -       if (dp->phy) {
>> +       if (dp->phy)
>>                 phy_power_on(dp->phy);
>> -       } else if (dp->phy_addr) {
>> -               u32 reg;
>> -
>> -               reg = __raw_readl(dp->phy_addr);
>> -               reg |= dp->enable_mask;
>> -               __raw_writel(reg, dp->phy_addr);
>> -       }
>>  }
>>
>>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>>  {
>> -       if (dp->phy) {
>> +       if (dp->phy)
>>                 phy_power_off(dp->phy);
>> -       } else if (dp->phy_addr) {
>> -               u32 reg;
>> -
>> -               reg = __raw_readl(dp->phy_addr);
>> -               reg &= ~(dp->enable_mask);
>> -               __raw_writel(reg, dp->phy_addr);
>> -       }
>>  }
>>
>>  static void exynos_dp_poweron(struct exynos_drm_display *display)
>> @@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
>>
>>  static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
>>  {
>> -       struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
>> -       u32 phy_base;
>>         int ret = 0;
>>
>> -       dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
>> -       if (!dp_phy_node) {
>> -               dp->phy = devm_phy_get(dp->dev, "dp");
>> -               return PTR_ERR_OR_ZERO(dp->phy);
>> -       }
>> -
>> -       if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
>> -               dev_err(dp->dev, "failed to get reg for dptx-phy\n");
>> -               ret = -EINVAL;
>> -               goto err;
>> -       }
>> -
>> -       if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
>> -                               &dp->enable_mask)) {
>> -               dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
>> -               ret = -EINVAL;
>> -               goto err;
>> -       }
>> -
>> -       dp->phy_addr = ioremap(phy_base, SZ_4);
>> -       if (!dp->phy_addr) {
>> -               dev_err(dp->dev, "failed to ioremap dp-phy\n");
>> -               ret = -ENOMEM;
>> -               goto err;
>> +       dp->phy = devm_phy_get(dp->dev, "dp");
>> +       if (IS_ERR(dp->phy)) {
>> +               ret = PTR_ERR(dp->phy);
>> +               if (ret == -ENOSYS || ret == -ENODEV) {
>> +                       dp->phy = NULL;
>> +               } else if (ret == -EPROBE_DEFER) {
>> +                       return ret;
>> +               } else {
>> +                       dev_err(dp->dev, "no DP phy configured\n");
>> +                       return ret;
>> +               }
>>         }
>>
>> -err:
>> -       of_node_put(dp_phy_node);
>> -
>>         return ret;
>>  }
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
>> index a1aee69..6426201 100644
>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
>> @@ -153,8 +153,6 @@ struct exynos_dp_device {
>>         struct clk              *clock;
>>         unsigned int            irq;
>>         void __iomem            *reg_base;
>> -       void __iomem            *phy_addr;
>> -       unsigned int            enable_mask;
>>
>>         struct video_info       *video_info;
>>         struct link_train       link_train;
>> --
>> 1.7.10.4
>>
>
>
>
> --
> Best Regards
> Vivek Gautam
> Samsung R&D Institute, Bangalore
> India



-- 
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy
  2014-10-08  2:57   ` Vivek Gautam
  2014-10-08  3:00     ` Vivek Gautam
@ 2014-10-08  3:10     ` Inki Dae
  1 sibling, 0 replies; 13+ messages in thread
From: Inki Dae @ 2014-10-08  3:10 UTC (permalink / raw)
  To: Vivek Gautam
  Cc: dri-devel, linux-samsung-soc, devicetree, linux-kernel,
	Sean Paul, kishon, ajaykumar.rs, Jingoo Han, cpgs

On 2014년 10월 08일 11:57, Vivek Gautam wrote:
> Hi,
> 
> 
> On Mon, Sep 15, 2014 at 6:43 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
>> Now that we have moved to generic phy based bindings,
>> we don't need to have any code related to older dptx-phy.
>> Nobody is using this dptx-phy anymore, so removing the
>> same.
>>
>> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>> Cc: Jingoo Han <jg1.han@samsung.com>
>> ---
> 
> Is someone taking care of this patch ? We already have got the corresponsding
> dp-phy patch merged, so we should also get this patch in.
> 

Can anyone give me tested-by after test? I cannot test this module
because I have no any board equipped with dp panel.

Jingoo or other?

Thanks,
Inki Dae

>>  drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
>>  drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
>>  2 files changed, 13 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> index 4f3c7eb..5ffc1b2 100644
>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> @@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>>
>>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>>  {
>> -       if (dp->phy) {
>> +       if (dp->phy)
>>                 phy_power_on(dp->phy);
>> -       } else if (dp->phy_addr) {
>> -               u32 reg;
>> -
>> -               reg = __raw_readl(dp->phy_addr);
>> -               reg |= dp->enable_mask;
>> -               __raw_writel(reg, dp->phy_addr);
>> -       }
>>  }
>>
>>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>>  {
>> -       if (dp->phy) {
>> +       if (dp->phy)
>>                 phy_power_off(dp->phy);
>> -       } else if (dp->phy_addr) {
>> -               u32 reg;
>> -
>> -               reg = __raw_readl(dp->phy_addr);
>> -               reg &= ~(dp->enable_mask);
>> -               __raw_writel(reg, dp->phy_addr);
>> -       }
>>  }
>>
>>  static void exynos_dp_poweron(struct exynos_drm_display *display)
>> @@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
>>
>>  static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
>>  {
>> -       struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
>> -       u32 phy_base;
>>         int ret = 0;
>>
>> -       dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
>> -       if (!dp_phy_node) {
>> -               dp->phy = devm_phy_get(dp->dev, "dp");
>> -               return PTR_ERR_OR_ZERO(dp->phy);
>> -       }
>> -
>> -       if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
>> -               dev_err(dp->dev, "failed to get reg for dptx-phy\n");
>> -               ret = -EINVAL;
>> -               goto err;
>> -       }
>> -
>> -       if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
>> -                               &dp->enable_mask)) {
>> -               dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
>> -               ret = -EINVAL;
>> -               goto err;
>> -       }
>> -
>> -       dp->phy_addr = ioremap(phy_base, SZ_4);
>> -       if (!dp->phy_addr) {
>> -               dev_err(dp->dev, "failed to ioremap dp-phy\n");
>> -               ret = -ENOMEM;
>> -               goto err;
>> +       dp->phy = devm_phy_get(dp->dev, "dp");
>> +       if (IS_ERR(dp->phy)) {
>> +               ret = PTR_ERR(dp->phy);
>> +               if (ret == -ENOSYS || ret == -ENODEV) {
>> +                       dp->phy = NULL;
>> +               } else if (ret == -EPROBE_DEFER) {
>> +                       return ret;
>> +               } else {
>> +                       dev_err(dp->dev, "no DP phy configured\n");
>> +                       return ret;
>> +               }
>>         }
>>
>> -err:
>> -       of_node_put(dp_phy_node);
>> -
>>         return ret;
>>  }
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
>> index a1aee69..6426201 100644
>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
>> @@ -153,8 +153,6 @@ struct exynos_dp_device {
>>         struct clk              *clock;
>>         unsigned int            irq;
>>         void __iomem            *reg_base;
>> -       void __iomem            *phy_addr;
>> -       unsigned int            enable_mask;
>>
>>         struct video_info       *video_info;
>>         struct link_train       link_train;
>> --
>> 1.7.10.4
>>
> 
> 
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup
  2014-09-15 13:13 [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup Vivek Gautam
                   ` (2 preceding siblings ...)
  2014-09-15 13:13 ` [PATCH 3/3] arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy Vivek Gautam
@ 2014-10-09 10:18 ` Ajay kumar
  2014-10-09 10:26   ` Vivek Gautam
  3 siblings, 1 reply; 13+ messages in thread
From: Ajay kumar @ 2014-10-09 10:18 UTC (permalink / raw)
  To: InKi Dae, Vivek Gautam
  Cc: dri-devel, linux-samsung-soc, devicetree, LKML, Sean Paul,
	kishon, Ajay Kumar

Hi,

On Mon, Sep 15, 2014 at 6:43 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
> These patches are based on 'for-next' branch of kgene's linux-samsung tree.
>
> Refactoring the exynos-dp-video phy to use pmu-system-controller handle
> and access the register using mfd-syscon and regmap.
> Simultaneously, removing the support for older dptx-phy, since it's obsolete
> now and noone uses it.
>
> Vivek Gautam (3):
>   phy: exynos-dp-video: Use syscon support to control pmu register
>   drm/exynos: dp: Remove support for unused dptx-phy
>   arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy
>
>  .../devicetree/bindings/phy/samsung-phy.txt        |    7 +-
>  arch/arm/boot/dts/exynos5250.dtsi                  |    2 +-
>  arch/arm/boot/dts/exynos5420.dtsi                  |    4 +-
>  drivers/gpu/drm/exynos/exynos_dp_core.c            |   58 ++++-----------
>  drivers/gpu/drm/exynos/exynos_dp_core.h            |    2 -
>  drivers/phy/phy-exynos-dp-video.c                  |   76 ++++++++++++++------
>  6 files changed, 75 insertions(+), 74 deletions(-)
>
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

I have tested this patchset on exynos5800-peach-pi, and I can see DP
display with the above patches.

Ajay

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup
  2014-10-09 10:18 ` [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup Ajay kumar
@ 2014-10-09 10:26   ` Vivek Gautam
  2014-10-09 10:29     ` Ajay kumar
  0 siblings, 1 reply; 13+ messages in thread
From: Vivek Gautam @ 2014-10-09 10:26 UTC (permalink / raw)
  To: Ajay kumar
  Cc: InKi Dae, dri-devel, linux-samsung-soc, devicetree, LKML,
	Sean Paul, kishon, Ajay Kumar

Ajay,


On Thu, Oct 9, 2014 at 3:48 PM, Ajay kumar <ajaynumb@gmail.com> wrote:
> Hi,
>
> On Mon, Sep 15, 2014 at 6:43 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
>> These patches are based on 'for-next' branch of kgene's linux-samsung tree.
>>
>> Refactoring the exynos-dp-video phy to use pmu-system-controller handle
>> and access the register using mfd-syscon and regmap.
>> Simultaneously, removing the support for older dptx-phy, since it's obsolete
>> now and noone uses it.
>>
>> Vivek Gautam (3):
>>   phy: exynos-dp-video: Use syscon support to control pmu register
>>   drm/exynos: dp: Remove support for unused dptx-phy
>>   arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy
>>
>>  .../devicetree/bindings/phy/samsung-phy.txt        |    7 +-
>>  arch/arm/boot/dts/exynos5250.dtsi                  |    2 +-
>>  arch/arm/boot/dts/exynos5420.dtsi                  |    4 +-
>>  drivers/gpu/drm/exynos/exynos_dp_core.c            |   58 ++++-----------
>>  drivers/gpu/drm/exynos/exynos_dp_core.h            |    2 -
>>  drivers/phy/phy-exynos-dp-video.c                  |   76 ++++++++++++++------
>>  6 files changed, 75 insertions(+), 74 deletions(-)
>>
>> --
>> 1.7.10.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> I have tested this patchset on exynos5800-peach-pi, and I can see DP
> display with the above patches.

we expect "Tested-by", if you have tested please give the same.


-- 
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup
  2014-10-09 10:26   ` Vivek Gautam
@ 2014-10-09 10:29     ` Ajay kumar
  0 siblings, 0 replies; 13+ messages in thread
From: Ajay kumar @ 2014-10-09 10:29 UTC (permalink / raw)
  To: Vivek Gautam
  Cc: InKi Dae, dri-devel, linux-samsung-soc, devicetree, LKML,
	Sean Paul, kishon, Ajay Kumar

On Thu, Oct 9, 2014 at 3:56 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
> Ajay,
>
>
> On Thu, Oct 9, 2014 at 3:48 PM, Ajay kumar <ajaynumb@gmail.com> wrote:
>> Hi,
>>
>> On Mon, Sep 15, 2014 at 6:43 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
>>> These patches are based on 'for-next' branch of kgene's linux-samsung tree.
>>>
>>> Refactoring the exynos-dp-video phy to use pmu-system-controller handle
>>> and access the register using mfd-syscon and regmap.
>>> Simultaneously, removing the support for older dptx-phy, since it's obsolete
>>> now and noone uses it.
>>>
>>> Vivek Gautam (3):
>>>   phy: exynos-dp-video: Use syscon support to control pmu register
>>>   drm/exynos: dp: Remove support for unused dptx-phy
>>>   arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy
>>>
>>>  .../devicetree/bindings/phy/samsung-phy.txt        |    7 +-
>>>  arch/arm/boot/dts/exynos5250.dtsi                  |    2 +-
>>>  arch/arm/boot/dts/exynos5420.dtsi                  |    4 +-
>>>  drivers/gpu/drm/exynos/exynos_dp_core.c            |   58 ++++-----------
>>>  drivers/gpu/drm/exynos/exynos_dp_core.h            |    2 -
>>>  drivers/phy/phy-exynos-dp-video.c                  |   76 ++++++++++++++------
>>>  6 files changed, 75 insertions(+), 74 deletions(-)
>>>
>>> --
>>> 1.7.10.4
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>> I have tested this patchset on exynos5800-peach-pi, and I can see DP
>> display with the above patches.
>
> we expect "Tested-by", if you have tested please give the same.
Tested-by: Ajay Kumar <ajaykumar.rs@samsung.com>

Ajay

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy
  2014-09-15 13:13 ` [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy Vivek Gautam
  2014-10-08  2:57   ` Vivek Gautam
@ 2014-10-30 12:20   ` Inki Dae
  2014-10-30 13:19     ` Vivek Gautam
  1 sibling, 1 reply; 13+ messages in thread
From: Inki Dae @ 2014-10-30 12:20 UTC (permalink / raw)
  To: Vivek Gautam
  Cc: dri-devel, linux-samsung-soc, devicetree, linux-kernel, seanpaul,
	kishon, ajaykumar.rs, Jingoo Han, cpgs .


Sorry for late. I missed this patch a little bit for long time.


On 2014년 09월 15일 22:13, Vivek Gautam wrote:
> Now that we have moved to generic phy based bindings,
> we don't need to have any code related to older dptx-phy.
> Nobody is using this dptx-phy anymore, so removing the
> same.
> 
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> Cc: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
>  drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
>  2 files changed, 13 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index 4f3c7eb..5ffc1b2 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>  
>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>  {
> -	if (dp->phy) {
> +	if (dp->phy)
>  		phy_power_on(dp->phy);
> -	} else if (dp->phy_addr) {
> -		u32 reg;
> -
> -		reg = __raw_readl(dp->phy_addr);
> -		reg |= dp->enable_mask;
> -		__raw_writel(reg, dp->phy_addr);
> -	}
>  }
>  
>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>  {
> -	if (dp->phy) {
> +	if (dp->phy)
>  		phy_power_off(dp->phy);
> -	} else if (dp->phy_addr) {
> -		u32 reg;
> -
> -		reg = __raw_readl(dp->phy_addr);
> -		reg &= ~(dp->enable_mask);
> -		__raw_writel(reg, dp->phy_addr);
> -	}
>  }
>  
>  static void exynos_dp_poweron(struct exynos_drm_display *display)
> @@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
>  
>  static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
>  {
> -	struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
> -	u32 phy_base;
>  	int ret = 0;
>  
> -	dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
> -	if (!dp_phy_node) {
> -		dp->phy = devm_phy_get(dp->dev, "dp");
> -		return PTR_ERR_OR_ZERO(dp->phy);
> -	}
> -
> -	if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
> -		dev_err(dp->dev, "failed to get reg for dptx-phy\n");
> -		ret = -EINVAL;
> -		goto err;
> -	}
> -
> -	if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
> -				&dp->enable_mask)) {
> -		dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
> -		ret = -EINVAL;
> -		goto err;
> -	}
> -
> -	dp->phy_addr = ioremap(phy_base, SZ_4);
> -	if (!dp->phy_addr) {
> -		dev_err(dp->dev, "failed to ioremap dp-phy\n");
> -		ret = -ENOMEM;
> -		goto err;
> +	dp->phy = devm_phy_get(dp->dev, "dp");
> +	if (IS_ERR(dp->phy)) {
> +		ret = PTR_ERR(dp->phy);
> +		if (ret == -ENOSYS || ret == -ENODEV) {
> +			dp->phy = NULL;
> +		} else if (ret == -EPROBE_DEFER) {
> +			return ret;
> +		} else {

WARNING: else is not generally useful after a break or return
#146: FILE: drivers/gpu/drm/exynos/exynos_dp_core.c:1208:
+			return ret;
+		} else {

How about just returning ret like below?
		if (IS_ERR(dp->phy)) {
			dev_err(dp->dev, "no DP phy configured\n");
			return PTR_ERR(ret);
		}

And then you can handle the error at probe function properly.

Thanks,
Inki Dae


> +			dev_err(dp->dev, "no DP phy configured\n");
> +			return ret;
> +		}
>  	}
>  
> -err:
> -	of_node_put(dp_phy_node);
> -
>  	return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
> index a1aee69..6426201 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
> @@ -153,8 +153,6 @@ struct exynos_dp_device {
>  	struct clk		*clock;
>  	unsigned int		irq;
>  	void __iomem		*reg_base;
> -	void __iomem		*phy_addr;
> -	unsigned int		enable_mask;
>  
>  	struct video_info	*video_info;
>  	struct link_train	link_train;
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy
  2014-10-30 12:20   ` Inki Dae
@ 2014-10-30 13:19     ` Vivek Gautam
  0 siblings, 0 replies; 13+ messages in thread
From: Vivek Gautam @ 2014-10-30 13:19 UTC (permalink / raw)
  To: Inki Dae
  Cc: dri-devel, linux-samsung-soc, devicetree, linux-kernel,
	Sean Paul, kishon, Ajay Kumar, Jingoo Han, cpgs .

Hi Inki,


On Thu, Oct 30, 2014 at 5:50 PM, Inki Dae <inki.dae@samsung.com> wrote:
>
> Sorry for late. I missed this patch a little bit for long time.

Thanks for reviewing.

>
>
> On 2014년 09월 15일 22:13, Vivek Gautam wrote:
>> Now that we have moved to generic phy based bindings,
>> we don't need to have any code related to older dptx-phy.
>> Nobody is using this dptx-phy anymore, so removing the
>> same.
>>
>> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>> Cc: Jingoo Han <jg1.han@samsung.com>
>> ---
>>  drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
>>  drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
>>  2 files changed, 13 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> index 4f3c7eb..5ffc1b2 100644
>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> @@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>>
>>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>>  {
>> -     if (dp->phy) {
>> +     if (dp->phy)
>>               phy_power_on(dp->phy);
>> -     } else if (dp->phy_addr) {
>> -             u32 reg;
>> -
>> -             reg = __raw_readl(dp->phy_addr);
>> -             reg |= dp->enable_mask;
>> -             __raw_writel(reg, dp->phy_addr);
>> -     }
>>  }
>>
>>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>>  {
>> -     if (dp->phy) {
>> +     if (dp->phy)
>>               phy_power_off(dp->phy);
>> -     } else if (dp->phy_addr) {
>> -             u32 reg;
>> -
>> -             reg = __raw_readl(dp->phy_addr);
>> -             reg &= ~(dp->enable_mask);
>> -             __raw_writel(reg, dp->phy_addr);
>> -     }
>>  }
>>
>>  static void exynos_dp_poweron(struct exynos_drm_display *display)
>> @@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
>>
>>  static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
>>  {
>> -     struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
>> -     u32 phy_base;
>>       int ret = 0;
>>
>> -     dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
>> -     if (!dp_phy_node) {
>> -             dp->phy = devm_phy_get(dp->dev, "dp");
>> -             return PTR_ERR_OR_ZERO(dp->phy);
>> -     }
>> -
>> -     if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
>> -             dev_err(dp->dev, "failed to get reg for dptx-phy\n");
>> -             ret = -EINVAL;
>> -             goto err;
>> -     }
>> -
>> -     if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
>> -                             &dp->enable_mask)) {
>> -             dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
>> -             ret = -EINVAL;
>> -             goto err;
>> -     }
>> -
>> -     dp->phy_addr = ioremap(phy_base, SZ_4);
>> -     if (!dp->phy_addr) {
>> -             dev_err(dp->dev, "failed to ioremap dp-phy\n");
>> -             ret = -ENOMEM;
>> -             goto err;
>> +     dp->phy = devm_phy_get(dp->dev, "dp");
>> +     if (IS_ERR(dp->phy)) {
>> +             ret = PTR_ERR(dp->phy);
>> +             if (ret == -ENOSYS || ret == -ENODEV) {
>> +                     dp->phy = NULL;
>> +             } else if (ret == -EPROBE_DEFER) {
>> +                     return ret;
>> +             } else {
>
> WARNING: else is not generally useful after a break or return
> #146: FILE: drivers/gpu/drm/exynos/exynos_dp_core.c:1208:
> +                       return ret;
> +               } else {
>
> How about just returning ret like below?
>                 if (IS_ERR(dp->phy)) {
>                         dev_err(dp->dev, "no DP phy configured\n");
>                         return PTR_ERR(ret);
>                 }
>
> And then you can handle the error at probe function properly.

Right, point taken. Will post the reworked patch.

[snip]

-- 
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-10-30 13:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15 13:13 [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup Vivek Gautam
2014-09-15 13:13 ` [PATCH 1/3] phy: exynos-dp-video: Use syscon support to control pmu register Vivek Gautam
2014-09-15 13:13 ` [PATCH 2/3] drm/exynos: dp: Remove support for unused dptx-phy Vivek Gautam
2014-10-08  2:57   ` Vivek Gautam
2014-10-08  3:00     ` Vivek Gautam
2014-10-08  3:10     ` Inki Dae
2014-10-30 12:20   ` Inki Dae
2014-10-30 13:19     ` Vivek Gautam
2014-09-15 13:13 ` [PATCH 3/3] arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy Vivek Gautam
2014-10-08  2:59   ` Vivek Gautam
2014-10-09 10:18 ` [PATCH 0/3] drm-exynos-dp/phy-exynos-dp: Refactor to use pmu-system-controller and dp driver cleanup Ajay kumar
2014-10-09 10:26   ` Vivek Gautam
2014-10-09 10:29     ` Ajay kumar

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).