2019-05-30 06:57:59 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2014-11-28 22:59:27 +07:00
|
|
|
/*
|
|
|
|
* oxfw.h - a part of driver for OXFW970/971 based devices
|
|
|
|
*
|
|
|
|
* Copyright (c) Clemens Ladisch <clemens@ladisch.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/firewire.h>
|
|
|
|
#include <linux/firewire-constants.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/mod_devicetable.h>
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
#include <linux/slab.h>
|
2014-12-08 22:10:49 +07:00
|
|
|
#include <linux/compat.h>
|
2017-02-03 01:15:33 +07:00
|
|
|
#include <linux/sched/signal.h>
|
2014-11-28 22:59:27 +07:00
|
|
|
|
|
|
|
#include <sound/control.h>
|
|
|
|
#include <sound/core.h>
|
|
|
|
#include <sound/initval.h>
|
|
|
|
#include <sound/pcm.h>
|
|
|
|
#include <sound/pcm_params.h>
|
2014-12-08 22:10:43 +07:00
|
|
|
#include <sound/info.h>
|
2014-12-08 22:10:48 +07:00
|
|
|
#include <sound/rawmidi.h>
|
2014-12-08 22:10:49 +07:00
|
|
|
#include <sound/firewire.h>
|
|
|
|
#include <sound/hwdep.h>
|
2014-11-28 22:59:27 +07:00
|
|
|
|
|
|
|
#include "../lib.h"
|
|
|
|
#include "../fcp.h"
|
|
|
|
#include "../packets-buffer.h"
|
|
|
|
#include "../iso-resources.h"
|
2015-09-19 09:21:55 +07:00
|
|
|
#include "../amdtp-am824.h"
|
2014-11-28 22:59:27 +07:00
|
|
|
#include "../cmp.h"
|
|
|
|
|
2014-12-08 22:10:42 +07:00
|
|
|
/* This is an arbitrary number for convinience. */
|
|
|
|
#define SND_OXFW_STREAM_FORMAT_ENTRIES 10
|
2014-11-28 22:59:27 +07:00
|
|
|
struct snd_oxfw {
|
|
|
|
struct snd_card *card;
|
|
|
|
struct fw_unit *unit;
|
|
|
|
struct mutex mutex;
|
2014-12-08 22:10:48 +07:00
|
|
|
spinlock_t lock;
|
2014-12-08 22:10:42 +07:00
|
|
|
|
2016-03-31 06:47:07 +07:00
|
|
|
bool registered;
|
|
|
|
struct delayed_work dwork;
|
|
|
|
|
2015-09-20 19:18:55 +07:00
|
|
|
bool wrong_dbs;
|
2014-12-08 22:10:46 +07:00
|
|
|
bool has_output;
|
|
|
|
u8 *tx_stream_formats[SND_OXFW_STREAM_FORMAT_ENTRIES];
|
2014-12-08 22:10:42 +07:00
|
|
|
u8 *rx_stream_formats[SND_OXFW_STREAM_FORMAT_ENTRIES];
|
|
|
|
bool assumed;
|
2014-12-08 22:10:46 +07:00
|
|
|
struct cmp_connection out_conn;
|
2014-11-28 22:59:27 +07:00
|
|
|
struct cmp_connection in_conn;
|
2014-12-08 22:10:46 +07:00
|
|
|
struct amdtp_stream tx_stream;
|
2014-11-28 22:59:27 +07:00
|
|
|
struct amdtp_stream rx_stream;
|
2019-06-12 15:44:20 +07:00
|
|
|
unsigned int substreams_count;
|
2014-12-08 22:10:42 +07:00
|
|
|
|
2014-12-08 22:10:48 +07:00
|
|
|
unsigned int midi_input_ports;
|
|
|
|
unsigned int midi_output_ports;
|
|
|
|
|
2014-12-08 22:10:49 +07:00
|
|
|
int dev_lock_count;
|
|
|
|
bool dev_lock_changed;
|
|
|
|
wait_queue_head_t hwdep_wait;
|
2015-12-15 21:56:20 +07:00
|
|
|
|
|
|
|
const struct ieee1394_device_id *entry;
|
2015-12-16 18:37:54 +07:00
|
|
|
void *spec;
|
2019-08-04 13:21:32 +07:00
|
|
|
|
|
|
|
struct amdtp_domain domain;
|
2014-11-28 22:59:27 +07:00
|
|
|
};
|
|
|
|
|
2014-12-08 22:10:41 +07:00
|
|
|
/*
|
|
|
|
* AV/C Stream Format Information Specification 1.1 Working Draft
|
|
|
|
* (Apr 2005, 1394TA)
|
|
|
|
*/
|
|
|
|
int avc_stream_set_format(struct fw_unit *unit, enum avc_general_plug_dir dir,
|
|
|
|
unsigned int pid, u8 *format, unsigned int len);
|
|
|
|
int avc_stream_get_format(struct fw_unit *unit,
|
|
|
|
enum avc_general_plug_dir dir, unsigned int pid,
|
|
|
|
u8 *buf, unsigned int *len, unsigned int eid);
|
|
|
|
static inline int
|
|
|
|
avc_stream_get_format_single(struct fw_unit *unit,
|
|
|
|
enum avc_general_plug_dir dir, unsigned int pid,
|
|
|
|
u8 *buf, unsigned int *len)
|
|
|
|
{
|
|
|
|
return avc_stream_get_format(unit, dir, pid, buf, len, 0xff);
|
|
|
|
}
|
|
|
|
static inline int
|
|
|
|
avc_stream_get_format_list(struct fw_unit *unit,
|
|
|
|
enum avc_general_plug_dir dir, unsigned int pid,
|
|
|
|
u8 *buf, unsigned int *len,
|
|
|
|
unsigned int eid)
|
|
|
|
{
|
|
|
|
return avc_stream_get_format(unit, dir, pid, buf, len, eid);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* AV/C Digital Interface Command Set General Specification 4.2
|
|
|
|
* (Sep 2004, 1394TA)
|
|
|
|
*/
|
|
|
|
int avc_general_inquiry_sig_fmt(struct fw_unit *unit, unsigned int rate,
|
|
|
|
enum avc_general_plug_dir dir,
|
|
|
|
unsigned short pid);
|
|
|
|
|
2019-06-12 15:44:19 +07:00
|
|
|
int snd_oxfw_stream_init_duplex(struct snd_oxfw *oxfw);
|
2019-06-12 15:44:21 +07:00
|
|
|
int snd_oxfw_stream_reserve_duplex(struct snd_oxfw *oxfw,
|
|
|
|
struct amdtp_stream *stream,
|
2019-10-07 18:05:19 +07:00
|
|
|
unsigned int rate, unsigned int pcm_channels,
|
|
|
|
unsigned int frames_per_period);
|
2019-06-12 15:44:21 +07:00
|
|
|
int snd_oxfw_stream_start_duplex(struct snd_oxfw *oxfw);
|
2019-06-12 15:44:19 +07:00
|
|
|
void snd_oxfw_stream_stop_duplex(struct snd_oxfw *oxfw);
|
|
|
|
void snd_oxfw_stream_destroy_duplex(struct snd_oxfw *oxfw);
|
|
|
|
void snd_oxfw_stream_update_duplex(struct snd_oxfw *oxfw);
|
2014-11-28 22:59:28 +07:00
|
|
|
|
2014-12-08 22:10:42 +07:00
|
|
|
struct snd_oxfw_stream_formation {
|
|
|
|
unsigned int rate;
|
|
|
|
unsigned int pcm;
|
|
|
|
unsigned int midi;
|
|
|
|
};
|
|
|
|
int snd_oxfw_stream_parse_format(u8 *format,
|
|
|
|
struct snd_oxfw_stream_formation *formation);
|
|
|
|
int snd_oxfw_stream_get_current_formation(struct snd_oxfw *oxfw,
|
|
|
|
enum avc_general_plug_dir dir,
|
|
|
|
struct snd_oxfw_stream_formation *formation);
|
2014-12-08 22:10:46 +07:00
|
|
|
|
2014-12-08 22:10:42 +07:00
|
|
|
int snd_oxfw_stream_discover(struct snd_oxfw *oxfw);
|
|
|
|
|
2014-12-08 22:10:49 +07:00
|
|
|
void snd_oxfw_stream_lock_changed(struct snd_oxfw *oxfw);
|
|
|
|
int snd_oxfw_stream_lock_try(struct snd_oxfw *oxfw);
|
|
|
|
void snd_oxfw_stream_lock_release(struct snd_oxfw *oxfw);
|
|
|
|
|
2014-11-28 22:59:28 +07:00
|
|
|
int snd_oxfw_create_pcm(struct snd_oxfw *oxfw);
|
2014-11-28 22:59:29 +07:00
|
|
|
|
2014-12-08 22:10:43 +07:00
|
|
|
void snd_oxfw_proc_init(struct snd_oxfw *oxfw);
|
2014-12-08 22:10:48 +07:00
|
|
|
|
|
|
|
int snd_oxfw_create_midi(struct snd_oxfw *oxfw);
|
2014-12-08 22:10:49 +07:00
|
|
|
|
|
|
|
int snd_oxfw_create_hwdep(struct snd_oxfw *oxfw);
|
2015-12-15 21:56:18 +07:00
|
|
|
|
2015-12-16 18:37:56 +07:00
|
|
|
int snd_oxfw_add_spkr(struct snd_oxfw *oxfw, bool is_lacie);
|
2015-12-22 07:15:39 +07:00
|
|
|
int snd_oxfw_scs1x_add(struct snd_oxfw *oxfw);
|
2015-12-22 07:15:40 +07:00
|
|
|
void snd_oxfw_scs1x_update(struct snd_oxfw *oxfw);
|