From patchwork Wed May 8 21:54:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Reinhard Nissl X-Patchwork-Id: 2541901 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 45168DF2E5 for ; Wed, 8 May 2013 21:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755404Ab3EHV5W (ORCPT ); Wed, 8 May 2013 17:57:22 -0400 Received: from mout.gmx.net ([212.227.15.19]:50441 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755383Ab3EHV5V (ORCPT ); Wed, 8 May 2013 17:57:21 -0400 Received: from mailout-de.gmx.net ([10.1.76.4]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0MZiPg-1Uq4WU1tUs-00LTc5 for ; Wed, 08 May 2013 23:57:20 +0200 Received: (qmail invoked by alias); 08 May 2013 21:57:20 -0000 Received: from pD95F13AA.dip0.t-ipconnect.de (EHLO corei7.home.test) [217.95.19.170] by mail.gmx.net (mp004) with SMTP; 08 May 2013 23:57:20 +0200 X-Authenticated: #527675 X-Provags-ID: V01U2FsdGVkX1/sz39zHyfs+9mdj5/4LQEjwCRXprU8rUqdR89rPn RtwOAdLHzrX6pe Received: by corei7.home.test (Postfix, from userid 0) id 74E6216E7F; Wed, 8 May 2013 23:55:22 +0200 (CEST) From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= To: linux-media@vger.kernel.org Cc: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Subject: [PATCH 1/2] stb0899: fix inversion enum values to match usage with CFR Date: Wed, 8 May 2013 23:54:56 +0200 Message-Id: <1368050097-6079-1-git-send-email-rnissl@gmx.de> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 X-Y-GMX-Trusted: 0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Throughout the zig-zag-implementations, inversion is taken into account when reading and writing the CFR register, which contains the derotator frequency. As swapping IQ signals changes the sign of that register for example, the idea is to compensate that sign change by multiplying the register value with the inversion enum value. The current enum values 0 and 1 for IQ_SWAP_OFF and IQ_SWAP_ON don't work in the case IQ_SWAP_OFF, due to the multiplication by zero (I've only found a single device which actually uses IQ_SWAP_OFF in it's config). I've changed the enum values to +1 and -1 to accommodate to the intended usage. Signed-off-by: Reinhard Nißl --- drivers/media/dvb-frontends/stb0899_algo.c | 4 ++-- drivers/media/dvb-frontends/stb0899_drv.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb-frontends/stb0899_algo.c b/drivers/media/dvb-frontends/stb0899_algo.c index 14d720b..e0d31a2 100644 --- a/drivers/media/dvb-frontends/stb0899_algo.c +++ b/drivers/media/dvb-frontends/stb0899_algo.c @@ -444,7 +444,7 @@ static enum stb0899_status stb0899_check_range(struct stb0899_state *state) int range_offst, tp_freq; range_offst = internal->srch_range / 2000; - tp_freq = internal->freq + (internal->derot_freq * internal->mclk) / 1000; + tp_freq = internal->freq - (internal->derot_freq * internal->mclk) / 1000; if ((tp_freq >= params->freq - range_offst) && (tp_freq <= params->freq + range_offst)) { internal->status = RANGEOK; @@ -638,7 +638,7 @@ enum stb0899_status stb0899_dvbs_algo(struct stb0899_state *state) "RANGE OK ! derot freq=%d, mclk=%d", internal->derot_freq, internal->mclk); - internal->freq = params->freq + ((internal->derot_freq * internal->mclk) / 1000); + internal->freq = params->freq - ((internal->derot_freq * internal->mclk) / 1000); reg = stb0899_read_reg(state, STB0899_PLPARM); internal->fecrate = STB0899_GETFIELD(VITCURPUN, reg); dprintk(state->verbose, FE_DEBUG, 1, diff --git a/drivers/media/dvb-frontends/stb0899_drv.h b/drivers/media/dvb-frontends/stb0899_drv.h index 1ddad6a..139264d 100644 --- a/drivers/media/dvb-frontends/stb0899_drv.h +++ b/drivers/media/dvb-frontends/stb0899_drv.h @@ -45,8 +45,8 @@ struct stb0899_s2_reg { }; enum stb0899_inversion { - IQ_SWAP_OFF = 0, - IQ_SWAP_ON, + IQ_SWAP_OFF = +1, /* inversion affects the sign of e. g. */ + IQ_SWAP_ON = -1, /* the derotator frequency register */ }; #define STB0899_GPIO00 0xf140