public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>,
	Henrik Kurelid <henke@kurelid.se>
Cc: Jean Delvare <khali@linux-fr.org>,
	Manu Abraham <abraham.manu@gmail.com>,
	Linux Media <linux-media@vger.kernel.org>,
	Chris Lee <updatelee@gmail.com>,
	Devin Heitmueller <dheitmueller@kernellabs.com>
Subject: Re: [PATCH 2/3] femon: Display SNR in dB
Date: Mon, 25 Nov 2013 15:00:55 +0100	[thread overview]
Message-ID: <20131125150055.076e60be@stein> (raw)
In-Reply-To: <20131125144317.330c7a03@stein>

On Nov 25 Stefan Richter wrote:
> On Nov 25 Jean Delvare wrote:
> > Hi Manu,
> > 
> > On Sun, 24 Nov 2013 22:51:33 +0530, Manu Abraham wrote:
> > > Sorry, that I came upon this patch quite late.
> > 
> > No problem, better late than never! :)
> > 
> > > On Mon, Jun 3, 2013 at 8:51 PM, Jean Delvare <khali@linux-fr.org> wrote:
> > > > SNR is supposed to be reported by the frontend drivers in dB, so print
> > > > it that way for drivers which implement it properly.
> > > 
> > > Not all frontends do report report the SNR in dB. Well, You can say quite
> > > some frontends do report it that way.
> > 
> > Last time I discussed this, I was told that this was the preferred way
> > for frontends to report the SNR. I also referred to this document:
> >   http://palosaari.fi/linux/v4l-dvb/snr_2012-05-21.txt
> > I don't know now up-to-date it is by now, but back then it showed a
> > significant number of frontends reporting in .1 dB already, including
> > the ones I'm using right now (drx-3916k and drx-3913k.) With the
> > current version of femon, "femon -H" reports it as 0%, which is quite
> > useless. Thus my patch.
> [...]
> 
> Hi,
> 
> I inherited this in drivers/media/firewire/firedtv-fe.c:
> 
> static int fdtv_read_snr(struct dvb_frontend *fe, u16 *snr)
> {
> 	struct firedtv *fdtv = fe->sec_priv;
> 	struct firedtv_tuner_status stat;
> 
> 	if (avc_tuner_status(fdtv, &stat))
> 		return -EINVAL;
> 
> 	/* C/N[dB] = -10 * log10(snr / 65535) */
> 	*snr = stat.carrier_noise_ratio * 257;
> 	return 0;
> }
> 
> As far as I understand, the comment should have been written with a "FIXME"
> prefix.
> 
> I have no documentation and no personal manufacturer contact (and the
> devices are EOL).  All I know from the driver source is that we do get a 16
> bits wide carrier_noise_ratio.  So it appears to be something on a scale
> from 0x0000 to 0xffff, and the comment makes it look like being on a linear
> scale originally.

Or I got it wrong and all the comment tries to tell that the value to be
returned in the snr argument is meant to be linear on a scale of 0...ffff,
and the code tells that we get a linear value on a scale of 0...255 from
the firmware.  (Cc'ing Henrik who added the code and the comment.)

> I could cross-check with a Windows based TV viewer application what signal
> strength value is presented there to the user with DVB-T and DVB-S2
> incarnations of FireDTV devices.  Right now I don't remember how that
> application presents it (i.e. as percentage or dB or whatever...).
> When I looked at that application and at kaffeine some years ago, they
> displayed grossly different values.  I did not research back then whether
> the Linux driver or kaffeine or both treated it wrong.
> 
> Any advice for the quoted kernel driver code?
> 
> Thanks,

-- 
Stefan Richter
-=====-===-= =-== ==--=
http://arcgraph.de/sr/

  reply	other threads:[~2013-11-25 14:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 15:16 [PATCH 0/3] dvb-apps: Improve femon Jean Delvare
2013-06-03 15:17 ` [PATCH 1/3] femon: Share common code Jean Delvare
2013-06-03 15:21 ` [PATCH 2/3] femon: Display SNR in dB Jean Delvare
2013-11-24 17:21   ` Manu Abraham
2013-11-24 18:02     ` Chris Lee
2013-11-24 18:14       ` Manu Abraham
2013-11-24 18:20       ` Devin Heitmueller
2013-11-24 18:40         ` Chris Lee
2013-11-24 18:52           ` Devin Heitmueller
2013-11-25  9:23     ` Jean Delvare
2013-11-25 13:43       ` Stefan Richter
2013-11-25 14:00         ` Stefan Richter [this message]
2013-06-03 15:23 ` [PATCH 3/3] femon: Handle -EOPNOTSUPP Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131125150055.076e60be@stein \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=abraham.manu@gmail.com \
    --cc=dheitmueller@kernellabs.com \
    --cc=henke@kurelid.se \
    --cc=khali@linux-fr.org \
    --cc=linux-media@vger.kernel.org \
    --cc=updatelee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox