aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2013-02-15 22:19:18 -0500
committerBen Skeggs <bskeggs@redhat.com>2013-02-20 01:00:59 -0500
commit548ddb6dec9964fc9c0812409f3e105b07324c4f (patch)
tree9deda89de5a975ffe2bdf52ec76b052185016ef9 /drivers/gpu/drm
parent31a34aa421032cfe3b2b892c929e7539e747a7ac (diff)
drm/nouveau/i2c: extend type to 16-bits, add lookup-by-type function
For off-chip transmitters we won't necessarily have an i2c table entry to lookup, but we can do it instead by encoding the type to include the extdev type and looking that up instead. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/i2c.h3
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/i2c/base.c14
2 files changed, 16 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h b/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h
index d2c067a794aa..a8043178f926 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h
@@ -16,7 +16,7 @@ struct nouveau_i2c_port {
16 struct i2c_algo_bit_data bit; 16 struct i2c_algo_bit_data bit;
17 struct list_head head; 17 struct list_head head;
18 u8 index; 18 u8 index;
19 u8 type; 19 u16 type;
20 u32 dcb; 20 u32 dcb;
21 u32 drive; 21 u32 drive;
22 u32 sense; 22 u32 sense;
@@ -29,6 +29,7 @@ struct nouveau_i2c {
29 struct nouveau_subdev base; 29 struct nouveau_subdev base;
30 30
31 struct nouveau_i2c_port *(*find)(struct nouveau_i2c *, u8 index); 31 struct nouveau_i2c_port *(*find)(struct nouveau_i2c *, u8 index);
32 struct nouveau_i2c_port *(*find_type)(struct nouveau_i2c *, u16 type);
32 int (*identify)(struct nouveau_i2c *, int index, 33 int (*identify)(struct nouveau_i2c *, int index,
33 const char *what, struct i2c_board_info *, 34 const char *what, struct i2c_board_info *,
34 bool (*match)(struct nouveau_i2c_port *, 35 bool (*match)(struct nouveau_i2c_port *,
diff --git a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
index bc8ec7ace9d1..6ab51d3b3016 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
@@ -109,6 +109,19 @@ nouveau_i2c_find(struct nouveau_i2c *i2c, u8 index)
109 return NULL; 109 return NULL;
110} 110}
111 111
112static struct nouveau_i2c_port *
113nouveau_i2c_find_type(struct nouveau_i2c *i2c, u16 type)
114{
115 struct nouveau_i2c_port *port;
116
117 list_for_each_entry(port, &i2c->ports, head) {
118 if (port->type == type)
119 return port;
120 }
121
122 return NULL;
123}
124
112static int 125static int
113nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what, 126nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what,
114 struct i2c_board_info *info, 127 struct i2c_board_info *info,
@@ -264,6 +277,7 @@ nouveau_i2c_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
264 return ret; 277 return ret;
265 278
266 i2c->find = nouveau_i2c_find; 279 i2c->find = nouveau_i2c_find;
280 i2c->find_type = nouveau_i2c_find_type;
267 i2c->identify = nouveau_i2c_identify; 281 i2c->identify = nouveau_i2c_identify;
268 INIT_LIST_HEAD(&i2c->ports); 282 INIT_LIST_HEAD(&i2c->ports);
269 283