dm: key: add key type and key name interface
Change-Id: Ifd054c609d92557b15acb8e53580dddd72325ff8 Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
f1f9ed8232
commit
6e14addfbc
|
|
@ -17,6 +17,26 @@ int key_read(struct udevice *dev)
|
||||||
return ops->read(dev);
|
return ops->read(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int key_type(struct udevice *dev)
|
||||||
|
{
|
||||||
|
const struct dm_key_ops *ops = dev_get_driver_ops(dev);
|
||||||
|
|
||||||
|
if (!ops || !ops->type)
|
||||||
|
return -ENOSYS;
|
||||||
|
|
||||||
|
return ops->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *key_name(struct udevice *dev)
|
||||||
|
{
|
||||||
|
const struct dm_key_ops *ops = dev_get_driver_ops(dev);
|
||||||
|
|
||||||
|
if (!ops || !ops->name)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return ops->name;
|
||||||
|
}
|
||||||
|
|
||||||
UCLASS_DRIVER(key) = {
|
UCLASS_DRIVER(key) = {
|
||||||
.id = UCLASS_KEY,
|
.id = UCLASS_KEY,
|
||||||
.name = "key",
|
.name = "key",
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,13 @@ enum key_state {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dm_key_ops {
|
struct dm_key_ops {
|
||||||
|
int type;
|
||||||
|
const char *name;
|
||||||
int (*read)(struct udevice *dev);
|
int (*read)(struct udevice *dev);
|
||||||
};
|
};
|
||||||
|
|
||||||
int key_read(struct udevice *dev);
|
int key_read(struct udevice *dev);
|
||||||
|
int key_type(struct udevice *dev);
|
||||||
|
const char *key_label(struct udevice *dev);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue