greybus: svc: Replace link config hack with standard operation
The link config operation was a hack only designed to fulfill the camera driver's needs. Now that a standard operation is defined for the same purpose, implement it and remove the hack. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
e49268cc33
commit
aab4a1a368
@ -606,13 +606,21 @@ static int gb_camera_connection_init(struct gb_connection *connection)
|
||||
|
||||
gcam->data_connected = true;
|
||||
|
||||
ret = gb_svc_link_config(svc, connection->intf->interface_id,
|
||||
GB_SVC_LINK_CONFIG_BURST_HS_A, 2, 2, 0);
|
||||
ret = gb_svc_intf_set_power_mode(svc, connection->intf->interface_id,
|
||||
GB_SVC_UNIPRO_HS_SERIES_A,
|
||||
GB_SVC_UNIPRO_FAST_MODE, 2, 2,
|
||||
GB_SVC_UNIPRO_FAST_MODE, 2, 2,
|
||||
GB_SVC_PWRM_RXTERMINATION |
|
||||
GB_SVC_PWRM_TXTERMINATION, 0);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
ret = gb_svc_link_config(svc, svc->ap_intf_id,
|
||||
GB_SVC_LINK_CONFIG_BURST_HS_A, 2, 2, 0);
|
||||
ret = gb_svc_intf_set_power_mode(svc, svc->ap_intf_id,
|
||||
GB_SVC_UNIPRO_HS_SERIES_A,
|
||||
GB_SVC_UNIPRO_FAST_MODE, 2, 2,
|
||||
GB_SVC_UNIPRO_FAST_MODE, 2, 2,
|
||||
GB_SVC_PWRM_RXTERMINATION |
|
||||
GB_SVC_PWRM_TXTERMINATION, 0);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
|
@ -737,7 +737,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 0x10
|
||||
#define GB_SVC_TYPE_INTF_SET_PWRM 0x10
|
||||
|
||||
/*
|
||||
* SVC version request/response has the same payload as
|
||||
@ -819,20 +819,6 @@ 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
|
||||
/* FIXME: remove ES2 support and DME_ATTR_T_TST_SRC_INCREMENT */
|
||||
@ -860,6 +846,40 @@ struct gb_svc_route_destroy_request {
|
||||
} __packed;
|
||||
/* route destroy response has no payload */
|
||||
|
||||
#define GB_SVC_UNIPRO_FAST_MODE 0x01
|
||||
#define GB_SVC_UNIPRO_SLOW_MODE 0x02
|
||||
#define GB_SVC_UNIPRO_FAST_AUTO_MODE 0x04
|
||||
#define GB_SVC_UNIPRO_SLOW_AUTO_MODE 0x05
|
||||
#define GB_SVC_UNIPRO_MODE_UNCHANGED 0x07
|
||||
#define GB_SVC_UNIPRO_HIBERNATE_MODE 0x11
|
||||
#define GB_SVC_UNIPRO_OFF_MODE 0x12
|
||||
|
||||
#define GB_SVC_PWRM_RXTERMINATION 0x01
|
||||
#define GB_SVC_PWRM_TXTERMINATION 0x02
|
||||
#define GB_SVC_PWRM_LINE_RESET 0x04
|
||||
#define GB_SVC_PWRM_SCRAMBLING 0x20
|
||||
|
||||
#define GB_SVC_PWRM_QUIRK_HSSER 0x00000001
|
||||
|
||||
#define GB_SVC_UNIPRO_HS_SERIES_A 0x01
|
||||
#define GB_SVC_UNIPRO_HS_SERIES_B 0x02
|
||||
|
||||
struct gb_svc_intf_set_pwrm_request {
|
||||
__u8 intf_id;
|
||||
__u8 hs_series;
|
||||
__u8 tx_mode;
|
||||
__u8 tx_gear;
|
||||
__u8 tx_nlanes;
|
||||
__u8 rx_mode;
|
||||
__u8 rx_gear;
|
||||
__u8 rx_nlanes;
|
||||
__u8 flags;
|
||||
__le32 quirks;
|
||||
} __packed;
|
||||
|
||||
struct gb_svc_intf_set_pwrm_response {
|
||||
__le16 result_code;
|
||||
} __packed;
|
||||
|
||||
/* RAW */
|
||||
|
||||
|
@ -285,22 +285,35 @@ static void gb_svc_route_destroy(struct gb_svc *svc, u8 intf1_id, u8 intf2_id)
|
||||
}
|
||||
}
|
||||
|
||||
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_intf_set_power_mode(struct gb_svc *svc, u8 intf_id, u8 hs_series,
|
||||
u8 tx_mode, u8 tx_gear, u8 tx_nlanes,
|
||||
u8 rx_mode, u8 rx_gear, u8 rx_nlanes,
|
||||
u8 flags, u32 quirks)
|
||||
{
|
||||
struct gb_svc_link_config_request request;
|
||||
struct gb_svc_intf_set_pwrm_request request;
|
||||
struct gb_svc_intf_set_pwrm_response response;
|
||||
int ret;
|
||||
|
||||
request.intf_id = intf_id;
|
||||
request.burst = burst;
|
||||
request.gear = gear;
|
||||
request.nlanes = nlanes;
|
||||
request.hs_series = hs_series;
|
||||
request.tx_mode = tx_mode;
|
||||
request.tx_gear = tx_gear;
|
||||
request.tx_nlanes = tx_nlanes;
|
||||
request.rx_mode = rx_mode;
|
||||
request.rx_gear = rx_gear;
|
||||
request.rx_nlanes = rx_nlanes;
|
||||
request.flags = flags;
|
||||
request.quirks = cpu_to_le32(quirks);
|
||||
|
||||
return gb_operation_sync(svc->connection, GB_SVC_TYPE_LINK_CONFIG,
|
||||
&request, sizeof(request), NULL, 0);
|
||||
ret = gb_operation_sync(svc->connection, GB_SVC_TYPE_INTF_SET_PWRM,
|
||||
&request, sizeof(request),
|
||||
&response, sizeof(response));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return le16_to_cpu(response.result_code);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gb_svc_link_config);
|
||||
EXPORT_SYMBOL_GPL(gb_svc_intf_set_power_mode);
|
||||
|
||||
static int gb_svc_version_request(struct gb_operation *op)
|
||||
{
|
||||
|
@ -44,9 +44,10 @@ 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_intf_set_power_mode(struct gb_svc *svc, u8 intf_id, u8 hs_series,
|
||||
u8 tx_mode, u8 tx_gear, u8 tx_nlanes,
|
||||
u8 rx_mode, u8 rx_gear, u8 rx_nlanes,
|
||||
u8 flags, u32 quirks);
|
||||
|
||||
int gb_svc_protocol_init(void);
|
||||
void gb_svc_protocol_exit(void);
|
||||
|
Loading…
Reference in New Issue
Block a user