linux/drivers/usb/typec/mux/wcd939x-usbss.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (C) 2023 Linaro Ltd.
 */

#include <linux/bits.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/regmap.h>
#include <linux/bitfield.h>
#include <linux/gpio/consumer.h>
#include <linux/usb/typec_dp.h>
#include <linux/usb/typec_mux.h>

#define WCD_USBSS_PMP_OUT1

#define WCD_USBSS_DP_DN_MISC1

#define WCD_USBSS_DP_DN_MISC1_DP_PCOMP_2X_DYN_BST_ON_EN
#define WCD_USBSS_DP_DN_MISC1_DN_PCOMP_2X_DYN_BST_ON_EN

#define WCD_USBSS_MG1_EN

#define WCD_USBSS_MG1_EN_CT_SNS_EN

#define WCD_USBSS_MG1_BIAS

#define WCD_USBSS_MG1_BIAS_PCOMP_DYN_BST_EN

#define WCD_USBSS_MG1_MISC

#define WCD_USBSS_MG1_MISC_PCOMP_2X_DYN_BST_ON_EN

#define WCD_USBSS_MG2_EN

#define WCD_USBSS_MG2_EN_CT_SNS_EN

#define WCD_USBSS_MG2_BIAS

#define WCD_USBSS_MG2_BIAS_PCOMP_DYN_BST_EN

#define WCD_USBSS_MG2_MISC

#define WCD_USBSS_MG2_MISC_PCOMP_2X_DYN_BST_ON_EN

#define WCD_USBSS_DISP_AUXP_THRESH

#define WCD_USBSS_DISP_AUXP_THRESH_DISP_AUXP_OVPON_CM

#define WCD_USBSS_DISP_AUXP_CTL

#define WCD_USBSS_DISP_AUXP_CTL_LK_CANCEL_TRK_COEFF

#define WCD_USBSS_CPLDO_CTL2

#define WCD_USBSS_SWITCH_SETTINGS_ENABLE

#define WCD_USBSS_SWITCH_SETTINGS_ENABLE_DEVICE_ENABLE
#define WCD_USBSS_SWITCH_SETTINGS_ENABLE_DP_AUXP_TO_MGX_SWITCHES
#define WCD_USBSS_SWITCH_SETTINGS_ENABLE_DP_AUXM_TO_MGX_SWITCHES
#define WCD_USBSS_SWITCH_SETTINGS_ENABLE_DNL_SWITCHES
#define WCD_USBSS_SWITCH_SETTINGS_ENABLE_DPR_SWITCHES
#define WCD_USBSS_SWITCH_SETTINGS_ENABLE_SENSE_SWITCHES
#define WCD_USBSS_SWITCH_SETTINGS_ENABLE_MIC_SWITCHES
#define WCD_USBSS_SWITCH_SETTINGS_ENABLE_AGND_SWITCHES

#define WCD_USBSS_SWITCH_SELECT0

#define WCD_USBSS_SWITCH_SELECT0_DP_AUXP_SWITCHES
#define WCD_USBSS_SWITCH_SELECT0_DP_AUXM_SWITCHES
#define WCD_USBSS_SWITCH_SELECT0_DNL_SWITCHES
#define WCD_USBSS_SWITCH_SELECT0_DPR_SWITCHES
#define WCD_USBSS_SWITCH_SELECT0_SENSE_SWITCHES
#define WCD_USBSS_SWITCH_SELECT0_MIC_SWITCHES

#define WCD_USBSS_SWITCH_SELECT0_DNL_SWITCH_L
#define WCD_USBSS_SWITCH_SELECT0_DNL_SWITCH_DN
#define WCD_USBSS_SWITCH_SELECT0_DNL_SWITCH_DN2

#define WCD_USBSS_SWITCH_SELECT0_DPR_SWITCH_R
#define WCD_USBSS_SWITCH_SELECT0_DPR_SWITCH_DP
#define WCD_USBSS_SWITCH_SELECT0_DPR_SWITCH_DR2

#define WCD_USBSS_SWITCH_SELECT1

#define WCD_USBSS_SWITCH_SELECT1_AGND_SWITCHES

#define WCD_USBSS_DELAY_R_SW
#define WCD_USBSS_DELAY_MIC_SW
#define WCD_USBSS_DELAY_SENSE_SW
#define WCD_USBSS_DELAY_GND_SW
#define WCD_USBSS_DELAY_L_SW

#define WCD_USBSS_FUNCTION_ENABLE

#define WCD_USBSS_FUNCTION_ENABLE_SOURCE_SELECT

#define WCD_USBSS_FUNCTION_ENABLE_SOURCE_SELECT_MANUAL
#define WCD_USBSS_FUNCTION_ENABLE_SOURCE_SELECT_AUDIO_FSM

#define WCD_USBSS_EQUALIZER1

#define WCD_USBSS_EQUALIZER1_EQ_EN
#define WCD_USBSS_EQUALIZER1_BW_SETTINGS

#define WCD_USBSS_USB_SS_CNTL

#define WCD_USBSS_USB_SS_CNTL_STANDBY_STATE
#define WCD_USBSS_USB_SS_CNTL_RCO_EN
#define WCD_USBSS_USB_SS_CNTL_USB_SS_MODE

#define WCD_USBSS_USB_SS_CNTL_USB_SS_MODE_AATC
#define WCD_USBSS_USB_SS_CNTL_USB_SS_MODE_USB

#define WCD_USBSS_AUDIO_FSM_START

#define WCD_USBSS_AUDIO_FSM_START_AUDIO_FSM_AUDIO_TRIG

#define WCD_USBSS_RATIO_SPKR_REXT_L_LSB
#define WCD_USBSS_RATIO_SPKR_REXT_L_MSB
#define WCD_USBSS_RATIO_SPKR_REXT_R_LSB
#define WCD_USBSS_RATIO_SPKR_REXT_R_MSB
#define WCD_USBSS_AUD_COEF_L_K0_0
#define WCD_USBSS_AUD_COEF_L_K0_1
#define WCD_USBSS_AUD_COEF_L_K0_2
#define WCD_USBSS_AUD_COEF_L_K1_0
#define WCD_USBSS_AUD_COEF_L_K1_1
#define WCD_USBSS_AUD_COEF_L_K2_0
#define WCD_USBSS_AUD_COEF_L_K2_1
#define WCD_USBSS_AUD_COEF_L_K3_0
#define WCD_USBSS_AUD_COEF_L_K3_1
#define WCD_USBSS_AUD_COEF_L_K4_0
#define WCD_USBSS_AUD_COEF_L_K4_1
#define WCD_USBSS_AUD_COEF_L_K5_0
#define WCD_USBSS_AUD_COEF_L_K5_1
#define WCD_USBSS_AUD_COEF_R_K0_0
#define WCD_USBSS_AUD_COEF_R_K0_1
#define WCD_USBSS_AUD_COEF_R_K0_2
#define WCD_USBSS_AUD_COEF_R_K1_0
#define WCD_USBSS_AUD_COEF_R_K1_1
#define WCD_USBSS_AUD_COEF_R_K2_0
#define WCD_USBSS_AUD_COEF_R_K2_1
#define WCD_USBSS_AUD_COEF_R_K3_0
#define WCD_USBSS_AUD_COEF_R_K3_1
#define WCD_USBSS_AUD_COEF_R_K4_0
#define WCD_USBSS_AUD_COEF_R_K4_1
#define WCD_USBSS_AUD_COEF_R_K5_0
#define WCD_USBSS_AUD_COEF_R_K5_1
#define WCD_USBSS_GND_COEF_L_K0_0
#define WCD_USBSS_GND_COEF_L_K0_1
#define WCD_USBSS_GND_COEF_L_K0_2
#define WCD_USBSS_GND_COEF_L_K1_0
#define WCD_USBSS_GND_COEF_L_K1_1
#define WCD_USBSS_GND_COEF_L_K2_0
#define WCD_USBSS_GND_COEF_L_K2_1
#define WCD_USBSS_GND_COEF_L_K3_0
#define WCD_USBSS_GND_COEF_L_K3_1
#define WCD_USBSS_GND_COEF_L_K4_0
#define WCD_USBSS_GND_COEF_L_K4_1
#define WCD_USBSS_GND_COEF_L_K5_0
#define WCD_USBSS_GND_COEF_L_K5_1
#define WCD_USBSS_GND_COEF_R_K0_0
#define WCD_USBSS_GND_COEF_R_K0_1
#define WCD_USBSS_GND_COEF_R_K0_2
#define WCD_USBSS_GND_COEF_R_K1_0
#define WCD_USBSS_GND_COEF_R_K1_1
#define WCD_USBSS_GND_COEF_R_K2_0
#define WCD_USBSS_GND_COEF_R_K2_1
#define WCD_USBSS_GND_COEF_R_K3_0
#define WCD_USBSS_GND_COEF_R_K3_1
#define WCD_USBSS_GND_COEF_R_K4_0
#define WCD_USBSS_GND_COEF_R_K4_1
#define WCD_USBSS_GND_COEF_R_K5_0
#define WCD_USBSS_GND_COEF_R_K5_1

#define WCD_USBSS_MAX_REGISTER

struct wcd939x_usbss {};

static const struct regmap_range_cfg wcd939x_usbss_ranges[] =;

static const struct regmap_config wcd939x_usbss_regmap_config =;

/* Linearlizer coefficients for 32ohm load */
static const struct {} wcd939x_usbss_coeff_init[] =;

static int wcd939x_usbss_set(struct wcd939x_usbss *usbss)
{}

static int wcd939x_usbss_switch_set(struct typec_switch_dev *sw,
				    enum typec_orientation orientation)
{}

static int wcd939x_usbss_mux_set(struct typec_mux_dev *mux,
				 struct typec_mux_state *state)
{}

static int wcd939x_usbss_probe(struct i2c_client *client)
{}

static void wcd939x_usbss_remove(struct i2c_client *client)
{}

static const struct i2c_device_id wcd939x_usbss_table[] =;
MODULE_DEVICE_TABLE(i2c, wcd939x_usbss_table);

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

static struct i2c_driver wcd939x_usbss_driver =;
module_i2c_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();