aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEliot Blennerhassett <eblennerhassett@audioscience.com>2011-07-21 23:52:40 -0400
committerTakashi Iwai <tiwai@suse.de>2011-07-22 01:46:14 -0400
commit58fbf77ff5d258a15a4084940e08219d7ee6f449 (patch)
tree4de219a74548d6bee8971b734a1a4f4f352fd20b
parentc6c2c9aba16c41a8f72bec0738880447d158bdf7 (diff)
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: Eliot Blennerhassett <eblennerhassett@audioscience.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/asihpi/hpi6205.c18
-rw-r--r--sound/pci/asihpi/hpi_internal.h132
-rw-r--r--sound/pci/asihpi/hpifunc.c86
3 files changed, 76 insertions, 160 deletions
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
index 8831a6f179e3..d011932c952f 100644
--- a/sound/pci/asihpi/hpi6205.c
+++ b/sound/pci/asihpi/hpi6205.c
@@ -402,7 +402,6 @@ void _HPI_6205(struct hpi_adapter_obj *pao, struct hpi_message *phm,
402 adapter_message(pao, phm, phr); 402 adapter_message(pao, phm, phr);
403 break; 403 break;
404 404
405 case HPI_OBJ_CONTROLEX:
406 case HPI_OBJ_CONTROL: 405 case HPI_OBJ_CONTROL:
407 control_message(pao, phm, phr); 406 control_message(pao, phm, phr);
408 break; 407 break;
@@ -2204,23 +2203,6 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm,
2204 phm->u.d.u.data.data_size, H620_HIF_GET_DATA); 2203 phm->u.d.u.data.data_size, H620_HIF_GET_DATA);
2205 break; 2204 break;
2206 2205
2207 case HPI_CONTROL_SET_STATE:
2208 if (phm->object == HPI_OBJ_CONTROLEX
2209 && phm->u.cx.attribute == HPI_COBRANET_SET_DATA)
2210 err = hpi6205_transfer_data(pao,
2211 phm->u.cx.u.cobranet_bigdata.pb_data,
2212 phm->u.cx.u.cobranet_bigdata.byte_count,
2213 H620_HIF_SEND_DATA);
2214 break;
2215
2216 case HPI_CONTROL_GET_STATE:
2217 if (phm->object == HPI_OBJ_CONTROLEX
2218 && phm->u.cx.attribute == HPI_COBRANET_GET_DATA)
2219 err = hpi6205_transfer_data(pao,
2220 phm->u.cx.u.cobranet_bigdata.pb_data,
2221 phr->u.cx.u.cobranet_data.byte_count,
2222 H620_HIF_GET_DATA);
2223 break;
2224 } 2206 }
2225 phr->error = err; 2207 phr->error = err;
2226 2208
diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
index ce5d7cda6dad..848fb7596ae4 100644
--- a/sound/pci/asihpi/hpi_internal.h
+++ b/sound/pci/asihpi/hpi_internal.h
@@ -226,8 +226,8 @@ enum HPI_CONTROL_ATTRIBUTES {
226 226
227 HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1), 227 HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1),
228 HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2), 228 HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2),
229 HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), 229 /*HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), */
230 HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), 230 /*HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), */
231 HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5), 231 HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5),
232 HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6), 232 HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6),
233 HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7), 233 HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7),
@@ -383,7 +383,7 @@ enum HPI_OBJECT_TYPES {
383 HPI_OBJ_WATCHDOG = 10, 383 HPI_OBJ_WATCHDOG = 10,
384 HPI_OBJ_CLOCK = 11, 384 HPI_OBJ_CLOCK = 11,
385 HPI_OBJ_PROFILE = 12, 385 HPI_OBJ_PROFILE = 12,
386 HPI_OBJ_CONTROLEX = 13, 386 /* HPI_ OBJ_ CONTROLEX = 13, */
387 HPI_OBJ_ASYNCEVENT = 14 387 HPI_OBJ_ASYNCEVENT = 14
388#define HPI_OBJ_MAXINDEX 14 388#define HPI_OBJ_MAXINDEX 14
389}; 389};
@@ -912,95 +912,13 @@ union hpi_control_union_res {
912 u32 remaining_chars; 912 u32 remaining_chars;
913 } chars8; 913 } chars8;
914 char c_data12[12]; 914 char c_data12[12];
915};
916
917/* HPI_CONTROLX_STRUCTURES */
918
919/* Message */
920
921/** Used for all HMI variables where max length <= 8 bytes
922*/
923struct hpi_controlx_msg_cobranet_data {
924 u32 hmi_address;
925 u32 byte_count;
926 u32 data[2];
927};
928
929/** Used for string data, and for packet bridge
930*/
931struct hpi_controlx_msg_cobranet_bigdata {
932 u32 hmi_address;
933 u32 byte_count;
934 u8 *pb_data;
935#ifndef HPI64BIT
936 u32 padding;
937#endif
938};
939
940/** Used for PADS control reading of string fields.
941*/
942struct hpi_controlx_msg_pad_data {
943 u32 field;
944 u32 byte_count;
945 u8 *pb_data;
946#ifndef HPI64BIT
947 u32 padding;
948#endif
949};
950
951/** Used for generic data
952*/
953
954struct hpi_controlx_msg_generic {
955 u32 param1;
956 u32 param2;
957};
958
959struct hpi_controlx_msg {
960 u16 attribute; /* control attribute or property */
961 u16 saved_index;
962 union { 915 union {
963 struct hpi_controlx_msg_cobranet_data cobranet_data; 916 struct {
964 struct hpi_controlx_msg_cobranet_bigdata cobranet_bigdata; 917 u32 status;
965 struct hpi_controlx_msg_generic generic; 918 u32 readable_size;
966 struct hpi_controlx_msg_pad_data pad_data; 919 u32 writeable_size;
967 /*struct param_value universal_value; */ 920 } status;
968 /* nothing extra to send for status read */ 921 } cobranet;
969 } u;
970};
971
972/* Response */
973/**
974*/
975struct hpi_controlx_res_cobranet_data {
976 u32 byte_count;
977 u32 data[2];
978};
979
980struct hpi_controlx_res_cobranet_bigdata {
981 u32 byte_count;
982};
983
984struct hpi_controlx_res_cobranet_status {
985 u32 status;
986 u32 readable_size;
987 u32 writeable_size;
988};
989
990struct hpi_controlx_res_generic {
991 u32 param1;
992 u32 param2;
993};
994
995struct hpi_controlx_res {
996 union {
997 struct hpi_controlx_res_cobranet_bigdata cobranet_bigdata;
998 struct hpi_controlx_res_cobranet_data cobranet_data;
999 struct hpi_controlx_res_cobranet_status cobranet_status;
1000 struct hpi_controlx_res_generic generic;
1001 /*struct param_info universal_info; */
1002 /*struct param_value universal_value; */
1003 } u;
1004}; 922};
1005 923
1006struct hpi_nvmemory_msg { 924struct hpi_nvmemory_msg {
@@ -1126,7 +1044,6 @@ struct hpi_message {
1126 /* identical to struct hpi_control_msg, 1044 /* identical to struct hpi_control_msg,
1127 but field naming is improved */ 1045 but field naming is improved */
1128 struct hpi_control_union_msg cu; 1046 struct hpi_control_union_msg cu;
1129 struct hpi_controlx_msg cx; /* extended mixer control; */
1130 struct hpi_nvmemory_msg n; 1047 struct hpi_nvmemory_msg n;
1131 struct hpi_gpio_msg l; /* digital i/o */ 1048 struct hpi_gpio_msg l; /* digital i/o */
1132 struct hpi_watchdog_msg w; 1049 struct hpi_watchdog_msg w;
@@ -1151,7 +1068,7 @@ struct hpi_message {
1151 sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\ 1068 sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
1152 sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\ 1069 sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
1153 sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\ 1070 sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
1154 sizeof(struct hpi_message_header) + sizeof(struct hpi_controlx_msg),\ 1071 sizeof(struct hpi_message_header), /* controlx obj removed */ \
1155 sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \ 1072 sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
1156} 1073}
1157 1074
@@ -1188,7 +1105,6 @@ struct hpi_response {
1188 struct hpi_control_res c; /* mixer control; */ 1105 struct hpi_control_res c; /* mixer control; */
1189 /* identical to hpi_control_res, but field naming is improved */ 1106 /* identical to hpi_control_res, but field naming is improved */
1190 union hpi_control_union_res cu; 1107 union hpi_control_union_res cu;
1191 struct hpi_controlx_res cx; /* extended mixer control; */
1192 struct hpi_nvmemory_res n; 1108 struct hpi_nvmemory_res n;
1193 struct hpi_gpio_res l; /* digital i/o */ 1109 struct hpi_gpio_res l; /* digital i/o */
1194 struct hpi_watchdog_res w; 1110 struct hpi_watchdog_res w;
@@ -1213,7 +1129,7 @@ struct hpi_response {
1213 sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\ 1129 sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
1214 sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\ 1130 sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
1215 sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\ 1131 sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
1216 sizeof(struct hpi_response_header) + sizeof(struct hpi_controlx_res),\ 1132 sizeof(struct hpi_response_header), /* controlx obj removed */ \
1217 sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \ 1133 sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
1218} 1134}
1219 1135
@@ -1308,6 +1224,30 @@ struct hpi_res_adapter_debug_read {
1308 u8 bytes[256]; 1224 u8 bytes[256];
1309}; 1225};
1310 1226
1227struct hpi_msg_cobranet_hmi {
1228 u16 attribute;
1229 u16 padding;
1230 u32 hmi_address;
1231 u32 byte_count;
1232};
1233
1234struct hpi_msg_cobranet_hmiwrite {
1235 struct hpi_message_header h;
1236 struct hpi_msg_cobranet_hmi p;
1237 u8 bytes[256];
1238};
1239
1240struct hpi_msg_cobranet_hmiread {
1241 struct hpi_message_header h;
1242 struct hpi_msg_cobranet_hmi p;
1243};
1244
1245struct hpi_res_cobranet_hmiread {
1246 struct hpi_response_header h;
1247 u32 byte_count;
1248 u8 bytes[256];
1249};
1250
1311#if 1 1251#if 1
1312#define hpi_message_header_v1 hpi_message_header 1252#define hpi_message_header_v1 hpi_message_header
1313#define hpi_response_header_v1 hpi_response_header 1253#define hpi_response_header_v1 hpi_response_header
@@ -1338,7 +1278,6 @@ struct hpi_msg_payload_v0 {
1338 union hpi_mixerx_msg mx; 1278 union hpi_mixerx_msg mx;
1339 struct hpi_control_msg c; 1279 struct hpi_control_msg c;
1340 struct hpi_control_union_msg cu; 1280 struct hpi_control_union_msg cu;
1341 struct hpi_controlx_msg cx;
1342 struct hpi_nvmemory_msg n; 1281 struct hpi_nvmemory_msg n;
1343 struct hpi_gpio_msg l; 1282 struct hpi_gpio_msg l;
1344 struct hpi_watchdog_msg w; 1283 struct hpi_watchdog_msg w;
@@ -1358,7 +1297,6 @@ struct hpi_res_payload_v0 {
1358 union hpi_mixerx_res mx; 1297 union hpi_mixerx_res mx;
1359 struct hpi_control_res c; 1298 struct hpi_control_res c;
1360 union hpi_control_union_res cu; 1299 union hpi_control_union_res cu;
1361 struct hpi_controlx_res cx;
1362 struct hpi_nvmemory_res n; 1300 struct hpi_nvmemory_res n;
1363 struct hpi_gpio_res l; 1301 struct hpi_gpio_res l;
1364 struct hpi_watchdog_res w; 1302 struct hpi_watchdog_res w;
diff --git a/sound/pci/asihpi/hpifunc.c b/sound/pci/asihpi/hpifunc.c
index 7397b169b89f..ebb568d695f1 100644
--- a/sound/pci/asihpi/hpifunc.c
+++ b/sound/pci/asihpi/hpifunc.c
@@ -1663,68 +1663,64 @@ u16 hpi_channel_mode_get(u32 h_control, u16 *mode)
1663u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count, 1663u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count,
1664 u8 *pb_data) 1664 u8 *pb_data)
1665{ 1665{
1666 struct hpi_message hm; 1666 struct hpi_msg_cobranet_hmiwrite hm;
1667 struct hpi_response hr; 1667 struct hpi_response_header hr;
1668 1668
1669 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, 1669 hpi_init_message_responseV1(&hm.h, sizeof(hm), &hr, sizeof(hr),
1670 HPI_CONTROL_SET_STATE); 1670 HPI_OBJ_CONTROL, HPI_CONTROL_SET_STATE);
1671 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1672 return HPI_ERROR_INVALID_HANDLE;
1673 1671
1674 hm.u.cx.u.cobranet_data.byte_count = byte_count; 1672 if (hpi_handle_indexes(h_control, &hm.h.adapter_index,
1675 hm.u.cx.u.cobranet_data.hmi_address = hmi_address; 1673 &hm.h.obj_index))
1674 return HPI_ERROR_INVALID_HANDLE;
1676 1675
1677 if (byte_count <= 8) { 1676 if (byte_count > sizeof(hm.bytes))
1678 memcpy(hm.u.cx.u.cobranet_data.data, pb_data, byte_count); 1677 return HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL;
1679 hm.u.cx.attribute = HPI_COBRANET_SET;
1680 } else {
1681 hm.u.cx.u.cobranet_bigdata.pb_data = pb_data;
1682 hm.u.cx.attribute = HPI_COBRANET_SET_DATA;
1683 }
1684 1678
1685 hpi_send_recv(&hm, &hr); 1679 hm.p.attribute = HPI_COBRANET_SET;
1680 hm.p.byte_count = byte_count;
1681 hm.p.hmi_address = hmi_address;
1682 memcpy(hm.bytes, pb_data, byte_count);
1683 hm.h.size = (u16)(sizeof(hm.h) + sizeof(hm.p) + byte_count);
1686 1684
1685 hpi_send_recvV1(&hm.h, &hr);
1687 return hr.error; 1686 return hr.error;
1688} 1687}
1689 1688
1690u16 hpi_cobranet_hmi_read(u32 h_control, u32 hmi_address, u32 max_byte_count, 1689u16 hpi_cobranet_hmi_read(u32 h_control, u32 hmi_address, u32 max_byte_count,
1691 u32 *pbyte_count, u8 *pb_data) 1690 u32 *pbyte_count, u8 *pb_data)
1692{ 1691{
1693 struct hpi_message hm; 1692 struct hpi_msg_cobranet_hmiread hm;
1694 struct hpi_response hr; 1693 struct hpi_res_cobranet_hmiread hr;
1695 1694
1696 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, 1695 hpi_init_message_responseV1(&hm.h, sizeof(hm), &hr.h, sizeof(hr),
1697 HPI_CONTROL_GET_STATE); 1696 HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE);
1698 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) 1697
1698 if (hpi_handle_indexes(h_control, &hm.h.adapter_index,
1699 &hm.h.obj_index))
1699 return HPI_ERROR_INVALID_HANDLE; 1700 return HPI_ERROR_INVALID_HANDLE;
1700 1701
1701 hm.u.cx.u.cobranet_data.byte_count = max_byte_count; 1702 if (max_byte_count > sizeof(hr.bytes))
1702 hm.u.cx.u.cobranet_data.hmi_address = hmi_address; 1703 return HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL;
1703 1704
1704 if (max_byte_count <= 8) { 1705 hm.p.attribute = HPI_COBRANET_GET;
1705 hm.u.cx.attribute = HPI_COBRANET_GET; 1706 hm.p.byte_count = max_byte_count;
1706 } else { 1707 hm.p.hmi_address = hmi_address;
1707 hm.u.cx.u.cobranet_bigdata.pb_data = pb_data;
1708 hm.u.cx.attribute = HPI_COBRANET_GET_DATA;
1709 }
1710 1708
1711 hpi_send_recv(&hm, &hr); 1709 hpi_send_recvV1(&hm.h, &hr.h);
1712 if (!hr.error && pb_data) {
1713 1710
1714 *pbyte_count = hr.u.cx.u.cobranet_data.byte_count; 1711 if (!hr.h.error && pb_data) {
1712 if (hr.byte_count > sizeof(hr.bytes))
1715 1713
1716 if (*pbyte_count < max_byte_count) 1714 return HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL;
1717 max_byte_count = *pbyte_count;
1718 1715
1719 if (hm.u.cx.attribute == HPI_COBRANET_GET) { 1716 *pbyte_count = hr.byte_count;
1720 memcpy(pb_data, hr.u.cx.u.cobranet_data.data,
1721 max_byte_count);
1722 } else {
1723 1717
1724 } 1718 if (hr.byte_count < max_byte_count)
1719 max_byte_count = *pbyte_count;
1725 1720
1721 memcpy(pb_data, hr.bytes, max_byte_count);
1726 } 1722 }
1727 return hr.error; 1723 return hr.h.error;
1728} 1724}
1729 1725
1730u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus, 1726u16 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 struct hpi_message hm; 1729 struct hpi_message hm;
1734 struct hpi_response hr; 1730 struct hpi_response hr;
1735 1731
1736 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, 1732 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
1737 HPI_CONTROL_GET_STATE); 1733 HPI_CONTROL_GET_STATE);
1738 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) 1734 if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
1739 return HPI_ERROR_INVALID_HANDLE; 1735 return HPI_ERROR_INVALID_HANDLE;
1740 1736
1741 hm.u.cx.attribute = HPI_COBRANET_GET_STATUS; 1737 hm.u.c.attribute = HPI_COBRANET_GET_STATUS;
1742 1738
1743 hpi_send_recv(&hm, &hr); 1739 hpi_send_recv(&hm, &hr);
1744 if (!hr.error) { 1740 if (!hr.error) {
1745 if (pstatus) 1741 if (pstatus)
1746 *pstatus = hr.u.cx.u.cobranet_status.status; 1742 *pstatus = hr.u.cu.cobranet.status.status;
1747 if (preadable_size) 1743 if (preadable_size)
1748 *preadable_size = 1744 *preadable_size =
1749 hr.u.cx.u.cobranet_status.readable_size; 1745 hr.u.cu.cobranet.status.readable_size;
1750 if (pwriteable_size) 1746 if (pwriteable_size)
1751 *pwriteable_size = 1747 *pwriteable_size =
1752 hr.u.cx.u.cobranet_status.writeable_size; 1748 hr.u.cu.cobranet.status.writeable_size;
1753 } 1749 }
1754 return hr.error; 1750 return hr.error;
1755} 1751}