From: Zongdong Jiao Date: Fri, 15 Nov 2019 08:03:43 +0000 (+0800) Subject: hdmitx: add a fake hpd for system test [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=51907dfec598c6d4924dab02dd55c7293adde627;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git hdmitx: add a fake hpd for system test [1/1] PD#SWPL-16891 Problem: For automatical test, the HDMI cable are always connected between Tx and Rx without manully action. Solution: add a fake hpd for system test echo 0[1] > /sys/class/amhdmitx/amhdmitx0/fake_plug Verify: G12/U212 Change-Id: I826fc0094845a13066a1535a4a87727b4ecad452 Signed-off-by: Zongdong Jiao (cherry picked from commit e764ebfccc9502eb027f20527b58f7d4f509d1fd) --- 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 f28870301a3a..43382a1b1762 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 @@ -3832,6 +3832,31 @@ static ssize_t show_hpd_state(struct device *dev, return pos; } +static ssize_t show_fake_plug(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%d", hdmitx_device.hpd_state); +} + +static ssize_t store_fake_plug(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct hdmitx_dev *hdev = &hdmitx_device; + + pr_info("hdmitx: fake plug %s\n", buf); + + if (strncmp(buf, "1", 1) == 0) + hdev->hpd_state = 1; + + if (strncmp(buf, "0", 1) == 0) + hdev->hpd_state = 0; + + extcon_set_state_sync(hdmitx_extcon_hdmi, EXTCON_DISP_HDMI, + hdev->hpd_state); + + return count; +} static ssize_t show_rhpd_state(struct device *dev, struct device_attribute *attr, char *buf) @@ -3953,6 +3978,7 @@ static DEVICE_ATTR(hdcp_ver, 0444, show_hdcp_ver, NULL); static DEVICE_ATTR(hpd_state, 0444, show_hpd_state, NULL); static DEVICE_ATTR(rhpd_state, 0444, show_rhpd_state, NULL); static DEVICE_ATTR(max_exceed, 0444, show_max_exceed_state, NULL); +static DEVICE_ATTR(fake_plug, 0664, show_fake_plug, store_fake_plug); static DEVICE_ATTR(hdmi_init, 0444, show_hdmi_init, NULL); static DEVICE_ATTR(ready, 0664, show_ready, store_ready); static DEVICE_ATTR(support_3d, 0444, show_support_3d, NULL); @@ -5153,6 +5179,7 @@ static int amhdmitx_probe(struct platform_device *pdev) ret = device_create_file(dev, &dev_attr_hpd_state); ret = device_create_file(dev, &dev_attr_rhpd_state); ret = device_create_file(dev, &dev_attr_max_exceed); + ret = device_create_file(dev, &dev_attr_fake_plug); ret = device_create_file(dev, &dev_attr_hdmi_init); ret = device_create_file(dev, &dev_attr_ready); ret = device_create_file(dev, &dev_attr_support_3d); @@ -5238,6 +5265,7 @@ static int amhdmitx_remove(struct platform_device *pdev) device_remove_file(dev, &dev_attr_contenttype_cap); device_remove_file(dev, &dev_attr_contenttype_mode); device_remove_file(dev, &dev_attr_hpd_state); + device_remove_file(dev, &dev_attr_fake_plug); device_remove_file(dev, &dev_attr_rhpd_state); device_remove_file(dev, &dev_attr_max_exceed); device_remove_file(dev, &dev_attr_hdmi_init);