linux/sound/pci/ice1712/juli.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *   ALSA driver for ICEnsemble VT1724 (Envy24HT)
 *
 *   Lowlevel functions for ESI Juli@ cards
 *
 *	Copyright (c) 2004 Jaroslav Kysela <[email protected]>
 *	              2008 Pavel Hofman <[email protected]>
 */

#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <sound/core.h>
#include <sound/tlv.h>

#include "ice1712.h"
#include "envy24ht.h"
#include "juli.h"

struct juli_spec {};

/*
 * chip addresses on I2C bus
 */
#define AK4114_ADDR
#define AK4358_ADDR

/*
 * Juli does not use the standard ICE1724 clock scheme. Juli's ice1724 chip is
 * supplied by external clock provided by Xilinx array and MK73-1 PLL frequency
 * multiplier. Actual frequency is set by ice1724 GPIOs hooked to the Xilinx.
 *
 * The clock circuitry is supplied by the two ice1724 crystals. This
 * arrangement allows to generate independent clock signal for AK4114's input
 * rate detection circuit. As a result, Juli, unlike most other
 * ice1724+ak4114-based cards, detects spdif input rate correctly.
 * This fact is applied in the driver, allowing to modify PCM stream rate
 * parameter according to the actual input rate.
 *
 * Juli uses the remaining three stereo-channels of its DAC to optionally
 * monitor analog input, digital input, and digital output. The corresponding
 * I2S signals are routed by Xilinx, controlled by GPIOs.
 *
 * The master mute is implemented using output muting transistors (GPIO) in
 * combination with smuting the DAC.
 *
 * The card itself has no HW master volume control, implemented using the
 * vmaster control.
 *
 * TODO:
 * researching and fixing the input monitors
 */

/*
 * GPIO pins
 */
#define GPIO_FREQ_MASK
#define GPIO_FREQ_32KHZ
#define GPIO_FREQ_44KHZ
#define GPIO_FREQ_48KHZ
#define GPIO_MULTI_MASK
#define GPIO_MULTI_4X
#define GPIO_MULTI_2X
#define GPIO_MULTI_1X
#define GPIO_MULTI_HALF
#define GPIO_INTERNAL_CLOCK
#define GPIO_CLOCK_MASK
#define GPIO_ANALOG_PRESENT
#define GPIO_RXMCLK_SEL
#define GPIO_AK5385A_CKS0
#define GPIO_AK5385A_DFS1
#define GPIO_AK5385A_DFS0
#define GPIO_DIGOUT_MONITOR
#define GPIO_DIGIN_MONITOR
#define GPIO_ANAIN_MONITOR
#define GPIO_AK5385A_CKS1
#define GPIO_MUTE_CONTROL

#define GPIO_RATE_MASK
#define GPIO_AK5385A_MASK

#define JULI_PCM_RATE

#define GPIO_RATE_16000
#define GPIO_RATE_22050
#define GPIO_RATE_24000
#define GPIO_RATE_32000
#define GPIO_RATE_44100
#define GPIO_RATE_48000
#define GPIO_RATE_64000
#define GPIO_RATE_88200
#define GPIO_RATE_96000
#define GPIO_RATE_176400
#define GPIO_RATE_192000

/*
 * Initial setup of the conversion array GPIO <-> rate
 */
static const unsigned int juli_rates[] =;

static const unsigned int gpio_vals[] =;

static const struct snd_pcm_hw_constraint_list juli_rates_info =;

static int get_gpio_val(int rate)
{}

static void juli_ak4114_write(void *private_data, unsigned char reg,
				unsigned char val)
{}

static unsigned char juli_ak4114_read(void *private_data, unsigned char reg)
{}

/*
 * If SPDIF capture and slaved to SPDIF-IN, setting runtime rate
 * to the external rate
 */
static void juli_spdif_in_open(struct snd_ice1712 *ice,
				struct snd_pcm_substream *substream)
{}

/*
 * AK4358 section
 */

static void juli_akm_lock(struct snd_akm4xxx *ak, int chip)
{}

static void juli_akm_unlock(struct snd_akm4xxx *ak, int chip)
{}

static void juli_akm_write(struct snd_akm4xxx *ak, int chip,
			   unsigned char addr, unsigned char data)
{}

/*
 * change the rate of envy24HT, AK4358, AK5385
 */
static void juli_akm_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
{}

#define AK_DAC(xname, xch)
#define PCM_VOLUME
#define MONITOR_AN_IN_VOLUME
#define MONITOR_DIG_IN_VOLUME
#define MONITOR_DIG_OUT_VOLUME

static const struct snd_akm4xxx_dac_channel juli_dac[] =;


static const struct snd_akm4xxx akm_juli_dac =;

#define juli_mute_info

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

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

static const struct snd_kcontrol_new juli_mute_controls[] =;

static const char * const follower_vols[] =;

static
DECLARE_TLV_DB_SCALE(juli_master_db_scale, -6350, 50, 1);

static int juli_add_controls(struct snd_ice1712 *ice)
{}

/*
 * suspend/resume
 * */

#ifdef CONFIG_PM_SLEEP
static int juli_resume(struct snd_ice1712 *ice)
{}

static int juli_suspend(struct snd_ice1712 *ice)
{}
#endif

/*
 * initialize the chip
 */

static inline int juli_is_spdif_master(struct snd_ice1712 *ice)
{}

static unsigned int juli_get_rate(struct snd_ice1712 *ice)
{}

/* setting new rate */
static void juli_set_rate(struct snd_ice1712 *ice, unsigned int rate)
{}

static inline unsigned char juli_set_mclk(struct snd_ice1712 *ice,
					  unsigned int rate)
{}

/* setting clock to external - SPDIF */
static int juli_set_spdif_clock(struct snd_ice1712 *ice, int type)
{}

/* Called when ak4114 detects change in the input SPDIF stream */
static void juli_ak4114_change(struct ak4114 *ak4114, unsigned char c0,
			       unsigned char c1)
{}

static int juli_init(struct snd_ice1712 *ice)
{}


/*
 * Juli@ boards don't provide the EEPROM data except for the vendor IDs.
 * hence the driver needs to sets up it properly.
 */

static const unsigned char juli_eeprom[] =;

/* entry point */
struct snd_ice1712_card_info snd_vt1724_juli_cards[] =;