1 /* 2 * TI FM kernel driver's sample application. 3 * 4 * Copyright (C) 2010 Texas Instruments 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * 19 */ 20 21 #ifndef _KFMAPP_H 22 #define _KFMAPP_H 23 24 #define DEFAULT_RADIO_DEVICE "/dev/radio0" 25 26 #define FMRX_BAND_SYSFS_ENTRY "/sys/class/video4linux/radio0/fmrx_band" 27 #define FMRX_RDS_AF_SYSFS_ENTRY "/sys/class/video4linux/radio0/fmrx_rds_af" 28 #define FMRX_RSSI_LVL_SYSFS_ENTRY "/sys/class/video4linux/radio0/fmrx_rssi_lvl" 29 30 #define FMTX_RDS_AF_SYSFS_ENTRY "/sys/class/video4linux/radio0/fmtx_rds_af" 31 32 #define CTL_INDEX_0 0 33 #define CTL_INDEX_1 1 34 35 #define FMAPP_BATCH 0 36 #define FMAPP_INTERACTIVE 1 37 38 #define FM_MUTE_OFF 0 39 #define FM_MUTE_ON 1 40 41 #define FM_SEARCH_DIRECTION_DOWN 0 42 #define FM_SEARCH_DIRECTION_UP 1 43 44 #define FM_MODE_SWITCH_CTL_NAME "Mode Switch" 45 #define FM_MODE_OFF 0 46 #define FM_MODE_TX 1 47 #define FM_MODE_RX 2 48 49 #define FM_BAND_SWITCH_CTL_NAME "Region Switch" 50 #define FM_BAND_EUROPE_US 0 51 #define FM_BAND_JAPAN 1 52 53 #define FM_RF_DEPENDENT_MUTE_CTL_NAME "RF Dependent Mute" 54 #define FM_RX_RF_DEPENDENT_MUTE_ON 1 55 #define FM_RX_RF_DEPENDENT_MUTE_OFF 0 56 57 #define FM_RX_GET_RSSI_LVL_CTL_NAME "RSSI Level" 58 #define FM_RX_RSSI_THRESHOLD_LVL_CTL_NAME "RSSI Threshold" 59 60 #define FM_STEREO_MONO_CTL_NAME "Stereo/Mono" 61 #define FM_STEREO_MODE 0 62 #define FM_MONO_MODE 1 63 64 #define FM_RX_DEEMPHASIS_CTL_NAME "De-emphasis Filter" 65 #define FM_RX_EMPHASIS_FILTER_50_USEC 0 66 #define FM_RX_EMPHASIS_FILTER_75_USEC 1 67 68 #define FM_RDS_SWITCH_CTL_NAME "RDS Switch" 69 #define FM_RDS_DISABLE 0 70 #define FM_RDS_ENABLE 1 71 72 #define FM_RX_RDS_OPMODE_CTL_NAME "RDS Operation Mode" 73 #define FM_RDS_SYSTEM_RDS 0 74 #define FM_RDS_SYSTEM_RBDS 1 75 76 #define FM_RX_AF_SWITCH_CTL_NAME "AF Switch" 77 #define FM_RX_RDS_AF_SWITCH_MODE_ON 1 78 #define FM_RX_RDS_AF_SWITCH_MODE_OFF 0 79 80 /* Auto scan info */ 81 #define FMAPP_ASCAN_SIGNAL_THRESHOLD_PER 50 /* 50 % */ 82 #define FMAPP_ASCAN_NO_OF_SIGNAL_SAMPLE 3 /* 3 Samples */ 83 84 #define FMAPP_AF_MAX_FREQ_RANGE 6 85 86 #define V4L2_CID_CHANNEL_SPACING (V4L2_CID_PRIVATE_BASE + 0) 87 88 struct tx_rds { 89 unsigned char text_type; 90 unsigned char text[25]; 91 unsigned int af_freq; 92 }; 93 #define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 94 /* FM Modulator class control IDs */ 95 #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) 96 #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) 97 98 #define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112) 99 100 #define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1) 101 #define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2) 102 #define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3) 103 #define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5) 104 #define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6) 105 106 #define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113) 107 #define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114) 108 #define V4L2_TUNER_SUB_RDS 0x0010 109 110 /* Following macros and structs are re-declared since android 111 file system has old videodev2.h but kfmapp needs new K35 videodev2.h 112 declarations, So need to remove these definitions once android headers 113 move to K35 plus */ 114 #undef VIDIOC_S_MODULATOR 115 #define VIDIOC_S_MODULATOR 1078220343 116 117 struct v4l2_ext_control_kfmapp { 118 __u32 id; 119 __u32 size; 120 __u32 reserved2[1]; 121 union { 122 __s32 value; 123 __s64 value64; 124 char *string; 125 }; 126 } __attribute__ ((packed)); 127 128 struct v4l2_ext_controls_kfmapp { 129 __u32 ctrl_class; 130 __u32 count; 131 __u32 error_idx; 132 __u32 reserved[2]; 133 struct v4l2_ext_control_kfmapp *controls; 134 }; 135 136 /* Presently android videodev2.h is from k2.6.35 so remove below struct when 137 * android header files moves to k3.0+ kernel header 138 * */ 139 struct ti_v4l2_hw_freq_seek { 140 __u32 tuner; 141 enum v4l2_tuner_type type; 142 __u32 seek_upward; 143 __u32 wrap_around; 144 __u32 spacing; 145 __u32 reserved[7]; 146 }; 147 148 #endif 149 150