diff options
author | Eli Sennesh <esennesh@leaflabs.com> | 2016-05-16 14:55:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-05-24 09:02:07 -0700 |
commit | 00606367141cf518e94d8354a02d298475de67e5 (patch) | |
tree | f67b4564d86ba430fc3f23577abded5c8a7c2053 /drivers/staging/greybus/svc.c | |
parent | d7be800f7ae9398055509b3a83d0ea3118e9277f (diff) |
greybus: update UniPro Set Interface Power Mode operation to match spec
Bring the gb_svc_intf_set_power_mode() up-to-date with the current Greybus
specification. This largely involves adding more members to the structure
sent across the wire. Also change the camera code to use the new
operation properly, with default values passed for the new necessary
arguments. The correctness of these default values is confirmed via testing
and by asking Rob Johnson.
Testing Done: Took a picture with a camera module, received error code
when passing deliberately incorrect values for new parameters, got proper
-EIO and Greybus result code printed when operation stopped halfway
through.
Associated Firmware Changes: 6810-6812 on Gerrit for SW-1239, 6870 and
5612-5613 on Gerrit for SW-2945
Signed-off-by: Eli Sennesh <esennesh@leaflabs.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/svc.c')
-rw-r--r-- | drivers/staging/greybus/svc.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index 78cc0e38828d..90094cf1a5eb 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -578,23 +578,33 @@ void gb_svc_route_destroy(struct gb_svc *svc, u8 intf1_id, u8 intf2_id) 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 tx_amplitude, u8 tx_hs_equalizer, u8 rx_mode, u8 rx_gear, u8 rx_nlanes, - u8 flags, u32 quirks) + u8 flags, u32 quirks, + struct gb_svc_l2_timer_cfg *local, + struct gb_svc_l2_timer_cfg *remote) { struct gb_svc_intf_set_pwrm_request request; struct gb_svc_intf_set_pwrm_response response; int ret; + u16 result_code; request.intf_id = intf_id; request.hs_series = hs_series; request.tx_mode = tx_mode; request.tx_gear = tx_gear; request.tx_nlanes = tx_nlanes; + request.tx_amplitude = tx_amplitude; + request.tx_hs_equalizer = tx_hs_equalizer; request.rx_mode = rx_mode; request.rx_gear = rx_gear; request.rx_nlanes = rx_nlanes; request.flags = flags; request.quirks = cpu_to_le32(quirks); + if (local) + request.local_l2timerdata = *local; + if (remote) + request.remote_l2timerdata = *remote; ret = gb_operation_sync(svc->connection, GB_SVC_TYPE_INTF_SET_PWRM, &request, sizeof(request), @@ -602,7 +612,13 @@ int gb_svc_intf_set_power_mode(struct gb_svc *svc, u8 intf_id, u8 hs_series, if (ret < 0) return ret; - return le16_to_cpu(response.result_code); + result_code = le16_to_cpu(response.result_code); + if (result_code != GB_SVC_SETPWRM_PWR_LOCAL) { + dev_err(&svc->dev, "set power mode = %d\n", result_code); + return -EIO; + } + + return 0; } EXPORT_SYMBOL_GPL(gb_svc_intf_set_power_mode); @@ -926,9 +942,11 @@ static void gb_svc_process_hello_deferred(struct gb_operation *operation) GB_SVC_UNIPRO_HS_SERIES_A, GB_SVC_UNIPRO_SLOW_AUTO_MODE, 2, 1, + GB_SVC_SMALL_AMPLITUDE, GB_SVC_NO_DE_EMPHASIS, GB_SVC_UNIPRO_SLOW_AUTO_MODE, 2, 1, - 0, 0); + 0, 0, + NULL, NULL); if (ret) dev_warn(&svc->dev, |