video: tegra: dc: add ddcci i2c client
Marvin Zhang [Fri, 21 Aug 2015 19:59:32 +0000 (12:59 -0700)]
bug 1637861

Change-Id: I4ee264421986cafcd00dab855fcea283465d9caa
Signed-off-by: Marvin Zhang <mzhang@nvidia.com>
Reviewed-on: http://git-master/r/810589
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Daniel Solomon <daniels@nvidia.com>
Tested-by: Daniel Solomon <daniels@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mitch Luban <mluban@nvidia.com>

drivers/video/tegra/dc/hdmi2.0.c
drivers/video/tegra/dc/hdmi2.0.h

index 1652b08..7d5ca05 100644 (file)
@@ -836,11 +836,38 @@ static int tegra_hdmi_vrr_init(struct tegra_hdmi *hdmi)
 {
        struct tegra_dc *dc = hdmi->dc;
        struct tegra_vrr *vrr  = dc->out->vrr;
+       struct i2c_adapter *i2c_adap;
+       int err = 0;
+       struct i2c_board_info i2c_dev_info = {
+               .type = "tegra_hdmi_ddcci",
+               .addr = 0x37,
+       };
 
-       if (!vrr || !vrr->capability)
-               return -EINVAL;
+       if (!vrr || !vrr->capability) {
+               err = -EINVAL;
+               goto fail;
+       }
 
-       return 0;
+       i2c_adap = i2c_get_adapter(dc->out->ddc_bus);
+       if (!i2c_adap) {
+               dev_err(&dc->ndev->dev,
+                       "hdmi: can't get adpater for ddcci bus %d\n",
+                       dc->out->ddc_bus);
+               err = -EBUSY;
+               goto fail;
+       }
+
+       hdmi->ddcci_i2c_client = i2c_new_device(i2c_adap, &i2c_dev_info);
+       i2c_put_adapter(i2c_adap);
+       if (!hdmi->ddcci_i2c_client) {
+               dev_err(&dc->ndev->dev,
+                       "hdmi: can't create ddcci i2c device\n");
+               err = -EBUSY;
+               goto fail;
+       }
+
+fail:
+       return err;
 }
 
 static int tegra_hdmi_tmds_init(struct tegra_hdmi *hdmi)
index 41f00bf..005d043 100644 (file)
@@ -362,6 +362,8 @@ struct tegra_hdmi {
        struct i2c_client *scdc_i2c_client;
        struct delayed_work scdc_work;
 
+       struct i2c_client *ddcci_i2c_client;
+
        struct hdmi_audio_infoframe audio;
 #ifdef CONFIG_SWITCH
        struct switch_dev hpd_switch;