diff options
| -rw-r--r-- | sound/soc/intel/sst-haswell-ipc.c | 168 | ||||
| -rw-r--r-- | sound/soc/intel/sst-haswell-ipc.h | 31 |
2 files changed, 0 insertions, 199 deletions
diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c index a282179a3064..0ab1309ef274 100644 --- a/sound/soc/intel/sst-haswell-ipc.c +++ b/sound/soc/intel/sst-haswell-ipc.c | |||
| @@ -338,12 +338,6 @@ static inline u32 msg_get_stage_type(u32 msg) | |||
| 338 | return (msg & IPC_STG_TYPE_MASK) >> IPC_STG_TYPE_SHIFT; | 338 | return (msg & IPC_STG_TYPE_MASK) >> IPC_STG_TYPE_SHIFT; |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | static inline u32 msg_set_stage_type(u32 msg, u32 type) | ||
| 342 | { | ||
| 343 | return (msg & ~IPC_STG_TYPE_MASK) + | ||
| 344 | (type << IPC_STG_TYPE_SHIFT); | ||
| 345 | } | ||
| 346 | |||
| 347 | static inline u32 msg_get_stream_id(u32 msg) | 341 | static inline u32 msg_get_stream_id(u32 msg) |
| 348 | { | 342 | { |
| 349 | return (msg & IPC_STR_ID_MASK) >> IPC_STR_ID_SHIFT; | 343 | return (msg & IPC_STR_ID_MASK) >> IPC_STR_ID_SHIFT; |
| @@ -970,45 +964,6 @@ int sst_hsw_fw_get_version(struct sst_hsw *hsw, | |||
| 970 | } | 964 | } |
| 971 | 965 | ||
| 972 | /* Mixer Controls */ | 966 | /* Mixer Controls */ |
| 973 | int sst_hsw_stream_mute(struct sst_hsw *hsw, struct sst_hsw_stream *stream, | ||
| 974 | u32 stage_id, u32 channel) | ||
| 975 | { | ||
| 976 | int ret; | ||
| 977 | |||
| 978 | ret = sst_hsw_stream_get_volume(hsw, stream, stage_id, channel, | ||
| 979 | &stream->mute_volume[channel]); | ||
| 980 | if (ret < 0) | ||
| 981 | return ret; | ||
| 982 | |||
| 983 | ret = sst_hsw_stream_set_volume(hsw, stream, stage_id, channel, 0); | ||
| 984 | if (ret < 0) { | ||
| 985 | dev_err(hsw->dev, "error: can't unmute stream %d channel %d\n", | ||
| 986 | stream->reply.stream_hw_id, channel); | ||
| 987 | return ret; | ||
| 988 | } | ||
| 989 | |||
| 990 | stream->mute[channel] = 1; | ||
| 991 | return 0; | ||
| 992 | } | ||
| 993 | |||
| 994 | int sst_hsw_stream_unmute(struct sst_hsw *hsw, struct sst_hsw_stream *stream, | ||
| 995 | u32 stage_id, u32 channel) | ||
| 996 | |||
| 997 | { | ||
| 998 | int ret; | ||
| 999 | |||
| 1000 | stream->mute[channel] = 0; | ||
| 1001 | ret = sst_hsw_stream_set_volume(hsw, stream, stage_id, channel, | ||
| 1002 | stream->mute_volume[channel]); | ||
| 1003 | if (ret < 0) { | ||
| 1004 | dev_err(hsw->dev, "error: can't unmute stream %d channel %d\n", | ||
| 1005 | stream->reply.stream_hw_id, channel); | ||
| 1006 | return ret; | ||
| 1007 | } | ||
| 1008 | |||
| 1009 | return 0; | ||
| 1010 | } | ||
| 1011 | |||
| 1012 | int sst_hsw_stream_get_volume(struct sst_hsw *hsw, struct sst_hsw_stream *stream, | 967 | int sst_hsw_stream_get_volume(struct sst_hsw *hsw, struct sst_hsw_stream *stream, |
| 1013 | u32 stage_id, u32 channel, u32 *volume) | 968 | u32 stage_id, u32 channel, u32 *volume) |
| 1014 | { | 969 | { |
| @@ -1022,17 +977,6 @@ int sst_hsw_stream_get_volume(struct sst_hsw *hsw, struct sst_hsw_stream *stream | |||
| 1022 | return 0; | 977 | return 0; |
| 1023 | } | 978 | } |
| 1024 | 979 | ||
| 1025 | int sst_hsw_stream_set_volume_curve(struct sst_hsw *hsw, | ||
| 1026 | struct sst_hsw_stream *stream, u64 curve_duration, | ||
| 1027 | enum sst_hsw_volume_curve curve) | ||
| 1028 | { | ||
| 1029 | /* curve duration in steps of 100ns */ | ||
| 1030 | stream->vol_req.curve_duration = curve_duration; | ||
| 1031 | stream->vol_req.curve_type = curve; | ||
| 1032 | |||
| 1033 | return 0; | ||
| 1034 | } | ||
| 1035 | |||
| 1036 | /* stream volume */ | 980 | /* stream volume */ |
| 1037 | int sst_hsw_stream_set_volume(struct sst_hsw *hsw, | 981 | int sst_hsw_stream_set_volume(struct sst_hsw *hsw, |
| 1038 | struct sst_hsw_stream *stream, u32 stage_id, u32 channel, u32 volume) | 982 | struct sst_hsw_stream *stream, u32 stage_id, u32 channel, u32 volume) |
| @@ -1084,42 +1028,6 @@ int sst_hsw_stream_set_volume(struct sst_hsw *hsw, | |||
| 1084 | return 0; | 1028 | return 0; |
| 1085 | } | 1029 | } |
| 1086 | 1030 | ||
| 1087 | int sst_hsw_mixer_mute(struct sst_hsw *hsw, u32 stage_id, u32 channel) | ||
| 1088 | { | ||
| 1089 | int ret; | ||
| 1090 | |||
| 1091 | ret = sst_hsw_mixer_get_volume(hsw, stage_id, channel, | ||
| 1092 | &hsw->mute_volume[channel]); | ||
| 1093 | if (ret < 0) | ||
| 1094 | return ret; | ||
| 1095 | |||
| 1096 | ret = sst_hsw_mixer_set_volume(hsw, stage_id, channel, 0); | ||
| 1097 | if (ret < 0) { | ||
| 1098 | dev_err(hsw->dev, "error: failed to unmute mixer channel %d\n", | ||
| 1099 | channel); | ||
| 1100 | return ret; | ||
| 1101 | } | ||
| 1102 | |||
| 1103 | hsw->mute[channel] = 1; | ||
| 1104 | return 0; | ||
| 1105 | } | ||
| 1106 | |||
| 1107 | int sst_hsw_mixer_unmute(struct sst_hsw *hsw, u32 stage_id, u32 channel) | ||
| 1108 | { | ||
| 1109 | int ret; | ||
| 1110 | |||
| 1111 | ret = sst_hsw_mixer_set_volume(hsw, stage_id, channel, | ||
| 1112 | hsw->mixer_info.volume_register_address[channel]); | ||
| 1113 | if (ret < 0) { | ||
| 1114 | dev_err(hsw->dev, "error: failed to unmute mixer channel %d\n", | ||
| 1115 | channel); | ||
| 1116 | return ret; | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | hsw->mute[channel] = 0; | ||
| 1120 | return 0; | ||
| 1121 | } | ||
| 1122 | |||
| 1123 | int sst_hsw_mixer_get_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, | 1031 | int sst_hsw_mixer_get_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, |
| 1124 | u32 *volume) | 1032 | u32 *volume) |
| 1125 | { | 1033 | { |
| @@ -1133,16 +1041,6 @@ int sst_hsw_mixer_get_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, | |||
| 1133 | return 0; | 1041 | return 0; |
| 1134 | } | 1042 | } |
| 1135 | 1043 | ||
| 1136 | int sst_hsw_mixer_set_volume_curve(struct sst_hsw *hsw, | ||
| 1137 | u64 curve_duration, enum sst_hsw_volume_curve curve) | ||
| 1138 | { | ||
| 1139 | /* curve duration in steps of 100ns */ | ||
| 1140 | hsw->curve_duration = curve_duration; | ||
| 1141 | hsw->curve_type = curve; | ||
| 1142 | |||
| 1143 | return 0; | ||
| 1144 | } | ||
| 1145 | |||
| 1146 | /* global mixer volume */ | 1044 | /* global mixer volume */ |
| 1147 | int sst_hsw_mixer_set_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, | 1045 | int sst_hsw_mixer_set_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, |
| 1148 | u32 volume) | 1046 | u32 volume) |
| @@ -1451,48 +1349,6 @@ int sst_hsw_stream_commit(struct sst_hsw *hsw, struct sst_hsw_stream *stream) | |||
| 1451 | 1349 | ||
| 1452 | /* Stream Information - these calls could be inline but we want the IPC | 1350 | /* Stream Information - these calls could be inline but we want the IPC |
| 1453 | ABI to be opaque to client PCM drivers to cope with any future ABI changes */ | 1351 | ABI to be opaque to client PCM drivers to cope with any future ABI changes */ |
| 1454 | int sst_hsw_stream_get_hw_id(struct sst_hsw *hsw, | ||
| 1455 | struct sst_hsw_stream *stream) | ||
| 1456 | { | ||
| 1457 | return stream->reply.stream_hw_id; | ||
| 1458 | } | ||
| 1459 | |||
| 1460 | int sst_hsw_stream_get_mixer_id(struct sst_hsw *hsw, | ||
| 1461 | struct sst_hsw_stream *stream) | ||
| 1462 | { | ||
| 1463 | return stream->reply.mixer_hw_id; | ||
| 1464 | } | ||
| 1465 | |||
| 1466 | u32 sst_hsw_stream_get_read_reg(struct sst_hsw *hsw, | ||
| 1467 | struct sst_hsw_stream *stream) | ||
| 1468 | { | ||
| 1469 | return stream->reply.read_position_register_address; | ||
| 1470 | } | ||
| 1471 | |||
| 1472 | u32 sst_hsw_stream_get_pointer_reg(struct sst_hsw *hsw, | ||
| 1473 | struct sst_hsw_stream *stream) | ||
| 1474 | { | ||
| 1475 | return stream->reply.presentation_position_register_address; | ||
| 1476 | } | ||
| 1477 | |||
| 1478 | u32 sst_hsw_stream_get_peak_reg(struct sst_hsw *hsw, | ||
| 1479 | struct sst_hsw_stream *stream, u32 channel) | ||
| 1480 | { | ||
| 1481 | if (channel >= 2) | ||
| 1482 | return 0; | ||
| 1483 | |||
| 1484 | return stream->reply.peak_meter_register_address[channel]; | ||
| 1485 | } | ||
| 1486 | |||
| 1487 | u32 sst_hsw_stream_get_vol_reg(struct sst_hsw *hsw, | ||
| 1488 | struct sst_hsw_stream *stream, u32 channel) | ||
| 1489 | { | ||
| 1490 | if (channel >= 2) | ||
| 1491 | return 0; | ||
| 1492 | |||
| 1493 | return stream->reply.volume_register_address[channel]; | ||
| 1494 | } | ||
| 1495 | |||
| 1496 | int sst_hsw_mixer_get_info(struct sst_hsw *hsw) | 1352 | int sst_hsw_mixer_get_info(struct sst_hsw *hsw) |
| 1497 | { | 1353 | { |
| 1498 | struct sst_hsw_ipc_stream_info_reply *reply; | 1354 | struct sst_hsw_ipc_stream_info_reply *reply; |
| @@ -1630,30 +1486,6 @@ u64 sst_hsw_get_dsp_presentation_position(struct sst_hsw *hsw, | |||
| 1630 | return ppos; | 1486 | return ppos; |
| 1631 | } | 1487 | } |
| 1632 | 1488 | ||
| 1633 | int sst_hsw_stream_set_write_position(struct sst_hsw *hsw, | ||
| 1634 | struct sst_hsw_stream *stream, u32 stage_id, u32 position) | ||
| 1635 | { | ||
| 1636 | u32 header; | ||
| 1637 | int ret; | ||
| 1638 | |||
| 1639 | trace_stream_write_position(stream->reply.stream_hw_id, position); | ||
| 1640 | |||
| 1641 | header = IPC_GLB_TYPE(IPC_GLB_STREAM_MESSAGE) | | ||
| 1642 | IPC_STR_TYPE(IPC_STR_STAGE_MESSAGE); | ||
| 1643 | header |= (stream->reply.stream_hw_id << IPC_STR_ID_SHIFT); | ||
| 1644 | header |= (IPC_STG_SET_WRITE_POSITION << IPC_STG_TYPE_SHIFT); | ||
| 1645 | header |= (stage_id << IPC_STG_ID_SHIFT); | ||
| 1646 | stream->wpos.position = position; | ||
| 1647 | |||
| 1648 | ret = ipc_tx_message_nowait(hsw, header, &stream->wpos, | ||
| 1649 | sizeof(stream->wpos)); | ||
| 1650 | if (ret < 0) | ||
| 1651 | dev_err(hsw->dev, "error: stream %d set position %d failed\n", | ||
| 1652 | stream->reply.stream_hw_id, position); | ||
| 1653 | |||
| 1654 | return ret; | ||
| 1655 | } | ||
| 1656 | |||
| 1657 | /* physical BE config */ | 1489 | /* physical BE config */ |
| 1658 | int sst_hsw_device_set_config(struct sst_hsw *hsw, | 1490 | int sst_hsw_device_set_config(struct sst_hsw *hsw, |
| 1659 | enum sst_hsw_device_id dev, enum sst_hsw_device_mclk mclk, | 1491 | enum sst_hsw_device_id dev, enum sst_hsw_device_mclk mclk, |
diff --git a/sound/soc/intel/sst-haswell-ipc.h b/sound/soc/intel/sst-haswell-ipc.h index 138e894ab413..c1ad901342f2 100644 --- a/sound/soc/intel/sst-haswell-ipc.h +++ b/sound/soc/intel/sst-haswell-ipc.h | |||
| @@ -376,32 +376,17 @@ int sst_hsw_fw_get_version(struct sst_hsw *hsw, | |||
| 376 | u32 create_channel_map(enum sst_hsw_channel_config config); | 376 | u32 create_channel_map(enum sst_hsw_channel_config config); |
| 377 | 377 | ||
| 378 | /* Stream Mixer Controls - */ | 378 | /* Stream Mixer Controls - */ |
| 379 | int sst_hsw_stream_mute(struct sst_hsw *hsw, struct sst_hsw_stream *stream, | ||
| 380 | u32 stage_id, u32 channel); | ||
| 381 | int sst_hsw_stream_unmute(struct sst_hsw *hsw, struct sst_hsw_stream *stream, | ||
| 382 | u32 stage_id, u32 channel); | ||
| 383 | |||
| 384 | int sst_hsw_stream_set_volume(struct sst_hsw *hsw, | 379 | int sst_hsw_stream_set_volume(struct sst_hsw *hsw, |
| 385 | struct sst_hsw_stream *stream, u32 stage_id, u32 channel, u32 volume); | 380 | struct sst_hsw_stream *stream, u32 stage_id, u32 channel, u32 volume); |
| 386 | int sst_hsw_stream_get_volume(struct sst_hsw *hsw, | 381 | int sst_hsw_stream_get_volume(struct sst_hsw *hsw, |
| 387 | struct sst_hsw_stream *stream, u32 stage_id, u32 channel, u32 *volume); | 382 | struct sst_hsw_stream *stream, u32 stage_id, u32 channel, u32 *volume); |
| 388 | 383 | ||
| 389 | int sst_hsw_stream_set_volume_curve(struct sst_hsw *hsw, | ||
| 390 | struct sst_hsw_stream *stream, u64 curve_duration, | ||
| 391 | enum sst_hsw_volume_curve curve); | ||
| 392 | |||
| 393 | /* Global Mixer Controls - */ | 384 | /* Global Mixer Controls - */ |
| 394 | int sst_hsw_mixer_mute(struct sst_hsw *hsw, u32 stage_id, u32 channel); | ||
| 395 | int sst_hsw_mixer_unmute(struct sst_hsw *hsw, u32 stage_id, u32 channel); | ||
| 396 | |||
| 397 | int sst_hsw_mixer_set_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, | 385 | int sst_hsw_mixer_set_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, |
| 398 | u32 volume); | 386 | u32 volume); |
| 399 | int sst_hsw_mixer_get_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, | 387 | int sst_hsw_mixer_get_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, |
| 400 | u32 *volume); | 388 | u32 *volume); |
| 401 | 389 | ||
| 402 | int sst_hsw_mixer_set_volume_curve(struct sst_hsw *hsw, | ||
| 403 | u64 curve_duration, enum sst_hsw_volume_curve curve); | ||
| 404 | |||
| 405 | /* Stream API */ | 390 | /* Stream API */ |
| 406 | struct sst_hsw_stream *sst_hsw_stream_new(struct sst_hsw *hsw, int id, | 391 | struct sst_hsw_stream *sst_hsw_stream_new(struct sst_hsw *hsw, int id, |
| 407 | u32 (*get_write_position)(struct sst_hsw_stream *stream, void *data), | 392 | u32 (*get_write_position)(struct sst_hsw_stream *stream, void *data), |
| @@ -440,18 +425,6 @@ int sst_hsw_stream_set_pmemory_info(struct sst_hsw *hsw, | |||
| 440 | struct sst_hsw_stream *stream, u32 offset, u32 size); | 425 | struct sst_hsw_stream *stream, u32 offset, u32 size); |
| 441 | int sst_hsw_stream_set_smemory_info(struct sst_hsw *hsw, | 426 | int sst_hsw_stream_set_smemory_info(struct sst_hsw *hsw, |
| 442 | struct sst_hsw_stream *stream, u32 offset, u32 size); | 427 | struct sst_hsw_stream *stream, u32 offset, u32 size); |
| 443 | int sst_hsw_stream_get_hw_id(struct sst_hsw *hsw, | ||
| 444 | struct sst_hsw_stream *stream); | ||
| 445 | int sst_hsw_stream_get_mixer_id(struct sst_hsw *hsw, | ||
| 446 | struct sst_hsw_stream *stream); | ||
| 447 | u32 sst_hsw_stream_get_read_reg(struct sst_hsw *hsw, | ||
| 448 | struct sst_hsw_stream *stream); | ||
| 449 | u32 sst_hsw_stream_get_pointer_reg(struct sst_hsw *hsw, | ||
| 450 | struct sst_hsw_stream *stream); | ||
| 451 | u32 sst_hsw_stream_get_peak_reg(struct sst_hsw *hsw, | ||
| 452 | struct sst_hsw_stream *stream, u32 channel); | ||
| 453 | u32 sst_hsw_stream_get_vol_reg(struct sst_hsw *hsw, | ||
| 454 | struct sst_hsw_stream *stream, u32 channel); | ||
| 455 | int sst_hsw_mixer_get_info(struct sst_hsw *hsw); | 428 | int sst_hsw_mixer_get_info(struct sst_hsw *hsw); |
| 456 | 429 | ||
| 457 | /* Stream ALSA trigger operations */ | 430 | /* Stream ALSA trigger operations */ |
| @@ -466,8 +439,6 @@ int sst_hsw_stream_get_read_pos(struct sst_hsw *hsw, | |||
| 466 | struct sst_hsw_stream *stream, u32 *position); | 439 | struct sst_hsw_stream *stream, u32 *position); |
| 467 | int sst_hsw_stream_get_write_pos(struct sst_hsw *hsw, | 440 | int sst_hsw_stream_get_write_pos(struct sst_hsw *hsw, |
| 468 | struct sst_hsw_stream *stream, u32 *position); | 441 | struct sst_hsw_stream *stream, u32 *position); |
| 469 | int sst_hsw_stream_set_write_position(struct sst_hsw *hsw, | ||
| 470 | struct sst_hsw_stream *stream, u32 stage_id, u32 position); | ||
| 471 | u32 sst_hsw_get_dsp_position(struct sst_hsw *hsw, | 442 | u32 sst_hsw_get_dsp_position(struct sst_hsw *hsw, |
| 472 | struct sst_hsw_stream *stream); | 443 | struct sst_hsw_stream *stream); |
| 473 | u64 sst_hsw_get_dsp_presentation_position(struct sst_hsw *hsw, | 444 | u64 sst_hsw_get_dsp_presentation_position(struct sst_hsw *hsw, |
| @@ -481,8 +452,6 @@ int sst_hsw_device_set_config(struct sst_hsw *hsw, | |||
| 481 | /* DX Config */ | 452 | /* DX Config */ |
| 482 | int sst_hsw_dx_set_state(struct sst_hsw *hsw, | 453 | int sst_hsw_dx_set_state(struct sst_hsw *hsw, |
| 483 | enum sst_hsw_dx_state state, struct sst_hsw_ipc_dx_reply *dx); | 454 | enum sst_hsw_dx_state state, struct sst_hsw_ipc_dx_reply *dx); |
| 484 | int sst_hsw_dx_get_state(struct sst_hsw *hsw, u32 item, | ||
| 485 | u32 *offset, u32 *size, u32 *source); | ||
| 486 | 455 | ||
| 487 | /* init */ | 456 | /* init */ |
| 488 | int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata); | 457 | int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata); |
