mdfld_tpo_vid.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright © 2010 Intel Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. * DEALINGS IN THE SOFTWARE.
  22. *
  23. * Authors:
  24. * jim liu <jim.liu@intel.com>
  25. * Jackie Li<yaodong.li@intel.com>
  26. */
  27. #include "mdfld_dsi_dpi.h"
  28. static struct drm_display_mode *tpo_vid_get_config_mode(struct drm_device *dev)
  29. {
  30. struct drm_display_mode *mode;
  31. mode = kzalloc(sizeof(*mode), GFP_KERNEL);
  32. if (!mode)
  33. return NULL;
  34. mode->hdisplay = 864;
  35. mode->vdisplay = 480;
  36. mode->hsync_start = 873;
  37. mode->hsync_end = 876;
  38. mode->htotal = 887;
  39. mode->vsync_start = 487;
  40. mode->vsync_end = 490;
  41. mode->vtotal = 499;
  42. mode->clock = 33264;
  43. drm_mode_set_name(mode);
  44. drm_mode_set_crtcinfo(mode, 0);
  45. mode->type |= DRM_MODE_TYPE_PREFERRED;
  46. return mode;
  47. }
  48. static int tpo_vid_get_panel_info(struct drm_device *dev,
  49. int pipe,
  50. struct panel_info *pi)
  51. {
  52. if (!dev || !pi)
  53. return -EINVAL;
  54. pi->width_mm = TPO_PANEL_WIDTH;
  55. pi->height_mm = TPO_PANEL_HEIGHT;
  56. return 0;
  57. }
  58. /*TPO DPI encoder helper funcs*/
  59. static const struct drm_encoder_helper_funcs
  60. mdfld_tpo_dpi_encoder_helper_funcs = {
  61. .dpms = mdfld_dsi_dpi_dpms,
  62. .mode_fixup = mdfld_dsi_dpi_mode_fixup,
  63. .prepare = mdfld_dsi_dpi_prepare,
  64. .mode_set = mdfld_dsi_dpi_mode_set,
  65. .commit = mdfld_dsi_dpi_commit,
  66. };
  67. const struct panel_funcs mdfld_tpo_vid_funcs = {
  68. .encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
  69. .get_config_mode = &tpo_vid_get_config_mode,
  70. .get_panel_info = tpo_vid_get_panel_info,
  71. };