Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 179.06 KB | None | 0 0
  1. Only in zte/arch/arm/configs: msm7627_blade_P330_defconfig
  2. Only in zte/arch/arm/configs: msm7627_blade_P729B_defconfig
  3. Only in zte/arch/arm/configs: msm7627_joe_defconfig
  4. Only in zte/arch/arm/configs: msm7627_mooncake_P726CU_defconfig
  5. Only in zte/arch/arm/configs: msm7627_mooncake_P726C_defconfig
  6. Only in zte/arch/arm/configs: msm7627_mooncake_P726G_defconfig
  7. Only in zte/arch/arm/configs: msm7627_mooncake_P726N_defconfig
  8. Only in zte/arch/arm/configs: msm7627_mooncake_P726US_defconfig
  9. Only in zte/arch/arm/configs: msm7627_mooncake_P726VV_defconfig
  10. Only in zte/arch/arm/configs: msm7627_mooncake_R750_defconfig
  11. Only in zte/arch/arm/configs: msm7627_mooncake_defconfig
  12. Only in zte/arch/arm/configs: msm7627_r750_defconfig
  13. Only in zte/arch/arm/configs: msm7627_raise_defconfig
  14. Only in zte/arch/arm/configs: msm7627_smooth_P728H_defconfig
  15. Only in zte/arch/arm/kernel: vmlinux.lds
  16. diff -urB -x .git msm/arch/arm/mach-msm/Kconfig zte/arch/arm/mach-msm/Kconfig
  17. --- msm/arch/arm/mach-msm/Kconfig   Mon Nov  1 14:42:21 2010
  18. +++ zte/arch/arm/mach-msm/Kconfig   Wed Oct 13 18:07:20 2010
  19. @@ -108,6 +108,111 @@
  20.     bool "MSM7x27 SURF"
  21.     help
  22.       Support for the Qualcomm MSM7x27 SURF eval board.
  23. +    
  24. +# ZTE_PLATFORM
  25. +config ZTE_PLATFORM
  26. +   depends on ARCH_MSM
  27. +   depends on !MSM_STACKED_MEMORY
  28. +   default y
  29. +   bool "ZTE Platform."
  30. +   help
  31. +     Support for the ZTE Platform.
  32. +
  33. +# ZTE mooncake
  34. +config MACH_MOONCAKE
  35. +   depends on ARCH_MSM
  36. +   depends on !MSM_STACKED_MEMORY
  37. +   default n
  38. +   bool "ZTE mooncake board."
  39. +   help
  40. +     Support for the ZTE mooncake board.
  41. +
  42. +# ZTE blade
  43. +config MACH_BLADE
  44. +   depends on ARCH_MSM
  45. +   depends on !MSM_STACKED_MEMORY
  46. +   default n
  47. +   bool "ZTE blade board."
  48. +   help
  49. +     Support for the ZTE blade board.
  50. +    
  51. +# ZTE smooth
  52. +config MACH_SMOOTH
  53. +   depends on ARCH_MSM
  54. +   depends on !MSM_STACKED_MEMORY
  55. +   default n
  56. +   bool "ZTE smooth board."
  57. +   help
  58. +     Support for the ZTE smooth board.
  59. +
  60. +# ZTE raise
  61. +config MACH_RAISE
  62. +   depends on ARCH_MSM
  63. +   depends on !MSM_STACKED_MEMORY
  64. +   default n
  65. +   bool "ZTE raise board."
  66. +   help
  67. +     Support for the ZTE raise board.
  68. +    
  69. +# ZTE joe
  70. +config MACH_JOE
  71. +   depends on ARCH_MSM
  72. +   depends on !MSM_STACKED_MEMORY
  73. +   default n
  74. +   bool "ZTE joe board."
  75. +   help
  76. +     Support for the ZTE joe board.
  77. +
  78. +# ZTE R750
  79. +config MACH_R750
  80. +   depends on ARCH_MSM
  81. +   depends on !MSM_STACKED_MEMORY
  82. +   default n
  83. +   bool "ZTE R750 board."
  84. +   help
  85. +     Support for the ZTE R750 board.
  86. +
  87. +# ZTE ZTE_MULTIMODE
  88. +config ZTE_MULTIMODE
  89. +   depends on ARCH_MSM
  90. +   depends on !MSM_STACKED_MEMORY
  91. +   default n
  92. +   bool "ZTE MULTIMODE."
  93. +   help
  94. +     Support for ZTE MULTIMODE.
  95. +
  96. +# ZTE ZTE_CG_MULTIMODE
  97. +config ZTE_CG_MULTIMODE
  98. +   depends on ARCH_MSM
  99. +   depends on !MSM_STACKED_MEMORY
  100. +   default n
  101. +   bool "ZTE CG_MULTIMODE."
  102. +   help
  103. +     Support for ZTE CG_MULTIMODE.
  104. +
  105. +# ZTE ZTE_CDMA_NETWORK_TEST
  106. +config ZTE_CDMA_NETWORK_TEST
  107. +   depends on ARCH_MSM
  108. +   depends on !MSM_STACKED_MEMORY
  109. +   default n
  110. +   bool "ZTE CDMA_NETWORK_TEST."
  111. +   help
  112. +     Support for ZTE CDMA_NETWORK_TEST.
  113. +
  114. +# ZTE ZTE_TELECOM_TEST
  115. +config ZTE_TELECOM_TEST
  116. +   depends on ARCH_MSM
  117. +   depends on !MSM_STACKED_MEMORY
  118. +   default n
  119. +   bool "ZTE TELECOM_TEST."
  120. +   help
  121. +     Support for ZTE TELECOM_TEST.
  122. +
  123. +# ZTE_FTM_FLAG_SUPPORT
  124. +config ZTE_FTM_FLAG_SUPPORT
  125. +   depends on ZTE_PLATFORM
  126. +   default y
  127. +   bool "enable ZTE handset FTM mode detect."
  128.  
  129.  config MACH_MSM7X27_FFA
  130.     depends on ARCH_MSM7X27
  131. @@ -235,7 +340,7 @@
  132.  
  133.  config PHYS_OFFSET
  134.     hex
  135. -   default "0x00200000" if !MSM_STACKED_MEMORY
  136. +   default "0x02A00000" if !MSM_STACKED_MEMORY
  137.     default "0x00000000" if ARCH_QSD8X50 && MSM_SOC_REV_A
  138.     default "0x20000000" if ARCH_QSD8X50
  139.     default "0x10000000"
  140. diff -urB -x .git msm/arch/arm/mach-msm/Makefile zte/arch/arm/mach-msm/Makefile
  141. --- msm/arch/arm/mach-msm/Makefile  Mon Nov  1 14:42:21 2010
  142. +++ zte/arch/arm/mach-msm/Makefile  Fri Oct 15 17:30:18 2010
  143. @@ -91,7 +92,20 @@
  144.  obj-$(CONFIG_TROUT_H2W) += board-trout-h2w.o
  145.  obj-$(CONFIG_TROUT_BATTCHG) += htc_battery.o
  146.  obj-$(CONFIG_TROUT_PWRSINK) += htc_pwrsink.o
  147. -obj-$(CONFIG_ARCH_MSM7X27) += board-msm7x27.o
  148. +#obj-$(CONFIG_ARCH_MSM7X27) += board-msm7x27.o
  149. +
  150. +obj-$(CONFIG_MACH_MOONCAKE) += board-mooncake.o board-mooncake-keypad.o msm_vibrator.o
  151. +
  152. +obj-$(CONFIG_MACH_R750) += board-r750.o board-r750-keypad.o msm_vibrator.o
  153. +
  154. +obj-$(CONFIG_MACH_BLADE) += board-zte-blade.o board-zte-blade-keypad.o msm_vibrator.o
  155. +
  156. +obj-$(CONFIG_MACH_SMOOTH) += board-zte-smooth.o board-zte-smooth-keypad.o msm_vibrator.o
  157. +
  158. +obj-$(CONFIG_MACH_RAISE) += board-raise.o board-raise-keypad.o msm_vibrator.o
  159. +
  160. +obj-$(CONFIG_MACH_JOE) += board-joe.o board-joe-keypad.o msm_vibrator.o
  161. +
  162.  obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o clock-7x30.o
  163.  obj-$(CONFIG_ARCH_MSM7X25) += board-msm7x27.o
  164.  
  165. diff -urB -x .git msm/arch/arm/mach-msm/Makefile.boot zte/arch/arm/mach-msm/Makefile.boot
  166. --- msm/arch/arm/mach-msm/Makefile.boot Mon Nov  1 13:46:21 2010
  167. +++ zte/arch/arm/mach-msm/Makefile.boot Wed Oct 13 18:07:20 2010
  168. @@ -1,31 +1,31 @@
  169.  # MSM7x01A
  170. -   zreladdr-$(CONFIG_ARCH_MSM7X01A)    := 0x10008000
  171. -params_phys-$(CONFIG_ARCH_MSM7X01A)    := 0x10000100
  172. -initrd_phys-$(CONFIG_ARCH_MSM7X01A)    := 0x10800000
  173. +#   zreladdr-$(CONFIG_ARCH_MSM7X01A)   := 0x10008000
  174. +#params_phys-$(CONFIG_ARCH_MSM7X01A)   := 0x10000100
  175. +#initrd_phys-$(CONFIG_ARCH_MSM7X01A)   := 0x10800000
  176.  
  177.  # MSM7x25
  178. -   zreladdr-$(CONFIG_ARCH_MSM7X25) := 0x00208000
  179. -params_phys-$(CONFIG_ARCH_MSM7X25) := 0x00200100
  180. -initrd_phys-$(CONFIG_ARCH_MSM7X25) := 0x0A000000
  181. +#   zreladdr-$(CONFIG_ARCH_MSM7X25)    := 0x00208000
  182. +#params_phys-$(CONFIG_ARCH_MSM7X25)    := 0x00200100
  183. +#initrd_phys-$(CONFIG_ARCH_MSM7X25)    := 0x0A000000
  184.  
  185.  # MSM7x27
  186. -   zreladdr-$(CONFIG_ARCH_MSM7X27) := 0x00208000
  187. -params_phys-$(CONFIG_ARCH_MSM7X27) := 0x00200100
  188. +   zreladdr-$(CONFIG_ARCH_MSM7X27) := 0x02A08000
  189. +params_phys-$(CONFIG_ARCH_MSM7X27) := 0x02A00100
  190.  initrd_phys-$(CONFIG_ARCH_MSM7X27) := 0x0A000000
  191.  
  192.  # MSM7x30
  193. -   zreladdr-$(CONFIG_ARCH_MSM7X30) := 0x00208000
  194. -params_phys-$(CONFIG_ARCH_MSM7X30) := 0x00200100
  195. -initrd_phys-$(CONFIG_ARCH_MSM7X30) := 0x01200000
  196. +#   zreladdr-$(CONFIG_ARCH_MSM7X30)    := 0x00208000
  197. +#params_phys-$(CONFIG_ARCH_MSM7X30)    := 0x00200100
  198. +#initrd_phys-$(CONFIG_ARCH_MSM7X30)    := 0x01200000
  199.  
  200. -ifeq ($(CONFIG_MSM_SOC_REV_A),y)
  201. +#ifeq ($(CONFIG_MSM_SOC_REV_A),y)
  202.  # QSD8X50A
  203. -   zreladdr-$(CONFIG_ARCH_QSD8X50) := 0x00008000
  204. -params_phys-$(CONFIG_ARCH_QSD8X50) := 0x00000100
  205. -initrd_phys-$(CONFIG_ARCH_QSD8X50) := 0x04000000
  206. -else
  207. +#   zreladdr-$(CONFIG_ARCH_QSD8X50)    := 0x00008000
  208. +#params_phys-$(CONFIG_ARCH_QSD8X50)    := 0x00000100
  209. +#initrd_phys-$(CONFIG_ARCH_QSD8X50)    := 0x04000000
  210. +#else
  211.  # QSD8x50
  212. -   zreladdr-$(CONFIG_ARCH_QSD8X50) := 0x20008000
  213. -params_phys-$(CONFIG_ARCH_QSD8X50) := 0x20000100
  214. -initrd_phys-$(CONFIG_ARCH_QSD8X50) := 0x24000000
  215. -endif
  216. +#   zreladdr-$(CONFIG_ARCH_QSD8X50)    := 0x20008000
  217. +#params_phys-$(CONFIG_ARCH_QSD8X50)    := 0x20000100
  218. +#initrd_phys-$(CONFIG_ARCH_QSD8X50)    := 0x24000000
  219. +#endif
  220. Only in zte/arch/arm/mach-msm: board-joe-keypad.c
  221. Only in zte/arch/arm/mach-msm: board-joe.c
  222. Only in zte/arch/arm/mach-msm: board-mooncake-keypad.c
  223. Only in zte/arch/arm/mach-msm: board-mooncake.c
  224. Only in zte/arch/arm/mach-msm: board-r750-keypad.c
  225. Only in zte/arch/arm/mach-msm: board-r750.c
  226. Only in zte/arch/arm/mach-msm: board-zte-blade-keypad.c
  227. Only in zte/arch/arm/mach-msm: board-zte-blade.c
  228. Only in zte/arch/arm/mach-msm: board-zte-blade.c.bak
  229. Only in zte/arch/arm/mach-msm: debug.c
  230. Only in zte/arch/arm/mach-msm/include/mach: avago_ofn.h
  231. diff -urB -x .git msm/arch/arm/mach-msm/include/mach/camera.h zte/arch/arm/mach-msm/include/mach/camera.h
  232. --- msm/arch/arm/mach-msm/include/mach/camera.h Mon Nov  1 13:46:22 2010
  233. +++ zte/arch/arm/mach-msm/include/mach/camera.h Mon Oct 18 11:03:32 2010
  234. @@ -29,9 +30,18 @@
  235.  #include <mach/board.h>
  236.  #include <media/msm_camera.h>
  237.  
  238. +
  239. +#undef CCRT
  240. +#undef CINF
  241. +#undef CDBG
  242.  #ifdef CONFIG_MSM_CAMERA_DEBUG
  243. -#define CDBG(fmt, args...) printk(KERN_INFO "msm_camera: " fmt, ##args)
  244. +#define CPREFIX "[jia@msm_camera]"
  245. +#define CCRT(fmt, args...) printk(KERN_CRIT CPREFIX": " fmt, ##args)
  246. +#define CINF(fmt, args...) printk(KERN_CRIT CPREFIX": " fmt, ##args)
  247. +#define CDBG(fmt, args...) printk(KERN_CRIT CPREFIX": " fmt, ##args)
  248.  #else
  249. +#define CCRT(fmt, args...) do { } while (0)
  250. +#define CINF(fmt, args...) do { } while (0)
  251.  #define CDBG(fmt, args...) do { } while (0)
  252.  #endif
  253.  
  254. @@ -260,6 +270,12 @@
  255.         int (*sensor_probe)(const struct msm_camera_sensor_info *,
  256.                     struct msm_sensor_ctrl *));
  257.  
  258. +
  259. +#if defined(CONFIG_SENSOR_ADAPTER)
  260. +int msm_camera_dev_start(struct platform_device *dev,
  261. +                                 int (*sensor_dev_probe)(const struct msm_camera_sensor_info *));
  262. +#endif
  263. +
  264.  enum msm_camio_clk_type {
  265.     CAMIO_VFE_MDC_CLK,
  266.     CAMIO_MDC_CLK,
  267. @@ -309,6 +325,15 @@
  268.  enum msm_s_setting {
  269.     S_RES_PREVIEW,
  270.     S_RES_CAPTURE
  271. +};
  272. +
  273. +
  274. +enum msm_camera_pwr_mode_t {
  275. +    MSM_CAMERA_PWRUP_MODE = 0,
  276. +    MSM_CAMERA_STANDBY_MODE,
  277. +    MSM_CAMERA_NORMAL_MODE,
  278. +    MSM_CAMERA_PWRDWN_MODE,
  279. +    MSM_CAMERA_PWR_MODE_MAX
  280.  };
  281.  
  282.  int msm_camio_enable(struct platform_device *dev);
  283. Only in zte/arch/arm/mach-msm/include/mach: fm_si4708.h
  284. Only in zte/arch/arm/mach-msm/include/mach: jogball_key.h
  285. diff -urB -x .git msm/arch/arm/mach-msm/include/mach/memory.h zte/arch/arm/mach-msm/include/mach/memory.h
  286. --- msm/arch/arm/mach-msm/include/mach/memory.h Mon Nov  1 13:46:22 2010
  287. +++ zte/arch/arm/mach-msm/include/mach/memory.h Mon Oct 18 11:04:40 2010
  288. @@ -39,7 +39,7 @@
  289.  #include <asm/mach-types.h>
  290.  
  291.  #define arch_barrier_extra() do \
  292. -   { if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa())  \
  293. +   { \
  294.         write_to_strongly_ordered_memory(); \
  295.     } while (0)
  296.  #endif
  297. diff -urB -x .git msm/arch/arm/mach-msm/include/mach/msm_adsp.h zte/arch/arm/mach-msm/include/mach/msm_adsp.h
  298. --- msm/arch/arm/mach-msm/include/mach/msm_adsp.h   Mon Nov  1 13:46:22 2010
  299. +++ zte/arch/arm/mach-msm/include/mach/msm_adsp.h   Mon Oct 18 11:04:54 2010
  300. @@ -41,6 +42,8 @@
  301.  int msm_adsp_disable(struct msm_adsp_module *module);
  302.  int adsp_set_clkrate(struct msm_adsp_module *module, unsigned long clk_rate);
  303.  int msm_adsp_disable_event_rsp(struct msm_adsp_module *module);
  304. +void resume_prevent_suspend(void);
  305. +void suspend_allow_suspend(void);
  306.  
  307.  /* Write is safe to call from interrupt context.
  308.   */
  309. diff -urB -x .git msm/arch/arm/mach-msm/include/mach/msm_hsusb.h zte/arch/arm/mach-msm/include/mach/msm_hsusb.h
  310. --- msm/arch/arm/mach-msm/include/mach/msm_hsusb.h  Mon Nov  1 13:46:22 2010
  311. +++ zte/arch/arm/mach-msm/include/mach/msm_hsusb.h  Wed Oct 13 18:07:14 2010
  312. @@ -52,6 +52,7 @@
  313.  #ifndef CONFIG_USB_ANDROID
  314.  /* platform device data for msm_hsusb driver */
  315.  struct usb_composition {
  316. +       __u16   vendor_id;
  317.     __u16   product_id;
  318.     unsigned long functions;
  319.  };
  320. @@ -97,6 +98,7 @@
  321.     int vreg5v_required;
  322.  
  323.     u32 swfi_latency;
  324. +   int zte_pid;//hemulu
  325.  };
  326.  
  327.  struct msm_otg_platform_data {
  328. diff -urB -x .git msm/arch/arm/mach-msm/include/mach/msm_iomap-7xxx.h zte/arch/arm/mach-msm/include/mach/msm_iomap-7xxx.h
  329. --- msm/arch/arm/mach-msm/include/mach/msm_iomap-7xxx.h Mon Nov  1 13:46:22 2010
  330. +++ zte/arch/arm/mach-msm/include/mach/msm_iomap-7xxx.h Wed Oct 13 18:07:14 2010
  331. @@ -99,4 +99,7 @@
  332.  #define MSM_AD5_PHYS          0xAC000000
  333.  #define MSM_AD5_SIZE          (SZ_1M*13)
  334.  
  335. +#define MSM_SMEM_RAM_PHYS     0x00200000
  336. +#define MSM_SMEM_RAM_SIZE     SZ_1M
  337. +
  338.  #endif
  339. diff -urB -x .git msm/arch/arm/mach-msm/include/mach/msm_serial_hs.h zte/arch/arm/mach-msm/include/mach/msm_serial_hs.h
  340. --- msm/arch/arm/mach-msm/include/mach/msm_serial_hs.h  Mon Nov  1 13:46:22 2010
  341. +++ zte/arch/arm/mach-msm/include/mach/msm_serial_hs.h  Thu Oct 14 14:51:26 2010
  342. @@ -26,6 +26,11 @@
  343.     char rx_to_inject;
  344.  };
  345.  
  346. +#ifdef CONFIG_MODEMCTL
  347. +#define MODEMCTL_UARTDM1_UNINIT  2
  348. +unsigned int msm_hs_dm1_tx_empty(void);
  349. +#endif
  350. +
  351.  unsigned int msm_hs_tx_empty(struct uart_port *uport);
  352.  void msm_hs_request_clock_off(struct uart_port *uport);
  353.  void msm_hs_request_clock_on(struct uart_port *uport);
  354. diff -urB -x .git msm/arch/arm/mach-msm/include/mach/rpc_hsusb.h zte/arch/arm/mach-msm/include/mach/rpc_hsusb.h
  355. --- msm/arch/arm/mach-msm/include/mach/rpc_hsusb.h  Mon Nov  1 13:46:22 2010
  356. +++ zte/arch/arm/mach-msm/include/mach/rpc_hsusb.h  Mon Oct 18 11:05:20 2010
  357. @@ -32,6 +33,7 @@
  358.  int msm_hsusb_send_productID(uint32_t product_id);
  359.  int msm_hsusb_send_serial_number(char *serial_number);
  360.  int msm_hsusb_is_serial_num_null(uint32_t val);
  361. +int msm_hsusb_get_set_usb_conf_nv_value(uint32_t nv_item,uint32_t value,uint32_t is_write);//ZTE-USB-HML-02
  362.  int msm_hsusb_reset_rework_installed(void);
  363.  int msm_hsusb_enable_pmic_ulpidata0(void);
  364.  int msm_hsusb_disable_pmic_ulpidata0(void);
  365. diff -urB -x .git msm/arch/arm/mach-msm/io.c zte/arch/arm/mach-msm/io.c
  366. --- msm/arch/arm/mach-msm/io.c  Mon Nov  1 13:46:22 2010
  367. +++ zte/arch/arm/mach-msm/io.c  Mon Oct 18 11:31:16 2010
  368. @@ -46,10 +47,14 @@
  369.     int i;
  370.  
  371.     BUG_ON(!size);
  372. -   for (i = 0; i < size; i++)
  373. +
  374. +   for (i = 0; i < size; i++) {
  375.         if (io_desc[i].virtual == (unsigned long)MSM_SHARED_RAM_BASE)
  376.             io_desc[i].pfn = __phys_to_pfn(msm_shared_ram_phys);
  377.  
  378. +   }  
  379. +
  380. +
  381.     iotable_init(io_desc, size);
  382.  }
  383.  
  384. @@ -81,6 +86,20 @@
  385.         .length =   MSM_SHARED_RAM_SIZE,
  386.         .type =     MT_DEVICE,
  387.     },
  388. +
  389. +#if 0 
  390. +   {
  391. +       .virtual =  (unsigned long) MSM_TRACE_LOG_BASE,
  392. +       .length =   MSM_TRACE_LOG_SIZE,
  393. +       .type =     MT_DEVICE,
  394. +   },
  395. +
  396. +   {
  397. +       .virtual =  (unsigned long) MSM_F3_LOG_BASE,
  398. +       .length =   MSM_F3_LOG_SIZE,
  399. +       .type =     MT_DEVICE,
  400. +   },
  401. +#endif
  402.  };
  403.  
  404.  void __init msm_map_common_io(void)
  405. Only in zte/arch/arm/mach-msm: msm_usb_config.h
  406. diff -urB -x .git msm/arch/arm/mach-msm/msm_vibrator.c zte/arch/arm/mach-msm/msm_vibrator.c
  407. --- msm/arch/arm/mach-msm/msm_vibrator.c    Mon Nov  1 13:46:22 2010
  408. +++ zte/arch/arm/mach-msm/msm_vibrator.c    Mon Oct 18 11:32:12 2010
  409. @@ -22,19 +23,27 @@
  410.  
  411.  #include <mach/msm_rpcrouter.h>
  412.  
  413. -#define PM_LIBPROG      0x30000061
  414. +#define PM_LIBPROG   0x30000061
  415. +#if 1  
  416. +#define PM_LIBVERS      0x10001
  417. +#else
  418.  #if (CONFIG_MSM_AMSS_VERSION == 6220) || (CONFIG_MSM_AMSS_VERSION == 6225)
  419. -#define PM_LIBVERS      0xfb837d0b
  420. +#define PM_LIBVERS   0xfb837d0b
  421.  #else
  422. -#define PM_LIBVERS      0x10001
  423. +#define PM_LIBVERS   MSM_RPC_VERS(1,1)
  424. +#endif
  425.  #endif
  426.  
  427. -#define HTC_PROCEDURE_SET_VIB_ON_OFF   21
  428. +#define HTC_PROCEDURE_SET_VIB_ON_OFF   22
  429.  #define PMIC_VIBRATOR_LEVEL    (3000)
  430.  
  431. -static struct work_struct work_vibrator_on;
  432. -static struct work_struct work_vibrator_off;
  433. +
  434. +
  435. +
  436. +static struct work_struct vibrator_work;
  437.  static struct hrtimer vibe_timer;
  438. +static spinlock_t vibe_lock;
  439. +static int vibe_state;
  440.  
  441.  static void set_pmic_vibrator(int on)
  442.  {
  443. @@ -44,6 +53,10 @@
  444.         uint32_t data;
  445.     } req;
  446.  
  447. +#ifdef STONE_DEBUG
  448. +        printk("\nstone vib01:0x%x,0x%x\n",on,vib_endpoint);
  449. +#endif
  450. +
  451.     if (!vib_endpoint) {
  452.         vib_endpoint = msm_rpc_connect(PM_LIBPROG, PM_LIBVERS, 0);
  453.         if (IS_ERR(vib_endpoint)) {
  454. @@ -63,41 +75,34 @@
  455.         sizeof(req), 5 * HZ);
  456.  }
  457.  
  458. -static void pmic_vibrator_on(struct work_struct *work)
  459. -{
  460. -   set_pmic_vibrator(1);
  461. -}
  462. -
  463. -static void pmic_vibrator_off(struct work_struct *work)
  464. +static void update_vibrator(struct work_struct *work)
  465.  {
  466. -   set_pmic_vibrator(0);
  467. -}
  468. -
  469. -static void timed_vibrator_on(struct timed_output_dev *sdev)
  470. -{
  471. -   schedule_work(&work_vibrator_on);
  472. -}
  473. -
  474. -static void timed_vibrator_off(struct timed_output_dev *sdev)
  475. -{
  476. -   schedule_work(&work_vibrator_off);
  477. +   set_pmic_vibrator(vibe_state);
  478.  }
  479.  
  480.  static void vibrator_enable(struct timed_output_dev *dev, int value)
  481.  {
  482. +   unsigned long   flags;
  483. +
  484. +   spin_lock_irqsave(&vibe_lock, flags);
  485.     hrtimer_cancel(&vibe_timer);
  486.  
  487. +#ifdef STONE_DEBUG
  488. +         printk("\nstone vib02:0x%x,0x%x\n",dev,value);
  489. +#endif
  490. +
  491.     if (value == 0)
  492. -       timed_vibrator_off(dev);
  493. +       vibe_state = 0;
  494.     else {
  495. -       value = (value > 15000 ? 15000 : value);
  496. -
  497. -       timed_vibrator_on(dev);
  498. -
  499. +       value = (value > 1000 ? 1000 : value);
  500. +       vibe_state = 1;
  501.         hrtimer_start(&vibe_timer,
  502. -                 ktime_set(value / 1000, (value % 1000) * 1000000),
  503. -                 HRTIMER_MODE_REL);
  504. +           ktime_set(value / 1000, (value % 1000) * 1000000),
  505. +           HRTIMER_MODE_REL);
  506.     }
  507. +   spin_unlock_irqrestore(&vibe_lock, flags);
  508. +
  509. +   schedule_work(&vibrator_work);
  510.  }
  511.  
  512.  static int vibrator_get_time(struct timed_output_dev *dev)
  513. @@ -111,7 +116,8 @@
  514.  
  515.  static enum hrtimer_restart vibrator_timer_func(struct hrtimer *timer)
  516.  {
  517. -   timed_vibrator_off(NULL);
  518. +   vibe_state = 0;
  519. +   schedule_work(&vibrator_work);
  520.     return HRTIMER_NORESTART;
  521.  }
  522.  
  523. @@ -123,9 +129,13 @@
  524.  
  525.  void __init msm_init_pmic_vibrator(void)
  526.  {
  527. -   INIT_WORK(&work_vibrator_on, pmic_vibrator_on);
  528. -   INIT_WORK(&work_vibrator_off, pmic_vibrator_off);
  529. +   INIT_WORK(&vibrator_work, update_vibrator);
  530. +  
  531. +         printk("\nstone_20100302 vib00:**************************************\n");
  532. +
  533.  
  534. +   spin_lock_init(&vibe_lock);
  535. +   vibe_state = 0;
  536.     hrtimer_init(&vibe_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
  537.     vibe_timer.function = vibrator_timer_func;
  538.  
  539. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/adsp.c zte/arch/arm/mach-msm/qdsp5/adsp.c
  540. --- msm/arch/arm/mach-msm/qdsp5/adsp.c  Mon Nov  1 13:46:22 2010
  541. +++ zte/arch/arm/mach-msm/qdsp5/adsp.c  Mon Oct 18 11:06:28 2010
  542. @@ -36,14 +38,33 @@
  543.  #include <linux/wakelock.h>
  544.  
  545.  static struct wake_lock adsp_wake_lock;
  546. +
  547.  static inline void prevent_suspend(void)
  548.  {
  549. +       if (!wake_lock_active(&adsp_wake_lock))
  550. +       {
  551.     wake_lock(&adsp_wake_lock);
  552.  }
  553. +}
  554.  static inline void allow_suspend(void)
  555.  {
  556. +       if (wake_lock_active(&adsp_wake_lock))
  557. +       {
  558.     wake_unlock(&adsp_wake_lock);
  559.  }
  560. +}
  561. +
  562. +void resume_prevent_suspend(void)
  563. +{
  564. +       prevent_suspend();
  565. +       MM_INFO("patch:resume_prevent_suspend\n");
  566. +}
  567. +void suspend_allow_suspend(void)
  568. +{
  569. +       allow_suspend();
  570. +       MM_INFO("patch:suspend_allow_suspend\n");
  571. +}
  572. +
  573.  
  574.  #include <linux/io.h>
  575.  #include <mach/msm_iomap.h>
  576. @@ -427,8 +448,9 @@
  577.     while (((ctrl_word = readl(info->write_ctrl)) &
  578.         ADSP_RTOS_WRITE_CTRL_WORD_READY_M) !=
  579.         ADSP_RTOS_WRITE_CTRL_WORD_READY_V) {
  580. -       if (cnt > 50) {
  581. +       if (cnt > (50 * 4)) {
  582.             MM_ERR("timeout waiting for DSP write ready\n");
  583. +           MM_ERR("write:write_ctrl = %#x\n", readl(info->write_ctrl));
  584.             ret_status = -EIO;
  585.             goto fail;
  586.         }
  587. @@ -464,8 +486,9 @@
  588.     while ((readl(info->write_ctrl) &
  589.         ADSP_RTOS_WRITE_CTRL_WORD_MUTEX_M) ==
  590.         ADSP_RTOS_WRITE_CTRL_WORD_MUTEX_NAVAIL_V) {
  591. -       if (cnt > 2500) {
  592. +       if (cnt > (2500 * 4)) {
  593.             MM_ERR("timeout waiting for adsp ack\n");
  594. +           MM_ERR("ack:write_ctrl = %#x\n", readl(info->write_ctrl));
  595.             ret_status = -EIO;
  596.             goto fail;
  597.         }
  598. @@ -985,7 +1008,7 @@
  599.  
  600.     MM_INFO("enable '%s'state[%d] id[%d]\n",
  601.                 module->name, module->state, module->id);
  602. -
  603. +   MM_INFO("adsp_open_count=%d\n", adsp_open_count);
  604.     mutex_lock(&module->lock);
  605.     switch (module->state) {
  606.     case ADSP_STATE_DISABLED:
  607. @@ -995,9 +1018,16 @@
  608.             break;
  609.         module->state = ADSP_STATE_ENABLING;
  610.         mutex_unlock(&module->lock);
  611. +#if 0
  612. +
  613.         rc = wait_event_timeout(module->state_wait,
  614.                     module->state != ADSP_STATE_ENABLING,
  615.                     1 * HZ);
  616. +#else
  617. +       rc = wait_event_timeout(module->state_wait,
  618. +                   module->state != ADSP_STATE_ENABLING,
  619. +                   5 * HZ);
  620. +#endif
  621.         mutex_lock(&module->lock);
  622.         if (module->state == ADSP_STATE_ENABLED) {
  623.             rc = 0;
  624. @@ -1049,12 +1079,17 @@
  625.  {
  626.     int rc = 0;
  627.  
  628. +   MM_INFO("disable_locked:'%s'state[%d]:id[%d]:adsp_open_count=%d\n",
  629. +              module->name, module->state, module->id, adsp_open_count);
  630. +
  631.     switch (module->state) {
  632.     case ADSP_STATE_DISABLED:
  633.         MM_DBG("module '%s' already disabled\n", module->name);
  634. +       MM_INFO("module '%s' already disabled\n", module->name);
  635.         break;
  636.     case ADSP_STATE_ENABLING:
  637.     case ADSP_STATE_ENABLED:
  638. +       MM_INFO("module'%s' to disabled\n", module->name);
  639.         rc = rpc_adsp_rtos_app_to_modem(RPC_ADSP_RTOS_CMD_DISABLE,
  640.                         module->id, module);
  641.         module->state = ADSP_STATE_DISABLED;
  642. @@ -1067,6 +1102,7 @@
  643.             MM_INFO("disable interrupt\n");
  644.         }
  645.         mutex_unlock(&adsp_open_lock);
  646. +   MM_INFO("adsp_open_count=%d\n", adsp_open_count);
  647.     }
  648.     return rc;
  649.  }
  650. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audio_aac.c zte/arch/arm/mach-msm/qdsp5/audio_aac.c
  651. --- msm/arch/arm/mach-msm/qdsp5/audio_aac.c Mon Nov  1 13:46:22 2010
  652. +++ zte/arch/arm/mach-msm/qdsp5/audio_aac.c Fri Oct 15 15:35:40 2010
  653. @@ -1482,6 +1484,7 @@
  654.  
  655.     MM_DBG("\n"); /* Macro prints the file name and function */
  656.     audaac_post_event(ctl->audio, AUDIO_EVENT_SUSPEND, payload);
  657. +   suspend_allow_suspend();
  658.  }
  659.  
  660.  static void audaac_resume(struct early_suspend *h)
  661. @@ -1492,7 +1495,9 @@
  662.  
  663.     MM_DBG("\n"); /* Macro prints the file name and function */
  664.     audaac_post_event(ctl->audio, AUDIO_EVENT_RESUME, payload);
  665. +   resume_prevent_suspend();
  666.  }
  667. +
  668.  #endif
  669.  
  670.  #ifdef CONFIG_DEBUG_FS
  671. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audio_amrnb.c zte/arch/arm/mach-msm/qdsp5/audio_amrnb.c
  672. --- msm/arch/arm/mach-msm/qdsp5/audio_amrnb.c   Mon Nov  1 13:46:22 2010
  673. +++ zte/arch/arm/mach-msm/qdsp5/audio_amrnb.c   Fri Oct 15 15:35:20 2010
  674. @@ -1280,6 +1282,7 @@
  675.  
  676.     MM_DBG("\n"); /* Macro prints the file name and function */
  677.     audamrnb_post_event(ctl->audio, AUDIO_EVENT_SUSPEND, payload);
  678. +   suspend_allow_suspend();
  679.  }
  680.  
  681.  static void audamrnb_resume(struct early_suspend *h)
  682. @@ -1290,7 +1293,9 @@
  683.  
  684.     MM_DBG("\n"); /* Macro prints the file name and function */
  685.     audamrnb_post_event(ctl->audio, AUDIO_EVENT_RESUME, payload);
  686. +   resume_prevent_suspend();
  687.  }
  688. +
  689.  #endif
  690.  
  691.  #ifdef CONFIG_DEBUG_FS
  692. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audio_amrwb.c zte/arch/arm/mach-msm/qdsp5/audio_amrwb.c
  693. --- msm/arch/arm/mach-msm/qdsp5/audio_amrwb.c   Mon Nov  1 13:46:22 2010
  694. +++ zte/arch/arm/mach-msm/qdsp5/audio_amrwb.c   Fri Oct 15 15:41:04 2010
  695. @@ -1361,6 +1361,7 @@
  696.  
  697.     pr_debug("%s()\n", __func__);
  698.     audamrwb_post_event(ctl->audio, AUDIO_EVENT_SUSPEND, payload);
  699. +   suspend_allow_suspend();
  700.  }
  701.  
  702.  static void audamrwb_resume(struct early_suspend *h)
  703. @@ -1371,6 +1372,7 @@
  704.  
  705.     pr_debug("%s()\n", __func__);
  706.     audamrwb_post_event(ctl->audio, AUDIO_EVENT_RESUME, payload);
  707. +   resume_prevent_suspend();
  708.  }
  709.  #endif
  710.  
  711. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audio_evrc.c zte/arch/arm/mach-msm/qdsp5/audio_evrc.c
  712. --- msm/arch/arm/mach-msm/qdsp5/audio_evrc.c    Mon Nov  1 13:46:22 2010
  713. +++ zte/arch/arm/mach-msm/qdsp5/audio_evrc.c    Fri Oct 15 15:41:26 2010
  714. @@ -1272,6 +1273,7 @@
  715.  
  716.     MM_DBG("\n"); /* Macro prints the file name and function */
  717.     audevrc_post_event(ctl->audio, AUDIO_EVENT_SUSPEND, payload);
  718. +   suspend_allow_suspend();
  719.  }
  720.  
  721.  static void audevrc_resume(struct early_suspend *h)
  722. @@ -1282,6 +1284,7 @@
  723.  
  724.     MM_DBG("\n"); /* Macro prints the file name and function */
  725.     audevrc_post_event(ctl->audio, AUDIO_EVENT_RESUME, payload);
  726. +   resume_prevent_suspend();
  727.  }
  728.  #endif
  729.  
  730. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audio_mp3.c zte/arch/arm/mach-msm/qdsp5/audio_mp3.c
  731. --- msm/arch/arm/mach-msm/qdsp5/audio_mp3.c Mon Nov  1 13:46:22 2010
  732. +++ zte/arch/arm/mach-msm/qdsp5/audio_mp3.c Fri Oct 15 15:42:14 2010
  733. @@ -1963,6 +1963,7 @@
  734.  
  735.     MM_DBG("\n"); /* Macro prints the file name and function */
  736.     audmp3_post_event(ctl->audio, AUDIO_EVENT_SUSPEND, payload);
  737. +   suspend_allow_suspend();
  738.  }
  739.  
  740.  static void audmp3_resume(struct early_suspend *h)
  741. @@ -1973,6 +1974,7 @@
  742.  
  743.     MM_DBG("\n"); /* Macro prints the file name and function */
  744.     audmp3_post_event(ctl->audio, AUDIO_EVENT_RESUME, payload);
  745. +   resume_prevent_suspend();
  746.  }
  747.  #endif
  748.  
  749. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audio_pcm.c zte/arch/arm/mach-msm/qdsp5/audio_pcm.c
  750. --- msm/arch/arm/mach-msm/qdsp5/audio_pcm.c Mon Nov  1 13:46:22 2010
  751. +++ zte/arch/arm/mach-msm/qdsp5/audio_pcm.c Fri Oct 15 15:42:32 2010
  752. @@ -1366,6 +1366,7 @@
  753.  
  754.     MM_DBG("\n"); /* Macro prints the file name and function */
  755.     audpcm_post_event(ctl->audio, AUDIO_EVENT_SUSPEND, payload);
  756. +   suspend_allow_suspend();
  757.  }
  758.  
  759.  static void audpcm_resume(struct early_suspend *h)
  760. @@ -1376,6 +1377,7 @@
  761.  
  762.     MM_DBG("\n"); /* Macro prints the file name and function */
  763.     audpcm_post_event(ctl->audio, AUDIO_EVENT_RESUME, payload);
  764. +   resume_prevent_suspend();
  765.  }
  766.  #endif
  767.  
  768. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audio_qcelp.c zte/arch/arm/mach-msm/qdsp5/audio_qcelp.c
  769. --- msm/arch/arm/mach-msm/qdsp5/audio_qcelp.c   Mon Nov  1 13:46:22 2010
  770. +++ zte/arch/arm/mach-msm/qdsp5/audio_qcelp.c   Fri Oct 15 15:43:02 2010
  771. @@ -1274,6 +1274,7 @@
  772.  
  773.     MM_DBG("\n"); /* Macro prints the file name and function */
  774.     audqcelp_post_event(ctl->audio, AUDIO_EVENT_SUSPEND, payload);
  775. +   suspend_allow_suspend();
  776.  }
  777.  
  778.  static void audqcelp_resume(struct early_suspend *h)
  779. @@ -1284,6 +1285,7 @@
  780.  
  781.     MM_DBG("\n"); /* Macro prints the file name and function */
  782.     audqcelp_post_event(ctl->audio, AUDIO_EVENT_RESUME, payload);
  783. +   resume_prevent_suspend();
  784.  }
  785.  #endif
  786.  
  787. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audio_wma.c zte/arch/arm/mach-msm/qdsp5/audio_wma.c
  788. --- msm/arch/arm/mach-msm/qdsp5/audio_wma.c Mon Nov  1 13:46:22 2010
  789. +++ zte/arch/arm/mach-msm/qdsp5/audio_wma.c Fri Oct 15 15:43:20 2010
  790. @@ -1417,6 +1418,7 @@
  791.  
  792.     MM_DBG("\n"); /* Macro prints the file name and function */
  793.     audwma_post_event(ctl->audio, AUDIO_EVENT_SUSPEND, payload);
  794. +   suspend_allow_suspend();
  795.  }
  796.  
  797.  static void audwma_resume(struct early_suspend *h)
  798. @@ -1427,6 +1429,7 @@
  799.  
  800.     MM_DBG("\n"); /* Macro prints the file name and function */
  801.     audwma_post_event(ctl->audio, AUDIO_EVENT_RESUME, payload);
  802. +   resume_prevent_suspend();
  803.  }
  804.  #endif
  805.  
  806. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audio_wmapro.c zte/arch/arm/mach-msm/qdsp5/audio_wmapro.c
  807. --- msm/arch/arm/mach-msm/qdsp5/audio_wmapro.c  Mon Nov  1 13:46:22 2010
  808. +++ zte/arch/arm/mach-msm/qdsp5/audio_wmapro.c  Fri Oct 15 15:43:44 2010
  809. @@ -1414,6 +1415,7 @@
  810.  
  811.     MM_DBG("\n"); /* Macro prints the file name and function */
  812.     audwmapro_post_event(ctl->audio, AUDIO_EVENT_SUSPEND, payload);
  813. +   suspend_allow_suspend();
  814.  }
  815.  
  816.  static void audwmapro_resume(struct early_suspend *h)
  817. @@ -1424,6 +1426,7 @@
  818.  
  819.     MM_DBG("\n"); /* Macro prints the file name and function */
  820.     audwmapro_post_event(ctl->audio, AUDIO_EVENT_RESUME, payload);
  821. +   resume_prevent_suspend();
  822.  }
  823.  #endif
  824.  
  825. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audmgr.c zte/arch/arm/mach-msm/qdsp5/audmgr.c
  826. --- msm/arch/arm/mach-msm/qdsp5/audmgr.c    Mon Nov  1 13:46:22 2010
  827. +++ zte/arch/arm/mach-msm/qdsp5/audmgr.c    Fri Oct 15 15:44:06 2010
  828. @@ -28,6 +28,9 @@
  829.  
  830.  #include "audmgr.h"
  831.  
  832. +#include <linux/delay.h>
  833. +
  834. +
  835.  #define STATE_CLOSED    0
  836.  #define STATE_DISABLED  1
  837.  #define STATE_ENABLING  2
  838. @@ -270,6 +273,9 @@
  839.             amg->ept = NULL;
  840.             goto done;
  841.         }
  842. +
  843. +   msleep(23);
  844. +
  845.     }
  846.  
  847.     /* Initialize session parameters */
  848. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/audmgr.h zte/arch/arm/mach-msm/qdsp5/audmgr.h
  849. --- msm/arch/arm/mach-msm/qdsp5/audmgr.h    Mon Nov  1 13:46:22 2010
  850. +++ zte/arch/arm/mach-msm/qdsp5/audmgr.h    Fri Oct 15 15:44:28 2010
  851. @@ -203,8 +204,9 @@
  852.  typedef void (*audpp_event_func)(void *private, unsigned id, uint16_t *msg);
  853.  typedef void (*audrec_event_func)(void *private, unsigned id, uint16_t *msg);
  854.  
  855. +
  856.  /* worst case delay of 100ms for response */
  857. -#define MSM_AUD_DECODER_WAIT_MS 200
  858. +#define MSM_AUD_DECODER_WAIT_MS 500
  859.  #define MSM_AUD_MODE_TUNNEL  0x00000100
  860.  #define MSM_AUD_MODE_NONTUNNEL  0x00000200
  861.  #define MSM_AUD_DECODER_MASK  0x0000FFFF
  862. diff -urB -x .git msm/arch/arm/mach-msm/qdsp5/snd.c zte/arch/arm/mach-msm/qdsp5/snd.c
  863. --- msm/arch/arm/mach-msm/qdsp5/snd.c   Mon Nov  1 13:46:22 2010
  864. +++ zte/arch/arm/mach-msm/qdsp5/snd.c   Fri Oct 15 15:46:14 2010
  865. @@ -30,11 +32,15 @@
  866.  #include <mach/board.h>
  867.  #include <mach/msm_rpcrouter.h>
  868.  
  869. +#include <linux/switch.h>
  870. +
  871.  struct snd_ctxt {
  872.     struct mutex lock;
  873.     int opened;
  874.     struct msm_rpc_endpoint *ept;
  875.     struct msm_snd_endpoints *snd_epts;
  876. +
  877. +   struct switch_dev snd_dev_info;
  878.  };
  879.  
  880.  struct snd_sys_ctxt {
  881. @@ -46,6 +52,12 @@
  882.  
  883.  static struct snd_ctxt the_snd;
  884.  
  885. +#define SND_DEV 0
  886. +#define EAR_MUTE 1
  887. +#define MIC_MUTE 2
  888. +#define SND_DEV_INFO_NUM 3
  889. +static int keep_snd_dev_info[SND_DEV_INFO_NUM] = {0, 0, 0};
  890. +
  891.  #define RPC_SND_PROG   0x30000002
  892.  #define RPC_SND_CB_PROG    0x31000002
  893.  
  894. @@ -55,7 +67,9 @@
  895.  #define SND_SET_VOLUME_PROC 3
  896.  #define SND_AVC_CTL_PROC 29
  897.  #define SND_AGC_CTL_PROC 30
  898. -
  899. +  #define SND_AUDIO_LOOPBACK_PROC 37
  900. +  #define SND_HPH_AMP_CTL_PROC 38
  901. +  
  902.  struct rpc_snd_set_device_args {
  903.     uint32_t device;
  904.     uint32_t ear_mute;
  905. @@ -86,6 +100,19 @@
  906.     uint32_t client_data;
  907.  };
  908.  
  909. +
  910. +struct rpc_snd_lb_ctl_args {
  911. +   uint32_t lb_ctl;
  912. +   uint32_t cb_func;
  913. +   uint32_t client_data;
  914. +};
  915. +
  916. +struct rpc_snd_hph_amp_ctl_args {
  917. +   uint32_t amp_ctl;
  918. +   uint32_t cb_func;
  919. +   uint32_t client_data;
  920. +};
  921. +
  922.  struct snd_set_device_msg {
  923.     struct rpc_request_hdr hdr;
  924.     struct rpc_snd_set_device_args args;
  925. @@ -106,6 +133,17 @@
  926.     struct rpc_snd_agc_ctl_args args;
  927.  };
  928.  
  929. +
  930. +struct snd_set_lb_msg {
  931. +   struct rpc_request_hdr hdr;
  932. +   struct rpc_snd_lb_ctl_args args;
  933. +};
  934. +
  935. +struct snd_hph_amp_msg {
  936. +   struct rpc_request_hdr hdr;
  937. +   struct rpc_snd_hph_amp_ctl_args args;
  938. +};
  939. +
  940.  struct snd_endpoint *get_snd_endpoints(int *size);
  941.  
  942.  static inline int check_mute(int mute)
  943. @@ -149,6 +187,7 @@
  944.     struct snd_set_volume_msg vmsg;
  945.     struct snd_avc_ctl_msg avc_msg;
  946.     struct snd_agc_ctl_msg agc_msg;
  947. +   struct snd_set_lb_msg lb_msg;
  948.  
  949.     struct msm_snd_device_config dev;
  950.     struct msm_snd_volume_config vol;
  951. @@ -156,6 +195,7 @@
  952.     int rc = 0;
  953.  
  954.     uint32_t avc, agc;
  955. +   uint32_t set_lb;
  956.  
  957.     mutex_lock(&snd->lock);
  958.     switch (cmd) {
  959. @@ -184,6 +224,13 @@
  960.         rc = msm_rpc_call(snd->ept,
  961.             SND_SET_DEVICE_PROC,
  962.             &dmsg, sizeof(dmsg), 5 * HZ);
  963. +
  964. +              if (dev.device != 28)
  965. +              {
  966. +           keep_snd_dev_info[SND_DEV] = dev.device;
  967. +              }
  968. +       keep_snd_dev_info[EAR_MUTE] = dev.ear_mute;
  969. +       keep_snd_dev_info[MIC_MUTE] = dev.mic_mute;
  970.         break;
  971.  
  972.     case SND_SET_VOLUME:
  973. @@ -264,6 +311,28 @@
  974.         rc = get_endpoint(snd, arg);
  975.         break;
  976.  
  977. +
  978. +   case SND_SET_AUDIO_LOOPBACK:
  979. +       if (get_user(set_lb, (uint32_t __user *) arg)) {
  980. +           rc = -EFAULT;
  981. +           break;
  982. +       } else if ((set_lb != 1) && (set_lb != 0)) {
  983. +           rc = -EINVAL;
  984. +           break;
  985. +       }
  986. +
  987. +       lb_msg.args.lb_ctl = cpu_to_be32(set_lb);
  988. +
  989. +       lb_msg.args.cb_func = -1;
  990. +       lb_msg.args.client_data = 0;
  991. +
  992. +       pr_info("snd_lb_ctl %d\n", set_lb);
  993. +
  994. +       rc = msm_rpc_call(snd->ept,
  995. +           SND_AUDIO_LOOPBACK_PROC,
  996. +           &lb_msg, sizeof(lb_msg), 5 * HZ);
  997. +       break;
  998. +
  999.     default:
  1000.         MM_ERR("unknown command\n");
  1001.         rc = -EINVAL;
  1002. @@ -271,6 +340,8 @@
  1003.     }
  1004.     mutex_unlock(&snd->lock);
  1005.  
  1006. +       MM_INFO("chenjun:rc = %d\n", rc);
  1007. +
  1008.     return rc;
  1009.  }
  1010.  
  1011. @@ -579,6 +650,29 @@
  1012.     return status ? : size;
  1013.  }
  1014.  
  1015. +int snd_hph_amp_ctl(uint32_t on)
  1016. +{
  1017. +   struct snd_ctxt *snd = &the_snd;
  1018. +   struct snd_hph_amp_msg hph_amp_msg;
  1019. +   int rc = 0;
  1020. +
  1021. +   pr_info("snd_hph_amp_ctl:%d\n", on);
  1022. +
  1023. +   mutex_lock(&snd->lock);
  1024. +    
  1025. +   hph_amp_msg.args.amp_ctl = cpu_to_be32(on);
  1026. +   hph_amp_msg.args.cb_func = -1;
  1027. +   hph_amp_msg.args.client_data = 0;
  1028. +
  1029. +   rc = msm_rpc_call(snd->ept,
  1030. +           SND_HPH_AMP_CTL_PROC,
  1031. +           &hph_amp_msg, sizeof(hph_amp_msg), 5 * HZ);
  1032. +
  1033. +   mutex_unlock(&snd->lock);
  1034. +    
  1035. +   return rc;
  1036. +}
  1037. +
  1038.  static DEVICE_ATTR(agc, S_IWUSR | S_IRUGO,
  1039.         NULL, snd_agc_store);
  1040.  
  1041. @@ -591,6 +685,16 @@
  1042.  static DEVICE_ATTR(volume, S_IWUSR | S_IRUGO,
  1043.         NULL, snd_vol_store);
  1044.  
  1045. +static ssize_t print_snd_dev_name(struct switch_dev *sdev, char *buf)
  1046. +{
  1047. +   return sprintf(buf, "%s\n", "dev,ear_mute,mic_mute");
  1048. +}
  1049. +
  1050. +static ssize_t print_snd_dev_state(struct switch_dev *sdev, char *buf)
  1051. +{
  1052. +   return sprintf(buf, "%d,%d,%d\n", keep_snd_dev_info[SND_DEV], keep_snd_dev_info[EAR_MUTE], keep_snd_dev_info[MIC_MUTE]);
  1053. +}
  1054. +
  1055.  static int snd_probe(struct platform_device *pdev)
  1056.  {
  1057.     struct snd_ctxt *snd = &the_snd;
  1058. @@ -639,6 +743,13 @@
  1059.                         &dev_attr_device);
  1060.         misc_deregister(&snd_misc);
  1061.     }
  1062. +
  1063. +   snd->snd_dev_info.name = "snd_debug";
  1064. +   snd->snd_dev_info.print_name = print_snd_dev_name;
  1065. +   snd->snd_dev_info.print_state = print_snd_dev_state;
  1066. +   rc = switch_dev_register(&snd->snd_dev_info);
  1067. +   if (rc < 0)
  1068. +       switch_dev_unregister(&snd->snd_dev_info);
  1069.  
  1070.     return rc;
  1071.  }
  1072. diff -urB -x .git msm/arch/arm/mach-msm/rpc_hsusb.c zte/arch/arm/mach-msm/rpc_hsusb.c
  1073. --- msm/arch/arm/mach-msm/rpc_hsusb.c   Mon Nov  1 13:46:22 2010
  1074. +++ zte/arch/arm/mach-msm/rpc_hsusb.c   Mon Oct 18 11:33:10 2010
  1075. @@ -47,6 +47,7 @@
  1076.     unsigned long   reset_rework_installed;
  1077.     unsigned long   enable_pmic_ulpi_data0;
  1078.     unsigned long   disable_pmic_ulpi_data0;
  1079. +   unsigned long   get_usb_conf_nv_value;
  1080.  };
  1081.  
  1082.  static struct msm_hsusb_rpc_ids usb_rpc_ids;
  1083. @@ -66,6 +67,7 @@
  1084.         usb_rpc_ids.reset_rework_installed  = 17;
  1085.         usb_rpc_ids.enable_pmic_ulpi_data0  = 18;
  1086.         usb_rpc_ids.disable_pmic_ulpi_data0 = 19;
  1087. +       usb_rpc_ids.get_usb_conf_nv_value   = 99;
  1088.         return 0;
  1089.     } else if (vers == 0x00010002) {
  1090.         usb_rpc_ids.prog            = 0x30000064;
  1091. @@ -79,6 +81,7 @@
  1092.         usb_rpc_ids.reset_rework_installed  = 17;
  1093.         usb_rpc_ids.enable_pmic_ulpi_data0  = 18;
  1094.         usb_rpc_ids.disable_pmic_ulpi_data0 = 19;
  1095. +       usb_rpc_ids.get_usb_conf_nv_value   = 99;
  1096.         return 0;
  1097.     } else {
  1098.         printk(KERN_INFO "%s: no matches found for version\n",
  1099. @@ -358,6 +361,51 @@
  1100.     return rc;
  1101.  }
  1102.  EXPORT_SYMBOL(msm_hsusb_is_serial_num_null);
  1103. +int msm_hsusb_get_set_usb_conf_nv_value(uint32_t nv_item,uint32_t value,uint32_t is_write)
  1104. +{
  1105. +   int rc = 0;
  1106. +   struct hsusb_phy_start_req {
  1107. +           struct rpc_request_hdr hdr;
  1108. +           uint32_t nv_item;
  1109. +           uint32_t value;
  1110. +           uint32_t is_write;
  1111. +   } req;
  1112. +   struct nv23_value_rep {
  1113. +       struct rpc_reply_hdr hdr;
  1114. +       int value;     
  1115. +   } rep;
  1116. +   if (!usb_ep || IS_ERR(usb_ep)) {
  1117. +       printk(KERN_ERR "%s: rpc connect failed: rc = %ld\n",
  1118. +           __func__, PTR_ERR(usb_ep));
  1119. +       return -EAGAIN;
  1120. +   }
  1121. +   if (!usb_rpc_ids.get_usb_conf_nv_value) {
  1122. +       printk(KERN_ERR "%s: proc id not supported \n", __func__);
  1123. +       return -ENODATA;
  1124. +   }
  1125. +   req.nv_item = cpu_to_be32(nv_item);
  1126. +   req.value = cpu_to_be32(value);
  1127. +   req.is_write =cpu_to_be32(is_write);   
  1128. +   rc = msm_rpc_call_reply(usb_ep, usb_rpc_ids.get_usb_conf_nv_value,
  1129. +               &req, sizeof(req),
  1130. +               &rep, sizeof(rep),
  1131. +               5 * HZ);
  1132. +   printk("======return value=%d \n\n",be32_to_cpu(rep.value));
  1133. +   if (rc < 0)
  1134. +   {
  1135. +       printk(KERN_ERR "%s: rpc call failed! error: %d\n" ,
  1136. +           __func__, rc);
  1137. +       return rc;
  1138. +   }
  1139. +   else
  1140. +   {
  1141. +   printk(KERN_ERR "%s: rpc call success\n" ,
  1142. +           __func__);
  1143. +   }
  1144. +       rc = be32_to_cpu(rep.value);
  1145. +   return rc;
  1146. +}
  1147. +EXPORT_SYMBOL(msm_hsusb_get_set_usb_conf_nv_value);
  1148.  
  1149.  int msm_chg_usb_charger_connected(uint32_t device)
  1150.  {
  1151. diff -urB -x .git msm/arch/arm/mach-msm/rpc_pmapp.c zte/arch/arm/mach-msm/rpc_pmapp.c
  1152. --- msm/arch/arm/mach-msm/rpc_pmapp.c   Mon Nov  1 13:46:22 2010
  1153. +++ zte/arch/arm/mach-msm/rpc_pmapp.c   Mon Oct 18 11:33:34 2010
  1154. @@ -260,10 +260,6 @@
  1155.  int msm_pm_app_rpc_init(void)
  1156.  {
  1157.  
  1158. -   if (!machine_is_qsd8x50_ffa() && !machine_is_qsd8x50a_ffa()
  1159. -           && !machine_is_msm7x27_ffa())
  1160. -       return -ENOTSUPP;
  1161. -
  1162.     boost_vreg = vreg_get(NULL, "boost");
  1163.     if (IS_ERR(boost_vreg)) {
  1164.         pr_err("%s: boost vreg get failed\n", __func__);
  1165. Only in zte/arch/arm/mach-msm: smd_rpc_sym.c
  1166. diff -urB -x .git msm/arch/arm/mach-msm/smem_log.c zte/arch/arm/mach-msm/smem_log.c
  1167. --- msm/arch/arm/mach-msm/smem_log.c    Mon Nov  1 13:46:22 2010
  1168. +++ zte/arch/arm/mach-msm/smem_log.c    Mon Oct 18 11:35:16 2010
  1169. @@ -72,6 +73,8 @@
  1170.  #include <linux/sched.h>
  1171.  #include <linux/wait.h>
  1172.  #include <linux/delay.h>
  1173. +#include <linux/zte_memlog.h>
  1174. +#include <linux/vmalloc.h>
  1175.  
  1176.  #include <mach/msm_iomap.h>
  1177.  #include <mach/smem_log.h>
  1178. @@ -111,7 +114,7 @@
  1179.     uint32_t data3;
  1180.  };
  1181.  
  1182. -#define SMEM_LOG_NUM_ENTRIES 2000
  1183. +#define SMEM_LOG_NUM_ENTRIES 20000
  1184.  #define SMEM_LOG_EVENTS_SIZE (sizeof(struct smem_log_item) * \
  1185.                   SMEM_LOG_NUM_ENTRIES)
  1186.  
  1187. @@ -154,6 +157,27 @@
  1188.  
  1189.  static struct smem_log_inst inst[NUM];
  1190.  
  1191. +typedef struct {
  1192. +   uint32_t magic;
  1193. +   struct {
  1194. +       volatile uint32_t smem_log_write_idx;
  1195. +       volatile uint32_t smem_log_write_wrap;
  1196. +   } log_area_info[NUM];
  1197. +} smem_log_info;
  1198. +
  1199. +static smem_log_info *log_info;
  1200. +
  1201. +#define SMEM_LOG_MPROC_OFFSET   SMEM_LOG_ENTRY_OFFSET
  1202. +#define SMEM_LOG_STATIC_OFFSET  (SMEM_LOG_MPROC_OFFSET + SMEM_LOG_EVENTS_SIZE)
  1203. +#define SMEM_LOG_POWER_OFFSET   (SMEM_LOG_STATIC_OFFSET + SMEM_STATIC_LOG_EVENTS_SIZE)
  1204. +static uint32_t log_area_offset[NUM] = {
  1205. +  SMEM_LOG_MPROC_OFFSET,
  1206. +  SMEM_LOG_STATIC_OFFSET,
  1207. +  SMEM_LOG_POWER_OFFSET
  1208. +};
  1209. +
  1210. +#define SMEM_MAGIC  0xdeadbeef
  1211. +
  1212.  #if defined(CONFIG_DEBUG_FS)
  1213.  
  1214.  #define HSIZE 13
  1215. @@ -846,16 +870,19 @@
  1216.  {
  1217.     int ret;
  1218.  
  1219. -   inst[GEN].which_log = GEN;
  1220. -   inst[GEN].events =
  1221. -       (struct smem_log_item *)smem_alloc(SMEM_SMEM_LOG_EVENTS,
  1222. -                         SMEM_LOG_EVENTS_SIZE);
  1223. -   inst[GEN].idx = (uint32_t *)smem_alloc(SMEM_SMEM_LOG_IDX,
  1224. -                        sizeof(uint32_t));
  1225. -   if (!inst[GEN].events || !inst[GEN].idx) {
  1226. -       pr_err("%s: no log or log_idx allocated, "
  1227. -              "smem_log disabled\n", __func__);
  1228. +   log_info = (smem_log_info *)ioremap(MSM_SMEM_RAM_PHYS, MSM_SMEM_RAM_SIZE);
  1229. +   if (!log_info) {
  1230. +       pr_err("can't get remap MSM_RAM_CONSOLE_PHYS\n");
  1231. +       return -ENOMEM;
  1232. +   }
  1233. +   if (log_info->magic != SMEM_MAGIC) {
  1234. +       memset(log_info, 0, sizeof(*log_info));
  1235. +       log_info->magic = SMEM_MAGIC;
  1236.     }
  1237. +
  1238. +   inst[GEN].which_log = GEN;
  1239. +   inst[GEN].events = (struct smem_log_item *)((uint32_t)log_info + log_area_offset[GEN]);
  1240. +   inst[GEN].idx = (uint32_t *)&(log_info->log_area_info[GEN].smem_log_write_idx);
  1241.     inst[GEN].num = SMEM_LOG_NUM_ENTRIES;
  1242.     inst[GEN].read_idx = 0;
  1243.     inst[GEN].last_read_avail = SMEM_LOG_NUM_ENTRIES;
  1244. @@ -863,16 +890,8 @@
  1245.     inst[GEN].remote_spinlock = &remote_spinlock;
  1246.  
  1247.     inst[STA].which_log = STA;
  1248. -   inst[STA].events =
  1249. -       (struct smem_log_item *)
  1250. -       smem_alloc(SMEM_SMEM_STATIC_LOG_EVENTS,
  1251. -              SMEM_STATIC_LOG_EVENTS_SIZE);
  1252. -   inst[STA].idx = (uint32_t *)smem_alloc(SMEM_SMEM_STATIC_LOG_IDX,
  1253. -                            sizeof(uint32_t));
  1254. -   if (!inst[STA].events || !inst[STA].idx) {
  1255. -       pr_err("%s: no static log or log_idx "
  1256. -              "allocated, smem_log disabled\n", __func__);
  1257. -   }
  1258. +   inst[STA].events = (struct smem_log_item *)((uint32_t)log_info + log_area_offset[STA]);
  1259. +   inst[STA].idx = (uint32_t *)&(log_info->log_area_info[STA].smem_log_write_idx);
  1260.     inst[STA].num = SMEM_LOG_NUM_STATIC_ENTRIES;
  1261.     inst[STA].read_idx = 0;
  1262.     inst[STA].last_read_avail = SMEM_LOG_NUM_ENTRIES;
  1263. @@ -880,16 +899,8 @@
  1264.     inst[STA].remote_spinlock = &remote_spinlock_static;
  1265.  
  1266.     inst[POW].which_log = POW;
  1267. -   inst[POW].events =
  1268. -       (struct smem_log_item *)
  1269. -       smem_alloc(SMEM_SMEM_LOG_POWER_EVENTS,
  1270. -              SMEM_POWER_LOG_EVENTS_SIZE);
  1271. -   inst[POW].idx = (uint32_t *)smem_alloc(SMEM_SMEM_LOG_POWER_IDX,
  1272. -                            sizeof(uint32_t));
  1273. -   if (!inst[POW].events || !inst[POW].idx) {
  1274. -       pr_err("%s: no power log or log_idx "
  1275. -              "allocated, smem_log disabled\n", __func__);
  1276. -   }
  1277. +   inst[POW].events = (struct smem_log_item *)((uint32_t)log_info + log_area_offset[POW]);
  1278. +   inst[POW].idx = (uint32_t *)&(log_info->log_area_info[POW].smem_log_write_idx);
  1279.     inst[POW].num = SMEM_LOG_NUM_POWER_ENTRIES;
  1280.     inst[POW].read_idx = 0;
  1281.     inst[POW].last_read_avail = SMEM_LOG_NUM_ENTRIES;
  1282. @@ -1844,7 +1855,7 @@
  1283.     return _debug_dump_voters(buf, max);
  1284.  }
  1285.  
  1286. -static char debug_buffer[EVENTS_PRINT_SIZE];
  1287. +static char *debug_buffer = NULL;
  1288.  
  1289.  static ssize_t debug_read(struct file *file, char __user *buf,
  1290.               size_t count, loff_t *ppos)
  1291. @@ -1852,11 +1863,24 @@
  1292.     int r;
  1293.     static int bsize;
  1294.     int (*fill)(char *, int, uint32_t) = file->private_data;
  1295. +
  1296. +   /* Use vmalloc, __get_free_pages may fail. */
  1297. +   if (!debug_buffer) {
  1298. +       debug_buffer = (char *)vmalloc(EVENTS_PRINT_SIZE);
  1299. +       if (!debug_buffer)
  1300. +           return 0;
  1301. +   }
  1302.     if (!(*ppos))
  1303.         bsize = fill(debug_buffer, EVENTS_PRINT_SIZE, 0);
  1304.     DBG("%s: count %d ppos %d\n", __func__, count, (unsigned int)*ppos);
  1305.     r =  simple_read_from_buffer(buf, count, ppos, debug_buffer,
  1306.                      bsize);
  1307. +   if (r == 0) {
  1308. +       if (debug_buffer) {
  1309. +           vfree(debug_buffer);
  1310. +           debug_buffer = NULL;
  1311. +       }
  1312. +   }
  1313.     return r;
  1314.  }
  1315.  
  1316. diff -urB -x .git msm/arch/arm/mach-msm/socinfo.c zte/arch/arm/mach-msm/socinfo.c
  1317. --- msm/arch/arm/mach-msm/socinfo.c Mon Nov  1 13:46:22 2010
  1318. +++ zte/arch/arm/mach-msm/socinfo.c Fri Oct 15 17:41:38 2010
  1319. @@ -334,6 +334,31 @@
  1320.     return snprintf(buf, PAGE_SIZE, "%-.32s\n", hw_platform[hw_type]);
  1321.  }
  1322.  
  1323. +#ifdef CONFIG_ZTE_PLATFORM
  1324. +#ifdef CONFIG_ZTE_FTM_FLAG_SUPPORT
  1325. +static int g_zte_ftm_flag;
  1326. +void zte_ftm_set_value(int val)
  1327. +{
  1328. +   g_zte_ftm_flag = val;
  1329. +}
  1330. +int zte_get_ftm_flag(void)
  1331. +{
  1332. +   return g_zte_ftm_flag;
  1333. +}
  1334. +static ssize_t
  1335. +socinfo_show_zte_ftm(struct sys_device *dev,
  1336. +            struct sysdev_attribute *attr,
  1337. +            char *buf)
  1338. +{
  1339. +   return snprintf(buf, PAGE_SIZE, "%u\n", g_zte_ftm_flag);
  1340. +}
  1341. +
  1342. +static struct sysdev_attribute socinfo_zte_ftm_files[] = {
  1343. +   _SYSDEV_ATTR(zte_ftm_flag, 0444, socinfo_show_zte_ftm, NULL),
  1344. +};
  1345. +#endif
  1346. +#endif
  1347. +
  1348.  static ssize_t
  1349.  socinfo_show_platform_version(struct sys_device *dev,
  1350.              struct sysdev_attribute *attr,
  1351. @@ -413,6 +438,13 @@
  1352.                __func__, err);
  1353.         return;
  1354.     }
  1355. +#ifdef CONFIG_ZTE_PLATFORM
  1356. +#ifdef CONFIG_ZTE_FTM_FLAG_SUPPORT
  1357. +   socinfo_create_files(&soc_sys_device, socinfo_zte_ftm_files,
  1358. +               ARRAY_SIZE(socinfo_zte_ftm_files));
  1359. +#endif
  1360. +#endif
  1361. +  
  1362.     socinfo_create_files(&soc_sys_device, socinfo_v1_files,
  1363.                 ARRAY_SIZE(socinfo_v1_files));
  1364.     if (socinfo->v1.format < 2)
  1365. diff -urB -x .git msm/arch/arm/mach-msm/socinfo.h zte/arch/arm/mach-msm/socinfo.h
  1366. --- msm/arch/arm/mach-msm/socinfo.h Mon Nov  1 13:46:22 2010
  1367. +++ zte/arch/arm/mach-msm/socinfo.h Wed Oct 13 18:07:20 2010
  1368. @@ -50,6 +50,11 @@
  1369.  };
  1370.  
  1371.  enum msm_cpu socinfo_get_msm_cpu(void);
  1372. +#ifdef CONFIG_ZTE_PLATFORM
  1373. +#ifdef CONFIG_ZTE_FTM_FLAG_SUPPORT
  1374. +void zte_ftm_set_value(int val);
  1375. +#endif
  1376. +#endif
  1377.  uint32_t socinfo_get_id(void);
  1378.  uint32_t socinfo_get_version(void);
  1379.  char *socinfo_get_build_id(void);
  1380. diff -urB -x .git msm/arch/arm/mm/Kconfig zte/arch/arm/mm/Kconfig
  1381. --- msm/arch/arm/mm/Kconfig Mon Nov  1 13:46:22 2010
  1382. +++ zte/arch/arm/mm/Kconfig Wed Oct 13 18:07:42 2010
  1383. @@ -719,7 +719,7 @@
  1384.  
  1385.  config CACHE_L2X0
  1386.     bool "Enable the L2x0 outer cache controller"
  1387. -   depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || REALVIEW_EB_A9MP || MACH_MSM7X27_SURF || MACH_MSM7X27_FFA
  1388. +   depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || REALVIEW_EB_A9MP || MACH_MSM7X27_SURF || MACH_MSM7X27_FFA || ZTE_PLATFORM
  1389.     default y
  1390.     select OUTER_CACHE
  1391.     help
  1392. diff -urB -x .git msm/arch/arm/tools/mach-types zte/arch/arm/tools/mach-types
  1393. --- msm/arch/arm/tools/mach-types   Mon Nov  1 13:46:22 2010
  1394. +++ zte/arch/arm/tools/mach-types   Wed Oct 13 18:07:10 2010
  1395. @@ -2140,3 +2140,9 @@
  1396.  qsd8x50_ffa        MACH_QSD8X50_FFA    QSD8X50_FFA     1008002
  1397.  qsd8x50a_surf      MACH_QSD8X50A_SURF  QSD8X50A_SURF       1008003
  1398.  qsd8x50a_ffa       MACH_QSD8X50A_FFA   QSD8X50A_FFA        1008004
  1399. +raise              MACH_RAISE              RAISE               1009001
  1400. +mooncake           MACH_MOONCAKE           MOONCAKE            1009002
  1401. +joe                MACH_JOE                JOE                 1009003
  1402. +blade              MACH_BLADE          BLADE               1009004
  1403. +smooth             MACH_SMOOTH         SMOOTH              1009005
  1404. +r750               MACH_R750           R750                    1009006
  1405. Only in zte/drivers/char: consolemap_deftbl.c
  1406. Only in zte/drivers/char: defkeymap.c
  1407. diff -urB -x .git msm/drivers/char/msm_kgsl/kgsl.c zte/drivers/char/msm_kgsl/kgsl.c
  1408. --- msm/drivers/char/msm_kgsl/kgsl.c    Mon Nov  1 14:41:52 2010
  1409. +++ zte/drivers/char/msm_kgsl/kgsl.c    Mon Oct 18 11:37:40 2010
  1410. @@ -253,10 +254,6 @@
  1411.             if (kgsl_driver.clk_freq[KGSL_3D_MIN_FREQ])
  1412.                 clk_set_min_rate(kgsl_driver.yamato_grp_src_clk,
  1413.                     kgsl_driver.clk_freq[KGSL_3D_MIN_FREQ]);
  1414. -           if ((kgsl_driver.g12_device.hwaccess_blocked ==
  1415. -               KGSL_TRUE) ||
  1416. -               (kgsl_driver.power_flags &
  1417. -               KGSL_PWRFLAGS_G12_CLK_OFF))
  1418.                 pm_qos_update_requirement(
  1419.                     PM_QOS_SYSTEM_BUS_FREQ,
  1420.                     DRIVER_NAME, PM_QOS_DEFAULT_VALUE);
  1421. diff -urB -x .git msm/drivers/char/vt.c zte/drivers/char/vt.c
  1422. --- msm/drivers/char/vt.c   Mon Nov  1 12:09:49 2010
  1423. +++ zte/drivers/char/vt.c   Mon Oct 18 11:38:14 2010
  1424. @@ -1617,7 +1618,7 @@
  1425.     vc->vc_decscnm      = 0;
  1426.     vc->vc_decom        = 0;
  1427.     vc->vc_decawm       = 1;
  1428. -   vc->vc_deccm        = 1;
  1429. +   vc->vc_deccm        = 0;       
  1430.     vc->vc_decim        = 0;
  1431.  
  1432.     set_kbd(vc, decarm);
  1433. diff -urB -x .git msm/drivers/i2c/busses/i2c-gpio.c zte/drivers/i2c/busses/i2c-gpio.c
  1434. --- msm/drivers/i2c/busses/i2c-gpio.c   Mon Nov  1 12:09:51 2010
  1435. +++ zte/drivers/i2c/busses/i2c-gpio.c   Fri Oct 15 17:52:16 2010
  1436. @@ -128,8 +129,10 @@
  1437.     else if (pdata->scl_is_output_only)
  1438.         bit_data->udelay = 50;          /* 10 kHz */
  1439.     else
  1440. +   #if 0
  1441.         bit_data->udelay = 5;           /* 100 kHz */
  1442. -
  1443. +   #endif
  1444. +       bit_data->udelay = 2;           /* 400 kHz */
  1445.     if (pdata->timeout)
  1446.         bit_data->timeout = pdata->timeout;
  1447.     else
  1448. diff -urB -x .git msm/drivers/i2c/busses/i2c-msm.c zte/drivers/i2c/busses/i2c-msm.c
  1449. --- msm/drivers/i2c/busses/i2c-msm.c    Mon Nov  1 14:29:40 2010
  1450. +++ zte/drivers/i2c/busses/i2c-msm.c    Mon Oct 18 11:41:24 2010
  1451. @@ -601,11 +601,22 @@
  1452.         ret = -ENOSYS;
  1453.         goto err_clk_get_failed;
  1454.     }
  1455. -   if (!pdata->msm_i2c_config_gpio) {
  1456. -       dev_err(&pdev->dev, "config_gpio function not initialized\n");
  1457. -       ret = -ENOSYS;
  1458. -       goto err_clk_get_failed;
  1459. +
  1460. +#ifdef CONFIG_ZTE_PLATFORM
  1461. +       {
  1462. +           printk(KERN_INFO" Warning: msm on-chip aux i2c bus disabled on Board mooncake!\n");
  1463. +       }
  1464. +#else
  1465. +   {
  1466. +       if (!pdata->msm_i2c_config_gpio) {
  1467. +      
  1468. +           dev_err(&pdev->dev, "config_gpio function not initialized\n");
  1469. +           ret = -ENOSYS;
  1470. +           goto err_clk_get_failed;
  1471. +       }
  1472.     }
  1473. +#endif
  1474. +  
  1475.     /* We support frequencies upto FAST Mode(400KHz) */
  1476.     if (pdata->clk_freq <= 0 || pdata->clk_freq > 400000) {
  1477.         dev_err(&pdev->dev, "clock frequency not supported\n");
  1478. @@ -666,19 +677,27 @@
  1479.         goto err_i2c_add_adapter_failed;
  1480.     }
  1481.  
  1482. -   i2c_set_adapdata(&dev->adap_aux, dev);
  1483. -   dev->adap_aux.algo = &msm_i2c_algo;
  1484. -   strlcpy(dev->adap_aux.name,
  1485. -       "MSM I2C adapter-AUX",
  1486. -       sizeof(dev->adap_aux.name));
  1487. -
  1488. -   dev->adap_aux.nr = pdev->id + 1;
  1489. -   ret = i2c_add_numbered_adapter(&dev->adap_aux);
  1490. -   if (ret) {
  1491. -       dev_err(&pdev->dev, "auxiliary i2c_add_adapter failed\n");
  1492. -       i2c_del_adapter(&dev->adap_pri);
  1493. -       goto err_i2c_add_adapter_failed;
  1494. +  
  1495. +#ifdef CONFIG_ZTE_PLATFORM
  1496. +       {
  1497. +       }
  1498. +#else
  1499. +   {
  1500. +       i2c_set_adapdata(&dev->adap_aux, dev);
  1501. +       dev->adap_aux.algo = &msm_i2c_algo;
  1502. +       strlcpy(dev->adap_aux.name,
  1503. +           "MSM I2C adapter-AUX",
  1504. +           sizeof(dev->adap_aux.name));
  1505. +
  1506. +       dev->adap_aux.nr = pdev->id + 1;
  1507. +       ret = i2c_add_numbered_adapter(&dev->adap_aux);
  1508. +       if (ret) {
  1509. +           dev_err(&pdev->dev, "auxiliary i2c_add_adapter failed\n");
  1510. +           i2c_del_adapter(&dev->adap_pri);
  1511. +           goto err_i2c_add_adapter_failed;
  1512. +       }
  1513.     }
  1514. +#endif
  1515.     ret = request_irq(dev->irq, msm_i2c_interrupt,
  1516.             IRQF_TRIGGER_RISING, pdev->name, dev);
  1517.     if (ret) {
  1518. @@ -693,10 +712,17 @@
  1519.     dev->clk_state = 0;
  1520.     /* Config GPIOs for primary and secondary lines */
  1521.     pdata->msm_i2c_config_gpio(dev->adap_pri.nr, 1);
  1522. -   pdata->msm_i2c_config_gpio(dev->adap_aux.nr, 1);
  1523. +
  1524. +#ifdef CONFIG_ZTE_PLATFORM
  1525. +       {
  1526. +       }
  1527. +#else
  1528. +   {
  1529. +       pdata->msm_i2c_config_gpio(dev->adap_aux.nr, 1);
  1530. +   }
  1531. +#endif
  1532.     clk_disable(dev->clk);
  1533.     setup_timer(&dev->pwr_timer, msm_i2c_pwr_timer, (unsigned long) dev);
  1534. -
  1535.     return 0;
  1536.  
  1537.  /* free_irq(dev->irq, dev); */
  1538. diff -urB -x .git msm/drivers/i2c/chips/Kconfig zte/drivers/i2c/chips/Kconfig
  1539. --- msm/drivers/i2c/chips/Kconfig   Mon Nov  1 13:46:22 2010
  1540. +++ zte/drivers/i2c/chips/Kconfig   Wed Oct 13 18:15:50 2010
  1541. @@ -102,11 +102,35 @@
  1542.       This driver can also be built as a module.  If so, the module
  1543.       will be called tsl2550.
  1544.  
  1545. +config SENSORS_TSL2771
  1546. +   tristate "Taos TSL2771 ambient light and prox sensor"
  1547. +   depends on I2C
  1548. +   default n
  1549. +   help
  1550. +     If you say yes here you get support for the Taos TSL2771
  1551. +     ambient light and prox sensor.
  1552. +    
  1553. +config SENSORS_AK8973
  1554. +   tristate "AK8973"
  1555. +   depends on I2C
  1556. +   default n
  1557. +   help
  1558. +     If you say yes here you get support for Asahi Kasei's
  1559. +     orientation sensor AK8973.
  1560. +    
  1561.  config SENSORS_AKM8976
  1562.     tristate "AKM8976 Compass Driver"
  1563.     depends on I2C
  1564.     help
  1565.      AKM8976 Compass Driver implemented by HTC.
  1566. +    
  1567. +config SENSOR_LIS302DL
  1568. +        tristate "ST LIS302DL acceleration sensor support"
  1569. +   depends on I2C
  1570. +   default y
  1571. +   help
  1572. +     if your say yes here your get support for LIS302
  1573. +     acceleration sensor support
  1574.  
  1575.  config SENSORS_PCA963X
  1576.     tristate "Philips PCA963X 4-bit I2C-bus LED"
  1577. diff -urB -x .git msm/drivers/i2c/chips/Makefile zte/drivers/i2c/chips/Makefile
  1578. --- msm/drivers/i2c/chips/Makefile  Mon Nov  1 13:46:22 2010
  1579. +++ zte/drivers/i2c/chips/Makefile  Wed Oct 13 18:15:50 2010
  1580. @@ -18,9 +18,12 @@
  1581.  obj-$(CONFIG_SENSORS_PCF8574)  += pcf8574.o
  1582.  obj-$(CONFIG_PCF8575)      += pcf8575.o
  1583.  obj-$(CONFIG_SENSORS_PCF8591)  += pcf8591.o
  1584. +obj-$(CONFIG_SENSORS_AK8973)   += akm8973.o
  1585.  obj-$(CONFIG_SENSORS_TSL2550)  += tsl2550.o
  1586.  obj-$(CONFIG_SENSORS_MT9T013)  += mt9t013.o
  1587.  
  1588. +obj-$(CONFIG_SENSOR_LIS302DL)      += lis302dl.o
  1589. +obj-$(CONFIG_SENSORS_TSL2771)  += taos.o
  1590.  ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
  1591.  EXTRA_CFLAGS += -DDEBUG
  1592.  endif
  1593. Only in zte/drivers/i2c/chips: akm8973.c
  1594. Only in zte/drivers/i2c/chips: lis302dl.c
  1595. Only in zte/drivers/i2c/chips: taos.c
  1596. Only in zte/drivers/i2c/chips: taos_common.h
  1597. diff -urB -x .git msm/drivers/input/misc/gpio_matrix.c zte/drivers/input/misc/gpio_matrix.c
  1598. --- msm/drivers/input/misc/gpio_matrix.c    Mon Nov  1 13:46:22 2010
  1599. +++ zte/drivers/input/misc/gpio_matrix.c    Mon Oct 18 11:59:02 2010
  1600. @@ -20,6 +20,14 @@
  1601.  #include <linux/interrupt.h>
  1602.  #include <linux/wakelock.h>
  1603.  
  1604. +#if defined(CONFIG_MACH_R750)
  1605. +#define TS_KEY_REPORT
  1606. +#endif
  1607. +
  1608. +#if defined(CONFIG_MACH_SMOOTH)
  1609. +#define FLIP_DET
  1610. +#endif
  1611. +
  1612.  struct gpio_kp {
  1613.     struct input_dev *input_dev;
  1614.     struct gpio_event_matrix_info *keypad_info;
  1615. @@ -33,6 +41,55 @@
  1616.     unsigned long keys_pressed[0];
  1617.  };
  1618.  
  1619. +#ifdef FLIP_DET
  1620. +#define FLIP_DET_IRQ MSM_GPIO_TO_INT(49)
  1621. +
  1622. +static irqreturn_t flip_detect_irq_handler(int irq, void *dev_id)
  1623. +{
  1624. +   struct gpio_kp *kp = dev_id;
  1625. +
  1626. +   disable_irq_nosync(irq);
  1627. +
  1628. +   if(gpio_get_value(49) == 0)
  1629. +   {
  1630. +       input_report_key(kp->input_dev, KEY_FLIP_DOWN, 1);
  1631. +       input_report_key(kp->input_dev, KEY_FLIP_DOWN, 0);
  1632. +   }
  1633. +   else
  1634. +   {
  1635. +       input_report_key(kp->input_dev, KEY_FLIP_UP, 1);
  1636. +       input_report_key(kp->input_dev, KEY_FLIP_UP, 0);
  1637. +   }
  1638. +
  1639. +   enable_irq(irq);
  1640. +   return IRQ_HANDLED;
  1641. +}
  1642. +
  1643. +static int slip_detect_init(struct gpio_kp *kp)
  1644. +{
  1645. +   int err;
  1646. +
  1647. +   err = request_irq(FLIP_DET_IRQ, flip_detect_irq_handler, (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING), "gpio-event", kp);//ZTE_KEY_ZT_20100513_003
  1648. +   if (err)
  1649. +   {
  1650. +       pr_err("gpiomatrix: request_irq failed for flip detect\n");
  1651. +       goto err_request_irq_failed;
  1652. +   }
  1653. +
  1654. +   err = set_irq_wake(FLIP_DET_IRQ, 1);
  1655. +   if (err)
  1656. +   {
  1657. +       pr_err("gpiomatrix: request_irq failed for flip detect\n");
  1658. +       goto err_request_irq_failed;
  1659. +   }
  1660. +   return 0;
  1661. +
  1662. +err_request_irq_failed:
  1663. +   free_irq(FLIP_DET_IRQ, kp);
  1664. +   return 1;
  1665. +}
  1666. +#endif
  1667. +
  1668.  static void clear_phantom_key(struct gpio_kp *kp, int out, int in)
  1669.  {
  1670.     struct gpio_event_matrix_info *mi = kp->keypad_info;
  1671. @@ -131,7 +188,11 @@
  1672.     struct gpio_kp *kp = container_of(timer, struct gpio_kp, timer);
  1673.     struct gpio_event_matrix_info *mi = kp->keypad_info;
  1674.     unsigned gpio_keypad_flags = mi->flags;
  1675. +#ifdef CONFIG_ZTE_PLATFORM
  1676. +   unsigned polarity = !!(gpio_keypad_flags & !GPIOKPF_ACTIVE_HIGH);
  1677. +#else
  1678.     unsigned polarity = !!(gpio_keypad_flags & GPIOKPF_ACTIVE_HIGH);
  1679. +#endif
  1680.  
  1681.     out = kp->current_output;
  1682.     if (out == mi->noutputs) {
  1683. @@ -218,7 +279,12 @@
  1684.     for (i = 0; i < mi->noutputs; i++) {
  1685.         if (gpio_keypad_flags & GPIOKPF_DRIVE_INACTIVE)
  1686.             gpio_set_value(mi->output_gpios[i],
  1687. +#ifdef CONFIG_ZTE_PLATFORM
  1688. +               (gpio_keypad_flags & GPIOKPF_ACTIVE_HIGH));
  1689. +#else
  1690.                 !(gpio_keypad_flags & GPIOKPF_ACTIVE_HIGH));
  1691. +#endif
  1692. +
  1693.         else
  1694.             gpio_direction_input(mi->output_gpios[i]);
  1695.     }
  1696. @@ -246,7 +312,12 @@
  1697.         request_flags = IRQF_TRIGGER_LOW;
  1698.         break;
  1699.     case GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_ACTIVE_HIGH:
  1700. +#ifdef CONFIG_ZTE_PLATFORM
  1701. +       request_flags = IRQF_TRIGGER_LOW;
  1702. +#else
  1703.         request_flags = IRQF_TRIGGER_HIGH;
  1704. +#endif
  1705. +
  1706.         break;
  1707.     }
  1708.  
  1709. @@ -261,11 +332,13 @@
  1710.                 "irq %d\n", mi->input_gpios[i], irq);
  1711.             goto err_request_irq_failed;
  1712.         }
  1713. +#ifndef CONFIG_ZTE_PLATFORM
  1714.         err = set_irq_wake(irq, 1);
  1715.         if (err) {
  1716.             pr_err("gpiomatrix: set_irq_wake failed for input %d, "
  1717.                 "irq %d\n", mi->input_gpios[i], irq);
  1718.         }
  1719. +#endif
  1720.         disable_irq(irq);
  1721.     }
  1722.     return 0;
  1723. @@ -279,6 +352,16 @@
  1724.     return err;
  1725.  }
  1726.  
  1727. +#ifdef TS_KEY_REPORT
  1728. +struct input_dev *input_keypad_dev = NULL;
  1729. +
  1730. +struct input_dev *get_keyinput_dev(void)
  1731. +{
  1732. +   return input_keypad_dev;
  1733. +}
  1734. +EXPORT_SYMBOL(get_keyinput_dev);
  1735. +#endif
  1736. +
  1737.  int gpio_event_matrix_func(struct input_dev *input_dev,
  1738.     struct gpio_event_info *info, void **data, int func)
  1739.  {
  1740. @@ -319,6 +402,18 @@
  1741.                 __set_bit(mi->keymap[i], input_dev->keybit);
  1742.         }
  1743.  
  1744. +#ifdef TS_KEY_REPORT
  1745. +       __set_bit(KEY_MENU, input_dev->keybit);
  1746. +       __set_bit(KEY_HOME, input_dev->keybit);
  1747. +       __set_bit(KEY_BACK, input_dev->keybit);
  1748. +       input_keypad_dev = kp->input_dev;
  1749. +#endif
  1750. +
  1751. +#ifdef FLIP_DET
  1752. +       __set_bit(KEY_FLIP_UP, input_dev->keybit);
  1753. +       __set_bit(KEY_FLIP_DOWN, input_dev->keybit);
  1754. +#endif
  1755. +
  1756.         for (i = 0; i < mi->noutputs; i++) {
  1757.             if (gpio_cansleep(mi->output_gpios[i])) {
  1758.                 pr_err("gpiomatrix: unsupported output gpio %d,"
  1759. @@ -334,7 +429,11 @@
  1760.             }
  1761.             if (mi->flags & GPIOKPF_DRIVE_INACTIVE)
  1762.                 err = gpio_direction_output(mi->output_gpios[i],
  1763. +#ifdef CONFIG_ZTE_PLATFORM
  1764. +                   (mi->flags & GPIOKPF_ACTIVE_HIGH));
  1765. +#else     
  1766.                     !(mi->flags & GPIOKPF_ACTIVE_HIGH));
  1767. +#endif
  1768.             else
  1769.                 err = gpio_direction_input(mi->output_gpios[i]);
  1770.             if (err) {
  1771. @@ -375,6 +474,11 @@
  1772.         hrtimer_start(&kp->timer, ktime_set(0, 10000),
  1773.                  HRTIMER_MODE_REL);
  1774.  
  1775. +#ifdef FLIP_DET
  1776. +       err  = slip_detect_init(kp);
  1777. +       if (err != 0)
  1778. +           pr_info("PIO Matrix Keypad Driver: init for slip detect failed\n");
  1779. +#endif
  1780.         return 0;
  1781.     }
  1782.  
  1783. diff -urB -x .git msm/drivers/input/mouse/Kconfig zte/drivers/input/mouse/Kconfig
  1784. --- msm/drivers/input/mouse/Kconfig Mon Nov  1 13:46:22 2010
  1785. +++ zte/drivers/input/mouse/Kconfig Fri Oct 15 18:22:42 2010
  1786. @@ -321,4 +321,19 @@
  1787.     help
  1788.       Say Y here to support PXA930 Trackball mouse.
  1789.  
  1790. +config AVAGO_OFN
  1791. +   tristate "AVAGO OFN(Optical Finger Navigation)"
  1792. +   depends on I2C_MSM && MACH_RAISE
  1793. +   default y
  1794. +   help
  1795. +     Say Y here if you have a ofn attached.
  1796. +     To compile this driver as a module, choose M here
  1797. +
  1798. +config JOGBALL_KEY
  1799. +  tristate "JOGBALL UP/DOWN/LEFT/RIGHT"
  1800. +  default n
  1801. +  help
  1802. +     Say Y here if you have a jogball attached.
  1803. +     To compile this driver as a module, choose M here
  1804. +
  1805.  endif
  1806. diff -urB -x .git msm/drivers/input/mouse/Makefile zte/drivers/input/mouse/Makefile
  1807. --- msm/drivers/input/mouse/Makefile    Mon Nov  1 13:46:22 2010
  1808. +++ zte/drivers/input/mouse/Makefile    Fri Oct 15 18:23:00 2010
  1809. @@ -21,6 +21,8 @@
  1810.  obj-$(CONFIG_MOUSE_OFN_ATLAB)           += ofn_atlab.o
  1811.  obj-$(CONFIG_MOUSE_OFN_ATLAB_M33C01)   += ofn_m33c01_atlab.o
  1812.  obj-$(CONFIG_MOUSE_GPIO)       += gpio_mouse.o
  1813. +obj-$(CONFIG_AVAGO_OFN) += avago_ofn.o
  1814. +obj-$(CONFIG_JOGBALL_KEY) += jogball_key.o
  1815.  
  1816.  psmouse-objs := psmouse-base.o synaptics.o
  1817.  
  1818. Only in zte/drivers/input/mouse: avago_ofn.c
  1819. Only in zte/drivers/input/mouse: jogball_key.c
  1820. diff -urB -x .git msm/drivers/input/touchscreen/Kconfig zte/drivers/input/touchscreen/Kconfig
  1821. --- msm/drivers/input/touchscreen/Kconfig   Mon Nov  1 13:46:22 2010
  1822. +++ zte/drivers/input/touchscreen/Kconfig   Sat Oct 16 11:16:26 2010
  1823. @@ -1,4 +1,4 @@
  1824. -#
  1825. +
  1826.  # Touchscreen driver configuration
  1827.  #
  1828.  menuconfig INPUT_TOUCHSCREEN
  1829. @@ -201,7 +201,7 @@
  1830.  
  1831.  config TOUCHSCREEN_MSM
  1832.     bool "Qualcomm MSM touchscreen controller"
  1833. -   depends on ARCH_MSM7X30
  1834. +#depends on ARCH_MSM7X30
  1835.     default n
  1836.     help
  1837.       Say Y here if you have a 4-wire resistive touchscreen panel
  1838. @@ -447,5 +447,9 @@
  1839.       MSM/QSD based Surf or FFAs. These hacks are required inorder
  1840.       to Android framework to receive adjusted x, y co-ordinates
  1841.       until proper calibration framework is in place.
  1842. -
  1843. +config TOUCHSCREEN_CYPRESS_I2C_RMI
  1844. +   tristate "Cypress i2c touchscreen"
  1845. +   depends on I2C
  1846. +   help
  1847. +     This enables support for Cypress RMI over I2C based touchscreens.
  1848.  endif
  1849. diff -urB -x .git msm/drivers/input/touchscreen/Makefile zte/drivers/input/touchscreen/Makefile
  1850. --- msm/drivers/input/touchscreen/Makefile  Mon Nov  1 13:46:22 2010
  1851. +++ zte/drivers/input/touchscreen/Makefile  Sat Oct 16 11:15:50 2010
  1852. @@ -38,3 +40,4 @@
  1853.  wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713) += wm9713.o
  1854.  obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o
  1855.  obj-$(CONFIG_TOUCHSCREEN_MSM_LEGACY)       += msm_touch.o
  1856. +obj-$(CONFIG_TOUCHSCREEN_CYPRESS_I2C_RMI)  += cypress_i2c_rmi.o
  1857. Only in zte/drivers/input/touchscreen: cypress_i2c_rmi.c
  1858. diff -urB -x .git msm/drivers/input/touchscreen/msm_ts.c zte/drivers/input/touchscreen/msm_ts.c
  1859. --- msm/drivers/input/touchscreen/msm_ts.c  Mon Nov  1 13:46:22 2010
  1860. +++ zte/drivers/input/touchscreen/msm_ts.c  Mon Oct 18 12:10:16 2010
  1861. @@ -27,6 +28,7 @@
  1862.  #include <linux/mfd/marimba-tsadc.h>
  1863.  
  1864.  #include <mach/msm_ts.h>
  1865. +#include <linux/jiffies.h>  
  1866.  
  1867.  #define TSSC_CTL           0x100
  1868.  #define    TSSC_CTL_PENUP_IRQ  (1 << 12)
  1869. @@ -51,6 +53,7 @@
  1870.  #define TSSC_TEST_1            0x198
  1871.     #define TSSC_TEST_1_EN_GATE_DEBOUNCE (1 << 2)
  1872.  #define TSSC_TEST_2            0x19c
  1873. +#define TS_PENUP_TIMEOUT_MS 70 // 20  -->  70  
  1874.  
  1875.  struct msm_ts {
  1876.     struct msm_ts_platform_data *pdata;
  1877. @@ -58,7 +61,7 @@
  1878.     void __iomem            *tssc_base;
  1879.     uint32_t            ts_down:1;
  1880.     struct ts_virt_key      *vkey_down;
  1881. -   struct marimba_tsadc_client *ts_client;
  1882. +   struct timer_list timer;  
  1883.  };
  1884.  
  1885.  static uint32_t msm_tsdebug;
  1886. @@ -70,29 +73,19 @@
  1887.  static void setup_next_sample(struct msm_ts *ts)
  1888.  {
  1889.     uint32_t tmp;
  1890. -
  1891. -   /* 1.2ms debounce time */
  1892. -   tmp = ((2 << 7) | TSSC_CTL_DEBOUNCE_EN | TSSC_CTL_EN_AVERAGE |
  1893. +   /* 3ms debounce time */
  1894. +   tmp = ((5 << 7) | TSSC_CTL_DEBOUNCE_EN | TSSC_CTL_EN_AVERAGE |
  1895.            TSSC_CTL_MODE_MASTER | TSSC_CTL_ENABLE);
  1896.     tssc_writel(ts, tmp, TSSC_CTL);
  1897.  }
  1898.  
  1899. -static struct ts_virt_key *find_virt_key(struct msm_ts *ts,
  1900. -                    struct msm_ts_virtual_keys *vkeys,
  1901. -                    uint32_t val)
  1902. -{
  1903. -   int i;
  1904. -
  1905. -   if (!vkeys)
  1906. -       return NULL;
  1907.  
  1908. -   for (i = 0; i < vkeys->num_keys; ++i)
  1909. -       if ((val >= vkeys->keys[i].min) && (val <= vkeys->keys[i].max))
  1910. -           return &vkeys->keys[i];
  1911. -   return NULL;
  1912. +static void ts_timer(unsigned long arg)
  1913. +{
  1914. +   struct msm_ts *ts = (struct msm_ts *)arg;
  1915. +   input_report_key(ts->input_dev, BTN_TOUCH, 0);
  1916. +   input_sync(ts->input_dev);
  1917.  }
  1918. -
  1919. -
  1920.  static irqreturn_t msm_ts_irq(int irq, void *dev_id)
  1921.  {
  1922.     struct msm_ts *ts = dev_id;
  1923. @@ -102,7 +95,8 @@
  1924.     int x, y, z1, z2;
  1925.     int was_down;
  1926.     int down;
  1927. -
  1928. +  int z=0;  
  1929. +  del_timer_sync(&ts->timer);
  1930.     tssc_ctl = tssc_readl(ts, TSSC_CTL);
  1931.     tssc_status = tssc_readl(ts, TSSC_STATUS);
  1932.     tssc_avg12 = tssc_readl(ts, TSSC_AVG_12);
  1933. @@ -132,71 +126,35 @@
  1934.     if (msm_tsdebug & 2)
  1935.         printk("%s: down=%d, x=%d, y=%d, z1=%d, z2=%d, status %x\n",
  1936.                __func__, down, x, y, z1, z2, tssc_status);
  1937. -
  1938. -   if (!was_down && down) {
  1939. -       struct ts_virt_key *vkey = NULL;
  1940. -
  1941. -       if (pdata->vkeys_y && (y > pdata->virt_y_start))
  1942. -           vkey = find_virt_key(ts, pdata->vkeys_y, x);
  1943. -       if (!vkey && ts->pdata->vkeys_x && (x > pdata->virt_x_start))
  1944. -           vkey = find_virt_key(ts, pdata->vkeys_x, y);
  1945. -
  1946. -       if (vkey) {
  1947. -           WARN_ON(ts->vkey_down != NULL);
  1948. -           if(msm_tsdebug)
  1949. -               printk("%s: virtual key down %d\n", __func__,
  1950. -                      vkey->key);
  1951. -           ts->vkey_down = vkey;
  1952. -           input_report_key(ts->input_dev, vkey->key, 1);
  1953. -           input_sync(ts->input_dev);
  1954. -           return IRQ_HANDLED;
  1955. +   if (down)
  1956. +       {
  1957. +           if ( 0 == z1 ) return IRQ_HANDLED;
  1958. +           z = ( ( z2 - z1 - 2)*x) / ( z1 + 2 );
  1959. +           z = ( 2500 - z ) * 1000 / ( 2500 - 900 );
  1960. +           if( z < 0 ) return IRQ_HANDLED;
  1961.         }
  1962. -   } else if (ts->vkey_down != NULL) {
  1963. -       if (!down) {
  1964. -           if(msm_tsdebug)
  1965. -               printk("%s: virtual key up %d\n", __func__,
  1966. -                      ts->vkey_down->key);
  1967. -           input_report_key(ts->input_dev, ts->vkey_down->key, 0);
  1968. -           input_sync(ts->input_dev);
  1969. -           ts->vkey_down = NULL;
  1970. -       }
  1971. -       return IRQ_HANDLED;
  1972. -   }
  1973. +  
  1974.  
  1975. -   if (down) {
  1976. +   if (down)
  1977. +       {
  1978.         input_report_abs(ts->input_dev, ABS_X, x);
  1979.         input_report_abs(ts->input_dev, ABS_Y, y);
  1980. -       input_report_abs(ts->input_dev, ABS_PRESSURE, z1);
  1981. +           input_report_abs(ts->input_dev, ABS_PRESSURE, z);
  1982.     }
  1983.     input_report_key(ts->input_dev, BTN_TOUCH, down);
  1984.     input_sync(ts->input_dev);
  1985.  
  1986. +   if (30 == irq)mod_timer(&ts->timer,jiffies + msecs_to_jiffies(TS_PENUP_TIMEOUT_MS));
  1987.     return IRQ_HANDLED;
  1988.  }
  1989. -
  1990. -static void dump_tssc_regs(struct msm_ts *ts)
  1991. -{
  1992. -#define __dump_tssc_reg(r) \
  1993. -       do { printk(#r " %x\n", tssc_readl(ts, (r))); } while(0)
  1994. -
  1995. -   __dump_tssc_reg(TSSC_CTL);
  1996. -   __dump_tssc_reg(TSSC_OPN);
  1997. -   __dump_tssc_reg(TSSC_SAMPLING_INT);
  1998. -   __dump_tssc_reg(TSSC_STATUS);
  1999. -   __dump_tssc_reg(TSSC_AVG_12);
  2000. -   __dump_tssc_reg(TSSC_AVG_34);
  2001. -   __dump_tssc_reg(TSSC_TEST_1);
  2002. -#undef __dump_tssc_reg
  2003. -}
  2004. -
  2005.  static int __devinit msm_ts_hw_init(struct msm_ts *ts)
  2006.  {
  2007. +#if 0
  2008.     uint32_t tmp;
  2009.  
  2010.     /* Enable the register clock to tssc so we can configure it. */
  2011.     tssc_writel(ts, TSSC_CTL_ENABLE, TSSC_CTL);
  2012.     /* Enable software reset*/
  2013. -   tssc_writel(ts, TSSC_CTL_SW_RESET, TSSC_CTL);
  2014.  
  2015.     /* op1 - measure X, 1 sample, 12bit resolution */
  2016.     tmp = (TSSC_OPN_4WIRE_X << 16) | (2 << 8) | (2 << 0);
  2017. @@ -215,8 +173,7 @@
  2018.     tssc_writel(ts, 16, TSSC_SAMPLING_INT);
  2019.     /* Enable gating logic to fix the timing delays caused because of
  2020.      * enabling debounce logic */
  2021. -   tssc_writel(ts, TSSC_TEST_1_EN_GATE_DEBOUNCE, TSSC_TEST_1);
  2022. -
  2023. +#endif
  2024.     setup_next_sample(ts);
  2025.  
  2026.     return 0;
  2027. @@ -230,8 +187,6 @@
  2028.     struct resource *irq1_res;
  2029.     struct resource *irq2_res;
  2030.     int err = 0;
  2031. -   int i;
  2032. -   struct marimba_tsadc_client *ts_client;
  2033.  
  2034.     tssc_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tssc");
  2035.     irq1_res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "tssc1");
  2036. @@ -261,7 +216,7 @@
  2037.         err = -ENOMEM;
  2038.         goto err_ioremap_tssc;
  2039.     }
  2040. -
  2041. +#if 0
  2042.     ts_client = marimba_tsadc_register(pdev, 1);
  2043.     if (IS_ERR(ts_client)) {
  2044.         err = -ENODEV;
  2045. @@ -276,7 +231,7 @@
  2046.         pr_err("%s: Unable to start TSADC\n", __func__);
  2047.         goto err_start_tsadc;
  2048.     }
  2049. -
  2050. +#endif
  2051.     ts->input_dev = input_allocate_device();
  2052.     if (ts->input_dev == NULL) {
  2053.         pr_err("failed to allocate touchscreen input device\n");
  2054. @@ -296,19 +251,13 @@
  2055.     input_set_abs_params(ts->input_dev, ABS_PRESSURE, pdata->min_press,
  2056.                  pdata->max_press, 0, 0);
  2057.  
  2058. -   for (i = 0; pdata->vkeys_x && (i < pdata->vkeys_x->num_keys); ++i)
  2059. -       input_set_capability(ts->input_dev, EV_KEY,
  2060. -                    pdata->vkeys_x->keys[i].key);
  2061. -   for (i = 0; pdata->vkeys_y && (i < pdata->vkeys_y->num_keys); ++i)
  2062. -       input_set_capability(ts->input_dev, EV_KEY,
  2063. -                    pdata->vkeys_y->keys[i].key);
  2064. -
  2065.     err = input_register_device(ts->input_dev);
  2066.     if (err != 0) {
  2067.         pr_err("%s: failed to register input device\n", __func__);
  2068.         goto err_input_dev_reg;
  2069.     }
  2070.  
  2071. +  setup_timer(&ts->timer, ts_timer, (unsigned long)ts);  
  2072.     msm_ts_hw_init(ts);
  2073.  
  2074.     err = request_irq(irq1_res->start, msm_ts_irq,
  2075. @@ -331,7 +280,6 @@
  2076.  
  2077.     pr_info("%s: tssc_base=%p irq1=%d irq2=%d\n", __func__,
  2078.         ts->tssc_base, (int)irq1_res->start, (int)irq2_res->start);
  2079. -   dump_tssc_regs(ts);
  2080.     return 0;
  2081.  
  2082.  err_request_irq2:
  2083. @@ -339,6 +287,7 @@
  2084.  
  2085.  err_request_irq1:
  2086.     /* disable the tssc */
  2087. +   del_timer_sync(&ts->timer);
  2088.     tssc_writel(ts, TSSC_CTL_ENABLE, TSSC_CTL);
  2089.  
  2090.  err_input_dev_reg:
  2091. @@ -346,17 +295,19 @@
  2092.     input_free_device(ts->input_dev);
  2093.  
  2094.  err_alloc_input_dev:
  2095. +#if 0
  2096.  err_start_tsadc:
  2097.     marimba_tsadc_unregister(ts->ts_client);
  2098.  
  2099.  err_tsadc_register:
  2100. +#endif
  2101.     iounmap(ts->tssc_base);
  2102.  
  2103.  err_ioremap_tssc:
  2104.     kfree(ts);
  2105.     return err;
  2106.  }
  2107. -
  2108. +#if 0
  2109.  static int __devexit msm_ts_remove(struct platform_device *pdev)
  2110.  {
  2111.     struct msm_ts *ts = platform_get_drvdata(pdev);
  2112. @@ -376,28 +327,25 @@
  2113.  
  2114.     return 0;
  2115.  }
  2116. -
  2117. +#endif
  2118.  static struct platform_driver msm_touchscreen_driver = {
  2119.     .driver = {
  2120.         .name = "msm_touchscreen",
  2121.         .owner = THIS_MODULE,
  2122.     },
  2123.     .probe = msm_ts_probe,
  2124. -   .remove = __devexit_p(msm_ts_remove),
  2125.  };
  2126.  
  2127.  static int __init msm_ts_init(void)
  2128.  {
  2129.     return platform_driver_register(&msm_touchscreen_driver);
  2130.  }
  2131. -
  2132. +#if 0
  2133.  static void __exit msm_ts_exit(void)
  2134.  {
  2135.     platform_driver_unregister(&msm_touchscreen_driver);
  2136.  }
  2137. -
  2138. +#endif
  2139.  device_initcall(msm_ts_init);
  2140. -module_exit(msm_ts_exit);
  2141.  MODULE_DESCRIPTION("Qualcomm MSM/QSD Touchscreen controller driver");
  2142.  MODULE_LICENSE("GPL");
  2143. -MODULE_ALIAS("platform:msm_touchscreen");
  2144. diff -urB -x .git msm/drivers/input/touchscreen/synaptics_i2c_rmi.c zte/drivers/input/touchscreen/synaptics_i2c_rmi.c
  2145. --- msm/drivers/input/touchscreen/synaptics_i2c_rmi.c   Mon Nov  1 13:46:22 2010
  2146. +++ zte/drivers/input/touchscreen/synaptics_i2c_rmi.c   Thu Oct 28 12:00:58 2010
  2147. @@ -21,33 +21,36 @@
  2148.  #include <linux/input.h>
  2149.  #include <linux/interrupt.h>
  2150.  #include <linux/io.h>
  2151. +#include <linux/proc_fs.h>
  2152.  #include <linux/platform_device.h>
  2153.  #include <linux/synaptics_i2c_rmi.h>
  2154. -
  2155. -#define swap(x, y) do { typeof(x) z = x; x = y; y = z; } while (0)
  2156. -
  2157. +#if 1
  2158. +#include <mach/gpio.h>
  2159. +#endif
  2160. +unsigned long polling_time = 30000000;
  2161. +#if defined(CONFIG_MACH_BLADE)//P729B touchscreen enable
  2162. +#define GPIO_TOUCH_EN_OUT  31
  2163. +#elif defined(CONFIG_MACH_R750)//R750 touchscreen enable
  2164. +#define GPIO_TOUCH_EN_OUT  33
  2165. +#else//other projects
  2166. +#define GPIO_TOUCH_EN_OUT  31
  2167. +#endif
  2168.  static struct workqueue_struct *synaptics_wq;
  2169. +static struct i2c_driver synaptics_ts_driver;
  2170. +#define POLL_IN_INT
  2171.  
  2172. -struct synaptics_ts_data {
  2173. +struct synaptics_ts_data
  2174. +{
  2175.     uint16_t addr;
  2176.     struct i2c_client *client;
  2177.     struct input_dev *input_dev;
  2178.     int use_irq;
  2179.     struct hrtimer timer;
  2180. +   struct hrtimer resume_timer;
  2181.     struct work_struct  work;
  2182.     uint16_t max[2];
  2183. -   int snap_state[2][2];
  2184. -   int snap_down_on[2];
  2185. -   int snap_down_off[2];
  2186. -   int snap_up_on[2];
  2187. -   int snap_up_off[2];
  2188. -   int snap_down[2];
  2189. -   int snap_up[2];
  2190. -   uint32_t flags;
  2191. -   int (*power)(int on);
  2192.     struct early_suspend early_suspend;
  2193.  };
  2194. -
  2195.  #ifdef CONFIG_HAS_EARLYSUSPEND
  2196.  static void synaptics_ts_early_suspend(struct early_suspend *h);
  2197.  static void synaptics_ts_late_resume(struct early_suspend *h);
  2198. @@ -52,158 +55,149 @@
  2199.  static void synaptics_ts_early_suspend(struct early_suspend *h);
  2200.  static void synaptics_ts_late_resume(struct early_suspend *h);
  2201.  #endif
  2202. +static int synaptics_i2c_read(struct i2c_client *client, int reg, u8 * buf, int count)
  2203. +{
  2204. +    int rc;
  2205. +    int ret = 0;
  2206.  
  2207. -static int synaptics_init_panel(struct synaptics_ts_data *ts)
  2208. +    buf[0] = 0xff;
  2209. +   buf[1] = reg >> 8;
  2210. +    rc = i2c_master_send(client, buf, 2);
  2211. +    if (rc != 2)
  2212.  {
  2213. -   int ret;
  2214. +        dev_err(&client->dev, "synaptics_i2c_read FAILED: failed of page select %d\n", rc);
  2215. +        ret = -1;
  2216. +        goto tp_i2c_rd_exit;
  2217. +    }
  2218. +   buf[0] = 0xff & reg;
  2219. +   rc = i2c_master_send(client, buf, 1);
  2220. +    if (rc != 1)
  2221. +    {
  2222. +        dev_err(&client->dev, "synaptics_i2c_read FAILED: read of register %d\n", reg);
  2223. +        ret = -1;
  2224. +        goto tp_i2c_rd_exit;
  2225. +    }
  2226. +    rc = i2c_master_recv(client, buf, count);
  2227. +    if (rc != count)
  2228. +    {
  2229. +        dev_err(&client->dev, "synaptics_i2c_read FAILED: read %d bytes from reg %d\n", count, reg);
  2230. +        ret = -1;
  2231. +    }
  2232.  
  2233. -   ret = i2c_smbus_write_byte_data(ts->client, 0xff, 0x10); /* page select = 0x10 */
  2234. -   if (ret < 0) {
  2235. -       printk(KERN_ERR "i2c_smbus_write_byte_data failed for page select\n");
  2236. -       goto err_page_select_failed;
  2237. +  tp_i2c_rd_exit:
  2238. +    return ret;
  2239.     }
  2240. -   ret = i2c_smbus_write_byte_data(ts->client, 0x41, 0x04); /* Set "No Clip Z" */
  2241. -   if (ret < 0)
  2242. -       printk(KERN_ERR "i2c_smbus_write_byte_data failed for No Clip Z\n");
  2243. -
  2244. -err_page_select_failed:
  2245. -   ret = i2c_smbus_write_byte_data(ts->client, 0xff, 0x04); /* page select = 0x04 */
  2246. -   if (ret < 0)
  2247. -       printk(KERN_ERR "i2c_smbus_write_byte_data failed for page select\n");
  2248. -   ret = i2c_smbus_write_byte_data(ts->client, 0xf0, 0x81); /* normal operation, 80 reports per second */
  2249. -   if (ret < 0)
  2250. -       printk(KERN_ERR "synaptics_ts_resume: i2c_smbus_write_byte_data failed\n");
  2251. +static int synaptics_i2c_write(struct i2c_client *client, int reg, u8 data)
  2252. +{
  2253. +    u8 buf[2];
  2254. +    int rc;
  2255. +    int ret = 0;
  2256. +
  2257. +    buf[0] = 0xff;
  2258. +    buf[1] = reg >> 8;
  2259. +    rc = i2c_master_send(client, buf, 2);
  2260. +    if (rc != 2)
  2261. +    {
  2262. +        dev_err(&client->dev, "synaptics_i2c_write FAILED: writing to reg %d\n", reg);
  2263. +        ret = -1;
  2264. +    }
  2265. +   buf[0] = 0xff & reg;
  2266. +    buf[1] = data;
  2267. +    rc = i2c_master_send(client, buf, 2);
  2268. +    if (rc != 2)
  2269. +    {
  2270. +        dev_err(&client->dev, "synaptics_i2c_write FAILED: writing to reg %d\n", reg);
  2271. +        ret = -1;
  2272. +    }
  2273.     return ret;
  2274.  }
  2275. +static int proc_read_val(char *page, char **start,
  2276. +           off_t off, int count, int *eof, void *data)
  2277. +{
  2278. +        int len;
  2279. +        len = sprintf(page, "%lu\n", polling_time);
  2280. +        return len;
  2281. +}
  2282.  
  2283. +static int proc_write_val(struct file *file, const char *buffer,
  2284. +           unsigned long count, void *data)
  2285. +{
  2286. +       unsigned long val;
  2287. +       sscanf(buffer, "%lu", &val);
  2288. +       if (val >= 0) {
  2289. +           polling_time= val;
  2290. +           return count;
  2291. +       }
  2292. +       return -EINVAL;
  2293. +}
  2294.  static void synaptics_ts_work_func(struct work_struct *work)
  2295.  {
  2296. -   int i;
  2297. -   int ret;
  2298. -   int bad_data = 0;
  2299. -   struct i2c_msg msg[2];
  2300. -   uint8_t start_reg;
  2301. -   uint8_t buf[15];
  2302. +   int ret, x, y, z, finger, w, x2, y2,w2,z2,finger2,pressure,pressure2;
  2303. +   uint8_t buf[16];
  2304.     struct synaptics_ts_data *ts = container_of(work, struct synaptics_ts_data, work);
  2305. +   finger=0;
  2306. +   ret = synaptics_i2c_read(ts->client, 0x0014, buf, 16);
  2307.  
  2308. -   msg[0].addr = ts->client->addr;
  2309. -   msg[0].flags = 0;
  2310. -   msg[0].len = 1;
  2311. -   msg[0].buf = &start_reg;
  2312. -   start_reg = 0x00;
  2313. -   msg[1].addr = ts->client->addr;
  2314. -   msg[1].flags = I2C_M_RD;
  2315. -   msg[1].len = sizeof(buf);
  2316. -   msg[1].buf = buf;
  2317. -
  2318. -   /* printk("synaptics_ts_work_func\n"); */
  2319. -   for (i = 0; i < ((ts->use_irq && !bad_data) ? 1 : 10); i++) {
  2320. -       ret = i2c_transfer(ts->client->adapter, msg, 2);
  2321. -       if (ret < 0) {
  2322. -           printk(KERN_ERR "synaptics_ts_work_func: i2c_transfer failed\n");
  2323. -           bad_data = 1;
  2324. -       } else {
  2325. -           /* printk("synaptics_ts_work_func: %x %x %x %x %x %x" */
  2326. -           /*        " %x %x %x %x %x %x %x %x %x, ret %d\n", */
  2327. -           /*        buf[0], buf[1], buf[2], buf[3], */
  2328. -           /*        buf[4], buf[5], buf[6], buf[7], */
  2329. -           /*        buf[8], buf[9], buf[10], buf[11], */
  2330. -           /*        buf[12], buf[13], buf[14], ret); */
  2331. -           if ((buf[14] & 0xc0) != 0x40) {
  2332. -               printk(KERN_WARNING "synaptics_ts_work_func:"
  2333. -                      " bad read %x %x %x %x %x %x %x %x %x"
  2334. -                      " %x %x %x %x %x %x, ret %d\n",
  2335. -                      buf[0], buf[1], buf[2], buf[3],
  2336. -                      buf[4], buf[5], buf[6], buf[7],
  2337. -                      buf[8], buf[9], buf[10], buf[11],
  2338. -                      buf[12], buf[13], buf[14], ret);
  2339. -               if (bad_data)
  2340. -                   synaptics_init_panel(ts);
  2341. -               bad_data = 1;
  2342. -               continue;
  2343. -           }
  2344. -           bad_data = 0;
  2345. -           if ((buf[14] & 1) == 0) {
  2346. -               /* printk("read %d coordinates\n", i); */
  2347. -               break;
  2348. -           } else {
  2349. -               int pos[2][2];
  2350. -               int f, a;
  2351. -               int base;
  2352. -               /* int x = buf[3] | (uint16_t)(buf[2] & 0x1f) << 8; */
  2353. -               /* int y = buf[5] | (uint16_t)(buf[4] & 0x1f) << 8; */
  2354. -               int z = buf[1];
  2355. -               int w = buf[0] >> 4;
  2356. -               int finger = buf[0] & 7;
  2357. -
  2358. -               /* int x2 = buf[3+6] | (uint16_t)(buf[2+6] & 0x1f) << 8; */
  2359. -               /* int y2 = buf[5+6] | (uint16_t)(buf[4+6] & 0x1f) << 8; */
  2360. -               /* int z2 = buf[1+6]; */
  2361. -               /* int w2 = buf[0+6] >> 4; */
  2362. -               /* int finger2 = buf[0+6] & 7; */
  2363. -
  2364. -               /* int dx = (int8_t)buf[12]; */
  2365. -               /* int dy = (int8_t)buf[13]; */
  2366. -               int finger2_pressed;
  2367. -
  2368. -               /* printk("x %4d, y %4d, z %3d, w %2d, F %d, 2nd: x %4d, y %4d, z %3d, w %2d, F %d, dx %4d, dy %4d\n", */
  2369. -               /*  x, y, z, w, finger, */
  2370. -               /*  x2, y2, z2, w2, finger2, */
  2371. -               /*  dx, dy); */
  2372. -
  2373. -               base = 2;
  2374. -               for (f = 0; f < 2; f++) {
  2375. -                   uint32_t flip_flag = SYNAPTICS_FLIP_X;
  2376. -                   for (a = 0; a < 2; a++) {
  2377. -                       int p = buf[base + 1];
  2378. -                       p |= (uint16_t)(buf[base] & 0x1f) << 8;
  2379. -                       if (ts->flags & flip_flag)
  2380. -                           p = ts->max[a] - p;
  2381. -                       if (ts->flags & SYNAPTICS_SNAP_TO_INACTIVE_EDGE) {
  2382. -                           if (ts->snap_state[f][a]) {
  2383. -                               if (p <= ts->snap_down_off[a])
  2384. -                                   p = ts->snap_down[a];
  2385. -                               else if (p >= ts->snap_up_off[a])
  2386. -                                   p = ts->snap_up[a];
  2387. -                               else
  2388. -                                   ts->snap_state[f][a] = 0;
  2389. -                           } else {
  2390. -                               if (p <= ts->snap_down_on[a]) {
  2391. -                                   p = ts->snap_down[a];
  2392. -                                   ts->snap_state[f][a] = 1;
  2393. -                               } else if (p >= ts->snap_up_on[a]) {
  2394. -                                   p = ts->snap_up[a];
  2395. -                                   ts->snap_state[f][a] = 1;
  2396. -                               }
  2397. -                           }
  2398. -                       }
  2399. -                       pos[f][a] = p;
  2400. -                       base += 2;
  2401. -                       flip_flag <<= 1;
  2402. -                   }
  2403. -                   base += 2;
  2404. -                   if (ts->flags & SYNAPTICS_SWAP_XY)
  2405. -                       swap(pos[f][0], pos[f][1]);
  2406. -               }
  2407. -               if (z) {
  2408. -                   input_report_abs(ts->input_dev, ABS_X, pos[0][0]);
  2409. -                   input_report_abs(ts->input_dev, ABS_Y, pos[0][1]);
  2410. -               }
  2411. -               input_report_abs(ts->input_dev, ABS_PRESSURE, z);
  2412. -               input_report_abs(ts->input_dev, ABS_TOOL_WIDTH, w);
  2413. -               input_report_key(ts->input_dev, BTN_TOUCH, finger);
  2414. -               finger2_pressed = finger > 1 && finger != 7;
  2415. -               input_report_key(ts->input_dev, BTN_2, finger2_pressed);
  2416. -               if (finger2_pressed) {
  2417. -                   input_report_abs(ts->input_dev, ABS_HAT0X, pos[1][0]);
  2418. -                   input_report_abs(ts->input_dev, ABS_HAT0Y, pos[1][1]);
  2419. -               }
  2420. -               input_sync(ts->input_dev);
  2421. -           }
  2422. +    if (ret < 0)
  2423. +    {
  2424. +       printk(KERN_ERR "synaptics_ts_work_func: i2c_transfer failed\n");
  2425. +    }
  2426. +    else
  2427. +    {
  2428. +
  2429. +       x = (uint16_t) buf[2] << 4| (buf[4] & 0x0f) ;
  2430. +       y = (uint16_t) buf[3] << 4| ((buf[4] & 0xf0) >> 4);
  2431. +       pressure = buf[6];
  2432. +       w = buf[5] >> 4;
  2433. +       z = buf[5]&0x0f;
  2434. +       finger = buf[1] & 0x3;
  2435. +
  2436. +       x2 = (uint16_t) buf[7] << 4| (buf[9] & 0x0f) ;  
  2437. +       y2 = (uint16_t) buf[8] << 4| ((buf[9] & 0xf0) >> 4);
  2438. +       pressure2 = buf[11];
  2439. +       w2 = buf[10] >> 4;
  2440. +       z2 = buf[10] & 0x0f;
  2441. +       finger2 = buf[1] & 0xc;
  2442. +       #ifdef CONFIG_MACH_JOE//ZTE_TS_ZT_20100520_001
  2443. +       y = 2787 - y;
  2444. +       y2 = 2787 - y2;
  2445. +       #endif 
  2446. +       if(finger)
  2447. +        {  
  2448. +            input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, pressure);
  2449. +           input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
  2450. +           input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
  2451. +            input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
  2452. +           input_mt_sync(ts->input_dev);
  2453. +       }
  2454. +       if(finger2)
  2455. +
  2456. +       {
  2457. +           input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, pressure2);
  2458. +           input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x2);
  2459. +           input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y2);
  2460. +           input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w2);
  2461. +           input_mt_sync(ts->input_dev);
  2462.         }
  2463. +       input_sync(ts->input_dev);
  2464. +       input_report_key(ts->input_dev, BTN_TOUCH, !!finger);
  2465. +       input_sync(ts->input_dev);
  2466. +
  2467.     }
  2468. +   #ifdef POLL_IN_INT
  2469. +   if(finger)
  2470. +       {
  2471. +           hrtimer_start(&ts->timer, ktime_set(0, polling_time), HRTIMER_MODE_REL);
  2472. +       }
  2473. +   else
  2474. +       {
  2475. +           hrtimer_cancel(&ts->timer);
  2476. +           enable_irq(ts->client->irq);
  2477. +   }
  2478. +   #else
  2479.     if (ts->use_irq)
  2480.         enable_irq(ts->client->irq);
  2481. +   #endif
  2482.  }
  2483.  
  2484.  static enum hrtimer_restart synaptics_ts_timer_func(struct hrtimer *timer)
  2485. @@ -212,8 +207,24 @@
  2486.     /* printk("synaptics_ts_timer_func\n"); */
  2487.  
  2488.     queue_work(synaptics_wq, &ts->work);
  2489. +   #ifndef POLL_IN_INT
  2490. +   hrtimer_start(&ts->timer, ktime_set(0, polling_time), HRTIMER_MODE_REL);
  2491. +   #endif
  2492. +   return HRTIMER_NORESTART;
  2493. +}
  2494. +static enum hrtimer_restart synaptics_ts_resume_func(struct hrtimer *timer)
  2495. +{
  2496. +  
  2497. +   #if 0
  2498. +   struct synaptics_ts_data *ts = container_of(timer, struct synaptics_ts_data, resume_timer);
  2499. +    if (ts->use_irq)
  2500. +       enable_irq(ts->client->irq);
  2501. +     synaptics_i2c_write(ts->client, 0x0026, 0x07);    /* enable abs int */
  2502. +    synaptics_i2c_write(ts->client, 0x0031, 0x7F);
  2503. +    #else
  2504. +    printk("synaptics_ts_resume_func\n");
  2505. +    #endif
  2506.  
  2507. -   hrtimer_start(&ts->timer, ktime_set(0, 12500000), HRTIMER_MODE_REL);
  2508.     return HRTIMER_NORESTART;
  2509.  }
  2510.  
  2511. @@ -222,8 +233,12 @@
  2512.     struct synaptics_ts_data *ts = dev_id;
  2513.  
  2514.     /* printk("synaptics_ts_irq_handler\n"); */
  2515. -   disable_irq(ts->client->irq);
  2516. +   disable_irq_nosync(ts->client->irq);
  2517. +   #ifdef POLL_IN_INT
  2518. +   hrtimer_start(&ts->timer, ktime_set(0, 0), HRTIMER_MODE_REL);
  2519. +   #else
  2520.     queue_work(synaptics_wq, &ts->work);
  2521. +   #endif
  2522.     return IRQ_HANDLED;
  2523.  }
  2524.  
  2525. @@ -231,28 +246,15 @@
  2526.     struct i2c_client *client, const struct i2c_device_id *id)
  2527.  {
  2528.     struct synaptics_ts_data *ts;
  2529. -   uint8_t buf0[4];
  2530. -   uint8_t buf1[8];
  2531. -   struct i2c_msg msg[2];
  2532. +   uint8_t buf1[9];
  2533. +   //struct i2c_msg msg[2];
  2534.     int ret = 0;
  2535.     uint16_t max_x, max_y;
  2536. -   int fuzz_x, fuzz_y, fuzz_p, fuzz_w;
  2537. -   struct synaptics_i2c_rmi_platform_data *pdata;
  2538. -   int inactive_area_left;
  2539. -   int inactive_area_right;
  2540. -   int inactive_area_top;
  2541. -   int inactive_area_bottom;
  2542. -   int snap_left_on;
  2543. -   int snap_left_off;
  2544. -   int snap_right_on;
  2545. -   int snap_right_off;
  2546. -   int snap_top_on;
  2547. -   int snap_top_off;
  2548. -   int snap_bottom_on;
  2549. -   int snap_bottom_off;
  2550. -   uint32_t panel_version;
  2551. -
  2552. -   if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
  2553. +   struct proc_dir_entry *refresh;
  2554. +   gpio_direction_output(GPIO_TOUCH_EN_OUT, 1);
  2555. +   msleep(250);
  2556. +    if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
  2557. +    {
  2558.         printk(KERN_ERR "synaptics_ts_probe: need I2C_FUNC_I2C\n");
  2559.         ret = -ENODEV;
  2560.         goto err_check_functionality_failed;
  2561. @@ -257,9 +259,9 @@
  2562.         ret = -ENODEV;
  2563.         goto err_check_functionality_failed;
  2564.     }
  2565. -
  2566.     ts = kzalloc(sizeof(*ts), GFP_KERNEL);
  2567. -   if (ts == NULL) {
  2568. +    if (ts == NULL)
  2569. +    {
  2570.         ret = -ENOMEM;
  2571.         goto err_alloc_data_failed;
  2572.     }
  2573. @@ -266,155 +269,45 @@
  2574.     INIT_WORK(&ts->work, synaptics_ts_work_func);
  2575.     ts->client = client;
  2576.     i2c_set_clientdata(client, ts);
  2577. -   pdata = client->dev.platform_data;
  2578. -   if (pdata)
  2579. -       ts->power = pdata->power;
  2580. -   if (ts->power) {
  2581. -       ret = ts->power(1);
  2582. -       if (ret < 0) {
  2583. -           printk(KERN_ERR "synaptics_ts_probe power on failed\n");
  2584. -           goto err_power_failed;
  2585. -       }
  2586. -   }
  2587. -
  2588. -   ret = i2c_smbus_write_byte_data(ts->client, 0xf4, 0x01); /* device command = reset */
  2589. -   if (ret < 0) {
  2590. -       printk(KERN_ERR "i2c_smbus_write_byte_data failed\n");
  2591. -       /* fail? */
  2592. -   }
  2593. +   client->driver = &synaptics_ts_driver;
  2594.     {
  2595. -       int retry = 10;
  2596. -       while (retry-- > 0) {
  2597. -           ret = i2c_smbus_read_byte_data(ts->client, 0xe4);
  2598. +       int retry = 3;
  2599. +        while (retry-- > 0)
  2600. +        {
  2601. +
  2602. +            ret = synaptics_i2c_read(ts->client, 0x0078, buf1, 9);
  2603. +           printk("wly: synaptics_i2c_read, %c, %d,%d,%d,%d,%d,%d,%d,%d\n",
  2604. +               buf1[0],buf1[1],buf1[2],buf1[3],buf1[4],buf1[5],buf1[6],buf1[7],buf1[8]);
  2605.             if (ret >= 0)
  2606.                 break;
  2607. -           msleep(100);
  2608. -       }
  2609. -   }
  2610. -   if (ret < 0) {
  2611. -       printk(KERN_ERR "i2c_smbus_read_byte_data failed\n");
  2612. -       goto err_detect_failed;
  2613. -   }
  2614. -   printk(KERN_INFO "synaptics_ts_probe: Product Major Version %x\n", ret);
  2615. -   panel_version = ret << 8;
  2616. -   ret = i2c_smbus_read_byte_data(ts->client, 0xe5);
  2617. -   if (ret < 0) {
  2618. -       printk(KERN_ERR "i2c_smbus_read_byte_data failed\n");
  2619. -       goto err_detect_failed;
  2620. -   }
  2621. -   printk(KERN_INFO "synaptics_ts_probe: Product Minor Version %x\n", ret);
  2622. -   panel_version |= ret;
  2623. +           msleep(10);
  2624.  
  2625. -   ret = i2c_smbus_read_byte_data(ts->client, 0xe3);
  2626. -   if (ret < 0) {
  2627. -       printk(KERN_ERR "i2c_smbus_read_byte_data failed\n");
  2628. -       goto err_detect_failed;
  2629.     }
  2630. -   printk(KERN_INFO "synaptics_ts_probe: product property %x\n", ret);
  2631. -
  2632. -   if (pdata) {
  2633. -       while (pdata->version > panel_version)
  2634. -           pdata++;
  2635. -       ts->flags = pdata->flags;
  2636. -       inactive_area_left = pdata->inactive_left;
  2637. -       inactive_area_right = pdata->inactive_right;
  2638. -       inactive_area_top = pdata->inactive_top;
  2639. -       inactive_area_bottom = pdata->inactive_bottom;
  2640. -       snap_left_on = pdata->snap_left_on;
  2641. -       snap_left_off = pdata->snap_left_off;
  2642. -       snap_right_on = pdata->snap_right_on;
  2643. -       snap_right_off = pdata->snap_right_off;
  2644. -       snap_top_on = pdata->snap_top_on;
  2645. -       snap_top_off = pdata->snap_top_off;
  2646. -       snap_bottom_on = pdata->snap_bottom_on;
  2647. -       snap_bottom_off = pdata->snap_bottom_off;
  2648. -       fuzz_x = pdata->fuzz_x;
  2649. -       fuzz_y = pdata->fuzz_y;
  2650. -       fuzz_p = pdata->fuzz_p;
  2651. -       fuzz_w = pdata->fuzz_w;
  2652. -   } else {
  2653. -       inactive_area_left = 0;
  2654. -       inactive_area_right = 0;
  2655. -       inactive_area_top = 0;
  2656. -       inactive_area_bottom = 0;
  2657. -       snap_left_on = 0;
  2658. -       snap_left_off = 0;
  2659. -       snap_right_on = 0;
  2660. -       snap_right_off = 0;
  2661. -       snap_top_on = 0;
  2662. -       snap_top_off = 0;
  2663. -       snap_bottom_on = 0;
  2664. -       snap_bottom_off = 0;
  2665. -       fuzz_x = 0;
  2666. -       fuzz_y = 0;
  2667. -       fuzz_p = 0;
  2668. -       fuzz_w = 0;
  2669. -   }
  2670. -
  2671. -   ret = i2c_smbus_read_byte_data(ts->client, 0xf0);
  2672. -   if (ret < 0) {
  2673. -       printk(KERN_ERR "i2c_smbus_read_byte_data failed\n");
  2674. +       if (retry < 0)
  2675. +           {
  2676. +           ret = -1;
  2677.         goto err_detect_failed;
  2678.     }
  2679. -   printk(KERN_INFO "synaptics_ts_probe: device control %x\n", ret);
  2680. -
  2681. -   ret = i2c_smbus_read_byte_data(ts->client, 0xf1);
  2682. -   if (ret < 0) {
  2683. -       printk(KERN_ERR "i2c_smbus_read_byte_data failed\n");
  2684. -       goto err_detect_failed;
  2685. -   }
  2686. -   printk(KERN_INFO "synaptics_ts_probe: interrupt enable %x\n", ret);
  2687. -
  2688. -   ret = i2c_smbus_write_byte_data(ts->client, 0xf1, 0); /* disable interrupt */
  2689. -   if (ret < 0) {
  2690. -       printk(KERN_ERR "i2c_smbus_write_byte_data failed\n");
  2691. -       goto err_detect_failed;
  2692. -   }
  2693. -
  2694. -   msg[0].addr = ts->client->addr;
  2695. -   msg[0].flags = 0;
  2696. -   msg[0].len = 1;
  2697. -   msg[0].buf = buf0;
  2698. -   buf0[0] = 0xe0;
  2699. -   msg[1].addr = ts->client->addr;
  2700. -   msg[1].flags = I2C_M_RD;
  2701. -   msg[1].len = 8;
  2702. -   msg[1].buf = buf1;
  2703. -   ret = i2c_transfer(ts->client->adapter, msg, 2);
  2704. -   if (ret < 0) {
  2705. -       printk(KERN_ERR "i2c_transfer failed\n");
  2706. -       goto err_detect_failed;
  2707. -   }
  2708. -   printk(KERN_INFO "synaptics_ts_probe: 0xe0: %x %x %x %x %x %x %x %x\n",
  2709. -          buf1[0], buf1[1], buf1[2], buf1[3],
  2710. -          buf1[4], buf1[5], buf1[6], buf1[7]);
  2711. -
  2712. -   ret = i2c_smbus_write_byte_data(ts->client, 0xff, 0x10); /* page select = 0x10 */
  2713. -   if (ret < 0) {
  2714. -       printk(KERN_ERR "i2c_smbus_write_byte_data failed for page select\n");
  2715. -       goto err_detect_failed;
  2716.     }
  2717. -   ret = i2c_smbus_read_word_data(ts->client, 0x04);
  2718. -   if (ret < 0) {
  2719. -       printk(KERN_ERR "i2c_smbus_read_word_data failed\n");
  2720. +    ret = synaptics_i2c_write(ts->client, 0x0025, 0x00);
  2721. +    ret = synaptics_i2c_read(ts->client, 0x002D, buf1, 2);
  2722. +    if (ret < 0)
  2723. +    {
  2724. +        printk(KERN_ERR "synaptics_i2c_read failed\n");
  2725.         goto err_detect_failed;
  2726.     }
  2727. -   ts->max[0] = max_x = (ret >> 8 & 0xff) | ((ret & 0x1f) << 8);
  2728. -   ret = i2c_smbus_read_word_data(ts->client, 0x06);
  2729. -   if (ret < 0) {
  2730. -       printk(KERN_ERR "i2c_smbus_read_word_data failed\n");
  2731. +    ts->max[0] = max_x = buf1[0] | ((buf1[1] & 0x0f) << 8);
  2732. +    ret = synaptics_i2c_read(ts->client, 0x002F, buf1, 2);
  2733. +    if (ret < 0)
  2734. +    {
  2735. +        printk(KERN_ERR "synaptics_i2c_read failed\n");
  2736.         goto err_detect_failed;
  2737.     }
  2738. -   ts->max[1] = max_y = (ret >> 8 & 0xff) | ((ret & 0x1f) << 8);
  2739. -   if (ts->flags & SYNAPTICS_SWAP_XY)
  2740. -       swap(max_x, max_y);
  2741. -
  2742. -   ret = synaptics_init_panel(ts); /* will also switch back to page 0x04 */
  2743. -   if (ret < 0) {
  2744. -       printk(KERN_ERR "synaptics_init_panel failed\n");
  2745. -       goto err_detect_failed;
  2746. -   }
  2747. -
  2748. +    ts->max[1] = max_y = buf1[0] | ((buf1[1] & 0x0f) << 8);
  2749. +   printk("wly: synaptics_ts_probe,max_x=%d, max_y=%d\n", max_x, max_y);
  2750. +#if defined(CONFIG_MACH_R750)
  2751. +   max_y = 2739;
  2752. +#endif
  2753.     ts->input_dev = input_allocate_device();
  2754.     if (ts->input_dev == NULL) {
  2755.         ret = -ENOMEM;
  2756. @@ -422,60 +315,49 @@
  2757.         goto err_input_dev_alloc_failed;
  2758.     }
  2759.     ts->input_dev->name = "synaptics-rmi-touchscreen";
  2760. +   ts->input_dev->phys = "synaptics-rmi-touchscreen/input0";
  2761. +
  2762.     set_bit(EV_SYN, ts->input_dev->evbit);
  2763.     set_bit(EV_KEY, ts->input_dev->evbit);
  2764.     set_bit(BTN_TOUCH, ts->input_dev->keybit);
  2765. -   set_bit(BTN_2, ts->input_dev->keybit);
  2766.     set_bit(EV_ABS, ts->input_dev->evbit);
  2767. -   inactive_area_left = inactive_area_left * max_x / 0x10000;
  2768. -   inactive_area_right = inactive_area_right * max_x / 0x10000;
  2769. -   inactive_area_top = inactive_area_top * max_y / 0x10000;
  2770. -   inactive_area_bottom = inactive_area_bottom * max_y / 0x10000;
  2771. -   snap_left_on = snap_left_on * max_x / 0x10000;
  2772. -   snap_left_off = snap_left_off * max_x / 0x10000;
  2773. -   snap_right_on = snap_right_on * max_x / 0x10000;
  2774. -   snap_right_off = snap_right_off * max_x / 0x10000;
  2775. -   snap_top_on = snap_top_on * max_y / 0x10000;
  2776. -   snap_top_off = snap_top_off * max_y / 0x10000;
  2777. -   snap_bottom_on = snap_bottom_on * max_y / 0x10000;
  2778. -   snap_bottom_off = snap_bottom_off * max_y / 0x10000;
  2779. -   fuzz_x = fuzz_x * max_x / 0x10000;
  2780. -   fuzz_y = fuzz_y * max_y / 0x10000;
  2781. -   ts->snap_down[!!(ts->flags & SYNAPTICS_SWAP_XY)] = -inactive_area_left;
  2782. -   ts->snap_up[!!(ts->flags & SYNAPTICS_SWAP_XY)] = max_x + inactive_area_right;
  2783. -   ts->snap_down[!(ts->flags & SYNAPTICS_SWAP_XY)] = -inactive_area_top;
  2784. -   ts->snap_up[!(ts->flags & SYNAPTICS_SWAP_XY)] = max_y + inactive_area_bottom;
  2785. -   ts->snap_down_on[!!(ts->flags & SYNAPTICS_SWAP_XY)] = snap_left_on;
  2786. -   ts->snap_down_off[!!(ts->flags & SYNAPTICS_SWAP_XY)] = snap_left_off;
  2787. -   ts->snap_up_on[!!(ts->flags & SYNAPTICS_SWAP_XY)] = max_x - snap_right_on;
  2788. -   ts->snap_up_off[!!(ts->flags & SYNAPTICS_SWAP_XY)] = max_x - snap_right_off;
  2789. -   ts->snap_down_on[!(ts->flags & SYNAPTICS_SWAP_XY)] = snap_top_on;
  2790. -   ts->snap_down_off[!(ts->flags & SYNAPTICS_SWAP_XY)] = snap_top_off;
  2791. -   ts->snap_up_on[!(ts->flags & SYNAPTICS_SWAP_XY)] = max_y - snap_bottom_on;
  2792. -   ts->snap_up_off[!(ts->flags & SYNAPTICS_SWAP_XY)] = max_y - snap_bottom_off;
  2793. -   printk(KERN_INFO "synaptics_ts_probe: max_x %d, max_y %d\n", max_x, max_y);
  2794. -   printk(KERN_INFO "synaptics_ts_probe: inactive_x %d %d, inactive_y %d %d\n",
  2795. -          inactive_area_left, inactive_area_right,
  2796. -          inactive_area_top, inactive_area_bottom);
  2797. -   printk(KERN_INFO "synaptics_ts_probe: snap_x %d-%d %d-%d, snap_y %d-%d %d-%d\n",
  2798. -          snap_left_on, snap_left_off, snap_right_on, snap_right_off,
  2799. -          snap_top_on, snap_top_off, snap_bottom_on, snap_bottom_off);
  2800. -   input_set_abs_params(ts->input_dev, ABS_X, -inactive_area_left, max_x + inactive_area_right, fuzz_x, 0);
  2801. -   input_set_abs_params(ts->input_dev, ABS_Y, -inactive_area_top, max_y + inactive_area_bottom, fuzz_y, 0);
  2802. -   input_set_abs_params(ts->input_dev, ABS_PRESSURE, 0, 255, fuzz_p, 0);
  2803. -   input_set_abs_params(ts->input_dev, ABS_TOOL_WIDTH, 0, 15, fuzz_w, 0);
  2804. -   input_set_abs_params(ts->input_dev, ABS_HAT0X, -inactive_area_left, max_x + inactive_area_right, fuzz_x, 0);
  2805. -   input_set_abs_params(ts->input_dev, ABS_HAT0Y, -inactive_area_top, max_y + inactive_area_bottom, fuzz_y, 0);
  2806. -   /* ts->input_dev->name = ts->keypad_info->name; */
  2807. +   set_bit(ABS_MT_TOUCH_MAJOR, ts->input_dev->absbit);
  2808. +   set_bit(ABS_MT_POSITION_X, ts->input_dev->absbit);
  2809. +   set_bit(ABS_MT_POSITION_Y, ts->input_dev->absbit);
  2810. +   set_bit(ABS_MT_WIDTH_MAJOR, ts->input_dev->absbit);
  2811. +  
  2812. +   input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
  2813. +    input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, max_x, 0, 0);
  2814. +    input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0, max_y, 0, 0);
  2815. +   input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
  2816.     ret = input_register_device(ts->input_dev);
  2817. -   if (ret) {
  2818. +    if (ret)
  2819. +    {
  2820.         printk(KERN_ERR "synaptics_ts_probe: Unable to register %s input device\n", ts->input_dev->name);
  2821.         goto err_input_register_device_failed;
  2822.     }
  2823. -   if (client->irq) {
  2824. -       ret = request_irq(client->irq, synaptics_ts_irq_handler, 0, client->name, ts);
  2825. +       hrtimer_init(&ts->resume_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
  2826. +   ts->resume_timer.function = synaptics_ts_resume_func;
  2827. +   #ifdef POLL_IN_INT
  2828. +   hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
  2829. +   ts->timer.function = synaptics_ts_timer_func;
  2830. +   ret = request_irq(client->irq, synaptics_ts_irq_handler, IRQF_TRIGGER_LOW, "synaptics_touch", ts);
  2831. +   if(ret == 0)
  2832. +       {
  2833. +       ret = synaptics_i2c_write(ts->client, 0x0026, 0x07);  
  2834. +       if (ret)
  2835. +       free_irq(client->irq, ts);
  2836. +       }
  2837. +   if(ret == 0)
  2838. +       ts->use_irq = 1;
  2839. +   else
  2840. +       dev_err(&client->dev, "request_irq failed\n");
  2841. +   #else
  2842. +   if (0)
  2843. +    {
  2844. +        ret = request_irq(client->irq, synaptics_ts_irq_handler, IRQF_TRIGGER_LOW, "synaptics_touch", ts);
  2845.         if (ret == 0) {
  2846. -           ret = i2c_smbus_write_byte_data(ts->client, 0xf1, 0x01); /* enable abs int */
  2847. +             ret = synaptics_i2c_write(ts->client, 0x0026, 0x07);  /* enable abs int */
  2848.             if (ret)
  2849.                 free_irq(client->irq, ts);
  2850.         }
  2851. @@ -484,18 +366,26 @@
  2852.         else
  2853.             dev_err(&client->dev, "request_irq failed\n");
  2854.     }
  2855. -   if (!ts->use_irq) {
  2856. +   ts->use_irq = 0;
  2857. +    if (!ts->use_irq)
  2858. +    {
  2859.         hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
  2860.         ts->timer.function = synaptics_ts_timer_func;
  2861.         hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL);
  2862.     }
  2863. +   #endif
  2864.  #ifdef CONFIG_HAS_EARLYSUSPEND
  2865.     ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
  2866.     ts->early_suspend.suspend = synaptics_ts_early_suspend;
  2867.     ts->early_suspend.resume = synaptics_ts_late_resume;
  2868.     register_early_suspend(&ts->early_suspend);
  2869.  #endif
  2870. -
  2871. +   refresh = create_proc_entry("ts_poll_freq", 0644, NULL);
  2872. +   if (refresh) {
  2873. +       refresh->data       = NULL;
  2874. +       refresh->read_proc  = proc_read_val;
  2875. +       refresh->write_proc = proc_write_val;
  2876. +   }
  2877.     printk(KERN_INFO "synaptics_ts_probe: Start touchscreen %s in %s mode\n", ts->input_dev->name, ts->use_irq ? "interrupt" : "polling");
  2878.  
  2879.     return 0;
  2880. @@ -505,7 +395,6 @@
  2881.  
  2882.  err_input_dev_alloc_failed:
  2883.  err_detect_failed:
  2884. -err_power_failed:
  2885.     kfree(ts);
  2886.  err_alloc_data_failed:
  2887.  err_check_functionality_failed:
  2888. @@ -522,6 +411,7 @@
  2889.         hrtimer_cancel(&ts->timer);
  2890.     input_unregister_device(ts->input_dev);
  2891.     kfree(ts);
  2892. +   gpio_direction_output(GPIO_TOUCH_EN_OUT, 0);
  2893.     return 0;
  2894.  }
  2895.  
  2896. @@ -537,18 +427,14 @@
  2897.     ret = cancel_work_sync(&ts->work);
  2898.     if (ret && ts->use_irq) /* if work was pending disable-count is now 2 */
  2899.         enable_irq(client->irq);
  2900. -   ret = i2c_smbus_write_byte_data(ts->client, 0xf1, 0); /* disable interrupt */
  2901. +    ret = synaptics_i2c_write(ts->client, 0x0026, 0);     /* disable interrupt */
  2902.     if (ret < 0)
  2903. -       printk(KERN_ERR "synaptics_ts_suspend: i2c_smbus_write_byte_data failed\n");
  2904. +        printk(KERN_ERR "synaptics_ts_suspend: synaptics_i2c_write failed\n");
  2905.  
  2906. -   ret = i2c_smbus_write_byte_data(client, 0xf0, 0x86); /* deep sleep */
  2907. +    ret = synaptics_i2c_write(client, 0x0025, 0x01);      /* deep sleep */
  2908.     if (ret < 0)
  2909. -       printk(KERN_ERR "synaptics_ts_suspend: i2c_smbus_write_byte_data failed\n");
  2910. -   if (ts->power) {
  2911. -       ret = ts->power(0);
  2912. -       if (ret < 0)
  2913. -           printk(KERN_ERR "synaptics_ts_resume power off failed\n");
  2914. -   }
  2915. +        printk(KERN_ERR "synaptics_ts_suspend: synaptics_i2c_write failed\n");
  2916. +
  2917.     return 0;
  2918.  }
  2919.  
  2920. @@ -556,23 +442,21 @@
  2921.  {
  2922.     int ret;
  2923.     struct synaptics_ts_data *ts = i2c_get_clientdata(client);
  2924. -
  2925. -   if (ts->power) {
  2926. -       ret = ts->power(1);
  2927. -       if (ret < 0)
  2928. -           printk(KERN_ERR "synaptics_ts_resume power on failed\n");
  2929. -   }
  2930. -
  2931. -   synaptics_init_panel(ts);
  2932. -
  2933. +   gpio_direction_output(GPIO_TOUCH_EN_OUT, 1);
  2934. +    ret = synaptics_i2c_write(ts->client, 0x0025, 0x00);
  2935. +   hrtimer_start(&ts->resume_timer, ktime_set(0, 5000000), HRTIMER_MODE_REL);
  2936. +   #if 1
  2937.     if (ts->use_irq)
  2938.         enable_irq(client->irq);
  2939.  
  2940.     if (!ts->use_irq)
  2941.         hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL);
  2942.     else
  2943. -       i2c_smbus_write_byte_data(ts->client, 0xf1, 0x01); /* enable abs int */
  2944. -
  2945. +       {
  2946. +        synaptics_i2c_write(ts->client, 0x0026, 0x07);    
  2947. +           synaptics_i2c_write(ts->client, 0x0031, 0x7F);
  2948. +       }
  2949. +   #endif
  2950.     return 0;
  2951.  }
  2952.  
  2953. diff -urB -x .git msm/drivers/leds/Makefile zte/drivers/leds/Makefile
  2954. --- msm/drivers/leds/Makefile   Mon Nov  1 13:46:22 2010
  2955. +++ zte/drivers/leds/Makefile   Sat Oct 16 11:46:40 2010
  2956. @@ -23,7 +23,10 @@
  2957.  obj-$(CONFIG_LEDS_HP6XX)       += leds-hp6xx.o
  2958.  obj-$(CONFIG_LEDS_FSG)         += leds-fsg.o
  2959.  obj-$(CONFIG_LEDS_PCA955X)     += leds-pca955x.o
  2960. -obj-$(CONFIG_LEDS_MSM_PMIC)        += leds-msm-pmic.o
  2961. +#support led blink based on msm-pmic-led drivers,  -->
  2962. +# obj-$(CONFIG_LEDS_MSM_PMIC)      += leds-msm-pmic.o
  2963. +obj-$(CONFIG_LEDS_MSM_PMIC)        += leds-msm-pmic-status.o
  2964. +#support led blink based on msm-pmic-led drivers ,   <--
  2965.  obj-$(CONFIG_LEDS_DA903X)      += leds-da903x.o
  2966.  obj-$(CONFIG_LEDS_WM8350)      += leds-wm8350.o
  2967.  
  2968. diff -urB -x .git msm/drivers/leds/leds-cpld.c zte/drivers/leds/leds-cpld.c
  2969. --- msm/drivers/leds/leds-cpld.c    Mon Nov  1 13:46:22 2010
  2970. +++ zte/drivers/leds/leds-cpld.c    Wed Oct 13 18:14:56 2010
  2971. @@ -26,6 +26,8 @@
  2972.  #include <linux/io.h>
  2973.  #include <asm/mach-types.h>
  2974.  
  2975. +#define DEBUG_LED_CHANGE 0
  2976. +
  2977.  static int _g_cpld_led_addr;
  2978.  
  2979.  struct CPLD_LED_data {
  2980. @@ -193,8 +195,10 @@
  2981.             reg_val = brightness;
  2982.         writeb(0, _g_cpld_led_addr + 0x8);
  2983.         writeb(reg_val, _g_cpld_led_addr + 0x8);
  2984. +#if DEBUG_LED_CHANGE
  2985.         printk(KERN_INFO "LED change: jogball backlight = %d \n",
  2986.                reg_val);
  2987. +#endif
  2988.         return;
  2989.     } else if (!strcmp(led_cdev->name, "red")) {
  2990.         idx = 0;
  2991. @@ -215,9 +219,9 @@
  2992.         reg_val &= ~(1 << (2 * idx));
  2993.  
  2994.     writeb(reg_val, _g_cpld_led_addr);
  2995. -   reg_val = led->brightness / 2;
  2996. -   writeb(reg_val, _g_cpld_led_addr + 2 * (idx + 1));
  2997. -   printk(KERN_INFO "LED change: %s = %d \n", led_cdev->name, reg_val);
  2998. +#if DEBUG_LED_CHANGE
  2999. +   printk(KERN_INFO "LED change: %s = %d \n", led_cdev->name, led->brightness);
  3000. +#endif
  3001.     spin_unlock(&CPLD_LED->data_lock);
  3002.  }
  3003.  
  3004. @@ -279,9 +283,6 @@
  3005.  
  3006.     memset(CPLD_LED, 0, sizeof(struct CPLD_LED_data));
  3007.     writeb(0x00, _g_cpld_led_addr);
  3008. -   writeb(0x00, _g_cpld_led_addr + 0x02);
  3009. -   writeb(0x00, _g_cpld_led_addr + 0x04);
  3010. -   writeb(0x00, _g_cpld_led_addr + 0x06);
  3011.  
  3012.     CPLD_LED->leds[0].name = "red";
  3013.     CPLD_LED->leds[0].brightness_set = led_brightness_set;
  3014. Only in zte/drivers/leds: leds-msm-pmic-status.c
  3015. diff -urB -x .git msm/drivers/media/video/msm/Kconfig zte/drivers/media/video/msm/Kconfig
  3016. --- msm/drivers/media/video/msm/Kconfig Mon Nov  1 13:46:22 2010
  3017. +++ zte/drivers/media/video/msm/Kconfig Fri Oct 29 16:55:34 2010
  3018. @@ -2,14 +2,14 @@
  3019.  config MT9T013
  3020.     bool "Sensor mt9t013 (BAYER 3M)"
  3021.     depends on MSM_CAMERA
  3022. -   default y
  3023. +   default n
  3024.     ---help---
  3025.       MICRON 3M Bayer Sensor with AutoFocus
  3026.  
  3027.  config MT9D112
  3028.     bool "Sensor mt9d112 (YUV 2M)"
  3029.     depends on MSM_CAMERA
  3030. -   default y
  3031. +   default n
  3032.     ---help---
  3033.       MICRON 2M YUV Sensor
  3034.  config VX6953
  3035. @@ -22,10 +22,34 @@
  3036.  config MT9P012
  3037.     bool "Sensor mt9p012 (BAYER 5M)"
  3038.     depends on MSM_CAMERA
  3039. -   default y
  3040. +   default n
  3041.     ---help---
  3042.       MICRON 5M Bayer Sensor with Autofocus
  3043. -
  3044. +    
  3045. +config MT9V113
  3046. +   bool "Sensor mt9v113 (YUV 0.3M)"
  3047. +   depends on MSM_CAMERA
  3048. +   default n
  3049. +   ---help---
  3050. +     APTINA 0.3M YUV Sensor
  3051. +
  3052. +config MT9T11X
  3053. +   bool "Sensor mt9t111 or mt9t112 (YUV 3.1M)"
  3054. +   depends on MSM_CAMERA
  3055. +   default y
  3056. +   ---help---
  3057. +     APTINA 3.1M YUV Sensor
  3058. +    
  3059. +if MT9T11X
  3060. +config MT9T11X_QTECH_MCNEX_FPC
  3061. +   bool "Sensor mt9t111 or mt9t112 (YUV 3.1M)"
  3062. +   depends on MSM_CAMERA
  3063. +   depends on MACH_BLADE || MACH_SMOOTH || MACH_RAISE
  3064. +   default y
  3065. +   ---help---
  3066. +     APTINA 3.1M YUV Sensor
  3067. +endif # MT9T11X
  3068. +    
  3069.  choice
  3070.     prompt "AF module"
  3071.     depends on MT9P012
  3072. @@ -46,14 +70,14 @@
  3073.  config MT9P012_KM
  3074.     bool "Sensor mt9p012 KM module (BAYER 5M)"
  3075.     depends on MSM_CAMERA
  3076. -   default y
  3077. +   default n
  3078.     ---help---
  3079.       MICRON 5M Bayer Sensor KM modules with Autofocus
  3080.  
  3081.  config S5K3E2FX
  3082.     bool "Sensor s5k3e2fx (Samsung 5M)"
  3083.     depends on MSM_CAMERA
  3084. -   default y
  3085. +   default n
  3086.     ---help---
  3087.       Samsung 5M with Autofocus
  3088.  
  3089. @@ -62,11 +86,11 @@
  3090.     depends on MSM_CAMERA
  3091.     ---help---
  3092.       5M with flash
  3093. -
  3094. +    
  3095.  config MSM_CAMERA_FLASH
  3096.     bool "Qualcomm MSM camera flash support"
  3097.     depends on MSM_CAMERA
  3098. -   default y
  3099. +   default n
  3100.     ---help---
  3101.       Enable support for LED flash for msm camera
  3102.  
  3103. Only in zte/drivers/media/video/msm: Kconfig.bak
  3104. diff -urB -x .git msm/drivers/media/video/msm/Makefile zte/drivers/media/video/msm/Makefile
  3105. --- msm/drivers/media/video/msm/Makefile    Mon Nov  1 13:46:22 2010
  3106. +++ zte/drivers/media/video/msm/Makefile    Thu Oct 28 15:28:00 2010
  3107. @@ -10,6 +10,8 @@
  3108.  obj-$(CONFIG_ARCH_QSD8X50) += msm_vfe8x.o msm_vfe8x_proc.o msm_io8x.o
  3109.  obj-$(CONFIG_MT9T013) += mt9t013.o mt9t013_reg.o
  3110.  obj-$(CONFIG_MT9D112) += mt9d112.o mt9d112_reg.o
  3111. +obj-$(CONFIG_MT9V113) += mt9v113.o mt9v113_reg.o
  3112. +obj-$(CONFIG_MT9T11X_QTECH_MCNEX_FPC) += mt9t11x.o mt9t112_reg.o mt9t111_reg.o
  3113.  obj-$(CONFIG_MT9P012) += mt9p012_reg.o
  3114.  obj-$(CONFIG_MSM_CAMERA_AF_FOXCONN) += mt9p012_fox.o
  3115.  obj-$(CONFIG_MSM_CAMERA_AF_BAM) += mt9p012_bam.o
  3116. Only in zte/drivers/media/video/msm: mt9t111_reg.c
  3117. Only in zte/drivers/media/video/msm: mt9t112_reg.c
  3118. Only in zte/drivers/media/video/msm: mt9t11x.c
  3119. Only in zte/drivers/media/video/msm: mt9t11x.h
  3120. Only in zte/drivers/media/video/msm: mt9v113.c
  3121. Only in zte/drivers/media/video/msm: mt9v113.h
  3122. Only in zte/drivers/media/video/msm: mt9v113_reg.c
  3123. diff -urB -x .git msm/drivers/misc/Kconfig zte/drivers/misc/Kconfig
  3124. --- msm/drivers/misc/Kconfig    Mon Nov  1 13:46:22 2010
  3125. +++ zte/drivers/misc/Kconfig    Mon Oct 25 15:33:20 2010
  3126. @@ -17,6 +17,9 @@
  3127.     bool "Android pmem allocator"
  3128.     default y
  3129.  
  3130. +config FM_SI4708
  3131. +   bool "Android fm semiconductor si470x from silicon libraries"
  3132. +   default y
  3133.  config ANDROID_PMEM_DEBUG
  3134.     bool "Android pmem debug"
  3135.     depends on ANDROID_PMEM
  3136. @@ -287,5 +290,7 @@
  3137.  source "drivers/misc/c2port/Kconfig"
  3138.  source "drivers/misc/eeprom/Kconfig"
  3139.  source "drivers/misc/video_core/720p/Kconfig"
  3140. +
  3141. +#source "drivers/misc/modemctl/Kconfig"
  3142.  
  3143.  endif # MISC_DEVICES
  3144. Only in zte/drivers/misc: Kconfig.bak
  3145. diff -urB -x .git msm/drivers/misc/Makefile zte/drivers/misc/Makefile
  3146. --- msm/drivers/misc/Makefile   Mon Nov  1 13:46:22 2010
  3147. +++ zte/drivers/misc/Makefile   Mon Oct 18 09:53:16 2010
  3148. @@ -21,6 +21,7 @@
  3149.  obj-$(CONFIG_SGI_XP)       += sgi-xp/
  3150.  obj-$(CONFIG_SGI_GRU)      += sgi-gru/
  3151.  obj-$(CONFIG_HP_ILO)       += hpilo.o
  3152. +obj-$(CONFIG_FM_SI4708)        += fm_si4708.o
  3153.  obj-$(CONFIG_UID_STAT)     += uid_stat.o
  3154.  obj-$(CONFIG_C2PORT)       += c2port/
  3155.  obj-y              += eeprom/
  3156. @@ -30,4 +31,7 @@
  3157.  
  3158.  obj-$(CONFIG_TSIF_CHRDEV) += tsif_chrdev.o
  3159.  obj-$(CONFIG_PMIC8058_PWM) += pmic8058-pwm.o
  3160. +
  3161. +obj-$(CONFIG_MODEMCTL)     += modemctl/
  3162. +
  3163.  
  3164. Only in zte/drivers/misc: fm_si4708.c
  3165. diff -urB -x .git msm/drivers/mmc/card/block.c zte/drivers/mmc/card/block.c
  3166. --- msm/drivers/mmc/card/block.c    Mon Nov  1 13:46:22 2010
  3167. +++ zte/drivers/mmc/card/block.c    Thu Oct 28 11:55:28 2010
  3168. @@ -608,12 +608,22 @@
  3169.     return err;
  3170.  }
  3171.  
  3172. +
  3173. +int remove_all_req(struct mmc_queue *mq);
  3174. +
  3175.  static void mmc_blk_remove(struct mmc_card *card)
  3176.  {
  3177.     struct mmc_blk_data *md = mmc_get_drvdata(card);
  3178.  
  3179.     if (md) {
  3180.         /* Stop new requests from getting into the queue */
  3181. +       //ruanmeisi_20100603
  3182. +       printk(KERN_ERR"rms:%s %d\n", __FUNCTION__, __LINE__);
  3183. +       queue_flag_set_unlocked(QUEUE_FLAG_DEAD,
  3184. +                   md->queue.queue);
  3185. +       remove_all_req(&md->queue);
  3186. +       //end
  3187. +      
  3188.         del_gendisk(md->disk);
  3189.  
  3190.         /* Then flush out any already in there */
  3191. diff -urB -x .git msm/drivers/mmc/card/queue.c zte/drivers/mmc/card/queue.c
  3192. --- msm/drivers/mmc/card/queue.c    Mon Nov  1 13:46:22 2010
  3193. +++ zte/drivers/mmc/card/queue.c    Thu Oct 28 11:55:28 2010
  3194. @@ -42,12 +42,39 @@
  3195.  
  3196.     return BLKPREP_OK;
  3197.  }
  3198. -
  3199. +//ruanmeisi_20100603
  3200. +int mmc_send_status(struct mmc_card *card, u32 *status);
  3201. +  
  3202. +int remove_all_req(struct mmc_queue *mq)
  3203. +{
  3204. +   int i = 0;
  3205. +   struct request_queue *q = mq->queue;
  3206. +   struct request *req = NULL;
  3207. +   if (NULL == mq) {
  3208. +       return 0;
  3209. +   }
  3210. +   spin_lock_irq(q->queue_lock);
  3211. +   while ((req = elv_next_request(q)) != NULL) {
  3212. +       int ret = 0;
  3213. +       do {
  3214. +           req->cmd_flags |= REQ_QUIET;
  3215. +           ret = __blk_end_request(req, -EIO,
  3216. +                       blk_rq_cur_bytes(req));
  3217. +       } while (ret);
  3218. +       i ++;
  3219. +   }
  3220. +   spin_unlock_irq(q->queue_lock);
  3221. +
  3222. +   printk(KERN_ERR"rms:%s %d req %d\n", __FUNCTION__, __LINE__, i);
  3223. +   return i;
  3224. +}
  3225.  static int mmc_queue_thread(void *d)
  3226.  {
  3227.     struct mmc_queue *mq = d;
  3228.     struct request_queue *q = mq->queue;
  3229.     struct request *req;
  3230. +   //ruanmeisi_20100603
  3231. +   int issue_ret = 0;
  3232.  
  3233.     current->flags |= PF_MEMALLOC;
  3234.  
  3235. @@ -55,6 +82,12 @@
  3236.     do {
  3237.         req = NULL; /* Must be set to NULL at each iteration */
  3238.  
  3239. +       //ruanmeisi_20100603
  3240. +       if (kthread_should_stop()) {
  3241. +           remove_all_req(mq);
  3242. +           break;
  3243. +       }
  3244. +       //end
  3245.         spin_lock_irq(q->queue_lock);
  3246.         set_current_state(TASK_INTERRUPTIBLE);
  3247.         if (!blk_queue_plugged(q))
  3248. @@ -106,7 +139,25 @@
  3249.             mq->check_status = 0;
  3250.                  }
  3251.  #endif
  3252. -       mq->issue_fn(mq, req);
  3253. +//ruanmeisi_20100529
  3254. +       issue_ret = mq->issue_fn(mq, req);
  3255. +       //ruanmeisi
  3256. +       if (0 == issue_ret) {
  3257. +           int err;
  3258. +           mmc_claim_host(mq->card->host);
  3259. +           err = mmc_send_status(mq->card, NULL);
  3260. +           mmc_release_host(mq->card->host);
  3261. +           if (err) {
  3262. +               printk(KERN_ERR "rms:%s: failed to get status (%d) maybe the card is removed\n",
  3263. +                      __func__, err);
  3264. +               //sdcard is removed?
  3265. +               mmc_detect_change(mq->card->host, 0);
  3266. +               msleep(500);
  3267. +               //set_current_state(TASK_INTERRUPTIBLE);
  3268. +               //schedule_timeout(HZ / 2);
  3269. +               continue;
  3270. +           }
  3271. +       }
  3272.     } while (1);
  3273.     up(&mq->thread_sem);
  3274.  
  3275. diff -urB -x .git msm/drivers/mmc/core/core.c zte/drivers/mmc/core/core.c
  3276. --- msm/drivers/mmc/core/core.c Mon Nov  1 13:46:22 2010
  3277. +++ zte/drivers/mmc/core/core.c Thu Oct 28 11:55:28 2010
  3278. @@ -37,6 +37,10 @@
  3279.  #include "sd_ops.h"
  3280.  #include "sdio_ops.h"
  3281.  
  3282. +/* ATHENV */
  3283. +#define    ATH_WIFI_SDCC_INDEX     1
  3284. +/* ATHENV */
  3285. +
  3286.  static struct workqueue_struct *workqueue;
  3287.  static struct wake_lock mmc_delayed_work_wake_lock;
  3288.  
  3289. @@ -54,7 +58,9 @@
  3290.  static int mmc_schedule_delayed_work(struct delayed_work *work,
  3291.                      unsigned long delay)
  3292.  {
  3293. -   wake_lock(&mmc_delayed_work_wake_lock);
  3294. +//ruanmeisi_20100422
  3295. +   //wake_lock(&mmc_delayed_work_wake_lock);
  3296. +//end
  3297.     return queue_delayed_work(workqueue, work, delay);
  3298.  }
  3299.  
  3300. @@ -353,16 +359,33 @@
  3301.     while (1) {
  3302.         set_current_state(TASK_UNINTERRUPTIBLE);
  3303.         stop = abort ? atomic_read(abort) : 0;
  3304. +/* ATHENV */
  3305. +#if 0
  3306.         if (stop || !host->claimed)
  3307.             break;
  3308. +#else
  3309. +       if (stop || !host->claimed || host->claimer == current)
  3310. +           break;
  3311. +#endif
  3312. +/* ATHENV */
  3313.         spin_unlock_irqrestore(&host->lock, flags);
  3314.         schedule();
  3315.         spin_lock_irqsave(&host->lock, flags);
  3316.     }
  3317.     set_current_state(TASK_RUNNING);
  3318. +/* ATHENV */
  3319. +#if 0
  3320.     if (!stop)
  3321.         host->claimed = 1;
  3322.     else
  3323. +#else
  3324. +   if (!stop) {
  3325. +       host->claimed = 1;
  3326. +       host->claimer = current;
  3327. +       host->claim_cnt += 1;
  3328. +   } else
  3329. +#endif
  3330. +/* ATHENV */
  3331.         wake_up(&host->wq);
  3332.     spin_unlock_irqrestore(&host->lock, flags);
  3333.     remove_wait_queue(&host->wq, &wait);
  3334. @@ -385,11 +408,24 @@
  3335.     WARN_ON(!host->claimed);
  3336.  
  3337.     spin_lock_irqsave(&host->lock, flags);
  3338. +/* ATHENV */
  3339. +#if 0
  3340.     host->claimed = 0;
  3341.     spin_unlock_irqrestore(&host->lock, flags);
  3342.  
  3343. +   wake_up(&host->wq)
  3344. +#else
  3345. +   if (--host->claim_cnt) {
  3346. +       spin_unlock_irqrestore(&host->lock, flags);
  3347. +   } else {
  3348. +       host->claimed = 0;
  3349. +       host->claimer = NULL;
  3350. +       spin_unlock_irqrestore(&host->lock, flags);
  3351.     wake_up(&host->wq);
  3352.  }
  3353. +#endif
  3354. +/* ATHENV */
  3355. +}
  3356.  
  3357.  EXPORT_SYMBOL(mmc_release_host);
  3358.  
  3359. @@ -798,7 +834,9 @@
  3360.         container_of(work, struct mmc_host, detect.work);
  3361.     u32 ocr;
  3362.     int err;
  3363. -
  3364. +   //ruanmeisi_20100422
  3365. +   wake_lock(&mmc_delayed_work_wake_lock);
  3366. +   //end
  3367.     mmc_bus_get(host);
  3368.  
  3369.  #ifdef CONFIG_MMC_AUTO_SUSPEND
  3370. @@ -867,7 +905,7 @@
  3371.     wake_lock_timeout(&mmc_delayed_work_wake_lock, HZ / 2);
  3372.  
  3373.     if (host->caps & MMC_CAP_NEEDS_POLL)
  3374. -       mmc_schedule_delayed_work(&host->detect, HZ);
  3375. +       mmc_schedule_delayed_work(&host->detect, 2 * HZ);
  3376.  }
  3377.  
  3378.  void mmc_start_host(struct mmc_host *host)
  3379. @@ -916,13 +954,18 @@
  3380.   */
  3381.  int mmc_suspend_host(struct mmc_host *host, pm_message_t state)
  3382.  {
  3383. +   int err = 0;
  3384.     cancel_delayed_work(&host->detect);
  3385.  #ifdef CONFIG_MMC_AUTO_SUSPEND
  3386.     cancel_delayed_work(&host->auto_suspend);
  3387.  #endif
  3388. +   pr_info("%s index = %d\n",  __FUNCTION__, host->index);
  3389. +
  3390.     mmc_flush_scheduled_work();
  3391.  
  3392.     mmc_bus_get(host);
  3393. +/* ATHENV */
  3394. +#if 0
  3395.     if (host->bus_ops && !host->bus_dead) {
  3396.         if (host->bus_ops->suspend)
  3397.             host->bus_ops->suspend(host);
  3398. @@ -934,10 +977,39 @@
  3399.             mmc_detach_bus(host);
  3400.             mmc_release_host(host);
  3401.         }
  3402. +#else
  3403. +   if (host->bus_ops && !host->bus_dead) {
  3404. +       if (host->bus_ops->suspend)
  3405. +           err = host->bus_ops->suspend(host);
  3406. +       if (err == -ENOSYS || !host->bus_ops->resume) {
  3407. +           /*
  3408. +            * We simply "remove" the card in this case.
  3409. +            * It will be redetected on resume.
  3410. +            */
  3411. +           if (host->bus_ops->remove)
  3412. +               host->bus_ops->remove(host);
  3413. +
  3414. +           mmc_claim_host(host);
  3415. +           mmc_detach_bus(host);
  3416. +           mmc_release_host(host);
  3417. +           err = 0;
  3418. +       }
  3419. +#endif
  3420. +/* ATHENV */
  3421.     }
  3422.     mmc_bus_put(host);
  3423. +/* ATHENV */
  3424. +#if 0
  3425.     mmc_power_off(host);
  3426. +
  3427.     return 0;
  3428. +#else
  3429. +   if (!err)
  3430. +       mmc_power_off(host);
  3431. +   host->last_suspend_error = err;
  3432. +
  3433. +   return err;
  3434. +#endif
  3435.  }
  3436.  
  3437.  EXPORT_SYMBOL(mmc_suspend_host);
  3438. @@ -948,21 +1020,54 @@
  3439.   */
  3440.  int mmc_resume_host(struct mmc_host *host)
  3441.  {
  3442. +/* ATHENV */
  3443. +   int err = 0;
  3444. +/* ATHENV */
  3445. +   pr_info("%s index = %d\n",  __FUNCTION__, host->index);
  3446. +
  3447.     mmc_bus_get(host);
  3448.     if (host->bus_ops && !host->bus_dead) {
  3449.         mmc_power_up(host);
  3450.         BUG_ON(!host->bus_ops->resume);
  3451. +/* ATHENV */
  3452. +#if 0
  3453.         host->bus_ops->resume(host);
  3454. +#else
  3455. +       err = host->bus_ops->resume(host);
  3456. +       if (err) {
  3457. +           printk(KERN_WARNING "%s: error %d during resume "
  3458. +                   "(card was removed?)\n",
  3459. +                   mmc_hostname(host), err);
  3460. +           if (host->bus_ops->remove)
  3461. +               host->bus_ops->remove(host);
  3462. +           mmc_claim_host(host);
  3463. +           mmc_detach_bus(host);
  3464. +           mmc_release_host(host);
  3465. +           /* no need to bother upper layers */
  3466. +           err = 0;
  3467. +       }
  3468. +#endif
  3469. +/* ATHENV */
  3470.     }
  3471.     mmc_bus_put(host);
  3472. -
  3473. +/* ATHENV */
  3474. +   if (host->index == ATH_WIFI_SDCC_INDEX) {      
  3475. +       pr_info("%s: mmc_resume_host in wifi slot skip cmd7\n",   mmc_hostname(host));
  3476. +       return err;
  3477. +   }
  3478. +/* ATHENV */
  3479.     /*
  3480.      * We add a slight delay here so that resume can progress
  3481.      * in parallel.
  3482.      */
  3483.     mmc_detect_change(host, 1);
  3484. -
  3485. +/* ATHENV */
  3486. +#if 0
  3487.     return 0;
  3488. +#else
  3489. +   return err;
  3490. +#endif
  3491. +/* ATHENV */
  3492.  }
  3493.  
  3494.  EXPORT_SYMBOL(mmc_resume_host);
  3495. @@ -985,6 +1090,25 @@
  3496.  EXPORT_SYMBOL(mmc_set_embedded_sdio_data);
  3497.  #endif
  3498.  
  3499. +//ruanmeisi_091224
  3500. +void mmc_redetect_card(struct mmc_host *host)
  3501. +{
  3502. +   printk(KERN_ERR"%s:line:%d %s\n", mmc_hostname(host), __LINE__, __FUNCTION__);
  3503. +   if (NULL == host) {
  3504. +       return ;
  3505. +   }
  3506. +   mmc_stop_host(host);
  3507. +   mmc_start_host(host);
  3508. +}
  3509. +
  3510. +EXPORT_SYMBOL(mmc_redetect_card);
  3511. +
  3512. +int queue_redetect_work(struct work_struct *work)
  3513. +{
  3514. +   return queue_work(workqueue, work);
  3515. +}
  3516. +EXPORT_SYMBOL(queue_redetect_work);
  3517. +//end
  3518.  static int __init mmc_init(void)
  3519.  {
  3520.     int ret;
  3521. diff -urB -x .git msm/drivers/mmc/core/core.h zte/drivers/mmc/core/core.h
  3522. --- msm/drivers/mmc/core/core.h Mon Nov  1 13:46:22 2010
  3523. +++ zte/drivers/mmc/core/core.h Thu Oct 28 11:55:28 2010
  3524. @@ -18,8 +18,15 @@
  3525.  struct mmc_bus_ops {
  3526.     void (*remove)(struct mmc_host *);
  3527.     void (*detect)(struct mmc_host *);
  3528. +/* ATHENV */
  3529. +#if 0
  3530.     void (*suspend)(struct mmc_host *);
  3531.     void (*resume)(struct mmc_host *);
  3532. +#else
  3533. +   int (*suspend)(struct mmc_host *);
  3534. +   int (*resume)(struct mmc_host *);
  3535. +#endif
  3536. +/* ATHENV */
  3537.  };
  3538.  
  3539.  void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
  3540. diff -urB -x .git msm/drivers/mmc/core/mmc.c zte/drivers/mmc/core/mmc.c
  3541. --- msm/drivers/mmc/core/mmc.c  Mon Nov  1 13:46:22 2010
  3542. +++ zte/drivers/mmc/core/mmc.c  Thu Oct 28 11:55:28 2010
  3543. @@ -512,7 +512,13 @@
  3544.  /*
  3545.   * Suspend callback from host.
  3546.   */
  3547. +/* ATHENV */
  3548. +#if 0
  3549.  static void mmc_suspend(struct mmc_host *host)
  3550. +#else
  3551. +static int mmc_suspend(struct mmc_host *host)
  3552. +#endif
  3553. +/* ATHENV */
  3554.  {
  3555.     BUG_ON(!host);
  3556.     BUG_ON(!host->card);
  3557. @@ -522,6 +528,9 @@
  3558.         mmc_deselect_cards(host);
  3559.     host->card->state &= ~MMC_STATE_HIGHSPEED;
  3560.     mmc_release_host(host);
  3561. +/* ATHENV */
  3562. +   return 0;
  3563. +/* ATHENV */
  3564.  }
  3565.  
  3566.  /*
  3567. @@ -530,7 +539,13 @@
  3568.   * This function tries to determine if the same card is still present
  3569.   * and, if so, restore all state to it.
  3570.   */
  3571. +/* ATHENV */
  3572. +#if 0
  3573.  static void mmc_resume(struct mmc_host *host)
  3574. +#else
  3575. +static int mmc_resume(struct mmc_host *host)
  3576. +#endif
  3577. +/* ATHENV */
  3578.  {
  3579.     int err;
  3580.  
  3581. @@ -540,7 +555,8 @@
  3582.     mmc_claim_host(host);
  3583.     err = mmc_init_card(host, host->ocr, host->card);
  3584.     mmc_release_host(host);
  3585. -
  3586. +/* ATHENV */
  3587. +#if 0
  3588.     if (err) {
  3589.         mmc_remove(host);
  3590.  
  3591. @@ -548,7 +564,10 @@
  3592.         mmc_detach_bus(host);
  3593.         mmc_release_host(host);
  3594.     }
  3595. -
  3596. +#else
  3597. +   return err;
  3598. +#endif
  3599. +/* ATHENV */
  3600.  }
  3601.  
  3602.  #else
  3603. diff -urB -x .git msm/drivers/mmc/core/sd.c zte/drivers/mmc/core/sd.c
  3604. --- msm/drivers/mmc/core/sd.c   Mon Nov  1 13:40:28 2010
  3605. +++ zte/drivers/mmc/core/sd.c   Thu Oct 28 11:55:28 2010
  3606. @@ -601,7 +601,13 @@
  3607.  /*
  3608.   * Suspend callback from host.
  3609.   */
  3610. +/* ATHENV */
  3611. +#if 0
  3612.  static void mmc_sd_suspend(struct mmc_host *host)
  3613. +#else
  3614. +static int mmc_sd_suspend(struct mmc_host *host)
  3615. +#endif
  3616. +/* ATHENV */
  3617.  {
  3618.     BUG_ON(!host);
  3619.     BUG_ON(!host->card);
  3620. @@ -611,6 +617,9 @@
  3621.         mmc_deselect_cards(host);
  3622.     host->card->state &= ~MMC_STATE_HIGHSPEED;
  3623.     mmc_release_host(host);
  3624. +/* ATHENV */
  3625. +   return 0;
  3626. +/* ATHENV */
  3627.  }
  3628.  
  3629.  /*
  3630. @@ -619,7 +628,12 @@
  3631.   * This function tries to determine if the same card is still present
  3632.   * and, if so, restore all state to it.
  3633.   */
  3634. +/* ATHENV */
  3635. +#if 0
  3636.  static void mmc_sd_resume(struct mmc_host *host)
  3637. +#else
  3638. +static int mmc_sd_resume(struct mmc_host *host)
  3639. +#endif
  3640.  {
  3641.     int err;
  3642.  #ifdef CONFIG_MMC_PARANOID_SD_INIT
  3643. @@ -648,7 +662,8 @@
  3644.     err = mmc_sd_init_card(host, host->ocr, host->card);
  3645.  #endif
  3646.     mmc_release_host(host);
  3647. -
  3648. +/* ATHENV */
  3649. +#if 0
  3650.     if (err) {
  3651.         mmc_sd_remove(host);
  3652.  
  3653. @@ -656,7 +671,10 @@
  3654.         mmc_detach_bus(host);
  3655.         mmc_release_host(host);
  3656.     }
  3657. -
  3658. +#else
  3659. +   return err;
  3660. +#endif
  3661. +/* ATHENV */
  3662.  }
  3663.  
  3664.  #else
  3665. diff -urB -x .git msm/drivers/mmc/core/sdio.c zte/drivers/mmc/core/sdio.c
  3666. --- msm/drivers/mmc/core/sdio.c Mon Nov  1 13:46:22 2010
  3667. +++ zte/drivers/mmc/core/sdio.c Thu Oct 28 11:55:28 2010
  3668. @@ -198,6 +198,175 @@
  3669.     return 0;
  3670.  }
  3671.  
  3672. +/* ATHENV */
  3673. +/*
  3674. + * Handle the detection and initialisation of a card.
  3675. + *
  3676. + * In the case of a resume, "oldcard" will contain the card
  3677. + * we're trying to reinitialise.
  3678. + */
  3679. +static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
  3680. +                 struct mmc_card *oldcard)
  3681. +{
  3682. +   struct mmc_card *card;
  3683. +   int err;
  3684. +
  3685. +   BUG_ON(!host);
  3686. +   WARN_ON(!host->claimed);
  3687. +
  3688. +   {
  3689. +       struct mmc_card tempcard;
  3690. +       tempcard.host = host;
  3691. +       mmc_io_rw_direct(&tempcard, 1, 0, SDIO_CCCR_ABORT, 0x08, NULL);
  3692. +   }
  3693. +
  3694. +   /*
  3695. +    * Since we're changing the OCR value, we seem to
  3696. +    * need to tell some cards to go back to the idle
  3697. +    * state.  We wait 1ms to give cards time to
  3698. +    * respond.
  3699. +    */
  3700. +   mmc_go_idle(host);
  3701. +
  3702. +   /*
  3703. +    * Inform the card of the voltage
  3704. +    */
  3705. +   err = mmc_send_io_op_cond(host, host->ocr, &ocr);
  3706. +   if (err)
  3707. +       goto err;
  3708. +
  3709. +   /*
  3710. +    * For SPI, enable CRC as appropriate.
  3711. +    */
  3712. +   if (mmc_host_is_spi(host)) {
  3713. +       err = mmc_spi_set_crc(host, use_spi_crc);
  3714. +       if (err)
  3715. +           goto err;
  3716. +   }
  3717. +
  3718. +   /*
  3719. +    * Allocate card structure.
  3720. +    */
  3721. +   card = mmc_alloc_card(host, NULL);
  3722. +   if (IS_ERR(card)) {
  3723. +       err = PTR_ERR(card);
  3724. +       goto err;
  3725. +   }
  3726. +
  3727. +   card->type = MMC_TYPE_SDIO;
  3728. +
  3729. +   /*
  3730. +    * For native busses:  set card RCA and quit open drain mode.
  3731. +    */
  3732. +   if (!mmc_host_is_spi(host)) {
  3733. +       err = mmc_send_relative_addr(host, &card->rca);
  3734. +       if (err)
  3735. +           goto remove;
  3736. +
  3737. +       mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
  3738. +   }
  3739. +
  3740. +   /*
  3741. +    * Select card, as all following commands rely on that.
  3742. +    */
  3743. +   if (!mmc_host_is_spi(host)) {
  3744. +       err = mmc_select_card(card);
  3745. +       if (err)
  3746. +           goto remove;
  3747. +   }
  3748. +
  3749. +   /*
  3750. +    * Read the common registers.
  3751. +    */
  3752. +#ifdef CONFIG_MMC_EMBEDDED_SDIO
  3753. +   if (host->embedded_sdio_data.cccr)
  3754. +       memcpy(&card->cccr, host->embedded_sdio_data.cccr,
  3755. +           sizeof(struct sdio_cccr));
  3756. +   else {
  3757. +#endif
  3758. +   err = sdio_read_cccr(card);
  3759. +   if (err)
  3760. +       goto remove;
  3761. +
  3762. +#ifdef CONFIG_MMC_EMBEDDED_SDIO
  3763. +   }
  3764. +#endif
  3765. +
  3766. +#ifdef CONFIG_MMC_EMBEDDED_SDIO
  3767. +   if (host->embedded_sdio_data.cis)
  3768. +       memcpy(&card->cis, host->embedded_sdio_data.cis,
  3769. +           sizeof(struct sdio_cis));
  3770. +   else {
  3771. +#endif
  3772. +   /*
  3773. +    * Read the common CIS tuples.
  3774. +    */
  3775. +   err = sdio_read_common_cis(card);
  3776. +   if (err)
  3777. +       goto remove;
  3778. +
  3779. +#ifdef CONFIG_MMC_EMBEDDED_SDIO
  3780. +   }
  3781. +#endif
  3782. +
  3783. +   if (oldcard) {
  3784. +       int same = (card->cis.vendor == oldcard->cis.vendor &&
  3785. +               card->cis.device == oldcard->cis.device);
  3786. +       mmc_remove_card(card);
  3787. +       if (!same) {
  3788. +           err = -ENOENT;
  3789. +           goto err;
  3790. +       }
  3791. +       card = oldcard;
  3792. +   }
  3793. +
  3794. +   /*
  3795. +    * Switch to high-speed (if supported).
  3796. +    */
  3797. +#if 1
  3798. +   err = sdio_enable_hs(card);
  3799. +   if (err)
  3800. +       goto remove;
  3801. +
  3802. +   /*
  3803. +    * Change to the card's maximum speed.
  3804. +    */
  3805. +   if (mmc_card_highspeed(card)) {
  3806. +       /*
  3807. +        * The SDIO specification doesn't mention how
  3808. +        * the CIS transfer speed register relates to
  3809. +        * high-speed, but it seems that 50 MHz is
  3810. +        * mandatory.
  3811. +        */
  3812. +       mmc_set_clock(host, 50000000);
  3813. +   } else {
  3814. +       mmc_set_clock(host, card->cis.max_dtr);
  3815. +   }
  3816. +#else
  3817. +   (void)&sdio_enable_hs;
  3818. +   mmc_set_clock(host, 25000000);
  3819. +#endif
  3820. +
  3821. +   /*
  3822. +    * Switch to wider bus (if supported).
  3823. +    */
  3824. +   err = sdio_enable_wide(card);
  3825. +   if (err)
  3826. +       goto remove;
  3827. +
  3828. +   if (!oldcard)
  3829. +       host->card = card;
  3830. +   return 0;
  3831. +
  3832. +remove:
  3833. +   if (!oldcard)
  3834. +       mmc_remove_card(card);
  3835. +
  3836. +err:
  3837. +   return err;
  3838. +}
  3839. +/* ATHENV */
  3840. +
  3841.  /*
  3842.   * Host is being removed. Free up the current card.
  3843.   */
  3844. @@ -247,10 +416,81 @@
  3845.     }
  3846.  }
  3847.  
  3848. +/* ATHENV */
  3849. +/*
  3850. + * SDIO suspend.  We need to suspend all functions separately.
  3851. + * Therefore all registered functions must have drivers with suspend
  3852. + * and resume methods.  Failing that we simply remove the whole card.
  3853. + */
  3854. +static int mmc_sdio_suspend(struct mmc_host *host)
  3855. +{
  3856. +   int i, err = 0;
  3857. +   const struct dev_pm_ops *pmops;
  3858. +   for (i = 0; i < host->card->sdio_funcs; i++) {
  3859. +       struct sdio_func *func = host->card->sdio_func[i];
  3860. +       if (func && sdio_func_present(func) && func->dev.driver) {
  3861. +           pmops = func->dev.driver->pm;
  3862. +           if (!pmops || !pmops->suspend || !pmops->resume) {
  3863. +               /* force removal of entire card in that case */
  3864. +               err = -ENOSYS;
  3865. +           } else
  3866. +               err = pmops->suspend(&func->dev);
  3867. +           if (err)
  3868. +               break;
  3869. +       }
  3870. +   }
  3871. +   while (err && --i >= 0) {
  3872. +       struct sdio_func *func = host->card->sdio_func[i];
  3873. +       if (func && sdio_func_present(func) && func->dev.driver) {
  3874. +           pmops = func->dev.driver->pm;
  3875. +           pmops->resume(&func->dev);
  3876. +       }
  3877. +   }
  3878. +
  3879. +   return err;
  3880. +}
  3881. +
  3882. +static int mmc_sdio_resume(struct mmc_host *host)
  3883. +{
  3884. +   int i, err;
  3885. +   const struct dev_pm_ops *pmops;
  3886. +   BUG_ON(!host);
  3887. +   BUG_ON(!host->card);
  3888. +
  3889. +   /* Basic card reinitialization. */
  3890. +   mmc_claim_host(host);
  3891. +   err = mmc_sdio_init_card(host, host->ocr, host->card);
  3892. +   mmc_release_host(host);
  3893. +
  3894. +/*
  3895. +    * If the card looked to be the same as before suspending, then
  3896. +    * we proceed to resume all card functions.  If one of them returns
  3897. +    * an error then we simply return that error to the core and the
  3898. +    * card will be redetected as new.  It is the responsibility of
  3899. +    * the function driver to perform further tests with the extra
  3900. +    * knowledge it has of the card to confirm the card is indeed the
  3901. +    * same as before suspending (same MAC address for network cards,
  3902. +    * etc.) and return an error otherwise.
  3903. + */
  3904. +   for (i = 0; !err && i < host->card->sdio_funcs; i++) {
  3905. +       struct sdio_func *func = host->card->sdio_func[i];
  3906. +       if (func && sdio_func_present(func) && func->dev.driver) {
  3907. +           pmops = func->dev.driver->pm;
  3908. +           err = pmops->resume(&func->dev);
  3909. +       }
  3910. +   }
  3911. +
  3912. +   return err;
  3913. +}
  3914. +/* ATHENV */
  3915.  
  3916.  static const struct mmc_bus_ops mmc_sdio_ops = {
  3917.     .remove = mmc_sdio_remove,
  3918.     .detect = mmc_sdio_detect,
  3919. +/* ATHENV */
  3920. +   .suspend = mmc_sdio_suspend,
  3921. +   .resume = mmc_sdio_resume,
  3922. +/* ATHENV */
  3923.  };
  3924.  
  3925.  
  3926. @@ -295,7 +535,8 @@
  3927.         err = -EINVAL;
  3928.         goto err;
  3929.     }
  3930. -
  3931. +/* ATHENV */
  3932. +#if 0
  3933.     /*
  3934.      * Inform the card of the voltage
  3935.      */
  3936. @@ -311,17 +552,34 @@
  3937.         if (err)
  3938.             goto err;
  3939.     }
  3940. +#else
  3941. +   /*
  3942. +    * Detect and init the card.
  3943. +    */
  3944. +   err = mmc_sdio_init_card(host, host->ocr, NULL);
  3945. +   if (err)
  3946. +       goto err;
  3947. +   card = host->card;
  3948. +#endif
  3949. +/* ATHENV */
  3950.  
  3951.     /*
  3952.      * The number of functions on the card is encoded inside
  3953.      * the ocr.
  3954.      */
  3955. +/* ATHENV */
  3956. +#if 0
  3957.     funcs = (ocr & 0x70000000) >> 28;
  3958. -
  3959. +#else
  3960. +   card->sdio_funcs = funcs = (ocr & 0x70000000) >> 28;
  3961. +#endif
  3962. +/* ATHENV */
  3963.  #ifdef CONFIG_MMC_EMBEDDED_SDIO
  3964.     if (host->embedded_sdio_data.funcs)
  3965.         funcs = host->embedded_sdio_data.num_funcs;
  3966.  #endif
  3967. +/* ATHENV */
  3968. +#if 0
  3969.  
  3970.     /*
  3971.      * Allocate card structure.
  3972. @@ -416,6 +674,8 @@
  3973.     if (err)
  3974.         goto remove;
  3975.  
  3976. +#endif
  3977. +/* ATHENV */
  3978.     /*
  3979.      * Initialize (but don't add) all present functions.
  3980.      */
  3981. diff -urB -x .git msm/drivers/mmc/core/sdio_irq.c zte/drivers/mmc/core/sdio_irq.c
  3982. --- msm/drivers/mmc/core/sdio_irq.c Mon Nov  1 12:09:57 2010
  3983. +++ zte/drivers/mmc/core/sdio_irq.c Thu Oct 28 11:55:28 2010
  3984. @@ -144,7 +144,18 @@
  3985.     if (host->caps & MMC_CAP_SDIO_IRQ)
  3986.         host->ops->enable_sdio_irq(host, 0);
  3987.  
  3988. -   pr_debug("%s: IRQ thread exiting with code %d\n",
  3989. +/* ATHENV */
  3990. +           /* someone is trying to reclaim it? */
  3991. +           while (!kthread_should_stop()) {
  3992. +                     pr_info("[%s]: [%d], wait for someone to reclaim\n", __func__, current->pid);
  3993. +                     set_current_state(TASK_INTERRUPTIBLE);
  3994. +                     schedule_timeout(HZ);
  3995. +                     set_current_state(TASK_RUNNING);
  3996. +           }
  3997. +           //wake_unlock(&mmc_sdio_irq_wake_lock);
  3998. +/* ATHENV */
  3999. +
  4000. +   pr_info("[WIFI]_%s: IRQ thread exiting with code %d\n",
  4001.          mmc_hostname(host), ret);
  4002.  
  4003.     return ret;
  4004. @@ -180,7 +191,21 @@
  4005.  
  4006.     if (!--host->sdio_irqs) {
  4007.         atomic_set(&host->sdio_irq_thread_abort, 1);
  4008. +       /* ATHENV */
  4009. +#if 0
  4010.         kthread_stop(host->sdio_irq_thread);
  4011. +#else
  4012. +       if (host->claimed) {
  4013. +           pr_info("[%s] host was claimed release it first\n", __FUNCTION__);
  4014. +           mmc_release_host(host);
  4015. +           kthread_stop(host->sdio_irq_thread);
  4016. +           mmc_claim_host(host);
  4017. +       } else {
  4018. +           kthread_stop(host->sdio_irq_thread);
  4019. +       }
  4020. +        pr_info("destroy  mmc_sdio_irq_wake_lock\n")
  4021. +#endif
  4022. +/* ATHENV */
  4023.     }
  4024.  
  4025.     return 0;
  4026. diff -urB -x .git msm/drivers/mmc/host/msm_sdcc.c zte/drivers/mmc/host/msm_sdcc.c
  4027. --- msm/drivers/mmc/host/msm_sdcc.c Mon Nov  1 13:46:22 2010
  4028. +++ zte/drivers/mmc/host/msm_sdcc.c Thu Oct 28 11:55:28 2010
  4029. @@ -14,6 +14,9 @@
  4030.   * Author: San Mehat (san@android.com)
  4031.   *
  4032.   */
  4033. +//ruanmeisi 20100408   ruanmeisi_20100408 p729b sd suport host plug don't shutdown polling
  4034. +//ruanmeisi 20100408   ruanmeisi_20100418 add CONFIG_MACH_BLADE macro
  4035. +//ruanmeisi 20100510   ruanmeisi_20100510 clean host->pio  when stop data
  4036.  
  4037.  #include <linux/module.h>
  4038.  #include <linux/moduleparam.h>
  4039. @@ -46,15 +49,39 @@
  4040.  #include <mach/clk.h>
  4041.  #include <mach/dma.h>
  4042.  #include <mach/htc_pwrsink.h>
  4043. +//ruanmeisi
  4044. +#include <linux/proc_fs.h>
  4045.  
  4046. +#define ATH_PATCH
  4047.  
  4048.  #include "msm_sdcc.h"
  4049.  
  4050.  #define DRIVER_NAME "msm-sdcc"
  4051.  
  4052. +//ruanmeisi   20100221
  4053. +
  4054. +#define T_CARD_DRIVER_ID                1
  4055. +
  4056. +
  4057. +/* #define DBG(host, fmt, args...) \ */
  4058. +/*     pr_debug("%s: %s: " fmt "\n", mmc_hostname(host->mmc), __func__ , args) */
  4059. +
  4060. +#define DPRINTK(fmt, args...)                      \
  4061. +   printk(KERN_ERR "mmc:%s: %d: " fmt "",                     \
  4062. +          __FUNCTION__, __LINE__,  ## args)
  4063. +
  4064.  #define DBG(host, fmt, args...)    \
  4065. -   pr_debug("%s: %s: " fmt "\n", mmc_hostname(host->mmc), __func__ , args)
  4066. +   do {                                \
  4067. +   if(mmc_debug)                           \
  4068. +       printk(KERN_ERR"%s: %s: " fmt "\n", mmc_hostname(host->mmc), __func__ , args) ; \
  4069. +           }while(0)                   \
  4070. +
  4071.  
  4072. +static struct proc_dir_entry * d_entry;
  4073. +int mmc_debug = 0;
  4074. +
  4075. +int queue_redetect_work(struct work_struct *work);
  4076. +void mmc_redetect_card(struct mmc_host *host);
  4077.  #define IRQ_DEBUG 0
  4078.  
  4079.  #if defined(CONFIG_DEBUG_FS)
  4080. @@ -199,6 +226,12 @@
  4081.  static void
  4082.  msmsdcc_stop_data(struct msmsdcc_host *host)
  4083.  {
  4084. +
  4085. +   //ruanmeisi_20100510
  4086. +   if (T_CARD_DRIVER_ID == host->pdev_id) {
  4087. +       memset(&host->pio, 0, sizeof(host->pio));
  4088. +   }
  4089. +   //end
  4090.     host->curr.data = NULL;
  4091.     host->curr.got_dataend = host->curr.got_datablkend = 0;
  4092.  }
  4093. @@ -693,7 +726,59 @@
  4094.  
  4095.         if (!(status & (MCI_TXFIFOHALFEMPTY | MCI_RXDATAAVLBL)))
  4096.             break;
  4097. +       //ruanmeisi_20100510
  4098. +       if(NULL == host->curr.mrq) {
  4099. +           pr_info("[rms:sd]:%s pio host->curr.mrq is null\n",
  4100. +               mmc_hostname(host->mmc));
  4101. +
  4102. +           if(status & MCI_RXACTIVE) {
  4103. +               int read_cnt = 0;
  4104. +               while(readl(base+MMCISTATUS) & MCI_RXDATAAVLBL) {
  4105. +                   readl(base+MMCIFIFO+(1%MCI_FIFOSIZE));
  4106. +                   if((read_cnt++) > MCI_FIFOSIZE)
  4107. +                       break;
  4108. +               }
  4109. +               writel(0, base + MMCIMASK1);
  4110. +           }
  4111. +
  4112. +           if(status & MCI_TXACTIVE) {
  4113. +               writel(0, base + MMCIMASK1);
  4114. +           }
  4115. +
  4116. +           return IRQ_HANDLED;
  4117. +       }
  4118. +       //ZTE_WIFI_HP_019
  4119. +       //hp merge htc patch for pio.sg NULL
  4120. +       //here we catch the pio.sg==NULL, and stop current transaction,
  4121. +       //let app to handle the error
  4122. +       if(host->pio.sg == NULL) {
  4123. +           pr_info("[hp@wifi]:%s pio scatter list is null\n",
  4124. +                   mmc_hostname(host->mmc));
  4125. +
  4126. +           if(status & MCI_RXACTIVE) {
  4127. +               int read_cnt = 0;
  4128. +               while(readl(base+MMCISTATUS) & MCI_RXDATAAVLBL) {
  4129. +                   readl(base+MMCIFIFO+(1%MCI_FIFOSIZE));
  4130. +                   if((read_cnt++) > MCI_FIFOSIZE)
  4131. +                       break;
  4132. +               }
  4133. +               writel(MCI_RXDATAAVLBLMASK, base + MMCIMASK1);
  4134. +           }
  4135. +
  4136. +           if(status & MCI_TXACTIVE) {
  4137. +               struct mmc_request *mrq;
  4138. +
  4139. +               writel(0, base + MMCIMASK1);
  4140. +               mrq = host->curr.mrq;
  4141. +               mrq->data->error = 1;
  4142. +               if(mrq->done)
  4143. +                   mrq->done(mrq);
  4144. +           }
  4145. +
  4146. +           return IRQ_HANDLED;
  4147.  
  4148. +       }
  4149. +       //ZTE_WIFI_HP_019 end
  4150.         /* Map the current scatter buffer */
  4151.         local_irq_save(flags);
  4152.         buffer = kmap_atomic(sg_page(host->pio.sg),
  4153. @@ -812,7 +897,9 @@
  4154.             cmd->resp[1] = readl(base + MMCIRESPONSE1);
  4155.             cmd->resp[2] = readl(base + MMCIRESPONSE2);
  4156.             cmd->resp[3] = readl(base + MMCIRESPONSE3);
  4157. -
  4158. +           //ruanmeisi_20100510
  4159. +           del_timer(&host->command_timer);
  4160. +           //end
  4161.             if (status & MCI_CMDTIMEOUT) {
  4162.  #if VERBOSE_COMMAND_TIMEOUTS
  4163.                 pr_err("%s: Command timeout\n",
  4164. @@ -996,6 +1083,9 @@
  4165.     }
  4166.  
  4167.     msmsdcc_request_start(host, mrq);
  4168. +   //ruanmeisi_20100510
  4169. +   mod_timer(&host->command_timer, jiffies + HZ);
  4170. +   //end
  4171.     spin_unlock_irqrestore(&host->lock, flags);
  4172.  }
  4173.  
  4174. @@ -1167,6 +1257,46 @@
  4175.     msmsdcc_check_status((unsigned long) host);
  4176.  }
  4177.  
  4178. +
  4179. +/* ruanmeisi_20100510 command timeout handle */
  4180. +/*
  4181. + * called when a command expires.
  4182. + * Dump some debugging, and then error
  4183. + * out the transaction.
  4184. + */
  4185. +static void
  4186. +msmsdcc_command_expired(unsigned long _data)
  4187. +{
  4188. +   struct msmsdcc_host *host = (struct msmsdcc_host *) _data;
  4189. +   struct mmc_request  *mrq;
  4190. +   unsigned long       flags;
  4191. +
  4192. +   spin_lock_irqsave(&host->lock, flags);
  4193. +   mrq = host->curr.mrq;
  4194. +
  4195. +   if (!mrq) {
  4196. +       printk(KERN_INFO "%s: Command expiry misfire\n",
  4197. +              mmc_hostname(host->mmc));
  4198. +       spin_unlock_irqrestore(&host->lock, flags);
  4199. +       return;
  4200. +   }
  4201. +
  4202. +   printk(KERN_ERR "%s: Command timeout [%u] (%p %p %p %p)\n",
  4203. +          mmc_hostname(host->mmc), mrq->cmd->opcode, mrq, mrq->cmd,
  4204. +          mrq->data, host->dma.sg);
  4205. +
  4206. +   mrq->cmd->error = -ETIMEDOUT;
  4207. +   msmsdcc_stop_data(host);
  4208. +
  4209. +   writel(0, host->base + MMCICOMMAND);
  4210. +
  4211. +   host->curr.mrq = NULL;
  4212. +   host->curr.cmd = NULL;
  4213. +
  4214. +   spin_unlock_irqrestore(&host->lock, flags);
  4215. +   mmc_request_done(host->mmc, mrq);
  4216. +}
  4217. +/*ruanmeisi_20100510 end */
  4218.  static int
  4219.  msmsdcc_init_dma(struct msmsdcc_host *host)
  4220.  {
  4221. @@ -1250,10 +1380,110 @@
  4222.     return count;
  4223.  }
  4224.  
  4225. +/* ATHENV +++ */
  4226. +static ssize_t
  4227. +set_detect_change(struct device *dev, struct device_attribute *attr,
  4228. +       const char *buf, size_t count)
  4229. +{
  4230. +   struct mmc_host *mmc = dev_get_drvdata(dev);
  4231. +   struct msmsdcc_host *host = mmc_priv(mmc);
  4232. +   int value;
  4233. +   if (sscanf(buf, "%d", &value)==1 && value) {
  4234. +        mmc_detect_change(host->mmc, 0);
  4235. +    }
  4236. +   return count;
  4237. +}
  4238. +static DEVICE_ATTR(detect_change, S_IRUGO | S_IWUSR,
  4239. +       NULL, set_detect_change);
  4240. +/* ATHENV --- */
  4241. +
  4242. +//ruanmeisi_20091224 sysfs interface for debug
  4243. +
  4244. +void msmsdcc_mmc_redetect(struct work_struct *work)
  4245. +{
  4246. +   struct msmsdcc_host *msmsdcchost =
  4247. +       container_of(work, struct msmsdcc_host, redetect);
  4248. +   struct mmc_host *host = msmsdcchost->mmc;
  4249. +#ifdef CONFIG_HAS_EARLYSUSPEND
  4250. +   if (msmsdcchost->polling_enabled) {
  4251. +       unsigned long flags;
  4252. +       spin_lock_irqsave(&host->lock, flags);
  4253. +       msmsdcchost->mmc->caps |= MMC_CAP_NEEDS_POLL;
  4254. +       spin_unlock_irqrestore(&host->lock, flags);
  4255. +   }
  4256. +#endif
  4257. +   mmc_redetect_card(host);
  4258. +   return ;
  4259. +}
  4260. +
  4261. +static ssize_t
  4262. +show_highspeed(struct device *dev, struct device_attribute *attr, char *buf)
  4263. +{
  4264. +   struct mmc_host *mmc = dev_get_drvdata(dev);
  4265. +   struct msmsdcc_host *host = mmc_priv(mmc);
  4266. +   int poll;
  4267. +   unsigned long flags;
  4268. +
  4269. +   spin_lock_irqsave(&host->lock, flags);
  4270. +   poll = !!(mmc->caps & MMC_CAP_SD_HIGHSPEED);
  4271. +   spin_unlock_irqrestore(&host->lock, flags);
  4272. +
  4273. +   return snprintf(buf, PAGE_SIZE, "%d\n", poll);
  4274. +}
  4275. +
  4276. +static ssize_t
  4277. +set_highspeed(struct device *dev, struct device_attribute *attr,
  4278. +       const char *buf, size_t count)
  4279. +{
  4280. +   struct mmc_host *mmc = dev_get_drvdata(dev);
  4281. +   struct msmsdcc_host *host = mmc_priv(mmc);
  4282. +   int value;
  4283. +   unsigned long flags;
  4284. +
  4285. +   sscanf(buf, "%d", &value);
  4286. +
  4287. +   spin_lock_irqsave(&host->lock, flags);
  4288. +   if (value) {
  4289. +       mmc->caps |= MMC_CAP_SD_HIGHSPEED;
  4290. +       mmc_detect_change(host->mmc, 0);
  4291. +   } else {
  4292. +       mmc->caps &= ~MMC_CAP_SD_HIGHSPEED;
  4293. +   }
  4294. +   spin_unlock_irqrestore(&host->lock, flags);
  4295. +   return count;
  4296. +}
  4297. +
  4298. +
  4299. +static ssize_t
  4300. +set_redetect(struct device *dev, struct device_attribute *attr,
  4301. +       const char *buf, size_t count)
  4302. +{
  4303. +   struct mmc_host *mmc = dev_get_drvdata(dev);
  4304. +   struct msmsdcc_host *host = mmc_priv(mmc);
  4305. +   queue_redetect_work(&(host->redetect));
  4306. +   return count;
  4307. +}
  4308. +
  4309. +
  4310. +static DEVICE_ATTR(redetect, S_IRUGO | S_IWUSR,
  4311. +       NULL, set_redetect);
  4312. +static DEVICE_ATTR(highspeed, S_IRUGO | S_IWUSR,
  4313. +       show_highspeed, set_highspeed);
  4314. +
  4315. +
  4316. +//end
  4317. +
  4318.  static DEVICE_ATTR(polling, S_IRUGO | S_IWUSR,
  4319.         show_polling, set_polling);
  4320.  static struct attribute *dev_attrs[] = {
  4321.     &dev_attr_polling.attr,
  4322. +/* ATHENV +++ */
  4323. +        &dev_attr_detect_change.attr,
  4324. +/* ATHENV --- */
  4325. +        //ruanmeisi_20091224 debug interface
  4326. +   &dev_attr_redetect.attr,
  4327. +   &dev_attr_highspeed.attr,
  4328. +   //end
  4329.     NULL,
  4330.  };
  4331.  static struct attribute_group dev_attr_grp = {
  4332. @@ -1266,7 +1496,13 @@
  4333.     struct msmsdcc_host *host =
  4334.         container_of(h, struct msmsdcc_host, early_suspend);
  4335.     unsigned long flags;
  4336. -
  4337. +#ifdef CONFIG_MACH_BLADE
  4338. +   //ruanmeisi_20100408 p729b sd suport host plug
  4339. +   //don't shutdown polling
  4340. +   if (T_CARD_DRIVER_ID == host->pdev_id) {
  4341. +       return ;
  4342. +   }
  4343. +#endif
  4344.     spin_lock_irqsave(&host->lock, flags);
  4345.     host->polling_enabled = host->mmc->caps & MMC_CAP_NEEDS_POLL;
  4346.     host->mmc->caps &= ~MMC_CAP_NEEDS_POLL;
  4347. @@ -1277,7 +1513,13 @@
  4348.     struct msmsdcc_host *host =
  4349.         container_of(h, struct msmsdcc_host, early_suspend);
  4350.     unsigned long flags;
  4351. -
  4352. +#ifdef CONFIG_MACH_BLADE
  4353. +   //ruanmeisi_20100408 p729b sd suport host plug
  4354. +   //don't shutdown polling
  4355. +   if (T_CARD_DRIVER_ID == host->pdev_id) {
  4356. +       return ;
  4357. +   }
  4358. +#endif
  4359.     if (host->polling_enabled) {
  4360.         spin_lock_irqsave(&host->lock, flags);
  4361.         host->mmc->caps |= MMC_CAP_NEEDS_POLL;
  4362. @@ -1427,7 +1669,11 @@
  4363.  #ifdef CONFIG_MMC_MSM_SDIO_SUPPORT
  4364.     mmc->caps |= MMC_CAP_SDIO_IRQ;
  4365.  #endif
  4366. -
  4367. +   //ruanmeisi 20100221
  4368. +   if (T_CARD_DRIVER_ID == host->pdev_id) {
  4369. +       mmc->caps |= MMC_CAP_NEEDS_POLL;
  4370. +   }
  4371. +   //end
  4372.     mmc->max_phys_segs = NR_SG;
  4373.     mmc->max_hw_segs = NR_SG;
  4374.     mmc->max_blk_size = 4096;   /* MCI_DATA_CTL BLOCKSIZE up to 4096 */
  4375. @@ -1484,7 +1730,16 @@
  4376.             disable_irq(host->plat->sdiowakeup_irq);
  4377.         }
  4378.     }
  4379. +//ruanmeisi_20100510
  4380.  
  4381. +/*
  4382. +    * Setup a command timer. We currently need this due to
  4383. +    * some 'strange' timeout / error handling situations.
  4384. +    */
  4385. +   init_timer(&host->command_timer);
  4386. +   host->command_timer.data = (unsigned long) host;
  4387. +   host->command_timer.function = msmsdcc_command_expired;
  4388. +//end
  4389.     ret = request_irq(irqres->start, msmsdcc_irq, IRQF_SHARED,
  4390.               DRIVER_NAME " (cmd)", host);
  4391.     if (ret)
  4392. @@ -1522,6 +1777,8 @@
  4393.            host->eject);
  4394.     pr_info("%s: Power save feature enable = %d\n",
  4395.            mmc_hostname(mmc), msmsdcc_pwrsave);
  4396. +   pr_info("%s: Dummy52 feature enable = %d\n",
  4397. +          mmc_hostname(mmc), plat->dummy52_required);
  4398.  
  4399.     if (host->dma.channel != -1) {
  4400.         pr_info("%s: DM non-cached buffer at %p, dma_addr 0x%.8x\n",
  4401. @@ -1540,6 +1797,8 @@
  4402.         if (ret)
  4403.             goto irq_free;
  4404.     }
  4405. +//ruanmeisi
  4406. +   INIT_WORK(&host->redetect, msmsdcc_mmc_redetect);
  4407.     return 0;
  4408.   irq_free:
  4409.     free_irq(irqres->start, host);
  4410. @@ -1584,6 +1843,9 @@
  4411.     DBG(host, "Removing SDCC2 device = %d\n", pdev->id);
  4412.     plat = host->plat;
  4413.  
  4414. +   //ruanmeisi_20100510
  4415. +   del_timer_sync(&host->command_timer);
  4416. +   //end
  4417.     if (!plat->status_irq)
  4418.         sysfs_remove_group(&pdev->dev.kobj, &dev_attr_grp);
  4419.  
  4420. @@ -1623,6 +1885,46 @@
  4421.  }
  4422.  
  4423.  #ifdef CONFIG_PM
  4424. +/* ATHENV */
  4425. +struct msmsdcc_host *wlan_host;
  4426. +void plat_disable_wlan_slot(void)
  4427. +{
  4428. +   struct msmsdcc_host *host = wlan_host;
  4429. +
  4430. +   if (host->plat->status_irq)
  4431. +       disable_irq(host->plat->status_irq);
  4432. +   writel(0, host->base + MMCIMASK0);
  4433. +   if (host->clks_on) {
  4434. +       clk_disable(host->clk);
  4435. +       clk_disable(host->pclk);
  4436. +       host->clks_on = 0;
  4437. +   }
  4438. +   if (host->plat->sdiowakeup_irq)
  4439. +       enable_irq(host->plat->sdiowakeup_irq);
  4440. +}
  4441. +EXPORT_SYMBOL(plat_disable_wlan_slot);
  4442. +
  4443. +void plat_enable_wlan_slot(void)
  4444. +{
  4445. +   struct msmsdcc_host *host = wlan_host;
  4446. +   unsigned long flags;
  4447. +
  4448. +   spin_lock_irqsave(&host->lock, flags);
  4449. +   if (!host->clks_on) {
  4450. +       clk_enable(host->pclk);
  4451. +       clk_enable(host->clk);
  4452. +       host->clks_on = 1;
  4453. +   }
  4454. +   writel(host->mci_irqenable, host->base + MMCIMASK0);
  4455. +   spin_unlock_irqrestore(&host->lock, flags);
  4456. +   if (host->plat->sdiowakeup_irq)
  4457. +       disable_irq(host->plat->sdiowakeup_irq);
  4458. +   if (host->plat->status_irq)
  4459. +       enable_irq(host->plat->status_irq);
  4460. +
  4461. +}
  4462. +EXPORT_SYMBOL(plat_enable_wlan_slot);
  4463. +/* ATHENV */
  4464.  static int
  4465.  msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
  4466.  {
  4467. @@ -1634,12 +1936,21 @@
  4468.     if (test_and_set_bit(0, &host->suspended))
  4469.         return 0;
  4470.  #endif
  4471. +   pr_info("%s pdev_id = %d\n",  __FUNCTION__, host->pdev_id);
  4472. +
  4473.     if (mmc) {
  4474.         if (host->plat->status_irq)
  4475.             disable_irq(host->plat->status_irq);
  4476. -
  4477. +#ifdef ATH_PATCH /* ATHENV+++ */
  4478. +       rc = mmc_suspend_host(mmc, state);
  4479. +       if (rc!=0) {
  4480. +           if (host->plat->status_irq)
  4481. +               enable_irq(host->plat->status_irq);
  4482. +       }
  4483. +#else
  4484.         if (!mmc->card || mmc->card->type != MMC_TYPE_SDIO)
  4485.             rc = mmc_suspend_host(mmc, state);
  4486. +#endif /* ATHENV--- */
  4487.         if (!rc) {
  4488.             writel(0, host->base + MMCIMASK0);
  4489.  
  4490. @@ -1649,9 +1960,19 @@
  4491.                 host->clks_on = 0;
  4492.             }
  4493.         }
  4494. -
  4495. +#ifdef ATH_PATCH /* ATHENV+++ */
  4496. +       if (mmc->last_suspend_error) {
  4497. +           /*
  4498. +            * save host for WoW mode
  4499. +            * Don't enable sdio wakeup irq before system suspend
  4500. +           */
  4501. +           wlan_host = host;
  4502. +           return 0;
  4503. +       }
  4504. +#else
  4505.         if (host->plat->sdiowakeup_irq)
  4506.             enable_irq(host->plat->sdiowakeup_irq);
  4507. +#endif /* ATHENV--- */
  4508.     }
  4509.     return rc;
  4510.  }
  4511. @@ -1667,7 +1988,16 @@
  4512.     if (!test_and_clear_bit(0, &host->suspended))
  4513.         return 0;
  4514.  #endif
  4515. +   pr_info("%s pdev_id = %d\n",  __FUNCTION__, host->pdev_id);
  4516. +
  4517.     if (mmc) {
  4518. +/* ATHENV+++ */
  4519. +       if (mmc->last_suspend_error) {
  4520. +           wlan_host = host;
  4521. +           mmc->last_suspend_error = 0;
  4522. +           return 0;
  4523. +       }
  4524. +/* ATHENV--- */
  4525.         spin_lock_irqsave(&host->lock, flags);
  4526.         if (!host->clks_on) {
  4527.             clk_enable(host->pclk);
  4528. @@ -1678,11 +2008,14 @@
  4529.         writel(host->mci_irqenable, host->base + MMCIMASK0);
  4530.  
  4531.         spin_unlock_irqrestore(&host->lock, flags);
  4532. -
  4533. +#ifdef ATH_PATCH /* ATHENV+++ */
  4534. +       if (1) {
  4535. +#else
  4536.         if (host->plat->sdiowakeup_irq)
  4537.             disable_irq(host->plat->sdiowakeup_irq);
  4538.  
  4539.         if (!mmc->card || mmc->card->type != MMC_TYPE_SDIO) {
  4540. +#endif /* ATHENV--- */
  4541.  #ifdef CONFIG_MMC_MSM7X00A_RESUME_IN_WQ
  4542.             schedule_work(&host->resume_task);
  4543.  #else
  4544. @@ -1726,6 +2059,60 @@
  4545.     },
  4546.  };
  4547.  
  4548. +//ruanmeisi_091224 proc interface
  4549. +static int msm_sdcc_read_proc(
  4550. +        char *page, char **start, off_t off, int count, int *eof, void *data)
  4551. +{
  4552. +   int len = 0;
  4553. +   len = sprintf(page, "%s\n",
  4554. +                      !!mmc_debug == 1?"on":"off");
  4555. +   return len;
  4556. +
  4557. +}
  4558. +
  4559. +static int msm_sdcc_write_proc(struct file *file, const char __user *buffer,
  4560. +                unsigned long count, void *data)
  4561. +{
  4562. +   char tmp[16] = {0};
  4563. +   int len = 0;
  4564. +   len = count;
  4565. +   if (count > sizeof(tmp)) {
  4566. +       len = sizeof(tmp) - 1;
  4567. +   }
  4568. +   if(copy_from_user(tmp, buffer, len))
  4569. +                return -EFAULT;
  4570. +   if (strstr(tmp, "on")) {
  4571. +       mmc_debug = 1;
  4572. +   } else if (strstr(tmp, "off")) {
  4573. +       mmc_debug = 0;
  4574. +   }
  4575. +   return count;
  4576. +
  4577. +}
  4578. +
  4579. +
  4580. +void
  4581. +init_mmc_proc(void)
  4582. +{
  4583. +   d_entry = create_proc_entry("msm_sdcc",
  4584. +                   0, NULL);
  4585. +        if (d_entry) {
  4586. +                d_entry->read_proc = msm_sdcc_read_proc;
  4587. +                d_entry->write_proc = msm_sdcc_write_proc;
  4588. +                d_entry->data = NULL;
  4589. +        }
  4590. +
  4591. +}
  4592. +
  4593. +void
  4594. +deinit_mmc_proc(void)
  4595. +{
  4596. +   if (NULL != d_entry) {
  4597. +       remove_proc_entry("msm_sdcc", NULL);
  4598. +       d_entry = NULL;
  4599. +   }
  4600. +}
  4601. +//end
  4602.  static int __init msmsdcc_init(void)
  4603.  {
  4604.  #if defined(CONFIG_DEBUG_FS)
  4605. @@ -1736,11 +2123,17 @@
  4606.         return ret;
  4607.     }
  4608.  #endif
  4609. +   //ruanmeisi_091224 proc interface
  4610. +   init_mmc_proc();
  4611. +   //end
  4612.     return platform_driver_register(&msmsdcc_driver);
  4613.  }
  4614.  
  4615.  static void __exit msmsdcc_exit(void)
  4616.  {
  4617. +   //ruanmeisi_091224 proc interface
  4618. +   deinit_mmc_proc();
  4619. +   //end
  4620.     platform_driver_unregister(&msmsdcc_driver);
  4621.  
  4622.  #if defined(CONFIG_DEBUG_FS)
  4623. diff -urB -x .git msm/drivers/mmc/host/msm_sdcc.h zte/drivers/mmc/host/msm_sdcc.h
  4624. --- msm/drivers/mmc/host/msm_sdcc.h Mon Nov  1 13:46:22 2010
  4625. +++ zte/drivers/mmc/host/msm_sdcc.h Thu Oct 28 11:55:28 2010
  4626. @@ -10,6 +10,7 @@
  4627.   *
  4628.   * - Based on mmci.h
  4629.   */
  4630. +/*ruanmeisi 20100510  ruanmeisi_20100510 timer for send command*/
  4631.  
  4632.  #ifndef _MSM_SDCC_H
  4633.  #define _MSM_SDCC_H
  4634. @@ -266,6 +267,11 @@
  4635.     unsigned int    mci_irqenable;
  4636.     unsigned int    dummy_52_needed;
  4637.     unsigned int    dummy_52_state;
  4638. +
  4639. +        //ruanmeisi_091224 redetect worker
  4640. +   struct work_struct  redetect;
  4641. +   //ruanmeisi_20100510
  4642. +   struct timer_list       command_timer;
  4643.  
  4644.  };
  4645.  
  4646. diff -urB -x .git msm/drivers/mtd/devices/msm_nand.c zte/drivers/mtd/devices/msm_nand.c
  4647. --- msm/drivers/mtd/devices/msm_nand.c  Mon Nov  1 14:21:30 2010
  4648. +++ zte/drivers/mtd/devices/msm_nand.c  Mon Oct 18 10:12:04 2010
  4649. @@ -382,6 +382,11 @@
  4650.     {0xd580b12c, 0xFFFFFFFF, (128<<20), 1, 2048, (2048<<6), 64, }, /*Micr*/
  4651.     {0x5580baad, 0xFFFFFFFF, (256<<20), 1, 2048, (2048<<6), 64, }, /*Hynx*/
  4652.     {0x5510baad, 0xFFFFFFFF, (256<<20), 1, 2048, (2048<<6), 64, }, /*Hynx*/
  4653. +
  4654. +#ifdef CONFIG_ZTE_PLATFORM
  4655. +   {0x5500bcec, 0xFFFFFFFF, (512<<20), 1, 2048, (2048<<6), 64,},                
  4656. +   {0x5510bcad, 0xFFFFFFFF, (512<<20), 1, 2048, (2048<<6), 64, },  
  4657. +#endif
  4658.     /* Note: Width flag is 0 for 8 bit Flash and 1 for 16 bit flash      */
  4659.     /* Note: The First row will be filled at runtime during ONFI probe   */
  4660.  };
  4661. diff -urB -x .git msm/drivers/serial/msm_serial_hs.c zte/drivers/serial/msm_serial_hs.c
  4662. --- msm/drivers/serial/msm_serial_hs.c  Mon Nov  1 13:46:22 2010
  4663. +++ zte/drivers/serial/msm_serial_hs.c  Mon Oct 18 10:16:50 2010
  4664. @@ -528,6 +529,42 @@
  4665.     return ret;
  4666.  }
  4667.  EXPORT_SYMBOL(msm_hs_tx_empty);
  4668. +
  4669. +#ifdef CONFIG_MODEMCTL
  4670. +
  4671. +
  4672. +unsigned int msm_hs_dm1_tx_empty(void)
  4673. +{
  4674. +   unsigned int data;
  4675. +   unsigned int ret = 0;
  4676. +
  4677. +
  4678. +   struct msm_hs_port *msm_uport = NULL;
  4679. +
  4680. +      printk(KERN_WARNING "@@@@ msm_hs_dm1_tx_empty++ \n");
  4681. +      
  4682. +   msm_uport = &q_uart_port[1];
  4683. +      if(!msm_uport)
  4684. +      {
  4685. +          printk(KERN_WARNING "@@ Error get the device /dev/ttyHS1--q_uart_port[1], maybe not init \n");
  4686. +       return MODEMCTL_UARTDM1_UNINIT;
  4687. +      }
  4688. +      
  4689. +   clk_enable(msm_uport->clk);
  4690. +    
  4691. +   data = msm_hs_read(&(msm_uport->uport), UARTDM_SR_ADDR);
  4692. +   if (data & UARTDM_SR_TXEMT_BMSK)
  4693. +       ret = TIOCSER_TEMT;
  4694. +
  4695. +   clk_disable(msm_uport->clk);
  4696. +    
  4697. +      printk(KERN_WARNING "@@@@ msm_hs_dm1_tx_empty-- the ret  = %d\n", ret);  
  4698. +
  4699. +   return ret;
  4700. +}
  4701. +EXPORT_SYMBOL(msm_hs_dm1_tx_empty);
  4702. +
  4703. +#endif
  4704.  
  4705.  /*
  4706.   *  Standard API, Stop transmitter.
  4707. diff -urB -x .git msm/drivers/usb/function/mass_storage.c zte/drivers/usb/function/mass_storage.c
  4708. --- msm/drivers/usb/function/mass_storage.c Mon Nov  1 13:46:22 2010
  4709. +++ zte/drivers/usb/function/mass_storage.c Thu Oct 28 11:49:56 2010
  4710. @@ -43,6 +43,12 @@
  4711.   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4712.   */
  4713.  
  4714. +/* ========================================================================================
  4715. +when         who        what, where, why                             comment tag
  4716. +--------     ----       -----------------------------                ----------------------
  4717. +2010-02-02   rms        fsg_main_thread exit fail                    ruanmeisi_100203
  4718. +
  4719. +==========================================================================================*/
  4720.  //#define DEBUG
  4721.  //#define VERBOSE_DEBUG
  4722.  //#define DUMP_MSGS
  4723. @@ -325,6 +331,8 @@
  4724.  
  4725.     int         thread_wakeup_needed;
  4726.     struct completion   thread_notifier;
  4727. +   //ruanmeisi_100203
  4728. +   struct completion   thread_notifier_exit;
  4729.     struct task_struct  *thread_task;
  4730.  
  4731.     int         cmnd_size;
  4732. @@ -2475,7 +2483,9 @@
  4733.         close_all_backing_files(fsg);
  4734.  
  4735.     /* Let the unbind and cleanup routines know the thread has exited */
  4736. -   complete_and_exit(&fsg->thread_notifier, 0);
  4737. +   //ruanmeisi_100203
  4738. +   complete(&fsg->thread_notifier);
  4739. +   complete_and_exit(&fsg->thread_notifier_exit, 0);
  4740.  }
  4741.  
  4742.  
  4743. @@ -2705,6 +2715,10 @@
  4744.         raise_exception(fsg, FSG_STATE_EXIT);
  4745.         wait_for_completion(&fsg->thread_notifier);
  4746.  
  4747. +       /* The cleanup routine waits for this completion also */
  4748. +       //ruanmeisi
  4749. +       //complete(&fsg->thread_notifier);
  4750. +      
  4751.     }
  4752.  
  4753.     /* Free the data buffers */
  4754. @@ -2814,6 +2828,8 @@
  4755.     fsg->buffhds[NUM_BUFFERS - 1].next = &fsg->buffhds[0];
  4756.  
  4757.     fsg->state = FSG_STATE_IDLE;
  4758. +   //ruanmeisi_100203
  4759. +   init_completion(&fsg->thread_notifier_exit);
  4760.     fsg->thread_task = kthread_create(fsg_main_thread, fsg,
  4761.             "USB mass_storage");
  4762.     if (IS_ERR(fsg->thread_task)) {
  4763. @@ -2915,6 +2931,8 @@
  4764.     init_rwsem(&fsg->filesem);
  4765.     kref_init(&fsg->ref);
  4766.     init_completion(&fsg->thread_notifier);
  4767. +   //ruanmeisi_100203
  4768. +   init_completion(&fsg->thread_notifier_exit);
  4769.  
  4770.     the_fsg = fsg;
  4771.     return 0;
  4772. @@ -2938,6 +2956,8 @@
  4773.     wake_lock_destroy(&fsg->wake_lock_idle);
  4774.     switch_dev_unregister(&fsg->sdev);
  4775.     test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags);
  4776. +   //ruanmeisi_100203
  4777. +   wait_for_completion(&fsg->thread_notifier_exit);
  4778.     close_all_backing_files(fsg);
  4779.     kref_put(&fsg->ref, fsg_release);
  4780.  
  4781. diff -urB -x .git msm/drivers/usb/function/msm_hsusb.c zte/drivers/usb/function/msm_hsusb.c
  4782. --- msm/drivers/usb/function/msm_hsusb.c    Mon Nov  1 13:46:22 2010
  4783. +++ zte/drivers/usb/function/msm_hsusb.c    Thu Oct 28 11:49:56 2010
  4784. @@ -16,6 +16,20 @@
  4785.   * GNU General Public License for more details.
  4786.   *
  4787.   */
  4788. + /*
  4789. + ========================================================================================
  4790. +when        who           what, where, why                                comment tag
  4791. +----------  ----------  ----------------------------------------------  -----------------
  4792. +2010-0528   rms       ruanmeisi_20100528 if serial_number is not default,bind in kernel
  4793. +2010-04-20  HML       config default pid & serialnumber in early-init            HML_USB_20100513
  4794. +2010-05-06  wzy       add pid 1354 1355                                    ZTE_USB_006
  4795. +2010-04-20  HML       add bind select                                               HML_USB_005
  4796. +2010-03-31  HML      delay enum,restore usb mode as composition      HML_USB_004
  4797. +                               switch  and modify some hsusb functions attr
  4798. +2010-01-21  HML      Extend rpc for read/write,and store                    HML_USB_003
  4799. +                               config info in nv.  
  4800. +2010-02-11  HML      eclair 5210 usb function modify                         USB-HML-001
  4801. +*/
  4802.  #include <linux/init.h>
  4803.  #include <linux/module.h>
  4804.  #include <linux/kernel.h>
  4805. @@ -73,8 +87,34 @@
  4806.  #define is_phy_45nm()     (PHY_MODEL(ui->phy_info) == USB_PHY_MODEL_45NM)
  4807.  #define is_phy_external() (PHY_TYPE(ui->phy_info) == USB_PHY_EXTERNAL)
  4808.  
  4809. -static int pid = 0x9018;
  4810. +static int pid = 0x01351;
  4811. +//HML_USB_005 add usb bind mode
  4812. +enum usb_bind_mode {  
  4813. +       BIND_IN_KERNEL=0,
  4814. +   BIND_IN_USER,
  4815. +} ;
  4816. +static enum usb_bind_mode g_bind_mode=BIND_IN_KERNEL; //hml
  4817. +int g_debug_enabled=0; //hml
  4818. +static int use_default_pid=0;
  4819. +static enum usb_bind_mode get_bind_mode(void)
  4820. +{
  4821. +   return g_bind_mode;
  4822. +}
  4823.  
  4824. +static void set_bind_mode(enum usb_bind_mode mode)
  4825. +{
  4826. +   g_bind_mode = mode;
  4827. +}
  4828. +// HML_USB_20100513- debug interface
  4829. +int get_debug_enabled(void)
  4830. +{
  4831. +   return g_debug_enabled;
  4832. +}
  4833. +EXPORT_SYMBOL(get_debug_enabled);
  4834. +void set_debug_enabled(int enabled)
  4835. +{
  4836. +   g_debug_enabled = enabled;
  4837. +}
  4838.  struct usb_fi_ept {
  4839.     struct usb_endpoint *ept;
  4840.     struct usb_endpoint_descriptor desc;
  4841. @@ -122,8 +162,9 @@
  4842.  static void usb_disable_pullup(struct usb_info *ui);
  4843.  
  4844.  static struct workqueue_struct *usb_work;
  4845. +#ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  4846.  static void usb_chg_stop(struct work_struct *w);
  4847. -
  4848. +#endif
  4849.  #define USB_STATE_IDLE    0
  4850.  #define USB_STATE_ONLINE  1
  4851.  #define USB_STATE_OFFLINE 2
  4852. @@ -151,6 +192,32 @@
  4853.     USB_CHG_TYPE__INVALID
  4854.  };
  4855.  
  4856. +//USB-HML-003 start,  add enum type for nv read/write
  4857. +enum usb_opt_nv_item  
  4858. +{
  4859. +    NV_BACK_LIGHT_I=77,//nv77 used for config/store usb mode
  4860. +    NV_FTM_MODE_I = 453// FTM mode  
  4861. +};
  4862. +enum usb_opt_nv_type
  4863. +{
  4864. +    NV_READ=0,
  4865. +    NV_WRITE
  4866. +};
  4867. +/*  usb mode enum
  4868. +*/
  4869. +enum usb_conf_mode
  4870. +{
  4871. +    HSU_CFG_ALL_INTERFACE=0,
  4872. +    HSU_CFG_ADB_MS,
  4873. +    HSU_CFG_ADB,
  4874. +    HSU_CFG_MS,
  4875. +    HSU_CFG_DIAG,
  4876. +    HSU_CFG_DIAG_NMEA_MODEM       
  4877. +};
  4878. +#define NV_WRITE_SUCCESS 10  //used for rpc call write nv function
  4879. +// HML_USB_20100513:take care of the order,the 4th must to be 0x0112 used for test software.
  4880. +static int zte_usb_pid[]={0x1350,0x1351,0x1352,0x1353,0x0112,0x0111,0x1354,0x1355};//usb zte pid list
  4881. +//USB-HML-003 end
  4882.  struct usb_info {
  4883.     /* lock for register/queue/device state changes */
  4884.     spinlock_t lock;
  4885. @@ -285,6 +352,7 @@
  4886.     return sprintf(buf, "%s\n", (ui->online ? "online" : "offline"));
  4887.  }
  4888.  
  4889. +#ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  4890.  #define USB_WALLCHARGER_CHG_CURRENT 1800
  4891.  static int usb_get_max_power(struct usb_info *ui)
  4892.  {
  4893. @@ -368,6 +436,7 @@
  4894.     } else
  4895.         pr_info("\n%s: Standard Downstream Port\n", __func__);
  4896.  }
  4897. +#endif
  4898.  
  4899.  int usb_msm_get_next_strdesc_id(char *str)
  4900.  {
  4901. @@ -1589,8 +1658,9 @@
  4902.         pr_info("hsusb reset interrupt\n");
  4903.         ui->usb_state = USB_STATE_DEFAULT;
  4904.         ui->configured = 0;
  4905. +       #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  4906.         schedule_work(&ui->chg_stop);
  4907. -
  4908. +#endif
  4909.         writel(readl(USB_ENDPTSETUPSTAT), USB_ENDPTSETUPSTAT);
  4910.         writel(readl(USB_ENDPTCOMPLETE), USB_ENDPTCOMPLETE);
  4911.         writel(0xffffffff, USB_ENDPTFLUSH);
  4912. @@ -1612,9 +1682,10 @@
  4913.     if (n & STS_SLI) {
  4914.         pr_info("hsusb suspend interrupt\n");
  4915.         ui->usb_state = USB_STATE_SUSPENDED;
  4916. -
  4917. +#ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  4918.         /* stop usb charging */
  4919.         schedule_work(&ui->chg_stop);
  4920. +#endif
  4921.     }
  4922.  
  4923.     if (n & STS_UI) {
  4924. @@ -1691,10 +1762,13 @@
  4925.     ui->setup_req = usb_ept_alloc_req(&ui->ep0in, SETUP_BUF_SIZE);
  4926.     ui->ep0out_req = usb_ept_alloc_req(&ui->ep0out, ui->ep0out.max_pkt);
  4927.  
  4928. +#ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  4929.     INIT_WORK(&ui->chg_stop, usb_chg_stop);
  4930. +       INIT_DELAYED_WORK(&ui->chg_legacy_det, usb_chg_legacy_detect);
  4931. +#endif
  4932.     INIT_WORK(&ui->li.wakeup_phy, usb_lpm_wakeup_phy);
  4933.     INIT_DELAYED_WORK(&ui->work, usb_do_work);
  4934. -   INIT_DELAYED_WORK(&ui->chg_legacy_det, usb_chg_legacy_detect);
  4935. +  
  4936.  }
  4937.  
  4938.  static int usb_is_online(struct usb_info *ui)
  4939. @@ -1969,7 +2043,7 @@
  4940.  
  4941.  void usb_start(struct usb_info *ui)
  4942.  {
  4943. -   int i, ret;
  4944. +   int i;
  4945.  
  4946.     for (i = 0; i < ui->num_funcs; i++) {
  4947.         struct usb_function_info *fi = ui->func[i];
  4948. @@ -1990,6 +2064,7 @@
  4949.         queue_delayed_work(usb_work, &ui->work, 0);
  4950.     } else {
  4951.         /*Initialize pm app RPC */
  4952. +       #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11
  4953.         ret = msm_pm_app_rpc_init();
  4954.         if (ret) {
  4955.             pr_err("%s: pm_app_rpc connect failed\n", __func__);
  4956. @@ -2021,6 +2096,12 @@
  4957.         ui->active = 1;
  4958.         ui->flags |= (USB_FLAG_START | USB_FLAG_RESET);
  4959.         queue_delayed_work(usb_work, &ui->work, 0);
  4960. +       #else
  4961. +       printk("hml usb start !\n");
  4962. +       ui->active = 1;
  4963. +       ui->flags |= (USB_FLAG_START | USB_FLAG_RESET);
  4964. +       queue_delayed_work(usb_work, &ui->work, 0);
  4965. +       #endif
  4966.     }
  4967.  
  4968.  }
  4969. @@ -2049,7 +2130,9 @@
  4970.     struct usb_info *ui = the_usb_info;
  4971.     unsigned long enabled_functions = 0;
  4972.     int i;
  4973. -
  4974. +   //ruanmeisi_20100513
  4975. +   use_default_pid = 0;
  4976. +   //end
  4977.     if (!ui || ui->bound || !ui->pdev || !ui->composition)
  4978.         return;
  4979.  
  4980. @@ -2113,8 +2196,9 @@
  4981.     fi->func->ep0_out = &ui->ep0out;
  4982.     fi->func->ep0_in = &ui->ep0in;
  4983.     pr_info("%s: name = '%s',  map = %d\n", __func__, driver->name, index);
  4984. -
  4985. -   usb_try_to_bind();
  4986. +    
  4987. +       if(BIND_IN_KERNEL == get_bind_mode())//HML_USB_005
  4988. +        usb_try_to_bind();
  4989.  fail:
  4990.     mutex_unlock(&usb_function_list_lock);
  4991.     return ret;
  4992. @@ -2212,7 +2296,7 @@
  4993.     int i;
  4994.     unsigned long flags;
  4995.  
  4996. -
  4997. +       pr_info("%s: usb_switch_composition start pid =%d \n", __func__,pid);
  4998.     if (!ui->active)
  4999.         return;
  5000.     if (!usb_validate_product_id(pid))
  5001. @@ -2233,11 +2317,11 @@
  5002.                 disable_irq(ui->gpio_irq[0]);
  5003.                 disable_irq(ui->gpio_irq[1]);
  5004.             }
  5005. -
  5006. +#ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11
  5007.             if (ui->usb_state == USB_STATE_NOTATTACHED
  5008.                         && ui->vbus_sn_notif)
  5009.                 msm_pm_app_enable_usb_ldo(1);
  5010. -
  5011. +#endif
  5012.             usb_lpm_exit(ui);
  5013.             if (cancel_work_sync(&ui->li.wakeup_phy))
  5014.                 usb_lpm_wakeup_phy(NULL);
  5015. @@ -2405,8 +2489,10 @@
  5016.             if ((flags & USB_FLAG_START) ||
  5017.                     (flags & USB_FLAG_RESET)) {
  5018.                 disable_irq(ui->irq);
  5019. +               #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-01
  5020.                 if (ui->vbus_sn_notif)
  5021.                     msm_pm_app_enable_usb_ldo(1);
  5022. +               #endif
  5023.                 usb_clk_enable(ui);
  5024.                 usb_vreg_enable(ui);
  5025.                 usb_vbus_online(ui);
  5026. @@ -2419,9 +2505,11 @@
  5027.                     msm_hsusb_suspend_locks_acquire(ui, 1);
  5028.                     ui->state = USB_STATE_ONLINE;
  5029.                     usb_enable_pullup(ui);
  5030. +                   #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  5031.                     schedule_delayed_work(
  5032.                             &ui->chg_legacy_det,
  5033.                             USB_CHG_DET_DELAY);
  5034. +                   #endif
  5035.                     pr_info("hsusb: IDLE -> ONLINE\n");
  5036.                 } else {
  5037.                     ui->usb_state = USB_STATE_NOTATTACHED;
  5038. @@ -2430,8 +2518,10 @@
  5039.                     msleep(500);
  5040.                     usb_lpm_enter(ui);
  5041.                     pr_info("hsusb: IDLE -> OFFLINE\n");
  5042. +                   #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-01
  5043.                     if (ui->vbus_sn_notif)
  5044.                         msm_pm_app_enable_usb_ldo(0);
  5045. +                   #endif
  5046.                 }
  5047.                 enable_irq(ui->irq);
  5048.                 break;
  5049. @@ -2443,6 +2533,7 @@
  5050.              * the signal to go offline, we must honor it
  5051.              */
  5052.             if (flags & USB_FLAG_VBUS_OFFLINE) {
  5053. +#ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  5054.                 enum charger_type temp;
  5055.                 unsigned long f;
  5056.  
  5057. @@ -2463,16 +2554,18 @@
  5058.                     msm_chg_usb_i_is_not_available();
  5059.                     msm_chg_usb_charger_disconnected();
  5060.                 }
  5061. -
  5062. +   #endif 
  5063.                 /* reset usb core and usb phy */
  5064.                 disable_irq(ui->irq);
  5065.                 if (ui->in_lpm)
  5066.                     usb_lpm_exit(ui);
  5067.                 usb_vbus_offline(ui);
  5068.                 usb_lpm_enter(ui);
  5069. +               #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-01
  5070.                 if ((ui->vbus_sn_notif) &&
  5071.                 (ui->usb_state == USB_STATE_NOTATTACHED))
  5072.                     msm_pm_app_enable_usb_ldo(0);
  5073. +               #endif
  5074.                 ui->state = USB_STATE_OFFLINE;
  5075.                 enable_irq(ui->irq);
  5076.                 switch_set_state(&ui->sdev, 0);
  5077. @@ -2487,10 +2580,12 @@
  5078.             }
  5079.             if ((flags & USB_FLAG_RESUME) ||
  5080.                     (flags & USB_FLAG_CONFIGURE)) {
  5081. +               #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  5082.                 int maxpower = usb_get_max_power(ui);
  5083.  
  5084.                 if (maxpower > 0)
  5085.                     msm_chg_usb_i_is_available(maxpower);
  5086. +               #endif
  5087.  
  5088.                 if (flags & USB_FLAG_CONFIGURE)
  5089.                     switch_set_state(&ui->sdev, 1);
  5090. @@ -2518,9 +2613,11 @@
  5091.                     goto reset;
  5092.                 }
  5093.                 usb_enable_pullup(ui);
  5094. +               #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  5095.                 schedule_delayed_work(
  5096.                         &ui->chg_legacy_det,
  5097.                         USB_CHG_DET_DELAY);
  5098. +               #endif
  5099.                 pr_info("hsusb: OFFLINE -> ONLINE\n");
  5100.                 enable_irq(ui->irq);
  5101.                 break;
  5102. @@ -2546,7 +2643,9 @@
  5103.     struct usb_info *ui = the_usb_info;
  5104.  
  5105.     if (ui && online) {
  5106. +       #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-01
  5107.         msm_pm_app_enable_usb_ldo(1);
  5108. +       #endif
  5109.         usb_lpm_exit(ui);
  5110.         /* Turn on PHY comparators */
  5111.         if (!(ulpi_read(ui, 0x30) & 0x01))
  5112. @@ -2685,6 +2784,7 @@
  5113.     enable_irq(ui->irq);
  5114.  }
  5115.  
  5116. +#ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  5117.  static void usb_chg_stop(struct work_struct *w)
  5118.  {
  5119.     struct usb_info *ui = the_usb_info;
  5120. @@ -2698,7 +2798,7 @@
  5121.     if (temp == USB_CHG_TYPE__SDP)
  5122.         msm_chg_usb_i_is_not_available();
  5123.  }
  5124. -
  5125. +#endif
  5126.  static void usb_vbus_online(struct usb_info *ui)
  5127.  {
  5128.     if (ui->in_lpm) {
  5129. @@ -2797,12 +2897,12 @@
  5130.     struct usb_info *ui = the_usb_info;
  5131.  
  5132.     /* disable and re-enable the D+ pullup */
  5133. -   pr_info("hsusb: disable pullup\n");
  5134. +   printk("hml: hsusb disable pullup\n");
  5135.     usb_disable_pullup(ui);
  5136.  
  5137.     msleep(10);
  5138.  
  5139. -   pr_info("hsusb: enable pullup\n");
  5140. +   printk("hml:hsusb enable pullup\n");
  5141.     usb_enable_pullup(ui);
  5142.  }
  5143.  
  5144. @@ -2871,7 +2971,7 @@
  5145.  {
  5146.     struct usb_info *ui = file->private_data;
  5147.     unsigned long flags;
  5148. -
  5149. +       printk("hml: debug_write_reset start  \n");
  5150.     spin_lock_irqsave(&ui->lock, flags);
  5151.     ui->flags |= USB_FLAG_RESET;
  5152.     queue_delayed_work(usb_work, &ui->work, 0);
  5153. @@ -2992,6 +3092,160 @@
  5154.     usb_function_enable(name, enable);
  5155.     return size;
  5156.  }
  5157. +/*
  5158. +**HML_USB_004  add sysfs interface
  5159. +*/
  5160. +static ssize_t msm_hsusb_show_serialnumber(struct device *dev,
  5161. +                    struct device_attribute *attr,
  5162. +                    char *buf)
  5163. +{
  5164. +   struct usb_info *ui = the_usb_info;
  5165. +   int i = 0;
  5166. +   if (ui->pdata->serial_number) {
  5167. +       i = scnprintf(buf, PAGE_SIZE,
  5168. +               "%s\n",
  5169. +                   ui->pdata->serial_number);
  5170. +   }
  5171. +   return i;
  5172. +}
  5173. +
  5174. +char g_serial_number[256] = {0};
  5175. +
  5176. +static ssize_t msm_hsusb_store_serialnumber(struct device *dev,
  5177. +                     struct device_attribute *attr,
  5178. +                     const char *buf, size_t size)
  5179. +{
  5180. +       struct usb_info *ui = the_usb_info;
  5181. +       // reset iSerialNumber field for device descriptor
  5182. +       if (BIND_IN_USER == get_bind_mode()) {          
  5183. +          strncpy(g_serial_number, buf, sizeof(g_serial_number));
  5184. +       g_serial_number[sizeof(g_serial_number) - 1] = 0;
  5185. +       ui->pdata->serial_number = g_serial_number;
  5186. +       if (ui->bound
  5187. +           && (desc_device.iSerialNumber >= 0)
  5188. +           && (desc_device.iSerialNumber < MAX_STRDESC_NUM)
  5189. +           && (ui->strdesc[desc_device.iSerialNumber])) {
  5190. +           char *tmp = kzalloc(strlen(g_serial_number) + 1, GFP_ATOMIC);
  5191. +           if(tmp) {
  5192. +               kfree(ui->strdesc[desc_device.iSerialNumber]);
  5193. +               ui->strdesc[desc_device.iSerialNumber] = tmp;
  5194. +               strcpy(ui->strdesc[desc_device.iSerialNumber], g_serial_number);
  5195. +           }      
  5196. +       }          
  5197. +       usb_try_to_bind();
  5198. +       }
  5199. +  
  5200. +   return size;
  5201. +}
  5202. +//HML_USB_004 end
  5203. +/*
  5204. +** HML_USB_20100513 debug enable sysfs interface
  5205. +*/
  5206. +static ssize_t msm_hsusb_show_debug_enable(struct device *dev,
  5207. +                    struct device_attribute *attr,
  5208. +                    char *buf)
  5209. +{
  5210. +   int i = 0
  5211. +   i = scnprintf(buf, PAGE_SIZE,
  5212. +               "%d\n",
  5213. +                   get_debug_enabled());
  5214. +  
  5215. +   return i;
  5216. +}
  5217. +
  5218. +static ssize_t msm_hsusb_store_debug_enable(struct device *dev,
  5219. +                     struct device_attribute *attr,
  5220. +                     const char *buf, size_t size)
  5221. +{
  5222. +       unsigned long debug_enable;
  5223. +       if (!strict_strtoul(buf, 16, &debug_enable)) {
  5224. +       set_debug_enabled((int)debug_enable);
  5225. +       pr_info("%s: Requested g_debug_enabled = %d\n", __func__,g_debug_enabled);     
  5226. +   }
  5227. +   else
  5228. +       pr_info("%s: strict_strtoul conversion failed\n", __func__);
  5229. +    
  5230. +   return size;
  5231. +}
  5232. +/*
  5233. +** HML_USB_20100513 debug enable sysfs interface
  5234. +*/
  5235. +static ssize_t msm_hsusb_show_pidnv(struct device *dev,
  5236. +                    struct device_attribute *attr,
  5237. +                    char *buf)
  5238. +{
  5239. +   int i = 0;
  5240. +   i = scnprintf(buf, PAGE_SIZE,
  5241. +             "nv %d\n",
  5242. +             msm_hsusb_get_set_usb_conf_nv_value(NV_BACK_LIGHT_I,0,NV_READ));
  5243. +   return i;
  5244. +}
  5245. +
  5246. +static ssize_t msm_hsusb_set_pidnv(struct device *dev,
  5247. +                  struct device_attribute *attr,
  5248. +                  const char *buf, size_t size)
  5249. +{
  5250. +   /* int i = 0; */
  5251. +   /* i = scnprintf(buf, PAGE_SIZE, */
  5252. +   /*          "%s\n", */
  5253. +   /*        use_default_pid?"use default pid":""); */
  5254. +  
  5255. +   /* return i; */
  5256. +   int value;
  5257. +   sscanf(buf, "%d", &value);
  5258. +   msm_hsusb_get_set_usb_conf_nv_value(NV_BACK_LIGHT_I,value,NV_WRITE);
  5259. +   return size;
  5260. +}
  5261. +
  5262. +
  5263. +
  5264. +static ssize_t msm_hsusb_show_default_pid(struct device *dev,
  5265. +                    struct device_attribute *attr,
  5266. +                    char *buf)
  5267. +{
  5268. +   /* int i = 0; */
  5269. +   /* i = scnprintf(buf, PAGE_SIZE, */
  5270. +   /*          "%s\n", */
  5271. +   /*        use_default_pid?"use default pid":""); */
  5272. +  
  5273. +   /* return i; */
  5274. +   return 0;
  5275. +}
  5276. +
  5277. +
  5278. +
  5279. +static ssize_t msm_hsusb_store_default_pid(struct device *dev,
  5280. +                      struct device_attribute *attr,
  5281. +                      const char *buf, size_t size)
  5282. +{
  5283. +   struct usb_info *ui = the_usb_info;
  5284. +   unsigned long default_pid;
  5285. +   int i;
  5286. +   if (1 != use_default_pid || BIND_IN_KERNEL == get_bind_mode() || ui->bound){
  5287. +       pr_info("usb:%s: use_default_pid %d bound %d\n", __func__,
  5288. +           use_default_pid,
  5289. +           ui->bound);
  5290. +       return  size;
  5291. +   }
  5292. +   use_default_pid = 0;
  5293. +       if (!strict_strtoul(buf, 16, &default_pid)) {
  5294. +       //set_default_pid((int)default_pid);
  5295. +       pr_info("usb:%s: default_pid 0x%x\n", __func__,
  5296. +           (unsigned int)default_pid);
  5297. +       for (i = 0; i < ui->pdata->num_compositions; i++) {
  5298. +           if (ui->pdata->compositions[i].product_id
  5299. +               == default_pid) {
  5300. +               ui->composition = &ui->pdata->compositions[i];
  5301. +               break;
  5302. +           }
  5303. +       }
  5304. +   } else
  5305. +       pr_info("%s: strict_strtoul conversion failed\n", __func__);
  5306. +    
  5307. +   return size;
  5308. +}
  5309. +
  5310. +// HML_USB_20100513 end
  5311.  static ssize_t msm_hsusb_show_compswitch(struct device *dev,
  5312.                      struct device_attribute *attr,
  5313.                      char *buf)
  5314. @@ -3014,11 +3268,22 @@
  5315.                       const char *buf, size_t size)
  5316.  {
  5317.     unsigned long pid;
  5318. +   int i,temp_pid;
  5319.  
  5320.     if (!strict_strtoul(buf, 16, &pid)) {
  5321.         pr_info("%s: Requested New Product id = %lx\n", __func__, pid);
  5322.         usb_switch_composition((unsigned short)pid);
  5323. -   } else
  5324. +          //HML_USB_004  restore pid in nv77
  5325. +       temp_pid = (int)pid;
  5326. +       printk("HML: restore pid =0x%x %d\n",temp_pid, ARRAY_SIZE(zte_usb_pid));
  5327. +       for(i = 0; i < ARRAY_SIZE(zte_usb_pid); i++){
  5328. +           if(temp_pid == zte_usb_pid[i])
  5329. +                   break;
  5330. +       }
  5331. +       if(NV_WRITE_SUCCESS == msm_hsusb_get_set_usb_conf_nv_value(NV_BACK_LIGHT_I,i,NV_WRITE))
  5332. +           printk("HML: usb config restore successful\n");
  5333. +   }
  5334. +   else
  5335.         pr_info("%s: strict_strtoul conversion failed\n", __func__);
  5336.  
  5337.     return size;
  5338. @@ -3082,6 +3347,16 @@
  5339.  static DEVICE_ATTR(state, 0664, msm_hsusb_show_state, NULL);
  5340.  static DEVICE_ATTR(lpm, 0664, msm_hsusb_show_lpm, NULL);
  5341.  static DEVICE_ATTR(speed, 0664, msm_hsusb_show_speed, NULL);
  5342. +//HML_USB_004 add sysfs interface
  5343. +static DEVICE_ATTR(serialnumber, 0664,
  5344. +       msm_hsusb_show_serialnumber, msm_hsusb_store_serialnumber);
  5345. +//add debug and default pid interface
  5346. +static DEVICE_ATTR(debug_enable, 0664,
  5347. +       msm_hsusb_show_debug_enable, msm_hsusb_store_debug_enable);
  5348. +static DEVICE_ATTR(default_pid, 0664,
  5349. +       msm_hsusb_show_default_pid, msm_hsusb_store_default_pid);
  5350. +static DEVICE_ATTR(pidnv, 0664,
  5351. +          msm_hsusb_show_pidnv, msm_hsusb_set_pidnv);
  5352.  
  5353.  static struct attribute *msm_hsusb_attrs[] = {
  5354.     &dev_attr_composition.attr,
  5355. @@ -3090,6 +3365,10 @@
  5356.     &dev_attr_state.attr,
  5357.     &dev_attr_lpm.attr,
  5358.     &dev_attr_speed.attr,
  5359. +   &dev_attr_serialnumber.attr,//HML_USB_004 add sysfs interface
  5360. +   &dev_attr_debug_enable.attr,//HML_USB_004 add sysfs interface
  5361. +   &dev_attr_default_pid.attr,//HML_USB_004 add sysfs interface
  5362. +   &dev_attr_pidnv.attr,//HML_USB_004 add sysfs interface
  5363.     NULL,
  5364.  };
  5365.  static struct attribute_group msm_hsusb_attr_grp = {
  5366. @@ -3109,13 +3388,14 @@
  5367.                                     \
  5368.  static DEVICE_ATTR(function, S_IRUGO, show_##function, NULL);
  5369.  
  5370. +// HML_USB_004: change order of functions, and delete ethernet/rmnet, we don't support now!
  5371.  msm_hsusb_func_attr(diag, 0);
  5372. -msm_hsusb_func_attr(adb, 1);
  5373. -msm_hsusb_func_attr(modem, 2);
  5374. -msm_hsusb_func_attr(nmea, 3);
  5375. -msm_hsusb_func_attr(mass_storage, 4);
  5376. -msm_hsusb_func_attr(ethernet, 5);
  5377. -msm_hsusb_func_attr(rmnet, 6);
  5378. +msm_hsusb_func_attr(modem, 1);
  5379. +msm_hsusb_func_attr(nmea, 2);
  5380. +msm_hsusb_func_attr(mass_storage, 3);
  5381. +msm_hsusb_func_attr(adb, 4);
  5382. +//msm_hsusb_func_attr(ethernet, 5);
  5383. +//msm_hsusb_func_attr(rmnet, 6);
  5384.  
  5385.  static struct attribute *msm_hsusb_func_attrs[] = {
  5386.     &dev_attr_diag.attr,
  5387. @@ -3123,8 +3403,8 @@
  5388.     &dev_attr_modem.attr,
  5389.     &dev_attr_nmea.attr,
  5390.     &dev_attr_mass_storage.attr,
  5391. -   &dev_attr_ethernet.attr,
  5392. -   &dev_attr_rmnet.attr,
  5393. +   //&dev_attr_ethernet.attr,
  5394. +   //&dev_attr_rmnet.attr,
  5395.     NULL,
  5396.  };
  5397.  
  5398. @@ -3132,6 +3412,30 @@
  5399.     .name  = "functions",
  5400.     .attrs = msm_hsusb_func_attrs,
  5401.  };
  5402. +/*USB-HML-003:  function used in usb_probe to indentity usb mode
  5403. + * param:
  5404. + * use_zte_config: if it's using zte signed pid list.
  5405. +*/
  5406. +static int  usb_config_mode_by_nv(int use_zte_config)
  5407. +{
  5408. +     int usb_conf_nv=0;
  5409. +     int rc=0;
  5410. +     int *usb_pid;
  5411. +       usb_pid = zte_usb_pid;
  5412. +    
  5413. +     usb_conf_nv = msm_hsusb_get_set_usb_conf_nv_value(NV_BACK_LIGHT_I,0,NV_READ);
  5414. +   printk("HML usb_probe: usb_conf_nv=%d, %d\n",
  5415. +          usb_conf_nv, ARRAY_SIZE(zte_usb_pid));
  5416. +   if (0 <= usb_conf_nv && usb_conf_nv < ARRAY_SIZE(zte_usb_pid)){
  5417. +          use_default_pid=0;
  5418. +      rc = usb_pid[usb_conf_nv];
  5419. +   } else {
  5420. +          rc = usb_pid[1]; //default adb +u port
  5421. +          use_default_pid=1;
  5422. +       }
  5423. +            
  5424. +      return rc;
  5425. +}
  5426.  
  5427.  static int __init usb_probe(struct platform_device *pdev)
  5428.  {
  5429. @@ -3184,7 +3488,29 @@
  5430.  
  5431.     ui->pdev = pdev;
  5432.     ui->pdata = pdev->dev.platform_data;
  5433. -
  5434. +  
  5435. +   //HML_USB_004 add
  5436. +   set_bind_mode((0x0112==ui->pdata->zte_pid)? BIND_IN_KERNEL:BIND_IN_USER);
  5437. +    //hemulu add to switch usbmode
  5438. +       pid = ui->pdata->zte_pid;
  5439. +       if(0x112!=pid)//ZTE-USB-HML-02 start: if it is FTM mode do not read usb conf nv
  5440. +       {
  5441. +           //USB-HML-003  rpc read nv77 value to config usb mode.
  5442. +           pid = usb_config_mode_by_nv(1);
  5443. +           printk("HML usb_probe: pid=0x%x\n",pid);
  5444. +          if(0x0112==pid)//to unify comport number with ftm and download mode
  5445. +          {
  5446. +               ui->pdata->serial_number = 0;            
  5447. +          }
  5448. +       }
  5449. +
  5450. +       //ruanmeisi_20100528 if serial_number is not default,bind in kernel
  5451. +       if (NULL != ui->pdata->serial_number &&
  5452. +       0 != strcmp(ui->pdata->serial_number, "ZTE-HSUSB")) {
  5453. +           set_bind_mode(BIND_IN_KERNEL);         
  5454. +       }
  5455. +       //end
  5456. +      
  5457.     for (i = 0; i < ui->pdata->num_compositions; i++)
  5458.         if (ui->pdata->compositions[i].product_id == pid) {
  5459.             ui->composition = &ui->pdata->compositions[i];
  5460. @@ -3457,7 +3783,9 @@
  5461.     /* rpc connect for phy_reset */
  5462.     msm_hsusb_rpc_connect();
  5463.     /* rpc connect for charging */
  5464. +   #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-001
  5465.     msm_chg_rpc_connect();
  5466. +   #endif
  5467.  
  5468.     return platform_driver_register(&usb_driver);
  5469.  }
  5470. @@ -3509,9 +3837,11 @@
  5471.     usb_debugfs_uninit();
  5472.     platform_driver_unregister(&usb_driver);
  5473.     msm_hsusb_rpc_close();
  5474. +   #ifdef CONFIG_HSU_CHARGER_TYPE_DETECT_ON_ARM11 //USB-HML-01
  5475.     msm_chg_rpc_close();
  5476.     msm_pm_app_unregister_vbus_sn(&msm_hsusb_set_vbus_state);
  5477.     msm_pm_app_rpc_deinit();
  5478. +   #endif
  5479.  }
  5480.  
  5481.  static void __exit usb_module_exit(void)
  5482. diff -urB -x .git msm/drivers/video/Kconfig zte/drivers/video/Kconfig
  5483. --- msm/drivers/video/Kconfig   Mon Nov  1 13:46:22 2010
  5484. +++ zte/drivers/video/Kconfig   Wed Oct 13 18:13:24 2010
  5485. @@ -2254,6 +2254,33 @@
  5486.     bool
  5487.     select FB_MSM_LCDC_PANEL
  5488.     default n
  5489. +config  FB_MSM_LCDC_HIMAX_WQVGA727
  5490. +   bool
  5491. +   select FB_MSM_LCDC_PANEL
  5492. +config  FB_MSM_LCDC_HIMAX_WQVGA722
  5493. +   bool
  5494. +   select FB_MSM_LCDC_PANEL
  5495. +config  FB_MSM_LCDC_LEAD_QVGA
  5496. +   bool
  5497. +   select FB_MSM_LCDC_PANEL
  5498. +   default n
  5499. +config  FB_MSM_LCDC_HIMAX_QVGA
  5500. +   bool
  5501. +   select FB_MSM_LCDC_PANEL
  5502. +   default n
  5503. +config  FB_MSM_LCDC_SAMSUNG_QVGA
  5504. +   bool
  5505. +   select FB_MSM_LCDC_PANEL
  5506. +   default n
  5507. +config  FB_MSM_LCDC_OLED_WVGA
  5508. +   bool
  5509. +   select FB_MSM_LCDC_PANEL
  5510. +   default n
  5511. +  
  5512. +config FB_MSM_LCDC_LEAD_HVGA
  5513. +   bool
  5514. +   select FB_MSM_LCDC_PANEL
  5515. +   default n
  5516.  
  5517.  config FB_MSM_LCDC_SHARP_WVGA_PT
  5518.     bool
  5519. @@ -2265,9 +2292,9 @@
  5520.     select FB_MSM_LCDC_PANEL
  5521.     default n
  5522.  
  5523. -choice
  5524. -   prompt "LCD Panel"
  5525. -   default FB_MSM_MDDI_AUTO_DETECT
  5526. +
  5527. +menu "LCD Panel"
  5528. +#  default FB_MSM_MDDI_AUTO_DETECT
  5529.  
  5530.  config FB_MSM_LCDC_PRISM_WVGA_PANEL
  5531.     depends on FB_MSM_LCDC_HW
  5532. @@ -2282,7 +2309,53 @@
  5533.     select FB_MSM_LCDC_GORDON_VGA
  5534.     ---help---
  5535.       Support for LCDC Gordon VGA (480x640) panel
  5536. +config FB_MSM_LCDC_HIMAX_WQVGA_PANEL727
  5537. +   depends on FB_MSM_LCDC_HW
  5538. +   bool "LCDC HiMax WQVGA Panel Joe"
  5539. +   select FB_MSM_LCDC_HIMAX_WQVGA727
  5540. +   ---help---
  5541. +     Support for LCDC HiMax WQVGA (400x240) panel
  5542. +config FB_MSM_LCDC_HIMAX_WQVGA_PANEL722
  5543. +   depends on FB_MSM_LCDC_HW
  5544. +   bool "LCDC HiMax WQVGA Panel Raise"
  5545. +   select FB_MSM_LCDC_HIMAX_WQVGA722
  5546. +   ---help---
  5547. +     Support for LCDC HiMax WQVGA (400x240) panel
  5548. +config FB_MSM_LCDC_LEAD_QVGA_PANEL
  5549. +   depends on FB_MSM_LCDC_HW
  5550. +   bool "LCDC Lead QVGA Panel"
  5551. +   select FB_MSM_LCDC_LEAD_QVGA
  5552. +   ---help---
  5553. +     Support for LCDC Lead QVGA (240x320) panel
  5554.  
  5555. +config FB_MSM_LCDC_HIMAX_QVGA_PANEL
  5556. +   depends on FB_MSM_LCDC_HW
  5557. +   bool "LCDC HIMAX QVGA Panel"
  5558. +   select FB_MSM_LCDC_HIMAX_QVGA
  5559. +   ---help---
  5560. +     Support for LCDC HIMAX QVGA (240x320) panel
  5561. +
  5562. +config FB_MSM_LCDC_SAMSUNG_QVGA_PANEL
  5563. +   depends on FB_MSM_LCDC_HW
  5564. +   bool "LCDC SAMSUNG QVGA Panel"
  5565. +   select FB_MSM_LCDC_SAMSUNG_QVGA
  5566. +   ---help---
  5567. +     Support for LCDC SAMSUNG QVGA (240x320) panel
  5568. +
  5569. +config FB_MSM_LCDC_OLED_WVGA_PANEL
  5570. +   depends on FB_MSM_LCDC_HW
  5571. +   bool "LCDC Oled WVGA Panel"
  5572. +   select FB_MSM_LCDC_OLED_WVGA
  5573. +   ---help---
  5574. +     Support for LCDC Samsung Oled WVGA (480x800) panel
  5575. +    
  5576. +config FB_MSM_LCDC_LEAD_HVGA_PANEL
  5577. +   depends on FB_MSM_LCDC_HW
  5578. +   bool "LCDC LEAD HVGA Panel"
  5579. +   select FB_MSM_LCDC_LEAD_HVGA
  5580. +   ---help---
  5581. +     Support for LCDC LEAD TFT HVGA (320x480) panel
  5582. +    
  5583.  config FB_MSM_LCDC_TOSHIBA_WVGA_PT_PANEL
  5584.     depends on FB_MSM_LCDC_HW
  5585.     bool "LCDC Toshiba WVGA PT Panel"
  5586. @@ -2356,7 +2429,7 @@
  5587.     bool "NONE"
  5588.     ---help---
  5589.       This will disable LCD panel
  5590. -endchoice
  5591. +endmenu
  5592.  
  5593.  choice
  5594.     prompt "Secondary LCD Panel"
  5595. diff -urB -x .git msm/drivers/video/msm/Makefile zte/drivers/video/msm/Makefile
  5596. --- msm/drivers/video/msm/Makefile  Mon Nov  1 13:46:22 2010
  5597. +++ zte/drivers/video/msm/Makefile  Wed Oct 13 18:13:22 2010
  5598. @@ -35,6 +35,7 @@
  5599.  obj-y += mdp_dma.o
  5600.  obj-y += mdp_dma_s.o
  5601.  obj-y += mdp_vsync.o
  5602. +obj-y += mdp_dma_lcdc.o
  5603.  obj-y += mdp_cursor.o
  5604.  obj-y += mdp_dma_tv.o
  5605.  
  5606. @@ -87,7 +88,15 @@
  5607.  obj-$(CONFIG_FB_MSM_LCDC_TOSHIBA_WVGA_PT) += lcdc_toshiba_wvga_pt.o
  5608.  obj-$(CONFIG_FB_MSM_LCDC_SHARP_WVGA_PT) += lcdc_sharp_wvga_pt.o
  5609.  obj-$(CONFIG_FB_MSM_HDMI_ADV7520_PANEL) += adv7520.o
  5610. +obj-$(CONFIG_FB_MSM_LCDC_HIMAX_WQVGA727) += lcdc_panel_wqvga727.o
  5611. +obj-$(CONFIG_FB_MSM_LCDC_HIMAX_WQVGA722) += lcdc_panel_wqvga722.o
  5612. +obj-$(CONFIG_FB_MSM_LCDC_LEAD_QVGA) += lcdc_panel_qvga_lead.o
  5613. +obj-$(CONFIG_FB_MSM_LCDC_HIMAX_QVGA) += lcdc_panel_qvga_himax.o
  5614. +obj-$(CONFIG_FB_MSM_LCDC_SAMSUNG_QVGA) += lcdc_panel_qvga_samsung.o
  5615.  
  5616. +obj-$(CONFIG_FB_MSM_LCDC_LEAD_HVGA) += lcdc_panel_hvga_lead.o
  5617. +
  5618. +obj-$(CONFIG_FB_MSM_LCDC_OLED_WVGA) += lcdc_panel_wvga_oled.o
  5619.  
  5620.  obj-$(CONFIG_FB_MSM_TVOUT_NTSC) += tv_ntsc.o
  5621.  obj-$(CONFIG_FB_MSM_TVOUT_PAL) += tv_pal.o
  5622. diff -urB -x .git msm/drivers/video/msm/lcdc.c zte/drivers/video/msm/lcdc.c
  5623. --- msm/drivers/video/msm/lcdc.c    Mon Nov  1 14:21:30 2010
  5624. +++ zte/drivers/video/msm/lcdc.c    Mon Oct 18 10:22:08 2010
  5625. @@ -118,8 +119,7 @@
  5626.     if (lcdc_pdata && lcdc_pdata->lcdc_power_save)
  5627.         lcdc_pdata->lcdc_power_save(0);
  5628.  
  5629. -   if (lcdc_pdata && lcdc_pdata->lcdc_gpio_config)
  5630. -       ret = lcdc_pdata->lcdc_gpio_config(0);
  5631. +
  5632.  
  5633.     pm_qos_update_requirement(PM_QOS_SYSTEM_BUS_FREQ , "lcdc",
  5634.                     PM_QOS_DEFAULT_VALUE);
  5635. Only in zte/drivers/video/msm: lcdc_panel_hvga_lead.c
  5636. Only in zte/drivers/video/msm: lcdc_panel_qvga_himax.c
  5637. Only in zte/drivers/video/msm: lcdc_panel_qvga_lead.c
  5638. Only in zte/drivers/video/msm: lcdc_panel_qvga_samsung.c
  5639. Only in zte/drivers/video/msm: lcdc_panel_wqvga722.c
  5640. Only in zte/drivers/video/msm: lcdc_panel_wqvga727.c
  5641. Only in zte/drivers/video/msm: lcdc_panel_wvga_oled.c
  5642. diff -urB -x .git msm/drivers/video/msm/logo.c zte/drivers/video/msm/logo.c
  5643. --- msm/drivers/video/msm/logo.c    Mon Nov  1 13:46:22 2010
  5644. +++ zte/drivers/video/msm/logo.c    Mon Oct 18 10:34:14 2010
  5645. @@ -35,7 +36,7 @@
  5646.     while (count--)
  5647.         *ptr++ = val;
  5648.  }
  5649. -
  5650. +#ifndef CONFIG_ZTE_PLATFORM
  5651.  /* 565RLE image format: [count(2 bytes), rle(2 bytes)] */
  5652.  int load_565rle_image(char *filename)
  5653.  {
  5654. @@ -95,4 +96,68 @@
  5655.     sys_close(fd);
  5656.     return err;
  5657.  }
  5658. +#else
  5659. +
  5660. +int load_565rle_image(char *filename)
  5661. +{
  5662. +   struct fb_info *info;
  5663. +   int fd, err = 0;
  5664. +   unsigned count, max;
  5665. +   unsigned short *data, *bits, *ptr;
  5666. +
  5667. +   info = registered_fb[0];
  5668. +   if (!info) {
  5669. +       printk(KERN_WARNING "%s: Can not access framebuffer\n",
  5670. +           __func__);
  5671. +       return -ENODEV;
  5672. +   }
  5673. +
  5674. +   fd = sys_open(filename, O_RDONLY, 0);
  5675. +   if (fd < 0) {
  5676. +       printk(KERN_WARNING "%s: Can not open %s\n",
  5677. +           __func__, filename);
  5678. +       return -ENOENT;
  5679. +   }
  5680. +
  5681. +   max = fb_width(info) * fb_height(info);
  5682. +   printk(KERN_WARNING "LUYA!!!!max=%d\n",max);
  5683. +   count = (unsigned)sys_lseek(fd, (off_t)0, 2);
  5684. +   printk(KERN_WARNING "LUYA!!!!count=%d\n",count);
  5685. +  
  5686. +   if (count == 0) {
  5687. +       sys_close(fd);
  5688. +       err = -EIO;
  5689. +       goto err_logo_close_file;
  5690. +   }
  5691. +   sys_lseek(fd, (off_t)0, 0);
  5692. +   data = kmalloc(count, GFP_KERNEL);
  5693. +   if (!data) {
  5694. +       printk(KERN_WARNING "%s: Can not alloc data\n", __func__);
  5695. +       err = -ENOMEM;
  5696. +       goto err_logo_close_file;
  5697. +   }
  5698. +   if ((unsigned)sys_read(fd, (char *)data, count) != count) {
  5699. +       err = -EIO;
  5700. +       goto err_logo_free_data;
  5701. +   }
  5702. +
  5703. +   ptr = data+35;
  5704. +   bits = (unsigned short *)(info->screen_base);
  5705. +   while (max > 0) {
  5706. +
  5707. +       memset16(bits, ptr[0], 1 << 1);
  5708. +       bits += 1;
  5709. +       max -= 1;
  5710. +       ptr += 1;
  5711. +
  5712. +   }
  5713. +
  5714. +err_logo_free_data:
  5715. +   kfree(data);
  5716. +err_logo_close_file:
  5717. +   sys_close(fd);
  5718. +   return err;
  5719. +}
  5720. +#endif
  5721. +
  5722.  EXPORT_SYMBOL(load_565rle_image);
  5723. diff -urB -x .git msm/drivers/video/msm/mdp_dma_lcdc.c zte/drivers/video/msm/mdp_dma_lcdc.c
  5724. --- msm/drivers/video/msm/mdp_dma_lcdc.c    Mon Nov  1 13:46:22 2010
  5725. +++ zte/drivers/video/msm/mdp_dma_lcdc.c    Mon Oct 18 10:34:56 2010
  5726. @@ -156,12 +157,23 @@
  5727.     buf = (uint8 *) fbi->fix.smem_start;
  5728.     buf += fbi->var.xoffset * bpp + fbi->var.yoffset * fbi->fix.line_length;
  5729.  
  5730. +#ifdef CONFIG_ZTE_PLATFORM
  5731. +   dma2_cfg_reg = DMA_PACK_ALIGN_MSB | DMA_DITHER_EN | DMA_OUT_SEL_LCDC;
  5732. +
  5733. +#else
  5734.     dma2_cfg_reg = DMA_PACK_ALIGN_LSB | DMA_DITHER_EN | DMA_OUT_SEL_LCDC;
  5735. +#endif
  5736.  
  5737.     if (mfd->fb_imgType == MDP_BGR_565)
  5738.         dma2_cfg_reg |= DMA_PACK_PATTERN_BGR;
  5739.     else
  5740. +       {
  5741. +       #ifdef CONFIG_FB_MSM_LCDC_OLED_WVGA
  5742. +       dma2_cfg_reg |= DMA_PACK_PATTERN_BGR;
  5743. +       #else
  5744.         dma2_cfg_reg |= DMA_PACK_PATTERN_RGB;
  5745. +       #endif
  5746. +       }
  5747.  
  5748.     if (bpp == 2)
  5749.         dma2_cfg_reg |= DMA_IBUF_FORMAT_RGB565;
  5750. diff -urB -x .git msm/drivers/video/msm/msm_fb.c zte/drivers/video/msm/msm_fb.c
  5751. --- msm/drivers/video/msm/msm_fb.c  Mon Nov  1 14:29:40 2010
  5752. +++ zte/drivers/video/msm/msm_fb.c  Mon Oct 18 10:35:56 2010
  5753. @@ -48,7 +48,7 @@
  5754.  #include "mdp4.h"
  5755.  
  5756.  #ifdef CONFIG_FB_MSM_LOGO
  5757. -#define INIT_IMAGE_FILE "/logo.rle"
  5758. +#define INIT_IMAGE_FILE "/logo.bmp"                           
  5759.  extern int load_565rle_image(char *filename);
  5760.  #endif
  5761.  
  5762. @@ -237,7 +237,7 @@
  5763.         return -ENOMEM;
  5764.  
  5765.     mfd->panel_info.frame_count = 0;
  5766. -   mfd->bl_level = mfd->panel_info.bl_max;
  5767. +   mfd->bl_level = mfd->panel_info.bl_max/4;
  5768.  #ifdef CONFIG_FB_MSM_OVERLAY
  5769.     mfd->overlay_play_enable = 1;
  5770.  #endif
  5771. @@ -523,9 +523,9 @@
  5772.     switch (blank_mode) {
  5773.     case FB_BLANK_UNBLANK:
  5774.         if (!mfd->panel_power_on) {
  5775. -           mdelay(100);
  5776.             ret = pdata->on(mfd->pdev);
  5777.             if (ret == 0) {
  5778. +               mdelay(30);        
  5779.                 mfd->panel_power_on = TRUE;
  5780.  
  5781.                 msm_fb_set_backlight(mfd,
  5782. @@ -555,14 +555,13 @@
  5783.  
  5784.             mfd->op_enable = FALSE;
  5785.             curr_pwr_state = mfd->panel_power_on;
  5786. +           msm_fb_set_backlight(mfd, 0, 0);       
  5787.             mfd->panel_power_on = FALSE;
  5788.  
  5789.             mdelay(100);
  5790.             ret = pdata->off(mfd->pdev);
  5791.             if (ret)
  5792.                 mfd->panel_power_on = curr_pwr_state;
  5793. -
  5794. -           msm_fb_set_backlight(mfd, 0, 0);
  5795.             mfd->op_enable = TRUE;
  5796.         }
  5797.         break;
  5798. @@ -871,9 +870,6 @@
  5799.        is writing directly to fb0, the framebuffer pitch
  5800.        also needs to be 32 pixel aligned */
  5801.  
  5802. -   if (mfd->index == 0)
  5803. -       fix->line_length = ALIGN(panel_info->xres, 32) * bpp;
  5804. -   else
  5805.         fix->line_length = panel_info->xres * bpp;
  5806.  
  5807.     fix->smem_len = fix->line_length * panel_info->yres * mfd->fb_page;
  5808. Only in zte/include/asm-arm: mach-types.h
  5809. Only in zte/include/linux: compile.h
  5810. Only in zte/include/linux/i2c: akm8973.h
  5811. diff -urB -x .git msm/include/linux/input.h zte/include/linux/input.h
  5812. --- msm/include/linux/input.h   Mon Nov  1 13:46:23 2010
  5813. +++ zte/include/linux/input.h   Mon Oct 18 13:50:40 2010
  5814. @@ -374,7 +374,13 @@
  5815.  #define KEY_BRIGHTNESS_ZERO    244 /* brightness off, use ambient */
  5816.  #define KEY_DISPLAY_OFF        245 /* display device to off state */
  5817.  
  5818. -#define KEY_WIMAX      246
  5819. +#if defined(CONFIG_MACH_SMOOTH)
  5820. +#define KEY_FLIP_UP            246
  5821. +#define KEY_FLIP_DOWN      247
  5822. +#define KEY_WIMAX          248
  5823. +#else
  5824. +#define KEY_WIMAX          246
  5825. +#endif
  5826.  
  5827.  /* Range 248 - 255 is reserved for special needs of AT keyboard driver */
  5828.  
  5829. Only in zte/include/linux: lis302dl.h
  5830. diff -urB -x .git msm/include/linux/mmc/host.h zte/include/linux/mmc/host.h
  5831. --- msm/include/linux/mmc/host.h    Mon Nov  1 13:46:23 2010
  5832. +++ zte/include/linux/mmc/host.h    Mon Oct 18 10:47:22 2010
  5833. @@ -148,8 +148,10 @@
  5834.     struct mmc_card     *card;      /* device attached to this host */
  5835.  
  5836.     wait_queue_head_t   wq;
  5837. -
  5838. -   struct delayed_work detect;
  5839. +
  5840. +   struct task_struct  *claimer;    
  5841. +   int         claim_cnt;   
  5842. +   struct delayed_work detect;
  5843.  
  5844.     const struct mmc_bus_ops *bus_ops;  /* current bus driver */
  5845.     unsigned int        bus_refs;   /* reference counter */
  5846. @@ -180,7 +182,8 @@
  5847.     int         idle_timeout;
  5848.     unsigned long       auto_suspend_state;
  5849.  #endif
  5850. -   unsigned long       private[0] ____cacheline_aligned;
  5851. +     int    last_suspend_error;
  5852. +   unsigned long       private[0] ____cacheline_aligned;
  5853.  };
  5854.  
  5855.  extern struct mmc_host *mmc_alloc_host(int extra, struct device *);
  5856. diff -urB -x .git msm/include/linux/msm_audio.h zte/include/linux/msm_audio.h
  5857. --- msm/include/linux/msm_audio.h   Mon Nov  1 13:46:23 2010
  5858. +++ zte/include/linux/msm_audio.h   Mon Oct 18 13:51:30 2010
  5859. @@ -227,6 +228,7 @@
  5860.  
  5861.  #define SND_AVC_CTL _IOW(SND_IOCTL_MAGIC, 6, unsigned *)
  5862.  #define SND_AGC_CTL _IOW(SND_IOCTL_MAGIC, 7, unsigned *)
  5863. +#define SND_SET_AUDIO_LOOPBACK _IOW(SND_IOCTL_MAGIC, 8, unsigned *)
  5864.  
  5865.  struct msm_audio_pcm_config {
  5866.     uint32_t pcm_feedback;  /* 0 - disable > 0 - enable */
  5867. diff -urB -x .git msm/include/linux/netfilter_ipv4/ipt_ecn.h zte/include/linux/netfilter_ipv4/ipt_ecn.h
  5868. --- msm/include/linux/netfilter_ipv4/ipt_ecn.h  Mon Nov  1 12:10:14 2010
  5869. +++ zte/include/linux/netfilter_ipv4/ipt_ecn.h  Mon Oct 18 10:48:54 2010
  5870. @@ -18,8 +18,7 @@
  5871.  
  5872.  #define IPT_ECN_OP_MATCH_MASK  0xce
  5873.  
  5874. -/* match info */
  5875. -struct ipt_ecn_info {
  5876. + struct ipt_ecn_info {
  5877.     u_int8_t operation;
  5878.     u_int8_t invert;
  5879.     u_int8_t ip_ect;
  5880. diff -urB -x .git msm/include/linux/netfilter_ipv4/ipt_ttl.h zte/include/linux/netfilter_ipv4/ipt_ttl.h
  5881. --- msm/include/linux/netfilter_ipv4/ipt_ttl.h  Mon Nov  1 12:10:14 2010
  5882. +++ zte/include/linux/netfilter_ipv4/ipt_ttl.h  Mon Oct 18 13:49:20 2010
  5883. @@ -5,10 +5,10 @@
  5884.  #define _IPT_TTL_H
  5885.  
  5886.  enum {
  5887. -   IPT_TTL_EQ = 0,     /* equals */
  5888. -   IPT_TTL_NE,     /* not equals */
  5889. -   IPT_TTL_LT,     /* less than */
  5890. -   IPT_TTL_GT,     /* greater than */
  5891. +   IPT_TTL_EQ = 0,    
  5892. +   IPT_TTL_NE,
  5893. +   IPT_TTL_LT,    
  5894. +   IPT_TTL_GT,    
  5895.  };
  5896.  
  5897.  
  5898. diff -urB -x .git msm/include/linux/netfilter_ipv6/ip6t_hl.h zte/include/linux/netfilter_ipv6/ip6t_hl.h
  5899. --- msm/include/linux/netfilter_ipv6/ip6t_hl.h  Mon Nov  1 12:10:14 2010
  5900. +++ zte/include/linux/netfilter_ipv6/ip6t_hl.h  Mon Oct 18 10:49:36 2010
  5901. @@ -6,10 +6,10 @@
  5902.  #define _IP6T_HL_H
  5903.  
  5904.  enum {
  5905. -   IP6T_HL_EQ = 0,     /* equals */
  5906. -   IP6T_HL_NE,     /* not equals */
  5907. -   IP6T_HL_LT,     /* less than */
  5908. -   IP6T_HL_GT,     /* greater than */
  5909. +   IP6T_HL_EQ = 0,  
  5910. +   IP6T_HL_NE,  
  5911. +   IP6T_HL_LT,      
  5912. +   IP6T_HL_GT,  
  5913.  };
  5914.  
  5915.  
  5916. Only in zte/include/linux: zte_memlog.h
  5917. diff -urB -x .git msm/include/media/msm_camera.h zte/include/media/msm_camera.h
  5918. --- msm/include/media/msm_camera.h  Mon Nov  1 13:46:23 2010
  5919. +++ zte/include/media/msm_camera.h  Mon Oct 18 10:51:10 2010
  5920. @@ -15,6 +15,7 @@
  5921.   * 02110-1301, USA.
  5922.   *
  5923.   */
  5924. +
  5925.  
  5926.  #ifndef __LINUX_MSM_CAMERA_H
  5927.  #define __LINUX_MSM_CAMERA_H
  5928. @@ -106,6 +107,10 @@
  5929.  #define MSM_CAM_IOCTL_AF_CTRL_DONE \
  5930.     _IOW(MSM_CAM_IOCTL_MAGIC, 26, struct msm_ctrl_cmt_t *)
  5931.  
  5932. +
  5933. +#define MSM_CAM_IOCTL_FLASH_LED_ON_OFF_CFG \
  5934. +   _IOW(MSM_CAM_IOCTL_MAGIC, 27, uint32_t *)
  5935. +
  5936.  #define MAX_SENSOR_NUM  3
  5937.  #define MAX_SENSOR_NAME 32
  5938.  
  5939. @@ -175,26 +180,26 @@
  5940.     void *value;
  5941.  };
  5942.  
  5943. -#define CMD_GENERAL            0
  5944. -#define CMD_AXI_CFG_OUT1       1
  5945. +#define CMD_GENERAL                    0
  5946. +#define CMD_AXI_CFG_OUT1           1
  5947.  #define CMD_AXI_CFG_SNAP_O1_AND_O2 2
  5948. -#define CMD_AXI_CFG_OUT2       3
  5949. -#define CMD_PICT_T_AXI_CFG     4
  5950. -#define CMD_PICT_M_AXI_CFG     5
  5951. +#define CMD_AXI_CFG_OUT2           3
  5952. +#define CMD_PICT_T_AXI_CFG         4
  5953. +#define CMD_PICT_M_AXI_CFG         5
  5954.  #define CMD_RAW_PICT_AXI_CFG       6
  5955.  
  5956.  #define CMD_FRAME_BUF_RELEASE      7
  5957. -#define CMD_PREV_BUF_CFG       8
  5958. +#define CMD_PREV_BUF_CFG           8
  5959.  #define CMD_SNAP_BUF_RELEASE       9
  5960. -#define CMD_SNAP_BUF_CFG       10
  5961. -#define CMD_STATS_DISABLE      11
  5962. +#define CMD_SNAP_BUF_CFG           10
  5963. +#define CMD_STATS_DISABLE          11
  5964.  #define CMD_STATS_AEC_AWB_ENABLE   12
  5965. -#define CMD_STATS_AF_ENABLE        13
  5966. +#define CMD_STATS_AF_ENABLE            13
  5967.  #define CMD_STATS_AEC_ENABLE       14
  5968.  #define CMD_STATS_AWB_ENABLE       15
  5969. -#define CMD_STATS_ENABLE       16
  5970. +#define CMD_STATS_ENABLE           16
  5971.  
  5972. -#define CMD_STATS_AXI_CFG      17
  5973. +#define CMD_STATS_AXI_CFG          17
  5974.  #define CMD_STATS_AEC_AXI_CFG      18
  5975.  #define CMD_STATS_AF_AXI_CFG       19
  5976.  #define CMD_STATS_AWB_AXI_CFG      20
  5977. @@ -214,9 +219,9 @@
  5978.  
  5979.  #define UPDATE_STATS_INVALID       33
  5980.  #define CMD_AXI_CFG_SNAP_GEMINI        34
  5981. -#define CMD_AXI_CFG_SNAP       35
  5982. -#define CMD_AXI_CFG_PREVIEW        36
  5983. -#define CMD_AXI_CFG_VIDEO      37
  5984. +#define CMD_AXI_CFG_SNAP           35
  5985. +#define CMD_AXI_CFG_PREVIEW            36
  5986. +#define CMD_AXI_CFG_VIDEO          37
  5987.  
  5988.  #define CMD_STATS_IHIST_ENABLE 38
  5989.  #define CMD_STATS_RS_ENABLE 39
  5990. @@ -381,8 +386,13 @@
  5991.  #define CFG_GET_PICT_P_PL      25
  5992.  #define CFG_GET_AF_MAX_STEPS       26
  5993.  #define CFG_GET_PICT_MAX_EXP_LC        27
  5994. + #define CFG_SET_SATURATION            28
  5995. +#define CFG_SET_SHARPNESS          29
  5996. +
  5997. +#define CFG_SET_AF                  30
  5998. +#define CFG_SET_ISO                 31
  5999. +#define CFG_MAX                        32
  6000.  #define CFG_SEND_WB_INFO    28
  6001. -#define CFG_MAX            29
  6002.  
  6003.  #define MOVE_NEAR  0
  6004.  #define MOVE_FAR   1
  6005. @@ -404,7 +414,70 @@
  6006.  #define CAMERA_EFFECT_WHITEBOARD   6
  6007.  #define CAMERA_EFFECT_BLACKBOARD   7
  6008.  #define CAMERA_EFFECT_AQUA     8
  6009. -#define CAMERA_EFFECT_MAX      9
  6010. +#define CAMERA_EFFECT_BULISH       9
  6011. +#define CAMERA_EFFECT_REDDISH      10
  6012. +#define CAMERA_EFFECT_GREENISH     11
  6013. +#define CAMERA_EFFECT_MAX          12
  6014. +
  6015. +#define CAMERA_WB_MODE_AWB              1
  6016. +#define CAMERA_WB_MODE_CUSTOM           2
  6017. +#define CAMERA_WB_MODE_INCANDESCENT     3
  6018. +#define CAMERA_WB_MODE_FLUORESCENT      4
  6019. +#define CAMERA_WB_MODE_SUNLIGHT         5
  6020. +#define CAMERA_WB_MODE_CLOUDY           6
  6021. +#define CAMERA_WB_MODE_NIGHT            7
  6022. +#define CAMERA_WB_MODE_SHADE            8
  6023. +#define CAMERA_WB_MODE_MAX              9
  6024. +
  6025. +#define CAMERA_BRIGHTNESS_0             0
  6026. +#define CAMERA_BRIGHTNESS_1             1
  6027. +#define CAMERA_BRIGHTNESS_2             2
  6028. +#define CAMERA_BRIGHTNESS_3             3
  6029. +#define CAMERA_BRIGHTNESS_4             4
  6030. +#define CAMERA_BRIGHTNESS_5             5
  6031. +#define CAMERA_BRIGHTNESS_6             6
  6032. +#define CAMERA_BRIGHTNESS_MAX           7
  6033. +
  6034. +#define CAMERA_CONTRAST_0               0
  6035. +#define CAMERA_CONTRAST_1               1
  6036. +#define CAMERA_CONTRAST_2               2
  6037. +#define CAMERA_CONTRAST_3               3
  6038. +#define CAMERA_CONTRAST_4               4
  6039. +#define CAMERA_CONTRAST_MAX             5
  6040. +
  6041. +#define CAMERA_SATURATION_0             0
  6042. +#define CAMERA_SATURATION_1             1
  6043. +#define CAMERA_SATURATION_2             2
  6044. +#define CAMERA_SATURATION_3             3
  6045. +#define CAMERA_SATURATION_4             4
  6046. +#define CAMERA_SATURATION_MAX           5
  6047. +
  6048. +#define CAMERA_ISO_SET_AUTO             0
  6049. +#define CAMERA_ISO_SET_HJR              1
  6050. +#define CAMERA_ISO_SET_100              2
  6051. +#define CAMERA_ISO_SET_200              3
  6052. +#define CAMERA_ISO_SET_400              4
  6053. +#define CAMERA_ISO_SET_800              5
  6054. +#define CAMERA_ISO_SET_MAX              6
  6055. +
  6056. +#define CAMERA_ANTIBANDING_SET_OFF      0
  6057. +#define CAMERA_ANTIBANDING_SET_60HZ     1
  6058. +#define CAMERA_ANTIBANDING_SET_50HZ     2
  6059. +#define CAMERA_ANTIBANDING_SET_AUTO     3
  6060. +#define CAMERA_ANTIBANDING_MAX          4
  6061. +
  6062. +#define CAMERA_SHARPNESS_0              0
  6063. +#define CAMERA_SHARPNESS_1              1
  6064. +#define CAMERA_SHARPNESS_2              2
  6065. +#define CAMERA_SHARPNESS_3              3
  6066. +#define CAMERA_SHARPNESS_4              4
  6067. +#define CAMERA_SHARPNESS_5              5
  6068. +#define CAMERA_SHARPNESS_6              6
  6069. +#define CAMERA_SHARPNESS_7              7
  6070. +#define CAMERA_SHARPNESS_8              8
  6071. +#define CAMERA_SHARPNESS_9              9
  6072. +#define CAMERA_SHARPNESS_10             10
  6073. +#define CAMERA_SHARPNESS_MAX            11
  6074.  
  6075.  struct sensor_pict_fps {
  6076.     uint16_t prevfps;
  6077. @@ -446,6 +519,17 @@
  6078.         uint16_t pictp_pl;
  6079.         uint32_t pict_max_exp_lc;
  6080.         uint16_t p_fps;
  6081. +
  6082. +  
  6083. +        int8_t wb_mode;
  6084. +        int8_t brightness;
  6085. +        int8_t contrast;
  6086. +        int8_t saturation;
  6087. +        int8_t sharpness;
  6088. +        int8_t iso_val;
  6089. +        int8_t antibanding;
  6090. +        int8_t lensshading;
  6091. +
  6092.         struct sensor_pict_fps gfps;
  6093.         struct exp_gain_cfg exp_gain;
  6094.         struct focus_cfg focus;
  6095. Only in zte/kernel: config_data.gz
  6096. Only in zte/kernel: config_data.h
  6097. Only in zte/kernel: timeconst.h
  6098. Only in zte/lib: crc32table.h
  6099. Only in zte/lib: gen_crc32table
  6100. diff -urB -x .git msm/net/ipv4/netfilter/ipt_ecn.c zte/net/ipv4/netfilter/ipt_ecn.c
  6101. --- msm/net/ipv4/netfilter/ipt_ecn.c    Mon Nov  1 12:10:18 2010
  6102. +++ zte/net/ipv4/netfilter/ipt_ecn.c    Mon Oct 18 10:56:38 2010
  6103. @@ -35,9 +35,7 @@
  6104.     struct tcphdr _tcph;
  6105.     const struct tcphdr *th;
  6106.  
  6107. -   /* In practice, TCP match does this, so can't fail.  But let's
  6108. -    * be good citizens.
  6109. -    */
  6110. +
  6111.     th = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph);
  6112.     if (th == NULL) {
  6113.         *hotdrop = false;
  6114. diff -urB -x .git msm/net/ipv6/af_inet6.c zte/net/ipv6/af_inet6.c
  6115. --- msm/net/ipv6/af_inet6.c Mon Nov  1 13:46:23 2010
  6116. +++ zte/net/ipv6/af_inet6.c Mon Oct 18 10:57:36 2010
  6117. @@ -88,9 +88,10 @@
  6118.  }
  6119.  
  6120.  #ifdef CONFIG_ANDROID_PARANOID_NETWORK
  6121. +
  6122.  static inline int current_has_network(void)
  6123.  {
  6124. -   return (!current->euid || in_egroup_p(AID_INET) ||
  6125. +   return (!current_euid() || in_egroup_p(AID_INET) ||
  6126.         in_egroup_p(AID_NET_RAW));
  6127.  }
  6128.  static inline int current_has_cap(int cap)
  6129. @@ -98,7 +99,7 @@
  6130.     if (cap == CAP_NET_RAW && in_egroup_p(AID_NET_RAW))
  6131.         return 1;
  6132.     return capable(cap);
  6133. -}
  6134. +}    
  6135.  # else
  6136.  static inline int current_has_network(void)
  6137.  {
  6138. diff -urB -x .git msm/net/ipv6/netfilter/ip6t_hl.c zte/net/ipv6/netfilter/ip6t_hl.c
  6139. --- msm/net/ipv6/netfilter/ip6t_hl.c    Mon Nov  1 12:10:18 2010
  6140. +++ zte/net/ipv6/netfilter/ip6t_hl.c    Mon Oct 18 10:58:26 2010
  6141. @@ -1,12 +1,4 @@
  6142. -/* Hop Limit matching module */
  6143.  
  6144. -/* (C) 2001-2002 Maciej Soltysiak <solt@dns.toxicfilms.tv>
  6145. - * Based on HW's ttl module
  6146. - *
  6147. - * This program is free software; you can redistribute it and/or modify
  6148. - * it under the terms of the GNU General Public License version 2 as
  6149. - * published by the Free Software Foundation.
  6150. - */
  6151.  
  6152.  #include <linux/ipv6.h>
  6153.  #include <linux/module.h>
  6154. diff -urB -x .git msm/scripts/Makefile.clean zte/scripts/Makefile.clean
  6155. --- msm/scripts/Makefile.clean  Mon Nov  1 12:10:20 2010
  6156. +++ zte/scripts/Makefile.clean  Tue Oct 26 16:54:52 2010
  6157. @@ -14,7 +14,8 @@
  6158.  
  6159.  # The filename Kbuild has precedence over Makefile
  6160.  kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
  6161. -include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile)
  6162. +#include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile)
  6163. +include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild)
  6164.  
  6165.  # Figure out what we need to build from the various variables
  6166.  # ==========================================================================
  6167. Only in zte/scripts: Makefile.clean.bak
  6168. Only in zte/scripts/basic: docproc
  6169. Only in zte/scripts/basic: fixdep
  6170. Only in zte/scripts/basic: hash
  6171. Only in zte/scripts: bin2c
  6172. Only in zte/scripts: conmakehash
  6173. Only in zte/scripts: ihex2fw
  6174. Only in zte/scripts: kallsyms
  6175. Only in zte/scripts/kconfig: conf
  6176. Only in zte/scripts/kconfig: lex.zconf.c
  6177. Only in zte/scripts/kconfig: zconf.hash.c
  6178. Only in zte/scripts/kconfig: zconf.tab.c
  6179. Only in zte/scripts/mod: elfconfig.h
  6180. Only in zte/scripts/mod: mk_elfconfig
  6181. Only in zte/scripts/mod: modpost
  6182. Only in zte/usr: gen_init_cpio
  6183. Only in zte/usr: initramfs_data.cpio.gz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement