From patchwork Tue Nov 1 06:51:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9406957 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 CC8E360234 for ; Tue, 1 Nov 2016 06:51:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC41E2898B for ; Tue, 1 Nov 2016 06:51:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE83A293CE; Tue, 1 Nov 2016 06:51:34 +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 506682898B for ; Tue, 1 Nov 2016 06:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1166413AbcKAGvQ (ORCPT ); Tue, 1 Nov 2016 02:51:16 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:52734 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1165738AbcKAGvO (ORCPT ); Tue, 1 Nov 2016 02:51:14 -0400 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OFY00SFFB19CT00@mailout3.samsung.com>; Tue, 01 Nov 2016 15:51:11 +0900 (KST) X-AuditID: cbfee61b-f793d6d000005a2a-fe-58183b5fe2a5 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id E0.01.23082.F5B38185; Tue, 1 Nov 2016 15:51:11 +0900 (KST) Received: from gangnam.samsung ([10.113.62.47]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OFY004N3B1BZS60@mmp1.samsung.com>; Tue, 01 Nov 2016 15:51:11 +0900 (KST) Date: Tue, 01 Nov 2016 15:51:11 +0900 From: Andi Shyti To: Sean Young Cc: David =?iso-8859-15?Q?H=E4rdeman?= , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti Subject: Re: [PATCH v2 5/7] [media] ir-lirc-codec: don't wait any transmitting time for tx only devices Message-id: <20161101065111.hofyxjps2iwmxpzj@gangnam.samsung> References: <20161027143601.GA5103@gofer.mess.org> <20160901171629.15422-1-andi.shyti@samsung.com> <20160901171629.15422-6-andi.shyti@samsung.com> <20160902084158.GA25342@gofer.mess.org> <20161027074401.wxg5icc6hcpwnfsf@gangnam.samsung> <7e2f88ed83c4044c30bc03aaea9f09e1@hardeman.nu> <20161031170526.GA8183@gofer.mess.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline In-reply-to: <20161031170526.GA8183@gofer.mess.org> User-Agent: NeoMutt/20161014 (1.7.1) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBIsWRmVeSWpSXmKPExsVy+t9jAd14a4kIg/6VJhaLfzxnsrh4ZB27 xfwj51gtLu+aw2bRs2Erq8XS6xeZLFY/q7Bo3XuE3WLh0+8sDpwea+atYfS4vuQTs8eJ+13M HptWdbJ5LHlj7bGl/y67x+dNcgHsUW42GamJKalFCql5yfkpmXnptkqhIW66FkoKeYm5qbZK Ebq+IUFKCmWJOaVAnpEBGnBwDnAPVtK3S3DL+Lr9F2PBatmKZbPusDcwrhXpYuTkkBAwkXjQ sIEFwhaTuHBvPRuILSSwlFFien91FyMXkP2RUWJBM0QRi4CqxKcb88GK2AQ0JZpu/wCzRQTk JL5ta2EFaWAW2MAkcbXrCFhCWCBTYmXbWrBmXgFbiV2bvrNBTF3ELNF1/w1UQlDix+R7YDaz gJbE+p3HmSBsaYlHf2ewg9icAsYSG38tBouLCqhIzLo8h2UCo8AsJO2zkLTPQtK+gJF5FaNE akFyQXFSeq5RXmq5XnFibnFpXrpecn7uJkZwLD6T3sF4eJf7IUYBDkYlHl6HE+IRQqyJZcWV uYcYJTiYlUR4pxtLRAjxpiRWVqUW5ccXleakFh9iNAUGyURmKdHkfGCayCuJNzQxNzE3NrAw t7Q0MVIS522c/SxcSCA9sSQ1OzW1ILUIpo+Jg1OqgbF2FfftrgXzDl9Y0rY5NMvwQtC1E45J c5LUrs+0lOa53XQmQ+rTerPS+il2VnrmC58wXckPs9j6LJ/j46Yb4VF79I4r1an0rVftusL+ vu9m2I7TQdY+S47XNWw4X6/Q93L+zIkf+ap4Zh56bJJkP6c6+KX5/Y3n9wZ7a7CLaPM8u/Wj 9dusAz+UWIozEg21mIuKEwHzW4aR2wIAAA== X-MTR: 20000000000000000@CPGS 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 Hi Sean, > Andi, it would be good to know what the use-case for the original change is. the use case is the ir-spi itself which doesn't need the lirc to perform any waiting on its behalf. To me it just doesn't look right to simulate a fake transmission period and wait unnecessary time. Of course, the "over-wait" is not a big deal and at the end we can decide to drop it. Otherwise, an alternative could be to add the boolean 'tx_no_wait' in the rc_dev structure. It could be set by the device driver during the initialization and the we can follow your approach. Something like this: Thanks, Andi --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index c327730..4553d04 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -161,15 +161,19 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, ret *= sizeof(unsigned int); - /* - * The lircd gap calculation expects the write function to - * wait for the actual IR signal to be transmitted before - * returning. - */ - towait = ktime_us_delta(ktime_add_us(start, duration), ktime_get()); - if (towait > 0) { - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(usecs_to_jiffies(towait)); + if (!dev->tx_no_wait) { + /* + * The lircd gap calculation expects the write function to + * wait for the actual IR signal to be transmitted before + * returning. + */ + towait = ktime_us_delta(ktime_add_us(start, duration), + ktime_get()); + if (towait > 0) { + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(usecs_to_jiffies(towait)); + } + } out: diff --git a/drivers/media/rc/ir-spi.c b/drivers/media/rc/ir-spi.c index fcda1e4..e44abfa 100644 --- a/drivers/media/rc/ir-spi.c +++ b/drivers/media/rc/ir-spi.c @@ -149,6 +149,7 @@ static int ir_spi_probe(struct spi_device *spi) if (!idata->rc) return -ENOMEM; + idata->rc->tx_no_wait = true; idata->rc->tx_ir = ir_spi_tx; idata->rc->s_tx_carrier = ir_spi_set_tx_carrier; idata->rc->s_tx_duty_cycle = ir_spi_set_duty_cycle; diff --git a/include/media/rc-core.h b/include/media/rc-core.h index fe0c9c4..c3ced9b 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -85,6 +85,9 @@ enum rc_filter_type { * @input_dev: the input child device used to communicate events to userspace * @driver_type: specifies if protocol decoding is done in hardware or software * @idle: used to keep track of RX state + * @tx_no_wait: decides whether to perform or not a sync write or not. The + * device driver setting it to true must make sure to not break the ABI + * which requires a sync transfer. * @allowed_protocols: bitmask with the supported RC_BIT_* protocols * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols * @allowed_wakeup_protocols: bitmask with the supported RC_BIT_* wakeup protocols @@ -147,6 +150,7 @@ struct rc_dev { struct input_dev *input_dev; enum rc_driver_type driver_type; bool idle; + bool tx_no_wait; u64 allowed_protocols; u64 enabled_protocols; u64 allowed_wakeup_protocols;