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
54c1e27d
Commit
54c1e27d
authored
Aug 22, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/kirkwood' into asoc-next
parents
e6ddd861
e4065f3f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
86 additions
and
155 deletions
+86
-155
arch/arm/mach-dove/common.c
arch/arm/mach-dove/common.c
+2
-2
arch/arm/mach-kirkwood/common.c
arch/arm/mach-kirkwood/common.c
+9
-15
sound/soc/kirkwood/Kconfig
sound/soc/kirkwood/Kconfig
+3
-8
sound/soc/kirkwood/Makefile
sound/soc/kirkwood/Makefile
+1
-3
sound/soc/kirkwood/kirkwood-dma.c
sound/soc/kirkwood/kirkwood-dma.c
+24
-84
sound/soc/kirkwood/kirkwood-i2s.c
sound/soc/kirkwood/kirkwood-i2s.c
+33
-34
sound/soc/kirkwood/kirkwood-openrd.c
sound/soc/kirkwood/kirkwood-openrd.c
+2
-4
sound/soc/kirkwood/kirkwood-t5325.c
sound/soc/kirkwood/kirkwood-t5325.c
+2
-4
sound/soc/kirkwood/kirkwood.h
sound/soc/kirkwood/kirkwood.h
+10
-1
No files found.
arch/arm/mach-dove/common.c
View file @
54c1e27d
...
...
@@ -108,8 +108,8 @@ static void __init dove_clk_init(void)
orion_clkdev_add
(
NULL
,
"sdhci-dove.1"
,
sdio1
);
orion_clkdev_add
(
NULL
,
"orion_nand"
,
nand
);
orion_clkdev_add
(
NULL
,
"cafe1000-ccic.0"
,
camera
);
orion_clkdev_add
(
NULL
,
"
kirkwood-i2s
.0"
,
i2s0
);
orion_clkdev_add
(
NULL
,
"
kirkwood-i2s
.1"
,
i2s1
);
orion_clkdev_add
(
NULL
,
"
mvebu-audio
.0"
,
i2s0
);
orion_clkdev_add
(
NULL
,
"
mvebu-audio
.1"
,
i2s1
);
orion_clkdev_add
(
NULL
,
"mv_crypto"
,
crypto
);
orion_clkdev_add
(
NULL
,
"dove-ac97"
,
ac97
);
orion_clkdev_add
(
NULL
,
"dove-pdma"
,
pdma
);
...
...
arch/arm/mach-kirkwood/common.c
View file @
54c1e27d
...
...
@@ -264,7 +264,7 @@ void __init kirkwood_clk_init(void)
orion_clkdev_add
(
NULL
,
MV_XOR_NAME
".1"
,
xor1
);
orion_clkdev_add
(
"0"
,
"pcie"
,
pex0
);
orion_clkdev_add
(
"1"
,
"pcie"
,
pex1
);
orion_clkdev_add
(
NULL
,
"
kirkwood-i2s
"
,
audio
);
orion_clkdev_add
(
NULL
,
"
mvebu-audio
"
,
audio
);
orion_clkdev_add
(
NULL
,
MV64XXX_I2C_CTLR_NAME
".0"
,
runit
);
orion_clkdev_add
(
NULL
,
MV64XXX_I2C_CTLR_NAME
".1"
,
runit
);
...
...
@@ -560,7 +560,7 @@ void __init kirkwood_timer_init(void)
/*****************************************************************************
* Audio
****************************************************************************/
static
struct
resource
kirkwood_
i2s
_resources
[]
=
{
static
struct
resource
kirkwood_
audio
_resources
[]
=
{
[
0
]
=
{
.
start
=
AUDIO_PHYS_BASE
,
.
end
=
AUDIO_PHYS_BASE
+
SZ_16K
-
1
,
...
...
@@ -573,29 +573,23 @@ static struct resource kirkwood_i2s_resources[] = {
},
};
static
struct
kirkwood_asoc_platform_data
kirkwood_
i2s
_data
=
{
static
struct
kirkwood_asoc_platform_data
kirkwood_
audio
_data
=
{
.
burst
=
128
,
};
static
struct
platform_device
kirkwood_
i2s
_device
=
{
.
name
=
"
kirkwood-i2s
"
,
static
struct
platform_device
kirkwood_
audio
_device
=
{
.
name
=
"
mvebu-audio
"
,
.
id
=
-
1
,
.
num_resources
=
ARRAY_SIZE
(
kirkwood_
i2s
_resources
),
.
resource
=
kirkwood_
i2s
_resources
,
.
num_resources
=
ARRAY_SIZE
(
kirkwood_
audio
_resources
),
.
resource
=
kirkwood_
audio
_resources
,
.
dev
=
{
.
platform_data
=
&
kirkwood_
i2s
_data
,
.
platform_data
=
&
kirkwood_
audio
_data
,
},
};
static
struct
platform_device
kirkwood_pcm_device
=
{
.
name
=
"kirkwood-pcm-audio"
,
.
id
=
-
1
,
};
void
__init
kirkwood_audio_init
(
void
)
{
platform_device_register
(
&
kirkwood_i2s_device
);
platform_device_register
(
&
kirkwood_pcm_device
);
platform_device_register
(
&
kirkwood_audio_device
);
}
/*****************************************************************************
...
...
sound/soc/kirkwood/Kconfig
View file @
54c1e27d
config SND_KIRKWOOD_SOC
tristate "SoC Audio for the Marvell Kirkwood chip"
depends on ARCH_KIRKWOOD
depends on ARCH_KIRKWOOD
|| COMPILE_TEST
help
Say Y or M if you want to add support for codecs attached to
the Kirkwood I2S interface. You will also need to select the
audio interfaces to support below.
config SND_KIRKWOOD_SOC_I2S
tristate
config SND_KIRKWOOD_SOC_OPENRD
tristate "SoC Audio support for Kirkwood Openrd Client"
depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE)
depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE
|| COMPILE_TEST
)
depends on I2C
select SND_KIRKWOOD_SOC_I2S
select SND_SOC_CS42L51
help
Say Y if you want to add support for SoC audio on
...
...
@@ -21,8 +17,7 @@ config SND_KIRKWOOD_SOC_OPENRD
config SND_KIRKWOOD_SOC_T5325
tristate "SoC Audio support for HP t5325"
depends on SND_KIRKWOOD_SOC && MACH_T5325 && I2C
select SND_KIRKWOOD_SOC_I2S
depends on SND_KIRKWOOD_SOC && (MACH_T5325 || COMPILE_TEST) && I2C
select SND_SOC_ALC5623
help
Say Y if you want to add support for SoC audio on
...
...
sound/soc/kirkwood/Makefile
View file @
54c1e27d
snd-soc-kirkwood-objs
:=
kirkwood-dma.o
snd-soc-kirkwood-i2s-objs
:=
kirkwood-i2s.o
snd-soc-kirkwood-objs
:=
kirkwood-dma.o kirkwood-i2s.o
obj-$(CONFIG_SND_KIRKWOOD_SOC)
+=
snd-soc-kirkwood.o
obj-$(CONFIG_SND_KIRKWOOD_SOC_I2S)
+=
snd-soc-kirkwood-i2s.o
snd-soc-openrd-objs
:=
kirkwood-openrd.o
snd-soc-t5325-objs
:=
kirkwood-t5325.o
...
...
sound/soc/kirkwood/kirkwood-dma.c
View file @
54c1e27d
...
...
@@ -33,11 +33,11 @@
SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE | \
SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE)
st
ruct
kirkwood_dma_priv
{
struct
snd_pcm_substream
*
play_stream
;
struct
snd_
pcm_substream
*
rec_stream
;
struct
kirkwood_dma_data
*
data
;
}
;
st
atic
struct
kirkwood_dma_data
*
kirkwood_priv
(
struct
snd_pcm_substream
*
subs
)
{
struct
snd_
soc_pcm_runtime
*
soc_runtime
=
subs
->
private_data
;
return
snd_soc_dai_get_drvdata
(
soc_runtime
->
cpu_dai
)
;
}
static
struct
snd_pcm_hardware
kirkwood_dma_snd_hw
=
{
.
info
=
(
SNDRV_PCM_INFO_INTERLEAVED
|
...
...
@@ -51,7 +51,7 @@ static struct snd_pcm_hardware kirkwood_dma_snd_hw = {
.
rate_max
=
384000
,
.
channels_min
=
1
,
.
channels_max
=
8
,
.
buffer_bytes_max
=
KIRKWOOD_SND_MAX_
PERIOD_BYTES
*
KIRKWOOD_SND_MAX_PERIOD
S
,
.
buffer_bytes_max
=
KIRKWOOD_SND_MAX_
BUFFER_BYTE
S
,
.
period_bytes_min
=
KIRKWOOD_SND_MIN_PERIOD_BYTES
,
.
period_bytes_max
=
KIRKWOOD_SND_MAX_PERIOD_BYTES
,
.
periods_min
=
KIRKWOOD_SND_MIN_PERIODS
,
...
...
@@ -63,8 +63,7 @@ static u64 kirkwood_dma_dmamask = DMA_BIT_MASK(32);
static
irqreturn_t
kirkwood_dma_irq
(
int
irq
,
void
*
dev_id
)
{
struct
kirkwood_dma_priv
*
prdata
=
dev_id
;
struct
kirkwood_dma_data
*
priv
=
prdata
->
data
;
struct
kirkwood_dma_data
*
priv
=
dev_id
;
unsigned
long
mask
,
status
,
cause
;
mask
=
readl
(
priv
->
io
+
KIRKWOOD_INT_MASK
);
...
...
@@ -89,10 +88,10 @@ static irqreturn_t kirkwood_dma_irq(int irq, void *dev_id)
writel
(
status
,
priv
->
io
+
KIRKWOOD_INT_CAUSE
);
if
(
status
&
KIRKWOOD_INT_CAUSE_PLAY_BYTES
)
snd_pcm_period_elapsed
(
pr
data
->
play_stream
);
snd_pcm_period_elapsed
(
pr
iv
->
substream_play
);
if
(
status
&
KIRKWOOD_INT_CAUSE_REC_BYTES
)
snd_pcm_period_elapsed
(
pr
data
->
rec_stream
);
snd_pcm_period_elapsed
(
pr
iv
->
substream_rec
);
return
IRQ_HANDLED
;
}
...
...
@@ -126,15 +125,10 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
{
int
err
;
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
struct
snd_soc_pcm_runtime
*
soc_runtime
=
substream
->
private_data
;
struct
snd_soc_platform
*
platform
=
soc_runtime
->
platform
;
struct
snd_soc_dai
*
cpu_dai
=
soc_runtime
->
cpu_dai
;
struct
kirkwood_dma_data
*
priv
;
struct
kirkwood_dma_priv
*
prdata
=
snd_soc_platform_get_drvdata
(
platform
);
struct
kirkwood_dma_data
*
priv
=
kirkwood_priv
(
substream
);
const
struct
mbus_dram_target_info
*
dram
;
unsigned
long
addr
;
priv
=
snd_soc_dai_get_dma_data
(
cpu_dai
,
substream
);
snd_soc_set_runtime_hwparams
(
substream
,
&
kirkwood_dma_snd_hw
);
/* Ensure that all constraints linked to dma burst are fulfilled */
...
...
@@ -157,21 +151,11 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
if
(
err
<
0
)
return
err
;
if
(
prdata
==
NULL
)
{
prdata
=
kzalloc
(
sizeof
(
struct
kirkwood_dma_priv
),
GFP_KERNEL
);
if
(
prdata
==
NULL
)
return
-
ENOMEM
;
prdata
->
data
=
priv
;
if
(
!
priv
->
substream_play
&&
!
priv
->
substream_rec
)
{
err
=
request_irq
(
priv
->
irq
,
kirkwood_dma_irq
,
IRQF_SHARED
,
"kirkwood-i2s"
,
prdata
);
if
(
err
)
{
kfree
(
prdata
);
"kirkwood-i2s"
,
priv
);
if
(
err
)
return
-
EBUSY
;
}
snd_soc_platform_set_drvdata
(
platform
,
prdata
);
/*
* Enable Error interrupts. We're only ack'ing them but
...
...
@@ -183,11 +167,11 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
dram
=
mv_mbus_dram_info
();
addr
=
substream
->
dma_buffer
.
addr
;
if
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
{
pr
data
->
play_stream
=
substream
;
pr
iv
->
substream_play
=
substream
;
kirkwood_dma_conf_mbus_windows
(
priv
->
io
,
KIRKWOOD_PLAYBACK_WIN
,
addr
,
dram
);
}
else
{
pr
data
->
rec_stream
=
substream
;
pr
iv
->
substream_rec
=
substream
;
kirkwood_dma_conf_mbus_windows
(
priv
->
io
,
KIRKWOOD_RECORD_WIN
,
addr
,
dram
);
}
...
...
@@ -197,27 +181,19 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
static
int
kirkwood_dma_close
(
struct
snd_pcm_substream
*
substream
)
{
struct
snd_soc_pcm_runtime
*
soc_runtime
=
substream
->
private_data
;
struct
snd_soc_dai
*
cpu_dai
=
soc_runtime
->
cpu_dai
;
struct
snd_soc_platform
*
platform
=
soc_runtime
->
platform
;
struct
kirkwood_dma_priv
*
prdata
=
snd_soc_platform_get_drvdata
(
platform
);
struct
kirkwood_dma_data
*
priv
;
priv
=
snd_soc_dai_get_dma_data
(
cpu_dai
,
substream
);
struct
kirkwood_dma_data
*
priv
=
kirkwood_priv
(
substream
);
if
(
!
pr
data
||
!
pr
iv
)
if
(
!
priv
)
return
0
;
if
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
pr
data
->
play_stream
=
NULL
;
pr
iv
->
substream_play
=
NULL
;
else
pr
data
->
rec_stream
=
NULL
;
pr
iv
->
substream_rec
=
NULL
;
if
(
!
pr
data
->
play_stream
&&
!
prdata
->
rec_stream
)
{
if
(
!
pr
iv
->
substream_play
&&
!
priv
->
substream_rec
)
{
writel
(
0
,
priv
->
io
+
KIRKWOOD_ERR_MASK
);
free_irq
(
priv
->
irq
,
prdata
);
kfree
(
prdata
);
snd_soc_platform_set_drvdata
(
platform
,
NULL
);
free_irq
(
priv
->
irq
,
priv
);
}
return
0
;
...
...
@@ -243,13 +219,9 @@ static int kirkwood_dma_hw_free(struct snd_pcm_substream *substream)
static
int
kirkwood_dma_prepare
(
struct
snd_pcm_substream
*
substream
)
{
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
struct
snd_soc_pcm_runtime
*
soc_runtime
=
substream
->
private_data
;
struct
snd_soc_dai
*
cpu_dai
=
soc_runtime
->
cpu_dai
;
struct
kirkwood_dma_data
*
priv
;
struct
kirkwood_dma_data
*
priv
=
kirkwood_priv
(
substream
);
unsigned
long
size
,
count
;
priv
=
snd_soc_dai_get_dma_data
(
cpu_dai
,
substream
);
/* compute buffer size in term of "words" as requested in specs */
size
=
frames_to_bytes
(
runtime
,
runtime
->
buffer_size
);
size
=
(
size
>>
2
)
-
1
;
...
...
@@ -272,13 +244,9 @@ static int kirkwood_dma_prepare(struct snd_pcm_substream *substream)
static
snd_pcm_uframes_t
kirkwood_dma_pointer
(
struct
snd_pcm_substream
*
substream
)
{
struct
snd_soc_pcm_runtime
*
soc_runtime
=
substream
->
private_data
;
struct
snd_soc_dai
*
cpu_dai
=
soc_runtime
->
cpu_dai
;
struct
kirkwood_dma_data
*
priv
;
struct
kirkwood_dma_data
*
priv
=
kirkwood_priv
(
substream
);
snd_pcm_uframes_t
count
;
priv
=
snd_soc_dai_get_dma_data
(
cpu_dai
,
substream
);
if
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
count
=
bytes_to_frames
(
substream
->
runtime
,
readl
(
priv
->
io
+
KIRKWOOD_PLAY_BYTE_COUNT
));
...
...
@@ -366,36 +334,8 @@ static void kirkwood_dma_free_dma_buffers(struct snd_pcm *pcm)
}
}
st
atic
st
ruct
snd_soc_platform_driver
kirkwood_soc_platform
=
{
struct
snd_soc_platform_driver
kirkwood_soc_platform
=
{
.
ops
=
&
kirkwood_dma_ops
,
.
pcm_new
=
kirkwood_dma_new
,
.
pcm_free
=
kirkwood_dma_free_dma_buffers
,
};
static
int
kirkwood_soc_platform_probe
(
struct
platform_device
*
pdev
)
{
return
snd_soc_register_platform
(
&
pdev
->
dev
,
&
kirkwood_soc_platform
);
}
static
int
kirkwood_soc_platform_remove
(
struct
platform_device
*
pdev
)
{
snd_soc_unregister_platform
(
&
pdev
->
dev
);
return
0
;
}
static
struct
platform_driver
kirkwood_pcm_driver
=
{
.
driver
=
{
.
name
=
"kirkwood-pcm-audio"
,
.
owner
=
THIS_MODULE
,
},
.
probe
=
kirkwood_soc_platform_probe
,
.
remove
=
kirkwood_soc_platform_remove
,
};
module_platform_driver
(
kirkwood_pcm_driver
);
MODULE_AUTHOR
(
"Arnaud Patard <arnaud.patard@rtp-net.org>"
);
MODULE_DESCRIPTION
(
"Marvell Kirkwood Audio DMA module"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_ALIAS
(
"platform:kirkwood-pcm-audio"
);
sound/soc/kirkwood/kirkwood-i2s.c
View file @
54c1e27d
...
...
@@ -24,11 +24,8 @@
#include <linux/platform_data/asoc-kirkwood.h>
#include "kirkwood.h"
#define DRV_NAME "
kirkwood-i2s
"
#define DRV_NAME "
mvebu-audio
"
#define KIRKWOOD_I2S_RATES \
(SNDRV_PCM_RATE_44100 | \
SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000)
#define KIRKWOOD_I2S_FORMATS \
(SNDRV_PCM_FMTBIT_S16_LE | \
SNDRV_PCM_FMTBIT_S24_LE | \
...
...
@@ -105,14 +102,16 @@ static void kirkwood_set_rate(struct snd_soc_dai *dai,
uint32_t
clks_ctrl
;
if
(
rate
==
44100
||
rate
==
48000
||
rate
==
96000
)
{
/* use internal dco for supported rates */
/* use internal dco for the supported rates
* defined in kirkwood_i2s_dai */
dev_dbg
(
dai
->
dev
,
"%s: dco set rate = %lu
\n
"
,
__func__
,
rate
);
kirkwood_set_dco
(
priv
->
io
,
rate
);
clks_ctrl
=
KIRKWOOD_MCLK_SOURCE_DCO
;
}
else
if
(
!
IS_ERR
(
priv
->
extclk
))
{
/* use optional external clk for other rates */
}
else
{
/* use the external clock for the other rates
* defined in kirkwood_i2s_dai_extclk */
dev_dbg
(
dai
->
dev
,
"%s: extclk set rate = %lu -> %lu
\n
"
,
__func__
,
rate
,
256
*
rate
);
clk_set_rate
(
priv
->
extclk
,
256
*
rate
);
...
...
@@ -199,8 +198,7 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
ctl_play
|=
KIRKWOOD_PLAYCTL_MONO_OFF
;
priv
->
ctl_play
&=
~
(
KIRKWOOD_PLAYCTL_MONO_MASK
|
KIRKWOOD_PLAYCTL_I2S_EN
|
KIRKWOOD_PLAYCTL_SPDIF_EN
|
KIRKWOOD_PLAYCTL_ENABLE_MASK
|
KIRKWOOD_PLAYCTL_SIZE_MASK
);
priv
->
ctl_play
|=
ctl_play
;
}
else
{
...
...
@@ -244,8 +242,7 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
case
SNDRV_PCM_TRIGGER_START
:
/* configure */
ctl
=
priv
->
ctl_play
;
value
=
ctl
&
~
(
KIRKWOOD_PLAYCTL_I2S_EN
|
KIRKWOOD_PLAYCTL_SPDIF_EN
);
value
=
ctl
&
~
KIRKWOOD_PLAYCTL_ENABLE_MASK
;
writel
(
value
,
priv
->
io
+
KIRKWOOD_PLAYCTL
);
/* enable interrupts */
...
...
@@ -267,7 +264,7 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
writel
(
value
,
priv
->
io
+
KIRKWOOD_INT_MASK
);
/* disable all playbacks */
ctl
&=
~
(
KIRKWOOD_PLAYCTL_I2S_EN
|
KIRKWOOD_PLAYCTL_SPDIF_EN
)
;
ctl
&=
~
KIRKWOOD_PLAYCTL_ENABLE_MASK
;
writel
(
ctl
,
priv
->
io
+
KIRKWOOD_PLAYCTL
);
break
;
...
...
@@ -387,7 +384,7 @@ static int kirkwood_i2s_probe(struct snd_soc_dai *dai)
/* disable playback/record */
value
=
readl
(
priv
->
io
+
KIRKWOOD_PLAYCTL
);
value
&=
~
(
KIRKWOOD_PLAYCTL_I2S_EN
|
KIRKWOOD_PLAYCTL_SPDIF_EN
)
;
value
&=
~
KIRKWOOD_PLAYCTL_ENABLE_MASK
;
writel
(
value
,
priv
->
io
+
KIRKWOOD_PLAYCTL
);
value
=
readl
(
priv
->
io
+
KIRKWOOD_RECCTL
);
...
...
@@ -398,11 +395,6 @@ static int kirkwood_i2s_probe(struct snd_soc_dai *dai)
}
static
int
kirkwood_i2s_remove
(
struct
snd_soc_dai
*
dai
)
{
return
0
;
}
static
const
struct
snd_soc_dai_ops
kirkwood_i2s_dai_ops
=
{
.
startup
=
kirkwood_i2s_startup
,
.
trigger
=
kirkwood_i2s_trigger
,
...
...
@@ -413,17 +405,18 @@ static const struct snd_soc_dai_ops kirkwood_i2s_dai_ops = {
static
struct
snd_soc_dai_driver
kirkwood_i2s_dai
=
{
.
probe
=
kirkwood_i2s_probe
,
.
remove
=
kirkwood_i2s_remove
,
.
playback
=
{
.
channels_min
=
1
,
.
channels_max
=
2
,
.
rates
=
KIRKWOOD_I2S_RATES
,
.
rates
=
SNDRV_PCM_RATE_44100
|
SNDRV_PCM_RATE_48000
|
SNDRV_PCM_RATE_96000
,
.
formats
=
KIRKWOOD_I2S_FORMATS
,
},
.
capture
=
{
.
channels_min
=
1
,
.
channels_max
=
2
,
.
rates
=
KIRKWOOD_I2S_RATES
,
.
rates
=
SNDRV_PCM_RATE_44100
|
SNDRV_PCM_RATE_48000
|
SNDRV_PCM_RATE_96000
,
.
formats
=
KIRKWOOD_I2S_FORMATS
,
},
.
ops
=
&
kirkwood_i2s_dai_ops
,
...
...
@@ -431,7 +424,6 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai = {
static
struct
snd_soc_dai_driver
kirkwood_i2s_dai_extclk
=
{
.
probe
=
kirkwood_i2s_probe
,
.
remove
=
kirkwood_i2s_remove
,
.
playback
=
{
.
channels_min
=
1
,
.
channels_max
=
2
,
...
...
@@ -498,10 +490,10 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
if
(
err
<
0
)
return
err
;
priv
->
extclk
=
clk_get
(
&
pdev
->
dev
,
"extclk"
);
priv
->
extclk
=
devm_
clk_get
(
&
pdev
->
dev
,
"extclk"
);
if
(
!
IS_ERR
(
priv
->
extclk
))
{
if
(
priv
->
extclk
==
priv
->
clk
)
{
clk_put
(
priv
->
extclk
);
devm_clk_put
(
&
pdev
->
dev
,
priv
->
extclk
);
priv
->
extclk
=
ERR_PTR
(
-
EINVAL
);
}
else
{
dev_info
(
&
pdev
->
dev
,
"found external clock
\n
"
);
...
...
@@ -525,14 +517,22 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
err
=
snd_soc_register_component
(
&
pdev
->
dev
,
&
kirkwood_i2s_component
,
soc_dai
,
1
);
if
(
!
err
)
return
0
;
dev_err
(
&
pdev
->
dev
,
"snd_soc_register_component failed
\n
"
);
if
(
err
)
{
dev_err
(
&
pdev
->
dev
,
"snd_soc_register_component failed
\n
"
);
goto
err_component
;
}
if
(
!
IS_ERR
(
priv
->
extclk
))
{
clk_disable_unprepare
(
priv
->
extclk
);
clk_put
(
priv
->
extclk
);
err
=
snd_soc_register_platform
(
&
pdev
->
dev
,
&
kirkwood_soc_platform
);
if
(
err
)
{
dev_err
(
&
pdev
->
dev
,
"snd_soc_register_platform failed
\n
"
);
goto
err_platform
;
}
return
0
;
err_platform:
snd_soc_unregister_component
(
&
pdev
->
dev
);
err_component:
if
(
!
IS_ERR
(
priv
->
extclk
))
clk_disable_unprepare
(
priv
->
extclk
);
clk_disable_unprepare
(
priv
->
clk
);
return
err
;
...
...
@@ -542,12 +542,11 @@ static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
{
struct
kirkwood_dma_data
*
priv
=
dev_get_drvdata
(
&
pdev
->
dev
);
snd_soc_unregister_platform
(
&
pdev
->
dev
);
snd_soc_unregister_component
(
&
pdev
->
dev
);
if
(
!
IS_ERR
(
priv
->
extclk
))
{
if
(
!
IS_ERR
(
priv
->
extclk
))
clk_disable_unprepare
(
priv
->
extclk
);
clk_put
(
priv
->
extclk
);
}
clk_disable_unprepare
(
priv
->
clk
);
return
0
;
...
...
@@ -568,4 +567,4 @@ module_platform_driver(kirkwood_i2s_driver);
MODULE_AUTHOR
(
"Arnaud Patard, <arnaud.patard@rtp-net.org>"
);
MODULE_DESCRIPTION
(
"Kirkwood I2S SoC Interface"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_ALIAS
(
"platform:
kirkwood-i2s
"
);
MODULE_ALIAS
(
"platform:
mvebu-audio
"
);
sound/soc/kirkwood/kirkwood-openrd.c
View file @
54c1e27d
...
...
@@ -16,9 +16,7 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <sound/soc.h>
#include <mach/kirkwood.h>
#include <linux/platform_data/asoc-kirkwood.h>
#include <asm/mach-types.h>
#include "../codecs/cs42l51.h"
static
int
openrd_client_hw_params
(
struct
snd_pcm_substream
*
substream
,
...
...
@@ -54,8 +52,8 @@ static struct snd_soc_dai_link openrd_client_dai[] = {
{
.
name
=
"CS42L51"
,
.
stream_name
=
"CS42L51 HiFi"
,
.
cpu_dai_name
=
"
kirkwood-i2s
"
,
.
platform_name
=
"
kirkwood-pcm
-audio"
,
.
cpu_dai_name
=
"
mvebu-audio
"
,
.
platform_name
=
"
mvebu
-audio"
,
.
codec_dai_name
=
"cs42l51-hifi"
,
.
codec_name
=
"cs42l51-codec.0-004a"
,
.
dai_fmt
=
SND_SOC_DAIFMT_I2S
|
SND_SOC_DAIFMT_CBS_CFS
,
...
...
sound/soc/kirkwood/kirkwood-t5325.c
View file @
54c1e27d
...
...
@@ -15,9 +15,7 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <sound/soc.h>
#include <mach/kirkwood.h>
#include <linux/platform_data/asoc-kirkwood.h>
#include <asm/mach-types.h>
#include "../codecs/alc5623.h"
static
int
t5325_hw_params
(
struct
snd_pcm_substream
*
substream
,
...
...
@@ -70,8 +68,8 @@ static struct snd_soc_dai_link t5325_dai[] = {
{
.
name
=
"ALC5621"
,
.
stream_name
=
"ALC5621 HiFi"
,
.
cpu_dai_name
=
"
kirkwood-i2s
"
,
.
platform_name
=
"
kirkwood-pcm
-audio"
,
.
cpu_dai_name
=
"
mvebu-audio
"
,
.
platform_name
=
"
mvebu
-audio"
,
.
codec_dai_name
=
"alc5621-hifi"
,
.
codec_name
=
"alc562x-codec.0-001a"
,
.
dai_fmt
=
SND_SOC_DAIFMT_I2S
|
SND_SOC_DAIFMT_CBS_CFS
,
...
...
sound/soc/kirkwood/kirkwood.h
View file @
54c1e27d
...
...
@@ -54,7 +54,7 @@
#define KIRKWOOD_PLAYCTL_MONO_OFF (0<<5)
#define KIRKWOOD_PLAYCTL_I2S_MUTE (1<<7)
#define KIRKWOOD_PLAYCTL_SPDIF_EN (1<<4)
#define KIRKWOOD_PLAYCTL_I2S_EN (1<<3)
#define KIRKWOOD_PLAYCTL_I2S_EN
(1<<3)
#define KIRKWOOD_PLAYCTL_SIZE_MASK (7<<0)
#define KIRKWOOD_PLAYCTL_SIZE_16 (7<<0)
#define KIRKWOOD_PLAYCTL_SIZE_16_C (3<<0)
...
...
@@ -62,6 +62,9 @@
#define KIRKWOOD_PLAYCTL_SIZE_24 (1<<0)
#define KIRKWOOD_PLAYCTL_SIZE_32 (0<<0)
#define KIRKWOOD_PLAYCTL_ENABLE_MASK (KIRKWOOD_PLAYCTL_SPDIF_EN | \
KIRKWOOD_PLAYCTL_I2S_EN)
#define KIRKWOOD_PLAY_BUF_ADDR 0x1104
#define KIRKWOOD_PLAY_BUF_SIZE 0x1108
#define KIRKWOOD_PLAY_BYTE_COUNT 0x110C
...
...
@@ -122,6 +125,8 @@
#define KIRKWOOD_SND_MAX_PERIODS 16
#define KIRKWOOD_SND_MIN_PERIOD_BYTES 0x4000
#define KIRKWOOD_SND_MAX_PERIOD_BYTES 0x4000
#define KIRKWOOD_SND_MAX_BUFFER_BYTES (KIRKWOOD_SND_MAX_PERIOD_BYTES \
* KIRKWOOD_SND_MAX_PERIODS)
struct
kirkwood_dma_data
{
void
__iomem
*
io
;
...
...
@@ -129,8 +134,12 @@ struct kirkwood_dma_data {
struct
clk
*
extclk
;
uint32_t
ctl_play
;
uint32_t
ctl_rec
;
struct
snd_pcm_substream
*
substream_play
;
struct
snd_pcm_substream
*
substream_rec
;
int
irq
;
int
burst
;
};
extern
struct
snd_soc_platform_driver
kirkwood_soc_platform
;
#endif
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