11a59d1b8SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later 21da177e4SLinus Torvalds /* 31da177e4SLinus Torvalds * Driver for Digigram VX soundcards 41da177e4SLinus Torvalds * 51da177e4SLinus Torvalds * DSP commands 61da177e4SLinus Torvalds * 71da177e4SLinus Torvalds * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de> 81da177e4SLinus Torvalds */ 91da177e4SLinus Torvalds 101da177e4SLinus Torvalds #include <sound/core.h> 111da177e4SLinus Torvalds #include <sound/pcm.h> 121da177e4SLinus Torvalds #include <sound/vx_core.h> 131da177e4SLinus Torvalds #include "vx_cmd.h" 141da177e4SLinus Torvalds 151da177e4SLinus Torvalds /* 161da177e4SLinus Torvalds * Array of DSP commands 171da177e4SLinus Torvalds */ 18*c0948245STakashi Iwai static const struct vx_cmd_info vx_dsp_cmds[] = { 191da177e4SLinus Torvalds [CMD_VERSION] = { 0x010000, 2, RMH_SSIZE_FIXED, 1 }, 201da177e4SLinus Torvalds [CMD_SUPPORTED] = { 0x020000, 1, RMH_SSIZE_FIXED, 2 }, 211da177e4SLinus Torvalds [CMD_TEST_IT] = { 0x040000, 1, RMH_SSIZE_FIXED, 1 }, 221da177e4SLinus Torvalds [CMD_SEND_IRQA] = { 0x070001, 1, RMH_SSIZE_FIXED, 0 }, 231da177e4SLinus Torvalds [CMD_IBL] = { 0x080000, 1, RMH_SSIZE_FIXED, 4 }, 241da177e4SLinus Torvalds [CMD_ASYNC] = { 0x0A0000, 1, RMH_SSIZE_ARG, 0 }, 251da177e4SLinus Torvalds [CMD_RES_PIPE] = { 0x400000, 1, RMH_SSIZE_FIXED, 0 }, 261da177e4SLinus Torvalds [CMD_FREE_PIPE] = { 0x410000, 1, RMH_SSIZE_FIXED, 0 }, 271da177e4SLinus Torvalds [CMD_CONF_PIPE] = { 0x42A101, 2, RMH_SSIZE_FIXED, 0 }, 281da177e4SLinus Torvalds [CMD_ABORT_CONF_PIPE] = { 0x42A100, 2, RMH_SSIZE_FIXED, 0 }, 291da177e4SLinus Torvalds [CMD_PARAM_OUTPUT_PIPE] = { 0x43A000, 2, RMH_SSIZE_FIXED, 0 }, 301da177e4SLinus Torvalds [CMD_STOP_PIPE] = { 0x470004, 1, RMH_SSIZE_FIXED, 0 }, 311da177e4SLinus Torvalds [CMD_PIPE_STATE] = { 0x480000, 1, RMH_SSIZE_FIXED, 1 }, 321da177e4SLinus Torvalds [CMD_PIPE_SPL_COUNT] = { 0x49A000, 2, RMH_SSIZE_FIXED, 2 }, 331da177e4SLinus Torvalds [CMD_CAN_START_PIPE] = { 0x4b0000, 1, RMH_SSIZE_FIXED, 1 }, 341da177e4SLinus Torvalds [CMD_SIZE_HBUFFER] = { 0x4C0000, 1, RMH_SSIZE_FIXED, 1 }, 351da177e4SLinus Torvalds [CMD_START_STREAM] = { 0x80A000, 2, RMH_SSIZE_FIXED, 0 }, 361da177e4SLinus Torvalds [CMD_START_ONE_STREAM] = { 0x800000, 1, RMH_SSIZE_FIXED, 0 }, 371da177e4SLinus Torvalds [CMD_PAUSE_STREAM] = { 0x81A000, 2, RMH_SSIZE_FIXED, 0 }, 381da177e4SLinus Torvalds [CMD_PAUSE_ONE_STREAM] = { 0x810000, 1, RMH_SSIZE_FIXED, 0 }, 391da177e4SLinus Torvalds [CMD_STREAM_OUT_LEVEL_ADJUST] = { 0x828000, 2, RMH_SSIZE_FIXED, 0 }, 401da177e4SLinus Torvalds [CMD_STOP_STREAM] = { 0x830000, 1, RMH_SSIZE_FIXED, 0 }, 411da177e4SLinus Torvalds [CMD_FORMAT_STREAM_OUT] = { 0x868000, 1, RMH_SSIZE_FIXED, 0 }, 421da177e4SLinus Torvalds [CMD_FORMAT_STREAM_IN] = { 0x878800, 1, RMH_SSIZE_FIXED, 0 }, 431da177e4SLinus Torvalds [CMD_GET_STREAM_STATE] = { 0x890001, 2, RMH_SSIZE_FIXED, 1 }, 441da177e4SLinus Torvalds [CMD_DROP_BYTES_AWAY] = { 0x8A8000, 2, RMH_SSIZE_FIXED, 0 }, 451da177e4SLinus Torvalds [CMD_GET_REMAINING_BYTES] = { 0x8D0800, 1, RMH_SSIZE_FIXED, 2 }, 461da177e4SLinus Torvalds [CMD_CONNECT_AUDIO] = { 0xC10000, 1, RMH_SSIZE_FIXED, 0 }, 471da177e4SLinus Torvalds [CMD_AUDIO_LEVEL_ADJUST] = { 0xC2A000, 3, RMH_SSIZE_FIXED, 0 }, 481da177e4SLinus Torvalds [CMD_AUDIO_VU_PIC_METER] = { 0xC3A003, 2, RMH_SSIZE_FIXED, 1 }, 491da177e4SLinus Torvalds [CMD_GET_AUDIO_LEVELS] = { 0xC4A000, 2, RMH_SSIZE_FIXED, 0 }, 501da177e4SLinus Torvalds [CMD_GET_NOTIFY_EVENT] = { 0x4D0000, 1, RMH_SSIZE_ARG, 0 }, 511da177e4SLinus Torvalds [CMD_INFO_NOTIFIED] = { 0x0B0000, 1, RMH_SSIZE_FIXED, 2 }, 521da177e4SLinus Torvalds [CMD_ACCESS_IO_FCT] = { 0x098000, 1, RMH_SSIZE_ARG, 0 }, 531da177e4SLinus Torvalds [CMD_STATUS_R_BUFFERS] = { 0x440000, 1, RMH_SSIZE_ARG, 0 }, 541da177e4SLinus Torvalds [CMD_UPDATE_R_BUFFERS] = { 0x848000, 4, RMH_SSIZE_FIXED, 0 }, 551da177e4SLinus Torvalds [CMD_LOAD_EFFECT_CONTEXT] = { 0x0c8000, 3, RMH_SSIZE_FIXED, 1 }, 561da177e4SLinus Torvalds [CMD_EFFECT_ONE_PIPE] = { 0x458000, 0, RMH_SSIZE_FIXED, 0 }, 571da177e4SLinus Torvalds [CMD_MODIFY_CLOCK] = { 0x0d0000, 1, RMH_SSIZE_FIXED, 0 }, 581da177e4SLinus Torvalds [CMD_STREAM1_OUT_SET_N_LEVELS] ={ 0x858000, 3, RMH_SSIZE_FIXED, 0 }, 591da177e4SLinus Torvalds [CMD_PURGE_STREAM_DCMDS] = { 0x8b8000, 3, RMH_SSIZE_FIXED, 0 }, 601da177e4SLinus Torvalds [CMD_NOTIFY_PIPE_TIME] = { 0x4e0000, 1, RMH_SSIZE_FIXED, 0 }, 611da177e4SLinus Torvalds [CMD_LOAD_EFFECT_CONTEXT_PACKET] = { 0x0c8000, 1, RMH_SSIZE_FIXED, 0 }, 621da177e4SLinus Torvalds [CMD_RELIC_R_BUFFER] = { 0x8e0800, 1, RMH_SSIZE_FIXED, 1 }, 631da177e4SLinus Torvalds [CMD_RESYNC_AUDIO_INPUTS] = { 0x0e0000, 1, RMH_SSIZE_FIXED, 0 }, 641da177e4SLinus Torvalds [CMD_NOTIFY_STREAM_TIME] = { 0x8f0000, 1, RMH_SSIZE_FIXED, 0 }, 651da177e4SLinus Torvalds [CMD_STREAM_SAMPLE_COUNT] = { 0x900000, 1, RMH_SSIZE_FIXED, 2 }, 661da177e4SLinus Torvalds [CMD_CONFIG_TIME_CODE] = { 0x050000, 2, RMH_SSIZE_FIXED, 0 }, 671da177e4SLinus Torvalds [CMD_GET_TIME_CODE] = { 0x060000, 1, RMH_SSIZE_FIXED, 5 }, 681da177e4SLinus Torvalds [CMD_MANAGE_SIGNAL] = { 0x0f0000, 1, RMH_SSIZE_FIXED, 0 }, 691da177e4SLinus Torvalds [CMD_PARAMETER_STREAM_OUT] = { 0x91A000, 3, RMH_SSIZE_FIXED, 0 }, 701da177e4SLinus Torvalds [CMD_READ_BOARD_FREQ] = { 0x030000, 1, RMH_SSIZE_FIXED, 2 }, 711da177e4SLinus Torvalds [CMD_GET_STREAM_LEVELS] = { 0x8c0000, 1, RMH_SSIZE_FIXED, 3 }, 721da177e4SLinus Torvalds [CMD_PURGE_PIPE_DCMDS] = { 0x4f8000, 3, RMH_SSIZE_FIXED, 0 }, 731da177e4SLinus Torvalds // [CMD_SET_STREAM_OUT_EFFECTS] = { 0x888000, 34, RMH_SSIZE_FIXED, 0 }, 741da177e4SLinus Torvalds // [CMD_GET_STREAM_OUT_EFFECTS] = { 0x928000, 2, RMH_SSIZE_FIXED, 32 }, 751da177e4SLinus Torvalds [CMD_CONNECT_MONITORING] = { 0xC00000, 1, RMH_SSIZE_FIXED, 0 }, 761da177e4SLinus Torvalds [CMD_STREAM2_OUT_SET_N_LEVELS] = { 0x938000, 3, RMH_SSIZE_FIXED, 0 }, 771da177e4SLinus Torvalds [CMD_CANCEL_R_BUFFERS] = { 0x948000, 4, RMH_SSIZE_FIXED, 0 }, 781da177e4SLinus Torvalds [CMD_NOTIFY_END_OF_BUFFER] = { 0x950000, 1, RMH_SSIZE_FIXED, 0 }, 791da177e4SLinus Torvalds [CMD_GET_STREAM_VU_METER] = { 0x95A000, 2, RMH_SSIZE_ARG, 0 }, 801da177e4SLinus Torvalds }; 811da177e4SLinus Torvalds 821da177e4SLinus Torvalds /** 831da177e4SLinus Torvalds * vx_init_rmh - initialize the RMH instance 841da177e4SLinus Torvalds * @rmh: the rmh pointer to be initialized 851da177e4SLinus Torvalds * @cmd: the rmh command to be set 861da177e4SLinus Torvalds */ 871da177e4SLinus Torvalds void vx_init_rmh(struct vx_rmh *rmh, unsigned int cmd) 881da177e4SLinus Torvalds { 895e246b85STakashi Iwai if (snd_BUG_ON(cmd >= CMD_LAST_INDEX)) 905e246b85STakashi Iwai return; 911da177e4SLinus Torvalds rmh->LgCmd = vx_dsp_cmds[cmd].length; 921da177e4SLinus Torvalds rmh->LgStat = vx_dsp_cmds[cmd].st_length; 931da177e4SLinus Torvalds rmh->DspStat = vx_dsp_cmds[cmd].st_type; 941da177e4SLinus Torvalds rmh->Cmd[0] = vx_dsp_cmds[cmd].opcode; 951da177e4SLinus Torvalds } 961da177e4SLinus Torvalds 97