Lines Matching refs:range

20 #define knav_range_offset_to_inst(kdev, range, q)	\  argument
21 (range->queue_base_inst + (q << kdev->inst_shift))
23 static void __knav_acc_notify(struct knav_range_info *range, in __knav_acc_notify() argument
26 struct knav_device *kdev = range->kdev; in __knav_acc_notify()
30 range_base = kdev->base_id + range->queue_base; in __knav_acc_notify()
32 if (range->flags & RANGE_MULTI_QUEUE) { in __knav_acc_notify()
33 for (queue = 0; queue < range->num_queues; queue++) { in __knav_acc_notify()
34 inst = knav_range_offset_to_inst(kdev, range, in __knav_acc_notify()
44 queue = acc->channel - range->acc_info.start_channel; in __knav_acc_notify()
45 inst = knav_range_offset_to_inst(kdev, range, queue); in __knav_acc_notify()
52 static int knav_acc_set_notify(struct knav_range_info *range, in knav_acc_set_notify() argument
56 struct knav_pdsp_info *pdsp = range->acc_info.pdsp; in knav_acc_set_notify()
57 struct knav_device *kdev = range->kdev; in knav_acc_set_notify()
81 struct knav_range_info *range; in knav_acc_int_handler() local
90 range = _instdata; in knav_acc_int_handler()
91 info = &range->acc_info; in knav_acc_int_handler()
92 kdev = range->kdev; in knav_acc_int_handler()
93 pdsp = range->acc_info.pdsp; in knav_acc_int_handler()
94 acc = range->acc; in knav_acc_int_handler()
96 range_base = kdev->base_id + range->queue_base; in knav_acc_int_handler()
97 if ((range->flags & RANGE_MULTI_QUEUE) == 0) { in knav_acc_int_handler()
98 for (queue = 0; queue < range->num_irqs; queue++) in knav_acc_int_handler()
99 if (range->irqs[queue].irq == irq) in knav_acc_int_handler()
101 kq = knav_range_offset_to_inst(kdev, range, queue); in knav_acc_int_handler()
112 __knav_acc_notify(range, acc); in knav_acc_int_handler()
147 if (range->flags & RANGE_MULTI_QUEUE) { in knav_acc_int_handler()
150 queue >= range_base + range->num_queues) { in knav_acc_int_handler()
154 range_base + range->num_queues); in knav_acc_int_handler()
158 kq = knav_range_offset_to_inst(kdev, range, in knav_acc_int_handler()
177 __knav_acc_notify(range, acc); in knav_acc_int_handler()
195 static int knav_range_setup_acc_irq(struct knav_range_info *range, in knav_range_setup_acc_irq() argument
198 struct knav_device *kdev = range->kdev; in knav_range_setup_acc_irq()
204 if (range->flags & RANGE_MULTI_QUEUE) { in knav_range_setup_acc_irq()
205 acc = range->acc; in knav_range_setup_acc_irq()
206 irq = range->irqs[0].irq; in knav_range_setup_acc_irq()
207 cpu_mask = range->irqs[0].cpu_mask; in knav_range_setup_acc_irq()
209 acc = range->acc + queue; in knav_range_setup_acc_irq()
210 irq = range->irqs[queue].irq; in knav_range_setup_acc_irq()
211 cpu_mask = range->irqs[queue].cpu_mask; in knav_range_setup_acc_irq()
233 range); in knav_range_setup_acc_irq()
237 dev_warn(range->kdev->dev, in knav_range_setup_acc_irq()
249 dev_warn(range->kdev->dev, in knav_range_setup_acc_irq()
251 free_irq(irq, range); in knav_range_setup_acc_irq()
301 struct knav_range_info *range, in knav_acc_setup_cmd() argument
305 struct knav_acc_info *info = &range->acc_info; in knav_acc_setup_cmd()
310 if (range->flags & RANGE_MULTI_QUEUE) { in knav_acc_setup_cmd()
311 acc = range->acc; in knav_acc_setup_cmd()
312 queue_base = range->queue_base; in knav_acc_setup_cmd()
313 queue_mask = BIT(range->num_queues) - 1; in knav_acc_setup_cmd()
315 acc = range->acc + queue; in knav_acc_setup_cmd()
316 queue_base = range->queue_base + queue; in knav_acc_setup_cmd()
328 if (range->flags & RANGE_MULTI_QUEUE) in knav_acc_setup_cmd()
335 struct knav_range_info *range, in knav_acc_stop() argument
342 acc = range->acc + queue; in knav_acc_stop()
344 knav_acc_setup_cmd(kdev, range, &cmd, queue); in knav_acc_stop()
346 result = knav_acc_write(kdev, range->acc_info.pdsp, &cmd); in knav_acc_stop()
353 struct knav_range_info *range, in knav_acc_start() argument
360 acc = range->acc + queue; in knav_acc_start()
362 knav_acc_setup_cmd(kdev, range, &cmd, queue); in knav_acc_start()
364 result = knav_acc_write(kdev, range->acc_info.pdsp, &cmd); in knav_acc_start()
372 static int knav_acc_init_range(struct knav_range_info *range) in knav_acc_init_range() argument
374 struct knav_device *kdev = range->kdev; in knav_acc_init_range()
379 for (queue = 0; queue < range->num_queues; queue++) { in knav_acc_init_range()
380 acc = range->acc + queue; in knav_acc_init_range()
382 knav_acc_stop(kdev, range, queue); in knav_acc_init_range()
384 result = knav_acc_start(kdev, range, queue); in knav_acc_init_range()
389 if (range->flags & RANGE_MULTI_QUEUE) in knav_acc_init_range()
395 static int knav_acc_init_queue(struct knav_range_info *range, in knav_acc_init_queue() argument
398 unsigned id = kq->id - range->queue_base; in knav_acc_init_queue()
400 kq->descs = devm_kcalloc(range->kdev->dev, in knav_acc_init_queue()
405 kq->acc = range->acc; in knav_acc_init_queue()
406 if ((range->flags & RANGE_MULTI_QUEUE) == 0) in knav_acc_init_queue()
411 static int knav_acc_open_queue(struct knav_range_info *range, in knav_acc_open_queue() argument
414 unsigned id = inst->id - range->queue_base; in knav_acc_open_queue()
416 return knav_range_setup_acc_irq(range, id, true); in knav_acc_open_queue()
419 static int knav_acc_close_queue(struct knav_range_info *range, in knav_acc_close_queue() argument
422 unsigned id = inst->id - range->queue_base; in knav_acc_close_queue()
424 return knav_range_setup_acc_irq(range, id, false); in knav_acc_close_queue()
427 static int knav_acc_free_range(struct knav_range_info *range) in knav_acc_free_range() argument
429 struct knav_device *kdev = range->kdev; in knav_acc_free_range()
434 info = &range->acc_info; in knav_acc_free_range()
436 if (range->flags & RANGE_MULTI_QUEUE) in knav_acc_free_range()
439 channels = range->num_queues; in knav_acc_free_range()
442 acc = range->acc + channel; in knav_acc_free_range()
449 devm_kfree(range->kdev->dev, range->acc); in knav_acc_free_range()
473 struct knav_range_info *range) in knav_init_acc_range() argument
484 range->flags |= RANGE_HAS_ACCUMULATOR; in knav_init_acc_range()
485 info = &range->acc_info; in knav_init_acc_range()
499 info->start_channel, range->name); in knav_init_acc_range()
505 info->pacing_mode, range->name); in knav_init_acc_range()
512 info->pdsp_id, range->name); in knav_init_acc_range()
518 info->pdsp_id, range->name); in knav_init_acc_range()
523 channels = range->num_queues; in knav_init_acc_range()
525 range->flags |= RANGE_MULTI_QUEUE; in knav_init_acc_range()
527 if (range->queue_base & (32 - 1)) { in knav_init_acc_range()
530 range->name); in knav_init_acc_range()
533 if (range->num_queues > 32) { in knav_init_acc_range()
536 range->name); in knav_init_acc_range()
547 range->acc = devm_kcalloc(kdev->dev, channels, sizeof(*range->acc), in knav_init_acc_range()
549 if (!range->acc) in knav_init_acc_range()
553 acc = range->acc + channel; in knav_init_acc_range()
581 range->ops = &knav_acc_range_ops; in knav_init_acc_range()