greybus: svc: Add support for the link config operation
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 18 Dec 2015 19:23:22 +0000 (21:23 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 22 Dec 2015 00:34:46 +0000 (16:34 -0800)
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/svc.c
drivers/staging/greybus/svc.h

index 770a162e55f391dc73a660e2f9975da4a30d7b00..a50823c9fae3e4544ac87541b6d48cb303393632 100644 (file)
@@ -726,6 +726,7 @@ struct gb_spi_transfer_response {
 #define GB_SVC_TYPE_DME_PEER_SET       0x0a
 #define GB_SVC_TYPE_ROUTE_CREATE       0x0b
 #define GB_SVC_TYPE_ROUTE_DESTROY      0x0c
+#define GB_SVC_TYPE_LINK_CONFIG                0x0d
 
 /*
  * SVC version request/response has the same payload as
@@ -806,6 +807,20 @@ struct gb_svc_dme_peer_set_response {
        __le16  result_code;
 } __packed;
 
+#define GB_SVC_LINK_CONFIG_BURST_PWM           0
+#define GB_SVC_LINK_CONFIG_BURST_HS_A          1
+#define GB_SVC_LINK_CONFIG_BURST_HS_B          2
+#define GB_SVC_LINK_CONFIG_FLAG_AUTO_SLEEP     (1 << 0)
+
+struct gb_svc_link_config_request {
+       __u8 intf_id;
+       __u8 burst;
+       __u8 gear;
+       __u8 nlanes;
+       __u8 flags;
+} __packed;
+/* link config response has no payload */
+
 /* Attributes for peer get/set operations */
 #define DME_ATTR_SELECTOR_INDEX                0
 #define DME_ATTR_T_TST_SRC_INCREMENT   0x4083
index 5c4ca7938387f13ec0909f8b65a116f942e8583d..ff865b3b4825eefa7899a6397bc65b18e81a950b 100644 (file)
@@ -270,6 +270,24 @@ static void gb_svc_route_destroy(struct gb_svc *svc, u8 intf1_id, u8 intf2_id)
        }
 }
 
+/* Creates bi-directional routes between the devices */
+int gb_svc_link_config(struct gb_svc *svc, u8 intf_id,
+                      unsigned int burst, unsigned int gear,
+                      unsigned int nlanes, unsigned int flags)
+{
+       struct gb_svc_link_config_request request;
+
+       request.intf_id = intf_id;
+       request.burst = burst;
+       request.gear = gear;
+       request.nlanes = nlanes;
+       request.flags = flags;
+
+       return gb_operation_sync(svc->connection, GB_SVC_TYPE_LINK_CONFIG,
+                                &request, sizeof(request), NULL, 0);
+}
+EXPORT_SYMBOL_GPL(gb_svc_link_config);
+
 static int gb_svc_version_request(struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;
index b7cb7e4c6cf5067e2985d2cac50c66aafbb00cee..23060357e3adb545cbd8ca39129cc34a5d9ca697 100644 (file)
@@ -44,6 +44,9 @@ int gb_svc_dme_peer_get(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
                        u32 *value);
 int gb_svc_dme_peer_set(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
                        u32 value);
+int gb_svc_link_config(struct gb_svc *svc, u8 intf_id, unsigned int burst,
+                      unsigned int gear, unsigned int nlanes,
+                      unsigned int flags);
 
 int gb_svc_protocol_init(void);
 void gb_svc_protocol_exit(void);