Blame view
sound/soc/cirrus/snappercl15.c
3.14 KB
2874c5fd2 treewide: Replace... |
1 |
// SPDX-License-Identifier: GPL-2.0-or-later |
315f7da63 ASoC: EP93xx: Add... |
2 3 4 5 |
/* * snappercl15.c -- SoC audio for Bluewater Systems Snapper CL15 module * * Copyright (C) 2008 Bluewater Systems Ltd |
1c5454eed Change Ryan Mallo... |
6 |
* Author: Ryan Mallon |
315f7da63 ASoC: EP93xx: Add... |
7 8 9 |
*/ #include <linux/platform_device.h> |
da155d5b4 sound: Add module... |
10 |
#include <linux/module.h> |
67e38f578 ARM: ep93xx: move... |
11 |
#include <linux/soc/cirrus/ep93xx.h> |
315f7da63 ASoC: EP93xx: Add... |
12 13 14 |
#include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> |
315f7da63 ASoC: EP93xx: Add... |
15 16 |
#include <asm/mach-types.h> |
315f7da63 ASoC: EP93xx: Add... |
17 18 |
#include "../codecs/tlv320aic23.h" |
315f7da63 ASoC: EP93xx: Add... |
19 20 21 22 23 24 |
#define CODEC_CLOCK 5644800 static int snappercl15_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { |
d42df9400 ASoC: cirrus: use... |
25 |
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
07c497a62 ASoC: cirrus: use... |
26 27 |
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
315f7da63 ASoC: EP93xx: Add... |
28 |
int err; |
315f7da63 ASoC: EP93xx: Add... |
29 30 31 32 33 34 35 36 37 38 39 40 |
err = snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK, SND_SOC_CLOCK_IN); if (err) return err; err = snd_soc_dai_set_sysclk(cpu_dai, 0, CODEC_CLOCK, SND_SOC_CLOCK_OUT); if (err) return err; return 0; } |
7f8159ace ASoC: cirrus: mak... |
41 |
static const struct snd_soc_ops snappercl15_ops = { |
315f7da63 ASoC: EP93xx: Add... |
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
.hw_params = snappercl15_hw_params, }; static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_LINE("Line In", NULL), SND_SOC_DAPM_MIC("Mic Jack", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { {"Headphone Jack", NULL, "LHPOUT"}, {"Headphone Jack", NULL, "RHPOUT"}, {"LLINEIN", NULL, "Line In"}, {"RLINEIN", NULL, "Line In"}, {"MICIN", NULL, "Mic Jack"}, }; |
40989980b ASoC: cirrus: sna... |
60 61 62 63 64 |
SND_SOC_DAILINK_DEFS(aic23, DAILINK_COMP_ARRAY(COMP_CPU("ep93xx-i2s")), DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic23-codec.0-001a", "tlv320aic23-hifi")), DAILINK_COMP_ARRAY(COMP_PLATFORM("ep93xx-i2s"))); |
315f7da63 ASoC: EP93xx: Add... |
65 66 67 |
static struct snd_soc_dai_link snappercl15_dai = { .name = "tlv320aic23", .stream_name = "AIC23", |
2d534113b ASoC: cirrus: i2s... |
68 |
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
f49f85108 ASoC: Use dai_fmt... |
69 |
SND_SOC_DAIFMT_CBS_CFS, |
315f7da63 ASoC: EP93xx: Add... |
70 |
.ops = &snappercl15_ops, |
40989980b ASoC: cirrus: sna... |
71 |
SND_SOC_DAILINK_REG(aic23), |
315f7da63 ASoC: EP93xx: Add... |
72 73 74 75 |
}; static struct snd_soc_card snd_soc_snappercl15 = { .name = "Snapper CL15", |
a76a70232 ASoC: ep93xx: Add... |
76 |
.owner = THIS_MODULE, |
315f7da63 ASoC: EP93xx: Add... |
77 78 |
.dai_link = &snappercl15_dai, .num_links = 1, |
7b2655b40 ASoC: snappercl15... |
79 80 81 82 83 |
.dapm_widgets = tlv320aic23_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(tlv320aic23_dapm_widgets), .dapm_routes = audio_map, .num_dapm_routes = ARRAY_SIZE(audio_map), |
315f7da63 ASoC: EP93xx: Add... |
84 |
}; |
145e28795 ASoC: cirrus: rem... |
85 |
static int snappercl15_probe(struct platform_device *pdev) |
315f7da63 ASoC: EP93xx: Add... |
86 |
{ |
62e4f7d13 ASoC: snappercl15... |
87 |
struct snd_soc_card *card = &snd_soc_snappercl15; |
315f7da63 ASoC: EP93xx: Add... |
88 |
int ret; |
44fb864b8 ep93xx: Don't use... |
89 |
ret = ep93xx_i2s_acquire(); |
315f7da63 ASoC: EP93xx: Add... |
90 91 |
if (ret) return ret; |
62e4f7d13 ASoC: snappercl15... |
92 93 94 95 96 97 98 99 100 |
card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d ", ret); ep93xx_i2s_release(); } |
315f7da63 ASoC: EP93xx: Add... |
101 102 103 |
return ret; } |
145e28795 ASoC: cirrus: rem... |
104 |
static int snappercl15_remove(struct platform_device *pdev) |
315f7da63 ASoC: EP93xx: Add... |
105 |
{ |
62e4f7d13 ASoC: snappercl15... |
106 107 108 |
struct snd_soc_card *card = platform_get_drvdata(pdev); snd_soc_unregister_card(card); |
315f7da63 ASoC: EP93xx: Add... |
109 |
ep93xx_i2s_release(); |
62e4f7d13 ASoC: snappercl15... |
110 111 112 113 114 115 116 |
return 0; } static struct platform_driver snappercl15_driver = { .driver = { .name = "snappercl15-audio", |
62e4f7d13 ASoC: snappercl15... |
117 118 |
}, .probe = snappercl15_probe, |
145e28795 ASoC: cirrus: rem... |
119 |
.remove = snappercl15_remove, |
62e4f7d13 ASoC: snappercl15... |
120 |
}; |
ee18f6314 ASoC: Convert ep9... |
121 |
module_platform_driver(snappercl15_driver); |
315f7da63 ASoC: EP93xx: Add... |
122 |
|
1c5454eed Change Ryan Mallo... |
123 |
MODULE_AUTHOR("Ryan Mallon"); |
315f7da63 ASoC: EP93xx: Add... |
124 125 |
MODULE_DESCRIPTION("ALSA SoC Snapper CL15"); MODULE_LICENSE("GPL"); |
62e4f7d13 ASoC: snappercl15... |
126 |
MODULE_ALIAS("platform:snappercl15-audio"); |