ALSA: ctxfi - Remove useless initializations and cast
Remove useless variable initializations and cast at the beginning of functions. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Родитель
4836ac6554
Коммит
514eef9c2a
|
@ -58,9 +58,9 @@ static struct rsc_ops amixer_basic_rsc_ops = {
|
||||||
|
|
||||||
static int amixer_set_input(struct amixer *amixer, struct rsc *rsc)
|
static int amixer_set_input(struct amixer *amixer, struct rsc *rsc)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)amixer->rsc.hw;
|
hw = amixer->rsc.hw;
|
||||||
hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE);
|
hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE);
|
||||||
amixer->input = rsc;
|
amixer->input = rsc;
|
||||||
if (NULL == rsc)
|
if (NULL == rsc)
|
||||||
|
@ -75,9 +75,9 @@ static int amixer_set_input(struct amixer *amixer, struct rsc *rsc)
|
||||||
/* y is a 14-bit immediate constant */
|
/* y is a 14-bit immediate constant */
|
||||||
static int amixer_set_y(struct amixer *amixer, unsigned int y)
|
static int amixer_set_y(struct amixer *amixer, unsigned int y)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)amixer->rsc.hw;
|
hw = amixer->rsc.hw;
|
||||||
hw->amixer_set_y(amixer->rsc.ctrl_blk, y);
|
hw->amixer_set_y(amixer->rsc.ctrl_blk, y);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -85,9 +85,9 @@ static int amixer_set_y(struct amixer *amixer, unsigned int y)
|
||||||
|
|
||||||
static int amixer_set_invalid_squash(struct amixer *amixer, unsigned int iv)
|
static int amixer_set_invalid_squash(struct amixer *amixer, unsigned int iv)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)amixer->rsc.hw;
|
hw = amixer->rsc.hw;
|
||||||
hw->amixer_set_iv(amixer->rsc.ctrl_blk, iv);
|
hw->amixer_set_iv(amixer->rsc.ctrl_blk, iv);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -95,9 +95,9 @@ static int amixer_set_invalid_squash(struct amixer *amixer, unsigned int iv)
|
||||||
|
|
||||||
static int amixer_set_sum(struct amixer *amixer, struct sum *sum)
|
static int amixer_set_sum(struct amixer *amixer, struct sum *sum)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)amixer->rsc.hw;
|
hw = amixer->rsc.hw;
|
||||||
amixer->sum = sum;
|
amixer->sum = sum;
|
||||||
if (NULL == sum) {
|
if (NULL == sum) {
|
||||||
hw->amixer_set_se(amixer->rsc.ctrl_blk, 0);
|
hw->amixer_set_se(amixer->rsc.ctrl_blk, 0);
|
||||||
|
@ -112,13 +112,13 @@ static int amixer_set_sum(struct amixer *amixer, struct sum *sum)
|
||||||
|
|
||||||
static int amixer_commit_write(struct amixer *amixer)
|
static int amixer_commit_write(struct amixer *amixer)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
unsigned int index = 0;
|
unsigned int index;
|
||||||
int i = 0;
|
int i;
|
||||||
struct rsc *input = NULL;
|
struct rsc *input;
|
||||||
struct sum *sum = NULL;
|
struct sum *sum;
|
||||||
|
|
||||||
hw = (struct hw *)amixer->rsc.hw;
|
hw = amixer->rsc.hw;
|
||||||
input = amixer->input;
|
input = amixer->input;
|
||||||
sum = amixer->sum;
|
sum = amixer->sum;
|
||||||
|
|
||||||
|
@ -158,10 +158,10 @@ static int amixer_commit_write(struct amixer *amixer)
|
||||||
|
|
||||||
static int amixer_commit_raw_write(struct amixer *amixer)
|
static int amixer_commit_raw_write(struct amixer *amixer)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
unsigned int index = 0;
|
unsigned int index;
|
||||||
|
|
||||||
hw = (struct hw *)amixer->rsc.hw;
|
hw = amixer->rsc.hw;
|
||||||
index = amixer->rsc.ops->output_slot(&amixer->rsc);
|
index = amixer->rsc.ops->output_slot(&amixer->rsc);
|
||||||
hw->amixer_commit_write(hw, index, amixer->rsc.ctrl_blk);
|
hw->amixer_commit_write(hw, index, amixer->rsc.ctrl_blk);
|
||||||
|
|
||||||
|
@ -170,9 +170,9 @@ static int amixer_commit_raw_write(struct amixer *amixer)
|
||||||
|
|
||||||
static int amixer_get_y(struct amixer *amixer)
|
static int amixer_get_y(struct amixer *amixer)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)amixer->rsc.hw;
|
hw = amixer->rsc.hw;
|
||||||
return hw->amixer_get_y(amixer->rsc.ctrl_blk);
|
return hw->amixer_get_y(amixer->rsc.ctrl_blk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ static int amixer_rsc_init(struct amixer *amixer,
|
||||||
const struct amixer_desc *desc,
|
const struct amixer_desc *desc,
|
||||||
struct amixer_mgr *mgr)
|
struct amixer_mgr *mgr)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
err = rsc_init(&amixer->rsc, amixer->idx[0],
|
err = rsc_init(&amixer->rsc, amixer->idx[0],
|
||||||
AMIXER, desc->msr, mgr->mgr.hw);
|
AMIXER, desc->msr, mgr->mgr.hw);
|
||||||
|
@ -233,9 +233,9 @@ static int get_amixer_rsc(struct amixer_mgr *mgr,
|
||||||
const struct amixer_desc *desc,
|
const struct amixer_desc *desc,
|
||||||
struct amixer **ramixer)
|
struct amixer **ramixer)
|
||||||
{
|
{
|
||||||
int err = 0, i = 0;
|
int err, i;
|
||||||
unsigned int idx = 0;
|
unsigned int idx;
|
||||||
struct amixer *amixer = NULL;
|
struct amixer *amixer;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
*ramixer = NULL;
|
*ramixer = NULL;
|
||||||
|
@ -284,7 +284,7 @@ error:
|
||||||
static int put_amixer_rsc(struct amixer_mgr *mgr, struct amixer *amixer)
|
static int put_amixer_rsc(struct amixer_mgr *mgr, struct amixer *amixer)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
spin_lock_irqsave(&mgr->mgr_lock, flags);
|
spin_lock_irqsave(&mgr->mgr_lock, flags);
|
||||||
for (i = 0; i < amixer->rsc.msr; i++)
|
for (i = 0; i < amixer->rsc.msr; i++)
|
||||||
|
@ -299,7 +299,7 @@ static int put_amixer_rsc(struct amixer_mgr *mgr, struct amixer *amixer)
|
||||||
|
|
||||||
int amixer_mgr_create(void *hw, struct amixer_mgr **ramixer_mgr)
|
int amixer_mgr_create(void *hw, struct amixer_mgr **ramixer_mgr)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
struct amixer_mgr *amixer_mgr;
|
struct amixer_mgr *amixer_mgr;
|
||||||
|
|
||||||
*ramixer_mgr = NULL;
|
*ramixer_mgr = NULL;
|
||||||
|
@ -367,7 +367,7 @@ static int sum_rsc_init(struct sum *sum,
|
||||||
const struct sum_desc *desc,
|
const struct sum_desc *desc,
|
||||||
struct sum_mgr *mgr)
|
struct sum_mgr *mgr)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
err = rsc_init(&sum->rsc, sum->idx[0], SUM, desc->msr, mgr->mgr.hw);
|
err = rsc_init(&sum->rsc, sum->idx[0], SUM, desc->msr, mgr->mgr.hw);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -388,9 +388,9 @@ static int get_sum_rsc(struct sum_mgr *mgr,
|
||||||
const struct sum_desc *desc,
|
const struct sum_desc *desc,
|
||||||
struct sum **rsum)
|
struct sum **rsum)
|
||||||
{
|
{
|
||||||
int err = 0, i = 0;
|
int err, i;
|
||||||
unsigned int idx = 0;
|
unsigned int idx;
|
||||||
struct sum *sum = NULL;
|
struct sum *sum;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
*rsum = NULL;
|
*rsum = NULL;
|
||||||
|
@ -438,7 +438,7 @@ error:
|
||||||
static int put_sum_rsc(struct sum_mgr *mgr, struct sum *sum)
|
static int put_sum_rsc(struct sum_mgr *mgr, struct sum *sum)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
spin_lock_irqsave(&mgr->mgr_lock, flags);
|
spin_lock_irqsave(&mgr->mgr_lock, flags);
|
||||||
for (i = 0; i < sum->rsc.msr; i++)
|
for (i = 0; i < sum->rsc.msr; i++)
|
||||||
|
@ -453,7 +453,7 @@ static int put_sum_rsc(struct sum_mgr *mgr, struct sum *sum)
|
||||||
|
|
||||||
int sum_mgr_create(void *hw, struct sum_mgr **rsum_mgr)
|
int sum_mgr_create(void *hw, struct sum_mgr **rsum_mgr)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
struct sum_mgr *sum_mgr;
|
struct sum_mgr *sum_mgr;
|
||||||
|
|
||||||
*rsum_mgr = NULL;
|
*rsum_mgr = NULL;
|
||||||
|
|
|
@ -190,8 +190,8 @@ static unsigned int convert_format(snd_pcm_format_t snd_format)
|
||||||
static unsigned int
|
static unsigned int
|
||||||
atc_get_pitch(unsigned int input_rate, unsigned int output_rate)
|
atc_get_pitch(unsigned int input_rate, unsigned int output_rate)
|
||||||
{
|
{
|
||||||
unsigned int pitch = 0;
|
unsigned int pitch;
|
||||||
int b = 0;
|
int b;
|
||||||
|
|
||||||
/* get pitch and convert to fixed-point 8.24 format. */
|
/* get pitch and convert to fixed-point 8.24 format. */
|
||||||
pitch = (input_rate / output_rate) << 24;
|
pitch = (input_rate / output_rate) << 24;
|
||||||
|
@ -241,12 +241,12 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
|
struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
|
||||||
struct src_desc desc = {0};
|
struct src_desc desc = {0};
|
||||||
struct amixer_desc mix_dsc = {0};
|
struct amixer_desc mix_dsc = {0};
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
struct amixer *amixer = NULL;
|
struct amixer *amixer;
|
||||||
int err = 0;
|
int err;
|
||||||
int n_amixer = apcm->substream->runtime->channels, i = 0;
|
int n_amixer = apcm->substream->runtime->channels, i = 0;
|
||||||
int device = apcm->substream->pcm->device;
|
int device = apcm->substream->pcm->device;
|
||||||
unsigned int pitch = 0;
|
unsigned int pitch;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
if (NULL != apcm->src) {
|
if (NULL != apcm->src) {
|
||||||
|
@ -324,8 +324,8 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
struct srcimp_mgr *srcimp_mgr = atc->rsc_mgrs[SRCIMP];
|
struct srcimp_mgr *srcimp_mgr = atc->rsc_mgrs[SRCIMP];
|
||||||
struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
|
struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
|
||||||
struct sum_mgr *sum_mgr = atc->rsc_mgrs[SUM];
|
struct sum_mgr *sum_mgr = atc->rsc_mgrs[SUM];
|
||||||
struct srcimp *srcimp = NULL;
|
struct srcimp *srcimp;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
if (NULL != apcm->srcimps) {
|
if (NULL != apcm->srcimps) {
|
||||||
for (i = 0; i < apcm->n_srcimp; i++) {
|
for (i = 0; i < apcm->n_srcimp; i++) {
|
||||||
|
@ -377,7 +377,7 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
|
|
||||||
static int atc_pcm_playback_start(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
static int atc_pcm_playback_start(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
{
|
{
|
||||||
unsigned int max_cisz = 0;
|
unsigned int max_cisz;
|
||||||
struct src *src = apcm->src;
|
struct src *src = apcm->src;
|
||||||
|
|
||||||
max_cisz = src->multi * src->rsc.msr;
|
max_cisz = src->multi * src->rsc.msr;
|
||||||
|
@ -398,8 +398,8 @@ static int atc_pcm_playback_start(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
|
|
||||||
static int atc_pcm_stop(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
static int atc_pcm_stop(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
{
|
{
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
ct_timer_stop(apcm->timer);
|
ct_timer_stop(apcm->timer);
|
||||||
|
|
||||||
|
@ -426,8 +426,8 @@ static int
|
||||||
atc_pcm_playback_position(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
atc_pcm_playback_position(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
{
|
{
|
||||||
struct src *src = apcm->src;
|
struct src *src = apcm->src;
|
||||||
u32 size = 0, max_cisz = 0;
|
u32 size, max_cisz;
|
||||||
int position = 0;
|
int position;
|
||||||
|
|
||||||
position = src->ops->get_ca(src);
|
position = src->ops->get_ca(src);
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ struct src_node_conf_t {
|
||||||
static void setup_src_node_conf(struct ct_atc *atc, struct ct_atc_pcm *apcm,
|
static void setup_src_node_conf(struct ct_atc *atc, struct ct_atc_pcm *apcm,
|
||||||
struct src_node_conf_t *conf, int *n_srcc)
|
struct src_node_conf_t *conf, int *n_srcc)
|
||||||
{
|
{
|
||||||
unsigned int pitch = 0;
|
unsigned int pitch;
|
||||||
|
|
||||||
/* get pitch and convert to fixed-point 8.24 format. */
|
/* get pitch and convert to fixed-point 8.24 format. */
|
||||||
pitch = atc_get_pitch((atc->rsr * atc->msr),
|
pitch = atc_get_pitch((atc->rsr * atc->msr),
|
||||||
|
@ -494,14 +494,14 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
|
struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
|
||||||
struct sum_mgr *sum_mgr = atc->rsc_mgrs[SUM];
|
struct sum_mgr *sum_mgr = atc->rsc_mgrs[SUM];
|
||||||
struct src_desc src_dsc = {0};
|
struct src_desc src_dsc = {0};
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
struct srcimp_desc srcimp_dsc = {0};
|
struct srcimp_desc srcimp_dsc = {0};
|
||||||
struct srcimp *srcimp = NULL;
|
struct srcimp *srcimp;
|
||||||
struct amixer_desc mix_dsc = {0};
|
struct amixer_desc mix_dsc = {0};
|
||||||
struct sum_desc sum_dsc = {0};
|
struct sum_desc sum_dsc = {0};
|
||||||
unsigned int pitch = 0;
|
unsigned int pitch;
|
||||||
int multi = 0, err = 0, i = 0;
|
int multi, err, i;
|
||||||
int n_srcimp = 0, n_amixer = 0, n_srcc = 0, n_sum = 0;
|
int n_srcimp, n_amixer, n_srcc, n_sum;
|
||||||
struct src_node_conf_t src_node_conf[2] = {{0} };
|
struct src_node_conf_t src_node_conf[2] = {{0} };
|
||||||
|
|
||||||
/* first release old resources */
|
/* first release old resources */
|
||||||
|
@ -518,8 +518,8 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
|
|
||||||
setup_src_node_conf(atc, apcm, src_node_conf, &n_srcc);
|
setup_src_node_conf(atc, apcm, src_node_conf, &n_srcc);
|
||||||
n_sum = (1 == multi) ? 1 : 0;
|
n_sum = (1 == multi) ? 1 : 0;
|
||||||
n_amixer += n_sum * 2 + n_srcc;
|
n_amixer = n_sum * 2 + n_srcc;
|
||||||
n_srcimp += n_srcc;
|
n_srcimp = n_srcc;
|
||||||
if ((multi > 1) && (0x8000000 >= pitch)) {
|
if ((multi > 1) && (0x8000000 >= pitch)) {
|
||||||
/* Need extra AMIXERs and SRCIMPs for special treatment
|
/* Need extra AMIXERs and SRCIMPs for special treatment
|
||||||
* of interleaved recording of conjugate channels */
|
* of interleaved recording of conjugate channels */
|
||||||
|
@ -633,14 +633,14 @@ error1:
|
||||||
|
|
||||||
static int atc_pcm_capture_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
static int atc_pcm_capture_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
{
|
{
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
struct amixer *amixer = NULL;
|
struct amixer *amixer;
|
||||||
struct srcimp *srcimp = NULL;
|
struct srcimp *srcimp;
|
||||||
struct ct_mixer *mixer = atc->mixer;
|
struct ct_mixer *mixer = atc->mixer;
|
||||||
struct sum *mono = NULL;
|
struct sum *mono;
|
||||||
struct rsc *out_ports[8] = {NULL};
|
struct rsc *out_ports[8] = {NULL};
|
||||||
int err = 0, i = 0, j = 0, n_sum = 0, multi = 0;
|
int err, i, j, n_sum, multi;
|
||||||
unsigned int pitch = 0;
|
unsigned int pitch;
|
||||||
int mix_base = 0, imp_base = 0;
|
int mix_base = 0, imp_base = 0;
|
||||||
|
|
||||||
if (NULL != apcm->src) {
|
if (NULL != apcm->src) {
|
||||||
|
@ -714,9 +714,9 @@ static int atc_pcm_capture_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
|
|
||||||
static int atc_pcm_capture_start(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
static int atc_pcm_capture_start(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
{
|
{
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
struct src_mgr *src_mgr = atc->rsc_mgrs[SRC];
|
struct src_mgr *src_mgr = atc->rsc_mgrs[SRC];
|
||||||
int i = 0, multi = 0;
|
int i, multi;
|
||||||
|
|
||||||
if (apcm->started)
|
if (apcm->started)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -776,10 +776,10 @@ static int spdif_passthru_playback_get_resources(struct ct_atc *atc,
|
||||||
struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
|
struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
|
||||||
struct src_desc desc = {0};
|
struct src_desc desc = {0};
|
||||||
struct amixer_desc mix_dsc = {0};
|
struct amixer_desc mix_dsc = {0};
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
int err = 0;
|
int err;
|
||||||
int n_amixer = apcm->substream->runtime->channels, i = 0;
|
int n_amixer = apcm->substream->runtime->channels, i;
|
||||||
unsigned int pitch = 0, rsr = atc->pll_rate;
|
unsigned int pitch, rsr = atc->pll_rate;
|
||||||
|
|
||||||
/* first release old resources */
|
/* first release old resources */
|
||||||
atc->pcm_release_resources(atc, apcm);
|
atc->pcm_release_resources(atc, apcm);
|
||||||
|
@ -832,15 +832,24 @@ error1:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int atc_pll_init(struct ct_atc *atc, int rate)
|
||||||
|
{
|
||||||
|
struct hw *hw = atc->hw;
|
||||||
|
int err;
|
||||||
|
err = hw->pll_init(hw, rate);
|
||||||
|
atc->pll_rate = err ? 0 : rate;
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
{
|
{
|
||||||
struct dao *dao = container_of(atc->daios[SPDIFOO], struct dao, daio);
|
struct dao *dao = container_of(atc->daios[SPDIFOO], struct dao, daio);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned int rate = apcm->substream->runtime->rate;
|
unsigned int rate = apcm->substream->runtime->rate;
|
||||||
unsigned int status = 0;
|
unsigned int status;
|
||||||
int err = 0;
|
int err;
|
||||||
unsigned char iec958_con_fs = 0;
|
unsigned char iec958_con_fs;
|
||||||
|
|
||||||
switch (rate) {
|
switch (rate) {
|
||||||
case 48000:
|
case 48000:
|
||||||
|
@ -864,10 +873,8 @@ spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
dao->ops->set_spos(dao, status);
|
dao->ops->set_spos(dao, status);
|
||||||
dao->ops->commit_write(dao);
|
dao->ops->commit_write(dao);
|
||||||
}
|
}
|
||||||
if ((rate != atc->pll_rate) && (32000 != rate)) {
|
if ((rate != atc->pll_rate) && (32000 != rate))
|
||||||
err = ((struct hw *)atc->hw)->pll_init(atc->hw, rate);
|
err = atc_pll_init(atc, rate);
|
||||||
atc->pll_rate = err ? 0 : rate;
|
|
||||||
}
|
|
||||||
spin_unlock_irqrestore(&atc->atc_lock, flags);
|
spin_unlock_irqrestore(&atc->atc_lock, flags);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
@ -876,11 +883,11 @@ spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
static int
|
static int
|
||||||
spdif_passthru_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
spdif_passthru_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
|
||||||
{
|
{
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
struct amixer *amixer = NULL;
|
struct amixer *amixer;
|
||||||
struct dao *dao = NULL;
|
struct dao *dao;
|
||||||
int err = 0;
|
int err;
|
||||||
int i = 0;
|
int i;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
if (NULL != apcm->src)
|
if (NULL != apcm->src)
|
||||||
|
@ -924,7 +931,7 @@ static int atc_select_line_in(struct ct_atc *atc)
|
||||||
{
|
{
|
||||||
struct hw *hw = atc->hw;
|
struct hw *hw = atc->hw;
|
||||||
struct ct_mixer *mixer = atc->mixer;
|
struct ct_mixer *mixer = atc->mixer;
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
|
|
||||||
if (hw->is_adc_source_selected(hw, ADC_LINEIN))
|
if (hw->is_adc_source_selected(hw, ADC_LINEIN))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -946,7 +953,7 @@ static int atc_select_mic_in(struct ct_atc *atc)
|
||||||
{
|
{
|
||||||
struct hw *hw = atc->hw;
|
struct hw *hw = atc->hw;
|
||||||
struct ct_mixer *mixer = atc->mixer;
|
struct ct_mixer *mixer = atc->mixer;
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
|
|
||||||
if (hw->is_adc_source_selected(hw, ADC_MICIN))
|
if (hw->is_adc_source_selected(hw, ADC_MICIN))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1063,8 +1070,8 @@ static int atc_spdif_out_passthru(struct ct_atc *atc, unsigned char state)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct dao_desc da_dsc = {0};
|
struct dao_desc da_dsc = {0};
|
||||||
struct dao *dao = NULL;
|
struct dao *dao;
|
||||||
int err = 0;
|
int err;
|
||||||
struct ct_mixer *mixer = atc->mixer;
|
struct ct_mixer *mixer = atc->mixer;
|
||||||
struct rsc *rscs[2] = {NULL};
|
struct rsc *rscs[2] = {NULL};
|
||||||
unsigned int spos = 0;
|
unsigned int spos = 0;
|
||||||
|
@ -1082,11 +1089,8 @@ static int atc_spdif_out_passthru(struct ct_atc *atc, unsigned char state)
|
||||||
dao->ops->set_left_input(dao, rscs[0]);
|
dao->ops->set_left_input(dao, rscs[0]);
|
||||||
dao->ops->set_right_input(dao, rscs[1]);
|
dao->ops->set_right_input(dao, rscs[1]);
|
||||||
/* Restore PLL to atc->rsr if needed. */
|
/* Restore PLL to atc->rsr if needed. */
|
||||||
if (atc->pll_rate != atc->rsr) {
|
if (atc->pll_rate != atc->rsr)
|
||||||
err = ((struct hw *)atc->hw)->pll_init(atc->hw,
|
err = atc_pll_init(atc, atc->rsr);
|
||||||
atc->rsr);
|
|
||||||
atc->pll_rate = err ? 0 : atc->rsr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dao->ops->set_spos(dao, spos);
|
dao->ops->set_spos(dao, spos);
|
||||||
dao->ops->commit_write(dao);
|
dao->ops->commit_write(dao);
|
||||||
|
@ -1097,15 +1101,15 @@ static int atc_spdif_out_passthru(struct ct_atc *atc, unsigned char state)
|
||||||
|
|
||||||
static int ct_atc_destroy(struct ct_atc *atc)
|
static int ct_atc_destroy(struct ct_atc *atc)
|
||||||
{
|
{
|
||||||
struct daio_mgr *daio_mgr = NULL;
|
struct daio_mgr *daio_mgr;
|
||||||
struct dao *dao = NULL;
|
struct dao *dao;
|
||||||
struct dai *dai = NULL;
|
struct dai *dai;
|
||||||
struct daio *daio = NULL;
|
struct daio *daio;
|
||||||
struct sum_mgr *sum_mgr = NULL;
|
struct sum_mgr *sum_mgr;
|
||||||
struct src_mgr *src_mgr = NULL;
|
struct src_mgr *src_mgr;
|
||||||
struct srcimp_mgr *srcimp_mgr = NULL;
|
struct srcimp_mgr *srcimp_mgr;
|
||||||
struct srcimp *srcimp = NULL;
|
struct srcimp *srcimp;
|
||||||
struct ct_mixer *mixer = NULL;
|
struct ct_mixer *mixer;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (NULL == atc)
|
if (NULL == atc)
|
||||||
|
@ -1279,9 +1283,9 @@ int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc)
|
||||||
|
|
||||||
static int __devinit atc_create_hw_devs(struct ct_atc *atc)
|
static int __devinit atc_create_hw_devs(struct ct_atc *atc)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
struct card_conf info = {0};
|
struct card_conf info = {0};
|
||||||
int i = 0, err = 0;
|
int i, err;
|
||||||
|
|
||||||
err = create_hw_obj(atc->pci, &hw);
|
err = create_hw_obj(atc->pci, &hw);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -1316,14 +1320,14 @@ static int __devinit atc_create_hw_devs(struct ct_atc *atc)
|
||||||
static int __devinit atc_get_resources(struct ct_atc *atc)
|
static int __devinit atc_get_resources(struct ct_atc *atc)
|
||||||
{
|
{
|
||||||
struct daio_desc da_desc = {0};
|
struct daio_desc da_desc = {0};
|
||||||
struct daio_mgr *daio_mgr = NULL;
|
struct daio_mgr *daio_mgr;
|
||||||
struct src_desc src_dsc = {0};
|
struct src_desc src_dsc = {0};
|
||||||
struct src_mgr *src_mgr = NULL;
|
struct src_mgr *src_mgr;
|
||||||
struct srcimp_desc srcimp_dsc = {0};
|
struct srcimp_desc srcimp_dsc = {0};
|
||||||
struct srcimp_mgr *srcimp_mgr = NULL;
|
struct srcimp_mgr *srcimp_mgr;
|
||||||
struct sum_desc sum_dsc = {0};
|
struct sum_desc sum_dsc = {0};
|
||||||
struct sum_mgr *sum_mgr = NULL;
|
struct sum_mgr *sum_mgr;
|
||||||
int err = 0, i = 0;
|
int err, i;
|
||||||
unsigned short subsys_id;
|
unsigned short subsys_id;
|
||||||
|
|
||||||
atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL);
|
atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL);
|
||||||
|
@ -1428,8 +1432,8 @@ atc_connect_dai(struct src_mgr *src_mgr, struct dai *dai,
|
||||||
struct src **srcs, struct srcimp **srcimps)
|
struct src **srcs, struct srcimp **srcimps)
|
||||||
{
|
{
|
||||||
struct rsc *rscs[2] = {NULL};
|
struct rsc *rscs[2] = {NULL};
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
struct srcimp *srcimp = NULL;
|
struct srcimp *srcimp;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
rscs[0] = &dai->daio.rscl;
|
rscs[0] = &dai->daio.rscl;
|
||||||
|
@ -1464,13 +1468,13 @@ atc_connect_dai(struct src_mgr *src_mgr, struct dai *dai,
|
||||||
|
|
||||||
static void __devinit atc_connect_resources(struct ct_atc *atc)
|
static void __devinit atc_connect_resources(struct ct_atc *atc)
|
||||||
{
|
{
|
||||||
struct dai *dai = NULL;
|
struct dai *dai;
|
||||||
struct dao *dao = NULL;
|
struct dao *dao;
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
struct sum *sum = NULL;
|
struct sum *sum;
|
||||||
struct ct_mixer *mixer = NULL;
|
struct ct_mixer *mixer;
|
||||||
struct rsc *rscs[2] = {NULL};
|
struct rsc *rscs[2] = {NULL};
|
||||||
int i = 0, j = 0;
|
int i, j;
|
||||||
|
|
||||||
mixer = atc->mixer;
|
mixer = atc->mixer;
|
||||||
|
|
||||||
|
@ -1553,11 +1557,11 @@ static struct ct_atc atc_preset __devinitdata = {
|
||||||
int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
|
int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
|
||||||
unsigned int rsr, unsigned int msr, struct ct_atc **ratc)
|
unsigned int rsr, unsigned int msr, struct ct_atc **ratc)
|
||||||
{
|
{
|
||||||
struct ct_atc *atc = NULL;
|
struct ct_atc *atc;
|
||||||
static struct snd_device_ops ops = {
|
static struct snd_device_ops ops = {
|
||||||
.dev_free = atc_dev_free,
|
.dev_free = atc_dev_free,
|
||||||
};
|
};
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
*ratc = NULL;
|
*ratc = NULL;
|
||||||
|
|
||||||
|
|
|
@ -168,9 +168,9 @@ static int dao_commit_write(struct dao *dao)
|
||||||
|
|
||||||
static int dao_set_left_input(struct dao *dao, struct rsc *input)
|
static int dao_set_left_input(struct dao *dao, struct rsc *input)
|
||||||
{
|
{
|
||||||
struct imapper *entry = NULL;
|
struct imapper *entry;
|
||||||
struct daio *daio = &dao->daio;
|
struct daio *daio = &dao->daio;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
entry = kzalloc((sizeof(*entry) * daio->rscl.msr), GFP_KERNEL);
|
entry = kzalloc((sizeof(*entry) * daio->rscl.msr), GFP_KERNEL);
|
||||||
if (NULL == entry)
|
if (NULL == entry)
|
||||||
|
@ -196,9 +196,9 @@ static int dao_set_left_input(struct dao *dao, struct rsc *input)
|
||||||
|
|
||||||
static int dao_set_right_input(struct dao *dao, struct rsc *input)
|
static int dao_set_right_input(struct dao *dao, struct rsc *input)
|
||||||
{
|
{
|
||||||
struct imapper *entry = NULL;
|
struct imapper *entry;
|
||||||
struct daio *daio = &dao->daio;
|
struct daio *daio = &dao->daio;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
entry = kzalloc((sizeof(*entry) * daio->rscr.msr), GFP_KERNEL);
|
entry = kzalloc((sizeof(*entry) * daio->rscr.msr), GFP_KERNEL);
|
||||||
if (NULL == entry)
|
if (NULL == entry)
|
||||||
|
@ -224,9 +224,9 @@ static int dao_set_right_input(struct dao *dao, struct rsc *input)
|
||||||
|
|
||||||
static int dao_clear_left_input(struct dao *dao)
|
static int dao_clear_left_input(struct dao *dao)
|
||||||
{
|
{
|
||||||
struct imapper *entry = NULL;
|
struct imapper *entry;
|
||||||
struct daio *daio = &dao->daio;
|
struct daio *daio = &dao->daio;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
if (NULL == dao->imappers[0])
|
if (NULL == dao->imappers[0])
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -248,9 +248,9 @@ static int dao_clear_left_input(struct dao *dao)
|
||||||
|
|
||||||
static int dao_clear_right_input(struct dao *dao)
|
static int dao_clear_right_input(struct dao *dao)
|
||||||
{
|
{
|
||||||
struct imapper *entry = NULL;
|
struct imapper *entry;
|
||||||
struct daio *daio = &dao->daio;
|
struct daio *daio = &dao->daio;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
if (NULL == dao->imappers[daio->rscl.msr])
|
if (NULL == dao->imappers[daio->rscl.msr])
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -299,7 +299,7 @@ static int dai_set_srt_srcr(struct dai *dai, struct rsc *src)
|
||||||
|
|
||||||
static int dai_set_srt_msr(struct dai *dai, unsigned int msr)
|
static int dai_set_srt_msr(struct dai *dai, unsigned int msr)
|
||||||
{
|
{
|
||||||
unsigned int rsr = 0;
|
unsigned int rsr;
|
||||||
|
|
||||||
for (rsr = 0; msr > 1; msr >>= 1)
|
for (rsr = 0; msr > 1; msr >>= 1)
|
||||||
rsr++;
|
rsr++;
|
||||||
|
@ -340,8 +340,8 @@ static int daio_rsc_init(struct daio *daio,
|
||||||
const struct daio_desc *desc,
|
const struct daio_desc *desc,
|
||||||
void *hw)
|
void *hw)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
unsigned int idx_l = 0, idx_r = 0;
|
unsigned int idx_l, idx_r;
|
||||||
|
|
||||||
switch (((struct hw *)hw)->get_chip_type(hw)) {
|
switch (((struct hw *)hw)->get_chip_type(hw)) {
|
||||||
case ATC20K1:
|
case ATC20K1:
|
||||||
|
@ -400,8 +400,8 @@ static int dao_rsc_init(struct dao *dao,
|
||||||
struct daio_mgr *mgr)
|
struct daio_mgr *mgr)
|
||||||
{
|
{
|
||||||
struct hw *hw = mgr->mgr.hw;
|
struct hw *hw = mgr->mgr.hw;
|
||||||
unsigned int conf = 0;
|
unsigned int conf;
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
err = daio_rsc_init(&dao->daio, desc, mgr->mgr.hw);
|
err = daio_rsc_init(&dao->daio, desc, mgr->mgr.hw);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -423,7 +423,7 @@ static int dao_rsc_init(struct dao *dao,
|
||||||
daio_device_index(dao->daio.type, hw));
|
daio_device_index(dao->daio.type, hw));
|
||||||
hw->daio_mgr_commit_write(hw, mgr->mgr.ctrl_blk);
|
hw->daio_mgr_commit_write(hw, mgr->mgr.ctrl_blk);
|
||||||
|
|
||||||
conf |= (desc->msr & 0x7) | (desc->passthru << 3);
|
conf = (desc->msr & 0x7) | (desc->passthru << 3);
|
||||||
hw->daio_mgr_dao_init(mgr->mgr.ctrl_blk,
|
hw->daio_mgr_dao_init(mgr->mgr.ctrl_blk,
|
||||||
daio_device_index(dao->daio.type, hw), conf);
|
daio_device_index(dao->daio.type, hw), conf);
|
||||||
hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk,
|
hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk,
|
||||||
|
@ -475,9 +475,9 @@ static int dai_rsc_init(struct dai *dai,
|
||||||
const struct daio_desc *desc,
|
const struct daio_desc *desc,
|
||||||
struct daio_mgr *mgr)
|
struct daio_mgr *mgr)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
struct hw *hw = mgr->mgr.hw;
|
struct hw *hw = mgr->mgr.hw;
|
||||||
unsigned int rsr = 0, msr = 0;
|
unsigned int rsr, msr;
|
||||||
|
|
||||||
err = daio_rsc_init(&dai->daio, desc, mgr->mgr.hw);
|
err = daio_rsc_init(&dai->daio, desc, mgr->mgr.hw);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -536,7 +536,7 @@ static int get_daio_rsc(struct daio_mgr *mgr,
|
||||||
const struct daio_desc *desc,
|
const struct daio_desc *desc,
|
||||||
struct daio **rdaio)
|
struct daio **rdaio)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
struct dai *dai = NULL;
|
struct dai *dai = NULL;
|
||||||
struct dao *dao = NULL;
|
struct dao *dao = NULL;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
@ -660,7 +660,7 @@ static int daio_map_op(void *data, struct imapper *entry)
|
||||||
static int daio_imap_add(struct daio_mgr *mgr, struct imapper *entry)
|
static int daio_imap_add(struct daio_mgr *mgr, struct imapper *entry)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
spin_lock_irqsave(&mgr->imap_lock, flags);
|
spin_lock_irqsave(&mgr->imap_lock, flags);
|
||||||
if ((0 == entry->addr) && (mgr->init_imap_added)) {
|
if ((0 == entry->addr) && (mgr->init_imap_added)) {
|
||||||
|
@ -677,7 +677,7 @@ static int daio_imap_add(struct daio_mgr *mgr, struct imapper *entry)
|
||||||
static int daio_imap_delete(struct daio_mgr *mgr, struct imapper *entry)
|
static int daio_imap_delete(struct daio_mgr *mgr, struct imapper *entry)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
spin_lock_irqsave(&mgr->imap_lock, flags);
|
spin_lock_irqsave(&mgr->imap_lock, flags);
|
||||||
err = input_mapper_delete(&mgr->imappers, entry, daio_map_op, mgr);
|
err = input_mapper_delete(&mgr->imappers, entry, daio_map_op, mgr);
|
||||||
|
@ -701,7 +701,7 @@ static int daio_mgr_commit_write(struct daio_mgr *mgr)
|
||||||
|
|
||||||
int daio_mgr_create(void *hw, struct daio_mgr **rdaio_mgr)
|
int daio_mgr_create(void *hw, struct daio_mgr **rdaio_mgr)
|
||||||
{
|
{
|
||||||
int err = 0, i = 0;
|
int err, i;
|
||||||
struct daio_mgr *daio_mgr;
|
struct daio_mgr *daio_mgr;
|
||||||
struct imapper *entry;
|
struct imapper *entry;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
static enum CHIPTYP __devinitdata get_chip_type(struct hw *hw)
|
static enum CHIPTYP __devinitdata get_chip_type(struct hw *hw)
|
||||||
{
|
{
|
||||||
enum CHIPTYP type = ATCNONE;
|
enum CHIPTYP type;
|
||||||
|
|
||||||
switch (hw->pci->device) {
|
switch (hw->pci->device) {
|
||||||
case 0x0005: /* 20k1 device */
|
case 0x0005: /* 20k1 device */
|
||||||
|
@ -41,7 +41,7 @@ static enum CHIPTYP __devinitdata get_chip_type(struct hw *hw)
|
||||||
|
|
||||||
int __devinit create_hw_obj(struct pci_dev *pci, struct hw **rhw)
|
int __devinit create_hw_obj(struct pci_dev *pci, struct hw **rhw)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
switch (pci->device) {
|
switch (pci->device) {
|
||||||
case 0x0005: /* 20k1 device */
|
case 0x0005: /* 20k1 device */
|
||||||
|
@ -65,7 +65,7 @@ int __devinit create_hw_obj(struct pci_dev *pci, struct hw **rhw)
|
||||||
|
|
||||||
int destroy_hw_obj(struct hw *hw)
|
int destroy_hw_obj(struct hw *hw)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
switch (hw->pci->device) {
|
switch (hw->pci->device) {
|
||||||
case 0x0005: /* 20k1 device */
|
case 0x0005: /* 20k1 device */
|
||||||
|
|
|
@ -369,7 +369,7 @@ static unsigned int src_param_pitch_mixer(unsigned int src_idx)
|
||||||
static int src_commit_write(struct hw *hw, unsigned int idx, void *blk)
|
static int src_commit_write(struct hw *hw, unsigned int idx, void *blk)
|
||||||
{
|
{
|
||||||
struct src_rsc_ctrl_blk *ctl = blk;
|
struct src_rsc_ctrl_blk *ctl = blk;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
if (ctl->dirty.bf.czbfs) {
|
if (ctl->dirty.bf.czbfs) {
|
||||||
/* Clear Z-Buffer registers */
|
/* Clear Z-Buffer registers */
|
||||||
|
@ -468,8 +468,8 @@ static int src_mgr_dsb_src(void *blk, unsigned int idx)
|
||||||
static int src_mgr_commit_write(struct hw *hw, void *blk)
|
static int src_mgr_commit_write(struct hw *hw, void *blk)
|
||||||
{
|
{
|
||||||
struct src_mgr_ctrl_blk *ctl = blk;
|
struct src_mgr_ctrl_blk *ctl = blk;
|
||||||
int i = 0;
|
int i;
|
||||||
unsigned int ret = 0;
|
unsigned int ret;
|
||||||
|
|
||||||
if (ctl->dirty.bf.enbsa) {
|
if (ctl->dirty.bf.enbsa) {
|
||||||
do {
|
do {
|
||||||
|
@ -1108,7 +1108,7 @@ static int daio_mgr_set_imapaddr(void *blk, unsigned int addr)
|
||||||
static int daio_mgr_commit_write(struct hw *hw, void *blk)
|
static int daio_mgr_commit_write(struct hw *hw, void *blk)
|
||||||
{
|
{
|
||||||
struct daio_mgr_ctrl_blk *ctl = blk;
|
struct daio_mgr_ctrl_blk *ctl = blk;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
if (ctl->dirty.bf.i2sictl || ctl->dirty.bf.i2soctl) {
|
if (ctl->dirty.bf.i2sictl || ctl->dirty.bf.i2soctl) {
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
|
@ -1212,8 +1212,8 @@ struct trn_conf {
|
||||||
|
|
||||||
static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
|
static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
|
||||||
{
|
{
|
||||||
u32 i2sorg = 0;
|
u32 i2sorg;
|
||||||
u32 spdorg = 0;
|
u32 spdorg;
|
||||||
|
|
||||||
/* Read I2S CTL. Keep original value. */
|
/* Read I2S CTL. Keep original value. */
|
||||||
/*i2sorg = hw_read_20kx(hw, I2SCTL);*/
|
/*i2sorg = hw_read_20kx(hw, I2SCTL);*/
|
||||||
|
@ -1263,8 +1263,8 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
|
||||||
/* TRANSPORT operations */
|
/* TRANSPORT operations */
|
||||||
static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
|
static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
|
||||||
{
|
{
|
||||||
u32 trnctl = 0;
|
u32 trnctl;
|
||||||
unsigned long ptp_phys_low = 0, ptp_phys_high = 0;
|
u32 ptp_phys_low, ptp_phys_high;
|
||||||
|
|
||||||
/* Set up device page table */
|
/* Set up device page table */
|
||||||
if ((~0UL) == info->vm_pgt_phys) {
|
if ((~0UL) == info->vm_pgt_phys) {
|
||||||
|
@ -1316,7 +1316,7 @@ static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
|
||||||
static int hw_pll_init(struct hw *hw, unsigned int rsr)
|
static int hw_pll_init(struct hw *hw, unsigned int rsr)
|
||||||
{
|
{
|
||||||
unsigned int pllctl;
|
unsigned int pllctl;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
pllctl = (48000 == rsr) ? 0x1480a001 : 0x1480a731;
|
pllctl = (48000 == rsr) ? 0x1480a001 : 0x1480a731;
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
|
@ -1384,7 +1384,7 @@ static void i2c_lock(struct hw *hw)
|
||||||
|
|
||||||
static void i2c_write(struct hw *hw, u32 device, u32 addr, u32 data)
|
static void i2c_write(struct hw *hw, u32 device, u32 addr, u32 data)
|
||||||
{
|
{
|
||||||
unsigned int ret = 0;
|
unsigned int ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ret = hw_read_pci(hw, 0xEC);
|
ret = hw_read_pci(hw, 0xEC);
|
||||||
|
@ -1397,9 +1397,9 @@ static void i2c_write(struct hw *hw, u32 device, u32 addr, u32 data)
|
||||||
|
|
||||||
static int hw_reset_dac(struct hw *hw)
|
static int hw_reset_dac(struct hw *hw)
|
||||||
{
|
{
|
||||||
u32 i = 0;
|
u32 i;
|
||||||
u16 gpioorg = 0;
|
u16 gpioorg;
|
||||||
unsigned int ret = 0;
|
unsigned int ret;
|
||||||
|
|
||||||
if (i2c_unlock(hw))
|
if (i2c_unlock(hw))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1430,10 +1430,10 @@ static int hw_reset_dac(struct hw *hw)
|
||||||
|
|
||||||
static int hw_dac_init(struct hw *hw, const struct dac_conf *info)
|
static int hw_dac_init(struct hw *hw, const struct dac_conf *info)
|
||||||
{
|
{
|
||||||
u32 data = 0;
|
u32 data;
|
||||||
u16 gpioorg = 0;
|
u16 gpioorg;
|
||||||
u16 subsys_id = 0;
|
u16 subsys_id;
|
||||||
unsigned int ret = 0;
|
unsigned int ret;
|
||||||
|
|
||||||
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
|
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
|
||||||
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
|
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
|
||||||
|
@ -1494,13 +1494,12 @@ static int hw_dac_init(struct hw *hw, const struct dac_conf *info)
|
||||||
|
|
||||||
static int is_adc_input_selected_SB055x(struct hw *hw, enum ADCSRC type)
|
static int is_adc_input_selected_SB055x(struct hw *hw, enum ADCSRC type)
|
||||||
{
|
{
|
||||||
u32 data = 0;
|
return 0;
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int is_adc_input_selected_SBx(struct hw *hw, enum ADCSRC type)
|
static int is_adc_input_selected_SBx(struct hw *hw, enum ADCSRC type)
|
||||||
{
|
{
|
||||||
u32 data = 0;
|
u32 data;
|
||||||
|
|
||||||
data = hw_read_20kx(hw, GPIO);
|
data = hw_read_20kx(hw, GPIO);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -1521,7 +1520,7 @@ static int is_adc_input_selected_SBx(struct hw *hw, enum ADCSRC type)
|
||||||
|
|
||||||
static int is_adc_input_selected_hendrix(struct hw *hw, enum ADCSRC type)
|
static int is_adc_input_selected_hendrix(struct hw *hw, enum ADCSRC type)
|
||||||
{
|
{
|
||||||
u32 data = 0;
|
u32 data;
|
||||||
|
|
||||||
data = hw_read_20kx(hw, GPIO);
|
data = hw_read_20kx(hw, GPIO);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -1539,7 +1538,7 @@ static int is_adc_input_selected_hendrix(struct hw *hw, enum ADCSRC type)
|
||||||
|
|
||||||
static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
|
static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
|
||||||
{
|
{
|
||||||
u16 subsys_id = 0;
|
u16 subsys_id;
|
||||||
|
|
||||||
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
|
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
|
||||||
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
|
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
|
||||||
|
@ -1559,7 +1558,7 @@ static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
|
||||||
static int
|
static int
|
||||||
adc_input_select_SB055x(struct hw *hw, enum ADCSRC type, unsigned char boost)
|
adc_input_select_SB055x(struct hw *hw, enum ADCSRC type, unsigned char boost)
|
||||||
{
|
{
|
||||||
u32 data = 0;
|
u32 data;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check and set the following GPIO bits accordingly
|
* check and set the following GPIO bits accordingly
|
||||||
|
@ -1599,9 +1598,9 @@ adc_input_select_SB055x(struct hw *hw, enum ADCSRC type, unsigned char boost)
|
||||||
static int
|
static int
|
||||||
adc_input_select_SBx(struct hw *hw, enum ADCSRC type, unsigned char boost)
|
adc_input_select_SBx(struct hw *hw, enum ADCSRC type, unsigned char boost)
|
||||||
{
|
{
|
||||||
u32 data = 0;
|
u32 data;
|
||||||
u32 i2c_data = 0;
|
u32 i2c_data;
|
||||||
unsigned int ret = 0;
|
unsigned int ret;
|
||||||
|
|
||||||
if (i2c_unlock(hw))
|
if (i2c_unlock(hw))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1649,9 +1648,9 @@ adc_input_select_SBx(struct hw *hw, enum ADCSRC type, unsigned char boost)
|
||||||
static int
|
static int
|
||||||
adc_input_select_hendrix(struct hw *hw, enum ADCSRC type, unsigned char boost)
|
adc_input_select_hendrix(struct hw *hw, enum ADCSRC type, unsigned char boost)
|
||||||
{
|
{
|
||||||
u32 data = 0;
|
u32 data;
|
||||||
u32 i2c_data = 0;
|
u32 i2c_data;
|
||||||
unsigned int ret = 0;
|
unsigned int ret;
|
||||||
|
|
||||||
if (i2c_unlock(hw))
|
if (i2c_unlock(hw))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1693,7 +1692,7 @@ adc_input_select_hendrix(struct hw *hw, enum ADCSRC type, unsigned char boost)
|
||||||
|
|
||||||
static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
|
static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
|
||||||
{
|
{
|
||||||
u16 subsys_id = 0;
|
u16 subsys_id;
|
||||||
|
|
||||||
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
|
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
|
||||||
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
|
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
|
||||||
|
@ -1719,8 +1718,8 @@ static int adc_init_SBx(struct hw *hw, int input, int mic20db)
|
||||||
{
|
{
|
||||||
u16 gpioorg;
|
u16 gpioorg;
|
||||||
u16 input_source;
|
u16 input_source;
|
||||||
u32 adcdata = 0;
|
u32 adcdata;
|
||||||
unsigned int ret = 0;
|
unsigned int ret;
|
||||||
|
|
||||||
input_source = 0x100; /* default to analog */
|
input_source = 0x100; /* default to analog */
|
||||||
switch (input) {
|
switch (input) {
|
||||||
|
@ -1742,6 +1741,7 @@ static int adc_init_SBx(struct hw *hw, int input, int mic20db)
|
||||||
input_source = 0x0; /* set to Digital */
|
input_source = 0x0; /* set to Digital */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
adcdata = 0x0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1781,8 +1781,8 @@ static int adc_init_SBx(struct hw *hw, int input, int mic20db)
|
||||||
|
|
||||||
static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
|
static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
u16 subsys_id = 0;
|
u16 subsys_id;
|
||||||
|
|
||||||
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
|
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
|
||||||
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
|
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
|
||||||
|
@ -1797,7 +1797,7 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
|
||||||
|
|
||||||
static int hw_have_digit_io_switch(struct hw *hw)
|
static int hw_have_digit_io_switch(struct hw *hw)
|
||||||
{
|
{
|
||||||
u16 subsys_id = 0;
|
u16 subsys_id;
|
||||||
|
|
||||||
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
|
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
|
||||||
/* SB073x and Vista compatible cards have no digit IO switch */
|
/* SB073x and Vista compatible cards have no digit IO switch */
|
||||||
|
@ -1814,11 +1814,11 @@ static int uaa_to_xfi(struct pci_dev *pci)
|
||||||
{
|
{
|
||||||
unsigned int bar0, bar1, bar2, bar3, bar4, bar5;
|
unsigned int bar0, bar1, bar2, bar3, bar4, bar5;
|
||||||
unsigned int cmd, irq, cl_size, l_timer, pwr;
|
unsigned int cmd, irq, cl_size, l_timer, pwr;
|
||||||
unsigned int is_uaa = 0;
|
unsigned int is_uaa;
|
||||||
unsigned int data[4] = {0};
|
unsigned int data[4] = {0};
|
||||||
unsigned int io_base;
|
unsigned int io_base;
|
||||||
void *mem_base;
|
void *mem_base;
|
||||||
int i = 0;
|
int i;
|
||||||
const u32 CTLX = CTLBITS('C', 'T', 'L', 'X');
|
const u32 CTLX = CTLBITS('C', 'T', 'L', 'X');
|
||||||
const u32 CTL_ = CTLBITS('C', 'T', 'L', '-');
|
const u32 CTL_ = CTLBITS('C', 'T', 'L', '-');
|
||||||
const u32 CTLF = CTLBITS('C', 'T', 'L', 'F');
|
const u32 CTLF = CTLBITS('C', 'T', 'L', 'F');
|
||||||
|
@ -1916,9 +1916,9 @@ static irqreturn_t ct_20k1_interrupt(int irq, void *dev_id)
|
||||||
|
|
||||||
static int hw_card_start(struct hw *hw)
|
static int hw_card_start(struct hw *hw)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
struct pci_dev *pci = hw->pci;
|
struct pci_dev *pci = hw->pci;
|
||||||
u16 subsys_id = 0;
|
u16 subsys_id;
|
||||||
|
|
||||||
err = pci_enable_device(pci);
|
err = pci_enable_device(pci);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
@ -2004,8 +2004,8 @@ static int hw_card_init(struct hw *hw, struct card_conf *info)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
unsigned int gctl;
|
unsigned int gctl;
|
||||||
u16 subsys_id = 0;
|
u16 subsys_id;
|
||||||
u32 data = 0;
|
u32 data;
|
||||||
struct dac_conf dac_info = {0};
|
struct dac_conf dac_info = {0};
|
||||||
struct adc_conf adc_info = {0};
|
struct adc_conf adc_info = {0};
|
||||||
struct daio_conf daio_info = {0};
|
struct daio_conf daio_info = {0};
|
||||||
|
|
|
@ -168,7 +168,7 @@ static int src_get_rsc_ctrl_blk(void **rblk)
|
||||||
|
|
||||||
static int src_put_rsc_ctrl_blk(void *blk)
|
static int src_put_rsc_ctrl_blk(void *blk)
|
||||||
{
|
{
|
||||||
kfree((struct src_rsc_ctrl_blk *)blk);
|
kfree(blk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ static unsigned int src_param_pitch_mixer(unsigned int src_idx)
|
||||||
static int src_commit_write(struct hw *hw, unsigned int idx, void *blk)
|
static int src_commit_write(struct hw *hw, unsigned int idx, void *blk)
|
||||||
{
|
{
|
||||||
struct src_rsc_ctrl_blk *ctl = blk;
|
struct src_rsc_ctrl_blk *ctl = blk;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
if (ctl->dirty.bf.czbfs) {
|
if (ctl->dirty.bf.czbfs) {
|
||||||
/* Clear Z-Buffer registers */
|
/* Clear Z-Buffer registers */
|
||||||
|
@ -458,8 +458,8 @@ static int src_mgr_dsb_src(void *blk, unsigned int idx)
|
||||||
static int src_mgr_commit_write(struct hw *hw, void *blk)
|
static int src_mgr_commit_write(struct hw *hw, void *blk)
|
||||||
{
|
{
|
||||||
struct src_mgr_ctrl_blk *ctl = blk;
|
struct src_mgr_ctrl_blk *ctl = blk;
|
||||||
int i = 0;
|
int i;
|
||||||
unsigned int ret = 0;
|
unsigned int ret;
|
||||||
|
|
||||||
if (ctl->dirty.bf.enbsa) {
|
if (ctl->dirty.bf.enbsa) {
|
||||||
do {
|
do {
|
||||||
|
@ -494,7 +494,7 @@ static int src_mgr_get_ctrl_blk(void **rblk)
|
||||||
|
|
||||||
static int src_mgr_put_ctrl_blk(void *blk)
|
static int src_mgr_put_ctrl_blk(void *blk)
|
||||||
{
|
{
|
||||||
kfree((struct src_mgr_ctrl_blk *)blk);
|
kfree(blk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ static int srcimp_mgr_get_ctrl_blk(void **rblk)
|
||||||
|
|
||||||
static int srcimp_mgr_put_ctrl_blk(void *blk)
|
static int srcimp_mgr_put_ctrl_blk(void *blk)
|
||||||
{
|
{
|
||||||
kfree((struct srcimp_mgr_ctrl_blk *)blk);
|
kfree(blk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -704,7 +704,7 @@ static int amixer_rsc_get_ctrl_blk(void **rblk)
|
||||||
|
|
||||||
static int amixer_rsc_put_ctrl_blk(void *blk)
|
static int amixer_rsc_put_ctrl_blk(void *blk)
|
||||||
{
|
{
|
||||||
kfree((struct amixer_rsc_ctrl_blk *)blk);
|
kfree(blk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -893,7 +893,7 @@ static int dai_get_ctrl_blk(void **rblk)
|
||||||
|
|
||||||
static int dai_put_ctrl_blk(void *blk)
|
static int dai_put_ctrl_blk(void *blk)
|
||||||
{
|
{
|
||||||
kfree((struct dai_ctrl_blk *)blk);
|
kfree(blk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -943,7 +943,7 @@ static int dao_get_ctrl_blk(void **rblk)
|
||||||
|
|
||||||
static int dao_put_ctrl_blk(void *blk)
|
static int dao_put_ctrl_blk(void *blk)
|
||||||
{
|
{
|
||||||
kfree((struct dao_ctrl_blk *)blk);
|
kfree(blk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1051,8 +1051,8 @@ static int daio_mgr_set_imapaddr(void *blk, unsigned int addr)
|
||||||
static int daio_mgr_commit_write(struct hw *hw, void *blk)
|
static int daio_mgr_commit_write(struct hw *hw, void *blk)
|
||||||
{
|
{
|
||||||
struct daio_mgr_ctrl_blk *ctl = blk;
|
struct daio_mgr_ctrl_blk *ctl = blk;
|
||||||
unsigned int data = 0;
|
unsigned int data;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
if ((ctl->dirty.bf.atxctl & (0x1 << i))) {
|
if ((ctl->dirty.bf.atxctl & (0x1 << i))) {
|
||||||
|
@ -1080,7 +1080,7 @@ static int daio_mgr_commit_write(struct hw *hw, void *blk)
|
||||||
static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk)
|
static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk)
|
||||||
{
|
{
|
||||||
struct daio_mgr_ctrl_blk *blk;
|
struct daio_mgr_ctrl_blk *blk;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
*rblk = NULL;
|
*rblk = NULL;
|
||||||
blk = kzalloc(sizeof(*blk), GFP_KERNEL);
|
blk = kzalloc(sizeof(*blk), GFP_KERNEL);
|
||||||
|
@ -1099,7 +1099,7 @@ static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk)
|
||||||
|
|
||||||
static int daio_mgr_put_ctrl_blk(void *blk)
|
static int daio_mgr_put_ctrl_blk(void *blk)
|
||||||
{
|
{
|
||||||
kfree((struct daio_mgr_ctrl_blk *)blk);
|
kfree(blk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1125,7 +1125,7 @@ struct trn_conf {
|
||||||
|
|
||||||
static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
|
static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
|
||||||
{
|
{
|
||||||
u32 dwData = 0;
|
u32 dwData;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Program I2S with proper sample rate and enable the correct I2S
|
/* Program I2S with proper sample rate and enable the correct I2S
|
||||||
|
@ -1195,9 +1195,9 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
|
||||||
/* TRANSPORT operations */
|
/* TRANSPORT operations */
|
||||||
static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
|
static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
|
||||||
{
|
{
|
||||||
u32 vmctl = 0, data = 0;
|
u32 vmctl, data;
|
||||||
unsigned long ptp_phys_low = 0, ptp_phys_high = 0;
|
u32 ptp_phys_low, ptp_phys_high;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
/* Set up device page table */
|
/* Set up device page table */
|
||||||
if ((~0UL) == info->vm_pgt_phys) {
|
if ((~0UL) == info->vm_pgt_phys) {
|
||||||
|
@ -1433,7 +1433,7 @@ static int I2CLockChip(struct hw *hw)
|
||||||
|
|
||||||
static int I2CInit(struct hw *hw, u8 bDeviceID, u8 bAddressSize, u8 bDataSize)
|
static int I2CInit(struct hw *hw, u8 bDeviceID, u8 bAddressSize, u8 bDataSize)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
unsigned int RegI2CStatus;
|
unsigned int RegI2CStatus;
|
||||||
unsigned int RegI2CAddress;
|
unsigned int RegI2CAddress;
|
||||||
|
|
||||||
|
@ -1481,7 +1481,7 @@ static int I2CUninit(struct hw *hw)
|
||||||
static int I2CWaitDataReady(struct hw *hw)
|
static int I2CWaitDataReady(struct hw *hw)
|
||||||
{
|
{
|
||||||
int i = 0x400000;
|
int i = 0x400000;
|
||||||
unsigned int ret = 0;
|
unsigned int ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ret = hw_read_20kx(hw, I2C_IF_STATUS);
|
ret = hw_read_20kx(hw, I2C_IF_STATUS);
|
||||||
|
@ -1541,9 +1541,9 @@ static int I2CWrite(struct hw *hw, u16 wAddress, u32 dwData)
|
||||||
|
|
||||||
static int hw_dac_init(struct hw *hw, const struct dac_conf *info)
|
static int hw_dac_init(struct hw *hw, const struct dac_conf *info)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
u32 dwData = 0;
|
u32 dwData;
|
||||||
int i = 0;
|
int i;
|
||||||
struct REGS_CS4382 cs4382_Read = {0};
|
struct REGS_CS4382 cs4382_Read = {0};
|
||||||
struct REGS_CS4382 cs4382_Def = {
|
struct REGS_CS4382 cs4382_Def = {
|
||||||
0x00000001, /* Mode Control 1 */
|
0x00000001, /* Mode Control 1 */
|
||||||
|
@ -1696,7 +1696,7 @@ End:
|
||||||
|
|
||||||
static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
|
static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
|
||||||
{
|
{
|
||||||
u32 data = 0;
|
u32 data;
|
||||||
|
|
||||||
data = hw_read_20kx(hw, GPIO_DATA);
|
data = hw_read_20kx(hw, GPIO_DATA);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -1714,7 +1714,7 @@ static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
|
||||||
|
|
||||||
static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
|
static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
|
||||||
{
|
{
|
||||||
u32 data = 0;
|
u32 data;
|
||||||
|
|
||||||
data = hw_read_20kx(hw, GPIO_DATA);
|
data = hw_read_20kx(hw, GPIO_DATA);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -1747,8 +1747,8 @@ static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
|
||||||
|
|
||||||
static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
|
static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
u32 dwMux = 2, dwData = 0, dwCtl = 0;
|
u32 dwMux = 2, dwData, dwCtl;
|
||||||
|
|
||||||
/* Set ADC reset bit as output */
|
/* Set ADC reset bit as output */
|
||||||
dwData = hw_read_20kx(hw, GPIO_CTRL);
|
dwData = hw_read_20kx(hw, GPIO_CTRL);
|
||||||
|
|
|
@ -99,8 +99,8 @@ int input_mapper_delete(struct list_head *mappers, struct imapper *entry,
|
||||||
|
|
||||||
void free_input_mapper_list(struct list_head *head)
|
void free_input_mapper_list(struct list_head *head)
|
||||||
{
|
{
|
||||||
struct imapper *entry = NULL;
|
struct imapper *entry;
|
||||||
struct list_head *pos = NULL;
|
struct list_head *pos;
|
||||||
|
|
||||||
while (!list_empty(head)) {
|
while (!list_empty(head)) {
|
||||||
pos = head->next;
|
pos = head->next;
|
||||||
|
|
|
@ -298,7 +298,7 @@ set_switch_state(struct ct_mixer *mixer,
|
||||||
* from 2^-6 to (1+1023/1024) */
|
* from 2^-6 to (1+1023/1024) */
|
||||||
static unsigned int uint16_to_float14(unsigned int x)
|
static unsigned int uint16_to_float14(unsigned int x)
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
unsigned int i;
|
||||||
|
|
||||||
if (x < 17)
|
if (x < 17)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -318,7 +318,7 @@ static unsigned int uint16_to_float14(unsigned int x)
|
||||||
|
|
||||||
static unsigned int float14_to_uint16(unsigned int x)
|
static unsigned int float14_to_uint16(unsigned int x)
|
||||||
{
|
{
|
||||||
unsigned int e = 0;
|
unsigned int e;
|
||||||
|
|
||||||
if (!x)
|
if (!x)
|
||||||
return x;
|
return x;
|
||||||
|
@ -491,7 +491,7 @@ static int ct_alsa_mix_switch_put(struct snd_kcontrol *kcontrol,
|
||||||
struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
|
struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
|
||||||
struct ct_mixer *mixer = atc->mixer;
|
struct ct_mixer *mixer = atc->mixer;
|
||||||
enum CTALSA_MIXER_CTL type = kcontrol->private_value;
|
enum CTALSA_MIXER_CTL type = kcontrol->private_value;
|
||||||
int state = 0;
|
int state;
|
||||||
|
|
||||||
state = ucontrol->value.integer.value[0];
|
state = ucontrol->value.integer.value[0];
|
||||||
if (get_switch_state(mixer, type) == state)
|
if (get_switch_state(mixer, type) == state)
|
||||||
|
@ -574,7 +574,7 @@ static int ct_spdif_get(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
|
struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned int status = 0;
|
unsigned int status;
|
||||||
|
|
||||||
atc->spdif_out_get_status(atc, &status);
|
atc->spdif_out_get_status(atc, &status);
|
||||||
ucontrol->value.iec958.status[0] = (status >> 0) & 0xff;
|
ucontrol->value.iec958.status[0] = (status >> 0) & 0xff;
|
||||||
|
@ -589,8 +589,8 @@ static int ct_spdif_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
|
struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
|
||||||
int change = 1;
|
int change;
|
||||||
unsigned int status = 0, old_status = 0;
|
unsigned int status, old_status;
|
||||||
|
|
||||||
status = (ucontrol->value.iec958.status[0] << 0) |
|
status = (ucontrol->value.iec958.status[0] << 0) |
|
||||||
(ucontrol->value.iec958.status[1] << 8) |
|
(ucontrol->value.iec958.status[1] << 8) |
|
||||||
|
@ -641,8 +641,8 @@ static struct snd_kcontrol_new iec958_ctl = {
|
||||||
static int
|
static int
|
||||||
ct_mixer_kcontrol_new(struct ct_mixer *mixer, struct snd_kcontrol_new *new)
|
ct_mixer_kcontrol_new(struct ct_mixer *mixer, struct snd_kcontrol_new *new)
|
||||||
{
|
{
|
||||||
struct snd_kcontrol *kctl = NULL;
|
struct snd_kcontrol *kctl;
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
kctl = snd_ctl_new1(new, mixer->atc);
|
kctl = snd_ctl_new1(new, mixer->atc);
|
||||||
if (NULL == kctl)
|
if (NULL == kctl)
|
||||||
|
@ -669,9 +669,9 @@ ct_mixer_kcontrol_new(struct ct_mixer *mixer, struct snd_kcontrol_new *new)
|
||||||
|
|
||||||
static int ct_mixer_kcontrols_create(struct ct_mixer *mixer)
|
static int ct_mixer_kcontrols_create(struct ct_mixer *mixer)
|
||||||
{
|
{
|
||||||
enum CTALSA_MIXER_CTL type = 0;
|
enum CTALSA_MIXER_CTL type;
|
||||||
struct ct_atc *atc = mixer->atc;
|
struct ct_atc *atc = mixer->atc;
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
/* Create snd kcontrol instances on demand */
|
/* Create snd kcontrol instances on demand */
|
||||||
for (type = VOL_MIXER_START; type <= VOL_MIXER_END; type++) {
|
for (type = VOL_MIXER_START; type <= VOL_MIXER_END; type++) {
|
||||||
|
@ -733,9 +733,9 @@ static int ct_mixer_kcontrols_create(struct ct_mixer *mixer)
|
||||||
static void
|
static void
|
||||||
ct_mixer_recording_select(struct ct_mixer *mixer, enum CT_AMIXER_CTL type)
|
ct_mixer_recording_select(struct ct_mixer *mixer, enum CT_AMIXER_CTL type)
|
||||||
{
|
{
|
||||||
struct amixer *amix_d = NULL;
|
struct amixer *amix_d;
|
||||||
struct sum *sum_c = NULL;
|
struct sum *sum_c;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
amix_d = mixer->amixers[type*CHN_NUM+i];
|
amix_d = mixer->amixers[type*CHN_NUM+i];
|
||||||
|
@ -748,8 +748,8 @@ ct_mixer_recording_select(struct ct_mixer *mixer, enum CT_AMIXER_CTL type)
|
||||||
static void
|
static void
|
||||||
ct_mixer_recording_unselect(struct ct_mixer *mixer, enum CT_AMIXER_CTL type)
|
ct_mixer_recording_unselect(struct ct_mixer *mixer, enum CT_AMIXER_CTL type)
|
||||||
{
|
{
|
||||||
struct amixer *amix_d = NULL;
|
struct amixer *amix_d;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
amix_d = mixer->amixers[type*CHN_NUM+i];
|
amix_d = mixer->amixers[type*CHN_NUM+i];
|
||||||
|
@ -760,14 +760,14 @@ ct_mixer_recording_unselect(struct ct_mixer *mixer, enum CT_AMIXER_CTL type)
|
||||||
|
|
||||||
static int ct_mixer_get_resources(struct ct_mixer *mixer)
|
static int ct_mixer_get_resources(struct ct_mixer *mixer)
|
||||||
{
|
{
|
||||||
struct sum_mgr *sum_mgr = NULL;
|
struct sum_mgr *sum_mgr;
|
||||||
struct sum *sum = NULL;
|
struct sum *sum;
|
||||||
struct sum_desc sum_desc = {0};
|
struct sum_desc sum_desc = {0};
|
||||||
struct amixer_mgr *amixer_mgr = NULL;
|
struct amixer_mgr *amixer_mgr;
|
||||||
struct amixer *amixer = NULL;
|
struct amixer *amixer;
|
||||||
struct amixer_desc am_desc = {0};
|
struct amixer_desc am_desc = {0};
|
||||||
int err = 0;
|
int err;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
/* Allocate sum resources for mixer obj */
|
/* Allocate sum resources for mixer obj */
|
||||||
sum_mgr = (struct sum_mgr *)mixer->atc->rsc_mgrs[SUM];
|
sum_mgr = (struct sum_mgr *)mixer->atc->rsc_mgrs[SUM];
|
||||||
|
@ -822,8 +822,8 @@ error1:
|
||||||
|
|
||||||
static int ct_mixer_get_mem(struct ct_mixer **rmixer)
|
static int ct_mixer_get_mem(struct ct_mixer **rmixer)
|
||||||
{
|
{
|
||||||
struct ct_mixer *mixer = NULL;
|
struct ct_mixer *mixer;
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
*rmixer = NULL;
|
*rmixer = NULL;
|
||||||
/* Allocate mem for mixer obj */
|
/* Allocate mem for mixer obj */
|
||||||
|
@ -855,9 +855,9 @@ error1:
|
||||||
|
|
||||||
static int ct_mixer_topology_build(struct ct_mixer *mixer)
|
static int ct_mixer_topology_build(struct ct_mixer *mixer)
|
||||||
{
|
{
|
||||||
struct sum *sum = NULL;
|
struct sum *sum;
|
||||||
struct amixer *amix_d = NULL, *amix_s = NULL;
|
struct amixer *amix_d, *amix_s;
|
||||||
enum CT_AMIXER_CTL i = 0, j = 0;
|
enum CT_AMIXER_CTL i, j;
|
||||||
|
|
||||||
/* Build topology from destination to source */
|
/* Build topology from destination to source */
|
||||||
|
|
||||||
|
@ -1044,7 +1044,7 @@ int ct_mixer_destroy(struct ct_mixer *mixer)
|
||||||
struct sum_mgr *sum_mgr = (struct sum_mgr *)mixer->atc->rsc_mgrs[SUM];
|
struct sum_mgr *sum_mgr = (struct sum_mgr *)mixer->atc->rsc_mgrs[SUM];
|
||||||
struct amixer_mgr *amixer_mgr =
|
struct amixer_mgr *amixer_mgr =
|
||||||
(struct amixer_mgr *)mixer->atc->rsc_mgrs[AMIXER];
|
(struct amixer_mgr *)mixer->atc->rsc_mgrs[AMIXER];
|
||||||
struct amixer *amixer = NULL;
|
struct amixer *amixer;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
/* Release amixer resources */
|
/* Release amixer resources */
|
||||||
|
@ -1071,8 +1071,8 @@ int ct_mixer_destroy(struct ct_mixer *mixer)
|
||||||
|
|
||||||
int ct_mixer_create(struct ct_atc *atc, struct ct_mixer **rmixer)
|
int ct_mixer_create(struct ct_atc *atc, struct ct_mixer **rmixer)
|
||||||
{
|
{
|
||||||
struct ct_mixer *mixer = NULL;
|
struct ct_mixer *mixer;
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
*rmixer = NULL;
|
*rmixer = NULL;
|
||||||
|
|
||||||
|
@ -1109,7 +1109,7 @@ int ct_alsa_mix_create(struct ct_atc *atc,
|
||||||
enum CTALSADEVS device,
|
enum CTALSADEVS device,
|
||||||
const char *device_name)
|
const char *device_name)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
/* Create snd kcontrol instances on demand */
|
/* Create snd kcontrol instances on demand */
|
||||||
/* vol_ctl.device = swh_ctl.device = device; */ /* better w/ device 0 */
|
/* vol_ctl.device = swh_ctl.device = device; */ /* better w/ device 0 */
|
||||||
|
|
|
@ -27,7 +27,7 @@ static int
|
||||||
get_resource(u8 *rscs, unsigned int amount,
|
get_resource(u8 *rscs, unsigned int amount,
|
||||||
unsigned int multi, unsigned int *ridx)
|
unsigned int multi, unsigned int *ridx)
|
||||||
{
|
{
|
||||||
int i = 0, j = 0, k = 0, n = 0;
|
int i, j, k, n;
|
||||||
|
|
||||||
/* Check whether there are sufficient resources to meet request. */
|
/* Check whether there are sufficient resources to meet request. */
|
||||||
for (i = 0, n = multi; i < amount; i++) {
|
for (i = 0, n = multi; i < amount; i++) {
|
||||||
|
@ -61,7 +61,7 @@ get_resource(u8 *rscs, unsigned int amount,
|
||||||
|
|
||||||
static int put_resource(u8 *rscs, unsigned int multi, unsigned int idx)
|
static int put_resource(u8 *rscs, unsigned int multi, unsigned int idx)
|
||||||
{
|
{
|
||||||
unsigned int i = 0, j = 0, k = 0, n = 0;
|
unsigned int i, j, k, n;
|
||||||
|
|
||||||
/* Mark the contiguous bits in resource bit-map as used */
|
/* Mark the contiguous bits in resource bit-map as used */
|
||||||
for (n = multi, i = idx; n > 0; n--) {
|
for (n = multi, i = idx; n > 0; n--) {
|
||||||
|
@ -76,7 +76,7 @@ static int put_resource(u8 *rscs, unsigned int multi, unsigned int idx)
|
||||||
|
|
||||||
int mgr_get_resource(struct rsc_mgr *mgr, unsigned int n, unsigned int *ridx)
|
int mgr_get_resource(struct rsc_mgr *mgr, unsigned int n, unsigned int *ridx)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
if (n > mgr->avail)
|
if (n > mgr->avail)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
|
@ -37,9 +37,9 @@ static int (*src_default_config[3])(struct src *) = {
|
||||||
|
|
||||||
static int src_set_state(struct src *src, unsigned int state)
|
static int src_set_state(struct src *src, unsigned int state)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_state(src->rsc.ctrl_blk, state);
|
hw->src_set_state(src->rsc.ctrl_blk, state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -47,9 +47,9 @@ static int src_set_state(struct src *src, unsigned int state)
|
||||||
|
|
||||||
static int src_set_bm(struct src *src, unsigned int bm)
|
static int src_set_bm(struct src *src, unsigned int bm)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_bm(src->rsc.ctrl_blk, bm);
|
hw->src_set_bm(src->rsc.ctrl_blk, bm);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -57,9 +57,9 @@ static int src_set_bm(struct src *src, unsigned int bm)
|
||||||
|
|
||||||
static int src_set_sf(struct src *src, unsigned int sf)
|
static int src_set_sf(struct src *src, unsigned int sf)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_sf(src->rsc.ctrl_blk, sf);
|
hw->src_set_sf(src->rsc.ctrl_blk, sf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -67,9 +67,9 @@ static int src_set_sf(struct src *src, unsigned int sf)
|
||||||
|
|
||||||
static int src_set_pm(struct src *src, unsigned int pm)
|
static int src_set_pm(struct src *src, unsigned int pm)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_pm(src->rsc.ctrl_blk, pm);
|
hw->src_set_pm(src->rsc.ctrl_blk, pm);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -77,9 +77,9 @@ static int src_set_pm(struct src *src, unsigned int pm)
|
||||||
|
|
||||||
static int src_set_rom(struct src *src, unsigned int rom)
|
static int src_set_rom(struct src *src, unsigned int rom)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_rom(src->rsc.ctrl_blk, rom);
|
hw->src_set_rom(src->rsc.ctrl_blk, rom);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -87,9 +87,9 @@ static int src_set_rom(struct src *src, unsigned int rom)
|
||||||
|
|
||||||
static int src_set_vo(struct src *src, unsigned int vo)
|
static int src_set_vo(struct src *src, unsigned int vo)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_vo(src->rsc.ctrl_blk, vo);
|
hw->src_set_vo(src->rsc.ctrl_blk, vo);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -97,9 +97,9 @@ static int src_set_vo(struct src *src, unsigned int vo)
|
||||||
|
|
||||||
static int src_set_st(struct src *src, unsigned int st)
|
static int src_set_st(struct src *src, unsigned int st)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_st(src->rsc.ctrl_blk, st);
|
hw->src_set_st(src->rsc.ctrl_blk, st);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -107,9 +107,9 @@ static int src_set_st(struct src *src, unsigned int st)
|
||||||
|
|
||||||
static int src_set_bp(struct src *src, unsigned int bp)
|
static int src_set_bp(struct src *src, unsigned int bp)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_bp(src->rsc.ctrl_blk, bp);
|
hw->src_set_bp(src->rsc.ctrl_blk, bp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -117,9 +117,9 @@ static int src_set_bp(struct src *src, unsigned int bp)
|
||||||
|
|
||||||
static int src_set_cisz(struct src *src, unsigned int cisz)
|
static int src_set_cisz(struct src *src, unsigned int cisz)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_cisz(src->rsc.ctrl_blk, cisz);
|
hw->src_set_cisz(src->rsc.ctrl_blk, cisz);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -127,9 +127,9 @@ static int src_set_cisz(struct src *src, unsigned int cisz)
|
||||||
|
|
||||||
static int src_set_ca(struct src *src, unsigned int ca)
|
static int src_set_ca(struct src *src, unsigned int ca)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_ca(src->rsc.ctrl_blk, ca);
|
hw->src_set_ca(src->rsc.ctrl_blk, ca);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -137,9 +137,9 @@ static int src_set_ca(struct src *src, unsigned int ca)
|
||||||
|
|
||||||
static int src_set_sa(struct src *src, unsigned int sa)
|
static int src_set_sa(struct src *src, unsigned int sa)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_sa(src->rsc.ctrl_blk, sa);
|
hw->src_set_sa(src->rsc.ctrl_blk, sa);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -147,9 +147,9 @@ static int src_set_sa(struct src *src, unsigned int sa)
|
||||||
|
|
||||||
static int src_set_la(struct src *src, unsigned int la)
|
static int src_set_la(struct src *src, unsigned int la)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_la(src->rsc.ctrl_blk, la);
|
hw->src_set_la(src->rsc.ctrl_blk, la);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -157,9 +157,9 @@ static int src_set_la(struct src *src, unsigned int la)
|
||||||
|
|
||||||
static int src_set_pitch(struct src *src, unsigned int pitch)
|
static int src_set_pitch(struct src *src, unsigned int pitch)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_pitch(src->rsc.ctrl_blk, pitch);
|
hw->src_set_pitch(src->rsc.ctrl_blk, pitch);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -167,9 +167,9 @@ static int src_set_pitch(struct src *src, unsigned int pitch)
|
||||||
|
|
||||||
static int src_set_clear_zbufs(struct src *src)
|
static int src_set_clear_zbufs(struct src *src)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
hw->src_set_clear_zbufs(src->rsc.ctrl_blk, 1);
|
hw->src_set_clear_zbufs(src->rsc.ctrl_blk, 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -177,11 +177,11 @@ static int src_set_clear_zbufs(struct src *src)
|
||||||
|
|
||||||
static int src_commit_write(struct src *src)
|
static int src_commit_write(struct src *src)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
int i = 0;
|
int i;
|
||||||
unsigned int dirty = 0;
|
unsigned int dirty = 0;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
src->rsc.ops->master(&src->rsc);
|
src->rsc.ops->master(&src->rsc);
|
||||||
if (src->rsc.msr > 1) {
|
if (src->rsc.msr > 1) {
|
||||||
/* Save dirty flags for conjugate resource programming */
|
/* Save dirty flags for conjugate resource programming */
|
||||||
|
@ -207,9 +207,9 @@ static int src_commit_write(struct src *src)
|
||||||
|
|
||||||
static int src_get_ca(struct src *src)
|
static int src_get_ca(struct src *src)
|
||||||
{
|
{
|
||||||
struct hw *hw = NULL;
|
struct hw *hw;
|
||||||
|
|
||||||
hw = (struct hw *)src->rsc.hw;
|
hw = src->rsc.hw;
|
||||||
return hw->src_get_ca(hw, src->rsc.ops->index(&src->rsc),
|
return hw->src_get_ca(hw, src->rsc.ops->index(&src->rsc),
|
||||||
src->rsc.ctrl_blk);
|
src->rsc.ctrl_blk);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ static struct src *src_next_interleave(struct src *src)
|
||||||
static int src_default_config_memrd(struct src *src)
|
static int src_default_config_memrd(struct src *src)
|
||||||
{
|
{
|
||||||
struct hw *hw = src->rsc.hw;
|
struct hw *hw = src->rsc.hw;
|
||||||
unsigned int rsr = 0, msr = 0;
|
unsigned int rsr, msr;
|
||||||
|
|
||||||
hw->src_set_state(src->rsc.ctrl_blk, SRC_STATE_OFF);
|
hw->src_set_state(src->rsc.ctrl_blk, SRC_STATE_OFF);
|
||||||
hw->src_set_bm(src->rsc.ctrl_blk, 1);
|
hw->src_set_bm(src->rsc.ctrl_blk, 1);
|
||||||
|
@ -297,7 +297,7 @@ static int src_default_config_memwr(struct src *src)
|
||||||
static int src_default_config_arcrw(struct src *src)
|
static int src_default_config_arcrw(struct src *src)
|
||||||
{
|
{
|
||||||
struct hw *hw = src->rsc.hw;
|
struct hw *hw = src->rsc.hw;
|
||||||
unsigned int rsr = 0, msr = 0;
|
unsigned int rsr, msr;
|
||||||
unsigned int dirty;
|
unsigned int dirty;
|
||||||
|
|
||||||
hw->src_set_state(src->rsc.ctrl_blk, SRC_STATE_OFF);
|
hw->src_set_state(src->rsc.ctrl_blk, SRC_STATE_OFF);
|
||||||
|
@ -360,8 +360,8 @@ static int
|
||||||
src_rsc_init(struct src *src, u32 idx,
|
src_rsc_init(struct src *src, u32 idx,
|
||||||
const struct src_desc *desc, struct src_mgr *mgr)
|
const struct src_desc *desc, struct src_mgr *mgr)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
int i = 0, n = 0;
|
int i, n;
|
||||||
struct src *p;
|
struct src *p;
|
||||||
|
|
||||||
n = (MEMRD == desc->mode) ? desc->multi : 1;
|
n = (MEMRD == desc->mode) ? desc->multi : 1;
|
||||||
|
@ -395,7 +395,7 @@ error1:
|
||||||
|
|
||||||
static int src_rsc_uninit(struct src *src, struct src_mgr *mgr)
|
static int src_rsc_uninit(struct src *src, struct src_mgr *mgr)
|
||||||
{
|
{
|
||||||
int i = 0, n = 0;
|
int i, n;
|
||||||
struct src *p;
|
struct src *p;
|
||||||
|
|
||||||
n = (MEMRD == src->mode) ? src->multi : 1;
|
n = (MEMRD == src->mode) ? src->multi : 1;
|
||||||
|
@ -416,8 +416,8 @@ static int
|
||||||
get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc)
|
get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc)
|
||||||
{
|
{
|
||||||
unsigned int idx = SRC_RESOURCE_NUM;
|
unsigned int idx = SRC_RESOURCE_NUM;
|
||||||
int err = 0;
|
int err;
|
||||||
struct src *src = NULL;
|
struct src *src;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
*rsrc = NULL;
|
*rsrc = NULL;
|
||||||
|
@ -489,7 +489,7 @@ static int put_src_rsc(struct src_mgr *mgr, struct src *src)
|
||||||
static int src_enable_s(struct src_mgr *mgr, struct src *src)
|
static int src_enable_s(struct src_mgr *mgr, struct src *src)
|
||||||
{
|
{
|
||||||
struct hw *hw = mgr->mgr.hw;
|
struct hw *hw = mgr->mgr.hw;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
src->rsc.ops->master(&src->rsc);
|
src->rsc.ops->master(&src->rsc);
|
||||||
for (i = 0; i < src->rsc.msr; i++) {
|
for (i = 0; i < src->rsc.msr; i++) {
|
||||||
|
@ -505,7 +505,7 @@ static int src_enable_s(struct src_mgr *mgr, struct src *src)
|
||||||
static int src_enable(struct src_mgr *mgr, struct src *src)
|
static int src_enable(struct src_mgr *mgr, struct src *src)
|
||||||
{
|
{
|
||||||
struct hw *hw = mgr->mgr.hw;
|
struct hw *hw = mgr->mgr.hw;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
src->rsc.ops->master(&src->rsc);
|
src->rsc.ops->master(&src->rsc);
|
||||||
for (i = 0; i < src->rsc.msr; i++) {
|
for (i = 0; i < src->rsc.msr; i++) {
|
||||||
|
@ -521,7 +521,7 @@ static int src_enable(struct src_mgr *mgr, struct src *src)
|
||||||
static int src_disable(struct src_mgr *mgr, struct src *src)
|
static int src_disable(struct src_mgr *mgr, struct src *src)
|
||||||
{
|
{
|
||||||
struct hw *hw = mgr->mgr.hw;
|
struct hw *hw = mgr->mgr.hw;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
src->rsc.ops->master(&src->rsc);
|
src->rsc.ops->master(&src->rsc);
|
||||||
for (i = 0; i < src->rsc.msr; i++) {
|
for (i = 0; i < src->rsc.msr; i++) {
|
||||||
|
@ -545,7 +545,7 @@ static int src_mgr_commit_write(struct src_mgr *mgr)
|
||||||
|
|
||||||
int src_mgr_create(void *hw, struct src_mgr **rsrc_mgr)
|
int src_mgr_create(void *hw, struct src_mgr **rsrc_mgr)
|
||||||
{
|
{
|
||||||
int err = 0, i = 0;
|
int err, i;
|
||||||
struct src_mgr *src_mgr;
|
struct src_mgr *src_mgr;
|
||||||
|
|
||||||
*rsrc_mgr = NULL;
|
*rsrc_mgr = NULL;
|
||||||
|
@ -618,8 +618,8 @@ static struct rsc_ops srcimp_basic_rsc_ops = {
|
||||||
|
|
||||||
static int srcimp_map(struct srcimp *srcimp, struct src *src, struct rsc *input)
|
static int srcimp_map(struct srcimp *srcimp, struct src *src, struct rsc *input)
|
||||||
{
|
{
|
||||||
struct imapper *entry = NULL;
|
struct imapper *entry;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
srcimp->rsc.ops->master(&srcimp->rsc);
|
srcimp->rsc.ops->master(&srcimp->rsc);
|
||||||
src->rsc.ops->master(&src->rsc);
|
src->rsc.ops->master(&src->rsc);
|
||||||
|
@ -646,7 +646,7 @@ static int srcimp_map(struct srcimp *srcimp, struct src *src, struct rsc *input)
|
||||||
|
|
||||||
static int srcimp_unmap(struct srcimp *srcimp)
|
static int srcimp_unmap(struct srcimp *srcimp)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
/* Program master and conjugate resources */
|
/* Program master and conjugate resources */
|
||||||
for (i = 0; i < srcimp->rsc.msr; i++) {
|
for (i = 0; i < srcimp->rsc.msr; i++) {
|
||||||
|
@ -669,7 +669,7 @@ static int srcimp_rsc_init(struct srcimp *srcimp,
|
||||||
const struct srcimp_desc *desc,
|
const struct srcimp_desc *desc,
|
||||||
struct srcimp_mgr *mgr)
|
struct srcimp_mgr *mgr)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
err = rsc_init(&srcimp->rsc, srcimp->idx[0],
|
err = rsc_init(&srcimp->rsc, srcimp->idx[0],
|
||||||
SRCIMP, desc->msr, mgr->mgr.hw);
|
SRCIMP, desc->msr, mgr->mgr.hw);
|
||||||
|
@ -715,9 +715,9 @@ static int get_srcimp_rsc(struct srcimp_mgr *mgr,
|
||||||
const struct srcimp_desc *desc,
|
const struct srcimp_desc *desc,
|
||||||
struct srcimp **rsrcimp)
|
struct srcimp **rsrcimp)
|
||||||
{
|
{
|
||||||
int err = 0, i = 0;
|
int err, i;
|
||||||
unsigned int idx = 0;
|
unsigned int idx;
|
||||||
struct srcimp *srcimp = NULL;
|
struct srcimp *srcimp;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
*rsrcimp = NULL;
|
*rsrcimp = NULL;
|
||||||
|
@ -765,7 +765,7 @@ error1:
|
||||||
static int put_srcimp_rsc(struct srcimp_mgr *mgr, struct srcimp *srcimp)
|
static int put_srcimp_rsc(struct srcimp_mgr *mgr, struct srcimp *srcimp)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
spin_lock_irqsave(&mgr->mgr_lock, flags);
|
spin_lock_irqsave(&mgr->mgr_lock, flags);
|
||||||
for (i = 0; i < srcimp->rsc.msr; i++)
|
for (i = 0; i < srcimp->rsc.msr; i++)
|
||||||
|
@ -795,7 +795,7 @@ static int srcimp_map_op(void *data, struct imapper *entry)
|
||||||
static int srcimp_imap_add(struct srcimp_mgr *mgr, struct imapper *entry)
|
static int srcimp_imap_add(struct srcimp_mgr *mgr, struct imapper *entry)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
spin_lock_irqsave(&mgr->imap_lock, flags);
|
spin_lock_irqsave(&mgr->imap_lock, flags);
|
||||||
if ((0 == entry->addr) && (mgr->init_imap_added)) {
|
if ((0 == entry->addr) && (mgr->init_imap_added)) {
|
||||||
|
@ -812,7 +812,7 @@ static int srcimp_imap_add(struct srcimp_mgr *mgr, struct imapper *entry)
|
||||||
static int srcimp_imap_delete(struct srcimp_mgr *mgr, struct imapper *entry)
|
static int srcimp_imap_delete(struct srcimp_mgr *mgr, struct imapper *entry)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
spin_lock_irqsave(&mgr->imap_lock, flags);
|
spin_lock_irqsave(&mgr->imap_lock, flags);
|
||||||
err = input_mapper_delete(&mgr->imappers, entry, srcimp_map_op, mgr);
|
err = input_mapper_delete(&mgr->imappers, entry, srcimp_map_op, mgr);
|
||||||
|
@ -828,7 +828,7 @@ static int srcimp_imap_delete(struct srcimp_mgr *mgr, struct imapper *entry)
|
||||||
|
|
||||||
int srcimp_mgr_create(void *hw, struct srcimp_mgr **rsrcimp_mgr)
|
int srcimp_mgr_create(void *hw, struct srcimp_mgr **rsrcimp_mgr)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err;
|
||||||
struct srcimp_mgr *srcimp_mgr;
|
struct srcimp_mgr *srcimp_mgr;
|
||||||
struct imapper *entry;
|
struct imapper *entry;
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
static struct ct_vm_block *
|
static struct ct_vm_block *
|
||||||
get_vm_block(struct ct_vm *vm, unsigned int size)
|
get_vm_block(struct ct_vm *vm, unsigned int size)
|
||||||
{
|
{
|
||||||
struct ct_vm_block *block = NULL, *entry = NULL;
|
struct ct_vm_block *block = NULL, *entry;
|
||||||
struct list_head *pos = NULL;
|
struct list_head *pos;
|
||||||
|
|
||||||
size = CT_PAGE_ALIGN(size);
|
size = CT_PAGE_ALIGN(size);
|
||||||
if (size > vm->size) {
|
if (size > vm->size) {
|
||||||
|
@ -77,8 +77,8 @@ get_vm_block(struct ct_vm *vm, unsigned int size)
|
||||||
|
|
||||||
static void put_vm_block(struct ct_vm *vm, struct ct_vm_block *block)
|
static void put_vm_block(struct ct_vm *vm, struct ct_vm_block *block)
|
||||||
{
|
{
|
||||||
struct ct_vm_block *entry = NULL, *pre_ent = NULL;
|
struct ct_vm_block *entry, *pre_ent;
|
||||||
struct list_head *pos = NULL, *pre = NULL;
|
struct list_head *pos, *pre;
|
||||||
|
|
||||||
block->size = CT_PAGE_ALIGN(block->size);
|
block->size = CT_PAGE_ALIGN(block->size);
|
||||||
|
|
||||||
|
@ -223,8 +223,8 @@ int ct_vm_create(struct ct_vm **rvm)
|
||||||
void ct_vm_destroy(struct ct_vm *vm)
|
void ct_vm_destroy(struct ct_vm *vm)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct list_head *pos = NULL;
|
struct list_head *pos;
|
||||||
struct ct_vm_block *entry = NULL;
|
struct ct_vm_block *entry;
|
||||||
|
|
||||||
/* free used and unused list nodes */
|
/* free used and unused list nodes */
|
||||||
while (!list_empty(&vm->used)) {
|
while (!list_empty(&vm->used)) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче