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
457eb901
Commit
457eb901
authored
Nov 08, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/rt5640' into asoc-next
parents
9686e4b2
5a7615cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
sound/soc/codecs/rt5640.c
sound/soc/codecs/rt5640.c
+25
-6
No files found.
sound/soc/codecs/rt5640.c
View file @
457eb901
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <linux/of_gpio.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi.h>
#include <linux/acpi.h>
#include <sound/core.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/pcm_params.h>
...
@@ -926,7 +927,7 @@ static int rt5640_set_dmic2_event(struct snd_soc_dapm_widget *w,
...
@@ -926,7 +927,7 @@ static int rt5640_set_dmic2_event(struct snd_soc_dapm_widget *w,
return
0
;
return
0
;
}
}
void
hp_amp_power_on
(
struct
snd_soc_codec
*
codec
)
static
void
hp_amp_power_on
(
struct
snd_soc_codec
*
codec
)
{
{
struct
rt5640_priv
*
rt5640
=
snd_soc_codec_get_drvdata
(
codec
);
struct
rt5640_priv
*
rt5640
=
snd_soc_codec_get_drvdata
(
codec
);
...
@@ -1603,13 +1604,14 @@ static int rt5640_hw_params(struct snd_pcm_substream *substream,
...
@@ -1603,13 +1604,14 @@ static int rt5640_hw_params(struct snd_pcm_substream *substream,
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
snd_soc_codec
*
codec
=
rtd
->
codec
;
struct
snd_soc_codec
*
codec
=
rtd
->
codec
;
struct
rt5640_priv
*
rt5640
=
snd_soc_codec_get_drvdata
(
codec
);
struct
rt5640_priv
*
rt5640
=
snd_soc_codec_get_drvdata
(
codec
);
unsigned
int
val_len
=
0
,
val_clk
,
mask_clk
,
dai_sel
;
unsigned
int
val_len
=
0
,
val_clk
,
mask_clk
;
int
pre_div
,
bclk_ms
,
frame_size
;
int
dai_sel
,
pre_div
,
bclk_ms
,
frame_size
;
rt5640
->
lrck
[
dai
->
id
]
=
params_rate
(
params
);
rt5640
->
lrck
[
dai
->
id
]
=
params_rate
(
params
);
pre_div
=
get_clk_info
(
rt5640
->
sysclk
,
rt5640
->
lrck
[
dai
->
id
]);
pre_div
=
get_clk_info
(
rt5640
->
sysclk
,
rt5640
->
lrck
[
dai
->
id
]);
if
(
pre_div
<
0
)
{
if
(
pre_div
<
0
)
{
dev_err
(
codec
->
dev
,
"Unsupported clock setting
\n
"
);
dev_err
(
codec
->
dev
,
"Unsupported clock setting %d for DAI %d
\n
"
,
rt5640
->
lrck
[
dai
->
id
],
dai
->
id
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
frame_size
=
snd_soc_params_to_frame_size
(
params
);
frame_size
=
snd_soc_params_to_frame_size
(
params
);
...
@@ -1673,7 +1675,8 @@ static int rt5640_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
...
@@ -1673,7 +1675,8 @@ static int rt5640_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{
{
struct
snd_soc_codec
*
codec
=
dai
->
codec
;
struct
snd_soc_codec
*
codec
=
dai
->
codec
;
struct
rt5640_priv
*
rt5640
=
snd_soc_codec_get_drvdata
(
codec
);
struct
rt5640_priv
*
rt5640
=
snd_soc_codec_get_drvdata
(
codec
);
unsigned
int
reg_val
=
0
,
dai_sel
;
unsigned
int
reg_val
=
0
;
int
dai_sel
;
switch
(
fmt
&
SND_SOC_DAIFMT_MASTER_MASK
)
{
switch
(
fmt
&
SND_SOC_DAIFMT_MASTER_MASK
)
{
case
SND_SOC_DAIFMT_CBM_CFM
:
case
SND_SOC_DAIFMT_CBM_CFM
:
...
@@ -1977,13 +1980,20 @@ static int rt5640_suspend(struct snd_soc_codec *codec)
...
@@ -1977,13 +1980,20 @@ static int rt5640_suspend(struct snd_soc_codec *codec)
rt5640_reset
(
codec
);
rt5640_reset
(
codec
);
regcache_cache_only
(
rt5640
->
regmap
,
true
);
regcache_cache_only
(
rt5640
->
regmap
,
true
);
regcache_mark_dirty
(
rt5640
->
regmap
);
regcache_mark_dirty
(
rt5640
->
regmap
);
if
(
gpio_is_valid
(
rt5640
->
pdata
.
ldo1_en
))
gpio_set_value_cansleep
(
rt5640
->
pdata
.
ldo1_en
,
0
);
return
0
;
return
0
;
}
}
static
int
rt5640_resume
(
struct
snd_soc_codec
*
codec
)
static
int
rt5640_resume
(
struct
snd_soc_codec
*
codec
)
{
{
rt5640_set_bias_level
(
codec
,
SND_SOC_BIAS_STANDBY
);
struct
rt5640_priv
*
rt5640
=
snd_soc_codec_get_drvdata
(
codec
);
if
(
gpio_is_valid
(
rt5640
->
pdata
.
ldo1_en
))
{
gpio_set_value_cansleep
(
rt5640
->
pdata
.
ldo1_en
,
1
);
msleep
(
400
);
}
return
0
;
return
0
;
}
}
...
@@ -2080,6 +2090,14 @@ static const struct i2c_device_id rt5640_i2c_id[] = {
...
@@ -2080,6 +2090,14 @@ static const struct i2c_device_id rt5640_i2c_id[] = {
};
};
MODULE_DEVICE_TABLE
(
i2c
,
rt5640_i2c_id
);
MODULE_DEVICE_TABLE
(
i2c
,
rt5640_i2c_id
);
#ifdef CONFIG_ACPI
static
struct
acpi_device_id
rt5640_acpi_match
[]
=
{
{
"INT33CA"
,
0
},
{
},
};
MODULE_DEVICE_TABLE
(
acpi
,
rt5640_acpi_match
);
#endif
static
int
rt5640_parse_dt
(
struct
rt5640_priv
*
rt5640
,
struct
device_node
*
np
)
static
int
rt5640_parse_dt
(
struct
rt5640_priv
*
rt5640
,
struct
device_node
*
np
)
{
{
rt5640
->
pdata
.
in1_diff
=
of_property_read_bool
(
np
,
rt5640
->
pdata
.
in1_diff
=
of_property_read_bool
(
np
,
...
@@ -2199,6 +2217,7 @@ static struct i2c_driver rt5640_i2c_driver = {
...
@@ -2199,6 +2217,7 @@ static struct i2c_driver rt5640_i2c_driver = {
.
driver
=
{
.
driver
=
{
.
name
=
"rt5640"
,
.
name
=
"rt5640"
,
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
acpi_match_table
=
ACPI_PTR
(
rt5640_acpi_match
),
},
},
.
probe
=
rt5640_i2c_probe
,
.
probe
=
rt5640_i2c_probe
,
.
remove
=
rt5640_i2c_remove
,
.
remove
=
rt5640_i2c_remove
,
...
...
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