Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3ec6a02 authored by Ajay Singh Parmar's avatar Ajay Singh Parmar
Browse files

msm: mdss: hdmi: use hardware hot plug trigger



On receiving hot plug power off event, switch off 5V
regulator in case cable is still connected to sink to
receive disconnect hardware interrupt. Do not issue
software based disconnect event in this case as it can
cause different modules to go out of sync resulting in
unstable system.

Change-Id: I19d82b62e8ad507458abd21a8a71fbcae8adefec
Signed-off-by: default avatarAjay Singh Parmar <aparmar@codeaurora.org>
parent 29f50667
Loading
Loading
Loading
Loading
+33 −8
Original line number Diff line number Diff line
@@ -658,6 +658,29 @@ void *hdmi_get_featuredata_from_sysfs_dev(struct device *device,
} /* hdmi_tx_get_featuredata_from_sysfs_dev */
EXPORT_SYMBOL(hdmi_get_featuredata_from_sysfs_dev);

static int hdmi_tx_config_5v(struct hdmi_tx_ctrl *hdmi_ctrl, bool enable)
{
	struct dss_module_power *pd = NULL;
	int ret = 0;

	if (!hdmi_ctrl) {
		DEV_ERR("%s: invalid input\n", __func__);
		ret = -EINVAL;
		goto end;
	}

	pd = &hdmi_ctrl->pdata.power_data[HDMI_TX_HPD_PM];
	if (!pd || !pd->gpio_config) {
		DEV_ERR("%s: Error: invalid power data\n", __func__);
		ret = -EINVAL;
		goto end;
	}

	gpio_set_value(pd->gpio_config->gpio, enable);
end:
	return ret;
}

static ssize_t hdmi_tx_sysfs_rda_connected(struct device *dev,
	struct device_attribute *attr, char *buf)
{
@@ -889,11 +912,12 @@ static ssize_t hdmi_tx_sysfs_wta_hpd(struct device *dev,

		hdmi_ctrl->audio_ack_enabled = false;

		hdmi_tx_set_audio_switch_node(hdmi_ctrl, 0);
		hdmi_tx_wait_for_audio_engine(hdmi_ctrl);
		hdmi_tx_send_cable_notification(hdmi_ctrl, 0);

		rc = hdmi_tx_sysfs_enable_hpd(hdmi_ctrl, false);
		if (hdmi_ctrl->panel_power_on) {
			hdmi_ctrl->hpd_off_pending = true;
			hdmi_tx_config_5v(hdmi_ctrl, false);
		} else {
			hdmi_tx_hpd_off(hdmi_ctrl);
		}

		break;
	case HPD_ON:
@@ -1244,7 +1268,7 @@ static ssize_t hdmi_tx_sysfs_wta_5v(struct device *dev,

	mutex_lock(&hdmi_ctrl->tx_lock);
	pd = &hdmi_ctrl->pdata.power_data[HDMI_TX_HPD_PM];
	if (!pd) {
	if (!pd || !pd->gpio_config) {
		DEV_ERR("%s: Error: invalid power data\n", __func__);
		ret = -EINVAL;
		goto end;
@@ -1258,8 +1282,9 @@ static ssize_t hdmi_tx_sysfs_wta_5v(struct device *dev,

	read = ~(!!read ^ pd->gpio_config->value) & BIT(0);

	DEV_DBG("%s: writing %d to 5v gpio\n", __func__, read);
	gpio_set_value(pd->gpio_config->gpio, read);
	ret = hdmi_tx_config_5v(hdmi_ctrl, read);
	if (ret)
		goto end;

	ret = strnlen(buf, PAGE_SIZE);
end: