18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci Copyright (c), 2004-2005,2007-2010 Trident Microsystems, Inc. 38c2ecf20Sopenharmony_ci All rights reserved. 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci Redistribution and use in source and binary forms, with or without 68c2ecf20Sopenharmony_ci modification, are permitted provided that the following conditions are met: 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci * Redistributions of source code must retain the above copyright notice, 98c2ecf20Sopenharmony_ci this list of conditions and the following disclaimer. 108c2ecf20Sopenharmony_ci * Redistributions in binary form must reproduce the above copyright notice, 118c2ecf20Sopenharmony_ci this list of conditions and the following disclaimer in the documentation 128c2ecf20Sopenharmony_ci and/or other materials provided with the distribution. 138c2ecf20Sopenharmony_ci * Neither the name of Trident Microsystems nor Hauppauge Computer Works 148c2ecf20Sopenharmony_ci nor the names of its contributors may be used to endorse or promote 158c2ecf20Sopenharmony_ci products derived from this software without specific prior written 168c2ecf20Sopenharmony_ci permission. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 198c2ecf20Sopenharmony_ci AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 208c2ecf20Sopenharmony_ci IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 218c2ecf20Sopenharmony_ci ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 228c2ecf20Sopenharmony_ci LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 238c2ecf20Sopenharmony_ci CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 248c2ecf20Sopenharmony_ci SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 258c2ecf20Sopenharmony_ci INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 268c2ecf20Sopenharmony_ci CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 278c2ecf20Sopenharmony_ci ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 288c2ecf20Sopenharmony_ci POSSIBILITY OF SUCH DAMAGE. 298c2ecf20Sopenharmony_ci*/ 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#ifndef __DRXDRIVER_H__ 328c2ecf20Sopenharmony_ci#define __DRXDRIVER_H__ 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#include <linux/kernel.h> 358c2ecf20Sopenharmony_ci#include <linux/errno.h> 368c2ecf20Sopenharmony_ci#include <linux/firmware.h> 378c2ecf20Sopenharmony_ci#include <linux/i2c.h> 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci/* 408c2ecf20Sopenharmony_ci * This structure contains the I2C address, the device ID and a user_data pointer. 418c2ecf20Sopenharmony_ci * The user_data pointer can be used for application specific purposes. 428c2ecf20Sopenharmony_ci */ 438c2ecf20Sopenharmony_cistruct i2c_device_addr { 448c2ecf20Sopenharmony_ci u16 i2c_addr; /* The I2C address of the device. */ 458c2ecf20Sopenharmony_ci u16 i2c_dev_id; /* The device identifier. */ 468c2ecf20Sopenharmony_ci void *user_data; /* User data pointer */ 478c2ecf20Sopenharmony_ci}; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci/* 508c2ecf20Sopenharmony_ci* \def IS_I2C_10BIT( addr ) 518c2ecf20Sopenharmony_ci* \brief Determine if I2C address 'addr' is a 10 bits address or not. 528c2ecf20Sopenharmony_ci* \param addr The I2C address. 538c2ecf20Sopenharmony_ci* \return int. 548c2ecf20Sopenharmony_ci* \retval 0 if address is not a 10 bits I2C address. 558c2ecf20Sopenharmony_ci* \retval 1 if address is a 10 bits I2C address. 568c2ecf20Sopenharmony_ci*/ 578c2ecf20Sopenharmony_ci#define IS_I2C_10BIT(addr) \ 588c2ecf20Sopenharmony_ci (((addr) & 0xF8) == 0xF0) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci/*------------------------------------------------------------------------------ 618c2ecf20Sopenharmony_ciExported FUNCTIONS 628c2ecf20Sopenharmony_ci------------------------------------------------------------------------------*/ 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* 658c2ecf20Sopenharmony_ci* \fn drxbsp_i2c_init() 668c2ecf20Sopenharmony_ci* \brief Initialize I2C communication module. 678c2ecf20Sopenharmony_ci* \return int Return status. 688c2ecf20Sopenharmony_ci* \retval 0 Initialization successful. 698c2ecf20Sopenharmony_ci* \retval -EIO Initialization failed. 708c2ecf20Sopenharmony_ci*/ 718c2ecf20Sopenharmony_ciint drxbsp_i2c_init(void); 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci/* 748c2ecf20Sopenharmony_ci* \fn drxbsp_i2c_term() 758c2ecf20Sopenharmony_ci* \brief Terminate I2C communication module. 768c2ecf20Sopenharmony_ci* \return int Return status. 778c2ecf20Sopenharmony_ci* \retval 0 Termination successful. 788c2ecf20Sopenharmony_ci* \retval -EIO Termination failed. 798c2ecf20Sopenharmony_ci*/ 808c2ecf20Sopenharmony_ciint drxbsp_i2c_term(void); 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci/* 838c2ecf20Sopenharmony_ci* \fn int drxbsp_i2c_write_read( struct i2c_device_addr *w_dev_addr, 848c2ecf20Sopenharmony_ci* u16 w_count, 858c2ecf20Sopenharmony_ci* u8 * wData, 868c2ecf20Sopenharmony_ci* struct i2c_device_addr *r_dev_addr, 878c2ecf20Sopenharmony_ci* u16 r_count, 888c2ecf20Sopenharmony_ci* u8 * r_data) 898c2ecf20Sopenharmony_ci* \brief Read and/or write count bytes from I2C bus, store them in data[]. 908c2ecf20Sopenharmony_ci* \param w_dev_addr The device i2c address and the device ID to write to 918c2ecf20Sopenharmony_ci* \param w_count The number of bytes to write 928c2ecf20Sopenharmony_ci* \param wData The array to write the data to 938c2ecf20Sopenharmony_ci* \param r_dev_addr The device i2c address and the device ID to read from 948c2ecf20Sopenharmony_ci* \param r_count The number of bytes to read 958c2ecf20Sopenharmony_ci* \param r_data The array to read the data from 968c2ecf20Sopenharmony_ci* \return int Return status. 978c2ecf20Sopenharmony_ci* \retval 0 Success. 988c2ecf20Sopenharmony_ci* \retval -EIO Failure. 998c2ecf20Sopenharmony_ci* \retval -EINVAL Parameter 'wcount' is not zero but parameter 1008c2ecf20Sopenharmony_ci* 'wdata' contains NULL. 1018c2ecf20Sopenharmony_ci* Idem for 'rcount' and 'rdata'. 1028c2ecf20Sopenharmony_ci* Both w_dev_addr and r_dev_addr are NULL. 1038c2ecf20Sopenharmony_ci* 1048c2ecf20Sopenharmony_ci* This function must implement an atomic write and/or read action on the I2C bus 1058c2ecf20Sopenharmony_ci* No other process may use the I2C bus when this function is executing. 1068c2ecf20Sopenharmony_ci* The critical section of this function runs from and including the I2C 1078c2ecf20Sopenharmony_ci* write, up to and including the I2C read action. 1088c2ecf20Sopenharmony_ci* 1098c2ecf20Sopenharmony_ci* The device ID can be useful if several devices share an I2C address. 1108c2ecf20Sopenharmony_ci* It can be used to control a "switch" on the I2C bus to the correct device. 1118c2ecf20Sopenharmony_ci*/ 1128c2ecf20Sopenharmony_ciint drxbsp_i2c_write_read(struct i2c_device_addr *w_dev_addr, 1138c2ecf20Sopenharmony_ci u16 w_count, 1148c2ecf20Sopenharmony_ci u8 *wData, 1158c2ecf20Sopenharmony_ci struct i2c_device_addr *r_dev_addr, 1168c2ecf20Sopenharmony_ci u16 r_count, u8 *r_data); 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci/* 1198c2ecf20Sopenharmony_ci* \fn drxbsp_i2c_error_text() 1208c2ecf20Sopenharmony_ci* \brief Returns a human readable error. 1218c2ecf20Sopenharmony_ci* Counter part of numerical drx_i2c_error_g. 1228c2ecf20Sopenharmony_ci* 1238c2ecf20Sopenharmony_ci* \return char* Pointer to human readable error text. 1248c2ecf20Sopenharmony_ci*/ 1258c2ecf20Sopenharmony_cichar *drxbsp_i2c_error_text(void); 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci/* 1288c2ecf20Sopenharmony_ci* \var drx_i2c_error_g; 1298c2ecf20Sopenharmony_ci* \brief I2C specific error codes, platform dependent. 1308c2ecf20Sopenharmony_ci*/ 1318c2ecf20Sopenharmony_ciextern int drx_i2c_error_g; 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci#define TUNER_MODE_SUB0 0x0001 /* for sub-mode (e.g. RF-AGC setting) */ 1348c2ecf20Sopenharmony_ci#define TUNER_MODE_SUB1 0x0002 /* for sub-mode (e.g. RF-AGC setting) */ 1358c2ecf20Sopenharmony_ci#define TUNER_MODE_SUB2 0x0004 /* for sub-mode (e.g. RF-AGC setting) */ 1368c2ecf20Sopenharmony_ci#define TUNER_MODE_SUB3 0x0008 /* for sub-mode (e.g. RF-AGC setting) */ 1378c2ecf20Sopenharmony_ci#define TUNER_MODE_SUB4 0x0010 /* for sub-mode (e.g. RF-AGC setting) */ 1388c2ecf20Sopenharmony_ci#define TUNER_MODE_SUB5 0x0020 /* for sub-mode (e.g. RF-AGC setting) */ 1398c2ecf20Sopenharmony_ci#define TUNER_MODE_SUB6 0x0040 /* for sub-mode (e.g. RF-AGC setting) */ 1408c2ecf20Sopenharmony_ci#define TUNER_MODE_SUB7 0x0080 /* for sub-mode (e.g. RF-AGC setting) */ 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define TUNER_MODE_DIGITAL 0x0100 /* for digital channel (e.g. DVB-T) */ 1438c2ecf20Sopenharmony_ci#define TUNER_MODE_ANALOG 0x0200 /* for analog channel (e.g. PAL) */ 1448c2ecf20Sopenharmony_ci#define TUNER_MODE_SWITCH 0x0400 /* during channel switch & scanning */ 1458c2ecf20Sopenharmony_ci#define TUNER_MODE_LOCK 0x0800 /* after tuner has locked */ 1468c2ecf20Sopenharmony_ci#define TUNER_MODE_6MHZ 0x1000 /* for 6MHz bandwidth channels */ 1478c2ecf20Sopenharmony_ci#define TUNER_MODE_7MHZ 0x2000 /* for 7MHz bandwidth channels */ 1488c2ecf20Sopenharmony_ci#define TUNER_MODE_8MHZ 0x4000 /* for 8MHz bandwidth channels */ 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define TUNER_MODE_SUB_MAX 8 1518c2ecf20Sopenharmony_ci#define TUNER_MODE_SUBALL (TUNER_MODE_SUB0 | TUNER_MODE_SUB1 | \ 1528c2ecf20Sopenharmony_ci TUNER_MODE_SUB2 | TUNER_MODE_SUB3 | \ 1538c2ecf20Sopenharmony_ci TUNER_MODE_SUB4 | TUNER_MODE_SUB5 | \ 1548c2ecf20Sopenharmony_ci TUNER_MODE_SUB6 | TUNER_MODE_SUB7) 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_cienum tuner_lock_status { 1588c2ecf20Sopenharmony_ci TUNER_LOCKED, 1598c2ecf20Sopenharmony_ci TUNER_NOT_LOCKED 1608c2ecf20Sopenharmony_ci}; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_cistruct tuner_common { 1638c2ecf20Sopenharmony_ci char *name; /* Tuner brand & type name */ 1648c2ecf20Sopenharmony_ci s32 min_freq_rf; /* Lowest RF input frequency, in kHz */ 1658c2ecf20Sopenharmony_ci s32 max_freq_rf; /* Highest RF input frequency, in kHz */ 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci u8 sub_mode; /* Index to sub-mode in use */ 1688c2ecf20Sopenharmony_ci char ***sub_mode_descriptions; /* Pointer to description of sub-modes */ 1698c2ecf20Sopenharmony_ci u8 sub_modes; /* Number of available sub-modes */ 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci /* The following fields will be either 0, NULL or false and do not need 1728c2ecf20Sopenharmony_ci initialisation */ 1738c2ecf20Sopenharmony_ci void *self_check; /* gives proof of initialization */ 1748c2ecf20Sopenharmony_ci bool programmed; /* only valid if self_check is OK */ 1758c2ecf20Sopenharmony_ci s32 r_ffrequency; /* only valid if programmed */ 1768c2ecf20Sopenharmony_ci s32 i_ffrequency; /* only valid if programmed */ 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci void *my_user_data; /* pointer to associated demod instance */ 1798c2ecf20Sopenharmony_ci u16 my_capabilities; /* value for storing application flags */ 1808c2ecf20Sopenharmony_ci}; 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_cistruct tuner_instance; 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_citypedef int(*tuner_open_func_t) (struct tuner_instance *tuner); 1858c2ecf20Sopenharmony_citypedef int(*tuner_close_func_t) (struct tuner_instance *tuner); 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_citypedef int(*tuner_set_frequency_func_t) (struct tuner_instance *tuner, 1888c2ecf20Sopenharmony_ci u32 mode, 1898c2ecf20Sopenharmony_ci s32 1908c2ecf20Sopenharmony_ci frequency); 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_citypedef int(*tuner_get_frequency_func_t) (struct tuner_instance *tuner, 1938c2ecf20Sopenharmony_ci u32 mode, 1948c2ecf20Sopenharmony_ci s32 * 1958c2ecf20Sopenharmony_ci r_ffrequency, 1968c2ecf20Sopenharmony_ci s32 * 1978c2ecf20Sopenharmony_ci i_ffrequency); 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_citypedef int(*tuner_lock_status_func_t) (struct tuner_instance *tuner, 2008c2ecf20Sopenharmony_ci enum tuner_lock_status * 2018c2ecf20Sopenharmony_ci lock_stat); 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_citypedef int(*tune_ri2c_write_read_func_t) (struct tuner_instance *tuner, 2048c2ecf20Sopenharmony_ci struct i2c_device_addr * 2058c2ecf20Sopenharmony_ci w_dev_addr, u16 w_count, 2068c2ecf20Sopenharmony_ci u8 *wData, 2078c2ecf20Sopenharmony_ci struct i2c_device_addr * 2088c2ecf20Sopenharmony_ci r_dev_addr, u16 r_count, 2098c2ecf20Sopenharmony_ci u8 *r_data); 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_cistruct tuner_ops { 2128c2ecf20Sopenharmony_ci tuner_open_func_t open_func; 2138c2ecf20Sopenharmony_ci tuner_close_func_t close_func; 2148c2ecf20Sopenharmony_ci tuner_set_frequency_func_t set_frequency_func; 2158c2ecf20Sopenharmony_ci tuner_get_frequency_func_t get_frequency_func; 2168c2ecf20Sopenharmony_ci tuner_lock_status_func_t lock_status_func; 2178c2ecf20Sopenharmony_ci tune_ri2c_write_read_func_t i2c_write_read_func; 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci}; 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_cistruct tuner_instance { 2228c2ecf20Sopenharmony_ci struct i2c_device_addr my_i2c_dev_addr; 2238c2ecf20Sopenharmony_ci struct tuner_common *my_common_attr; 2248c2ecf20Sopenharmony_ci void *my_ext_attr; 2258c2ecf20Sopenharmony_ci struct tuner_ops *my_funct; 2268c2ecf20Sopenharmony_ci}; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ciint drxbsp_tuner_set_frequency(struct tuner_instance *tuner, 2298c2ecf20Sopenharmony_ci u32 mode, 2308c2ecf20Sopenharmony_ci s32 frequency); 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ciint drxbsp_tuner_get_frequency(struct tuner_instance *tuner, 2338c2ecf20Sopenharmony_ci u32 mode, 2348c2ecf20Sopenharmony_ci s32 *r_ffrequency, 2358c2ecf20Sopenharmony_ci s32 *i_ffrequency); 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ciint drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner, 2388c2ecf20Sopenharmony_ci struct i2c_device_addr *w_dev_addr, 2398c2ecf20Sopenharmony_ci u16 w_count, 2408c2ecf20Sopenharmony_ci u8 *wData, 2418c2ecf20Sopenharmony_ci struct i2c_device_addr *r_dev_addr, 2428c2ecf20Sopenharmony_ci u16 r_count, u8 *r_data); 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci/************* 2458c2ecf20Sopenharmony_ci* 2468c2ecf20Sopenharmony_ci* This section configures the DRX Data Access Protocols (DAPs). 2478c2ecf20Sopenharmony_ci* 2488c2ecf20Sopenharmony_ci**************/ 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci/* 2518c2ecf20Sopenharmony_ci* \def DRXDAP_SINGLE_MASTER 2528c2ecf20Sopenharmony_ci* \brief Enable I2C single or I2C multimaster mode on host. 2538c2ecf20Sopenharmony_ci* 2548c2ecf20Sopenharmony_ci* Set to 1 to enable single master mode 2558c2ecf20Sopenharmony_ci* Set to 0 to enable multi master mode 2568c2ecf20Sopenharmony_ci* 2578c2ecf20Sopenharmony_ci* The actual DAP implementation may be restricted to only one of the modes. 2588c2ecf20Sopenharmony_ci* A compiler warning or error will be generated if the DAP implementation 2598c2ecf20Sopenharmony_ci* overrides or cannot handle the mode defined below. 2608c2ecf20Sopenharmony_ci*/ 2618c2ecf20Sopenharmony_ci#ifndef DRXDAP_SINGLE_MASTER 2628c2ecf20Sopenharmony_ci#define DRXDAP_SINGLE_MASTER 1 2638c2ecf20Sopenharmony_ci#endif 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci/* 2668c2ecf20Sopenharmony_ci* \def DRXDAP_MAX_WCHUNKSIZE 2678c2ecf20Sopenharmony_ci* \brief Defines maximum chunksize of an i2c write action by host. 2688c2ecf20Sopenharmony_ci* 2698c2ecf20Sopenharmony_ci* This indicates the maximum size of data the I2C device driver is able to 2708c2ecf20Sopenharmony_ci* write at a time. This includes I2C device address and register addressing. 2718c2ecf20Sopenharmony_ci* 2728c2ecf20Sopenharmony_ci* This maximum size may be restricted by the actual DAP implementation. 2738c2ecf20Sopenharmony_ci* A compiler warning or error will be generated if the DAP implementation 2748c2ecf20Sopenharmony_ci* overrides or cannot handle the chunksize defined below. 2758c2ecf20Sopenharmony_ci* 2768c2ecf20Sopenharmony_ci* Beware that the DAP uses DRXDAP_MAX_WCHUNKSIZE to create a temporary data 2778c2ecf20Sopenharmony_ci* buffer. Do not undefine or choose too large, unless your system is able to 2788c2ecf20Sopenharmony_ci* handle a stack buffer of that size. 2798c2ecf20Sopenharmony_ci* 2808c2ecf20Sopenharmony_ci*/ 2818c2ecf20Sopenharmony_ci#ifndef DRXDAP_MAX_WCHUNKSIZE 2828c2ecf20Sopenharmony_ci#define DRXDAP_MAX_WCHUNKSIZE 60 2838c2ecf20Sopenharmony_ci#endif 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci/* 2868c2ecf20Sopenharmony_ci* \def DRXDAP_MAX_RCHUNKSIZE 2878c2ecf20Sopenharmony_ci* \brief Defines maximum chunksize of an i2c read action by host. 2888c2ecf20Sopenharmony_ci* 2898c2ecf20Sopenharmony_ci* This indicates the maximum size of data the I2C device driver is able to read 2908c2ecf20Sopenharmony_ci* at a time. Minimum value is 2. Also, the read chunk size must be even. 2918c2ecf20Sopenharmony_ci* 2928c2ecf20Sopenharmony_ci* This maximum size may be restricted by the actual DAP implementation. 2938c2ecf20Sopenharmony_ci* A compiler warning or error will be generated if the DAP implementation 2948c2ecf20Sopenharmony_ci* overrides or cannot handle the chunksize defined below. 2958c2ecf20Sopenharmony_ci*/ 2968c2ecf20Sopenharmony_ci#ifndef DRXDAP_MAX_RCHUNKSIZE 2978c2ecf20Sopenharmony_ci#define DRXDAP_MAX_RCHUNKSIZE 60 2988c2ecf20Sopenharmony_ci#endif 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci/************* 3018c2ecf20Sopenharmony_ci* 3028c2ecf20Sopenharmony_ci* This section describes drxdriver defines. 3038c2ecf20Sopenharmony_ci* 3048c2ecf20Sopenharmony_ci**************/ 3058c2ecf20Sopenharmony_ci 3068c2ecf20Sopenharmony_ci/* 3078c2ecf20Sopenharmony_ci* \def DRX_UNKNOWN 3088c2ecf20Sopenharmony_ci* \brief Generic UNKNOWN value for DRX enumerated types. 3098c2ecf20Sopenharmony_ci* 3108c2ecf20Sopenharmony_ci* Used to indicate that the parameter value is unknown or not yet initialized. 3118c2ecf20Sopenharmony_ci*/ 3128c2ecf20Sopenharmony_ci#ifndef DRX_UNKNOWN 3138c2ecf20Sopenharmony_ci#define DRX_UNKNOWN (254) 3148c2ecf20Sopenharmony_ci#endif 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci/* 3178c2ecf20Sopenharmony_ci* \def DRX_AUTO 3188c2ecf20Sopenharmony_ci* \brief Generic AUTO value for DRX enumerated types. 3198c2ecf20Sopenharmony_ci* 3208c2ecf20Sopenharmony_ci* Used to instruct the driver to automatically determine the value of the 3218c2ecf20Sopenharmony_ci* parameter. 3228c2ecf20Sopenharmony_ci*/ 3238c2ecf20Sopenharmony_ci#ifndef DRX_AUTO 3248c2ecf20Sopenharmony_ci#define DRX_AUTO (255) 3258c2ecf20Sopenharmony_ci#endif 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci/************* 3288c2ecf20Sopenharmony_ci* 3298c2ecf20Sopenharmony_ci* This section describes flag definitions for the device capbilities. 3308c2ecf20Sopenharmony_ci* 3318c2ecf20Sopenharmony_ci**************/ 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci/* 3348c2ecf20Sopenharmony_ci* \brief LNA capability flag 3358c2ecf20Sopenharmony_ci* 3368c2ecf20Sopenharmony_ci* Device has a Low Noise Amplifier 3378c2ecf20Sopenharmony_ci* 3388c2ecf20Sopenharmony_ci*/ 3398c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_LNA (1UL << 0) 3408c2ecf20Sopenharmony_ci/* 3418c2ecf20Sopenharmony_ci* \brief OOB-RX capability flag 3428c2ecf20Sopenharmony_ci* 3438c2ecf20Sopenharmony_ci* Device has OOB-RX 3448c2ecf20Sopenharmony_ci* 3458c2ecf20Sopenharmony_ci*/ 3468c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_OOBRX (1UL << 1) 3478c2ecf20Sopenharmony_ci/* 3488c2ecf20Sopenharmony_ci* \brief ATV capability flag 3498c2ecf20Sopenharmony_ci* 3508c2ecf20Sopenharmony_ci* Device has ATV 3518c2ecf20Sopenharmony_ci* 3528c2ecf20Sopenharmony_ci*/ 3538c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_ATV (1UL << 2) 3548c2ecf20Sopenharmony_ci/* 3558c2ecf20Sopenharmony_ci* \brief DVB-T capability flag 3568c2ecf20Sopenharmony_ci* 3578c2ecf20Sopenharmony_ci* Device has DVB-T 3588c2ecf20Sopenharmony_ci* 3598c2ecf20Sopenharmony_ci*/ 3608c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_DVBT (1UL << 3) 3618c2ecf20Sopenharmony_ci/* 3628c2ecf20Sopenharmony_ci* \brief ITU-B capability flag 3638c2ecf20Sopenharmony_ci* 3648c2ecf20Sopenharmony_ci* Device has ITU-B 3658c2ecf20Sopenharmony_ci* 3668c2ecf20Sopenharmony_ci*/ 3678c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_ITUB (1UL << 4) 3688c2ecf20Sopenharmony_ci/* 3698c2ecf20Sopenharmony_ci* \brief Audio capability flag 3708c2ecf20Sopenharmony_ci* 3718c2ecf20Sopenharmony_ci* Device has Audio 3728c2ecf20Sopenharmony_ci* 3738c2ecf20Sopenharmony_ci*/ 3748c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_AUD (1UL << 5) 3758c2ecf20Sopenharmony_ci/* 3768c2ecf20Sopenharmony_ci* \brief SAW switch capability flag 3778c2ecf20Sopenharmony_ci* 3788c2ecf20Sopenharmony_ci* Device has SAW switch 3798c2ecf20Sopenharmony_ci* 3808c2ecf20Sopenharmony_ci*/ 3818c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_SAWSW (1UL << 6) 3828c2ecf20Sopenharmony_ci/* 3838c2ecf20Sopenharmony_ci* \brief GPIO1 capability flag 3848c2ecf20Sopenharmony_ci* 3858c2ecf20Sopenharmony_ci* Device has GPIO1 3868c2ecf20Sopenharmony_ci* 3878c2ecf20Sopenharmony_ci*/ 3888c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_GPIO1 (1UL << 7) 3898c2ecf20Sopenharmony_ci/* 3908c2ecf20Sopenharmony_ci* \brief GPIO2 capability flag 3918c2ecf20Sopenharmony_ci* 3928c2ecf20Sopenharmony_ci* Device has GPIO2 3938c2ecf20Sopenharmony_ci* 3948c2ecf20Sopenharmony_ci*/ 3958c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_GPIO2 (1UL << 8) 3968c2ecf20Sopenharmony_ci/* 3978c2ecf20Sopenharmony_ci* \brief IRQN capability flag 3988c2ecf20Sopenharmony_ci* 3998c2ecf20Sopenharmony_ci* Device has IRQN 4008c2ecf20Sopenharmony_ci* 4018c2ecf20Sopenharmony_ci*/ 4028c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_IRQN (1UL << 9) 4038c2ecf20Sopenharmony_ci/* 4048c2ecf20Sopenharmony_ci* \brief 8VSB capability flag 4058c2ecf20Sopenharmony_ci* 4068c2ecf20Sopenharmony_ci* Device has 8VSB 4078c2ecf20Sopenharmony_ci* 4088c2ecf20Sopenharmony_ci*/ 4098c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_8VSB (1UL << 10) 4108c2ecf20Sopenharmony_ci/* 4118c2ecf20Sopenharmony_ci* \brief SMA-TX capability flag 4128c2ecf20Sopenharmony_ci* 4138c2ecf20Sopenharmony_ci* Device has SMATX 4148c2ecf20Sopenharmony_ci* 4158c2ecf20Sopenharmony_ci*/ 4168c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_SMATX (1UL << 11) 4178c2ecf20Sopenharmony_ci/* 4188c2ecf20Sopenharmony_ci* \brief SMA-RX capability flag 4198c2ecf20Sopenharmony_ci* 4208c2ecf20Sopenharmony_ci* Device has SMARX 4218c2ecf20Sopenharmony_ci* 4228c2ecf20Sopenharmony_ci*/ 4238c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_SMARX (1UL << 12) 4248c2ecf20Sopenharmony_ci/* 4258c2ecf20Sopenharmony_ci* \brief ITU-A/C capability flag 4268c2ecf20Sopenharmony_ci* 4278c2ecf20Sopenharmony_ci* Device has ITU-A/C 4288c2ecf20Sopenharmony_ci* 4298c2ecf20Sopenharmony_ci*/ 4308c2ecf20Sopenharmony_ci#define DRX_CAPABILITY_HAS_ITUAC (1UL << 13) 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci/*------------------------------------------------------------------------- 4338c2ecf20Sopenharmony_ciMACROS 4348c2ecf20Sopenharmony_ci-------------------------------------------------------------------------*/ 4358c2ecf20Sopenharmony_ci/* Macros to stringify the version number */ 4368c2ecf20Sopenharmony_ci#define DRX_VERSIONSTRING(MAJOR, MINOR, PATCH) \ 4378c2ecf20Sopenharmony_ci DRX_VERSIONSTRING_HELP(MAJOR)"." \ 4388c2ecf20Sopenharmony_ci DRX_VERSIONSTRING_HELP(MINOR)"." \ 4398c2ecf20Sopenharmony_ci DRX_VERSIONSTRING_HELP(PATCH) 4408c2ecf20Sopenharmony_ci#define DRX_VERSIONSTRING_HELP(NUM) #NUM 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_ci/* 4438c2ecf20Sopenharmony_ci* \brief Macro to create byte array elements from 16 bit integers. 4448c2ecf20Sopenharmony_ci* This macro is used to create byte arrays for block writes. 4458c2ecf20Sopenharmony_ci* Block writes speed up I2C traffic between host and demod. 4468c2ecf20Sopenharmony_ci* The macro takes care of the required byte order in a 16 bits word. 4478c2ecf20Sopenharmony_ci* x->lowbyte(x), highbyte(x) 4488c2ecf20Sopenharmony_ci*/ 4498c2ecf20Sopenharmony_ci#define DRX_16TO8(x) ((u8) (((u16)x) & 0xFF)), \ 4508c2ecf20Sopenharmony_ci ((u8)((((u16)x)>>8)&0xFF)) 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci/* 4538c2ecf20Sopenharmony_ci* \brief Macro to convert 16 bit register value to a s32 4548c2ecf20Sopenharmony_ci*/ 4558c2ecf20Sopenharmony_ci#define DRX_U16TODRXFREQ(x) ((x & 0x8000) ? \ 4568c2ecf20Sopenharmony_ci ((s32) \ 4578c2ecf20Sopenharmony_ci (((u32) x) | 0xFFFF0000)) : \ 4588c2ecf20Sopenharmony_ci ((s32) x)) 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_ci/*------------------------------------------------------------------------- 4618c2ecf20Sopenharmony_ciENUM 4628c2ecf20Sopenharmony_ci-------------------------------------------------------------------------*/ 4638c2ecf20Sopenharmony_ci 4648c2ecf20Sopenharmony_ci/* 4658c2ecf20Sopenharmony_ci* \enum enum drx_standard 4668c2ecf20Sopenharmony_ci* \brief Modulation standards. 4678c2ecf20Sopenharmony_ci*/ 4688c2ecf20Sopenharmony_cienum drx_standard { 4698c2ecf20Sopenharmony_ci DRX_STANDARD_DVBT = 0, /*< Terrestrial DVB-T. */ 4708c2ecf20Sopenharmony_ci DRX_STANDARD_8VSB, /*< Terrestrial 8VSB. */ 4718c2ecf20Sopenharmony_ci DRX_STANDARD_NTSC, /*< Terrestrial\Cable analog NTSC. */ 4728c2ecf20Sopenharmony_ci DRX_STANDARD_PAL_SECAM_BG, 4738c2ecf20Sopenharmony_ci /*< Terrestrial analog PAL/SECAM B/G */ 4748c2ecf20Sopenharmony_ci DRX_STANDARD_PAL_SECAM_DK, 4758c2ecf20Sopenharmony_ci /*< Terrestrial analog PAL/SECAM D/K */ 4768c2ecf20Sopenharmony_ci DRX_STANDARD_PAL_SECAM_I, 4778c2ecf20Sopenharmony_ci /*< Terrestrial analog PAL/SECAM I */ 4788c2ecf20Sopenharmony_ci DRX_STANDARD_PAL_SECAM_L, 4798c2ecf20Sopenharmony_ci /*< Terrestrial analog PAL/SECAM L 4808c2ecf20Sopenharmony_ci with negative modulation */ 4818c2ecf20Sopenharmony_ci DRX_STANDARD_PAL_SECAM_LP, 4828c2ecf20Sopenharmony_ci /*< Terrestrial analog PAL/SECAM L 4838c2ecf20Sopenharmony_ci with positive modulation */ 4848c2ecf20Sopenharmony_ci DRX_STANDARD_ITU_A, /*< Cable ITU ANNEX A. */ 4858c2ecf20Sopenharmony_ci DRX_STANDARD_ITU_B, /*< Cable ITU ANNEX B. */ 4868c2ecf20Sopenharmony_ci DRX_STANDARD_ITU_C, /*< Cable ITU ANNEX C. */ 4878c2ecf20Sopenharmony_ci DRX_STANDARD_ITU_D, /*< Cable ITU ANNEX D. */ 4888c2ecf20Sopenharmony_ci DRX_STANDARD_FM, /*< Terrestrial\Cable FM radio */ 4898c2ecf20Sopenharmony_ci DRX_STANDARD_DTMB, /*< Terrestrial DTMB standard (China)*/ 4908c2ecf20Sopenharmony_ci DRX_STANDARD_UNKNOWN = DRX_UNKNOWN, 4918c2ecf20Sopenharmony_ci /*< Standard unknown. */ 4928c2ecf20Sopenharmony_ci DRX_STANDARD_AUTO = DRX_AUTO 4938c2ecf20Sopenharmony_ci /*< Autodetect standard. */ 4948c2ecf20Sopenharmony_ci}; 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci/* 4978c2ecf20Sopenharmony_ci* \enum enum drx_standard 4988c2ecf20Sopenharmony_ci* \brief Modulation sub-standards. 4998c2ecf20Sopenharmony_ci*/ 5008c2ecf20Sopenharmony_cienum drx_substandard { 5018c2ecf20Sopenharmony_ci DRX_SUBSTANDARD_MAIN = 0, /*< Main subvariant of standard */ 5028c2ecf20Sopenharmony_ci DRX_SUBSTANDARD_ATV_BG_SCANDINAVIA, 5038c2ecf20Sopenharmony_ci DRX_SUBSTANDARD_ATV_DK_POLAND, 5048c2ecf20Sopenharmony_ci DRX_SUBSTANDARD_ATV_DK_CHINA, 5058c2ecf20Sopenharmony_ci DRX_SUBSTANDARD_UNKNOWN = DRX_UNKNOWN, 5068c2ecf20Sopenharmony_ci /*< Sub-standard unknown. */ 5078c2ecf20Sopenharmony_ci DRX_SUBSTANDARD_AUTO = DRX_AUTO 5088c2ecf20Sopenharmony_ci /*< Auto (default) sub-standard */ 5098c2ecf20Sopenharmony_ci}; 5108c2ecf20Sopenharmony_ci 5118c2ecf20Sopenharmony_ci/* 5128c2ecf20Sopenharmony_ci* \enum enum drx_bandwidth 5138c2ecf20Sopenharmony_ci* \brief Channel bandwidth or channel spacing. 5148c2ecf20Sopenharmony_ci*/ 5158c2ecf20Sopenharmony_cienum drx_bandwidth { 5168c2ecf20Sopenharmony_ci DRX_BANDWIDTH_8MHZ = 0, /*< Bandwidth 8 MHz. */ 5178c2ecf20Sopenharmony_ci DRX_BANDWIDTH_7MHZ, /*< Bandwidth 7 MHz. */ 5188c2ecf20Sopenharmony_ci DRX_BANDWIDTH_6MHZ, /*< Bandwidth 6 MHz. */ 5198c2ecf20Sopenharmony_ci DRX_BANDWIDTH_UNKNOWN = DRX_UNKNOWN, 5208c2ecf20Sopenharmony_ci /*< Bandwidth unknown. */ 5218c2ecf20Sopenharmony_ci DRX_BANDWIDTH_AUTO = DRX_AUTO 5228c2ecf20Sopenharmony_ci /*< Auto Set Bandwidth */ 5238c2ecf20Sopenharmony_ci}; 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_ci/* 5268c2ecf20Sopenharmony_ci* \enum enum drx_mirror 5278c2ecf20Sopenharmony_ci* \brief Indicate if channel spectrum is mirrored or not. 5288c2ecf20Sopenharmony_ci*/ 5298c2ecf20Sopenharmony_cienum drx_mirror { 5308c2ecf20Sopenharmony_ci DRX_MIRROR_NO = 0, /*< Spectrum is not mirrored. */ 5318c2ecf20Sopenharmony_ci DRX_MIRROR_YES, /*< Spectrum is mirrored. */ 5328c2ecf20Sopenharmony_ci DRX_MIRROR_UNKNOWN = DRX_UNKNOWN, 5338c2ecf20Sopenharmony_ci /*< Unknown if spectrum is mirrored. */ 5348c2ecf20Sopenharmony_ci DRX_MIRROR_AUTO = DRX_AUTO 5358c2ecf20Sopenharmony_ci /*< Autodetect if spectrum is mirrored. */ 5368c2ecf20Sopenharmony_ci}; 5378c2ecf20Sopenharmony_ci 5388c2ecf20Sopenharmony_ci/* 5398c2ecf20Sopenharmony_ci* \enum enum drx_modulation 5408c2ecf20Sopenharmony_ci* \brief Constellation type of the channel. 5418c2ecf20Sopenharmony_ci*/ 5428c2ecf20Sopenharmony_cienum drx_modulation { 5438c2ecf20Sopenharmony_ci DRX_CONSTELLATION_BPSK = 0, /*< Modulation is BPSK. */ 5448c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QPSK, /*< Constellation is QPSK. */ 5458c2ecf20Sopenharmony_ci DRX_CONSTELLATION_PSK8, /*< Constellation is PSK8. */ 5468c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM16, /*< Constellation is QAM16. */ 5478c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM32, /*< Constellation is QAM32. */ 5488c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM64, /*< Constellation is QAM64. */ 5498c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM128, /*< Constellation is QAM128. */ 5508c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM256, /*< Constellation is QAM256. */ 5518c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM512, /*< Constellation is QAM512. */ 5528c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM1024, /*< Constellation is QAM1024. */ 5538c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QPSK_NR, /*< Constellation is QPSK_NR */ 5548c2ecf20Sopenharmony_ci DRX_CONSTELLATION_UNKNOWN = DRX_UNKNOWN, 5558c2ecf20Sopenharmony_ci /*< Constellation unknown. */ 5568c2ecf20Sopenharmony_ci DRX_CONSTELLATION_AUTO = DRX_AUTO 5578c2ecf20Sopenharmony_ci /*< Autodetect constellation. */ 5588c2ecf20Sopenharmony_ci}; 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_ci/* 5618c2ecf20Sopenharmony_ci* \enum enum drx_hierarchy 5628c2ecf20Sopenharmony_ci* \brief Hierarchy of the channel. 5638c2ecf20Sopenharmony_ci*/ 5648c2ecf20Sopenharmony_cienum drx_hierarchy { 5658c2ecf20Sopenharmony_ci DRX_HIERARCHY_NONE = 0, /*< None hierarchical channel. */ 5668c2ecf20Sopenharmony_ci DRX_HIERARCHY_ALPHA1, /*< Hierarchical channel, alpha=1. */ 5678c2ecf20Sopenharmony_ci DRX_HIERARCHY_ALPHA2, /*< Hierarchical channel, alpha=2. */ 5688c2ecf20Sopenharmony_ci DRX_HIERARCHY_ALPHA4, /*< Hierarchical channel, alpha=4. */ 5698c2ecf20Sopenharmony_ci DRX_HIERARCHY_UNKNOWN = DRX_UNKNOWN, 5708c2ecf20Sopenharmony_ci /*< Hierarchy unknown. */ 5718c2ecf20Sopenharmony_ci DRX_HIERARCHY_AUTO = DRX_AUTO 5728c2ecf20Sopenharmony_ci /*< Autodetect hierarchy. */ 5738c2ecf20Sopenharmony_ci}; 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ci/* 5768c2ecf20Sopenharmony_ci* \enum enum drx_priority 5778c2ecf20Sopenharmony_ci* \brief Channel priority in case of hierarchical transmission. 5788c2ecf20Sopenharmony_ci*/ 5798c2ecf20Sopenharmony_cienum drx_priority { 5808c2ecf20Sopenharmony_ci DRX_PRIORITY_LOW = 0, /*< Low priority channel. */ 5818c2ecf20Sopenharmony_ci DRX_PRIORITY_HIGH, /*< High priority channel. */ 5828c2ecf20Sopenharmony_ci DRX_PRIORITY_UNKNOWN = DRX_UNKNOWN 5838c2ecf20Sopenharmony_ci /*< Priority unknown. */ 5848c2ecf20Sopenharmony_ci}; 5858c2ecf20Sopenharmony_ci 5868c2ecf20Sopenharmony_ci/* 5878c2ecf20Sopenharmony_ci* \enum enum drx_coderate 5888c2ecf20Sopenharmony_ci* \brief Channel priority in case of hierarchical transmission. 5898c2ecf20Sopenharmony_ci*/ 5908c2ecf20Sopenharmony_cienum drx_coderate { 5918c2ecf20Sopenharmony_ci DRX_CODERATE_1DIV2 = 0, /*< Code rate 1/2nd. */ 5928c2ecf20Sopenharmony_ci DRX_CODERATE_2DIV3, /*< Code rate 2/3nd. */ 5938c2ecf20Sopenharmony_ci DRX_CODERATE_3DIV4, /*< Code rate 3/4nd. */ 5948c2ecf20Sopenharmony_ci DRX_CODERATE_5DIV6, /*< Code rate 5/6nd. */ 5958c2ecf20Sopenharmony_ci DRX_CODERATE_7DIV8, /*< Code rate 7/8nd. */ 5968c2ecf20Sopenharmony_ci DRX_CODERATE_UNKNOWN = DRX_UNKNOWN, 5978c2ecf20Sopenharmony_ci /*< Code rate unknown. */ 5988c2ecf20Sopenharmony_ci DRX_CODERATE_AUTO = DRX_AUTO 5998c2ecf20Sopenharmony_ci /*< Autodetect code rate. */ 6008c2ecf20Sopenharmony_ci}; 6018c2ecf20Sopenharmony_ci 6028c2ecf20Sopenharmony_ci/* 6038c2ecf20Sopenharmony_ci* \enum enum drx_guard 6048c2ecf20Sopenharmony_ci* \brief Guard interval of a channel. 6058c2ecf20Sopenharmony_ci*/ 6068c2ecf20Sopenharmony_cienum drx_guard { 6078c2ecf20Sopenharmony_ci DRX_GUARD_1DIV32 = 0, /*< Guard interval 1/32nd. */ 6088c2ecf20Sopenharmony_ci DRX_GUARD_1DIV16, /*< Guard interval 1/16th. */ 6098c2ecf20Sopenharmony_ci DRX_GUARD_1DIV8, /*< Guard interval 1/8th. */ 6108c2ecf20Sopenharmony_ci DRX_GUARD_1DIV4, /*< Guard interval 1/4th. */ 6118c2ecf20Sopenharmony_ci DRX_GUARD_UNKNOWN = DRX_UNKNOWN, 6128c2ecf20Sopenharmony_ci /*< Guard interval unknown. */ 6138c2ecf20Sopenharmony_ci DRX_GUARD_AUTO = DRX_AUTO 6148c2ecf20Sopenharmony_ci /*< Autodetect guard interval. */ 6158c2ecf20Sopenharmony_ci}; 6168c2ecf20Sopenharmony_ci 6178c2ecf20Sopenharmony_ci/* 6188c2ecf20Sopenharmony_ci* \enum enum drx_fft_mode 6198c2ecf20Sopenharmony_ci* \brief FFT mode. 6208c2ecf20Sopenharmony_ci*/ 6218c2ecf20Sopenharmony_cienum drx_fft_mode { 6228c2ecf20Sopenharmony_ci DRX_FFTMODE_2K = 0, /*< 2K FFT mode. */ 6238c2ecf20Sopenharmony_ci DRX_FFTMODE_4K, /*< 4K FFT mode. */ 6248c2ecf20Sopenharmony_ci DRX_FFTMODE_8K, /*< 8K FFT mode. */ 6258c2ecf20Sopenharmony_ci DRX_FFTMODE_UNKNOWN = DRX_UNKNOWN, 6268c2ecf20Sopenharmony_ci /*< FFT mode unknown. */ 6278c2ecf20Sopenharmony_ci DRX_FFTMODE_AUTO = DRX_AUTO 6288c2ecf20Sopenharmony_ci /*< Autodetect FFT mode. */ 6298c2ecf20Sopenharmony_ci}; 6308c2ecf20Sopenharmony_ci 6318c2ecf20Sopenharmony_ci/* 6328c2ecf20Sopenharmony_ci* \enum enum drx_classification 6338c2ecf20Sopenharmony_ci* \brief Channel classification. 6348c2ecf20Sopenharmony_ci*/ 6358c2ecf20Sopenharmony_cienum drx_classification { 6368c2ecf20Sopenharmony_ci DRX_CLASSIFICATION_GAUSS = 0, /*< Gaussion noise. */ 6378c2ecf20Sopenharmony_ci DRX_CLASSIFICATION_HVY_GAUSS, /*< Heavy Gaussion noise. */ 6388c2ecf20Sopenharmony_ci DRX_CLASSIFICATION_COCHANNEL, /*< Co-channel. */ 6398c2ecf20Sopenharmony_ci DRX_CLASSIFICATION_STATIC, /*< Static echo. */ 6408c2ecf20Sopenharmony_ci DRX_CLASSIFICATION_MOVING, /*< Moving echo. */ 6418c2ecf20Sopenharmony_ci DRX_CLASSIFICATION_ZERODB, /*< Zero dB echo. */ 6428c2ecf20Sopenharmony_ci DRX_CLASSIFICATION_UNKNOWN = DRX_UNKNOWN, 6438c2ecf20Sopenharmony_ci /*< Unknown classification */ 6448c2ecf20Sopenharmony_ci DRX_CLASSIFICATION_AUTO = DRX_AUTO 6458c2ecf20Sopenharmony_ci /*< Autodetect classification. */ 6468c2ecf20Sopenharmony_ci}; 6478c2ecf20Sopenharmony_ci 6488c2ecf20Sopenharmony_ci/* 6498c2ecf20Sopenharmony_ci* /enum enum drx_interleave_mode 6508c2ecf20Sopenharmony_ci* /brief Interleave modes 6518c2ecf20Sopenharmony_ci*/ 6528c2ecf20Sopenharmony_cienum drx_interleave_mode { 6538c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I128_J1 = 0, 6548c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I128_J1_V2, 6558c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I128_J2, 6568c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I64_J2, 6578c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I128_J3, 6588c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I32_J4, 6598c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I128_J4, 6608c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I16_J8, 6618c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I128_J5, 6628c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I8_J16, 6638c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I128_J6, 6648c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_RESERVED_11, 6658c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I128_J7, 6668c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_RESERVED_13, 6678c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I128_J8, 6688c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_RESERVED_15, 6698c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I12_J17, 6708c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_I5_J4, 6718c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_B52_M240, 6728c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_B52_M720, 6738c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_B52_M48, 6748c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_B52_M0, 6758c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_UNKNOWN = DRX_UNKNOWN, 6768c2ecf20Sopenharmony_ci /*< Unknown interleave mode */ 6778c2ecf20Sopenharmony_ci DRX_INTERLEAVEMODE_AUTO = DRX_AUTO 6788c2ecf20Sopenharmony_ci /*< Autodetect interleave mode */ 6798c2ecf20Sopenharmony_ci}; 6808c2ecf20Sopenharmony_ci 6818c2ecf20Sopenharmony_ci/* 6828c2ecf20Sopenharmony_ci* \enum enum drx_carrier_mode 6838c2ecf20Sopenharmony_ci* \brief Channel Carrier Mode. 6848c2ecf20Sopenharmony_ci*/ 6858c2ecf20Sopenharmony_cienum drx_carrier_mode { 6868c2ecf20Sopenharmony_ci DRX_CARRIER_MULTI = 0, /*< Multi carrier mode */ 6878c2ecf20Sopenharmony_ci DRX_CARRIER_SINGLE, /*< Single carrier mode */ 6888c2ecf20Sopenharmony_ci DRX_CARRIER_UNKNOWN = DRX_UNKNOWN, 6898c2ecf20Sopenharmony_ci /*< Carrier mode unknown. */ 6908c2ecf20Sopenharmony_ci DRX_CARRIER_AUTO = DRX_AUTO /*< Autodetect carrier mode */ 6918c2ecf20Sopenharmony_ci}; 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_ci/* 6948c2ecf20Sopenharmony_ci* \enum enum drx_frame_mode 6958c2ecf20Sopenharmony_ci* \brief Channel Frame Mode. 6968c2ecf20Sopenharmony_ci*/ 6978c2ecf20Sopenharmony_cienum drx_frame_mode { 6988c2ecf20Sopenharmony_ci DRX_FRAMEMODE_420 = 0, /*< 420 with variable PN */ 6998c2ecf20Sopenharmony_ci DRX_FRAMEMODE_595, /*< 595 */ 7008c2ecf20Sopenharmony_ci DRX_FRAMEMODE_945, /*< 945 with variable PN */ 7018c2ecf20Sopenharmony_ci DRX_FRAMEMODE_420_FIXED_PN, 7028c2ecf20Sopenharmony_ci /*< 420 with fixed PN */ 7038c2ecf20Sopenharmony_ci DRX_FRAMEMODE_945_FIXED_PN, 7048c2ecf20Sopenharmony_ci /*< 945 with fixed PN */ 7058c2ecf20Sopenharmony_ci DRX_FRAMEMODE_UNKNOWN = DRX_UNKNOWN, 7068c2ecf20Sopenharmony_ci /*< Frame mode unknown. */ 7078c2ecf20Sopenharmony_ci DRX_FRAMEMODE_AUTO = DRX_AUTO 7088c2ecf20Sopenharmony_ci /*< Autodetect frame mode */ 7098c2ecf20Sopenharmony_ci}; 7108c2ecf20Sopenharmony_ci 7118c2ecf20Sopenharmony_ci/* 7128c2ecf20Sopenharmony_ci* \enum enum drx_tps_frame 7138c2ecf20Sopenharmony_ci* \brief Frame number in current super-frame. 7148c2ecf20Sopenharmony_ci*/ 7158c2ecf20Sopenharmony_cienum drx_tps_frame { 7168c2ecf20Sopenharmony_ci DRX_TPS_FRAME1 = 0, /*< TPS frame 1. */ 7178c2ecf20Sopenharmony_ci DRX_TPS_FRAME2, /*< TPS frame 2. */ 7188c2ecf20Sopenharmony_ci DRX_TPS_FRAME3, /*< TPS frame 3. */ 7198c2ecf20Sopenharmony_ci DRX_TPS_FRAME4, /*< TPS frame 4. */ 7208c2ecf20Sopenharmony_ci DRX_TPS_FRAME_UNKNOWN = DRX_UNKNOWN 7218c2ecf20Sopenharmony_ci /*< TPS frame unknown. */ 7228c2ecf20Sopenharmony_ci}; 7238c2ecf20Sopenharmony_ci 7248c2ecf20Sopenharmony_ci/* 7258c2ecf20Sopenharmony_ci* \enum enum drx_ldpc 7268c2ecf20Sopenharmony_ci* \brief TPS LDPC . 7278c2ecf20Sopenharmony_ci*/ 7288c2ecf20Sopenharmony_cienum drx_ldpc { 7298c2ecf20Sopenharmony_ci DRX_LDPC_0_4 = 0, /*< LDPC 0.4 */ 7308c2ecf20Sopenharmony_ci DRX_LDPC_0_6, /*< LDPC 0.6 */ 7318c2ecf20Sopenharmony_ci DRX_LDPC_0_8, /*< LDPC 0.8 */ 7328c2ecf20Sopenharmony_ci DRX_LDPC_UNKNOWN = DRX_UNKNOWN, 7338c2ecf20Sopenharmony_ci /*< LDPC unknown. */ 7348c2ecf20Sopenharmony_ci DRX_LDPC_AUTO = DRX_AUTO /*< Autodetect LDPC */ 7358c2ecf20Sopenharmony_ci}; 7368c2ecf20Sopenharmony_ci 7378c2ecf20Sopenharmony_ci/* 7388c2ecf20Sopenharmony_ci* \enum enum drx_pilot_mode 7398c2ecf20Sopenharmony_ci* \brief Pilot modes in DTMB. 7408c2ecf20Sopenharmony_ci*/ 7418c2ecf20Sopenharmony_cienum drx_pilot_mode { 7428c2ecf20Sopenharmony_ci DRX_PILOT_ON = 0, /*< Pilot On */ 7438c2ecf20Sopenharmony_ci DRX_PILOT_OFF, /*< Pilot Off */ 7448c2ecf20Sopenharmony_ci DRX_PILOT_UNKNOWN = DRX_UNKNOWN, 7458c2ecf20Sopenharmony_ci /*< Pilot unknown. */ 7468c2ecf20Sopenharmony_ci DRX_PILOT_AUTO = DRX_AUTO /*< Autodetect Pilot */ 7478c2ecf20Sopenharmony_ci}; 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_ci/* 7508c2ecf20Sopenharmony_ci * enum drxu_code_action - indicate if firmware has to be uploaded or verified. 7518c2ecf20Sopenharmony_ci * @UCODE_UPLOAD: Upload the microcode image to device 7528c2ecf20Sopenharmony_ci * @UCODE_VERIFY: Compare microcode image with code on device 7538c2ecf20Sopenharmony_ci */ 7548c2ecf20Sopenharmony_cienum drxu_code_action { 7558c2ecf20Sopenharmony_ci UCODE_UPLOAD, 7568c2ecf20Sopenharmony_ci UCODE_VERIFY 7578c2ecf20Sopenharmony_ci}; 7588c2ecf20Sopenharmony_ci 7598c2ecf20Sopenharmony_ci/* 7608c2ecf20Sopenharmony_ci* \enum enum drx_lock_status * \brief Used to reflect current lock status of demodulator. 7618c2ecf20Sopenharmony_ci* 7628c2ecf20Sopenharmony_ci* The generic lock states have device dependent semantics. 7638c2ecf20Sopenharmony_ci 7648c2ecf20Sopenharmony_ci DRX_NEVER_LOCK = 0, 7658c2ecf20Sopenharmony_ci **< Device will never lock on this signal * 7668c2ecf20Sopenharmony_ci DRX_NOT_LOCKED, 7678c2ecf20Sopenharmony_ci **< Device has no lock at all * 7688c2ecf20Sopenharmony_ci DRX_LOCK_STATE_1, 7698c2ecf20Sopenharmony_ci **< Generic lock state * 7708c2ecf20Sopenharmony_ci DRX_LOCK_STATE_2, 7718c2ecf20Sopenharmony_ci **< Generic lock state * 7728c2ecf20Sopenharmony_ci DRX_LOCK_STATE_3, 7738c2ecf20Sopenharmony_ci **< Generic lock state * 7748c2ecf20Sopenharmony_ci DRX_LOCK_STATE_4, 7758c2ecf20Sopenharmony_ci **< Generic lock state * 7768c2ecf20Sopenharmony_ci DRX_LOCK_STATE_5, 7778c2ecf20Sopenharmony_ci **< Generic lock state * 7788c2ecf20Sopenharmony_ci DRX_LOCK_STATE_6, 7798c2ecf20Sopenharmony_ci **< Generic lock state * 7808c2ecf20Sopenharmony_ci DRX_LOCK_STATE_7, 7818c2ecf20Sopenharmony_ci **< Generic lock state * 7828c2ecf20Sopenharmony_ci DRX_LOCK_STATE_8, 7838c2ecf20Sopenharmony_ci **< Generic lock state * 7848c2ecf20Sopenharmony_ci DRX_LOCK_STATE_9, 7858c2ecf20Sopenharmony_ci **< Generic lock state * 7868c2ecf20Sopenharmony_ci DRX_LOCKED **< Device is in lock * 7878c2ecf20Sopenharmony_ci*/ 7888c2ecf20Sopenharmony_ci 7898c2ecf20Sopenharmony_cienum drx_lock_status { 7908c2ecf20Sopenharmony_ci DRX_NEVER_LOCK = 0, 7918c2ecf20Sopenharmony_ci DRX_NOT_LOCKED, 7928c2ecf20Sopenharmony_ci DRX_LOCK_STATE_1, 7938c2ecf20Sopenharmony_ci DRX_LOCK_STATE_2, 7948c2ecf20Sopenharmony_ci DRX_LOCK_STATE_3, 7958c2ecf20Sopenharmony_ci DRX_LOCK_STATE_4, 7968c2ecf20Sopenharmony_ci DRX_LOCK_STATE_5, 7978c2ecf20Sopenharmony_ci DRX_LOCK_STATE_6, 7988c2ecf20Sopenharmony_ci DRX_LOCK_STATE_7, 7998c2ecf20Sopenharmony_ci DRX_LOCK_STATE_8, 8008c2ecf20Sopenharmony_ci DRX_LOCK_STATE_9, 8018c2ecf20Sopenharmony_ci DRX_LOCKED 8028c2ecf20Sopenharmony_ci}; 8038c2ecf20Sopenharmony_ci 8048c2ecf20Sopenharmony_ci/* 8058c2ecf20Sopenharmony_ci* \enum enum drx_uio* \brief Used to address a User IO (UIO). 8068c2ecf20Sopenharmony_ci*/ 8078c2ecf20Sopenharmony_cienum drx_uio { 8088c2ecf20Sopenharmony_ci DRX_UIO1, 8098c2ecf20Sopenharmony_ci DRX_UIO2, 8108c2ecf20Sopenharmony_ci DRX_UIO3, 8118c2ecf20Sopenharmony_ci DRX_UIO4, 8128c2ecf20Sopenharmony_ci DRX_UIO5, 8138c2ecf20Sopenharmony_ci DRX_UIO6, 8148c2ecf20Sopenharmony_ci DRX_UIO7, 8158c2ecf20Sopenharmony_ci DRX_UIO8, 8168c2ecf20Sopenharmony_ci DRX_UIO9, 8178c2ecf20Sopenharmony_ci DRX_UIO10, 8188c2ecf20Sopenharmony_ci DRX_UIO11, 8198c2ecf20Sopenharmony_ci DRX_UIO12, 8208c2ecf20Sopenharmony_ci DRX_UIO13, 8218c2ecf20Sopenharmony_ci DRX_UIO14, 8228c2ecf20Sopenharmony_ci DRX_UIO15, 8238c2ecf20Sopenharmony_ci DRX_UIO16, 8248c2ecf20Sopenharmony_ci DRX_UIO17, 8258c2ecf20Sopenharmony_ci DRX_UIO18, 8268c2ecf20Sopenharmony_ci DRX_UIO19, 8278c2ecf20Sopenharmony_ci DRX_UIO20, 8288c2ecf20Sopenharmony_ci DRX_UIO21, 8298c2ecf20Sopenharmony_ci DRX_UIO22, 8308c2ecf20Sopenharmony_ci DRX_UIO23, 8318c2ecf20Sopenharmony_ci DRX_UIO24, 8328c2ecf20Sopenharmony_ci DRX_UIO25, 8338c2ecf20Sopenharmony_ci DRX_UIO26, 8348c2ecf20Sopenharmony_ci DRX_UIO27, 8358c2ecf20Sopenharmony_ci DRX_UIO28, 8368c2ecf20Sopenharmony_ci DRX_UIO29, 8378c2ecf20Sopenharmony_ci DRX_UIO30, 8388c2ecf20Sopenharmony_ci DRX_UIO31, 8398c2ecf20Sopenharmony_ci DRX_UIO32, 8408c2ecf20Sopenharmony_ci DRX_UIO_MAX = DRX_UIO32 8418c2ecf20Sopenharmony_ci}; 8428c2ecf20Sopenharmony_ci 8438c2ecf20Sopenharmony_ci/* 8448c2ecf20Sopenharmony_ci* \enum enum drxuio_mode * \brief Used to configure the modus oprandi of a UIO. 8458c2ecf20Sopenharmony_ci* 8468c2ecf20Sopenharmony_ci* DRX_UIO_MODE_FIRMWARE is an old uio mode. 8478c2ecf20Sopenharmony_ci* It is replaced by the modes DRX_UIO_MODE_FIRMWARE0 .. DRX_UIO_MODE_FIRMWARE9. 8488c2ecf20Sopenharmony_ci* To be backward compatible DRX_UIO_MODE_FIRMWARE is equivalent to 8498c2ecf20Sopenharmony_ci* DRX_UIO_MODE_FIRMWARE0. 8508c2ecf20Sopenharmony_ci*/ 8518c2ecf20Sopenharmony_cienum drxuio_mode { 8528c2ecf20Sopenharmony_ci DRX_UIO_MODE_DISABLE = 0x01, 8538c2ecf20Sopenharmony_ci /*< not used, pin is configured as input */ 8548c2ecf20Sopenharmony_ci DRX_UIO_MODE_READWRITE = 0x02, 8558c2ecf20Sopenharmony_ci /*< used for read/write by application */ 8568c2ecf20Sopenharmony_ci DRX_UIO_MODE_FIRMWARE = 0x04, 8578c2ecf20Sopenharmony_ci /*< controlled by firmware, function 0 */ 8588c2ecf20Sopenharmony_ci DRX_UIO_MODE_FIRMWARE0 = DRX_UIO_MODE_FIRMWARE, 8598c2ecf20Sopenharmony_ci /*< same as above */ 8608c2ecf20Sopenharmony_ci DRX_UIO_MODE_FIRMWARE1 = 0x08, 8618c2ecf20Sopenharmony_ci /*< controlled by firmware, function 1 */ 8628c2ecf20Sopenharmony_ci DRX_UIO_MODE_FIRMWARE2 = 0x10, 8638c2ecf20Sopenharmony_ci /*< controlled by firmware, function 2 */ 8648c2ecf20Sopenharmony_ci DRX_UIO_MODE_FIRMWARE3 = 0x20, 8658c2ecf20Sopenharmony_ci /*< controlled by firmware, function 3 */ 8668c2ecf20Sopenharmony_ci DRX_UIO_MODE_FIRMWARE4 = 0x40, 8678c2ecf20Sopenharmony_ci /*< controlled by firmware, function 4 */ 8688c2ecf20Sopenharmony_ci DRX_UIO_MODE_FIRMWARE5 = 0x80 8698c2ecf20Sopenharmony_ci /*< controlled by firmware, function 5 */ 8708c2ecf20Sopenharmony_ci}; 8718c2ecf20Sopenharmony_ci 8728c2ecf20Sopenharmony_ci/* 8738c2ecf20Sopenharmony_ci* \enum enum drxoob_downstream_standard * \brief Used to select OOB standard. 8748c2ecf20Sopenharmony_ci* 8758c2ecf20Sopenharmony_ci* Based on ANSI 55-1 and 55-2 8768c2ecf20Sopenharmony_ci*/ 8778c2ecf20Sopenharmony_cienum drxoob_downstream_standard { 8788c2ecf20Sopenharmony_ci DRX_OOB_MODE_A = 0, 8798c2ecf20Sopenharmony_ci /*< ANSI 55-1 */ 8808c2ecf20Sopenharmony_ci DRX_OOB_MODE_B_GRADE_A, 8818c2ecf20Sopenharmony_ci /*< ANSI 55-2 A */ 8828c2ecf20Sopenharmony_ci DRX_OOB_MODE_B_GRADE_B 8838c2ecf20Sopenharmony_ci /*< ANSI 55-2 B */ 8848c2ecf20Sopenharmony_ci}; 8858c2ecf20Sopenharmony_ci 8868c2ecf20Sopenharmony_ci/*------------------------------------------------------------------------- 8878c2ecf20Sopenharmony_ciSTRUCTS 8888c2ecf20Sopenharmony_ci-------------------------------------------------------------------------*/ 8898c2ecf20Sopenharmony_ci 8908c2ecf20Sopenharmony_ci/*============================================================================*/ 8918c2ecf20Sopenharmony_ci/*============================================================================*/ 8928c2ecf20Sopenharmony_ci/*== CTRL CFG related data structures ========================================*/ 8938c2ecf20Sopenharmony_ci/*============================================================================*/ 8948c2ecf20Sopenharmony_ci/*============================================================================*/ 8958c2ecf20Sopenharmony_ci 8968c2ecf20Sopenharmony_ci#ifndef DRX_CFG_BASE 8978c2ecf20Sopenharmony_ci#define DRX_CFG_BASE 0 8988c2ecf20Sopenharmony_ci#endif 8998c2ecf20Sopenharmony_ci 9008c2ecf20Sopenharmony_ci#define DRX_CFG_MPEG_OUTPUT (DRX_CFG_BASE + 0) /* MPEG TS output */ 9018c2ecf20Sopenharmony_ci#define DRX_CFG_PKTERR (DRX_CFG_BASE + 1) /* Packet Error */ 9028c2ecf20Sopenharmony_ci#define DRX_CFG_SYMCLK_OFFS (DRX_CFG_BASE + 2) /* Symbol Clk Offset */ 9038c2ecf20Sopenharmony_ci#define DRX_CFG_SMA (DRX_CFG_BASE + 3) /* Smart Antenna */ 9048c2ecf20Sopenharmony_ci#define DRX_CFG_PINSAFE (DRX_CFG_BASE + 4) /* Pin safe mode */ 9058c2ecf20Sopenharmony_ci#define DRX_CFG_SUBSTANDARD (DRX_CFG_BASE + 5) /* substandard */ 9068c2ecf20Sopenharmony_ci#define DRX_CFG_AUD_VOLUME (DRX_CFG_BASE + 6) /* volume */ 9078c2ecf20Sopenharmony_ci#define DRX_CFG_AUD_RDS (DRX_CFG_BASE + 7) /* rds */ 9088c2ecf20Sopenharmony_ci#define DRX_CFG_AUD_AUTOSOUND (DRX_CFG_BASE + 8) /* ASS & ASC */ 9098c2ecf20Sopenharmony_ci#define DRX_CFG_AUD_ASS_THRES (DRX_CFG_BASE + 9) /* ASS Thresholds */ 9108c2ecf20Sopenharmony_ci#define DRX_CFG_AUD_DEVIATION (DRX_CFG_BASE + 10) /* Deviation */ 9118c2ecf20Sopenharmony_ci#define DRX_CFG_AUD_PRESCALE (DRX_CFG_BASE + 11) /* Prescale */ 9128c2ecf20Sopenharmony_ci#define DRX_CFG_AUD_MIXER (DRX_CFG_BASE + 12) /* Mixer */ 9138c2ecf20Sopenharmony_ci#define DRX_CFG_AUD_AVSYNC (DRX_CFG_BASE + 13) /* AVSync */ 9148c2ecf20Sopenharmony_ci#define DRX_CFG_AUD_CARRIER (DRX_CFG_BASE + 14) /* Audio carriers */ 9158c2ecf20Sopenharmony_ci#define DRX_CFG_I2S_OUTPUT (DRX_CFG_BASE + 15) /* I2S output */ 9168c2ecf20Sopenharmony_ci#define DRX_CFG_ATV_STANDARD (DRX_CFG_BASE + 16) /* ATV standard */ 9178c2ecf20Sopenharmony_ci#define DRX_CFG_SQI_SPEED (DRX_CFG_BASE + 17) /* SQI speed */ 9188c2ecf20Sopenharmony_ci#define DRX_CTRL_CFG_MAX (DRX_CFG_BASE + 18) /* never to be used */ 9198c2ecf20Sopenharmony_ci 9208c2ecf20Sopenharmony_ci#define DRX_CFG_PINS_SAFE_MODE DRX_CFG_PINSAFE 9218c2ecf20Sopenharmony_ci/*============================================================================*/ 9228c2ecf20Sopenharmony_ci/*============================================================================*/ 9238c2ecf20Sopenharmony_ci/*== CTRL related data structures ============================================*/ 9248c2ecf20Sopenharmony_ci/*============================================================================*/ 9258c2ecf20Sopenharmony_ci/*============================================================================*/ 9268c2ecf20Sopenharmony_ci 9278c2ecf20Sopenharmony_ci/* 9288c2ecf20Sopenharmony_ci * struct drxu_code_info Parameters for microcode upload and verfiy. 9298c2ecf20Sopenharmony_ci * 9308c2ecf20Sopenharmony_ci * @mc_file: microcode file name 9318c2ecf20Sopenharmony_ci * 9328c2ecf20Sopenharmony_ci * Used by DRX_CTRL_LOAD_UCODE and DRX_CTRL_VERIFY_UCODE 9338c2ecf20Sopenharmony_ci */ 9348c2ecf20Sopenharmony_cistruct drxu_code_info { 9358c2ecf20Sopenharmony_ci char *mc_file; 9368c2ecf20Sopenharmony_ci}; 9378c2ecf20Sopenharmony_ci 9388c2ecf20Sopenharmony_ci/* 9398c2ecf20Sopenharmony_ci* \struct drx_mc_version_rec_t 9408c2ecf20Sopenharmony_ci* \brief Microcode version record 9418c2ecf20Sopenharmony_ci* Version numbers are stored in BCD format, as usual: 9428c2ecf20Sopenharmony_ci* o major number = bits 31-20 (first three nibbles of MSW) 9438c2ecf20Sopenharmony_ci* o minor number = bits 19-16 (fourth nibble of MSW) 9448c2ecf20Sopenharmony_ci* o patch number = bits 15-0 (remaining nibbles in LSW) 9458c2ecf20Sopenharmony_ci* 9468c2ecf20Sopenharmony_ci* The device type indicates for which the device is meant. It is based on the 9478c2ecf20Sopenharmony_ci* JTAG ID, using everything except the bond ID and the metal fix. 9488c2ecf20Sopenharmony_ci* 9498c2ecf20Sopenharmony_ci* Special values: 9508c2ecf20Sopenharmony_ci* - mc_dev_type == 0 => any device allowed 9518c2ecf20Sopenharmony_ci* - mc_base_version == 0.0.0 => full microcode (mc_version is the version) 9528c2ecf20Sopenharmony_ci* - mc_base_version != 0.0.0 => patch microcode, the base microcode version 9538c2ecf20Sopenharmony_ci* (mc_version is the version) 9548c2ecf20Sopenharmony_ci*/ 9558c2ecf20Sopenharmony_ci#define AUX_VER_RECORD 0x8000 9568c2ecf20Sopenharmony_ci 9578c2ecf20Sopenharmony_cistruct drx_mc_version_rec { 9588c2ecf20Sopenharmony_ci u16 aux_type; /* type of aux data - 0x8000 for version record */ 9598c2ecf20Sopenharmony_ci u32 mc_dev_type; /* device type, based on JTAG ID */ 9608c2ecf20Sopenharmony_ci u32 mc_version; /* version of microcode */ 9618c2ecf20Sopenharmony_ci u32 mc_base_version; /* in case of patch: the original microcode version */ 9628c2ecf20Sopenharmony_ci}; 9638c2ecf20Sopenharmony_ci 9648c2ecf20Sopenharmony_ci/*========================================*/ 9658c2ecf20Sopenharmony_ci 9668c2ecf20Sopenharmony_ci/* 9678c2ecf20Sopenharmony_ci* \struct drx_filter_info_t 9688c2ecf20Sopenharmony_ci* \brief Parameters for loading filter coefficients 9698c2ecf20Sopenharmony_ci* 9708c2ecf20Sopenharmony_ci* Used by DRX_CTRL_LOAD_FILTER 9718c2ecf20Sopenharmony_ci*/ 9728c2ecf20Sopenharmony_cistruct drx_filter_info { 9738c2ecf20Sopenharmony_ci u8 *data_re; 9748c2ecf20Sopenharmony_ci /*< pointer to coefficients for RE */ 9758c2ecf20Sopenharmony_ci u8 *data_im; 9768c2ecf20Sopenharmony_ci /*< pointer to coefficients for IM */ 9778c2ecf20Sopenharmony_ci u16 size_re; 9788c2ecf20Sopenharmony_ci /*< size of coefficients for RE */ 9798c2ecf20Sopenharmony_ci u16 size_im; 9808c2ecf20Sopenharmony_ci /*< size of coefficients for IM */ 9818c2ecf20Sopenharmony_ci}; 9828c2ecf20Sopenharmony_ci 9838c2ecf20Sopenharmony_ci/*========================================*/ 9848c2ecf20Sopenharmony_ci 9858c2ecf20Sopenharmony_ci/* 9868c2ecf20Sopenharmony_ci* \struct struct drx_channel * \brief The set of parameters describing a single channel. 9878c2ecf20Sopenharmony_ci* 9888c2ecf20Sopenharmony_ci* Used by DRX_CTRL_SET_CHANNEL and DRX_CTRL_GET_CHANNEL. 9898c2ecf20Sopenharmony_ci* Only certain fields need to be used for a specific standard. 9908c2ecf20Sopenharmony_ci* 9918c2ecf20Sopenharmony_ci*/ 9928c2ecf20Sopenharmony_cistruct drx_channel { 9938c2ecf20Sopenharmony_ci s32 frequency; 9948c2ecf20Sopenharmony_ci /*< frequency in kHz */ 9958c2ecf20Sopenharmony_ci enum drx_bandwidth bandwidth; 9968c2ecf20Sopenharmony_ci /*< bandwidth */ 9978c2ecf20Sopenharmony_ci enum drx_mirror mirror; /*< mirrored or not on RF */ 9988c2ecf20Sopenharmony_ci enum drx_modulation constellation; 9998c2ecf20Sopenharmony_ci /*< constellation */ 10008c2ecf20Sopenharmony_ci enum drx_hierarchy hierarchy; 10018c2ecf20Sopenharmony_ci /*< hierarchy */ 10028c2ecf20Sopenharmony_ci enum drx_priority priority; /*< priority */ 10038c2ecf20Sopenharmony_ci enum drx_coderate coderate; /*< coderate */ 10048c2ecf20Sopenharmony_ci enum drx_guard guard; /*< guard interval */ 10058c2ecf20Sopenharmony_ci enum drx_fft_mode fftmode; /*< fftmode */ 10068c2ecf20Sopenharmony_ci enum drx_classification classification; 10078c2ecf20Sopenharmony_ci /*< classification */ 10088c2ecf20Sopenharmony_ci u32 symbolrate; 10098c2ecf20Sopenharmony_ci /*< symbolrate in symbols/sec */ 10108c2ecf20Sopenharmony_ci enum drx_interleave_mode interleavemode; 10118c2ecf20Sopenharmony_ci /*< interleaveMode QAM */ 10128c2ecf20Sopenharmony_ci enum drx_ldpc ldpc; /*< ldpc */ 10138c2ecf20Sopenharmony_ci enum drx_carrier_mode carrier; /*< carrier */ 10148c2ecf20Sopenharmony_ci enum drx_frame_mode framemode; 10158c2ecf20Sopenharmony_ci /*< frame mode */ 10168c2ecf20Sopenharmony_ci enum drx_pilot_mode pilot; /*< pilot mode */ 10178c2ecf20Sopenharmony_ci}; 10188c2ecf20Sopenharmony_ci 10198c2ecf20Sopenharmony_ci/*========================================*/ 10208c2ecf20Sopenharmony_ci 10218c2ecf20Sopenharmony_cienum drx_cfg_sqi_speed { 10228c2ecf20Sopenharmony_ci DRX_SQI_SPEED_FAST = 0, 10238c2ecf20Sopenharmony_ci DRX_SQI_SPEED_MEDIUM, 10248c2ecf20Sopenharmony_ci DRX_SQI_SPEED_SLOW, 10258c2ecf20Sopenharmony_ci DRX_SQI_SPEED_UNKNOWN = DRX_UNKNOWN 10268c2ecf20Sopenharmony_ci}; 10278c2ecf20Sopenharmony_ci 10288c2ecf20Sopenharmony_ci/*========================================*/ 10298c2ecf20Sopenharmony_ci 10308c2ecf20Sopenharmony_ci/* 10318c2ecf20Sopenharmony_ci* \struct struct drx_complex * A complex number. 10328c2ecf20Sopenharmony_ci* 10338c2ecf20Sopenharmony_ci* Used by DRX_CTRL_CONSTEL. 10348c2ecf20Sopenharmony_ci*/ 10358c2ecf20Sopenharmony_cistruct drx_complex { 10368c2ecf20Sopenharmony_ci s16 im; 10378c2ecf20Sopenharmony_ci /*< Imaginary part. */ 10388c2ecf20Sopenharmony_ci s16 re; 10398c2ecf20Sopenharmony_ci /*< Real part. */ 10408c2ecf20Sopenharmony_ci}; 10418c2ecf20Sopenharmony_ci 10428c2ecf20Sopenharmony_ci/*========================================*/ 10438c2ecf20Sopenharmony_ci 10448c2ecf20Sopenharmony_ci/* 10458c2ecf20Sopenharmony_ci* \struct struct drx_frequency_plan * Array element of a frequency plan. 10468c2ecf20Sopenharmony_ci* 10478c2ecf20Sopenharmony_ci* Used by DRX_CTRL_SCAN_INIT. 10488c2ecf20Sopenharmony_ci*/ 10498c2ecf20Sopenharmony_cistruct drx_frequency_plan { 10508c2ecf20Sopenharmony_ci s32 first; 10518c2ecf20Sopenharmony_ci /*< First centre frequency in this band */ 10528c2ecf20Sopenharmony_ci s32 last; 10538c2ecf20Sopenharmony_ci /*< Last centre frequency in this band */ 10548c2ecf20Sopenharmony_ci s32 step; 10558c2ecf20Sopenharmony_ci /*< Stepping frequency in this band */ 10568c2ecf20Sopenharmony_ci enum drx_bandwidth bandwidth; 10578c2ecf20Sopenharmony_ci /*< Bandwidth within this frequency band */ 10588c2ecf20Sopenharmony_ci u16 ch_number; 10598c2ecf20Sopenharmony_ci /*< First channel number in this band, or first 10608c2ecf20Sopenharmony_ci index in ch_names */ 10618c2ecf20Sopenharmony_ci char **ch_names; 10628c2ecf20Sopenharmony_ci /*< Optional list of channel names in this 10638c2ecf20Sopenharmony_ci band */ 10648c2ecf20Sopenharmony_ci}; 10658c2ecf20Sopenharmony_ci 10668c2ecf20Sopenharmony_ci/*========================================*/ 10678c2ecf20Sopenharmony_ci 10688c2ecf20Sopenharmony_ci/* 10698c2ecf20Sopenharmony_ci* \struct struct drx_scan_param * Parameters for channel scan. 10708c2ecf20Sopenharmony_ci* 10718c2ecf20Sopenharmony_ci* Used by DRX_CTRL_SCAN_INIT. 10728c2ecf20Sopenharmony_ci*/ 10738c2ecf20Sopenharmony_cistruct drx_scan_param { 10748c2ecf20Sopenharmony_ci struct drx_frequency_plan *frequency_plan; 10758c2ecf20Sopenharmony_ci /*< Frequency plan (array)*/ 10768c2ecf20Sopenharmony_ci u16 frequency_plan_size; /*< Number of bands */ 10778c2ecf20Sopenharmony_ci u32 num_tries; /*< Max channels tried */ 10788c2ecf20Sopenharmony_ci s32 skip; /*< Minimum frequency step to take 10798c2ecf20Sopenharmony_ci after a channel is found */ 10808c2ecf20Sopenharmony_ci void *ext_params; /*< Standard specific params */ 10818c2ecf20Sopenharmony_ci}; 10828c2ecf20Sopenharmony_ci 10838c2ecf20Sopenharmony_ci/*========================================*/ 10848c2ecf20Sopenharmony_ci 10858c2ecf20Sopenharmony_ci/* 10868c2ecf20Sopenharmony_ci* \brief Scan commands. 10878c2ecf20Sopenharmony_ci* Used by scanning algorithms. 10888c2ecf20Sopenharmony_ci*/ 10898c2ecf20Sopenharmony_cienum drx_scan_command { 10908c2ecf20Sopenharmony_ci DRX_SCAN_COMMAND_INIT = 0,/*< Initialize scanning */ 10918c2ecf20Sopenharmony_ci DRX_SCAN_COMMAND_NEXT, /*< Next scan */ 10928c2ecf20Sopenharmony_ci DRX_SCAN_COMMAND_STOP /*< Stop scanning */ 10938c2ecf20Sopenharmony_ci}; 10948c2ecf20Sopenharmony_ci 10958c2ecf20Sopenharmony_ci/*========================================*/ 10968c2ecf20Sopenharmony_ci 10978c2ecf20Sopenharmony_ci/* 10988c2ecf20Sopenharmony_ci* \brief Inner scan function prototype. 10998c2ecf20Sopenharmony_ci*/ 11008c2ecf20Sopenharmony_citypedef int(*drx_scan_func_t) (void *scan_context, 11018c2ecf20Sopenharmony_ci enum drx_scan_command scan_command, 11028c2ecf20Sopenharmony_ci struct drx_channel *scan_channel, 11038c2ecf20Sopenharmony_ci bool *get_next_channel); 11048c2ecf20Sopenharmony_ci 11058c2ecf20Sopenharmony_ci/*========================================*/ 11068c2ecf20Sopenharmony_ci 11078c2ecf20Sopenharmony_ci/* 11088c2ecf20Sopenharmony_ci* \struct struct drxtps_info * TPS information, DVB-T specific. 11098c2ecf20Sopenharmony_ci* 11108c2ecf20Sopenharmony_ci* Used by DRX_CTRL_TPS_INFO. 11118c2ecf20Sopenharmony_ci*/ 11128c2ecf20Sopenharmony_ci struct drxtps_info { 11138c2ecf20Sopenharmony_ci enum drx_fft_mode fftmode; /*< Fft mode */ 11148c2ecf20Sopenharmony_ci enum drx_guard guard; /*< Guard interval */ 11158c2ecf20Sopenharmony_ci enum drx_modulation constellation; 11168c2ecf20Sopenharmony_ci /*< Constellation */ 11178c2ecf20Sopenharmony_ci enum drx_hierarchy hierarchy; 11188c2ecf20Sopenharmony_ci /*< Hierarchy */ 11198c2ecf20Sopenharmony_ci enum drx_coderate high_coderate; 11208c2ecf20Sopenharmony_ci /*< High code rate */ 11218c2ecf20Sopenharmony_ci enum drx_coderate low_coderate; 11228c2ecf20Sopenharmony_ci /*< Low cod rate */ 11238c2ecf20Sopenharmony_ci enum drx_tps_frame frame; /*< Tps frame */ 11248c2ecf20Sopenharmony_ci u8 length; /*< Length */ 11258c2ecf20Sopenharmony_ci u16 cell_id; /*< Cell id */ 11268c2ecf20Sopenharmony_ci }; 11278c2ecf20Sopenharmony_ci 11288c2ecf20Sopenharmony_ci/*========================================*/ 11298c2ecf20Sopenharmony_ci 11308c2ecf20Sopenharmony_ci/* 11318c2ecf20Sopenharmony_ci* \brief Power mode of device. 11328c2ecf20Sopenharmony_ci* 11338c2ecf20Sopenharmony_ci* Used by DRX_CTRL_SET_POWER_MODE. 11348c2ecf20Sopenharmony_ci*/ 11358c2ecf20Sopenharmony_ci enum drx_power_mode { 11368c2ecf20Sopenharmony_ci DRX_POWER_UP = 0, 11378c2ecf20Sopenharmony_ci /*< Generic , Power Up Mode */ 11388c2ecf20Sopenharmony_ci DRX_POWER_MODE_1, 11398c2ecf20Sopenharmony_ci /*< Device specific , Power Up Mode */ 11408c2ecf20Sopenharmony_ci DRX_POWER_MODE_2, 11418c2ecf20Sopenharmony_ci /*< Device specific , Power Up Mode */ 11428c2ecf20Sopenharmony_ci DRX_POWER_MODE_3, 11438c2ecf20Sopenharmony_ci /*< Device specific , Power Up Mode */ 11448c2ecf20Sopenharmony_ci DRX_POWER_MODE_4, 11458c2ecf20Sopenharmony_ci /*< Device specific , Power Up Mode */ 11468c2ecf20Sopenharmony_ci DRX_POWER_MODE_5, 11478c2ecf20Sopenharmony_ci /*< Device specific , Power Up Mode */ 11488c2ecf20Sopenharmony_ci DRX_POWER_MODE_6, 11498c2ecf20Sopenharmony_ci /*< Device specific , Power Up Mode */ 11508c2ecf20Sopenharmony_ci DRX_POWER_MODE_7, 11518c2ecf20Sopenharmony_ci /*< Device specific , Power Up Mode */ 11528c2ecf20Sopenharmony_ci DRX_POWER_MODE_8, 11538c2ecf20Sopenharmony_ci /*< Device specific , Power Up Mode */ 11548c2ecf20Sopenharmony_ci 11558c2ecf20Sopenharmony_ci DRX_POWER_MODE_9, 11568c2ecf20Sopenharmony_ci /*< Device specific , Power Down Mode */ 11578c2ecf20Sopenharmony_ci DRX_POWER_MODE_10, 11588c2ecf20Sopenharmony_ci /*< Device specific , Power Down Mode */ 11598c2ecf20Sopenharmony_ci DRX_POWER_MODE_11, 11608c2ecf20Sopenharmony_ci /*< Device specific , Power Down Mode */ 11618c2ecf20Sopenharmony_ci DRX_POWER_MODE_12, 11628c2ecf20Sopenharmony_ci /*< Device specific , Power Down Mode */ 11638c2ecf20Sopenharmony_ci DRX_POWER_MODE_13, 11648c2ecf20Sopenharmony_ci /*< Device specific , Power Down Mode */ 11658c2ecf20Sopenharmony_ci DRX_POWER_MODE_14, 11668c2ecf20Sopenharmony_ci /*< Device specific , Power Down Mode */ 11678c2ecf20Sopenharmony_ci DRX_POWER_MODE_15, 11688c2ecf20Sopenharmony_ci /*< Device specific , Power Down Mode */ 11698c2ecf20Sopenharmony_ci DRX_POWER_MODE_16, 11708c2ecf20Sopenharmony_ci /*< Device specific , Power Down Mode */ 11718c2ecf20Sopenharmony_ci DRX_POWER_DOWN = 255 11728c2ecf20Sopenharmony_ci /*< Generic , Power Down Mode */ 11738c2ecf20Sopenharmony_ci }; 11748c2ecf20Sopenharmony_ci 11758c2ecf20Sopenharmony_ci/*========================================*/ 11768c2ecf20Sopenharmony_ci 11778c2ecf20Sopenharmony_ci/* 11788c2ecf20Sopenharmony_ci* \enum enum drx_module * \brief Software module identification. 11798c2ecf20Sopenharmony_ci* 11808c2ecf20Sopenharmony_ci* Used by DRX_CTRL_VERSION. 11818c2ecf20Sopenharmony_ci*/ 11828c2ecf20Sopenharmony_ci enum drx_module { 11838c2ecf20Sopenharmony_ci DRX_MODULE_DEVICE, 11848c2ecf20Sopenharmony_ci DRX_MODULE_MICROCODE, 11858c2ecf20Sopenharmony_ci DRX_MODULE_DRIVERCORE, 11868c2ecf20Sopenharmony_ci DRX_MODULE_DEVICEDRIVER, 11878c2ecf20Sopenharmony_ci DRX_MODULE_DAP, 11888c2ecf20Sopenharmony_ci DRX_MODULE_BSP_I2C, 11898c2ecf20Sopenharmony_ci DRX_MODULE_BSP_TUNER, 11908c2ecf20Sopenharmony_ci DRX_MODULE_BSP_HOST, 11918c2ecf20Sopenharmony_ci DRX_MODULE_UNKNOWN 11928c2ecf20Sopenharmony_ci }; 11938c2ecf20Sopenharmony_ci 11948c2ecf20Sopenharmony_ci/* 11958c2ecf20Sopenharmony_ci* \enum struct drx_version * \brief Version information of one software module. 11968c2ecf20Sopenharmony_ci* 11978c2ecf20Sopenharmony_ci* Used by DRX_CTRL_VERSION. 11988c2ecf20Sopenharmony_ci*/ 11998c2ecf20Sopenharmony_ci struct drx_version { 12008c2ecf20Sopenharmony_ci enum drx_module module_type; 12018c2ecf20Sopenharmony_ci /*< Type identifier of the module */ 12028c2ecf20Sopenharmony_ci char *module_name; 12038c2ecf20Sopenharmony_ci /*< Name or description of module */ 12048c2ecf20Sopenharmony_ci u16 v_major; /*< Major version number */ 12058c2ecf20Sopenharmony_ci u16 v_minor; /*< Minor version number */ 12068c2ecf20Sopenharmony_ci u16 v_patch; /*< Patch version number */ 12078c2ecf20Sopenharmony_ci char *v_string; /*< Version as text string */ 12088c2ecf20Sopenharmony_ci }; 12098c2ecf20Sopenharmony_ci 12108c2ecf20Sopenharmony_ci/* 12118c2ecf20Sopenharmony_ci* \enum struct drx_version_list * \brief List element of NULL terminated, linked list for version information. 12128c2ecf20Sopenharmony_ci* 12138c2ecf20Sopenharmony_ci* Used by DRX_CTRL_VERSION. 12148c2ecf20Sopenharmony_ci*/ 12158c2ecf20Sopenharmony_cistruct drx_version_list { 12168c2ecf20Sopenharmony_ci struct drx_version *version;/*< Version information */ 12178c2ecf20Sopenharmony_ci struct drx_version_list *next; 12188c2ecf20Sopenharmony_ci /*< Next list element */ 12198c2ecf20Sopenharmony_ci}; 12208c2ecf20Sopenharmony_ci 12218c2ecf20Sopenharmony_ci/*========================================*/ 12228c2ecf20Sopenharmony_ci 12238c2ecf20Sopenharmony_ci/* 12248c2ecf20Sopenharmony_ci* \brief Parameters needed to confiugure a UIO. 12258c2ecf20Sopenharmony_ci* 12268c2ecf20Sopenharmony_ci* Used by DRX_CTRL_UIO_CFG. 12278c2ecf20Sopenharmony_ci*/ 12288c2ecf20Sopenharmony_ci struct drxuio_cfg { 12298c2ecf20Sopenharmony_ci enum drx_uio uio; 12308c2ecf20Sopenharmony_ci /*< UIO identifier */ 12318c2ecf20Sopenharmony_ci enum drxuio_mode mode; 12328c2ecf20Sopenharmony_ci /*< UIO operational mode */ 12338c2ecf20Sopenharmony_ci }; 12348c2ecf20Sopenharmony_ci 12358c2ecf20Sopenharmony_ci/*========================================*/ 12368c2ecf20Sopenharmony_ci 12378c2ecf20Sopenharmony_ci/* 12388c2ecf20Sopenharmony_ci* \brief Parameters needed to read from or write to a UIO. 12398c2ecf20Sopenharmony_ci* 12408c2ecf20Sopenharmony_ci* Used by DRX_CTRL_UIO_READ and DRX_CTRL_UIO_WRITE. 12418c2ecf20Sopenharmony_ci*/ 12428c2ecf20Sopenharmony_ci struct drxuio_data { 12438c2ecf20Sopenharmony_ci enum drx_uio uio; 12448c2ecf20Sopenharmony_ci /*< UIO identifier */ 12458c2ecf20Sopenharmony_ci bool value; 12468c2ecf20Sopenharmony_ci /*< UIO value (true=1, false=0) */ 12478c2ecf20Sopenharmony_ci }; 12488c2ecf20Sopenharmony_ci 12498c2ecf20Sopenharmony_ci/*========================================*/ 12508c2ecf20Sopenharmony_ci 12518c2ecf20Sopenharmony_ci/* 12528c2ecf20Sopenharmony_ci* \brief Parameters needed to configure OOB. 12538c2ecf20Sopenharmony_ci* 12548c2ecf20Sopenharmony_ci* Used by DRX_CTRL_SET_OOB. 12558c2ecf20Sopenharmony_ci*/ 12568c2ecf20Sopenharmony_ci struct drxoob { 12578c2ecf20Sopenharmony_ci s32 frequency; /*< Frequency in kHz */ 12588c2ecf20Sopenharmony_ci enum drxoob_downstream_standard standard; 12598c2ecf20Sopenharmony_ci /*< OOB standard */ 12608c2ecf20Sopenharmony_ci bool spectrum_inverted; /*< If true, then spectrum 12618c2ecf20Sopenharmony_ci is inverted */ 12628c2ecf20Sopenharmony_ci }; 12638c2ecf20Sopenharmony_ci 12648c2ecf20Sopenharmony_ci/*========================================*/ 12658c2ecf20Sopenharmony_ci 12668c2ecf20Sopenharmony_ci/* 12678c2ecf20Sopenharmony_ci* \brief Metrics from OOB. 12688c2ecf20Sopenharmony_ci* 12698c2ecf20Sopenharmony_ci* Used by DRX_CTRL_GET_OOB. 12708c2ecf20Sopenharmony_ci*/ 12718c2ecf20Sopenharmony_ci struct drxoob_status { 12728c2ecf20Sopenharmony_ci s32 frequency; /*< Frequency in Khz */ 12738c2ecf20Sopenharmony_ci enum drx_lock_status lock; /*< Lock status */ 12748c2ecf20Sopenharmony_ci u32 mer; /*< MER */ 12758c2ecf20Sopenharmony_ci s32 symbol_rate_offset; /*< Symbolrate offset in ppm */ 12768c2ecf20Sopenharmony_ci }; 12778c2ecf20Sopenharmony_ci 12788c2ecf20Sopenharmony_ci/*========================================*/ 12798c2ecf20Sopenharmony_ci 12808c2ecf20Sopenharmony_ci/* 12818c2ecf20Sopenharmony_ci* \brief Device dependent configuration data. 12828c2ecf20Sopenharmony_ci* 12838c2ecf20Sopenharmony_ci* Used by DRX_CTRL_SET_CFG and DRX_CTRL_GET_CFG. 12848c2ecf20Sopenharmony_ci* A sort of nested drx_ctrl() functionality for device specific controls. 12858c2ecf20Sopenharmony_ci*/ 12868c2ecf20Sopenharmony_ci struct drx_cfg { 12878c2ecf20Sopenharmony_ci u32 cfg_type; 12888c2ecf20Sopenharmony_ci /*< Function identifier */ 12898c2ecf20Sopenharmony_ci void *cfg_data; 12908c2ecf20Sopenharmony_ci /*< Function data */ 12918c2ecf20Sopenharmony_ci }; 12928c2ecf20Sopenharmony_ci 12938c2ecf20Sopenharmony_ci/*========================================*/ 12948c2ecf20Sopenharmony_ci 12958c2ecf20Sopenharmony_ci/* 12968c2ecf20Sopenharmony_ci* /struct DRXMpegStartWidth_t 12978c2ecf20Sopenharmony_ci* MStart width [nr MCLK cycles] for serial MPEG output. 12988c2ecf20Sopenharmony_ci*/ 12998c2ecf20Sopenharmony_ci 13008c2ecf20Sopenharmony_ci enum drxmpeg_str_width { 13018c2ecf20Sopenharmony_ci DRX_MPEG_STR_WIDTH_1, 13028c2ecf20Sopenharmony_ci DRX_MPEG_STR_WIDTH_8 13038c2ecf20Sopenharmony_ci }; 13048c2ecf20Sopenharmony_ci 13058c2ecf20Sopenharmony_ci/* CTRL CFG MPEG output */ 13068c2ecf20Sopenharmony_ci/* 13078c2ecf20Sopenharmony_ci* \struct struct drx_cfg_mpeg_output * \brief Configuration parameters for MPEG output control. 13088c2ecf20Sopenharmony_ci* 13098c2ecf20Sopenharmony_ci* Used by DRX_CFG_MPEG_OUTPUT, in combination with DRX_CTRL_SET_CFG and 13108c2ecf20Sopenharmony_ci* DRX_CTRL_GET_CFG. 13118c2ecf20Sopenharmony_ci*/ 13128c2ecf20Sopenharmony_ci 13138c2ecf20Sopenharmony_ci struct drx_cfg_mpeg_output { 13148c2ecf20Sopenharmony_ci bool enable_mpeg_output;/*< If true, enable MPEG output */ 13158c2ecf20Sopenharmony_ci bool insert_rs_byte; /*< If true, insert RS byte */ 13168c2ecf20Sopenharmony_ci bool enable_parallel; /*< If true, parallel out otherwise 13178c2ecf20Sopenharmony_ci serial */ 13188c2ecf20Sopenharmony_ci bool invert_data; /*< If true, invert DATA signals */ 13198c2ecf20Sopenharmony_ci bool invert_err; /*< If true, invert ERR signal */ 13208c2ecf20Sopenharmony_ci bool invert_str; /*< If true, invert STR signals */ 13218c2ecf20Sopenharmony_ci bool invert_val; /*< If true, invert VAL signals */ 13228c2ecf20Sopenharmony_ci bool invert_clk; /*< If true, invert CLK signals */ 13238c2ecf20Sopenharmony_ci bool static_clk; /*< If true, static MPEG clockrate 13248c2ecf20Sopenharmony_ci will be used, otherwise clockrate 13258c2ecf20Sopenharmony_ci will adapt to the bitrate of the 13268c2ecf20Sopenharmony_ci TS */ 13278c2ecf20Sopenharmony_ci u32 bitrate; /*< Maximum bitrate in b/s in case 13288c2ecf20Sopenharmony_ci static clockrate is selected */ 13298c2ecf20Sopenharmony_ci enum drxmpeg_str_width width_str; 13308c2ecf20Sopenharmony_ci /*< MPEG start width */ 13318c2ecf20Sopenharmony_ci }; 13328c2ecf20Sopenharmony_ci 13338c2ecf20Sopenharmony_ci 13348c2ecf20Sopenharmony_ci/*========================================*/ 13358c2ecf20Sopenharmony_ci 13368c2ecf20Sopenharmony_ci/* 13378c2ecf20Sopenharmony_ci* \struct struct drxi2c_data * \brief Data for I2C via 2nd or 3rd or etc I2C port. 13388c2ecf20Sopenharmony_ci* 13398c2ecf20Sopenharmony_ci* Used by DRX_CTRL_I2C_READWRITE. 13408c2ecf20Sopenharmony_ci* If port_nr is equal to primairy port_nr BSPI2C will be used. 13418c2ecf20Sopenharmony_ci* 13428c2ecf20Sopenharmony_ci*/ 13438c2ecf20Sopenharmony_ci struct drxi2c_data { 13448c2ecf20Sopenharmony_ci u16 port_nr; /*< I2C port number */ 13458c2ecf20Sopenharmony_ci struct i2c_device_addr *w_dev_addr; 13468c2ecf20Sopenharmony_ci /*< Write device address */ 13478c2ecf20Sopenharmony_ci u16 w_count; /*< Size of write data in bytes */ 13488c2ecf20Sopenharmony_ci u8 *wData; /*< Pointer to write data */ 13498c2ecf20Sopenharmony_ci struct i2c_device_addr *r_dev_addr; 13508c2ecf20Sopenharmony_ci /*< Read device address */ 13518c2ecf20Sopenharmony_ci u16 r_count; /*< Size of data to read in bytes */ 13528c2ecf20Sopenharmony_ci u8 *r_data; /*< Pointer to read buffer */ 13538c2ecf20Sopenharmony_ci }; 13548c2ecf20Sopenharmony_ci 13558c2ecf20Sopenharmony_ci/*========================================*/ 13568c2ecf20Sopenharmony_ci 13578c2ecf20Sopenharmony_ci/* 13588c2ecf20Sopenharmony_ci* \enum enum drx_aud_standard * \brief Audio standard identifier. 13598c2ecf20Sopenharmony_ci* 13608c2ecf20Sopenharmony_ci* Used by DRX_CTRL_SET_AUD. 13618c2ecf20Sopenharmony_ci*/ 13628c2ecf20Sopenharmony_ci enum drx_aud_standard { 13638c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_BTSC, /*< set BTSC standard (USA) */ 13648c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_A2, /*< set A2-Korea FM Stereo */ 13658c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_EIAJ, /*< set to Japanese FM Stereo */ 13668c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_FM_STEREO,/*< set to FM-Stereo Radio */ 13678c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_M_MONO, /*< for 4.5 MHz mono detected */ 13688c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_D_K_MONO, /*< for 6.5 MHz mono detected */ 13698c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_BG_FM, /*< set BG_FM standard */ 13708c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_D_K1, /*< set D_K1 standard */ 13718c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_D_K2, /*< set D_K2 standard */ 13728c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_D_K3, /*< set D_K3 standard */ 13738c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_BG_NICAM_FM, 13748c2ecf20Sopenharmony_ci /*< set BG_NICAM_FM standard */ 13758c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_L_NICAM_AM, 13768c2ecf20Sopenharmony_ci /*< set L_NICAM_AM standard */ 13778c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_I_NICAM_FM, 13788c2ecf20Sopenharmony_ci /*< set I_NICAM_FM standard */ 13798c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_D_K_NICAM_FM, 13808c2ecf20Sopenharmony_ci /*< set D_K_NICAM_FM standard */ 13818c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_NOT_READY,/*< used to detect audio standard */ 13828c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_AUTO = DRX_AUTO, 13838c2ecf20Sopenharmony_ci /*< Automatic Standard Detection */ 13848c2ecf20Sopenharmony_ci DRX_AUD_STANDARD_UNKNOWN = DRX_UNKNOWN 13858c2ecf20Sopenharmony_ci /*< used as auto and for readback */ 13868c2ecf20Sopenharmony_ci }; 13878c2ecf20Sopenharmony_ci 13888c2ecf20Sopenharmony_ci/* CTRL_AUD_GET_STATUS - struct drx_aud_status */ 13898c2ecf20Sopenharmony_ci/* 13908c2ecf20Sopenharmony_ci* \enum enum drx_aud_nicam_status * \brief Status of NICAM carrier. 13918c2ecf20Sopenharmony_ci*/ 13928c2ecf20Sopenharmony_ci enum drx_aud_nicam_status { 13938c2ecf20Sopenharmony_ci DRX_AUD_NICAM_DETECTED = 0, 13948c2ecf20Sopenharmony_ci /*< NICAM carrier detected */ 13958c2ecf20Sopenharmony_ci DRX_AUD_NICAM_NOT_DETECTED, 13968c2ecf20Sopenharmony_ci /*< NICAM carrier not detected */ 13978c2ecf20Sopenharmony_ci DRX_AUD_NICAM_BAD /*< NICAM carrier bad quality */ 13988c2ecf20Sopenharmony_ci }; 13998c2ecf20Sopenharmony_ci 14008c2ecf20Sopenharmony_ci/* 14018c2ecf20Sopenharmony_ci* \struct struct drx_aud_status * \brief Audio status characteristics. 14028c2ecf20Sopenharmony_ci*/ 14038c2ecf20Sopenharmony_ci struct drx_aud_status { 14048c2ecf20Sopenharmony_ci bool stereo; /*< stereo detection */ 14058c2ecf20Sopenharmony_ci bool carrier_a; /*< carrier A detected */ 14068c2ecf20Sopenharmony_ci bool carrier_b; /*< carrier B detected */ 14078c2ecf20Sopenharmony_ci bool sap; /*< sap / bilingual detection */ 14088c2ecf20Sopenharmony_ci bool rds; /*< RDS data array present */ 14098c2ecf20Sopenharmony_ci enum drx_aud_nicam_status nicam_status; 14108c2ecf20Sopenharmony_ci /*< status of NICAM carrier */ 14118c2ecf20Sopenharmony_ci s8 fm_ident; /*< FM Identification value */ 14128c2ecf20Sopenharmony_ci }; 14138c2ecf20Sopenharmony_ci 14148c2ecf20Sopenharmony_ci/* CTRL_AUD_READ_RDS - DRXRDSdata_t */ 14158c2ecf20Sopenharmony_ci 14168c2ecf20Sopenharmony_ci/* 14178c2ecf20Sopenharmony_ci* \struct DRXRDSdata_t 14188c2ecf20Sopenharmony_ci* \brief Raw RDS data array. 14198c2ecf20Sopenharmony_ci*/ 14208c2ecf20Sopenharmony_ci struct drx_cfg_aud_rds { 14218c2ecf20Sopenharmony_ci bool valid; /*< RDS data validation */ 14228c2ecf20Sopenharmony_ci u16 data[18]; /*< data from one RDS data array */ 14238c2ecf20Sopenharmony_ci }; 14248c2ecf20Sopenharmony_ci 14258c2ecf20Sopenharmony_ci/* DRX_CFG_AUD_VOLUME - struct drx_cfg_aud_volume - set/get */ 14268c2ecf20Sopenharmony_ci/* 14278c2ecf20Sopenharmony_ci* \enum DRXAudAVCDecayTime_t 14288c2ecf20Sopenharmony_ci* \brief Automatic volume control configuration. 14298c2ecf20Sopenharmony_ci*/ 14308c2ecf20Sopenharmony_ci enum drx_aud_avc_mode { 14318c2ecf20Sopenharmony_ci DRX_AUD_AVC_OFF, /*< Automatic volume control off */ 14328c2ecf20Sopenharmony_ci DRX_AUD_AVC_DECAYTIME_8S, /*< level volume in 8 seconds */ 14338c2ecf20Sopenharmony_ci DRX_AUD_AVC_DECAYTIME_4S, /*< level volume in 4 seconds */ 14348c2ecf20Sopenharmony_ci DRX_AUD_AVC_DECAYTIME_2S, /*< level volume in 2 seconds */ 14358c2ecf20Sopenharmony_ci DRX_AUD_AVC_DECAYTIME_20MS/*< level volume in 20 millisec */ 14368c2ecf20Sopenharmony_ci }; 14378c2ecf20Sopenharmony_ci 14388c2ecf20Sopenharmony_ci/* 14398c2ecf20Sopenharmony_ci* /enum DRXAudMaxAVCGain_t 14408c2ecf20Sopenharmony_ci* /brief Automatic volume control max gain in audio baseband. 14418c2ecf20Sopenharmony_ci*/ 14428c2ecf20Sopenharmony_ci enum drx_aud_avc_max_gain { 14438c2ecf20Sopenharmony_ci DRX_AUD_AVC_MAX_GAIN_0DB, /*< maximum AVC gain 0 dB */ 14448c2ecf20Sopenharmony_ci DRX_AUD_AVC_MAX_GAIN_6DB, /*< maximum AVC gain 6 dB */ 14458c2ecf20Sopenharmony_ci DRX_AUD_AVC_MAX_GAIN_12DB /*< maximum AVC gain 12 dB */ 14468c2ecf20Sopenharmony_ci }; 14478c2ecf20Sopenharmony_ci 14488c2ecf20Sopenharmony_ci/* 14498c2ecf20Sopenharmony_ci* /enum DRXAudMaxAVCAtten_t 14508c2ecf20Sopenharmony_ci* /brief Automatic volume control max attenuation in audio baseband. 14518c2ecf20Sopenharmony_ci*/ 14528c2ecf20Sopenharmony_ci enum drx_aud_avc_max_atten { 14538c2ecf20Sopenharmony_ci DRX_AUD_AVC_MAX_ATTEN_12DB, 14548c2ecf20Sopenharmony_ci /*< maximum AVC attenuation 12 dB */ 14558c2ecf20Sopenharmony_ci DRX_AUD_AVC_MAX_ATTEN_18DB, 14568c2ecf20Sopenharmony_ci /*< maximum AVC attenuation 18 dB */ 14578c2ecf20Sopenharmony_ci DRX_AUD_AVC_MAX_ATTEN_24DB/*< maximum AVC attenuation 24 dB */ 14588c2ecf20Sopenharmony_ci }; 14598c2ecf20Sopenharmony_ci/* 14608c2ecf20Sopenharmony_ci* \struct struct drx_cfg_aud_volume * \brief Audio volume configuration. 14618c2ecf20Sopenharmony_ci*/ 14628c2ecf20Sopenharmony_ci struct drx_cfg_aud_volume { 14638c2ecf20Sopenharmony_ci bool mute; /*< mute overrides volume setting */ 14648c2ecf20Sopenharmony_ci s16 volume; /*< volume, range -114 to 12 dB */ 14658c2ecf20Sopenharmony_ci enum drx_aud_avc_mode avc_mode; /*< AVC auto volume control mode */ 14668c2ecf20Sopenharmony_ci u16 avc_ref_level; /*< AVC reference level */ 14678c2ecf20Sopenharmony_ci enum drx_aud_avc_max_gain avc_max_gain; 14688c2ecf20Sopenharmony_ci /*< AVC max gain selection */ 14698c2ecf20Sopenharmony_ci enum drx_aud_avc_max_atten avc_max_atten; 14708c2ecf20Sopenharmony_ci /*< AVC max attenuation selection */ 14718c2ecf20Sopenharmony_ci s16 strength_left; /*< quasi-peak, left speaker */ 14728c2ecf20Sopenharmony_ci s16 strength_right; /*< quasi-peak, right speaker */ 14738c2ecf20Sopenharmony_ci }; 14748c2ecf20Sopenharmony_ci 14758c2ecf20Sopenharmony_ci/* DRX_CFG_I2S_OUTPUT - struct drx_cfg_i2s_output - set/get */ 14768c2ecf20Sopenharmony_ci/* 14778c2ecf20Sopenharmony_ci* \enum enum drxi2s_mode * \brief I2S output mode. 14788c2ecf20Sopenharmony_ci*/ 14798c2ecf20Sopenharmony_ci enum drxi2s_mode { 14808c2ecf20Sopenharmony_ci DRX_I2S_MODE_MASTER, /*< I2S is in master mode */ 14818c2ecf20Sopenharmony_ci DRX_I2S_MODE_SLAVE /*< I2S is in slave mode */ 14828c2ecf20Sopenharmony_ci }; 14838c2ecf20Sopenharmony_ci 14848c2ecf20Sopenharmony_ci/* 14858c2ecf20Sopenharmony_ci* \enum enum drxi2s_word_length * \brief Width of I2S data. 14868c2ecf20Sopenharmony_ci*/ 14878c2ecf20Sopenharmony_ci enum drxi2s_word_length { 14888c2ecf20Sopenharmony_ci DRX_I2S_WORDLENGTH_32 = 0,/*< I2S data is 32 bit wide */ 14898c2ecf20Sopenharmony_ci DRX_I2S_WORDLENGTH_16 = 1 /*< I2S data is 16 bit wide */ 14908c2ecf20Sopenharmony_ci }; 14918c2ecf20Sopenharmony_ci 14928c2ecf20Sopenharmony_ci/* 14938c2ecf20Sopenharmony_ci* \enum enum drxi2s_format * \brief Data wordstrobe alignment for I2S. 14948c2ecf20Sopenharmony_ci*/ 14958c2ecf20Sopenharmony_ci enum drxi2s_format { 14968c2ecf20Sopenharmony_ci DRX_I2S_FORMAT_WS_WITH_DATA, 14978c2ecf20Sopenharmony_ci /*< I2S data and wordstrobe are aligned */ 14988c2ecf20Sopenharmony_ci DRX_I2S_FORMAT_WS_ADVANCED 14998c2ecf20Sopenharmony_ci /*< I2S data one cycle after wordstrobe */ 15008c2ecf20Sopenharmony_ci }; 15018c2ecf20Sopenharmony_ci 15028c2ecf20Sopenharmony_ci/* 15038c2ecf20Sopenharmony_ci* \enum enum drxi2s_polarity * \brief Polarity of I2S data. 15048c2ecf20Sopenharmony_ci*/ 15058c2ecf20Sopenharmony_ci enum drxi2s_polarity { 15068c2ecf20Sopenharmony_ci DRX_I2S_POLARITY_RIGHT,/*< wordstrobe - right high, left low */ 15078c2ecf20Sopenharmony_ci DRX_I2S_POLARITY_LEFT /*< wordstrobe - right low, left high */ 15088c2ecf20Sopenharmony_ci }; 15098c2ecf20Sopenharmony_ci 15108c2ecf20Sopenharmony_ci/* 15118c2ecf20Sopenharmony_ci* \struct struct drx_cfg_i2s_output * \brief I2S output configuration. 15128c2ecf20Sopenharmony_ci*/ 15138c2ecf20Sopenharmony_ci struct drx_cfg_i2s_output { 15148c2ecf20Sopenharmony_ci bool output_enable; /*< I2S output enable */ 15158c2ecf20Sopenharmony_ci u32 frequency; /*< range from 8000-48000 Hz */ 15168c2ecf20Sopenharmony_ci enum drxi2s_mode mode; /*< I2S mode, master or slave */ 15178c2ecf20Sopenharmony_ci enum drxi2s_word_length word_length; 15188c2ecf20Sopenharmony_ci /*< I2S wordlength, 16 or 32 bits */ 15198c2ecf20Sopenharmony_ci enum drxi2s_polarity polarity;/*< I2S wordstrobe polarity */ 15208c2ecf20Sopenharmony_ci enum drxi2s_format format; /*< I2S wordstrobe delay to data */ 15218c2ecf20Sopenharmony_ci }; 15228c2ecf20Sopenharmony_ci 15238c2ecf20Sopenharmony_ci/* ------------------------------expert interface-----------------------------*/ 15248c2ecf20Sopenharmony_ci/* 15258c2ecf20Sopenharmony_ci* /enum enum drx_aud_fm_deemphasis * setting for FM-Deemphasis in audio demodulator. 15268c2ecf20Sopenharmony_ci* 15278c2ecf20Sopenharmony_ci*/ 15288c2ecf20Sopenharmony_ci enum drx_aud_fm_deemphasis { 15298c2ecf20Sopenharmony_ci DRX_AUD_FM_DEEMPH_50US, 15308c2ecf20Sopenharmony_ci DRX_AUD_FM_DEEMPH_75US, 15318c2ecf20Sopenharmony_ci DRX_AUD_FM_DEEMPH_OFF 15328c2ecf20Sopenharmony_ci }; 15338c2ecf20Sopenharmony_ci 15348c2ecf20Sopenharmony_ci/* 15358c2ecf20Sopenharmony_ci* /enum DRXAudDeviation_t 15368c2ecf20Sopenharmony_ci* setting for deviation mode in audio demodulator. 15378c2ecf20Sopenharmony_ci* 15388c2ecf20Sopenharmony_ci*/ 15398c2ecf20Sopenharmony_ci enum drx_cfg_aud_deviation { 15408c2ecf20Sopenharmony_ci DRX_AUD_DEVIATION_NORMAL, 15418c2ecf20Sopenharmony_ci DRX_AUD_DEVIATION_HIGH 15428c2ecf20Sopenharmony_ci }; 15438c2ecf20Sopenharmony_ci 15448c2ecf20Sopenharmony_ci/* 15458c2ecf20Sopenharmony_ci* /enum enum drx_no_carrier_option * setting for carrier, mute/noise. 15468c2ecf20Sopenharmony_ci* 15478c2ecf20Sopenharmony_ci*/ 15488c2ecf20Sopenharmony_ci enum drx_no_carrier_option { 15498c2ecf20Sopenharmony_ci DRX_NO_CARRIER_MUTE, 15508c2ecf20Sopenharmony_ci DRX_NO_CARRIER_NOISE 15518c2ecf20Sopenharmony_ci }; 15528c2ecf20Sopenharmony_ci 15538c2ecf20Sopenharmony_ci/* 15548c2ecf20Sopenharmony_ci* \enum DRXAudAutoSound_t 15558c2ecf20Sopenharmony_ci* \brief Automatic Sound 15568c2ecf20Sopenharmony_ci*/ 15578c2ecf20Sopenharmony_ci enum drx_cfg_aud_auto_sound { 15588c2ecf20Sopenharmony_ci DRX_AUD_AUTO_SOUND_OFF = 0, 15598c2ecf20Sopenharmony_ci DRX_AUD_AUTO_SOUND_SELECT_ON_CHANGE_ON, 15608c2ecf20Sopenharmony_ci DRX_AUD_AUTO_SOUND_SELECT_ON_CHANGE_OFF 15618c2ecf20Sopenharmony_ci }; 15628c2ecf20Sopenharmony_ci 15638c2ecf20Sopenharmony_ci/* 15648c2ecf20Sopenharmony_ci* \enum DRXAudASSThres_t 15658c2ecf20Sopenharmony_ci* \brief Automatic Sound Select Thresholds 15668c2ecf20Sopenharmony_ci*/ 15678c2ecf20Sopenharmony_ci struct drx_cfg_aud_ass_thres { 15688c2ecf20Sopenharmony_ci u16 a2; /* A2 Threshold for ASS configuration */ 15698c2ecf20Sopenharmony_ci u16 btsc; /* BTSC Threshold for ASS configuration */ 15708c2ecf20Sopenharmony_ci u16 nicam; /* Nicam Threshold for ASS configuration */ 15718c2ecf20Sopenharmony_ci }; 15728c2ecf20Sopenharmony_ci 15738c2ecf20Sopenharmony_ci/* 15748c2ecf20Sopenharmony_ci* \struct struct drx_aud_carrier * \brief Carrier detection related parameters 15758c2ecf20Sopenharmony_ci*/ 15768c2ecf20Sopenharmony_ci struct drx_aud_carrier { 15778c2ecf20Sopenharmony_ci u16 thres; /* carrier detetcion threshold for primary carrier (A) */ 15788c2ecf20Sopenharmony_ci enum drx_no_carrier_option opt; /* Mute or noise at no carrier detection (A) */ 15798c2ecf20Sopenharmony_ci s32 shift; /* DC level of incoming signal (A) */ 15808c2ecf20Sopenharmony_ci s32 dco; /* frequency adjustment (A) */ 15818c2ecf20Sopenharmony_ci }; 15828c2ecf20Sopenharmony_ci 15838c2ecf20Sopenharmony_ci/* 15848c2ecf20Sopenharmony_ci* \struct struct drx_cfg_aud_carriers * \brief combining carrier A & B to one struct 15858c2ecf20Sopenharmony_ci*/ 15868c2ecf20Sopenharmony_ci struct drx_cfg_aud_carriers { 15878c2ecf20Sopenharmony_ci struct drx_aud_carrier a; 15888c2ecf20Sopenharmony_ci struct drx_aud_carrier b; 15898c2ecf20Sopenharmony_ci }; 15908c2ecf20Sopenharmony_ci 15918c2ecf20Sopenharmony_ci/* 15928c2ecf20Sopenharmony_ci* /enum enum drx_aud_i2s_src * Selection of audio source 15938c2ecf20Sopenharmony_ci*/ 15948c2ecf20Sopenharmony_ci enum drx_aud_i2s_src { 15958c2ecf20Sopenharmony_ci DRX_AUD_SRC_MONO, 15968c2ecf20Sopenharmony_ci DRX_AUD_SRC_STEREO_OR_AB, 15978c2ecf20Sopenharmony_ci DRX_AUD_SRC_STEREO_OR_A, 15988c2ecf20Sopenharmony_ci DRX_AUD_SRC_STEREO_OR_B}; 15998c2ecf20Sopenharmony_ci 16008c2ecf20Sopenharmony_ci/* 16018c2ecf20Sopenharmony_ci* \enum enum drx_aud_i2s_matrix * \brief Used for selecting I2S output. 16028c2ecf20Sopenharmony_ci*/ 16038c2ecf20Sopenharmony_ci enum drx_aud_i2s_matrix { 16048c2ecf20Sopenharmony_ci DRX_AUD_I2S_MATRIX_A_MONO, 16058c2ecf20Sopenharmony_ci /*< A sound only, stereo or mono */ 16068c2ecf20Sopenharmony_ci DRX_AUD_I2S_MATRIX_B_MONO, 16078c2ecf20Sopenharmony_ci /*< B sound only, stereo or mono */ 16088c2ecf20Sopenharmony_ci DRX_AUD_I2S_MATRIX_STEREO, 16098c2ecf20Sopenharmony_ci /*< A+B sound, transparent */ 16108c2ecf20Sopenharmony_ci DRX_AUD_I2S_MATRIX_MONO /*< A+B mixed to mono sum, (L+R)/2 */}; 16118c2ecf20Sopenharmony_ci 16128c2ecf20Sopenharmony_ci/* 16138c2ecf20Sopenharmony_ci* /enum enum drx_aud_fm_matrix * setting for FM-Matrix in audio demodulator. 16148c2ecf20Sopenharmony_ci* 16158c2ecf20Sopenharmony_ci*/ 16168c2ecf20Sopenharmony_ci enum drx_aud_fm_matrix { 16178c2ecf20Sopenharmony_ci DRX_AUD_FM_MATRIX_NO_MATRIX, 16188c2ecf20Sopenharmony_ci DRX_AUD_FM_MATRIX_GERMAN, 16198c2ecf20Sopenharmony_ci DRX_AUD_FM_MATRIX_KOREAN, 16208c2ecf20Sopenharmony_ci DRX_AUD_FM_MATRIX_SOUND_A, 16218c2ecf20Sopenharmony_ci DRX_AUD_FM_MATRIX_SOUND_B}; 16228c2ecf20Sopenharmony_ci 16238c2ecf20Sopenharmony_ci/* 16248c2ecf20Sopenharmony_ci* \struct DRXAudMatrices_t 16258c2ecf20Sopenharmony_ci* \brief Mixer settings 16268c2ecf20Sopenharmony_ci*/ 16278c2ecf20Sopenharmony_cistruct drx_cfg_aud_mixer { 16288c2ecf20Sopenharmony_ci enum drx_aud_i2s_src source_i2s; 16298c2ecf20Sopenharmony_ci enum drx_aud_i2s_matrix matrix_i2s; 16308c2ecf20Sopenharmony_ci enum drx_aud_fm_matrix matrix_fm; 16318c2ecf20Sopenharmony_ci}; 16328c2ecf20Sopenharmony_ci 16338c2ecf20Sopenharmony_ci/* 16348c2ecf20Sopenharmony_ci* \enum DRXI2SVidSync_t 16358c2ecf20Sopenharmony_ci* \brief Audio/video synchronization, interacts with I2S mode. 16368c2ecf20Sopenharmony_ci* AUTO_1 and AUTO_2 are for automatic video standard detection with preference 16378c2ecf20Sopenharmony_ci* for NTSC or Monochrome, because the frequencies are too close (59.94 & 60 Hz) 16388c2ecf20Sopenharmony_ci*/ 16398c2ecf20Sopenharmony_ci enum drx_cfg_aud_av_sync { 16408c2ecf20Sopenharmony_ci DRX_AUD_AVSYNC_OFF,/*< audio/video synchronization is off */ 16418c2ecf20Sopenharmony_ci DRX_AUD_AVSYNC_NTSC, 16428c2ecf20Sopenharmony_ci /*< it is an NTSC system */ 16438c2ecf20Sopenharmony_ci DRX_AUD_AVSYNC_MONOCHROME, 16448c2ecf20Sopenharmony_ci /*< it is a MONOCHROME system */ 16458c2ecf20Sopenharmony_ci DRX_AUD_AVSYNC_PAL_SECAM 16468c2ecf20Sopenharmony_ci /*< it is a PAL/SECAM system */}; 16478c2ecf20Sopenharmony_ci 16488c2ecf20Sopenharmony_ci/* 16498c2ecf20Sopenharmony_ci* \struct struct drx_cfg_aud_prescale * \brief Prescalers 16508c2ecf20Sopenharmony_ci*/ 16518c2ecf20Sopenharmony_cistruct drx_cfg_aud_prescale { 16528c2ecf20Sopenharmony_ci u16 fm_deviation; 16538c2ecf20Sopenharmony_ci s16 nicam_gain; 16548c2ecf20Sopenharmony_ci}; 16558c2ecf20Sopenharmony_ci 16568c2ecf20Sopenharmony_ci/* 16578c2ecf20Sopenharmony_ci* \struct struct drx_aud_beep * \brief Beep 16588c2ecf20Sopenharmony_ci*/ 16598c2ecf20Sopenharmony_cistruct drx_aud_beep { 16608c2ecf20Sopenharmony_ci s16 volume; /* dB */ 16618c2ecf20Sopenharmony_ci u16 frequency; /* Hz */ 16628c2ecf20Sopenharmony_ci bool mute; 16638c2ecf20Sopenharmony_ci}; 16648c2ecf20Sopenharmony_ci 16658c2ecf20Sopenharmony_ci/* 16668c2ecf20Sopenharmony_ci* \enum enum drx_aud_btsc_detect * \brief BTSC detetcion mode 16678c2ecf20Sopenharmony_ci*/ 16688c2ecf20Sopenharmony_ci enum drx_aud_btsc_detect { 16698c2ecf20Sopenharmony_ci DRX_BTSC_STEREO, 16708c2ecf20Sopenharmony_ci DRX_BTSC_MONO_AND_SAP}; 16718c2ecf20Sopenharmony_ci 16728c2ecf20Sopenharmony_ci/* 16738c2ecf20Sopenharmony_ci* \struct struct drx_aud_data * \brief Audio data structure 16748c2ecf20Sopenharmony_ci*/ 16758c2ecf20Sopenharmony_cistruct drx_aud_data { 16768c2ecf20Sopenharmony_ci /* audio storage */ 16778c2ecf20Sopenharmony_ci bool audio_is_active; 16788c2ecf20Sopenharmony_ci enum drx_aud_standard audio_standard; 16798c2ecf20Sopenharmony_ci struct drx_cfg_i2s_output i2sdata; 16808c2ecf20Sopenharmony_ci struct drx_cfg_aud_volume volume; 16818c2ecf20Sopenharmony_ci enum drx_cfg_aud_auto_sound auto_sound; 16828c2ecf20Sopenharmony_ci struct drx_cfg_aud_ass_thres ass_thresholds; 16838c2ecf20Sopenharmony_ci struct drx_cfg_aud_carriers carriers; 16848c2ecf20Sopenharmony_ci struct drx_cfg_aud_mixer mixer; 16858c2ecf20Sopenharmony_ci enum drx_cfg_aud_deviation deviation; 16868c2ecf20Sopenharmony_ci enum drx_cfg_aud_av_sync av_sync; 16878c2ecf20Sopenharmony_ci struct drx_cfg_aud_prescale prescale; 16888c2ecf20Sopenharmony_ci enum drx_aud_fm_deemphasis deemph; 16898c2ecf20Sopenharmony_ci enum drx_aud_btsc_detect btsc_detect; 16908c2ecf20Sopenharmony_ci /* rds */ 16918c2ecf20Sopenharmony_ci u16 rds_data_counter; 16928c2ecf20Sopenharmony_ci bool rds_data_present; 16938c2ecf20Sopenharmony_ci}; 16948c2ecf20Sopenharmony_ci 16958c2ecf20Sopenharmony_ci/* 16968c2ecf20Sopenharmony_ci* \enum enum drx_qam_lock_range * \brief QAM lock range mode 16978c2ecf20Sopenharmony_ci*/ 16988c2ecf20Sopenharmony_ci enum drx_qam_lock_range { 16998c2ecf20Sopenharmony_ci DRX_QAM_LOCKRANGE_NORMAL, 17008c2ecf20Sopenharmony_ci DRX_QAM_LOCKRANGE_EXTENDED}; 17018c2ecf20Sopenharmony_ci 17028c2ecf20Sopenharmony_ci/*============================================================================*/ 17038c2ecf20Sopenharmony_ci/*============================================================================*/ 17048c2ecf20Sopenharmony_ci/*== Data access structures ==================================================*/ 17058c2ecf20Sopenharmony_ci/*============================================================================*/ 17068c2ecf20Sopenharmony_ci/*============================================================================*/ 17078c2ecf20Sopenharmony_ci 17088c2ecf20Sopenharmony_ci/* Address on device */ 17098c2ecf20Sopenharmony_ci typedef u32 dr_xaddr_t, *pdr_xaddr_t; 17108c2ecf20Sopenharmony_ci 17118c2ecf20Sopenharmony_ci/* Protocol specific flags */ 17128c2ecf20Sopenharmony_ci typedef u32 dr_xflags_t, *pdr_xflags_t; 17138c2ecf20Sopenharmony_ci 17148c2ecf20Sopenharmony_ci/* Write block of data to device */ 17158c2ecf20Sopenharmony_ci typedef int(*drx_write_block_func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17168c2ecf20Sopenharmony_ci u32 addr, /* address of register/memory */ 17178c2ecf20Sopenharmony_ci u16 datasize, /* size of data in bytes */ 17188c2ecf20Sopenharmony_ci u8 *data, /* data to send */ 17198c2ecf20Sopenharmony_ci u32 flags); 17208c2ecf20Sopenharmony_ci 17218c2ecf20Sopenharmony_ci/* Read block of data from device */ 17228c2ecf20Sopenharmony_ci typedef int(*drx_read_block_func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17238c2ecf20Sopenharmony_ci u32 addr, /* address of register/memory */ 17248c2ecf20Sopenharmony_ci u16 datasize, /* size of data in bytes */ 17258c2ecf20Sopenharmony_ci u8 *data, /* receive buffer */ 17268c2ecf20Sopenharmony_ci u32 flags); 17278c2ecf20Sopenharmony_ci 17288c2ecf20Sopenharmony_ci/* Write 8-bits value to device */ 17298c2ecf20Sopenharmony_ci typedef int(*drx_write_reg8func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17308c2ecf20Sopenharmony_ci u32 addr, /* address of register/memory */ 17318c2ecf20Sopenharmony_ci u8 data, /* data to send */ 17328c2ecf20Sopenharmony_ci u32 flags); 17338c2ecf20Sopenharmony_ci 17348c2ecf20Sopenharmony_ci/* Read 8-bits value to device */ 17358c2ecf20Sopenharmony_ci typedef int(*drx_read_reg8func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17368c2ecf20Sopenharmony_ci u32 addr, /* address of register/memory */ 17378c2ecf20Sopenharmony_ci u8 *data, /* receive buffer */ 17388c2ecf20Sopenharmony_ci u32 flags); 17398c2ecf20Sopenharmony_ci 17408c2ecf20Sopenharmony_ci/* Read modify write 8-bits value to device */ 17418c2ecf20Sopenharmony_ci typedef int(*drx_read_modify_write_reg8func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17428c2ecf20Sopenharmony_ci u32 waddr, /* write address of register */ 17438c2ecf20Sopenharmony_ci u32 raddr, /* read address of register */ 17448c2ecf20Sopenharmony_ci u8 wdata, /* data to write */ 17458c2ecf20Sopenharmony_ci u8 *rdata); /* data to read */ 17468c2ecf20Sopenharmony_ci 17478c2ecf20Sopenharmony_ci/* Write 16-bits value to device */ 17488c2ecf20Sopenharmony_ci typedef int(*drx_write_reg16func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17498c2ecf20Sopenharmony_ci u32 addr, /* address of register/memory */ 17508c2ecf20Sopenharmony_ci u16 data, /* data to send */ 17518c2ecf20Sopenharmony_ci u32 flags); 17528c2ecf20Sopenharmony_ci 17538c2ecf20Sopenharmony_ci/* Read 16-bits value to device */ 17548c2ecf20Sopenharmony_ci typedef int(*drx_read_reg16func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17558c2ecf20Sopenharmony_ci u32 addr, /* address of register/memory */ 17568c2ecf20Sopenharmony_ci u16 *data, /* receive buffer */ 17578c2ecf20Sopenharmony_ci u32 flags); 17588c2ecf20Sopenharmony_ci 17598c2ecf20Sopenharmony_ci/* Read modify write 16-bits value to device */ 17608c2ecf20Sopenharmony_ci typedef int(*drx_read_modify_write_reg16func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17618c2ecf20Sopenharmony_ci u32 waddr, /* write address of register */ 17628c2ecf20Sopenharmony_ci u32 raddr, /* read address of register */ 17638c2ecf20Sopenharmony_ci u16 wdata, /* data to write */ 17648c2ecf20Sopenharmony_ci u16 *rdata); /* data to read */ 17658c2ecf20Sopenharmony_ci 17668c2ecf20Sopenharmony_ci/* Write 32-bits value to device */ 17678c2ecf20Sopenharmony_ci typedef int(*drx_write_reg32func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17688c2ecf20Sopenharmony_ci u32 addr, /* address of register/memory */ 17698c2ecf20Sopenharmony_ci u32 data, /* data to send */ 17708c2ecf20Sopenharmony_ci u32 flags); 17718c2ecf20Sopenharmony_ci 17728c2ecf20Sopenharmony_ci/* Read 32-bits value to device */ 17738c2ecf20Sopenharmony_ci typedef int(*drx_read_reg32func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17748c2ecf20Sopenharmony_ci u32 addr, /* address of register/memory */ 17758c2ecf20Sopenharmony_ci u32 *data, /* receive buffer */ 17768c2ecf20Sopenharmony_ci u32 flags); 17778c2ecf20Sopenharmony_ci 17788c2ecf20Sopenharmony_ci/* Read modify write 32-bits value to device */ 17798c2ecf20Sopenharmony_ci typedef int(*drx_read_modify_write_reg32func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */ 17808c2ecf20Sopenharmony_ci u32 waddr, /* write address of register */ 17818c2ecf20Sopenharmony_ci u32 raddr, /* read address of register */ 17828c2ecf20Sopenharmony_ci u32 wdata, /* data to write */ 17838c2ecf20Sopenharmony_ci u32 *rdata); /* data to read */ 17848c2ecf20Sopenharmony_ci 17858c2ecf20Sopenharmony_ci/* 17868c2ecf20Sopenharmony_ci* \struct struct drx_access_func * \brief Interface to an access protocol. 17878c2ecf20Sopenharmony_ci*/ 17888c2ecf20Sopenharmony_cistruct drx_access_func { 17898c2ecf20Sopenharmony_ci drx_write_block_func_t write_block_func; 17908c2ecf20Sopenharmony_ci drx_read_block_func_t read_block_func; 17918c2ecf20Sopenharmony_ci drx_write_reg8func_t write_reg8func; 17928c2ecf20Sopenharmony_ci drx_read_reg8func_t read_reg8func; 17938c2ecf20Sopenharmony_ci drx_read_modify_write_reg8func_t read_modify_write_reg8func; 17948c2ecf20Sopenharmony_ci drx_write_reg16func_t write_reg16func; 17958c2ecf20Sopenharmony_ci drx_read_reg16func_t read_reg16func; 17968c2ecf20Sopenharmony_ci drx_read_modify_write_reg16func_t read_modify_write_reg16func; 17978c2ecf20Sopenharmony_ci drx_write_reg32func_t write_reg32func; 17988c2ecf20Sopenharmony_ci drx_read_reg32func_t read_reg32func; 17998c2ecf20Sopenharmony_ci drx_read_modify_write_reg32func_t read_modify_write_reg32func; 18008c2ecf20Sopenharmony_ci}; 18018c2ecf20Sopenharmony_ci 18028c2ecf20Sopenharmony_ci/* Register address and data for register dump function */ 18038c2ecf20Sopenharmony_cistruct drx_reg_dump { 18048c2ecf20Sopenharmony_ci u32 address; 18058c2ecf20Sopenharmony_ci u32 data; 18068c2ecf20Sopenharmony_ci}; 18078c2ecf20Sopenharmony_ci 18088c2ecf20Sopenharmony_ci/*============================================================================*/ 18098c2ecf20Sopenharmony_ci/*============================================================================*/ 18108c2ecf20Sopenharmony_ci/*== Demod instance data structures ==========================================*/ 18118c2ecf20Sopenharmony_ci/*============================================================================*/ 18128c2ecf20Sopenharmony_ci/*============================================================================*/ 18138c2ecf20Sopenharmony_ci 18148c2ecf20Sopenharmony_ci/* 18158c2ecf20Sopenharmony_ci* \struct struct drx_common_attr * \brief Set of common attributes, shared by all DRX devices. 18168c2ecf20Sopenharmony_ci*/ 18178c2ecf20Sopenharmony_ci struct drx_common_attr { 18188c2ecf20Sopenharmony_ci /* Microcode (firmware) attributes */ 18198c2ecf20Sopenharmony_ci char *microcode_file; /*< microcode filename */ 18208c2ecf20Sopenharmony_ci bool verify_microcode; 18218c2ecf20Sopenharmony_ci /*< Use microcode verify or not. */ 18228c2ecf20Sopenharmony_ci struct drx_mc_version_rec mcversion; 18238c2ecf20Sopenharmony_ci /*< Version record of microcode from file */ 18248c2ecf20Sopenharmony_ci 18258c2ecf20Sopenharmony_ci /* Clocks and tuner attributes */ 18268c2ecf20Sopenharmony_ci s32 intermediate_freq; 18278c2ecf20Sopenharmony_ci /*< IF,if tuner instance not used. (kHz)*/ 18288c2ecf20Sopenharmony_ci s32 sys_clock_freq; 18298c2ecf20Sopenharmony_ci /*< Systemclock frequency. (kHz) */ 18308c2ecf20Sopenharmony_ci s32 osc_clock_freq; 18318c2ecf20Sopenharmony_ci /*< Oscillator clock frequency. (kHz) */ 18328c2ecf20Sopenharmony_ci s16 osc_clock_deviation; 18338c2ecf20Sopenharmony_ci /*< Oscillator clock deviation. (ppm) */ 18348c2ecf20Sopenharmony_ci bool mirror_freq_spect; 18358c2ecf20Sopenharmony_ci /*< Mirror IF frequency spectrum or not.*/ 18368c2ecf20Sopenharmony_ci 18378c2ecf20Sopenharmony_ci /* Initial MPEG output attributes */ 18388c2ecf20Sopenharmony_ci struct drx_cfg_mpeg_output mpeg_cfg; 18398c2ecf20Sopenharmony_ci /*< MPEG configuration */ 18408c2ecf20Sopenharmony_ci 18418c2ecf20Sopenharmony_ci bool is_opened; /*< if true instance is already opened. */ 18428c2ecf20Sopenharmony_ci 18438c2ecf20Sopenharmony_ci /* Channel scan */ 18448c2ecf20Sopenharmony_ci struct drx_scan_param *scan_param; 18458c2ecf20Sopenharmony_ci /*< scan parameters */ 18468c2ecf20Sopenharmony_ci u16 scan_freq_plan_index; 18478c2ecf20Sopenharmony_ci /*< next index in freq plan */ 18488c2ecf20Sopenharmony_ci s32 scan_next_frequency; 18498c2ecf20Sopenharmony_ci /*< next freq to scan */ 18508c2ecf20Sopenharmony_ci bool scan_ready; /*< scan ready flag */ 18518c2ecf20Sopenharmony_ci u32 scan_max_channels;/*< number of channels in freqplan */ 18528c2ecf20Sopenharmony_ci u32 scan_channels_scanned; 18538c2ecf20Sopenharmony_ci /*< number of channels scanned */ 18548c2ecf20Sopenharmony_ci /* Channel scan - inner loop: demod related */ 18558c2ecf20Sopenharmony_ci drx_scan_func_t scan_function; 18568c2ecf20Sopenharmony_ci /*< function to check channel */ 18578c2ecf20Sopenharmony_ci /* Channel scan - inner loop: SYSObj related */ 18588c2ecf20Sopenharmony_ci void *scan_context; /*< Context Pointer of SYSObj */ 18598c2ecf20Sopenharmony_ci /* Channel scan - parameters for default DTV scan function in core driver */ 18608c2ecf20Sopenharmony_ci u16 scan_demod_lock_timeout; 18618c2ecf20Sopenharmony_ci /*< millisecs to wait for lock */ 18628c2ecf20Sopenharmony_ci enum drx_lock_status scan_desired_lock; 18638c2ecf20Sopenharmony_ci /*< lock requirement for channel found */ 18648c2ecf20Sopenharmony_ci /* scan_active can be used by SetChannel to decide how to program the tuner, 18658c2ecf20Sopenharmony_ci fast or slow (but stable). Usually fast during scan. */ 18668c2ecf20Sopenharmony_ci bool scan_active; /*< true when scan routines are active */ 18678c2ecf20Sopenharmony_ci 18688c2ecf20Sopenharmony_ci /* Power management */ 18698c2ecf20Sopenharmony_ci enum drx_power_mode current_power_mode; 18708c2ecf20Sopenharmony_ci /*< current power management mode */ 18718c2ecf20Sopenharmony_ci 18728c2ecf20Sopenharmony_ci /* Tuner */ 18738c2ecf20Sopenharmony_ci u8 tuner_port_nr; /*< nr of I2C port to which tuner is */ 18748c2ecf20Sopenharmony_ci s32 tuner_min_freq_rf; 18758c2ecf20Sopenharmony_ci /*< minimum RF input frequency, in kHz */ 18768c2ecf20Sopenharmony_ci s32 tuner_max_freq_rf; 18778c2ecf20Sopenharmony_ci /*< maximum RF input frequency, in kHz */ 18788c2ecf20Sopenharmony_ci bool tuner_rf_agc_pol; /*< if true invert RF AGC polarity */ 18798c2ecf20Sopenharmony_ci bool tuner_if_agc_pol; /*< if true invert IF AGC polarity */ 18808c2ecf20Sopenharmony_ci bool tuner_slow_mode; /*< if true invert IF AGC polarity */ 18818c2ecf20Sopenharmony_ci 18828c2ecf20Sopenharmony_ci struct drx_channel current_channel; 18838c2ecf20Sopenharmony_ci /*< current channel parameters */ 18848c2ecf20Sopenharmony_ci enum drx_standard current_standard; 18858c2ecf20Sopenharmony_ci /*< current standard selection */ 18868c2ecf20Sopenharmony_ci enum drx_standard prev_standard; 18878c2ecf20Sopenharmony_ci /*< previous standard selection */ 18888c2ecf20Sopenharmony_ci enum drx_standard di_cache_standard; 18898c2ecf20Sopenharmony_ci /*< standard in DI cache if available */ 18908c2ecf20Sopenharmony_ci bool use_bootloader; /*< use bootloader in open */ 18918c2ecf20Sopenharmony_ci u32 capabilities; /*< capabilities flags */ 18928c2ecf20Sopenharmony_ci u32 product_id; /*< product ID inc. metal fix number */}; 18938c2ecf20Sopenharmony_ci 18948c2ecf20Sopenharmony_ci/* 18958c2ecf20Sopenharmony_ci* Generic functions for DRX devices. 18968c2ecf20Sopenharmony_ci*/ 18978c2ecf20Sopenharmony_ci 18988c2ecf20Sopenharmony_cistruct drx_demod_instance; 18998c2ecf20Sopenharmony_ci 19008c2ecf20Sopenharmony_ci/* 19018c2ecf20Sopenharmony_ci* \struct struct drx_demod_instance * \brief Top structure of demodulator instance. 19028c2ecf20Sopenharmony_ci*/ 19038c2ecf20Sopenharmony_cistruct drx_demod_instance { 19048c2ecf20Sopenharmony_ci /*< data access protocol functions */ 19058c2ecf20Sopenharmony_ci struct i2c_device_addr *my_i2c_dev_addr; 19068c2ecf20Sopenharmony_ci /*< i2c address and device identifier */ 19078c2ecf20Sopenharmony_ci struct drx_common_attr *my_common_attr; 19088c2ecf20Sopenharmony_ci /*< common DRX attributes */ 19098c2ecf20Sopenharmony_ci void *my_ext_attr; /*< device specific attributes */ 19108c2ecf20Sopenharmony_ci /* generic demodulator data */ 19118c2ecf20Sopenharmony_ci 19128c2ecf20Sopenharmony_ci struct i2c_adapter *i2c; 19138c2ecf20Sopenharmony_ci const struct firmware *firmware; 19148c2ecf20Sopenharmony_ci}; 19158c2ecf20Sopenharmony_ci 19168c2ecf20Sopenharmony_ci/*------------------------------------------------------------------------- 19178c2ecf20Sopenharmony_ciMACROS 19188c2ecf20Sopenharmony_ciConversion from enum values to human readable form. 19198c2ecf20Sopenharmony_ci-------------------------------------------------------------------------*/ 19208c2ecf20Sopenharmony_ci 19218c2ecf20Sopenharmony_ci/* standard */ 19228c2ecf20Sopenharmony_ci 19238c2ecf20Sopenharmony_ci#define DRX_STR_STANDARD(x) ( \ 19248c2ecf20Sopenharmony_ci (x == DRX_STANDARD_DVBT) ? "DVB-T" : \ 19258c2ecf20Sopenharmony_ci (x == DRX_STANDARD_8VSB) ? "8VSB" : \ 19268c2ecf20Sopenharmony_ci (x == DRX_STANDARD_NTSC) ? "NTSC" : \ 19278c2ecf20Sopenharmony_ci (x == DRX_STANDARD_PAL_SECAM_BG) ? "PAL/SECAM B/G" : \ 19288c2ecf20Sopenharmony_ci (x == DRX_STANDARD_PAL_SECAM_DK) ? "PAL/SECAM D/K" : \ 19298c2ecf20Sopenharmony_ci (x == DRX_STANDARD_PAL_SECAM_I) ? "PAL/SECAM I" : \ 19308c2ecf20Sopenharmony_ci (x == DRX_STANDARD_PAL_SECAM_L) ? "PAL/SECAM L" : \ 19318c2ecf20Sopenharmony_ci (x == DRX_STANDARD_PAL_SECAM_LP) ? "PAL/SECAM LP" : \ 19328c2ecf20Sopenharmony_ci (x == DRX_STANDARD_ITU_A) ? "ITU-A" : \ 19338c2ecf20Sopenharmony_ci (x == DRX_STANDARD_ITU_B) ? "ITU-B" : \ 19348c2ecf20Sopenharmony_ci (x == DRX_STANDARD_ITU_C) ? "ITU-C" : \ 19358c2ecf20Sopenharmony_ci (x == DRX_STANDARD_ITU_D) ? "ITU-D" : \ 19368c2ecf20Sopenharmony_ci (x == DRX_STANDARD_FM) ? "FM" : \ 19378c2ecf20Sopenharmony_ci (x == DRX_STANDARD_DTMB) ? "DTMB" : \ 19388c2ecf20Sopenharmony_ci (x == DRX_STANDARD_AUTO) ? "Auto" : \ 19398c2ecf20Sopenharmony_ci (x == DRX_STANDARD_UNKNOWN) ? "Unknown" : \ 19408c2ecf20Sopenharmony_ci "(Invalid)") 19418c2ecf20Sopenharmony_ci 19428c2ecf20Sopenharmony_ci/* channel */ 19438c2ecf20Sopenharmony_ci 19448c2ecf20Sopenharmony_ci#define DRX_STR_BANDWIDTH(x) ( \ 19458c2ecf20Sopenharmony_ci (x == DRX_BANDWIDTH_8MHZ) ? "8 MHz" : \ 19468c2ecf20Sopenharmony_ci (x == DRX_BANDWIDTH_7MHZ) ? "7 MHz" : \ 19478c2ecf20Sopenharmony_ci (x == DRX_BANDWIDTH_6MHZ) ? "6 MHz" : \ 19488c2ecf20Sopenharmony_ci (x == DRX_BANDWIDTH_AUTO) ? "Auto" : \ 19498c2ecf20Sopenharmony_ci (x == DRX_BANDWIDTH_UNKNOWN) ? "Unknown" : \ 19508c2ecf20Sopenharmony_ci "(Invalid)") 19518c2ecf20Sopenharmony_ci#define DRX_STR_FFTMODE(x) ( \ 19528c2ecf20Sopenharmony_ci (x == DRX_FFTMODE_2K) ? "2k" : \ 19538c2ecf20Sopenharmony_ci (x == DRX_FFTMODE_4K) ? "4k" : \ 19548c2ecf20Sopenharmony_ci (x == DRX_FFTMODE_8K) ? "8k" : \ 19558c2ecf20Sopenharmony_ci (x == DRX_FFTMODE_AUTO) ? "Auto" : \ 19568c2ecf20Sopenharmony_ci (x == DRX_FFTMODE_UNKNOWN) ? "Unknown" : \ 19578c2ecf20Sopenharmony_ci "(Invalid)") 19588c2ecf20Sopenharmony_ci#define DRX_STR_GUARD(x) ( \ 19598c2ecf20Sopenharmony_ci (x == DRX_GUARD_1DIV32) ? "1/32nd" : \ 19608c2ecf20Sopenharmony_ci (x == DRX_GUARD_1DIV16) ? "1/16th" : \ 19618c2ecf20Sopenharmony_ci (x == DRX_GUARD_1DIV8) ? "1/8th" : \ 19628c2ecf20Sopenharmony_ci (x == DRX_GUARD_1DIV4) ? "1/4th" : \ 19638c2ecf20Sopenharmony_ci (x == DRX_GUARD_AUTO) ? "Auto" : \ 19648c2ecf20Sopenharmony_ci (x == DRX_GUARD_UNKNOWN) ? "Unknown" : \ 19658c2ecf20Sopenharmony_ci "(Invalid)") 19668c2ecf20Sopenharmony_ci#define DRX_STR_CONSTELLATION(x) ( \ 19678c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_BPSK) ? "BPSK" : \ 19688c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_QPSK) ? "QPSK" : \ 19698c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_PSK8) ? "PSK8" : \ 19708c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_QAM16) ? "QAM16" : \ 19718c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_QAM32) ? "QAM32" : \ 19728c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_QAM64) ? "QAM64" : \ 19738c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_QAM128) ? "QAM128" : \ 19748c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_QAM256) ? "QAM256" : \ 19758c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_QAM512) ? "QAM512" : \ 19768c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_QAM1024) ? "QAM1024" : \ 19778c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_QPSK_NR) ? "QPSK_NR" : \ 19788c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_AUTO) ? "Auto" : \ 19798c2ecf20Sopenharmony_ci (x == DRX_CONSTELLATION_UNKNOWN) ? "Unknown" : \ 19808c2ecf20Sopenharmony_ci "(Invalid)") 19818c2ecf20Sopenharmony_ci#define DRX_STR_CODERATE(x) ( \ 19828c2ecf20Sopenharmony_ci (x == DRX_CODERATE_1DIV2) ? "1/2nd" : \ 19838c2ecf20Sopenharmony_ci (x == DRX_CODERATE_2DIV3) ? "2/3rd" : \ 19848c2ecf20Sopenharmony_ci (x == DRX_CODERATE_3DIV4) ? "3/4th" : \ 19858c2ecf20Sopenharmony_ci (x == DRX_CODERATE_5DIV6) ? "5/6th" : \ 19868c2ecf20Sopenharmony_ci (x == DRX_CODERATE_7DIV8) ? "7/8th" : \ 19878c2ecf20Sopenharmony_ci (x == DRX_CODERATE_AUTO) ? "Auto" : \ 19888c2ecf20Sopenharmony_ci (x == DRX_CODERATE_UNKNOWN) ? "Unknown" : \ 19898c2ecf20Sopenharmony_ci "(Invalid)") 19908c2ecf20Sopenharmony_ci#define DRX_STR_HIERARCHY(x) ( \ 19918c2ecf20Sopenharmony_ci (x == DRX_HIERARCHY_NONE) ? "None" : \ 19928c2ecf20Sopenharmony_ci (x == DRX_HIERARCHY_ALPHA1) ? "Alpha=1" : \ 19938c2ecf20Sopenharmony_ci (x == DRX_HIERARCHY_ALPHA2) ? "Alpha=2" : \ 19948c2ecf20Sopenharmony_ci (x == DRX_HIERARCHY_ALPHA4) ? "Alpha=4" : \ 19958c2ecf20Sopenharmony_ci (x == DRX_HIERARCHY_AUTO) ? "Auto" : \ 19968c2ecf20Sopenharmony_ci (x == DRX_HIERARCHY_UNKNOWN) ? "Unknown" : \ 19978c2ecf20Sopenharmony_ci "(Invalid)") 19988c2ecf20Sopenharmony_ci#define DRX_STR_PRIORITY(x) ( \ 19998c2ecf20Sopenharmony_ci (x == DRX_PRIORITY_LOW) ? "Low" : \ 20008c2ecf20Sopenharmony_ci (x == DRX_PRIORITY_HIGH) ? "High" : \ 20018c2ecf20Sopenharmony_ci (x == DRX_PRIORITY_UNKNOWN) ? "Unknown" : \ 20028c2ecf20Sopenharmony_ci "(Invalid)") 20038c2ecf20Sopenharmony_ci#define DRX_STR_MIRROR(x) ( \ 20048c2ecf20Sopenharmony_ci (x == DRX_MIRROR_NO) ? "Normal" : \ 20058c2ecf20Sopenharmony_ci (x == DRX_MIRROR_YES) ? "Mirrored" : \ 20068c2ecf20Sopenharmony_ci (x == DRX_MIRROR_AUTO) ? "Auto" : \ 20078c2ecf20Sopenharmony_ci (x == DRX_MIRROR_UNKNOWN) ? "Unknown" : \ 20088c2ecf20Sopenharmony_ci "(Invalid)") 20098c2ecf20Sopenharmony_ci#define DRX_STR_CLASSIFICATION(x) ( \ 20108c2ecf20Sopenharmony_ci (x == DRX_CLASSIFICATION_GAUSS) ? "Gaussion" : \ 20118c2ecf20Sopenharmony_ci (x == DRX_CLASSIFICATION_HVY_GAUSS) ? "Heavy Gaussion" : \ 20128c2ecf20Sopenharmony_ci (x == DRX_CLASSIFICATION_COCHANNEL) ? "Co-channel" : \ 20138c2ecf20Sopenharmony_ci (x == DRX_CLASSIFICATION_STATIC) ? "Static echo" : \ 20148c2ecf20Sopenharmony_ci (x == DRX_CLASSIFICATION_MOVING) ? "Moving echo" : \ 20158c2ecf20Sopenharmony_ci (x == DRX_CLASSIFICATION_ZERODB) ? "Zero dB echo" : \ 20168c2ecf20Sopenharmony_ci (x == DRX_CLASSIFICATION_UNKNOWN) ? "Unknown" : \ 20178c2ecf20Sopenharmony_ci (x == DRX_CLASSIFICATION_AUTO) ? "Auto" : \ 20188c2ecf20Sopenharmony_ci "(Invalid)") 20198c2ecf20Sopenharmony_ci 20208c2ecf20Sopenharmony_ci#define DRX_STR_INTERLEAVEMODE(x) ( \ 20218c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I128_J1) ? "I128_J1" : \ 20228c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I128_J1_V2) ? "I128_J1_V2" : \ 20238c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I128_J2) ? "I128_J2" : \ 20248c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I64_J2) ? "I64_J2" : \ 20258c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I128_J3) ? "I128_J3" : \ 20268c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I32_J4) ? "I32_J4" : \ 20278c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I128_J4) ? "I128_J4" : \ 20288c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I16_J8) ? "I16_J8" : \ 20298c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I128_J5) ? "I128_J5" : \ 20308c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I8_J16) ? "I8_J16" : \ 20318c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I128_J6) ? "I128_J6" : \ 20328c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_RESERVED_11) ? "Reserved 11" : \ 20338c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I128_J7) ? "I128_J7" : \ 20348c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_RESERVED_13) ? "Reserved 13" : \ 20358c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I128_J8) ? "I128_J8" : \ 20368c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_RESERVED_15) ? "Reserved 15" : \ 20378c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I12_J17) ? "I12_J17" : \ 20388c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_I5_J4) ? "I5_J4" : \ 20398c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_B52_M240) ? "B52_M240" : \ 20408c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_B52_M720) ? "B52_M720" : \ 20418c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_B52_M48) ? "B52_M48" : \ 20428c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_B52_M0) ? "B52_M0" : \ 20438c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_UNKNOWN) ? "Unknown" : \ 20448c2ecf20Sopenharmony_ci (x == DRX_INTERLEAVEMODE_AUTO) ? "Auto" : \ 20458c2ecf20Sopenharmony_ci "(Invalid)") 20468c2ecf20Sopenharmony_ci 20478c2ecf20Sopenharmony_ci#define DRX_STR_LDPC(x) ( \ 20488c2ecf20Sopenharmony_ci (x == DRX_LDPC_0_4) ? "0.4" : \ 20498c2ecf20Sopenharmony_ci (x == DRX_LDPC_0_6) ? "0.6" : \ 20508c2ecf20Sopenharmony_ci (x == DRX_LDPC_0_8) ? "0.8" : \ 20518c2ecf20Sopenharmony_ci (x == DRX_LDPC_AUTO) ? "Auto" : \ 20528c2ecf20Sopenharmony_ci (x == DRX_LDPC_UNKNOWN) ? "Unknown" : \ 20538c2ecf20Sopenharmony_ci "(Invalid)") 20548c2ecf20Sopenharmony_ci 20558c2ecf20Sopenharmony_ci#define DRX_STR_CARRIER(x) ( \ 20568c2ecf20Sopenharmony_ci (x == DRX_CARRIER_MULTI) ? "Multi" : \ 20578c2ecf20Sopenharmony_ci (x == DRX_CARRIER_SINGLE) ? "Single" : \ 20588c2ecf20Sopenharmony_ci (x == DRX_CARRIER_AUTO) ? "Auto" : \ 20598c2ecf20Sopenharmony_ci (x == DRX_CARRIER_UNKNOWN) ? "Unknown" : \ 20608c2ecf20Sopenharmony_ci "(Invalid)") 20618c2ecf20Sopenharmony_ci 20628c2ecf20Sopenharmony_ci#define DRX_STR_FRAMEMODE(x) ( \ 20638c2ecf20Sopenharmony_ci (x == DRX_FRAMEMODE_420) ? "420" : \ 20648c2ecf20Sopenharmony_ci (x == DRX_FRAMEMODE_595) ? "595" : \ 20658c2ecf20Sopenharmony_ci (x == DRX_FRAMEMODE_945) ? "945" : \ 20668c2ecf20Sopenharmony_ci (x == DRX_FRAMEMODE_420_FIXED_PN) ? "420 with fixed PN" : \ 20678c2ecf20Sopenharmony_ci (x == DRX_FRAMEMODE_945_FIXED_PN) ? "945 with fixed PN" : \ 20688c2ecf20Sopenharmony_ci (x == DRX_FRAMEMODE_AUTO) ? "Auto" : \ 20698c2ecf20Sopenharmony_ci (x == DRX_FRAMEMODE_UNKNOWN) ? "Unknown" : \ 20708c2ecf20Sopenharmony_ci "(Invalid)") 20718c2ecf20Sopenharmony_ci 20728c2ecf20Sopenharmony_ci#define DRX_STR_PILOT(x) ( \ 20738c2ecf20Sopenharmony_ci (x == DRX_PILOT_ON) ? "On" : \ 20748c2ecf20Sopenharmony_ci (x == DRX_PILOT_OFF) ? "Off" : \ 20758c2ecf20Sopenharmony_ci (x == DRX_PILOT_AUTO) ? "Auto" : \ 20768c2ecf20Sopenharmony_ci (x == DRX_PILOT_UNKNOWN) ? "Unknown" : \ 20778c2ecf20Sopenharmony_ci "(Invalid)") 20788c2ecf20Sopenharmony_ci/* TPS */ 20798c2ecf20Sopenharmony_ci 20808c2ecf20Sopenharmony_ci#define DRX_STR_TPS_FRAME(x) ( \ 20818c2ecf20Sopenharmony_ci (x == DRX_TPS_FRAME1) ? "Frame1" : \ 20828c2ecf20Sopenharmony_ci (x == DRX_TPS_FRAME2) ? "Frame2" : \ 20838c2ecf20Sopenharmony_ci (x == DRX_TPS_FRAME3) ? "Frame3" : \ 20848c2ecf20Sopenharmony_ci (x == DRX_TPS_FRAME4) ? "Frame4" : \ 20858c2ecf20Sopenharmony_ci (x == DRX_TPS_FRAME_UNKNOWN) ? "Unknown" : \ 20868c2ecf20Sopenharmony_ci "(Invalid)") 20878c2ecf20Sopenharmony_ci 20888c2ecf20Sopenharmony_ci/* lock status */ 20898c2ecf20Sopenharmony_ci 20908c2ecf20Sopenharmony_ci#define DRX_STR_LOCKSTATUS(x) ( \ 20918c2ecf20Sopenharmony_ci (x == DRX_NEVER_LOCK) ? "Never" : \ 20928c2ecf20Sopenharmony_ci (x == DRX_NOT_LOCKED) ? "No" : \ 20938c2ecf20Sopenharmony_ci (x == DRX_LOCKED) ? "Locked" : \ 20948c2ecf20Sopenharmony_ci (x == DRX_LOCK_STATE_1) ? "Lock state 1" : \ 20958c2ecf20Sopenharmony_ci (x == DRX_LOCK_STATE_2) ? "Lock state 2" : \ 20968c2ecf20Sopenharmony_ci (x == DRX_LOCK_STATE_3) ? "Lock state 3" : \ 20978c2ecf20Sopenharmony_ci (x == DRX_LOCK_STATE_4) ? "Lock state 4" : \ 20988c2ecf20Sopenharmony_ci (x == DRX_LOCK_STATE_5) ? "Lock state 5" : \ 20998c2ecf20Sopenharmony_ci (x == DRX_LOCK_STATE_6) ? "Lock state 6" : \ 21008c2ecf20Sopenharmony_ci (x == DRX_LOCK_STATE_7) ? "Lock state 7" : \ 21018c2ecf20Sopenharmony_ci (x == DRX_LOCK_STATE_8) ? "Lock state 8" : \ 21028c2ecf20Sopenharmony_ci (x == DRX_LOCK_STATE_9) ? "Lock state 9" : \ 21038c2ecf20Sopenharmony_ci "(Invalid)") 21048c2ecf20Sopenharmony_ci 21058c2ecf20Sopenharmony_ci/* version information , modules */ 21068c2ecf20Sopenharmony_ci#define DRX_STR_MODULE(x) ( \ 21078c2ecf20Sopenharmony_ci (x == DRX_MODULE_DEVICE) ? "Device" : \ 21088c2ecf20Sopenharmony_ci (x == DRX_MODULE_MICROCODE) ? "Microcode" : \ 21098c2ecf20Sopenharmony_ci (x == DRX_MODULE_DRIVERCORE) ? "CoreDriver" : \ 21108c2ecf20Sopenharmony_ci (x == DRX_MODULE_DEVICEDRIVER) ? "DeviceDriver" : \ 21118c2ecf20Sopenharmony_ci (x == DRX_MODULE_BSP_I2C) ? "BSP I2C" : \ 21128c2ecf20Sopenharmony_ci (x == DRX_MODULE_BSP_TUNER) ? "BSP Tuner" : \ 21138c2ecf20Sopenharmony_ci (x == DRX_MODULE_BSP_HOST) ? "BSP Host" : \ 21148c2ecf20Sopenharmony_ci (x == DRX_MODULE_DAP) ? "Data Access Protocol" : \ 21158c2ecf20Sopenharmony_ci (x == DRX_MODULE_UNKNOWN) ? "Unknown" : \ 21168c2ecf20Sopenharmony_ci "(Invalid)") 21178c2ecf20Sopenharmony_ci 21188c2ecf20Sopenharmony_ci#define DRX_STR_POWER_MODE(x) ( \ 21198c2ecf20Sopenharmony_ci (x == DRX_POWER_UP) ? "DRX_POWER_UP " : \ 21208c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_1) ? "DRX_POWER_MODE_1" : \ 21218c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_2) ? "DRX_POWER_MODE_2" : \ 21228c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_3) ? "DRX_POWER_MODE_3" : \ 21238c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_4) ? "DRX_POWER_MODE_4" : \ 21248c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_5) ? "DRX_POWER_MODE_5" : \ 21258c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_6) ? "DRX_POWER_MODE_6" : \ 21268c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_7) ? "DRX_POWER_MODE_7" : \ 21278c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_8) ? "DRX_POWER_MODE_8" : \ 21288c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_9) ? "DRX_POWER_MODE_9" : \ 21298c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_10) ? "DRX_POWER_MODE_10" : \ 21308c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_11) ? "DRX_POWER_MODE_11" : \ 21318c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_12) ? "DRX_POWER_MODE_12" : \ 21328c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_13) ? "DRX_POWER_MODE_13" : \ 21338c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_14) ? "DRX_POWER_MODE_14" : \ 21348c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_15) ? "DRX_POWER_MODE_15" : \ 21358c2ecf20Sopenharmony_ci (x == DRX_POWER_MODE_16) ? "DRX_POWER_MODE_16" : \ 21368c2ecf20Sopenharmony_ci (x == DRX_POWER_DOWN) ? "DRX_POWER_DOWN " : \ 21378c2ecf20Sopenharmony_ci "(Invalid)") 21388c2ecf20Sopenharmony_ci 21398c2ecf20Sopenharmony_ci#define DRX_STR_OOB_STANDARD(x) ( \ 21408c2ecf20Sopenharmony_ci (x == DRX_OOB_MODE_A) ? "ANSI 55-1 " : \ 21418c2ecf20Sopenharmony_ci (x == DRX_OOB_MODE_B_GRADE_A) ? "ANSI 55-2 A" : \ 21428c2ecf20Sopenharmony_ci (x == DRX_OOB_MODE_B_GRADE_B) ? "ANSI 55-2 B" : \ 21438c2ecf20Sopenharmony_ci "(Invalid)") 21448c2ecf20Sopenharmony_ci 21458c2ecf20Sopenharmony_ci#define DRX_STR_AUD_STANDARD(x) ( \ 21468c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_BTSC) ? "BTSC" : \ 21478c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_A2) ? "A2" : \ 21488c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_EIAJ) ? "EIAJ" : \ 21498c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_FM_STEREO) ? "FM Stereo" : \ 21508c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_AUTO) ? "Auto" : \ 21518c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_M_MONO) ? "M-Standard Mono" : \ 21528c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_D_K_MONO) ? "D/K Mono FM" : \ 21538c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_BG_FM) ? "B/G-Dual Carrier FM (A2)" : \ 21548c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_D_K1) ? "D/K1-Dual Carrier FM" : \ 21558c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_D_K2) ? "D/K2-Dual Carrier FM" : \ 21568c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_D_K3) ? "D/K3-Dual Carrier FM" : \ 21578c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_BG_NICAM_FM) ? "B/G-NICAM-FM" : \ 21588c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_L_NICAM_AM) ? "L-NICAM-AM" : \ 21598c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_I_NICAM_FM) ? "I-NICAM-FM" : \ 21608c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_D_K_NICAM_FM) ? "D/K-NICAM-FM" : \ 21618c2ecf20Sopenharmony_ci (x == DRX_AUD_STANDARD_UNKNOWN) ? "Unknown" : \ 21628c2ecf20Sopenharmony_ci "(Invalid)") 21638c2ecf20Sopenharmony_ci#define DRX_STR_AUD_STEREO(x) ( \ 21648c2ecf20Sopenharmony_ci (x == true) ? "Stereo" : \ 21658c2ecf20Sopenharmony_ci (x == false) ? "Mono" : \ 21668c2ecf20Sopenharmony_ci "(Invalid)") 21678c2ecf20Sopenharmony_ci 21688c2ecf20Sopenharmony_ci#define DRX_STR_AUD_SAP(x) ( \ 21698c2ecf20Sopenharmony_ci (x == true) ? "Present" : \ 21708c2ecf20Sopenharmony_ci (x == false) ? "Not present" : \ 21718c2ecf20Sopenharmony_ci "(Invalid)") 21728c2ecf20Sopenharmony_ci 21738c2ecf20Sopenharmony_ci#define DRX_STR_AUD_CARRIER(x) ( \ 21748c2ecf20Sopenharmony_ci (x == true) ? "Present" : \ 21758c2ecf20Sopenharmony_ci (x == false) ? "Not present" : \ 21768c2ecf20Sopenharmony_ci "(Invalid)") 21778c2ecf20Sopenharmony_ci 21788c2ecf20Sopenharmony_ci#define DRX_STR_AUD_RDS(x) ( \ 21798c2ecf20Sopenharmony_ci (x == true) ? "Available" : \ 21808c2ecf20Sopenharmony_ci (x == false) ? "Not Available" : \ 21818c2ecf20Sopenharmony_ci "(Invalid)") 21828c2ecf20Sopenharmony_ci 21838c2ecf20Sopenharmony_ci#define DRX_STR_AUD_NICAM_STATUS(x) ( \ 21848c2ecf20Sopenharmony_ci (x == DRX_AUD_NICAM_DETECTED) ? "Detected" : \ 21858c2ecf20Sopenharmony_ci (x == DRX_AUD_NICAM_NOT_DETECTED) ? "Not detected" : \ 21868c2ecf20Sopenharmony_ci (x == DRX_AUD_NICAM_BAD) ? "Bad" : \ 21878c2ecf20Sopenharmony_ci "(Invalid)") 21888c2ecf20Sopenharmony_ci 21898c2ecf20Sopenharmony_ci#define DRX_STR_RDS_VALID(x) ( \ 21908c2ecf20Sopenharmony_ci (x == true) ? "Valid" : \ 21918c2ecf20Sopenharmony_ci (x == false) ? "Not Valid" : \ 21928c2ecf20Sopenharmony_ci "(Invalid)") 21938c2ecf20Sopenharmony_ci 21948c2ecf20Sopenharmony_ci/*------------------------------------------------------------------------- 21958c2ecf20Sopenharmony_ciAccess macros 21968c2ecf20Sopenharmony_ci-------------------------------------------------------------------------*/ 21978c2ecf20Sopenharmony_ci 21988c2ecf20Sopenharmony_ci/* 21998c2ecf20Sopenharmony_ci* \brief Create a compilable reference to the microcode attribute 22008c2ecf20Sopenharmony_ci* \param d pointer to demod instance 22018c2ecf20Sopenharmony_ci* 22028c2ecf20Sopenharmony_ci* Used as main reference to an attribute field. 22038c2ecf20Sopenharmony_ci* Used by both macro implementation and function implementation. 22048c2ecf20Sopenharmony_ci* These macros are defined to avoid duplication of code in macro and function 22058c2ecf20Sopenharmony_ci* definitions that handle access of demod common or extended attributes. 22068c2ecf20Sopenharmony_ci* 22078c2ecf20Sopenharmony_ci*/ 22088c2ecf20Sopenharmony_ci 22098c2ecf20Sopenharmony_ci#define DRX_ATTR_MCRECORD(d) ((d)->my_common_attr->mcversion) 22108c2ecf20Sopenharmony_ci#define DRX_ATTR_MIRRORFREQSPECT(d) ((d)->my_common_attr->mirror_freq_spect) 22118c2ecf20Sopenharmony_ci#define DRX_ATTR_CURRENTPOWERMODE(d)((d)->my_common_attr->current_power_mode) 22128c2ecf20Sopenharmony_ci#define DRX_ATTR_ISOPENED(d) ((d)->my_common_attr->is_opened) 22138c2ecf20Sopenharmony_ci#define DRX_ATTR_USEBOOTLOADER(d) ((d)->my_common_attr->use_bootloader) 22148c2ecf20Sopenharmony_ci#define DRX_ATTR_CURRENTSTANDARD(d) ((d)->my_common_attr->current_standard) 22158c2ecf20Sopenharmony_ci#define DRX_ATTR_PREVSTANDARD(d) ((d)->my_common_attr->prev_standard) 22168c2ecf20Sopenharmony_ci#define DRX_ATTR_CACHESTANDARD(d) ((d)->my_common_attr->di_cache_standard) 22178c2ecf20Sopenharmony_ci#define DRX_ATTR_CURRENTCHANNEL(d) ((d)->my_common_attr->current_channel) 22188c2ecf20Sopenharmony_ci#define DRX_ATTR_MICROCODE(d) ((d)->my_common_attr->microcode) 22198c2ecf20Sopenharmony_ci#define DRX_ATTR_VERIFYMICROCODE(d) ((d)->my_common_attr->verify_microcode) 22208c2ecf20Sopenharmony_ci#define DRX_ATTR_CAPABILITIES(d) ((d)->my_common_attr->capabilities) 22218c2ecf20Sopenharmony_ci#define DRX_ATTR_PRODUCTID(d) ((d)->my_common_attr->product_id) 22228c2ecf20Sopenharmony_ci#define DRX_ATTR_INTERMEDIATEFREQ(d) ((d)->my_common_attr->intermediate_freq) 22238c2ecf20Sopenharmony_ci#define DRX_ATTR_SYSCLOCKFREQ(d) ((d)->my_common_attr->sys_clock_freq) 22248c2ecf20Sopenharmony_ci#define DRX_ATTR_TUNERRFAGCPOL(d) ((d)->my_common_attr->tuner_rf_agc_pol) 22258c2ecf20Sopenharmony_ci#define DRX_ATTR_TUNERIFAGCPOL(d) ((d)->my_common_attr->tuner_if_agc_pol) 22268c2ecf20Sopenharmony_ci#define DRX_ATTR_TUNERSLOWMODE(d) ((d)->my_common_attr->tuner_slow_mode) 22278c2ecf20Sopenharmony_ci#define DRX_ATTR_TUNERSPORTNR(d) ((d)->my_common_attr->tuner_port_nr) 22288c2ecf20Sopenharmony_ci#define DRX_ATTR_I2CADDR(d) ((d)->my_i2c_dev_addr->i2c_addr) 22298c2ecf20Sopenharmony_ci#define DRX_ATTR_I2CDEVID(d) ((d)->my_i2c_dev_addr->i2c_dev_id) 22308c2ecf20Sopenharmony_ci#define DRX_ISMCVERTYPE(x) ((x) == AUX_VER_RECORD) 22318c2ecf20Sopenharmony_ci 22328c2ecf20Sopenharmony_ci/*************************/ 22338c2ecf20Sopenharmony_ci 22348c2ecf20Sopenharmony_ci/* Macros with device-specific handling are converted to CFG functions */ 22358c2ecf20Sopenharmony_ci 22368c2ecf20Sopenharmony_ci#define DRX_ACCESSMACRO_SET(demod, value, cfg_name, data_type) \ 22378c2ecf20Sopenharmony_ci do { \ 22388c2ecf20Sopenharmony_ci struct drx_cfg config; \ 22398c2ecf20Sopenharmony_ci data_type cfg_data; \ 22408c2ecf20Sopenharmony_ci config.cfg_type = cfg_name; \ 22418c2ecf20Sopenharmony_ci config.cfg_data = &cfg_data; \ 22428c2ecf20Sopenharmony_ci cfg_data = value; \ 22438c2ecf20Sopenharmony_ci drx_ctrl(demod, DRX_CTRL_SET_CFG, &config); \ 22448c2ecf20Sopenharmony_ci } while (0) 22458c2ecf20Sopenharmony_ci 22468c2ecf20Sopenharmony_ci#define DRX_ACCESSMACRO_GET(demod, value, cfg_name, data_type, error_value) \ 22478c2ecf20Sopenharmony_ci do { \ 22488c2ecf20Sopenharmony_ci int cfg_status; \ 22498c2ecf20Sopenharmony_ci struct drx_cfg config; \ 22508c2ecf20Sopenharmony_ci data_type cfg_data; \ 22518c2ecf20Sopenharmony_ci config.cfg_type = cfg_name; \ 22528c2ecf20Sopenharmony_ci config.cfg_data = &cfg_data; \ 22538c2ecf20Sopenharmony_ci cfg_status = drx_ctrl(demod, DRX_CTRL_GET_CFG, &config); \ 22548c2ecf20Sopenharmony_ci if (cfg_status == 0) { \ 22558c2ecf20Sopenharmony_ci value = cfg_data; \ 22568c2ecf20Sopenharmony_ci } else { \ 22578c2ecf20Sopenharmony_ci value = (data_type)error_value; \ 22588c2ecf20Sopenharmony_ci } \ 22598c2ecf20Sopenharmony_ci } while (0) 22608c2ecf20Sopenharmony_ci 22618c2ecf20Sopenharmony_ci/* Configuration functions for usage by Access (XS) Macros */ 22628c2ecf20Sopenharmony_ci 22638c2ecf20Sopenharmony_ci#ifndef DRX_XS_CFG_BASE 22648c2ecf20Sopenharmony_ci#define DRX_XS_CFG_BASE (500) 22658c2ecf20Sopenharmony_ci#endif 22668c2ecf20Sopenharmony_ci 22678c2ecf20Sopenharmony_ci#define DRX_XS_CFG_PRESET (DRX_XS_CFG_BASE + 0) 22688c2ecf20Sopenharmony_ci#define DRX_XS_CFG_AUD_BTSC_DETECT (DRX_XS_CFG_BASE + 1) 22698c2ecf20Sopenharmony_ci#define DRX_XS_CFG_QAM_LOCKRANGE (DRX_XS_CFG_BASE + 2) 22708c2ecf20Sopenharmony_ci 22718c2ecf20Sopenharmony_ci/* Access Macros with device-specific handling */ 22728c2ecf20Sopenharmony_ci 22738c2ecf20Sopenharmony_ci#define DRX_SET_PRESET(d, x) \ 22748c2ecf20Sopenharmony_ci DRX_ACCESSMACRO_SET((d), (x), DRX_XS_CFG_PRESET, char*) 22758c2ecf20Sopenharmony_ci#define DRX_GET_PRESET(d, x) \ 22768c2ecf20Sopenharmony_ci DRX_ACCESSMACRO_GET((d), (x), DRX_XS_CFG_PRESET, char*, "ERROR") 22778c2ecf20Sopenharmony_ci 22788c2ecf20Sopenharmony_ci#define DRX_SET_AUD_BTSC_DETECT(d, x) DRX_ACCESSMACRO_SET((d), (x), \ 22798c2ecf20Sopenharmony_ci DRX_XS_CFG_AUD_BTSC_DETECT, enum drx_aud_btsc_detect) 22808c2ecf20Sopenharmony_ci#define DRX_GET_AUD_BTSC_DETECT(d, x) DRX_ACCESSMACRO_GET((d), (x), \ 22818c2ecf20Sopenharmony_ci DRX_XS_CFG_AUD_BTSC_DETECT, enum drx_aud_btsc_detect, DRX_UNKNOWN) 22828c2ecf20Sopenharmony_ci 22838c2ecf20Sopenharmony_ci#define DRX_SET_QAM_LOCKRANGE(d, x) DRX_ACCESSMACRO_SET((d), (x), \ 22848c2ecf20Sopenharmony_ci DRX_XS_CFG_QAM_LOCKRANGE, enum drx_qam_lock_range) 22858c2ecf20Sopenharmony_ci#define DRX_GET_QAM_LOCKRANGE(d, x) DRX_ACCESSMACRO_GET((d), (x), \ 22868c2ecf20Sopenharmony_ci DRX_XS_CFG_QAM_LOCKRANGE, enum drx_qam_lock_range, DRX_UNKNOWN) 22878c2ecf20Sopenharmony_ci 22888c2ecf20Sopenharmony_ci/* 22898c2ecf20Sopenharmony_ci* \brief Macro to check if std is an ATV standard 22908c2ecf20Sopenharmony_ci* \retval true std is an ATV standard 22918c2ecf20Sopenharmony_ci* \retval false std is an ATV standard 22928c2ecf20Sopenharmony_ci*/ 22938c2ecf20Sopenharmony_ci#define DRX_ISATVSTD(std) (((std) == DRX_STANDARD_PAL_SECAM_BG) || \ 22948c2ecf20Sopenharmony_ci ((std) == DRX_STANDARD_PAL_SECAM_DK) || \ 22958c2ecf20Sopenharmony_ci ((std) == DRX_STANDARD_PAL_SECAM_I) || \ 22968c2ecf20Sopenharmony_ci ((std) == DRX_STANDARD_PAL_SECAM_L) || \ 22978c2ecf20Sopenharmony_ci ((std) == DRX_STANDARD_PAL_SECAM_LP) || \ 22988c2ecf20Sopenharmony_ci ((std) == DRX_STANDARD_NTSC) || \ 22998c2ecf20Sopenharmony_ci ((std) == DRX_STANDARD_FM)) 23008c2ecf20Sopenharmony_ci 23018c2ecf20Sopenharmony_ci/* 23028c2ecf20Sopenharmony_ci* \brief Macro to check if std is an QAM standard 23038c2ecf20Sopenharmony_ci* \retval true std is an QAM standards 23048c2ecf20Sopenharmony_ci* \retval false std is an QAM standards 23058c2ecf20Sopenharmony_ci*/ 23068c2ecf20Sopenharmony_ci#define DRX_ISQAMSTD(std) (((std) == DRX_STANDARD_ITU_A) || \ 23078c2ecf20Sopenharmony_ci ((std) == DRX_STANDARD_ITU_B) || \ 23088c2ecf20Sopenharmony_ci ((std) == DRX_STANDARD_ITU_C) || \ 23098c2ecf20Sopenharmony_ci ((std) == DRX_STANDARD_ITU_D)) 23108c2ecf20Sopenharmony_ci 23118c2ecf20Sopenharmony_ci/* 23128c2ecf20Sopenharmony_ci* \brief Macro to check if std is VSB standard 23138c2ecf20Sopenharmony_ci* \retval true std is VSB standard 23148c2ecf20Sopenharmony_ci* \retval false std is not VSB standard 23158c2ecf20Sopenharmony_ci*/ 23168c2ecf20Sopenharmony_ci#define DRX_ISVSBSTD(std) ((std) == DRX_STANDARD_8VSB) 23178c2ecf20Sopenharmony_ci 23188c2ecf20Sopenharmony_ci/* 23198c2ecf20Sopenharmony_ci* \brief Macro to check if std is DVBT standard 23208c2ecf20Sopenharmony_ci* \retval true std is DVBT standard 23218c2ecf20Sopenharmony_ci* \retval false std is not DVBT standard 23228c2ecf20Sopenharmony_ci*/ 23238c2ecf20Sopenharmony_ci#define DRX_ISDVBTSTD(std) ((std) == DRX_STANDARD_DVBT) 23248c2ecf20Sopenharmony_ci 23258c2ecf20Sopenharmony_ci/*------------------------------------------------------------------------- 23268c2ecf20Sopenharmony_ciTHE END 23278c2ecf20Sopenharmony_ci-------------------------------------------------------------------------*/ 23288c2ecf20Sopenharmony_ci#endif /* __DRXDRIVER_H__ */ 2329