static void hdmi_early_suspend(struct early_suspend *h)
{
    printk(" hdmi_early_suspend \n");
    hdmi_power_enable(0);
    hdmi_factory_mode_test(STEP1_ENABLE, NULL);
    hdmi_factory_mode_test(STEP3_SUSPEND, NULL);
}
static void hdmi_early_suspend(struct early_suspend *h)
{
    printk(" hdmi_early_suspend \n");
    hdmi_power_enable(0);
#ifndef CONFIG_SINGLE_PANEL_OUTPUT
    hdmi_factory_mode_test(STEP1_ENABLE, NULL);
    hdmi_factory_mode_test(STEP3_SUSPEND, NULL);
#endif
}
Пример #3
0
static void process_dbg_opt(const char *opt)
{
	unsigned int reg;
	unsigned int val;
	unsigned int vadr_regstart;
	unsigned int vadr_regend;
	char *buf;
	int temp_len = 0;
	int len = 0;
	int ret;
	long int p_temp;

	buf = (char *)opt;

	if (strncmp(buf, "dbgtype:", 8) == 0) {
		ret = sscanf(buf + 8, "%x", &val);
		mt8193_log_enable(val);
		pr_debug("hdmidrv_log_on = 0x%08x\n", mt8193_log_on);
	} else if (strncmp(buf, "w:", 2) == 0) {
		ret = sscanf(buf + 2, "%x=%x", &reg, &val);
		pr_debug("w:0x%08x=0x%08x\n", reg, val);
		mt8193_write(reg, val);
	} else if (strncmp(buf, "r:", 2) == 0) {
		ret = sscanf(buf + 2, "%x/%x", &vadr_regstart, &vadr_regend);
		vadr_regend &= 0x3ff;
		pr_debug("r:0x%08x/0x%08x\n", vadr_regstart, vadr_regend);
		vadr_regend = vadr_regstart + vadr_regend;
		while (vadr_regstart <= vadr_regend) {
			mt8193_read(vadr_regstart, &val);
			HDMI_ATTR_SPRINTF("0x%08x = 0x%08x\n", vadr_regstart, val);
			vadr_regstart += 4;
		}
	} else if (strncmp(buf, "dw:", 3) == 0) {
		ret = sscanf(buf + 3, "%x=%x", &reg, &val);
		pr_debug("dw:0x%08x=0x%08x\n", reg, val);
		iowrite32(val, (void __iomem *)DPI0_BASE_ADDR + reg);
	} else if (strncmp(buf, "dr:", 3) == 0) {
		ret = sscanf(buf + 3, "%x/%x", &vadr_regstart, &vadr_regend);
		vadr_regend &= 0x3ff;
		pr_debug("dr:0x%08x/0x%08x\n", vadr_regstart, vadr_regend);
		vadr_regend = vadr_regstart + vadr_regend;
		while (vadr_regstart <= vadr_regend) {
			HDMI_ATTR_SPRINTF("0x%08x = 0x%08x\n", vadr_regstart,
					  ioread32((void __iomem *)DPI0_BASE_ADDR + vadr_regstart));
			vadr_regstart += 4;
		}
	} else if (strncmp(buf, "status", 6) == 0) {
		HDMI_ATTR_SPRINTF("[hdmi]mt8193_log_on=%x\n", mt8193_log_on);
		HDMI_ATTR_SPRINTF("[hdmi]hdmi_powerenable=%x\n", hdmi_powerenable);
		HDMI_ATTR_SPRINTF("[hdmi]mt8193_hdmiinit=%d\n", mt8193_hdmiinit);
		HDMI_ATTR_SPRINTF("[hdmi]mt8193_hotinit=%d\n", mt8193_hotinit);
		HDMI_ATTR_SPRINTF("[hdmi]mt8193_hdmipoweroninit=%d\n", mt8193_hdmipoweroninit);
		HDMI_ATTR_SPRINTF("[hdmi]is_user_mute_hdmi_audio=%x\n", is_user_mute_hdmi_audio);
		HDMI_ATTR_SPRINTF("[hdmi]port=%d\n", hdmi_port_status());
		if (mt8193_hotplugstate == HDMI_STATE_HOT_PLUGIN_AND_POWER_ON)
			HDMI_ATTR_SPRINTF("[hdmi]plug:HDMI_STATE_HOT_PLUGIN_AND_POWER_ON\n");
		else if (mt8193_hotplugstate == HDMI_STATE_HOT_PLUG_OUT)
			HDMI_ATTR_SPRINTF("[hdmi]plug:HDMI_STATE_HOT_PLUG_OUT\n");
		else if (mt8193_hotplugstate == HDMI_STATE_HOT_PLUG_IN_ONLY)
			HDMI_ATTR_SPRINTF("[hdmi]plug:HDMI_STATE_HOT_PLUG_IN_ONLY\n");

		HDMI_ATTR_SPRINTF("[hdmi]video resolution : %d\n", _stAvdAVInfo.e_resolution);
		HDMI_ATTR_SPRINTF("[hdmi]video color space : %d\n",
				  _stAvdAVInfo.e_video_color_space);
		HDMI_ATTR_SPRINTF("[hdmi]video deep color : %d\n", _stAvdAVInfo.e_deep_color_bit);
		HDMI_ATTR_SPRINTF("[hdmi]audio fs : %d\n", _stAvdAVInfo.e_hdmi_fs);

		if (vIsDviMode())
			HDMI_ATTR_SPRINTF("[hdmi]dvi Mode\n");
		else
			HDMI_ATTR_SPRINTF("[hdmi]hdmi Mode\n");

		mt8193_hdmistatus();
	} else if (0 == strncmp(opt, "po", 2)) {
		mt8193_power_on();
	} else if (0 == strncmp(opt, "pd", 2)) {
		mt8193_power_off();
	} else if (0 == strncmp(opt, "cs:", 3)) {
		ret = sscanf(buf + 3, "%x", &val);
		mt8193_colordeep(val, 0);
	} else if (0 == strncmp(opt, "finit", 5)) {
		hdmi_factory_mode_test(STEP1_CHIP_INIT, NULL);
	} else if (0 == strncmp(opt, "fres:", 5)) {
		ret = sscanf(buf + 5, "%x", &val);
		p_temp = (long int)val;
		hdmi_factory_mode_test(STEP3_START_DPI_AND_CONFIG, (void *)p_temp);
	} else {
		HDMI_ATTR_SPRINTF("---hdmi debug help---\n");
		HDMI_ATTR_SPRINTF("please go in to sys/kernel/debug\n");
		HDMI_ATTR_SPRINTF("[debug type] echo dbgtype:VALUE>8193\n");
		HDMI_ATTR_SPRINTF("[8193 read reg] echo r:ADDR/LEN>8193;cat 8193\n");
		HDMI_ATTR_SPRINTF("[8193 write reg] echo w:ADDR=VALUE>8193\n");
		HDMI_ATTR_SPRINTF("[d2 dpi0  read reg] echo dr:ADDR/LEN>8193;cat 8193\n");
		HDMI_ATTR_SPRINTF("[d2 dpi0  write reg] echo dw:ADDR=VALUE>8193\n");
		HDMI_ATTR_SPRINTF("[hdmi status] echo status>8193;cat 8193\n");
		HDMI_ATTR_SPRINTF("[power on] echo po>8193\n");
		HDMI_ATTR_SPRINTF("[power off] echo dn>8193\n");
		HDMI_ATTR_SPRINTF("[color space] echo cs:VALUE>8193\n");
		HDMI_ATTR_SPRINTF("[factory mode init] echo finit>8193\n");
		HDMI_ATTR_SPRINTF("[factory res] echo fres:VALUE>8193\n");
	}
}
static long mtk_ext_disp_mgr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
    void __user *argp = (void __user *)arg;
    int r = 0;

    printk("[EXTD]ioctl= %s(%d), arg = %lu\n", _hdmi_ioctl_spy(cmd), cmd & 0xff, arg);

    switch (cmd)
    {
    case MTK_HDMI_AUDIO_VIDEO_ENABLE:
    {
        /* 0xXY
                   * the low 16 bits(Y) are for disable and enable, and the high 16 bits(X) are for device id
                   * the device id:
                   * X = 0 - mhl
                   * X = 1 - wifi display
                */
        external_display_enable(arg);
        break;
    }

    case MTK_HDMI_POWER_ENABLE:
    {
        /* 0xXY
                   * the low 16 bits(Y) are for disable and enable, and the high 16 bits(X) are for device id
                   * the device id:
                   * X = 0 - mhl
                   * X = 1 - wifi display
                */
        external_display_power_enable(arg);
        break;
    }

    case MTK_HDMI_VIDEO_CONFIG:
    {
        /* 0xXY
                   * the low 16 bits(Y) are for disable and enable, and the high 16 bits(X) are for device id
                   * the device id:
                   * X = 0 - mhl
                   * X = 1 - wifi display
                   */
        external_display_set_resolution(arg);
        break;
    }

    case MTK_HDMI_FORCE_FULLSCREEN_ON:
        //case MTK_HDMI_FORCE_CLOSE:
    {
        /* 0xXY
                   * the low 16 bits(Y) are for disable and enable, and the high 16 bits(X) are for device id
                   * the device id:
                   * X = 0 - mhl
                   * X = 1 - wifi display
                   */
        arg = arg | 0x1;
        external_display_power_enable(arg);
        break;
    }

    case MTK_HDMI_FORCE_FULLSCREEN_OFF:
        //case MTK_HDMI_FORCE_OPEN:
    {
        /* 0xXY
                   * the low 16 bits(Y) are for disable and enable, and the high 16 bits(X) are for device id
                   * the device id:
                   * X = 0 - mhl
                   * X = 1 - wifi display
                 */
        arg = arg & 0x0FF0000;
        external_display_power_enable(arg);
        break;
    }

    case MTK_HDMI_GET_DEV_INFO:
    {
        /* 0xXY
                   * the low 16 bits(Y) are for disable and enable, and the high 16 bits(X) are for device id
                   * the device id:
                   * X = 0 - mhl
                   * X = 1 - wifi display
                 */
        r = external_display_get_dev_info(*((unsigned long *)argp), argp);
        break;
    }

    case MTK_HDMI_USBOTG_STATUS:
    {
        //hdmi_set_USBOTG_status(arg);
        break;
    }

    case MTK_HDMI_AUDIO_ENABLE:
    {
        printk("[EXTD]hdmi_set_audio_enable, arg = %lu\n", arg);
        hdmi_set_audio_enable(arg);
        break;
    }

    case MTK_HDMI_VIDEO_ENABLE:
    {
        break;
    }

    case MTK_HDMI_AUDIO_CONFIG:
    {
        r = hdmi_audio_config(arg);
        break;
    }

    case MTK_HDMI_IS_FORCE_AWAKE:
    {
        r = hdmi_is_force_awake(argp);
        break;
    }

    case MTK_HDMI_GET_EDID:
    {
        hdmi_get_edid(argp);
        break;
    }

    case MTK_HDMI_SCREEN_CAPTURE:
    {
        r = hdmi_screen_capture(argp);
        break;
    }

    case MTK_HDMI_FACTORY_CHIP_INIT:
    {
        r = hdmi_factory_mode_test(STEP1_CHIP_INIT, NULL);
        break;
    }

    case MTK_HDMI_FACTORY_JUDGE_CALLBACK:
    {
        r = hdmi_factory_mode_test(STEP2_JUDGE_CALLBACK, argp);
        break;
    }

    case MTK_HDMI_FACTORY_START_DPI_AND_CONFIG:
    {
        r = hdmi_factory_mode_test(STEP3_START_DPI_AND_CONFIG, arg);
        //hdmi_factory_mode_test(STEP1_CHIP_INIT, NULL);
        //hdmi_factory_mode_test(STEP3_START_DPI_AND_CONFIG, arg);
        break;
    }
    case MTK_HDMI_FACTORY_DPI_STOP_AND_POWER_OFF:
    {
        ///r = hdmi_factory_mode_test(STEP4_DPI_STOP_AND_POWER_OFF, NULL);
        break;
    }
    case MTK_HDMI_FAKE_PLUG_IN:
    {
        if(arg)
        {
            hdmi_cable_fake_plug_in();
        }
        else
        {
            hdmi_cable_fake_plug_out();
        }
        break;
    }
    default:
    {
        printk("[EXTD]ioctl(%d) arguments is not support\n",  cmd & 0x0ff);
        r = -EFAULT;
        break;
    }
    }

    printk("[EXTD]ioctl = %s(%d) done\n",  _hdmi_ioctl_spy(cmd), cmd & 0x0ff);
    return r;
}