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

Commit 76ee1b8d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "DRM: DBA: Adding hardware power sequence to DBA power off code"

parents 3b67a386 def1bee6
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -205,7 +205,8 @@ static void _dba_bridge_disable(struct drm_bridge *bridge)
	}

	if (d_bridge->ops.video_on) {
		rc = d_bridge->ops.video_on(d_bridge->dba_ctx, false, NULL, 0);
		rc = d_bridge->ops.video_on(d_bridge->dba_ctx,
				false, NULL, 0);
		if (rc)
			SDE_ERROR("video off failed ret=%d\n", rc);
	}
@@ -213,10 +214,19 @@ static void _dba_bridge_disable(struct drm_bridge *bridge)

static void _dba_bridge_post_disable(struct drm_bridge *bridge)
{
	int rc = 0;
	struct dba_bridge *d_bridge = to_dba_bridge(bridge);

	if (!bridge) {
		SDE_ERROR("Invalid params\n");
		return;
	}

	if (d_bridge->ops.power_on) {
		rc = d_bridge->ops.power_on(d_bridge->dba_ctx, false, 0);
		if (rc)
			SDE_ERROR("power off failed ret=%d\n", rc);
	}
}

static void _dba_bridge_mode_set(struct drm_bridge *bridge,
+62 −31
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -188,6 +188,17 @@ static struct adv7533_reg_cfg adv7533_video_en[] = {
	{I2C_ADDR_MAIN, 0x40, 0x80, 0},
};

static struct adv7533_reg_cfg adv7533_video_disable[] = {
	/* Timing Generator Disable */
	{I2C_ADDR_CEC_DSI, 0x27, 0x4B, 0},
	/* SPDIF disable */
	{I2C_ADDR_MAIN, 0x0B, 0x00, 0},
	/* Gate CEC Clock */
	{I2C_ADDR_CEC_DSI, 0x05, 0xF8, 0},
	/* power down */
	{I2C_ADDR_MAIN, 0x41, 0x50, 0},
};

static struct adv7533_reg_cfg adv7533_cec_en[] = {
	/* Fixed, clock gate disable */
	{I2C_ADDR_CEC_DSI, 0x05, 0xC8, 0},
@@ -1379,6 +1390,12 @@ static int adv7533_power_on(void *client, bool on, u32 flags)
	mutex_lock(&pdata->ops_mutex);

	if (on && !pdata->is_power_on) {
		if (gpio_is_valid(pdata->switch_gpio)) {
			gpio_set_value(pdata->switch_gpio,
				pdata->switch_flags);
			msleep(ADV7533_RESET_DELAY);
		}

		adv7533_write_array(pdata, adv7533_init_setup,
					sizeof(adv7533_init_setup));

@@ -1394,6 +1411,12 @@ static int adv7533_power_on(void *client, bool on, u32 flags)
		adv7533_write(pdata, I2C_ADDR_MAIN, 0x41, 0x50);
		pdata->is_power_on = false;

		if (gpio_is_valid(pdata->switch_gpio)) {
			gpio_set_value(pdata->switch_gpio,
				!pdata->switch_flags);
			msleep(ADV7533_RESET_DELAY);
		}
		ret = 0;
		adv7533_notify_clients(&pdata->dev_info,
			MSM_DBA_CB_HPD_DISCONNECT);
	}
@@ -1556,13 +1579,17 @@ static int adv7533_video_on(void *client, bool on,
	u8 reg_val = 0;
	struct adv7533 *pdata = adv7533_get_platform_data(client);

	if (!pdata || !cfg) {
	if (!pdata) {
		pr_err("%s: invalid platform data\n", __func__);
		return -EINVAL;
	} else if (on && !cfg) {
		pr_err("%s: invalid cfg data for power on\n", __func__);
		return -EINVAL;
	}

	mutex_lock(&pdata->ops_mutex);

	if (on) {
		/* DSI lane configuration */
		lanes = (cfg->num_of_input_lanes << 4);
		adv7533_write(pdata, I2C_ADDR_CEC_DSI, 0x1C, lanes);
@@ -1598,6 +1625,10 @@ static int adv7533_video_on(void *client, bool on,

		adv7533_write_array(pdata, adv7533_video_en,
					sizeof(adv7533_video_en));
	} else {
		adv7533_write_array(pdata, adv7533_video_disable,
				sizeof(adv7533_video_disable));
	}

	mutex_unlock(&pdata->ops_mutex);
	return ret;