Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * wm8727.c
0004  *
0005  *  Created on: 15-Oct-2009
0006  *      Author: neil.jones@imgtec.com
0007  *
0008  * Copyright (C) 2009 Imagination Technologies Ltd.
0009  */
0010 
0011 #include <linux/init.h>
0012 #include <linux/slab.h>
0013 #include <linux/module.h>
0014 #include <linux/kernel.h>
0015 #include <linux/device.h>
0016 #include <sound/core.h>
0017 #include <sound/pcm.h>
0018 #include <sound/initval.h>
0019 #include <sound/soc.h>
0020 
0021 static const struct snd_soc_dapm_widget wm8727_dapm_widgets[] = {
0022 SND_SOC_DAPM_OUTPUT("VOUTL"),
0023 SND_SOC_DAPM_OUTPUT("VOUTR"),
0024 };
0025 
0026 static const struct snd_soc_dapm_route wm8727_dapm_routes[] = {
0027     { "VOUTL", NULL, "Playback" },
0028     { "VOUTR", NULL, "Playback" },
0029 };
0030 
0031 /*
0032  * Note this is a simple chip with no configuration interface, sample rate is
0033  * determined automatically by examining the Master clock and Bit clock ratios
0034  */
0035 #define WM8727_RATES  (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
0036             SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |\
0037             SNDRV_PCM_RATE_192000)
0038 
0039 static struct snd_soc_dai_driver wm8727_dai = {
0040     .name = "wm8727-hifi",
0041     .playback = {
0042         .stream_name = "Playback",
0043         .channels_min = 2,
0044         .channels_max = 2,
0045         .rates = WM8727_RATES,
0046         .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
0047         },
0048 };
0049 
0050 static const struct snd_soc_component_driver soc_component_dev_wm8727 = {
0051     .dapm_widgets       = wm8727_dapm_widgets,
0052     .num_dapm_widgets   = ARRAY_SIZE(wm8727_dapm_widgets),
0053     .dapm_routes        = wm8727_dapm_routes,
0054     .num_dapm_routes    = ARRAY_SIZE(wm8727_dapm_routes),
0055     .idle_bias_on       = 1,
0056     .use_pmdown_time    = 1,
0057     .endianness     = 1,
0058 };
0059 
0060 static int wm8727_probe(struct platform_device *pdev)
0061 {
0062     return devm_snd_soc_register_component(&pdev->dev,
0063             &soc_component_dev_wm8727, &wm8727_dai, 1);
0064 }
0065 
0066 static struct platform_driver wm8727_codec_driver = {
0067     .driver = {
0068             .name = "wm8727",
0069     },
0070 
0071     .probe = wm8727_probe,
0072 };
0073 
0074 module_platform_driver(wm8727_codec_driver);
0075 
0076 MODULE_DESCRIPTION("ASoC wm8727 driver");
0077 MODULE_AUTHOR("Neil Jones");
0078 MODULE_LICENSE("GPL");