diff mbox

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

Message ID 1396959566-2960-6-git-send-email-benjamin.gaignard@linaro.org
State New
Headers show

Commit Message

Benjamin Gaignard April 8, 2014, 12:19 p.m. UTC
Add I2C client driver to retrieve EDID.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Fabien Dessenne <fabien.dessenne@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 mbox

Patch

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@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,
+};