Loading drivers/platform/msm/gsi/gsi.c +61 −1 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -1742,6 +1742,32 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl, } EXPORT_SYMBOL(gsi_alloc_channel); static void __gsi_read_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch * val) { uint32_t reg; reg = gsi_readl(gsi_ctx->base + GSI_EE_n_GSI_CH_k_SCRATCH_0_OFFS(chan_hdl, gsi_ctx->per.ee)); val->data.word1 = reg; reg = gsi_readl(gsi_ctx->base + GSI_EE_n_GSI_CH_k_SCRATCH_1_OFFS(chan_hdl, gsi_ctx->per.ee)); val->data.word2 = reg; reg = gsi_readl(gsi_ctx->base + GSI_EE_n_GSI_CH_k_SCRATCH_2_OFFS(chan_hdl, gsi_ctx->per.ee)); val->data.word3 = reg; reg = gsi_readl(gsi_ctx->base + GSI_EE_n_GSI_CH_k_SCRATCH_3_OFFS(chan_hdl, gsi_ctx->per.ee)); val->data.word4 = reg; } static void __gsi_write_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch val) { Loading Loading @@ -1802,6 +1828,40 @@ int gsi_write_channel_scratch(unsigned long chan_hdl, } EXPORT_SYMBOL(gsi_write_channel_scratch); int gsi_read_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch * ch_scratch) { struct gsi_chan_ctx *ctx; if (!gsi_ctx) { pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__); return -GSI_STATUS_NODEV; } if (chan_hdl >= gsi_ctx->max_ch) { GSIERR("bad params chan_hdl=%lu\n", chan_hdl); return -GSI_STATUS_INVALID_PARAMS; } if (gsi_ctx->chan[chan_hdl].state != GSI_CHAN_STATE_ALLOCATED && gsi_ctx->chan[chan_hdl].state != GSI_CHAN_STATE_STARTED && gsi_ctx->chan[chan_hdl].state != GSI_CHAN_STATE_STOPPED) { GSIERR("bad state %d\n", gsi_ctx->chan[chan_hdl].state); return -GSI_STATUS_UNSUPPORTED_OP; } ctx = &gsi_ctx->chan[chan_hdl]; mutex_lock(&ctx->mlock); __gsi_read_channel_scratch(chan_hdl, ch_scratch); ctx->restore_scratch = *ch_scratch; mutex_unlock(&ctx->mlock); return GSI_STATUS_SUCCESS; } EXPORT_SYMBOL(gsi_read_channel_scratch); int gsi_query_channel_db_addr(unsigned long chan_hdl, uint32_t *db_addr_wp_lsb, uint32_t *db_addr_wp_msb) { Loading drivers/platform/msm/gsi/gsi.h +2 −1 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -129,6 +129,7 @@ struct gsi_chan_ctx { bool allocated; atomic_t poll_mode; union __packed gsi_channel_scratch scratch; union __packed gsi_channel_scratch restore_scratch; struct gsi_chan_stats stats; bool enable_dp_stats; bool print_dp_stats; Loading drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c +30 −4 Original line number Diff line number Diff line /* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved. /* Copyright (c) 2015, 2017-2018 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -21,13 +21,39 @@ #include "../ipa_common_i.h" #define IPA_MHI_DRV_NAME "ipa_mhi_client" #define IPA_MHI_DBG(fmt, args...) \ do { \ pr_debug(IPA_MHI_DRV_NAME " %s:%d " fmt, \ __func__, __LINE__, ## args); \ IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \ } while (0) #define IPA_MHI_DBG_LOW(fmt, args...) \ do { \ pr_debug(IPA_MHI_DRV_NAME " %s:%d " fmt, \ __func__, __LINE__, ## args) __func__, __LINE__, ## args); \ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \ } while (0) #define IPA_MHI_ERR(fmt, args...) \ pr_err(IPA_MHI_DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args) do { \ pr_err(IPA_MHI_DRV_NAME " %s:%d " fmt, \ __func__, __LINE__, ## args); \ IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \ } while (0) #define IPA_MHI_FUNC_ENTRY() \ IPA_MHI_DBG("ENTRY\n") #define IPA_MHI_FUNC_EXIT() \ IPA_MHI_DBG("EXIT\n") Loading drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c +29 −5 Original line number Diff line number Diff line /* Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -56,9 +56,9 @@ #define IPA_MHI_FUNC_ENTRY() \ IPA_MHI_DBG_LOW("ENTRY\n") IPA_MHI_DBG("ENTRY\n") #define IPA_MHI_FUNC_EXIT() \ IPA_MHI_DBG_LOW("EXIT\n") IPA_MHI_DBG("EXIT\n") #define IPA_MHI_MAX_UL_CHANNELS 1 #define IPA_MHI_MAX_DL_CHANNELS 1 Loading Loading @@ -537,6 +537,7 @@ int ipa3_mhi_resume_channels_internal(enum ipa_client_type client, int res; int ipa_ep_idx; struct ipa3_ep_context *ep; union __packed gsi_channel_scratch gsi_ch_scratch; IPA_MHI_FUNC_ENTRY(); Loading @@ -551,11 +552,34 @@ int ipa3_mhi_resume_channels_internal(enum ipa_client_type client, /* * set polling mode bit to DB mode before * resuming the channel * * For MHI-->IPA pipes: * when resuming due to transition to M0, * set the polling mode bit to 0. * In other cases, restore it's value form * when you stopped the channel. * Here, after successful resume client move to M0 state. * So, by default setting polling mode bit to 0. * * For IPA-->MHI pipe: * always restore the polling mode bit. */ res = gsi_read_channel_scratch( ep->gsi_chan_hdl, &gsi_ch_scratch); if (res) { IPA_MHI_ERR("Read ch scratch fail %d\n" , res); return res; } if (IPA_CLIENT_IS_PROD(client)) gsi_ch_scratch.mhi.polling_mode = false; res = gsi_write_channel_scratch( ep->gsi_chan_hdl, ch_scratch); ep->gsi_chan_hdl, gsi_ch_scratch); if (res) { IPA_MHI_ERR("write ch scratch fail %d\n" IPA_MHI_ERR("Write ch scratch fail %d\n" , res); return res; } Loading include/linux/msm_gsi.h +20 −1 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -835,6 +835,18 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl, int gsi_write_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch val); /** * gsi_read_channel_scratch - Peripheral should call this function to * read the scratch area of the channel context * * @chan_hdl: Client handle previously obtained from * gsi_alloc_channel * * @Return gsi_status */ int gsi_read_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch *ch_scratch); /** * gsi_start_channel - Peripheral should call this function to * start a channel i.e put into running state Loading Loading @@ -1093,6 +1105,7 @@ int gsi_halt_channel_ee(unsigned int chan_idx, unsigned int ee, int *code); * gsi_alloc_channel (for as many channels as needed; channels can have * no event ring, an exclusive event ring or a shared event ring) * gsi_write_channel_scratch * gsi_read_channel_scratch * gsi_start_channel * gsi_queue_xfer/gsi_start_xfer * gsi_config_channel_mode/gsi_poll_channel (if clients wants to poll on Loading Loading @@ -1177,6 +1190,12 @@ static inline int gsi_write_channel_scratch(unsigned long chan_hdl, return -GSI_STATUS_UNSUPPORTED_OP; } static inline int gsi_read_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch *ch_scratch) { return -GSI_STATUS_UNSUPPORTED_OP; } static inline int gsi_start_channel(unsigned long chan_hdl) { return -GSI_STATUS_UNSUPPORTED_OP; Loading Loading
drivers/platform/msm/gsi/gsi.c +61 −1 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -1742,6 +1742,32 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl, } EXPORT_SYMBOL(gsi_alloc_channel); static void __gsi_read_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch * val) { uint32_t reg; reg = gsi_readl(gsi_ctx->base + GSI_EE_n_GSI_CH_k_SCRATCH_0_OFFS(chan_hdl, gsi_ctx->per.ee)); val->data.word1 = reg; reg = gsi_readl(gsi_ctx->base + GSI_EE_n_GSI_CH_k_SCRATCH_1_OFFS(chan_hdl, gsi_ctx->per.ee)); val->data.word2 = reg; reg = gsi_readl(gsi_ctx->base + GSI_EE_n_GSI_CH_k_SCRATCH_2_OFFS(chan_hdl, gsi_ctx->per.ee)); val->data.word3 = reg; reg = gsi_readl(gsi_ctx->base + GSI_EE_n_GSI_CH_k_SCRATCH_3_OFFS(chan_hdl, gsi_ctx->per.ee)); val->data.word4 = reg; } static void __gsi_write_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch val) { Loading Loading @@ -1802,6 +1828,40 @@ int gsi_write_channel_scratch(unsigned long chan_hdl, } EXPORT_SYMBOL(gsi_write_channel_scratch); int gsi_read_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch * ch_scratch) { struct gsi_chan_ctx *ctx; if (!gsi_ctx) { pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__); return -GSI_STATUS_NODEV; } if (chan_hdl >= gsi_ctx->max_ch) { GSIERR("bad params chan_hdl=%lu\n", chan_hdl); return -GSI_STATUS_INVALID_PARAMS; } if (gsi_ctx->chan[chan_hdl].state != GSI_CHAN_STATE_ALLOCATED && gsi_ctx->chan[chan_hdl].state != GSI_CHAN_STATE_STARTED && gsi_ctx->chan[chan_hdl].state != GSI_CHAN_STATE_STOPPED) { GSIERR("bad state %d\n", gsi_ctx->chan[chan_hdl].state); return -GSI_STATUS_UNSUPPORTED_OP; } ctx = &gsi_ctx->chan[chan_hdl]; mutex_lock(&ctx->mlock); __gsi_read_channel_scratch(chan_hdl, ch_scratch); ctx->restore_scratch = *ch_scratch; mutex_unlock(&ctx->mlock); return GSI_STATUS_SUCCESS; } EXPORT_SYMBOL(gsi_read_channel_scratch); int gsi_query_channel_db_addr(unsigned long chan_hdl, uint32_t *db_addr_wp_lsb, uint32_t *db_addr_wp_msb) { Loading
drivers/platform/msm/gsi/gsi.h +2 −1 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -129,6 +129,7 @@ struct gsi_chan_ctx { bool allocated; atomic_t poll_mode; union __packed gsi_channel_scratch scratch; union __packed gsi_channel_scratch restore_scratch; struct gsi_chan_stats stats; bool enable_dp_stats; bool print_dp_stats; Loading
drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c +30 −4 Original line number Diff line number Diff line /* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved. /* Copyright (c) 2015, 2017-2018 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -21,13 +21,39 @@ #include "../ipa_common_i.h" #define IPA_MHI_DRV_NAME "ipa_mhi_client" #define IPA_MHI_DBG(fmt, args...) \ do { \ pr_debug(IPA_MHI_DRV_NAME " %s:%d " fmt, \ __func__, __LINE__, ## args); \ IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \ } while (0) #define IPA_MHI_DBG_LOW(fmt, args...) \ do { \ pr_debug(IPA_MHI_DRV_NAME " %s:%d " fmt, \ __func__, __LINE__, ## args) __func__, __LINE__, ## args); \ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \ } while (0) #define IPA_MHI_ERR(fmt, args...) \ pr_err(IPA_MHI_DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args) do { \ pr_err(IPA_MHI_DRV_NAME " %s:%d " fmt, \ __func__, __LINE__, ## args); \ IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \ } while (0) #define IPA_MHI_FUNC_ENTRY() \ IPA_MHI_DBG("ENTRY\n") #define IPA_MHI_FUNC_EXIT() \ IPA_MHI_DBG("EXIT\n") Loading
drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c +29 −5 Original line number Diff line number Diff line /* Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -56,9 +56,9 @@ #define IPA_MHI_FUNC_ENTRY() \ IPA_MHI_DBG_LOW("ENTRY\n") IPA_MHI_DBG("ENTRY\n") #define IPA_MHI_FUNC_EXIT() \ IPA_MHI_DBG_LOW("EXIT\n") IPA_MHI_DBG("EXIT\n") #define IPA_MHI_MAX_UL_CHANNELS 1 #define IPA_MHI_MAX_DL_CHANNELS 1 Loading Loading @@ -537,6 +537,7 @@ int ipa3_mhi_resume_channels_internal(enum ipa_client_type client, int res; int ipa_ep_idx; struct ipa3_ep_context *ep; union __packed gsi_channel_scratch gsi_ch_scratch; IPA_MHI_FUNC_ENTRY(); Loading @@ -551,11 +552,34 @@ int ipa3_mhi_resume_channels_internal(enum ipa_client_type client, /* * set polling mode bit to DB mode before * resuming the channel * * For MHI-->IPA pipes: * when resuming due to transition to M0, * set the polling mode bit to 0. * In other cases, restore it's value form * when you stopped the channel. * Here, after successful resume client move to M0 state. * So, by default setting polling mode bit to 0. * * For IPA-->MHI pipe: * always restore the polling mode bit. */ res = gsi_read_channel_scratch( ep->gsi_chan_hdl, &gsi_ch_scratch); if (res) { IPA_MHI_ERR("Read ch scratch fail %d\n" , res); return res; } if (IPA_CLIENT_IS_PROD(client)) gsi_ch_scratch.mhi.polling_mode = false; res = gsi_write_channel_scratch( ep->gsi_chan_hdl, ch_scratch); ep->gsi_chan_hdl, gsi_ch_scratch); if (res) { IPA_MHI_ERR("write ch scratch fail %d\n" IPA_MHI_ERR("Write ch scratch fail %d\n" , res); return res; } Loading
include/linux/msm_gsi.h +20 −1 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -835,6 +835,18 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl, int gsi_write_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch val); /** * gsi_read_channel_scratch - Peripheral should call this function to * read the scratch area of the channel context * * @chan_hdl: Client handle previously obtained from * gsi_alloc_channel * * @Return gsi_status */ int gsi_read_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch *ch_scratch); /** * gsi_start_channel - Peripheral should call this function to * start a channel i.e put into running state Loading Loading @@ -1093,6 +1105,7 @@ int gsi_halt_channel_ee(unsigned int chan_idx, unsigned int ee, int *code); * gsi_alloc_channel (for as many channels as needed; channels can have * no event ring, an exclusive event ring or a shared event ring) * gsi_write_channel_scratch * gsi_read_channel_scratch * gsi_start_channel * gsi_queue_xfer/gsi_start_xfer * gsi_config_channel_mode/gsi_poll_channel (if clients wants to poll on Loading Loading @@ -1177,6 +1190,12 @@ static inline int gsi_write_channel_scratch(unsigned long chan_hdl, return -GSI_STATUS_UNSUPPORTED_OP; } static inline int gsi_read_channel_scratch(unsigned long chan_hdl, union __packed gsi_channel_scratch *ch_scratch) { return -GSI_STATUS_UNSUPPORTED_OP; } static inline int gsi_start_channel(unsigned long chan_hdl) { return -GSI_STATUS_UNSUPPORTED_OP; Loading