FreeBSD kernel sound device code
onyx.c File Reference
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <machine/dbdma.h>
#include <machine/intr_machdep.h>
#include <machine/resource.h>
#include <machine/bus.h>
#include <machine/pio.h>
#include <sys/rman.h>
#include <dev/iicbus/iicbus.h>
#include <dev/iicbus/iiconf.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/sound/pcm/sound.h>
#include "mixer_if.h"
Include dependency graph for onyx.c:

Go to the source code of this file.

Data Structures

struct  onyx_softc
 
struct  onyx_reg
 

Macros

#define PCM3052_IICADDR   0x8C /* Hard-coded I2C slave addr */
 
#define PCM3052_REG_LEFT_ATTN   65
 
#define PCM3052_REG_RIGHT_ATTN   66
 
#define PCM3052_REG_CONTROL   67
 
#define PCM3052_MRST   (1 << 7)
 
#define PCM3052_SRST   (1 << 6)
 
#define PCM3052_REG_DAC_CONTROL   68
 
#define PCM3052_OVR1   (1 << 6)
 
#define PCM3052_MUTE_L   (1 << 1)
 
#define PCM3052_MUTE_R   (1 << 0)
 
#define PCM3052_REG_DAC_DEEMPH   69
 
#define PCM3052_REG_DAC_FILTER   70
 
#define PCM3052_DAC_FILTER_ALWAYS   (1 << 2)
 
#define PCM3052_REG_OUT_PHASE   71
 
#define PCM3052_REG_ADC_CONTROL   72
 
#define PCM3052_REG_ADC_HPF_BP   75
 
#define PCM3052_HPF_ALWAYS   (1 << 2)
 
#define PCM3052_REG_INFO_1   77
 
#define PCM3052_REG_INFO_2   78
 
#define PCM3052_REG_INFO_3   79
 
#define PCM3052_REG_INFO_4   80
 

Functions

static int onyx_probe (device_t)
 
static int onyx_attach (device_t)
 
static int onyx_init (struct snd_mixer *m)
 
static int onyx_uninit (struct snd_mixer *m)
 
static int onyx_reinit (struct snd_mixer *m)
 
static int onyx_set (struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
 
static u_int32_t onyx_setrecsrc (struct snd_mixer *m, u_int32_t src)
 
 DRIVER_MODULE (onyx, iicbus, onyx_driver, onyx_devclass, 0, 0)
 
 MODULE_VERSION (onyx, 1)
 
 MODULE_DEPEND (onyx, iicbus, 1, 1, 1)
 
 MIXER_DECLARE (onyx_mixer)
 
static int onyx_write (struct onyx_softc *sc, uint8_t reg, const uint8_t value)
 

Variables

kobj_class_t i2s_mixer_class
 
device_t i2s_mixer
 
static device_method_t onyx_methods []
 
static driver_t onyx_driver
 
static devclass_t onyx_devclass
 
static kobj_method_t onyx_mixer_methods []
 
static const struct onyx_reg onyx_initdata
 

Macro Definition Documentation

◆ PCM3052_DAC_FILTER_ALWAYS

#define PCM3052_DAC_FILTER_ALWAYS   (1 << 2)

Definition at line 127 of file onyx.c.

◆ PCM3052_HPF_ALWAYS

#define PCM3052_HPF_ALWAYS   (1 << 2)

Definition at line 131 of file onyx.c.

◆ PCM3052_IICADDR

#define PCM3052_IICADDR   0x8C /* Hard-coded I2C slave addr */

Definition at line 110 of file onyx.c.

◆ PCM3052_MRST

#define PCM3052_MRST   (1 << 7)

Definition at line 119 of file onyx.c.

◆ PCM3052_MUTE_L

#define PCM3052_MUTE_L   (1 << 1)

Definition at line 123 of file onyx.c.

◆ PCM3052_MUTE_R

#define PCM3052_MUTE_R   (1 << 0)

Definition at line 124 of file onyx.c.

◆ PCM3052_OVR1

#define PCM3052_OVR1   (1 << 6)

Definition at line 122 of file onyx.c.

◆ PCM3052_REG_ADC_CONTROL

#define PCM3052_REG_ADC_CONTROL   72

Definition at line 129 of file onyx.c.

◆ PCM3052_REG_ADC_HPF_BP

#define PCM3052_REG_ADC_HPF_BP   75

Definition at line 130 of file onyx.c.

◆ PCM3052_REG_CONTROL

#define PCM3052_REG_CONTROL   67

Definition at line 118 of file onyx.c.

◆ PCM3052_REG_DAC_CONTROL

#define PCM3052_REG_DAC_CONTROL   68

Definition at line 121 of file onyx.c.

◆ PCM3052_REG_DAC_DEEMPH

#define PCM3052_REG_DAC_DEEMPH   69

Definition at line 125 of file onyx.c.

◆ PCM3052_REG_DAC_FILTER

#define PCM3052_REG_DAC_FILTER   70

Definition at line 126 of file onyx.c.

◆ PCM3052_REG_INFO_1

#define PCM3052_REG_INFO_1   77

Definition at line 132 of file onyx.c.

◆ PCM3052_REG_INFO_2

#define PCM3052_REG_INFO_2   78

Definition at line 133 of file onyx.c.

◆ PCM3052_REG_INFO_3

#define PCM3052_REG_INFO_3   79

Definition at line 134 of file onyx.c.

◆ PCM3052_REG_INFO_4

#define PCM3052_REG_INFO_4   80

Definition at line 135 of file onyx.c.

◆ PCM3052_REG_LEFT_ATTN

#define PCM3052_REG_LEFT_ATTN   65

Definition at line 116 of file onyx.c.

◆ PCM3052_REG_OUT_PHASE

#define PCM3052_REG_OUT_PHASE   71

Definition at line 128 of file onyx.c.

◆ PCM3052_REG_RIGHT_ATTN

#define PCM3052_REG_RIGHT_ATTN   66

Definition at line 117 of file onyx.c.

◆ PCM3052_SRST

#define PCM3052_SRST   (1 << 6)

Definition at line 120 of file onyx.c.

Function Documentation

◆ DRIVER_MODULE()

DRIVER_MODULE ( onyx  ,
iicbus  ,
onyx_driver  ,
onyx_devclass  ,
,
 
)

◆ MIXER_DECLARE()

MIXER_DECLARE ( onyx_mixer  )

◆ MODULE_DEPEND()

MODULE_DEPEND ( onyx  ,
iicbus  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( onyx  ,
 
)

◆ onyx_attach()

static int onyx_attach ( device_t  dev)
static

Definition at line 215 of file onyx.c.

References dev, i2s_mixer, i2s_mixer_class, onyx_softc::sc_addr, and onyx_softc::sc_dev.

◆ onyx_init()

◆ onyx_probe()

static int onyx_probe ( device_t  dev)
static

Definition at line 192 of file onyx.c.

References dev, name, and PCM3052_IICADDR.

◆ onyx_reinit()

static int onyx_reinit ( struct snd_mixer m)
static

Definition at line 266 of file onyx.c.

◆ onyx_set()

static int onyx_set ( struct snd_mixer m,
unsigned  dev,
unsigned  left,
unsigned  right 
)
static

Definition at line 272 of file onyx.c.

References dev, left, m, mix_getdevinfo(), mixer_get_lock(), onyx_write(), PCM3052_REG_LEFT_ATTN, PCM3052_REG_RIGHT_ATTN, r, and right.

Here is the call graph for this function:

◆ onyx_setrecsrc()

static u_int32_t onyx_setrecsrc ( struct snd_mixer m,
u_int32_t  src 
)
static

Definition at line 314 of file onyx.c.

◆ onyx_uninit()

static int onyx_uninit ( struct snd_mixer m)
static

Definition at line 260 of file onyx.c.

◆ onyx_write()

static int onyx_write ( struct onyx_softc sc,
uint8_t  reg,
const uint8_t  value 
)
static

Definition at line 172 of file onyx.c.

References buf, reg, onyx_softc::sc_addr, onyx_softc::sc_dev, size, and value.

Referenced by onyx_init(), and onyx_set().

Here is the caller graph for this function:

Variable Documentation

◆ i2s_mixer

device_t i2s_mixer
extern

Definition at line 108 of file i2s.c.

Referenced by onyx_attach().

◆ i2s_mixer_class

kobj_class_t i2s_mixer_class
extern

Definition at line 107 of file i2s.c.

Referenced by onyx_attach().

◆ onyx_devclass

devclass_t onyx_devclass
static

Definition at line 93 of file onyx.c.

◆ onyx_driver

driver_t onyx_driver
static
Initial value:
= {
"onyx",
sizeof(struct onyx_softc)
}
static device_method_t onyx_methods[]
Definition: onyx.c:81

Definition at line 88 of file onyx.c.

◆ onyx_initdata

const struct onyx_reg onyx_initdata
static
Initial value:
= {
0x80,
0x80,
0,
0,
0,
(-1 + 8) & 0xf,
(1 << 2),
2,
0,
1
}
#define PCM3052_DAC_FILTER_ALWAYS
Definition: onyx.c:127
#define PCM3052_SRST
Definition: onyx.c:120
#define PCM3052_HPF_ALWAYS
Definition: onyx.c:131
#define PCM3052_MRST
Definition: onyx.c:119

Definition at line 153 of file onyx.c.

Referenced by onyx_init().

◆ onyx_methods

device_method_t onyx_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, onyx_probe),
DEVMETHOD(device_attach, onyx_attach),
{ 0, 0 }
}
static int onyx_attach(device_t)
Definition: onyx.c:215
static int onyx_probe(device_t)
Definition: onyx.c:192

Definition at line 81 of file onyx.c.

◆ onyx_mixer_methods

kobj_method_t onyx_mixer_methods[]
static
Initial value:
= {
KOBJMETHOD(mixer_init, onyx_init),
KOBJMETHOD(mixer_uninit, onyx_uninit),
KOBJMETHOD(mixer_reinit, onyx_reinit),
KOBJMETHOD(mixer_set, onyx_set),
}
#define KOBJMETHOD_END
Definition: midi.c:76
static int mixer_setrecsrc(struct snd_mixer *mixer, u_int32_t src)
Definition: mixer.c:373
int mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
Definition: mixer.c:725
static int mixer_set(struct snd_mixer *m, u_int dev, u_int32_t muted, u_int lev)
Definition: mixer.c:247
int mixer_uninit(device_t dev)
Definition: mixer.c:805
int mixer_reinit(device_t dev)
Definition: mixer.c:860
static int onyx_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
Definition: onyx.c:272
static int onyx_reinit(struct snd_mixer *m)
Definition: onyx.c:266
static int onyx_uninit(struct snd_mixer *m)
Definition: onyx.c:260
static int onyx_init(struct snd_mixer *m)
Definition: onyx.c:230
static u_int32_t onyx_setrecsrc(struct snd_mixer *m, u_int32_t src)
Definition: onyx.c:314

Definition at line 99 of file onyx.c.