Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Intel: boards: start merging byt-rt5640 drivers

first renaming and reducing delta with byt-rt5640 code before
dmi-based quirks are enabled

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Pierre-Louis Bossart and committed by
Mark Brown
a2d5563b e2be1da0

+93 -37
+1 -1
sound/soc/intel/atom/sst/sst_acpi.c
··· 314 314 } 315 315 316 316 static struct sst_acpi_mach sst_acpi_bytcr[] = { 317 - {"10EC5640", "bytt100_rt5640", "intel/fw_sst_0f28.bin", "T100", NULL, 317 + {"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL, 318 318 &byt_rvp_platform_data }, 319 319 {}, 320 320 };
+92 -36
sound/soc/intel/boards/bytcr_rt5640.c
··· 20 20 #include <linux/init.h> 21 21 #include <linux/module.h> 22 22 #include <linux/platform_device.h> 23 + #include <linux/acpi.h> 23 24 #include <linux/device.h> 25 + #include <linux/dmi.h> 24 26 #include <linux/slab.h> 25 - #include <linux/input.h> 26 27 #include <sound/pcm.h> 27 28 #include <sound/pcm_params.h> 28 29 #include <sound/soc.h> 30 + #include <sound/jack.h> 29 31 #include "../../codecs/rt5640.h" 30 32 #include "../atom/sst-atom-controls.h" 31 33 32 - static const struct snd_soc_dapm_widget byt_dapm_widgets[] = { 34 + static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = { 33 35 SND_SOC_DAPM_HP("Headphone", NULL), 34 36 SND_SOC_DAPM_MIC("Headset Mic", NULL), 35 37 SND_SOC_DAPM_MIC("Internal Mic", NULL), 36 38 SND_SOC_DAPM_SPK("Speaker", NULL), 37 39 }; 38 40 39 - static const struct snd_soc_dapm_route byt_audio_map[] = { 41 + static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = { 40 42 {"Headset Mic", NULL, "MICBIAS1"}, 41 43 {"IN2P", NULL, "Headset Mic"}, 42 44 {"Headphone", NULL, "HPOL"}, ··· 58 56 {"ssp2 Rx", NULL, "AIF1 Capture"}, 59 57 }; 60 58 61 - static const struct snd_kcontrol_new byt_mc_controls[] = { 59 + static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic1_map[] = { 60 + {"DMIC1", NULL, "Internal Mic"}, 61 + }; 62 + 63 + static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic2_map[] = { 64 + {"DMIC2", NULL, "Internal Mic"}, 65 + }; 66 + 67 + static const struct snd_soc_dapm_route byt_rt5640_intmic_in1_map[] = { 68 + {"Internal Mic", NULL, "MICBIAS1"}, 69 + {"IN1P", NULL, "Internal Mic"}, 70 + }; 71 + 72 + enum { 73 + BYT_RT5640_DMIC1_MAP, 74 + BYT_RT5640_DMIC2_MAP, 75 + BYT_RT5640_IN1_MAP, 76 + }; 77 + 78 + #define BYT_RT5640_MAP(quirk) ((quirk) & 0xff) 79 + #define BYT_RT5640_DMIC_EN BIT(16) 80 + 81 + static unsigned long byt_rt5640_quirk = BYT_RT5640_DMIC1_MAP | 82 + BYT_RT5640_DMIC_EN; 83 + 84 + static const struct snd_kcontrol_new byt_rt5640_controls[] = { 62 85 SOC_DAPM_PIN_SWITCH("Headphone"), 63 86 SOC_DAPM_PIN_SWITCH("Headset Mic"), 64 87 SOC_DAPM_PIN_SWITCH("Internal Mic"), 65 88 SOC_DAPM_PIN_SWITCH("Speaker"), 66 89 }; 67 90 68 - static int byt_aif1_hw_params(struct snd_pcm_substream *substream, 91 + static int byt_rt5640_aif1_hw_params(struct snd_pcm_substream *substream, 69 92 struct snd_pcm_hw_params *params) 70 93 { 71 94 struct snd_soc_pcm_runtime *rtd = substream->private_data; ··· 118 91 return 0; 119 92 } 120 93 121 - static const struct snd_soc_pcm_stream byt_dai_params = { 94 + static int byt_rt5640_quirk_cb(const struct dmi_system_id *id) 95 + { 96 + byt_rt5640_quirk = (unsigned long)id->driver_data; 97 + return 1; 98 + } 99 + 100 + static const struct dmi_system_id byt_rt5640_quirk_table[] = { 101 + { 102 + .callback = byt_rt5640_quirk_cb, 103 + .matches = { 104 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 105 + DMI_MATCH(DMI_PRODUCT_NAME, "T100TA"), 106 + }, 107 + .driver_data = (unsigned long *)BYT_RT5640_IN1_MAP, 108 + }, 109 + { 110 + .callback = byt_rt5640_quirk_cb, 111 + .matches = { 112 + DMI_MATCH(DMI_SYS_VENDOR, "DellInc."), 113 + DMI_MATCH(DMI_PRODUCT_NAME, "Venue 8 Pro 5830"), 114 + }, 115 + .driver_data = (unsigned long *)(BYT_RT5640_DMIC2_MAP | 116 + BYT_RT5640_DMIC_EN), 117 + }, 118 + {} 119 + }; 120 + 121 + static const struct snd_soc_pcm_stream byt_rt5640_dai_params = { 122 122 .formats = SNDRV_PCM_FMTBIT_S24_LE, 123 123 .rate_min = 48000, 124 124 .rate_max = 48000, ··· 153 99 .channels_max = 2, 154 100 }; 155 101 156 - static int byt_codec_fixup(struct snd_soc_pcm_runtime *rtd, 102 + static int byt_rt5640_codec_fixup(struct snd_soc_pcm_runtime *rtd, 157 103 struct snd_pcm_hw_params *params) 158 104 { 159 105 struct snd_interval *rate = hw_param_interval(params, ··· 193 139 return 0; 194 140 } 195 141 196 - static int byt_aif1_startup(struct snd_pcm_substream *substream) 142 + static int byt_rt5640_aif1_startup(struct snd_pcm_substream *substream) 197 143 { 198 144 return snd_pcm_hw_constraint_single(substream->runtime, 199 145 SNDRV_PCM_HW_PARAM_RATE, 48000); 200 146 } 201 147 202 - static struct snd_soc_ops byt_aif1_ops = { 203 - .startup = byt_aif1_startup, 148 + static struct snd_soc_ops byt_rt5640_aif1_ops = { 149 + .startup = byt_rt5640_aif1_startup, 204 150 }; 205 151 206 - static struct snd_soc_ops byt_be_ssp2_ops = { 207 - .hw_params = byt_aif1_hw_params, 152 + static struct snd_soc_ops byt_rt5640_be_ssp2_ops = { 153 + .hw_params = byt_rt5640_aif1_hw_params, 208 154 }; 209 155 210 - static struct snd_soc_dai_link byt_dailink[] = { 156 + static struct snd_soc_dai_link byt_rt5640_dais[] = { 211 157 [MERR_DPCM_AUDIO] = { 212 158 .name = "Baytrail Audio Port", 213 159 .stream_name = "Baytrail Audio", ··· 219 165 .dynamic = 1, 220 166 .dpcm_playback = 1, 221 167 .dpcm_capture = 1, 222 - .ops = &byt_aif1_ops, 168 + .ops = &byt_rt5640_aif1_ops, 223 169 }, 224 170 [MERR_DPCM_COMPR] = { 225 171 .name = "Baytrail Compressed Port", ··· 240 186 .codec_name = "i2c-10EC5640:00", 241 187 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 242 188 | SND_SOC_DAIFMT_CBS_CFS, 243 - .be_hw_params_fixup = byt_codec_fixup, 189 + .be_hw_params_fixup = byt_rt5640_codec_fixup, 244 190 .ignore_suspend = 1, 245 191 .dpcm_playback = 1, 246 192 .dpcm_capture = 1, 247 - .ops = &byt_be_ssp2_ops, 193 + .ops = &byt_rt5640_be_ssp2_ops, 248 194 }, 249 195 }; 250 196 251 197 /* SoC card */ 252 - static struct snd_soc_card snd_soc_card_byt = { 253 - .name = "baytrailcraudio", 198 + static struct snd_soc_card snd_soc_card_byt_rt5640 = { 199 + .name = "bytcr-rt5640", 254 200 .owner = THIS_MODULE, 255 - .dai_link = byt_dailink, 256 - .num_links = ARRAY_SIZE(byt_dailink), 257 - .dapm_widgets = byt_dapm_widgets, 258 - .num_dapm_widgets = ARRAY_SIZE(byt_dapm_widgets), 259 - .dapm_routes = byt_audio_map, 260 - .num_dapm_routes = ARRAY_SIZE(byt_audio_map), 261 - .controls = byt_mc_controls, 262 - .num_controls = ARRAY_SIZE(byt_mc_controls), 201 + .dai_link = byt_rt5640_dais, 202 + .num_links = ARRAY_SIZE(byt_rt5640_dais), 203 + .dapm_widgets = byt_rt5640_widgets, 204 + .num_dapm_widgets = ARRAY_SIZE(byt_rt5640_widgets), 205 + .dapm_routes = byt_rt5640_audio_map, 206 + .num_dapm_routes = ARRAY_SIZE(byt_rt5640_audio_map), 207 + .controls = byt_rt5640_controls, 208 + .num_controls = ARRAY_SIZE(byt_rt5640_controls), 263 209 }; 264 210 265 - static int snd_byt_mc_probe(struct platform_device *pdev) 211 + static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) 266 212 { 267 213 int ret_val = 0; 268 214 269 215 /* register the soc card */ 270 - snd_soc_card_byt.dev = &pdev->dev; 216 + snd_soc_card_byt_rt5640.dev = &pdev->dev; 271 217 272 - ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_byt); 218 + ret_val = devm_snd_soc_register_card(&pdev->dev, 219 + &snd_soc_card_byt_rt5640); 273 220 if (ret_val) { 274 - dev_err(&pdev->dev, "devm_snd_soc_register_card failed %d\n", ret_val); 221 + dev_err(&pdev->dev, "devm_snd_soc_register_card failed %d\n", 222 + ret_val); 275 223 return ret_val; 276 224 } 277 - platform_set_drvdata(pdev, &snd_soc_card_byt); 225 + platform_set_drvdata(pdev, &snd_soc_card_byt_rt5640); 278 226 return ret_val; 279 227 } 280 228 281 - static struct platform_driver snd_byt_mc_driver = { 229 + static struct platform_driver snd_byt_rt5640_mc_driver = { 282 230 .driver = { 283 - .name = "bytt100_rt5640", 231 + .name = "bytcr_rt5640", 284 232 .pm = &snd_soc_pm_ops, 285 233 }, 286 - .probe = snd_byt_mc_probe, 234 + .probe = snd_byt_rt5640_mc_probe, 287 235 }; 288 236 289 - module_platform_driver(snd_byt_mc_driver); 237 + module_platform_driver(snd_byt_rt5640_mc_driver); 290 238 291 239 MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver"); 292 240 MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>"); 293 241 MODULE_LICENSE("GPL v2"); 294 - MODULE_ALIAS("platform:bytt100_rt5640"); 242 + MODULE_ALIAS("platform:bytcr_rt5640");