From patchwork Thu Sep 1 17:16:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9309775 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 5CB1E60760 for ; Thu, 1 Sep 2016 21:35:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B96E29472 for ; Thu, 1 Sep 2016 21:35:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20772294F1; Thu, 1 Sep 2016 21:35:01 +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=unavailable 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 ACAFA29472 for ; Thu, 1 Sep 2016 21:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934494AbcIAVeb (ORCPT ); Thu, 1 Sep 2016 17:34:31 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:49869 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754285AbcIAV1U (ORCPT ); Thu, 1 Sep 2016 17:27:20 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OCU01AFZ5BQ7G90@mailout4.samsung.com>; Fri, 02 Sep 2016 02:16:38 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.113]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id A0.02.31386.57268C75; Fri, 2 Sep 2016 02:16:38 +0900 (KST) X-AuditID: cbfee68d-f79286d000007a9a-5f-57c862751621 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id AD.F4.07740.57268C75; Thu, 1 Sep 2016 10:16:37 -0700 (MST) 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 <0OCU00L0B5BMT280@mmp1.samsung.com>; Fri, 02 Sep 2016 02:16:37 +0900 (KST) From: Andi Shyti To: Mauro Carvalho Chehab , Sean Young , Rob Herring , Mark Rutland Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti , Andi Shyti Subject: [PATCH v2 3/7] [media] rc-core: add support for IR raw transmitters Date: Fri, 02 Sep 2016 02:16:25 +0900 Message-id: <20160901171629.15422-4-andi.shyti@samsung.com> X-Mailer: git-send-email 2.9.3 In-reply-to: <20160901171629.15422-1-andi.shyti@samsung.com> References: <20160901171629.15422-1-andi.shyti@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsWyRsSkULcs6US4waSDjBbbjzxjtVj84zmT xfwj51gtLu+aw2bRs2Erq8XS6xeZLFY/q7Bo3XuE3WLh0+8sDpwea+atYfS4vuQTs8emVZ1s HkveWHts6b/L7tG3ZRWjx+dNcgHsUVw2Kak5mWWpRfp2CVwZnxffZy6YKV1xfMFC9gbG9WJd jJwcEgImEm82rGaBsMUkLtxbzwZiCwmsYJRonuIIU7P5cg9QDRdQfCmjxKK+DiYI5yOjxNrr D8E62AQ0JZpu/2ADSYgIzGKUeD31BzNIgllgIaPEhs/KILawgI/EkfadYA0sAqoSS7/uBbN5 BawlrrefYINYJydxadsXsF5OARuJyacvs0KcZC1xYP1ksAUSArvYJba9u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mBlZGpkbWhgZ myuJ8z7+vy5MSCA9sSQ1OzW1ILUIpo+Jg1OqgXHvl+z6Bs3LLKbcXCw7Zyu95CjdcGiHBOei 9SIrlz113ezwMni//YVH+2/M7Wv7eN/Z6NHW6P0O7Rtq5yxK7C1afX3Z3dnPNXjtJ3abVZ8L nV/y74NukvELn40XrOuuSey7InJWxjCtTrR3v4mpbGPEuUPvld2n9oa5/RHVdLFjf5nhovjc bp8SS3FGoqEWc1FxIgAgC24YzwIAAA== 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 | 39 +++++++++++++++++++++++---------------- include/media/rc-core.h | 9 ++++++--- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 7961083..c3c1f68 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1361,20 +1361,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); + setup_timer(&dev->timer_keyup, ir_timer_keyup, + (unsigned long)dev); - spin_lock_init(&dev->rc_map.lock); - spin_lock_init(&dev->keylock); + 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; @@ -1474,7 +1478,7 @@ out_table: static void rc_free_rx_device(struct rc_dev *dev) { - if (!dev) + if (!dev || dev->driver_type == RC_DRIVER_IR_RAW_TX) return; ir_free_table(&dev->rc_map); @@ -1522,11 +1526,14 @@ int rc_register_device(struct rc_dev *dev) dev->input_name ?: "Unspecified device", path ?: "N/A"); kfree(path); - rc = rc_setup_rx_device(dev); - if (rc) - goto out_dev; + 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) { + 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 4fc60dd..56e33c1 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -32,13 +32,16 @@ do { \ /** * enum rc_driver_type - type of the RC output * - * @RC_DRIVER_SCANCODE: Driver or hardware generates a scancode - * @RC_DRIVER_IR_RAW: Driver or hardware generates pulse/space sequences. - * It needs a Infra-Red pulse/space decoder + * @RC_DRIVER_SCANCODE: Driver or hardware generates a scancode + * @RC_DRIVER_IR_RAW: Driver or hardware generates pulse/space sequences. + * It needs a Infra-Red pulse/space decoder + * @RC_DRIVER_IR_RAW_TX: Device transmitter only, + driver requires pulce/spce data sequence. */ enum rc_driver_type { RC_DRIVER_SCANCODE = 0, RC_DRIVER_IR_RAW, + RC_DRIVER_IR_RAW_TX, }; /**