Commit 61d3a1bd6ee464535303f61331335a7ea907e643

  • avatar
  • Markinus <markus @Kubu…uVM.(none)>
  • Sat Jan 16 01:49:32 CET 2010
Removed static config cases, replaces with dynamic code
  
185185CONFIG_MSM_AMSS_VERSION=5200
186186CONFIG_MSM_AMSS_VERSION_WINCE=y
187187CONFIG_MSM_AMSS_VERSION_5200=y
188# CONFIG_MSM_AMSS_VERSION_6120 is not set
188CONFIG_MSM_AMSS_VERSION_6120=y
189189# CONFIG_MSM_AMSS_VERSION_6125 is not set
190# CONFIG_MSM_AMSS_VERSION_6150 is not set
191# CONFIG_MSM_AMSS_VERSION_6210 is not set
192# CONFIG_MSM_AMSS_VERSION_6220 is not set
190# CONFIG_MSM_AMSS_VERSION_6150=y
191# CONFIG_MSM_AMSS_VERSION_6210=y
192# CONFIG_MSM_AMSS_VERSION_6220=y
193193# CONFIG_MSM_AMSS_VERSION_6225 is not set
194194CONFIG_MSM_DEBUG_UART_NONE=y
195195# CONFIG_MSM_DEBUG_UART1 is not set
  
132132 msg.msg[1] = cpu_to_be32 (0);
133133 msg.msg[2] = cpu_to_be32 (0);
134134 msg.msg[3] = cpu_to_be32 (PD_CLIENT_ID);
135 rc =
136 msm_rpc_call (ept, END_SESSION, &msg, 4*4 + sizeof (struct rpc_request_hdr), 15 * HZ);
135 rc = msm_rpc_call (ept, END_SESSION, &msg, 4*4 + sizeof (struct rpc_request_hdr), 15 * HZ);
137136 if (rc < 0)
138137 printk ("ERROR: %s:%d %d\n", __func__, __LINE__, rc);
139138
  
291291 }
292292}
293293
294#define PM_LIBPROG 0x30000061
295#if (CONFIG_MSM_AMSS_VERSION == 6220) || (CONFIG_MSM_AMSS_VERSION == 6225)
296#define PM_LIBVERS 0xfb837d0b
297#else
298#define PM_LIBVERS 0x10001
299#endif
300
301294#if 0
302295static struct platform_device *msm_serial_devices[] __initdata = {
303296 &msm_device_uart1,
  
1717#include <linux/delay.h>
1818#include <linux/rfkill.h>
1919#include <asm/mach-types.h>
20#include <mach/amss_para.h>
2021
2122#include "vogue_gps.h"
2223#include "nmea.h"
2324
24#define RPC_PDAPI_PROG 0x3000005b
25#define RPC_PDAPI_CB_PROG 0x3100005b
26
2725struct rpc_ids {
2826 uint32_t client_init;
2927 uint32_t client_pd_reg;
3333 uint32_t client_deact;
3434 uint32_t get_position;
3535 uint32_t end_session;
36 uint32_t pd_reg_msg4;
37 uint32_t pa_reg_msg4;
3638} ids;
3739
3840struct rpc_ids ids_6120 = {
4848 .client_deact = 0xa,
4949 .get_position = 0xb,
5050 .end_session = 0xc,
51 .pd_reg_msg4 = 0xf3f0ffff,
52 .pa_reg_msg4 = 0x07ffefe0,
5153};
5254struct rpc_ids ids_5200 = {
5355 .client_init = 3,
6262 .client_deact = 0xb,
6363 .get_position = 0xc,
6464 .end_session = 0xd,
65 .pd_reg_msg4 = 0xf310ffff,
66 .pa_reg_msg4 = 0x003fefe0,
6567};
6668
6769#define RPC_PDSM_ATL_PROG 0x3000001d
118118}
119119
120120static struct msm_rpc_server pdapi_rpc_server = {
121 .prog = RPC_PDAPI_CB_PROG,
122121 .vers = 0,
123122 .rpc_call = handle_pdapi_rpc_call,
124123};
125124
126125static struct msm_rpc_server pdsm_atl_rpc_server = {
127 .prog = RPC_PDSM_ATL_CB_PROG,
128126 .vers = 0,
129127 .rpc_call = handle_pdsm_atl_rpc_call,
130128};
141141 } rep;
142142
143143 /* register CB */
144 pdapi_rpc_server.prog = amss_get_num_value(RPC_PDAPI_CB_PROG);
145 pdsm_atl_rpc_server.prog = amss_get_num_value(RPC_PDSM_ATL_CB_PROG);
144146 msm_rpc_create_server(&pdapi_rpc_server);
145147 msm_rpc_create_server(&pdsm_atl_rpc_server);
146148
163163 msg.msg[1] = cpu_to_be32 (0x0);
164164 msg.msg[2] = cpu_to_be32 (0x0);
165165 msg.msg[3] = cpu_to_be32 (0x0);
166#if (CONFIG_MSM_AMSS_VERSION == 6120) || (CONFIG_MSM_AMSS_VERSION == 6125)
167 msg.msg[4] = cpu_to_be32 (0xf3f0ffff);
168#elif (CONFIG_MSM_AMSS_VERSION == 5200) || (CONFIG_MSM_AMSS_VERSION == 6150)
169 msg.msg[4] = cpu_to_be32 (0xf310ffff);
170#else
171#error "Unknown AMSS version"
172#endif
166 msg.msg[4] = cpu_to_be32 (ids.pd_reg_msg4);
173167 msg.msg[5] = cpu_to_be32 (0xffffffff);
174168 rc = msm_rpc_call_reply (ept, ids.client_pd_reg, &msg,
175169 6*4 + sizeof (struct rpc_request_hdr),
207207 msg.msg[1] = cpu_to_be32 (0x0);
208208 msg.msg[2] = cpu_to_be32 (0x2);
209209 msg.msg[3] = cpu_to_be32 (0x0);
210#if (CONFIG_MSM_AMSS_VERSION == 6120) || (CONFIG_MSM_AMSS_VERSION == 6125)
211 msg.msg[4] = cpu_to_be32 (0x07ffefe0);
212#elif (CONFIG_MSM_AMSS_VERSION == 5200) || (CONFIG_MSM_AMSS_VERSION == 6150)
213 msg.msg[4] = cpu_to_be32 (0x003fefe0);
214#else
215#error "Unknown AMSS version"
216#endif
210 msg.msg[4] = cpu_to_be32 (ids.pa_reg_msg4);
217211 msg.msg[5] = cpu_to_be32 (0xffffffff);
218212 rc = msm_rpc_call (ept, CLIENT_PD_REG, &msg,
219213 6*4 + sizeof (struct rpc_request_hdr),
282282 switch (state) {
283283 case RFKILL_STATE_ON:
284284 if(!ept) {
285 ept = msm_rpc_connect (RPC_PDAPI_PROG, 0, MSM_RPC_UNINTERRUPTIBLE);
285 ept = msm_rpc_connect (
286 amss_get_num_value(RPC_PDAPI_PROG),
287 0,
288 MSM_RPC_UNINTERRUPTIBLE);
286289 if (!ept || IS_ERR (ept)) {
287290 printk ("msm_rpc_connect failed (%d)\n", (int) ept);
288291 return -1;
  
4444#include <asm/pgtable.h>
4545#include <asm/mach/map.h>
4646#include "../../../drivers/video/msm/mdp_hw.h"
47#include <asm/mach-types.h>
4748
4849
4950/* Defined in /arch/arm/mm/mmu.c, helps us map physical memory to virtual memory.
6060/* Green message (color = 2), the reset color to white (color = 6) */
6161#define HTC_FB_MSG ("\n\n" "\x1b" "2" "HTC Linux framebuffer console by druidu" "\x1b" "7" "\n\n")
6262
63/* LCD resolution */
64#define HTC_FB_LCD_WIDTH 480
65#if defined(CONFIG_MACH_HTCBLACKSTONE) || defined(CONFIG_MACH_HTCKOVSKY) || defined(CONFIG_MACH_HTCTOPAZ)|| defined(CONFIG_MACH_HTCRHODIUM)
66#define HTC_FB_LCD_HEIGHT 800
67#else
68#define HTC_FB_LCD_HEIGHT 640
69#endif
63struct fb_para {
64 uint32_t htc_fb_lcd_width;
65 uint32_t htc_fb_lcd_height;
66 uint32_t htc_fb_phys;
67 uint32_t htc_fb_off;
68 uint32_t htc_fb_size;
69 uint32_t htc_fb_con_max_rows;
70 uint32_t htc_fb_con_max_cols;
71} para;
7072
71/* Set max console size for a 4x4 font */
72#define HTC_FB_CON_MAX_ROWS (HTC_FB_LCD_WIDTH / 4)
73#define HTC_FB_CON_MAX_COLS (HTC_FB_LCD_HEIGHT / 4)
73struct fb_para blackstone_para = {
74 .htc_fb_lcd_width = 480,
75 .htc_fb_lcd_height = 800,
76 .htc_fb_phys = 0x16800000,
77 .htc_fb_off = 0x0006a000,
78 .htc_fb_size = 0x00200000,
79 .htc_fb_con_max_rows = 120,
80 .htc_fb_con_max_cols = 200,
81};
7482
83struct fb_para topaz_para = {
84 .htc_fb_lcd_width = 480,
85 .htc_fb_lcd_height = 800,
86 .htc_fb_phys = 0x15100000,
87 .htc_fb_off = 0x00000780,
88 .htc_fb_size = 0x00200000,
89 .htc_fb_con_max_rows = 120,
90 .htc_fb_con_max_cols = 200,
91};
92
93struct fb_para default_para = {
94 .htc_fb_lcd_width = 480, /* LCD resolution width*/
95 .htc_fb_lcd_height = 640, /* LCD resolution height*/
96 .htc_fb_phys = 0x16800000, /* physical page for our fb */
97 .htc_fb_off = 0x0006a000, /* offset in the page to start of fb */
98 .htc_fb_size = 0x00100000, /* map 1 MB (640 * 480 * 2 rounded properly) */
99 .htc_fb_con_max_rows = 120, /* Set max console size for a 4x4 font */
100 .htc_fb_con_max_cols = 160, /* Set max console size for a 4x4 font */
101};
102
103
75104/* Framebuffer stuff */
76105#define HTC_FB_BASE 0xe2000000 /* virtual page for our fb */
77106
78#if defined(CONFIG_MACH_HTCBLACKSTONE) || defined(CONFIG_MACH_HTCKOVSKY)
79#define HTC_FB_PHYS 0x16800000 /* physical page for our fb */
80#define HTC_FB_OFF 0x0006a000 /* offset in the page to start of fb */
81#define HTC_FB_SIZE 0x00200000 /* map 2 MB (640 * 480 * 2 rounded properly) */
82#elif defined(CONFIG_MACH_HTCTOPAZ)|| defined(CONFIG_MACH_HTCRHODIUM)
83#define HTC_FB_PHYS 0x15100000 /* physical page for our fb */
84#define HTC_FB_OFF 0x00000780 /* offset in the page to start of fb */
85#define HTC_FB_SIZE 0x00200000 /* map 2 MB (640 * 480 * 2 rounded properly) */
86#else
87#define HTC_FB_PHYS 0x16800000 /* physical page for our fb */
88#define HTC_FB_OFF 0x0006a000 /* offset in the page to start of fb */
89#define HTC_FB_SIZE 0x00100000 /* map 1 MB (640 * 480 * 2 rounded properly) */
90#endif
91
92107/* Pack color data in 565 RGB format; r and b are 5 bits, g is 6 bits */
93108#define HTC_FB_RGB(r, g, b) ((((r) & 0x1f) << 11) | (((g) & 0x3f) << 5) | (((b) & 0x1f) << 0))
94109
137137/* Current fg / bg colors */
138138unsigned char htc_fb_cur_fg, htc_fb_cur_bg;
139139
140/* Buffer to hold characters and attributes */
141unsigned char htc_fb_chars[HTC_FB_CON_MAX_ROWS][HTC_FB_CON_MAX_COLS];
142unsigned char htc_fb_fg[HTC_FB_CON_MAX_ROWS][HTC_FB_CON_MAX_COLS];
143unsigned char htc_fb_bg[HTC_FB_CON_MAX_ROWS][HTC_FB_CON_MAX_COLS];
140/* Buffer to hold characters and attributes, set it to the biggest size! */
141unsigned char htc_fb_chars[120][200];
142unsigned char htc_fb_fg[120][200];
143unsigned char htc_fb_bg[120][200];
144144
145145static void htc_fb_console_write(struct console *console, const char *s, unsigned int count);
146146
165165 unsigned short *ptr;
166166 unsigned char ch;
167167
168 fbram = HTC_FB_PHYS + HTC_FB_OFF;
169 memaddr = HTC_FB_BASE + HTC_FB_OFF;
168 fbram = para.htc_fb_phys + para.htc_fb_off;
169 memaddr = HTC_FB_BASE + para.htc_fb_off;
170170
171171 ptr = (unsigned short*) memaddr;
172172 for (i = 0; i < htc_fb_console_rows * htc_fb_font_rows; i++) {
180180 ? htc_fb_colors[htc_fb_fg[r1][c1]]
181181 : htc_fb_colors[htc_fb_bg[r1][c1]];
182182 }
183 ptr += HTC_FB_LCD_WIDTH - htc_fb_console_cols * htc_fb_font_cols;
183 ptr += para.htc_fb_lcd_width - htc_fb_console_cols * htc_fb_font_cols;
184184 }
185185
186 stride = HTC_FB_LCD_WIDTH * 2;
187 width = HTC_FB_LCD_WIDTH;
188 height = HTC_FB_LCD_HEIGHT;
186 stride = para.htc_fb_lcd_width * 2;
187 width = para.htc_fb_lcd_width;
188 height = para.htc_fb_lcd_height;
189189 x = 0;
190190 y = 0;
191191
226226static void htc_fb_console_clear(void)
227227{
228228 /* Default white on black, clear everything */
229 memset((void*) (HTC_FB_BASE + HTC_FB_OFF), 0, HTC_FB_LCD_WIDTH * HTC_FB_LCD_HEIGHT * 2);
229 memset((void*) (HTC_FB_BASE + para.htc_fb_off), 0, para.htc_fb_lcd_width * para.htc_fb_lcd_height * 2);
230230 memset(htc_fb_chars, 0, htc_fb_console_cols * htc_fb_console_rows);
231231 memset(htc_fb_fg, 7, htc_fb_console_cols * htc_fb_console_rows);
232232 memset(htc_fb_bg, 0, htc_fb_console_cols * htc_fb_console_rows);
327327static int __init htc_fb_console_init(void)
328328{
329329 struct map_desc map;
330 switch(__machine_arch_type) {
331 case MACH_TYPE_HTCTOPAZ:
332 case MACH_TYPE_HTCRHODIUM:
333 memcpy(&para, &topaz_para, sizeof(para));
334 break;
335 case MACH_TYPE_HTCBLACKSTONE:
336 case MACH_TYPE_HTCKOVSKY:
337 memcpy(&para, &blackstone_para, sizeof(para));
338 break;
339 default:
340 memcpy(&para, &default_para, sizeof(para));
341 break;
342 }
330343
331344 /* Map the framebuffer Windows was using, as we know the physical address */
332 map.pfn = __phys_to_pfn(HTC_FB_PHYS & SECTION_MASK);
345 map.pfn = __phys_to_pfn(para.htc_fb_phys & SECTION_MASK);
333346 map.virtual = HTC_FB_BASE;
334 map.length = ((unsigned long) HTC_FB_SIZE + ~SECTION_MASK) & SECTION_MASK;
347 map.length = ((unsigned long) para.htc_fb_size + ~SECTION_MASK) & SECTION_MASK;
335348 map.type = MT_MEMORY;
336349 /* Ugly hack, but we're not sure what works and what doesn't,
337350 * so better use the lowest level we have for setting the mapping */
338351 create_mapping(&map);
339352
340353 /* Init font (we support any font that has width <= 8; height doesn't matter) */
341 htc_fb_default_font = get_default_font(HTC_FB_LCD_WIDTH, HTC_FB_LCD_HEIGHT, 0xFF, 0xFFFFFFFF);
354 htc_fb_default_font = get_default_font(para.htc_fb_lcd_width, para.htc_fb_lcd_height, 0xFF, 0xFFFFFFFF);
342355 if (!htc_fb_default_font) {
343356 printk(KERN_WARNING "Can't find a suitable font for htc_fb");
344357 return -1;
360360 htc_fb_font_data = htc_fb_default_font->data;
361361 htc_fb_font_cols = htc_fb_default_font->width;
362362 htc_fb_font_rows = htc_fb_default_font->height;
363 htc_fb_console_cols = HTC_FB_LCD_WIDTH / htc_fb_font_cols;
364 if (htc_fb_console_cols > HTC_FB_CON_MAX_COLS)
365 htc_fb_console_cols = HTC_FB_CON_MAX_COLS;
366 htc_fb_console_rows = HTC_FB_LCD_HEIGHT / htc_fb_font_rows;
367 if (htc_fb_console_rows > HTC_FB_CON_MAX_ROWS)
368 htc_fb_console_rows = HTC_FB_CON_MAX_ROWS;
363 htc_fb_console_cols = para.htc_fb_lcd_width / htc_fb_font_cols;
364 if (htc_fb_console_cols > para.htc_fb_con_max_cols)
365 htc_fb_console_cols = para.htc_fb_con_max_cols;
366 htc_fb_console_rows = para.htc_fb_lcd_height / htc_fb_font_rows;
367 if (htc_fb_console_rows > para.htc_fb_con_max_rows)
368 htc_fb_console_rows = para.htc_fb_con_max_rows;
369369
370370 /* Clear the buffer; we could probably see the Haret output if we didn't clear
371371 * the buffer (if it used same physical address) */
  
1/*
2 * Author: Markinus
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#ifndef _ARCH_ARM_MACH_MSM_AMSS_PARA_H
16#define _ARCH_ARM_MACH_MSM_AMSS_PARA_H
17
18
19struct amss_value {
20 int id;
21 uint32_t numval;
22 char* strval;
23};
24
25// The enum with AMSS IDs, it have to have the same order and size as the default para struct in the c file!
26enum amss_ids {
27 AUDMGR_PROG_VERS=0,
28 AUDMGR_PROG,
29 AUDMGR_VERS,
30 AUDMGR_CB_PROG_VERS,
31 AUDMGR_CB_PROG,
32 AUDMGR_CB_VERS,
33 TIME_REMOTE_MTOA_PROG,
34 TIME_REMOTE_MTOA_VERS,
35 RPC_TIME_REMOTE_MTOA_NULL,
36 RPC_TIME_TOD_SET_APPS_BASES,
37 PM_LIBPROG,
38 PM_LIBVERS,
39 RPC_SND_PROG,
40 RPC_SND_VERS,
41 SND_SET_DEVICE_PROC,
42 SND_SET_VOLUME_PROC,
43 RPC_ADSP_RTOS_ATOM_PROG_VERS,
44 RPC_ADSP_RTOS_ATOM_PROG,
45 RPC_ADSP_RTOS_ATOM_VERS,
46 RPC_ADSP_RTOS_MTOA_PROG,
47 RPC_ADSP_RTOS_MTOA_VERS,
48 RPC_ADSP_RTOS_ATOM_NULL_PROC,
49 RPC_ADSP_RTOS_MTOA_NULL_PROC,
50 RPC_ADSP_RTOS_APP_TO_MODEM_PROC,
51 RPC_ADSP_RTOS_MODEM_TO_APP_PROC,
52 RPC_DOG_KEEPALIVE_NULL,
53 RPC_DOG_KEEPALIVE_BEACON,
54 DOG_KEEPALIVE_PROG,
55 DOG_KEEPALIVE_VERS,
56 RPC_PDAPI_PROG,
57 RPC_PDAPI_CB_PROG
58};
59
60extern uint32_t amss_get_num_value(int);
61
62extern void amss_get_str_value(int, char*, size_t);
63
64
65#endif //LOCK
  
1818#include <linux/err.h>
1919#include <linux/hrtimer.h>
2020#include <linux/timed_output.h>
21#include <mach/amss_para.h>
2122
2223#include <mach/msm_rpcrouter.h>
2324
2425#include "proc_comm_wince.h"
2526
26#define PM_LIBPROG 0x30000061
27#if (CONFIG_MSM_AMSS_VERSION == 6220) || (CONFIG_MSM_AMSS_VERSION == 6225)
28#define PM_LIBVERS 0xfb837d0b
29#elif (CONFIG_MSM_AMSS_VERSION == 6120)
30#define PM_LIBVERS 0x0
31#else
32#define PM_LIBVERS 0x10001
33#endif
34
3527#define HTC_PROCEDURE_SET_VIB_ON_OFF 21
3628#define PMIC_VIBRATOR_LEVEL (3000)
3729
4242 } req;
4343
4444 if (!vib_endpoint) {
45 vib_endpoint = msm_rpc_connect(PM_LIBPROG, PM_LIBVERS, 0);
45 vib_endpoint = msm_rpc_connect(
46 amss_get_num_value(PM_LIBPROG),
47 amss_get_num_value(PM_LIBVERS),
48 0);
4649 if (IS_ERR(vib_endpoint)) {
4750 printk(KERN_ERR "init vib rpc failed!\n");
4851 vib_endpoint = 0;
  
1515obj-y += adsp_lpm_verify_cmd.o
1616obj-y += audio_out.o audio_in.o audio_mp3.o audmgr.o audpp.o
1717obj-y += snd.o
18obj-y += amss_para.o
1819
1920obj-y += adsp_5200.o
2021obj-y += adsp_6120.o
  
3535#include <linux/wakelock.h>
3636#include <asm/mach-types.h>
3737#include "../smd_rpcrouter.h"
38#include <mach/amss_para.h>
3839
3940static struct wake_lock adsp_wake_lock;
4041static inline void prevent_suspend(void)
9191 struct rpc_reply_hdr *rpc_rsp;
9292
9393 msm_rpc_setup_req(&rpc_req.hdr,
94 RPC_ADSP_RTOS_ATOM_PROG,
95 RPC_ADSP_RTOS_ATOM_VERS,
96 RPC_ADSP_RTOS_APP_TO_MODEM_PROC);
94 amss_get_num_value(RPC_ADSP_RTOS_ATOM_PROG),
95 amss_get_num_value(RPC_ADSP_RTOS_ATOM_VERS),
96 amss_get_num_value(RPC_ADSP_RTOS_APP_TO_MODEM_PROC));
9797
9898 rpc_req.gotit = cpu_to_be32(1);
9999 rpc_req.cmd = cpu_to_be32(cmd);
153153static int adsp_rpc_init(struct msm_adsp_module *adsp_module)
154154{
155155 adsp_module->rpc_client = msm_rpc_connect(
156 RPC_ADSP_RTOS_ATOM_PROG,
157 RPC_ADSP_RTOS_ATOM_VERS,
158 MSM_RPC_UNINTERRUPTIBLE);
156 amss_get_num_value(RPC_ADSP_RTOS_ATOM_PROG),
157 amss_get_num_value(RPC_ADSP_RTOS_ATOM_VERS),
158 amss_get_num_value(MSM_RPC_UNINTERRUPTIBLE));
159159
160160 if (IS_ERR(adsp_module->rpc_client)) {
161161 int rc = PTR_ERR(adsp_module->rpc_client);
433433
434434static void handle_adsp_rtos_mtoa_app(struct rpc_request_hdr *req)
435435{
436 struct rpc_adsp_rtos_modem_to_app_args_t *args =
437 (struct rpc_adsp_rtos_modem_to_app_args_t *)req;
438 uint32_t event = be32_to_cpu(args->event);
439 uint32_t proc_id = be32_to_cpu(args->proc_id);
440 uint32_t module_id = be32_to_cpu(args->module);
441 uint32_t image = be32_to_cpu(args->image);
436 uint32_t event = 0;
437 uint32_t proc_id = 0;
438 uint32_t module_id = 0;
439 uint32_t image = 0;
440
441 switch(__machine_arch_type) {
442 case MACH_TYPE_HTCTOPAZ:
443 case MACH_TYPE_HTCRHODIUM: {
444 struct rpc_adsp_rtos_modem_to_app_args_t_6120 *args =
445 (struct rpc_adsp_rtos_modem_to_app_args_t_6120 *)req;
446 event = be32_to_cpu(args->event);
447 proc_id = be32_to_cpu(args->proc_id);
448 module_id = be32_to_cpu(args->module);
449 image = be32_to_cpu(args->image);
450 break;
451 }
452 default: {
453 struct rpc_adsp_rtos_modem_to_app_args_t *args =
454 (struct rpc_adsp_rtos_modem_to_app_args_t *)req;
455 event = be32_to_cpu(args->event);
456 proc_id = be32_to_cpu(args->proc_id);
457 module_id = be32_to_cpu(args->module);
458 image = be32_to_cpu(args->image);
459 break;
460 }
461 }
442462 struct msm_adsp_module *module;
443463
444464 pr_info("adsp: rpc event=%d, proc_id=%d, module=%d, image=%d\n",
510510
511511static int handle_adsp_rtos_mtoa(struct rpc_request_hdr *req)
512512{
513 switch (req->procedure) {
514 case RPC_ADSP_RTOS_MTOA_NULL_PROC:
513 if(req->procedure == amss_get_num_value(RPC_ADSP_RTOS_MTOA_NULL_PROC)) {
515514 rpc_send_accepted_void_reply(rpc_cb_server_client,
516515 req->xid,
517516 RPC_ACCEPTSTAT_SUCCESS);
518 break;
519 case RPC_ADSP_RTOS_MODEM_TO_APP_PROC:
517 }
518 else if(req->procedure == amss_get_num_value(RPC_ADSP_RTOS_MODEM_TO_APP_PROC)) {
520519 handle_adsp_rtos_mtoa_app(req);
521 break;
522 default:
520 }
521 else {
523522 pr_err("adsp: unknowned proc %d\n", req->procedure);
524523 rpc_send_accepted_void_reply(
525524 rpc_cb_server_client, req->xid,
526525 RPC_ACCEPTSTAT_PROC_UNAVAIL);
527 break;
528526 }
529527 return 0;
530528}
553553 goto bad_rpc;
554554 if (req->rpc_vers != 2)
555555 goto bad_rpc;
556 if (req->prog != RPC_ADSP_RTOS_MTOA_PROG)
556 if (req->prog != amss_get_num_value(RPC_ADSP_RTOS_MTOA_PROG))
557557 goto bad_rpc;
558 if (req->vers != RPC_ADSP_RTOS_MTOA_VERS)
558 if (req->vers != amss_get_num_value(RPC_ADSP_RTOS_MTOA_VERS))
559559 goto bad_rpc;
560560
561561 handle_adsp_rtos_mtoa(req);
880880 rpc_cb_server_client->cid=adsp_cid;
881881
882882 rc = msm_rpc_register_server(rpc_cb_server_client,
883 RPC_ADSP_RTOS_MTOA_PROG,
884 RPC_ADSP_RTOS_MTOA_VERS);
883 amss_get_num_value(RPC_ADSP_RTOS_MTOA_PROG),
884 amss_get_num_value(RPC_ADSP_RTOS_MTOA_VERS));
885885
886886 if (rc) {
887887 pr_err("adsp: could not register callback server (%d)\n", rc);
931931static struct platform_driver msm_adsp_driver = {
932932 .probe = msm_adsp_probe,
933933 .driver = {
934#if CONFIG_MSM_AMSS_VERSION == 6210
935 .name = "rs3000000a:20f17fd3",
936#elif (CONFIG_MSM_AMSS_VERSION == 6220) || (CONFIG_MSM_AMSS_VERSION == 6225)
937 .name = "rs3000000a:71d1094b",
938#elif (CONFIG_MSM_AMSS_VERSION == 5200) || (CONFIG_MSM_AMSS_VERSION == 6120) || (CONFIG_MSM_AMSS_VERSION == 6125)
939 .name = "rs3000000a:00000000",
940#elif CONFIG_MSM_AMSS_VERSION == 6150 /* TODO */
941 .name = "rs3000000a:00000000",
942#else
943#error "Unknown AMSS version"
944#endif
945934 .owner = THIS_MODULE,
946935 },
947936};
939939{
940940 int i;
941941 unsigned *rpcchan;
942 char drivename[20];
942943
943944 /*
944945 if(!adsp_cid) {
956956 printk("Using adsp_cid=%08x\n", adsp_cid);
957957 }
958958 */
959 amss_get_str_value(RPC_ADSP_RTOS_ATOM_PROG_VERS, drivename, sizeof(drivename));
960 msm_adsp_driver.driver.name = drivename;
961 pr_err("ADSP DRIVERNAME: %s \n", msm_adsp_driver.driver.name);
959962
960963 return platform_driver_register(&msm_adsp_driver);
961964}
  
110110 uint32_t event_backlog_max;
111111};
112112
113#define RPC_ADSP_RTOS_ATOM_PROG 0x3000000a
114#define RPC_ADSP_RTOS_MTOA_PROG 0x3000000b
115#define RPC_ADSP_RTOS_ATOM_NULL_PROC 0
116#define RPC_ADSP_RTOS_MTOA_NULL_PROC 0
117#define RPC_ADSP_RTOS_APP_TO_MODEM_PROC 1
118#define RPC_ADSP_RTOS_MODEM_TO_APP_PROC 1
119
120//Move that to adsp_info ?
121#if CONFIG_MSM_AMSS_VERSION == 6210
122#define RPC_ADSP_RTOS_ATOM_VERS 0x20f17fd3
123#define RPC_ADSP_RTOS_MTOA_VERS 0x75babbd6
124#elif (CONFIG_MSM_AMSS_VERSION == 6220) || (CONFIG_MSM_AMSS_VERSION == 6225)
125#define RPC_ADSP_RTOS_ATOM_VERS 0x71d1094b
126#define RPC_ADSP_RTOS_MTOA_VERS 0xee3a9966
127#elif (CONFIG_MSM_AMSS_VERSION == 5200) || (CONFIG_MSM_AMSS_VERSION == 6150) || (CONFIG_MSM_AMSS_VERSION == 6120) || (CONFIG_MSM_AMSS_VERSION == 6125)
128#define RPC_ADSP_RTOS_ATOM_VERS 0x0
129#define RPC_ADSP_RTOS_MTOA_VERS 0x0
130#else
131#error "Unknown AMSS version"
132#endif
133
134113enum rpc_adsp_rtos_proc_type {
135114 RPC_ADSP_RTOS_PROC_NONE = 0,
136115 RPC_ADSP_RTOS_PROC_MODEM = 1,
151151 uint32_t proc_id; /* e.g., RPC_ADSP_RTOS_PROC_APPS */
152152 uint32_t module; /* e.g., QDSP_MODULE_AUDPPTASK */
153153 uint32_t image; /* RPC_QDSP_IMAGE_GAUDIO */
154#if (CONFIG_MSM_AMSS_VERSION == 6120) || (CONFIG_MSM_AMSS_VERSION == 6125)
154};
155
156struct rpc_adsp_rtos_modem_to_app_args_t_6120 {
157 struct rpc_request_hdr hdr;
158 uint32_t gotit; /* if 1, the next elements are present */
159 uint32_t event; /* e.g., RPC_ADSP_RTOS_CMD_REGISTER_APP */
160 uint32_t proc_id; /* e.g., RPC_ADSP_RTOS_PROC_APPS */
161 uint32_t module; /* e.g., QDSP_MODULE_AUDPPTASK */
162 uint32_t image; /* RPC_QDSP_IMAGE_GAUDIO */
155163 uint32_t unknown; /* unknown*/
156#endif
157164};
158165
159166#define ADSP_STATE_DISABLED 0
  
1/*
2 * Author: Markinus
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14#include <linux/init.h>
15
16#include <linux/module.h>
17#include <linux/mutex.h>
18#include <linux/err.h>
19
20#include <asm/mach-types.h>
21#include <mach/amss_para.h>
22
23// The struckt array with the AMSS default Values, it have to have the same order and size as the enum with AMSS IDs in the Heaader File!
24struct amss_value amss_def_para[] = {
25 {AUDMGR_PROG_VERS,0, "rs30000013:e94e8f0c"},
26 {AUDMGR_PROG, 0x30000013, ""},
27 {AUDMGR_VERS, 0xe94e8f0c, ""},
28 {AUDMGR_CB_PROG_VERS,0, "rs31000013:21570ba7"},
29 {AUDMGR_CB_PROG, 0x31000013, ""},
30 {AUDMGR_CB_VERS, 0x21570ba7, ""},
31 {TIME_REMOTE_MTOA_PROG, 0x3000005d, ""},
32 {TIME_REMOTE_MTOA_VERS, 0, ""},
33 {RPC_TIME_REMOTE_MTOA_NULL, 0, ""},
34 {RPC_TIME_TOD_SET_APPS_BASES, 1, ""},
35 {PM_LIBPROG, 0x30000061, ""},
36 {PM_LIBVERS, 0x10001, ""},
37 {RPC_SND_PROG, 0x30000002, ""},
38 {RPC_SND_VERS, 0x0, ""},
39 {SND_SET_DEVICE_PROC, 1, ""},
40 {SND_SET_VOLUME_PROC, 2, ""},
41 {RPC_ADSP_RTOS_ATOM_PROG_VERS, 0, ""},
42 {RPC_ADSP_RTOS_ATOM_PROG, 0x3000000a, ""},
43 {RPC_ADSP_RTOS_ATOM_VERS, 0x0, ""},
44 {RPC_ADSP_RTOS_MTOA_PROG, 0x3000000b, ""},
45 {RPC_ADSP_RTOS_MTOA_VERS, 0x0, ""},
46 {RPC_ADSP_RTOS_ATOM_NULL_PROC, 0, ""},
47 {RPC_ADSP_RTOS_MTOA_NULL_PROC, 0, ""},
48 {RPC_ADSP_RTOS_APP_TO_MODEM_PROC, 1, ""},
49 {RPC_ADSP_RTOS_MODEM_TO_APP_PROC, 1, ""},
50 {RPC_DOG_KEEPALIVE_NULL, 0, ""},
51 {RPC_DOG_KEEPALIVE_BEACON, 1, ""},
52 {DOG_KEEPALIVE_PROG, 0x30000015, ""},
53 {DOG_KEEPALIVE_VERS, 0, ""},
54 {RPC_PDAPI_PROG, 0x3000005b, ""},
55 {RPC_PDAPI_CB_PROG, 0x3100005b, ""},
56};
57
58
59// Now the version spezificly values
60struct amss_value amss_6120_para[] = {
61 {AUDMGR_PROG_VERS,0, "rs30000013:00000000"},
62 {AUDMGR_VERS, 0x0, ""},
63 {AUDMGR_CB_PROG_VERS,0, "rs31000013:00000000"},
64 {AUDMGR_CB_VERS, 0x00000000, ""},
65 {RPC_SND_VERS, 0xaa2b1a44, ""},
66 {SND_SET_DEVICE_PROC, 2, ""},
67 {SND_SET_VOLUME_PROC, 3, ""},
68 {RPC_ADSP_RTOS_ATOM_PROG_VERS, 0, "rs3000000a:00000000"},
69 {RPC_ADSP_RTOS_ATOM_VERS, 0x0, ""},
70 {RPC_ADSP_RTOS_MTOA_VERS, 0x0, ""},
71};
72
73struct amss_value amss_6210_para[] = {
74 {AUDMGR_PROG_VERS,0, "rs30000013:46255756"},
75 {AUDMGR_VERS, 0x46255756, ""},
76 {AUDMGR_CB_PROG_VERS,0, "rs31000013:5fa922a9"},
77 {AUDMGR_CB_VERS, 0x5fa922a9, ""},
78 {TIME_REMOTE_MTOA_VERS, 0, ""},
79 {RPC_TIME_TOD_SET_APPS_BASES, 2, ""},
80 {PM_LIBVERS, 0x0, ""},
81 {RPC_SND_VERS, 0x94756085, ""},
82 {SND_SET_DEVICE_PROC, 2, ""},
83 {SND_SET_VOLUME_PROC, 3, ""},
84 {RPC_ADSP_RTOS_ATOM_PROG_VERS, 0, "rs3000000a:20f17fd3"},
85 {RPC_ADSP_RTOS_ATOM_VERS, 0x20f17fd3, ""},
86 {RPC_ADSP_RTOS_MTOA_VERS, 0x75babbd6, ""},
87 {RPC_DOG_KEEPALIVE_BEACON, 1, ""},
88 {DOG_KEEPALIVE_VERS, 0, ""},
89};
90
91struct amss_value amss_6220_para[] = {
92 {TIME_REMOTE_MTOA_VERS, 0x731fa727, ""},
93 {RPC_TIME_TOD_SET_APPS_BASES, 2, ""},
94 {PM_LIBVERS, 0xfb837d0b, ""},
95 {RPC_ADSP_RTOS_ATOM_PROG_VERS, 0, "rs3000000a:71d1094b"},
96 {RPC_ADSP_RTOS_ATOM_VERS, 0x71d1094b, ""},
97 {RPC_ADSP_RTOS_MTOA_VERS, 0xee3a9966, ""},
98 {RPC_DOG_KEEPALIVE_BEACON, 2, ""},
99 {DOG_KEEPALIVE_VERS, 0x731fa727, ""},
100};
101
102
103struct amss_value amss_5200_para[] = {
104 {AUDMGR_PROG_VERS,0, "rs30000013:00000000"},
105 {AUDMGR_VERS, 0x0, ""},
106 {AUDMGR_CB_PROG_VERS,0, "rs31000013:5fa922a9"},
107 {AUDMGR_CB_VERS, 0x5fa922a9, ""},
108 {RPC_SND_VERS, 0x0, ""},
109 {SND_SET_DEVICE_PROC, 1, ""},
110 {SND_SET_VOLUME_PROC, 2, ""},
111 {RPC_ADSP_RTOS_ATOM_PROG_VERS, 0, "rs3000000a:00000000"},
112 {RPC_ADSP_RTOS_ATOM_VERS, 0x0, ""},
113 {RPC_ADSP_RTOS_MTOA_VERS, 0x0, ""},
114};
115
116struct amss_value amss_6150_para[] = {
117 {AUDMGR_PROG_VERS,0, "rs30000013:00000000"},
118 {AUDMGR_VERS, 0x0, ""},
119 {RPC_ADSP_RTOS_ATOM_PROG_VERS, 0, "rs3000000a:00000000"},
120};
121
122// Function to init of the struct and get the Values, Init in first call.
123
124int amss_get_value(int id, uint32_t numval, char* strval, size_t size)
125{
126 static struct amss_value *active_para = NULL;
127 struct amss_value *mach_para;
128 static uint8_t init = 0, i;
129 uint32_t nbr_para = 0;
130 if(!init) { // First run, init the struct
131 pr_err("INIT AMSS PARA!, size: %d\n", sizeof(amss_def_para));
132 // Initializes the default patameters
133 active_para = kmalloc(sizeof(amss_def_para), GFP_KERNEL);
134 memcpy(active_para, &amss_def_para, sizeof(amss_def_para));
135 // Get the right struct
136 switch(__machine_arch_type) {
137 case MACH_TYPE_HTCTOPAZ:
138 case MACH_TYPE_HTCRHODIUM:
139 mach_para = amss_6120_para;
140 nbr_para = ARRAY_SIZE(amss_6120_para);
141 break;
142 case MACH_TYPE_HTCRAPHAEL:
143 case MACH_TYPE_HTCDIAMOND:
144 case MACH_TYPE_HTCBLACKSTONE:
145 mach_para = amss_5200_para;
146 nbr_para = ARRAY_SIZE(amss_5200_para);
147 break;
148 case MACH_TYPE_HTCRAPHAEL_CDMA:
149 case MACH_TYPE_HTCRAPHAEL_CDMA500:
150 case MACH_TYPE_HTCDIAMOND_CDMA:
151 mach_para = amss_6150_para;
152 nbr_para = ARRAY_SIZE(amss_6150_para);
153 break;
154 default:
155 printk(KERN_ERR "Unsupported device for adsp driver\n");
156 strval = "";
157 numval = 0;
158 return -ENODEV;
159 break;
160 }
161 // Set the versionspezificly values
162 for(i=0; i<nbr_para; i++) {
163 active_para[mach_para[i].id].numval = mach_para[i].numval;
164 active_para[mach_para[i].id].strval = kmalloc(sizeof(mach_para[i].strval)+1, GFP_KERNEL);
165 strcpy(active_para[mach_para[i].id].strval, mach_para[i].strval);
166 }
167
168 init = 1;
169 }
170 // Struct ready, get Value and exit
171 if(active_para[id].id != id) { // Check the array integrity
172 pr_err("AMSS Array mismatch! Check the parameters!\n");
173 strval = "";
174 numval = 0;
175 return -EINVAL;
176 }
177
178 numval = active_para[id].numval;
179 memcpy (strval, active_para[id].strval, size);
180 pr_err("AMSS ASK: %d GET: %x :%s\n", id, numval, strval);
181
182 return 0;
183
184}
185
186
187uint32_t amss_get_num_value(int id)
188{
189 char* str = "";
190 uint32_t num = 0;
191 amss_get_value(id, num, str, 0);
192 return num;
193}
194
195void amss_get_str_value(int id, char* str, size_t size)
196{
197 uint32_t num = 0;
198 amss_get_value(id, num, str, size);
199}
200
  
2323
2424#include <asm/atomic.h>
2525#include <mach/msm_rpcrouter.h>
26#include <mach/amss_para.h>
2627
2728#include "audmgr.h"
2829
209209 if (am->state != STATE_CLOSED)
210210 return 0;
211211
212 am->ept = msm_rpc_connect(AUDMGR_PROG, AUDMGR_VERS,
213 MSM_RPC_UNINTERRUPTIBLE);
212 am->ept = msm_rpc_connect(
213 amss_get_num_value(AUDMGR_PROG),
214 amss_get_num_value(AUDMGR_VERS),
215 MSM_RPC_UNINTERRUPTIBLE);
214216 init_waitqueue_head(&am->wait);
215217
216218 if (IS_ERR(am->ept)) {
261261 msg.args.cb_func = cpu_to_be32(0x11111111);
262262 msg.args.client_data = cpu_to_be32(0x11223344);
263263
264 msm_rpc_setup_req(&msg.hdr, AUDMGR_PROG, AUDMGR_VERS,
264 msm_rpc_setup_req(&msg.hdr,
265 amss_get_num_value(AUDMGR_PROG),
266 amss_get_num_value(AUDMGR_VERS),
265267 AUDMGR_ENABLE_CLIENT);
266268
267269 rc = msm_rpc_write(am->ept, &msg, sizeof(msg));
290290 if (am->state == STATE_DISABLED)
291291 return 0;
292292
293 msm_rpc_setup_req(&msg.hdr, AUDMGR_PROG, AUDMGR_VERS,
293 msm_rpc_setup_req(&msg.hdr,
294 amss_get_num_value(AUDMGR_PROG),
295 amss_get_num_value(AUDMGR_VERS),
294296 AUDMGR_DISABLE_CLIENT);
295297 msg.handle = cpu_to_be32(am->handle);
296298
  
138138//#define AUDMGR_GET_TX_SAMPLE_RATE 9
139139//#define AUDMGR_SET_DEVICE_MODE 10
140140
141#if CONFIG_MSM_AMSS_VERSION == 6120
142#define AUDMGR_PROG_VERS "rs30000013:00000000"
143#define AUDMGR_PROG 0x30000013
144#define AUDMGR_VERS 0x0
145#elif CONFIG_MSM_AMSS_VERSION == 6210
146#define AUDMGR_PROG_VERS "rs30000013:46255756"
147#define AUDMGR_PROG 0x30000013
148#define AUDMGR_VERS 0x46255756
149#elif CONFIG_MSM_AMSS_VERSION == 5200
150#define AUDMGR_PROG_VERS "rs30000013:00000000"
151#define AUDMGR_PROG 0x30000013
152#define AUDMGR_VERS 0x0
153#elif CONFIG_MSM_AMSS_VERSION == 6150 /* TODO */
154#define AUDMGR_PROG_VERS "rs30000013:00000000"
155#define AUDMGR_PROG 0x30000013
156#define AUDMGR_VERS 0x0
157#else
158#define AUDMGR_PROG_VERS "rs30000013:e94e8f0c"
159#define AUDMGR_PROG 0x30000013
160#define AUDMGR_VERS 0xe94e8f0c
161#endif
162141
163142struct rpc_audmgr_cb_func_ptr {
164143 uint32_t cb_id;
154154#define AUDMGR_OPR_LSTNR_CB_FUNC_PTR 2
155155#define AUDMGR_CODEC_LSTR_FUNC_PTR 3
156156
157#if CONFIG_MSM_AMSS_VERSION == 6120
158#define AUDMGR_CB_PROG_VERS "rs31000013:00000000"
159#define AUDMGR_CB_PROG 0x31000013
160#define AUDMGR_CB_VERS 0x00000000
161#elif CONFIG_MSM_AMSS_VERSION == 6210
162#define AUDMGR_CB_PROG_VERS "rs31000013:5fa922a9"
163#define AUDMGR_CB_PROG 0x31000013
164#define AUDMGR_CB_VERS 0x5fa922a9
165#elif CONFIG_MSM_AMSS_VERSION == 5200
166#define AUDMGR_CB_PROG_VERS "rs31000013:00000000"
167#define AUDMGR_CB_PROG 0x31000013
168#define AUDMGR_CB_VERS 0x0
169#else
170#define AUDMGR_CB_PROG_VERS "rs31000013:21570ba7"
171#define AUDMGR_CB_PROG 0x31000013
172#define AUDMGR_CB_VERS 0x21570ba7
173#endif
174157
175158struct audmgr {
176159 wait_queue_head_t wait;
  
3030#include <mach/msm_rpcrouter.h>
3131#include <mach/htc_headset.h>
3232#include <asm/mach-types.h>
33#include <mach/amss_para.h>
3334
3435struct snd_ctxt {
3536 struct mutex lock;
4343static int force_headset=0;
4444module_param_named(force_headset, force_headset, int, S_IRUGO | S_IWUSR | S_IWGRP);
4545
46#define RPC_SND_PROG 0x30000002
4746
48#if CONFIG_MSM_AMSS_VERSION == 6210
49#define RPC_SND_VERS 0x94756085 /* 2490720389 */
50#define SND_SET_DEVICE_PROC 2
51#define SND_SET_VOLUME_PROC 3
52#elif (CONFIG_MSM_AMSS_VERSION == 6220) || (CONFIG_MSM_AMSS_VERSION == 6225) || (CONFIG_MSM_AMSS_VERSION == 6120) || (CONFIG_MSM_AMSS_VERSION == 6125)
53#elif (CONFIG_MSM_AMSS_VERSION == 5200) || (CONFIG_MSM_AMSS_VERSION == 6150)
54#endif
55#define RPC_SND_VERS_6120 0xaa2b1a44 /* 2854951492 */
56#define SND_SET_DEVICE_PROC_6120 2
57#define SND_SET_VOLUME_PROC_6120 3
58#define RPC_SND_VERS_5200 0x0
59#define SND_SET_DEVICE_PROC_5200 1
60#define SND_SET_VOLUME_PROC_5200 2
61
6247struct rpc_snd_set_device_args {
6348 uint32_t device;
6449 uint32_t ear_mute;
134134 pr_err("No sound endpoint found, can't set snd_device");
135135 return;
136136 }
137 switch(__machine_arch_type) {
138 case MACH_TYPE_HTCTOPAZ:
139 case MACH_TYPE_HTCRHODIUM:
140 msm_rpc_call(snd->ept,
141 SND_SET_DEVICE_PROC_6120,
142 &dmsg, sizeof(dmsg), 5 * HZ);
143 break;
144 case MACH_TYPE_HTCRAPHAEL:
145 case MACH_TYPE_HTCDIAMOND_CDMA:
146 case MACH_TYPE_HTCDIAMOND:
147 case MACH_TYPE_HTCBLACKSTONE:
148 case MACH_TYPE_HTCRAPHAEL_CDMA:
149 msm_rpc_call(snd->ept,
150 SND_SET_DEVICE_PROC_5200,
151 &dmsg, sizeof(dmsg), 5 * HZ);
152 break;
153 default:
154 printk(KERN_ERR "Unsupported device for snd_set_device driver\n");
155 break;
156 }
137 msm_rpc_call(snd->ept,
138 amss_get_num_value(SND_SET_DEVICE_PROC),
139 &dmsg, sizeof(dmsg), 5 * HZ);
140
157141}
158142EXPORT_SYMBOL(snd_set_device);
159143
188188
189189 pr_info("snd_set_device %d %d %d\n", dev.device,
190190 dev.ear_mute, dev.mic_mute);
191 switch(__machine_arch_type) {
192 case MACH_TYPE_HTCTOPAZ:
193 case MACH_TYPE_HTCRHODIUM:
194 rc = msm_rpc_call(snd->ept,
195 SND_SET_DEVICE_PROC_6120,
196 &dmsg, sizeof(dmsg), 5 * HZ);
197 break;
198 case MACH_TYPE_HTCRAPHAEL:
199 case MACH_TYPE_HTCDIAMOND_CDMA:
200 case MACH_TYPE_HTCDIAMOND:
201 case MACH_TYPE_HTCBLACKSTONE:
202 case MACH_TYPE_HTCRAPHAEL_CDMA:
203 rc = msm_rpc_call(snd->ept,
204 SND_SET_DEVICE_PROC_5200,
205 &dmsg, sizeof(dmsg), 5 * HZ);
206 break;
207 default:
208 printk(KERN_ERR "Unsupported device for snd_set_device driver\n");
209 rc = -ENODEV;
210 break;
211 }
191 rc = msm_rpc_call(snd->ept,
192 amss_get_num_value(SND_SET_DEVICE_PROC),
193 &dmsg, sizeof(dmsg), 5 * HZ);
212194
213195 break;
214196
237237 pr_info("snd_set_volume %d %d %d\n", vol.device,
238238 vol.method, vol.volume);
239239
240 switch(__machine_arch_type) {
241 case MACH_TYPE_HTCTOPAZ:
242 case MACH_TYPE_HTCRHODIUM:
243 rc = msm_rpc_call(snd->ept,
244 SND_SET_VOLUME_PROC_6120,
245 &vmsg, sizeof(vmsg), 5 * HZ);
246 break;
247 case MACH_TYPE_HTCRAPHAEL:
248 case MACH_TYPE_HTCDIAMOND_CDMA:
249 case MACH_TYPE_HTCDIAMOND:
250 case MACH_TYPE_HTCBLACKSTONE:
251 case MACH_TYPE_HTCRAPHAEL_CDMA:
252 rc = msm_rpc_call(snd->ept,
253 SND_SET_VOLUME_PROC_5200,
254 &vmsg, sizeof(vmsg), 5 * HZ);
255 break;
256 default:
257 printk(KERN_ERR "Unsupported device for snd_set_device driver\n");
258 rc = -ENODEV;
259 break;
260 }
261 break;
240 rc = msm_rpc_call(snd->ept,
241 amss_get_num_value(SND_SET_VOLUME_PROC),
242 &vmsg, sizeof(vmsg), 5 * HZ);
262243
244
263245 case SND_GET_NUM_ENDPOINTS:
264246 if (copy_to_user((void __user *)arg,
265247 &snd->snd_epts->num, sizeof(unsigned))) {
282282 mutex_lock(&snd->lock);
283283 if (snd->opened == 0) {
284284 if (snd->ept == NULL) {
285 switch(__machine_arch_type) {
286 case MACH_TYPE_HTCTOPAZ:
287 case MACH_TYPE_HTCRHODIUM:
288 snd->ept = msm_rpc_connect(RPC_SND_PROG, RPC_SND_VERS_6120,
289 MSM_RPC_UNINTERRUPTIBLE);
290 break;
291 case MACH_TYPE_HTCRAPHAEL:
292 case MACH_TYPE_HTCDIAMOND_CDMA:
293 case MACH_TYPE_HTCDIAMOND:
294 case MACH_TYPE_HTCBLACKSTONE:
295 case MACH_TYPE_HTCRAPHAEL_CDMA:
296 snd->ept = msm_rpc_connect(RPC_SND_PROG, RPC_SND_VERS_5200,
297 MSM_RPC_UNINTERRUPTIBLE);
298 break;
299 default:
300 printk(KERN_ERR "Unsupported device for qdsp/snd driver\n");
301 return -1;
302 break;
303 }
285 snd->ept = msm_rpc_connect(
286 amss_get_num_value(RPC_SND_PROG),
287 amss_get_num_value(RPC_SND_VERS),
288 MSM_RPC_UNINTERRUPTIBLE);
304289 if (IS_ERR(snd->ept)) {
305290 rc = PTR_ERR(snd->ept);
306291 snd->ept = NULL;
  
1717#include <linux/module.h>
1818#include <linux/kernel.h>
1919#include <mach/msm_rpcrouter.h>
20#include <mach/amss_para.h>
2021
2122/* dog_keepalive server definitions */
2223
23#define DOG_KEEPALIVE_PROG 0x30000015
24#define RPC_DOG_KEEPALIVE_NULL 0
2524
26#if CONFIG_MSM_AMSS_VERSION==6210
27 #define DOG_KEEPALIVE_VERS 0
28 #define RPC_DOG_KEEPALIVE_BEACON 1
29#elif (CONFIG_MSM_AMSS_VERSION==6220) || (CONFIG_MSM_AMSS_VERSION==6225)
30 #define DOG_KEEPALIVE_VERS 0x731fa727
31 #define RPC_DOG_KEEPALIVE_BEACON 2
32#else
33 #error "Unsupported AMSS version"
34#endif
35
3625static int handle_rpc_call(struct msm_rpc_server *server,
3726 struct rpc_request_hdr *req, unsigned len)
3827{
39 switch (req->procedure) {
40 case RPC_DOG_KEEPALIVE_NULL:
28 if (req->procedure == amss_get_num_value(RPC_DOG_KEEPALIVE_NULL))
4129 return 0;
42 case RPC_DOG_KEEPALIVE_BEACON:
30 else if (req->procedure == amss_get_num_value(RPC_DOG_KEEPALIVE_BEACON)) {
4331 printk(KERN_INFO "DOG KEEPALIVE PING\n");
4432 return 0;
45 default:
46 return -ENODEV;
4733 }
34 else
35 return -ENODEV;
36
4837}
4938
5039static struct msm_rpc_server rpc_server = {
51 .prog = DOG_KEEPALIVE_PROG,
52 .vers = DOG_KEEPALIVE_VERS,
5340 .rpc_call = handle_rpc_call,
5441};
5542
5643static int __init rpc_server_init(void)
5744{
45 rpc_server.prog = amss_get_num_value(DOG_KEEPALIVE_PROG);
46 rpc_server.vers = amss_get_num_value(DOG_KEEPALIVE_VERS);
5847 return msm_rpc_create_server(&rpc_server);
5948}
6049
  
1717#include <linux/module.h>
1818#include <linux/kernel.h>
1919#include <mach/msm_rpcrouter.h>
20#include <mach/amss_para.h>
2021
2122/* time_remote_mtoa server definitions. */
2223
23#define TIME_REMOTE_MTOA_PROG 0x3000005d
24#define RPC_TIME_REMOTE_MTOA_NULL 0
2524
26#if CONFIG_MSM_AMSS_VERSION==6210
27 #define TIME_REMOTE_MTOA_VERS 0
28 #define RPC_TIME_TOD_SET_APPS_BASES 2
29#elif (CONFIG_MSM_AMSS_VERSION==6220) || (CONFIG_MSM_AMSS_VERSION==6225)
30 #define TIME_REMOTE_MTOA_VERS 0x9202a8e4
31 #define RPC_TIME_TOD_SET_APPS_BASES 2
32#elif defined(CONFIG_MSM_AMSS_VERSION_WINCE)
33 #define TIME_REMOTE_MTOA_VERS 0
34 #define RPC_TIME_TOD_SET_APPS_BASES 1
35#else
36#error "Unknown AMSS version"
37#endif
38
3925struct rpc_time_tod_set_apps_bases_args {
4026 uint32_t tick;
4127 uint64_t stamp;
3030static int handle_rpc_call(struct msm_rpc_server *server,
3131 struct rpc_request_hdr *req, unsigned len)
3232{
33 switch (req->procedure) {
34 case RPC_TIME_REMOTE_MTOA_NULL:
33 if (req->procedure == amss_get_num_value(RPC_TIME_REMOTE_MTOA_NULL))
3534 return 0;
36
37 case RPC_TIME_TOD_SET_APPS_BASES: {
35 else if (req->procedure == amss_get_num_value(RPC_TIME_TOD_SET_APPS_BASES)) {
3836 struct rpc_time_tod_set_apps_bases_args *args;
3937 args = (struct rpc_time_tod_set_apps_bases_args *)(req + 1);
4038 args->tick = be32_to_cpu(args->tick);
4343 args->tick, args->stamp);
4444 return 0;
4545 }
46 default:
46 else
4747 return -ENODEV;
48 }
4948}
5049
5150static struct msm_rpc_server rpc_server = {
52 .prog = TIME_REMOTE_MTOA_PROG,
53 .vers = TIME_REMOTE_MTOA_VERS,
5451 .rpc_call = handle_rpc_call,
5552};
5653
5754static int __init rpc_server_init(void)
5855{
56 rpc_server.prog = amss_get_num_value(TIME_REMOTE_MTOA_PROG);
57 rpc_server.vers = amss_get_num_value(TIME_REMOTE_MTOA_VERS);
58
5959 return msm_rpc_create_server(&rpc_server);
6060}
6161