From patchwork Tue May 5 16:33:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 6339301 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 44550BEEE1 for ; Tue, 5 May 2015 16:34:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6EFB220265 for ; Tue, 5 May 2015 16:34:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 825DA20149 for ; Tue, 5 May 2015 16:34:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965476AbbEEQeW (ORCPT ); Tue, 5 May 2015 12:34:22 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:32909 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965444AbbEEQeT (ORCPT ); Tue, 5 May 2015 12:34:19 -0400 Received: by lbbzk7 with SMTP id zk7so133166089lbb.0 for ; Tue, 05 May 2015 09:34:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=J6cYXWgOx3XXTz+smWuo9R/6ulHyHVtg40lpf2c6yOU=; b=Px3HhTaxG8UgxL1isAhuKug8hfYyhTtoY5BoJ1mT3KTAjjgUe7af9n8DyjlzFpBvfB ATFHXQF/u5gp9FZfe5kDKdFBZMPNV5Wnj0O6svK2U7yUGekqNwX3qA2XlmKN/ygTA3VL UiRHk+jR2/vFf0m1CNUSst5xZ3rZ2+vjEgJQwj+kzFVCiy+2a7gslwqhUkt/vpta1Rin 5VUQgEXtolpubxt8G2nzRU3ZAOxrB8lQuhGhkpABqSceGYdJ29cjSgA1Fn9mN9tJ3XMQ Wu4PPBV4f7SXFdLmergtJy40pgFNOg/fpkRx2Js8hvuYkJKlVW9V13F+hYVroN03R5lK 0Eaw== X-Gm-Message-State: ALoCoQl7vgZHJUMCsPkSQJB360Z3zxW3xsMf/IxgcrP3umgMQ7J55ddIYHHYVDAkfNBKUHemZSB8 X-Received: by 10.152.243.9 with SMTP id wu9mr24434377lac.63.1430843657804; Tue, 05 May 2015 09:34:17 -0700 (PDT) Received: from dl160.lan (188-67-118-178.bb.dnainternet.fi. [188.67.118.178]) by mx.google.com with ESMTPSA id m8sm4171702lbs.17.2015.05.05.09.34.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 May 2015 09:34:16 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH 4/4] dw2102: resync fifo when demod locks Date: Tue, 5 May 2015 19:33:55 +0300 Message-Id: <1430843635-24002-4-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430843635-24002-1-git-send-email-olli.salonen@iki.fi> References: <1430843635-24002-1-git-send-email-olli.salonen@iki.fi> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the streaming_ctrl is called to enable TS before demod has locked the TS will be empty. Copied the solution from the dvbsky driver for the TechnoTrend S2-4600 device: when the state changes from unlock to lock, call su3000_streaming_ctrl again. Signed-off-by: Olli Salonen --- drivers/media/usb/dvb-usb/dw2102.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c index 7552521..f9ad57f 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -117,8 +117,13 @@ struct dw2102_state { u8 initialized; + u8 last_lock; struct i2c_client *i2c_client_tuner; + + /* fe hook functions*/ int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v); + int (*fe_read_status)(struct dvb_frontend *fe, + fe_status_t *status); }; /* debug */ @@ -1001,6 +1006,23 @@ static void dw210x_led_ctrl(struct dvb_frontend *fe, int offon) i2c_transfer(&udev_adap->dev->i2c_adap, &msg, 1); } +static int tt_s2_4600_read_status(struct dvb_frontend *fe, fe_status_t *status) +{ + struct dvb_usb_adapter *d = + (struct dvb_usb_adapter *)(fe->dvb->priv); + struct dw2102_state *st = (struct dw2102_state *)d->dev->priv; + int ret; + + ret = st->fe_read_status(fe, status); + + /* resync slave fifo when signal change from unlock to lock */ + if ((*status & FE_HAS_LOCK) && (!st->last_lock)) + su3000_streaming_ctrl(d, 1); + + st->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0; + return ret; +} + static struct stv0299_config sharp_z0194a_config = { .demod_address = 0x68, .inittab = sharp_z0194a_inittab, @@ -1553,6 +1575,12 @@ static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap) state->i2c_client_tuner = client; + /* hook fe: need to resync the slave fifo when signal locks */ + state->fe_read_status = adap->fe_adap[0].fe->ops.read_status; + adap->fe_adap[0].fe->ops.read_status = tt_s2_4600_read_status; + + state->last_lock = 0; + return 0; }