Commit 58fbf77f authored by Eliot Blennerhassett's avatar Eliot Blennerhassett Committed by Takashi Iwai

ALSA: asihpi - Remove controlex structs and associated special data transfer code

Some cobranet control data would not fit in an original HPI message.
Now that HPI is able to transfer larger messages, this special handling
is no longer required.
Signed-off-by: default avatarEliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c6c2c9ab
...@@ -402,7 +402,6 @@ void _HPI_6205(struct hpi_adapter_obj *pao, struct hpi_message *phm, ...@@ -402,7 +402,6 @@ void _HPI_6205(struct hpi_adapter_obj *pao, struct hpi_message *phm,
adapter_message(pao, phm, phr); adapter_message(pao, phm, phr);
break; break;
case HPI_OBJ_CONTROLEX:
case HPI_OBJ_CONTROL: case HPI_OBJ_CONTROL:
control_message(pao, phm, phr); control_message(pao, phm, phr);
break; break;
...@@ -2204,23 +2203,6 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm, ...@@ -2204,23 +2203,6 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm,
phm->u.d.u.data.data_size, H620_HIF_GET_DATA); phm->u.d.u.data.data_size, H620_HIF_GET_DATA);
break; break;
case HPI_CONTROL_SET_STATE:
if (phm->object == HPI_OBJ_CONTROLEX
&& phm->u.cx.attribute == HPI_COBRANET_SET_DATA)
err = hpi6205_transfer_data(pao,
phm->u.cx.u.cobranet_bigdata.pb_data,
phm->u.cx.u.cobranet_bigdata.byte_count,
H620_HIF_SEND_DATA);
break;
case HPI_CONTROL_GET_STATE:
if (phm->object == HPI_OBJ_CONTROLEX
&& phm->u.cx.attribute == HPI_COBRANET_GET_DATA)
err = hpi6205_transfer_data(pao,
phm->u.cx.u.cobranet_bigdata.pb_data,
phr->u.cx.u.cobranet_data.byte_count,
H620_HIF_GET_DATA);
break;
} }
phr->error = err; phr->error = err;
......
...@@ -226,8 +226,8 @@ enum HPI_CONTROL_ATTRIBUTES { ...@@ -226,8 +226,8 @@ enum HPI_CONTROL_ATTRIBUTES {
HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1), HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1),
HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2), HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2),
HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), /*HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), */
HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), /*HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), */
HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5), HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5),
HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6), HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6),
HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7), HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7),
...@@ -383,7 +383,7 @@ enum HPI_OBJECT_TYPES { ...@@ -383,7 +383,7 @@ enum HPI_OBJECT_TYPES {
HPI_OBJ_WATCHDOG = 10, HPI_OBJ_WATCHDOG = 10,
HPI_OBJ_CLOCK = 11, HPI_OBJ_CLOCK = 11,
HPI_OBJ_PROFILE = 12, HPI_OBJ_PROFILE = 12,
HPI_OBJ_CONTROLEX = 13, /* HPI_ OBJ_ CONTROLEX = 13, */
HPI_OBJ_ASYNCEVENT = 14 HPI_OBJ_ASYNCEVENT = 14
#define HPI_OBJ_MAXINDEX 14 #define HPI_OBJ_MAXINDEX 14
}; };
...@@ -912,95 +912,13 @@ union hpi_control_union_res { ...@@ -912,95 +912,13 @@ union hpi_control_union_res {
u32 remaining_chars; u32 remaining_chars;
} chars8; } chars8;
char c_data12[12]; char c_data12[12];
};
/* HPI_CONTROLX_STRUCTURES */
/* Message */
/** Used for all HMI variables where max length <= 8 bytes
*/
struct hpi_controlx_msg_cobranet_data {
u32 hmi_address;
u32 byte_count;
u32 data[2];
};
/** Used for string data, and for packet bridge
*/
struct hpi_controlx_msg_cobranet_bigdata {
u32 hmi_address;
u32 byte_count;
u8 *pb_data;
#ifndef HPI64BIT
u32 padding;
#endif
};
/** Used for PADS control reading of string fields.
*/
struct hpi_controlx_msg_pad_data {
u32 field;
u32 byte_count;
u8 *pb_data;
#ifndef HPI64BIT
u32 padding;
#endif
};
/** Used for generic data
*/
struct hpi_controlx_msg_generic {
u32 param1;
u32 param2;
};
struct hpi_controlx_msg {
u16 attribute; /* control attribute or property */
u16 saved_index;
union { union {
struct hpi_controlx_msg_cobranet_data cobranet_data; struct {
struct hpi_controlx_msg_cobranet_bigdata cobranet_bigdata;
struct hpi_controlx_msg_generic generic;
struct hpi_controlx_msg_pad_data pad_data;
/*struct param_value universal_value; */
/* nothing extra to send for status read */
} u;
};
/* Response */
/**
*/
struct hpi_controlx_res_cobranet_data {
u32 byte_count;
u32 data[2];
};
struct hpi_controlx_res_cobranet_bigdata {
u32 byte_count;
};
struct hpi_controlx_res_cobranet_status {
u32 status; u32 status;
u32 readable_size; u32 readable_size;
u32 writeable_size; u32 writeable_size;
}; } status;
} cobranet;
struct hpi_controlx_res_generic {
u32 param1;
u32 param2;
};
struct hpi_controlx_res {
union {
struct hpi_controlx_res_cobranet_bigdata cobranet_bigdata;
struct hpi_controlx_res_cobranet_data cobranet_data;
struct hpi_controlx_res_cobranet_status cobranet_status;
struct hpi_controlx_res_generic generic;
/*struct param_info universal_info; */
/*struct param_value universal_value; */
} u;
}; };
struct hpi_nvmemory_msg { struct hpi_nvmemory_msg {
...@@ -1126,7 +1044,6 @@ struct hpi_message { ...@@ -1126,7 +1044,6 @@ struct hpi_message {
/* identical to struct hpi_control_msg, /* identical to struct hpi_control_msg,
but field naming is improved */ but field naming is improved */
struct hpi_control_union_msg cu; struct hpi_control_union_msg cu;
struct hpi_controlx_msg cx; /* extended mixer control; */
struct hpi_nvmemory_msg n; struct hpi_nvmemory_msg n;
struct hpi_gpio_msg l; /* digital i/o */ struct hpi_gpio_msg l; /* digital i/o */
struct hpi_watchdog_msg w; struct hpi_watchdog_msg w;
...@@ -1151,7 +1068,7 @@ struct hpi_message { ...@@ -1151,7 +1068,7 @@ struct hpi_message {
sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\ sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\ sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\ sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
sizeof(struct hpi_message_header) + sizeof(struct hpi_controlx_msg),\ sizeof(struct hpi_message_header), /* controlx obj removed */ \
sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \ sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
} }
...@@ -1188,7 +1105,6 @@ struct hpi_response { ...@@ -1188,7 +1105,6 @@ struct hpi_response {
struct hpi_control_res c; /* mixer control; */ struct hpi_control_res c; /* mixer control; */
/* identical to hpi_control_res, but field naming is improved */ /* identical to hpi_control_res, but field naming is improved */
union hpi_control_union_res cu; union hpi_control_union_res cu;
struct hpi_controlx_res cx; /* extended mixer control; */
struct hpi_nvmemory_res n; struct hpi_nvmemory_res n;
struct hpi_gpio_res l; /* digital i/o */ struct hpi_gpio_res l; /* digital i/o */
struct hpi_watchdog_res w; struct hpi_watchdog_res w;
...@@ -1213,7 +1129,7 @@ struct hpi_response { ...@@ -1213,7 +1129,7 @@ struct hpi_response {
sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\ sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\ sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\ sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
sizeof(struct hpi_response_header) + sizeof(struct hpi_controlx_res),\ sizeof(struct hpi_response_header), /* controlx obj removed */ \
sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \ sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
} }
...@@ -1308,6 +1224,30 @@ struct hpi_res_adapter_debug_read { ...@@ -1308,6 +1224,30 @@ struct hpi_res_adapter_debug_read {
u8 bytes[256]; u8 bytes[256];
}; };
struct hpi_msg_cobranet_hmi {
u16 attribute;
u16 padding;
u32 hmi_address;
u32 byte_count;
};
struct hpi_msg_cobranet_hmiwrite {
struct hpi_message_header h;
struct hpi_msg_cobranet_hmi p;
u8 bytes[256];
};
struct hpi_msg_cobranet_hmiread {
struct hpi_message_header h;
struct hpi_msg_cobranet_hmi p;
};
struct hpi_res_cobranet_hmiread {
struct hpi_response_header h;
u32 byte_count;
u8 bytes[256];
};
#if 1 #if 1
#define hpi_message_header_v1 hpi_message_header #define hpi_message_header_v1 hpi_message_header
#define hpi_response_header_v1 hpi_response_header #define hpi_response_header_v1 hpi_response_header
...@@ -1338,7 +1278,6 @@ struct hpi_msg_payload_v0 { ...@@ -1338,7 +1278,6 @@ struct hpi_msg_payload_v0 {
union hpi_mixerx_msg mx; union hpi_mixerx_msg mx;
struct hpi_control_msg c; struct hpi_control_msg c;
struct hpi_control_union_msg cu; struct hpi_control_union_msg cu;
struct hpi_controlx_msg cx;
struct hpi_nvmemory_msg n; struct hpi_nvmemory_msg n;
struct hpi_gpio_msg l; struct hpi_gpio_msg l;
struct hpi_watchdog_msg w; struct hpi_watchdog_msg w;
...@@ -1358,7 +1297,6 @@ struct hpi_res_payload_v0 { ...@@ -1358,7 +1297,6 @@ struct hpi_res_payload_v0 {
union hpi_mixerx_res mx; union hpi_mixerx_res mx;
struct hpi_control_res c; struct hpi_control_res c;
union hpi_control_union_res cu; union hpi_control_union_res cu;
struct hpi_controlx_res cx;
struct hpi_nvmemory_res n; struct hpi_nvmemory_res n;
struct hpi_gpio_res l; struct hpi_gpio_res l;
struct hpi_watchdog_res w; struct hpi_watchdog_res w;
......
...@@ -1663,68 +1663,64 @@ u16 hpi_channel_mode_get(u32 h_control, u16 *mode) ...@@ -1663,68 +1663,64 @@ u16 hpi_channel_mode_get(u32 h_control, u16 *mode)
u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count, u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count,
u8 *pb_data) u8 *pb_data)
{ {
struct hpi_message hm; struct hpi_msg_cobranet_hmiwrite hm;
struct hpi_response hr; struct hpi_response_header hr;
hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, hpi_init_message_responseV1(&hm.h, sizeof(hm), &hr, sizeof(hr),
HPI_CONTROL_SET_STATE); HPI_OBJ_CONTROL, HPI_CONTROL_SET_STATE);
if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
return HPI_ERROR_INVALID_HANDLE;
hm.u.cx.u.cobranet_data.byte_count = byte_count; if (hpi_handle_indexes(h_control, &hm.h.adapter_index,
hm.u.cx.u.cobranet_data.hmi_address = hmi_address; &hm.h.obj_index))
return HPI_ERROR_INVALID_HANDLE;
if (byte_count <= 8) { if (byte_count > sizeof(hm.bytes))
memcpy(hm.u.cx.u.cobranet_data.data, pb_data, byte_count); return HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL;
hm.u.cx.attribute = HPI_COBRANET_SET;
} else {
hm.u.cx.u.cobranet_bigdata.pb_data = pb_data;
hm.u.cx.attribute = HPI_COBRANET_SET_DATA;
}
hpi_send_recv(&hm, &hr); hm.p.attribute = HPI_COBRANET_SET;
hm.p.byte_count = byte_count;
hm.p.hmi_address = hmi_address;
memcpy(hm.bytes, pb_data, byte_count);
hm.h.size = (u16)(sizeof(hm.h) + sizeof(hm.p) + byte_count);
hpi_send_recvV1(&hm.h, &hr);
return hr.error; return hr.error;
} }
u16 hpi_cobranet_hmi_read(u32 h_control, u32 hmi_address, u32 max_byte_count, u16 hpi_cobranet_hmi_read(u32 h_control, u32 hmi_address, u32 max_byte_count,
u32 *pbyte_count, u8 *pb_data) u32 *pbyte_count, u8 *pb_data)
{ {
struct hpi_message hm; struct hpi_msg_cobranet_hmiread hm;
struct hpi_response hr; struct hpi_res_cobranet_hmiread hr;
hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, hpi_init_message_responseV1(&hm.h, sizeof(hm), &hr.h, sizeof(hr),
HPI_CONTROL_GET_STATE); HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE);
if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
if (hpi_handle_indexes(h_control, &hm.h.adapter_index,
&hm.h.obj_index))
return HPI_ERROR_INVALID_HANDLE; return HPI_ERROR_INVALID_HANDLE;
hm.u.cx.u.cobranet_data.byte_count = max_byte_count; if (max_byte_count > sizeof(hr.bytes))
hm.u.cx.u.cobranet_data.hmi_address = hmi_address; return HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL;
if (max_byte_count <= 8) { hm.p.attribute = HPI_COBRANET_GET;
hm.u.cx.attribute = HPI_COBRANET_GET; hm.p.byte_count = max_byte_count;
} else { hm.p.hmi_address = hmi_address;
hm.u.cx.u.cobranet_bigdata.pb_data = pb_data;
hm.u.cx.attribute = HPI_COBRANET_GET_DATA;
}
hpi_send_recv(&hm, &hr); hpi_send_recvV1(&hm.h, &hr.h);
if (!hr.error && pb_data) {
*pbyte_count = hr.u.cx.u.cobranet_data.byte_count; if (!hr.h.error && pb_data) {
if (hr.byte_count > sizeof(hr.bytes))
if (*pbyte_count < max_byte_count) return HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL;
max_byte_count = *pbyte_count;
if (hm.u.cx.attribute == HPI_COBRANET_GET) { *pbyte_count = hr.byte_count;
memcpy(pb_data, hr.u.cx.u.cobranet_data.data,
max_byte_count);
} else {
} if (hr.byte_count < max_byte_count)
max_byte_count = *pbyte_count;
memcpy(pb_data, hr.bytes, max_byte_count);
} }
return hr.error; return hr.h.error;
} }
u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus, u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus,
...@@ -1733,23 +1729,23 @@ u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus, ...@@ -1733,23 +1729,23 @@ u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus,
struct hpi_message hm; struct hpi_message hm;
struct hpi_response hr; struct hpi_response hr;
hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
HPI_CONTROL_GET_STATE); HPI_CONTROL_GET_STATE);
if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
return HPI_ERROR_INVALID_HANDLE; return HPI_ERROR_INVALID_HANDLE;
hm.u.cx.attribute = HPI_COBRANET_GET_STATUS; hm.u.c.attribute = HPI_COBRANET_GET_STATUS;
hpi_send_recv(&hm, &hr); hpi_send_recv(&hm, &hr);
if (!hr.error) { if (!hr.error) {
if (pstatus) if (pstatus)
*pstatus = hr.u.cx.u.cobranet_status.status; *pstatus = hr.u.cu.cobranet.status.status;
if (preadable_size) if (preadable_size)
*preadable_size = *preadable_size =
hr.u.cx.u.cobranet_status.readable_size; hr.u.cu.cobranet.status.readable_size;
if (pwriteable_size) if (pwriteable_size)
*pwriteable_size = *pwriteable_size =
hr.u.cx.u.cobranet_status.writeable_size; hr.u.cu.cobranet.status.writeable_size;
} }
return hr.error; return hr.error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment