From patchwork Mon Mar 5 13:51:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10258971 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 9064660211 for ; Mon, 5 Mar 2018 13:51:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8191028A47 for ; Mon, 5 Mar 2018 13:51:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7689428A49; Mon, 5 Mar 2018 13:51:57 +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 3EDB128A47 for ; Mon, 5 Mar 2018 13:51:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A87056E143; Mon, 5 Mar 2018 13:51:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb2-smtp-cloud7.xs4all.net (lb2-smtp-cloud7.xs4all.net [194.109.24.28]) by gabe.freedesktop.org (Postfix) with ESMTPS id 25E2D6E104 for ; Mon, 5 Mar 2018 13:51:43 +0000 (UTC) Received: from marune.fritz.box ([80.101.105.217]) by smtp-cloud7.xs4all.net with ESMTPA id sqWhehqUp8U07sqWke2ket; Mon, 05 Mar 2018 14:51:42 +0100 From: Hans Verkuil To: linux-media@vger.kernel.org Subject: [PATCHv2 3/7] cec-pin: create cec_pin_start_timer() function Date: Mon, 5 Mar 2018 14:51:35 +0100 Message-Id: <20180305135139.95652-4-hverkuil@xs4all.nl> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180305135139.95652-1-hverkuil@xs4all.nl> References: <20180305135139.95652-1-hverkuil@xs4all.nl> X-CMAE-Envelope: MS4wfP4uE/kXmC5jjPzAuV9prCL6c/gmMOrNyDraVA5xjoXm5+AtLG9tj0LtzfdjTIwnSzsMHPNn1SFH3Wb9vNBkkRzeEqa8YNafkpS5miNTzo0JGqeKgxLa 3DMHpxXtJ5ev625uCFijZdsNZ2a0PZlFbzlYW9tqxyFOcUvE0k3b1zgN+z1UDInO5xhlNLCaZzB+/bVNAXXr6D8N/zjL4YsIKumURrq1gMphjEqATc9wjW6Q gXDVuLag4WjtbBNqv1vxxy+Xn0kXLu2jrPJoqXMI/pScoEeSH0QfL6Z9zCxIneB+VMyDyZsak3vKWfcghpOpoA== 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; }