sound/pci/ice1712/ews.c
Source file repositories/reference/linux-study-clean/sound/pci/ice1712/ews.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/ice1712/ews.c- Extension
.c- Size
- 30558 bytes
- Lines
- 1071
- Domain
- Driver Families
- Bucket
- sound/pci
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/interrupt.hlinux/init.hlinux/slab.hsound/core.hsound/cs8427.hsound/asoundef.hice1712.hews.hsound/cs8403.h
Detected Declarations
struct ews_specfunction modefunction ewx_i2c_getclockfunction ewx_i2c_getdatafunction ewx_i2c_startfunction ewx_i2c_stopfunction ewx_i2c_directionfunction snd_ice1712_ews88mt_chip_selectfunction ews88mt_ak4524_lockfunction ews88mt_ak4524_unlockfunction ewx2496_ak4524_lockfunction dmx6fire_ak4524_lockfunction snd_ice1712_ews_cs8404_spdif_writefunction ews88_spdif_default_getfunction ews88_spdif_default_putfunction ews88_spdif_stream_getfunction ews88_spdif_stream_putfunction ews88_open_spdiffunction ews88_setup_spdiffunction scoped_guardfunction snd_ice1712_ews_initfunction snd_ice1712_ewx_io_sense_infofunction snd_ice1712_ewx_io_sense_getfunction snd_ice1712_ewx_io_sense_putfunction snd_ice1712_ews88mt_output_sense_getfunction snd_ice1712_ews88mt_output_sense_putfunction snd_ice1712_ews88mt_input_sense_getfunction snd_ice1712_ews88mt_input_sense_putfunction snd_ice1712_ews88d_control_getfunction snd_ice1712_ews88d_control_putfunction snd_i2c_sendbytesfunction snd_ice1712_6fire_read_pcafunction snd_ice1712_6fire_write_pcafunction snd_ice1712_6fire_control_getfunction snd_ice1712_6fire_control_putfunction snd_ice1712_6fire_select_input_infofunction snd_ice1712_6fire_select_input_getfunction snd_ice1712_6fire_select_input_putfunction snd_ice1712_ews_add_controls
Annotated Snippet
struct ews_spec {
struct snd_i2c_device *i2cdevs[3];
};
/*
* access via i2c mode (for EWX 24/96, EWS 88MT&D)
*/
/* send SDA and SCL */
static void ewx_i2c_setlines(struct snd_i2c_bus *bus, int clk, int data)
{
struct snd_ice1712 *ice = bus->private_data;
unsigned char tmp = 0;
if (clk)
tmp |= ICE1712_EWX2496_SERIAL_CLOCK;
if (data)
tmp |= ICE1712_EWX2496_SERIAL_DATA;
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
udelay(5);
}
static int ewx_i2c_getclock(struct snd_i2c_bus *bus)
{
struct snd_ice1712 *ice = bus->private_data;
return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_CLOCK ? 1 : 0;
}
static int ewx_i2c_getdata(struct snd_i2c_bus *bus, int ack)
{
struct snd_ice1712 *ice = bus->private_data;
int bit;
/* set RW pin to low */
snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_RW);
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, 0);
if (ack)
udelay(5);
bit = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_DATA ? 1 : 0;
/* set RW pin to high */
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, ICE1712_EWX2496_RW);
/* reset write mask */
snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_SERIAL_CLOCK);
return bit;
}
static void ewx_i2c_start(struct snd_i2c_bus *bus)
{
struct snd_ice1712 *ice = bus->private_data;
unsigned char mask;
snd_ice1712_save_gpio_status(ice);
/* set RW high */
mask = ICE1712_EWX2496_RW;
switch (ice->eeprom.subvendor) {
case ICE1712_SUBDEVICE_EWX2496:
mask |= ICE1712_EWX2496_AK4524_CS; /* CS high also */
break;
case ICE1712_SUBDEVICE_DMX6FIRE:
mask |= ICE1712_6FIRE_AK4524_CS_MASK; /* CS high also */
break;
}
snd_ice1712_gpio_write_bits(ice, mask, mask);
}
static void ewx_i2c_stop(struct snd_i2c_bus *bus)
{
struct snd_ice1712 *ice = bus->private_data;
snd_ice1712_restore_gpio_status(ice);
}
static void ewx_i2c_direction(struct snd_i2c_bus *bus, int clock, int data)
{
struct snd_ice1712 *ice = bus->private_data;
unsigned char mask = 0;
if (clock)
mask |= ICE1712_EWX2496_SERIAL_CLOCK; /* write SCL */
if (data)
mask |= ICE1712_EWX2496_SERIAL_DATA; /* write SDA */
ice->gpio.direction &= ~(ICE1712_EWX2496_SERIAL_CLOCK|ICE1712_EWX2496_SERIAL_DATA);
ice->gpio.direction |= mask;
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->gpio.direction);
snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~mask);
}
static struct snd_i2c_bit_ops snd_ice1712_ewx_cs8427_bit_ops = {
.start = ewx_i2c_start,
.stop = ewx_i2c_stop,
.direction = ewx_i2c_direction,
.setlines = ewx_i2c_setlines,
.getclock = ewx_i2c_getclock,
Annotation
- Immediate include surface: `linux/delay.h`, `linux/interrupt.h`, `linux/init.h`, `linux/slab.h`, `sound/core.h`, `sound/cs8427.h`, `sound/asoundef.h`, `ice1712.h`.
- Detected declarations: `struct ews_spec`, `function mode`, `function ewx_i2c_getclock`, `function ewx_i2c_getdata`, `function ewx_i2c_start`, `function ewx_i2c_stop`, `function ewx_i2c_direction`, `function snd_ice1712_ews88mt_chip_select`, `function ews88mt_ak4524_lock`, `function ews88mt_ak4524_unlock`.
- Atlas domain: Driver Families / sound/pci.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.