aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb-frontends/af9033.c14
-rw-r--r--drivers/media/dvb-frontends/af9033.h23
-rw-r--r--drivers/media/usb/dvb-usb-v2/af9035.c10
-rw-r--r--drivers/media/usb/dvb-usb-v2/af9035.h2
4 files changed, 33 insertions, 16 deletions
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c
index 5a1c508c7417..be4bec2a9640 100644
--- a/drivers/media/dvb-frontends/af9033.c
+++ b/drivers/media/dvb-frontends/af9033.c
@@ -989,7 +989,7 @@ err:
989 return ret; 989 return ret;
990} 990}
991 991
992int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff) 992static int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff)
993{ 993{
994 struct af9033_state *state = fe->demodulator_priv; 994 struct af9033_state *state = fe->demodulator_priv;
995 int ret; 995 int ret;
@@ -1007,9 +1007,8 @@ err:
1007 1007
1008 return ret; 1008 return ret;
1009} 1009}
1010EXPORT_SYMBOL(af9033_pid_filter_ctrl);
1011 1010
1012int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid, int onoff) 1011static int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid, int onoff)
1013{ 1012{
1014 struct af9033_state *state = fe->demodulator_priv; 1013 struct af9033_state *state = fe->demodulator_priv;
1015 int ret; 1014 int ret;
@@ -1040,12 +1039,12 @@ err:
1040 1039
1041 return ret; 1040 return ret;
1042} 1041}
1043EXPORT_SYMBOL(af9033_pid_filter);
1044 1042
1045static struct dvb_frontend_ops af9033_ops; 1043static struct dvb_frontend_ops af9033_ops;
1046 1044
1047struct dvb_frontend *af9033_attach(const struct af9033_config *config, 1045struct dvb_frontend *af9033_attach(const struct af9033_config *config,
1048 struct i2c_adapter *i2c) 1046 struct i2c_adapter *i2c,
1047 struct af9033_ops *ops)
1049{ 1048{
1050 int ret; 1049 int ret;
1051 struct af9033_state *state; 1050 struct af9033_state *state;
@@ -1120,6 +1119,11 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config,
1120 memcpy(&state->fe.ops, &af9033_ops, sizeof(struct dvb_frontend_ops)); 1119 memcpy(&state->fe.ops, &af9033_ops, sizeof(struct dvb_frontend_ops));
1121 state->fe.demodulator_priv = state; 1120 state->fe.demodulator_priv = state;
1122 1121
1122 if (ops) {
1123 ops->pid_filter = af9033_pid_filter;
1124 ops->pid_filter_ctrl = af9033_pid_filter_ctrl;
1125 }
1126
1123 return &state->fe; 1127 return &state->fe;
1124 1128
1125err: 1129err:
diff --git a/drivers/media/dvb-frontends/af9033.h b/drivers/media/dvb-frontends/af9033.h
index de245f9adb65..539f4db678b8 100644
--- a/drivers/media/dvb-frontends/af9033.h
+++ b/drivers/media/dvb-frontends/af9033.h
@@ -78,17 +78,24 @@ struct af9033_config {
78}; 78};
79 79
80 80
81#if IS_ENABLED(CONFIG_DVB_AF9033) 81struct af9033_ops {
82extern struct dvb_frontend *af9033_attach(const struct af9033_config *config, 82 int (*pid_filter_ctrl)(struct dvb_frontend *fe, int onoff);
83 struct i2c_adapter *i2c); 83 int (*pid_filter)(struct dvb_frontend *fe, int index, u16 pid,
84 int onoff);
85};
84 86
85extern int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff);
86 87
87extern int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid, 88#if IS_ENABLED(CONFIG_DVB_AF9033)
88 int onoff); 89extern
90struct dvb_frontend *af9033_attach(const struct af9033_config *config,
91 struct i2c_adapter *i2c,
92 struct af9033_ops *ops);
93
89#else 94#else
90static inline struct dvb_frontend *af9033_attach( 95static inline
91 const struct af9033_config *config, struct i2c_adapter *i2c) 96struct dvb_frontend *af9033_attach(const struct af9033_config *config,
97 struct i2c_adapter *i2c,
98 struct af9033_ops *ops)
92{ 99{
93 pr_warn("%s: driver disabled by Kconfig\n", __func__); 100 pr_warn("%s: driver disabled by Kconfig\n", __func__);
94 return NULL; 101 return NULL;
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 31d09a23c82e..021e4d35e4d7 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -963,7 +963,7 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
963 963
964 /* attach demodulator */ 964 /* attach demodulator */
965 adap->fe[0] = dvb_attach(af9033_attach, &state->af9033_config[adap->id], 965 adap->fe[0] = dvb_attach(af9033_attach, &state->af9033_config[adap->id],
966 &d->i2c_adap); 966 &d->i2c_adap, &state->ops);
967 if (adap->fe[0] == NULL) { 967 if (adap->fe[0] == NULL) {
968 ret = -ENODEV; 968 ret = -ENODEV;
969 goto err; 969 goto err;
@@ -1373,13 +1373,17 @@ static int af9035_get_stream_config(struct dvb_frontend *fe, u8 *ts_type,
1373 1373
1374static int af9035_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) 1374static int af9035_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
1375{ 1375{
1376 return af9033_pid_filter_ctrl(adap->fe[0], onoff); 1376 struct state *state = adap_to_priv(adap);
1377
1378 return state->ops.pid_filter_ctrl(adap->fe[0], onoff);
1377} 1379}
1378 1380
1379static int af9035_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, 1381static int af9035_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
1380 int onoff) 1382 int onoff)
1381{ 1383{
1382 return af9033_pid_filter(adap->fe[0], index, pid, onoff); 1384 struct state *state = adap_to_priv(adap);
1385
1386 return state->ops.pid_filter(adap->fe[0], index, pid, onoff);
1383} 1387}
1384 1388
1385static int af9035_probe(struct usb_interface *intf, 1389static int af9035_probe(struct usb_interface *intf,
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h
index a1c68d829b8c..c21902fdd4c4 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.h
+++ b/drivers/media/usb/dvb-usb-v2/af9035.h
@@ -62,6 +62,8 @@ struct state {
62 u8 dual_mode:1; 62 u8 dual_mode:1;
63 u16 eeprom_addr; 63 u16 eeprom_addr;
64 struct af9033_config af9033_config[2]; 64 struct af9033_config af9033_config[2];
65
66 struct af9033_ops ops;
65}; 67};
66 68
67static const u32 clock_lut_af9035[] = { 69static const u32 clock_lut_af9035[] = {