From: Mark Brown Date: Sun, 30 Aug 2015 14:55:54 +0000 (+0100) Subject: Merge remote-tracking branches 'asoc/topic/rcar', 'asoc/topic/reg-default', 'asoc... X-Git-Tag: firefly_0821_release~176^2~1082^2~13^2~8 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=532161e6ccbd1c5ac3a2ea9dc60c8e253cd22fa5;p=firefly-linux-kernel-4.4.55.git Merge remote-tracking branches 'asoc/topic/rcar', 'asoc/topic/reg-default', 'asoc/topic/rl6231', 'asoc/topic/rockchip' and 'asoc/topic/rt286' into asoc-next --- 532161e6ccbd1c5ac3a2ea9dc60c8e253cd22fa5 diff --cc sound/soc/codecs/da7210.c index 457ed82d3e10,21810e5f3321,d4c0a324a03e,21810e5f3321,21810e5f3321,21810e5f3321..c7b3e927c606 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@@@@@@ -1182,7 -1182,7 -1182,7 -1182,7 -1182,7 -1182,7 +1182,7 @@@@@@@ static struct snd_soc_codec_driver soc_ #if IS_ENABLED(CONFIG_I2C) - static const struct reg_default da7210_regmap_i2c_patch[] = { - ---static struct reg_default da7210_regmap_i2c_patch[] = { ++ +++static const struct reg_sequence da7210_regmap_i2c_patch[] = { /* System controller master disable */ { DA7210_STARTUP1, 0x00 }, @@@@@@@ -1268,7 -1269,7 -1269,7 -1269,7 -1269,7 -1269,7 +1268,7 @@@@@@@ static struct i2c_driver da7210_i2c_dri #if defined(CONFIG_SPI_MASTER) - static const struct reg_default da7210_regmap_spi_patch[] = { - ---static struct reg_default da7210_regmap_spi_patch[] = { ++ +++static const struct reg_sequence da7210_regmap_spi_patch[] = { /* Dummy read to give two pulses over nCS for SPI */ { DA7210_AUX2, 0x00 }, { DA7210_AUX2, 0x00 }, diff --cc sound/soc/codecs/rt5651.c index 54acd286bd00,a3506e193abc,383c3f065d30,8df690a5e99d,a3506e193abc,a3506e193abc..f2026a962e57 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c @@@@@@@ -46,7 -46,7 -46,7 -46,7 -46,7 -46,7 +46,7 @@@@@@@ static const struct regmap_range_cfg rt .window_len = 0x1, }, }; - static const struct reg_default init_list[] = { - ---static struct reg_default init_list[] = { ++ +++static const struct reg_sequence init_list[] = { {RT5651_PR_BASE + 0x3d, 0x3e00}, }; diff --cc sound/soc/codecs/wm8993.c index 9638accb74b9,8a8db8605dc2,06ff4943e7cc,8a8db8605dc2,8a8db8605dc2,8a8db8605dc2..ac9efd63dbef --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@@@@@@ -1595,7 -1595,7 -1595,7 -1595,7 -1595,7 -1595,7 +1595,7 @@@@@@@ static int wm8993_resume(struct snd_soc #endif /* Tune DC servo configuration */ - static const struct reg_default wm8993_regmap_patch[] = { - ---static struct reg_default wm8993_regmap_patch[] = { ++ +++static const struct reg_sequence wm8993_regmap_patch[] = { { 0x44, 3 }, { 0x56, 3 }, { 0x44, 0 }, diff --cc sound/soc/rockchip/rockchip_max98090.c index cc26f81ee4ff,000000000000,000000000000,000000000000,562e7ea3c55f,000000000000..26567b10393a mode 100644,000000,000000,000000,100644,000000..100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@@@@@@ -1,237 -1,0 -1,0 -1,0 -1,235 -1,0 +1,236 @@@@@@@ +++ +/* +++ + * Rockchip machine ASoC driver for boards using a MAX90809 CODEC. +++ + * +++ + * Copyright (c) 2014, ROCKCHIP CORPORATION. All rights reserved. +++ + * +++ + * This program is free software; you can redistribute it and/or modify it +++ + * under the terms and conditions of the GNU General Public License, +++ + * version 2, as published by the Free Software Foundation. +++ + * +++ + * This program is distributed in the hope it will be useful, but WITHOUT +++ + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +++ + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +++ + * more details. +++ + * +++ + * You should have received a copy of the GNU General Public License +++ + * along with this program. If not, see . +++ + * +++ + */ +++ + +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ + +++ +#include "rockchip_i2s.h" +++ +#include "../codecs/ts3a227e.h" +++ + +++ +#define DRV_NAME "rockchip-snd-max98090" +++ + +++ +static struct snd_soc_jack headset_jack; +++ +static struct snd_soc_jack_pin headset_jack_pins[] = { +++ + { +++ + .pin = "Headset Jack", +++ + .mask = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | +++ + SND_JACK_BTN_0 | SND_JACK_BTN_1 | +++ + SND_JACK_BTN_2 | SND_JACK_BTN_3, +++ + }, +++ +}; +++ + +++ +static const struct snd_soc_dapm_widget rk_dapm_widgets[] = { +++ + SND_SOC_DAPM_HP("Headphone", NULL), +++ + SND_SOC_DAPM_MIC("Headset Mic", NULL), +++ + SND_SOC_DAPM_MIC("Int Mic", NULL), +++ + SND_SOC_DAPM_SPK("Speaker", NULL), +++ +}; +++ + +++ +static const struct snd_soc_dapm_route rk_audio_map[] = { +++ + {"IN34", NULL, "Headset Mic"}, +++ + {"IN34", NULL, "MICBIAS"}, +++ + {"MICBIAS", NULL, "Headset Mic"}, +++ + {"DMICL", NULL, "Int Mic"}, +++ + {"Headphone", NULL, "HPL"}, +++ + {"Headphone", NULL, "HPR"}, +++ + {"Speaker", NULL, "SPKL"}, +++ + {"Speaker", NULL, "SPKR"}, +++ +}; +++ + +++ +static const struct snd_kcontrol_new rk_mc_controls[] = { +++ + SOC_DAPM_PIN_SWITCH("Headphone"), +++ + SOC_DAPM_PIN_SWITCH("Headset Mic"), +++ + SOC_DAPM_PIN_SWITCH("Int Mic"), +++ + SOC_DAPM_PIN_SWITCH("Speaker"), +++ +}; +++ + +++ +static int rk_aif1_hw_params(struct snd_pcm_substream *substream, +++ + struct snd_pcm_hw_params *params) +++ +{ +++ + int ret = 0; +++ + struct snd_soc_pcm_runtime *rtd = substream->private_data; +++ + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; +++ + struct snd_soc_dai *codec_dai = rtd->codec_dai; +++ + int mclk; +++ + +++ + switch (params_rate(params)) { +++ + case 8000: +++ + case 16000: +++ + case 48000: +++ + case 96000: +++ + mclk = 12288000; +++ + break; +++ + case 44100: +++ + mclk = 11289600; +++ + break; +++ + default: +++ + return -EINVAL; +++ + } +++ + +++ + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, +++ + SND_SOC_CLOCK_OUT); +++ + if (ret < 0) { +++ + dev_err(codec_dai->dev, "Can't set codec clock %d\n", ret); +++ + return ret; +++ + } +++ + +++ + ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, +++ + SND_SOC_CLOCK_IN); +++ + if (ret < 0) { +++ + dev_err(codec_dai->dev, "Can't set codec clock %d\n", ret); +++ + return ret; +++ + } +++ + +++ + return ret; +++ +} +++ + +++ +static int rk_init(struct snd_soc_pcm_runtime *runtime) +++ +{ +++ + /* Enable Headset and 4 Buttons Jack detection */ +++ + return snd_soc_card_jack_new(runtime->card, "Headset Jack", +++ + SND_JACK_HEADSET | +++ + SND_JACK_BTN_0 | SND_JACK_BTN_1 | +++ + SND_JACK_BTN_2 | SND_JACK_BTN_3, +++ + &headset_jack, +++ + headset_jack_pins, +++ + ARRAY_SIZE(headset_jack_pins)); +++ +} +++ + +++ +static int rk_98090_headset_init(struct snd_soc_component *component) +++ +{ +++ + return ts3a227e_enable_jack_detect(component, &headset_jack); +++ +} +++ + +++ +static struct snd_soc_ops rk_aif1_ops = { +++ + .hw_params = rk_aif1_hw_params, +++ +}; +++ + +++ +static struct snd_soc_aux_dev rk_98090_headset_dev = { +++ + .name = "Headset Chip", +++ + .init = rk_98090_headset_init, +++ +}; +++ + +++ +static struct snd_soc_dai_link rk_dailink = { +++ + .name = "max98090", +++ + .stream_name = "Audio", +++ + .codec_dai_name = "HiFi", +++ + .init = rk_init, +++ + .ops = &rk_aif1_ops, +++ + /* set max98090 as slave */ +++ + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | +++ + SND_SOC_DAIFMT_CBS_CFS, +++ +}; +++ + +++ +static struct snd_soc_card snd_soc_card_rk = { +++ + .name = "ROCKCHIP-I2S", +++++ .owner = THIS_MODULE, +++ + .dai_link = &rk_dailink, +++ + .num_links = 1, +++ + .aux_dev = &rk_98090_headset_dev, +++ + .num_aux_devs = 1, +++ + .dapm_widgets = rk_dapm_widgets, +++ + .num_dapm_widgets = ARRAY_SIZE(rk_dapm_widgets), +++ + .dapm_routes = rk_audio_map, +++ + .num_dapm_routes = ARRAY_SIZE(rk_audio_map), +++ + .controls = rk_mc_controls, +++ + .num_controls = ARRAY_SIZE(rk_mc_controls), +++ +}; +++ + +++ +static int snd_rk_mc_probe(struct platform_device *pdev) +++ +{ +++ + int ret = 0; +++ + struct snd_soc_card *card = &snd_soc_card_rk; +++ + struct device_node *np = pdev->dev.of_node; +++ + +++ + /* register the soc card */ +++ + card->dev = &pdev->dev; +++ + +++ + rk_dailink.codec_of_node = of_parse_phandle(np, +++ + "rockchip,audio-codec", 0); +++ + if (!rk_dailink.codec_of_node) { +++ + dev_err(&pdev->dev, +++ + "Property 'rockchip,audio-codec' missing or invalid\n"); +++ + return -EINVAL; +++ + } +++ + +++ + rk_dailink.cpu_of_node = of_parse_phandle(np, +++ + "rockchip,i2s-controller", 0); +++ + if (!rk_dailink.cpu_of_node) { +++ + dev_err(&pdev->dev, +++ + "Property 'rockchip,i2s-controller' missing or invalid\n"); +++ + return -EINVAL; +++ + } +++ + +++ + rk_dailink.platform_of_node = rk_dailink.cpu_of_node; +++ + +++ + rk_98090_headset_dev.codec_of_node = of_parse_phandle(np, +++ + "rockchip,headset-codec", 0); +++ + if (!rk_98090_headset_dev.codec_of_node) { +++ + dev_err(&pdev->dev, +++ + "Property 'rockchip,headset-codec' missing/invalid\n"); +++ + return -EINVAL; +++ + } +++ + +++ + ret = snd_soc_of_parse_card_name(card, "rockchip,model"); +++ + if (ret) { +++ + dev_err(&pdev->dev, +++ + "Soc parse card name failed %d\n", ret); +++ + return ret; +++ + } +++ + +++ + ret = devm_snd_soc_register_card(&pdev->dev, card); +++ + if (ret) { +++ + dev_err(&pdev->dev, +++ + "Soc register card failed %d\n", ret); +++ + return ret; +++ + } +++ + +++ + return ret; +++ +} +++ + +++ +static const struct of_device_id rockchip_max98090_of_match[] = { +++ + { .compatible = "rockchip,rockchip-audio-max98090", }, +++ + {}, +++ +}; +++ + +++ +MODULE_DEVICE_TABLE(of, rockchip_max98090_of_match); +++ + +++ +static struct platform_driver snd_rk_mc_driver = { +++ + .probe = snd_rk_mc_probe, +++ + .driver = { +++ + .name = DRV_NAME, - .owner = THIS_MODULE, +++ + .pm = &snd_soc_pm_ops, +++ + .of_match_table = rockchip_max98090_of_match, +++ + }, +++ +}; +++ + +++ +module_platform_driver(snd_rk_mc_driver); +++ + +++ +MODULE_AUTHOR("jianqun "); +++ +MODULE_DESCRIPTION("Rockchip max98090 machine ASoC driver"); +++ +MODULE_LICENSE("GPL v2"); +++ +MODULE_ALIAS("platform:" DRV_NAME); diff --cc sound/soc/rockchip/rockchip_rt5645.c index 09402799c8dc,000000000000,000000000000,000000000000,274b9b3dd9f6,000000000000..68c62e4c2316 mode 100644,000000,000000,000000,100644,000000..100644 --- a/sound/soc/rockchip/rockchip_rt5645.c +++ b/sound/soc/rockchip/rockchip_rt5645.c @@@@@@@ -1,226 -1,0 -1,0 -1,0 -1,224 -1,0 +1,225 @@@@@@@ +++ +/* +++ + * Rockchip machine ASoC driver for boards using a RT5645/RT5650 CODEC. +++ + * +++ + * Copyright (c) 2015, ROCKCHIP CORPORATION. All rights reserved. +++ + * +++ + * This program is free software; you can redistribute it and/or modify it +++ + * under the terms and conditions of the GNU General Public License, +++ + * version 2, as published by the Free Software Foundation. +++ + * +++ + * This program is distributed in the hope it will be useful, but WITHOUT +++ + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +++ + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +++ + * more details. +++ + * +++ + * You should have received a copy of the GNU General Public License +++ + * along with this program. If not, see . +++ + * +++ + */ +++ + +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include +++ +#include "rockchip_i2s.h" +++ + +++ +#define DRV_NAME "rockchip-snd-rt5645" +++ + +++ +static struct snd_soc_jack headset_jack; +++ + +++ +/* Jack detect via rt5645 driver. */ +++ +extern int rt5645_set_jack_detect(struct snd_soc_codec *codec, +++ + struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack, +++ + struct snd_soc_jack *btn_jack); +++ + +++ +static const struct snd_soc_dapm_widget rk_dapm_widgets[] = { +++ + SND_SOC_DAPM_HP("Headphones", NULL), +++ + SND_SOC_DAPM_SPK("Speakers", NULL), +++ + SND_SOC_DAPM_MIC("Headset Mic", NULL), +++ + SND_SOC_DAPM_MIC("Int Mic", NULL), +++ +}; +++ + +++ +static const struct snd_soc_dapm_route rk_audio_map[] = { +++ + /* Input Lines */ +++ + {"DMIC L2", NULL, "Int Mic"}, +++ + {"DMIC R2", NULL, "Int Mic"}, +++ + {"RECMIXL", NULL, "Headset Mic"}, +++ + {"RECMIXR", NULL, "Headset Mic"}, +++ + +++ + /* Output Lines */ +++ + {"Headphones", NULL, "HPOR"}, +++ + {"Headphones", NULL, "HPOL"}, +++ + {"Speakers", NULL, "SPOL"}, +++ + {"Speakers", NULL, "SPOR"}, +++ +}; +++ + +++ +static const struct snd_kcontrol_new rk_mc_controls[] = { +++ + SOC_DAPM_PIN_SWITCH("Headphones"), +++ + SOC_DAPM_PIN_SWITCH("Speakers"), +++ + SOC_DAPM_PIN_SWITCH("Headset Mic"), +++ + SOC_DAPM_PIN_SWITCH("Int Mic"), +++ +}; +++ + +++ +static int rk_aif1_hw_params(struct snd_pcm_substream *substream, +++ + struct snd_pcm_hw_params *params) +++ +{ +++ + int ret = 0; +++ + struct snd_soc_pcm_runtime *rtd = substream->private_data; +++ + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; +++ + struct snd_soc_dai *codec_dai = rtd->codec_dai; +++ + int mclk; +++ + +++ + switch (params_rate(params)) { +++ + case 8000: +++ + case 16000: +++ + case 48000: +++ + case 96000: +++ + mclk = 12288000; +++ + break; +++ + case 44100: +++ + mclk = 11289600; +++ + break; +++ + default: +++ + return -EINVAL; +++ + } +++ + +++ + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, +++ + SND_SOC_CLOCK_OUT); +++ + if (ret < 0) { +++ + dev_err(codec_dai->dev, "Can't set codec clock %d\n", ret); +++ + return ret; +++ + } +++ + +++ + ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, +++ + SND_SOC_CLOCK_IN); +++ + if (ret < 0) { +++ + dev_err(codec_dai->dev, "Can't set codec clock %d\n", ret); +++ + return ret; +++ + } +++ + +++ + return ret; +++ +} +++ + +++ +static int rk_init(struct snd_soc_pcm_runtime *runtime) +++ +{ +++ + struct snd_soc_card *card = runtime->card; +++ + int ret; +++ + +++ + /* Enable Headset and 4 Buttons Jack detection */ +++ + ret = snd_soc_card_jack_new(card, "Headset Jack", +++ + SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | +++ + SND_JACK_BTN_0 | SND_JACK_BTN_1 | +++ + SND_JACK_BTN_2 | SND_JACK_BTN_3, +++ + &headset_jack, NULL, 0); - if (!ret) { ++++ + if (ret) { +++ + dev_err(card->dev, "New Headset Jack failed! (%d)\n", ret); +++ + return ret; +++ + } +++ + +++ + return rt5645_set_jack_detect(runtime->codec, +++ + &headset_jack, +++ + &headset_jack, +++ + &headset_jack); +++ +} +++ + +++ +static struct snd_soc_ops rk_aif1_ops = { +++ + .hw_params = rk_aif1_hw_params, +++ +}; +++ + +++ +static struct snd_soc_dai_link rk_dailink = { +++ + .name = "rt5645", +++ + .stream_name = "rt5645 PCM", +++ + .codec_dai_name = "rt5645-aif1", +++ + .init = rk_init, +++ + .ops = &rk_aif1_ops, +++ + /* set rt5645 as slave */ +++ + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | +++ + SND_SOC_DAIFMT_CBS_CFS, +++ +}; +++ + +++ +static struct snd_soc_card snd_soc_card_rk = { +++ + .name = "I2S-RT5650", +++++ .owner = THIS_MODULE, +++ + .dai_link = &rk_dailink, +++ + .num_links = 1, +++ + .dapm_widgets = rk_dapm_widgets, +++ + .num_dapm_widgets = ARRAY_SIZE(rk_dapm_widgets), +++ + .dapm_routes = rk_audio_map, +++ + .num_dapm_routes = ARRAY_SIZE(rk_audio_map), +++ + .controls = rk_mc_controls, +++ + .num_controls = ARRAY_SIZE(rk_mc_controls), +++ +}; +++ + +++ +static int snd_rk_mc_probe(struct platform_device *pdev) +++ +{ +++ + int ret = 0; +++ + struct snd_soc_card *card = &snd_soc_card_rk; +++ + struct device_node *np = pdev->dev.of_node; +++ + +++ + /* register the soc card */ +++ + card->dev = &pdev->dev; +++ + +++ + rk_dailink.codec_of_node = of_parse_phandle(np, +++ + "rockchip,audio-codec", 0); +++ + if (!rk_dailink.codec_of_node) { +++ + dev_err(&pdev->dev, +++ + "Property 'rockchip,audio-codec' missing or invalid\n"); +++ + return -EINVAL; +++ + } +++ + +++ + rk_dailink.cpu_of_node = of_parse_phandle(np, +++ + "rockchip,i2s-controller", 0); +++ + if (!rk_dailink.cpu_of_node) { +++ + dev_err(&pdev->dev, +++ + "Property 'rockchip,i2s-controller' missing or invalid\n"); +++ + return -EINVAL; +++ + } +++ + +++ + rk_dailink.platform_of_node = rk_dailink.cpu_of_node; +++ + +++ + ret = snd_soc_of_parse_card_name(card, "rockchip,model"); +++ + if (ret) { +++ + dev_err(&pdev->dev, +++ + "Soc parse card name failed %d\n", ret); +++ + return ret; +++ + } +++ + +++ + ret = devm_snd_soc_register_card(&pdev->dev, card); +++ + if (ret) { +++ + dev_err(&pdev->dev, +++ + "Soc register card failed %d\n", ret); +++ + return ret; +++ + } +++ + +++ + return ret; +++ +} +++ + +++ +static const struct of_device_id rockchip_rt5645_of_match[] = { +++ + { .compatible = "rockchip,rockchip-audio-rt5645", }, +++ + {}, +++ +}; +++ + +++ +MODULE_DEVICE_TABLE(of, rockchip_rt5645_of_match); +++ + +++ +static struct platform_driver snd_rk_mc_driver = { +++ + .probe = snd_rk_mc_probe, +++ + .driver = { +++ + .name = DRV_NAME, - .owner = THIS_MODULE, +++ + .pm = &snd_soc_pm_ops, +++ + .of_match_table = rockchip_rt5645_of_match, +++ + }, +++ +}; +++ + +++ +module_platform_driver(snd_rk_mc_driver); +++ + +++ +MODULE_AUTHOR("Xing Zheng "); +++ +MODULE_DESCRIPTION("Rockchip rt5645 machine ASoC driver"); +++ +MODULE_LICENSE("GPL v2"); +++ +MODULE_ALIAS("platform:" DRV_NAME);