Advertisement
Guest User

Untitled

a guest
Jan 10th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.14 KB | None | 0 0
  1. From 55d9149777d7ac58c57c4da62bc024f80a65cd71 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
  3. Date: Sat, 10 Jan 2015 14:52:22 +0100
  4. Subject: [PATCH] n950: initial support for n950 (RM680)
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8.  
  9. Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
  10. ---
  11. arch/arm/mach-omap2/board-rm680.c | 222 +++++++++++++++++++++++++++++++++-----
  12. 1 file changed, 193 insertions(+), 29 deletions(-)
  13.  
  14. diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
  15. index 2786dee..f9c0bcb 100644
  16. --- a/arch/arm/mach-omap2/board-rm680.c
  17. +++ b/arch/arm/mach-omap2/board-rm680.c
  18. @@ -38,8 +38,8 @@
  19. #include <sound/tpa6130a2-plat.h>
  20. #include <sound/tlv320dac33-plat.h>
  21. #include <linux/i2c/apds990x.h>
  22. -#include <linux/i2c/ak8975.h>
  23. -#include <linux/nfc/pn544.h>
  24. +#include <linux/i2c/ak8975.h> //RM696
  25. +#include <linux/nfc/pn544.h> //RM696
  26. #include <linux/i2c/bcm4751-gps.h>
  27.  
  28. #include <asm/mach/arch.h>
  29. @@ -111,9 +111,11 @@
  30. #define RM696_TVOUT_EN_GPIO 40
  31. #define RM696_JACK_GPIO (OMAP_MAX_GPIO_LINES + 0)
  32.  
  33. -#define RM696_LP5521_CHIP_EN_GPIO 41
  34. +#define RM696_LP5521_CHIP_EN_GPIO 41 //RM696
  35. +#define RM680_LP5523_CHIP_EN_GPIO 41 //RM680
  36.  
  37. -#define APDS990X_GPIO 83
  38. +#define APDS990X_GPIO 83 //RM696
  39. +#define BHSFH_GPIO 83 //RM680
  40.  
  41. #define RM696_BCM4751_GPS_IRQ_GPIO 95
  42. #define RM696_BCM4751_GPS_ENABLE_GPIO 94
  43. @@ -512,7 +514,7 @@ static struct regulator_consumer_supply rm696_vio_consumers[] = {
  44. REGULATOR_SUPPLY("Vdd", "2-004b"), /* Atmel mxt */
  45. REGULATOR_SUPPLY("vonenand", "omap2-onenand"), /* OneNAND flash */
  46. REGULATOR_SUPPLY("Vdd_IO", "3-001d"), /* LIS302 */
  47. - REGULATOR_SUPPLY("DVdd", "3-000f"), /* AK8975 */
  48. + REGULATOR_SUPPLY("DVdd", "3-000f"), /* AK8975 on RM696, AK8974 on RM680 */
  49. REGULATOR_SUPPLY("Vdd_IO", "3-002b"), /* PN544 */
  50. REGULATOR_SUPPLY("vmmc_aux", "mmci-omap-hs.1"),
  51. REGULATOR_SUPPLY("Vbat", "3-a1fa"), /* BCM4751_GPS */
  52. @@ -610,7 +612,7 @@ static struct regulator_consumer_supply rm696_vaux1_consumers[] = {
  53. REGULATOR_SUPPLY("Vdd", "3-001d"), /* LIS302 */
  54. REGULATOR_SUPPLY("v28", "twl5031_aci"),
  55. REGULATOR_SUPPLY("Vdd", "2-0039"), /* APDS990x */
  56. - REGULATOR_SUPPLY("AVdd", "3-000f"), /* AK8975 */
  57. + REGULATOR_SUPPLY("AVdd", "3-000f"), /* AK8975 on RM696, AK8974 on RM680 */
  58. };
  59.  
  60. static struct regulator_init_data rm696_vaux1_data = {
  61. @@ -1107,9 +1109,9 @@ static struct lis3lv02d_platform_data rm696_lis302dl_data = {
  62.  
  63. #if defined(CONFIG_SENSORS_AK8975) || defined(CONFIG_SENSORS_AK8975_MODULE)
  64. static struct ak8975_platform_data rm696_ak8975_data = {
  65. -.axis_x = AK8975_DEV_Z,
  66. -.axis_y = AK8975_INV_DEV_X,
  67. -.axis_z = AK8975_INV_DEV_Y,
  68. + .axis_x = AK8975_DEV_Z,
  69. + .axis_y = AK8975_INV_DEV_X,
  70. + .axis_z = AK8975_INV_DEV_Y,
  71. };
  72. #endif
  73.  
  74. @@ -1500,6 +1502,20 @@ static struct nokia_dsi_panel_data rm696_panel_data = {
  75. .rotate = 1,
  76. };
  77.  
  78. +static struct nokia_dsi_panel_data rm680_panel_data = {
  79. + .name = "himalaya",
  80. + .reset_gpio = 87,
  81. + .use_ext_te = true,
  82. + .ext_te_gpio = 62,
  83. + .esd_timeout = 5000,
  84. + .ulps_timeout = 500,
  85. + .partial_area = {
  86. + .offset = 5,
  87. + .height = 854,
  88. + },
  89. + .rotate = 3,
  90. +};
  91. +
  92. static struct omap_dss_device rm696_dsi_display_data = {
  93. .type = OMAP_DISPLAY_TYPE_DSI,
  94. .name = "lcd",
  95. @@ -1548,6 +1564,52 @@ static struct omap_dss_device rm696_dsi_display_data = {
  96. .data = &rm696_panel_data,
  97. };
  98.  
  99. +static struct omap_dss_device rm680_dsi_display_data = {
  100. + .type = OMAP_DISPLAY_TYPE_DSI,
  101. + .name = "lcd",
  102. + .driver_name = "panel-nokia-dsi",
  103. + .phy.dsi = {
  104. + .clk_lane = 2,
  105. + .clk_pol = 0,
  106. + .data1_lane = 1,
  107. + .data1_pol = 0,
  108. + .data2_lane = 3,
  109. + .data2_pol = 0,
  110. + },
  111. +
  112. + .clocks = {
  113. + .dss = {
  114. + .fck_div = 5,
  115. + },
  116. +
  117. + .dispc = {
  118. + /* LCK 170.88 MHz */
  119. + .lck_div = 1,
  120. + /* PCK 42.72 MHz */
  121. + .pck_div = 4,
  122. +
  123. + .fclk_from_dsi_pll = false,
  124. + },
  125. +
  126. + .dsi = {
  127. + /* DDR CLK 256.32 MHz */
  128. + .regn = 10,
  129. + .regm = 267,
  130. + /* DISPC FCLK 170.88 MHz */
  131. + .regm3 = 6,
  132. + /* DSI FCLK 170.88 MHz */
  133. + .regm4 = 6,
  134. +
  135. + /* LP CLK 7.767 MHz */
  136. + .lp_clk_div = 11,
  137. +
  138. + .fclk_from_dsi_pll = false,
  139. + },
  140. + },
  141. +
  142. + .data = &rm680_panel_data,
  143. +};
  144. +
  145. static int rm696_tv_enable(struct omap_dss_device *dssdev)
  146. {
  147. if (dssdev->reset_gpio != -1)
  148. @@ -1578,12 +1640,23 @@ static struct omap_dss_device *rm696_dss_devices[] = {
  149. &rm696_tv_display_data,
  150. };
  151.  
  152. +static struct omap_dss_device *rm680_dss_devices[] = {
  153. + &rm680_dsi_display_data,
  154. + &rm696_tv_display_data, //same as on RM696
  155. +};
  156. +
  157. static struct omap_dss_board_info rm696_dss_data = {
  158. .num_devices = ARRAY_SIZE(rm696_dss_devices),
  159. .devices = rm696_dss_devices,
  160. .default_device = &rm696_dsi_display_data,
  161. };
  162.  
  163. +static struct omap_dss_board_info rm680_dss_data = {
  164. + .num_devices = ARRAY_SIZE(rm680_dss_devices),
  165. + .devices = rm680_dss_devices,
  166. + .default_device = &rm680_dsi_display_data,
  167. +};
  168. +
  169. struct platform_device rm696_dss_device = {
  170. .name = "omapdss",
  171. .id = -1,
  172. @@ -1592,6 +1665,14 @@ struct platform_device rm696_dss_device = {
  173. },
  174. };
  175.  
  176. +struct platform_device rm680_dss_device = {
  177. + .name = "omapdss",
  178. + .id = -1,
  179. + .dev = {
  180. + .platform_data = &rm680_dss_data,
  181. + },
  182. +};
  183. +
  184. static struct omapfb_platform_data rm696_omapfb_data = {
  185. .mem_desc = {
  186. .region_cnt = 1,
  187. @@ -1642,6 +1723,9 @@ static int __init rm696_video_init(void)
  188. {
  189. int r;
  190.  
  191. + if (board_is_rm680())
  192. + return 0;
  193. +
  194. omap_setup_dss_device(&rm696_dss_device);
  195.  
  196. rm696_dss_devices[0] = &rm696_dsi_display_data;
  197. @@ -1696,6 +1780,72 @@ err0:
  198.  
  199. subsys_initcall(rm696_video_init);
  200.  
  201. +static int __init rm680_video_init(void)
  202. +{
  203. + int r;
  204. +
  205. + if (!board_is_rm680())
  206. + return 0;
  207. +
  208. + if (system_rev < 0x0420) {
  209. + pr_err("RM-680 display is supported only on HWID 0420 and " \
  210. + "higher\n");
  211. + r = -ENODEV;
  212. + goto err0;
  213. + }
  214. +
  215. + omap_setup_dss_device(&rm680_dss_device);
  216. +
  217. + r = gpio_request(rm680_panel_data.reset_gpio, "himalaya reset");
  218. + if (r < 0)
  219. + goto err0;
  220. +
  221. + r = gpio_direction_output(rm680_panel_data.reset_gpio, 1);
  222. +
  223. + rm680_dss_data.default_device = rm680_dss_devices[0];
  224. +
  225. + /* TV */
  226. + if (rm696_tv_display_data.reset_gpio != -1) { //same as on RM696
  227. + r = gpio_request(rm696_tv_display_data.reset_gpio,
  228. + "TV-out enable");
  229. + if (r < 0)
  230. + goto err1;
  231. +
  232. + r = gpio_direction_output(rm696_tv_display_data.reset_gpio, 0);
  233. + if (r < 0)
  234. + goto err2;
  235. + }
  236. +
  237. + r = platform_device_register(&rm680_dss_device);
  238. + if (r < 0)
  239. + goto err2;
  240. +
  241. + omapfb_set_platform_data(&rm696_omapfb_data); // same as on RM696
  242. +
  243. + r = platform_device_register(&rm696_sgx_device); //same as on RM696
  244. + if (r < 0)
  245. + goto err3;
  246. +
  247. + return 0;
  248. +
  249. +err3:
  250. + platform_device_unregister(&rm696_dss_device);
  251. +err2:
  252. + if (rm696_tv_display_data.reset_gpio != -1) {
  253. + gpio_free(rm696_tv_display_data.reset_gpio);
  254. + rm696_tv_display_data.reset_gpio = -1;
  255. + }
  256. +err1:
  257. + gpio_free(rm680_panel_data.reset_gpio);
  258. + rm680_panel_data.reset_gpio = -1;
  259. +err0:
  260. + pr_err("%s failed (%d)\n", __func__, r);
  261. +
  262. + return r;
  263. +}
  264. +
  265. +subsys_initcall(rm680_video_init);
  266. +
  267. static int __init rm696_atmel_mxt_init(void)
  268. {
  269. int err;
  270. @@ -1790,25 +1940,30 @@ static void __init rm696_avplugdet_init(void)
  271. static void __init rm680_peripherals_init(void)
  272. {
  273. rm680_init_wl1271();
  274. - rm696_init_vibra();
  275. -
  276. - platform_add_devices(rm680_peripherals_devices,
  277. - ARRAY_SIZE(rm680_peripherals_devices));
  278. -
  279. - rm696_atmel_mxt_init();
  280. - rm696_apds990x_init();
  281. - rm696_avplugdet_init();
  282. - rm680_i2c_init();
  283. - gpmc_onenand_init(board_onenand_data);
  284. -
  285. - /* FIXME: gpio_hw_reset is present in 2.6 but missing in 3.5 */
  286. - /* if (system_rev > 0x1300) {
  287. - mmc[0].hw_reset_connected = 1;
  288. - mmc[0].gpio_hw_reset = 39;
  289. - }*/
  290. - omap_hsmmc_init(mmc);
  291. - rm696_ssi_init();
  292. - omap_bt_init(&rm680_bt_config);
  293. +
  294. + /*if (!board_is_rm680()) {*/
  295. + rm696_init_vibra();
  296. +
  297. + platform_add_devices(rm680_peripherals_devices,
  298. + ARRAY_SIZE(rm680_peripherals_devices));
  299. +
  300. + rm696_atmel_mxt_init();
  301. + rm696_apds990x_init();
  302. + rm696_avplugdet_init();
  303. + rm680_i2c_init();
  304. + gpmc_onenand_init(board_onenand_data);
  305. +
  306. + /* FIXME: gpio_hw_reset is present in 2.6 but missing in 3.5 */
  307. + /* if (system_rev > 0x1300) {
  308. + mmc[0].hw_reset_connected = 1;
  309. + mmc[0].gpio_hw_reset = 39;
  310. + }*/
  311. + omap_hsmmc_init(mmc);
  312. + rm696_ssi_init();
  313. + omap_bt_init(&rm680_bt_config);
  314. + /*} else {
  315. +
  316. + }*/
  317. }
  318.  
  319. #ifdef CONFIG_OMAP_MUX
  320. @@ -2420,6 +2575,11 @@ void __init rm696_camera_init(void)
  321. __func__);
  322. }
  323.  
  324. +void __init rm680_camera_init(void)
  325. +{
  326. + //TODO
  327. +}
  328. +
  329. static inline void board_serial_init(void)
  330. {
  331. struct omap_board_data bdata;
  332. @@ -2447,7 +2607,11 @@ static void __init rm680_init(void)
  333.  
  334. usb_musb_init(&rm696_musb_data);
  335. rm680_peripherals_init();
  336. - rm696_camera_init();
  337. + if (!board_is_rm680()) {
  338. + rm696_camera_init();
  339. + } else {
  340. + rm680_camera_init();
  341. + }
  342.  
  343. /* Ensure SDRC pins are mux'd for self-refresh */
  344. omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
  345. --
  346. 2.1.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement