Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * helene.h
0004  *
0005  * Sony HELENE DVB-S/S2/T/T2/C/C2/ISDB-T/S tuner driver (CXD2858ER)
0006  *
0007  * Copyright 2012 Sony Corporation
0008  * Copyright (C) 2014 NetUP Inc.
0009  * Copyright (C) 2014 Abylay Ospan <aospan@netup.ru>
0010   */
0011 
0012 #ifndef __DVB_HELENE_H__
0013 #define __DVB_HELENE_H__
0014 
0015 #include <linux/dvb/frontend.h>
0016 #include <linux/i2c.h>
0017 
0018 enum helene_xtal {
0019     SONY_HELENE_XTAL_16000, /* 16 MHz */
0020     SONY_HELENE_XTAL_20500, /* 20.5 MHz */
0021     SONY_HELENE_XTAL_24000, /* 24 MHz */
0022     SONY_HELENE_XTAL_41000 /* 41 MHz */
0023 };
0024 
0025 /**
0026  * struct helene_config - the configuration of 'Helene' tuner driver
0027  * @i2c_address:    I2C address of the tuner
0028  * @xtal_freq_mhz:  Oscillator frequency, MHz
0029  * @set_tuner_priv: Callback function private context
0030  * @set_tuner_callback: Callback function that notifies the parent driver
0031  *          which tuner is active now
0032  * @xtal: Cristal frequency as described by &enum helene_xtal
0033  * @fe: Frontend for which connects this tuner
0034  */
0035 struct helene_config {
0036     u8  i2c_address;
0037     u8  xtal_freq_mhz;
0038     void    *set_tuner_priv;
0039     int (*set_tuner_callback)(void *, int);
0040     enum helene_xtal xtal;
0041 
0042     struct dvb_frontend *fe;
0043 };
0044 
0045 #if IS_REACHABLE(CONFIG_DVB_HELENE)
0046 /**
0047  * helene_attach - Attach a helene tuner (terrestrial and cable standards)
0048  *
0049  * @fe: frontend to be attached
0050  * @config: pointer to &struct helene_config with tuner configuration.
0051  * @i2c: i2c adapter to use.
0052  *
0053  * return: FE pointer on success, NULL on failure.
0054  */
0055 extern struct dvb_frontend *helene_attach(struct dvb_frontend *fe,
0056                     const struct helene_config *config,
0057                     struct i2c_adapter *i2c);
0058 
0059 /**
0060  * helene_attach_s - Attach a helene tuner (satellite standards)
0061  *
0062  * @fe: frontend to be attached
0063  * @config: pointer to &struct helene_config with tuner configuration.
0064  * @i2c: i2c adapter to use.
0065  *
0066  * return: FE pointer on success, NULL on failure.
0067  */
0068 extern struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe,
0069                     const struct helene_config *config,
0070                     struct i2c_adapter *i2c);
0071 #else
0072 static inline struct dvb_frontend *helene_attach(struct dvb_frontend *fe,
0073                     const struct helene_config *config,
0074                     struct i2c_adapter *i2c)
0075 {
0076     pr_warn("%s: driver disabled by Kconfig\n", __func__);
0077     return NULL;
0078 }
0079 static inline struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe,
0080                     const struct helene_config *config,
0081                     struct i2c_adapter *i2c)
0082 {
0083     pr_warn("%s: driver disabled by Kconfig\n", __func__);
0084     return NULL;
0085 }
0086 #endif
0087 
0088 #endif