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

Commit 8d16a3e9 authored by Sandeep Panda's avatar Sandeep Panda Committed by Gerrit - the friendly Code Review server
Browse files

msm: adv7533: add support for clients to read audio block



Add support to read audio and speaker block from sink EDID
data, so that clients like audio driver who are registered
to adv chip can get the audio data and parse it accordingly.

Change-Id: Ia603044069fb4ae651a4df6faaa4ca61e6377276
Signed-off-by: default avatarSandeep Panda <spanda@codeaurora.org>
parent ee833ce5
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -300,6 +300,7 @@ static void mdss_dba_utils_dba_cb(void *data, enum msm_dba_callback_event event)
	bool operands_present = false;
	u32 no_of_operands, size, i;
	u32 operands_offset = MAX_CEC_FRAME_SIZE - MAX_OPERAND_SIZE;
	struct msm_hdmi_audio_edid_blk blk;

	if (!udata) {
		pr_err("Invalid data\n");
@@ -319,11 +320,15 @@ static void mdss_dba_utils_dba_cb(void *data, enum msm_dba_callback_event event)
			ret = udata->ops.get_raw_edid(udata->dba_data,
				udata->edid_buf_size, udata->edid_buf, 0);

			if (!ret)
			if (!ret) {
				hdmi_edid_parser(udata->edid_data);
			else
				hdmi_edid_get_audio_blk(udata->edid_data, &blk);
				udata->ops.set_audio_block(udata->dba_data,
							sizeof(blk), &blk);
			} else {
				pr_err("failed to get edid%d\n", ret);
			}
		}

		if (pluggable) {
			mdss_dba_utils_send_display_notification(udata, 1);
+43 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@

#define MDSS_MAX_PANEL_LEN      256
#define EDID_SEG_SIZE 0x100
/* size of audio and speaker info Block */
#define AUDIO_DATA_SIZE 32

/* 0x94 interrupts */
#define HPD_INT_ENABLE           BIT(7)
@@ -129,6 +131,7 @@ struct adv7533 {
	bool is_power_on;
	void *edid_data;
	u8 edid_buf[EDID_SEG_SIZE];
	u8 audio_spkr_data[AUDIO_DATA_SIZE];
	struct workqueue_struct *workq;
	struct delayed_work adv7533_intr_work_id;
	struct msm_dba_device_info dev_info;
@@ -1274,6 +1277,44 @@ static int adv7533_cec_enable(void *client, bool cec_on, u32 flags)
end:
	return ret;
}
static void adv7533_set_audio_block(void *client, u32 size, void *buf)
{
	struct adv7533 *pdata =
		adv7533_get_platform_data(client);

	if (!pdata || !buf) {
		pr_err("%s: invalid data\n", __func__);
		return;
	}

	mutex_lock(&pdata->ops_mutex);

	size = min_t(u32, size, AUDIO_DATA_SIZE);

	memset(pdata->audio_spkr_data, 0, AUDIO_DATA_SIZE);
	memcpy(pdata->audio_spkr_data, buf, size);

	mutex_unlock(&pdata->ops_mutex);
}

static void adv7533_get_audio_block(void *client, u32 size, void *buf)
{
	struct adv7533 *pdata =
		adv7533_get_platform_data(client);

	if (!pdata || !buf) {
		pr_err("%s: invalid data\n", __func__);
		return;
	}

	mutex_lock(&pdata->ops_mutex);

	size = min_t(u32, size, AUDIO_DATA_SIZE);

	memcpy(buf, pdata->audio_spkr_data, size);

	mutex_unlock(&pdata->ops_mutex);
}

static int adv7533_check_hpd(void *client, u32 flags)
{
@@ -1880,6 +1921,8 @@ static int adv7533_register_dba(struct adv7533 *pdata)
	client_ops->get_edid_size   = adv7533_get_edid_size;
	client_ops->get_raw_edid    = adv7533_get_raw_edid;
	client_ops->check_hpd	    = adv7533_check_hpd;
	client_ops->get_audio_block = adv7533_get_audio_block;
	client_ops->set_audio_block = adv7533_set_audio_block;

	dev_ops->write_reg = adv7533_write_reg;
	dev_ops->read_reg = adv7533_read_reg;
+6 −0
Original line number Diff line number Diff line
@@ -466,6 +466,10 @@ struct msm_dba_video_cfg {
 * @dump_debug_info: dumps debug information to dmesg.
 * @check_hpd: Check if cable is connected or not. if cable is connected we
 *		send notification to display framework.
 * @set_audio_block: This function will populate the raw audio speaker block
 *		     data along with size of each block in bridgechip buffer.
 * @get_audio_block: This function will return the raw audio speaker block
 *		     along with size of each block.
 *
 * The msm_dba_ops structure represents a set of operations that can be
 * supported by each bridge chip. Depending on the functionality supported by a
@@ -564,6 +568,8 @@ struct msm_dba_ops {
	int (*force_reset)(void *client, u32 flags);
	int (*dump_debug_info)(void *client, u32 flags);
	int (*check_hpd)(void *client, u32 flags);
	void (*set_audio_block)(void *client, u32 size, void *buf);
	void (*get_audio_block)(void *client, u32 size, void *buf);
};

/**