1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * helene.h 4 * 5 * Sony HELENE DVB-S/S2/T/T2/C/C2/ISDB-T/S tuner driver (CXD2858ER) 6 * 7 * Copyright 2012 Sony Corporation 8 * Copyright (C) 2014 NetUP Inc. 9 * Copyright (C) 2014 Abylay Ospan <aospan@netup.ru> 10 */ 11 12 #ifndef __DVB_HELENE_H__ 13 #define __DVB_HELENE_H__ 14 15 #include <linux/dvb/frontend.h> 16 #include <linux/i2c.h> 17 18 enum helene_xtal { 19 SONY_HELENE_XTAL_16000, /* 16 MHz */ 20 SONY_HELENE_XTAL_20500, /* 20.5 MHz */ 21 SONY_HELENE_XTAL_24000, /* 24 MHz */ 22 SONY_HELENE_XTAL_41000 /* 41 MHz */ 23 }; 24 25 /** 26 * struct helene_config - the configuration of 'Helene' tuner driver 27 * @i2c_address: I2C address of the tuner 28 * @xtal_freq_mhz: Oscillator frequency, MHz 29 * @set_tuner_priv: Callback function private context 30 * @set_tuner_callback: Callback function that notifies the parent driver 31 * which tuner is active now 32 * @xtal: Cristal frequency as described by &enum helene_xtal 33 * @fe: Frontend for which connects this tuner 34 */ 35 struct helene_config { 36 u8 i2c_address; 37 u8 xtal_freq_mhz; 38 void *set_tuner_priv; 39 int (*set_tuner_callback)(void *, int); 40 enum helene_xtal xtal; 41 42 struct dvb_frontend *fe; 43 }; 44 45 #if IS_REACHABLE(CONFIG_DVB_HELENE) 46 /** 47 * helene_attach - Attach a helene tuner (terrestrial and cable standards) 48 * 49 * @fe: frontend to be attached 50 * @config: pointer to &struct helene_config with tuner configuration. 51 * @i2c: i2c adapter to use. 52 * 53 * return: FE pointer on success, NULL on failure. 54 */ 55 extern struct dvb_frontend *helene_attach(struct dvb_frontend *fe, 56 const struct helene_config *config, 57 struct i2c_adapter *i2c); 58 59 /** 60 * helene_attach_s - Attach a helene tuner (satellite standards) 61 * 62 * @fe: frontend to be attached 63 * @config: pointer to &struct helene_config with tuner configuration. 64 * @i2c: i2c adapter to use. 65 * 66 * return: FE pointer on success, NULL on failure. 67 */ 68 extern struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe, 69 const struct helene_config *config, 70 struct i2c_adapter *i2c); 71 #else 72 static inline struct dvb_frontend *helene_attach(struct dvb_frontend *fe, 73 const struct helene_config *config, 74 struct i2c_adapter *i2c) 75 { 76 pr_warn("%s: driver disabled by Kconfig\n", __func__); 77 return NULL; 78 } 79 static inline struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe, 80 const struct helene_config *config, 81 struct i2c_adapter *i2c) 82 { 83 pr_warn("%s: driver disabled by Kconfig\n", __func__); 84 return NULL; 85 } 86 #endif 87 88 #endif 89