From patchwork Sun May 13 11:24:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Reichl X-Patchwork-Id: 10396169 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 81BF960215 for ; Sun, 13 May 2018 11:24:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6903728DA8 for ; Sun, 13 May 2018 11:24:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CEAA28DE6; Sun, 13 May 2018 11:24:37 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, 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 9228828DA8 for ; Sun, 13 May 2018 11:24:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751217AbeEMLYf (ORCPT ); Sun, 13 May 2018 07:24:35 -0400 Received: from mail.horus.com ([78.46.148.228]:52350 "EHLO mail.horus.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750941AbeEMLYf (ORCPT ); Sun, 13 May 2018 07:24:35 -0400 Received: from [192.168.1.20] (62-116-59-119.adsl.highway.telekom.at [62.116.59.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "E-Mail Matthias Reichl", Issuer "HiassofT CA 2014" (verified OK)) by mail.horus.com (Postfix) with ESMTPSA id 5CFD36409D; Sun, 13 May 2018 13:24:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=horus.com; s=20180324; t=1526210673; bh=CzOvKOwr52NhfM6RPTUrSmc+3evyk+d3KA+QqhjjwEg=; h=From:To:Cc:Subject:Date:From; b=F4urYjXgra1u7vh3qU2Mxmb5rqp777Q0MEQKYcz7nHpmUtRb08kYk1Qe+/ybAJleV PAN2Ca2yv7QDFBplwQAKxjQbIFdtq7uqtHg+O/oJTluCd2QDooW2VWsk8a3R/QDzWM 0jNd6+XTn2aF/oa77VEqmi2pqh4GuD1F/mZxMZ4E= Received: by camel2.lan (Postfix, from userid 1000) id 2D4131C7754; Sun, 13 May 2018 13:24:32 +0200 (CEST) From: Matthias Reichl To: Sean Young Cc: linux-media@vger.kernel.org Subject: [PATCH] media: rc: ite-cir: lower timeout and extend allowed timeout range Date: Sun, 13 May 2018 13:24:31 +0200 Message-Id: <20180513112431.7016-1-hias@horus.com> X-Mailer: git-send-email 2.11.0 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 The minimum possible timeout of ite-cir is 8 samples, which is typically about 70us. The driver however changes the FIFO trigger level from the hardware's default of 1 byte to 17 bytes, so the minimum usable timeout value is 17 * 8 samples, which is typically about 1.2ms. Tests showed that using timeouts down to 1.2ms actually work fine. The current default timeout of 200ms is much longer than necessary and the maximum timeout of 1s seems to have been chosen a bit arbitrarily. So change the minimum timeout to the driver's limit of 17 * 8 samples and bring timeout and maximum timeout in line with the settings of many other receivers. Signed-off-by: Matthias Reichl --- drivers/media/rc/ite-cir.c | 8 +++++--- drivers/media/rc/ite-cir.h | 7 ------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index 65e104c7ddfc..de77d22c30a7 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c @@ -1561,9 +1561,11 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id rdev->close = ite_close; rdev->s_idle = ite_s_idle; rdev->s_rx_carrier_range = ite_set_rx_carrier_range; - rdev->min_timeout = ITE_MIN_IDLE_TIMEOUT; - rdev->max_timeout = ITE_MAX_IDLE_TIMEOUT; - rdev->timeout = ITE_IDLE_TIMEOUT; + /* FIFO threshold is 17 bytes, so 17 * 8 samples minimum */ + rdev->min_timeout = 17 * 8 * ITE_BAUDRATE_DIVISOR * + itdev->params.sample_period; + rdev->timeout = IR_DEFAULT_TIMEOUT; + rdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT; rdev->rx_resolution = ITE_BAUDRATE_DIVISOR * itdev->params.sample_period; rdev->tx_resolution = ITE_BAUDRATE_DIVISOR * diff --git a/drivers/media/rc/ite-cir.h b/drivers/media/rc/ite-cir.h index 0e8ebc880d1f..9cb24ac01350 100644 --- a/drivers/media/rc/ite-cir.h +++ b/drivers/media/rc/ite-cir.h @@ -154,13 +154,6 @@ struct ite_dev { /* default carrier freq for when demodulator is off (Hz) */ #define ITE_DEFAULT_CARRIER_FREQ 38000 -/* default idling timeout in ns (0.2 seconds) */ -#define ITE_IDLE_TIMEOUT 200000000UL - -/* limit timeout values */ -#define ITE_MIN_IDLE_TIMEOUT 100000000UL -#define ITE_MAX_IDLE_TIMEOUT 1000000000UL - /* convert bits to us */ #define ITE_BITS_TO_NS(bits, sample_period) \ ((u32) ((bits) * ITE_BAUDRATE_DIVISOR * sample_period))