From patchwork Mon Feb 26 08:57:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10241703 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 1EEF060208 for ; Mon, 26 Feb 2018 08:57:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14CB929D69 for ; Mon, 26 Feb 2018 08:57:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0975529D74; Mon, 26 Feb 2018 08:57:22 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B35CD29D69 for ; Mon, 26 Feb 2018 08:57:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4345F6E3E2; Mon, 26 Feb 2018 08:57:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb3-smtp-cloud7.xs4all.net (lb3-smtp-cloud7.xs4all.net [194.109.24.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 37F3E6E3E2 for ; Mon, 26 Feb 2018 08:57:13 +0000 (UTC) Received: from tschai.fritz.box ([212.251.195.8]) by smtp-cloud7.xs4all.net with ESMTPA id qEapeSsZ4lILHqEatecgMh; Mon, 26 Feb 2018 09:57:11 +0100 From: Hans Verkuil To: linux-media@vger.kernel.org Subject: [PATCH 3/6] cec-pin: create cec_pin_start_timer() function Date: Mon, 26 Feb 2018 09:57:03 +0100 Message-Id: <20180226085706.41526-4-hverkuil@xs4all.nl> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180226085706.41526-1-hverkuil@xs4all.nl> References: <20180226085706.41526-1-hverkuil@xs4all.nl> X-CMAE-Envelope: MS4wfCzXjqMZLdc3ciZYeoOrIG17E70WAndZa6FeY28nlWweUPwwa73RWmuQk+3ACY73WIteTtv0GhGu/ZXRq+jxVwufESc6KjRVbzDapd8tNwUOQ0BVqtCp OlcVYsAP1KAKyIfQ9kzzTw28YzKKKv4bF6njQ8sYi2h1JE01HOYnhSRyLGGA7ZbSXu3bDD8pirMjxFgHD1tLfHiEmumTATyr5eoc4r4+dVxX5m4pyjM/Q2Ya IQsedI/pF+HzUZz8K8gUN1RCUk0cBSC+zdRKaPlGAox/oSWMeC1J1FATfsRJpp5M0eeXXw1lhDUcvoYBb1W76A== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxime Ripard , Hans Verkuil , dri-devel@lists.freedesktop.org, Wolfram Sang MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil This function will be needed for injecting a custom pulse. Signed-off-by: Hans Verkuil --- drivers/media/cec/cec-pin-priv.h | 2 ++ drivers/media/cec/cec-pin.c | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/media/cec/cec-pin-priv.h b/drivers/media/cec/cec-pin-priv.h index cf41c4236efd..4571a0001a9d 100644 --- a/drivers/media/cec/cec-pin-priv.h +++ b/drivers/media/cec/cec-pin-priv.h @@ -118,4 +118,6 @@ struct cec_pin { u32 timer_sum_overrun; }; +void cec_pin_start_timer(struct cec_pin *pin); + #endif diff --git a/drivers/media/cec/cec-pin.c b/drivers/media/cec/cec-pin.c index 8e834b9f72c6..67d6ea9f56b6 100644 --- a/drivers/media/cec/cec-pin.c +++ b/drivers/media/cec/cec-pin.c @@ -680,6 +680,18 @@ static int cec_pin_adap_log_addr(struct cec_adapter *adap, u8 log_addr) return 0; } +void cec_pin_start_timer(struct cec_pin *pin) +{ + if (pin->state != CEC_ST_RX_IRQ) + return; + + atomic_set(&pin->work_irq_change, CEC_PIN_IRQ_UNCHANGED); + pin->ops->disable_irq(pin->adap); + cec_pin_high(pin); + cec_pin_to_idle(pin); + hrtimer_start(&pin->timer, ns_to_ktime(0), HRTIMER_MODE_REL); +} + static int cec_pin_adap_transmit(struct cec_adapter *adap, u8 attempts, u32 signal_free_time, struct cec_msg *msg) { @@ -689,14 +701,7 @@ static int cec_pin_adap_transmit(struct cec_adapter *adap, u8 attempts, pin->tx_msg = *msg; pin->work_tx_status = 0; pin->tx_bit = 0; - if (pin->state == CEC_ST_RX_IRQ) { - atomic_set(&pin->work_irq_change, CEC_PIN_IRQ_UNCHANGED); - pin->ops->disable_irq(adap); - cec_pin_high(pin); - cec_pin_to_idle(pin); - hrtimer_start(&pin->timer, ns_to_ktime(0), - HRTIMER_MODE_REL); - } + cec_pin_start_timer(pin); return 0; }