Changeset 1743

Show
Ignore:
Timestamp:
12/04/09 02:14:46 (11 years ago)
Author:
jwoithe
Message:

MOTU: first cut at optical mode setting for the original 828. There's still a missing piece though, since we don't currently know how to differentiate between OFF and ADAT modes at the device level.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/src/motu/motu_avdevice.cpp

    r1715 r1743  
    11721172    if (m_motu_model == MOTU_MODEL_828MkI) { 
    11731173        // The early devices used a different register layout.   
    1174         // To be completed. 
     1174        unsigned int mask, shift; 
     1175        reg = ReadRegister(MOTU_G1_REG_CONFIG); 
     1176        mask = (dir==MOTU_DIR_IN)?MOTU_G1_OPT_IN_MODE_MASK:MOTU_G1_OPT_OUT_MODE_MASK; 
     1177        shift = (dir==MOTU_DIR_IN)?MOTU_G1_OPT_IN_MODE_BIT0:MOTU_G1_OPT_OUT_MODE_BIT0; 
     1178        switch (reg & mask) { 
     1179            case MOTU_G1_OPTICAL_OFF: return MOTU_OPTICAL_MODE_OFF; 
     1180            case MOTU_G1_OPTICAL_TOSLINK: return MOTU_OPTICAL_MODE_TOSLINK; 
     1181            // MOTU_G1_OPTICAL_OFF and MOTU_G1_OPTICAL_ADAT seem to be 
     1182            // identical, so currently we don't know how to differentiate 
     1183            // these two modes. 
     1184            // case MOTU_G1_OPTICAL_ADAT: return MOTU_OPTICAL_MODE_ADAT; 
     1185        } 
    11751186        return 0; 
    11761187    } 
    11771188 
    11781189    reg = ReadRegister(MOTU_REG_ROUTE_PORT_CONF); 
    1179  
    1180 debugOutput(DEBUG_LEVEL_VERBOSE, "optical mode: %x %x %x %x\n",dir, reg, reg & MOTU_OPTICAL_IN_MODE_MASK, 
    1181 reg & MOTU_OPTICAL_OUT_MODE_MASK); 
    11821190 
    11831191    if (dir == MOTU_DIR_IN) 
     
    11881196 
    11891197signed int MotuDevice::setOpticalMode(unsigned int dir, unsigned int mode) { 
    1190     unsigned int reg = ReadRegister(MOTU_REG_ROUTE_PORT_CONF)
     1198    unsigned int reg
    11911199    unsigned int opt_ctrl = 0x0000002; 
    11921200 
     
    11991207    if (m_motu_model == MOTU_MODEL_828MkI) { 
    12001208        // The earlier MOTUs handle this differently. 
    1201         // To be completed. 
    1202         return 0; 
    1203     } 
     1209        unsigned int mask, shift, g1mode = 0; 
     1210        reg = ReadRegister(MOTU_G1_REG_CONFIG); 
     1211        mask = (dir==MOTU_DIR_IN)?MOTU_G1_OPT_IN_MODE_MASK:MOTU_G1_OPT_OUT_MODE_MASK; 
     1212        shift = (dir==MOTU_DIR_IN)?MOTU_G1_OPT_IN_MODE_BIT0:MOTU_G1_OPT_OUT_MODE_BIT0; 
     1213        switch (mode) { 
     1214            case MOTU_OPTICAL_MODE_OFF: g1mode = MOTU_G1_OPTICAL_OFF; break; 
     1215            case MOTU_OPTICAL_MODE_ADAT: g1mode = MOTU_G1_OPTICAL_ADAT; break; 
     1216            // See comment in getOpticalMode() about mode ambiguity 
     1217            // case MOTU_OPTICAL_MODE_TOSLINK: g1mode = MOTU_G1_OPTICAL_TOSLINK; break; 
     1218        } 
     1219        reg = (reg & ~mask) | (g1mode << shift); 
     1220        return WriteRegister(MOTU_G1_REG_CONFIG, reg); 
     1221    } 
     1222 
     1223    reg = ReadRegister(MOTU_REG_ROUTE_PORT_CONF); 
    12041224 
    12051225    // Set up the optical control register value according to the current 
  • branches/libffado-2.0/src/motu/motu_avdevice.h

    r1715 r1743  
    9393#define MOTU_G1_REG_CONFIG         0x0b00 
    9494 
    95 /* The optical mode defines for the 828Mk1 are estimates at present, to be  
    96  * confirmed. 
     95/* There's an unknown subtlety regarding the optical mode of the "generation 
     96 * 1" devices such as the 828Mk1.  It seems that the same configuration 
     97 * register setting is used for "off" and "adat" modes.  There must be more 
     98 * to this though because the number of audio channels sent presumedly 
     99 * changes when adat mode is selected; there must be some way that the 
     100 * device deduces the mode. 
    97101 */ 
    98 #define MOTU_G1_OPT_IN_MODE_MASK   0x0000  // Still be be observed 
    99 #define MOTU_G1_OPT_IN_MODE_BIT0        0  // Still to be observed 
    100 #define MOTU_G1_OPT_OUT_MODE_MASK  0xc000 
    101 #define MOTU_G1_OPT_OUT_MODE_BIT0      26 
     102#define MOTU_G1_OPT_IN_MODE_MASK   0x8000 
     103#define MOTU_G1_OPT_IN_MODE_BIT0       15 
     104#define MOTU_G1_OPT_OUT_MODE_MASK  0x4000 
     105#define MOTU_G1_OPT_OUT_MODE_BIT0      14 
    102106#define MOTU_G1_OPTICAL_OFF        0x0000 
    103107#define MOTU_G1_OPTICAL_TOSLINK    0x0001 
    104 #define MOTU_G1_OPTICAL_ADAT       0x0002 
     108#define MOTU_G1_OPTICAL_ADAT       0x0000 
    105109 
    106110#define MOTU_G1_RATE_MASK          0x0004