2022-04-12 23:03:05

by Jayshri Pawar

[permalink] [raw]
Subject: [PATCH] drm/bridge: cdns-dsi: Add support for pre_enable and post_enable control functions.

From: jpawar <[email protected]>

Add support for pre_enable and post_enable drm bridge control functions.
Making sure that host to be prepared before panel is powered up,
for the panels like TC358762.

Signed-off-by: jpawar <[email protected]>
---
drivers/gpu/drm/bridge/cdns-dsi.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cdns-dsi.c
index 829e1a144656..20bece84ff8c 100644
--- a/drivers/gpu/drm/bridge/cdns-dsi.c
+++ b/drivers/gpu/drm/bridge/cdns-dsi.c
@@ -462,6 +462,7 @@ struct cdns_dsi {
struct reset_control *dsi_p_rst;
struct clk *dsi_sys_clk;
bool link_initialized;
+ bool phy_initialized;
struct phy *dphy;
};

@@ -711,11 +712,21 @@ static void cdns_dsi_bridge_disable(struct drm_bridge *bridge)
pm_runtime_put(dsi->base.dev);
}

+static void cdns_dsi_bridge_post_disable(struct drm_bridge *bridge)
+{
+ struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
+ struct cdns_dsi *dsi = input_to_dsi(input);
+
+ pm_runtime_put(dsi->base.dev);
+}
+
static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
{
struct cdns_dsi_output *output = &dsi->output;
u32 status;

+ if (dsi->phy_initialized)
+ return;
/*
* Power all internal DPHY blocks down and maintain their reset line
* asserted before changing the DPHY config.
@@ -739,6 +750,7 @@ static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
writel(DPHY_CMN_PSO | DPHY_ALL_D_PDN | DPHY_C_PDN | DPHY_CMN_PDN |
DPHY_D_RSTB(output->dev->lanes) | DPHY_C_RSTB,
dsi->regs + MCTL_DPHY_CFG0);
+ dsi->phy_initialized = true;
}

static void cdns_dsi_init_link(struct cdns_dsi *dsi)
@@ -914,11 +926,25 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)
writel(tmp, dsi->regs + MCTL_MAIN_EN);
}

+static void cdns_dsi_bridge_pre_enable(struct drm_bridge *bridge)
+{
+ struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
+ struct cdns_dsi *dsi = input_to_dsi(input);
+
+ if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
+ return;
+
+ cdns_dsi_init_link(dsi);
+ cdns_dsi_hs_init(dsi);
+}
+
static const struct drm_bridge_funcs cdns_dsi_bridge_funcs = {
.attach = cdns_dsi_bridge_attach,
.mode_valid = cdns_dsi_bridge_mode_valid,
.disable = cdns_dsi_bridge_disable,
+ .pre_enable = cdns_dsi_bridge_pre_enable,
.enable = cdns_dsi_bridge_enable,
+ .post_disable = cdns_dsi_bridge_post_disable,
};

static int cdns_dsi_attach(struct mipi_dsi_host *host,
--
2.30.2


2022-05-11 13:23:15

by Robert Foss

[permalink] [raw]
Subject: Re: [PATCH] drm/bridge: cdns-dsi: Add support for pre_enable and post_enable control functions.

On Mon, 11 Apr 2022 at 16:07, Jayshri Pawar <[email protected]> wrote:
>
> From: jpawar <[email protected]>

This should be "Jayshri Pawar <[email protected]>"

>
> Add support for pre_enable and post_enable drm bridge control functions.
> Making sure that host to be prepared before panel is powered up,
> for the panels like TC358762.
>
> Signed-off-by: jpawar <[email protected]>

Again, your full name should be used.

> ---
> drivers/gpu/drm/bridge/cdns-dsi.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cdns-dsi.c
> index 829e1a144656..20bece84ff8c 100644
> --- a/drivers/gpu/drm/bridge/cdns-dsi.c
> +++ b/drivers/gpu/drm/bridge/cdns-dsi.c
> @@ -462,6 +462,7 @@ struct cdns_dsi {
> struct reset_control *dsi_p_rst;
> struct clk *dsi_sys_clk;
> bool link_initialized;
> + bool phy_initialized;
> struct phy *dphy;
> };
>
> @@ -711,11 +712,21 @@ static void cdns_dsi_bridge_disable(struct drm_bridge *bridge)
> pm_runtime_put(dsi->base.dev);
> }
>
> +static void cdns_dsi_bridge_post_disable(struct drm_bridge *bridge)
> +{
> + struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
> + struct cdns_dsi *dsi = input_to_dsi(input);
> +
> + pm_runtime_put(dsi->base.dev);
> +}
> +
> static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
> {
> struct cdns_dsi_output *output = &dsi->output;
> u32 status;
>
> + if (dsi->phy_initialized)
> + return;
> /*
> * Power all internal DPHY blocks down and maintain their reset line
> * asserted before changing the DPHY config.
> @@ -739,6 +750,7 @@ static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
> writel(DPHY_CMN_PSO | DPHY_ALL_D_PDN | DPHY_C_PDN | DPHY_CMN_PDN |
> DPHY_D_RSTB(output->dev->lanes) | DPHY_C_RSTB,
> dsi->regs + MCTL_DPHY_CFG0);
> + dsi->phy_initialized = true;
> }
>
> static void cdns_dsi_init_link(struct cdns_dsi *dsi)
> @@ -914,11 +926,25 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)
> writel(tmp, dsi->regs + MCTL_MAIN_EN);
> }
>
> +static void cdns_dsi_bridge_pre_enable(struct drm_bridge *bridge)
> +{
> + struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
> + struct cdns_dsi *dsi = input_to_dsi(input);
> +
> + if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
> + return;
> +
> + cdns_dsi_init_link(dsi);
> + cdns_dsi_hs_init(dsi);
> +}
> +
> static const struct drm_bridge_funcs cdns_dsi_bridge_funcs = {
> .attach = cdns_dsi_bridge_attach,
> .mode_valid = cdns_dsi_bridge_mode_valid,
> .disable = cdns_dsi_bridge_disable,
> + .pre_enable = cdns_dsi_bridge_pre_enable,
> .enable = cdns_dsi_bridge_enable,
> + .post_disable = cdns_dsi_bridge_post_disable,
> };
>
> static int cdns_dsi_attach(struct mipi_dsi_host *host,

Cadence seems to have DKIM mail server failure, which is preventing b4
from importing this patch. Log attached below.

I've manually fixed this author string issues.

Reviewed-by: Robert Foss <[email protected]>

Applied to drm-misc-next.


----

Checking attestation on all messages, may take a moment...
Traceback (most recent call last):
File "/usr/bin/b4", line 33, in <module>
sys.exit(load_entry_point('b4==0.8.0', 'console_scripts', 'b4')())
File "/usr/lib/python3/dist-packages/b4/command.py", line 246, in cmd
cmdargs.func(cmdargs)
File "/usr/lib/python3/dist-packages/b4/command.py", line 51, in cmd_am
b4.mbox.main(cmdargs)
File "/usr/lib/python3/dist-packages/b4/mbox.py", line 593, in main
make_am(msgs, cmdargs, msgid)
File "/usr/lib/python3/dist-packages/b4/mbox.py", line 92, in make_am
am_msgs = lser.get_am_ready(noaddtrailers=cmdargs.noaddtrailers,
File "/usr/lib/python3/dist-packages/b4/__init__.py", line 523, in
get_am_ready
checkmark, trailers, attcrit =
lmsg.get_attestation_trailers(attpolicy, maxdays)
File "/usr/lib/python3/dist-packages/b4/__init__.py", line 1173, in
get_attestation_trailers
for attestor in self.attestors:
File "/usr/lib/python3/dist-packages/b4/__init__.py", line 1028, in attestors
self._load_dkim_attestors()
File "/usr/lib/python3/dist-packages/b4/__init__.py", line 1071, in
_load_dkim_attestors
res = dkim.verify(self.msg.as_bytes(), logger=dkimlogger)
File "/usr/lib/python3/dist-packages/dkim/__init__.py", line 1352, in verify
return d.verify(dnsfunc=dnsfunc)
File "/usr/lib/python3/dist-packages/dkim/__init__.py", line 940, in verify
return self.verify_sig(sig, include_headers, sigheaders[idx], dnsfunc)
File "/usr/lib/python3/dist-packages/dkim/__init__.py", line 773, in
verify_sig
self.pk, self.keysize, self.ktag, self.seqtlsrpt = load_pk_from_dns(name,
File "/usr/lib/python3/dist-packages/dkim/__init__.py", line 481, in
load_pk_from_dns
s = dnsfunc(name, timeout=timeout)
File "/usr/lib/python3/dist-packages/dkim/dnsplug.py", line 88, in get_txt
txt = _get_txt(unicode_name, timeout)
File "/usr/lib/python3/dist-packages/dkim/dnsplug.py", line 31, in
get_txt_dnspython
a = dns.resolver.query(name,
dns.rdatatype.TXT,raise_on_no_answer=False, lifetime=timeout)
File "/usr/lib/python3/dist-packages/dns/resolver.py", line 1321, in query
return resolve(qname, rdtype, rdclass, tcp, source,
File "/usr/lib/python3/dist-packages/dns/resolver.py", line 1305, in resolve
return get_default_resolver().resolve(qname, rdtype, rdclass, tcp, source,
File "/usr/lib/python3/dist-packages/dns/resolver.py", line 1176, in resolve
timeout = self._compute_timeout(start, lifetime)
File "/usr/lib/python3/dist-packages/dns/resolver.py", line 997, in
_compute_timeout
raise Timeout(timeout=duration)
dns.exception.Timeout: The DNS operation timed out after
5.402302026748657 seconds

2022-05-11 18:03:25

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] drm/bridge: cdns-dsi: Add support for pre_enable and post_enable control functions.

Hi Jayshri,

Thank you for the patch.

On Mon, Apr 11, 2022 at 04:06:06PM +0200, Jayshri Pawar wrote:
> From: jpawar <[email protected]>
>
> Add support for pre_enable and post_enable drm bridge control functions.
> Making sure that host to be prepared before panel is powered up,
> for the panels like TC358762.
>
> Signed-off-by: jpawar <[email protected]>
> ---
> drivers/gpu/drm/bridge/cdns-dsi.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cdns-dsi.c
> index 829e1a144656..20bece84ff8c 100644
> --- a/drivers/gpu/drm/bridge/cdns-dsi.c
> +++ b/drivers/gpu/drm/bridge/cdns-dsi.c
> @@ -462,6 +462,7 @@ struct cdns_dsi {
> struct reset_control *dsi_p_rst;
> struct clk *dsi_sys_clk;
> bool link_initialized;
> + bool phy_initialized;
> struct phy *dphy;
> };
>
> @@ -711,11 +712,21 @@ static void cdns_dsi_bridge_disable(struct drm_bridge *bridge)
> pm_runtime_put(dsi->base.dev);
> }
>
> +static void cdns_dsi_bridge_post_disable(struct drm_bridge *bridge)
> +{
> + struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
> + struct cdns_dsi *dsi = input_to_dsi(input);
> +
> + pm_runtime_put(dsi->base.dev);
> +}
> +
> static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
> {
> struct cdns_dsi_output *output = &dsi->output;
> u32 status;
>
> + if (dsi->phy_initialized)
> + return;
> /*
> * Power all internal DPHY blocks down and maintain their reset line
> * asserted before changing the DPHY config.
> @@ -739,6 +750,7 @@ static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
> writel(DPHY_CMN_PSO | DPHY_ALL_D_PDN | DPHY_C_PDN | DPHY_CMN_PDN |
> DPHY_D_RSTB(output->dev->lanes) | DPHY_C_RSTB,
> dsi->regs + MCTL_DPHY_CFG0);
> + dsi->phy_initialized = true;
> }
>
> static void cdns_dsi_init_link(struct cdns_dsi *dsi)
> @@ -914,11 +926,25 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)
> writel(tmp, dsi->regs + MCTL_MAIN_EN);
> }
>
> +static void cdns_dsi_bridge_pre_enable(struct drm_bridge *bridge)
> +{
> + struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
> + struct cdns_dsi *dsi = input_to_dsi(input);
> +
> + if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))

This should use pm_runtime_resume_and_get(), otherwise you need to call
pm_runtime_put_noidle() on failure.

> + return;
> +
> + cdns_dsi_init_link(dsi);
> + cdns_dsi_hs_init(dsi);
> +}
> +
> static const struct drm_bridge_funcs cdns_dsi_bridge_funcs = {
> .attach = cdns_dsi_bridge_attach,
> .mode_valid = cdns_dsi_bridge_mode_valid,
> .disable = cdns_dsi_bridge_disable,
> + .pre_enable = cdns_dsi_bridge_pre_enable,
> .enable = cdns_dsi_bridge_enable,
> + .post_disable = cdns_dsi_bridge_post_disable,
> };
>
> static int cdns_dsi_attach(struct mipi_dsi_host *host,

--
Regards,

Laurent Pinchart