From patchwork Thu Jul 18 22:41:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Alves X-Patchwork-Id: 19323 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Uzwtq-0006Fo-Cg; Fri, 19 Jul 2013 00:42:14 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-8) with esmtp id 1Uzwto-0001Fc-jU; Fri, 19 Jul 2013 00:42:14 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759220Ab3GRWmH (ORCPT + 1 other); Thu, 18 Jul 2013 18:42:07 -0400 Received: from mail-wg0-f47.google.com ([74.125.82.47]:40371 "EHLO mail-wg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759112Ab3GRWmE (ORCPT ); Thu, 18 Jul 2013 18:42:04 -0400 Received: by mail-wg0-f47.google.com with SMTP id l18so3428906wgh.14 for ; Thu, 18 Jul 2013 15:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=rbO7I02QDICkMpAWk5lHifuh4/ZyrcKHq1JAtGALiJU=; b=WCu67uVnJtsrI1hgyiDw1XHqMWP/20wwqHd7/ANazemex9Eh5xLDJXfVxfJ8TTKUSV pobcG6uRmGG5t7isEy4xT8oji5FAHYwdZV1Ctib0sX5n88d1RgDfE7UKmUDznLBo0J2n XfDWU7ViK/Ag28DQk/L++YyTSM1i5xC/io9TpVe5eluD7GC8ioh+QjJmMqZh7/qN5n1D oPkF8u5mULEIpNBc4o7RUW0b83+FzCnVBDOJUrGAj5sI8KcUH87cep7a8i8gVbTKwLGe to4mhIWnYT2cpDVJdeuF5xd6vBbus6UDqv49YB2HnlEtq9ykHOv7VZ5ceFr6IW4vNMs7 yJIA== X-Received: by 10.180.74.232 with SMTP id x8mr20603081wiv.48.1374187323527; Thu, 18 Jul 2013 15:42:03 -0700 (PDT) Received: from xsys-lnx.lan (a89-152-208-145.cpe.netcabo.pt. [89.152.208.145]) by mx.google.com with ESMTPSA id u9sm19490390wif.6.2013.07.18.15.42.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Jul 2013 15:42:02 -0700 (PDT) From: Luis Alves To: linux-media@vger.kernel.org Cc: mchehab@infradead.org, crope@iki.fi, awalls@md.metrocast.net, Luis Alves Subject: [PATCH] cx23885[v2]: Fix IR interrupt storm. Date: Thu, 18 Jul 2013 23:41:57 +0100 Message-Id: <1374187317-4970-1-git-send-email-ljalvs@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.7.18.223028 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, ECARD_WORD 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' Hi all, This path is meant to be up-streamed. Andy has a nice explanation for the interrupt storm when enabling the IR interrupt: The flatiron core (the audio adc) signals the end of its self-test with an interrupt. Since the flatiron irq seems OR-wired with the IR irq the result is this interrupt storm. This i2c tranfers will clear the flatiron interrupts - the left and right channels self-tests. Also as suggested by Andy I moved the i2c transfers to the cx23885 av core interrupt handling worker. If any spurious interrupt happens we silence them. The flatiron has some dedicated register read/write functions but are not exported so Antti just suggested to call the i2c_transfer directly. Tested in the TBS6981 Dual DVB-S2 card. PS: I've found this i2c_transfers in TBS media tree, more precisely in the cx23885-i2c.c file. Regards, Luis Signed-off-by: Luis Alves --- drivers/media/pci/cx23885/cx23885-av.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/media/pci/cx23885/cx23885-av.c b/drivers/media/pci/cx23885/cx23885-av.c index e958a01..d33570f 100644 --- a/drivers/media/pci/cx23885/cx23885-av.c +++ b/drivers/media/pci/cx23885/cx23885-av.c @@ -29,8 +29,25 @@ void cx23885_av_work_handler(struct work_struct *work) struct cx23885_dev *dev = container_of(work, struct cx23885_dev, cx25840_work); bool handled; + char buffer[2]; + struct i2c_msg msg = { + .addr = 0x98 >> 1, + .flags = 0, + .len = 2, + .buf = buffer, + }; v4l2_subdev_call(dev->sd_cx25840, core, interrupt_service_routine, PCI_MSK_AV_CORE, &handled); + + if (!handled) { + /* clear any pending flatiron interrupts */ + buffer[0] = 0x1f; + buffer[1] = 0x80; + i2c_transfer(&dev->i2c_bus[2].i2c_adap, &msg, 1); + buffer[0] = 0x23; + i2c_transfer(&dev->i2c_bus[2].i2c_adap, &msg, 1); + } + cx23885_irq_enable(dev, PCI_MSK_AV_CORE); }