Lines Matching refs:smp2p
85 static void ipa_smp2p_notify(struct ipa_smp2p *smp2p) in ipa_smp2p_notify() argument
91 if (smp2p->notified) in ipa_smp2p_notify()
94 dev = &smp2p->ipa->pdev->dev; in ipa_smp2p_notify()
95 smp2p->power_on = pm_runtime_get_if_active(dev, true) > 0; in ipa_smp2p_notify()
98 mask = BIT(smp2p->enabled_bit); in ipa_smp2p_notify()
99 value = smp2p->power_on ? mask : 0; in ipa_smp2p_notify()
100 qcom_smem_state_update_bits(smp2p->enabled_state, mask, value); in ipa_smp2p_notify()
103 mask = BIT(smp2p->valid_bit); in ipa_smp2p_notify()
105 qcom_smem_state_update_bits(smp2p->valid_state, mask, value); in ipa_smp2p_notify()
107 smp2p->notified = true; in ipa_smp2p_notify()
113 struct ipa_smp2p *smp2p = dev_id; in ipa_smp2p_modem_clk_query_isr() local
115 ipa_smp2p_notify(smp2p); in ipa_smp2p_modem_clk_query_isr()
123 struct ipa_smp2p *smp2p; in ipa_smp2p_panic_notifier() local
125 smp2p = container_of(nb, struct ipa_smp2p, panic_notifier); in ipa_smp2p_panic_notifier()
127 ipa_smp2p_notify(smp2p); in ipa_smp2p_panic_notifier()
129 if (smp2p->power_on) in ipa_smp2p_panic_notifier()
130 ipa_uc_panic_notifier(smp2p->ipa); in ipa_smp2p_panic_notifier()
135 static int ipa_smp2p_panic_notifier_register(struct ipa_smp2p *smp2p) in ipa_smp2p_panic_notifier_register() argument
138 smp2p->panic_notifier.notifier_call = ipa_smp2p_panic_notifier; in ipa_smp2p_panic_notifier_register()
139 smp2p->panic_notifier.priority = INT_MAX; /* Do it early */ in ipa_smp2p_panic_notifier_register()
142 &smp2p->panic_notifier); in ipa_smp2p_panic_notifier_register()
145 static void ipa_smp2p_panic_notifier_unregister(struct ipa_smp2p *smp2p) in ipa_smp2p_panic_notifier_unregister() argument
148 &smp2p->panic_notifier); in ipa_smp2p_panic_notifier_unregister()
154 struct ipa_smp2p *smp2p = dev_id; in ipa_smp2p_modem_setup_ready_isr() local
159 if (smp2p->ipa->setup_complete) in ipa_smp2p_modem_setup_ready_isr()
163 dev = &smp2p->ipa->pdev->dev; in ipa_smp2p_modem_setup_ready_isr()
171 ret = ipa_setup(smp2p->ipa); in ipa_smp2p_modem_setup_ready_isr()
182 static int ipa_smp2p_irq_init(struct ipa_smp2p *smp2p, const char *name, in ipa_smp2p_irq_init() argument
185 struct device *dev = &smp2p->ipa->pdev->dev; in ipa_smp2p_irq_init()
189 ret = platform_get_irq_byname(smp2p->ipa->pdev, name); in ipa_smp2p_irq_init()
194 ret = request_threaded_irq(irq, NULL, handler, 0, name, smp2p); in ipa_smp2p_irq_init()
203 static void ipa_smp2p_irq_exit(struct ipa_smp2p *smp2p, u32 irq) in ipa_smp2p_irq_exit() argument
205 free_irq(irq, smp2p); in ipa_smp2p_irq_exit()
213 if (!ipa->smp2p->power_on) in ipa_smp2p_power_release()
218 ipa->smp2p->power_on = false; in ipa_smp2p_power_release()
227 struct ipa_smp2p *smp2p; in ipa_smp2p_init() local
246 smp2p = kzalloc(sizeof(*smp2p), GFP_KERNEL); in ipa_smp2p_init()
247 if (!smp2p) in ipa_smp2p_init()
250 smp2p->ipa = ipa; in ipa_smp2p_init()
255 mutex_init(&smp2p->mutex); in ipa_smp2p_init()
256 smp2p->valid_state = valid_state; in ipa_smp2p_init()
257 smp2p->valid_bit = valid_bit; in ipa_smp2p_init()
258 smp2p->enabled_state = enabled_state; in ipa_smp2p_init()
259 smp2p->enabled_bit = enabled_bit; in ipa_smp2p_init()
262 ipa->smp2p = smp2p; in ipa_smp2p_init()
264 ret = ipa_smp2p_irq_init(smp2p, "ipa-clock-query", in ipa_smp2p_init()
268 smp2p->clock_query_irq = ret; in ipa_smp2p_init()
270 ret = ipa_smp2p_panic_notifier_register(smp2p); in ipa_smp2p_init()
276 ret = ipa_smp2p_irq_init(smp2p, "ipa-setup-ready", in ipa_smp2p_init()
280 smp2p->setup_ready_irq = ret; in ipa_smp2p_init()
286 ipa_smp2p_panic_notifier_unregister(smp2p); in ipa_smp2p_init()
288 ipa_smp2p_irq_exit(smp2p, smp2p->clock_query_irq); in ipa_smp2p_init()
290 ipa->smp2p = NULL; in ipa_smp2p_init()
291 mutex_destroy(&smp2p->mutex); in ipa_smp2p_init()
292 kfree(smp2p); in ipa_smp2p_init()
299 struct ipa_smp2p *smp2p = ipa->smp2p; in ipa_smp2p_exit() local
301 if (smp2p->setup_ready_irq) in ipa_smp2p_exit()
302 ipa_smp2p_irq_exit(smp2p, smp2p->setup_ready_irq); in ipa_smp2p_exit()
303 ipa_smp2p_panic_notifier_unregister(smp2p); in ipa_smp2p_exit()
304 ipa_smp2p_irq_exit(smp2p, smp2p->clock_query_irq); in ipa_smp2p_exit()
307 ipa->smp2p = NULL; in ipa_smp2p_exit()
308 mutex_destroy(&smp2p->mutex); in ipa_smp2p_exit()
309 kfree(smp2p); in ipa_smp2p_exit()
314 struct ipa_smp2p *smp2p = ipa->smp2p; in ipa_smp2p_irq_disable_setup() local
316 if (!smp2p->setup_ready_irq) in ipa_smp2p_irq_disable_setup()
319 mutex_lock(&smp2p->mutex); in ipa_smp2p_irq_disable_setup()
321 if (!smp2p->setup_disabled) { in ipa_smp2p_irq_disable_setup()
322 disable_irq(smp2p->setup_ready_irq); in ipa_smp2p_irq_disable_setup()
323 smp2p->setup_disabled = true; in ipa_smp2p_irq_disable_setup()
326 mutex_unlock(&smp2p->mutex); in ipa_smp2p_irq_disable_setup()
332 struct ipa_smp2p *smp2p = ipa->smp2p; in ipa_smp2p_notify_reset() local
335 if (!smp2p->notified) in ipa_smp2p_notify_reset()
341 mask = BIT(smp2p->valid_bit); in ipa_smp2p_notify_reset()
342 qcom_smem_state_update_bits(smp2p->valid_state, mask, 0); in ipa_smp2p_notify_reset()
345 mask = BIT(smp2p->enabled_bit); in ipa_smp2p_notify_reset()
346 qcom_smem_state_update_bits(smp2p->enabled_state, mask, 0); in ipa_smp2p_notify_reset()
348 smp2p->notified = false; in ipa_smp2p_notify_reset()