void sun4i_tcon_set_status(struct sun4i_tcon *tcon, const struct drm_encoder *encoder, bool enabled) { int channel; switch (encoder->encoder_type) { case DRM_MODE_ENCODER_NONE: channel = 0; break; case DRM_MODE_ENCODER_TMDS: case DRM_MODE_ENCODER_TVDAC: channel = 1; break; default: DRM_DEBUG_DRIVER("Unknown encoder type, doing nothing...\n"); return; } regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG, SUN4I_TCON_GCTL_TCON_ENABLE, enabled ? SUN4I_TCON_GCTL_TCON_ENABLE : 0); sun4i_tcon_channel_set_status(tcon, channel, enabled); }
void sun4i_tcon_set_status(struct sun4i_tcon *tcon, const struct drm_encoder *encoder, bool enabled) { bool is_lvds = false; int channel; switch (encoder->encoder_type) { case DRM_MODE_ENCODER_LVDS: is_lvds = true; /* Fallthrough */ case DRM_MODE_ENCODER_NONE: channel = 0; break; case DRM_MODE_ENCODER_TMDS: case DRM_MODE_ENCODER_TVDAC: channel = 1; break; default: DRM_DEBUG_DRIVER("Unknown encoder type, doing nothing...\n"); return; } if (is_lvds && !enabled) sun4i_tcon_lvds_set_status(tcon, encoder, false); regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG, SUN4I_TCON_GCTL_TCON_ENABLE, enabled ? SUN4I_TCON_GCTL_TCON_ENABLE : 0); if (is_lvds && enabled) sun4i_tcon_lvds_set_status(tcon, encoder, true); sun4i_tcon_channel_set_status(tcon, channel, enabled); }