summaryrefslogtreecommitdiff
path: root/sound/firewire/speakers.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-04-25 22:44:59 +0900
committerTakashi Iwai <tiwai@suse.de>2014-05-26 14:23:13 +0200
commit1017abed18ae7087e7f3e256c48421d09d83176e (patch)
treeb98d0848986364dd5bede66b9553da96a60fcfa1 /sound/firewire/speakers.c
parent00a7bb81c20f3e81711e28e0f6c08cee8fd18514 (diff)
ALSA: firewire-lib: Add some AV/C general commands
This commit adds three commands, which may be used by some firewire device drivers. These commands are defined in 'AV/C Digital Interface Command Set General Specification Version 4.2 (2004006, 1394TA)'. 1. PLUG INFO command (clause 10.1) 2. INPUT PLUG SIGNAL FORMAT command (clause 10.10) 3. OUTPUT PLUG SIGNAL FORMAT command (clause 10.11) By the command 1, the drivers can get the number of plugs for AV/C unit or subunit. By the command 2 and 3, the drivers can get/set sampling frequency. The 'firewire-speakers' already uses INPUT PLUG SIGNAL FORMAT command to set sampling rate. So this commit also affects the driver. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/speakers.c')
-rw-r--r--sound/firewire/speakers.c43
1 files changed, 5 insertions, 38 deletions
diff --git a/sound/firewire/speakers.c b/sound/firewire/speakers.c
index dd9983b98607..768d40ddfebb 100644
--- a/sound/firewire/speakers.c
+++ b/sound/firewire/speakers.c
@@ -187,42 +187,6 @@ static void fwspk_stop_stream(struct fwspk *fwspk)
}
}
-static int fwspk_set_rate(struct fwspk *fwspk, unsigned int sfc)
-{
- u8 *buf;
- int err;
-
- buf = kmalloc(8, GFP_KERNEL);
- if (!buf)
- return -ENOMEM;
-
- buf[0] = 0x00; /* AV/C, CONTROL */
- buf[1] = 0xff; /* unit */
- buf[2] = 0x19; /* INPUT PLUG SIGNAL FORMAT */
- buf[3] = 0x00; /* plug 0 */
- buf[4] = 0x90; /* format: audio */
- buf[5] = 0x00 | sfc; /* AM824, frequency */
- buf[6] = 0xff; /* SYT (not used) */
- buf[7] = 0xff;
-
- err = fcp_avc_transaction(fwspk->unit, buf, 8, buf, 8,
- BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5));
- if (err < 0)
- goto error;
- if (err < 6 || buf[0] != 0x09 /* ACCEPTED */) {
- dev_err(&fwspk->unit->device, "failed to set sample rate\n");
- err = -EIO;
- goto error;
- }
-
- err = 0;
-
-error:
- kfree(buf);
-
- return err;
-}
-
static int fwspk_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
@@ -246,9 +210,12 @@ static int fwspk_hw_params(struct snd_pcm_substream *substream,
amdtp_stream_set_pcm_format(&fwspk->stream,
params_format(hw_params));
- err = fwspk_set_rate(fwspk, fwspk->stream.sfc);
- if (err < 0)
+ err = avc_general_set_sig_fmt(fwspk->unit, params_rate(hw_params),
+ AVC_GENERAL_PLUG_DIR_IN, 0);
+ if (err < 0) {
+ dev_err(&fwspk->unit->device, "failed to set sample rate\n");
goto err_buffer;
+ }
return 0;