linux/sound/soc/codecs/wcd937x.c

// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.

#include <linux/component.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_gpio.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <sound/jack.h>
#include <sound/pcm_params.h>
#include <sound/pcm.h>
#include <sound/soc-dapm.h>
#include <sound/soc.h>
#include <sound/tlv.h>

#include "wcd-clsh-v2.h"
#include "wcd-mbhc-v2.h"
#include "wcd937x.h"

enum {};

/* Z value defined in milliohm */
#define WCD937X_ZDET_VAL_32
#define WCD937X_ZDET_VAL_400
#define WCD937X_ZDET_VAL_1200
#define WCD937X_ZDET_VAL_100K
/* Z floating defined in ohms */
#define WCD937X_ZDET_FLOATING_IMPEDANCE
#define WCD937X_ZDET_NUM_MEASUREMENTS
#define WCD937X_MBHC_GET_C1(c)
#define WCD937X_MBHC_GET_X1(x)
/* Z value compared in milliOhm */
#define WCD937X_MBHC_IS_SECOND_RAMP_REQUIRED(z)
#define WCD937X_MBHC_ZDET_CONST
#define WCD937X_MBHC_MOISTURE_RREF
#define WCD_MBHC_HS_V_MAX
#define EAR_RX_PATH_AUX
#define WCD937X_MBHC_MAX_BUTTONS

#define WCD937X_RATES

/* Fractional Rates */
#define WCD937X_FRAC_RATES

#define WCD937X_FORMATS

enum {};

enum {};

struct wcd937x_priv {};

static const SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(ear_pa_gain, 600, -1800);
static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1);
static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1);

struct wcd937x_mbhc_zdet_param {};

static const struct wcd_mbhc_field wcd_mbhc_fields[WCD_MBHC_REG_FUNC_MAX] =;

static const struct regmap_irq wcd937x_irqs[WCD937X_NUM_IRQS] =;

static int wcd937x_handle_post_irq(void *data)
{}

static const u32 wcd937x_config_regs[] =;

static const struct regmap_irq_chip wcd937x_regmap_irq_chip =;

static void wcd937x_reset(struct wcd937x_priv *wcd937x)
{}

static void wcd937x_io_init(struct regmap *regmap)
{}

static int wcd937x_rx_clk_enable(struct snd_soc_component *component)
{}

static int wcd937x_rx_clk_disable(struct snd_soc_component *component)
{}

static int wcd937x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
					struct snd_kcontrol *kcontrol,
					int event)
{}

static int wcd937x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
					struct snd_kcontrol *kcontrol,
					int event)
{}

static int wcd937x_codec_ear_dac_event(struct snd_soc_dapm_widget *w,
				       struct snd_kcontrol *kcontrol,
				       int event)
{}

static int wcd937x_codec_aux_dac_event(struct snd_soc_dapm_widget *w,
				       struct snd_kcontrol *kcontrol,
				       int event)
{}

static int wcd937x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
					struct snd_kcontrol *kcontrol,
					int event)
{}

static int wcd937x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
					struct snd_kcontrol *kcontrol,
					int event)
{}

static int wcd937x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
				       struct snd_kcontrol *kcontrol,
				       int event)
{}

static int wcd937x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
				       struct snd_kcontrol *kcontrol,
				       int event)
{}

static int wcd937x_enable_rx1(struct snd_soc_dapm_widget *w,
			      struct snd_kcontrol *kcontrol,
			      int event)
{}

static int wcd937x_enable_rx2(struct snd_soc_dapm_widget *w,
			      struct snd_kcontrol *kcontrol, int event)
{}

static int wcd937x_enable_rx3(struct snd_soc_dapm_widget *w,
			      struct snd_kcontrol *kcontrol,
			      int event)
{}

static int wcd937x_get_micb_vout_ctl_val(u32 micb_mv)
{}

static int wcd937x_tx_swr_ctrl(struct snd_soc_dapm_widget *w,
			       struct snd_kcontrol *kcontrol, int event)
{}

static int wcd937x_codec_enable_adc(struct snd_soc_dapm_widget *w,
				    struct snd_kcontrol *kcontrol, int event)
{}

static int wcd937x_enable_req(struct snd_soc_dapm_widget *w,
			      struct snd_kcontrol *kcontrol, int event)
{}

static int wcd937x_codec_enable_dmic(struct snd_soc_dapm_widget *w,
				     struct snd_kcontrol *kcontrol,
				     int event)
{}

static int wcd937x_micbias_control(struct snd_soc_component *component,
				   int micb_num, int req, bool is_dapm)
{}

static int __wcd937x_codec_enable_micbias(struct snd_soc_dapm_widget *w,
					  int event)
{}

static int wcd937x_codec_enable_micbias(struct snd_soc_dapm_widget *w,
					struct snd_kcontrol *kcontrol,
					int event)
{}

static int __wcd937x_codec_enable_micbias_pullup(struct snd_soc_dapm_widget *w,
						 int event)
{}

static int wcd937x_codec_enable_micbias_pullup(struct snd_soc_dapm_widget *w,
					       struct snd_kcontrol *kcontrol,
					       int event)
{}

static int wcd937x_connect_port(struct wcd937x_sdw_priv *wcd, u8 port_idx, u8 ch_id, bool enable)
{}

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

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

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

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

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

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

static const char * const rx_hph_mode_mux_text[] =;

static const struct soc_enum rx_hph_mode_mux_enum =;

/* MBHC related */
static void wcd937x_mbhc_clk_setup(struct snd_soc_component *component,
				   bool enable)
{}

static void wcd937x_mbhc_mbhc_bias_control(struct snd_soc_component *component,
					   bool enable)
{}

static void wcd937x_mbhc_program_btn_thr(struct snd_soc_component *component,
					 int *btn_low, int *btn_high,
					 int num_btn, bool is_micbias)
{}

static bool wcd937x_mbhc_micb_en_status(struct snd_soc_component *component, int micb_num)
{}

static void wcd937x_mbhc_hph_l_pull_up_control(struct snd_soc_component *component,
					       int pull_up_cur)
{}

static int wcd937x_mbhc_request_micbias(struct snd_soc_component *component,
					int micb_num, int req)
{}

static void wcd937x_mbhc_micb_ramp_control(struct snd_soc_component *component,
					   bool enable)
{}

static int wcd937x_mbhc_micb_adjust_voltage(struct snd_soc_component *component,
					    int req_volt, int micb_num)
{}

static int wcd937x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *component,
						int micb_num, bool req_en)
{}

static void wcd937x_mbhc_get_result_params(struct snd_soc_component *component,
					   s16 *d1_a, u16 noff,
					   int32_t *zdet)
{}

static void wcd937x_mbhc_zdet_ramp(struct snd_soc_component *component,
				   struct wcd937x_mbhc_zdet_param *zdet_param,
				   s32 *zl, s32 *zr, s16 *d1_a)
{}

static void wcd937x_wcd_mbhc_qfuse_cal(struct snd_soc_component *component,
				       s32 *z_val, int flag_l_r)
{}

static void wcd937x_wcd_mbhc_calc_impedance(struct snd_soc_component *component,
					    u32 *zl, u32 *zr)
{}

static void wcd937x_mbhc_gnd_det_ctrl(struct snd_soc_component *component,
				      bool enable)
{}

static void wcd937x_mbhc_hph_pull_down_ctrl(struct snd_soc_component *component,
					    bool enable)
{}

static void wcd937x_mbhc_moisture_config(struct snd_soc_component *component)
{}

static void wcd937x_mbhc_moisture_detect_en(struct snd_soc_component *component, bool enable)
{}

static bool wcd937x_mbhc_get_moisture_status(struct snd_soc_component *component)
{}

static void wcd937x_mbhc_moisture_polling_ctrl(struct snd_soc_component *component,
					       bool enable)
{}

static const struct wcd_mbhc_cb mbhc_cb =;

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

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

static const struct snd_kcontrol_new hph_type_detect_controls[] =;

static const struct snd_kcontrol_new impedance_detect_controls[] =;

static int wcd937x_mbhc_init(struct snd_soc_component *component)
{}

static void wcd937x_mbhc_deinit(struct snd_soc_component *component)
{}

/* END MBHC */

static const struct snd_kcontrol_new wcd937x_snd_controls[] =;

static const struct snd_kcontrol_new adc1_switch[] =;

static const struct snd_kcontrol_new adc2_switch[] =;

static const struct snd_kcontrol_new adc3_switch[] =;

static const struct snd_kcontrol_new dmic1_switch[] =;

static const struct snd_kcontrol_new dmic2_switch[] =;

static const struct snd_kcontrol_new dmic3_switch[] =;

static const struct snd_kcontrol_new dmic4_switch[] =;

static const struct snd_kcontrol_new dmic5_switch[] =;

static const struct snd_kcontrol_new dmic6_switch[] =;

static const struct snd_kcontrol_new ear_rdac_switch[] =;

static const struct snd_kcontrol_new aux_rdac_switch[] =;

static const struct snd_kcontrol_new hphl_rdac_switch[] =;

static const struct snd_kcontrol_new hphr_rdac_switch[] =;

static const char * const adc2_mux_text[] =;

static const char * const rdac3_mux_text[] =;

static const struct soc_enum adc2_enum =;

static const struct soc_enum rdac3_enum =;

static const struct snd_kcontrol_new tx_adc2_mux =;

static const struct snd_kcontrol_new rx_rdac3_mux =;

static const struct snd_soc_dapm_widget wcd937x_dapm_widgets[] =;

static const struct snd_soc_dapm_widget wcd9375_dapm_widgets[] =;

static const struct snd_soc_dapm_route wcd937x_audio_map[] =;

static const struct snd_soc_dapm_route wcd9375_audio_map[] =;

static int wcd937x_set_micbias_data(struct wcd937x_priv *wcd937x)
{}

static irqreturn_t wcd937x_wd_handle_irq(int irq, void *data)
{}

static const struct irq_chip wcd_irq_chip =;

static int wcd_irq_chip_map(struct irq_domain *irqd, unsigned int virq,
			    irq_hw_number_t hw)
{}

static const struct irq_domain_ops wcd_domain_ops =;

static int wcd937x_irq_init(struct wcd937x_priv *wcd, struct device *dev)
{}

static int wcd937x_soc_codec_probe(struct snd_soc_component *component)
{}

static void wcd937x_soc_codec_remove(struct snd_soc_component *component)
{}

static int wcd937x_codec_set_jack(struct snd_soc_component *comp,
				  struct snd_soc_jack *jack, void *data)
{}

static const struct snd_soc_component_driver soc_codec_dev_wcd937x =;

static void wcd937x_dt_parse_micbias_info(struct device *dev, struct wcd937x_priv *wcd)
{}

static bool wcd937x_swap_gnd_mic(struct snd_soc_component *component, bool active)
{}

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

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

static int wcd937x_codec_set_sdw_stream(struct snd_soc_dai *dai,
					void *stream, int direction)
{}

static const struct snd_soc_dai_ops wcd937x_sdw_dai_ops =;

static struct snd_soc_dai_driver wcd937x_dais[] =;

static int wcd937x_bind(struct device *dev)
{}

static void wcd937x_unbind(struct device *dev)
{}

static const struct component_master_ops wcd937x_comp_ops =;

static int wcd937x_add_slave_components(struct wcd937x_priv *wcd937x,
					struct device *dev,
					struct component_match **matchptr)
{}

static int wcd937x_probe(struct platform_device *pdev)
{}

static void wcd937x_remove(struct platform_device *pdev)
{}

#if defined(CONFIG_OF)
static const struct of_device_id wcd937x_of_match[] =;
MODULE_DEVICE_TABLE(of, wcd937x_of_match);
#endif

static struct platform_driver wcd937x_codec_driver =;

module_platform_driver();
MODULE_DESCRIPTION();
MODULE_LICENSE();