Home | History | Annotate | Line # | Download | only in dev
      1 /*	$NetBSD: wm8731reg.h,v 1.1 2014/09/23 14:49:46 nonaka Exp $	*/
      2 /*-
      3  * Copyright (c) 2013 The NetBSD Foundation, Inc.
      4  * All rights reserved.
      5  *
      6  * This code is derived from software contributed to The NetBSD Foundation
      7  * by TOYOKURA Atsushi.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28  * POSSIBILITY OF SUCH DAMAGE.
     29  */
     30 
     31 #ifndef	_DEV_IC_WM8731REG_H_
     32 #define	_DEV_IC_WM8731REG_H_
     33 
     34 /*
     35  * Wolfson Microelectronics' WM8731/WM8731L I2C/I2S audio codec:
     36  * - I2C register definitions.  Used in the Sharp Zaurus SL-C7x0/860.
     37  */
     38 
     39 #define WM8731_LIN_REG 0x00	/* Left Line In */
     40 #define   WM8731_LRINBOTH     0x100
     41 #define   WM8731_LINMUTE      0x080
     42 #define   WM8731_LINVOL_MASK  0x01F
     43 #define   WM8731_GET_LINVOL(x) ((x) & WM8731_LINVOL_MASK)
     44 #define   WM8731_SET_LINVOL(x) ((x) & WM8731_LINVOL_MASK)
     45 
     46 #define WM8731_RIN_REG 0x01	/* Right Line In */
     47 #define   WM8731_RLINBOTH     0x100
     48 #define   WM8731_RINMUTE      0x080
     49 #define   WM8731_RINVOL_MASK  0x01F
     50 #define   WM8731_GET_RINVOL(x) ((x) & WM8731_RINVOL_MASK)
     51 #define   WM8731_SET_RINVOL(x) ((x) & WM8731_RINVOL_MASK)
     52 
     53 #define WM8731_LHP_REG 0x02	/* Left Headphone Out */
     54 #define   WM8731_LRHPBOTH     0x100
     55 #define   WM8731_LZCEN        0x080
     56 #define   WM8731_LHPVOL_MASK  0x07F
     57 #define   WM8731_GET_LHPVOL(x) ((x) & WM8731_LHPVOL_MASK)
     58 #define   WM8731_SET_LHPVOL(x) ((x) & WM8731_LHPVOL_MASK)
     59 
     60 #define WM8731_RHP_REG 0x03	/* Right Headphone Out */
     61 #define   WM8731_RLHPBOTH     0x100
     62 #define   WM8731_RZCEN        0x080
     63 #define   WM8731_RHPVOL_MASK  0x07F
     64 #define   WM8731_GET_RHPVOL(x) ((x) & WM8731_RHPVOL_MASK)
     65 #define   WM8731_SET_RHPVOL(x) ((x) & WM8731_RHPVOL_MASK)
     66 
     67 #define WM8731_AAP_REG 0x04	/* Analogue Audio Path Control */
     68 #define   WM8731_SIDEATT_MASK 0x0C0
     69 #define   WM8731_SIDETONE     0x020
     70 #define   WM8731_DACSEL       0x010
     71 #define   WM8731_BYPASS       0x008
     72 #define   WM8731_INSEL        0x004
     73 #define   WM8731_MUTEMIC      0x002
     74 #define   WM8731_MICBOOST     0x001
     75 #define   WM8731_GET_SIDEATT(x) (((x) & WM8731_SIDEATT_MASK) >> 6)
     76 #define   WM8731_SET_SIDEATT(x) (((x) << 6) & WM8731_SIDEATT_MASK)
     77 
     78 #define WM8731_DAP_REG 0x05	/* Digital Audio Path Control */
     79 #define   WM8731_HPOR         0x010
     80 #define   WM8731_DACMU        0x008
     81 #define   WM8731_DEEMP_MASK   0x006
     82 #define   WM8731_ADCHP        0x001
     83 #define   WM8731_GET_DEEMP(x) (((x) & WM8731_DEEMP_MASK) >> 1)
     84 #define   WM8731_SET_DEEMP(x) (((x) << 1) & WM8731_DEEMP_MASK)
     85 
     86 #define WM8731_PD_REG  0x06	/* Power Down Control */
     87 #define   WM8731_POWEROFF     0x080
     88 #define   WM8731_CLKOUTPD     0x040
     89 #define   WM8731_OSCPD        0x020
     90 #define   WM8731_OUTPD        0x010
     91 #define   WM8731_DACPD        0x008
     92 #define   WM8731_ADCPD        0x004
     93 #define   WM8731_MICPD        0x002
     94 #define   WM8731_LINEINPD     0x001
     95 
     96 #define WM8731_DAI_REG 0x07	/* Digital Audio Interface Format */
     97 #define   WM8731_BCLKINV      0x080
     98 #define   WM8731_MS           0x040
     99 #define   WM8731_LRSWAP       0x020
    100 #define   WM8731_LRP          0x010
    101 #define   WM8731_IWL_MASK     0x00C
    102 #define   WM8731_FORMAT_MASK  0x003
    103 #define   WM8731_GET_IWL(x) (((x) & WM8731_IWL_MASK) >> 2)
    104 #define   WM8731_SET_IWL(x) (((x) << 2) & WM8731_IWL_MASK)
    105 #define   WM8731_GET_FORMAT(x) ((x) & WM8731_FORMAT_MASK)
    106 #define   WM8731_SET_FORMAT(x) ((x) & WM8731_FORMAT_MASK)
    107 
    108 #define WM8731_SP_REG 0x08	/* Sampling Control */
    109 #define   WM8731_CLKODIV2     0x080
    110 #define   WM8731_CLKIDIV2     0x040
    111 #define   WM8731_SR_MASK      0x03C
    112 #define   WM8731_BOSR         0x002
    113 #define   WM8731_USB          0x001
    114 #define   WM8731_GET_SR(x) (((x) & WM8731_SR_MASK) >> 2)
    115 #define   WM8731_SET_SR(x) (((x) << 2) & WM8731_SR_MASK)
    116 
    117 #define WM8731_AC_REG 0x09	/* Active Control */
    118 #define   WM8731_ACTIVE       0x001
    119 
    120 #define WM8731_RESET_REG 0x0F	/* Reset Register */
    121 #define   WM8731_RESET_MASK   0x1FF
    122 #define   WM8731_GET_RESET(x) ((x) & WM8731_RESET_MASK)
    123 #define   WM8731_SET_RESET(x) ((x) & WM8731_RESET_MASK)
    124 
    125 #endif	/* _DEV_IC_WM8731REG_H_ */
    126