Don't let G_PROPERTY interfere at tuner locking
Subsystems (16)
cover Don't let G_PROPERTY interfere at tuner locking
Yesterday, I used an old hardware to test a VB2 issue with DVB. On the tests, I noticed that some very old drivers don't play nice if either G_PROPERTY or GET_FRONTEND is called while the driver didn't lock.
The driver simply overrides the tuning cache with some random data, causing tune to fail. This is wrong, and frontend drivers should be fixed with patches like this one:
https://patchwork.linuxtv.org/patch/32813/
Yet, the core should be smarter to not let the driver to not tune due to such driver bugs.
So, make the core more robust by passing a separate DTV properties struct to the drivers on get_frontend(). This way, if the driver updates it with bogus values, it won't interere with digital TV zig-zag routines.
Please also notice that drivers may simply update the cache either at set_frontend(), at get_status() or via some driver kthread. This should work too with the new logic.
Tested on my device with tda1004x with the fix reverted, and with the fix applied.
Mauro Carvalho Chehab (7):
[media] dvb_frontend: add props argument to dtv_get_frontend() [media] siano: remove get_frontend stub
[media] friio-fe: remove get_frontend() callback
[media] lgs8gxx: don't export get_frontend() callback [media] mb86a20s: get rid of dummy get_frontend() [media] dvb_frontend: pass the props cache to get_frontend() as arg [media] dvb_frontend: Don't let drivers to trash data at cache
drivers/media/common/siano/smsdvb-main.c | 7 --- drivers/media/dvb-core/dvb_frontend.c | 55 +++++++++++++------- drivers/media/dvb-core/dvb_frontend.h | 3 +- drivers/media/dvb-frontends/af9013.c | 4 +- drivers/media/dvb-frontends/af9033.c | 4 +- drivers/media/dvb-frontends/as102_fe.c | 4 +- drivers/media/dvb-frontends/atbm8830.c | 4 +- drivers/media/dvb-frontends/au8522_dig.c | 4 +- drivers/media/dvb-frontends/cx22700.c | 4 +- drivers/media/dvb-frontends/cx22702.c | 4 +- drivers/media/dvb-frontends/cx24110.c | 4 +- drivers/media/dvb-frontends/cx24117.c | 4 +- drivers/media/dvb-frontends/cx24120.c | 4 +- drivers/media/dvb-frontends/cx24123.c | 4 +- drivers/media/dvb-frontends/cxd2820r_c.c | 4 +- drivers/media/dvb-frontends/cxd2820r_core.c | 9 ++-- drivers/media/dvb-frontends/cxd2820r_priv.h | 9 ++-- drivers/media/dvb-frontends/cxd2820r_t.c | 4 +- drivers/media/dvb-frontends/cxd2820r_t2.c | 6 +-- drivers/media/dvb-frontends/cxd2841er.c | 4 +- drivers/media/dvb-frontends/dib3000mb.c | 9 ++-- drivers/media/dvb-frontends/dib3000mc.c | 6 +-- drivers/media/dvb-frontends/dib7000m.c | 6 +-- drivers/media/dvb-frontends/dib7000p.c | 6 +-- drivers/media/dvb-frontends/dib8000.c | 75 ++++++++++++++------------- drivers/media/dvb-frontends/dib9000.c | 23 ++++---- drivers/media/dvb-frontends/dvb_dummy_fe.c | 7 ++- drivers/media/dvb-frontends/hd29l2.c | 4 +- drivers/media/dvb-frontends/l64781.c | 4 +- drivers/media/dvb-frontends/lg2160.c | 62 +++++++++++----------- drivers/media/dvb-frontends/lgdt3305.c | 4 +- drivers/media/dvb-frontends/lgdt3306a.c | 4 +- drivers/media/dvb-frontends/lgdt330x.c | 5 +- drivers/media/dvb-frontends/lgs8gl5.c | 5 +- drivers/media/dvb-frontends/lgs8gxx.c | 13 +---- drivers/media/dvb-frontends/m88ds3103.c | 4 +- drivers/media/dvb-frontends/m88rs2000.c | 5 +- drivers/media/dvb-frontends/mb86a20s.c | 11 ---- drivers/media/dvb-frontends/mt312.c | 4 +- drivers/media/dvb-frontends/mt352.c | 4 +- drivers/media/dvb-frontends/or51132.c | 4 +- drivers/media/dvb-frontends/rtl2830.c | 4 +- drivers/media/dvb-frontends/rtl2832.c | 4 +- drivers/media/dvb-frontends/s5h1409.c | 4 +- drivers/media/dvb-frontends/s5h1411.c | 4 +- drivers/media/dvb-frontends/s5h1420.c | 4 +- drivers/media/dvb-frontends/s921.c | 4 +- drivers/media/dvb-frontends/stb0899_drv.c | 4 +- drivers/media/dvb-frontends/stb6100.c | 2 +- drivers/media/dvb-frontends/stv0297.c | 4 +- drivers/media/dvb-frontends/stv0299.c | 4 +- drivers/media/dvb-frontends/stv0367.c | 8 +-- drivers/media/dvb-frontends/stv0900_core.c | 4 +- drivers/media/dvb-frontends/tc90522.c | 10 ++-- drivers/media/dvb-frontends/tda10021.c | 4 +- drivers/media/dvb-frontends/tda10023.c | 4 +- drivers/media/dvb-frontends/tda10048.c | 4 +- drivers/media/dvb-frontends/tda1004x.c | 4 +- drivers/media/dvb-frontends/tda10071.c | 4 +- drivers/media/dvb-frontends/tda10086.c | 4 +- drivers/media/dvb-frontends/tda8083.c | 4 +- drivers/media/dvb-frontends/ves1820.c | 4 +- drivers/media/dvb-frontends/ves1x93.c | 4 +- drivers/media/dvb-frontends/zl10353.c | 4 +- drivers/media/pci/bt8xx/dst.c | 4 +- drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c | 4 +- drivers/media/usb/dvb-usb/af9005-fe.c | 4 +- drivers/media/usb/dvb-usb/dtt200u-fe.c | 5 +- drivers/media/usb/dvb-usb/friio-fe.c | 37 ++++++------- 69 files changed, 281 insertions(+), 283 deletions(-)
Signature · 1 line
2.5.0
PATCH 1/7 dvb_frontend: add props argument to dtv_get_frontend()
Instead of implicitly using the DTV cache properties at dtv_get_frontend(), pass it as an additional argument.
This patch prepares to use a separate cache for G_PROPERTY, in order to avoid it to mangle with the DVB thread zigzag logic.
--- drivers/media/dvb-core/dvb_frontend.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +18 -12
@@ -140,9 +140,12 @@ struct dvb_frontend_private {static void dvb_frontend_wakeup (struct dvb_frontend *fe);static int dtv_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c,struct dvb_frontend_parameters *p_out); -static int dtv_property_legacy_params_sync (struct dvb_frontend *fe, -struct dvb_frontend_parameters *p); +static int +dtv_property_legacy_params_sync (struct dvb_frontend *fe, +const struct dtv_frontend_properties *c, +struct dvb_frontend_parameters *p);static bool has_get_frontend (struct dvb_frontend *fe) {
@@ -202,6 +205,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, enum fe_status status) {struct dvb_frontend_private *fepriv = fe->frontend_priv; +struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct dvb_fe_events *events = &fepriv->events;struct dvb_frontend_event *e;int wp;
@@ -209,7 +213,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe,dev_dbg (fe->dvb->device,"%s:\n" , __func__);if ((status &FE_HAS_LOCK ) &&has_get_frontend (fe)) -dtv_get_frontend (fe, &fepriv->parameters_out); +dtv_get_frontend (fe, c, &fepriv->parameters_out);mutex_lock (&events->mtx);
@@ -687,6 +691,7 @@ static int dvb_enable_media_tuner(struct dvb_frontend *fe)static int dvb_frontend_thread (void *data) {struct dvb_frontend *fe = data; +struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct dvb_frontend_private *fepriv = fe->frontend_priv;enum fe_status s;enum dvbfe_algo algo;
@@ -807,7 +812,7 @@ restart: fepriv->algo_status |=DVBFE_ALGO_SEARCH_AGAIN ; fepriv->delay =HZ /2 ; } -dtv_property_legacy_params_sync (fe, &fepriv->parameters_out); +dtv_property_legacy_params_sync (fe, c, &fepriv->parameters_out); fe->ops.read_status (fe, &s);if (s != fepriv->status) {dvb_frontend_add_event (fe, s);/* update event list */
@@ -1274,11 +1279,11 @@ static int dtv_property_cache_sync(struct dvb_frontend *fe,/* Ensure the cached values are set correctly in the frontend * legacy tuning structures, for the advanced tuning API. */ -static int dtv_property_legacy_params_sync (struct dvb_frontend *fe, -struct dvb_frontend_parameters *p) +static int +dtv_property_legacy_params_sync (struct dvb_frontend *fe, +const struct dtv_frontend_properties *c, +struct dvb_frontend_parameters *p) { -const struct dtv_frontend_properties *c = &fe->dtv_property_cache; - p->frequency = c->frequency; p->inversion = c->inversion;
@@ -1350,6 +1355,7 @@ static int dtv_property_legacy_params_sync(struct dvb_frontend *fe,* If p_out is not null, it will update the DVBv3 params pointed by it. */ static int dtv_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c,struct dvb_frontend_parameters *p_out) {int r;
@@ -1359,7 +1365,7 @@ static int dtv_get_frontend(struct dvb_frontend *fe,if (unlikely (r <0 ))return r;if (p_out) -dtv_property_legacy_params_sync (fe, p_out); +dtv_property_legacy_params_sync (fe, c, p_out);return 0 ; }
@@ -2107,7 +2113,7 @@ static int dvb_frontend_ioctl_properties(struct file *file,* is not idle. Otherwise, returns the cached content */ if (fepriv->state !=FESTATE_IDLE ) { - err =dtv_get_frontend (fe,NULL ); + err =dtv_get_frontend (fe, c,NULL );if (err <0 ) goto out; }
@@ -2147,7 +2153,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe)* the user. FE_SET_FRONTEND triggers an initial frontend event * with status = 0, which copies output parameters to userspace. */ -dtv_property_legacy_params_sync (fe, &fepriv->parameters_out); +dtv_property_legacy_params_sync (fe, c, &fepriv->parameters_out);/* * Be sure that the bandwidth will be filled for all
@@ -2518,7 +2524,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file,break ;case FE_GET_FRONTEND : - err =dtv_get_frontend (fe, parg); + err =dtv_get_frontend (fe, c, parg);break ;case FE_SET_FRONTEND_TUNE_MODE :
Signature · 1 line
2.5.0
PATCH 2/7 siano: remove get_frontend stub
In reply to Mauro Carvalho ChehabThere's nothing at siano's get_frontend() callback. So, remove it, as the core will handle it.
--- drivers/media/common/siano/smsdvb-main.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/media/common/siano/smsdvb-main.c +0 -7
@@ -1015,12 +1015,6 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe) } } -/* Nothing to do here, as stats are automatically updated */ -static int smsdvb_get_frontend (struct dvb_frontend *fe) -{ -return 0 ; -} -static int smsdvb_init (struct dvb_frontend *fe) { struct smsdvb_client_t *client =
@@ -1069,7 +1063,6 @@ static struct dvb_frontend_ops smsdvb_fe_ops = { .release = smsdvb_release, .set_frontend = smsdvb_set_frontend, - .get_frontend = smsdvb_get_frontend, .get_tune_settings = smsdvb_get_tune_settings, .read_status = smsdvb_read_status,
Signature · 1 line
2.5.0
Re: [PATCH 2/7] [media] siano: remove get_frontend stub
Hello Mauro,
Quoted 5 lines · Mauro Carvalho Chehab
There's nothing at siano's
get_frontend()callback. So, remove it, as the core will handle it.Signed-off-by Mauro Carvalho Chehab <[email protected]>---
The patch looks good to me.
Best regards,
Signature · 3 lines
Javier Martinez Canillas Open Source Group Samsung Research America
PATCH 3/7 friio-fe: remove get_frontend() callback
In reply to Mauro Carvalho ChehabThis driver doesn't support getting frontend information and it only works in automatic mode.
So, let's remove get_frontend() and update the cache at set_frontend().
--- drivers/media/usb/dvb-usb/friio-fe.c | 37 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 22 deletions(-)
drivers/media/usb/dvb-usb/friio-fe.c +15 -22
@@ -283,9 +283,22 @@ static int jdvbt90502_set_property(struct dvb_frontend *fe,return r; } -static int jdvbt90502_get_frontend (struct dvb_frontend *fe) +static int jdvbt90502_set_frontend (struct dvb_frontend *fe) {struct dtv_frontend_properties *p = &fe->dtv_property_cache; + +/** +* NOTE: ignore all the parameters except frequency. +* others should be fixed to the proper value for ISDB-T, +* but don't check here. +*/ + +struct jdvbt90502_state *state = fe->demodulator_priv; +int ret; + +deb_fe ("%s: Freq:%d\n" , __func__, p->frequency); + +/* This driver only works on auto mode */ p->inversion =INVERSION_AUTO ; p->bandwidth_hz =6000000 ; p->code_rate_HP =FEC_AUTO ;
@@ -294,26 +307,7 @@ static int jdvbt90502_get_frontend(struct dvb_frontend *fe) p->transmission_mode =TRANSMISSION_MODE_AUTO ; p->guard_interval =GUARD_INTERVAL_AUTO ; p->hierarchy =HIERARCHY_AUTO ; -return 0 ; -} - -static int jdvbt90502_set_frontend (struct dvb_frontend *fe) -{ -struct dtv_frontend_properties *p = &fe->dtv_property_cache; - -/** -* NOTE: ignore all the parameters except frequency. -* others should be fixed to the proper value for ISDB-T, -* but don't check here. -*/ - -struct jdvbt90502_state *state = fe->demodulator_priv; -int ret; - -deb_fe ("%s: Freq:%d\n" , __func__, p->frequency); - -/* for recovery from DTV_CLEAN */ - fe->dtv_property_cache.delivery_system =SYS_ISDBT ; + p->delivery_system =SYS_ISDBT ; ret =jdvbt90502_pll_set_freq (state, p->frequency);if (ret) {
@@ -466,7 +460,6 @@ static struct dvb_frontend_ops jdvbt90502_ops = { .set_property = jdvbt90502_set_property, .set_frontend = jdvbt90502_set_frontend, - .get_frontend = jdvbt90502_get_frontend, .read_status = jdvbt90502_read_status, .read_signal_strength = jdvbt90502_read_signal_strength,
Signature · 1 line
2.5.0
PATCH 4/7 lgs8gxx: don't export get_frontend() callback
In reply to Mauro Carvalho ChehabThis device doesn't really have a get_frontend(). All it does is to blindly set everything to auto mode.
Remove the get_frontend(), as the code does that already, and put the frontend changes at set_frontend, where it belongs.
--- drivers/media/dvb-frontends/lgs8gxx.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/media/dvb-frontends/lgs8gxx.c +1 -12
@@ -672,7 +672,7 @@ static int lgs8gxx_write(struct dvb_frontend *fe, const u8 buf[], int len)static int lgs8gxx_set_fe (struct dvb_frontend *fe) { - +struct dtv_frontend_properties *fe_params = &fe->dtv_property_cache;struct lgs8gxx_state *priv = fe->demodulator_priv;dprintk ("%s\n" , __func__);
@@ -689,17 +689,7 @@ static int lgs8gxx_set_fe(struct dvb_frontend *fe)msleep (10 ); -return 0 ; -} - -static int lgs8gxx_get_fe (struct dvb_frontend *fe) -{ -struct dtv_frontend_properties *fe_params = &fe->dtv_property_cache; -dprintk ("%s\n" , __func__); -/* TODO: get real readings from device */ -/* inversion status */ - fe_params->inversion =INVERSION_OFF ;/* bandwidth */ fe_params->bandwidth_hz =8000000 ;
@@ -1016,7 +1006,6 @@ static struct dvb_frontend_ops lgs8gxx_ops = { .i2c_gate_ctrl = lgs8gxx_i2c_gate_ctrl, .set_frontend = lgs8gxx_set_fe, - .get_frontend = lgs8gxx_get_fe, .get_tune_settings = lgs8gxx_get_tune_settings, .read_status = lgs8gxx_read_status,
Signature · 1 line
2.5.0
PATCH 5/7 mb86a20s: get rid of dummy get_frontend()
In reply to Mauro Carvalho ChehabThis is not needed, as the core handles well if get_frontend() is not present.
--- drivers/media/dvb-frontends/mb86a20s.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/media/dvb-frontends/mb86a20s.c +0 -11
@@ -2028,16 +2028,6 @@ static int mb86a20s_read_signal_strength_from_cache(struct dvb_frontend *fe,return 0 ; } -static int mb86a20s_get_frontend_dummy (struct dvb_frontend *fe) -{ -/* -* get_frontend is now handled together with other stats -* retrival, when read_status() is called, as some statistics -* will depend on the layers detection. -*/ -return 0 ; -}; - static int mb86a20s_tune(struct dvb_frontend *fe, bool re_tune, unsigned int mode_flags,
@@ -2136,7 +2126,6 @@ static struct dvb_frontend_ops mb86a20s_ops = { .init = mb86a20s_initfe, .set_frontend = mb86a20s_set_frontend, - .get_frontend = mb86a20s_get_frontend_dummy, .read_status = mb86a20s_read_status_and_stats, .read_signal_strength = mb86a20s_read_signal_strength_from_cache, .tune = mb86a20s_tune,
Signature · 1 line
2.5.0
PATCH 6/7 dvb_frontend: pass the props cache to get_frontend() as arg
In reply to Mauro Carvalho ChehabInstead of using the DTV properties cache directly, pass the get frontend data as an argument. For now, everything should remain the same, but the next patch will prevent get_frontend to affect the global cache.
This is needed because several drivers don't care enough to only change the properties if locked. Due to that, calling G_PROPERTY before locking on those drivers will make them to never lock. Ok, those drivers are crap and should never be merged like that, but the core should not rely that the drivers would be doing the right thing.
--- drivers/media/dvb-core/dvb_frontend.c | 2 +- drivers/media/dvb-core/dvb_frontend.h | 3 +- drivers/media/dvb-frontends/af9013.c | 4 +- drivers/media/dvb-frontends/af9033.c | 4 +- drivers/media/dvb-frontends/as102_fe.c | 4 +- drivers/media/dvb-frontends/atbm8830.c | 4 +- drivers/media/dvb-frontends/au8522_dig.c | 4 +- drivers/media/dvb-frontends/cx22700.c | 4 +- drivers/media/dvb-frontends/cx22702.c | 4 +- drivers/media/dvb-frontends/cx24110.c | 4 +- drivers/media/dvb-frontends/cx24117.c | 4 +- drivers/media/dvb-frontends/cx24120.c | 4 +- drivers/media/dvb-frontends/cx24123.c | 4 +- drivers/media/dvb-frontends/cxd2820r_c.c | 4 +- drivers/media/dvb-frontends/cxd2820r_core.c | 9 ++-- drivers/media/dvb-frontends/cxd2820r_priv.h | 9 ++-- drivers/media/dvb-frontends/cxd2820r_t.c | 4 +- drivers/media/dvb-frontends/cxd2820r_t2.c | 6 +-- drivers/media/dvb-frontends/cxd2841er.c | 4 +- drivers/media/dvb-frontends/dib3000mb.c | 9 ++-- drivers/media/dvb-frontends/dib3000mc.c | 6 +-- drivers/media/dvb-frontends/dib7000m.c | 6 +-- drivers/media/dvb-frontends/dib7000p.c | 6 +-- drivers/media/dvb-frontends/dib8000.c | 75 ++++++++++++++------------- drivers/media/dvb-frontends/dib9000.c | 23 ++++---- drivers/media/dvb-frontends/dvb_dummy_fe.c | 7 ++- drivers/media/dvb-frontends/hd29l2.c | 4 +- drivers/media/dvb-frontends/l64781.c | 4 +- drivers/media/dvb-frontends/lg2160.c | 62 +++++++++++----------- drivers/media/dvb-frontends/lgdt3305.c | 4 +- drivers/media/dvb-frontends/lgdt3306a.c | 4 +- drivers/media/dvb-frontends/lgdt330x.c | 5 +- drivers/media/dvb-frontends/lgs8gl5.c | 5 +- drivers/media/dvb-frontends/m88ds3103.c | 4 +- drivers/media/dvb-frontends/m88rs2000.c | 5 +- drivers/media/dvb-frontends/mt312.c | 4 +- drivers/media/dvb-frontends/mt352.c | 4 +- drivers/media/dvb-frontends/or51132.c | 4 +- drivers/media/dvb-frontends/rtl2830.c | 4 +- drivers/media/dvb-frontends/rtl2832.c | 4 +- drivers/media/dvb-frontends/s5h1409.c | 4 +- drivers/media/dvb-frontends/s5h1411.c | 4 +- drivers/media/dvb-frontends/s5h1420.c | 4 +- drivers/media/dvb-frontends/s921.c | 4 +- drivers/media/dvb-frontends/stb0899_drv.c | 4 +- drivers/media/dvb-frontends/stb6100.c | 2 +- drivers/media/dvb-frontends/stv0297.c | 4 +- drivers/media/dvb-frontends/stv0299.c | 4 +- drivers/media/dvb-frontends/stv0367.c | 8 +-- drivers/media/dvb-frontends/stv0900_core.c | 4 +- drivers/media/dvb-frontends/tc90522.c | 10 ++-- drivers/media/dvb-frontends/tda10021.c | 4 +- drivers/media/dvb-frontends/tda10023.c | 4 +- drivers/media/dvb-frontends/tda10048.c | 4 +- drivers/media/dvb-frontends/tda1004x.c | 4 +- drivers/media/dvb-frontends/tda10071.c | 4 +- drivers/media/dvb-frontends/tda10086.c | 4 +- drivers/media/dvb-frontends/tda8083.c | 4 +- drivers/media/dvb-frontends/ves1820.c | 4 +- drivers/media/dvb-frontends/ves1x93.c | 4 +- drivers/media/dvb-frontends/zl10353.c | 4 +- drivers/media/pci/bt8xx/dst.c | 4 +- drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c | 4 +- drivers/media/usb/dvb-usb/af9005-fe.c | 4 +- drivers/media/usb/dvb-usb/dtt200u-fe.c | 5 +- 65 files changed, 230 insertions(+), 213 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +1 -1
@@ -1361,7 +1361,7 @@ static int dtv_get_frontend(struct dvb_frontend *fe,int r;if (fe->ops.get_frontend) { - r = fe->ops.get_frontend (fe); + r = fe->ops.get_frontend (fe, c);if (unlikely (r <0 ))return r;if (p_out)
drivers/media/dvb-core/dvb_frontend.h +2 -1
@@ -449,7 +449,8 @@ struct dvb_frontend_ops {int (*set_frontend)(struct dvb_frontend *fe);int (*get_tune_settings)(struct dvb_frontend * fe,struct dvb_frontend_tune_settings * settings); -int (*get_frontend)(struct dvb_frontend *fe); +int (*get_frontend)(struct dvb_frontend *fe, +struct dtv_frontend_properties *props);int (*read_status)(struct dvb_frontend *fe,enum fe_status *status);int (*read_ber)(struct dvb_frontend * fe,u32 * ber);
drivers/media/dvb-frontends/af9013.c +2 -2
@@ -866,9 +866,9 @@ err:return ret; } -static int af9013_get_frontend (struct dvb_frontend *fe) +static int af9013_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) { -struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct af9013_state *state = fe->demodulator_priv;int ret;u8 buf[3 ];
drivers/media/dvb-frontends/af9033.c +2 -2
@@ -691,10 +691,10 @@ err:return ret; } -static int af9033_get_frontend (struct dvb_frontend *fe) +static int af9033_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct af9033_dev *dev = fe->demodulator_priv; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;int ret;u8 buf[8 ];
drivers/media/dvb-frontends/as102_fe.c +2 -2
@@ -190,10 +190,10 @@ static int as102_fe_set_frontend(struct dvb_frontend *fe)return state->ops->set_tune (state->priv, &tune_args); } -static int as102_fe_get_frontend (struct dvb_frontend *fe) +static int as102_fe_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct as102_state *state = fe->demodulator_priv; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;int ret =0 ;struct as10x_tps tps = {0 };
drivers/media/dvb-frontends/atbm8830.c +2 -2
@@ -297,9 +297,9 @@ static int atbm8830_set_fe(struct dvb_frontend *fe)return 0 ; } -static int atbm8830_get_fe (struct dvb_frontend *fe) +static int atbm8830_get_fe (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) { -struct dtv_frontend_properties *c = &fe->dtv_property_cache;dprintk ("%s\n" , __func__);/* TODO: get real readings from device */
drivers/media/dvb-frontends/au8522_dig.c +2 -2
@@ -816,9 +816,9 @@ static int au8522_read_ber(struct dvb_frontend *fe, u32 *ber)return au8522_read_ucblocks (fe, ber); } -static int au8522_get_frontend (struct dvb_frontend *fe) +static int au8522_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) { -struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct au8522_state *state = fe->demodulator_priv; c->frequency = state->current_frequency;
drivers/media/dvb-frontends/cx22700.c +2 -2
@@ -345,9 +345,9 @@ static int cx22700_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int cx22700_get_frontend (struct dvb_frontend *fe) +static int cx22700_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) { -struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct cx22700_state * state = fe->demodulator_priv;u8 reg09 =cx22700_readreg (state,0x09 );
drivers/media/dvb-frontends/cx22702.c +2 -2
@@ -562,9 +562,9 @@ static int cx22702_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)return 0 ; } -static int cx22702_get_frontend (struct dvb_frontend *fe) +static int cx22702_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) { -struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct cx22702_state *state = fe->demodulator_priv;u8 reg0C =cx22702_readreg (state,0x0C );
drivers/media/dvb-frontends/cx24110.c +2 -2
@@ -550,9 +550,9 @@ static int cx24110_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int cx24110_get_frontend (struct dvb_frontend *fe) +static int cx24110_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct cx24110_state *state = fe->demodulator_priv;s32 afc;unsigned sclk;
drivers/media/dvb-frontends/cx24117.c +2 -2
@@ -1560,10 +1560,10 @@ static int cx24117_get_algo(struct dvb_frontend *fe)return DVBFE_ALGO_HW ; } -static int cx24117_get_frontend (struct dvb_frontend *fe) +static int cx24117_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct cx24117_state *state = fe->demodulator_priv; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct cx24117_cmd cmd;u8 reg, st, inv;int ret, idx;
drivers/media/dvb-frontends/cx24120.c +2 -2
@@ -1502,9 +1502,9 @@ static int cx24120_sleep(struct dvb_frontend *fe)return 0 ; } -static int cx24120_get_frontend (struct dvb_frontend *fe) +static int cx24120_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) { -struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct cx24120_state *state = fe->demodulator_priv;u8 freq1, freq2, freq3;
drivers/media/dvb-frontends/cx24123.c +2 -2
@@ -945,9 +945,9 @@ static int cx24123_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int cx24123_get_frontend (struct dvb_frontend *fe) +static int cx24123_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct cx24123_state *state = fe->demodulator_priv;dprintk ("\n" );
drivers/media/dvb-frontends/cxd2820r_c.c +2 -2
@@ -101,10 +101,10 @@ error:return ret; } -int cxd2820r_get_frontend_c (struct dvb_frontend *fe) +int cxd2820r_get_frontend_c (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct cxd2820r_priv *priv = fe->demodulator_priv; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;int ret;u8 buf[2 ];
drivers/media/dvb-frontends/cxd2820r_core.c +5 -4
@@ -313,7 +313,8 @@ static int cxd2820r_read_status(struct dvb_frontend *fe, enum fe_status *status)return ret; } -static int cxd2820r_get_frontend (struct dvb_frontend *fe) +static int cxd2820r_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) {struct cxd2820r_priv *priv = fe->demodulator_priv;int ret;
@@ -326,13 +327,13 @@ static int cxd2820r_get_frontend(struct dvb_frontend *fe)switch (fe->dtv_property_cache.delivery_system) {case SYS_DVBT : - ret =cxd2820r_get_frontend_t (fe); + ret =cxd2820r_get_frontend_t (fe, p);break ;case SYS_DVBT2 : - ret =cxd2820r_get_frontend_t2 (fe); + ret =cxd2820r_get_frontend_t2 (fe, p);break ;case SYS_DVBC_ANNEX_A : - ret =cxd2820r_get_frontend_c (fe); + ret =cxd2820r_get_frontend_c (fe, p);break ;default : ret = -EINVAL ;
drivers/media/dvb-frontends/cxd2820r_priv.h +6 -3
@@ -76,7 +76,8 @@ int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val);/* cxd2820r_c.c */ -int cxd2820r_get_frontend_c (struct dvb_frontend *fe); +int cxd2820r_get_frontend_c (struct dvb_frontend *fe, +struct dtv_frontend_properties *p);int cxd2820r_set_frontend_c (struct dvb_frontend *fe);
@@ -99,7 +100,8 @@ int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe,/* cxd2820r_t.c */ -int cxd2820r_get_frontend_t (struct dvb_frontend *fe); +int cxd2820r_get_frontend_t (struct dvb_frontend *fe, +struct dtv_frontend_properties *p);int cxd2820r_set_frontend_t (struct dvb_frontend *fe);
@@ -122,7 +124,8 @@ int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe,/* cxd2820r_t2.c */ -int cxd2820r_get_frontend_t2 (struct dvb_frontend *fe); +int cxd2820r_get_frontend_t2 (struct dvb_frontend *fe, +struct dtv_frontend_properties *p);int cxd2820r_set_frontend_t2 (struct dvb_frontend *fe);
drivers/media/dvb-frontends/cxd2820r_t.c +2 -2
@@ -138,10 +138,10 @@ error:return ret; } -int cxd2820r_get_frontend_t (struct dvb_frontend *fe) +int cxd2820r_get_frontend_t (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct cxd2820r_priv *priv = fe->demodulator_priv; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;int ret;u8 buf[2 ];
drivers/media/dvb-frontends/cxd2820r_t2.c +3 -3
@@ -23,8 +23,8 @@int cxd2820r_set_frontend_t2 (struct dvb_frontend *fe) { -struct cxd2820r_priv *priv = fe->demodulator_priv;struct dtv_frontend_properties *c = &fe->dtv_property_cache; +struct cxd2820r_priv *priv = fe->demodulator_priv;int ret, i, bw_i;u32 if_freq, if_ctl;u64 num;
@@ -169,10 +169,10 @@ error: } -int cxd2820r_get_frontend_t2 (struct dvb_frontend *fe) +int cxd2820r_get_frontend_t2 (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct cxd2820r_priv *priv = fe->demodulator_priv; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;int ret;u8 buf[2 ];
drivers/media/dvb-frontends/cxd2841er.c +2 -2
@@ -2090,13 +2090,13 @@ static int cxd2841er_sleep_tc_to_active_c(struct cxd2841er_priv *priv,return 0 ; } -static int cxd2841er_get_frontend (struct dvb_frontend *fe) +static int cxd2841er_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) {enum fe_status status =0 ;u16 strength =0 , snr =0 ;u32 errors =0 , ber =0 ;struct cxd2841er_priv *priv = fe->demodulator_priv; -struct dtv_frontend_properties *p = &fe->dtv_property_cache;dev_dbg (&priv->i2c->dev,"%s()\n" , __func__);if (priv->state ==STATE_ACTIVE_S )
drivers/media/dvb-frontends/dib3000mb.c +5 -4
@@ -112,7 +112,8 @@ static u16 dib3000_seq[2][2][2] = /* fft,gua, inv */ } }; -static int dib3000mb_get_frontend (struct dvb_frontend * fe); +static int dib3000mb_get_frontend (struct dvb_frontend * fe, +struct dtv_frontend_properties *c);static int dib3000mb_set_frontend (struct dvb_frontend *fe,int tuner) {
@@ -359,7 +360,7 @@ static int dib3000mb_set_frontend(struct dvb_frontend *fe, int tuner)deb_setf ("search_state after autosearch %d after %d checks\n" ,search_state,as_count);if (search_state ==1 ) { -if (dib3000mb_get_frontend (fe) ==0 ) { +if (dib3000mb_get_frontend (fe, c) ==0 ) {deb_setf ("reading tuning data from frontend succeeded.\n" );return dib3000mb_set_frontend (fe,0 ); }
@@ -450,9 +451,9 @@ static int dib3000mb_fe_init(struct dvb_frontend* fe, int mobile_mode)return 0 ; } -static int dib3000mb_get_frontend (struct dvb_frontend * fe) +static int dib3000mb_get_frontend (struct dvb_frontend * fe, +struct dtv_frontend_properties *c) { -struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct dib3000_state * state = fe->demodulator_priv;enum fe_code_rate *cr;u16 tps_val;
drivers/media/dvb-frontends/dib3000mc.c +3 -3
@@ -636,9 +636,9 @@ struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod,EXPORT_SYMBOL (dib3000mc_get_tuner_i2c_master); -static int dib3000mc_get_frontend (struct dvb_frontend * fe) +static int dib3000mc_get_frontend (struct dvb_frontend * fe, +struct dtv_frontend_properties *fep) { -struct dtv_frontend_properties *fep = &fe->dtv_property_cache;struct dib3000mc_state *state = fe->demodulator_priv;u16 tps =dib3000mc_read_word (state,458 );
@@ -726,7 +726,7 @@ static int dib3000mc_set_frontend(struct dvb_frontend *fe)if (found ==0 || found ==1 )return 0 ;// no channel found -dib3000mc_get_frontend (fe); +dib3000mc_get_frontend (fe, fep); } ret =dib3000mc_tune (fe);
drivers/media/dvb-frontends/dib7000m.c +3 -3
@@ -1151,9 +1151,9 @@ static int dib7000m_identify(struct dib7000m_state *state) } -static int dib7000m_get_frontend (struct dvb_frontend * fe) +static int dib7000m_get_frontend (struct dvb_frontend * fe, +struct dtv_frontend_properties *fep) { -struct dtv_frontend_properties *fep = &fe->dtv_property_cache;struct dib7000m_state *state = fe->demodulator_priv;u16 tps =dib7000m_read_word (state,480 );
@@ -1246,7 +1246,7 @@ static int dib7000m_set_frontend(struct dvb_frontend *fe)if (found ==0 || found ==1 )return 0 ;// no channel found -dib7000m_get_frontend (fe); +dib7000m_get_frontend (fe, fep); } ret =dib7000m_tune (fe);
drivers/media/dvb-frontends/dib7000p.c +3 -3
@@ -1405,9 +1405,9 @@ static int dib7000p_identify(struct dib7000p_state *st)return 0 ; } -static int dib7000p_get_frontend (struct dvb_frontend *fe) +static int dib7000p_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *fep) { -struct dtv_frontend_properties *fep = &fe->dtv_property_cache;struct dib7000p_state *state = fe->demodulator_priv;u16 tps =dib7000p_read_word (state,463 );
@@ -1540,7 +1540,7 @@ static int dib7000p_set_frontend(struct dvb_frontend *fe)if (found ==0 || found ==1 )return 0 ; -dib7000p_get_frontend (fe); +dib7000p_get_frontend (fe, fep); } ret =dib7000p_tune (fe);
drivers/media/dvb-frontends/dib8000.c +38 -37
203 lines not on this page · raw message
drivers/media/dvb-frontends/dib9000.c +12 -11
@@ -1889,7 +1889,8 @@ static int dib9000_fe_get_tune_settings(struct dvb_frontend *fe, struct dvb_fronreturn 0 ; } -static int dib9000_get_frontend (struct dvb_frontend *fe) +static int dib9000_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct dib9000_state *state = fe->demodulator_priv;u8 index_frontend, sub_index_frontend;
@@ -1909,7 +1910,7 @@ static int dib9000_get_frontend(struct dvb_frontend *fe)dprintk ("TPS lock on the slave%i" , index_frontend);/* synchronize the cache with the other frontends */ - state->fe[index_frontend]->ops.get_frontend (state->fe[index_frontend]); + state->fe[index_frontend]->ops.get_frontend (state->fe[index_frontend], c);for (sub_index_frontend =0 ; (sub_index_frontend <MAX_NUMBER_OF_FRONTENDS ) && (state->fe[sub_index_frontend] !=NULL ); sub_index_frontend++) {if (sub_index_frontend != index_frontend) {
@@ -1943,14 +1944,14 @@ static int dib9000_get_frontend(struct dvb_frontend *fe)/* synchronize the cache with the other frontends */ for (index_frontend =1 ; (index_frontend <MAX_NUMBER_OF_FRONTENDS ) && (state->fe[index_frontend] !=NULL ); index_frontend++) { - state->fe[index_frontend]->dtv_property_cache.inversion = fe->dtv_property_cache.inversion; - state->fe[index_frontend]->dtv_property_cache.transmission_mode = fe->dtv_property_cache.transmission_mode; - state->fe[index_frontend]->dtv_property_cache.guard_interval = fe->dtv_property_cache.guard_interval; - state->fe[index_frontend]->dtv_property_cache.modulation = fe->dtv_property_cache.modulation; - state->fe[index_frontend]->dtv_property_cache.hierarchy = fe->dtv_property_cache.hierarchy; - state->fe[index_frontend]->dtv_property_cache.code_rate_HP = fe->dtv_property_cache.code_rate_HP; - state->fe[index_frontend]->dtv_property_cache.code_rate_LP = fe->dtv_property_cache.code_rate_LP; - state->fe[index_frontend]->dtv_property_cache.rolloff = fe->dtv_property_cache.rolloff; + state->fe[index_frontend]->dtv_property_cache.inversion = c->inversion; + state->fe[index_frontend]->dtv_property_cache.transmission_mode = c->transmission_mode; + state->fe[index_frontend]->dtv_property_cache.guard_interval = c->guard_interval; + state->fe[index_frontend]->dtv_property_cache.modulation = c->modulation; + state->fe[index_frontend]->dtv_property_cache.hierarchy = c->hierarchy; + state->fe[index_frontend]->dtv_property_cache.code_rate_HP = c->code_rate_HP; + state->fe[index_frontend]->dtv_property_cache.code_rate_LP = c->code_rate_LP; + state->fe[index_frontend]->dtv_property_cache.rolloff = c->rolloff; } ret =0 ;
@@ -2083,7 +2084,7 @@ static int dib9000_set_frontend(struct dvb_frontend *fe)/* synchronize all the channel cache */ state->get_frontend_internal =1 ; -dib9000_get_frontend (state->fe[0 ]); +dib9000_get_frontend (state->fe[0 ], &state->fe[0 ]->dtv_property_cache); state->get_frontend_internal =0 ;/* retune the other frontends with the found channel */
drivers/media/dvb-frontends/dvb_dummy_fe.c +5 -2
@@ -70,9 +70,12 @@ static int dvb_dummy_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) }/* -* Only needed if it actually reads something from the hardware +* Should only be implemented if it actually reads something from the hardware. +* Also, it should check for the locks, in order to avoid report wrong data +* to userspace. */ -static int dvb_dummy_fe_get_frontend (struct dvb_frontend *fe) +static int dvb_dummy_fe_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) {return 0 ; }
drivers/media/dvb-frontends/hd29l2.c +2 -2
@@ -560,11 +560,11 @@ static int hd29l2_get_frontend_algo(struct dvb_frontend *fe)return DVBFE_ALGO_CUSTOM ; } -static int hd29l2_get_frontend (struct dvb_frontend *fe) +static int hd29l2_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {int ret;struct hd29l2_priv *priv = fe->demodulator_priv; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;u8 buf[3 ];u32 if_ctl; char *str_constellation, *str_code_rate, *str_constellation_code_rate,
drivers/media/dvb-frontends/l64781.c +2 -2
@@ -243,9 +243,9 @@ static int apply_frontend_param(struct dvb_frontend *fe)return 0 ; } -static int get_frontend (struct dvb_frontend *fe) +static int get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct l64781_state * state = fe->demodulator_priv;int tmp;
drivers/media/dvb-frontends/lg2160.c +33 -29
155 lines not on this page · raw message
drivers/media/dvb-frontends/lgdt3305.c +2 -2
@@ -812,9 +812,9 @@ fail:return ret; } -static int lgdt3305_get_frontend (struct dvb_frontend *fe) +static int lgdt3305_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct lgdt3305_state *state = fe->demodulator_priv;lg_dbg ("\n" );
drivers/media/dvb-frontends/lgdt3306a.c +2 -2
@@ -1040,10 +1040,10 @@ fail:return ret; } -static int lgdt3306a_get_frontend (struct dvb_frontend *fe) +static int lgdt3306a_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) {struct lgdt3306a_state *state = fe->demodulator_priv; -struct dtv_frontend_properties *p = &fe->dtv_property_cache;dbg_info ("(%u, %d)\n" , state->current_frequency, state->current_modulation);
drivers/media/dvb-frontends/lgdt330x.c +3 -2
@@ -439,10 +439,11 @@ static int lgdt330x_set_parameters(struct dvb_frontend *fe)return 0 ; } -static int lgdt330x_get_frontend (struct dvb_frontend *fe) +static int lgdt330x_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct lgdt330x_state *state = fe->demodulator_priv; + p->frequency = state->current_frequency;return 0 ; }
drivers/media/dvb-frontends/lgs8gl5.c +3 -2
@@ -336,10 +336,11 @@ lgs8gl5_set_frontend(struct dvb_frontend *fe)static int -lgs8gl5_get_frontend (struct dvb_frontend *fe) +lgs8gl5_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct lgs8gl5_state *state = fe->demodulator_priv; +u8 inv =lgs8gl5_read_reg (state,REG_INVERSION ); p->inversion = (inv ®_INVERSION_ON ) ?INVERSION_ON :INVERSION_OFF ;
drivers/media/dvb-frontends/m88ds3103.c +2 -2
@@ -791,11 +791,11 @@ err:return ret; } -static int m88ds3103_get_frontend (struct dvb_frontend *fe) +static int m88ds3103_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct m88ds3103_dev *dev = fe->demodulator_priv;struct i2c_client *client = dev->client; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;int ret;u8 buf[3 ];
drivers/media/dvb-frontends/m88rs2000.c +3 -2
@@ -708,10 +708,11 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int m88rs2000_get_frontend (struct dvb_frontend *fe) +static int m88rs2000_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) { -struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct m88rs2000_state *state = fe->demodulator_priv; + c->fec_inner = state->fec_inner; c->frequency = state->tuner_frequency; c->symbol_rate = state->symbol_rate;
drivers/media/dvb-frontends/mt312.c +2 -2
@@ -647,9 +647,9 @@ static int mt312_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int mt312_get_frontend (struct dvb_frontend *fe) +static int mt312_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct mt312_state *state = fe->demodulator_priv;int ret;
drivers/media/dvb-frontends/mt352.c +2 -2
@@ -311,9 +311,9 @@ static int mt352_set_parameters(struct dvb_frontend *fe)return 0 ; } -static int mt352_get_parameters (struct dvb_frontend * fe) +static int mt352_get_parameters (struct dvb_frontend * fe, +struct dtv_frontend_properties *op) { -struct dtv_frontend_properties *op = &fe->dtv_property_cache;struct mt352_state * state = fe->demodulator_priv;u16 tps;u16 div;
drivers/media/dvb-frontends/or51132.c +2 -2
@@ -375,9 +375,9 @@ static int or51132_set_parameters(struct dvb_frontend *fe)return 0 ; } -static int or51132_get_parameters (struct dvb_frontend * fe) +static int or51132_get_parameters (struct dvb_frontend * fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct or51132_state * state = fe->demodulator_priv;int status;int retry =1 ;
drivers/media/dvb-frontends/rtl2830.c +2 -2
@@ -279,11 +279,11 @@ err:return ret; } -static int rtl2830_get_frontend (struct dvb_frontend *fe) +static int rtl2830_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct i2c_client *client = fe->demodulator_priv;struct rtl2830_dev *dev =i2c_get_clientdata (client); -struct dtv_frontend_properties *c = &fe->dtv_property_cache;int ret;u8 buf[3 ];
drivers/media/dvb-frontends/rtl2832.c +2 -2
@@ -575,11 +575,11 @@ err:return ret; } -static int rtl2832_get_frontend (struct dvb_frontend *fe) +static int rtl2832_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct rtl2832_dev *dev = fe->demodulator_priv;struct i2c_client *client = dev->client; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;int ret;u8 buf[3 ];
drivers/media/dvb-frontends/s5h1409.c +2 -2
@@ -925,9 +925,9 @@ static int s5h1409_read_ber(struct dvb_frontend *fe, u32 *ber)return s5h1409_read_ucblocks (fe, ber); } -static int s5h1409_get_frontend (struct dvb_frontend *fe) +static int s5h1409_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct s5h1409_state *state = fe->demodulator_priv; p->frequency = state->current_frequency;
drivers/media/dvb-frontends/s5h1411.c +2 -2
@@ -840,9 +840,9 @@ static int s5h1411_read_ber(struct dvb_frontend *fe, u32 *ber)return s5h1411_read_ucblocks (fe, ber); } -static int s5h1411_get_frontend (struct dvb_frontend *fe) +static int s5h1411_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct s5h1411_state *state = fe->demodulator_priv; p->frequency = state->current_frequency;
drivers/media/dvb-frontends/s5h1420.c +2 -2
@@ -756,9 +756,9 @@ static int s5h1420_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int s5h1420_get_frontend (struct dvb_frontend * fe) +static int s5h1420_get_frontend (struct dvb_frontend * fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct s5h1420_state * state = fe->demodulator_priv; p->frequency = state->tunedfreq +s5h1420_getfreqoffset (state);
drivers/media/dvb-frontends/s921.c +2 -2
@@ -433,9 +433,9 @@ static int s921_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int s921_get_frontend (struct dvb_frontend *fe) +static int s921_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct s921_state *state = fe->demodulator_priv;/* FIXME: Probably it is possible to get it from regs f1 and f2 */
drivers/media/dvb-frontends/stb0899_drv.c +2 -2
@@ -1568,9 +1568,9 @@ static enum dvbfe_search stb0899_search(struct dvb_frontend *fe)return DVBFE_ALGO_SEARCH_ERROR ; } -static int stb0899_get_frontend (struct dvb_frontend *fe) +static int stb0899_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct stb0899_state *state = fe->demodulator_priv;struct stb0899_internal *internal = &state->internal;
drivers/media/dvb-frontends/stb6100.c +1 -1
@@ -346,7 +346,7 @@ static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)if (fe->ops.get_frontend) {dprintk (verbose,FE_DEBUG ,1 ,"Get frontend parameters" ); - fe->ops.get_frontend (fe); + fe->ops.get_frontend (fe, p); } srate = p->symbol_rate;
drivers/media/dvb-frontends/stv0297.c +2 -2
@@ -615,9 +615,9 @@ timeout:return 0 ; } -static int stv0297_get_frontend (struct dvb_frontend *fe) +static int stv0297_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct stv0297_state *state = fe->demodulator_priv;int reg_00, reg_83;
drivers/media/dvb-frontends/stv0299.c +2 -2
@@ -602,9 +602,9 @@ static int stv0299_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int stv0299_get_frontend (struct dvb_frontend *fe) +static int stv0299_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct stv0299_state * state = fe->demodulator_priv;s32 derot_freq;int invval;
drivers/media/dvb-frontends/stv0367.c +4 -4
@@ -1938,9 +1938,9 @@ static int stv0367ter_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)return 0 ; } -static int stv0367ter_get_frontend (struct dvb_frontend *fe) +static int stv0367ter_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct stv0367_state *state = fe->demodulator_priv;struct stv0367ter_state *ter_state = state->ter_state;enum stv0367_ter_mode mode;
@@ -3146,9 +3146,9 @@ static int stv0367cab_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int stv0367cab_get_frontend (struct dvb_frontend *fe) +static int stv0367cab_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct stv0367_state *state = fe->demodulator_priv;struct stv0367cab_state *cab_state = state->cab_state;
drivers/media/dvb-frontends/stv0900_core.c +2 -2
@@ -1859,9 +1859,9 @@ static int stv0900_sleep(struct dvb_frontend *fe)return 0 ; } -static int stv0900_get_frontend (struct dvb_frontend *fe) +static int stv0900_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct stv0900_state *state = fe->demodulator_priv;struct stv0900_internal *intp = state->internal;enum fe_stv0900_demod_num demod = state->demod;
drivers/media/dvb-frontends/tc90522.c +4 -6
@@ -201,10 +201,10 @@ static const enum fe_code_rate fec_conv_sat[] = { FEC_2_3, /* for 8PSK. (trellis code) */ }; -static int tc90522s_get_frontend (struct dvb_frontend *fe) +static int tc90522s_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct tc90522_state *state; -struct dtv_frontend_properties *c;struct dtv_fe_stats *stats;int ret, i;int layers;
@@ -212,7 +212,6 @@ static int tc90522s_get_frontend(struct dvb_frontend *fe)u32 cndat; state = fe->demodulator_priv; - c = &fe->dtv_property_cache; c->delivery_system =SYS_ISDBS ; c->symbol_rate =28860000 ;
@@ -337,10 +336,10 @@ static const enum fe_modulation mod_conv[] = { DQPSK, QPSK, QAM_16, QAM_64, 0, 0, 0, 0 }; -static int tc90522t_get_frontend (struct dvb_frontend *fe) +static int tc90522t_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct tc90522_state *state; -struct dtv_frontend_properties *c;struct dtv_fe_stats *stats;int ret, i;int layers;
@@ -348,7 +347,6 @@ static int tc90522t_get_frontend(struct dvb_frontend *fe)u32 cndat; state = fe->demodulator_priv; - c = &fe->dtv_property_cache; c->delivery_system =SYS_ISDBT ; c->bandwidth_hz =6000000 ; mode =1 ;
drivers/media/dvb-frontends/tda10021.c +2 -2
@@ -387,9 +387,9 @@ static int tda10021_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)return 0 ; } -static int tda10021_get_frontend (struct dvb_frontend *fe) +static int tda10021_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct tda10021_state * state = fe->demodulator_priv;int sync;s8 afc =0 ;
drivers/media/dvb-frontends/tda10023.c +2 -2
@@ -457,9 +457,9 @@ static int tda10023_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)return 0 ; } -static int tda10023_get_frontend (struct dvb_frontend *fe) +static int tda10023_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct tda10023_state * state = fe->demodulator_priv;int sync,inv;s8 afc =0 ;
drivers/media/dvb-frontends/tda10048.c +2 -2
@@ -1028,9 +1028,9 @@ static int tda10048_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)return 0 ; } -static int tda10048_get_frontend (struct dvb_frontend *fe) +static int tda10048_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct tda10048_state *state = fe->demodulator_priv;dprintk (1 ,"%s()\n" , __func__);
drivers/media/dvb-frontends/tda1004x.c +2 -2
@@ -899,9 +899,9 @@ static int tda1004x_set_fe(struct dvb_frontend *fe)return 0 ; } -static int tda1004x_get_fe (struct dvb_frontend *fe) +static int tda1004x_get_fe (struct dvb_frontend *fe, +struct dtv_frontend_properties *fe_params) { -struct dtv_frontend_properties *fe_params = &fe->dtv_property_cache;struct tda1004x_state * state = fe->demodulator_priv;dprintk ("%s\n" , __func__);
drivers/media/dvb-frontends/tda10071.c +2 -2
@@ -701,11 +701,11 @@ error:return ret; } -static int tda10071_get_frontend (struct dvb_frontend *fe) +static int tda10071_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) {struct tda10071_dev *dev = fe->demodulator_priv;struct i2c_client *client = dev->client; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;int ret, i;u8 buf[5 ], tmp;
drivers/media/dvb-frontends/tda10086.c +2 -2
@@ -459,9 +459,9 @@ static int tda10086_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int tda10086_get_frontend (struct dvb_frontend *fe) +static int tda10086_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *fe_params) { -struct dtv_frontend_properties *fe_params = &fe->dtv_property_cache;struct tda10086_state * state = fe->demodulator_priv;u8 val;int tmp;
drivers/media/dvb-frontends/tda8083.c +2 -2
@@ -342,9 +342,9 @@ static int tda8083_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int tda8083_get_frontend (struct dvb_frontend *fe) +static int tda8083_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct tda8083_state * state = fe->demodulator_priv;/* FIXME: get symbolrate & frequency offset...*/
drivers/media/dvb-frontends/ves1820.c +2 -2
@@ -312,9 +312,9 @@ static int ves1820_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)return 0 ; } -static int ves1820_get_frontend (struct dvb_frontend *fe) +static int ves1820_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct ves1820_state * state = fe->demodulator_priv;int sync;s8 afc =0 ;
drivers/media/dvb-frontends/ves1x93.c +2 -2
@@ -406,9 +406,9 @@ static int ves1x93_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int ves1x93_get_frontend (struct dvb_frontend *fe) +static int ves1x93_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct ves1x93_state * state = fe->demodulator_priv;int afc;
drivers/media/dvb-frontends/zl10353.c +2 -2
@@ -371,9 +371,9 @@ static int zl10353_set_parameters(struct dvb_frontend *fe)return 0 ; } -static int zl10353_get_parameters (struct dvb_frontend *fe) +static int zl10353_get_parameters (struct dvb_frontend *fe, +struct dtv_frontend_properties *c) { -struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct zl10353_state *state = fe->demodulator_priv;int s6, s9;u16 tps;
drivers/media/pci/bt8xx/dst.c +2 -2
@@ -1688,9 +1688,9 @@ static int dst_get_tuning_algo(struct dvb_frontend *fe)return dst_algo ?DVBFE_ALGO_HW :DVBFE_ALGO_SW ; } -static int dst_get_frontend (struct dvb_frontend *fe) +static int dst_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct dst_state *state = fe->demodulator_priv; p->frequency = state->decode_freq;
drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c +2 -2
@@ -507,9 +507,9 @@ static int mxl111sf_demod_read_signal_strength(struct dvb_frontend *fe,return 0 ; } -static int mxl111sf_demod_get_frontend (struct dvb_frontend *fe) +static int mxl111sf_demod_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *p) { -struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct mxl111sf_demod_state *state = fe->demodulator_priv;mxl_dbg ("()" );
drivers/media/usb/dvb-usb/af9005-fe.c +2 -2
@@ -1227,9 +1227,9 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int af9005_fe_get_frontend (struct dvb_frontend *fe) +static int af9005_fe_get_frontend (struct dvb_frontend *fe, +struct dtv_frontend_properties *fep) { -struct dtv_frontend_properties *fep = &fe->dtv_property_cache;struct af9005_fe_state *state = fe->demodulator_priv;int ret;u8 temp;
drivers/media/usb/dvb-usb/dtt200u-fe.c +3 -2
@@ -140,10 +140,11 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend *fe)return 0 ; } -static int dtt200u_fe_get_frontend (struct dvb_frontend * fe) +static int dtt200u_fe_get_frontend (struct dvb_frontend * fe, +struct dtv_frontend_properties *fep) { -struct dtv_frontend_properties *fep = &fe->dtv_property_cache;struct dtt200u_fe_state *state = fe->demodulator_priv; +memcpy (fep, &state->fep,sizeof (struct dtv_frontend_properties ));return 0 ; }
Signature · 1 line
2.5.0
Re: [PATCH 6/7] [media] dvb_frontend: pass the props cache to get_frontend() as arg
Quoted 5 lines · Mauro Carvalho Chehab
Instead of using the DTV properties cache directly, pass the get frontend data as an argument. For now, everything should remain the same, but the next patch will prevent
get_frontendto affect the global cache.
Quoted 8 lines
This is needed because several drivers don't care enough to only change the properties if locked. Due to that, calling
G_PROPERTYbefore locking on those drivers will make them to never lock. Ok, those drivers are crap and should never be merged like that, but the core should not rely that the drivers would be doing the right thing.Signed-off-by Mauro Carvalho Chehab <[email protected]>
PATCH 7/7 dvb_frontend: Don't let drivers to trash data at cache
In reply to Mauro Carvalho ChehabGET_FRONTEND and G_PROPERTY can be called anytime, even when the tuner/demod is not fully locked. However, several parameters returned by those calls are available only after the demod get VITERBI lock.
While several drivers do the right thing by checking the status before returning the parameter, some drivers simply blindly update the DTV properties cache without checking if the registers at the hardware contain valid values.
Due to that, programs that call G_PROPERTY (or GET_FRONTEND) before having a tuner lock may interfere at the zigzag logic, as the DVB kthread calls the set_frontend() callback several times, to fine tune the frequency and to identify if the signal is inverted or not.
While the drivers should be fixed to report the right status, we should prevent that such bugs would actually interfere at the device operation.
So, let's use a separate var for userspace calls to get frontend.
As we copy the content of the cache, this should not cause any troubles.
--- drivers/media/dvb-core/dvb_frontend.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +19 -8
@@ -2087,6 +2087,8 @@ static int dvb_frontend_ioctl_properties(struct file *file,dev_dbg (fe->dvb->device,"%s: Property cache is full, tuning\n" , __func__); }else if (cmd ==FE_GET_PROPERTY ) { +struct dtv_frontend_properties getp = fe->dtv_property_cache; +dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , __func__, tvps->num);dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , __func__, tvps->props);
@@ -2108,17 +2110,18 @@ static int dvb_frontend_ioctl_properties(struct file *file, }/* -* Fills the cache out struct with the cache contents, plus -* the data retrieved from get_frontend, if the frontend -* is not idle. Otherwise, returns the cached content +* Let's use our own copy of property cache, in order to +* avoid mangling with DTV zigzag logic, as drivers might +* return crap, if they don't check if the data is available +* before updating the properties cache. */ if (fepriv->state !=FESTATE_IDLE ) { - err =dtv_get_frontend (fe, c,NULL ); + err =dtv_get_frontend (fe, &getp,NULL );if (err <0 ) goto out; }for (i =0 ; i < tvps->num; i++) { - err =dtv_property_process_get (fe, c, tvp + i, file); + err =dtv_property_process_get (fe, &getp, tvp + i, file);if (err <0 ) goto out; (tvp + i)->result = err;
@@ -2523,10 +2526,18 @@ static int dvb_frontend_ioctl_legacy(struct file *file, err =dvb_frontend_get_event (fe, parg, file->f_flags);break ; -case FE_GET_FRONTEND : - err =dtv_get_frontend (fe, c, parg); -break ; +case FE_GET_FRONTEND : { +struct dtv_frontend_properties getp = fe->dtv_property_cache; +/* +* Let's use our own copy of property cache, in order to +* avoid mangling with DTV zigzag logic, as drivers might +* return crap, if they don't check if the data is available +* before updating the properties cache. +*/ + err =dtv_get_frontend (fe, &getp, parg); +break ; + }case FE_SET_FRONTEND_TUNE_MODE : fepriv->tune_mode_flags = (unsigned long ) parg; err =0 ;
Signature · 1 line
2.5.0