msm_connector.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (C) 2013 Red Hat
  3. * Author: Rob Clark <robdclark@gmail.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. #ifndef __MSM_CONNECTOR_H__
  18. #define __MSM_CONNECTOR_H__
  19. #include "msm_drv.h"
  20. /*
  21. * Base class for MSM connectors. Typically a connector is a bit more
  22. * passive. But with the split between (for example) DTV within MDP4,
  23. * and HDMI encoder, we really need two parts to an encoder. Instead
  24. * what we do is have the part external to the display controller block
  25. * in the connector, which is called from the encoder to delegate the
  26. * appropriate parts of modeset.
  27. */
  28. struct msm_connector;
  29. struct msm_connector_funcs {
  30. void (*dpms)(struct msm_connector *connector, int mode);
  31. void (*mode_set)(struct msm_connector *connector,
  32. struct drm_display_mode *mode);
  33. };
  34. struct msm_connector {
  35. struct drm_connector base;
  36. struct drm_encoder *encoder;
  37. const struct msm_connector_funcs *funcs;
  38. };
  39. #define to_msm_connector(x) container_of(x, struct msm_connector, base)
  40. void msm_connector_init(struct msm_connector *connector,
  41. const struct msm_connector_funcs *funcs,
  42. struct drm_encoder *encoder);
  43. struct drm_encoder *msm_connector_attached_encoder(
  44. struct drm_connector *connector);
  45. static inline struct msm_connector *get_connector(struct drm_encoder *encoder)
  46. {
  47. struct msm_drm_private *priv = encoder->dev->dev_private;
  48. int i;
  49. for (i = 0; i < priv->num_connectors; i++) {
  50. struct drm_connector *connector = priv->connectors[i];
  51. if (msm_connector_attached_encoder(connector) == encoder)
  52. return to_msm_connector(connector);
  53. }
  54. return NULL;
  55. }
  56. #endif /* __MSM_CONNECTOR_H__ */