dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Brian Starkey <brian.starkey@arm.com>
To: Russell King <rmk+kernel@armlinux.org.uk>
Cc: dri-devel@lists.freedesktop.org,
	Liviu Dudau <Liviu.Dudau@arm.com>,
	linux-arm-kernel@lists.infradead.org, Jyri Sarha <jsarha@ti.com>
Subject: Re: [PATCH 1/2] drm/i2c: tda998x: allow interrupt to be shared
Date: Thu, 17 Nov 2016 12:24:57 +0000	[thread overview]
Message-ID: <20161117122457.GC21156@e106950-lin.cambridge.arm.com> (raw)
In-Reply-To: <E1c6xls-0006wf-Jg@rmk-PC.armlinux.org.uk>

Hi Russell,

On Wed, Nov 16, 2016 at 10:48:52AM +0000, Russell King wrote:
>The TDA998x contains two different I2C devices - there is the HDMI
>encoder, and the TDA9950 CEC engine.  These two share the same interrupt
>signal.
>
>In order to allow a driver for the CEC engine to work, we need to be
>able to share the interrupt with the CEC driver, so convert the handler
>and registration to allow this to happen.
>
>Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
>---
>This patch follows on from:
>   "drm/i2c: tda998x: power down pre-filter and color conversion"
>which is now part of my drm-tda998x-devel branch, a branch which will
>shortly be part of linux-next.  This patch and the following patch are
>not part of that branch yet.
>
>I don't believe I received any testing for the power-down patch above
>either, so if I can have some tested-bys/reviewed-bys for it and these
>two patches, that'd be great.  Thanks.

I tested these two and the power-down one on mali-dp and hdlcd. The
output, hotplugging and EDID continued to work; so you can have my
tested-by and reviewed-by for all 3.

Cheers,
Brian

>
>As my Juno has now been fixed, I've been able to test these two patches
>on the HDLCD on Juno and Dove Cubox.
>
> drivers/gpu/drm/i2c/tda998x_drv.c | 52 ++++++++++++++++++++-------------------
> 1 file changed, 27 insertions(+), 25 deletions(-)
>
>diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
>index bf5eec0c1b4f..74fb59a35269 100644
>--- a/drivers/gpu/drm/i2c/tda998x_drv.c
>+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
>@@ -634,28 +634,30 @@ static irqreturn_t tda998x_irq_thread(int irq, void *data)
> 	bool handled = false;
>
> 	sta = cec_read(priv, REG_CEC_INTSTATUS);
>-	cec = cec_read(priv, REG_CEC_RXSHPDINT);
>-	lvl = cec_read(priv, REG_CEC_RXSHPDLEV);
>-	flag0 = reg_read(priv, REG_INT_FLAGS_0);
>-	flag1 = reg_read(priv, REG_INT_FLAGS_1);
>-	flag2 = reg_read(priv, REG_INT_FLAGS_2);
>-	DRM_DEBUG_DRIVER(
>-		"tda irq sta %02x cec %02x lvl %02x f0 %02x f1 %02x f2 %02x\n",
>-		sta, cec, lvl, flag0, flag1, flag2);
>-
>-	if (cec & CEC_RXSHPDINT_HPD) {
>-		if (lvl & CEC_RXSHPDLEV_HPD)
>-			tda998x_edid_delay_start(priv);
>-		else
>-			schedule_work(&priv->detect_work);
>-
>-		handled = true;
>-	}
>+	if (sta & CEC_INTSTATUS_HDMI) {
>+		cec = cec_read(priv, REG_CEC_RXSHPDINT);
>+		lvl = cec_read(priv, REG_CEC_RXSHPDLEV);
>+		flag0 = reg_read(priv, REG_INT_FLAGS_0);
>+		flag1 = reg_read(priv, REG_INT_FLAGS_1);
>+		flag2 = reg_read(priv, REG_INT_FLAGS_2);
>+		DRM_DEBUG_DRIVER(
>+			"tda irq sta %02x cec %02x lvl %02x f0 %02x f1 %02x f2 %02x\n",
>+			sta, cec, lvl, flag0, flag1, flag2);
>+
>+		if (cec & CEC_RXSHPDINT_HPD) {
>+			if (lvl & CEC_RXSHPDLEV_HPD)
>+				tda998x_edid_delay_start(priv);
>+			else
>+				schedule_work(&priv->detect_work);
>+
>+			handled = true;
>+		}
>
>-	if ((flag2 & INT_FLAGS_2_EDID_BLK_RD) && priv->wq_edid_wait) {
>-		priv->wq_edid_wait = 0;
>-		wake_up(&priv->wq_edid);
>-		handled = true;
>+		if ((flag2 & INT_FLAGS_2_EDID_BLK_RD) && priv->wq_edid_wait) {
>+			priv->wq_edid_wait = 0;
>+			wake_up(&priv->wq_edid);
>+			handled = true;
>+		}
> 	}
>
> 	return IRQ_RETVAL(handled);
>@@ -1542,7 +1544,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
>
> 	/* initialize the optional IRQ */
> 	if (client->irq) {
>-		int irqf_trigger;
>+		unsigned long irq_flags;
>
> 		/* init read EDID waitqueue and HDP work */
> 		init_waitqueue_head(&priv->wq_edid);
>@@ -1552,11 +1554,11 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
> 		reg_read(priv, REG_INT_FLAGS_1);
> 		reg_read(priv, REG_INT_FLAGS_2);
>
>-		irqf_trigger =
>+		irq_flags =
> 			irqd_get_trigger_type(irq_get_irq_data(client->irq));
>+		irq_flags |= IRQF_SHARED | IRQF_ONESHOT;
> 		ret = request_threaded_irq(client->irq, NULL,
>-					   tda998x_irq_thread,
>-					   irqf_trigger | IRQF_ONESHOT,
>+					   tda998x_irq_thread, irq_flags,
> 					   "tda998x", priv);
> 		if (ret) {
> 			dev_err(&client->dev,
>-- 
>2.7.4
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-11-17 12:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16 10:48 [PATCH 1/2] drm/i2c: tda998x: allow interrupt to be shared Russell King
2016-11-17 12:24 ` Brian Starkey [this message]
2016-11-17 16:38   ` Russell King - ARM Linux

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=20161117122457.GC21156@e106950-lin.cambridge.arm.com \
    --to=brian.starkey@arm.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsarha@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /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 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).