root/sound/soc/codecs/gtm601.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. gtm601_platform_probe

   1 // SPDX-License-Identifier: GPL-2.0-only
   2 /*
   3  * This is a simple driver for the GTM601 Voice PCM interface
   4  *
   5  * Copyright (C) 2015 Goldelico GmbH
   6  *
   7  * Author: Marek Belisko <marek@goldelico.com>
   8  *
   9  * Based on wm8727.c driver
  10  */
  11 
  12 #include <linux/init.h>
  13 #include <linux/slab.h>
  14 #include <linux/module.h>
  15 #include <linux/kernel.h>
  16 #include <linux/device.h>
  17 #include <sound/core.h>
  18 #include <sound/pcm.h>
  19 #include <sound/initval.h>
  20 #include <sound/soc.h>
  21 
  22 static const struct snd_soc_dapm_widget gtm601_dapm_widgets[] = {
  23         SND_SOC_DAPM_OUTPUT("AOUT"),
  24         SND_SOC_DAPM_INPUT("AIN"),
  25 };
  26 
  27 static const struct snd_soc_dapm_route gtm601_dapm_routes[] = {
  28         { "AOUT", NULL, "Playback" },
  29         { "Capture", NULL, "AIN" },
  30 };
  31 
  32 static struct snd_soc_dai_driver gtm601_dai = {
  33         .name = "gtm601",
  34         .playback = {
  35                 .stream_name = "Playback",
  36                 .channels_min = 1,
  37                 .channels_max = 1,
  38                 .rates = SNDRV_PCM_RATE_8000,
  39                 .formats = SNDRV_PCM_FMTBIT_S16_LE,
  40                 },
  41         .capture = {
  42                 .stream_name = "Capture",
  43                 .channels_min = 1,
  44                 .channels_max = 1,
  45                 .rates = SNDRV_PCM_RATE_8000,
  46                 .formats = SNDRV_PCM_FMTBIT_S16_LE,
  47         },
  48 };
  49 
  50 static const struct snd_soc_component_driver soc_component_dev_gtm601 = {
  51         .dapm_widgets           = gtm601_dapm_widgets,
  52         .num_dapm_widgets       = ARRAY_SIZE(gtm601_dapm_widgets),
  53         .dapm_routes            = gtm601_dapm_routes,
  54         .num_dapm_routes        = ARRAY_SIZE(gtm601_dapm_routes),
  55         .idle_bias_on           = 1,
  56         .use_pmdown_time        = 1,
  57         .endianness             = 1,
  58         .non_legacy_dai_naming  = 1,
  59 };
  60 
  61 static int gtm601_platform_probe(struct platform_device *pdev)
  62 {
  63         return devm_snd_soc_register_component(&pdev->dev,
  64                         &soc_component_dev_gtm601, &gtm601_dai, 1);
  65 }
  66 
  67 #if defined(CONFIG_OF)
  68 static const struct of_device_id gtm601_codec_of_match[] = {
  69         { .compatible = "option,gtm601", },
  70         {},
  71 };
  72 MODULE_DEVICE_TABLE(of, gtm601_codec_of_match);
  73 #endif
  74 
  75 static struct platform_driver gtm601_codec_driver = {
  76         .driver = {
  77                 .name = "gtm601",
  78                 .of_match_table = of_match_ptr(gtm601_codec_of_match),
  79         },
  80         .probe = gtm601_platform_probe,
  81 };
  82 
  83 module_platform_driver(gtm601_codec_driver);
  84 
  85 MODULE_DESCRIPTION("ASoC gtm601 driver");
  86 MODULE_AUTHOR("Marek Belisko <marek@goldelico.com>");
  87 MODULE_LICENSE("GPL");
  88 MODULE_ALIAS("platform:gtm601");

/* [<][>][^][v][top][bottom][index][help] */