Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1734043
| Path | csiph.com!news.redatomik.org!weretis.net!feeder4.news.weretis.net!newsfeed.CARNet.hr!news.spin.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Jeffy Chen <jeffy.chen@rock-chips.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v11 2/2] ASoC: rockchip: Use bus_type to distinguish rt5514 dsp from rt5514 codec |
| Date | Mon, 18 Sep 2017 13:20:02 +0200 |
| Message-ID | <ur2fM-5C2-3@gated-at.bofh.it> (permalink) |
| References | <ur2fM-5C2-5@gated-at.bofh.it> |
| X-263anti-Spam | KSV:0; |
| X-Mail-Delivery | 1 |
| X-Abs-Checked | 4 |
| X-Rl-Sender | jeffy.chen@rock-chips.com |
| X-Fst-To | linux-kernel@vger.kernel.org |
| X-Sender-IP | 58.22.7.114 |
| X-Login-Name | jeffy.chen@rock-chips.com |
| X-Unique-Tag | <897d1d29e84c62a410aefa4fa91a155b> |
| X-Sender | cjf@rock-chips.com |
| X-Mailer | git-send-email 2.11.0 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 101 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | briannorris@chromium.org, broonie@kernel.org, mka@chromium.org, dianders@chromium.org, Jeffy Chen <jeffy.chen@rock-chips.com>, Jaroslav Kysela <perex@perex.cz>, alsa-devel@alsa-project.org, linux-rockchip@lists.infradead.org, Takashi Iwai <tiwai@suse.com>, Liam Girdwood <lgirdwood@gmail.com>, linux-arm-kernel@lists.infradead.org |
| X-Original-Date | Mon, 18 Sep 2017 19:14:35 +0800 |
| X-Original-Message-ID | <20170918111435.11411-2-jeffy.chen@rock-chips.com> |
| X-Original-References | <20170918111435.11411-1-jeffy.chen@rock-chips.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1734043 |
Show key headers only | View raw
Currently rt5514 dsp and rt5514 codec are sharing the same compatible.
Use bus_type to distinguish rt5514 dsp from rt5514 codec.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
Changes in v11: None
Changes in v10: None
Changes in v9: None
sound/soc/rockchip/rk3399_gru_sound.c | 57 +++++++++++++++++++++++++++--------
1 file changed, 45 insertions(+), 12 deletions(-)
diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c
index 0513fe480353..f8028f1f3266 100644
--- a/sound/soc/rockchip/rk3399_gru_sound.c
+++ b/sound/soc/rockchip/rk3399_gru_sound.c
@@ -23,6 +23,7 @@
#include <linux/of_gpio.h>
#include <linux/delay.h>
#include <linux/spi/spi.h>
+#include <linux/i2c.h>
#include <linux/input.h>
#include <sound/core.h>
#include <sound/jack.h>
@@ -329,15 +330,6 @@ enum {
DAILINK_RT5514_DSP,
};
-static const char * const dailink_compat[] = {
- [DAILINK_CDNDP] = "rockchip,rk3399-cdn-dp",
- [DAILINK_DA7219] = "dlg,da7219",
- [DAILINK_DMIC] = "dmic-codec",
- [DAILINK_MAX98357A] = "maxim,max98357a",
- [DAILINK_RT5514] = "realtek,rt5514-i2c",
- [DAILINK_RT5514_DSP] = "realtek,rt5514-spi",
-};
-
static const struct snd_soc_dai_link rockchip_dais[] = {
[DAILINK_CDNDP] = {
.name = "DP",
@@ -391,13 +383,54 @@ static const struct snd_soc_dai_link rockchip_dais[] = {
},
};
+struct dailink_match_data {
+ const char *compatible;
+ struct bus_type *bus_type;
+};
+
+static const struct dailink_match_data dailink_match[] = {
+ [DAILINK_CDNDP] = {
+ .compatible = "rockchip,rk3399-cdn-dp",
+ },
+ [DAILINK_DA7219] = {
+ .compatible = "dlg,da7219",
+ },
+ [DAILINK_DMIC] = {
+ .compatible = "dmic-codec",
+ },
+ [DAILINK_MAX98357A] = {
+ .compatible = "maxim,max98357a",
+ },
+ [DAILINK_RT5514] = {
+ .compatible = "realtek,rt5514",
+ .bus_type = &i2c_bus_type,
+ },
+ [DAILINK_RT5514_DSP] = {
+ .compatible = "realtek,rt5514",
+ .bus_type = &spi_bus_type,
+ },
+};
+
+static int of_dev_node_match(struct device *dev, void *data)
+{
+ return dev->of_node == data;
+}
+
static int rockchip_sound_codec_node_match(struct device_node *np_codec)
{
int i;
- for (i = 0; i < ARRAY_SIZE(dailink_compat); i++) {
- if (of_device_is_compatible(np_codec, dailink_compat[i]))
- return i;
+ for (i = 0; i < ARRAY_SIZE(dailink_match); i++) {
+ if (!of_device_is_compatible(np_codec,
+ dailink_match[i].compatible))
+ continue;
+
+ if (dailink_match[i].bus_type
+ && !bus_find_device(dailink_match[i].bus_type,
+ NULL, np_codec, of_dev_node_match))
+ continue;
+
+ return i;
}
return -1;
}
--
2.11.0
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v11 2/2] ASoC: rockchip: Use bus_type to distinguish rt5514 dsp from rt5514 codec Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-09-18 13:20 +0200
Re: [PATCH v11 2/2] ASoC: rockchip: Use bus_type to distinguish rt5514 dsp from rt5514 codec Matthias Kaehlcke <mka@chromium.org> - 2017-09-18 21:20 +0200
Re: [PATCH v11 2/2] ASoC: rockchip: Use bus_type to distinguish rt5514 dsp from rt5514 codec jeffy <jeffy.chen@rock-chips.com> - 2017-09-19 05:20 +0200
csiph-web