示例#1
0
static void tegra_dc_shutdown(struct nvhost_device *ndev)
{
	struct tegra_dc *dc = nvhost_get_drvdata(ndev);

	if (!dc || !dc->enabled)
		return;

	tegra_dc_blank(dc);
	tegra_dc_disable(dc);
}
示例#2
0
static ssize_t enable_store(struct device *dev,
	struct device_attribute *attr, const char *buf, size_t count)
{
	struct nvhost_device *ndev = to_nvhost_device(dev);
	struct tegra_dc *dc = nvhost_get_drvdata(ndev);
	unsigned long val = 0;

	if (strict_strtoul(buf, 10, &val) < 0)
		return -EINVAL;

	if (val) {
		tegra_dc_enable(dc);
	} else {
		tegra_dc_disable(dc);
	}

	return count;
}
/************************************************************
 *
 * internal state handlers and dispatch table
 *
 ************************************************************/
static void hdmi_disable_l(struct tegra_dc_hdmi_data *hdmi, bool power_gate)
{
#ifdef CONFIG_SWITCH
	switch_set_state(&hdmi->audio_switch, 0);
	pr_info("%s: audio_switch 0\n", __func__);
	switch_set_state(&hdmi->hpd_switch, 0);
	pr_info("%s: hpd_switch 0\n", __func__);
#endif
	tegra_nvhdcp_set_plug(hdmi->nvhdcp, 0);
	if (hdmi->dc->connected) {
		pr_info("HDMI from connected to disconnected\n");
		hdmi->dc->connected = false;
		tegra_dc_disable(hdmi->dc);
		tegra_fb_update_monspecs(hdmi->dc->fb, NULL, NULL);
		tegra_dc_ext_process_hotplug(hdmi->dc->ndev->id);
	}
	if (power_gate && tegra_powergate_is_powered(hdmi->dc->powergate_id))
		tegra_dc_powergate_locked(hdmi->dc);
}
示例#4
0
/************************************************************
 *
 * internal state handlers and dispatch table
 *
 ************************************************************/
static void hdmi_disable_l(struct tegra_dc_hdmi_data *hdmi)
{
#ifdef CONFIG_SWITCH
	switch_set_state(&hdmi->audio_switch, 0);
	pr_info("%s: audio_switch 0\n", __func__);
	switch_set_state(&hdmi->hpd_switch, 0);
	pr_info("%s: hpd_switch 0\n", __func__);
#endif
	tegra_nvhdcp_set_plug(hdmi->nvhdcp, 0);
	if (hdmi->dc->connected) {
		pr_info("HDMI from connected to disconnected\n");
		hdmi->dc->connected = false;
		tegra_dc_disable(hdmi->dc);
#ifdef CONFIG_ADF_TEGRA
		tegra_adf_process_hotplug_disconnected(hdmi->dc->adf);
#endif
#ifdef CONFIG_TEGRA_DC_EXTENSIONS
		tegra_fb_update_monspecs(hdmi->dc->fb, NULL, NULL);
		tegra_dc_ext_process_hotplug(hdmi->dc->ndev->id);
#endif
	}
}
示例#5
0
static int tegra_fb_set_par(struct fb_info *info)
{
	struct tegra_fb_info *tegra_fb = info->par;
	struct fb_var_screeninfo *var = &info->var;

	if (var->bits_per_pixel) {
		/* we only support RGB ordering for now */
		switch (var->bits_per_pixel) {
		case 32:
			var->red.offset = 0;
			var->red.length = 8;
			var->green.offset = 8;
			var->green.length = 8;
			var->blue.offset = 16;
			var->blue.length = 8;
			var->transp.offset = 24;
			var->transp.length = 8;
			tegra_fb->win->fmt = TEGRA_WIN_FMT_R8G8B8A8;
			break;
		case 16:
			var->red.offset = 11;
			var->red.length = 5;
			var->green.offset = 5;
			var->green.length = 6;
			var->blue.offset = 0;
			var->blue.length = 5;
			tegra_fb->win->fmt = TEGRA_WIN_FMT_B5G6R5;
			break;

		default:
			return -EINVAL;
		}
		info->fix.line_length = var->xres * var->bits_per_pixel / 8;
		/* Pad the stride to 16-byte boundary. */
		info->fix.line_length = round_up(info->fix.line_length,
						TEGRA_LINEAR_PITCH_ALIGNMENT);
		tegra_fb->win->stride = info->fix.line_length;
		tegra_fb->win->stride_uv = 0;
		tegra_fb->win->phys_addr_u = 0;
		tegra_fb->win->phys_addr_v = 0;
	}

	if (var->pixclock) {
		bool stereo;
		struct fb_videomode m;

		fb_var_to_videomode(&m, var);

		info->mode = (struct fb_videomode *)
			fb_find_nearest_mode(&m, &info->modelist);
		if (!info->mode) {
			dev_warn(&tegra_fb->ndev->dev, "can't match video mode\n");
			return -EINVAL;
		}

		/*
		 * only enable stereo if the mode supports it and
		 * client requests it
		 */
		stereo = !!(var->vmode & info->mode->vmode &
#ifndef CONFIG_TEGRA_HDMI_74MHZ_LIMIT
					FB_VMODE_STEREO_FRAME_PACK);
#else
					FB_VMODE_STEREO_LEFT_RIGHT);
#endif
		tegra_dc_set_fb_mode(tegra_fb->win->dc, info->mode, stereo);
		/* Reflect the mode change on dc */
		tegra_dc_disable(tegra_fb->win->dc);
		tegra_dc_enable(tegra_fb->win->dc);

		tegra_fb->win->w.full = dfixed_const(info->mode->xres);
		tegra_fb->win->h.full = dfixed_const(info->mode->yres);
		tegra_fb->win->out_w = info->mode->xres;
		tegra_fb->win->out_h = info->mode->yres;
	}