video: adf: add informational flags to interfaces

Informational flags don't affect ADF directly but may be useful to
clients.  Currently used to indicate primary and external displays.

Change-Id: I343c7f0148da0869244c8e818350e9855525df85
Signed-off-by: Greg Hackmann <ghackmann@google.com>
This commit is contained in:
Greg Hackmann
2013-09-13 11:23:05 -07:00
committed by John Stultz
parent 4b3bd37bd9
commit e45fc30f3e
6 changed files with 23 additions and 3 deletions

View File

@@ -625,6 +625,7 @@ EXPORT_SYMBOL(adf_device_destroy);
* @type: interface type (see enum @adf_interface_type)
* @idx: which interface of type @type;
* e.g. interface DSI.1 -> @type=%ADF_INTF_TYPE_DSI, @idx=1
* @flags: informational flags (bitmask of %ADF_INTF_FLAG_* values)
* @ops: the interface's associated ops
* @fmt: formatting string for the display interface's name
*
@@ -637,11 +638,13 @@ EXPORT_SYMBOL(adf_device_destroy);
* Returns 0 on success or error code (<0) on failure.
*/
int adf_interface_init(struct adf_interface *intf, struct adf_device *dev,
enum adf_interface_type type, u32 idx,
enum adf_interface_type type, u32 idx, u32 flags,
const struct adf_interface_ops *ops, const char *fmt, ...)
{
int ret;
va_list args;
const u32 allowed_flags = ADF_INTF_FLAG_PRIMARY |
ADF_INTF_FLAG_EXTERNAL;
if (dev->n_interfaces == ADF_MAX_INTERFACES) {
pr_err("%s: parent device %s has too many interfaces\n",
@@ -654,6 +657,12 @@ int adf_interface_init(struct adf_interface *intf, struct adf_device *dev,
return -EINVAL;
}
if (flags & ~allowed_flags) {
pr_err("%s: invalid interface flags 0x%X\n", __func__,
flags & ~allowed_flags);
return -EINVAL;
}
memset(intf, 0, sizeof(*intf));
va_start(args, fmt);
@@ -665,6 +674,7 @@ int adf_interface_init(struct adf_interface *intf, struct adf_device *dev,
intf->type = type;
intf->idx = idx;
intf->flags = flags;
intf->ops = ops;
init_waitqueue_head(&intf->vsync_wait);
rwlock_init(&intf->vsync_lock);

View File

@@ -570,6 +570,7 @@ static int adf_intf_get_data(struct adf_interface *intf,
data.type = intf->type;
data.id = intf->idx;
data.flags = intf->flags;
err = adf_interface_get_screen_size(intf, &data.width_mm,
&data.height_mm);

View File

@@ -130,6 +130,8 @@ long adf_compat_get_interface_data(struct file *file,
copy_in_user(&arg->type, &data->type,
sizeof(arg->type)) ||
copy_in_user(&arg->id, &data->id, sizeof(arg->id)) ||
copy_in_user(&arg->flags, &data->flags,
sizeof(arg->flags)) ||
copy_in_user(&arg->dpms_state, &data->dpms_state,
sizeof(arg->dpms_state)) ||
copy_in_user(&arg->hotplug_detect,

View File

@@ -47,6 +47,7 @@ struct adf_interface_data32 {
__u8 type;
__u32 id;
/* e.g. type=ADF_INTF_TYPE_DSI, id=1 => DSI.1 */
__u32 flags;
__u8 dpms_state;
__u8 hotplug_detect;

View File

@@ -36,6 +36,9 @@ enum adf_interface_type {
ADF_INTF_TYPE_MAX = (~(__u32)0),
};
#define ADF_INTF_FLAG_PRIMARY (1 << 0)
#define ADF_INTF_FLAG_EXTERNAL (1 << 1)
enum adf_event_type {
ADF_EVENT_VSYNC = 0,
ADF_EVENT_HOTPLUG = 1,
@@ -256,6 +259,7 @@ struct adf_interface_data {
__u32 type;
__u32 id;
/* e.g. type=ADF_INTF_TYPE_DSI, id=1 => DSI.1 */
__u32 flags;
__u8 dpms_state;
__u8 hotplug_detect;

View File

@@ -355,6 +355,7 @@ struct adf_interface {
enum adf_interface_type type;
u32 idx;
u32 flags;
wait_queue_head_t vsync_wait;
ktime_t vsync_timestamp;
@@ -405,9 +406,10 @@ int __printf(4, 5) adf_device_init(struct adf_device *dev,
struct device *parent, const struct adf_device_ops *ops,
const char *fmt, ...);
void adf_device_destroy(struct adf_device *dev);
int __printf(6, 7) adf_interface_init(struct adf_interface *intf,
int __printf(7, 8) adf_interface_init(struct adf_interface *intf,
struct adf_device *dev, enum adf_interface_type type, u32 idx,
const struct adf_interface_ops *ops, const char *fmt, ...);
u32 flags, const struct adf_interface_ops *ops, const char *fmt,
...);
void adf_interface_destroy(struct adf_interface *intf);
static inline struct adf_device *adf_interface_parent(
struct adf_interface *intf)