Loading arch/arm/mach-msm/bam_dmux.c +46 −133 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <linux/debugfs.h> #include <linux/clk.h> #include <linux/wakelock.h> #include <linux/kfifo.h> #include <linux/of.h> #include <linux/ipc_logging.h> #include <linux/srcu.h> Loading Loading @@ -229,7 +228,6 @@ static struct srcu_struct bam_dmux_srcu; /* A2 power collaspe */ #define UL_TIMEOUT_DELAY 1000 /* in ms */ #define ENABLE_DISCONNECT_ACK 0x1 #define SHUTDOWN_TIMEOUT_MS 500 #define UL_WAKEUP_TIMEOUT_MS 2000 static void toggle_apps_ack(void); Loading Loading @@ -264,12 +262,10 @@ static struct completion dfab_unvote_completion; static DEFINE_SPINLOCK(wakelock_reference_lock); static int wakelock_reference_count; static int a2_pc_disabled_wakelock_skipped; static int disconnect_ack = 1; static LIST_HEAD(bam_other_notify_funcs); static DEFINE_MUTEX(smsm_cb_lock); static DEFINE_MUTEX(delayed_ul_vote_lock); static int need_delayed_ul_vote; static int power_management_only_mode; static int in_ssr; static int ssr_skipped_disconnect; static struct completion shutdown_completion; Loading Loading @@ -304,7 +300,6 @@ static int in_global_reset; #define bam_ch_is_in_reset(x) \ (bam_ch[(x)].status & BAM_CH_IN_RESET) struct kfifo bam_dmux_state_log; static int bam_dmux_uplink_vote; static int bam_dmux_power_state; Loading Loading @@ -334,7 +329,7 @@ static void *bam_ipc_log_txt; do { \ if (bam_ipc_log_txt) { \ ipc_log_string(bam_ipc_log_txt, \ "<DMUX> %c%c%c%c %c%c%c%c%d%c " fmt, \ "<DMUX> %c%c%c%c %c%c%c%c%d " fmt, \ a2_pc_disabled ? 'D' : 'd', \ in_global_reset ? 'R' : 'r', \ bam_dmux_power_state ? 'P' : 'p', \ Loading @@ -344,7 +339,6 @@ do { \ wait_for_ack ? 'W' : 'w', \ ul_wakeup_ack_completion.done ? 'A' : 'a', \ atomic_read(&ul_ondemand_vote), \ disconnect_ack ? 'D' : 'd', \ args); \ } \ } while (0) Loading Loading @@ -588,11 +582,6 @@ static void handle_bam_mux_cmd(struct work_struct *work) BAM_DMUX_LOG("%s: opening cid %d PC enabled\n", __func__, rx_hdr->ch_id); handle_bam_mux_cmd_open(rx_hdr); if (!(rx_hdr->reserved & ENABLE_DISCONNECT_ACK)) { BAM_DMUX_LOG("%s: deactivating disconnect ack\n", __func__); disconnect_ack = 0; } dev_kfree_skb_any(rx_skb); break; case BAM_MUX_HDR_CMD_OPEN_NO_A2_PC: Loading Loading @@ -1775,7 +1764,7 @@ static void reconnect_to_bam(void) in_global_reset = 0; in_ssr = 0; vote_dfab(); if (!power_management_only_mode) { if (ssr_skipped_disconnect) { /* delayed to here to prevent bus stall */ bam_ops->sps_disconnect_ptr(bam_tx_pipe); Loading Loading @@ -1806,8 +1795,6 @@ static void reconnect_to_bam(void) if (i) pr_err("%s: rx event reg failed rc = %d\n", __func__, i); } bam_connection_is_active = 1; if (polling_mode) Loading @@ -1815,7 +1802,6 @@ static void reconnect_to_bam(void) toggle_apps_ack(); complete_all(&bam_connection_completion); if (!power_management_only_mode) queue_rx(); } Loading Loading @@ -1853,7 +1839,6 @@ static void disconnect_to_bam(void) INIT_COMPLETION(bam_connection_completion); /* in_ssr documentation/assumptions found in restart_notifier_cb */ if (!power_management_only_mode) { if (likely(!in_ssr)) { BAM_DMUX_LOG("%s: disconnect tx\n", __func__); bam_ops->sps_disconnect_ptr(bam_tx_pipe); Loading @@ -1866,7 +1851,6 @@ static void disconnect_to_bam(void) } else { ssr_skipped_disconnect = 1; } } unvote_dfab(); mutex_lock(&bam_rx_pool_mutexlock); Loading @@ -1881,10 +1865,7 @@ static void disconnect_to_bam(void) } bam_rx_pool_len = 0; mutex_unlock(&bam_rx_pool_mutexlock); if (disconnect_ack) toggle_apps_ack(); verify_tx_queue_is_empty(__func__); } Loading Loading @@ -2016,7 +1997,6 @@ static int restart_notifier_cb(struct notifier_block *this, ul_powerdown_finish(); a2_pc_disabled = 0; a2_pc_disabled_wakelock_skipped = 0; disconnect_ack = 1; /* Cleanup Channel States */ mutex_lock(&bam_pdev_mutexlock); Loading Loading @@ -2086,7 +2066,7 @@ static int bam_init(void) a2_props.summing_threshold = A2_SUMMING_THRESHOLD; a2_props.constrained_logging = true; a2_props.logging_number = 1; if (cpu_is_msm9615() || satellite_mode) if (satellite_mode) a2_props.manage = SPS_BAM_MGR_DEVICE_REMOTE; /* need to free on tear down */ ret = bam_ops->sps_register_bam_device_ptr(&a2_props, &h); Loading Loading @@ -2237,70 +2217,6 @@ ioremap_failed: return ret; } static int bam_init_fallback(void) { u32 h; int ret; void *a2_virt_addr; /* init BAM */ a2_virt_addr = ioremap_nocache((unsigned long)(a2_phys_base), a2_phys_size); if (!a2_virt_addr) { pr_err("%s: ioremap failed\n", __func__); ret = -ENOMEM; goto ioremap_failed; } a2_props.phys_addr = (u32)(a2_phys_base); a2_props.virt_addr = a2_virt_addr; a2_props.virt_size = a2_phys_size; a2_props.irq = a2_bam_irq; a2_props.options = SPS_BAM_OPT_IRQ_WAKEUP; a2_props.num_pipes = A2_NUM_PIPES; a2_props.summing_threshold = A2_SUMMING_THRESHOLD; if (cpu_is_msm9615() || satellite_mode) a2_props.manage = SPS_BAM_MGR_DEVICE_REMOTE; ret = bam_ops->sps_register_bam_device_ptr(&a2_props, &h); if (ret < 0) { pr_err("%s: register bam error %d\n", __func__, ret); goto register_bam_failed; } a2_device_handle = h; mutex_lock(&delayed_ul_vote_lock); bam_mux_initialized = 1; if (need_delayed_ul_vote) { need_delayed_ul_vote = 0; msm_bam_dmux_kickoff_ul_wakeup(); } mutex_unlock(&delayed_ul_vote_lock); toggle_apps_ack(); power_management_only_mode = 1; bam_connection_is_active = 1; complete_all(&bam_connection_completion); return 0; register_bam_failed: iounmap(a2_virt_addr); ioremap_failed: return ret; } static void msm9615_bam_init(void) { int ret = 0; ret = bam_init(); if (ret) { ret = bam_init_fallback(); if (ret) pr_err("%s: bam init fallback failed: %d", __func__, ret); } } static void toggle_apps_ack(void) { static unsigned int clear_bit; /* 0 = set the bit, else clear bit */ Loading Loading @@ -2348,9 +2264,6 @@ static void bam_dmux_smsm_cb(void *priv, uint32_t old_state, uint32_t new_state) } else if (new_state & SMSM_A2_POWER_CONTROL) { BAM_DMUX_LOG("%s: init\n", __func__); grab_wakelock(); if (cpu_is_msm9615()) msm9615_bam_init(); else bam_init(); } else { BAM_DMUX_LOG("%s: bad state change\n", __func__); Loading Loading
arch/arm/mach-msm/bam_dmux.c +46 −133 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <linux/debugfs.h> #include <linux/clk.h> #include <linux/wakelock.h> #include <linux/kfifo.h> #include <linux/of.h> #include <linux/ipc_logging.h> #include <linux/srcu.h> Loading Loading @@ -229,7 +228,6 @@ static struct srcu_struct bam_dmux_srcu; /* A2 power collaspe */ #define UL_TIMEOUT_DELAY 1000 /* in ms */ #define ENABLE_DISCONNECT_ACK 0x1 #define SHUTDOWN_TIMEOUT_MS 500 #define UL_WAKEUP_TIMEOUT_MS 2000 static void toggle_apps_ack(void); Loading Loading @@ -264,12 +262,10 @@ static struct completion dfab_unvote_completion; static DEFINE_SPINLOCK(wakelock_reference_lock); static int wakelock_reference_count; static int a2_pc_disabled_wakelock_skipped; static int disconnect_ack = 1; static LIST_HEAD(bam_other_notify_funcs); static DEFINE_MUTEX(smsm_cb_lock); static DEFINE_MUTEX(delayed_ul_vote_lock); static int need_delayed_ul_vote; static int power_management_only_mode; static int in_ssr; static int ssr_skipped_disconnect; static struct completion shutdown_completion; Loading Loading @@ -304,7 +300,6 @@ static int in_global_reset; #define bam_ch_is_in_reset(x) \ (bam_ch[(x)].status & BAM_CH_IN_RESET) struct kfifo bam_dmux_state_log; static int bam_dmux_uplink_vote; static int bam_dmux_power_state; Loading Loading @@ -334,7 +329,7 @@ static void *bam_ipc_log_txt; do { \ if (bam_ipc_log_txt) { \ ipc_log_string(bam_ipc_log_txt, \ "<DMUX> %c%c%c%c %c%c%c%c%d%c " fmt, \ "<DMUX> %c%c%c%c %c%c%c%c%d " fmt, \ a2_pc_disabled ? 'D' : 'd', \ in_global_reset ? 'R' : 'r', \ bam_dmux_power_state ? 'P' : 'p', \ Loading @@ -344,7 +339,6 @@ do { \ wait_for_ack ? 'W' : 'w', \ ul_wakeup_ack_completion.done ? 'A' : 'a', \ atomic_read(&ul_ondemand_vote), \ disconnect_ack ? 'D' : 'd', \ args); \ } \ } while (0) Loading Loading @@ -588,11 +582,6 @@ static void handle_bam_mux_cmd(struct work_struct *work) BAM_DMUX_LOG("%s: opening cid %d PC enabled\n", __func__, rx_hdr->ch_id); handle_bam_mux_cmd_open(rx_hdr); if (!(rx_hdr->reserved & ENABLE_DISCONNECT_ACK)) { BAM_DMUX_LOG("%s: deactivating disconnect ack\n", __func__); disconnect_ack = 0; } dev_kfree_skb_any(rx_skb); break; case BAM_MUX_HDR_CMD_OPEN_NO_A2_PC: Loading Loading @@ -1775,7 +1764,7 @@ static void reconnect_to_bam(void) in_global_reset = 0; in_ssr = 0; vote_dfab(); if (!power_management_only_mode) { if (ssr_skipped_disconnect) { /* delayed to here to prevent bus stall */ bam_ops->sps_disconnect_ptr(bam_tx_pipe); Loading Loading @@ -1806,8 +1795,6 @@ static void reconnect_to_bam(void) if (i) pr_err("%s: rx event reg failed rc = %d\n", __func__, i); } bam_connection_is_active = 1; if (polling_mode) Loading @@ -1815,7 +1802,6 @@ static void reconnect_to_bam(void) toggle_apps_ack(); complete_all(&bam_connection_completion); if (!power_management_only_mode) queue_rx(); } Loading Loading @@ -1853,7 +1839,6 @@ static void disconnect_to_bam(void) INIT_COMPLETION(bam_connection_completion); /* in_ssr documentation/assumptions found in restart_notifier_cb */ if (!power_management_only_mode) { if (likely(!in_ssr)) { BAM_DMUX_LOG("%s: disconnect tx\n", __func__); bam_ops->sps_disconnect_ptr(bam_tx_pipe); Loading @@ -1866,7 +1851,6 @@ static void disconnect_to_bam(void) } else { ssr_skipped_disconnect = 1; } } unvote_dfab(); mutex_lock(&bam_rx_pool_mutexlock); Loading @@ -1881,10 +1865,7 @@ static void disconnect_to_bam(void) } bam_rx_pool_len = 0; mutex_unlock(&bam_rx_pool_mutexlock); if (disconnect_ack) toggle_apps_ack(); verify_tx_queue_is_empty(__func__); } Loading Loading @@ -2016,7 +1997,6 @@ static int restart_notifier_cb(struct notifier_block *this, ul_powerdown_finish(); a2_pc_disabled = 0; a2_pc_disabled_wakelock_skipped = 0; disconnect_ack = 1; /* Cleanup Channel States */ mutex_lock(&bam_pdev_mutexlock); Loading Loading @@ -2086,7 +2066,7 @@ static int bam_init(void) a2_props.summing_threshold = A2_SUMMING_THRESHOLD; a2_props.constrained_logging = true; a2_props.logging_number = 1; if (cpu_is_msm9615() || satellite_mode) if (satellite_mode) a2_props.manage = SPS_BAM_MGR_DEVICE_REMOTE; /* need to free on tear down */ ret = bam_ops->sps_register_bam_device_ptr(&a2_props, &h); Loading Loading @@ -2237,70 +2217,6 @@ ioremap_failed: return ret; } static int bam_init_fallback(void) { u32 h; int ret; void *a2_virt_addr; /* init BAM */ a2_virt_addr = ioremap_nocache((unsigned long)(a2_phys_base), a2_phys_size); if (!a2_virt_addr) { pr_err("%s: ioremap failed\n", __func__); ret = -ENOMEM; goto ioremap_failed; } a2_props.phys_addr = (u32)(a2_phys_base); a2_props.virt_addr = a2_virt_addr; a2_props.virt_size = a2_phys_size; a2_props.irq = a2_bam_irq; a2_props.options = SPS_BAM_OPT_IRQ_WAKEUP; a2_props.num_pipes = A2_NUM_PIPES; a2_props.summing_threshold = A2_SUMMING_THRESHOLD; if (cpu_is_msm9615() || satellite_mode) a2_props.manage = SPS_BAM_MGR_DEVICE_REMOTE; ret = bam_ops->sps_register_bam_device_ptr(&a2_props, &h); if (ret < 0) { pr_err("%s: register bam error %d\n", __func__, ret); goto register_bam_failed; } a2_device_handle = h; mutex_lock(&delayed_ul_vote_lock); bam_mux_initialized = 1; if (need_delayed_ul_vote) { need_delayed_ul_vote = 0; msm_bam_dmux_kickoff_ul_wakeup(); } mutex_unlock(&delayed_ul_vote_lock); toggle_apps_ack(); power_management_only_mode = 1; bam_connection_is_active = 1; complete_all(&bam_connection_completion); return 0; register_bam_failed: iounmap(a2_virt_addr); ioremap_failed: return ret; } static void msm9615_bam_init(void) { int ret = 0; ret = bam_init(); if (ret) { ret = bam_init_fallback(); if (ret) pr_err("%s: bam init fallback failed: %d", __func__, ret); } } static void toggle_apps_ack(void) { static unsigned int clear_bit; /* 0 = set the bit, else clear bit */ Loading Loading @@ -2348,9 +2264,6 @@ static void bam_dmux_smsm_cb(void *priv, uint32_t old_state, uint32_t new_state) } else if (new_state & SMSM_A2_POWER_CONTROL) { BAM_DMUX_LOG("%s: init\n", __func__); grab_wakelock(); if (cpu_is_msm9615()) msm9615_bam_init(); else bam_init(); } else { BAM_DMUX_LOG("%s: bad state change\n", __func__); Loading