]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/gpu/drm/msm/hdmi/hdmi.h
drm/msm: convert to drm_bridge
[karo-tx-linux.git] / drivers / gpu / drm / msm / hdmi / hdmi.h
index 34703fea22caa5f6e8f00adfc59c9f7bab384ae9..2c2ec566394c7ac314c9bf3e97b70071bfce4d48 100644 (file)
@@ -30,6 +30,8 @@
 struct hdmi_phy;
 
 struct hdmi {
+       struct kref refcount;
+
        struct drm_device *dev;
        struct platform_device *pdev;
 
@@ -45,6 +47,10 @@ struct hdmi {
        struct hdmi_phy *phy;
        struct i2c_adapter *i2c;
        struct drm_connector *connector;
+       struct drm_bridge *bridge;
+
+       /* the encoder we are hooked to (outside of hdmi block) */
+       struct drm_encoder *encoder;
 
        bool hdmi_mode;               /* are we in hdmi mode? */
 
@@ -58,9 +64,7 @@ struct hdmi_platform_config {
 };
 
 void hdmi_set_mode(struct hdmi *hdmi, bool power_on);
-void hdmi_destroy(struct hdmi *hdmi);
-int hdmi_init(struct hdmi *hdmi, struct drm_device *dev,
-               struct drm_connector *connector);
+void hdmi_destroy(struct kref *kref);
 
 static inline void hdmi_write(struct hdmi *hdmi, u32 reg, u32 data)
 {
@@ -72,6 +76,17 @@ static inline u32 hdmi_read(struct hdmi *hdmi, u32 reg)
        return msm_readl(hdmi->mmio + reg);
 }
 
+static inline struct hdmi * hdmi_reference(struct hdmi *hdmi)
+{
+       kref_get(&hdmi->refcount);
+       return hdmi;
+}
+
+static inline void hdmi_unreference(struct hdmi *hdmi)
+{
+       kref_put(&hdmi->refcount, hdmi_destroy);
+}
+
 /*
  * The phy appears to be different, for example between 8960 and 8x60,
  * so split the phy related functions out and load the correct one at
@@ -89,17 +104,21 @@ struct hdmi_phy {
        const struct hdmi_phy_funcs *funcs;
 };
 
-/*
- * phy can be different on different generations:
- */
 struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi);
 struct hdmi_phy *hdmi_phy_8x60_init(struct hdmi *hdmi);
 
+/*
+ * hdmi bridge:
+ */
+
+struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi);
+
 /*
  * hdmi connector:
  */
 
 void hdmi_connector_irq(struct drm_connector *connector);
+struct drm_connector *hdmi_connector_init(struct hdmi *hdmi);
 
 /*
  * i2c adapter for ddc: