Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
2291d269
Commit
2291d269
authored
Aug 22, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/tlv320aic26' into asoc-next
parents
840f0e43
4a11bc2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
+36
-15
sound/soc/codecs/tlv320aic26.c
sound/soc/codecs/tlv320aic26.c
+36
-15
No files found.
sound/soc/codecs/tlv320aic26.c
View file @
2291d269
...
...
@@ -29,7 +29,7 @@ MODULE_LICENSE("GPL");
/* AIC26 driver private data */
struct
aic26
{
struct
spi_device
*
spi
;
struct
snd_soc_codec
codec
;
struct
snd_soc_codec
*
codec
;
int
master
;
int
datfm
;
int
mclk
;
...
...
@@ -119,6 +119,22 @@ static int aic26_reg_write(struct snd_soc_codec *codec, unsigned int reg,
return
0
;
}
static
const
struct
snd_soc_dapm_widget
tlv320aic26_dapm_widgets
[]
=
{
SND_SOC_DAPM_INPUT
(
"MICIN"
),
SND_SOC_DAPM_INPUT
(
"AUX"
),
SND_SOC_DAPM_OUTPUT
(
"HPL"
),
SND_SOC_DAPM_OUTPUT
(
"HPR"
),
};
static
const
struct
snd_soc_dapm_route
tlv320aic26_dapm_routes
[]
=
{
{
"Capture"
,
NULL
,
"MICIN"
},
{
"Capture"
,
NULL
,
"AUX"
},
{
"HPL"
,
NULL
,
"Playback"
},
{
"HPR"
,
NULL
,
"Playback"
},
};
/* ---------------------------------------------------------------------
* Digital Audio Interface Operations
*/
...
...
@@ -174,9 +190,9 @@ static int aic26_hw_params(struct snd_pcm_substream *substream,
dev_dbg
(
&
aic26
->
spi
->
dev
,
"Setting PLLM to %d.%04d
\n
"
,
jval
,
dval
);
qval
=
0
;
reg
=
0x8000
|
qval
<<
11
|
pval
<<
8
|
jval
<<
2
;
aic26_reg
_write
(
codec
,
AIC26_REG_PLL_PROG1
,
reg
);
snd_soc
_write
(
codec
,
AIC26_REG_PLL_PROG1
,
reg
);
reg
=
dval
<<
2
;
aic26_reg
_write
(
codec
,
AIC26_REG_PLL_PROG2
,
reg
);
snd_soc
_write
(
codec
,
AIC26_REG_PLL_PROG2
,
reg
);
/* Audio Control 3 (master mode, fsref rate) */
reg
=
aic26_reg_read_cache
(
codec
,
AIC26_REG_AUDIO_CTRL3
);
...
...
@@ -185,13 +201,13 @@ static int aic26_hw_params(struct snd_pcm_substream *substream,
reg
|=
0x0800
;
if
(
fsref
==
48000
)
reg
|=
0x2000
;
aic26_reg
_write
(
codec
,
AIC26_REG_AUDIO_CTRL3
,
reg
);
snd_soc
_write
(
codec
,
AIC26_REG_AUDIO_CTRL3
,
reg
);
/* Audio Control 1 (FSref divisor) */
reg
=
aic26_reg_read_cache
(
codec
,
AIC26_REG_AUDIO_CTRL1
);
reg
&=
~
0x0fff
;
reg
|=
wlen
|
aic26
->
datfm
|
(
divisor
<<
3
)
|
divisor
;
aic26_reg
_write
(
codec
,
AIC26_REG_AUDIO_CTRL1
,
reg
);
snd_soc
_write
(
codec
,
AIC26_REG_AUDIO_CTRL1
,
reg
);
return
0
;
}
...
...
@@ -212,7 +228,7 @@ static int aic26_mute(struct snd_soc_dai *dai, int mute)
reg
|=
0x8080
;
else
reg
&=
~
0x8080
;
aic26_reg
_write
(
codec
,
AIC26_REG_DAC_GAIN
,
reg
);
snd_soc
_write
(
codec
,
AIC26_REG_DAC_GAIN
,
reg
);
return
0
;
}
...
...
@@ -330,7 +346,7 @@ static ssize_t aic26_keyclick_show(struct device *dev,
struct
aic26
*
aic26
=
dev_get_drvdata
(
dev
);
int
val
,
amp
,
freq
,
len
;
val
=
aic26_reg_read_cache
(
&
aic26
->
codec
,
AIC26_REG_AUDIO_CTRL2
);
val
=
aic26_reg_read_cache
(
aic26
->
codec
,
AIC26_REG_AUDIO_CTRL2
);
amp
=
(
val
>>
12
)
&
0x7
;
freq
=
(
125
<<
((
val
>>
8
)
&
0x7
))
>>
1
;
len
=
2
*
(
1
+
((
val
>>
4
)
&
0xf
));
...
...
@@ -346,9 +362,9 @@ static ssize_t aic26_keyclick_set(struct device *dev,
struct
aic26
*
aic26
=
dev_get_drvdata
(
dev
);
int
val
;
val
=
aic26_reg_read_cache
(
&
aic26
->
codec
,
AIC26_REG_AUDIO_CTRL2
);
val
=
aic26_reg_read_cache
(
aic26
->
codec
,
AIC26_REG_AUDIO_CTRL2
);
val
|=
0x8000
;
aic26_reg_write
(
&
aic26
->
codec
,
AIC26_REG_AUDIO_CTRL2
,
val
);
snd_soc_write
(
aic26
->
codec
,
AIC26_REG_AUDIO_CTRL2
,
val
);
return
count
;
}
...
...
@@ -360,25 +376,26 @@ static DEVICE_ATTR(keyclick, 0644, aic26_keyclick_show, aic26_keyclick_set);
*/
static
int
aic26_probe
(
struct
snd_soc_codec
*
codec
)
{
struct
aic26
*
aic26
=
dev_get_drvdata
(
codec
->
dev
);
int
ret
,
err
,
i
,
reg
;
dev_info
(
codec
->
dev
,
"Probing AIC26 SoC CODEC driver
\n
"
)
;
aic26
->
codec
=
codec
;
/* Reset the codec to power on defaults */
aic26_reg
_write
(
codec
,
AIC26_REG_RESET
,
0xBB00
);
snd_soc
_write
(
codec
,
AIC26_REG_RESET
,
0xBB00
);
/* Power up CODEC */
aic26_reg
_write
(
codec
,
AIC26_REG_POWER_CTRL
,
0
);
snd_soc
_write
(
codec
,
AIC26_REG_POWER_CTRL
,
0
);
/* Audio Control 3 (master mode, fsref rate) */
reg
=
aic26_reg
_read
(
codec
,
AIC26_REG_AUDIO_CTRL3
);
reg
=
snd_soc
_read
(
codec
,
AIC26_REG_AUDIO_CTRL3
);
reg
&=
~
0xf800
;
reg
|=
0x0800
;
/* set master mode */
aic26_reg
_write
(
codec
,
AIC26_REG_AUDIO_CTRL3
,
reg
);
snd_soc
_write
(
codec
,
AIC26_REG_AUDIO_CTRL3
,
reg
);
/* Fill register cache */
for
(
i
=
0
;
i
<
codec
->
driver
->
reg_cache_size
;
i
++
)
aic26_reg
_read
(
codec
,
i
);
snd_soc
_read
(
codec
,
i
);
/* Register the sysfs files for debugging */
/* Create SysFS files */
...
...
@@ -401,6 +418,10 @@ static struct snd_soc_codec_driver aic26_soc_codec_dev = {
.
write
=
aic26_reg_write
,
.
reg_cache_size
=
AIC26_NUM_REGS
,
.
reg_word_size
=
sizeof
(
u16
),
.
dapm_widgets
=
tlv320aic26_dapm_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
tlv320aic26_dapm_widgets
),
.
dapm_routes
=
tlv320aic26_dapm_routes
,
.
num_dapm_routes
=
ARRAY_SIZE
(
tlv320aic26_dapm_routes
),
};
/* ---------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment