e750_lcd.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* e750_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. static struct w100_gen_regs e750_lcd_regs = {
  21. .lcd_format = 0x00008003,
  22. .lcdd_cntl1 = 0x00000000,
  23. .lcdd_cntl2 = 0x0003ffff,
  24. .genlcd_cntl1 = 0x00fff003,
  25. .genlcd_cntl2 = 0x003c0f03,
  26. .genlcd_cntl3 = 0x000143aa,
  27. };
  28. static struct w100_mode e750_lcd_mode = {
  29. .xres = 240,
  30. .yres = 320,
  31. .left_margin = 21,
  32. .right_margin = 22,
  33. .upper_margin = 5,
  34. .lower_margin = 4,
  35. .crtc_ss = 0x80150014,
  36. .crtc_ls = 0x8014000d,
  37. .crtc_gs = 0xc1000005,
  38. .crtc_vpos_gs = 0x00020147,
  39. .crtc_rev = 0x0040010a,
  40. .crtc_dclk = 0xa1700030,
  41. .crtc_gclk = 0x80cc0015,
  42. .crtc_goe = 0x80cc0015,
  43. .crtc_ps1_active = 0x61060017,
  44. .pll_freq = 57,
  45. .pixclk_divider = 4,
  46. .pixclk_divider_rotated = 4,
  47. .pixclk_src = CLK_SRC_XTAL,
  48. .sysclk_divider = 1,
  49. .sysclk_src = CLK_SRC_PLL,
  50. };
  51. static struct w100_gpio_regs e750_w100_gpio_info = {
  52. .init_data1 = 0x01192f1b,
  53. .gpio_dir1 = 0xd5ffdeff,
  54. .gpio_oe1 = 0x000020bf,
  55. .init_data2 = 0x010f010f,
  56. .gpio_dir2 = 0xffffffff,
  57. .gpio_oe2 = 0x000001cf,
  58. };
  59. static struct w100fb_mach_info e750_fb_info = {
  60. .modelist = &e750_lcd_mode,
  61. .num_modes = 1,
  62. .regs = &e750_lcd_regs,
  63. .gpio = &e750_w100_gpio_info,
  64. .xtal_freq = 14318000,
  65. .xtal_dbl = 1,
  66. };
  67. static struct resource e750_fb_resources[] = {
  68. [0] = {
  69. .start = 0x0c000000,
  70. .end = 0x0cffffff,
  71. .flags = IORESOURCE_MEM,
  72. },
  73. };
  74. /* ----------------------- device declarations -------------------------- */
  75. static struct platform_device e750_fb_device = {
  76. .name = "w100fb",
  77. .id = -1,
  78. .dev = {
  79. .platform_data = &e750_fb_info,
  80. },
  81. .num_resources = ARRAY_SIZE(e750_fb_resources),
  82. .resource = e750_fb_resources,
  83. };
  84. static int e750_lcd_init(void)
  85. {
  86. if (!machine_is_e750())
  87. return -ENODEV;
  88. return platform_device_register(&e750_fb_device);
  89. }
  90. module_init(e750_lcd_init);
  91. MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
  92. MODULE_DESCRIPTION("e750 lcd driver");
  93. MODULE_LICENSE("GPLv2");