sound/hda/controllers/cix-ipbloq.c

Source file repositories/reference/linux-study-clean/sound/hda/controllers/cix-ipbloq.c

File Facts

System
Linux kernel
Corpus path
sound/hda/controllers/cix-ipbloq.c
Extension
.c
Size
10764 bytes
Lines
435
Domain
Driver Families
Bucket
sound/hda
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct cix_ipbloq_hda {
	struct azx chip;
	struct device *dev;
	void __iomem *regs;

	struct reset_control *reset;
	struct clk_bulk_data clocks[2];
	unsigned int nclocks;
};

static const struct hda_controller_ops cix_ipbloq_hda_ops;

static int cix_ipbloq_hda_dev_disconnect(struct snd_device *device)
{
	struct azx *chip = device->device_data;

	chip->bus.shutdown = 1;

	return 0;
}

static int cix_ipbloq_hda_dev_free(struct snd_device *device)
{
	struct azx *chip = device->device_data;

	if (azx_bus(chip)->chip_init) {
		azx_stop_all_streams(chip);
		azx_stop_chip(chip);
	}

	azx_free_stream_pages(chip);
	azx_free_streams(chip);
	snd_hdac_bus_exit(azx_bus(chip));

	return 0;
}

static int cix_ipbloq_hda_probe_codec(struct cix_ipbloq_hda *hda)
{
	struct azx *chip = &hda->chip;
	struct hdac_bus *bus = azx_bus(chip);
	int err;

	to_hda_bus(bus)->bus_probing = 1;

	/* create codec instances */
	err = azx_probe_codecs(chip, 8);
	if (err < 0) {
		dev_err(hda->dev, "probe codecs failed: %d\n", err);
		return err;
	}

	err = azx_codec_configure(chip);
	if (err < 0) {
		dev_err(hda->dev, "codec configure failed: %d\n", err);
		return err;
	}

	err = snd_card_register(chip->card);
	if (err < 0) {
		dev_err(hda->dev, "card register failed: %d\n", err);
		return err;
	}

	chip->running = 1;

	to_hda_bus(bus)->bus_probing = 0;

	snd_hda_set_power_save(&chip->bus, CIX_IPBLOQ_POWER_SAVE_DEFAULT_TIME_MS);

	return 0;
}

static int cix_ipbloq_hda_init(struct cix_ipbloq_hda *hda,
			       struct azx *chip,
			       struct platform_device *pdev)
{
	const char *sname = NULL, *drv_name = "cix-ipbloq-hda";
	struct hdac_bus *bus = azx_bus(chip);
	struct snd_card *card = chip->card;
	struct resource *res;
	unsigned short gcap;
	int irq_id, err;

	hda->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
	if (IS_ERR(hda->regs)) {
		dev_err(hda->dev, "failed to get and ioremap resource\n");
		return PTR_ERR(hda->regs);
	}
	bus->remap_addr = hda->regs;

Annotation

Implementation Notes