linux/sound/pci/au88x0/au88x0_a3d.c

// SPDX-License-Identifier: GPL-2.0-or-later
/***************************************************************************
 *            au88x0_a3d.c
 *
 *  Fri Jul 18 14:16:22 2003
 *  Copyright  2003  mjander
 *  [email protected]
 *
 * A3D. You may think i'm crazy, but this may work someday. Who knows...
 ****************************************************************************/

/*
 */

#include "au88x0_a3d.h"
#include "au88x0_a3ddata.c"
#include "au88x0_xtalk.h"
#include "au88x0.h"

static void
a3dsrc_SetTimeConsts(a3dsrc_t * a, short HrtfTrack, short ItdTrack,
		     short GTrack, short CTrack)
{}

#if 0
static void
a3dsrc_GetTimeConsts(a3dsrc_t * a, short *HrtfTrack, short *ItdTrack,
		     short *GTrack, short *CTrack)
{
	// stub!
}

#endif
/* Atmospheric absorption. */

static void
a3dsrc_SetAtmosTarget(a3dsrc_t * a, short aa, short b, short c, short d,
		      short e)
{}

static void
a3dsrc_SetAtmosCurrent(a3dsrc_t * a, short aa, short b, short c, short d,
		       short e)
{}

static void
a3dsrc_SetAtmosState(a3dsrc_t * a, short x1, short x2, short y1, short y2)
{}

#if 0
static void
a3dsrc_GetAtmosTarget(a3dsrc_t * a, short *aa, short *b, short *c,
		      short *d, short *e)
{
}
static void
a3dsrc_GetAtmosCurrent(a3dsrc_t * a, short *bb01, short *ab01, short *b2,
		       short *aa12, short *ba12)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	*aa12 =
	    hwread(vortex->mmio,
		   a3d_addrA(a->slice, a->source, A3D_A_A12Current));
	*ba12 =
	    hwread(vortex->mmio,
		   a3d_addrB(a->slice, a->source, A3D_B_A12Current));
	*ab01 =
	    hwread(vortex->mmio,
		   a3d_addrA(a->slice, a->source, A3D_A_B01Current));
	*bb01 =
	    hwread(vortex->mmio,
		   a3d_addrB(a->slice, a->source, A3D_B_B01Current));
	*b2 =
	    hwread(vortex->mmio,
		   a3d_addrA(a->slice, a->source, A3D_A_B2Current));
}

static void
a3dsrc_GetAtmosState(a3dsrc_t * a, short *x1, short *x2, short *y1, short *y2)
{

}

#endif
/* HRTF */

static void
a3dsrc_SetHrtfTarget(a3dsrc_t * a, a3d_Hrtf_t const aa, a3d_Hrtf_t const b)
{}

static void
a3dsrc_SetHrtfCurrent(a3dsrc_t * a, a3d_Hrtf_t const aa, a3d_Hrtf_t const b)
{}

static void
a3dsrc_SetHrtfState(a3dsrc_t * a, a3d_Hrtf_t const aa, a3d_Hrtf_t const b)
{}

static void a3dsrc_SetHrtfOutput(a3dsrc_t * a, short left, short right)
{}

#if 0
static void a3dsrc_GetHrtfTarget(a3dsrc_t * a, a3d_Hrtf_t aa, a3d_Hrtf_t b)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	int i;

	for (i = 0; i < HRTF_SZ; i++)
		aa[i] =
		    hwread(vortex->mmio,
			   a3d_addrA(a->slice, a->source,
				     A3D_A_HrtfTarget + (i << 2)));
	for (i = 0; i < HRTF_SZ; i++)
		b[i] =
		    hwread(vortex->mmio,
			   a3d_addrB(a->slice, a->source,
				     A3D_B_HrtfTarget + (i << 2)));
}

static void a3dsrc_GetHrtfCurrent(a3dsrc_t * a, a3d_Hrtf_t aa, a3d_Hrtf_t b)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	int i;

	for (i = 0; i < HRTF_SZ; i++)
		aa[i] =
		    hwread(vortex->mmio,
			   a3d_addrA(a->slice, a->source,
				     A3D_A_HrtfCurrent + (i << 2)));
	for (i = 0; i < HRTF_SZ; i++)
		b[i] =
		    hwread(vortex->mmio,
			   a3d_addrB(a->slice, a->source,
				     A3D_B_HrtfCurrent + (i << 2)));
}

static void a3dsrc_GetHrtfState(a3dsrc_t * a, a3d_Hrtf_t aa, a3d_Hrtf_t b)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	int i;
	// FIXME: verify this!
	for (i = 0; i < HRTF_SZ; i++)
		aa[i] =
		    hwread(vortex->mmio,
			   a3d_addrA(a->slice, a->source,
				     A3D_A_HrtfDelayLine + (i << 2)));
	for (i = 0; i < HRTF_SZ; i++)
		b[i] =
		    hwread(vortex->mmio,
			   a3d_addrB(a->slice, a->source,
				     A3D_B_HrtfDelayLine + (i << 2)));
}

static void a3dsrc_GetHrtfOutput(a3dsrc_t * a, short *left, short *right)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	*left =
	    hwread(vortex->mmio,
		   a3d_addrA(a->slice, a->source, A3D_A_HrtfOutL));
	*right =
	    hwread(vortex->mmio,
		   a3d_addrA(a->slice, a->source, A3D_A_HrtfOutR));
}

#endif

/* Interaural Time Difference. 
 * "The other main clue that humans use to locate sounds, is called 
 * Interaural Time Difference (ITD). The differences in distance from 
 * the sound source to a listeners ears means  that the sound will 
 * reach one ear slightly before the other....", found somewhere with google.*/
static void a3dsrc_SetItdTarget(a3dsrc_t * a, short litd, short ritd)
{}

static void a3dsrc_SetItdCurrent(a3dsrc_t * a, short litd, short ritd)
{}

static void a3dsrc_SetItdDline(a3dsrc_t * a, a3d_ItdDline_t const dline)
{}

#if 0
static void a3dsrc_GetItdTarget(a3dsrc_t * a, short *litd, short *ritd)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	*ritd =
	    hwread(vortex->mmio,
		   a3d_addrA(a->slice, a->source, A3D_A_ITDTarget));
	*litd =
	    hwread(vortex->mmio,
		   a3d_addrB(a->slice, a->source, A3D_B_ITDTarget));
}

static void a3dsrc_GetItdCurrent(a3dsrc_t * a, short *litd, short *ritd)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);

	*ritd =
	    hwread(vortex->mmio,
		   a3d_addrA(a->slice, a->source, A3D_A_ITDCurrent));
	*litd =
	    hwread(vortex->mmio,
		   a3d_addrB(a->slice, a->source, A3D_B_ITDCurrent));
}

static void a3dsrc_GetItdDline(a3dsrc_t * a, a3d_ItdDline_t dline)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	int i;

	for (i = 0; i < DLINE_SZ; i++)
		dline[i] =
		    hwread(vortex->mmio,
			   a3d_addrA(a->slice, a->source,
				     A3D_A_ITDDelayLine + (i << 2)));
}

#endif
/* This is may be used for ILD Interaural Level Difference. */

static void a3dsrc_SetGainTarget(a3dsrc_t * a, short left, short right)
{}

static void a3dsrc_SetGainCurrent(a3dsrc_t * a, short left, short right)
{}

#if 0
static void a3dsrc_GetGainTarget(a3dsrc_t * a, short *left, short *right)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	*right =
	    hwread(vortex->mmio,
		   a3d_addrA(a->slice, a->source, A3D_A_GainTarget));
	*left =
	    hwread(vortex->mmio,
		   a3d_addrB(a->slice, a->source, A3D_B_GainTarget));
}

static void a3dsrc_GetGainCurrent(a3dsrc_t * a, short *left, short *right)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	*right =
	    hwread(vortex->mmio,
		   a3d_addrA(a->slice, a->source, A3D_A_GainCurrent));
	*left =
	    hwread(vortex->mmio,
		   a3d_addrB(a->slice, a->source, A3D_B_GainCurrent));
}

/* CA3dIO this func seems to be inlined all over this place. */
static void CA3dIO_WriteReg(a3dsrc_t * a, unsigned long addr, short aa, short b)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	hwwrite(vortex->mmio, addr, (aa << 0x10) | b);
}

#endif
/* Generic A3D stuff */

static void a3dsrc_SetA3DSampleRate(a3dsrc_t * a, int sr)
{}

static void a3dsrc_EnableA3D(a3dsrc_t * a)
{}

static void a3dsrc_DisableA3D(a3dsrc_t * a)
{}

static void a3dsrc_SetA3DControlReg(a3dsrc_t * a, unsigned long ctrl)
{}

static void a3dsrc_SetA3DPointerReg(a3dsrc_t * a, unsigned long ptr)
{}

#if 0
static void a3dsrc_GetA3DSampleRate(a3dsrc_t * a, int *sr)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	*sr = ((hwread(vortex->mmio, A3D_SLICE_Control + (a->slice << 0xd))
		>> 3) & 0x1f);
	//*sr = ((hwread(vortex->mmio, 0x19C38 + (this08<<0xd))>>3)&0x1f);
}

static void a3dsrc_GetA3DControlReg(a3dsrc_t * a, unsigned long *ctrl)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	*ctrl = hwread(vortex->mmio, A3D_SLICE_Control + ((a->slice) << 0xd));
}

static void a3dsrc_GetA3DPointerReg(a3dsrc_t * a, unsigned long *ptr)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);
	*ptr = hwread(vortex->mmio, A3D_SLICE_Pointers + ((a->slice) << 0xd));
}

#endif
static void a3dsrc_ZeroSliceIO(a3dsrc_t * a)
{}

/* Reset Single A3D source. */
static void a3dsrc_ZeroState(a3dsrc_t * a)
{}

/* Reset entire A3D engine */
static void a3dsrc_ZeroStateA3D(a3dsrc_t *a, vortex_t *v)
{}

/* Program A3D block as pass through */
static void a3dsrc_ProgramPipe(a3dsrc_t * a)
{}

/* VDB = Vortex audio Dataflow Bus */
#if 0
static void a3dsrc_ClearVDBData(a3dsrc_t * a, unsigned long aa)
{
	vortex_t *vortex = (vortex_t *) (a->vortex);

	// ((aa >> 2) << 8) - (aa >> 2)
	hwwrite(vortex->mmio,
		a3d_addrS(a->slice, A3D_SLICE_VDBDest) + (a->source << 2), 0);
	hwwrite(vortex->mmio,
		a3d_addrS(a->slice,
			  A3D_SLICE_VDBDest + 4) + (a->source << 2), 0);
	/*
	   hwwrite(vortex->mmio, 0x19c00 + (((aa>>2)*255*4)+aa)*8, 0);
	   hwwrite(vortex->mmio, 0x19c04 + (((aa>>2)*255*4)+aa)*8, 0);
	 */
}
#endif

/* A3D HwSource stuff. */

static void vortex_A3dSourceHw_Initialize(vortex_t * v, int source, int slice)
{}

static int Vort3DRend_Initialize(vortex_t * v, unsigned short mode)
{}

/* 3D Sound entry points. */

static int vortex_a3d_register_controls(vortex_t * vortex);
static void vortex_a3d_unregister_controls(vortex_t * vortex);
/* A3D base support init/shudown */
static void vortex_Vort3D_enable(vortex_t *v)
{}

static void vortex_Vort3D_disable(vortex_t * v)
{}

/* Make A3D subsystem connections. */
static void vortex_Vort3D_connect(vortex_t * v, int en)
{}

/* Initialize one single A3D source. */
static void vortex_Vort3D_InitializeSource(a3dsrc_t *a, int en, vortex_t *v)
{}

/* Conversion of coordinates into 3D parameters. */

static void vortex_a3d_coord2hrtf(a3d_Hrtf_t hrtf, int *coord)
{}
static void vortex_a3d_coord2itd(a3d_Itd_t itd, int *coord)
{}
static void vortex_a3d_coord2ild(a3d_LRGains_t ild, int left, int right)
{}
static void vortex_a3d_translate_filter(a3d_atmos_t filter, int *params)
{}

/* ALSA control interface.  */

static int
snd_vortex_a3d_hrtf_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}
static int
snd_vortex_a3d_itd_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}
static int
snd_vortex_a3d_ild_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}
static int
snd_vortex_a3d_filter_info(struct snd_kcontrol *kcontrol,
			   struct snd_ctl_elem_info *uinfo)
{}

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

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

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

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

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

static const struct snd_kcontrol_new vortex_a3d_kcontrol =;

/* Control (un)registration. */
static int vortex_a3d_register_controls(vortex_t *vortex)
{}

static void vortex_a3d_unregister_controls(vortex_t * vortex)
{}

/* End of File*/