Merge "ASoC: wcd938x: add support to retrieve codec variant"

This commit is contained in:
qctecmdr
2019-08-25 03:20:21 -07:00
committed by Gerrit - the friendly Code Review server
2 changed files with 36 additions and 6 deletions

View File

@@ -23,6 +23,7 @@
#include "internal.h" #include "internal.h"
#include "wcd938x-registers.h" #include "wcd938x-registers.h"
#include "wcd938x.h"
#define WCD938X_DRV_NAME "wcd938x_codec" #define WCD938X_DRV_NAME "wcd938x_codec"
#define NUM_SWRS_DT_PARAMS 5 #define NUM_SWRS_DT_PARAMS 5
@@ -39,11 +40,6 @@
#define ADC_MODE_VAL_ULP1 0x09 #define ADC_MODE_VAL_ULP1 0x09
#define ADC_MODE_VAL_ULP2 0x0B #define ADC_MODE_VAL_ULP2 0x0B
enum {
WCD9380 = 0,
WCD9385 = 5,
};
enum { enum {
CODEC_TX = 0, CODEC_TX = 0,
CODEC_RX, CODEC_RX,
@@ -2680,6 +2676,30 @@ static struct snd_info_entry_ops wcd938x_variant_ops = {
.read = wcd938x_variant_read, .read = wcd938x_variant_read,
}; };
/*
* wcd938x_get_codec_variant
* @component: component instance
*
* Return: codec variant or -EINVAL in error.
*/
int wcd938x_get_codec_variant(struct snd_soc_component *component)
{
struct wcd938x_priv *priv = NULL;
if (!component)
return -EINVAL;
priv = snd_soc_component_get_drvdata(component);
if (!priv) {
dev_err(component->dev,
"%s:wcd938x not probed\n", __func__);
return 0;
}
return priv->variant;
}
EXPORT_SYMBOL(wcd938x_get_codec_variant);
/* /*
* wcd938x_info_create_codec_entry - creates wcd938x module * wcd938x_info_create_codec_entry - creates wcd938x module
* @codec_root: The parent directory * @codec_root: The parent directory

View File

@@ -1,19 +1,29 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* /*
* Copyright (c) 2018, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
*/ */
#ifndef _WCD938X_H #ifndef _WCD938X_H
#define _WCD938X_H #define _WCD938X_H
enum {
WCD9380 = 0,
WCD9385 = 5,
};
#ifdef CONFIG_SND_SOC_WCD938X #ifdef CONFIG_SND_SOC_WCD938X
extern int wcd938x_info_create_codec_entry(struct snd_info_entry *codec_root, extern int wcd938x_info_create_codec_entry(struct snd_info_entry *codec_root,
struct snd_soc_component *component); struct snd_soc_component *component);
extern int wcd938x_get_codec_variant(struct snd_soc_component *component);
#else #else
extern int wcd938x_info_create_codec_entry(struct snd_info_entry *codec_root, extern int wcd938x_info_create_codec_entry(struct snd_info_entry *codec_root,
struct snd_soc_component *component) struct snd_soc_component *component)
{ {
return 0; return 0;
} }
extern int wcd938x_get_codec_variant(struct snd_soc_component *component)
{
return 0;
}
#endif /* CONFIG_SND_SOC_WCD938X */ #endif /* CONFIG_SND_SOC_WCD938X */
#endif /* _WCD938X_H */ #endif /* _WCD938X_H */