Thomas Gleixner | c942fdd | 2019-05-27 08:55:06 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Abylay Ospan | 2dc1ed4 | 2016-03-21 22:19:12 -0300 | [diff] [blame] | 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> |
Abylay Ospan | 2dc1ed4 | 2016-03-21 22:19:12 -0300 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #ifndef __DVB_HELENE_H__ |
| 13 | #define __DVB_HELENE_H__ |
| 14 | |
Abylay Ospan | 2dc1ed4 | 2016-03-21 22:19:12 -0300 | [diff] [blame] | 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 |
Mauro Carvalho Chehab | b95b0c9 | 2017-11-29 12:39:19 -0500 | [diff] [blame] | 32 | * @xtal: Cristal frequency as described by &enum helene_xtal |
Katsuhiro Suzuki | 817dc4b | 2018-07-17 21:06:42 -0400 | [diff] [blame] | 33 | * @fe: Frontend for which connects this tuner |
Abylay Ospan | 2dc1ed4 | 2016-03-21 22:19:12 -0300 | [diff] [blame] | 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; |
Katsuhiro Suzuki | 817dc4b | 2018-07-17 21:06:42 -0400 | [diff] [blame] | 41 | |
| 42 | struct dvb_frontend *fe; |
Abylay Ospan | 2dc1ed4 | 2016-03-21 22:19:12 -0300 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | #if IS_REACHABLE(CONFIG_DVB_HELENE) |
Mauro Carvalho Chehab | be9b53c | 2017-11-29 14:02:22 -0500 | [diff] [blame] | 46 | /** |
| 47 | * 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 | */ |
Abylay Ospan | 2dc1ed4 | 2016-03-21 22:19:12 -0300 | [diff] [blame] | 55 | extern struct dvb_frontend *helene_attach(struct dvb_frontend *fe, |
| 56 | const struct helene_config *config, |
| 57 | struct i2c_adapter *i2c); |
Mauro Carvalho Chehab | be9b53c | 2017-11-29 14:02:22 -0500 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * 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); |
Abylay Ospan | 2dc1ed4 | 2016-03-21 22:19:12 -0300 | [diff] [blame] | 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 | } |
Abylay Ospan | 2dc1ed4 | 2016-03-21 22:19:12 -0300 | [diff] [blame] | 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 |