output.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
  3. * Author: Archit Taneja <archit@ti.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published by
  7. * the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/module.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/slab.h>
  21. #include <linux/of.h>
  22. #include "dss.h"
  23. #include "omapdss.h"
  24. int omapdss_output_validate(struct omap_dss_device *out)
  25. {
  26. if (out->next && out->output_type != out->next->type) {
  27. dev_err(out->dev, "output type and display type don't match\n");
  28. return -EINVAL;
  29. }
  30. return 0;
  31. }
  32. EXPORT_SYMBOL(omapdss_output_validate);
  33. int dss_install_mgr_ops(struct dss_device *dss,
  34. const struct dss_mgr_ops *mgr_ops,
  35. struct omap_drm_private *priv)
  36. {
  37. if (dss->mgr_ops)
  38. return -EBUSY;
  39. dss->mgr_ops = mgr_ops;
  40. dss->mgr_ops_priv = priv;
  41. return 0;
  42. }
  43. EXPORT_SYMBOL(dss_install_mgr_ops);
  44. void dss_uninstall_mgr_ops(struct dss_device *dss)
  45. {
  46. dss->mgr_ops = NULL;
  47. dss->mgr_ops_priv = NULL;
  48. }
  49. EXPORT_SYMBOL(dss_uninstall_mgr_ops);
  50. void dss_mgr_set_timings(struct omap_dss_device *dssdev,
  51. const struct videomode *vm)
  52. {
  53. dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
  54. dssdev->dispc_channel, vm);
  55. }
  56. EXPORT_SYMBOL(dss_mgr_set_timings);
  57. void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
  58. const struct dss_lcd_mgr_config *config)
  59. {
  60. dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
  61. dssdev->dispc_channel, config);
  62. }
  63. EXPORT_SYMBOL(dss_mgr_set_lcd_config);
  64. int dss_mgr_enable(struct omap_dss_device *dssdev)
  65. {
  66. return dssdev->dss->mgr_ops->enable(dssdev->dss->mgr_ops_priv,
  67. dssdev->dispc_channel);
  68. }
  69. EXPORT_SYMBOL(dss_mgr_enable);
  70. void dss_mgr_disable(struct omap_dss_device *dssdev)
  71. {
  72. dssdev->dss->mgr_ops->disable(dssdev->dss->mgr_ops_priv,
  73. dssdev->dispc_channel);
  74. }
  75. EXPORT_SYMBOL(dss_mgr_disable);
  76. void dss_mgr_start_update(struct omap_dss_device *dssdev)
  77. {
  78. dssdev->dss->mgr_ops->start_update(dssdev->dss->mgr_ops_priv,
  79. dssdev->dispc_channel);
  80. }
  81. EXPORT_SYMBOL(dss_mgr_start_update);
  82. int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
  83. void (*handler)(void *), void *data)
  84. {
  85. struct dss_device *dss = dssdev->dss;
  86. return dss->mgr_ops->register_framedone_handler(dss->mgr_ops_priv,
  87. dssdev->dispc_channel,
  88. handler, data);
  89. }
  90. EXPORT_SYMBOL(dss_mgr_register_framedone_handler);
  91. void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
  92. void (*handler)(void *), void *data)
  93. {
  94. struct dss_device *dss = dssdev->dss;
  95. dss->mgr_ops->unregister_framedone_handler(dss->mgr_ops_priv,
  96. dssdev->dispc_channel,
  97. handler, data);
  98. }
  99. EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler);