return err;
}
-static int __dpi_panel_turn_on(struct mdfld_dsi_config *dsi_config)
-{
- struct mdfld_dsi_pkg_sender *sender =
- mdfld_dsi_get_pkg_sender(dsi_config);
- struct mdfld_dsi_hw_registers *regs;
- struct mdfld_dsi_hw_context *ctx;
- struct drm_device *dev;
- int err;
-
- regs = &dsi_config->regs;
- ctx = &dsi_config->dsi_hw_context;
- dev = dsi_config->dev;
-
- err = mdfld_dsi_send_dpi_spk_pkg_hs(sender,
- MDFLD_DSI_DPI_SPK_TURN_ON);
-
- return err;
-}
-
-static int __dpi_panel_turn_off(struct mdfld_dsi_config *dsi_config)
-{
- struct mdfld_dsi_pkg_sender *sender =
- mdfld_dsi_get_pkg_sender(dsi_config);
- struct mdfld_dsi_hw_registers *regs;
- struct mdfld_dsi_hw_context *ctx;
- struct drm_device *dev;
- int err;
-
- regs = &dsi_config->regs;
- ctx = &dsi_config->dsi_hw_context;
- dev = dsi_config->dev;
-
- err = mdfld_dsi_send_dpi_spk_pkg_hs(sender,
- MDFLD_DSI_DPI_SPK_SHUT_DOWN);
- return err;
-}
-
/**
* Setup Display Controller to turn on/off a video mode panel.
* Most of the video mode MIPI panel should follow the power on/off
* new panel function callbacks to make this function available for a
* new video mode panel
*/
-static int __mdfld_dsi_dpi_set_power(struct drm_encoder *encoder, enum mipi_panel_state opera)
+static int __mdfld_dsi_dpi_set_power(struct drm_encoder *encoder, bool on)
{
struct mdfld_dsi_encoder *dsi_encoder;
struct mdfld_dsi_connector *dsi_connector;
int pipe;
struct drm_device *dev;
struct drm_psb_private *dev_priv;
- bool power = false;
- static enum mipi_panel_state state = INVALID;
+
+ PSB_DEBUG_ENTRY("%s: mode %s\n", __func__, (on ? "on" : "off"));
if (!encoder) {
DRM_ERROR("Invalid encoder\n");
mutex_lock(&dsi_config->context_lock);
- power = (opera == PANEL_TURN_ON || opera == PANEL_TURN_OFF) ? false : true;
- PSB_DEBUG_ENTRY("%s: operation is %x, last state is %x\n", __func__, opera, state);
-
- if (dpi_output->first_boot) {
- printk(KERN_ALERT "skip panel power setting for first boot!\n");
- if (dsi_config->dsi_hw_context.panel_on)
- state = PANEL_POWER_ON;
- else
- state = PANEL_POWER_OFF;
- goto fun_exit;
- }
-
- if (!power) {
- if (opera == PANEL_TURN_ON) {
- if (state == PANEL_POWER_OFF) {
- PSB_DEBUG_ENTRY("%s: Panel is aready powered off\n", __func__);
- goto fun_exit;
- } else if (state == PANEL_POWER_ON || state == PANEL_TURN_ON)
- goto fun_exit;
- else { /*INVALID or PANEL_TURN_OFF*/
- if (__dpi_panel_turn_on(dsi_config)) {
- DRM_ERROR("Failed to turn off panel\n");
- goto set_power_err;
- }
- state = opera;
- dsi_config->dsi_hw_context.panel_on = 1;
+ if (on && !dsi_config->dsi_hw_context.panel_on) {
+ if (!dev_priv->drm_psb_widi && !dev_priv->dpms_on_off) {
+ if (__dpi_panel_power_on(dsi_config, p_funcs)) {
+ DRM_ERROR("Failed to power on\n");
+ goto set_power_err;
}
- } else { /*opera == PANEL_TURN_OFF*/
- if (state == PANEL_TURN_OFF || state == PANEL_POWER_OFF)
- goto fun_exit;
- else if (state == PANEL_TURN_ON || state == PANEL_POWER_ON
- || state == INVALID) {
- if (__dpi_panel_turn_off(dsi_config)) {
- DRM_ERROR("Failed to turn off panel\n");
+ } else {
+ if (p_funcs && p_funcs->power_on) {
+ if (p_funcs->power_on(dsi_config)) {
+ DRM_ERROR("Failed to power on panel\n");
goto set_power_err;
}
- state = opera;
- dsi_config->dsi_hw_context.panel_on = 0;
}
}
- } else { /*panel power management*/
- if (opera == PANEL_POWER_ON) {
- if (state == PANEL_TURN_ON || state == PANEL_POWER_ON)
- goto fun_exit;
- else {
- if (__dpi_panel_power_on(dsi_config, p_funcs)) {
- DRM_ERROR("Failed to power on\n");
- goto set_power_err;
- }
- state = opera;
- dsi_config->dsi_hw_context.panel_on = 1;
+ dsi_config->dsi_hw_context.panel_on = 1;
+ /*if power on , then default turn off color mode,
+ let panel in full color*/
+ mdfld_dsi_dpi_set_color_mode(dsi_config, false);
+ } else if (!on && dsi_config->dsi_hw_context.panel_on) {
+ if (dpi_output->first_boot) {
+ pr_debug("DPMS OFF first boot!\n");
+ goto set_power_err;
+ }
+ /*Just turn off panel for WiDi Extended Mode.*/
+ if (!dev_priv->drm_psb_widi && !dev_priv->dpms_on_off) {
+ if (__dpi_panel_power_off(dsi_config, p_funcs)) {
+ DRM_ERROR("Failed to power off\n");
+ goto set_power_err;
}
- } else {/*opera == PANEL_POWER_OFF*/
- if (state == PANEL_POWER_OFF)
- goto fun_exit;
- else{
- if (__dpi_panel_power_off(dsi_config, p_funcs)) {
- DRM_ERROR("Failed to power on\n");
+ } else {
+ if (p_funcs && p_funcs->power_off) {
+ if (p_funcs->power_off(dsi_config)) {
+ DRM_ERROR(
+ "Failed to power off panel\n");
goto set_power_err;
}
- state = opera;
- dsi_config->dsi_hw_context.panel_on = 0;
}
}
+ dsi_config->dsi_hw_context.panel_on = 0;
}
fun_exit:
mutex_unlock(&dsi_config->context_lock);
void mdfld_dsi_dpi_set_power(struct drm_encoder *encoder, bool on)
{
struct mdfld_dsi_encoder *dsi_encoder = MDFLD_DSI_ENCODER(encoder);
+ struct mdfld_dsi_dpi_output *dpi_output =
+ MDFLD_DSI_DPI_OUTPUT(dsi_encoder);
struct mdfld_dsi_config *dsi_config =
mdfld_dsi_encoder_get_config(dsi_encoder);
int pipe = mdfld_dsi_encoder_get_pipe(dsi_encoder);
struct drm_device *dev = dsi_config->dev;
struct drm_psb_private *dev_priv = dev->dev_private;
- struct mdfld_dsi_dpi_output *dpi_output = NULL;
u32 mipi_reg = MIPI;
u32 pipeconf_reg = PIPEACONF;
PSB_DEBUG_ENTRY("set power %s on pipe %d\n", on ? "On" : "Off", pipe);
- dpi_output = MDFLD_DSI_DPI_OUTPUT(dsi_encoder);
-
if (pipe)
if (!(dev_priv->panel_desc & DISPLAY_B) ||
!(dev_priv->panel_desc & DISPLAY_C))
* if TMD panel call new power on/off sequences instead.
* NOTE: refine TOSHIBA panel code later
*/
- if (dev_priv->dpms_on_off && !dpi_output->first_boot) {
- if (on)
- __mdfld_dsi_dpi_set_power(encoder, PANEL_TURN_ON);
- else
- __mdfld_dsi_dpi_set_power(encoder, PANEL_TURN_OFF);
- } else {
- if (on)
- __mdfld_dsi_dpi_set_power(encoder, PANEL_POWER_ON);
- else
- __mdfld_dsi_dpi_set_power(encoder, PANEL_POWER_OFF);
- }
+ __mdfld_dsi_dpi_set_power(encoder, on);
#endif
ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND);
return;
/*turn off*/
- __mdfld_dsi_dpi_set_power(encoder, PANEL_POWER_OFF);
+ __mdfld_dsi_dpi_set_power(encoder, false);
}
void mdfld_dsi_dpi_restore(struct drm_encoder *encoder)
return;
/*turn on*/
- __mdfld_dsi_dpi_set_power(encoder, PANEL_POWER_ON);
+ __mdfld_dsi_dpi_set_power(encoder, true);
}
/**
struct panel_funcs *p_funcs;
};
-enum mipi_panel_state {
- INVALID,
- PANEL_TURN_ON,
- PANEL_TURN_OFF,
- PANEL_POWER_ON,
- PANEL_POWER_OFF
-};
-
#define MDFLD_DSI_DPI_OUTPUT(dsi_encoder) \
container_of(dsi_encoder, struct mdfld_dsi_dpi_output, base)
spinlock_t flip_lock;
/*whether is DVI port*/
bool bDVIport;
+ unsigned int drm_psb_widi;
/*hdmi connected status */
bool bhdmiconnected;
if (ospm_power_using_hw_begin(OSPM_DISPLAY_ISLAND, OSPM_UHB_ONLY_IF_ON)) {
u32 writeVal = PSB_RVDC32(reg);
/* Don't clear other interrupts */
- writeVal &= (PIPE_EVENT_MASK | PIPE_VBLANK_MASK);
+ writeVal &= PIPE_EVENT_MASK;
writeVal |= (mask | (mask >> 16));
PSB_WVDC32(writeVal, reg);
(void) PSB_RVDC32(reg);
if (ospm_power_using_hw_begin(OSPM_DISPLAY_ISLAND, OSPM_UHB_ONLY_IF_ON)) {
u32 writeVal = PSB_RVDC32(reg);
/* Don't clear other interrupts */
- writeVal &= (PIPE_EVENT_MASK | PIPE_VBLANK_MASK);
+ writeVal &= PIPE_EVENT_MASK;
writeVal &= ~mask;
PSB_WVDC32(writeVal, reg);
(void) PSB_RVDC32(reg);
mutex_init(&g_ospm_mutex);
spin_lock_init(&dev_priv->ospm_lock);
+ dev_priv->drm_psb_widi = 0;
spin_lock_irqsave(&dev_priv->ospm_lock, flags);
g_hw_power_status_mask = OSPM_ALL_ISLANDS;
spin_unlock_irqrestore(&dev_priv->ospm_lock, flags);
mdfld_restore_display_registers(dev, 2);
if (dev_priv->panel_desc & DISPLAY_A)
mdfld_restore_display_registers(dev, 0);
-
/*
* Don't restore Display B registers during resuming, if HDMI
* isn't turned on before suspending.
defined(CONFIG_SND_INTELMID_HDMI_AUDIO_MODULE))
if (!is_hdmi_plugged_out(dev)) {
PSB_DEBUG_ENTRY("resume hdmi_state %d", hdmi_state);
- if (dev_priv->had_pvt_data && hdmi_state)
- dev_priv->had_interface->resume(dev_priv->had_pvt_data);
+ if (dev_priv->had_pvt_data && hdmi_state) {
+ if (!dev_priv->had_interface->resume(dev_priv->had_pvt_data)) {
+ uevent_string = "HDMI_AUDIO_PM_RESUMED=1";
+ psb_sysfs_uevent(dev_priv->dev, uevent_string);
+ }
+ }
}
#endif
}
printk(KERN_ALERT "\n gfx_early_suspend\n");
#endif
+ if( dev_priv->drm_psb_widi )
+ dev_priv->drm_psb_widi = 0;
if (dev_priv->pvr_screen_event_handler)
dev_priv->pvr_screen_event_handler(dev, 0);
/*Display off*/
printk(KERN_ALERT "\ngfx_late_resume\n");
#endif
+ if( dev_priv->drm_psb_widi )
+ dev_priv->drm_psb_widi = 0;
+
if(IS_MDFLD(gpDrmDevice)){
#ifdef CONFIG_GFX_RTPM
hdmi_audio_busy =
had_interface->suspend(dev_priv->had_pvt_data,
hdmi_audio_event);
+ if (!hdmi_audio_busy) {
+ uevent_string = "HDMI_AUDIO_PM_SUSPENDED=1";
+ psb_sysfs_uevent(dev_priv->dev, uevent_string);
+ }
}
#endif
return -EINVAL;
}
- mdfld_dsi_send_gen_long_hs(sender, pr2_mcs_protect_off, 4, 0);
- /*change power state*/
- mdfld_dsi_send_mcs_long_hs(sender, pr2_exit_sleep_mode, 4, 0);
+ /*Just turn on panel for WiDi Extended Mode.*/
+ if (!dev_priv->drm_psb_widi && !dev_priv->dpms_on_off) {
+ mdfld_dsi_send_gen_long_hs(sender, pr2_mcs_protect_off, 4, 0);
+ /*change power state*/
+ mdfld_dsi_send_mcs_long_hs(sender, pr2_exit_sleep_mode, 4, 0);
- /*120ms delay is needed between enter and exit sleep mode per spec*/
- msleep(120);
+ msleep(120);
- /*enable PWMON*/
- pr2_backlight_control_2[0] |= BIT8;
- mdfld_dsi_send_mcs_long_hs(sender,
+ /*enable PWMON*/
+ pr2_backlight_control_2[0] |= BIT8;
+ mdfld_dsi_send_mcs_long_hs(sender,
pr2_backlight_control_2, 8, 0);
- /*set display on*/
- mdfld_dsi_send_mcs_long_hs(sender, pr2_set_display_on, 4, 0);
+ /*set display on*/
+ mdfld_dsi_send_mcs_long_hs(sender, pr2_set_display_on, 4, 0);
- /*FIXME: To be safe before enter sleep mode there's a delay. 21ms is a trial value.*/
- msleep(21);
+ msleep(21);
- /*Enable BLON , CABC*/
- if (drm_psb_enable_pr2_cabc) {
- pr2_backlight_control_1[0] |= BIT8;
- mdfld_dsi_send_gen_long_hs(sender,
+ /*Enable BLON , CABC*/
+ if (drm_psb_enable_pr2_cabc) {
+ pr2_backlight_control_1[0] |= BIT8;
+ mdfld_dsi_send_gen_long_hs(sender,
pr2_backlight_control_1, 24, 0);
- printk(KERN_ALERT "enable pr2 cabc\n");
- }
+ printk(KERN_ALERT "enable pr2 cabc\n");
+ }
+ }
/*send TURN_ON packet*/
err = mdfld_dsi_send_dpi_spk_pkg_hs(sender,
MDFLD_DSI_DPI_SPK_TURN_ON);
return err;
}
- mdfld_dsi_send_gen_long_hs(sender, pr2_mcs_protect_off, 4, 0);
- /*change power state here*/
- mdfld_dsi_send_mcs_long_hs(sender, pr2_set_display_off, 4, 0);
+ /*Just turn off panel for WiDi Extended Mode.*/
+ if (!dev_priv->drm_psb_widi && !dev_priv->dpms_on_off) {
+ mdfld_dsi_send_gen_long_hs(sender, pr2_mcs_protect_off, 4, 0);
+ /*change power state here*/
+ mdfld_dsi_send_mcs_long_hs(sender, pr2_set_display_off, 4, 0);
- /*disable BLCON, disable CABC*/
- pr2_backlight_control_1[0] &= (~BIT8);
- mdfld_dsi_send_gen_long_hs(sender,
- pr2_backlight_control_1, 6, 0);
- printk(KERN_ALERT "disable pr2 cabc\n");
+ /*disable BLCON, disable CABC*/
+ pr2_backlight_control_1[0] &= (~BIT8);
+ mdfld_dsi_send_gen_long_hs(sender,
+ pr2_backlight_control_1, 24, 0);
+ printk(KERN_ALERT "disable pr2 cabc\n");
- /*FIXME: To be safe before enter sleep mode there's a delay. 21ms is a trial value.*/
- msleep(21);
+ msleep(21);
- mdfld_dsi_send_mcs_long_hs(sender, pr2_enter_sleep_mode, 4, 0);
+ mdfld_dsi_send_mcs_long_hs(sender, pr2_enter_sleep_mode, 4, 0);
- /*120ms delay is needed between enter and exit sleep mode per spec*/
- msleep(120);
+ msleep(120);
- /*put panel into deep standby mode*/
- mdfld_dsi_send_gen_long_hs(sender,
+ /*put panel into deep standby mode*/
+ mdfld_dsi_send_gen_long_hs(sender,
pr2_enter_low_power_mode, 4, 0);
- mdfld_dsi_send_gen_long_hs(sender, pr2_mcs_protect_on, 4, 0);
-
+ mdfld_dsi_send_gen_long_hs(sender, pr2_mcs_protect_on, 4, 0);
+ }
return 0;
}
}
break;
case IMG_DISPLAY_SET_WIDI_EXT_STATE:
- DRM_ERROR("variable drm_psb_widi has been removed\n");
+ dev_priv->drm_psb_widi = (int)arg->value;
+ DRM_INFO("psb_drm_widi: %d.\n", dev_priv->drm_psb_widi);
break;
case IMG_VIDEO_GET_HDMI_STATE:
ret = copy_to_user((void __user *)((unsigned long)arg->value),
return -ENODEV;
}
- /*
- * HDMI driver might suspend the device already,
- * so we return it on
- */
- if (!ospm_power_using_hw_begin(OSPM_DISPLAY_ISLAND,
- OSPM_UHB_FORCE_POWER_ON)) {
- pr_err("HDMI device can't be turned on\n");
- return -ENODEV;
- }
-
if (had_get_hwstate(intelhaddata)) {
pr_err("%s: HDMI cable plugged-out\n", __func__);
- ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND);
return -ENODEV;
}
/* Check, if device already in use */
if (runtime->private_data) {
pr_err("Device already in use\n");
- ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND);
return -EBUSY;
}
- ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND);
-
/* set the runtime hw parameter with local snd_pcm_hardware struct */
runtime->hw = snd_intel_hadstream;