mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
media: mxl58x, si2183, si2168: Limit CNR legacy value.
This commit is contained in:
@@ -532,6 +532,8 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status)
|
|||||||
p->cnr.stat[0].svalue = (s16)reg[0] * 10;
|
p->cnr.stat[0].svalue = (s16)reg[0] * 10;
|
||||||
p->cnr.stat[1].scale = FE_SCALE_RELATIVE;
|
p->cnr.stat[1].scale = FE_SCALE_RELATIVE;
|
||||||
p->cnr.stat[1].uvalue = reg[0] * 33;
|
p->cnr.stat[1].uvalue = reg[0] * 33;
|
||||||
|
if (p->cnr.stat[1].uvalue > 0xffff)
|
||||||
|
p->cnr.stat[1].uvalue = 0xffff;
|
||||||
|
|
||||||
/* Read BER */
|
/* Read BER */
|
||||||
mutex_lock(&state->base->status_lock);
|
mutex_lock(&state->base->status_lock);
|
||||||
|
@@ -169,6 +169,8 @@ static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
|||||||
c->cnr.stat[0].svalue = (s64)cmd.args[3] * 250;
|
c->cnr.stat[0].svalue = (s64)cmd.args[3] * 250;
|
||||||
c->cnr.stat[1].scale = FE_SCALE_RELATIVE;
|
c->cnr.stat[1].scale = FE_SCALE_RELATIVE;
|
||||||
c->cnr.stat[1].uvalue = (s64)cmd.args[3] * 328;
|
c->cnr.stat[1].uvalue = (s64)cmd.args[3] * 328;
|
||||||
|
if (c->cnr.stat[1].uvalue > 0xffff)
|
||||||
|
c->cnr.stat[1].uvalue = 0xffff;
|
||||||
} else {
|
} else {
|
||||||
c->cnr.len = 1;
|
c->cnr.len = 1;
|
||||||
c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||||
|
@@ -315,7 +315,10 @@ static int si2183_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
|||||||
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
|
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
|
||||||
c->cnr.stat[0].svalue = (s64) cmd.args[3] * 250;
|
c->cnr.stat[0].svalue = (s64) cmd.args[3] * 250;
|
||||||
c->cnr.stat[1].scale = FE_SCALE_RELATIVE;
|
c->cnr.stat[1].scale = FE_SCALE_RELATIVE;
|
||||||
c->cnr.stat[1].svalue = dev->snr;
|
c->cnr.stat[1].uvalue = dev->snr;
|
||||||
|
if (c->cnr.stat[1].uvalue > 0xffff)
|
||||||
|
c->cnr.stat[1].uvalue = 0xffff;
|
||||||
|
|
||||||
|
|
||||||
// writing missing properties
|
// writing missing properties
|
||||||
// CONSTELLATION or modulation
|
// CONSTELLATION or modulation
|
||||||
@@ -555,10 +558,13 @@ err:
|
|||||||
|
|
||||||
static int si2183_read_snr(struct dvb_frontend *fe, u16 *snr)
|
static int si2183_read_snr(struct dvb_frontend *fe, u16 *snr)
|
||||||
{
|
{
|
||||||
struct i2c_client *client = fe->demodulator_priv;
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||||
struct si2183_dev *dev = i2c_get_clientdata(client);
|
int i;
|
||||||
|
|
||||||
*snr = (dev->fe_status & FE_HAS_LOCK) ? dev->snr : 0;
|
*snr = 0;
|
||||||
|
for (i=0; i < c->cnr.len; i++)
|
||||||
|
if (c->cnr.stat[i].scale == FE_SCALE_RELATIVE)
|
||||||
|
*snr = (u16)c->cnr.stat[i].uvalue;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user