From patchwork Tue Jul 19 15:56:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9237769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6FE23600CB for ; Tue, 19 Jul 2016 15:57:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 610F12624C for ; Tue, 19 Jul 2016 15:57:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5593926C2F; Tue, 19 Jul 2016 15:57:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 938A126A4D for ; Tue, 19 Jul 2016 15:57:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753986AbcGSP5O (ORCPT ); Tue, 19 Jul 2016 11:57:14 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:43900 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753348AbcGSP5K (ORCPT ); Tue, 19 Jul 2016 11:57:10 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OAK00JB7KB7WP90@mailout4.samsung.com>; Wed, 20 Jul 2016 00:57:07 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.112]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 4D.E7.05161.3DD4E875; Wed, 20 Jul 2016 00:57:07 +0900 (KST) X-AuditID: cbfee68f-f79476d000001429-cd-578e4dd33a42 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 84.BA.02101.3DD4E875; Wed, 20 Jul 2016 00:57:07 +0900 (KST) Received: from samsunx.samsung ([10.113.63.54]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OAK006NUKB4PH70@mmp1.samsung.com>; Wed, 20 Jul 2016 00:57:07 +0900 (KST) From: Andi Shyti To: Mauro Carvalho Chehab , Sean Young Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti , Andi Shyti Subject: [RFC 3/7] [media] rc-core: add support for IR raw transmitters Date: Wed, 20 Jul 2016 00:56:54 +0900 Message-id: <1468943818-26025-4-git-send-email-andi.shyti@samsung.com> X-Mailer: git-send-email 2.8.1 In-reply-to: <1468943818-26025-1-git-send-email-andi.shyti@samsung.com> References: <1468943818-26025-1-git-send-email-andi.shyti@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMLMWRmVeSWpSXmKPExsWyRsSkQPeyb1+4wZsmZYvtR56xWiz+8ZzJ 4vKuOWwWPRu2slqsflZhsfDpdxYHNo/rSz4xeyx5Y+2xpf8uu0ffllWMHp83yQWwRnHZpKTm ZJalFunbJXBlXOorK3ggWvH19Am2BsYmoS5GTg4JAROJfxuaWCFsMYkL99azdTFycQgJrGCU WH1lLhNM0c1Xd1khEksZJbb+mcMM4XxklNh59BRYFZuApkTT7R9sILaIgL/Em57FYGOZBZoZ JXZfNwKxhQXcJeYteMkOYrMIqErsvfCKGcTmFXCT+Dh9LwvENjmJy9MfAM3h4OAEqr9yswgk LARU8m7dQxaQvRICk9klXk9+yAwxR0Di2+RDLCD1EgKyEpsOMEOMkZQ4uOIGywRG4QWM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k3rzKzay9n1HXYN1U+8bO2AIPQp4lx jvfbHVNLw1O1q20vzFn77U/Itb7MKoVPOk0Nk3pWf7v0b3W5VIXv71tJf/MWGf1zPPPk/ok9 J17t2pUqNSPyrfPZnP/3z0s8Xrqobl7yOpX2O/9MlFiKMxINtZiLihMBXNVElLMCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP IR raw transmitter driver type is specified in the enum rc_driver_type as RC_DRIVER_IR_RAW_TX which includes all those devices that transmit raw stream of bit to a receiver. The data are provided by userspace applications, therefore they don't need any input device allocation, but still they need to be registered as raw devices. Suggested-by: Sean Young Signed-off-by: Andi Shyti --- drivers/media/rc/rc-main.c | 35 +++++++++++++++++++++++------------ include/media/rc-core.h | 1 + 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index ac91157..f555f38 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1354,20 +1354,24 @@ struct rc_dev *rc_allocate_device(enum rc_driver_type type) if (!dev) return NULL; - dev->input_dev = input_allocate_device(); - if (!dev->input_dev) { - kfree(dev); - return NULL; - } + if (type != RC_DRIVER_IR_RAW_TX) { + dev->input_dev = input_allocate_device(); + if (!dev->input_dev) { + kfree(dev); + return NULL; + } - dev->input_dev->getkeycode = ir_getkeycode; - dev->input_dev->setkeycode = ir_setkeycode; - input_set_drvdata(dev->input_dev, dev); + dev->input_dev->getkeycode = ir_getkeycode; + dev->input_dev->setkeycode = ir_setkeycode; + input_set_drvdata(dev->input_dev, dev); - spin_lock_init(&dev->rc_map.lock); - spin_lock_init(&dev->keylock); + setup_timer(&dev->timer_keyup, ir_timer_keyup, + (unsigned long)dev); + + spin_lock_init(&dev->rc_map.lock); + spin_lock_init(&dev->keylock); + } mutex_init(&dev->lock); - setup_timer(&dev->timer_keyup, ir_timer_keyup, (unsigned long)dev); dev->dev.type = &rc_dev_type; dev->dev.class = &rc_class; @@ -1515,7 +1519,14 @@ int rc_register_device(struct rc_dev *dev) dev->input_name ?: "Unspecified device", path ?: "N/A"); kfree(path); - if (dev->driver_type == RC_DRIVER_IR_RAW) { + if (dev->driver_type != RC_DRIVER_IR_RAW_TX) { + rc = rc_setup_rx_device(dev); + if (rc) + goto out_dev; + } + + if (dev->driver_type == RC_DRIVER_IR_RAW || + dev->driver_type == RC_DRIVER_IR_RAW_TX) { if (!raw_init) { request_module_nowait("ir-lirc-codec"); raw_init = true; diff --git a/include/media/rc-core.h b/include/media/rc-core.h index c6bf1ef..77b0893 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -32,6 +32,7 @@ do { \ enum rc_driver_type { RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */ RC_DRIVER_IR_RAW, /* Needs a Infra-Red pulse/space decoder */ + RC_DRIVER_IR_RAW_TX, /* Device is transmitter, driver handles raw */ }; /**