aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/dib0700_devices.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-18 15:53:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-18 15:53:54 -0500
commit4a7c1ff2362b7bfbc04990f42c21cefdff57f997 (patch)
tree82ac9c30ca95b6a92084f5535e6406866eb99cf3 /drivers/media/dvb/dvb-usb/dib0700_devices.c
parent9278e634b4e063f415b46923a9ca4e74f42ec932 (diff)
parent36be126cb0ebe3000a65c1049f339a3e882a9a47 (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (57 commits) [media] as3645a: Fix compilation by including slab.h [media] s5p-fimc: Remove linux/version.h include from fimc-mdevice.c [media] s5p-mfc: Remove linux/version.h include from s5p_mfc.c [media] ds3000: using logical && instead of bitwise & [media] v4l2-ctrls: make control names consistent [media] DVB: dib0700, add support for Nova-TD LEDs [media] DVB: dib0700, add corrected Nova-TD frontend_attach [media] DVB: dib0700, separate stk7070pd initialization [media] DVB: dib0700, move Nova-TD Stick to a separate set [media] : add MODULE_FIRMWARE to dib0700 [media] DVB-CORE: remove superfluous DTV_CMDs [media] s5p-jpeg: adapt to recent videobuf2 changes [media] s5p-g2d: fixed a bug in controls setting function [media] s5p-mfc: Fix volatile controls setup [media] drivers/media/video/s5p-mfc/s5p_mfc.c: adjust double test [media] drivers/media/video/s5p-fimc/fimc-capture.c: adjust double test [media] s5p-fimc: Fix incorrect control ID assignment [media] dvb_frontend: Don't call get_frontend() if idle [media] DocBook/dvbproperty.xml: Remove DTV_MODULATION from ISDB-T [media] DocBook/dvbproperty.xml: Fix ISDB-T delivery system parameters ...
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dib0700_devices.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c150
1 files changed, 137 insertions, 13 deletions
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 81ef4b46f790..f9e966aa26e7 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -3066,19 +3066,25 @@ static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
3066 } 3066 }
3067}; 3067};
3068 3068
3069static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap) 3069static void stk7070pd_init(struct dvb_usb_device *dev)
3070{ 3070{
3071 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); 3071 dib0700_set_gpio(dev, GPIO6, GPIO_OUT, 1);
3072 msleep(10); 3072 msleep(10);
3073 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); 3073 dib0700_set_gpio(dev, GPIO9, GPIO_OUT, 1);
3074 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); 3074 dib0700_set_gpio(dev, GPIO4, GPIO_OUT, 1);
3075 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); 3075 dib0700_set_gpio(dev, GPIO7, GPIO_OUT, 1);
3076 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); 3076 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 0);
3077 3077
3078 dib0700_ctrl_clock(adap->dev, 72, 1); 3078 dib0700_ctrl_clock(dev, 72, 1);
3079 3079
3080 msleep(10); 3080 msleep(10);
3081 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); 3081 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 1);
3082}
3083
3084static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
3085{
3086 stk7070pd_init(adap->dev);
3087
3082 msleep(10); 3088 msleep(10);
3083 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); 3089 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3084 3090
@@ -3099,6 +3105,77 @@ static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
3099 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; 3105 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3100} 3106}
3101 3107
3108static int novatd_read_status_override(struct dvb_frontend *fe,
3109 fe_status_t *stat)
3110{
3111 struct dvb_usb_adapter *adap = fe->dvb->priv;
3112 struct dvb_usb_device *dev = adap->dev;
3113 struct dib0700_state *state = dev->priv;
3114 int ret;
3115
3116 ret = state->read_status(fe, stat);
3117
3118 if (!ret)
3119 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT,
3120 !!(*stat & FE_HAS_LOCK));
3121
3122 return ret;
3123}
3124
3125static int novatd_sleep_override(struct dvb_frontend* fe)
3126{
3127 struct dvb_usb_adapter *adap = fe->dvb->priv;
3128 struct dvb_usb_device *dev = adap->dev;
3129 struct dib0700_state *state = dev->priv;
3130
3131 /* turn off LED */
3132 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 0);
3133
3134 return state->sleep(fe);
3135}
3136
3137/**
3138 * novatd_frontend_attach - Nova-TD specific attach
3139 *
3140 * Nova-TD has GPIO0, 1 and 2 for LEDs. So do not fiddle with them except for
3141 * information purposes.
3142 */
3143static int novatd_frontend_attach(struct dvb_usb_adapter *adap)
3144{
3145 struct dvb_usb_device *dev = adap->dev;
3146 struct dib0700_state *st = dev->priv;
3147
3148 if (adap->id == 0) {
3149 stk7070pd_init(dev);
3150
3151 /* turn the power LED on, the other two off (just in case) */
3152 dib0700_set_gpio(dev, GPIO0, GPIO_OUT, 0);
3153 dib0700_set_gpio(dev, GPIO1, GPIO_OUT, 0);
3154 dib0700_set_gpio(dev, GPIO2, GPIO_OUT, 1);
3155
3156 if (dib7000p_i2c_enumeration(&dev->i2c_adap, 2, 18,
3157 stk7070pd_dib7000p_config) != 0) {
3158 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
3159 __func__);
3160 return -ENODEV;
3161 }
3162 }
3163
3164 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &dev->i2c_adap,
3165 adap->id == 0 ? 0x80 : 0x82,
3166 &stk7070pd_dib7000p_config[adap->id]);
3167
3168 if (adap->fe_adap[0].fe == NULL)
3169 return -ENODEV;
3170
3171 st->read_status = adap->fe_adap[0].fe->ops.read_status;
3172 adap->fe_adap[0].fe->ops.read_status = novatd_read_status_override;
3173 st->sleep = adap->fe_adap[0].fe->ops.sleep;
3174 adap->fe_adap[0].fe->ops.sleep = novatd_sleep_override;
3175
3176 return 0;
3177}
3178
3102/* S5H1411 */ 3179/* S5H1411 */
3103static struct s5h1411_config pinnacle_801e_config = { 3180static struct s5h1411_config pinnacle_801e_config = {
3104 .output_mode = S5H1411_PARALLEL_OUTPUT, 3181 .output_mode = S5H1411_PARALLEL_OUTPUT,
@@ -3870,6 +3947,57 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3870 .pid_filter_count = 32, 3947 .pid_filter_count = 32,
3871 .pid_filter = stk70x0p_pid_filter, 3948 .pid_filter = stk70x0p_pid_filter,
3872 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, 3949 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3950 .frontend_attach = novatd_frontend_attach,
3951 .tuner_attach = dib7070p_tuner_attach,
3952
3953 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3954 }},
3955 .size_of_priv = sizeof(struct dib0700_adapter_state),
3956 }, {
3957 .num_frontends = 1,
3958 .fe = {{
3959 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3960 .pid_filter_count = 32,
3961 .pid_filter = stk70x0p_pid_filter,
3962 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3963 .frontend_attach = novatd_frontend_attach,
3964 .tuner_attach = dib7070p_tuner_attach,
3965
3966 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3967 }},
3968 .size_of_priv = sizeof(struct dib0700_adapter_state),
3969 }
3970 },
3971
3972 .num_device_descs = 1,
3973 .devices = {
3974 { "Hauppauge Nova-TD Stick (52009)",
3975 { &dib0700_usb_id_table[35], NULL },
3976 { NULL },
3977 },
3978 },
3979
3980 .rc.core = {
3981 .rc_interval = DEFAULT_RC_INTERVAL,
3982 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3983 .module_name = "dib0700",
3984 .rc_query = dib0700_rc_query_old_firmware,
3985 .allowed_protos = RC_TYPE_RC5 |
3986 RC_TYPE_RC6 |
3987 RC_TYPE_NEC,
3988 .change_protocol = dib0700_change_protocol,
3989 },
3990 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3991
3992 .num_adapters = 2,
3993 .adapter = {
3994 {
3995 .num_frontends = 1,
3996 .fe = {{
3997 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3998 .pid_filter_count = 32,
3999 .pid_filter = stk70x0p_pid_filter,
4000 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3873 .frontend_attach = stk7070pd_frontend_attach0, 4001 .frontend_attach = stk7070pd_frontend_attach0,
3874 .tuner_attach = dib7070p_tuner_attach, 4002 .tuner_attach = dib7070p_tuner_attach,
3875 4003
@@ -3892,7 +4020,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3892 } 4020 }
3893 }, 4021 },
3894 4022
3895 .num_device_descs = 6, 4023 .num_device_descs = 5,
3896 .devices = { 4024 .devices = {
3897 { "DiBcom STK7070PD reference design", 4025 { "DiBcom STK7070PD reference design",
3898 { &dib0700_usb_id_table[17], NULL }, 4026 { &dib0700_usb_id_table[17], NULL },
@@ -3902,10 +4030,6 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3902 { &dib0700_usb_id_table[18], NULL }, 4030 { &dib0700_usb_id_table[18], NULL },
3903 { NULL }, 4031 { NULL },
3904 }, 4032 },
3905 { "Hauppauge Nova-TD Stick (52009)",
3906 { &dib0700_usb_id_table[35], NULL },
3907 { NULL },
3908 },
3909 { "Hauppauge Nova-TD-500 (84xxx)", 4033 { "Hauppauge Nova-TD-500 (84xxx)",
3910 { &dib0700_usb_id_table[36], NULL }, 4034 { &dib0700_usb_id_table[36], NULL },
3911 { NULL }, 4035 { NULL },