Commit 4a4ba483 authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: move version check for channel suspend/resume

Change the Boolean flags passed to __gsi_channel_start() and
__gsi_channel_stop() so they represent whether the request is being
made to implement suspend (versus stop) or resume (versus start).

Then stop or start the channel for suspend/resume requests only if
the hardware version indicates it should be done.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent decfef0f
...@@ -920,12 +920,13 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell) ...@@ -920,12 +920,13 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell)
/* All done! */ /* All done! */
} }
static int __gsi_channel_start(struct gsi_channel *channel, bool start) static int __gsi_channel_start(struct gsi_channel *channel, bool resume)
{ {
struct gsi *gsi = channel->gsi; struct gsi *gsi = channel->gsi;
int ret; int ret;
if (!start) /* Prior to IPA v4.0 suspend/resume is not implemented by GSI */
if (resume && gsi->version < IPA_VERSION_4_0)
return 0; return 0;
mutex_lock(&gsi->mutex); mutex_lock(&gsi->mutex);
...@@ -947,7 +948,7 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id) ...@@ -947,7 +948,7 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id)
napi_enable(&channel->napi); napi_enable(&channel->napi);
gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id);
ret = __gsi_channel_start(channel, true); ret = __gsi_channel_start(channel, false);
if (ret) { if (ret) {
gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
napi_disable(&channel->napi); napi_disable(&channel->napi);
...@@ -971,7 +972,7 @@ static int gsi_channel_stop_retry(struct gsi_channel *channel) ...@@ -971,7 +972,7 @@ static int gsi_channel_stop_retry(struct gsi_channel *channel)
return ret; return ret;
} }
static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) static int __gsi_channel_stop(struct gsi_channel *channel, bool suspend)
{ {
struct gsi *gsi = channel->gsi; struct gsi *gsi = channel->gsi;
int ret; int ret;
...@@ -979,7 +980,8 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) ...@@ -979,7 +980,8 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop)
/* Wait for any underway transactions to complete before stopping. */ /* Wait for any underway transactions to complete before stopping. */
gsi_channel_trans_quiesce(channel); gsi_channel_trans_quiesce(channel);
if (!stop) /* Prior to IPA v4.0 suspend/resume is not implemented by GSI */
if (suspend && gsi->version < IPA_VERSION_4_0)
return 0; return 0;
mutex_lock(&gsi->mutex); mutex_lock(&gsi->mutex);
...@@ -997,7 +999,7 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id) ...@@ -997,7 +999,7 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id)
struct gsi_channel *channel = &gsi->channel[channel_id]; struct gsi_channel *channel = &gsi->channel[channel_id];
int ret; int ret;
ret = __gsi_channel_stop(channel, true); ret = __gsi_channel_stop(channel, false);
if (ret) if (ret)
return ret; return ret;
...@@ -1032,8 +1034,7 @@ int gsi_channel_suspend(struct gsi *gsi, u32 channel_id) ...@@ -1032,8 +1034,7 @@ int gsi_channel_suspend(struct gsi *gsi, u32 channel_id)
struct gsi_channel *channel = &gsi->channel[channel_id]; struct gsi_channel *channel = &gsi->channel[channel_id];
int ret; int ret;
/* Prior to IPA v4.0 suspend/resume is not implemented by GSI */ ret = __gsi_channel_stop(channel, true);
ret = __gsi_channel_stop(channel, gsi->version >= IPA_VERSION_4_0);
if (ret) if (ret)
return ret; return ret;
...@@ -1048,8 +1049,7 @@ int gsi_channel_resume(struct gsi *gsi, u32 channel_id) ...@@ -1048,8 +1049,7 @@ int gsi_channel_resume(struct gsi *gsi, u32 channel_id)
{ {
struct gsi_channel *channel = &gsi->channel[channel_id]; struct gsi_channel *channel = &gsi->channel[channel_id];
/* Prior to IPA v4.0 suspend/resume is not implemented by GSI */ return __gsi_channel_start(channel, true);
return __gsi_channel_start(channel, gsi->version >= IPA_VERSION_4_0);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment