commandProcessing.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * linux/arch/arm/mach-omap1/lcd_dma.c
  3. *
  4. * Extracted from arch/arm/plat-omap/dma.c
  5. * Copyright (C) 2003 - 2008 Nokia Corporation
  6. * Author: Juha Yrjölä <juha.yrjola@nokia.com>
  7. * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
  8. * Graphics DMA and LCD DMA graphics tranformations
  9. * by Imre Deak <imre.deak@nokia.com>
  10. * OMAP2/3 support Copyright (C) 2004-2007 Texas Instruments, Inc.
  11. * Merged to support both OMAP1 and OMAP2 by Tony Lindgren <tony@atomide.com>
  12. * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc.
  13. *
  14. * Copyright (C) 2009 Texas Instruments
  15. * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
  16. *
  17. * Support functions for the OMAP internal DMA channels.
  18. *
  19. * This program is free software; you can redistribute it and/or modify
  20. * it under the terms of the GNU General Public License version 2 as
  21. * published by the Free Software Foundation.
  22. *
  23. */
  24. #include <linux/module.h>
  25. #include <linux/spinlock.h>
  26. #include <linux/interrupt.h>
  27. #include <linux/io.h>
  28. #include <linux/omap-dma.h>
  29. #include <mach/hardware.h>
  30. #include <mach/lcdc.h>
  31. #include "dma.h"
  32. int omap_lcd_dma_running(void)
  33. {
  34. /*
  35. * On OMAP1510, internal LCD controller will start the transfer
  36. * when it gets enabled, so assume DMA running if LCD enabled.
  37. */
  38. if (cpu_is_omap15xx())
  39. if (omap_readw(OMAP_LCDC_CONTROL) & OMAP_LCDC_CTRL_LCD_EN)
  40. return 1;
  41. /* Check if LCD DMA is running */
  42. if (cpu_is_omap16xx())
  43. if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN)
  44. return 1;
  45. return 0;
  46. }
  47. static struct lcd_dma_info {
  48. spinlock_t lock;
  49. int reserved;
  50. void (*callback)(u16 status, void *data);
  51. void *cb_data;
  52. int active;
  53. unsigned long addr;
  54. int rotate, data_type, xres, yres;
  55. int vxres;
  56. int mirror;
  57. int xscale, yscale;
  58. int ext_ctrl;
  59. int src_port;
  60. int single_transfer;
  61. } lcd_dma;
  62. void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
  63. int data_type)
  64. {
  65. lcd_dma.addr = addr;
  66. lcd_dma.data_type = data_type;
  67. lcd_dma.xres = fb_xres;
  68. lcd_dma.yres = fb_yres;
  69. }
  70. EXPORT_SYMBOL(omap_set_lcd_dma_b1);
  71. void omap_set_lcd_dma_ext_controller(int external)
  72. {
  73. lcd_dma.ext_ctrl = external;
  74. }
  75. EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
  76. void omap_set_lcd_dma_single_transfer(int single)
  77. {
  78. lcd_dma.single_transfer = single;
  79. }
  80. EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
  81. void omap_set_lcd_dma_b1_rotation(int rotate)
  82. {
  83. if (cpu_is_omap15xx()) {
  84. printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n");
  85. BUG();
  86. return;
  87. }
  88. lcd_dma.rotate = rotate;
  89. }
  90. EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
  91. void omap_set_lcd_dma_b1_mirror(int mirror)
  92. {
  93. if (cpu_is_omap15xx()) {
  94. printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n");
  95. BUG();
  96. }
  97. lcd_dma.mirror = mirror;
  98. }
  99. EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
  100. void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
  101. {
  102. if (cpu_is_omap15xx()) {
  103. pr_err("DMA virtual resolution is not supported in 1510 mode\n");
  104. BUG();
  105. }
  106. lcd_dma.vxres = vxres;