From patchwork Thu Feb 6 19:59:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hogan X-Patchwork-Id: 3598221 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7CCE79F2F5 for ; Thu, 6 Feb 2014 20:00:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A89D720131 for ; Thu, 6 Feb 2014 20:00:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C641920114 for ; Thu, 6 Feb 2014 20:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757027AbaBFUAa (ORCPT ); Thu, 6 Feb 2014 15:00:30 -0500 Received: from mail-wi0-f174.google.com ([209.85.212.174]:39328 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756997AbaBFUAB (ORCPT ); Thu, 6 Feb 2014 15:00:01 -0500 Received: by mail-wi0-f174.google.com with SMTP id f8so181701wiw.13 for ; Thu, 06 Feb 2014 12:00:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LjJc5+qTgWqBfef8jxVX+bIr1ofxG6TJw6QAg8rzZso=; b=NVYTOpDjXdFkYSj8eUUwje1Vf3tICSPLnLurWOEc0jR1nYnaVGBYhsKYaCRdMk0xbQ cGznv+Yz0VJE0Uq2gG1SWjjI/nu9VsIwRN6kWCU3T6wrITLYtOniCjz9GEu8hyg+qLBL hj9pS85RQm1UyE1iIrJwzumI1l99aoDG0AMYSVOhu8V0deA7jkgy8WwOJDChqMoFfDBJ P1xVYrlXRaHEoRIDJhZ2+difdu9lHpTSF0gv4QPvlSLjnTz99dh+Sd06RKOq3rdohkcS R628T/wJWSpurxjCJBuhGKTE7kA5PXSh4nwVuQib9VnWdwzd8TQ1oKmxEbGPzFuLdLsG eiDA== X-Gm-Message-State: ALoCoQn0U3XLtOihxzc7iZJOBg7U+9oRDOv5peNvV+Ff3rnV2ByjYwlQ5LbG0yvHOlkqOE1u2nUn X-Received: by 10.181.13.11 with SMTP id eu11mr880397wid.30.1391716800846; Thu, 06 Feb 2014 12:00:00 -0800 (PST) Received: from radagast.lan (jahogan.plus.com. [212.159.75.221]) by mx.google.com with ESMTPSA id f3sm1493472wiv.2.2014.02.06.12.00.00 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Thu, 06 Feb 2014 12:00:00 -0800 (PST) From: James Hogan To: Mauro Carvalho Chehab , =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= Cc: linux-media@vger.kernel.org, James Hogan Subject: [RFC 4/4] DEBUG: rc: img-ir: raw: Add loopback on s_filter Date: Thu, 6 Feb 2014 19:59:23 +0000 Message-Id: <1391716763-2689-5-git-send-email-james.hogan@imgtec.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1391716763-2689-1-git-send-email-james.hogan@imgtec.com> References: <1391716763-2689-1-git-send-email-james.hogan@imgtec.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Purely for the purposes of debugging the raw IR encode, add the s_filter callback to the img-ir-raw driver, which instead of setting the filter just feeds it back through the input device so that it can be verified. --- drivers/media/rc/img-ir/img-ir-raw.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/media/rc/img-ir/img-ir-raw.c b/drivers/media/rc/img-ir/img-ir-raw.c index cfb01d9..272767a 100644 --- a/drivers/media/rc/img-ir/img-ir-raw.c +++ b/drivers/media/rc/img-ir/img-ir-raw.c @@ -7,6 +7,7 @@ * signal edges are reported and decoded by generic software decoders. */ +#include #include #include #include "img-ir.h" @@ -95,6 +96,34 @@ void img_ir_setup_raw(struct img_ir_priv *priv) spin_unlock_irq(&priv->lock); } +static int img_ir_raw_set_filter(struct rc_dev *dev, enum rc_filter_type type, + struct rc_scancode_filter *sc_filter) +{ + struct ir_raw_event *raw; + int ret; + int i; + + /* fine to disable filter */ + if (!sc_filter->mask) + return 0; + + raw = kmalloc(512 * sizeof(*raw), GFP_KERNEL); + ret = ir_raw_encode_scancode(dev->enabled_protocols, sc_filter, raw, + 512); + if (ret >= 0) { + /* loop back the scancode just for fun! */ + for (i = 0; i < ret; ++i) + ir_raw_event_store(dev, &raw[i]); + ir_raw_event_handle(dev); + + ret = 0; + } + + kfree(raw); + + return ret; +} + int img_ir_probe_raw(struct img_ir_priv *priv) { struct img_ir_priv_raw *raw = &priv->raw; @@ -114,6 +143,7 @@ int img_ir_probe_raw(struct img_ir_priv *priv) rdev->map_name = RC_MAP_EMPTY; rdev->input_name = "IMG Infrared Decoder Raw"; rdev->driver_type = RC_DRIVER_IR_RAW; + rdev->s_filter = img_ir_raw_set_filter; /* Register raw decoder */ error = rc_register_device(rdev);