summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/audio_apbridgea.c
diff options
context:
space:
mode:
authorDavid Lin <dtwlin@google.com>2016-07-14 15:13:00 -0500
committerAlex Elder <elder@linaro.org>2016-07-14 16:53:55 -0500
commit6ba7fad430d6300b966800bc5d2c782e2baf6f1d (patch)
tree69966b93b1c1381c4b807e0d92eab27e4fc654af /drivers/staging/greybus/audio_apbridgea.c
parent61e13db9cc8945d53f72d4021594ee3be214e667 (diff)
greybus: audio: add runtime pm support
Add runtime pm support to audio protocol device class driver. Testing Done: - Use white speaker module and check the interface is autosuspended when it's idle and resumed when playback audio Signed-off-by: David Lin <dtwlin@google.com> Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Reviewed-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org> Signed-off-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'drivers/staging/greybus/audio_apbridgea.c')
-rw-r--r--drivers/staging/greybus/audio_apbridgea.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/staging/greybus/audio_apbridgea.c b/drivers/staging/greybus/audio_apbridgea.c
index 361470788a76..45d3522789a8 100644
--- a/drivers/staging/greybus/audio_apbridgea.c
+++ b/drivers/staging/greybus/audio_apbridgea.c
@@ -33,12 +33,17 @@ int gb_audio_apbridgea_register_cport(struct gb_connection *connection,
__u8 direction)
{
struct audio_apbridgea_register_cport_request req;
+ int ret;
req.hdr.type = AUDIO_APBRIDGEA_TYPE_REGISTER_CPORT;
req.hdr.i2s_port = cpu_to_le16(i2s_port);
req.cport = cpu_to_le16(cportid);
req.direction = direction;
+ ret = gb_pm_runtime_get_sync(connection->bundle);
+ if (ret)
+ return ret;
+
return gb_hd_output(connection->hd, &req, sizeof(req),
GB_APB_REQUEST_AUDIO_CONTROL, true);
}
@@ -49,14 +54,19 @@ int gb_audio_apbridgea_unregister_cport(struct gb_connection *connection,
__u8 direction)
{
struct audio_apbridgea_unregister_cport_request req;
+ int ret;
req.hdr.type = AUDIO_APBRIDGEA_TYPE_UNREGISTER_CPORT;
req.hdr.i2s_port = cpu_to_le16(i2s_port);
req.cport = cpu_to_le16(cportid);
req.direction = direction;
- return gb_hd_output(connection->hd, &req, sizeof(req),
- GB_APB_REQUEST_AUDIO_CONTROL, true);
+ ret = gb_hd_output(connection->hd, &req, sizeof(req),
+ GB_APB_REQUEST_AUDIO_CONTROL, true);
+
+ gb_pm_runtime_put_autosuspend(connection->bundle);
+
+ return ret;
}
EXPORT_SYMBOL_GPL(gb_audio_apbridgea_unregister_cport);