Skip to contentSkip to conversation

Generic PHY driver for the Exynos SoC DP PHY

PATCH New Jingoo Han 1 participant 4 messages Sep 30, 2013

Subsystems (4)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

v8 cover Generic PHY driver for the Exynos SoC DP PHY

This patch series adds a simple driver for the Samsung Exynos SoC series DP transmitter PHY, using the generic PHY framework [1]. Previously the DP PHY used an internal DT node to control the PHY power enable bit.

This PATCH v8 follows:
* PATCH v7, sent on August, 26th 2013
* PATCH v6, sent on July, 9th 2013
* PATCH v5, sent on July, 8th 2013
* PATCH v4, sent on July, 2nd 2013
* PATCH v3, sent on July, 1st 2013
* PATCH v2, sent on June, 28th 2013
* PATCH v1, sent on June, 28th 2013

Changes from v7:
* Re-based on git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git next

Changes from v6:
* Re-based on git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git

Changes from v5:
* Re-based on git://gitorious.org/linuxphy/linuxphy.git

Changes from v4:
* Marked original bindings as deprecated in 'exynos_dp.txt'
* Fixed typo of commit message.
* Added Tomasz Figa's Reviewed-by.

Changes from v3:
* Added OF dependancy.
* Removed redundant local variable 'void __iomem *addr'.
* Removed unnecessary dev_set_drvdata().
* Added a patch that remove non-DT support for Exynos Display Port driver.
* Removed unnecessary 'struct exynos_dp_platdata'.
* Kept supporting the original bindings for DT compatibility.

Changes from v2:
* Removed redundant spinlock
* Removed 'struct phy' from 'struct exynos_dp_video_phy'
* Updated 'samsung-phy.txt', instead of creating

    'samsung,exynos5250-dp-video-phy.txt'.

* Removed unnecessary additional specifier from 'phys' DT property.
* Added 'phys', 'phy-names' properties to 'exynos_dp.txt' file.
* Added Felipe Balbi's Acked-by.

Changes from v1:
* Replaced exynos_dp_video_phy_xlate() with of_phy_simple_xlate(), as Kishon Vijay Abraham I guided.
* Set the value of phy-cells as 0, because the phy_provider implements only one PHY.
* Removed unnecessary header include.
* Added '#ifdef CONFIG_OF' and of_match_ptr macro.

This series depends on the generic PHY framework [1]. These patches refer to Sylwester Nawrocki's patches about Exynos MIPI [2].

[1] http://www.spinics.net/lists/kernel/msg1609491.html
[2] http://www.spinics.net/lists/linux-samsung-soc/msg23073.html

Jingoo Han (3):
phy: Add driver for Exynos DP PHY
video: exynos_dp: remove non-DT support for Exynos Display Port
video: exynos_dp: Use the generic PHY driver

 .../devicetree/bindings/phy/samsung-phy.txt        |    8 ++
 .../devicetree/bindings/video/exynos_dp.txt        |   17 +--
 drivers/phy/Kconfig                                |    7 ++
 drivers/phy/Makefile                               |    1 +
 drivers/phy/phy-exynos-dp-video.c                  |  111 ++++++++++++++++
 drivers/video/exynos/Kconfig                       |    2 +-
 drivers/video/exynos/exynos_dp_core.c              |  132 ++++++--------------
 drivers/video/exynos/exynos_dp_core.h              |  110 ++++++++++++++++
 drivers/video/exynos/exynos_dp_reg.c               |    2 -
 include/video/exynos_dp.h                          |  131 -------------------
 10 files changed, 284 insertions(+), 237 deletions(-)
 create mode 100644 drivers/phy/phy-exynos-dp-video.c
 delete mode 100644 include/video/exynos_dp.h

--
1.7.10.4

author
#1 lore raw

PATCH v8 1/3 phy: Add driver for Exynos DP PHY

Add a PHY provider driver for the Samsung Exynos SoC Display Port PHY.

---
 .../devicetree/bindings/phy/samsung-phy.txt        |    8 ++
 drivers/phy/Kconfig                                |    7 ++
 drivers/phy/Makefile                               |    1 +
 drivers/phy/phy-exynos-dp-video.c                  |  111 ++++++++++++++++++++
 4 files changed, 127 insertions(+)
 create mode 100644 drivers/phy/phy-exynos-dp-video.c
Documentation/devicetree/bindings/phy/samsung-phy.txt +8 -0
index 5ff208c..c0fccaa 100644
@@ -12,3 +12,11 @@ the PHY specifier identifies the PHY and its meaning is as follows:
   1 - MIPI DSIM 0,
   2 - MIPI CSIS 1,
   3 - MIPI DSIM 1.
+
+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;
+- #phy-cells : from the generic PHY bindings, must be 0;
drivers/phy/Kconfig +7 -0
index 0062d7e..a344f3d 100644
@@ -44,4 +44,11 @@ config TWL4030_USB
 	  This transceiver supports high and full speed devices plus,
 	  in host mode, low speed.
 
+config PHY_EXYNOS_DP_VIDEO
+	tristate "EXYNOS SoC series Display Port PHY driver"
+	depends on OF
+	select GENERIC_PHY
+	help
+	  Support for Display Port PHY found on Samsung EXYNOS SoCs.
+
 endmenu
drivers/phy/Makefile +1 -0
index 6344053..d0caae9 100644
@@ -3,6 +3,7 @@
 #
 
 obj-$(CONFIG_GENERIC_PHY)		+= phy-core.o
+obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO)	+= phy-exynos-dp-video.o
 obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)	+= phy-exynos-mipi-video.o
 obj-$(CONFIG_OMAP_USB2)			+= phy-omap-usb2.o
 obj-$(CONFIG_TWL4030_USB)		+= phy-twl4030-usb.o
drivers/phy/phy-exynos-dp-video.c new file +111 -0

111 lines not on this page · raw message

Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH v8 2/3 video: exynos_dp: remove non-DT support for Exynos Display Port

In reply to Jingoo Han

Exynos Display Port can be used only for Exynos SoCs. In addition, non-DT for EXYNOS SoCs is not supported from v3.11; thus, there is no need to support non-DT for Exynos Display Port.

The 'include/video/exynos_dp.h' file has been used for non-DT support and the content of file include/video/exynos_dp.h is moved to drivers/video/exynos/exynos_dp_core.h. Thus, the 'exynos_dp.h' file is removed. Also, 'struct exynos_dp_platdata' is removed, because it is not used any more.

---
 drivers/video/exynos/Kconfig          |    2 +-
 drivers/video/exynos/exynos_dp_core.c |  116 +++++++----------------------
 drivers/video/exynos/exynos_dp_core.h |  109 +++++++++++++++++++++++++++
 drivers/video/exynos/exynos_dp_reg.c  |    2 -
 include/video/exynos_dp.h             |  131 ---------------------------------
 5 files changed, 135 insertions(+), 225 deletions(-)
 delete mode 100644 include/video/exynos_dp.h
drivers/video/exynos/Kconfig +1 -1
index 976594d..1129d0e 100644
@@ -30,7 +30,7 @@ config EXYNOS_LCD_S6E8AX0
 
 config EXYNOS_DP
 	bool "EXYNOS DP driver support"
-	depends on ARCH_EXYNOS
+	depends on OF && ARCH_EXYNOS
 	default n
 	help
 	  This enables support for DP device.
drivers/video/exynos/exynos_dp_core.c +25 -91

210 lines not on this page · raw message

drivers/video/exynos/exynos_dp_core.h +109 -0

121 lines not on this page · raw message

drivers/video/exynos/exynos_dp_reg.c +0 -2
index 29d9d03..b70da50 100644
@@ -14,8 +14,6 @@
 #include <linux/io.h>
 #include <linux/delay.h>
 
-#include <video/exynos_dp.h>
-
 #include "exynos_dp_core.h"
 #include "exynos_dp_reg.h"
 
include/video/exynos_dp.h deleted +0 -131

131 lines not on this page · raw message

Signature · 1 line
1.7.10.4
author
#3 lore raw

PATCH v8 3/3 video: exynos_dp: Use the generic PHY driver

In reply to Jingoo Han

Use the generic PHY API to control the DP PHY.

---
 Documentation/devicetree/bindings/video/exynos_dp.txt |   17 +++++++++--------
 drivers/video/exynos/exynos_dp_core.c                 |   16 ++++++++++++----
 drivers/video/exynos/exynos_dp_core.h                 |    1 +
 3 files changed, 22 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/video/exynos_dp.txt +9 -8
index 84f10c1..3289d76 100644
@@ -6,10 +6,10 @@ We use two nodes:
 	-dptx-phy node(defined inside dp-controller node)
 
 For the DP-PHY initialization, we use the dptx-phy node.
-Required properties for dptx-phy:
-	-reg:
+Required properties for dptx-phy: deprecated, use phys and phy-names
+	-reg: deprecated
 		Base address of DP PHY register.
-	-samsung,enable-mask:
+	-samsung,enable-mask: deprecated
 		The bit-mask used to enable/disable DP PHY.
 
 For the Panel initialization, we read data from dp-controller node.
@@ -27,6 +27,10 @@ Required properties for dp-controller:
 		from common clock binding: Shall be "dp".
 	-interrupt-parent:
 		phandle to Interrupt combiner node.
+	-phys:
+		from general PHY binding: the phandle for the PHY device.
+	-phy-names:
+		from general PHY binding: Should be "dp".
 	-samsung,color-space:
 		input video data format.
 			COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2
@@ -68,11 +72,8 @@ SOC specific portion:
 		clocks = <&clock 342>;
 		clock-names = "dp";
 
-		dptx-phy {
-			reg = <0x10040720>;
-			samsung,enable-mask = <1>;
-		};
-
+		phys = <&dp_phy>;
+		phy-names = "dp";
 	};
 
 Board Specific portion:
drivers/video/exynos/exynos_dp_core.c +12 -4
index 05fed7d..5e1a715 100644
@@ -19,6 +19,7 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/of.h>
+#include <linux/phy/phy.h>
 
 #include "exynos_dp_core.h"
 
@@ -960,8 +961,11 @@ static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
 
 	dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
 	if (!dp_phy_node) {
-		dev_err(dp->dev, "could not find dptx-phy node\n");
-		return -ENODEV;
+		dp->phy = devm_phy_get(dp->dev, "dp");
+		if (IS_ERR(dp->phy))
+			return PTR_ERR(dp->phy);
+		else
+			return 0;
 	}
 
 	if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
@@ -992,7 +996,9 @@ err:
 
 static void exynos_dp_phy_init(struct exynos_dp_device *dp)
 {
-	if (dp->phy_addr) {
+	if (dp->phy) {
+		phy_power_on(dp->phy);
+	} else if (dp->phy_addr) {
 		u32 reg;
 
 		reg = __raw_readl(dp->phy_addr);
@@ -1003,7 +1009,9 @@ static void exynos_dp_phy_init(struct exynos_dp_device *dp)
 
 static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
 {
-	if (dp->phy_addr) {
+	if (dp->phy) {
+		phy_power_off(dp->phy);
+	} else if (dp->phy_addr) {
 		u32 reg;
 
 		reg = __raw_readl(dp->phy_addr);
drivers/video/exynos/exynos_dp_core.h +1 -0
index 56cfec8..607e36d 100644
@@ -151,6 +151,7 @@ struct exynos_dp_device {
 	struct video_info	*video_info;
 	struct link_train	link_train;
 	struct work_struct	hotplug_work;
+	struct phy		*phy;
 };
 
 /* exynos_dp_reg.c */
Signature · 1 line
1.7.10.4