Home | History | Annotate | Download | only in linux
      1 /* linux/omap_csmi.h
      2 **
      3 ** Copyright 2005-2006, The Android Open Source Project
      4 ** Author: Arve Hjnnevg
      5 **
      6 ** This file is dual licensed.  It may be redistributed and/or modified
      7 ** under the terms of the Apache 2.0 License OR version 2 of the GNU
      8 ** General Public License.
      9 */
     10 
     11 #ifndef _OMAP_CSMI_H_
     12 #define _OMAP_CSMI_H_
     13 
     14 #include <asm/ioctl.h>
     15 
     16 #ifdef __KERNEL__
     17 
     18 typedef struct {
     19 	uint32_t cmd;
     20 	uint32_t arg1;
     21 	uint32_t arg2;
     22 	uint32_t arg3;
     23 } omap_csmi_gc_command_t;
     24 
     25 typedef struct {
     26 	void (*ack)(int mailbox);
     27 	int (*data)(int mailbox);
     28 	void (*reset)(int mailbox);
     29 	void (*start)(int mailbox);
     30 	void (*stop)(int mailbox);
     31 } omap_csmi_mailbox_handlers_t;
     32 
     33 extern uint8_t *omap_csmi_gsm_data_vaddr;
     34 
     35 #define SEND_FLAG_NO_ACK_AFTER_SEND 1
     36 #define SEND_FLAG_REQEST_ACK_IF_BUSY 2
     37 
     38 typedef struct {
     39 	uint32_t magic;                // 0-3     0x494d5347
     40 	uint32_t header_size;          // 4-7     64
     41 	uint8_t  mailbox_size;         // 8       8 or 16
     42 	uint8_t  num_channels;         // 9       2-15
     43 	uint8_t  gc_channel;           // 10
     44 	uint8_t  debug_channel;        // 11
     45 	uint16_t stream_channel_mask;  // 12-13
     46 	uint16_t pad;                  // 14-15
     47 	char     vendor_code[16];      // 16-31
     48 	char     product_code[16];     // 32-47
     49 	uint32_t version;              // 48-51
     50 	uint32_t ffs_location;         // 52-55
     51 	uint32_t ffs_size;             // 56-59   0 or size
     52 	char     vendor_data[20];       // 60-79
     53 } omap_csmi_gsm_image_info_t;
     54 // in platform_device->platform_data where platform_device->name == "omap-csmi"
     55 
     56 #define OMAP_GSM_IMAGE_HEADER_MAGIC 0x494d5347 /* GSMI */
     57 
     58 struct sysdev_class *omap_csmi_get_sysclass(void);
     59 unsigned short omap_csmi_get_vendor_boot_flags(void);
     60 int omap_csmi_gc_command(const omap_csmi_gc_command_t *command, int timeout, omap_csmi_gc_command_t *reply);
     61 int omap_csmi_send_mailbox(int mailbox, void *data, size_t size, unsigned int flags);
     62 void omap_csmi_read_mailbox(int mailbox, void *data, size_t size);
     63 int omap_csmi_install_mailbox_handlers(int mailbox, omap_csmi_mailbox_handlers_t handlers);
     64 int omap_csmi_uninstall_mailbox_handlers(int mailbox, omap_csmi_mailbox_handlers_t handlers);
     65 
     66 //mailbox channel 1 commands
     67 
     68 #define GC_DSP_PLL_REQ                  0x0001
     69 #define GC_ARM_PLL_REQ                  0x0002
     70 #define GC_READ_MEM_REQ                 0x0003
     71 #define GC_SET_MEM_REQ                  0x0004
     72 #define GC_SERIAL_CONFIG_REQ            0x0005
     73 #define GC_RESET_REQ                    0x0006
     74 #define GC_SW_VERSION_REQ               0x0007
     75 #define GC_HW_VERSION_REQ               0x0008
     76 #define GC_SLEEP_REQ                    0x0009
     77 #define GC_IRQ_REQ                      0x000A
     78 #define GC_BATTERY_STATUS_REQ           0x0011
     79 #define GC_AUDIO_VOICE_REQ              0x0012
     80 #define GC_AUDIO_VOICEBANDCTL_REQ       0x0013
     81 #define GC_AUDIO_OUTPUTCTL_REQ          0x0014
     82 #define GC_AUDIO_SIDETONE_REQ           0x0015
     83 #define GC_AUDIO_ECHOCANC_REQ           0x0016
     84 #define GC_AUDIO_STEREO_CODEC_REQ       0x0017
     85 #define GC_AUDIO_PGA_REQ                0x0018
     86 #define GC_AUDIO_PROFILE_LOAD_REQ       0x0019
     87 #define GC_FFS_INIT_RESTORE_REQ         0x0020
     88 #define GC_FFS_RESTORE_REQ              0x0021
     89 #define GC_FFS_BACKUP_REQ               0x0022
     90 #define GC_DAR_GET_INFO_REQ             0x0023
     91 #define GC_AMR_RECORD_START_REQ         0x0030
     92 #define GC_AMR_RECORD_STOP_REQ          0x0031
     93 #define GC_AMR_PLAY_START_REQ           0x0032
     94 #define GC_AMR_PLAY_STOP_REQ            0x0033
     95 #define GC_AMR_GET_STATUS_REQ           0x0034
     96 #define GC_AMR_PURGE_PLAY_BUFFER_REQ    0x0035
     97 #define GC_ABB_REGISTER_REQ             0x0040
     98 #define GC_AUDIO_ENHECHOCANC_REQ        0x0041
     99 
    100 #define GC_READ_MEM_RES                 0x1000
    101 #define GC_SW_VERSION_RES               0x1001
    102 #define GC_HW_VERSION_RES               0x1002
    103 #define GC_BATTERY_STATUS_RES           0x1005
    104 #define GC_AUDIO_VOICEBANDCTL_RES       0x1006
    105 #define GC_AUDIO_OUTPUTCTL_RES          0x1007
    106 #define GC_AUDIO_STEREO_CODEC_RES       0x1008
    107 #define GC_AUDIO_PROFILE_LOAD_RES       0x1019
    108 #define GC_FFS_INIT_RESTORE_RES         0x1020
    109 #define GC_FFS_BACKUP_RES               0x1022
    110 #define GC_DAR_GET_INFO_RES             0x1023
    111 #define GC_AMR_RECORD_START_RES         0x1030
    112 #define GC_AMR_RECORD_STOP_RES          0x1031
    113 #define GC_AMR_PLAY_START_RES           0x1032
    114 #define GC_AMR_PLAY_STOP_RES            0x1033
    115 #define GC_AMR_GET_STATUS_RES           0x1034
    116 #define GC_ABB_REGISTER_RES             0x1040
    117 
    118 #endif
    119 
    120 /* tty ioctls */
    121 
    122 #define OMAP_CSMI_TTY_ENABLE_ACK _IO('c', 0)
    123 #define OMAP_CSMI_TTY_DISABLE_ACK _IO('c', 1)
    124 #define OMAP_CSMI_TTY_READ_UNACKED _IOR('c', 2, int)
    125 #define OMAP_CSMI_TTY_ACK _IOW('c', 3, int)
    126 #define OMAP_CSMI_TTY_WAKEUP_AND_ACK _IOW('c', 4, int)
    127 
    128 #endif
    129