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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* linux/drivers/media/video/samsung/tv20/ddc.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - ddc interface file for Samsung TVOut driver
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/i2c.h>
15
16 #define I2C_DRIVERID_S5P_HDCP 510
17 #define S5P_HDCP_I2C_ADDR 0x74
18
19 const static u16 ignore[] = { I2C_CLIENT_END };
20 const static u16 normal_addr[] = {
21 (S5P_HDCP_I2C_ADDR >> 1),
22 I2C_CLIENT_END
23 };
24
25 const static u16 *forces[] = { NULL };
26
27 static struct i2c_client_address_data ddc_addr = {
28 .normal_i2c = normal_addr,
29 .probe = ignore,
30 .ignore = ignore,
31 .forces = forces,
32 };
33
34 struct i2c_client *ddc_port;
35
36 int ddc_read(u8 subaddr, u8 *data, u16 len)
37 {
38 u8 addr = subaddr;
39 int ret = 0;
40
41 struct i2c_msg msg[] = {
42 [0] = {
43 .addr = ddc_port->addr,
44 .flags = 0,
45 .len = 1,
46 .buf = &addr
47 },
48 [1] = {
49 .addr = ddc_port->addr,
50 .flags = I2C_M_RD,
51 .len = len,
52 .buf = data
53 }
54 };
55
56 if (i2c_transfer(ddc_port->adapter, msg, 2) != 2)
57 ret = -EIO;
58
59 return ret;
60 }
61
62
63 int ddc_write(u8 *data, u16 len)
64 {
65 int ret = 0;
66
67 if (i2c_master_send(ddc_port, (const char *) data, len) != len)
68 ret = -EIO;
69
70 return ret;
71 }
72
73 static int __devinit ddc_probe(struct i2c_client *client,
74 const struct i2c_device_id *dev_id)
75 {
76 int ret = 0;
77
78 ddc_port = client;
79
80 dev_info(&client->adapter->dev, "attached s5p_ddc "
81 "into i2c adapter successfully\n");
82
83 return ret;
84 }
85
86 static int ddc_remove(struct i2c_client *client)
87 {
88 dev_info(&client->adapter->dev, "detached s5p_ddc "
89 "from i2c adapter successfully\n");
90
91 return 0;
92 }
93
94 static int ddc_suspend(struct i2c_client *cl, pm_message_t mesg)
95 {
96 return 0;
97 };
98
99 static int ddc_resume(struct i2c_client *cl)
100 {
101 return 0;
102 };
103
104 static struct i2c_device_id ddc_idtable[] = {
105 {"s5p_ddc", 0},
106 };
107
108 MODULE_DEVICE_TABLE(i2c, ddc_idtable);
109
110 static struct i2c_driver ddc_driver = {
111 .driver = {
112 .name = "s5p_ddc",
113 },
114 /* Removed id member due to the change of i2c_driver structure of i2c.h */
115 /* .id = I2C_DRIVERID_S5P_HDCP,*/
116 .id_table = ddc_idtable,
117 .probe = ddc_probe,
118 .remove = __devexit_p(ddc_remove),
119 .address_data = &ddc_addr,
120
121 .suspend = ddc_suspend,
122 .resume = ddc_resume,
123 };
124
125 static int __init ddc_init(void)
126 {
127 return i2c_add_driver(&ddc_driver);
128 }
129
130 static void __exit ddc_exit(void)
131 {
132 i2c_del_driver(&ddc_driver);
133 }
134
135 MODULE_AUTHOR("SangPil Moon <sangpil.moon@samsung.com>");
136 MODULE_DESCRIPTION("Driver for SMDKV210 I2C DDC devices");
137
138 MODULE_LICENSE("GPL");
139
140 module_init(ddc_init);
141 module_exit(ddc_exit);
OLDNEW
« 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