ASoC: Intel:Add Cherrytrail & Braswell machine driver cht_bsw_rt5645
Subsystems (4)
PATCH 1/2 ASoC: Intel:Add Cherrytrail & Braswell machine driver cht_bsw_rt5645
From: "Fang, Yang A" <[email protected]>
Add machine driver for two Intel Cherryview-based platforms, Cherrytrail and Braswell, with RT5645 codec
--- sound/soc/intel/Kconfig | 11 ++ sound/soc/intel/Makefile | 2 + sound/soc/intel/cht_bsw_rt5645.c | 317 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 330 insertions(+) create mode 100644 sound/soc/intel/cht_bsw_rt5645.c
sound/soc/intel/Kconfig +11 -0
@@ -110,3 +110,14 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH platforms with RT5672 audio codec. Say Y if you have such a device If unsure select "N". + +config SND_SOC_INTEL_CHT_BSW_RT5645_MACH + tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5645 codec" + depends on X86_INTEL_LPSS + select SND_SOC_RT5645 + select SND_SST_MFLD_PLATFORM + select SND_SST_IPC_ACPI + help + This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell + platforms with RT5645 audio codec. + If unsure select "N".
sound/soc/intel/Makefile +2 -0
@@ -28,6 +28,7 @@ snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o snd-soc-sst-broadwell-objs := broadwell.o snd-soc-sst-bytcr-dpcm-rt5640-objs := bytcr_dpcm_rt5640.o snd-soc-sst-cht-bsw-rt5672-objs := cht_bsw_rt5672.o +snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o
@@ -35,6 +36,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-dpcm-rt5640.o obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH) += snd-soc-sst-cht-bsw-rt5672.o +obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o # DSP driver obj-$(CONFIG_SND_SST_IPC) += sst/
sound/soc/intel/cht_bsw_rt5645.c new file +317 -0
317 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 2/2 ASoC: Intel:Add support rt5645 in sst driver
From: "Fang, Yang A" <[email protected]>
Added entry in sst driver to support rt5645 codec
for intel Braswell platform.
--- sound/soc/intel/sst/sst_acpi.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/intel/sst/sst_acpi.c +2 -0
@@ -352,6 +352,8 @@ static struct sst_machines sst_acpi_bytcr[] = {static struct sst_machines sst_acpi_chv[] = { {"10EC5670" ,"cht-bsw" ,"cht-bsw-rt5672" ,NULL ,"fw_sst_22a8.bin" , &chv_platform_data }, + {"10EC5645" ,"cht-bsw" ,"cht-bsw-rt5645" ,NULL ,"fw_sst_22a8.bin" , + &chv_platform_data }, {}, };
Signature · 1 line
1.7.9.5
Re: [PATCH 2/2] ASoC: Intel:Add support rt5645 in sst driver
Quoted 4 lines · On Sat, Jan 31, 2015 at 03:22:40PM -0800, [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
Added entry in sst driver to support rt5645 codec
for intel Braswell platform.
Applied, thanks.
Mark Brown
maintainersound/soc/intel/cht_bsw_rt5645.c line 152
Quoted 2 lines · On Sat, Jan 31, 2015 at 03:22:39PM -0800, [email protected] wrote:
sound/soc/intel/cht_bsw_rt5645.c new file +2
-0+/* Select clk_i2s1_asrc as ASRC clock source */ +snd_soc_write (codec,RT5645_ASRC_2 ,0x1111 );
We should have an interface for doing this from the CODEC driver rather than just randomly writing directly to registers - that way we don't have something else working behind the back of the CODEC driver and potentially interfering with it.
PATCH v2 1/2 ASoC: rt5645: add API to select ASRC clock source
In reply to [email protected]From: "Fang, Yang A" <[email protected]>
This patch defines an API to select the clock source for specified filters.
--- sound/soc/codecs/rt5645.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/rt5645.h | 72 +++++++++++++++++++------------------------ 2 files changed, 105 insertions(+), 41 deletions(-)
sound/soc/codecs/rt5645.c +74 -0
@@ -601,6 +601,80 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source, } +/** +* rt5645_sel_asrc_clk_src - select ASRC clock source for a set of filters +* @codec: SoC audio codec device. +* @filter_mask: mask of filters. +* @clk_src: clock source +* +* The ASRC function is for asynchronous MCLK and LRCK. Also, since RT5645 can +* only support standard 32fs or 64fs i2s format, ASRC should be enabled to +* support special i2s clock format such as Intel's 100fs(100 * sampling rate). +* ASRC function will track i2s clock and generate a corresponding system clock +* for codec. This function provides an API to select the clock source for a +* set of filters specified by the mask. And the codec driver will turn on ASRC +* for these filters if ASRC is selected as their clock source. +*/ +int rt5645_sel_asrc_clk_src (struct snd_soc_codec *codec, +unsigned int filter_mask,unsigned int clk_src) +{ +unsigned int asrc2_mask =0 , asrc2_value =0 ; +unsigned int asrc3_mask =0 , asrc3_value =0 ; + +if ((clk_src !=RT5645_CLK_SEL_SYS ) && + (clk_src !=RT5645_CLK_SEL_I2S1_ASRC ) && + (clk_src !=RT5645_CLK_SEL_I2S2_ASRC ) && + (clk_src !=RT5645_CLK_SEL_SYS2 )) +return -EINVAL ; + +if (filter_mask &RT5645_DA_STEREO_FILTER ) { + asrc2_mask |=RT5645_DA_STO_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_DA_STO_CLK_SEL_MASK ) + | (clk_src <<RT5645_DA_STO_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_DA_MONO_L_FILTER ) { + asrc2_mask |=RT5645_DA_MONOL_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_DA_MONOL_CLK_SEL_MASK ) + | (clk_src <<RT5645_DA_MONOL_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_DA_MONO_R_FILTER ) { + asrc2_mask |=RT5645_DA_MONOR_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_DA_MONOR_CLK_SEL_MASK ) + | (clk_src <<RT5645_DA_MONOR_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_AD_STEREO_FILTER ) { + asrc2_mask |=RT5645_AD_STO1_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_AD_STO1_CLK_SEL_MASK ) + | (clk_src <<RT5645_AD_STO1_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_AD_MONO_L_FILTER ) { + asrc3_mask |=RT5645_AD_MONOL_CLK_SEL_MASK ; + asrc3_value = (asrc3_value & ~RT5645_AD_MONOL_CLK_SEL_MASK ) + | (clk_src <<RT5645_AD_MONOL_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_AD_MONO_R_FILTER ) { + asrc3_mask |=RT5645_AD_MONOR_CLK_SEL_MASK ; + asrc3_value = (asrc3_value & ~RT5645_AD_MONOR_CLK_SEL_MASK ) + | (clk_src <<RT5645_AD_MONOR_CLK_SEL_SFT ); + } + +if (asrc2_mask) +snd_soc_update_bits (codec,RT5645_ASRC_2 , + asrc2_mask, asrc2_value); + +if (asrc3_mask) +snd_soc_update_bits (codec,RT5645_ASRC_3 , + asrc3_mask, asrc3_value); + +return 0 ; +} +EXPORT_SYMBOL_GPL (rt5645_sel_asrc_clk_src); +/* Digital Mixer */ static const struct snd_kcontrol_new rt5645_sto1_adc_l_mix[] = { SOC_DAPM_SINGLE("ADC1 Switch", RT5645_STO1_ADC_MIXER,
sound/soc/codecs/rt5645.h +31 -41
87 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 2/2 ASoC: Intel:Add Cherrytrail & Braswell machine driver cht_bsw_rt5645
From: "Fang, Yang A" <[email protected]>
Add machine driver for two Intel Cherryview-based platforms, Cherrytrail and Braswell, with RT5645 codec
--- sound/soc/intel/Kconfig | 11 ++ sound/soc/intel/Makefile | 2 + sound/soc/intel/cht_bsw_rt5645.c | 322 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 335 insertions(+) create mode 100644 sound/soc/intel/cht_bsw_rt5645.c
sound/soc/intel/Kconfig +11 -0
@@ -110,3 +110,14 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH platforms with RT5672 audio codec. Say Y if you have such a device If unsure select "N". + +config SND_SOC_INTEL_CHT_BSW_RT5645_MACH + tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5645 codec" + depends on X86_INTEL_LPSS + select SND_SOC_RT5645 + select SND_SST_MFLD_PLATFORM + select SND_SST_IPC_ACPI + help + This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell + platforms with RT5645 audio codec. + If unsure select "N".
sound/soc/intel/Makefile +2 -0
@@ -28,6 +28,7 @@ snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o snd-soc-sst-broadwell-objs := broadwell.o snd-soc-sst-bytcr-dpcm-rt5640-objs := bytcr_dpcm_rt5640.o snd-soc-sst-cht-bsw-rt5672-objs := cht_bsw_rt5672.o +snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o
@@ -35,6 +36,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-dpcm-rt5640.o obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH) += snd-soc-sst-cht-bsw-rt5672.o +obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o # DSP driver obj-$(CONFIG_SND_SST_IPC) += sst/
sound/soc/intel/cht_bsw_rt5645.c new file +322 -0
322 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Quoted 58 lines · On Tue, Feb 03, 2015 at 11:25:51AM -0800, [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
Add machine driver for two Intel Cherryview-based platforms, Cherrytrail and Braswell, with RT5645 codec
Signed-off-by Fang, Yang A <[email protected]>--- sound/soc/intel/Kconfig | 11 ++ sound/soc/intel/Makefile | 2 + sound/soc/intel/cht_bsw_rt5645.c | 322 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 335 insertions(+) create mode 100644 sound/soc/intel/cht_bsw_rt5645.csound/soc/intel/Kconfig +11
-0@@ -110,3 +110,14 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH platforms with RT5672 audio codec. Say Y if you have such a device If unsure select "N". + +config SND_SOC_INTEL_CHT_BSW_RT5645_MACH + tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5645 codec" + depends on X86_INTEL_LPSS + select SND_SOC_RT5645 + select SND_SST_MFLD_PLATFORM + select SND_SST_IPC_ACPI + help + This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell + platforms with RT5645 audio codec. + If unsure select "N".sound/soc/intel/Makefile +2
-0@@ -28,6 +28,7 @@ snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o snd-soc-sst-broadwell-objs := broadwell.o snd-soc-sst-bytcr-dpcm-rt5640-objs := bytcr_dpcm_rt5640.o snd-soc-sst-cht-bsw-rt5672-objs := cht_bsw_rt5672.o +snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o@@ -35,6 +36,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-dpcm-rt5640.o obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH) += snd-soc-sst-cht-bsw-rt5672.o +obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o # DSP driver obj-$(CONFIG_SND_SST_IPC) += sst/sound/soc/intel/cht_bsw_rt5645.c new file +0
-0
sound/soc/intel/cht_bsw_rt5645.c line 5
Quoted 5 lines
sound/soc/intel/cht_bsw_rt5645.c new file +5
-0@@ -0,0 +1,322 @@ +/* +* cht-bsw-rt5645.c - ASoc Machine driver for Intel Cherryview-based platforms +* Cherrytrail and Braswell, with RT5645 codec. +* +* Copyright (C) 2014 Intel Corp
nitpick, this should be 2014-15. Otherwise looks good
Signature · 1 line
~Vinod
PATCH v3 1/2 ASoC: rt5645: add API to select ASRC clock source
In reply to [email protected]From: "Fang, Yang A" <[email protected]>
This patch defines an API to select the clock source for specified filters.
--- sound/soc/codecs/rt5645.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/rt5645.h | 72 +++++++++++++++++++------------------------ 2 files changed, 105 insertions(+), 41 deletions(-)
sound/soc/codecs/rt5645.c +74 -0
@@ -601,6 +601,80 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source, } +/** +* rt5645_sel_asrc_clk_src - select ASRC clock source for a set of filters +* @codec: SoC audio codec device. +* @filter_mask: mask of filters. +* @clk_src: clock source +* +* The ASRC function is for asynchronous MCLK and LRCK. Also, since RT5645 can +* only support standard 32fs or 64fs i2s format, ASRC should be enabled to +* support special i2s clock format such as Intel's 100fs(100 * sampling rate). +* ASRC function will track i2s clock and generate a corresponding system clock +* for codec. This function provides an API to select the clock source for a +* set of filters specified by the mask. And the codec driver will turn on ASRC +* for these filters if ASRC is selected as their clock source. +*/ +int rt5645_sel_asrc_clk_src (struct snd_soc_codec *codec, +unsigned int filter_mask,unsigned int clk_src) +{ +unsigned int asrc2_mask =0 , asrc2_value =0 ; +unsigned int asrc3_mask =0 , asrc3_value =0 ; + +if ((clk_src !=RT5645_CLK_SEL_SYS ) && + (clk_src !=RT5645_CLK_SEL_I2S1_ASRC ) && + (clk_src !=RT5645_CLK_SEL_I2S2_ASRC ) && + (clk_src !=RT5645_CLK_SEL_SYS2 )) +return -EINVAL ; + +if (filter_mask &RT5645_DA_STEREO_FILTER ) { + asrc2_mask |=RT5645_DA_STO_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_DA_STO_CLK_SEL_MASK ) + | (clk_src <<RT5645_DA_STO_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_DA_MONO_L_FILTER ) { + asrc2_mask |=RT5645_DA_MONOL_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_DA_MONOL_CLK_SEL_MASK ) + | (clk_src <<RT5645_DA_MONOL_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_DA_MONO_R_FILTER ) { + asrc2_mask |=RT5645_DA_MONOR_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_DA_MONOR_CLK_SEL_MASK ) + | (clk_src <<RT5645_DA_MONOR_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_AD_STEREO_FILTER ) { + asrc2_mask |=RT5645_AD_STO1_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_AD_STO1_CLK_SEL_MASK ) + | (clk_src <<RT5645_AD_STO1_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_AD_MONO_L_FILTER ) { + asrc3_mask |=RT5645_AD_MONOL_CLK_SEL_MASK ; + asrc3_value = (asrc3_value & ~RT5645_AD_MONOL_CLK_SEL_MASK ) + | (clk_src <<RT5645_AD_MONOL_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_AD_MONO_R_FILTER ) { + asrc3_mask |=RT5645_AD_MONOR_CLK_SEL_MASK ; + asrc3_value = (asrc3_value & ~RT5645_AD_MONOR_CLK_SEL_MASK ) + | (clk_src <<RT5645_AD_MONOR_CLK_SEL_SFT ); + } + +if (asrc2_mask) +snd_soc_update_bits (codec,RT5645_ASRC_2 , + asrc2_mask, asrc2_value); + +if (asrc3_mask) +snd_soc_update_bits (codec,RT5645_ASRC_3 , + asrc3_mask, asrc3_value); + +return 0 ; +} +EXPORT_SYMBOL_GPL (rt5645_sel_asrc_clk_src); +/* Digital Mixer */ static const struct snd_kcontrol_new rt5645_sto1_adc_l_mix[] = { SOC_DAPM_SINGLE("ADC1 Switch", RT5645_STO1_ADC_MIXER,
sound/soc/codecs/rt5645.h +31 -41
87 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 2/2 ASoC: Intel:Add Cherrytrail & Braswell machine driver cht_bsw_rt5645
From: "Fang, Yang A" <[email protected]>
Add machine driver for two Intel Cherryview-based platforms, Cherrytrail and Braswell, with RT5645 codec
--- sound/soc/intel/Kconfig | 11 ++ sound/soc/intel/Makefile | 2 + sound/soc/intel/cht_bsw_rt5645.c | 322 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 335 insertions(+) create mode 100644 sound/soc/intel/cht_bsw_rt5645.c
sound/soc/intel/Kconfig +11 -0
@@ -110,3 +110,14 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH platforms with RT5672 audio codec. Say Y if you have such a device If unsure select "N". + +config SND_SOC_INTEL_CHT_BSW_RT5645_MACH + tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5645 codec" + depends on X86_INTEL_LPSS + select SND_SOC_RT5645 + select SND_SST_MFLD_PLATFORM + select SND_SST_IPC_ACPI + help + This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell + platforms with RT5645 audio codec. + If unsure select "N".
sound/soc/intel/Makefile +2 -0
@@ -28,6 +28,7 @@ snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o snd-soc-sst-broadwell-objs := broadwell.o snd-soc-sst-bytcr-dpcm-rt5640-objs := bytcr_dpcm_rt5640.o snd-soc-sst-cht-bsw-rt5672-objs := cht_bsw_rt5672.o +snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o
@@ -35,6 +36,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-dpcm-rt5640.o obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH) += snd-soc-sst-cht-bsw-rt5672.o +obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o # DSP driver obj-$(CONFIG_SND_SST_IPC) += sst/
sound/soc/intel/cht_bsw_rt5645.c new file +322 -0
322 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Quoted 6 lines · On Tue, Feb 03, 2015 at 12:03:48PM -0800, [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
Add machine driver for two Intel Cherryview-based platforms, Cherrytrail and Braswell, with RT5645 codec
Signed-off-by Fang, Yang A <[email protected]>
Signature · 1 line
~Vinod
Mark Brown
maintainerRe: [PATCH v3 1/2] ASoC: rt5645: add API to select ASRC clock source
In reply to [email protected]Quoted 3 lines · On Tue, Feb 03, 2015 at 12:03:47PM -0800, [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
This patch defines an API to select the clock source for specified filters.
This doesn't apply against current code, looks like a conflict with the rt5650 support patch. Please check and resend.
sound/soc/codecs/rt5645.c static int is_using_asrc(struct snd_soc_dapm_widget *source, · line 628
Quoted 5 lines
sound/soc/codecs/rt5645.c +5
-0+if ((clk_src !=RT5645_CLK_SEL_SYS ) && + (clk_src !=RT5645_CLK_SEL_I2S1_ASRC ) && + (clk_src !=RT5645_CLK_SEL_I2S2_ASRC ) && + (clk_src !=RT5645_CLK_SEL_SYS2 )) +return -EINVAL ;
That return statement is indented a bit far (it should just be a tab, it's not really anything to do with the constants so shouldn't be lined up with them). The whole thing would be better written as a switch statement (return -EINVAL in the default case and break on a known source).
PATCH v4 1/2 ASoC: rt5645: add API to select ASRC clock source
In reply to [email protected]From: "Fang, Yang A" <[email protected]>
This patch defines an API to select the clock source for specified filters.
--- sound/soc/codecs/rt5645.c | 81 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/rt5645.h | 72 +++++++++++++++++----------------------- 2 files changed, 112 insertions(+), 41 deletions(-)
sound/soc/codecs/rt5645.c +81 -0
@@ -613,6 +613,87 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source, } +/** +* rt5645_sel_asrc_clk_src - select ASRC clock source for a set of filters +* @codec: SoC audio codec device. +* @filter_mask: mask of filters. +* @clk_src: clock source +* +* The ASRC function is for asynchronous MCLK and LRCK. Also, since RT5645 can +* only support standard 32fs or 64fs i2s format, ASRC should be enabled to +* support special i2s clock format such as Intel's 100fs(100 * sampling rate). +* ASRC function will track i2s clock and generate a corresponding system clock +* for codec. This function provides an API to select the clock source for a +* set of filters specified by the mask. And the codec driver will turn on ASRC +* for these filters if ASRC is selected as their clock source. +*/ +int rt5645_sel_asrc_clk_src (struct snd_soc_codec *codec, +unsigned int filter_mask,unsigned int clk_src) +{ +unsigned int asrc2_mask =0 ; +unsigned int asrc2_value =0 ; +unsigned int asrc3_mask =0 ; +unsigned int asrc3_value =0 ; + +switch (clk_src) { +case RT5645_CLK_SEL_SYS : +case RT5645_CLK_SEL_I2S1_ASRC : +case RT5645_CLK_SEL_I2S2_ASRC : +case RT5645_CLK_SEL_SYS2 : +break ; + +default : +return -EINVAL ; + } + +if (filter_mask &RT5645_DA_STEREO_FILTER ) { + asrc2_mask |=RT5645_DA_STO_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_DA_STO_CLK_SEL_MASK ) + | (clk_src <<RT5645_DA_STO_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_DA_MONO_L_FILTER ) { + asrc2_mask |=RT5645_DA_MONOL_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_DA_MONOL_CLK_SEL_MASK ) + | (clk_src <<RT5645_DA_MONOL_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_DA_MONO_R_FILTER ) { + asrc2_mask |=RT5645_DA_MONOR_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_DA_MONOR_CLK_SEL_MASK ) + | (clk_src <<RT5645_DA_MONOR_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_AD_STEREO_FILTER ) { + asrc2_mask |=RT5645_AD_STO1_CLK_SEL_MASK ; + asrc2_value = (asrc2_value & ~RT5645_AD_STO1_CLK_SEL_MASK ) + | (clk_src <<RT5645_AD_STO1_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_AD_MONO_L_FILTER ) { + asrc3_mask |=RT5645_AD_MONOL_CLK_SEL_MASK ; + asrc3_value = (asrc3_value & ~RT5645_AD_MONOL_CLK_SEL_MASK ) + | (clk_src <<RT5645_AD_MONOL_CLK_SEL_SFT ); + } + +if (filter_mask &RT5645_AD_MONO_R_FILTER ) { + asrc3_mask |=RT5645_AD_MONOR_CLK_SEL_MASK ; + asrc3_value = (asrc3_value & ~RT5645_AD_MONOR_CLK_SEL_MASK ) + | (clk_src <<RT5645_AD_MONOR_CLK_SEL_SFT ); + } + +if (asrc2_mask) +snd_soc_update_bits (codec,RT5645_ASRC_2 , + asrc2_mask, asrc2_value); + +if (asrc3_mask) +snd_soc_update_bits (codec,RT5645_ASRC_3 , + asrc3_mask, asrc3_value); + +return 0 ; +} +EXPORT_SYMBOL_GPL (rt5645_sel_asrc_clk_src); +/* Digital Mixer */ static const struct snd_kcontrol_new rt5645_sto1_adc_l_mix[] = { SOC_DAPM_SINGLE("ADC1 Switch", RT5645_STO1_ADC_MIXER,
sound/soc/codecs/rt5645.h +31 -41
87 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 2/2 ASoC: Intel:Add Cherrytrail & Braswell machine driver cht_bsw_rt5645
From: "Fang, Yang A" <[email protected]>
Add machine driver for two Intel Cherryview-based platforms, Cherrytrail and Braswell, with RT5645 codec
--- sound/soc/intel/Kconfig | 11 ++ sound/soc/intel/Makefile | 2 + sound/soc/intel/cht_bsw_rt5645.c | 327 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 340 insertions(+) create mode 100644 sound/soc/intel/cht_bsw_rt5645.c
sound/soc/intel/Kconfig +11 -0
@@ -110,3 +110,14 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH platforms with RT5672 audio codec. Say Y if you have such a device If unsure select "N". + +config SND_SOC_INTEL_CHT_BSW_RT5645_MACH + tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5645 codec" + depends on X86_INTEL_LPSS + select SND_SOC_RT5645 + select SND_SST_MFLD_PLATFORM + select SND_SST_IPC_ACPI + help + This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell + platforms with RT5645 audio codec. + If unsure select "N".
sound/soc/intel/Makefile +2 -0
@@ -28,6 +28,7 @@ snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o snd-soc-sst-broadwell-objs := broadwell.o snd-soc-sst-bytcr-dpcm-rt5640-objs := bytcr_dpcm_rt5640.o snd-soc-sst-cht-bsw-rt5672-objs := cht_bsw_rt5672.o +snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o
@@ -35,6 +36,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-dpcm-rt5640.o obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH) += snd-soc-sst-cht-bsw-rt5672.o +obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o # DSP driver obj-$(CONFIG_SND_SST_IPC) += sst/
sound/soc/intel/cht_bsw_rt5645.c new file +327 -0
327 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH v4 1/2] ASoC: rt5645: add API to select ASRC clock source
In reply to [email protected]Quoted 3 lines · On Wed, Feb 04, 2015 at 06:19:31PM -0800, [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
This patch defines an API to select the clock source for specified filters.
Applied both, thanks.