All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Zhong <zyw@rock-chips.com>
To: dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, mark.yao@rock-chips.com,
	groeck@chromium.org, seanpaul@chromium.org, zyw@rock-chips.com,
	David Airlie <airlied@linux.ie>, Heiko Stuebner <heiko@sntech.de>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v17 4/7] drm/rockchip: cdn-dp: do not use drm_helper_hpd_irq_event
Date: Sun,  5 Feb 2017 15:54:59 +0800	[thread overview]
Message-ID: <1486281302-28200-5-git-send-email-zyw@rock-chips.com> (raw)
In-Reply-To: <1486281302-28200-1-git-send-email-zyw@rock-chips.com>

The cdn_dp_pd_event_work is using drm_helper_hpd_irq_event to update the
connector status, this function is used to update all connectors of
drm_device. Therefore, the detect of other connector will be call, when
cdn_dp_pd_event_work is triggered, every time. It is not necessary, and
it may cause system crash. replace drm_helper_hpd_irq_event with
drm_kms_helper_hotplug_event, only update cdn-dp status.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
---

Changes in v17: None

 drivers/gpu/drm/rockchip/cdn-dp-core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index a70eedc..62e02a4 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -935,6 +935,9 @@ static void cdn_dp_pd_event_work(struct work_struct *work)
 {
 	struct cdn_dp_device *dp = container_of(work, struct cdn_dp_device,
 						event_work);
+	struct drm_connector *connector = &dp->connector;
+	enum drm_connector_status old_status;
+
 	int ret;
 	u8 sink_count;
 
@@ -997,7 +1000,11 @@ static void cdn_dp_pd_event_work(struct work_struct *work)
 
 out:
 	mutex_unlock(&dp->lock);
-	drm_helper_hpd_irq_event(dp->drm_dev);
+
+	old_status = connector->status;
+	connector->status = connector->funcs->detect(connector, false);
+	if (old_status != connector->status)
+		drm_kms_helper_hotplug_event(dp->drm_dev);
 }
 
 static int cdn_dp_pd_event(struct notifier_block *nb,
-- 
2.6.3

WARNING: multiple messages have this Message-ID (diff)
From: Chris Zhong <zyw@rock-chips.com>
To: dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, zyw@rock-chips.com,
	groeck@chromium.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v17 4/7] drm/rockchip: cdn-dp: do not use drm_helper_hpd_irq_event
Date: Sun,  5 Feb 2017 15:54:59 +0800	[thread overview]
Message-ID: <1486281302-28200-5-git-send-email-zyw@rock-chips.com> (raw)
In-Reply-To: <1486281302-28200-1-git-send-email-zyw@rock-chips.com>

The cdn_dp_pd_event_work is using drm_helper_hpd_irq_event to update the
connector status, this function is used to update all connectors of
drm_device. Therefore, the detect of other connector will be call, when
cdn_dp_pd_event_work is triggered, every time. It is not necessary, and
it may cause system crash. replace drm_helper_hpd_irq_event with
drm_kms_helper_hotplug_event, only update cdn-dp status.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
---

Changes in v17: None

 drivers/gpu/drm/rockchip/cdn-dp-core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index a70eedc..62e02a4 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -935,6 +935,9 @@ static void cdn_dp_pd_event_work(struct work_struct *work)
 {
 	struct cdn_dp_device *dp = container_of(work, struct cdn_dp_device,
 						event_work);
+	struct drm_connector *connector = &dp->connector;
+	enum drm_connector_status old_status;
+
 	int ret;
 	u8 sink_count;
 
@@ -997,7 +1000,11 @@ static void cdn_dp_pd_event_work(struct work_struct *work)
 
 out:
 	mutex_unlock(&dp->lock);
-	drm_helper_hpd_irq_event(dp->drm_dev);
+
+	old_status = connector->status;
+	connector->status = connector->funcs->detect(connector, false);
+	if (old_status != connector->status)
+		drm_kms_helper_hotplug_event(dp->drm_dev);
 }
 
 static int cdn_dp_pd_event(struct notifier_block *nb,
-- 
2.6.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: zyw@rock-chips.com (Chris Zhong)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v17 4/7] drm/rockchip: cdn-dp: do not use drm_helper_hpd_irq_event
Date: Sun,  5 Feb 2017 15:54:59 +0800	[thread overview]
Message-ID: <1486281302-28200-5-git-send-email-zyw@rock-chips.com> (raw)
In-Reply-To: <1486281302-28200-1-git-send-email-zyw@rock-chips.com>

The cdn_dp_pd_event_work is using drm_helper_hpd_irq_event to update the
connector status, this function is used to update all connectors of
drm_device. Therefore, the detect of other connector will be call, when
cdn_dp_pd_event_work is triggered, every time. It is not necessary, and
it may cause system crash. replace drm_helper_hpd_irq_event with
drm_kms_helper_hotplug_event, only update cdn-dp status.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
---

Changes in v17: None

 drivers/gpu/drm/rockchip/cdn-dp-core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index a70eedc..62e02a4 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -935,6 +935,9 @@ static void cdn_dp_pd_event_work(struct work_struct *work)
 {
 	struct cdn_dp_device *dp = container_of(work, struct cdn_dp_device,
 						event_work);
+	struct drm_connector *connector = &dp->connector;
+	enum drm_connector_status old_status;
+
 	int ret;
 	u8 sink_count;
 
@@ -997,7 +1000,11 @@ static void cdn_dp_pd_event_work(struct work_struct *work)
 
 out:
 	mutex_unlock(&dp->lock);
-	drm_helper_hpd_irq_event(dp->drm_dev);
+
+	old_status = connector->status;
+	connector->status = connector->funcs->detect(connector, false);
+	if (old_status != connector->status)
+		drm_kms_helper_hotplug_event(dp->drm_dev);
 }
 
 static int cdn_dp_pd_event(struct notifier_block *nb,
-- 
2.6.3

  parent reply	other threads:[~2017-02-05  7:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-05  7:54 [PATCH v17 0/7] drm/rockchip: Add CDN DP driver Chris Zhong
2017-02-05  7:54 ` Chris Zhong
2017-02-05  7:54 ` Chris Zhong
2017-02-05  7:54 ` [PATCH v17 1/7] drm/rockchip: cdn-dp: add cdn DP support for rk3399 Chris Zhong
2017-02-05  7:54   ` Chris Zhong
2017-02-05  7:54   ` Chris Zhong
2017-02-05  7:54 ` [PATCH v17 2/7] drm/rockchip: cdn-dp: Load firmware if no monitor connected Chris Zhong
2017-02-05  7:54   ` Chris Zhong
2017-02-05  7:54   ` Chris Zhong
2017-02-05  7:54 ` [PATCH v17 3/7] drm/rockchip: cdn-dp: Do not run worker while suspended Chris Zhong
2017-02-05  7:54   ` Chris Zhong
2017-02-05  7:54   ` Chris Zhong
2017-02-05  7:54 ` Chris Zhong [this message]
2017-02-05  7:54   ` [PATCH v17 4/7] drm/rockchip: cdn-dp: do not use drm_helper_hpd_irq_event Chris Zhong
2017-02-05  7:54   ` Chris Zhong
2017-02-05  7:55 ` [PATCH v17 5/7] drm/rockchip: cdn-dp: Move mutex_init to probe Chris Zhong
2017-02-05  7:55   ` Chris Zhong
2017-02-05  7:55   ` Chris Zhong
2017-02-05  7:55 ` [PATCH v17 6/7] drm/rockchip: cdn-dp: retry to check sink count Chris Zhong
2017-02-05  7:55   ` Chris Zhong
2017-02-05  7:55   ` Chris Zhong
2017-02-05  7:55 ` [PATCH v17 7/7] drm/rockchip: cdn-dp: don't configure hardware in mode_set Chris Zhong
2017-02-05  7:55   ` Chris Zhong
2017-02-05  8:42 ` [PATCH v17 0/7] drm/rockchip: Add CDN DP driver Mark yao
2017-02-05  8:42   ` Mark yao
2017-02-05  8:42   ` Mark yao

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=1486281302-28200-5-git-send-email-zyw@rock-chips.com \
    --to=zyw@rock-chips.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=groeck@chromium.org \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.yao@rock-chips.com \
    --cc=seanpaul@chromium.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.