From 74f7463b03a048a167d724bcb45eaca2ccdeb399 Mon Sep 17 00:00:00 2001 From: Joy Cho Date: Thu, 28 Mar 2019 14:45:08 +0900 Subject: [PATCH] ODROID-N2: display: Support hdmi phy control using osd blank ioctl 1. control with env 'monitor_onoff' in boot.ini 2. blank_mode - FB_BLANK_POWERDOWN - hdmi phy off - FB_BLANK_UNBLANK - hdmi phy on Change-Id: I00411be529fe80f19d9a1e4b17eed3583934ff4a --- drivers/amlogic/media/osd/osd_fb.c | 31 +++++++++++++++++++ drivers/amlogic/media/osd/osd_fb.h | 1 + .../vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c | 12 +++++++ 3 files changed, 44 insertions(+) diff --git a/drivers/amlogic/media/osd/osd_fb.c b/drivers/amlogic/media/osd/osd_fb.c index c4870b473017..6b8227cf5460 100644 --- a/drivers/amlogic/media/osd/osd_fb.c +++ b/drivers/amlogic/media/osd/osd_fb.c @@ -1915,12 +1915,43 @@ done: return err; } +static bool monitor_onoff_action; + int osd_blank(int blank_mode, struct fb_info *info) { osd_enable_hw(info->node, (blank_mode != 0) ? 0 : 1); + + if (!monitor_onoff_action) + return 0; + + switch (blank_mode) { + case FB_BLANK_UNBLANK: + control_hdmiphy(true); + break; + case FB_BLANK_POWERDOWN: + control_hdmiphy(false); + break; + case FB_BLANK_NORMAL: + case FB_BLANK_HSYNC_SUSPEND: + case FB_BLANK_VSYNC_SUSPEND: + default: + break; + } + return 0; } +static int __init osd_setup_monitor_onoff(char *str) +{ + if (!strcmp(str, "true") || !strcmp(str, "1")) + monitor_onoff_action = true; + else + monitor_onoff_action = false; + + return 0; +} +__setup("monitor_onoff=", osd_setup_monitor_onoff); + static int osd_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi) { diff --git a/drivers/amlogic/media/osd/osd_fb.h b/drivers/amlogic/media/osd/osd_fb.h index 61ddc16b9bd3..75475a93dd2e 100644 --- a/drivers/amlogic/media/osd/osd_fb.h +++ b/drivers/amlogic/media/osd/osd_fb.h @@ -73,4 +73,5 @@ extern size_t get_fb_rmem_size(int index); extern int osd_blank(int blank_mode, struct fb_info *info); extern struct osd_fb_dev_s *gp_fbdev_list[]; extern const struct color_bit_define_s default_color_format_array[]; +extern void control_hdmiphy(bool on); #endif diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c index 87342822acdf..40465b3bcb46 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c @@ -110,6 +110,18 @@ struct extcon_dev *hdmitx_extcon_hdr; struct extcon_dev *hdmitx_extcon_rxsense; struct extcon_dev *hdmitx_extcon_hdcp; +void control_hdmiphy(bool on) +{ + if (on) + hdmitx_device.HWOp.CntlMisc(&hdmitx_device, + MISC_TMDS_PHY_OP, + TMDS_PHY_ENABLE); + else + hdmitx_device.HWOp.CntlMisc(&hdmitx_device, + MISC_TMDS_PHY_OP, + TMDS_PHY_DISABLE); +} + static struct hdmi_cea_timing custom_timing; struct hdmi_cea_timing *get_custom_timing(void) {