h3100.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Support for Compaq iPAQ H3100 handheld computer
  3. *
  4. * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
  5. * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. */
  12. #include <linux/init.h>
  13. #include <linux/kernel.h>
  14. #include <linux/gpio.h>
  15. #include <video/sa1100fb.h>
  16. #include <asm/mach-types.h>
  17. #include <asm/mach/arch.h>
  18. #include <asm/mach/irda.h>
  19. #include <mach/h3xxx.h>
  20. #include "generic.h"
  21. /*
  22. * helper for sa1100fb
  23. */
  24. static void h3100_lcd_power(int enable)
  25. {
  26. if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) {
  27. gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
  28. gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
  29. gpio_free(H3XXX_EGPIO_LCD_ON);
  30. } else {
  31. pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__);
  32. }
  33. }
  34. static struct sa1100fb_mach_info h3100_lcd_info = {
  35. .pixclock = 406977, .bpp = 4,
  36. .xres = 320, .yres = 240,
  37. .hsync_len = 26, .vsync_len = 41,
  38. .left_margin = 4, .upper_margin = 0,
  39. .right_margin = 4, .lower_margin = 0,
  40. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  41. .cmap_greyscale = 1,
  42. .cmap_inverse = 1,
  43. .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas,
  44. .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
  45. .lcd_power = h3100_lcd_power,
  46. };
  47. static void __init h3100_map_io(void)
  48. {
  49. h3xxx_map_io();
  50. /* Older bootldrs put GPIO2-9 in alternate mode on the
  51. assumption that they are used for video */
  52. GAFR &= ~0x000001fb;
  53. }
  54. /*
  55. * This turns the IRDA power on or off on the Compaq H3100
  56. */
  57. static int h3100_irda_set_power(struct device *dev, unsigned int state)
  58. {
  59. gpio_set_value(H3100_GPIO_IR_ON, state);
  60. return 0;
  61. }
  62. static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
  63. {
  64. gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
  65. }
  66. static struct irda_platform_data h3100_irda_data = {
  67. .set_power = h3100_irda_set_power,
  68. .set_speed = h3100_irda_set_speed,
  69. };
  70. static struct gpio_default_state h3100_default_gpio[] = {
  71. { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" },
  72. { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" },
  73. { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
  74. { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
  75. { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
  76. { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" },
  77. };
  78. static void __init h3100_mach_init(void)
  79. {
  80. h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio));
  81. h3xxx_mach_init();
  82. sa11x0_register_lcd(&h3100_lcd_info);
  83. sa11x0_register_irda(&h3100_irda_data);
  84. }
  85. MACHINE_START(H3100, "Compaq iPAQ H3100")
  86. .atag_offset = 0x100,
  87. .map_io = h3100_map_io,
  88. .init_irq = sa1100_init_irq,
  89. .timer = &sa1100_timer,
  90. .init_machine = h3100_mach_init,
  91. .restart = sa11x0_restart,
  92. MACHINE_END