]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
greybus: interface: Extract and store Interface feature byte
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Sun, 15 May 2016 18:37:49 +0000 (19:37 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Sun, 15 May 2016 18:39:57 +0000 (11:39 -0700)
The Interface description in the Greybus specification contains a
'features' field which is currently not implemented on the AP side. The
Interface features field provides information on optional attributes of an
Interface as a bitmask. Currently only GREYBUS_INTERFACE_FEATURE_TIMESYNC
is implemented in the specification but, the expectation is that other
feature flags will be added over time.

This patch adds support to extract the feature byte communicated in the
features field of the Interface Descriptor header and extends struct
interface to contain a features field through which any user with a pointer
to struct interface may interrogate the features of an Interface.

This is a necessary pre-cursor for TimeSync to ensure only Interfaces which
declare GREYBUS_INTERFACE_FEATURE_TIMESYNC will be included when we go
through the process of FrameTime synchronization.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_manifest.h
drivers/staging/greybus/interface.h
drivers/staging/greybus/manifest.c

index 4f70190116426441d091f193fb6ef39ad9efed55..28bbadd057d1d8b531736e696aeb0d3298d2cb3f 100644 (file)
@@ -81,6 +81,10 @@ enum greybus_class_type {
        GREYBUS_CLASS_VENDOR            = 0xff,
 };
 
+enum {
+       GREYBUS_INTERFACE_FEATURE_TIMESYNC = BIT(0),
+};
+
 /*
  * The string in a string descriptor is not NUL-terminated.  The
  * size of the descriptor will be rounded up to a multiple of 4
@@ -99,7 +103,8 @@ struct greybus_descriptor_string {
 struct greybus_descriptor_interface {
        __u8    vendor_stringid;
        __u8    product_stringid;
-       __u8    pad[2];
+       __u8    features;
+       __u8    pad;
 } __packed;
 
 /*
index 1a25234351e2e92ef6cc4094fea3d061c9c50526..51772ccdd467be65a5b9b5143d0af71737f28598 100644 (file)
@@ -23,6 +23,7 @@ struct gb_interface {
        struct list_head manifest_descs;
        u8 interface_id;        /* Physical location within the Endo */
        u8 device_id;
+       u8 features;            /* Feature flags set in the manifest */
 
        u32 ddbl1_manufacturer_id;
        u32 ddbl1_product_id;
index 886c5fb91d9f427bc02697a9c3c8043ad539f800..529a984db99235a0ceab34e7c50a15615fa26a7e 100644 (file)
@@ -398,6 +398,9 @@ static bool gb_manifest_parse_interface(struct gb_interface *intf,
                goto out_free_vendor_string;
        control->product_string = str;
 
+       /* Assign feature flags communicated via manifest */
+       intf->features = desc_intf->features;
+
        /* Release the interface descriptor, now that we're done with it */
        release_manifest_descriptor(interface_desc);