From patchwork Sat Dec 28 17:02:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 3414201 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 657BEC02DC for ; Sat, 28 Dec 2013 17:03:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5AF812011B for ; Sat, 28 Dec 2013 17:03:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 974B920103 for ; Sat, 28 Dec 2013 17:03:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755470Ab3L1RDE (ORCPT ); Sat, 28 Dec 2013 12:03:04 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:33275 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755301Ab3L1RDD (ORCPT ); Sat, 28 Dec 2013 12:03:03 -0500 Received: by mail-wi0-f178.google.com with SMTP id bz8so10443209wib.17 for ; Sat, 28 Dec 2013 09:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:content-type:mime-version :content-transfer-encoding; bh=5dRU926cehbiOO0GYcGCuqcyj+zQ+d5VFVgKcsHNQuc=; b=nbQwcJ5T35RBtNcgOlWDrArdk8RuzLSz9G9Z5E2k5DrjMPgVULn1vMUdu+FgtbqLZ/ LVRFxoWIkKVt9yEtesq7lJoYOHgpTBuzfJPu1sNB08yaV6X8yWzSlfFgDGne7LlYqPY4 A9aBemm473LlLjA8SOH5CO2+2K0zrZ7EeMGBUzBlwyTzfKld6YnEawUzycrNVCpx1gU0 z1LGwbuU2ueD0fGJCuYSbLN1/MayP8hk+7SovY91lb/NnJArSPhxoI6/lXcgW/39cDEd pPgZk0v/i0+Rr7sIqQqkCaCH494lrF+ks7eBp/WqSwxCj6W+ZwKQ6j4q2mj3do263SOe qPPA== X-Received: by 10.180.108.240 with SMTP id hn16mr37384872wib.5.1388250181566; Sat, 28 Dec 2013 09:03:01 -0800 (PST) Received: from [192.168.1.100] (188.29.109.137.threembb.co.uk. [188.29.109.137]) by mx.google.com with ESMTPSA id cx3sm60704038wib.0.2013.12.28.09.03.00 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Sat, 28 Dec 2013 09:03:00 -0800 (PST) Message-ID: <1388250164.5893.3.camel@canaries32-MCP7A> Subject: [PATCH 2/3] m88rs2000: Correct m88rs2000_set_fec settings. From: Malcolm Priestley To: linux-media@vger.kernel.org Date: Sat, 28 Dec 2013 17:02:44 +0000 X-Mailer: Evolution 3.10.1-2ubuntu2 Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 Register 0x70 is used to set fec, register 0x76 is used to get fec Register 0x76 is set to 0x8. Signed-off-by: Malcolm Priestley --- drivers/media/dvb-frontends/m88rs2000.c | 37 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index f9d04db..002b109 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -541,33 +541,38 @@ static int m88rs2000_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) static int m88rs2000_set_fec(struct m88rs2000_state *state, fe_code_rate_t fec) { - u16 fec_set; + u8 fec_set, reg; + int ret; + switch (fec) { - /* This is not confirmed kept for reference */ -/* case FEC_1_2: - fec_set = 0x88; + case FEC_1_2: + fec_set = 0x8; break; case FEC_2_3: - fec_set = 0x68; + fec_set = 0x10; break; case FEC_3_4: - fec_set = 0x48; + fec_set = 0x20; break; case FEC_5_6: - fec_set = 0x28; + fec_set = 0x40; break; case FEC_7_8: - fec_set = 0x18; - break; */ + fec_set = 0x80; + break; case FEC_AUTO: default: - fec_set = 0x08; + fec_set = 0x0; } - m88rs2000_writereg(state, 0x76, fec_set); - return 0; -} + reg = m88rs2000_readreg(state, 0x70); + reg &= 0x7; + ret = m88rs2000_writereg(state, 0x70, reg | fec_set); + ret |= m88rs2000_writereg(state, 0x76, 0x8); + + return ret; +} static fe_code_rate_t m88rs2000_get_fec(struct m88rs2000_state *state) { @@ -650,12 +655,8 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe) if (ret < 0) return -ENODEV; - /* Unknown */ - reg = m88rs2000_readreg(state, 0x70); - ret = m88rs2000_writereg(state, 0x70, reg); - /* Set FEC */ - ret |= m88rs2000_set_fec(state, c->fec_inner); + ret = m88rs2000_set_fec(state, c->fec_inner); ret |= m88rs2000_writereg(state, 0x85, 0x1); ret |= m88rs2000_writereg(state, 0x8a, 0xbf); ret |= m88rs2000_writereg(state, 0x8d, 0x1e);