Commit 548ddb6d authored by Ben Skeggs's avatar Ben Skeggs

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: default avatarBen Skeggs <bskeggs@redhat.com>
parent 31a34aa4
...@@ -16,7 +16,7 @@ struct nouveau_i2c_port { ...@@ -16,7 +16,7 @@ struct nouveau_i2c_port {
struct i2c_algo_bit_data bit; struct i2c_algo_bit_data bit;
struct list_head head; struct list_head head;
u8 index; u8 index;
u8 type; u16 type;
u32 dcb; u32 dcb;
u32 drive; u32 drive;
u32 sense; u32 sense;
...@@ -29,6 +29,7 @@ struct nouveau_i2c { ...@@ -29,6 +29,7 @@ struct nouveau_i2c {
struct nouveau_subdev base; struct nouveau_subdev base;
struct nouveau_i2c_port *(*find)(struct nouveau_i2c *, u8 index); struct nouveau_i2c_port *(*find)(struct nouveau_i2c *, u8 index);
struct nouveau_i2c_port *(*find_type)(struct nouveau_i2c *, u16 type);
int (*identify)(struct nouveau_i2c *, int index, int (*identify)(struct nouveau_i2c *, int index,
const char *what, struct i2c_board_info *, const char *what, struct i2c_board_info *,
bool (*match)(struct nouveau_i2c_port *, bool (*match)(struct nouveau_i2c_port *,
......
...@@ -109,6 +109,19 @@ nouveau_i2c_find(struct nouveau_i2c *i2c, u8 index) ...@@ -109,6 +109,19 @@ nouveau_i2c_find(struct nouveau_i2c *i2c, u8 index)
return NULL; return NULL;
} }
static struct nouveau_i2c_port *
nouveau_i2c_find_type(struct nouveau_i2c *i2c, u16 type)
{
struct nouveau_i2c_port *port;
list_for_each_entry(port, &i2c->ports, head) {
if (port->type == type)
return port;
}
return NULL;
}
static int static int
nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what, nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what,
struct i2c_board_info *info, struct i2c_board_info *info,
...@@ -264,6 +277,7 @@ nouveau_i2c_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -264,6 +277,7 @@ nouveau_i2c_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return ret; return ret;
i2c->find = nouveau_i2c_find; i2c->find = nouveau_i2c_find;
i2c->find_type = nouveau_i2c_find_type;
i2c->identify = nouveau_i2c_identify; i2c->identify = nouveau_i2c_identify;
INIT_LIST_HEAD(&i2c->ports); INIT_LIST_HEAD(&i2c->ports);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment