| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * This is a simple driver for the GTM601 Voice PCM interface |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Author: Marek Belisko <marek@goldelico.com> |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * Based on wm8727.c driver |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 12 | | - * published by the Free Software Foundation. |
|---|
| 13 | 10 | */ |
|---|
| 14 | 11 | |
|---|
| 15 | 12 | #include <linux/init.h> |
|---|
| 16 | 13 | #include <linux/slab.h> |
|---|
| 17 | 14 | #include <linux/module.h> |
|---|
| 18 | 15 | #include <linux/kernel.h> |
|---|
| 19 | | -#include <linux/device.h> |
|---|
| 16 | +#include <linux/of_device.h> |
|---|
| 20 | 17 | #include <sound/core.h> |
|---|
| 21 | 18 | #include <sound/pcm.h> |
|---|
| 22 | 19 | #include <sound/initval.h> |
|---|
| .. | .. |
|---|
| 50 | 47 | }, |
|---|
| 51 | 48 | }; |
|---|
| 52 | 49 | |
|---|
| 50 | +static struct snd_soc_dai_driver bm818_dai = { |
|---|
| 51 | + .name = "bm818", |
|---|
| 52 | + .playback = { |
|---|
| 53 | + .stream_name = "Playback", |
|---|
| 54 | + .channels_min = 2, |
|---|
| 55 | + .channels_max = 2, |
|---|
| 56 | + .rates = SNDRV_PCM_RATE_48000, |
|---|
| 57 | + .formats = SNDRV_PCM_FMTBIT_S16_LE, |
|---|
| 58 | + }, |
|---|
| 59 | + .capture = { |
|---|
| 60 | + .stream_name = "Capture", |
|---|
| 61 | + .channels_min = 2, |
|---|
| 62 | + .channels_max = 2, |
|---|
| 63 | + .rates = SNDRV_PCM_RATE_48000, |
|---|
| 64 | + .formats = SNDRV_PCM_FMTBIT_S16_LE, |
|---|
| 65 | + }, |
|---|
| 66 | +}; |
|---|
| 67 | + |
|---|
| 53 | 68 | static const struct snd_soc_component_driver soc_component_dev_gtm601 = { |
|---|
| 54 | 69 | .dapm_widgets = gtm601_dapm_widgets, |
|---|
| 55 | 70 | .num_dapm_widgets = ARRAY_SIZE(gtm601_dapm_widgets), |
|---|
| .. | .. |
|---|
| 63 | 78 | |
|---|
| 64 | 79 | static int gtm601_platform_probe(struct platform_device *pdev) |
|---|
| 65 | 80 | { |
|---|
| 81 | + const struct snd_soc_dai_driver *dai_driver; |
|---|
| 82 | + |
|---|
| 83 | + dai_driver = of_device_get_match_data(&pdev->dev); |
|---|
| 84 | + |
|---|
| 66 | 85 | return devm_snd_soc_register_component(&pdev->dev, |
|---|
| 67 | | - &soc_component_dev_gtm601, >m601_dai, 1); |
|---|
| 86 | + &soc_component_dev_gtm601, |
|---|
| 87 | + (struct snd_soc_dai_driver *)dai_driver, 1); |
|---|
| 68 | 88 | } |
|---|
| 69 | 89 | |
|---|
| 70 | | -#if defined(CONFIG_OF) |
|---|
| 71 | 90 | static const struct of_device_id gtm601_codec_of_match[] = { |
|---|
| 72 | | - { .compatible = "option,gtm601", }, |
|---|
| 91 | + { .compatible = "option,gtm601", .data = (void *)>m601_dai }, |
|---|
| 92 | + { .compatible = "broadmobi,bm818", .data = (void *)&bm818_dai }, |
|---|
| 73 | 93 | {}, |
|---|
| 74 | 94 | }; |
|---|
| 75 | 95 | MODULE_DEVICE_TABLE(of, gtm601_codec_of_match); |
|---|
| 76 | | -#endif |
|---|
| 77 | 96 | |
|---|
| 78 | 97 | static struct platform_driver gtm601_codec_driver = { |
|---|
| 79 | 98 | .driver = { |
|---|