void mipi_dsi_shutdown(void) { if(!target_cont_splash_screen()) { mdp_shutdown(); writel(0x01010101, DSI_INT_CTRL); writel(0x13FF3BFF, DSI_ERR_INT_MASK0); #if (DISPLAY_MIPI_PANEL_NOVATEK_BLUE \ || DISPLAY_MIPI_PANEL_TOSHIBA) secure_writel(0x0, DSI_CC_REG); secure_writel(0x0, DSI_PIXEL_CC_REG); #endif writel(0, DSI_CLK_CTRL); writel(0, DSI_CTRL); writel(0, DSIPHY_PLL_CTRL(0)); } else { /* To keep the splash screen displayed till kernel driver takes control, do not turn off the video mode engine and clocks. Only disabling the MIPI DSI IRQs */ writel(0x01010101, DSI_INT_CTRL); writel(0x13FF3BFF, DSI_ERR_INT_MASK0); } }
void mipi_dsi_shutdown(void) { #if (!CONT_SPLASH_SCREEN) mdp_shutdown(); writel(0x01010101, DSI_INT_CTRL); writel(0x13FF3BFF, DSI_ERR_INT_MASK0); #if DISPLAY_MIPI_PANEL_TOSHIBA_MDT61 /* Disable branch clocks */ writel(0x0, DSI1_BYTE_CC_REG); writel(0x0, DSI_PIXEL_CC_REG); writel(0x0, DSI1_ESC_CC_REG); /* Disable root clock */ writel(0x0, DSI_CC_REG); #elif (!DISPLAY_MIPI_PANEL_RENESAS) secure_writel(0x0, DSI_CC_REG); secure_writel(0x0, DSI_PIXEL_CC_REG); #endif writel(0, DSI_CLK_CTRL); writel(0, DSI_CTRL); writel(0, DSIPHY_PLL_CTRL(0)); #else /* To keep the splash screen displayed till kernel driver takes control, do not turn off the video mode engine and clocks. Only disabling the MIPI DSI IRQs */ writel(0x01010101, DSI_INT_CTRL); writel(0x13FF3BFF, DSI_ERR_INT_MASK0); #endif }
static void rpm_clk_disable(unsigned id) { unsigned long flags; spin_lock_irqsave(&rpm_clock_lock, flags); if (rpm_clk[id].count > 0) rpm_clk[id].count--; else { pr_warning("%s: Reference counts are incorrect for clock %d!\n", __func__, id); goto out; } if (!rpm_clk[id].count) { unsigned peer_id = rpm_clk[id].peer_clk_id; if (rpm_clk[id].last_set_khz) { struct msm_rpm_iv_pair iv; unsigned peer_khz = 0, peer_sleep_khz = 0; int rc; iv.id = rpm_clk[id].rpm_clk_id; /* Take peer clock rate into account only if enabled. */ if (rpm_clk[peer_id].count) { peer_khz = rpm_clk[peer_id].last_set_khz; peer_sleep_khz = rpm_clk[peer_id].last_set_sleep_khz; } iv.value = peer_khz; rc = msm_rpmrs_set_noirq(MSM_RPM_CTX_SET_0, &iv, 1); if (rc) goto out; iv.value = peer_sleep_khz; rc = msm_rpmrs_set_noirq(MSM_RPM_CTX_SET_SLEEP, &iv, 1); } /* Turn off local smi_clk after disabling remote clock. */ if ((id == R_SMI_CLK || id == R_SMI_A_CLK) && !rpm_clk[peer_id].count) { uint32_t regval; spin_lock(&local_clock_reg_lock); regval = secure_readl(MMSS_MAXI_EN2); regval &= ~SMI_2X_AXI_CLK_EN; secure_writel(regval, MMSS_MAXI_EN2); spin_unlock(&local_clock_reg_lock); } } out: spin_unlock_irqrestore(&rpm_clock_lock, flags); return; }
static void hdmi_msm_reset_core() { uint32_t reg_val = 0; hdmi_msm_set_mode(0); // Disable clocks hdmi_app_clk_init(0); udelay(5); // Enable clocks hdmi_app_clk_init(1); reg_val = secure_readl(SW_RESET_CORE_REG); reg_val |= BIT(11); secure_writel(reg_val, SW_RESET_CORE_REG); udelay(5); reg_val = secure_readl(SW_RESET_AHB_REG); reg_val |= BIT(9); secure_writel(reg_val, SW_RESET_AHB_REG); udelay(5); reg_val = secure_readl(SW_RESET_AHB_REG); reg_val |= BIT(9); secure_writel(reg_val, SW_RESET_AHB_REG); udelay(20); reg_val = secure_readl(SW_RESET_CORE_REG); reg_val &= ~(BIT(11)); secure_writel(reg_val, SW_RESET_CORE_REG); udelay(5); reg_val = secure_readl(SW_RESET_AHB_REG); reg_val &= ~(BIT(9)); secure_writel(reg_val, SW_RESET_AHB_REG); udelay(5); reg_val = secure_readl(SW_RESET_AHB_REG); reg_val &= ~(BIT(9)); secure_writel(reg_val, SW_RESET_AHB_REG); udelay(5); }
void hdmi_app_clk_init(int on) { uint32_t val = 0; if (on) { // Enable clocks val = secure_readl(MISC_CC2_REG); val |= BIT(11); secure_writel(val, MISC_CC2_REG); udelay(10); val = secure_readl(MMSS_AHB_EN_REG); val |= BIT(14); secure_writel(val, MMSS_AHB_EN_REG); udelay(10); val = secure_readl(MMSS_AHB_EN_REG); val |= BIT(4); secure_writel(val, MMSS_AHB_EN_REG); udelay(10); } else { // Disable clocks val = secure_readl(MISC_CC2_REG); val &= ~(BIT(11)); secure_writel(val, MISC_CC2_REG); udelay(10); val = secure_readl(MMSS_AHB_EN_REG); val &= ~(BIT(14)); secure_writel(val, MMSS_AHB_EN_REG); udelay(10); val = secure_readl(MMSS_AHB_EN_REG); val &= ~(BIT(4)); secure_writel(val, MMSS_AHB_EN_REG); udelay(10); } }
static int rpm_clk_enable(unsigned id) { unsigned long flags; int rc = 0; spin_lock_irqsave(&rpm_clock_lock, flags); /* Don't send requests to the RPM if the rate has not been set. */ if (rpm_clk[id].last_set_khz == 0) goto out; if (!rpm_clk[id].count) { struct msm_rpm_iv_pair iv; unsigned this_khz = rpm_clk[id].last_set_khz; unsigned this_sleep_khz = rpm_clk[id].last_set_sleep_khz; unsigned peer_id = rpm_clk[id].peer_clk_id; unsigned peer_khz = 0, peer_sleep_khz = 0; /* Turn on local smi_clk before enabling remote clock. */ if (id == R_SMI_CLK || id == R_SMI_A_CLK) { uint32_t regval; spin_lock(&local_clock_reg_lock); regval = secure_readl(MMSS_MAXI_EN2); regval |= SMI_2X_AXI_CLK_EN; secure_writel(regval, MMSS_MAXI_EN2); spin_unlock(&local_clock_reg_lock); } iv.id = rpm_clk[id].rpm_clk_id; /* Take peer clock's rate into account only if it's enabled. */ if (rpm_clk[peer_id].count) { peer_khz = rpm_clk[peer_id].last_set_khz; peer_sleep_khz = rpm_clk[peer_id].last_set_sleep_khz; } iv.value = max(this_khz, peer_khz); rc = msm_rpmrs_set_noirq(MSM_RPM_CTX_SET_0, &iv, 1); if (rc) goto out; iv.value = max(this_sleep_khz, peer_sleep_khz); rc = msm_rpmrs_set_noirq(MSM_RPM_CTX_SET_SLEEP, &iv, 1); } out: if (!rc) rpm_clk[id].count++; spin_unlock_irqrestore(&rpm_clock_lock, flags); return rc; }
void reboot_device(unsigned reboot_reason) { /* Reset WDG0 counter */ writel(1, MSM_WDT0_RST); /* Disable WDG0 */ writel(0, MSM_WDT0_EN); /* Set WDG0 bark time */ writel(0x31F3, MSM_WDT0_BT); /* Enable WDG0 */ writel(3, MSM_WDT0_EN); dmb(); /* Enable WDG output */ secure_writel(3, MSM_TCSR_BASE + TCSR_WDOG_CFG); mdelay(10000); dprintf(CRITICAL, "Rebooting failed\n"); return; }
void reboot_device(uint32_t reboot_reason) { /* TBD - set download mode? */ pm8058_reset_pwr_off(1); writel(reboot_reason, RESTART_REASON_ADDR); dmb(); writel(0, MSM_WDT0_EN); writel(0, PSHOLD_CTL_SU); mdelay(5000); writel(0x31F3, MSM_WDT0_BARK_TIME); writel(0x31F3, MSM_WDT0_BITE_TIME); writel(3, MSM_WDT0_EN); dmb(); secure_writel(3, MSM_TCSR_WDOG_CFG); mdelay(10000); dprintf(CRITICAL, "Shutdown failed\n"); }