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
nexedi
linux
Commits
91898117
Commit
91898117
authored
Mar 28, 2018
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/pcm3168a' into asoc-next
parents
09a37cbc
29751c1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
26 deletions
+25
-26
sound/soc/codecs/pcm3168a.c
sound/soc/codecs/pcm3168a.c
+25
-26
No files found.
sound/soc/codecs/pcm3168a.c
View file @
91898117
...
@@ -287,8 +287,8 @@ static int pcm3168a_reset(struct pcm3168a_priv *pcm3168a)
...
@@ -287,8 +287,8 @@ static int pcm3168a_reset(struct pcm3168a_priv *pcm3168a)
static
int
pcm3168a_digital_mute
(
struct
snd_soc_dai
*
dai
,
int
mute
)
static
int
pcm3168a_digital_mute
(
struct
snd_soc_dai
*
dai
,
int
mute
)
{
{
struct
snd_soc_co
dec
*
codec
=
dai
->
codec
;
struct
snd_soc_co
mponent
*
component
=
dai
->
component
;
struct
pcm3168a_priv
*
pcm3168a
=
snd_soc_co
dec_get_drvdata
(
codec
);
struct
pcm3168a_priv
*
pcm3168a
=
snd_soc_co
mponent_get_drvdata
(
component
);
regmap_write
(
pcm3168a
->
regmap
,
PCM3168A_DAC_MUTE
,
mute
?
0xff
:
0
);
regmap_write
(
pcm3168a
->
regmap
,
PCM3168A_DAC_MUTE
,
mute
?
0xff
:
0
);
...
@@ -298,7 +298,7 @@ static int pcm3168a_digital_mute(struct snd_soc_dai *dai, int mute)
...
@@ -298,7 +298,7 @@ static int pcm3168a_digital_mute(struct snd_soc_dai *dai, int mute)
static
int
pcm3168a_set_dai_sysclk
(
struct
snd_soc_dai
*
dai
,
static
int
pcm3168a_set_dai_sysclk
(
struct
snd_soc_dai
*
dai
,
int
clk_id
,
unsigned
int
freq
,
int
dir
)
int
clk_id
,
unsigned
int
freq
,
int
dir
)
{
{
struct
pcm3168a_priv
*
pcm3168a
=
snd_soc_co
dec_get_drvdata
(
dai
->
codec
);
struct
pcm3168a_priv
*
pcm3168a
=
snd_soc_co
mponent_get_drvdata
(
dai
->
component
);
int
ret
;
int
ret
;
if
(
freq
>
PCM1368A_MAX_SYSCLK
)
if
(
freq
>
PCM1368A_MAX_SYSCLK
)
...
@@ -316,8 +316,8 @@ static int pcm3168a_set_dai_sysclk(struct snd_soc_dai *dai,
...
@@ -316,8 +316,8 @@ static int pcm3168a_set_dai_sysclk(struct snd_soc_dai *dai,
static
int
pcm3168a_set_dai_fmt
(
struct
snd_soc_dai
*
dai
,
static
int
pcm3168a_set_dai_fmt
(
struct
snd_soc_dai
*
dai
,
unsigned
int
format
,
bool
dac
)
unsigned
int
format
,
bool
dac
)
{
{
struct
snd_soc_co
dec
*
codec
=
dai
->
codec
;
struct
snd_soc_co
mponent
*
component
=
dai
->
component
;
struct
pcm3168a_priv
*
pcm3168a
=
snd_soc_co
dec_get_drvdata
(
codec
);
struct
pcm3168a_priv
*
pcm3168a
=
snd_soc_co
mponent_get_drvdata
(
component
);
u32
fmt
,
reg
,
mask
,
shift
;
u32
fmt
,
reg
,
mask
,
shift
;
bool
master_mode
;
bool
master_mode
;
...
@@ -338,7 +338,7 @@ static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai,
...
@@ -338,7 +338,7 @@ static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai,
fmt
=
PCM3168A_FMT_DSP_B
;
fmt
=
PCM3168A_FMT_DSP_B
;
break
;
break
;
default:
default:
dev_err
(
co
dec
->
dev
,
"unsupported dai format
\n
"
);
dev_err
(
co
mponent
->
dev
,
"unsupported dai format
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -350,7 +350,7 @@ static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai,
...
@@ -350,7 +350,7 @@ static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai,
master_mode
=
true
;
master_mode
=
true
;
break
;
break
;
default:
default:
dev_err
(
co
dec
->
dev
,
"unsupported master/slave mode
\n
"
);
dev_err
(
co
mponent
->
dev
,
"unsupported master/slave mode
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -396,8 +396,8 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
...
@@ -396,8 +396,8 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
struct
snd_pcm_hw_params
*
params
,
struct
snd_pcm_hw_params
*
params
,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
snd_soc_co
dec
*
codec
=
dai
->
codec
;
struct
snd_soc_co
mponent
*
component
=
dai
->
component
;
struct
pcm3168a_priv
*
pcm3168a
=
snd_soc_co
dec_get_drvdata
(
codec
);
struct
pcm3168a_priv
*
pcm3168a
=
snd_soc_co
mponent_get_drvdata
(
component
);
bool
tx
,
master_mode
;
bool
tx
,
master_mode
;
u32
val
,
mask
,
shift
,
reg
;
u32
val
,
mask
,
shift
,
reg
;
unsigned
int
rate
,
fmt
,
ratio
,
max_ratio
;
unsigned
int
rate
,
fmt
,
ratio
,
max_ratio
;
...
@@ -430,7 +430,7 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
...
@@ -430,7 +430,7 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
}
}
if
(
i
==
max_ratio
)
{
if
(
i
==
max_ratio
)
{
dev_err
(
co
dec
->
dev
,
"unsupported sysclk ratio
\n
"
);
dev_err
(
co
mponent
->
dev
,
"unsupported sysclk ratio
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -438,21 +438,21 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
...
@@ -438,21 +438,21 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
switch
(
min_frame_size
)
{
switch
(
min_frame_size
)
{
case
32
:
case
32
:
if
(
master_mode
||
(
fmt
!=
PCM3168A_FMT_RIGHT_J
))
{
if
(
master_mode
||
(
fmt
!=
PCM3168A_FMT_RIGHT_J
))
{
dev_err
(
co
dec
->
dev
,
"32-bit frames are supported only for slave mode using right justified
\n
"
);
dev_err
(
co
mponent
->
dev
,
"32-bit frames are supported only for slave mode using right justified
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
fmt
=
PCM3168A_FMT_RIGHT_J_16
;
fmt
=
PCM3168A_FMT_RIGHT_J_16
;
break
;
break
;
case
48
:
case
48
:
if
(
master_mode
||
(
fmt
&
PCM3168A_FMT_DSP_MASK
))
{
if
(
master_mode
||
(
fmt
&
PCM3168A_FMT_DSP_MASK
))
{
dev_err
(
co
dec
->
dev
,
"48-bit frames not supported in master mode, or slave mode using DSP
\n
"
);
dev_err
(
co
mponent
->
dev
,
"48-bit frames not supported in master mode, or slave mode using DSP
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
break
;
break
;
case
64
:
case
64
:
break
;
break
;
default:
default:
dev_err
(
co
dec
->
dev
,
"unsupported frame size: %d
\n
"
,
min_frame_size
);
dev_err
(
co
mponent
->
dev
,
"unsupported frame size: %d
\n
"
,
min_frame_size
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -595,16 +595,16 @@ const struct regmap_config pcm3168a_regmap = {
...
@@ -595,16 +595,16 @@ const struct regmap_config pcm3168a_regmap = {
};
};
EXPORT_SYMBOL_GPL
(
pcm3168a_regmap
);
EXPORT_SYMBOL_GPL
(
pcm3168a_regmap
);
static
const
struct
snd_soc_co
dec
_driver
pcm3168a_driver
=
{
static
const
struct
snd_soc_co
mponent
_driver
pcm3168a_driver
=
{
.
idle_bias_off
=
true
,
.
controls
=
pcm3168a_snd_controls
,
.
component_driver
=
{
.
num_controls
=
ARRAY_SIZE
(
pcm3168a_snd_controls
),
.
controls
=
pcm3168a_snd_control
s
,
.
dapm_widgets
=
pcm3168a_dapm_widget
s
,
.
num_controls
=
ARRAY_SIZE
(
pcm3168a_snd_control
s
),
.
num_dapm_widgets
=
ARRAY_SIZE
(
pcm3168a_dapm_widget
s
),
.
dapm_widgets
=
pcm3168a_dapm_widget
s
,
.
dapm_routes
=
pcm3168a_dapm_route
s
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
pcm3168a_dapm_widget
s
),
.
num_dapm_routes
=
ARRAY_SIZE
(
pcm3168a_dapm_route
s
),
.
dapm_routes
=
pcm3168a_dapm_routes
,
.
use_pmdown_time
=
1
,
.
num_dapm_routes
=
ARRAY_SIZE
(
pcm3168a_dapm_routes
)
.
endianness
=
1
,
}
,
.
non_legacy_dai_naming
=
1
,
};
};
int
pcm3168a_probe
(
struct
device
*
dev
,
struct
regmap
*
regmap
)
int
pcm3168a_probe
(
struct
device
*
dev
,
struct
regmap
*
regmap
)
...
@@ -669,10 +669,10 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap)
...
@@ -669,10 +669,10 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap)
pm_runtime_enable
(
dev
);
pm_runtime_enable
(
dev
);
pm_runtime_idle
(
dev
);
pm_runtime_idle
(
dev
);
ret
=
snd_soc_register_codec
(
dev
,
&
pcm3168a_driver
,
pcm3168a_dais
,
ret
=
devm_snd_soc_register_component
(
dev
,
&
pcm3168a_driver
,
pcm3168a_dais
,
ARRAY_SIZE
(
pcm3168a_dais
));
ARRAY_SIZE
(
pcm3168a_dais
));
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
dev
,
"failed to register co
dec
: %d
\n
"
,
ret
);
dev_err
(
dev
,
"failed to register co
mponent
: %d
\n
"
,
ret
);
goto
err_regulator
;
goto
err_regulator
;
}
}
...
@@ -692,7 +692,6 @@ void pcm3168a_remove(struct device *dev)
...
@@ -692,7 +692,6 @@ void pcm3168a_remove(struct device *dev)
{
{
struct
pcm3168a_priv
*
pcm3168a
=
dev_get_drvdata
(
dev
);
struct
pcm3168a_priv
*
pcm3168a
=
dev_get_drvdata
(
dev
);
snd_soc_unregister_codec
(
dev
);
pm_runtime_disable
(
dev
);
pm_runtime_disable
(
dev
);
regulator_bulk_disable
(
ARRAY_SIZE
(
pcm3168a
->
supplies
),
regulator_bulk_disable
(
ARRAY_SIZE
(
pcm3168a
->
supplies
),
pcm3168a
->
supplies
);
pcm3168a
->
supplies
);
...
...
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