Skip to content

Commit decfef0

Browse files
Alex Elderdavem330
authored andcommitted
net: ipa: use gsi->version for channel suspend/resume
The GSI layer has the IPA version now, so there's no need for version-specific flags to be passed from IPA. One instance of this is in gsi_channel_suspend() and gsi_channel_resume(), which indicate whether or not the endpoint suspend is implemented by GSI stopping the channel. We can make that determination based on gsi->version, eliminating the need for a Boolean flag in those functions. Signed-off-by: Alex Elder <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 93bbcfe commit decfef0

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

drivers/net/ipa/gsi.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,13 +1026,14 @@ void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell)
10261026
mutex_unlock(&gsi->mutex);
10271027
}
10281028

1029-
/* Stop a STARTED channel for suspend (using stop if requested) */
1030-
int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop)
1029+
/* Stop a started channel for suspend */
1030+
int gsi_channel_suspend(struct gsi *gsi, u32 channel_id)
10311031
{
10321032
struct gsi_channel *channel = &gsi->channel[channel_id];
10331033
int ret;
10341034

1035-
ret = __gsi_channel_stop(channel, stop);
1035+
/* Prior to IPA v4.0 suspend/resume is not implemented by GSI */
1036+
ret = __gsi_channel_stop(channel, gsi->version >= IPA_VERSION_4_0);
10361037
if (ret)
10371038
return ret;
10381039

@@ -1042,12 +1043,13 @@ int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop)
10421043
return 0;
10431044
}
10441045

1045-
/* Resume a suspended channel (starting will be requested if STOPPED) */
1046-
int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start)
1046+
/* Resume a suspended channel (starting if stopped) */
1047+
int gsi_channel_resume(struct gsi *gsi, u32 channel_id)
10471048
{
10481049
struct gsi_channel *channel = &gsi->channel[channel_id];
10491050

1050-
return __gsi_channel_start(channel, start);
1051+
/* Prior to IPA v4.0 suspend/resume is not implemented by GSI */
1052+
return __gsi_channel_start(channel, gsi->version >= IPA_VERSION_4_0);
10511053
}
10521054

10531055
/**

drivers/net/ipa/gsi.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,23 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id);
232232
*/
233233
void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell);
234234

235-
int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop);
236-
int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start);
235+
/**
236+
* gsi_channel_suspend() - Suspend a GSI channel
237+
* @gsi: GSI pointer
238+
* @channel_id: Channel to suspend
239+
*
240+
* For IPA v4.0+, suspend is implemented by stopping the channel.
241+
*/
242+
int gsi_channel_suspend(struct gsi *gsi, u32 channel_id);
243+
244+
/**
245+
* gsi_channel_resume() - Resume a suspended GSI channel
246+
* @gsi: GSI pointer
247+
* @channel_id: Channel to resume
248+
*
249+
* For IPA v4.0+, the stopped channel is started again.
250+
*/
251+
int gsi_channel_resume(struct gsi *gsi, u32 channel_id);
237252

238253
/**
239254
* gsi_init() - Initialize the GSI subsystem

drivers/net/ipa/ipa_endpoint.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,6 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint)
15871587
{
15881588
struct device *dev = &endpoint->ipa->pdev->dev;
15891589
struct gsi *gsi = &endpoint->ipa->gsi;
1590-
bool stop_channel;
15911590
int ret;
15921591

15931592
if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id)))
@@ -1598,11 +1597,7 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint)
15981597
(void)ipa_endpoint_program_suspend(endpoint, true);
15991598
}
16001599

1601-
/* Starting with IPA v4.0, endpoints are suspended by stopping the
1602-
* underlying GSI channel rather than using endpoint suspend mode.
1603-
*/
1604-
stop_channel = endpoint->ipa->version >= IPA_VERSION_4_0;
1605-
ret = gsi_channel_suspend(gsi, endpoint->channel_id, stop_channel);
1600+
ret = gsi_channel_suspend(gsi, endpoint->channel_id);
16061601
if (ret)
16071602
dev_err(dev, "error %d suspending channel %u\n", ret,
16081603
endpoint->channel_id);
@@ -1612,7 +1607,6 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint)
16121607
{
16131608
struct device *dev = &endpoint->ipa->pdev->dev;
16141609
struct gsi *gsi = &endpoint->ipa->gsi;
1615-
bool start_channel;
16161610
int ret;
16171611

16181612
if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id)))
@@ -1621,11 +1615,7 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint)
16211615
if (!endpoint->toward_ipa)
16221616
(void)ipa_endpoint_program_suspend(endpoint, false);
16231617

1624-
/* Starting with IPA v4.0, the underlying GSI channel must be
1625-
* restarted for resume.
1626-
*/
1627-
start_channel = endpoint->ipa->version >= IPA_VERSION_4_0;
1628-
ret = gsi_channel_resume(gsi, endpoint->channel_id, start_channel);
1618+
ret = gsi_channel_resume(gsi, endpoint->channel_id);
16291619
if (ret)
16301620
dev_err(dev, "error %d resuming channel %u\n", ret,
16311621
endpoint->channel_id);

0 commit comments

Comments
 (0)