mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
asoc: codecs: Add dai driver in rouleur
Add dai driver in rouleur. Changed micbias widget to supply widget. Change-Id: I7ddfe98ac70eab7f622e78758af8467ccf93b8e3 Signed-off-by: Dechen Chai <dchai@codeaurora.org>
This commit is contained in:
parent
b698fda5c7
commit
132677f6a5
2 changed files with 48 additions and 13 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
|
@ -29,8 +29,6 @@
|
|||
#include <linux/power_supply.h>
|
||||
#include "asoc/bolero-slave-internal.h"
|
||||
|
||||
#define DRV_NAME "rouleur_codec"
|
||||
|
||||
#define NUM_SWRS_DT_PARAMS 5
|
||||
|
||||
#define ROULEUR_VERSION_1_0 1
|
||||
|
|
@ -42,6 +40,18 @@
|
|||
|
||||
#define FOUNDRY_ID_SEC 0x5
|
||||
|
||||
#define ROULEUR_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
|
||||
SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
|
||||
SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\
|
||||
SNDRV_PCM_RATE_384000)
|
||||
/* Fractional Rates */
|
||||
#define ROULEUR_FRAC_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_88200 |\
|
||||
SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_352800)
|
||||
|
||||
#define ROULEUR_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
|
||||
SNDRV_PCM_FMTBIT_S24_LE |\
|
||||
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
|
||||
|
||||
enum {
|
||||
CODEC_TX = 0,
|
||||
CODEC_RX,
|
||||
|
|
@ -97,6 +107,29 @@ static struct regmap_irq_chip rouleur_regmap_irq_chip = {
|
|||
.irq_drv_data = NULL,
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_driver rouleur_dai[] = {
|
||||
{
|
||||
.name = "rouleur_cdc",
|
||||
.playback = {
|
||||
.stream_name = "ROULEUR_AIF Playback",
|
||||
.rates = ROULEUR_RATES | ROULEUR_FRAC_RATES,
|
||||
.formats = ROULEUR_FORMATS,
|
||||
.rate_max = 384000,
|
||||
.rate_min = 8000,
|
||||
.channels_min = 1,
|
||||
.channels_max = 2,
|
||||
},
|
||||
.capture = {
|
||||
.stream_name = "ROULEUR_AIF Capture",
|
||||
.rates = ROULEUR_RATES,
|
||||
.formats = ROULEUR_FORMATS,
|
||||
.rate_max = 192000,
|
||||
.rate_min = 8000,
|
||||
.channels_min = 1,
|
||||
.channels_max = 2,
|
||||
},
|
||||
},
|
||||
};
|
||||
static int rouleur_handle_post_irq(void *data)
|
||||
{
|
||||
struct rouleur_priv *rouleur = data;
|
||||
|
|
@ -1764,15 +1797,15 @@ static const struct snd_soc_dapm_widget rouleur_dapm_widgets[] = {
|
|||
SND_SOC_DAPM_POST_PMD),
|
||||
|
||||
/* micbias widgets*/
|
||||
SND_SOC_DAPM_MICBIAS_E("MIC BIAS1", SND_SOC_NOPM, 0, 0,
|
||||
SND_SOC_DAPM_SUPPLY("MIC BIAS1", SND_SOC_NOPM, 0, 0,
|
||||
rouleur_codec_enable_micbias,
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
|
||||
SND_SOC_DAPM_POST_PMD),
|
||||
SND_SOC_DAPM_MICBIAS_E("MIC BIAS2", SND_SOC_NOPM, 0, 0,
|
||||
SND_SOC_DAPM_SUPPLY("MIC BIAS2", SND_SOC_NOPM, 0, 0,
|
||||
rouleur_codec_enable_micbias,
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
|
||||
SND_SOC_DAPM_POST_PMD),
|
||||
SND_SOC_DAPM_MICBIAS_E("MIC BIAS3", SND_SOC_NOPM, 0, 0,
|
||||
SND_SOC_DAPM_SUPPLY("MIC BIAS3", SND_SOC_NOPM, 0, 0,
|
||||
rouleur_codec_enable_micbias,
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
|
||||
SND_SOC_DAPM_POST_PMD),
|
||||
|
|
@ -1842,15 +1875,15 @@ static const struct snd_soc_dapm_widget rouleur_dapm_widgets[] = {
|
|||
SND_SOC_DAPM_OUTPUT("HPHR"),
|
||||
|
||||
/* micbias pull up widgets*/
|
||||
SND_SOC_DAPM_MICBIAS_E("VA MIC BIAS1", SND_SOC_NOPM, 0, 0,
|
||||
SND_SOC_DAPM_SUPPLY("VA MIC BIAS1", SND_SOC_NOPM, 0, 0,
|
||||
rouleur_codec_enable_micbias_pullup,
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
|
||||
SND_SOC_DAPM_POST_PMD),
|
||||
SND_SOC_DAPM_MICBIAS_E("VA MIC BIAS2", SND_SOC_NOPM, 0, 0,
|
||||
SND_SOC_DAPM_SUPPLY("VA MIC BIAS2", SND_SOC_NOPM, 0, 0,
|
||||
rouleur_codec_enable_micbias_pullup,
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
|
||||
SND_SOC_DAPM_POST_PMD),
|
||||
SND_SOC_DAPM_MICBIAS_E("VA MIC BIAS3", SND_SOC_NOPM, 0, 0,
|
||||
SND_SOC_DAPM_SUPPLY("VA MIC BIAS3", SND_SOC_NOPM, 0, 0,
|
||||
rouleur_codec_enable_micbias_pullup,
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
|
||||
SND_SOC_DAPM_POST_PMD),
|
||||
|
|
@ -1977,7 +2010,7 @@ int rouleur_info_create_codec_entry(struct snd_info_entry *codec_root,
|
|||
return 0;
|
||||
}
|
||||
card = component->card;
|
||||
priv->entry = snd_info_create_subdir(codec_root->module,
|
||||
priv->entry = snd_info_create_module_entry(codec_root->module,
|
||||
"rouleur", codec_root);
|
||||
if (!priv->entry) {
|
||||
dev_dbg(component->dev, "%s: failed to create rouleur entry\n",
|
||||
|
|
@ -2271,7 +2304,7 @@ static int rouleur_soc_codec_resume(struct snd_soc_component *component)
|
|||
}
|
||||
|
||||
static const struct snd_soc_component_driver soc_codec_dev_rouleur = {
|
||||
.name = DRV_NAME,
|
||||
.name = ROULEUR_DRV_NAME,
|
||||
.probe = rouleur_soc_codec_probe,
|
||||
.remove = rouleur_soc_codec_remove,
|
||||
.controls = rouleur_snd_controls,
|
||||
|
|
@ -2682,7 +2715,7 @@ static int rouleur_bind(struct device *dev)
|
|||
wcd_disable_irq(&rouleur->irq_info, ROULEUR_IRQ_HPHL_PDM_WD_INT);
|
||||
|
||||
ret = snd_soc_register_component(dev, &soc_codec_dev_rouleur,
|
||||
NULL, 0);
|
||||
rouleur_dai, ARRAY_SIZE(rouleur_dai));
|
||||
if (ret) {
|
||||
dev_err(dev, "%s: Codec registration failed\n",
|
||||
__func__);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _ROULEUR_H
|
||||
#define _ROULEUR_H
|
||||
|
||||
#define ROULEUR_DRV_NAME "rouleur_codec"
|
||||
|
||||
#ifdef CONFIG_SND_SOC_ROULEUR
|
||||
extern int rouleur_info_create_codec_entry(struct snd_info_entry *codec_root,
|
||||
struct snd_soc_component *component);
|
||||
|
|
|
|||
Loading…
Reference in a new issue