Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: drivers/media/video/samsung/tv20/ddc.c

Issue 2036011: V4L/DVB : Add S5PV210 TV out driver support (Closed) Base URL: swsolcc@12.23.106.100:kernel-samsung.git
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « drivers/media/video/samsung/tv20/ddc.h ('k') | drivers/media/video/samsung/tv20/hdcp_s5pv210.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: drivers/media/video/samsung/tv20/ddc.c
diff --git a/drivers/media/video/samsung/tv20/ddc.c b/drivers/media/video/samsung/tv20/ddc.c
new file mode 100644
index 0000000000000000000000000000000000000000..6fb861865b0c6575f29910aec5c766ffc626efb0
--- /dev/null
+++ b/drivers/media/video/samsung/tv20/ddc.c
@@ -0,0 +1,141 @@
+/* linux/drivers/media/video/samsung/tv20/ddc.c
+*
+* Copyright (c) 2010 Samsung Electronics Co., Ltd.
+* http://www.samsung.com/
+*
+* S5PV210 - ddc interface file for Samsung TVOut driver
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2 as
+* published by the Free Software Foundation.
+*/
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/i2c.h>
+
+#define I2C_DRIVERID_S5P_HDCP 510
+#define S5P_HDCP_I2C_ADDR 0x74
+
+const static u16 ignore[] = { I2C_CLIENT_END };
+const static u16 normal_addr[] = {
+ (S5P_HDCP_I2C_ADDR >> 1),
+ I2C_CLIENT_END
+};
+
+const static u16 *forces[] = { NULL };
+
+static struct i2c_client_address_data ddc_addr = {
+ .normal_i2c = normal_addr,
+ .probe = ignore,
+ .ignore = ignore,
+ .forces = forces,
+};
+
+struct i2c_client *ddc_port;
+
+int ddc_read(u8 subaddr, u8 *data, u16 len)
+{
+ u8 addr = subaddr;
+ int ret = 0;
+
+ struct i2c_msg msg[] = {
+ [0] = {
+ .addr = ddc_port->addr,
+ .flags = 0,
+ .len = 1,
+ .buf = &addr
+ },
+ [1] = {
+ .addr = ddc_port->addr,
+ .flags = I2C_M_RD,
+ .len = len,
+ .buf = data
+ }
+ };
+
+ if (i2c_transfer(ddc_port->adapter, msg, 2) != 2)
+ ret = -EIO;
+
+ return ret;
+}
+
+
+int ddc_write(u8 *data, u16 len)
+{
+ int ret = 0;
+
+ if (i2c_master_send(ddc_port, (const char *) data, len) != len)
+ ret = -EIO;
+
+ return ret;
+}
+
+static int __devinit ddc_probe(struct i2c_client *client,
+ const struct i2c_device_id *dev_id)
+{
+ int ret = 0;
+
+ ddc_port = client;
+
+ dev_info(&client->adapter->dev, "attached s5p_ddc "
+ "into i2c adapter successfully\n");
+
+ return ret;
+}
+
+static int ddc_remove(struct i2c_client *client)
+{
+ dev_info(&client->adapter->dev, "detached s5p_ddc "
+ "from i2c adapter successfully\n");
+
+ return 0;
+}
+
+static int ddc_suspend(struct i2c_client *cl, pm_message_t mesg)
+{
+ return 0;
+};
+
+static int ddc_resume(struct i2c_client *cl)
+{
+ return 0;
+};
+
+static struct i2c_device_id ddc_idtable[] = {
+ {"s5p_ddc", 0},
+};
+
+MODULE_DEVICE_TABLE(i2c, ddc_idtable);
+
+static struct i2c_driver ddc_driver = {
+ .driver = {
+ .name = "s5p_ddc",
+ },
+/* Removed id member due to the change of i2c_driver structure of i2c.h */
+/* .id = I2C_DRIVERID_S5P_HDCP,*/
+ .id_table = ddc_idtable,
+ .probe = ddc_probe,
+ .remove = __devexit_p(ddc_remove),
+ .address_data = &ddc_addr,
+
+ .suspend = ddc_suspend,
+ .resume = ddc_resume,
+};
+
+static int __init ddc_init(void)
+{
+ return i2c_add_driver(&ddc_driver);
+}
+
+static void __exit ddc_exit(void)
+{
+ i2c_del_driver(&ddc_driver);
+}
+
+MODULE_AUTHOR("SangPil Moon <sangpil.moon@samsung.com>");
+MODULE_DESCRIPTION("Driver for SMDKV210 I2C DDC devices");
+
+MODULE_LICENSE("GPL");
+
+module_init(ddc_init);
+module_exit(ddc_exit);
« no previous file with comments | « drivers/media/video/samsung/tv20/ddc.h ('k') | drivers/media/video/samsung/tv20/hdcp_s5pv210.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698