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

Commit c6c2c9ab authored by Eliot Blennerhassett's avatar Eliot Blennerhassett Committed by Takashi Iwai
Browse files

ALSA: asihpi - Increase request and response buffer sizes



Allow for up to 256 bytes of extra data on top of standard hpi
request and response sizes.

Signed-off-by: default avatarEliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 82b5774f
Loading
Loading
Loading
Loading
+8 −7
Original line number Original line Diff line number Diff line
@@ -2085,13 +2085,13 @@ static u16 message_response_sequence(struct hpi_adapter_obj *pao,
	u16 err = 0;
	u16 err = 0;


	message_count++;
	message_count++;
	if (phm->size > sizeof(interface->u)) {
	if (phm->size > sizeof(interface->u.message_buffer)) {
		phr->error = HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL;
		phr->error = HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL;
		phr->specific_error = sizeof(interface->u);
		phr->specific_error = sizeof(interface->u.message_buffer);
		phr->size = sizeof(struct hpi_response_header);
		phr->size = sizeof(struct hpi_response_header);
		HPI_DEBUG_LOG(ERROR,
		HPI_DEBUG_LOG(ERROR,
			"message len %d too big for buffer %zd \n", phm->size,
			"message len %d too big for buffer %zd \n", phm->size,
			sizeof(interface->u));
			sizeof(interface->u.message_buffer));
		return 0;
		return 0;
	}
	}


@@ -2123,18 +2123,19 @@ static u16 message_response_sequence(struct hpi_adapter_obj *pao,


	/* read the result */
	/* read the result */
	if (time_out) {
	if (time_out) {
		if (interface->u.response_buffer.size <= phr->size)
		if (interface->u.response_buffer.response.size <= phr->size)
			memcpy(phr, &interface->u.response_buffer,
			memcpy(phr, &interface->u.response_buffer,
				interface->u.response_buffer.size);
				interface->u.response_buffer.response.size);
		else {
		else {
			HPI_DEBUG_LOG(ERROR,
			HPI_DEBUG_LOG(ERROR,
				"response len %d too big for buffer %d\n",
				"response len %d too big for buffer %d\n",
				interface->u.response_buffer.size, phr->size);
				interface->u.response_buffer.response.size,
				phr->size);
			memcpy(phr, &interface->u.response_buffer,
			memcpy(phr, &interface->u.response_buffer,
				sizeof(struct hpi_response_header));
				sizeof(struct hpi_response_header));
			phr->error = HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL;
			phr->error = HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL;
			phr->specific_error =
			phr->specific_error =
				interface->u.response_buffer.size;
				interface->u.response_buffer.response.size;
			phr->size = sizeof(struct hpi_response_header);
			phr->size = sizeof(struct hpi_response_header);
		}
		}
	}
	}
+19 −6
Original line number Original line Diff line number Diff line
/*****************************************************************************
/*****************************************************************************


    AudioScience HPI driver
    AudioScience HPI driver
    Copyright (C) 1997-2010  AudioScience Inc. <support@audioscience.com>
    Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>


    This program is free software; you can redistribute it and/or modify
    This program is free software; you can redistribute it and/or modify
    it under the terms of version 2 of the GNU General Public License as
    it under the terms of version 2 of the GNU General Public License as
@@ -70,15 +70,28 @@ The Host located memory buffer that the 6205 will bus master
in and out of.
in and out of.
************************************************************/
************************************************************/
#define HPI6205_SIZEOF_DATA (16*1024)
#define HPI6205_SIZEOF_DATA (16*1024)

struct message_buffer_6205 {
	struct hpi_message message;
	char data[256];
};

struct response_buffer_6205 {
	struct hpi_response response;
	char data[256];
};

union buffer_6205 {
	struct message_buffer_6205 message_buffer;
	struct response_buffer_6205 response_buffer;
	u8 b_data[HPI6205_SIZEOF_DATA];
};

struct bus_master_interface {
struct bus_master_interface {
	u32 host_cmd;
	u32 host_cmd;
	u32 dsp_ack;
	u32 dsp_ack;
	u32 transfer_size_in_bytes;
	u32 transfer_size_in_bytes;
	union {
	union buffer_6205 u;
		struct hpi_message_header message_buffer;
		struct hpi_response_header response_buffer;
		u8 b_data[HPI6205_SIZEOF_DATA];
	} u;
	struct controlcache_6205 control_cache;
	struct controlcache_6205 control_cache;
	struct async_event_buffer_6205 async_buffer;
	struct async_event_buffer_6205 async_buffer;
	struct hpi_hostbuffer_status
	struct hpi_hostbuffer_status
+7 −6
Original line number Original line Diff line number Diff line
@@ -315,8 +315,7 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
	short found = 1;
	short found = 1;
	struct hpi_control_cache_info *pI;
	struct hpi_control_cache_info *pI;
	struct hpi_control_cache_single *pC;
	struct hpi_control_cache_single *pC;
	struct hpi_control_cache_pad *p_pad;
	u16 response_size;

	if (!find_control(phm->obj_index, p_cache, &pI)) {
	if (!find_control(phm->obj_index, p_cache, &pI)) {
		HPI_DEBUG_LOG(VERBOSE,
		HPI_DEBUG_LOG(VERBOSE,
			"HPICMN find_control() failed for adap %d\n",
			"HPICMN find_control() failed for adap %d\n",
@@ -326,11 +325,15 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,


	phr->error = 0;
	phr->error = 0;


	/* set the default response size */
	response_size =
		sizeof(struct hpi_response_header) +
		sizeof(struct hpi_control_res);

	/* pC is the default cached control strucure. May be cast to
	/* pC is the default cached control strucure. May be cast to
	   something else in the following switch statement.
	   something else in the following switch statement.
	 */
	 */
	pC = (struct hpi_control_cache_single *)pI;
	pC = (struct hpi_control_cache_single *)pI;
	p_pad = (struct hpi_control_cache_pad *)pI;


	switch (pI->control_type) {
	switch (pI->control_type) {


@@ -529,9 +532,7 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
		pI->control_index, pI->control_type, phm->u.c.attribute);
		pI->control_index, pI->control_type, phm->u.c.attribute);


	if (found)
	if (found)
		phr->size =
		phr->size = response_size;
			sizeof(struct hpi_response_header) +
			sizeof(struct hpi_control_res);


	return found;
	return found;
}
}