From patchwork Tue Aug 21 23:56:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antti Palosaari X-Patchwork-Id: 1358361 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E554C40210 for ; Tue, 21 Aug 2012 23:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753653Ab2HUX5L (ORCPT ); Tue, 21 Aug 2012 19:57:11 -0400 Received: from mail.kapsi.fi ([217.30.184.167]:48984 "EHLO mail.kapsi.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752962Ab2HUX5I (ORCPT ); Tue, 21 Aug 2012 19:57:08 -0400 Received: from dyn2-212-50-134-229.psoas.suomi.net ([212.50.134.229] helo=localhost.localdomain) by mail.kapsi.fi with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1T3yJn-0002Rt-Dm; Wed, 22 Aug 2012 02:57:07 +0300 From: Antti Palosaari To: linux-media@vger.kernel.org Cc: Antti Palosaari , Thomas Mair Subject: [PATCH 5/5] rtl2832: implement .read_ber() Date: Wed, 22 Aug 2012 02:56:22 +0300 Message-Id: <1345593382-11367-5-git-send-email-crope@iki.fi> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1345593382-11367-1-git-send-email-crope@iki.fi> References: <1345593382-11367-1-git-send-email-crope@iki.fi> X-SA-Exim-Connect-IP: 212.50.134.229 X-SA-Exim-Mail-From: crope@iki.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Implementation taken from rtl2830. Cc: Thomas Mair Signed-off-by: Antti Palosaari --- drivers/media/dvb-frontends/rtl2832.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index dad8ab5..4d40b4f 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c @@ -824,6 +824,24 @@ err: return ret; } +static int rtl2832_read_ber(struct dvb_frontend *fe, u32 *ber) +{ + struct rtl2832_priv *priv = fe->demodulator_priv; + int ret; + u8 buf[2]; + + ret = rtl2832_rd_regs(priv, 0x4e, 3, buf, 2); + if (ret) + goto err; + + *ber = buf[0] << 8 | buf[1]; + + return 0; +err: + dbg("%s: failed=%d", __func__, ret); + return ret; +} + static struct dvb_frontend_ops rtl2832_ops; static void rtl2832_release(struct dvb_frontend *fe) @@ -909,6 +927,7 @@ static struct dvb_frontend_ops rtl2832_ops = { .read_status = rtl2832_read_status, .read_snr = rtl2832_read_snr, + .read_ber = rtl2832_read_ber, .i2c_gate_ctrl = rtl2832_i2c_gate_ctrl, };