e740_lcd.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* e740_lcd.c
  2. *
  3. * This file contains the definitions for the LCD timings and functions
  4. * to control the LCD power / frontlighting via the w100fb driver.
  5. *
  6. * (c) 2005 Ian Molton <spyro@f2s.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/module.h>
  14. #include <linux/device.h>
  15. #include <linux/fb.h>
  16. #include <linux/err.h>
  17. #include <linux/platform_device.h>
  18. #include <asm/mach-types.h>
  19. #include <video/w100fb.h>
  20. /*
  21. **potential** shutdown routine - to be investigated
  22. devmem2 0x0c010528 w 0xff3fff00
  23. devmem2 0x0c010190 w 0x7FFF8000
  24. devmem2 0x0c0101b0 w 0x00FF0000
  25. devmem2 0x0c01008c w 0x00000000
  26. devmem2 0x0c010080 w 0x000000bf
  27. devmem2 0x0c010098 w 0x00000015
  28. devmem2 0x0c010088 w 0x4b000204
  29. devmem2 0x0c010098 w 0x0000001d
  30. */
  31. static struct w100_gen_regs e740_lcd_regs = {
  32. .lcd_format = 0x00008023,
  33. .lcdd_cntl1 = 0x0f000000,
  34. .lcdd_cntl2 = 0x0003ffff,
  35. .genlcd_cntl1 = 0x00ffff03,
  36. .genlcd_cntl2 = 0x003c0f03,
  37. .genlcd_cntl3 = 0x000143aa,
  38. };
  39. static struct w100_mode e740_lcd_mode = {
  40. .xres = 240,
  41. .yres = 320,
  42. .left_margin = 20,
  43. .right_margin = 28,
  44. .upper_margin = 9,
  45. .lower_margin = 8,
  46. .crtc_ss = 0x80140013,
  47. .crtc_ls = 0x81150110,
  48. .crtc_gs = 0x80050005,
  49. .crtc_vpos_gs = 0x000a0009,
  50. .crtc_rev = 0x0040010a,
  51. .crtc_dclk = 0xa906000a,
  52. .crtc_gclk = 0x80050108,
  53. .crtc_goe = 0x80050108,
  54. .pll_freq = 57,
  55. .pixclk_divider = 4,
  56. .pixclk_divider_rotated = 4,
  57. .pixclk_src = CLK_SRC_XTAL,
  58. .sysclk_divider = 1,
  59. .sysclk_src = CLK_SRC_PLL,
  60. .crtc_ps1_active = 0x41060010,
  61. };
  62. static struct w100_gpio_regs e740_w100_gpio_info = {
  63. .init_data1 = 0x21002103,
  64. .gpio_dir1 = 0xffffdeff,
  65. .gpio_oe1 = 0x03c00643,
  66. .init_data2 = 0x003f003f,
  67. .gpio_dir2 = 0xffffffff,
  68. .gpio_oe2 = 0x000000ff,
  69. };
  70. static struct w100fb_mach_info e740_fb_info = {
  71. .modelist = &e740_lcd_mode,
  72. .num_modes = 1,
  73. .regs = &e740_lcd_regs,
  74. .gpio = &e740_w100_gpio_info,
  75. .xtal_freq = 14318000,
  76. .xtal_dbl = 1,
  77. };
  78. static struct resource e740_fb_resources[] = {
  79. [0] = {
  80. .start = 0x0c000000,
  81. .end = 0x0cffffff,
  82. .flags = IORESOURCE_MEM,
  83. },
  84. };
  85. /* ----------------------- device declarations -------------------------- */
  86. static struct platform_device e740_fb_device = {
  87. .name = "w100fb",
  88. .id = -1,
  89. .dev = {
  90. .platform_data = &e740_fb_info,
  91. },
  92. .num_resources = ARRAY_SIZE(e740_fb_resources),
  93. .resource = e740_fb_resources,
  94. };
  95. static int e740_lcd_init(void)
  96. {
  97. int ret;
  98. if (!machine_is_e740())
  99. return -ENODEV;
  100. return platform_device_register(&e740_fb_device);
  101. }
  102. module_init(e740_lcd_init);
  103. MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
  104. MODULE_DESCRIPTION("e740 lcd driver");
  105. MODULE_LICENSE("GPLv2");