[PATCH v1 05/19] drm: sti: add I2C client driver for HDMI

Benjamin Gaignard benjamin.gaignard at linaro.org
Tue Apr 8 05:19:12 PDT 2014


Add I2C client driver to retrieve EDID.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard at linaro.org>
Signed-off-by: Vincent Abriou <vincent.abriou at st.com>
Signed-off-by: Fabien Dessenne <fabien.dessenne at st.com>
---
 drivers/gpu/drm/sti/Makefile  |  3 ++-
 drivers/gpu/drm/sti/sti_ddc.c | 56 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/sti/sti_ddc.c

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index 2bb3035..b6f596a 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -2,7 +2,8 @@ ccflags-y := -Iinclude/drm
 
 stidrm-y := sti_hdmi.o \
 	sti_hdmi_tx3g0c55phy.o \
-	sti_hdmi_tx3g4c28phy.o
+	sti_hdmi_tx3g4c28phy.o \
+	sti_ddc.o
 
 obj-$(CONFIG_DRM_STI) += stidrm.o
 obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
diff --git a/drivers/gpu/drm/sti/sti_ddc.c b/drivers/gpu/drm/sti/sti_ddc.c
new file mode 100644
index 0000000..147a704
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_ddc.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard <benjamin.gaignard at st.com> for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+#include <drm/drmP.h>
+
+#include <linux/kernel.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+
+#include "sti_hdmi.h"
+
+static int sti_hdmi_ddc_probe(struct i2c_client *client,
+			      const struct i2c_device_id *dev_id)
+{
+	sti_hdmi_attach_ddc_client(client);
+
+	DRM_INFO("%s attached %s into i2c adapter successfully\n",
+		 __func__, client->name);
+
+	return 0;
+}
+
+static int sti_hdmi_ddc_remove(struct i2c_client *client)
+{
+	DRM_INFO("%s detached %s from i2c adapter successfully\n",
+		 __func__, client->name);
+
+	return 0;
+}
+
+static struct i2c_device_id sti_ddc_idtable[] = {
+	{"sti-hdmiddc", 0},
+	{},
+};
+
+static struct of_device_id hdmiddc_match_types[] = {
+	{
+	 .compatible = "st,sti-hdmiddc",
+	 }, {
+	     /* end node */
+	     }
+};
+
+struct i2c_driver ddc_driver = {
+	.driver = {
+		   .name = "sti-hdmiddc",
+		   .owner = THIS_MODULE,
+		   .of_match_table = of_match_ptr(hdmiddc_match_types),
+		   },
+	.id_table = sti_ddc_idtable,
+	.probe = sti_hdmi_ddc_probe,
+	.remove = sti_hdmi_ddc_remove,
+	.command = NULL,
+};
-- 
1.9.0



More information about the dri-devel mailing list