aboutsummaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorGreg Hackmann <ghackmann@google.com>2013-09-13 11:23:05 -0700
committerGreg Hackmann <ghackmann@google.com>2013-10-11 16:50:31 -0700
commit27e7183c5aa432bfd6a99e6164761eae3917748b (patch)
treeb5f63767edc7e9b785cec603aa572414b623a409 /drivers/video
parentf9309086600f7689b61f38bb53ac00e45bb45f8f (diff)
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>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/adf/adf.c12
-rw-r--r--drivers/video/adf/adf_fops.c1
-rw-r--r--drivers/video/adf/adf_fops32.c2
-rw-r--r--drivers/video/adf/adf_fops32.h1
4 files changed, 15 insertions, 1 deletions
diff --git a/drivers/video/adf/adf.c b/drivers/video/adf/adf.c
index 15fbc4a0d53..79511759d2a 100644
--- a/drivers/video/adf/adf.c
+++ b/drivers/video/adf/adf.c
@@ -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);
diff --git a/drivers/video/adf/adf_fops.c b/drivers/video/adf/adf_fops.c
index 343bdcc7744..abec58ea2ed 100644
--- a/drivers/video/adf/adf_fops.c
+++ b/drivers/video/adf/adf_fops.c
@@ -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);
diff --git a/drivers/video/adf/adf_fops32.c b/drivers/video/adf/adf_fops32.c
index 2ecf8c8001f..60a47cf5a78 100644
--- a/drivers/video/adf/adf_fops32.c
+++ b/drivers/video/adf/adf_fops32.c
@@ -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,
diff --git a/drivers/video/adf/adf_fops32.h b/drivers/video/adf/adf_fops32.h
index 8d0413274bc..18c673dc5e2 100644
--- a/drivers/video/adf/adf_fops32.h
+++ b/drivers/video/adf/adf_fops32.h
@@ -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;