All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Trimarchi <michael@amarulasolutions.com>
To: "Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-phy@lists.infradead.org,
	linux-amarula@amarulasolutions.com
Subject: [RFC PATCH 4/4] drm/rockchip: rgb: Add dphy connection to rgb output
Date: Sun,  2 Oct 2022 08:45:40 +0200	[thread overview]
Message-ID: <20221002064540.2500257-5-michael@amarulasolutions.com> (raw)
In-Reply-To: <20221002064540.2500257-1-michael@amarulasolutions.com>

Dispite the commit 1f0f015151727, the rgb output has an option
to allow to sent the output pin using the dsi/lvds/ttl logic.
The only way to do and stay on the same design is let the
rockchip_rgb block to grab the handle if it is present and
enable it. The present of this handle depends on dts configuration

I have a full working example with an hardware with mixed lines
on direct logic and using the phy, with the follow dts example:

panel: panel {
	compatible = "panel-dpi";
	...
	panel-timing {
		clock-frequency = <30000000>;
		...
	};

	port {
		panel_rgb_in: endpoint {
			remote-endpoint = <&vopb_out_rgb>;
		};
	};
};

&vopb_out {
        vopb_out_rgb: endpoint@2 {
                reg = <2>;
                remote-endpoint = <&panel_rgb_in>;
        };
};

&vopb {
        status = "okay";
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&lcdc_rgb_pins>;
        pinctrl-1 = <&lcdc_sleep_pins>;

        phys = <&dsi_dphy>;
        phy-names = "dphy";
};

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/gpu/drm/rockchip/rockchip_rgb.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c
index 75eb7cca3d82..c725774a0f40 100644
--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c
@@ -8,6 +8,7 @@
 #include <linux/component.h>
 #include <linux/media-bus-format.h>
 #include <linux/of_graph.h>
+#include <linux/phy/phy.h>
 
 #include <drm/display/drm_dp_helper.h>
 #include <drm/drm_atomic_helper.h>
@@ -30,6 +31,7 @@ struct rockchip_rgb {
 	struct drm_bridge *bridge;
 	struct drm_encoder encoder;
 	struct drm_connector connector;
+	struct phy *dphy;
 	int output_mode;
 };
 
@@ -168,6 +170,22 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 		goto err_free_connector;
 	}
 
+	/* PHY */
+	rgb->dphy = devm_phy_get(dev, "dphy");
+	if (!IS_ERR(rgb->dphy)) {
+		ret = phy_init(rgb->dphy);
+		if (ret)
+			return ERR_PTR(ret);
+
+		ret = phy_set_mode(rgb->dphy, PHY_MODE_TTL);
+		if (ret)
+			return ERR_PTR(ret);
+
+		ret = phy_power_on(rgb->dphy);
+		if (ret)
+			return ERR_PTR(ret);
+	}
+
 	return rgb;
 
 err_free_connector:
-- 
2.34.1


WARNING: multiple messages have this Message-ID (diff)
From: Michael Trimarchi <michael@amarulasolutions.com>
To: "Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Kishon Vijay Abraham I <kishon@ti.com>,
	linux-rockchip@lists.infradead.org, Vinod Koul <vkoul@kernel.org>,
	linux-phy@lists.infradead.org,
	linux-amarula@amarulasolutions.com,
	linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 4/4] drm/rockchip: rgb: Add dphy connection to rgb output
Date: Sun,  2 Oct 2022 08:45:40 +0200	[thread overview]
Message-ID: <20221002064540.2500257-5-michael@amarulasolutions.com> (raw)
In-Reply-To: <20221002064540.2500257-1-michael@amarulasolutions.com>

Dispite the commit 1f0f015151727, the rgb output has an option
to allow to sent the output pin using the dsi/lvds/ttl logic.
The only way to do and stay on the same design is let the
rockchip_rgb block to grab the handle if it is present and
enable it. The present of this handle depends on dts configuration

I have a full working example with an hardware with mixed lines
on direct logic and using the phy, with the follow dts example:

panel: panel {
	compatible = "panel-dpi";
	...
	panel-timing {
		clock-frequency = <30000000>;
		...
	};

	port {
		panel_rgb_in: endpoint {
			remote-endpoint = <&vopb_out_rgb>;
		};
	};
};

&vopb_out {
        vopb_out_rgb: endpoint@2 {
                reg = <2>;
                remote-endpoint = <&panel_rgb_in>;
        };
};

&vopb {
        status = "okay";
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&lcdc_rgb_pins>;
        pinctrl-1 = <&lcdc_sleep_pins>;

        phys = <&dsi_dphy>;
        phy-names = "dphy";
};

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/gpu/drm/rockchip/rockchip_rgb.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c
index 75eb7cca3d82..c725774a0f40 100644
--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c
@@ -8,6 +8,7 @@
 #include <linux/component.h>
 #include <linux/media-bus-format.h>
 #include <linux/of_graph.h>
+#include <linux/phy/phy.h>
 
 #include <drm/display/drm_dp_helper.h>
 #include <drm/drm_atomic_helper.h>
@@ -30,6 +31,7 @@ struct rockchip_rgb {
 	struct drm_bridge *bridge;
 	struct drm_encoder encoder;
 	struct drm_connector connector;
+	struct phy *dphy;
 	int output_mode;
 };
 
@@ -168,6 +170,22 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 		goto err_free_connector;
 	}
 
+	/* PHY */
+	rgb->dphy = devm_phy_get(dev, "dphy");
+	if (!IS_ERR(rgb->dphy)) {
+		ret = phy_init(rgb->dphy);
+		if (ret)
+			return ERR_PTR(ret);
+
+		ret = phy_set_mode(rgb->dphy, PHY_MODE_TTL);
+		if (ret)
+			return ERR_PTR(ret);
+
+		ret = phy_power_on(rgb->dphy);
+		if (ret)
+			return ERR_PTR(ret);
+	}
+
 	return rgb;
 
 err_free_connector:
-- 
2.34.1


WARNING: multiple messages have this Message-ID (diff)
From: Michael Trimarchi <michael@amarulasolutions.com>
To: "Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-phy@lists.infradead.org,
	linux-amarula@amarulasolutions.com
Subject: [RFC PATCH 4/4] drm/rockchip: rgb: Add dphy connection to rgb output
Date: Sun,  2 Oct 2022 08:45:40 +0200	[thread overview]
Message-ID: <20221002064540.2500257-5-michael@amarulasolutions.com> (raw)
In-Reply-To: <20221002064540.2500257-1-michael@amarulasolutions.com>

Dispite the commit 1f0f015151727, the rgb output has an option
to allow to sent the output pin using the dsi/lvds/ttl logic.
The only way to do and stay on the same design is let the
rockchip_rgb block to grab the handle if it is present and
enable it. The present of this handle depends on dts configuration

I have a full working example with an hardware with mixed lines
on direct logic and using the phy, with the follow dts example:

panel: panel {
	compatible = "panel-dpi";
	...
	panel-timing {
		clock-frequency = <30000000>;
		...
	};

	port {
		panel_rgb_in: endpoint {
			remote-endpoint = <&vopb_out_rgb>;
		};
	};
};

&vopb_out {
        vopb_out_rgb: endpoint@2 {
                reg = <2>;
                remote-endpoint = <&panel_rgb_in>;
        };
};

&vopb {
        status = "okay";
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&lcdc_rgb_pins>;
        pinctrl-1 = <&lcdc_sleep_pins>;

        phys = <&dsi_dphy>;
        phy-names = "dphy";
};

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/gpu/drm/rockchip/rockchip_rgb.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c
index 75eb7cca3d82..c725774a0f40 100644
--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c
@@ -8,6 +8,7 @@
 #include <linux/component.h>
 #include <linux/media-bus-format.h>
 #include <linux/of_graph.h>
+#include <linux/phy/phy.h>
 
 #include <drm/display/drm_dp_helper.h>
 #include <drm/drm_atomic_helper.h>
@@ -30,6 +31,7 @@ struct rockchip_rgb {
 	struct drm_bridge *bridge;
 	struct drm_encoder encoder;
 	struct drm_connector connector;
+	struct phy *dphy;
 	int output_mode;
 };
 
@@ -168,6 +170,22 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 		goto err_free_connector;
 	}
 
+	/* PHY */
+	rgb->dphy = devm_phy_get(dev, "dphy");
+	if (!IS_ERR(rgb->dphy)) {
+		ret = phy_init(rgb->dphy);
+		if (ret)
+			return ERR_PTR(ret);
+
+		ret = phy_set_mode(rgb->dphy, PHY_MODE_TTL);
+		if (ret)
+			return ERR_PTR(ret);
+
+		ret = phy_power_on(rgb->dphy);
+		if (ret)
+			return ERR_PTR(ret);
+	}
+
 	return rgb;
 
 err_free_connector:
-- 
2.34.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

WARNING: multiple messages have this Message-ID (diff)
From: Michael Trimarchi <michael@amarulasolutions.com>
To: "Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-phy@lists.infradead.org,
	linux-amarula@amarulasolutions.com
Subject: [RFC PATCH 4/4] drm/rockchip: rgb: Add dphy connection to rgb output
Date: Sun,  2 Oct 2022 08:45:40 +0200	[thread overview]
Message-ID: <20221002064540.2500257-5-michael@amarulasolutions.com> (raw)
In-Reply-To: <20221002064540.2500257-1-michael@amarulasolutions.com>

Dispite the commit 1f0f015151727, the rgb output has an option
to allow to sent the output pin using the dsi/lvds/ttl logic.
The only way to do and stay on the same design is let the
rockchip_rgb block to grab the handle if it is present and
enable it. The present of this handle depends on dts configuration

I have a full working example with an hardware with mixed lines
on direct logic and using the phy, with the follow dts example:

panel: panel {
	compatible = "panel-dpi";
	...
	panel-timing {
		clock-frequency = <30000000>;
		...
	};

	port {
		panel_rgb_in: endpoint {
			remote-endpoint = <&vopb_out_rgb>;
		};
	};
};

&vopb_out {
        vopb_out_rgb: endpoint@2 {
                reg = <2>;
                remote-endpoint = <&panel_rgb_in>;
        };
};

&vopb {
        status = "okay";
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&lcdc_rgb_pins>;
        pinctrl-1 = <&lcdc_sleep_pins>;

        phys = <&dsi_dphy>;
        phy-names = "dphy";
};

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/gpu/drm/rockchip/rockchip_rgb.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c
index 75eb7cca3d82..c725774a0f40 100644
--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c
@@ -8,6 +8,7 @@
 #include <linux/component.h>
 #include <linux/media-bus-format.h>
 #include <linux/of_graph.h>
+#include <linux/phy/phy.h>
 
 #include <drm/display/drm_dp_helper.h>
 #include <drm/drm_atomic_helper.h>
@@ -30,6 +31,7 @@ struct rockchip_rgb {
 	struct drm_bridge *bridge;
 	struct drm_encoder encoder;
 	struct drm_connector connector;
+	struct phy *dphy;
 	int output_mode;
 };
 
@@ -168,6 +170,22 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 		goto err_free_connector;
 	}
 
+	/* PHY */
+	rgb->dphy = devm_phy_get(dev, "dphy");
+	if (!IS_ERR(rgb->dphy)) {
+		ret = phy_init(rgb->dphy);
+		if (ret)
+			return ERR_PTR(ret);
+
+		ret = phy_set_mode(rgb->dphy, PHY_MODE_TTL);
+		if (ret)
+			return ERR_PTR(ret);
+
+		ret = phy_power_on(rgb->dphy);
+		if (ret)
+			return ERR_PTR(ret);
+	}
+
 	return rgb;
 
 err_free_connector:
-- 
2.34.1


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

WARNING: multiple messages have this Message-ID (diff)
From: Michael Trimarchi <michael@amarulasolutions.com>
To: "Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-phy@lists.infradead.org,
	linux-amarula@amarulasolutions.com
Subject: [RFC PATCH 4/4] drm/rockchip: rgb: Add dphy connection to rgb output
Date: Sun,  2 Oct 2022 08:45:40 +0200	[thread overview]
Message-ID: <20221002064540.2500257-5-michael@amarulasolutions.com> (raw)
In-Reply-To: <20221002064540.2500257-1-michael@amarulasolutions.com>

Dispite the commit 1f0f015151727, the rgb output has an option
to allow to sent the output pin using the dsi/lvds/ttl logic.
The only way to do and stay on the same design is let the
rockchip_rgb block to grab the handle if it is present and
enable it. The present of this handle depends on dts configuration

I have a full working example with an hardware with mixed lines
on direct logic and using the phy, with the follow dts example:

panel: panel {
	compatible = "panel-dpi";
	...
	panel-timing {
		clock-frequency = <30000000>;
		...
	};

	port {
		panel_rgb_in: endpoint {
			remote-endpoint = <&vopb_out_rgb>;
		};
	};
};

&vopb_out {
        vopb_out_rgb: endpoint@2 {
                reg = <2>;
                remote-endpoint = <&panel_rgb_in>;
        };
};

&vopb {
        status = "okay";
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&lcdc_rgb_pins>;
        pinctrl-1 = <&lcdc_sleep_pins>;

        phys = <&dsi_dphy>;
        phy-names = "dphy";
};

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/gpu/drm/rockchip/rockchip_rgb.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c
index 75eb7cca3d82..c725774a0f40 100644
--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c
@@ -8,6 +8,7 @@
 #include <linux/component.h>
 #include <linux/media-bus-format.h>
 #include <linux/of_graph.h>
+#include <linux/phy/phy.h>
 
 #include <drm/display/drm_dp_helper.h>
 #include <drm/drm_atomic_helper.h>
@@ -30,6 +31,7 @@ struct rockchip_rgb {
 	struct drm_bridge *bridge;
 	struct drm_encoder encoder;
 	struct drm_connector connector;
+	struct phy *dphy;
 	int output_mode;
 };
 
@@ -168,6 +170,22 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 		goto err_free_connector;
 	}
 
+	/* PHY */
+	rgb->dphy = devm_phy_get(dev, "dphy");
+	if (!IS_ERR(rgb->dphy)) {
+		ret = phy_init(rgb->dphy);
+		if (ret)
+			return ERR_PTR(ret);
+
+		ret = phy_set_mode(rgb->dphy, PHY_MODE_TTL);
+		if (ret)
+			return ERR_PTR(ret);
+
+		ret = phy_power_on(rgb->dphy);
+		if (ret)
+			return ERR_PTR(ret);
+	}
+
 	return rgb;
 
 err_free_connector:
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-10-02  6:46 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-02  6:45 [RFC PATCH 0/4] Add RGB ttl connection on rockchip phy Michael Trimarchi
2022-10-02  6:45 ` Michael Trimarchi
2022-10-02  6:45 ` Michael Trimarchi
2022-10-02  6:45 ` Michael Trimarchi
2022-10-02  6:45 ` Michael Trimarchi
2022-10-02  6:45 ` [RFC PATCH 1/4] phy: add PHY_MODE_TTL Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45 ` [RFC PATCH 2/4] phy: rockchip: Add inno_is_valid_phy_mode Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2023-01-13 17:58   ` Vinod Koul
2023-01-13 17:58     ` Vinod Koul
2023-01-13 17:58     ` Vinod Koul
2023-01-13 17:58     ` Vinod Koul
2023-01-13 17:58     ` Vinod Koul
2022-10-02  6:45 ` [RFC PATCH 3/4] phy: rockchip: Implement TTY phy mode Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45 ` Michael Trimarchi [this message]
2022-10-02  6:45   ` [RFC PATCH 4/4] drm/rockchip: rgb: Add dphy connection to rgb output Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-10-02  6:45   ` Michael Trimarchi
2022-12-19 12:35 ` [RFC PATCH 0/4] Add RGB ttl connection on rockchip phy Michael Nazzareno Trimarchi
2022-12-19 12:35   ` Michael Nazzareno Trimarchi
2022-12-19 12:35   ` Michael Nazzareno Trimarchi
2022-12-19 12:35   ` Michael Nazzareno Trimarchi
2022-12-19 12:35   ` Michael Nazzareno Trimarchi

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=20221002064540.2500257-5-michael@amarulasolutions.com \
    --to=michael@amarulasolutions.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=kishon@ti.com \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=vkoul@kernel.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 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.