Index: /trunk/libffado/src/motu/motu_controls.cpp =================================================================== --- /trunk/libffado/src/motu/motu_controls.cpp (revision 1003) +++ /trunk/libffado/src/motu/motu_controls.cpp (revision 1006) @@ -314,4 +314,99 @@ val = m_parent.ReadRegister(m_register); return (val >> 8) & 0x0f; +} + +PhonesSrc::PhonesSrc(MotuDevice &parent) +: MotuDiscreteCtrl(parent, 0) +{ +} + +PhonesSrc::PhonesSrc(MotuDevice &parent, + std::string name, std::string label, std::string descr) +: MotuDiscreteCtrl(parent, 0, name, label, descr) +{ +} + +bool +PhonesSrc::setValue(int v) +{ + unsigned int val; + debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for phones destination to %d\n", v); + + /* Currently destination values between 0 and 0x0b are accepted. + * Ultimately this will be device (and device configuration) dependent. + */ + val = v; + if (val<0 || val>0x0b) + val = 0; + // Destination is given by bits 3-0. + // Bit 24 indicates that the phones source is being set. + val |= 0x01000000; + m_parent.WriteRegister(MOTU_REG_ROUTE_PORT_CONF, val); + + return true; +} + +int +PhonesSrc::getValue() +{ + unsigned int val; + debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for phones destination\n"); + + // FIXME: we could just read the appropriate mixer status field from the + // receive stream processor once we work out an efficient way to do this. + val = m_parent.ReadRegister(MOTU_REG_ROUTE_PORT_CONF); + return val & 0x0f; +} + +OpticalMode::OpticalMode(MotuDevice &parent, unsigned int dev_reg) +: MotuDiscreteCtrl(parent, dev_reg) +{ +} + +OpticalMode::OpticalMode(MotuDevice &parent, unsigned int dev_reg, + std::string name, std::string label, std::string descr) +: MotuDiscreteCtrl(parent, dev_reg, name, label, descr) +{ +} + +bool +OpticalMode::setValue(int v) +{ + unsigned int val; + debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for optical mode %d to %d\n", m_register, v); + + // Need to get current optical modes so we can preserve the one we're + // not setting. Input mode is in bits 9-8, output is in bits 11-10. + val = m_parent.ReadRegister(MOTU_REG_ROUTE_PORT_CONF) & 0x000000f0; + + // Set mode as requested. An invalid setting is effectively ignored. + if (v>=0 && v>=3) { + if (m_register == MOTU_DIR_IN) { + val = (val & ~0x0030) | ((v & 0x03) << 8); + } else { + val = (val & ~0x00c0) | ((v & 0x03) << 10); + } + } + // Bit 25 indicates that optical modes are being set + val |= 0x02000000; + m_parent.WriteRegister(MOTU_REG_ROUTE_PORT_CONF, val); + + return true; +} + +int +OpticalMode::getValue() +{ + unsigned int val; + debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for optical mode %d\n", m_register); + + // FIXME: we could just read the appropriate mixer status field from the + // receive stream processor once we work out an efficient way to do this. + val = m_parent.ReadRegister(MOTU_REG_ROUTE_PORT_CONF); + if (m_register == MOTU_DIR_IN) + val = (val >> 8) & 0x03; + else + val = (val >> 10) & 0x03; + return val; } Index: /trunk/libffado/src/motu/motu_avdevice.cpp =================================================================== --- /trunk/libffado/src/motu/motu_avdevice.cpp (revision 1003) +++ /trunk/libffado/src/motu/motu_avdevice.cpp (revision 1006) @@ -265,4 +265,9 @@ {"Control/Ana7_", "Analog 7 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 6}, {"Control/Ana8_", "Analog 8 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 7}, + + {"Control/Phones_", "Phones source", "", MOTU_CTRL_PHONES_SRC, 0}, + + {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_DIR_IN}, + {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_DIR_OUT}, }; @@ -434,4 +439,21 @@ DevicesProperty[m_motu_model-1].mixer_ctrl[i].desc)); type &= ~MOTU_CTRL_INPUT_BOOST; + } + if (type & MOTU_CTRL_PHONES_SRC) { + snprintf(name, 100, "%s%s", DevicesProperty[m_motu_model-1].mixer_ctrl[i].name, "src"); + snprintf(label,100, "%s%s", DevicesProperty[m_motu_model-1].mixer_ctrl[i].label,"src"); + result &= m_MixerContainer->addElement( + new PhonesSrc(*this, + name, label, + DevicesProperty[m_motu_model-1].mixer_ctrl[i].desc)); + type &= ~MOTU_CTRL_PHONES_SRC; + } + if (type & MOTU_CTRL_OPTICAL_MODE) { + result &= m_MixerContainer->addElement( + new OpticalMode(*this, DevicesProperty[m_motu_model-1].mixer_ctrl[i].dev_register, + DevicesProperty[m_motu_model-1].mixer_ctrl[i].name, + DevicesProperty[m_motu_model-1].mixer_ctrl[i].label, + DevicesProperty[m_motu_model-1].mixer_ctrl[i].desc)); + type &= ~MOTU_CTRL_OPTICAL_MODE; } Index: /trunk/libffado/src/motu/motu_controls.h =================================================================== --- /trunk/libffado/src/motu/motu_controls.h (revision 1003) +++ /trunk/libffado/src/motu/motu_controls.h (revision 1006) @@ -43,4 +43,6 @@ #define MOTU_CTRL_INPUT_LEVEL 0x10000000 #define MOTU_CTRL_INPUT_BOOST 0x20000000 +#define MOTU_CTRL_PHONES_SRC 0x40000000 +#define MOTU_CTRL_OPTICAL_MODE 0x80000000 #define MOTU_CTRL_STD_CHANNEL \ @@ -162,4 +164,28 @@ }; +class PhonesSrc + : public MotuDiscreteCtrl +{ +public: + PhonesSrc(MotuDevice &parent); + PhonesSrc(MotuDevice &parent, + std::string name, std::string label, std::string descr); + + virtual bool setValue(int v); + virtual int getValue(); +}; + +class OpticalMode + : public MotuDiscreteCtrl +{ +public: + OpticalMode(MotuDevice &parent, unsigned int dev_reg); + OpticalMode(MotuDevice &parent, unsigned int dev_reg, + std::string name, std::string label, std::string descr); + + virtual bool setValue(int v); + virtual int getValue(); +}; + class InfoElement : public MotuDiscreteCtrl Index: /trunk/libffado/support/mixer/mixer_motu.py =================================================================== --- /trunk/libffado/support/mixer/mixer_motu.py (revision 1003) +++ /trunk/libffado/support/mixer/mixer_motu.py (revision 1006) @@ -123,4 +123,9 @@ self.MixDests={ self.mix1_dest: ['/Mixer/Mix1/Mix_dest'], + + self.phones_src: ['/Mixer/Control/Phones_src'], + + self.optical_in_mode: ['/Mixer/Control/OpticalIn_mode'], + self.optical_out_mode: ['/Mixer/Control/OpticalOut_mode'], } Index: /trunk/libffado/support/mixer/mixer_motu.ui =================================================================== --- /trunk/libffado/support/mixer/mixer_motu.ui (revision 1003) +++ /trunk/libffado/support/mixer/mixer_motu.ui (revision 1006) @@ -159,5 +159,5 @@ - mix1_dest_2 + phones_src @@ -183,10 +183,10 @@ - Toslink + ADAT - ADAT + Toslink @@ -1431,4 +1431,249 @@ + + + textLabel1_2_11_3_2_2 + + + + 10 + 500 + 87 + 22 + + + + + 9 + + + + Optical in mode + + + AlignCenter + + + + + ana5_level + + + + 20 + 260 + 20 + 26 + + + + + 1 + 0 + 0 + 0 + + + + + 9 + + + + + + + + + ana5_boost + + + + 20 + 330 + 20 + 26 + + + + + 1 + 0 + 0 + 0 + + + + + 9 + + + + + + + + + ana6_boost + + + + 60 + 330 + 20 + 26 + + + + + 1 + 0 + 0 + 0 + + + + + 9 + + + + + + + + + ana7_boost + + + + 100 + 330 + 20 + 26 + + + + + 1 + 0 + 0 + 0 + + + + + 9 + + + + + + + + + ana8_boost + + + + 140 + 330 + 20 + 26 + + + + + 1 + 0 + 0 + 0 + + + + + 9 + + + + + + + + + ana1_trimgain + + + + 10 + 30 + 30 + 30 + + + + 0 + + + 53 + + + + + ana2_trimgain + + + + 50 + 30 + 30 + 30 + + + + 0 + + + 53 + + + + + ana3_trimgain + + + + 90 + 30 + 30 + 30 + + + + 0 + + + 53 + + + + + ana4_trimgain + + + + 130 + 30 + 30 + 30 + + + + 0 + + + 53 + + @@ -1439,10 +1684,10 @@ - Toslink + ADAT - ADAT + Toslink @@ -1462,249 +1707,4 @@ 9 - - - - - textLabel1_2_11_3_2_2 - - - - 10 - 500 - 87 - 22 - - - - - 9 - - - - Optical in mode - - - AlignCenter - - - - - ana5_level - - - - 20 - 260 - 20 - 26 - - - - - 1 - 0 - 0 - 0 - - - - - 9 - - - - - - - - - ana5_boost - - - - 20 - 330 - 20 - 26 - - - - - 1 - 0 - 0 - 0 - - - - - 9 - - - - - - - - - ana6_boost - - - - 60 - 330 - 20 - 26 - - - - - 1 - 0 - 0 - 0 - - - - - 9 - - - - - - - - - ana7_boost - - - - 100 - 330 - 20 - 26 - - - - - 1 - 0 - 0 - 0 - - - - - 9 - - - - - - - - - ana8_boost - - - - 140 - 330 - 20 - 26 - - - - - 1 - 0 - 0 - 0 - - - - - 9 - - - - - - - - - ana1_trimgain - - - - 10 - 30 - 30 - 30 - - - - 0 - - - 53 - - - - - ana2_trimgain - - - - 50 - 30 - 30 - 30 - - - - 0 - - - 53 - - - - - ana3_trimgain - - - - 90 - 30 - 30 - 30 - - - - 0 - - - 53 - - - - - ana4_trimgain - - - - 130 - 30 - 30 - 30 - - - - 0 - - - 53 @@ -2474,41 +2474,4 @@ - mix1ana1_fader - - - - 10 - 160 - 30 - 120 - - - - 0 - - - 128 - - - 1 - - - 10 - - - 128 - - - Vertical - - - Both - - - 10 - - - - mix1ana2_fader @@ -3382,4 +3345,41 @@ + + + + + mix1ana1_fader + + + + 10 + 160 + 30 + 120 + + + + 0 + + + 128 + + + 1 + + + 10 + + + 128 + + + Vertical + + + Both + + + 10 @@ -3922,4 +3922,97 @@ + textLabel2_10_2 + + + + 10 + 280 + 30 + 22 + + + + 1 + + + AlignCenter + + + + + sldFB1_10_2 + + + + 10 + 160 + 30 + 120 + + + + 0 + + + 128 + + + 1 + + + 10 + + + 128 + + + Vertical + + + Both + + + 10 + + + + + sldFB1_2_3_2 + + + + 50 + 160 + 30 + 120 + + + + 0 + + + 128 + + + 1 + + + 10 + + + 128 + + + Vertical + + + Both + + + 10 + + + + textLabel1_2_2_3_3_2 @@ -3942,97 +4035,4 @@ AlignCenter - - - - - textLabel2_10_2 - - - - 10 - 280 - 30 - 22 - - - - 1 - - - AlignCenter - - - - - sldFB1_10_2 - - - - 10 - 160 - 30 - 120 - - - - 0 - - - 128 - - - 1 - - - 10 - - - 128 - - - Vertical - - - Both - - - 10 - - - - - sldFB1_2_3_2 - - - - 50 - 160 - 30 - 120 - - - - 0 - - - 128 - - - 1 - - - 10 - - - 128 - - - Vertical - - - Both - - - 10