Christian Gmeiner | cdbf33a | 2007-05-22 15:56:05 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Implementation of MAS35xx audiohw api driver. |
| 11 | * |
| 12 | * Copyright (C) 2007 by Christian Gmeiner |
| 13 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 14 | * This program is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU General Public License |
| 16 | * as published by the Free Software Foundation; either version 2 |
| 17 | * of the License, or (at your option) any later version. |
Christian Gmeiner | cdbf33a | 2007-05-22 15:56:05 +0000 | [diff] [blame] | 18 | * |
| 19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 20 | * KIND, either express or implied. |
| 21 | * |
| 22 | ****************************************************************************/ |
| 23 | |
| 24 | #ifndef _MAS35XX_H |
| 25 | #define _MAS35XX_H |
| 26 | |
Christian Gmeiner | 7197d9d | 2007-11-15 23:32:56 +0000 | [diff] [blame] | 27 | #include "config.h" |
| 28 | |
Christian Gmeiner | 3ad6ca0 | 2008-04-22 12:37:20 +0000 | [diff] [blame] | 29 | #if CONFIG_CODEC == MAS3507D |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 30 | |
Christian Gmeiner | 365c3b9 | 2008-04-22 09:42:02 +0000 | [diff] [blame] | 31 | #define VOLUME_MIN -780 |
| 32 | #define VOLUME_MAX 180 |
Christian Gmeiner | 05e8488 | 2008-05-14 21:35:19 +0000 | [diff] [blame] | 33 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP) |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 34 | |
| 35 | #else /* CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F */ |
| 36 | |
| 37 | /* MAS3587F and MAS3539F handle clipping prevention internally so we do not need |
| 38 | * the prescaler -> CLIPPING_CAP |
| 39 | */ |
| 40 | |
Christian Gmeiner | 3ad6ca0 | 2008-04-22 12:37:20 +0000 | [diff] [blame] | 41 | #define VOLUME_MIN -400 |
| 42 | #define VOLUME_MAX 600 |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 43 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BALANCE_CAP | CLIPPING_CAP) |
| 44 | |
Christian Gmeiner | 3ad6ca0 | 2008-04-22 12:37:20 +0000 | [diff] [blame] | 45 | #endif |
| 46 | |
| 47 | |
| 48 | #if CONFIG_CODEC == MAS3507D |
Christian Gmeiner | 365c3b9 | 2008-04-22 09:42:02 +0000 | [diff] [blame] | 49 | |
Christian Gmeiner | 7197d9d | 2007-11-15 23:32:56 +0000 | [diff] [blame] | 50 | static const unsigned int bass_table[] = |
| 51 | { |
| 52 | 0x9e400, /* -15dB */ |
| 53 | 0xa2800, /* -14dB */ |
| 54 | 0xa7400, /* -13dB */ |
| 55 | 0xac400, /* -12dB */ |
| 56 | 0xb1800, /* -11dB */ |
| 57 | 0xb7400, /* -10dB */ |
| 58 | 0xbd400, /* -9dB */ |
| 59 | 0xc3c00, /* -8dB */ |
| 60 | 0xca400, /* -7dB */ |
| 61 | 0xd1800, /* -6dB */ |
| 62 | 0xd8c00, /* -5dB */ |
| 63 | 0xe0400, /* -4dB */ |
| 64 | 0xe8000, /* -3dB */ |
| 65 | 0xefc00, /* -2dB */ |
| 66 | 0xf7c00, /* -1dB */ |
| 67 | 0, |
| 68 | 0x800, /* 1dB */ |
| 69 | 0x10000, /* 2dB */ |
| 70 | 0x17c00, /* 3dB */ |
| 71 | 0x1f800, /* 4dB */ |
| 72 | 0x27000, /* 5dB */ |
| 73 | 0x2e400, /* 6dB */ |
| 74 | 0x35800, /* 7dB */ |
| 75 | 0x3c000, /* 8dB */ |
| 76 | 0x42800, /* 9dB */ |
| 77 | 0x48800, /* 10dB */ |
| 78 | 0x4e400, /* 11dB */ |
| 79 | 0x53800, /* 12dB */ |
| 80 | 0x58800, /* 13dB */ |
| 81 | 0x5d400, /* 14dB */ |
| 82 | 0x61800 /* 15dB */ |
| 83 | }; |
| 84 | |
| 85 | static const unsigned int treble_table[] = |
| 86 | { |
| 87 | 0xb2c00, /* -15dB */ |
| 88 | 0xbb400, /* -14dB */ |
| 89 | 0xc1800, /* -13dB */ |
| 90 | 0xc6c00, /* -12dB */ |
| 91 | 0xcbc00, /* -11dB */ |
| 92 | 0xd0400, /* -10dB */ |
| 93 | 0xd5000, /* -9dB */ |
| 94 | 0xd9800, /* -8dB */ |
| 95 | 0xde000, /* -7dB */ |
| 96 | 0xe2800, /* -6dB */ |
| 97 | 0xe7e00, /* -5dB */ |
| 98 | 0xec000, /* -4dB */ |
| 99 | 0xf0c00, /* -3dB */ |
| 100 | 0xf5c00, /* -2dB */ |
| 101 | 0xfac00, /* -1dB */ |
| 102 | 0, |
| 103 | 0x5400, /* 1dB */ |
| 104 | 0xac00, /* 2dB */ |
| 105 | 0x10400, /* 3dB */ |
| 106 | 0x16000, /* 4dB */ |
| 107 | 0x1c000, /* 5dB */ |
| 108 | 0x22400, /* 6dB */ |
| 109 | 0x28400, /* 7dB */ |
| 110 | 0x2ec00, /* 8dB */ |
| 111 | 0x35400, /* 9dB */ |
| 112 | 0x3c000, /* 10dB */ |
| 113 | 0x42c00, /* 11dB */ |
| 114 | 0x49c00, /* 12dB */ |
| 115 | 0x51800, /* 13dB */ |
| 116 | 0x58400, /* 14dB */ |
| 117 | 0x5f800 /* 15dB */ |
| 118 | }; |
| 119 | |
| 120 | static const unsigned int prescale_table[] = |
| 121 | { |
| 122 | 0x80000, /* 0db */ |
| 123 | 0x8e000, /* 1dB */ |
| 124 | 0x9a400, /* 2dB */ |
| 125 | 0xa5800, /* 3dB */ |
| 126 | 0xaf400, /* 4dB */ |
| 127 | 0xb8000, /* 5dB */ |
| 128 | 0xbfc00, /* 6dB */ |
| 129 | 0xc6c00, /* 7dB */ |
| 130 | 0xcd000, /* 8dB */ |
| 131 | 0xd25c0, /* 9dB */ |
| 132 | 0xd7800, /* 10dB */ |
| 133 | 0xdc000, /* 11dB */ |
| 134 | 0xdfc00, /* 12dB */ |
| 135 | 0xe3400, /* 13dB */ |
| 136 | 0xe6800, /* 14dB */ |
| 137 | 0xe9400 /* 15dB */ |
| 138 | }; |
| 139 | #endif /*CONFIG_CODEC == MAS3507D*/ |
| 140 | |
Christian Gmeiner | cdbf33a | 2007-05-22 15:56:05 +0000 | [diff] [blame] | 141 | #endif /* _MAS35XX_H */ |