1 /* 2 * helene.h 3 * 4 * Sony HELENE DVB-S/S2/T/T2/C/C2/ISDB-T/S tuner driver (CXD2858ER) 5 * 6 * Copyright 2012 Sony Corporation 7 * Copyright (C) 2014 NetUP Inc. 8 * Copyright (C) 2014 Abylay Ospan <aospan@netup.ru> 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 */ 20 21 #ifndef __DVB_HELENE_H__ 22 #define __DVB_HELENE_H__ 23 24 #include <linux/dvb/frontend.h> 25 #include <linux/i2c.h> 26 27 enum helene_xtal { 28 SONY_HELENE_XTAL_16000, /* 16 MHz */ 29 SONY_HELENE_XTAL_20500, /* 20.5 MHz */ 30 SONY_HELENE_XTAL_24000, /* 24 MHz */ 31 SONY_HELENE_XTAL_41000 /* 41 MHz */ 32 }; 33 34 /** 35 * struct helene_config - the configuration of 'Helene' tuner driver 36 * @i2c_address: I2C address of the tuner 37 * @xtal_freq_mhz: Oscillator frequency, MHz 38 * @set_tuner_priv: Callback function private context 39 * @set_tuner_callback: Callback function that notifies the parent driver 40 * which tuner is active now 41 * @xtal: Cristal frequency as described by &enum helene_xtal 42 * @fe: Frontend for which connects this tuner 43 */ 44 struct helene_config { 45 u8 i2c_address; 46 u8 xtal_freq_mhz; 47 void *set_tuner_priv; 48 int (*set_tuner_callback)(void *, int); 49 enum helene_xtal xtal; 50 51 struct dvb_frontend *fe; 52 }; 53 54 #if IS_REACHABLE(CONFIG_DVB_HELENE) 55 /** 56 * Attach a helene tuner (terrestrial and cable standards) 57 * 58 * @fe: frontend to be attached 59 * @config: pointer to &struct helene_config with tuner configuration. 60 * @i2c: i2c adapter to use. 61 * 62 * return: FE pointer on success, NULL on failure. 63 */ 64 extern struct dvb_frontend *helene_attach(struct dvb_frontend *fe, 65 const struct helene_config *config, 66 struct i2c_adapter *i2c); 67 68 /** 69 * Attach a helene tuner (satellite standards) 70 * 71 * @fe: frontend to be attached 72 * @config: pointer to &struct helene_config with tuner configuration. 73 * @i2c: i2c adapter to use. 74 * 75 * return: FE pointer on success, NULL on failure. 76 */ 77 extern struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe, 78 const struct helene_config *config, 79 struct i2c_adapter *i2c); 80 #else 81 static inline struct dvb_frontend *helene_attach(struct dvb_frontend *fe, 82 const struct helene_config *config, 83 struct i2c_adapter *i2c) 84 { 85 pr_warn("%s: driver disabled by Kconfig\n", __func__); 86 return NULL; 87 } 88 static inline struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe, 89 const struct helene_config *config, 90 struct i2c_adapter *i2c) 91 { 92 pr_warn("%s: driver disabled by Kconfig\n", __func__); 93 return NULL; 94 } 95 #endif 96 97 #endif 98