~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to sound/soc/omap/abe/abe_main.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
  This file is provided under a dual BSD/GPLv2 license.  When using or
 
4
  redistributing this file, you may do so under either license.
 
5
 
 
6
  GPL LICENSE SUMMARY
 
7
 
 
8
  Copyright(c) 2010-2011 Texas Instruments Incorporated,
 
9
  All rights reserved.
 
10
 
 
11
  This program is free software; you can redistribute it and/or modify
 
12
  it under the terms of version 2 of the GNU General Public License as
 
13
  published by the Free Software Foundation.
 
14
 
 
15
  This program is distributed in the hope that it will be useful, but
 
16
  WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
18
  General Public License for more details.
 
19
 
 
20
  You should have received a copy of the GNU General Public License
 
21
  along with this program; if not, write to the Free Software
 
22
  Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 
23
  The full GNU General Public License is included in this distribution
 
24
  in the file called LICENSE.GPL.
 
25
 
 
26
  BSD LICENSE
 
27
 
 
28
  Copyright(c) 2010-2011 Texas Instruments Incorporated,
 
29
  All rights reserved.
 
30
 
 
31
  Redistribution and use in source and binary forms, with or without
 
32
  modification, are permitted provided that the following conditions
 
33
  are met:
 
34
 
 
35
    * Redistributions of source code must retain the above copyright
 
36
      notice, this list of conditions and the following disclaimer.
 
37
    * Redistributions in binary form must reproduce the above copyright
 
38
      notice, this list of conditions and the following disclaimer in
 
39
      the documentation and/or other materials provided with the
 
40
      distribution.
 
41
    * Neither the name of Texas Instruments Incorporated nor the names of
 
42
      its contributors may be used to endorse or promote products derived
 
43
      from this software without specific prior written permission.
 
44
 
 
45
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
46
  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
47
  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
48
  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 
49
  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
50
  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
51
  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
52
  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
53
  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
54
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
55
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
56
 
 
57
*/
 
58
 
 
59
#include <linux/kernel.h>
 
60
#include <linux/module.h>
 
61
#include <linux/io.h>
 
62
#include <linux/module.h>
 
63
#include <linux/slab.h>
 
64
 
 
65
#include "abe_legacy.h"
 
66
#include "abe_dbg.h"
 
67
#include "abe_port.h"
 
68
 
 
69
 
 
70
struct omap_abe_equ {
 
71
        /* type of filter */
 
72
        u32 equ_type;
 
73
        /* filter length */
 
74
        u32 equ_length;
 
75
        union {
 
76
                /* parameters are the direct and recursive coefficients in */
 
77
                /* Q6.26 integer fixed-point format. */
 
78
                s32 type1[NBEQ1];
 
79
                struct {
 
80
                        /* center frequency of the band [Hz] */
 
81
                        s32 freq[NBEQ2];
 
82
                        /* gain of each band. [dB] */
 
83
                        s32 gain[NBEQ2];
 
84
                        /* Q factor of this band [dB] */
 
85
                        s32 q[NBEQ2];
 
86
                } type2;
 
87
        } coef;
 
88
        s32 equ_param3;
 
89
};
 
90
 
 
91
#include "abe_gain.h"
 
92
#include "abe_aess.h"
 
93
#include "abe_seq.h"
 
94
 
 
95
 
 
96
int omap_abe_connect_debug_trace(struct omap_abe *abe,
 
97
                                 struct omap_abe_dma *dma2);
 
98
 
 
99
int omap_abe_reset_hal(struct omap_abe *abe);
 
100
int omap_abe_load_fw(struct omap_abe *abe);
 
101
int omap_abe_wakeup(struct omap_abe *abe);
 
102
int omap_abe_irq_processing(struct omap_abe *abe);
 
103
int omap_abe_clear_irq(struct omap_abe *abe);
 
104
int omap_abe_disable_irq(struct omap_abe *abe);
 
105
int omap_abe_set_debug_trace(struct omap_abe_dbg *dbg, int debug);
 
106
int omap_abe_set_ping_pong_buffer(struct omap_abe *abe,
 
107
                                                u32 port, u32 n_bytes);
 
108
int omap_abe_read_next_ping_pong_buffer(struct omap_abe *abe,
 
109
                                                u32 port, u32 *p, u32 *n);
 
110
int omap_abe_init_ping_pong_buffer(struct omap_abe *abe,
 
111
                                        u32 id, u32 size_bytes, u32 n_buffers,
 
112
                                        u32 *p);
 
113
int omap_abe_read_offset_from_ping_buffer(struct omap_abe *abe,
 
114
                                                u32 id, u32 *n);
 
115
int omap_abe_set_router_configuration(struct omap_abe *abe,
 
116
                                        u32 id, u32 k, u32 *param);
 
117
int omap_abe_set_opp_processing(struct omap_abe *abe, u32 opp);
 
118
int omap_abe_disable_data_transfer(struct omap_abe *abe, u32 id);
 
119
int omap_abe_enable_data_transfer(struct omap_abe *abe, u32 id);
 
120
int omap_abe_connect_cbpr_dmareq_port(struct omap_abe *abe,
 
121
                                                u32 id, abe_data_format_t *f,
 
122
                                                u32 d,
 
123
                                                abe_dma_t *returned_dma_t);
 
124
int omap_abe_connect_irq_ping_pong_port(struct omap_abe *abe,
 
125
                                             u32 id, abe_data_format_t *f,
 
126
                                             u32 subroutine_id, u32 size,
 
127
                                             u32 *sink, u32 dsp_mcu_flag);
 
128
int omap_abe_connect_serial_port(struct omap_abe *abe,
 
129
                                 u32 id, abe_data_format_t *f,
 
130
                                 u32 mcbsp_id);
 
131
int omap_abe_read_port_address(struct omap_abe *abe,
 
132
                               u32 port, abe_dma_t *dma2);
 
133
int omap_abe_check_activity(struct omap_abe *abe);
 
134
 
 
135
int omap_abe_use_compensated_gain(struct omap_abe *abe, int on_off);
 
136
int omap_abe_write_equalizer(struct omap_abe *abe,
 
137
                             u32 id, struct omap_abe_equ *param);
 
138
 
 
139
int omap_abe_disable_gain(struct omap_abe *abe, u32 id, u32 p);
 
140
int omap_abe_enable_gain(struct omap_abe *abe, u32 id, u32 p);
 
141
int omap_abe_mute_gain(struct omap_abe *abe, u32 id, u32 p);
 
142
int omap_abe_unmute_gain(struct omap_abe *abe, u32 id, u32 p);
 
143
 
 
144
int omap_abe_write_gain(struct omap_abe *abe,
 
145
                        u32 id, s32 f_g, u32 ramp, u32 p);
 
146
int omap_abe_write_mixer(struct omap_abe *abe,
 
147
                         u32 id, s32 f_g, u32 f_ramp, u32 p);
 
148
int omap_abe_read_gain(struct omap_abe *abe,
 
149
                       u32 id, u32 *f_g, u32 p);
 
150
int omap_abe_read_mixer(struct omap_abe *abe,
 
151
                        u32 id, u32 *f_g, u32 p);
 
152
 
 
153
extern struct omap_abe *abe;
 
154
 
 
155
#if 0
 
156
/**
 
157
 * abe_init_mem - Allocate Kernel space memory map for ABE
 
158
 *
 
159
 * Memory map of ABE memory space for PMEM/DMEM/SMEM/DMEM
 
160
 */
 
161
void abe_init_mem(void __iomem *_io_base)
 
162
{
 
163
        omap_abe_init_mem(abe, _io_base);
 
164
}
 
165
EXPORT_SYMBOL(abe_init_mem);
 
166
 
 
167
struct omap_abe* abe_probe_aess(void)
 
168
{
 
169
        return omap_abe_probe_aess(abe);
 
170
}
 
171
EXPORT_SYMBOL(abe_probe_aess);
 
172
 
 
173
void abe_remove_aess(void)
 
174
{
 
175
        omap_abe_remove_aess(abe);
 
176
}
 
177
EXPORT_SYMBOL(abe_remove_aess);
 
178
 
 
179
void abe_add_subroutine(u32 *id, abe_subroutine2 f,
 
180
                                                u32 nparam, u32 *params)
 
181
{
 
182
        omap_abe_add_subroutine(abe, id, f, nparam, params);
 
183
}
 
184
EXPORT_SYMBOL(abe_add_subroutine);
 
185
 
 
186
#endif
 
187
 
 
188
/**
 
189
 * abe_reset_hal - reset the ABE/HAL
 
190
 * @rdev: regulator source
 
191
 * @constraints: constraints to apply
 
192
 *
 
193
 * Operations : reset the HAL by reloading the static variables and
 
194
 * default AESS registers.
 
195
 * Called after a PRCM cold-start reset of ABE
 
196
 */
 
197
u32 abe_reset_hal(void)
 
198
{
 
199
        omap_abe_reset_hal(abe);
 
200
        return 0;
 
201
}
 
202
EXPORT_SYMBOL(abe_reset_hal);
 
203
 
 
204
/**
 
205
 * abe_load_fw - Load ABE Firmware and initialize memories
 
206
 *
 
207
 */
 
208
u32 abe_load_fw(void)
 
209
{
 
210
        omap_abe_load_fw(abe);
 
211
        return 0;
 
212
}
 
213
EXPORT_SYMBOL(abe_load_fw);
 
214
 
 
215
/**
 
216
 * abe_wakeup - Wakeup ABE
 
217
 *
 
218
 * Wakeup ABE in case of retention
 
219
 */
 
220
u32 abe_wakeup(void)
 
221
{
 
222
        omap_abe_wakeup(abe);
 
223
        return 0;
 
224
}
 
225
EXPORT_SYMBOL(abe_wakeup);
 
226
 
 
227
/**
 
228
 * abe_irq_processing - Process ABE interrupt
 
229
 *
 
230
 * This subroutine is call upon reception of "MA_IRQ_99 ABE_MPU_IRQ" Audio
 
231
 * back-end interrupt. This subroutine will check the ATC Hrdware, the
 
232
 * IRQ_FIFO from the AE and act accordingly. Some IRQ source are originated
 
233
 * for the delivery of "end of time sequenced tasks" notifications, some are
 
234
 * originated from the Ping-Pong protocols, some are generated from
 
235
 * the embedded debugger when the firmware stops on programmable break-points,
 
236
 * etc ...
 
237
 */
 
238
u32 abe_irq_processing(void)
 
239
{
 
240
        omap_abe_irq_processing(abe);
 
241
        return 0;
 
242
}
 
243
EXPORT_SYMBOL(abe_irq_processing);
 
244
 
 
245
/**
 
246
 * abe_clear_irq - clear ABE interrupt
 
247
 *
 
248
 * This subroutine is call to clear MCU Irq
 
249
 */
 
250
u32 abe_clear_irq(void)
 
251
{
 
252
        omap_abe_clear_irq(abe);
 
253
        return 0;
 
254
}
 
255
EXPORT_SYMBOL(abe_clear_irq);
 
256
 
 
257
/**
 
258
 * abe_disable_irq - disable MCU/DSP ABE interrupt
 
259
 *
 
260
 * This subroutine is disabling ABE MCU/DSP Irq
 
261
 */
 
262
u32 abe_disable_irq(void)
 
263
{
 
264
        omap_abe_disable_irq(abe);
 
265
 
 
266
        return 0;
 
267
}
 
268
EXPORT_SYMBOL(abe_disable_irq);
 
269
 
 
270
/**
 
271
 * abe_write_event_generator - Selects event generator source
 
272
 * @e: Event Generation Counter, McPDM, DMIC or default.
 
273
 *
 
274
 * Loads the AESS event generator hardware source.
 
275
 * Loads the firmware parameters accordingly.
 
276
 * Indicates to the FW which data stream is the most important to preserve
 
277
 * in case all the streams are asynchronous.
 
278
 * If the parameter is "default", then HAL decides which Event source
 
279
 * is the best appropriate based on the opened ports.
 
280
 *
 
281
 * When neither the DMIC and the McPDM are activated, the AE will have
 
282
 * its EVENT generator programmed with the EVENT_COUNTER.
 
283
 * The event counter will be tuned in order to deliver a pulse frequency higher
 
284
 * than 96 kHz.
 
285
 * The DPLL output at 100% OPP is MCLK = (32768kHz x6000) = 196.608kHz
 
286
 * The ratio is (MCLK/96000)+(1<<1) = 2050
 
287
 * (1<<1) in order to have the same speed at 50% and 100% OPP
 
288
 * (only 15 MSB bits are used at OPP50%)
 
289
 */
 
290
u32 abe_write_event_generator(u32 e) // should integarte abe as parameter
 
291
{
 
292
        omap_abe_write_event_generator(abe, e);
 
293
        return 0;
 
294
}
 
295
EXPORT_SYMBOL(abe_write_event_generator);
 
296
 
 
297
/**
 
298
 * abe_start_event_generator - Starts event generator source
 
299
 *
 
300
 * Start the event genrator of AESS. No more event will be send to AESS engine.
 
301
 * Upper layer must wait 1/96kHz to be sure that engine reaches
 
302
 * the IDLE instruction.
 
303
 */
 
304
u32 abe_stop_event_generator(void)
 
305
{
 
306
        omap_abe_stop_event_generator(abe);
 
307
        return 0;
 
308
}
 
309
EXPORT_SYMBOL(abe_stop_event_generator);
 
310
 
 
311
/**
 
312
 * abe_connect_debug_trace
 
313
 * @dma2:pointer to the DMEM trace buffer
 
314
 *
 
315
 * returns the address and size of the real-time debug trace buffer,
 
316
 * the content of which will vary from one firmware release to another
 
317
 */
 
318
u32 abe_connect_debug_trace(abe_dma_t *dma2)
 
319
{
 
320
        omap_abe_connect_debug_trace(abe, (struct omap_abe_dma *)dma2);
 
321
        return 0;
 
322
}
 
323
EXPORT_SYMBOL(abe_connect_debug_trace);
 
324
 
 
325
/**
 
326
 * abe_set_debug_trace
 
327
 * @debug: debug ID from a list to be defined
 
328
 *
 
329
 * loads a mask which filters the debug trace to dedicated types of data
 
330
 */
 
331
u32 abe_set_debug_trace(abe_dbg_t debug)
 
332
{
 
333
        omap_abe_set_debug_trace(&abe->dbg, (int)(debug));
 
334
        return 0;
 
335
}
 
336
EXPORT_SYMBOL(abe_set_debug_trace);
 
337
 
 
338
/**
 
339
 * abe_set_ping_pong_buffer
 
340
 * @port: ABE port ID
 
341
 * @n_bytes: Size of Ping/Pong buffer
 
342
 *
 
343
 * Updates the next ping-pong buffer with "size" bytes copied from the
 
344
 * host processor. This API notifies the FW that the data transfer is done.
 
345
 */
 
346
u32 abe_set_ping_pong_buffer(u32 port, u32 n_bytes)
 
347
{
 
348
        omap_abe_set_ping_pong_buffer(abe, port, n_bytes);
 
349
        return 0;
 
350
}
 
351
EXPORT_SYMBOL(abe_set_ping_pong_buffer);
 
352
 
 
353
/**
 
354
 * abe_read_next_ping_pong_buffer
 
355
 * @port: ABE portID
 
356
 * @p: Next buffer address (pointer)
 
357
 * @n: Next buffer size (pointer)
 
358
 *
 
359
 * Tell the next base address of the next ping_pong Buffer and its size
 
360
 */
 
361
u32 abe_read_next_ping_pong_buffer(u32 port, u32 *p, u32 *n)
 
362
{
 
363
        omap_abe_read_next_ping_pong_buffer(abe, port, p, n);
 
364
        return 0;
 
365
}
 
366
EXPORT_SYMBOL(abe_read_next_ping_pong_buffer);
 
367
 
 
368
/**
 
369
 * abe_init_ping_pong_buffer
 
370
 * @id: ABE port ID
 
371
 * @size_bytes:size of the ping pong
 
372
 * @n_buffers:number of buffers (2 = ping/pong)
 
373
 * @p:returned address of the ping-pong list of base addresses
 
374
 *      (byte offset from DMEM start)
 
375
 *
 
376
 * Computes the base address of the ping_pong buffers
 
377
 */
 
378
u32 abe_init_ping_pong_buffer(u32 id, u32 size_bytes, u32 n_buffers,
 
379
                                        u32 *p)
 
380
{
 
381
        omap_abe_init_ping_pong_buffer(abe, id, size_bytes, n_buffers, p);
 
382
        return 0;
 
383
}
 
384
EXPORT_SYMBOL(abe_init_ping_pong_buffer);
 
385
 
 
386
/**
 
387
 * abe_read_offset_from_ping_buffer
 
388
 * @id: ABE port ID
 
389
 * @n:  returned address of the offset
 
390
 *      from the ping buffer start address (in samples)
 
391
 *
 
392
 * Computes the current firmware ping pong read pointer location,
 
393
 * expressed in samples, as the offset from the start address of ping buffer.
 
394
 */
 
395
u32 abe_read_offset_from_ping_buffer(u32 id, u32 *n)
 
396
{
 
397
        omap_abe_read_offset_from_ping_buffer(abe, id, n);
 
398
        return 0;
 
399
}
 
400
EXPORT_SYMBOL(abe_read_offset_from_ping_buffer);
 
401
 
 
402
/**
 
403
 * abe_write_equalizer
 
404
 * @id: name of the equalizer
 
405
 * @param : equalizer coefficients
 
406
 *
 
407
 * Load the coefficients in CMEM.
 
408
 */
 
409
u32 abe_write_equalizer(u32 id, abe_equ_t *param)
 
410
{
 
411
        omap_abe_write_equalizer(abe, id, (struct omap_abe_equ *)param);
 
412
        return 0;
 
413
}
 
414
EXPORT_SYMBOL(abe_write_equalizer);
 
415
/**
 
416
 * abe_disable_gain
 
417
 * Parameters:
 
418
 *      mixer id
 
419
 *      sub-port id
 
420
 *
 
421
 */
 
422
u32 abe_disable_gain(u32 id, u32 p)
 
423
{
 
424
        omap_abe_disable_gain(abe, id, p);
 
425
        return 0;
 
426
}
 
427
EXPORT_SYMBOL(abe_disable_gain);
 
428
/**
 
429
 * abe_enable_gain
 
430
 * Parameters:
 
431
 *      mixer id
 
432
 *      sub-port id
 
433
 *
 
434
 */
 
435
u32 abe_enable_gain(u32 id, u32 p)
 
436
{
 
437
        omap_abe_enable_gain(abe, id, p);
 
438
        return 0;
 
439
}
 
440
EXPORT_SYMBOL(abe_enable_gain);
 
441
 
 
442
/**
 
443
 * abe_mute_gain
 
444
 * Parameters:
 
445
 *      mixer id
 
446
 *      sub-port id
 
447
 *
 
448
 */
 
449
u32 abe_mute_gain(u32 id, u32 p)
 
450
{
 
451
        omap_abe_mute_gain(abe, id, p);
 
452
        return 0;
 
453
}
 
454
EXPORT_SYMBOL(abe_mute_gain);
 
455
 
 
456
/**
 
457
 * abe_unmute_gain
 
458
 * Parameters:
 
459
 *      mixer id
 
460
 *      sub-port id
 
461
 *
 
462
 */
 
463
u32 abe_unmute_gain(u32 id, u32 p)
 
464
{
 
465
        omap_abe_unmute_gain(abe, id, p);
 
466
        return 0;
 
467
}
 
468
EXPORT_SYMBOL(abe_unmute_gain);
 
469
 
 
470
/**
 
471
 * abe_write_gain
 
472
 * @id: gain name or mixer name
 
473
 * @f_g: list of input gains of the mixer
 
474
 * @ramp: gain ramp speed factor
 
475
 * @p: list of ports corresponding to the above gains
 
476
 *
 
477
 * Loads the gain coefficients to FW memory. This API can be called when
 
478
 * the corresponding MIXER is not activated. After reloading the firmware
 
479
 * the default coefficients corresponds to "all input and output mixer's gain
 
480
 * in mute state". A mixer is disabled with a network reconfiguration
 
481
 * corresponding to an OPP value.
 
482
 */
 
483
u32 abe_write_gain(u32 id, s32 f_g, u32 ramp, u32 p)
 
484
{
 
485
        omap_abe_write_gain(abe, id, f_g, ramp, p);
 
486
        return 0;
 
487
}
 
488
EXPORT_SYMBOL(abe_write_gain);
 
489
 
 
490
/**
 
491
 * abe_write_mixer
 
492
 * @id: name of the mixer
 
493
 * @param: input gains and delay ramp of the mixer
 
494
 * @p: port corresponding to the above gains
 
495
 *
 
496
 * Load the gain coefficients in FW memory. This API can be called when
 
497
 * the corresponding MIXER is not activated. After reloading the firmware
 
498
 * the default coefficients corresponds to "all input and output mixer's
 
499
 * gain in mute state". A mixer is disabled with a network reconfiguration
 
500
 * corresponding to an OPP value.
 
501
 */
 
502
u32 abe_write_mixer(u32 id, s32 f_g, u32 f_ramp, u32 p)
 
503
{
 
504
        omap_abe_write_gain(abe, id, f_g, f_ramp, p);
 
505
        return 0;
 
506
}
 
507
EXPORT_SYMBOL(abe_write_mixer);
 
508
 
 
509
/**
 
510
 * abe_read_gain
 
511
 * @id: name of the mixer
 
512
 * @param: list of input gains of the mixer
 
513
 * @p: list of port corresponding to the above gains
 
514
 *
 
515
 */
 
516
u32 abe_read_gain(u32 id, u32 *f_g, u32 p)
 
517
{
 
518
        omap_abe_read_gain(abe, id, f_g, p);
 
519
        return 0;
 
520
}
 
521
EXPORT_SYMBOL(abe_read_gain);
 
522
 
 
523
/**
 
524
 * abe_read_mixer
 
525
 * @id: name of the mixer
 
526
 * @param: gains of the mixer
 
527
 * @p: port corresponding to the above gains
 
528
 *
 
529
 * Load the gain coefficients in FW memory. This API can be called when
 
530
 * the corresponding MIXER is not activated. After reloading the firmware
 
531
 * the default coefficients corresponds to "all input and output mixer's
 
532
 * gain in mute state". A mixer is disabled with a network reconfiguration
 
533
 * corresponding to an OPP value.
 
534
 */
 
535
u32 abe_read_mixer(u32 id, u32 *f_g, u32 p)
 
536
{
 
537
        omap_abe_read_gain(abe, id, f_g, p);
 
538
        return 0;
 
539
}
 
540
EXPORT_SYMBOL(abe_read_mixer);
 
541
 
 
542
/**
 
543
 * abe_set_router_configuration
 
544
 * @Id: name of the router
 
545
 * @Conf: id of the configuration
 
546
 * @param: list of output index of the route
 
547
 *
 
548
 * The uplink router takes its input from DMIC (6 samples), AMIC (2 samples)
 
549
 * and PORT1/2 (2 stereo ports). Each sample will be individually stored in
 
550
 * an intermediate table of 10 elements.
 
551
 *
 
552
 * Example of router table parameter for voice uplink with phoenix microphones
 
553
 *
 
554
 * indexes 0 .. 9 = MM_UL description (digital MICs and MMEXTIN)
 
555
 *      DMIC1_L_labelID, DMIC1_R_labelID, DMIC2_L_labelID, DMIC2_R_labelID,
 
556
 *      MM_EXT_IN_L_labelID, MM_EXT_IN_R_labelID, ZERO_labelID, ZERO_labelID,
 
557
 *      ZERO_labelID, ZERO_labelID,
 
558
 * indexes 10 .. 11 = MM_UL2 description (recording on DMIC3)
 
559
 *      DMIC3_L_labelID, DMIC3_R_labelID,
 
560
 * indexes 12 .. 13 = VX_UL description (VXUL based on PDMUL data)
 
561
 *      AMIC_L_labelID, AMIC_R_labelID,
 
562
 * indexes 14 .. 15 = RESERVED (NULL)
 
563
 *      ZERO_labelID, ZERO_labelID,
 
564
 */
 
565
u32 abe_set_router_configuration(u32 id, u32 k, u32 *param)
 
566
{
 
567
        omap_abe_set_router_configuration(abe, id, k, param);
 
568
        return 0;
 
569
}
 
570
EXPORT_SYMBOL(abe_set_router_configuration);
 
571
 
 
572
/**
 
573
 * abe_set_opp_processing - Set OPP mode for ABE Firmware
 
574
 * @opp: OOPP mode
 
575
 *
 
576
 * New processing network and OPP:
 
577
 * 0: Ultra Lowest power consumption audio player (no post-processing, no mixer)
 
578
 * 1: OPP 25% (simple multimedia features, including low-power player)
 
579
 * 2: OPP 50% (multimedia and voice calls)
 
580
 * 3: OPP100% ( multimedia complex use-cases)
 
581
 *
 
582
 * Rearranges the FW task network to the corresponding OPP list of features.
 
583
 * The corresponding AE ports are supposed to be set/reset accordingly before
 
584
 * this switch.
 
585
 *
 
586
 */
 
587
u32 abe_set_opp_processing(u32 opp)
 
588
{
 
589
        omap_abe_set_opp_processing(abe, opp);
 
590
        return 0;
 
591
}
 
592
EXPORT_SYMBOL(abe_set_opp_processing);
 
593
 
 
594
/**
 
595
 * abe_disable_data_transfer
 
596
 * @id: ABE port id
 
597
 *
 
598
 * disables the ATC descriptor and stop IO/port activities
 
599
 * disable the IO task (@f = 0)
 
600
 * clear ATC DMEM buffer, ATC enabled
 
601
 */
 
602
u32 abe_disable_data_transfer(u32 id)
 
603
{
 
604
        omap_abe_disable_data_transfer(abe, id);
 
605
        return 0;
 
606
}
 
607
EXPORT_SYMBOL(abe_disable_data_transfer);
 
608
 
 
609
/**
 
610
 * abe_enable_data_transfer
 
611
 * @ip: ABE port id
 
612
 *
 
613
 * enables the ATC descriptor
 
614
 * reset ATC pointers
 
615
 * enable the IO task (@f <> 0)
 
616
 */
 
617
u32 abe_enable_data_transfer(u32 id)
 
618
{
 
619
        omap_abe_enable_data_transfer(abe, id);
 
620
        return 0;
 
621
}
 
622
EXPORT_SYMBOL(abe_enable_data_transfer);
 
623
 
 
624
/**
 
625
 * abe_connect_cbpr_dmareq_port
 
626
 * @id: port name
 
627
 * @f: desired data format
 
628
 * @d: desired dma_request line (0..7)
 
629
 * @a: returned pointer to the base address of the CBPr register and number of
 
630
 *      samples to exchange during a DMA_request.
 
631
 *
 
632
 * enables the data echange between a DMA and the ABE through the
 
633
 *      CBPr registers of AESS.
 
634
 */
 
635
u32 abe_connect_cbpr_dmareq_port(u32 id, abe_data_format_t *f, u32 d,
 
636
                                           abe_dma_t *returned_dma_t)
 
637
{
 
638
        omap_abe_connect_cbpr_dmareq_port(abe, id, f, d, returned_dma_t);
 
639
        return 0;
 
640
}
 
641
EXPORT_SYMBOL(abe_connect_cbpr_dmareq_port);
 
642
 
 
643
/**
 
644
 * abe_connect_irq_ping_pong_port
 
645
 * @id: port name
 
646
 * @f: desired data format
 
647
 * @I: index of the call-back subroutine to call
 
648
 * @s: half-buffer (ping) size
 
649
 * @p: returned base address of the first (ping) buffer)
 
650
 *
 
651
 * enables the data echanges between a direct access to the DMEM
 
652
 * memory of ABE using cache flush. On each IRQ activation a subroutine
 
653
 * registered with "abe_plug_subroutine" will be called. This subroutine
 
654
 * will generate an amount of samples, send them to DMEM memory and call
 
655
 * "abe_set_ping_pong_buffer" to notify the new amount of samples in the
 
656
 * pong buffer.
 
657
 */
 
658
u32 abe_connect_irq_ping_pong_port(u32 id, abe_data_format_t *f,
 
659
                                             u32 subroutine_id, u32 size,
 
660
                                             u32 *sink, u32 dsp_mcu_flag)
 
661
{
 
662
        omap_abe_connect_irq_ping_pong_port(abe, id, f, subroutine_id, size,
 
663
                                             sink, dsp_mcu_flag);
 
664
        return 0;
 
665
}
 
666
EXPORT_SYMBOL(abe_connect_irq_ping_pong_port);
 
667
 
 
668
/**
 
669
 * abe_connect_serial_port()
 
670
 * @id: port name
 
671
 * @f: data format
 
672
 * @i: peripheral ID (McBSP #1, #2, #3)
 
673
 *
 
674
 * Operations : enables the data echanges between a McBSP and an ATC buffer in
 
675
 * DMEM. This API is used connect 48kHz McBSP streams to MM_DL and 8/16kHz
 
676
 * voice streams to VX_UL, VX_DL, BT_VX_UL, BT_VX_DL. It abstracts the
 
677
 * abe_write_port API.
 
678
 */
 
679
u32 abe_connect_serial_port(u32 id, abe_data_format_t *f,
 
680
                                      u32 mcbsp_id)
 
681
{
 
682
        omap_abe_connect_serial_port(abe, id, f, mcbsp_id);
 
683
        return 0;
 
684
}
 
685
EXPORT_SYMBOL(abe_connect_serial_port);
 
686
 
 
687
/**
 
688
 * abe_read_port_address
 
689
 * @dma: output pointer to the DMA iteration and data destination pointer
 
690
 *
 
691
 * This API returns the address of the DMA register used on this audio port.
 
692
 * Depending on the protocol being used, adds the base address offset L3
 
693
 * (DMA) or MPU (ARM)
 
694
 */
 
695
u32 abe_read_port_address(u32 port, abe_dma_t *dma2)
 
696
{
 
697
        omap_abe_read_port_address(abe, port, dma2);
 
698
        return 0;
 
699
}
 
700
EXPORT_SYMBOL(abe_read_port_address);
 
701
 
 
702
/**
 
703
 * abe_check_activity - Check if some ABE activity.
 
704
 *
 
705
 * Check if any ABE ports are running.
 
706
 * return 1: still activity on ABE
 
707
 * return 0: no more activity on ABE. Event generator can be stopped
 
708
 *
 
709
 */
 
710
u32 abe_check_activity(void)
 
711
{
 
712
        return (u32)omap_abe_check_activity(abe);
 
713
}
 
714
EXPORT_SYMBOL(abe_check_activity);
 
715
/**
 
716
 * abe_use_compensated_gain
 
717
 * @on_off:
 
718
 *
 
719
 * Selects the automatic Mixer's gain management
 
720
 * on_off = 1 allows the "abe_write_gain" to adjust the overall
 
721
 * gains of the mixer to be tuned not to create saturation
 
722
 */
 
723
abehal_status abe_use_compensated_gain(u32 on_off)
 
724
{
 
725
        omap_abe_use_compensated_gain(abe, (int)(on_off));
 
726
        return 0;
 
727
}
 
728
EXPORT_SYMBOL(abe_use_compensated_gain);