void AudDrv_APLL24M_Clk_Off(void) { mutex_lock(&auddrv_pmic_mutex); Aud_APLL24M_Clk_cntr--; if (Aud_APLL24M_Clk_cntr == 0) { PRINTK_AUDDRV("+%s disable_clock ADC clk(%x)\n", __func__, Aud_APLL24M_Clk_cntr); #ifdef PM_MANAGER_API if (disable_clock(MT_CG_AUDIO_24M, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } if (disable_clock(MT_CG_AUDIO_APLL2_TUNER, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } clkmux_sel(MT_MUX_AUD2, 0, "AUDIO"); //select 26M disable_mux(MT_MUX_AUD2, "AUDIO"); #endif } if (Aud_APLL24M_Clk_cntr < 0) { PRINTK_AUDDRV("%s <0 (%d) \n", __func__, Aud_APLL24M_Clk_cntr); Aud_APLL24M_Clk_cntr = 0; } mutex_unlock(&auddrv_pmic_mutex); }
static ssize_t dcm_state_store(struct kobject *kobj, struct kobj_attribute *attr,const char *buf, size_t n) { char cmd[10]; unsigned int mask; if (sscanf(buf, "%s %x", cmd, &mask) == 2) { mask &= ALL_DCM; /* Need to enable MM clock before setting Smi_secure register to avoid system crash while screen is off(screen off with USB cable) */ enable_mux(MT_MUX_MM, "DCM"); if (!strcmp(cmd, "enable")) { dcm_dump_regs(mask); dcm_enable(mask); dcm_dump_regs(mask); } else if (!strcmp(cmd, "disable")) { dcm_dump_regs(mask); dcm_disable(mask); dcm_dump_regs(mask); } else if (!strcmp(cmd, "dump")) { dcm_dump_regs(mask); } disable_mux(MT_MUX_MM, "DCM"); return n; } return -EINVAL; }
std::string lifLEDArray::turn_on_LED(unsigned int LEDNumber) throw (std::string) { if (!initialized) throw ((std::string)(devName + " has not been initialized.")); //Check if the LED exists if (LEDNumber > LEDs.size() | LEDNumber < 1) throw ((std::string)"LED out of range."); std::string LEDPwr = LEDs.at(LEDNumber - 1)->get_power_source(); //If an LED power source is listed, send message to turn it on if (LEDPwr != "") { lifMsg msg; msg.set_target(LEDs.at(LEDNumber - 1)->get_power_source()); msg.set_command("TurnOn"); msg.set_source(devName); send_back_msg(msg); msg.set_source(LEDs.at(LEDNumber - 1)->get_power_source()); msg.set_command("StatusReport"); msg.clear_params(); msg.add_param("TurnOnSUCCESS"); try { wait_for_msg(msg, 5000); lif_print("Received successful message reply"); } catch (std::string errStr) { throw (errStr); } } //Turn on the LED by writing the correct value to the MUX unsigned int regValue; disable_mux(); regValue = valueMemAcc.readValue(); valueMemAcc.writeValue((regValue & ~0xf) | (LEDNumber - 1)); enable_mux(); //enable the mux to actually turn on the LED lif_print(((std::string)"Turned on LED #") + to_string(LEDNumber) + ((std::string)".")); //lifDevice::status_report("ALL", "Illumination LED " + to_string(LEDs.at(LEDNumber-1)->get_wavelength())); //lifDevice::status_report("ALL", "LEDon"); return (std::string)("Illumination LED " + to_string(LEDs.at(LEDNumber - 1)->get_wavelength())); }
void AudDrv_APLL24M_Clk_Off(void) { pr_debug("+%s %d \n", __func__, Aud_APLL24M_Clk_cntr); mutex_lock(&auddrv_pmic_mutex); Aud_APLL24M_Clk_cntr--; if (Aud_APLL24M_Clk_cntr == 0) { PRINTK_AUDDRV("+%s disable_clock ADC clk(%x)\n", __func__, Aud_APLL24M_Clk_cntr); #ifdef PM_MANAGER_API #if defined(CONFIG_MTK_LEGACY) if (disable_clock(MT_CG_AUDIO_24M, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } if (disable_clock(MT_CG_AUDIO_APLL2_TUNER, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } #else if (paudclk->aud_apll24m_clk_status) { clk_disable_unprepare(paudclk->aud_apll24m_clk); } if (paudclk->aud_apll2_tuner_clk_status) { clk_disable_unprepare(paudclk->aud_apll2_tuner_clk); } #endif clkmux_sel(MT_MUX_AUD1, 0, "AUDIO"); //select 26M disable_mux(MT_MUX_AUD1, "AUDIO"); #endif } if (Aud_APLL24M_Clk_cntr < 0) { PRINTK_AUDDRV("%s <0 (%d) \n", __func__, Aud_APLL24M_Clk_cntr); Aud_APLL24M_Clk_cntr = 0; } mutex_unlock(&auddrv_pmic_mutex); }
void AudDrv_Suspend_Clk_Off(void) { unsigned long flags; spin_lock_irqsave(&auddrv_Clk_lock, flags); if (Aud_Core_Clk_cntr > 0) { #ifdef PM_MANAGER_API if (Aud_AFE_Clk_cntr > 0) { if (disable_clock(MT_CG_AUDIO_AFE, "AUDIO")) { xlog_printk(ANDROID_LOG_ERROR, "Sound", "Aud enable_clock MT_CG_AUDIO_AFE fail !!!\n"); } } if (Aud_I2S_Clk_cntr > 0) { if (disable_clock(MT_CG_AUDIO_I2S, "AUDIO")) { PRINTK_AUD_ERROR("disable_clock MT_CG_AUDIO_I2S fail"); } } if (Aud_ADC_Clk_cntr > 0) { Afe_Set_Reg(AUDIO_TOP_CON0, 1 << 24 , 1 << 24); } if (Aud_ADC2_Clk_cntr > 0) { #if 0 //K2 removed if (disable_clock(MT_CG_AUDIO_ADDA2, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } #endif } if (Aud_ADC3_Clk_cntr > 0) { #if 0 //K2 removed if (disable_clock(MT_CG_AUDIO_ADDA3, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } #endif } if (Aud_ANA_Clk_cntr > 0) { } if (Aud_HDMI_Clk_cntr > 0) { } if (Aud_APLL22M_Clk_cntr > 0) { if (disable_clock(MT_CG_AUDIO_22M, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } if (disable_clock(MT_CG_AUDIO_APLL_TUNER, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } clkmux_sel(MT_MUX_AUD1, 0, "AUDIO"); //select 26M disable_mux(MT_MUX_AUD1, "AUDIO"); } if (Aud_APLL24M_Clk_cntr > 0) { if (disable_clock(MT_CG_AUDIO_24M, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } if (disable_clock(MT_CG_AUDIO_APLL2_TUNER, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } clkmux_sel(MT_MUX_AUD2, 0, "AUDIO"); //select 26M disable_mux(MT_MUX_AUD2, "AUDIO"); } #endif } spin_unlock_irqrestore(&auddrv_Clk_lock, flags); }
void AudDrv_Suspend_Clk_Off(void) { unsigned long flags; spin_lock_irqsave(&auddrv_Clk_lock, flags); if (Aud_Core_Clk_cntr > 0) { #ifdef PM_MANAGER_API if (Aud_AFE_Clk_cntr > 0) { #if defined(CONFIG_MTK_LEGACY) if (disable_clock(MT_CG_AUDIO_AFE, "AUDIO")) { printk("Aud enable_clock MT_CG_AUDIO_AFE fail !!!\n"); } #else if (paudclk->aud_afe_clk_status) { clk_disable_unprepare(paudclk->aud_afe_clk); } #endif } if (Aud_I2S_Clk_cntr > 0) { #if defined(CONFIG_MTK_LEGACY) if (disable_clock(MT_CG_AUDIO_I2S, "AUDIO")) { PRINTK_AUD_ERROR("disable_clock MT_CG_AUDIO_I2S fail"); } #else if (paudclk->aud_i2s_clk_status) { clk_disable_unprepare(paudclk->aud_i2s_clk); } #endif } if (Aud_ADC_Clk_cntr > 0) { Afe_Set_Reg(AUDIO_TOP_CON0, 1 << 24 , 1 << 24); } if (Aud_ADC2_Clk_cntr > 0) { #if 0 //K2 removed if (disable_clock(MT_CG_AUDIO_ADDA2, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } #endif } if (Aud_ADC3_Clk_cntr > 0) { #if 0 //K2 removed if (disable_clock(MT_CG_AUDIO_ADDA3, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } #endif } if (Aud_ANA_Clk_cntr > 0) { } if (Aud_HDMI_Clk_cntr > 0) { } if (Aud_APLL22M_Clk_cntr > 0) { #if defined(CONFIG_MTK_LEGACY) if (disable_clock(MT_CG_AUDIO_22M, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } if (disable_clock(MT_CG_AUDIO_APLL_TUNER, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } #else if (paudclk->aud_apll22m_clk_status) { clk_disable_unprepare(paudclk->aud_apll22m_clk); } if (paudclk->aud_apll1_tuner_clk_status) { clk_disable_unprepare(paudclk->aud_apll1_tuner_clk); } #endif clkmux_sel(MT_MUX_AUD1, 0, "AUDIO"); //select 26M disable_mux(MT_MUX_AUD1, "AUDIO"); } if (Aud_APLL24M_Clk_cntr > 0) { #if defined(CONFIG_MTK_LEGACY) if (disable_clock(MT_CG_AUDIO_24M, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } if (disable_clock(MT_CG_AUDIO_APLL2_TUNER, "AUDIO")) { PRINTK_AUD_CLK("%s fail", __func__); } clkmux_sel(MT_MUX_AUD2, 0, "AUDIO"); //select 26M disable_mux(MT_MUX_AUD2, "AUDIO"); #else if (paudclk->aud_apll24m_clk_status) { clk_disable_unprepare(paudclk->aud_apll24m_clk); } if (paudclk->aud_apll2_tuner_clk_status) { clk_disable_unprepare(paudclk->aud_apll2_tuner_clk); } #endif } #endif } spin_unlock_irqrestore(&auddrv_Clk_lock, flags); }
void lifLEDArray::turn_off_LED() { disable_mux(); }