bt-sco.c 2.3 KB
Newer Older
1
/*
2
 * Driver for generic Bluetooth SCO link
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
 * Copyright 2011 Lars-Peter Clausen <lars@metafoo.de>
 *
 *  This program is free software; you can redistribute  it and/or modify it
 *  under  the terms of  the GNU General  Public License as published by the
 *  Free Software Foundation;  either version 2 of the  License, or (at your
 *  option) any later version.
 *
 */

#include <linux/init.h>
#include <linux/module.h>
#include <linux/platform_device.h>

#include <sound/soc.h>

18 19 20 21 22 23 24 25 26 27
static const struct snd_soc_dapm_widget bt_sco_widgets[] = {
	SND_SOC_DAPM_INPUT("RX"),
	SND_SOC_DAPM_OUTPUT("TX"),
};

static const struct snd_soc_dapm_route bt_sco_routes[] = {
	{ "Capture", NULL, "RX" },
	{ "TX", NULL, "Playback" },
};

28 29
static struct snd_soc_dai_driver bt_sco_dai = {
	.name = "bt-sco-pcm",
30
	.playback = {
31
		.stream_name = "Playback",
32 33 34 35 36 37
		.channels_min = 1,
		.channels_max = 1,
		.rates = SNDRV_PCM_RATE_8000,
		.formats = SNDRV_PCM_FMTBIT_S16_LE,
	},
	.capture = {
38
		 .stream_name = "Capture",
39 40 41 42 43 44 45
		.channels_min = 1,
		.channels_max = 1,
		.rates = SNDRV_PCM_RATE_8000,
		.formats = SNDRV_PCM_FMTBIT_S16_LE,
	},
};

46 47 48 49 50 51
static struct snd_soc_codec_driver soc_codec_dev_bt_sco = {
	.dapm_widgets = bt_sco_widgets,
	.num_dapm_widgets = ARRAY_SIZE(bt_sco_widgets),
	.dapm_routes = bt_sco_routes,
	.num_dapm_routes = ARRAY_SIZE(bt_sco_routes),
};
52

53
static int bt_sco_probe(struct platform_device *pdev)
54
{
55 56
	return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_bt_sco,
			&bt_sco_dai, 1);
57 58
}

59
static int bt_sco_remove(struct platform_device *pdev)
60 61 62 63 64 65
{
	snd_soc_unregister_codec(&pdev->dev);

	return 0;
}

66
static const struct platform_device_id bt_sco_driver_ids[] = {
67 68 69
	{
		.name		= "dfbmcs320",
	},
70 71 72
	{
		.name		= "bt-sco",
	},
73 74 75 76
	{},
};
MODULE_DEVICE_TABLE(platform, bt_sco_driver_ids);

77 78 79 80 81 82 83 84
#if defined(CONFIG_OF)
static const struct of_device_id bt_sco_codec_of_match[] = {
	{ .compatible = "delta,dfbmcs320", },
	{},
};
MODULE_DEVICE_TABLE(of, bt_sco_codec_of_match);
#endif

85
static struct platform_driver bt_sco_driver = {
86
	.driver = {
87
		.name = "bt-sco",
88
		.of_match_table = of_match_ptr(bt_sco_codec_of_match),
89
	},
90 91 92
	.probe = bt_sco_probe,
	.remove = bt_sco_remove,
	.id_table = bt_sco_driver_ids,
93 94
};

95
module_platform_driver(bt_sco_driver);
96 97

MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
M
Masanari Iida 已提交
98
MODULE_DESCRIPTION("ASoC generic bluetooth sco link driver");
99
MODULE_LICENSE("GPL");