Merge branch 'topic/misc' into for-next
Generic updates for sound 3.6
This commit is contained in:
@@ -1250,10 +1250,10 @@ static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params,
|
||||
int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,
|
||||
unsigned int cond,
|
||||
snd_pcm_hw_param_t var,
|
||||
struct snd_pcm_hw_constraint_list *l)
|
||||
const struct snd_pcm_hw_constraint_list *l)
|
||||
{
|
||||
return snd_pcm_hw_rule_add(runtime, cond, var,
|
||||
snd_pcm_hw_rule_list, l,
|
||||
snd_pcm_hw_rule_list, (void *)l,
|
||||
var, -1);
|
||||
}
|
||||
|
||||
|
@@ -488,3 +488,21 @@ unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate)
|
||||
return SNDRV_PCM_RATE_KNOT;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_pcm_rate_to_rate_bit);
|
||||
|
||||
/**
|
||||
* snd_pcm_rate_bit_to_rate - converts SNDRV_PCM_RATE_xxx bit to sample rate
|
||||
* @rate_bit: the rate bit to convert
|
||||
*
|
||||
* Returns the sample rate that corresponds to the given SNDRV_PCM_RATE_xxx flag
|
||||
* or 0 for an unknown rate bit
|
||||
*/
|
||||
unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < snd_pcm_known_rates.count; i++)
|
||||
if ((1u << i) == rate_bit)
|
||||
return snd_pcm_known_rates.list[i];
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_pcm_rate_bit_to_rate);
|
||||
|
@@ -135,10 +135,9 @@ struct snd_opti9xx {
|
||||
unsigned long mc_base_size;
|
||||
#ifdef OPTi93X
|
||||
unsigned long mc_indir_index;
|
||||
unsigned long mc_indir_size;
|
||||
struct resource *res_mc_indir;
|
||||
struct snd_wss *codec;
|
||||
#endif /* OPTi93X */
|
||||
struct snd_wss *codec;
|
||||
unsigned long pwd_reg;
|
||||
|
||||
spinlock_t lock;
|
||||
@@ -245,10 +244,8 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
|
||||
case OPTi9XX_HW_82C931:
|
||||
case OPTi9XX_HW_82C933:
|
||||
chip->mc_base = (hardware == OPTi9XX_HW_82C930) ? 0xf8f : 0xf8d;
|
||||
if (!chip->mc_indir_index) {
|
||||
if (!chip->mc_indir_index)
|
||||
chip->mc_indir_index = 0xe0e;
|
||||
chip->mc_indir_size = 2;
|
||||
}
|
||||
chip->password = 0xe4;
|
||||
chip->pwd_reg = 0;
|
||||
break;
|
||||
@@ -351,7 +348,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
|
||||
(snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask)))
|
||||
|
||||
|
||||
static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
|
||||
static int snd_opti9xx_configure(struct snd_opti9xx *chip,
|
||||
long port,
|
||||
int irq, int dma1, int dma2,
|
||||
long mpu_port, int mpu_irq)
|
||||
@@ -403,7 +400,9 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
|
||||
|
||||
#else /* OPTi93X */
|
||||
case OPTi9XX_HW_82C931:
|
||||
case OPTi9XX_HW_82C933:
|
||||
/* disable 3D sound (set GPIO1 as output, low) */
|
||||
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(20), 0x04, 0x0c);
|
||||
case OPTi9XX_HW_82C933: /* FALL THROUGH */
|
||||
/*
|
||||
* The BTC 1817DW has QS1000 wavetable which is connected
|
||||
* to the serial digital input of the OPTI931.
|
||||
@@ -696,8 +695,7 @@ static int __devinit snd_opti9xx_read_check(struct snd_opti9xx *chip)
|
||||
if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)))
|
||||
return 0;
|
||||
#else /* OPTi93X */
|
||||
chip->res_mc_indir = request_region(chip->mc_indir_index,
|
||||
chip->mc_indir_size,
|
||||
chip->res_mc_indir = request_region(chip->mc_indir_index, 2,
|
||||
"OPTi93x MC");
|
||||
if (chip->res_mc_indir == NULL)
|
||||
return -EBUSY;
|
||||
@@ -770,8 +768,9 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
|
||||
#ifdef OPTi93X
|
||||
port = pnp_port_start(pdev, 0) - 4;
|
||||
fm_port = pnp_port_start(pdev, 1) + 8;
|
||||
chip->mc_indir_index = pnp_port_start(pdev, 3) + 2;
|
||||
chip->mc_indir_size = pnp_port_len(pdev, 3) - 2;
|
||||
/* adjust mc_indir_index - some cards report it at 0xe?d,
|
||||
other at 0xe?c but it really is always at 0xe?e */
|
||||
chip->mc_indir_index = (pnp_port_start(pdev, 3) & ~0xf) | 0xe;
|
||||
#else
|
||||
devmc = pnp_request_card_device(card, pid->devs[2].id, NULL);
|
||||
if (devmc == NULL)
|
||||
@@ -871,9 +870,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
|
||||
&codec);
|
||||
if (error < 0)
|
||||
return error;
|
||||
#ifdef OPTi93X
|
||||
chip->codec = codec;
|
||||
#endif
|
||||
error = snd_wss_pcm(codec, 0, &pcm);
|
||||
if (error < 0)
|
||||
return error;
|
||||
@@ -1054,11 +1051,55 @@ static int __devexit snd_opti9xx_isa_remove(struct device *devptr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int snd_opti9xx_suspend(struct snd_card *card)
|
||||
{
|
||||
struct snd_opti9xx *chip = card->private_data;
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||
chip->codec->suspend(chip->codec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_opti9xx_resume(struct snd_card *card)
|
||||
{
|
||||
struct snd_opti9xx *chip = card->private_data;
|
||||
int error, xdma2;
|
||||
#if defined(CS4231) || defined(OPTi93X)
|
||||
xdma2 = dma2;
|
||||
#else
|
||||
xdma2 = -1;
|
||||
#endif
|
||||
|
||||
error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2,
|
||||
mpu_port, mpu_irq);
|
||||
if (error)
|
||||
return error;
|
||||
chip->codec->resume(chip->codec);
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_opti9xx_isa_suspend(struct device *dev, unsigned int n,
|
||||
pm_message_t state)
|
||||
{
|
||||
return snd_opti9xx_suspend(dev_get_drvdata(dev));
|
||||
}
|
||||
|
||||
static int snd_opti9xx_isa_resume(struct device *dev, unsigned int n)
|
||||
{
|
||||
return snd_opti9xx_resume(dev_get_drvdata(dev));
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct isa_driver snd_opti9xx_driver = {
|
||||
.match = snd_opti9xx_isa_match,
|
||||
.probe = snd_opti9xx_isa_probe,
|
||||
.remove = __devexit_p(snd_opti9xx_isa_remove),
|
||||
/* FIXME: suspend/resume */
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = snd_opti9xx_isa_suspend,
|
||||
.resume = snd_opti9xx_isa_resume,
|
||||
#endif
|
||||
.driver = {
|
||||
.name = DEV_NAME
|
||||
},
|
||||
@@ -1124,12 +1165,29 @@ static void __devexit snd_opti9xx_pnp_remove(struct pnp_card_link * pcard)
|
||||
snd_opti9xx_pnp_is_probed = 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int snd_opti9xx_pnp_suspend(struct pnp_card_link *pcard,
|
||||
pm_message_t state)
|
||||
{
|
||||
return snd_opti9xx_suspend(pnp_get_card_drvdata(pcard));
|
||||
}
|
||||
|
||||
static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard)
|
||||
{
|
||||
return snd_opti9xx_resume(pnp_get_card_drvdata(pcard));
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct pnp_card_driver opti9xx_pnpc_driver = {
|
||||
.flags = PNP_DRIVER_RES_DISABLE,
|
||||
.name = "opti9xx",
|
||||
.id_table = snd_opti9xx_pnpids,
|
||||
.probe = snd_opti9xx_pnp_probe,
|
||||
.remove = __devexit_p(snd_opti9xx_pnp_remove),
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = snd_opti9xx_pnp_suspend,
|
||||
.resume = snd_opti9xx_pnp_resume,
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -1456,7 +1456,6 @@ static struct snd_pcm_hardware snd_wss_playback =
|
||||
{
|
||||
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
|
||||
SNDRV_PCM_INFO_MMAP_VALID |
|
||||
SNDRV_PCM_INFO_RESUME |
|
||||
SNDRV_PCM_INFO_SYNC_START),
|
||||
.formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | SNDRV_PCM_FMTBIT_IMA_ADPCM |
|
||||
SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE),
|
||||
@@ -1657,6 +1656,10 @@ static void snd_wss_resume(struct snd_wss *chip)
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Yamaha needs this to resume properly */
|
||||
if (chip->hardware == WSS_HW_OPL3SA2)
|
||||
snd_wss_out(chip, CS4231_PLAYBK_FORMAT,
|
||||
chip->image[CS4231_PLAYBK_FORMAT]);
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
#if 1
|
||||
snd_wss_mce_down(chip);
|
||||
|
@@ -69,7 +69,6 @@
|
||||
#include <linux/sound.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/soundcard.h>
|
||||
#include <linux/ac97_codec.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/interrupt.h>
|
||||
@@ -199,6 +198,22 @@ static const char invalid_magic[] =
|
||||
} \
|
||||
})
|
||||
|
||||
/* AC97 registers */
|
||||
#define AC97_MASTER_VOL_STEREO 0x0002 /* Line Out */
|
||||
#define AC97_PCBEEP_VOL 0x000a /* none */
|
||||
#define AC97_PHONE_VOL 0x000c /* TAD Input (mono) */
|
||||
#define AC97_MIC_VOL 0x000e /* MIC Input (mono) */
|
||||
#define AC97_LINEIN_VOL 0x0010 /* Line Input (stereo) */
|
||||
#define AC97_CD_VOL 0x0012 /* CD Input (stereo) */
|
||||
#define AC97_AUX_VOL 0x0016 /* Aux Input (stereo) */
|
||||
#define AC97_PCMOUT_VOL 0x0018 /* Wave Output (stereo) */
|
||||
#define AC97_RECORD_SELECT 0x001a /* */
|
||||
#define AC97_RECORD_GAIN 0x001c
|
||||
#define AC97_GENERAL_PURPOSE 0x0020
|
||||
#define AC97_3D_CONTROL 0x0022
|
||||
#define AC97_POWER_CONTROL 0x0026
|
||||
#define AC97_VENDOR_ID1 0x007c
|
||||
|
||||
struct list_head cs4297a_devs = { &cs4297a_devs, &cs4297a_devs };
|
||||
|
||||
typedef struct serdma_descr_s {
|
||||
|
@@ -10,6 +10,15 @@
|
||||
#include <sound/core.h>
|
||||
#include "au88x0.h"
|
||||
|
||||
static int remove_ctl(struct snd_card *card, const char *name)
|
||||
{
|
||||
struct snd_ctl_elem_id id;
|
||||
memset(&id, 0, sizeof(id));
|
||||
strcpy(id.name, name);
|
||||
id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
|
||||
return snd_ctl_remove_id(card, &id);
|
||||
}
|
||||
|
||||
static int __devinit snd_vortex_mixer(vortex_t * vortex)
|
||||
{
|
||||
struct snd_ac97_bus *pbus;
|
||||
@@ -28,5 +37,7 @@ static int __devinit snd_vortex_mixer(vortex_t * vortex)
|
||||
ac97.scaps = AC97_SCAP_NO_SPDIF;
|
||||
err = snd_ac97_mixer(pbus, &ac97, &vortex->codec);
|
||||
vortex->isquad = ((vortex->codec == NULL) ? 0 : (vortex->codec->ext_id&0x80));
|
||||
remove_ctl(vortex->card, "Master Mono Playback Volume");
|
||||
remove_ctl(vortex->card, "Master Mono Playback Switch");
|
||||
return err;
|
||||
}
|
||||
|
@@ -1321,35 +1321,30 @@ static int snd_es1938_put_double(struct snd_kcontrol *kcontrol,
|
||||
return change;
|
||||
}
|
||||
|
||||
static unsigned int db_scale_master[] = {
|
||||
TLV_DB_RANGE_HEAD(2),
|
||||
static const DECLARE_TLV_DB_RANGE(db_scale_master,
|
||||
0, 54, TLV_DB_SCALE_ITEM(-3600, 50, 1),
|
||||
54, 63, TLV_DB_SCALE_ITEM(-900, 100, 0),
|
||||
};
|
||||
);
|
||||
|
||||
static unsigned int db_scale_audio1[] = {
|
||||
TLV_DB_RANGE_HEAD(2),
|
||||
static const DECLARE_TLV_DB_RANGE(db_scale_audio1,
|
||||
0, 8, TLV_DB_SCALE_ITEM(-3300, 300, 1),
|
||||
8, 15, TLV_DB_SCALE_ITEM(-900, 150, 0),
|
||||
};
|
||||
);
|
||||
|
||||
static unsigned int db_scale_audio2[] = {
|
||||
TLV_DB_RANGE_HEAD(2),
|
||||
static const DECLARE_TLV_DB_RANGE(db_scale_audio2,
|
||||
0, 8, TLV_DB_SCALE_ITEM(-3450, 300, 1),
|
||||
8, 15, TLV_DB_SCALE_ITEM(-1050, 150, 0),
|
||||
};
|
||||
);
|
||||
|
||||
static unsigned int db_scale_mic[] = {
|
||||
TLV_DB_RANGE_HEAD(2),
|
||||
static const DECLARE_TLV_DB_RANGE(db_scale_mic,
|
||||
0, 8, TLV_DB_SCALE_ITEM(-2400, 300, 1),
|
||||
8, 15, TLV_DB_SCALE_ITEM(0, 150, 0),
|
||||
};
|
||||
);
|
||||
|
||||
static unsigned int db_scale_line[] = {
|
||||
TLV_DB_RANGE_HEAD(2),
|
||||
static const DECLARE_TLV_DB_RANGE(db_scale_line,
|
||||
0, 8, TLV_DB_SCALE_ITEM(-3150, 300, 1),
|
||||
8, 15, TLV_DB_SCALE_ITEM(-750, 150, 0),
|
||||
};
|
||||
);
|
||||
|
||||
static const DECLARE_TLV_DB_SCALE(db_scale_capture, 0, 150, 0);
|
||||
|
||||
|
@@ -361,74 +361,6 @@ MODULE_PARM_DESC(amp_gpio, "GPIO pin number for external amp. (default = -1)");
|
||||
#define DSP2HOST_REQ_I2SRATE 0x02
|
||||
#define DSP2HOST_REQ_TIMER 0x04
|
||||
|
||||
/* AC97 registers */
|
||||
/* XXX fix this crap up */
|
||||
/*#define AC97_RESET 0x00*/
|
||||
|
||||
#define AC97_VOL_MUTE_B 0x8000
|
||||
#define AC97_VOL_M 0x1F
|
||||
#define AC97_LEFT_VOL_S 8
|
||||
|
||||
#define AC97_MASTER_VOL 0x02
|
||||
#define AC97_LINE_LEVEL_VOL 0x04
|
||||
#define AC97_MASTER_MONO_VOL 0x06
|
||||
#define AC97_PC_BEEP_VOL 0x0A
|
||||
#define AC97_PC_BEEP_VOL_M 0x0F
|
||||
#define AC97_SROUND_MASTER_VOL 0x38
|
||||
#define AC97_PC_BEEP_VOL_S 1
|
||||
|
||||
/*#define AC97_PHONE_VOL 0x0C
|
||||
#define AC97_MIC_VOL 0x0E*/
|
||||
#define AC97_MIC_20DB_ENABLE 0x40
|
||||
|
||||
/*#define AC97_LINEIN_VOL 0x10
|
||||
#define AC97_CD_VOL 0x12
|
||||
#define AC97_VIDEO_VOL 0x14
|
||||
#define AC97_AUX_VOL 0x16*/
|
||||
#define AC97_PCM_OUT_VOL 0x18
|
||||
/*#define AC97_RECORD_SELECT 0x1A*/
|
||||
#define AC97_RECORD_MIC 0x00
|
||||
#define AC97_RECORD_CD 0x01
|
||||
#define AC97_RECORD_VIDEO 0x02
|
||||
#define AC97_RECORD_AUX 0x03
|
||||
#define AC97_RECORD_MONO_MUX 0x02
|
||||
#define AC97_RECORD_DIGITAL 0x03
|
||||
#define AC97_RECORD_LINE 0x04
|
||||
#define AC97_RECORD_STEREO 0x05
|
||||
#define AC97_RECORD_MONO 0x06
|
||||
#define AC97_RECORD_PHONE 0x07
|
||||
|
||||
/*#define AC97_RECORD_GAIN 0x1C*/
|
||||
#define AC97_RECORD_VOL_M 0x0F
|
||||
|
||||
/*#define AC97_GENERAL_PURPOSE 0x20*/
|
||||
#define AC97_POWER_DOWN_CTRL 0x26
|
||||
#define AC97_ADC_READY 0x0001
|
||||
#define AC97_DAC_READY 0x0002
|
||||
#define AC97_ANALOG_READY 0x0004
|
||||
#define AC97_VREF_ON 0x0008
|
||||
#define AC97_PR0 0x0100
|
||||
#define AC97_PR1 0x0200
|
||||
#define AC97_PR2 0x0400
|
||||
#define AC97_PR3 0x0800
|
||||
#define AC97_PR4 0x1000
|
||||
|
||||
#define AC97_RESERVED1 0x28
|
||||
|
||||
#define AC97_VENDOR_TEST 0x5A
|
||||
|
||||
#define AC97_CLOCK_DELAY 0x5C
|
||||
#define AC97_LINEOUT_MUX_SEL 0x0001
|
||||
#define AC97_MONO_MUX_SEL 0x0002
|
||||
#define AC97_CLOCK_DELAY_SEL 0x1F
|
||||
#define AC97_DAC_CDS_SHIFT 6
|
||||
#define AC97_ADC_CDS_SHIFT 11
|
||||
|
||||
#define AC97_MULTI_CHANNEL_SEL 0x74
|
||||
|
||||
/*#define AC97_VENDOR_ID1 0x7C
|
||||
#define AC97_VENDOR_ID2 0x7E*/
|
||||
|
||||
/*
|
||||
* ASSP control regs
|
||||
*/
|
||||
|
@@ -1368,6 +1368,67 @@ static void pcxhr_proc_gpo_write(struct snd_info_entry *entry,
|
||||
}
|
||||
}
|
||||
|
||||
/* Access to the results of the CMD_GET_TIME_CODE RMH */
|
||||
#define TIME_CODE_VALID_MASK 0x00800000
|
||||
#define TIME_CODE_NEW_MASK 0x00400000
|
||||
#define TIME_CODE_BACK_MASK 0x00200000
|
||||
#define TIME_CODE_WAIT_MASK 0x00100000
|
||||
|
||||
/* Values for the CMD_MANAGE_SIGNAL RMH */
|
||||
#define MANAGE_SIGNAL_TIME_CODE 0x01
|
||||
#define MANAGE_SIGNAL_MIDI 0x02
|
||||
|
||||
/* linear time code read proc*/
|
||||
static void pcxhr_proc_ltc(struct snd_info_entry *entry,
|
||||
struct snd_info_buffer *buffer)
|
||||
{
|
||||
struct snd_pcxhr *chip = entry->private_data;
|
||||
struct pcxhr_mgr *mgr = chip->mgr;
|
||||
struct pcxhr_rmh rmh;
|
||||
unsigned int ltcHrs, ltcMin, ltcSec, ltcFrm;
|
||||
int err;
|
||||
/* commands available when embedded DSP is running */
|
||||
if (!(mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX))) {
|
||||
snd_iprintf(buffer, "no firmware loaded\n");
|
||||
return;
|
||||
}
|
||||
if (!mgr->capture_ltc) {
|
||||
pcxhr_init_rmh(&rmh, CMD_MANAGE_SIGNAL);
|
||||
rmh.cmd[0] |= MANAGE_SIGNAL_TIME_CODE;
|
||||
err = pcxhr_send_msg(mgr, &rmh);
|
||||
if (err) {
|
||||
snd_iprintf(buffer, "ltc not activated (%d)\n", err);
|
||||
return;
|
||||
}
|
||||
if (mgr->is_hr_stereo)
|
||||
hr222_manage_timecode(mgr, 1);
|
||||
else
|
||||
pcxhr_write_io_num_reg_cont(mgr, REG_CONT_VALSMPTE,
|
||||
REG_CONT_VALSMPTE, NULL);
|
||||
mgr->capture_ltc = 1;
|
||||
}
|
||||
pcxhr_init_rmh(&rmh, CMD_GET_TIME_CODE);
|
||||
err = pcxhr_send_msg(mgr, &rmh);
|
||||
if (err) {
|
||||
snd_iprintf(buffer, "ltc read error (err=%d)\n", err);
|
||||
return ;
|
||||
}
|
||||
ltcHrs = 10*((rmh.stat[0] >> 8) & 0x3) + (rmh.stat[0] & 0xf);
|
||||
ltcMin = 10*((rmh.stat[1] >> 16) & 0x7) + ((rmh.stat[1] >> 8) & 0xf);
|
||||
ltcSec = 10*(rmh.stat[1] & 0x7) + ((rmh.stat[2] >> 16) & 0xf);
|
||||
ltcFrm = 10*((rmh.stat[2] >> 8) & 0x3) + (rmh.stat[2] & 0xf);
|
||||
|
||||
snd_iprintf(buffer, "timecode: %02u:%02u:%02u-%02u\n",
|
||||
ltcHrs, ltcMin, ltcSec, ltcFrm);
|
||||
snd_iprintf(buffer, "raw: 0x%04x%06x%06x\n", rmh.stat[0] & 0x00ffff,
|
||||
rmh.stat[1] & 0xffffff, rmh.stat[2] & 0xffffff);
|
||||
/*snd_iprintf(buffer, "dsp ref time: 0x%06x%06x\n",
|
||||
rmh.stat[3] & 0xffffff, rmh.stat[4] & 0xffffff);*/
|
||||
if (!(rmh.stat[0] & TIME_CODE_VALID_MASK)) {
|
||||
snd_iprintf(buffer, "warning: linear timecode not valid\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip)
|
||||
{
|
||||
struct snd_info_entry *entry;
|
||||
@@ -1383,6 +1444,8 @@ static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip)
|
||||
entry->c.text.write = pcxhr_proc_gpo_write;
|
||||
entry->mode |= S_IWUSR;
|
||||
}
|
||||
if (!snd_card_proc_new(chip->card, "ltc", &entry))
|
||||
snd_info_set_text_ops(entry, chip, pcxhr_proc_ltc);
|
||||
}
|
||||
/* end of proc interface */
|
||||
|
||||
|
@@ -103,6 +103,7 @@ struct pcxhr_mgr {
|
||||
unsigned int board_has_mic:1; /* if 1 the board has microphone input */
|
||||
unsigned int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */
|
||||
unsigned int mono_capture:1; /* if 1 the board does mono capture */
|
||||
unsigned int capture_ltc:1; /* if 1 the board captures LTC input */
|
||||
|
||||
struct snd_dma_buffer hostport;
|
||||
|
||||
|
@@ -504,6 +504,8 @@ static struct pcxhr_cmd_info pcxhr_dsp_cmds[] = {
|
||||
[CMD_FORMAT_STREAM_IN] = { 0x870000, 0, RMH_SSIZE_FIXED },
|
||||
[CMD_STREAM_SAMPLE_COUNT] = { 0x902000, 2, RMH_SSIZE_FIXED },
|
||||
[CMD_AUDIO_LEVEL_ADJUST] = { 0xc22000, 0, RMH_SSIZE_FIXED },
|
||||
[CMD_GET_TIME_CODE] = { 0x060000, 5, RMH_SSIZE_FIXED },
|
||||
[CMD_MANAGE_SIGNAL] = { 0x0f0000, 0, RMH_SSIZE_FIXED },
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SND_DEBUG_VERBOSE
|
||||
@@ -533,6 +535,8 @@ static char* cmd_names[] = {
|
||||
[CMD_FORMAT_STREAM_IN] = "CMD_FORMAT_STREAM_IN",
|
||||
[CMD_STREAM_SAMPLE_COUNT] = "CMD_STREAM_SAMPLE_COUNT",
|
||||
[CMD_AUDIO_LEVEL_ADJUST] = "CMD_AUDIO_LEVEL_ADJUST",
|
||||
[CMD_GET_TIME_CODE] = "CMD_GET_TIME_CODE",
|
||||
[CMD_MANAGE_SIGNAL] = "CMD_MANAGE_SIGNAL",
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1133,13 +1137,12 @@ static u_int64_t pcxhr_stream_read_position(struct pcxhr_mgr *mgr,
|
||||
hw_sample_count = ((u_int64_t)rmh.stat[0]) << 24;
|
||||
hw_sample_count += (u_int64_t)rmh.stat[1];
|
||||
|
||||
snd_printdd("stream %c%d : abs samples real(%ld) timer(%ld)\n",
|
||||
snd_printdd("stream %c%d : abs samples real(%llu) timer(%llu)\n",
|
||||
stream->pipe->is_capture ? 'C' : 'P',
|
||||
stream->substream->number,
|
||||
(long unsigned int)hw_sample_count,
|
||||
(long unsigned int)(stream->timer_abs_periods +
|
||||
stream->timer_period_frag +
|
||||
mgr->granularity));
|
||||
hw_sample_count,
|
||||
stream->timer_abs_periods + stream->timer_period_frag +
|
||||
mgr->granularity);
|
||||
return hw_sample_count;
|
||||
}
|
||||
|
||||
@@ -1243,10 +1246,18 @@ irqreturn_t pcxhr_interrupt(int irq, void *dev_id)
|
||||
|
||||
if ((dsp_time_diff < 0) &&
|
||||
(mgr->dsp_time_last != PCXHR_DSP_TIME_INVALID)) {
|
||||
snd_printdd("ERROR DSP TIME old(%d) new(%d) -> "
|
||||
"resynchronize all streams\n",
|
||||
/* handle dsp counter wraparound without resync */
|
||||
int tmp_diff = dsp_time_diff + PCXHR_DSP_TIME_MASK + 1;
|
||||
snd_printdd("WARNING DSP timestamp old(%d) new(%d)",
|
||||
mgr->dsp_time_last, dsp_time_new);
|
||||
mgr->dsp_time_err++;
|
||||
if (tmp_diff > 0 && tmp_diff <= (2*mgr->granularity)) {
|
||||
snd_printdd("-> timestamp wraparound OK: "
|
||||
"diff=%d\n", tmp_diff);
|
||||
dsp_time_diff = tmp_diff;
|
||||
} else {
|
||||
snd_printdd("-> resynchronize all streams\n");
|
||||
mgr->dsp_time_err++;
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_SND_DEBUG_VERBOSE
|
||||
if (dsp_time_diff == 0)
|
||||
|
@@ -79,6 +79,8 @@ enum {
|
||||
CMD_FORMAT_STREAM_IN, /* cmd_len >= 4 stat_len = 0 */
|
||||
CMD_STREAM_SAMPLE_COUNT, /* cmd_len = 2 stat_len = (2 * nb_stream) */
|
||||
CMD_AUDIO_LEVEL_ADJUST, /* cmd_len = 3 stat_len = 0 */
|
||||
CMD_GET_TIME_CODE, /* cmd_len = 1 stat_len = 5 */
|
||||
CMD_MANAGE_SIGNAL, /* cmd_len = 1 stat_len = 0 */
|
||||
CMD_LAST_INDEX
|
||||
};
|
||||
|
||||
@@ -116,7 +118,7 @@ int pcxhr_send_msg(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh);
|
||||
#define IO_NUM_REG_OUT_ANA_LEVEL 20
|
||||
#define IO_NUM_REG_IN_ANA_LEVEL 21
|
||||
|
||||
|
||||
#define REG_CONT_VALSMPTE 0x000800
|
||||
#define REG_CONT_UNMUTE_INPUTS 0x020000
|
||||
|
||||
/* parameters used with register IO_NUM_REG_STATUS */
|
||||
|
@@ -53,6 +53,7 @@
|
||||
#define PCXHR_DSP_RESET_DSP 0x01
|
||||
#define PCXHR_DSP_RESET_MUTE 0x02
|
||||
#define PCXHR_DSP_RESET_CODEC 0x08
|
||||
#define PCXHR_DSP_RESET_SMPTE 0x10
|
||||
#define PCXHR_DSP_RESET_GPO_OFFSET 5
|
||||
#define PCXHR_DSP_RESET_GPO_MASK 0x60
|
||||
|
||||
@@ -527,6 +528,16 @@ int hr222_write_gpo(struct pcxhr_mgr *mgr, int value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hr222_manage_timecode(struct pcxhr_mgr *mgr, int enable)
|
||||
{
|
||||
if (enable)
|
||||
mgr->dsp_reset |= PCXHR_DSP_RESET_SMPTE;
|
||||
else
|
||||
mgr->dsp_reset &= ~PCXHR_DSP_RESET_SMPTE;
|
||||
|
||||
PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, mgr->dsp_reset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hr222_update_analog_audio_level(struct snd_pcxhr *chip,
|
||||
int is_capture, int channel)
|
||||
|
@@ -34,6 +34,7 @@ int hr222_get_external_clock(struct pcxhr_mgr *mgr,
|
||||
|
||||
int hr222_read_gpio(struct pcxhr_mgr *mgr, int is_gpi, int *value);
|
||||
int hr222_write_gpo(struct pcxhr_mgr *mgr, int value);
|
||||
int hr222_manage_timecode(struct pcxhr_mgr *mgr, int enable);
|
||||
|
||||
#define HR222_LINE_PLAYBACK_LEVEL_MIN 0 /* -25.5 dB */
|
||||
#define HR222_LINE_PLAYBACK_ZERO_LEVEL 51 /* 0.0 dB */
|
||||
|
@@ -485,7 +485,7 @@ static int __devinit snd_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
int ret;
|
||||
struct snd_card *card;
|
||||
struct snd_card *card = NULL;
|
||||
struct usb_device *device = interface_to_usbdev(intf);
|
||||
|
||||
ret = create_card(device, intf, &card);
|
||||
|
@@ -42,6 +42,13 @@
|
||||
|
||||
extern struct snd_kcontrol_new *snd_usb_feature_unit_ctl;
|
||||
|
||||
struct std_mono_table {
|
||||
unsigned int unitid, control, cmask;
|
||||
int val_type;
|
||||
const char *name;
|
||||
snd_kcontrol_tlv_rw_t *tlv_callback;
|
||||
};
|
||||
|
||||
/* private_free callback */
|
||||
static void usb_mixer_elem_free(struct snd_kcontrol *kctl)
|
||||
{
|
||||
@@ -113,6 +120,25 @@ static int snd_create_std_mono_ctl(struct usb_mixer_interface *mixer,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a set of standard UAC controls from a table
|
||||
*/
|
||||
static int snd_create_std_mono_table(struct usb_mixer_interface *mixer,
|
||||
struct std_mono_table *t)
|
||||
{
|
||||
int err;
|
||||
|
||||
while (t->name != NULL) {
|
||||
err = snd_create_std_mono_ctl(mixer, t->unitid, t->control,
|
||||
t->cmask, t->val_type, t->name, t->tlv_callback);
|
||||
if (err < 0)
|
||||
return err;
|
||||
t++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sound Blaster remote control configuration
|
||||
*
|
||||
@@ -916,61 +942,6 @@ static int snd_ftu_create_mixer(struct usb_mixer_interface *mixer)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create mixer for Electrix Ebox-44
|
||||
*
|
||||
* The mixer units from this device are corrupt, and even where they
|
||||
* are valid they presents mono controls as L and R channels of
|
||||
* stereo. So we create a good mixer in code.
|
||||
*/
|
||||
|
||||
static int snd_ebox44_create_mixer(struct usb_mixer_interface *mixer)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = snd_create_std_mono_ctl(mixer, 4, 1, 0x0, USB_MIXER_INV_BOOLEAN,
|
||||
"Headphone Playback Switch", NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_create_std_mono_ctl(mixer, 4, 2, 0x1, USB_MIXER_S16,
|
||||
"Headphone A Mix Playback Volume", NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_create_std_mono_ctl(mixer, 4, 2, 0x2, USB_MIXER_S16,
|
||||
"Headphone B Mix Playback Volume", NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = snd_create_std_mono_ctl(mixer, 7, 1, 0x0, USB_MIXER_INV_BOOLEAN,
|
||||
"Output Playback Switch", NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_create_std_mono_ctl(mixer, 7, 2, 0x1, USB_MIXER_S16,
|
||||
"Output A Playback Volume", NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_create_std_mono_ctl(mixer, 7, 2, 0x2, USB_MIXER_S16,
|
||||
"Output B Playback Volume", NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = snd_create_std_mono_ctl(mixer, 10, 1, 0x0, USB_MIXER_INV_BOOLEAN,
|
||||
"Input Capture Switch", NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_create_std_mono_ctl(mixer, 10, 2, 0x1, USB_MIXER_S16,
|
||||
"Input A Capture Volume", NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_create_std_mono_ctl(mixer, 10, 2, 0x2, USB_MIXER_S16,
|
||||
"Input B Capture Volume", NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
|
||||
unsigned char samplerate_id)
|
||||
{
|
||||
@@ -990,6 +961,81 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The mixer units for Ebox-44 are corrupt, and even where they
|
||||
* are valid they presents mono controls as L and R channels of
|
||||
* stereo. So we provide a good mixer here.
|
||||
*/
|
||||
struct std_mono_table ebox44_table[] = {
|
||||
{
|
||||
.unitid = 4,
|
||||
.control = 1,
|
||||
.cmask = 0x0,
|
||||
.val_type = USB_MIXER_INV_BOOLEAN,
|
||||
.name = "Headphone Playback Switch"
|
||||
},
|
||||
{
|
||||
.unitid = 4,
|
||||
.control = 2,
|
||||
.cmask = 0x1,
|
||||
.val_type = USB_MIXER_S16,
|
||||
.name = "Headphone A Mix Playback Volume"
|
||||
},
|
||||
{
|
||||
.unitid = 4,
|
||||
.control = 2,
|
||||
.cmask = 0x2,
|
||||
.val_type = USB_MIXER_S16,
|
||||
.name = "Headphone B Mix Playback Volume"
|
||||
},
|
||||
|
||||
{
|
||||
.unitid = 7,
|
||||
.control = 1,
|
||||
.cmask = 0x0,
|
||||
.val_type = USB_MIXER_INV_BOOLEAN,
|
||||
.name = "Output Playback Switch"
|
||||
},
|
||||
{
|
||||
.unitid = 7,
|
||||
.control = 2,
|
||||
.cmask = 0x1,
|
||||
.val_type = USB_MIXER_S16,
|
||||
.name = "Output A Playback Volume"
|
||||
},
|
||||
{
|
||||
.unitid = 7,
|
||||
.control = 2,
|
||||
.cmask = 0x2,
|
||||
.val_type = USB_MIXER_S16,
|
||||
.name = "Output B Playback Volume"
|
||||
},
|
||||
|
||||
{
|
||||
.unitid = 10,
|
||||
.control = 1,
|
||||
.cmask = 0x0,
|
||||
.val_type = USB_MIXER_INV_BOOLEAN,
|
||||
.name = "Input Capture Switch"
|
||||
},
|
||||
{
|
||||
.unitid = 10,
|
||||
.control = 2,
|
||||
.cmask = 0x1,
|
||||
.val_type = USB_MIXER_S16,
|
||||
.name = "Input A Capture Volume"
|
||||
},
|
||||
{
|
||||
.unitid = 10,
|
||||
.control = 2,
|
||||
.cmask = 0x2,
|
||||
.val_type = USB_MIXER_S16,
|
||||
.name = "Input B Capture Volume"
|
||||
},
|
||||
|
||||
{}
|
||||
};
|
||||
|
||||
int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
|
||||
{
|
||||
int err = 0;
|
||||
@@ -1035,7 +1081,8 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
|
||||
break;
|
||||
|
||||
case USB_ID(0x200c, 0x1018): /* Electrix Ebox-44 */
|
||||
err = snd_ebox44_create_mixer(mixer);
|
||||
/* detection is disabled in mixer_maps.c */
|
||||
err = snd_create_std_mono_table(mixer, ebox44_table);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user