diff options
Diffstat (limited to 'drivers/soc/qcom/glink.c')
| -rw-r--r-- | drivers/soc/qcom/glink.c | 85 |
1 files changed, 84 insertions, 1 deletions
diff --git a/drivers/soc/qcom/glink.c b/drivers/soc/qcom/glink.c index 72f5829d1eb6..561b9074f2ee 100644 --- a/drivers/soc/qcom/glink.c +++ b/drivers/soc/qcom/glink.c @@ -232,7 +232,9 @@ static DEFINE_MUTEX(edge_list_lock_lhd0); * @req_rate_kBps: Current QoS request by the channel. * @tx_intent_cnt: Intent count to transmit soon in future. * @tx_cnt: Packets to be picked by tx scheduler. - */ + * @rt_vote_on: Number of times RT vote on is called. + * @rt_vote_off: Number of times RT vote off is called. +*/ struct channel_ctx { struct rwref_lock ch_state_lhb2; struct list_head port_list_node; @@ -311,6 +313,9 @@ struct channel_ctx { unsigned long req_rate_kBps; uint32_t tx_intent_cnt; uint32_t tx_cnt; + + uint32_t rt_vote_on; + uint32_t rt_vote_off; uint32_t magic_number; }; @@ -2418,6 +2423,25 @@ static int dummy_power_unvote(struct glink_transport_if *if_ptr) } /** + * dummy_rx_rt_vote() - Dummy RX Realtime thread vote + * @if_ptr: The transport to transmit on. + + */ +static int dummy_rx_rt_vote(struct glink_transport_if *if_ptr) +{ + return -EOPNOTSUPP; +} + +/** + * dummy_rx_rt_unvote() - Dummy RX Realtime thread unvote + * @if_ptr: The transport to transmit on. + */ +static int dummy_rx_rt_unvote(struct glink_transport_if *if_ptr) +{ + return -EOPNOTSUPP; +} + +/** * notif_if_up_all_xprts() - Check and notify existing transport state if up * @notif_info: Data structure containing transport information to be notified. * @@ -3543,6 +3567,61 @@ unsigned long glink_qos_get_ramp_time(void *handle, size_t pkt_size) } EXPORT_SYMBOL(glink_qos_get_ramp_time); + +/** + * glink_start_rx_rt() - Vote for RT thread priority on RX. + * @handle: Channel handle for which transaction are occurring. + * + * Return: 0 on success, standard Linux error codes on failure + */ +int glink_start_rx_rt(void *handle) +{ + struct channel_ctx *ctx = (struct channel_ctx *)handle; + int ret; + + ret = glink_get_ch_ctx(ctx); + if (ret) + return ret; + if (!ch_is_fully_opened(ctx)) { + GLINK_ERR_CH(ctx, "%s: Channel is not fully opened\n", + __func__); + glink_put_ch_ctx(ctx, false); + return -EBUSY; + } + ret = ctx->transport_ptr->ops->rx_rt_vote(ctx->transport_ptr->ops); + ctx->rt_vote_on++; + GLINK_INFO_CH(ctx, "%s: Voting RX Realtime Thread %d", __func__, ret); + glink_put_ch_ctx(ctx, false); + return ret; +} + +/** + * glink_end_rx_rt() - Vote for RT thread priority on RX. + * @handle: Channel handle for which transaction are occurring. + * + * Return: 0 on success, standard Linux error codes on failure + */ +int glink_end_rx_rt(void *handle) +{ + struct channel_ctx *ctx = (struct channel_ctx *)handle; + int ret; + + ret = glink_get_ch_ctx(ctx); + if (ret) + return ret; + if (!ch_is_fully_opened(ctx)) { + GLINK_ERR_CH(ctx, "%s: Channel is not fully opened\n", + __func__); + glink_put_ch_ctx(ctx, false); + return -EBUSY; + } + ret = ctx->transport_ptr->ops->rx_rt_unvote(ctx->transport_ptr->ops); + ctx->rt_vote_off++; + GLINK_INFO_CH(ctx, "%s: Unvoting RX Realtime Thread %d", __func__, ret); + glink_put_ch_ctx(ctx, false); + return ret; +} + /** * glink_rpm_rx_poll() - Poll and receive any available events * @handle: Channel handle in which this operation is performed. @@ -3950,6 +4029,10 @@ int glink_core_register_transport(struct glink_transport_if *if_ptr, if_ptr->power_vote = dummy_power_vote; if (!if_ptr->power_unvote) if_ptr->power_unvote = dummy_power_unvote; + if (!if_ptr->rx_rt_vote) + if_ptr->rx_rt_vote = dummy_rx_rt_vote; + if (!if_ptr->rx_rt_unvote) + if_ptr->rx_rt_unvote = dummy_rx_rt_unvote; xprt_ptr->capabilities = 0; xprt_ptr->ops = if_ptr; spin_lock_init(&xprt_ptr->xprt_ctx_lock_lhb1); |
