Barry Song | 7eaae41 | 2009-08-13 11:59:32 +0800 | [diff] [blame] | 1 | /* |
| 2 | * File: sound/soc/codecs/ad1836.h |
| 3 | * Based on: |
| 4 | * Author: Barry Song <Barry.Song@analog.com> |
| 5 | * |
| 6 | * Created: Aug 04, 2009 |
| 7 | * Description: definitions for AD1836 registers |
| 8 | * |
| 9 | * Modified: |
| 10 | * |
| 11 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by |
| 15 | * the Free Software Foundation; either version 2 of the License, or |
| 16 | * (at your option) any later version. |
| 17 | */ |
| 18 | |
| 19 | #ifndef __AD1836_H__ |
| 20 | #define __AD1836_H__ |
| 21 | |
| 22 | #define AD1836_DAC_CTRL1 0 |
| 23 | #define AD1836_DAC_POWERDOWN 2 |
| 24 | #define AD1836_DAC_SERFMT_MASK 0xE0 |
| 25 | #define AD1836_DAC_SERFMT_PCK256 (0x4 << 5) |
| 26 | #define AD1836_DAC_SERFMT_PCK128 (0x5 << 5) |
| 27 | #define AD1836_DAC_WORD_LEN_MASK 0x18 |
Lars-Peter Clausen | 8ca695f | 2011-06-06 13:38:35 +0200 | [diff] [blame] | 28 | #define AD1836_DAC_WORD_LEN_OFFSET 3 |
Barry Song | 7eaae41 | 2009-08-13 11:59:32 +0800 | [diff] [blame] | 29 | |
| 30 | #define AD1836_DAC_CTRL2 1 |
Barry Song | 7eaae41 | 2009-08-13 11:59:32 +0800 | [diff] [blame] | 31 | |
Lars-Peter Clausen | 90bc11d | 2011-06-06 13:38:36 +0200 | [diff] [blame] | 32 | /* These macros are one-based. So AD183X_MUTE_LEFT(1) will return the mute bit |
| 33 | * for the first ADC/DAC */ |
| 34 | #define AD1836_MUTE_LEFT(x) (((x) * 2) - 2) |
| 35 | #define AD1836_MUTE_RIGHT(x) (((x) * 2) - 1) |
| 36 | |
| 37 | #define AD1836_DAC_L_VOL(x) ((x) * 2) |
| 38 | #define AD1836_DAC_R_VOL(x) (1 + ((x) * 2)) |
Barry Song | 7eaae41 | 2009-08-13 11:59:32 +0800 | [diff] [blame] | 39 | |
| 40 | #define AD1836_ADC_CTRL1 12 |
| 41 | #define AD1836_ADC_POWERDOWN 7 |
| 42 | #define AD1836_ADC_HIGHPASS_FILTER 8 |
| 43 | |
| 44 | #define AD1836_ADC_CTRL2 13 |
Barry Song | 7eaae41 | 2009-08-13 11:59:32 +0800 | [diff] [blame] | 45 | #define AD1836_ADC_WORD_LEN_MASK 0x30 |
Lars-Peter Clausen | 8ca695f | 2011-06-06 13:38:35 +0200 | [diff] [blame] | 46 | #define AD1836_ADC_WORD_OFFSET 5 |
Barry Song | 7eaae41 | 2009-08-13 11:59:32 +0800 | [diff] [blame] | 47 | #define AD1836_ADC_SERFMT_MASK (7 << 6) |
| 48 | #define AD1836_ADC_SERFMT_PCK256 (0x4 << 6) |
| 49 | #define AD1836_ADC_SERFMT_PCK128 (0x5 << 6) |
Barry Song | 84549d2 | 2010-01-25 16:42:25 +0800 | [diff] [blame] | 50 | #define AD1836_ADC_AUX (0x6 << 6) |
Barry Song | 7eaae41 | 2009-08-13 11:59:32 +0800 | [diff] [blame] | 51 | |
| 52 | #define AD1836_ADC_CTRL3 14 |
| 53 | |
| 54 | #define AD1836_NUM_REGS 16 |
| 55 | |
Lars-Peter Clausen | 8ca695f | 2011-06-06 13:38:35 +0200 | [diff] [blame] | 56 | #define AD1836_WORD_LEN_24 0x0 |
| 57 | #define AD1836_WORD_LEN_20 0x1 |
| 58 | #define AD1836_WORD_LEN_16 0x2 |
| 59 | |
Barry Song | 7eaae41 | 2009-08-13 11:59:32 +0800 | [diff] [blame] | 60 | #endif |