diff options
Diffstat (limited to 'drivers/media/usb/dvb-usb-v2')
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/Makefile | 1 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 48 |
2 files changed, 43 insertions, 6 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/Makefile b/drivers/media/usb/dvb-usb-v2/Makefile index 7407b8338ccf..bc38f03394cd 100644 --- a/drivers/media/usb/dvb-usb-v2/Makefile +++ b/drivers/media/usb/dvb-usb-v2/Makefile | |||
@@ -41,4 +41,3 @@ ccflags-y += -I$(srctree)/drivers/media/dvb-core | |||
41 | ccflags-y += -I$(srctree)/drivers/media/dvb-frontends | 41 | ccflags-y += -I$(srctree)/drivers/media/dvb-frontends |
42 | ccflags-y += -I$(srctree)/drivers/media/tuners | 42 | ccflags-y += -I$(srctree)/drivers/media/tuners |
43 | ccflags-y += -I$(srctree)/drivers/media/common | 43 | ccflags-y += -I$(srctree)/drivers/media/common |
44 | ccflags-y += -I$(srctree)/drivers/staging/media/rtl2832u_sdr | ||
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index 61d196e8b3ab..dcbd392e6efc 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c | |||
@@ -24,7 +24,6 @@ | |||
24 | 24 | ||
25 | #include "rtl2830.h" | 25 | #include "rtl2830.h" |
26 | #include "rtl2832.h" | 26 | #include "rtl2832.h" |
27 | #include "rtl2832_sdr.h" | ||
28 | 27 | ||
29 | #include "qt1010.h" | 28 | #include "qt1010.h" |
30 | #include "mt2060.h" | 29 | #include "mt2060.h" |
@@ -36,6 +35,45 @@ | |||
36 | #include "tua9001.h" | 35 | #include "tua9001.h" |
37 | #include "r820t.h" | 36 | #include "r820t.h" |
38 | 37 | ||
38 | /* | ||
39 | * RTL2832_SDR module is in staging. That logic is added in order to avoid any | ||
40 | * hard dependency to drivers/staging/ directory as we want compile mainline | ||
41 | * driver even whole staging directory is missing. | ||
42 | */ | ||
43 | #include <media/v4l2-subdev.h> | ||
44 | |||
45 | #if IS_ENABLED(CONFIG_DVB_RTL2832_SDR) | ||
46 | struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe, | ||
47 | struct i2c_adapter *i2c, const struct rtl2832_config *cfg, | ||
48 | struct v4l2_subdev *sd); | ||
49 | #else | ||
50 | static inline struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe, | ||
51 | struct i2c_adapter *i2c, const struct rtl2832_config *cfg, | ||
52 | struct v4l2_subdev *sd) | ||
53 | { | ||
54 | return NULL; | ||
55 | } | ||
56 | #endif | ||
57 | |||
58 | #ifdef CONFIG_MEDIA_ATTACH | ||
59 | #define dvb_attach_sdr(FUNCTION, ARGS...) ({ \ | ||
60 | void *__r = NULL; \ | ||
61 | typeof(&FUNCTION) __a = symbol_request(FUNCTION); \ | ||
62 | if (__a) { \ | ||
63 | __r = (void *) __a(ARGS); \ | ||
64 | if (__r == NULL) \ | ||
65 | symbol_put(FUNCTION); \ | ||
66 | } \ | ||
67 | __r; \ | ||
68 | }) | ||
69 | |||
70 | #else | ||
71 | #define dvb_attach_sdr(FUNCTION, ARGS...) ({ \ | ||
72 | FUNCTION(ARGS); \ | ||
73 | }) | ||
74 | |||
75 | #endif | ||
76 | |||
39 | static int rtl28xxu_disable_rc; | 77 | static int rtl28xxu_disable_rc; |
40 | module_param_named(disable_rc, rtl28xxu_disable_rc, int, 0644); | 78 | module_param_named(disable_rc, rtl28xxu_disable_rc, int, 0644); |
41 | MODULE_PARM_DESC(disable_rc, "disable RTL2832U remote controller"); | 79 | MODULE_PARM_DESC(disable_rc, "disable RTL2832U remote controller"); |
@@ -908,7 +946,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) | |||
908 | adap->fe[0]->ops.tuner_ops.get_rf_strength; | 946 | adap->fe[0]->ops.tuner_ops.get_rf_strength; |
909 | 947 | ||
910 | /* attach SDR */ | 948 | /* attach SDR */ |
911 | dvb_attach(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap, | 949 | dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap, |
912 | &rtl28xxu_rtl2832_fc0012_config, NULL); | 950 | &rtl28xxu_rtl2832_fc0012_config, NULL); |
913 | break; | 951 | break; |
914 | case TUNER_RTL2832_FC0013: | 952 | case TUNER_RTL2832_FC0013: |
@@ -920,7 +958,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) | |||
920 | adap->fe[0]->ops.tuner_ops.get_rf_strength; | 958 | adap->fe[0]->ops.tuner_ops.get_rf_strength; |
921 | 959 | ||
922 | /* attach SDR */ | 960 | /* attach SDR */ |
923 | dvb_attach(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap, | 961 | dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap, |
924 | &rtl28xxu_rtl2832_fc0013_config, NULL); | 962 | &rtl28xxu_rtl2832_fc0013_config, NULL); |
925 | break; | 963 | break; |
926 | case TUNER_RTL2832_E4000: { | 964 | case TUNER_RTL2832_E4000: { |
@@ -951,7 +989,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) | |||
951 | i2c_set_adapdata(i2c_adap_internal, d); | 989 | i2c_set_adapdata(i2c_adap_internal, d); |
952 | 990 | ||
953 | /* attach SDR */ | 991 | /* attach SDR */ |
954 | dvb_attach(rtl2832_sdr_attach, adap->fe[0], | 992 | dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], |
955 | i2c_adap_internal, | 993 | i2c_adap_internal, |
956 | &rtl28xxu_rtl2832_e4000_config, sd); | 994 | &rtl28xxu_rtl2832_e4000_config, sd); |
957 | } | 995 | } |
@@ -982,7 +1020,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) | |||
982 | adap->fe[0]->ops.tuner_ops.get_rf_strength; | 1020 | adap->fe[0]->ops.tuner_ops.get_rf_strength; |
983 | 1021 | ||
984 | /* attach SDR */ | 1022 | /* attach SDR */ |
985 | dvb_attach(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap, | 1023 | dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap, |
986 | &rtl28xxu_rtl2832_r820t_config, NULL); | 1024 | &rtl28xxu_rtl2832_r820t_config, NULL); |
987 | break; | 1025 | break; |
988 | case TUNER_RTL2832_R828D: | 1026 | case TUNER_RTL2832_R828D: |