linux/sound/soc/fsl/fsl_micfil.c

// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
// Copyright 2018 NXP

#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/kobject.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include <linux/dma/imx-dma.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include <sound/core.h>

#include "fsl_micfil.h"
#include "fsl_utils.h"

#define MICFIL_OSR_DEFAULT

enum quality {};

struct fsl_micfil {};

struct fsl_micfil_soc_data {};

static struct fsl_micfil_soc_data fsl_micfil_imx8mm =;

static struct fsl_micfil_soc_data fsl_micfil_imx8mp =;

static struct fsl_micfil_soc_data fsl_micfil_imx93 =;

static const struct of_device_id fsl_micfil_dt_ids[] =;
MODULE_DEVICE_TABLE(of, fsl_micfil_dt_ids);

static const char * const micfil_quality_select_texts[] =;

static const struct soc_enum fsl_micfil_quality_enum =;

static DECLARE_TLV_DB_SCALE(gain_tlv, 0, 100, 0);

static int micfil_set_quality(struct fsl_micfil *micfil)
{}

static int micfil_quality_get(struct snd_kcontrol *kcontrol,
			      struct snd_ctl_elem_value *ucontrol)
{}

static int micfil_quality_set(struct snd_kcontrol *kcontrol,
			      struct snd_ctl_elem_value *ucontrol)
{}

static const char * const micfil_hwvad_enable[] =;

static const char * const micfil_hwvad_init_mode[] =;

static const char * const micfil_hwvad_hpf_texts[] =;

/*
 * DC Remover Control
 * Filter Bypassed	1 1
 * Cut-off @21Hz	0 0
 * Cut-off @83Hz	0 1
 * Cut-off @152HZ	1 0
 */
static const char * const micfil_dc_remover_texts[] =;

static const struct soc_enum hwvad_enable_enum =;
static const struct soc_enum hwvad_init_mode_enum =;
static const struct soc_enum hwvad_hpf_enum =;
static const struct soc_enum fsl_micfil_dc_remover_enum =;

static int micfil_put_dc_remover_state(struct snd_kcontrol *kcontrol,
				       struct snd_ctl_elem_value *ucontrol)
{}

static int micfil_get_dc_remover_state(struct snd_kcontrol *kcontrol,
				       struct snd_ctl_elem_value *ucontrol)
{}

static int hwvad_put_enable(struct snd_kcontrol *kcontrol,
			    struct snd_ctl_elem_value *ucontrol)
{}

static int hwvad_get_enable(struct snd_kcontrol *kcontrol,
			    struct snd_ctl_elem_value *ucontrol)
{}

static int hwvad_put_init_mode(struct snd_kcontrol *kcontrol,
			       struct snd_ctl_elem_value *ucontrol)
{}

static int hwvad_get_init_mode(struct snd_kcontrol *kcontrol,
			       struct snd_ctl_elem_value *ucontrol)
{}

static int hwvad_detected(struct snd_kcontrol *kcontrol,
			  struct snd_ctl_elem_value *ucontrol)
{}

static const struct snd_kcontrol_new fsl_micfil_snd_controls[] =;

static int fsl_micfil_use_verid(struct device *dev)
{}

/* The SRES is a self-negated bit which provides the CPU with the
 * capability to initialize the PDM Interface module through the
 * slave-bus interface. This bit always reads as zero, and this
 * bit is only effective when MDIS is cleared
 */
static int fsl_micfil_reset(struct device *dev)
{}

static int fsl_micfil_startup(struct snd_pcm_substream *substream,
			      struct snd_soc_dai *dai)
{}

/* Enable/disable hwvad interrupts */
static int fsl_micfil_configure_hwvad_interrupts(struct fsl_micfil *micfil, int enable)
{}

/* Configuration done only in energy-based initialization mode */
static int fsl_micfil_init_hwvad_energy_mode(struct fsl_micfil *micfil)
{}

/* Configuration done only in envelope-based initialization mode */
static int fsl_micfil_init_hwvad_envelope_mode(struct fsl_micfil *micfil)
{}

/*
 * Hardware Voice Active Detection: The HWVAD takes data from the input
 * of a selected PDM microphone to detect if there is any
 * voice activity. When a voice activity is detected, an interrupt could
 * be delivered to the system. Initialization in section 8.4:
 * Can work in two modes:
 *  -> Eneveope-based mode (section 8.4.1)
 *  -> Energy-based mode (section 8.4.2)
 *
 * It is important to remark that the HWVAD detector could be enabled
 * or reset only when the MICFIL isn't running i.e. when the BSY_FIL
 * bit in STAT register is cleared
 */
static int fsl_micfil_hwvad_enable(struct fsl_micfil *micfil)
{}

static int fsl_micfil_hwvad_disable(struct fsl_micfil *micfil)
{}

static int fsl_micfil_trigger(struct snd_pcm_substream *substream, int cmd,
			      struct snd_soc_dai *dai)
{}

static int fsl_micfil_reparent_rootclk(struct fsl_micfil *micfil, unsigned int sample_rate)
{}

static int fsl_micfil_hw_params(struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *params,
				struct snd_soc_dai *dai)
{}

static int fsl_micfil_dai_probe(struct snd_soc_dai *cpu_dai)
{}

static const struct snd_soc_dai_ops fsl_micfil_dai_ops =;

static struct snd_soc_dai_driver fsl_micfil_dai =;

static const struct snd_soc_component_driver fsl_micfil_component =;

/* REGMAP */
static const struct reg_default fsl_micfil_reg_defaults[] =;

static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg)
{}

static bool fsl_micfil_writeable_reg(struct device *dev, unsigned int reg)
{}

static bool fsl_micfil_volatile_reg(struct device *dev, unsigned int reg)
{}

static const struct regmap_config fsl_micfil_regmap_config =;

/* END OF REGMAP */

static irqreturn_t micfil_isr(int irq, void *devid)
{}

static irqreturn_t micfil_err_isr(int irq, void *devid)
{}

static irqreturn_t voice_detected_fn(int irq, void *devid)
{}

static irqreturn_t hwvad_isr(int irq, void *devid)
{}

static irqreturn_t hwvad_err_isr(int irq, void *devid)
{}

static int fsl_micfil_runtime_suspend(struct device *dev);
static int fsl_micfil_runtime_resume(struct device *dev);

static int fsl_micfil_probe(struct platform_device *pdev)
{}

static void fsl_micfil_remove(struct platform_device *pdev)
{}

static int fsl_micfil_runtime_suspend(struct device *dev)
{}

static int fsl_micfil_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops fsl_micfil_pm_ops =;

static struct platform_driver fsl_micfil_driver =;
module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();