mirror of
https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
synced 2025-10-28 23:08:52 +01:00
Fixed MTP to work with TWRP
This commit is contained in:
commit
f6dfaef42e
50820 changed files with 20846062 additions and 0 deletions
8
sound/pci/vx222/Makefile
Normal file
8
sound/pci/vx222/Makefile
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#
|
||||
# Makefile for ALSA
|
||||
# Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
|
||||
#
|
||||
|
||||
snd-vx222-objs := vx222.o vx222_ops.o
|
||||
|
||||
obj-$(CONFIG_SND_VX222) += snd-vx222.o
|
||||
307
sound/pci/vx222/vx222.c
Normal file
307
sound/pci/vx222/vx222.c
Normal file
|
|
@ -0,0 +1,307 @@
|
|||
/*
|
||||
* Driver for Digigram VX222 V2/Mic PCI soundcards
|
||||
*
|
||||
* Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/initval.h>
|
||||
#include <sound/tlv.h>
|
||||
#include "vx222.h"
|
||||
|
||||
#define CARD_NAME "VX222"
|
||||
|
||||
MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
|
||||
MODULE_DESCRIPTION("Digigram VX222 V2/Mic");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}");
|
||||
|
||||
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
|
||||
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
|
||||
static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
|
||||
static bool mic[SNDRV_CARDS]; /* microphone */
|
||||
static int ibl[SNDRV_CARDS]; /* microphone */
|
||||
|
||||
module_param_array(index, int, NULL, 0444);
|
||||
MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard.");
|
||||
module_param_array(id, charp, NULL, 0444);
|
||||
MODULE_PARM_DESC(id, "ID string for Digigram " CARD_NAME " soundcard.");
|
||||
module_param_array(enable, bool, NULL, 0444);
|
||||
MODULE_PARM_DESC(enable, "Enable Digigram " CARD_NAME " soundcard.");
|
||||
module_param_array(mic, bool, NULL, 0444);
|
||||
MODULE_PARM_DESC(mic, "Enable Microphone.");
|
||||
module_param_array(ibl, int, NULL, 0444);
|
||||
MODULE_PARM_DESC(ibl, "Capture IBL size.");
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
enum {
|
||||
VX_PCI_VX222_OLD,
|
||||
VX_PCI_VX222_NEW
|
||||
};
|
||||
|
||||
static const struct pci_device_id snd_vx222_ids[] = {
|
||||
{ 0x10b5, 0x9050, 0x1369, PCI_ANY_ID, 0, 0, VX_PCI_VX222_OLD, }, /* PLX */
|
||||
{ 0x10b5, 0x9030, 0x1369, PCI_ANY_ID, 0, 0, VX_PCI_VX222_NEW, }, /* PLX */
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, snd_vx222_ids);
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
static const DECLARE_TLV_DB_SCALE(db_scale_old_vol, -11350, 50, 0);
|
||||
static const DECLARE_TLV_DB_SCALE(db_scale_akm, -7350, 50, 0);
|
||||
|
||||
static struct snd_vx_hardware vx222_old_hw = {
|
||||
|
||||
.name = "VX222/Old",
|
||||
.type = VX_TYPE_BOARD,
|
||||
/* hw specs */
|
||||
.num_codecs = 1,
|
||||
.num_ins = 1,
|
||||
.num_outs = 1,
|
||||
.output_level_max = VX_ANALOG_OUT_LEVEL_MAX,
|
||||
.output_level_db_scale = db_scale_old_vol,
|
||||
};
|
||||
|
||||
static struct snd_vx_hardware vx222_v2_hw = {
|
||||
|
||||
.name = "VX222/v2",
|
||||
.type = VX_TYPE_V2,
|
||||
/* hw specs */
|
||||
.num_codecs = 1,
|
||||
.num_ins = 1,
|
||||
.num_outs = 1,
|
||||
.output_level_max = VX2_AKM_LEVEL_MAX,
|
||||
.output_level_db_scale = db_scale_akm,
|
||||
};
|
||||
|
||||
static struct snd_vx_hardware vx222_mic_hw = {
|
||||
|
||||
.name = "VX222/Mic",
|
||||
.type = VX_TYPE_MIC,
|
||||
/* hw specs */
|
||||
.num_codecs = 1,
|
||||
.num_ins = 1,
|
||||
.num_outs = 1,
|
||||
.output_level_max = VX2_AKM_LEVEL_MAX,
|
||||
.output_level_db_scale = db_scale_akm,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
static int snd_vx222_free(struct vx_core *chip)
|
||||
{
|
||||
struct snd_vx222 *vx = (struct snd_vx222 *)chip;
|
||||
|
||||
if (chip->irq >= 0)
|
||||
free_irq(chip->irq, (void*)chip);
|
||||
if (vx->port[0])
|
||||
pci_release_regions(vx->pci);
|
||||
pci_disable_device(vx->pci);
|
||||
kfree(chip);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_vx222_dev_free(struct snd_device *device)
|
||||
{
|
||||
struct vx_core *chip = device->device_data;
|
||||
return snd_vx222_free(chip);
|
||||
}
|
||||
|
||||
|
||||
static int snd_vx222_create(struct snd_card *card, struct pci_dev *pci,
|
||||
struct snd_vx_hardware *hw,
|
||||
struct snd_vx222 **rchip)
|
||||
{
|
||||
struct vx_core *chip;
|
||||
struct snd_vx222 *vx;
|
||||
int i, err;
|
||||
static struct snd_device_ops ops = {
|
||||
.dev_free = snd_vx222_dev_free,
|
||||
};
|
||||
struct snd_vx_ops *vx_ops;
|
||||
|
||||
/* enable PCI device */
|
||||
if ((err = pci_enable_device(pci)) < 0)
|
||||
return err;
|
||||
pci_set_master(pci);
|
||||
|
||||
vx_ops = hw->type == VX_TYPE_BOARD ? &vx222_old_ops : &vx222_ops;
|
||||
chip = snd_vx_create(card, hw, vx_ops,
|
||||
sizeof(struct snd_vx222) - sizeof(struct vx_core));
|
||||
if (! chip) {
|
||||
pci_disable_device(pci);
|
||||
return -ENOMEM;
|
||||
}
|
||||
vx = (struct snd_vx222 *)chip;
|
||||
vx->pci = pci;
|
||||
|
||||
if ((err = pci_request_regions(pci, CARD_NAME)) < 0) {
|
||||
snd_vx222_free(chip);
|
||||
return err;
|
||||
}
|
||||
for (i = 0; i < 2; i++)
|
||||
vx->port[i] = pci_resource_start(pci, i + 1);
|
||||
|
||||
if (request_threaded_irq(pci->irq, snd_vx_irq_handler,
|
||||
snd_vx_threaded_irq_handler, IRQF_SHARED,
|
||||
KBUILD_MODNAME, chip)) {
|
||||
dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
|
||||
snd_vx222_free(chip);
|
||||
return -EBUSY;
|
||||
}
|
||||
chip->irq = pci->irq;
|
||||
|
||||
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
|
||||
snd_vx222_free(chip);
|
||||
return err;
|
||||
}
|
||||
|
||||
*rchip = vx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int snd_vx222_probe(struct pci_dev *pci,
|
||||
const struct pci_device_id *pci_id)
|
||||
{
|
||||
static int dev;
|
||||
struct snd_card *card;
|
||||
struct snd_vx_hardware *hw;
|
||||
struct snd_vx222 *vx;
|
||||
int err;
|
||||
|
||||
if (dev >= SNDRV_CARDS)
|
||||
return -ENODEV;
|
||||
if (!enable[dev]) {
|
||||
dev++;
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
||||
0, &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
switch ((int)pci_id->driver_data) {
|
||||
case VX_PCI_VX222_OLD:
|
||||
hw = &vx222_old_hw;
|
||||
break;
|
||||
case VX_PCI_VX222_NEW:
|
||||
default:
|
||||
if (mic[dev])
|
||||
hw = &vx222_mic_hw;
|
||||
else
|
||||
hw = &vx222_v2_hw;
|
||||
break;
|
||||
}
|
||||
if ((err = snd_vx222_create(card, pci, hw, &vx)) < 0) {
|
||||
snd_card_free(card);
|
||||
return err;
|
||||
}
|
||||
card->private_data = vx;
|
||||
vx->core.ibl.size = ibl[dev];
|
||||
|
||||
sprintf(card->longname, "%s at 0x%lx & 0x%lx, irq %i",
|
||||
card->shortname, vx->port[0], vx->port[1], vx->core.irq);
|
||||
dev_dbg(card->dev, "%s at 0x%lx & 0x%lx, irq %i\n",
|
||||
card->shortname, vx->port[0], vx->port[1], vx->core.irq);
|
||||
|
||||
#ifdef SND_VX_FW_LOADER
|
||||
vx->core.dev = &pci->dev;
|
||||
#endif
|
||||
|
||||
if ((err = snd_vx_setup_firmware(&vx->core)) < 0) {
|
||||
snd_card_free(card);
|
||||
return err;
|
||||
}
|
||||
|
||||
if ((err = snd_card_register(card)) < 0) {
|
||||
snd_card_free(card);
|
||||
return err;
|
||||
}
|
||||
|
||||
pci_set_drvdata(pci, card);
|
||||
dev++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void snd_vx222_remove(struct pci_dev *pci)
|
||||
{
|
||||
snd_card_free(pci_get_drvdata(pci));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int snd_vx222_suspend(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci = to_pci_dev(dev);
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
struct snd_vx222 *vx = card->private_data;
|
||||
int err;
|
||||
|
||||
err = snd_vx_suspend(&vx->core);
|
||||
pci_disable_device(pci);
|
||||
pci_save_state(pci);
|
||||
pci_set_power_state(pci, PCI_D3hot);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int snd_vx222_resume(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci = to_pci_dev(dev);
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
struct snd_vx222 *vx = card->private_data;
|
||||
|
||||
pci_set_power_state(pci, PCI_D0);
|
||||
pci_restore_state(pci);
|
||||
if (pci_enable_device(pci) < 0) {
|
||||
dev_err(dev, "pci_enable_device failed, disabling device\n");
|
||||
snd_card_disconnect(card);
|
||||
return -EIO;
|
||||
}
|
||||
pci_set_master(pci);
|
||||
return snd_vx_resume(&vx->core);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(snd_vx222_pm, snd_vx222_suspend, snd_vx222_resume);
|
||||
#define SND_VX222_PM_OPS &snd_vx222_pm
|
||||
#else
|
||||
#define SND_VX222_PM_OPS NULL
|
||||
#endif
|
||||
|
||||
static struct pci_driver vx222_driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.id_table = snd_vx222_ids,
|
||||
.probe = snd_vx222_probe,
|
||||
.remove = snd_vx222_remove,
|
||||
.driver = {
|
||||
.pm = SND_VX222_PM_OPS,
|
||||
},
|
||||
};
|
||||
|
||||
module_pci_driver(vx222_driver);
|
||||
114
sound/pci/vx222/vx222.h
Normal file
114
sound/pci/vx222/vx222.h
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Driver for Digigram VX222 PCI soundcards
|
||||
*
|
||||
* Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __VX222_H
|
||||
#define __VX222_H
|
||||
|
||||
#include <sound/vx_core.h>
|
||||
|
||||
struct snd_vx222 {
|
||||
|
||||
struct vx_core core;
|
||||
|
||||
/* h/w config; for PLX and for DSP */
|
||||
struct pci_dev *pci;
|
||||
unsigned long port[2];
|
||||
|
||||
unsigned int regCDSP; /* current CDSP register */
|
||||
unsigned int regCFG; /* current CFG register */
|
||||
unsigned int regSELMIC; /* current SELMIC reg. (for VX222 Mic) */
|
||||
|
||||
int input_level[2]; /* input level for vx222 mic */
|
||||
int mic_level; /* mic level for vx222 mic */
|
||||
};
|
||||
|
||||
/* we use a lookup table with 148 values, see vx_mixer.c */
|
||||
#define VX2_AKM_LEVEL_MAX 0x93
|
||||
|
||||
extern struct snd_vx_ops vx222_ops;
|
||||
extern struct snd_vx_ops vx222_old_ops;
|
||||
|
||||
/* Offset of registers with base equal to portDSP. */
|
||||
#define VX_RESET_DMA_REGISTER_OFFSET 0x00000008
|
||||
|
||||
/* Constants used to access the INTCSR register. */
|
||||
#define VX_INTCSR_VALUE 0x00000001
|
||||
#define VX_PCI_INTERRUPT_MASK 0x00000040
|
||||
|
||||
/* Constants used to access the CDSP register (0x20). */
|
||||
#define VX_CDSP_TEST1_MASK 0x00000080
|
||||
#define VX_CDSP_TOR1_MASK 0x00000040
|
||||
#define VX_CDSP_TOR2_MASK 0x00000020
|
||||
#define VX_CDSP_RESERVED0_0_MASK 0x00000010
|
||||
#define VX_CDSP_CODEC_RESET_MASK 0x00000008
|
||||
#define VX_CDSP_VALID_IRQ_MASK 0x00000004
|
||||
#define VX_CDSP_TEST0_MASK 0x00000002
|
||||
#define VX_CDSP_DSP_RESET_MASK 0x00000001
|
||||
|
||||
#define VX_CDSP_GPIO_OUT_MASK 0x00000060
|
||||
#define VX_GPIO_OUT_BIT_OFFSET 5 // transform output to bit 0 and 1
|
||||
|
||||
/* Constants used to access the CFG register (0x24). */
|
||||
#define VX_CFG_SYNCDSP_MASK 0x00000080
|
||||
#define VX_CFG_RESERVED0_0_MASK 0x00000040
|
||||
#define VX_CFG_RESERVED1_0_MASK 0x00000020
|
||||
#define VX_CFG_RESERVED2_0_MASK 0x00000010
|
||||
#define VX_CFG_DATAIN_SEL_MASK 0x00000008 // 0 (ana), 1 (UER)
|
||||
#define VX_CFG_RESERVED3_0_MASK 0x00000004
|
||||
#define VX_CFG_RESERVED4_0_MASK 0x00000002
|
||||
#define VX_CFG_CLOCKIN_SEL_MASK 0x00000001 // 0 (internal), 1 (AES/EBU)
|
||||
|
||||
/* Constants used to access the STATUS register (0x30). */
|
||||
#define VX_STATUS_DATA_XICOR_MASK 0x00000080
|
||||
#define VX_STATUS_VAL_TEST1_MASK 0x00000040
|
||||
#define VX_STATUS_VAL_TEST0_MASK 0x00000020
|
||||
#define VX_STATUS_RESERVED0_MASK 0x00000010
|
||||
#define VX_STATUS_VAL_TOR1_MASK 0x00000008
|
||||
#define VX_STATUS_VAL_TOR0_MASK 0x00000004
|
||||
#define VX_STATUS_LEVEL_IN_MASK 0x00000002 // 6 dBu (0), 22 dBu (1)
|
||||
#define VX_STATUS_MEMIRQ_MASK 0x00000001
|
||||
|
||||
#define VX_STATUS_GPIO_IN_MASK 0x0000000C
|
||||
#define VX_GPIO_IN_BIT_OFFSET 0 // leave input as bit 2 and 3
|
||||
|
||||
/* Constants used to access the MICRO INPUT SELECT register (0x40). */
|
||||
#define MICRO_SELECT_INPUT_NORM 0x00
|
||||
#define MICRO_SELECT_INPUT_MUTE 0x01
|
||||
#define MICRO_SELECT_INPUT_LIMIT 0x02
|
||||
#define MICRO_SELECT_INPUT_MASK 0x03
|
||||
|
||||
#define MICRO_SELECT_PREAMPLI_G_0 0x00
|
||||
#define MICRO_SELECT_PREAMPLI_G_1 0x04
|
||||
#define MICRO_SELECT_PREAMPLI_G_2 0x08
|
||||
#define MICRO_SELECT_PREAMPLI_G_3 0x0C
|
||||
#define MICRO_SELECT_PREAMPLI_MASK 0x0C
|
||||
#define MICRO_SELECT_PREAMPLI_OFFSET 2
|
||||
|
||||
#define MICRO_SELECT_RAISE_COMPR 0x10
|
||||
|
||||
#define MICRO_SELECT_NOISE_T_52DB 0x00
|
||||
#define MICRO_SELECT_NOISE_T_42DB 0x20
|
||||
#define MICRO_SELECT_NOISE_T_32DB 0x40
|
||||
#define MICRO_SELECT_NOISE_T_MASK 0x60
|
||||
|
||||
#define MICRO_SELECT_PHANTOM_ALIM 0x80
|
||||
|
||||
|
||||
#endif /* __VX222_H */
|
||||
1032
sound/pci/vx222/vx222_ops.c
Normal file
1032
sound/pci/vx222/vx222_ops.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue