···111111If you have problems with this please do ask on the mailing list.112112113113--114114-Authors: Richard Walker, Jamie Honan, Michael Hunold, Manu Abraham114114+Authors: Richard Walker,115115+ Jamie Honan,116116+ Michael Hunold,117117+ Manu Abraham,118118+ Michael Krufky
···2929 A DVB-S tuner module. Say Y when you want to support this frontend.30303131config DVB_MT3123232- tristate "Zarlink MT312 based"3232+ tristate "Zarlink VP310/MT312 based"3333 depends on DVB_CORE3434 help3535 A DVB-S tuner module. Say Y when you want to support this frontend.
+44-72
drivers/media/dvb/frontends/mt312.c
···612612 kfree(state);613613}614614615615-static struct dvb_frontend_ops vp310_mt312_ops;616616-617617-struct dvb_frontend* vp310_attach(const struct mt312_config* config,618618- struct i2c_adapter* i2c)619619-{620620- struct mt312_state* state = NULL;621621-622622- /* allocate memory for the internal state */623623- state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL);624624- if (state == NULL)625625- goto error;626626-627627- /* setup the state */628628- state->config = config;629629- state->i2c = i2c;630630- memcpy(&state->ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops));631631- strcpy(state->ops.info.name, "Zarlink VP310 DVB-S");632632-633633- /* check if the demod is there */634634- if (mt312_readreg(state, ID, &state->id) < 0)635635- goto error;636636- if (state->id != ID_VP310) {637637- goto error;638638- }639639-640640- /* create dvb_frontend */641641- state->frequency = 90;642642- state->frontend.ops = &state->ops;643643- state->frontend.demodulator_priv = state;644644- return &state->frontend;645645-646646-error:647647- kfree(state);648648- return NULL;649649-}650650-651651-struct dvb_frontend* mt312_attach(const struct mt312_config* config,652652- struct i2c_adapter* i2c)653653-{654654- struct mt312_state* state = NULL;655655-656656- /* allocate memory for the internal state */657657- state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL);658658- if (state == NULL)659659- goto error;660660-661661- /* setup the state */662662- state->config = config;663663- state->i2c = i2c;664664- memcpy(&state->ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops));665665- strcpy(state->ops.info.name, "Zarlink MT312 DVB-S");666666-667667- /* check if the demod is there */668668- if (mt312_readreg(state, ID, &state->id) < 0)669669- goto error;670670- if (state->id != ID_MT312) {671671- goto error;672672- }673673-674674- /* create dvb_frontend */675675- state->frequency = 60;676676- state->frontend.ops = &state->ops;677677- state->frontend.demodulator_priv = state;678678- return &state->frontend;679679-680680-error:681681- kfree(state);682682- return NULL;683683-}684684-685615static struct dvb_frontend_ops vp310_mt312_ops = {686616687617 .info = {···650720 .set_voltage = mt312_set_voltage,651721};652722723723+struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config,724724+ struct i2c_adapter* i2c)725725+{726726+ struct mt312_state* state = NULL;727727+728728+ /* allocate memory for the internal state */729729+ state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL);730730+ if (state == NULL)731731+ goto error;732732+733733+ /* setup the state */734734+ state->config = config;735735+ state->i2c = i2c;736736+ memcpy(&state->ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops));737737+738738+ /* check if the demod is there */739739+ if (mt312_readreg(state, ID, &state->id) < 0)740740+ goto error;741741+742742+ switch (state->id) {743743+ case ID_VP310:744744+ strcpy(state->ops.info.name, "Zarlink VP310 DVB-S");745745+ state->frequency = 90;746746+ break;747747+ case ID_MT312:748748+ strcpy(state->ops.info.name, "Zarlink MT312 DVB-S");749749+ state->frequency = 60;750750+ break;751751+ default:752752+ printk (KERN_WARNING "Only Zarlink VP310/MT312 are supported chips.\n");753753+ goto error;754754+ }755755+756756+ /* create dvb_frontend */757757+ state->frontend.ops = &state->ops;758758+ state->frontend.demodulator_priv = state;759759+ return &state->frontend;760760+761761+error:762762+ kfree(state);763763+ return NULL;764764+}765765+653766module_param(debug, int, 0644);654767MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");655768···700727MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>");701728MODULE_LICENSE("GPL");702729703703-EXPORT_SYMBOL(mt312_attach);704704-EXPORT_SYMBOL(vp310_attach);730730+EXPORT_SYMBOL(vp310_mt312_attach);