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
07797e9b
Commit
07797e9b
authored
Oct 24, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/mc13783' into asoc-next
parents
ed87aabf
bb7838d4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
61 deletions
+91
-61
drivers/mfd/mc13xxx-core.c
drivers/mfd/mc13xxx-core.c
+0
-5
drivers/mfd/mc13xxx-spi.c
drivers/mfd/mc13xxx-spi.c
+5
-0
include/linux/mfd/mc13xxx.h
include/linux/mfd/mc13xxx.h
+7
-0
sound/soc/codecs/mc13783.c
sound/soc/codecs/mc13783.c
+79
-56
No files found.
drivers/mfd/mc13xxx-core.c
View file @
07797e9b
...
...
@@ -158,8 +158,6 @@ int mc13xxx_reg_read(struct mc13xxx *mc13xxx, unsigned int offset, u32 *val)
{
int
ret
;
BUG_ON
(
!
mutex_is_locked
(
&
mc13xxx
->
lock
));
if
(
offset
>
MC13XXX_NUMREGS
)
return
-
EINVAL
;
...
...
@@ -172,8 +170,6 @@ EXPORT_SYMBOL(mc13xxx_reg_read);
int
mc13xxx_reg_write
(
struct
mc13xxx
*
mc13xxx
,
unsigned
int
offset
,
u32
val
)
{
BUG_ON
(
!
mutex_is_locked
(
&
mc13xxx
->
lock
));
dev_vdbg
(
mc13xxx
->
dev
,
"[0x%02x] <- 0x%06x
\n
"
,
offset
,
val
);
if
(
offset
>
MC13XXX_NUMREGS
||
val
>
0xffffff
)
...
...
@@ -186,7 +182,6 @@ EXPORT_SYMBOL(mc13xxx_reg_write);
int
mc13xxx_reg_rmw
(
struct
mc13xxx
*
mc13xxx
,
unsigned
int
offset
,
u32
mask
,
u32
val
)
{
BUG_ON
(
!
mutex_is_locked
(
&
mc13xxx
->
lock
));
BUG_ON
(
val
&
~
mask
);
dev_vdbg
(
mc13xxx
->
dev
,
"[0x%02x] <- 0x%06x (mask: 0x%06x)
\n
"
,
offset
,
val
,
mask
);
...
...
drivers/mfd/mc13xxx-spi.c
View file @
07797e9b
...
...
@@ -94,10 +94,15 @@ static int mc13xxx_spi_write(void *context, const void *data, size_t count)
{
struct
device
*
dev
=
context
;
struct
spi_device
*
spi
=
to_spi_device
(
dev
);
const
char
*
reg
=
data
;
if
(
count
!=
4
)
return
-
ENOTSUPP
;
/* include errata fix for spi audio problems */
if
(
*
reg
==
MC13783_AUDIO_CODEC
||
*
reg
==
MC13783_AUDIO_DAC
)
spi_write
(
spi
,
data
,
count
);
return
spi_write
(
spi
,
data
,
count
);
}
...
...
include/linux/mfd/mc13xxx.h
View file @
07797e9b
...
...
@@ -41,6 +41,13 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
unsigned
int
mode
,
unsigned
int
channel
,
u8
ato
,
bool
atox
,
unsigned
int
*
sample
);
#define MC13783_AUDIO_RX0 36
#define MC13783_AUDIO_RX1 37
#define MC13783_AUDIO_TX 38
#define MC13783_SSI_NETWORK 39
#define MC13783_AUDIO_CODEC 40
#define MC13783_AUDIO_DAC 41
#define MC13XXX_IRQ_ADCDONE 0
#define MC13XXX_IRQ_ADCBISDONE 1
#define MC13XXX_IRQ_TS 2
...
...
sound/soc/codecs/mc13783.c
View file @
07797e9b
...
...
@@ -30,16 +30,10 @@
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/soc-dapm.h>
#include <linux/regmap.h>
#include "mc13783.h"
#define MC13783_AUDIO_RX0 36
#define MC13783_AUDIO_RX1 37
#define MC13783_AUDIO_TX 38
#define MC13783_SSI_NETWORK 39
#define MC13783_AUDIO_CODEC 40
#define MC13783_AUDIO_DAC 41
#define AUDIO_RX0_ALSPEN (1 << 5)
#define AUDIO_RX0_ALSPSEL (1 << 7)
#define AUDIO_RX0_ADDCDC (1 << 21)
...
...
@@ -95,45 +89,12 @@
struct
mc13783_priv
{
struct
mc13xxx
*
mc13xxx
;
struct
regmap
*
regmap
;
enum
mc13783_ssi_port
adc_ssi_port
;
enum
mc13783_ssi_port
dac_ssi_port
;
};
static
unsigned
int
mc13783_read
(
struct
snd_soc_codec
*
codec
,
unsigned
int
reg
)
{
struct
mc13783_priv
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
unsigned
int
value
=
0
;
mc13xxx_lock
(
priv
->
mc13xxx
);
mc13xxx_reg_read
(
priv
->
mc13xxx
,
reg
,
&
value
);
mc13xxx_unlock
(
priv
->
mc13xxx
);
return
value
;
}
static
int
mc13783_write
(
struct
snd_soc_codec
*
codec
,
unsigned
int
reg
,
unsigned
int
value
)
{
struct
mc13783_priv
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
int
ret
;
mc13xxx_lock
(
priv
->
mc13xxx
);
ret
=
mc13xxx_reg_write
(
priv
->
mc13xxx
,
reg
,
value
);
/* include errata fix for spi audio problems */
if
(
reg
==
MC13783_AUDIO_CODEC
||
reg
==
MC13783_AUDIO_DAC
)
ret
=
mc13xxx_reg_write
(
priv
->
mc13xxx
,
reg
,
value
);
mc13xxx_unlock
(
priv
->
mc13xxx
);
return
ret
;
}
/* Mapping between sample rates and register value */
static
unsigned
int
mc13783_rates
[]
=
{
8000
,
11025
,
12000
,
16000
,
...
...
@@ -466,6 +427,29 @@ static const struct snd_kcontrol_new right_input_mux =
static
const
struct
snd_kcontrol_new
samp_ctl
=
SOC_DAPM_SINGLE
(
"Switch"
,
MC13783_AUDIO_RX0
,
3
,
1
,
0
);
static
const
char
*
const
speaker_amp_source_text
[]
=
{
"CODEC"
,
"Right"
};
static
const
SOC_ENUM_SINGLE_DECL
(
speaker_amp_source
,
MC13783_AUDIO_RX0
,
4
,
speaker_amp_source_text
);
static
const
struct
snd_kcontrol_new
speaker_amp_source_mux
=
SOC_DAPM_ENUM
(
"Speaker Amp Source MUX"
,
speaker_amp_source
);
static
const
char
*
const
headset_amp_source_text
[]
=
{
"CODEC"
,
"Mixer"
};
static
const
SOC_ENUM_SINGLE_DECL
(
headset_amp_source
,
MC13783_AUDIO_RX0
,
11
,
headset_amp_source_text
);
static
const
struct
snd_kcontrol_new
headset_amp_source_mux
=
SOC_DAPM_ENUM
(
"Headset Amp Source MUX"
,
headset_amp_source
);
static
const
struct
snd_kcontrol_new
cdcout_ctl
=
SOC_DAPM_SINGLE
(
"Switch"
,
MC13783_AUDIO_RX0
,
18
,
1
,
0
);
static
const
struct
snd_kcontrol_new
adc_bypass_ctl
=
SOC_DAPM_SINGLE
(
"Switch"
,
MC13783_AUDIO_CODEC
,
16
,
1
,
0
);
static
const
struct
snd_kcontrol_new
lamp_ctl
=
SOC_DAPM_SINGLE
(
"Switch"
,
MC13783_AUDIO_RX0
,
5
,
1
,
0
);
...
...
@@ -503,12 +487,22 @@ static const struct snd_soc_dapm_widget mc13783_dapm_widgets[] = {
SND_SOC_DAPM_VIRT_MUX
(
"PGA Right Input Mux"
,
SND_SOC_NOPM
,
0
,
0
,
&
right_input_mux
),
SND_SOC_DAPM_MUX
(
"Speaker Amp Source MUX"
,
SND_SOC_NOPM
,
0
,
0
,
&
speaker_amp_source_mux
),
SND_SOC_DAPM_MUX
(
"Headset Amp Source MUX"
,
SND_SOC_NOPM
,
0
,
0
,
&
headset_amp_source_mux
),
SND_SOC_DAPM_PGA
(
"PGA Left Input"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_PGA
(
"PGA Right Input"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_ADC
(
"ADC"
,
"Capture"
,
MC13783_AUDIO_CODEC
,
11
,
0
),
SND_SOC_DAPM_SUPPLY
(
"ADC_Reset"
,
MC13783_AUDIO_CODEC
,
15
,
0
,
NULL
,
0
),
SND_SOC_DAPM_PGA
(
"Voice CODEC PGA"
,
MC13783_AUDIO_RX1
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_SWITCH
(
"Voice CODEC Bypass"
,
MC13783_AUDIO_CODEC
,
16
,
0
,
&
adc_bypass_ctl
),
/* Output */
SND_SOC_DAPM_SUPPLY
(
"DAC_E"
,
MC13783_AUDIO_DAC
,
11
,
0
,
NULL
,
0
),
SND_SOC_DAPM_SUPPLY
(
"DAC_Reset"
,
MC13783_AUDIO_DAC
,
15
,
0
,
NULL
,
0
),
...
...
@@ -516,10 +510,15 @@ static const struct snd_soc_dapm_widget mc13783_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT
(
"RXOUTR"
),
SND_SOC_DAPM_OUTPUT
(
"HSL"
),
SND_SOC_DAPM_OUTPUT
(
"HSR"
),
SND_SOC_DAPM_OUTPUT
(
"LSPL"
),
SND_SOC_DAPM_OUTPUT
(
"LSP"
),
SND_SOC_DAPM_OUTPUT
(
"SP"
),
SND_SOC_DAPM_OUTPUT
(
"CDCOUT"
),
SND_SOC_DAPM_SWITCH
(
"Speaker Amp"
,
MC13783_AUDIO_RX0
,
3
,
0
,
&
samp_ctl
),
SND_SOC_DAPM_SWITCH
(
"CDCOUT Switch"
,
MC13783_AUDIO_RX0
,
18
,
0
,
&
cdcout_ctl
),
SND_SOC_DAPM_SWITCH
(
"Speaker Amp Switch"
,
MC13783_AUDIO_RX0
,
3
,
0
,
&
samp_ctl
),
SND_SOC_DAPM_SWITCH
(
"Loudspeaker Amp"
,
SND_SOC_NOPM
,
0
,
0
,
&
lamp_ctl
),
SND_SOC_DAPM_SWITCH
(
"Headset Amp Left"
,
MC13783_AUDIO_RX0
,
10
,
0
,
&
hlamp_ctl
),
...
...
@@ -554,20 +553,28 @@ static struct snd_soc_dapm_route mc13783_routes[] = {
{
"ADC"
,
NULL
,
"PGA Right Input"
},
{
"ADC"
,
NULL
,
"ADC_Reset"
},
{
"Voice CODEC PGA"
,
"Voice CODEC Bypass"
,
"ADC"
},
{
"Speaker Amp Source MUX"
,
"CODEC"
,
"Voice CODEC PGA"
},
{
"Speaker Amp Source MUX"
,
"Right"
,
"DAC PGA"
},
{
"Headset Amp Source MUX"
,
"CODEC"
,
"Voice CODEC PGA"
},
{
"Headset Amp Source MUX"
,
"Mixer"
,
"DAC PGA"
},
/* Output */
{
"HSL"
,
NULL
,
"Headset Amp Left"
},
{
"HSR"
,
NULL
,
"Headset Amp Right"
},
{
"RXOUTL"
,
NULL
,
"Line out Amp Left"
},
{
"RXOUTR"
,
NULL
,
"Line out Amp Right"
},
{
"SP"
,
NULL
,
"Speaker Amp"
},
{
"Speaker Amp"
,
NULL
,
"DAC PGA"
},
{
"LSP"
,
NULL
,
"DAC PGA"
},
{
"Headset Amp Left"
,
NULL
,
"DAC PGA"
},
{
"Headset Amp Right"
,
NULL
,
"DAC PGA"
},
{
"SP"
,
"Speaker Amp Switch"
,
"Speaker Amp Source MUX"
},
{
"LSP"
,
"Loudspeaker Amp"
,
"Speaker Amp Source MUX"
},
{
"HSL"
,
"Headset Amp Left"
,
"Headset Amp Source MUX"
},
{
"HSR"
,
"Headset Amp Right"
,
"Headset Amp Source MUX"
},
{
"Line out Amp Left"
,
NULL
,
"DAC PGA"
},
{
"Line out Amp Right"
,
NULL
,
"DAC PGA"
},
{
"DAC PGA"
,
NULL
,
"DAC"
},
{
"DAC"
,
NULL
,
"DAC_E"
},
{
"CDCOUT"
,
"CDCOUT Switch"
,
"Voice CODEC PGA"
},
};
static
const
char
*
const
mc13783_3d_mixer
[]
=
{
"Stereo"
,
"Phase Mix"
,
...
...
@@ -580,15 +587,39 @@ static const struct soc_enum mc13783_enum_3d_mixer =
static
struct
snd_kcontrol_new
mc13783_control_list
[]
=
{
SOC_SINGLE
(
"Loudspeaker enable"
,
MC13783_AUDIO_RX0
,
5
,
1
,
0
),
SOC_SINGLE
(
"PCM Playback Volume"
,
MC13783_AUDIO_RX1
,
6
,
15
,
0
),
SOC_SINGLE
(
"PCM Playback Switch"
,
MC13783_AUDIO_RX1
,
5
,
1
,
0
),
SOC_DOUBLE
(
"PCM Capture Volume"
,
MC13783_AUDIO_TX
,
19
,
14
,
31
,
0
),
SOC_ENUM
(
"3D Control"
,
mc13783_enum_3d_mixer
),
SOC_SINGLE
(
"CDCOUT Switch"
,
MC13783_AUDIO_RX0
,
18
,
1
,
0
),
SOC_SINGLE
(
"Earpiece Amp Switch"
,
MC13783_AUDIO_RX0
,
3
,
1
,
0
),
SOC_DOUBLE
(
"Headset Amp Switch"
,
MC13783_AUDIO_RX0
,
10
,
9
,
1
,
0
),
SOC_DOUBLE
(
"Line out Amp Switch"
,
MC13783_AUDIO_RX0
,
16
,
15
,
1
,
0
),
SOC_SINGLE
(
"PCM Capture Mixin Switch"
,
MC13783_AUDIO_RX0
,
22
,
1
,
0
),
SOC_SINGLE
(
"Line in Capture Mixin Switch"
,
MC13783_AUDIO_RX0
,
23
,
1
,
0
),
SOC_SINGLE
(
"CODEC Capture Volume"
,
MC13783_AUDIO_RX1
,
1
,
15
,
0
),
SOC_SINGLE
(
"CODEC Capture Mixin Switch"
,
MC13783_AUDIO_RX0
,
21
,
1
,
0
),
SOC_SINGLE
(
"Line in Capture Volume"
,
MC13783_AUDIO_RX1
,
12
,
15
,
0
),
SOC_SINGLE
(
"Line in Capture Switch"
,
MC13783_AUDIO_RX1
,
10
,
1
,
0
),
SOC_SINGLE
(
"MC1 Capture Bias Switch"
,
MC13783_AUDIO_TX
,
0
,
1
,
0
),
SOC_SINGLE
(
"MC2 Capture Bias Switch"
,
MC13783_AUDIO_TX
,
1
,
1
,
0
),
};
static
int
mc13783_probe
(
struct
snd_soc_codec
*
codec
)
{
struct
mc13783_priv
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
int
ret
;
mc13xxx_lock
(
priv
->
mc13xxx
);
codec
->
control_data
=
dev_get_regmap
(
codec
->
dev
->
parent
,
NULL
);
ret
=
snd_soc_codec_set_cache_io
(
codec
,
8
,
24
,
SND_SOC_REGMAP
);
if
(
ret
!=
0
)
{
dev_err
(
codec
->
dev
,
"Failed to set cache I/O: %d
\n
"
,
ret
);
return
ret
;
}
/* these are the reset values */
mc13xxx_reg_write
(
priv
->
mc13xxx
,
MC13783_AUDIO_RX0
,
0x25893
);
...
...
@@ -612,8 +643,6 @@ static int mc13783_probe(struct snd_soc_codec *codec)
mc13xxx_reg_rmw
(
priv
->
mc13xxx
,
MC13783_AUDIO_DAC
,
0
,
AUDIO_SSI_SEL
);
mc13xxx_unlock
(
priv
->
mc13xxx
);
return
0
;
}
...
...
@@ -621,13 +650,9 @@ static int mc13783_remove(struct snd_soc_codec *codec)
{
struct
mc13783_priv
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
mc13xxx_lock
(
priv
->
mc13xxx
);
/* Make sure VAUDIOON is off */
mc13xxx_reg_rmw
(
priv
->
mc13xxx
,
MC13783_AUDIO_RX0
,
0x3
,
0
);
mc13xxx_unlock
(
priv
->
mc13xxx
);
return
0
;
}
...
...
@@ -717,8 +742,6 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = {
static
struct
snd_soc_codec_driver
soc_codec_dev_mc13783
=
{
.
probe
=
mc13783_probe
,
.
remove
=
mc13783_remove
,
.
read
=
mc13783_read
,
.
write
=
mc13783_write
,
.
controls
=
mc13783_control_list
,
.
num_controls
=
ARRAY_SIZE
(
mc13783_control_list
),
.
dapm_widgets
=
mc13783_dapm_widgets
,
...
...
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