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
dfd18caa
Commit
dfd18caa
authored
Aug 22, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/ac97' into asoc-next
parents
10c0d7a9
741a509f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
198 additions
and
0 deletions
+198
-0
Documentation/devicetree/bindings/sound/soc-ac97link.txt
Documentation/devicetree/bindings/sound/soc-ac97link.txt
+28
-0
include/sound/soc.h
include/sound/soc.h
+2
-0
sound/soc/codecs/ac97.c
sound/soc/codecs/ac97.c
+15
-0
sound/soc/soc-core.c
sound/soc/soc-core.c
+153
-0
No files found.
Documentation/devicetree/bindings/sound/soc-ac97link.txt
0 → 100644
View file @
dfd18caa
AC97 link bindings
These bindings can be included within any other device node.
Required properties:
- pinctrl-names: Has to contain following states to setup the correct
pinmuxing for the used gpios:
"ac97-running": AC97-link is active
"ac97-reset": AC97-link reset state
"ac97-warm-reset": AC97-link warm reset state
- ac97-gpios: List of gpio phandles with args in the order ac97-sync,
ac97-sdata, ac97-reset
Example:
ssi {
...
pinctrl-names = "default", "ac97-running", "ac97-reset", "ac97-warm-reset";
pinctrl-0 = <&ac97link_running>;
pinctrl-1 = <&ac97link_running>;
pinctrl-2 = <&ac97link_reset>;
pinctrl-3 = <&ac97link_warm_reset>;
ac97-gpios = <&gpio3 20 0 &gpio3 22 0 &gpio3 28 0>;
...
};
include/sound/soc.h
View file @
dfd18caa
...
@@ -468,6 +468,8 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
...
@@ -468,6 +468,8 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
void
snd_soc_free_ac97_codec
(
struct
snd_soc_codec
*
codec
);
void
snd_soc_free_ac97_codec
(
struct
snd_soc_codec
*
codec
);
int
snd_soc_set_ac97_ops
(
struct
snd_ac97_bus_ops
*
ops
);
int
snd_soc_set_ac97_ops
(
struct
snd_ac97_bus_ops
*
ops
);
int
snd_soc_set_ac97_ops_of_reset
(
struct
snd_ac97_bus_ops
*
ops
,
struct
platform_device
*
pdev
);
/*
/*
*Controls
*Controls
...
...
sound/soc/codecs/ac97.c
View file @
dfd18caa
...
@@ -23,6 +23,16 @@
...
@@ -23,6 +23,16 @@
#include <sound/initval.h>
#include <sound/initval.h>
#include <sound/soc.h>
#include <sound/soc.h>
static
const
struct
snd_soc_dapm_widget
ac97_widgets
[]
=
{
SND_SOC_DAPM_INPUT
(
"RX"
),
SND_SOC_DAPM_OUTPUT
(
"TX"
),
};
static
const
struct
snd_soc_dapm_route
ac97_routes
[]
=
{
{
"AC97 Capture"
,
NULL
,
"RX"
},
{
"TX"
,
NULL
,
"AC97 Playback"
},
};
static
int
ac97_prepare
(
struct
snd_pcm_substream
*
substream
,
static
int
ac97_prepare
(
struct
snd_pcm_substream
*
substream
,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
...
@@ -117,6 +127,11 @@ static struct snd_soc_codec_driver soc_codec_dev_ac97 = {
...
@@ -117,6 +127,11 @@ static struct snd_soc_codec_driver soc_codec_dev_ac97 = {
.
probe
=
ac97_soc_probe
,
.
probe
=
ac97_soc_probe
,
.
suspend
=
ac97_soc_suspend
,
.
suspend
=
ac97_soc_suspend
,
.
resume
=
ac97_soc_resume
,
.
resume
=
ac97_soc_resume
,
.
dapm_widgets
=
ac97_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
ac97_widgets
),
.
dapm_routes
=
ac97_routes
,
.
num_dapm_routes
=
ARRAY_SIZE
(
ac97_routes
),
};
};
static
int
ac97_probe
(
struct
platform_device
*
pdev
)
static
int
ac97_probe
(
struct
platform_device
*
pdev
)
...
...
sound/soc/soc-core.c
View file @
dfd18caa
...
@@ -30,9 +30,12 @@
...
@@ -30,9 +30,12 @@
#include <linux/bitops.h>
#include <linux/bitops.h>
#include <linux/debugfs.h>
#include <linux/debugfs.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/pinctrl/consumer.h>
#include <linux/ctype.h>
#include <linux/ctype.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <sound/ac97_codec.h>
#include <sound/ac97_codec.h>
#include <sound/core.h>
#include <sound/core.h>
#include <sound/jack.h>
#include <sound/jack.h>
...
@@ -69,6 +72,16 @@ static int pmdown_time = 5000;
...
@@ -69,6 +72,16 @@ static int pmdown_time = 5000;
module_param
(
pmdown_time
,
int
,
0
);
module_param
(
pmdown_time
,
int
,
0
);
MODULE_PARM_DESC
(
pmdown_time
,
"DAPM stream powerdown time (msecs)"
);
MODULE_PARM_DESC
(
pmdown_time
,
"DAPM stream powerdown time (msecs)"
);
struct
snd_ac97_reset_cfg
{
struct
pinctrl
*
pctl
;
struct
pinctrl_state
*
pstate_reset
;
struct
pinctrl_state
*
pstate_warm_reset
;
struct
pinctrl_state
*
pstate_run
;
int
gpio_sdata
;
int
gpio_sync
;
int
gpio_reset
;
};
/* returns the minimum number of bytes needed to represent
/* returns the minimum number of bytes needed to represent
* a particular given value */
* a particular given value */
static
int
min_bytes_needed
(
unsigned
long
val
)
static
int
min_bytes_needed
(
unsigned
long
val
)
...
@@ -2080,6 +2093,117 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
...
@@ -2080,6 +2093,117 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
}
}
EXPORT_SYMBOL_GPL
(
snd_soc_new_ac97_codec
);
EXPORT_SYMBOL_GPL
(
snd_soc_new_ac97_codec
);
static
struct
snd_ac97_reset_cfg
snd_ac97_rst_cfg
;
static
void
snd_soc_ac97_warm_reset
(
struct
snd_ac97
*
ac97
)
{
struct
pinctrl
*
pctl
=
snd_ac97_rst_cfg
.
pctl
;
pinctrl_select_state
(
pctl
,
snd_ac97_rst_cfg
.
pstate_warm_reset
);
gpio_direction_output
(
snd_ac97_rst_cfg
.
gpio_sync
,
1
);
udelay
(
10
);
gpio_direction_output
(
snd_ac97_rst_cfg
.
gpio_sync
,
0
);
pinctrl_select_state
(
pctl
,
snd_ac97_rst_cfg
.
pstate_run
);
msleep
(
2
);
}
static
void
snd_soc_ac97_reset
(
struct
snd_ac97
*
ac97
)
{
struct
pinctrl
*
pctl
=
snd_ac97_rst_cfg
.
pctl
;
pinctrl_select_state
(
pctl
,
snd_ac97_rst_cfg
.
pstate_reset
);
gpio_direction_output
(
snd_ac97_rst_cfg
.
gpio_sync
,
0
);
gpio_direction_output
(
snd_ac97_rst_cfg
.
gpio_sdata
,
0
);
gpio_direction_output
(
snd_ac97_rst_cfg
.
gpio_reset
,
0
);
udelay
(
10
);
gpio_direction_output
(
snd_ac97_rst_cfg
.
gpio_reset
,
1
);
pinctrl_select_state
(
pctl
,
snd_ac97_rst_cfg
.
pstate_run
);
msleep
(
2
);
}
static
int
snd_soc_ac97_parse_pinctl
(
struct
device
*
dev
,
struct
snd_ac97_reset_cfg
*
cfg
)
{
struct
pinctrl
*
p
;
struct
pinctrl_state
*
state
;
int
gpio
;
int
ret
;
p
=
devm_pinctrl_get
(
dev
);
if
(
IS_ERR
(
p
))
{
dev_err
(
dev
,
"Failed to get pinctrl
\n
"
);
return
PTR_RET
(
p
);
}
cfg
->
pctl
=
p
;
state
=
pinctrl_lookup_state
(
p
,
"ac97-reset"
);
if
(
IS_ERR
(
state
))
{
dev_err
(
dev
,
"Can't find pinctrl state ac97-reset
\n
"
);
return
PTR_RET
(
state
);
}
cfg
->
pstate_reset
=
state
;
state
=
pinctrl_lookup_state
(
p
,
"ac97-warm-reset"
);
if
(
IS_ERR
(
state
))
{
dev_err
(
dev
,
"Can't find pinctrl state ac97-warm-reset
\n
"
);
return
PTR_RET
(
state
);
}
cfg
->
pstate_warm_reset
=
state
;
state
=
pinctrl_lookup_state
(
p
,
"ac97-running"
);
if
(
IS_ERR
(
state
))
{
dev_err
(
dev
,
"Can't find pinctrl state ac97-running
\n
"
);
return
PTR_RET
(
state
);
}
cfg
->
pstate_run
=
state
;
gpio
=
of_get_named_gpio
(
dev
->
of_node
,
"ac97-gpios"
,
0
);
if
(
gpio
<
0
)
{
dev_err
(
dev
,
"Can't find ac97-sync gpio
\n
"
);
return
gpio
;
}
ret
=
devm_gpio_request
(
dev
,
gpio
,
"AC97 link sync"
);
if
(
ret
)
{
dev_err
(
dev
,
"Failed requesting ac97-sync gpio
\n
"
);
return
ret
;
}
cfg
->
gpio_sync
=
gpio
;
gpio
=
of_get_named_gpio
(
dev
->
of_node
,
"ac97-gpios"
,
1
);
if
(
gpio
<
0
)
{
dev_err
(
dev
,
"Can't find ac97-sdata gpio %d
\n
"
,
gpio
);
return
gpio
;
}
ret
=
devm_gpio_request
(
dev
,
gpio
,
"AC97 link sdata"
);
if
(
ret
)
{
dev_err
(
dev
,
"Failed requesting ac97-sdata gpio
\n
"
);
return
ret
;
}
cfg
->
gpio_sdata
=
gpio
;
gpio
=
of_get_named_gpio
(
dev
->
of_node
,
"ac97-gpios"
,
2
);
if
(
gpio
<
0
)
{
dev_err
(
dev
,
"Can't find ac97-reset gpio
\n
"
);
return
gpio
;
}
ret
=
devm_gpio_request
(
dev
,
gpio
,
"AC97 link reset"
);
if
(
ret
)
{
dev_err
(
dev
,
"Failed requesting ac97-reset gpio
\n
"
);
return
ret
;
}
cfg
->
gpio_reset
=
gpio
;
return
0
;
}
struct
snd_ac97_bus_ops
*
soc_ac97_ops
;
struct
snd_ac97_bus_ops
*
soc_ac97_ops
;
EXPORT_SYMBOL_GPL
(
soc_ac97_ops
);
EXPORT_SYMBOL_GPL
(
soc_ac97_ops
);
...
@@ -2097,6 +2221,35 @@ int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops)
...
@@ -2097,6 +2221,35 @@ int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops)
}
}
EXPORT_SYMBOL_GPL
(
snd_soc_set_ac97_ops
);
EXPORT_SYMBOL_GPL
(
snd_soc_set_ac97_ops
);
/**
* snd_soc_set_ac97_ops_of_reset - Set ac97 ops with generic ac97 reset functions
*
* This function sets the reset and warm_reset properties of ops and parses
* the device node of pdev to get pinctrl states and gpio numbers to use.
*/
int
snd_soc_set_ac97_ops_of_reset
(
struct
snd_ac97_bus_ops
*
ops
,
struct
platform_device
*
pdev
)
{
struct
device
*
dev
=
&
pdev
->
dev
;
struct
snd_ac97_reset_cfg
cfg
;
int
ret
;
ret
=
snd_soc_ac97_parse_pinctl
(
dev
,
&
cfg
);
if
(
ret
)
return
ret
;
ret
=
snd_soc_set_ac97_ops
(
ops
);
if
(
ret
)
return
ret
;
ops
->
warm_reset
=
snd_soc_ac97_warm_reset
;
ops
->
reset
=
snd_soc_ac97_reset
;
snd_ac97_rst_cfg
=
cfg
;
return
0
;
}
EXPORT_SYMBOL_GPL
(
snd_soc_set_ac97_ops_of_reset
);
/**
/**
* snd_soc_free_ac97_codec - free AC97 codec device
* snd_soc_free_ac97_codec - free AC97 codec device
* @codec: audio codec
* @codec: audio codec
...
...
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