From patchwork Tue Dec 22 14:21:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 7904841 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A0F089F349 for ; Tue, 22 Dec 2015 14:21:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B06EF204D1 for ; Tue, 22 Dec 2015 14:21:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C4C13204CF for ; Tue, 22 Dec 2015 14:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752627AbbLVOVd (ORCPT ); Tue, 22 Dec 2015 09:21:33 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38754 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751720AbbLVOVc (ORCPT ); Tue, 22 Dec 2015 09:21:32 -0500 Received: by mail-wm0-f47.google.com with SMTP id l126so113579050wml.1; Tue, 22 Dec 2015 06:21:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=grB3A/1vXfztui+jheRttub6B11rECMhogBKvh2nNRc=; b=sd0hj2tvvbnxdNWpVbaKwdB/Vecr7kFi/xFtZMBjU2Vl+Z2JVA1oP2zg75XoQEs756 9JPlr+ZEE7pX1U1kRCXcGpL9aW6taTuqM7Uk5zZoLZfSn0c6lSMsi0S2Pf20T63yh2/Y 3arYW1idlcQZng8e4u8PqRMbcJ46WUPlQE7YA2PzT2dMtX3VL0moLBCCPAH3xOAEgkRw 2VE2zBAayrMo76qfeJOrv3vWCnyqiso/HA6xXUfto9kDbQaB1hz+Iwf4Kyz8Le86fQNy G+mxN3OkIoONB8q2e9Wpl9XGjcPwA5We5oa3K60b9eRL36XQQgWMQbGk33xFthuwLUIl brRQ== X-Received: by 10.194.20.2 with SMTP id j2mr28775595wje.46.1450794091035; Tue, 22 Dec 2015 06:21:31 -0800 (PST) Received: from groucho.site (ip9234e209.dynamic.kabel-deutschland.de. [146.52.226.9]) by smtp.gmail.com with ESMTPSA id h5sm33225661wjz.21.2015.12.22.06.21.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Dec 2015 06:21:29 -0800 (PST) From: Ulrich Hecht To: linux-media@vger.kernel.org, linux-sh@vger.kernel.org Cc: magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com, hans.verkuil@cisco.com, ian.molton@codethink.co.uk, lars@metafoo.de, william.towle@codethink.co.uk, Ulrich Hecht Subject: [PATCH v2] adv7604: add direct interrupt handling Date: Tue, 22 Dec 2015 15:21:27 +0100 Message-Id: <1450794087-31153-1-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.6.3 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When probed from device tree, the i2c client driver can handle the interrupt on its own. Signed-off-by: Ulrich Hecht Reviewed-by: Laurent Pinchart --- This revision implements the suggested style changes and drops the IRQF_TRIGGER_LOW flag, which is handled in the device tree. CU Uli drivers/media/i2c/adv7604.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 5bd81bd..be5980c 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -1971,6 +1972,16 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 status, bool *handled) return 0; } +static irqreturn_t adv76xx_irq_handler(int irq, void *devid) +{ + struct adv76xx_state *state = devid; + bool handled; + + adv76xx_isr(&state->sd, 0, &handled); + + return handled ? IRQ_HANDLED : IRQ_NONE; +} + static int adv76xx_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) { struct adv76xx_state *state = to_state(sd); @@ -2844,8 +2855,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state) state->pdata.op_656_range = 1; } - /* Disable the interrupt for now as no DT-based board uses it. */ - state->pdata.int1_config = ADV76XX_INT1_CONFIG_DISABLED; + state->pdata.int1_config = ADV76XX_INT1_CONFIG_ACTIVE_LOW; /* Use the default I2C addresses. */ state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42; @@ -3235,6 +3245,16 @@ static int adv76xx_probe(struct i2c_client *client, v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, client->addr << 1, client->adapter->name); + if (client->irq) { + err = devm_request_threaded_irq(&client->dev, + client->irq, + NULL, adv76xx_irq_handler, + IRQF_ONESHOT, + dev_name(&client->dev), state); + if (err) + goto err_entity; + } + err = v4l2_async_register_subdev(sd); if (err) goto err_entity;