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
141dee78
Commit
141dee78
authored
Feb 19, 2017
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branches 'asoc/topic/wm8753' and 'asoc/topic/zte' into asoc-next
parents
ebfa3dcc
af4b654f
66ead502
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
20 deletions
+40
-20
Documentation/devicetree/bindings/sound/zte,zx-i2s.txt
Documentation/devicetree/bindings/sound/zte,zx-i2s.txt
+8
-6
sound/soc/codecs/wm8753.c
sound/soc/codecs/wm8753.c
+2
-1
sound/soc/zte/zx-i2s.c
sound/soc/zte/zx-i2s.c
+30
-13
No files found.
Documentation/devicetree/bindings/sound/zte,zx-i2s.txt
View file @
141dee78
ZTE ZX296702 I2S controller
ZTE ZX296702 I2S controller
Required properties:
Required properties:
- compatible : Must be "zte,zx296702-i2s"
- compatible : Must be one of:
"zte,zx296718-i2s", "zte,zx296702-i2s"
"zte,zx296702-i2s"
- reg : Must contain I2S core's registers location and length
- reg : Must contain I2S core's registers location and length
- clocks : Pairs of phandle and specifier referencing the controller's clocks.
- clocks : Pairs of phandle and specifier referencing the controller's clocks.
- clock-names: "
tx" for the cloc
k to the I2S interface.
- clock-names: "
wclk" for the wclk, "pclk" for the pcl
k to the I2S interface.
- dmas: Pairs of phandle and specifier for the DMA channel that is used by
- dmas: Pairs of phandle and specifier for the DMA channel that is used by
the core. The core expects two dma channels for transmit.
the core. The core expects two dma channels for transmit.
- dma-names : Must be "tx" and "rx"
- dma-names : Must be "tx" and "rx"
...
@@ -16,12 +18,12 @@ please check:
...
@@ -16,12 +18,12 @@ please check:
* dma/dma.txt
* dma/dma.txt
Example:
Example:
i2s0: i2s
0@0
b005000 {
i2s0: i2s
@
b005000 {
#sound-dai-cells = <0>;
#sound-dai-cells = <0>;
compatible = "zte,zx296702-i2s";
compatible = "zte,zx2967
18-i2s", "zte,zx2967
02-i2s";
reg = <0x0b005000 0x1000>;
reg = <0x0b005000 0x1000>;
clocks = <&
lsp0clk ZX296702_I2S0_DIV
>;
clocks = <&
audiocrm AUDIO_I2S0_WCLK>, <&audiocrm AUDIO_I2S0_PCLK
>;
clock-names = "
tx
";
clock-names = "
wclk", "pclk
";
interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&dma 5>, <&dma 6>;
dmas = <&dma 5>, <&dma 6>;
dma-names = "tx", "rx";
dma-names = "tx", "rx";
...
...
sound/soc/codecs/wm8753.c
View file @
141dee78
...
@@ -280,6 +280,7 @@ static const DECLARE_TLV_DB_SCALE(voice_mix_tlv, -1200, 300, 0);
...
@@ -280,6 +280,7 @@ static const DECLARE_TLV_DB_SCALE(voice_mix_tlv, -1200, 300, 0);
static
const
DECLARE_TLV_DB_SCALE
(
pga_tlv
,
-
1725
,
75
,
0
);
static
const
DECLARE_TLV_DB_SCALE
(
pga_tlv
,
-
1725
,
75
,
0
);
static
const
struct
snd_kcontrol_new
wm8753_snd_controls
[]
=
{
static
const
struct
snd_kcontrol_new
wm8753_snd_controls
[]
=
{
SOC_SINGLE
(
"Hi-Fi DAC Left/Right channel Swap"
,
WM8753_HIFI
,
5
,
1
,
0
),
SOC_DOUBLE_R_TLV
(
"PCM Volume"
,
WM8753_LDAC
,
WM8753_RDAC
,
0
,
255
,
0
,
dac_tlv
),
SOC_DOUBLE_R_TLV
(
"PCM Volume"
,
WM8753_LDAC
,
WM8753_RDAC
,
0
,
255
,
0
,
dac_tlv
),
SOC_DOUBLE_R_TLV
(
"ADC Capture Volume"
,
WM8753_LADC
,
WM8753_RADC
,
0
,
255
,
0
,
SOC_DOUBLE_R_TLV
(
"ADC Capture Volume"
,
WM8753_LADC
,
WM8753_RADC
,
0
,
255
,
0
,
...
@@ -1087,7 +1088,7 @@ static int wm8753_i2s_set_dai_fmt(struct snd_soc_codec *codec,
...
@@ -1087,7 +1088,7 @@ static int wm8753_i2s_set_dai_fmt(struct snd_soc_codec *codec,
{
{
u16
ioctl
,
hifi
;
u16
ioctl
,
hifi
;
hifi
=
snd_soc_read
(
codec
,
WM8753_HIFI
)
&
0x01
1
f
;
hifi
=
snd_soc_read
(
codec
,
WM8753_HIFI
)
&
0x01
3
f
;
ioctl
=
snd_soc_read
(
codec
,
WM8753_IOCTL
)
&
0x00ae
;
ioctl
=
snd_soc_read
(
codec
,
WM8753_IOCTL
)
&
0x00ae
;
/* set master/slave audio interface */
/* set master/slave audio interface */
...
...
sound/soc/zte/zx-i2s.c
View file @
141dee78
...
@@ -95,7 +95,8 @@
...
@@ -95,7 +95,8 @@
struct
zx_i2s_info
{
struct
zx_i2s_info
{
struct
snd_dmaengine_dai_dma_data
dma_playback
;
struct
snd_dmaengine_dai_dma_data
dma_playback
;
struct
snd_dmaengine_dai_dma_data
dma_capture
;
struct
snd_dmaengine_dai_dma_data
dma_capture
;
struct
clk
*
dai_clk
;
struct
clk
*
dai_wclk
;
struct
clk
*
dai_pclk
;
void
__iomem
*
reg_base
;
void
__iomem
*
reg_base
;
int
master
;
int
master
;
resource_size_t
mapbase
;
resource_size_t
mapbase
;
...
@@ -225,7 +226,7 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream,
...
@@ -225,7 +226,7 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream,
struct
zx_i2s_info
*
i2s
=
snd_soc_dai_get_drvdata
(
socdai
);
struct
zx_i2s_info
*
i2s
=
snd_soc_dai_get_drvdata
(
socdai
);
struct
snd_dmaengine_dai_dma_data
*
dma_data
;
struct
snd_dmaengine_dai_dma_data
*
dma_data
;
unsigned
int
lane
,
ch_num
,
len
,
ret
=
0
;
unsigned
int
lane
,
ch_num
,
len
,
ret
=
0
;
unsigned
long
val
,
format
;
unsigned
long
val
;
unsigned
long
chn_cfg
;
unsigned
long
chn_cfg
;
dma_data
=
snd_soc_dai_get_dma_data
(
socdai
,
substream
);
dma_data
=
snd_soc_dai_get_dma_data
(
socdai
,
substream
);
...
@@ -238,15 +239,12 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream,
...
@@ -238,15 +239,12 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream,
switch
(
params_format
(
params
))
{
switch
(
params_format
(
params
))
{
case
SNDRV_PCM_FORMAT_S16_LE
:
case
SNDRV_PCM_FORMAT_S16_LE
:
format
=
0
;
len
=
16
;
len
=
16
;
break
;
break
;
case
SNDRV_PCM_FORMAT_S24_LE
:
case
SNDRV_PCM_FORMAT_S24_LE
:
format
=
1
;
len
=
24
;
len
=
24
;
break
;
break
;
case
SNDRV_PCM_FORMAT_S32_LE
:
case
SNDRV_PCM_FORMAT_S32_LE
:
format
=
2
;
len
=
32
;
len
=
32
;
break
;
break
;
default:
default:
...
@@ -278,8 +276,9 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream,
...
@@ -278,8 +276,9 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream,
writel_relaxed
(
val
,
i2s
->
reg_base
+
ZX_I2S_TIMING_CTRL
);
writel_relaxed
(
val
,
i2s
->
reg_base
+
ZX_I2S_TIMING_CTRL
);
if
(
i2s
->
master
)
if
(
i2s
->
master
)
ret
=
clk_set_rate
(
i2s
->
dai_clk
,
ret
=
clk_set_rate
(
i2s
->
dai_wclk
,
params_rate
(
params
)
*
ch_num
*
CLK_RAT
);
params_rate
(
params
)
*
ch_num
*
CLK_RAT
);
return
ret
;
return
ret
;
}
}
...
@@ -331,8 +330,19 @@ static int zx_i2s_startup(struct snd_pcm_substream *substream,
...
@@ -331,8 +330,19 @@ static int zx_i2s_startup(struct snd_pcm_substream *substream,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
zx_i2s_info
*
zx_i2s
=
dev_get_drvdata
(
dai
->
dev
);
struct
zx_i2s_info
*
zx_i2s
=
dev_get_drvdata
(
dai
->
dev
);
int
ret
;
return
clk_prepare_enable
(
zx_i2s
->
dai_clk
);
ret
=
clk_prepare_enable
(
zx_i2s
->
dai_wclk
);
if
(
ret
)
return
ret
;
ret
=
clk_prepare_enable
(
zx_i2s
->
dai_pclk
);
if
(
ret
)
{
clk_disable_unprepare
(
zx_i2s
->
dai_wclk
);
return
ret
;
}
return
ret
;
}
}
static
void
zx_i2s_shutdown
(
struct
snd_pcm_substream
*
substream
,
static
void
zx_i2s_shutdown
(
struct
snd_pcm_substream
*
substream
,
...
@@ -340,7 +350,8 @@ static void zx_i2s_shutdown(struct snd_pcm_substream *substream,
...
@@ -340,7 +350,8 @@ static void zx_i2s_shutdown(struct snd_pcm_substream *substream,
{
{
struct
zx_i2s_info
*
zx_i2s
=
dev_get_drvdata
(
dai
->
dev
);
struct
zx_i2s_info
*
zx_i2s
=
dev_get_drvdata
(
dai
->
dev
);
clk_disable_unprepare
(
zx_i2s
->
dai_clk
);
clk_disable_unprepare
(
zx_i2s
->
dai_wclk
);
clk_disable_unprepare
(
zx_i2s
->
dai_pclk
);
}
}
static
struct
snd_soc_dai_ops
zx_i2s_dai_ops
=
{
static
struct
snd_soc_dai_ops
zx_i2s_dai_ops
=
{
...
@@ -384,10 +395,16 @@ static int zx_i2s_probe(struct platform_device *pdev)
...
@@ -384,10 +395,16 @@ static int zx_i2s_probe(struct platform_device *pdev)
if
(
!
zx_i2s
)
if
(
!
zx_i2s
)
return
-
ENOMEM
;
return
-
ENOMEM
;
zx_i2s
->
dai_clk
=
devm_clk_get
(
&
pdev
->
dev
,
"tx"
);
zx_i2s
->
dai_wclk
=
devm_clk_get
(
&
pdev
->
dev
,
"wclk"
);
if
(
IS_ERR
(
zx_i2s
->
dai_clk
))
{
if
(
IS_ERR
(
zx_i2s
->
dai_wclk
))
{
dev_err
(
&
pdev
->
dev
,
"Fail to get clk
\n
"
);
dev_err
(
&
pdev
->
dev
,
"Fail to get wclk
\n
"
);
return
PTR_ERR
(
zx_i2s
->
dai_clk
);
return
PTR_ERR
(
zx_i2s
->
dai_wclk
);
}
zx_i2s
->
dai_pclk
=
devm_clk_get
(
&
pdev
->
dev
,
"pclk"
);
if
(
IS_ERR
(
zx_i2s
->
dai_pclk
))
{
dev_err
(
&
pdev
->
dev
,
"Fail to get pclk
\n
"
);
return
PTR_ERR
(
zx_i2s
->
dai_pclk
);
}
}
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
...
...
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