Skip to content

Commit 8f06c87

Browse files
Zichar.ZhangDylan.Wu
authored andcommitted
CIX: update hda driver and put it into hda directory
aligns the driver with the existing HDA subsystem layout, improves code structure, and simplifies future maintenance Signed-off-by: Zichar.Zhang <[email protected]> Signed-off-by: Dylan.Wu" <[email protected]>
1 parent da71ed2 commit 8f06c87

File tree

23 files changed

+1002
-2629
lines changed

23 files changed

+1002
-2629
lines changed

arch/arm64/configs/deepin_arm64_desktop_defconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3310,8 +3310,7 @@ CONFIG_SND_ATMEL_SOC=m
33103310
CONFIG_SND_SOC_CIX=m
33113311
CONFIG_SND_SOC_CDNS_I2S_SC_CIX=m
33123312
CONFIG_SND_SOC_CDNS_I2S_MC_CIX=m
3313-
CONFIG_SND_SOC_IPBLOQ_HDA_CIX=m
3314-
CONFIG_SND_HDACODEC_REALTEK_CIX=m
3313+
CONFIG_SND_HDA_CIX_IPBLOQ=m
33153314
CONFIG_SND_DESIGNWARE_I2S=m
33163315
CONFIG_SND_DESIGNWARE_PCM=y
33173316
CONFIG_SND_SOC_FSL_ASRC=m

drivers/soc/cix/acpi/acpi_resource_lookup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,11 @@ static int reset_lookup_handle(const union acpi_object *obj, void *data)
174174

175175
static int rmem_dev_set_dma(struct device *dev, phys_addr_t base, size_t size)
176176
{
177+
dev_err(dev, "==== dev[%s], dev->dma[%s]", dev ? "1": "NULL", dev->dma_mem ? "1": "NULL");
177178
if (!dev || dev->dma_mem)
178179
return -EINVAL;
180+
dev_err(dev, "==== memblock_is_region_memory[%d], memblock_is_map_memory[%d]",
181+
memblock_is_region_memory(base, size), memblock_is_map_memory(base));
179182

180183
if (!memblock_is_region_memory(base, size)
181184
|| memblock_is_map_memory(base))

include/sound/hda_codec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ struct hda_codec {
258258
unsigned int forced_resume:1; /* forced resume for jack */
259259
unsigned int no_stream_clean_at_suspend:1; /* do not clean streams at suspend */
260260
unsigned int ctl_dev_id:1; /* old control element id build behaviour */
261+
unsigned int reconfig_init_verbs:1; /* need reconfig init verbs when system resume */
261262

262263
#ifdef CONFIG_PM
263264
unsigned long power_on_acct;

include/sound/hdaudio.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ struct hdac_bus {
292292
const struct hdac_bus_ops *ops;
293293
const struct hdac_ext_bus_ops *ext_ops;
294294

295+
/* address translation from host to hdac */
296+
dma_addr_t (*addr_host_to_hdac)(struct hdac_bus *bus, dma_addr_t addr);
297+
298+
/* configure init verbs */
299+
int (*config_init_verbs)(struct hdac_bus *bus, unsigned int vendor_id);
300+
295301
/* h/w resources */
296302
unsigned long addr;
297303
void __iomem *remap_addr;

sound/hda/hdac_controller.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@ static void azx_clear_corbrp(struct hdac_bus *bus)
4343
void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus)
4444
{
4545
WARN_ON_ONCE(!bus->rb.area);
46+
dma_addr_t corb_addr, rirb_addr;
4647

4748
spin_lock_irq(&bus->reg_lock);
4849
/* CORB set up */
4950
bus->corb.addr = bus->rb.addr;
5051
bus->corb.buf = (__le32 *)bus->rb.area;
51-
snd_hdac_chip_writel(bus, CORBLBASE, (u32)bus->corb.addr);
52-
snd_hdac_chip_writel(bus, CORBUBASE, upper_32_bits(bus->corb.addr));
52+
corb_addr = bus->corb.addr;
53+
if (bus->addr_host_to_hdac)
54+
corb_addr = bus->addr_host_to_hdac(bus, bus->corb.addr);
55+
snd_hdac_chip_writel(bus, CORBLBASE, (u32)corb_addr);
56+
snd_hdac_chip_writel(bus, CORBUBASE, upper_32_bits(corb_addr));
5357

5458
/* set the corb size to 256 entries (ULI requires explicitly) */
5559
snd_hdac_chip_writeb(bus, CORBSIZE, 0x02);
@@ -69,8 +73,11 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus)
6973
bus->rirb.buf = (__le32 *)(bus->rb.area + 2048);
7074
bus->rirb.wp = bus->rirb.rp = 0;
7175
memset(bus->rirb.cmds, 0, sizeof(bus->rirb.cmds));
72-
snd_hdac_chip_writel(bus, RIRBLBASE, (u32)bus->rirb.addr);
73-
snd_hdac_chip_writel(bus, RIRBUBASE, upper_32_bits(bus->rirb.addr));
76+
rirb_addr = bus->rirb.addr;
77+
if (bus->addr_host_to_hdac)
78+
rirb_addr = bus->addr_host_to_hdac(bus, bus->rirb.addr);
79+
snd_hdac_chip_writel(bus, RIRBLBASE, (u32)rirb_addr);
80+
snd_hdac_chip_writel(bus, RIRBUBASE, upper_32_bits(rirb_addr));
7481

7582
/* set the rirb size to 256 entries (ULI requires explicitly) */
7683
snd_hdac_chip_writeb(bus, RIRBSIZE, 0x02);
@@ -552,6 +559,8 @@ static void azx_int_clear(struct hdac_bus *bus)
552559
*/
553560
bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)
554561
{
562+
dma_addr_t posbuf_addr;
563+
555564
if (bus->chip_init)
556565
return false;
557566

@@ -569,8 +578,12 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)
569578

570579
/* program the position buffer */
571580
if (bus->use_posbuf && bus->posbuf.addr) {
572-
snd_hdac_chip_writel(bus, DPLBASE, (u32)bus->posbuf.addr);
573-
snd_hdac_chip_writel(bus, DPUBASE, upper_32_bits(bus->posbuf.addr));
581+
posbuf_addr = bus->posbuf.addr;
582+
if (bus->addr_host_to_hdac)
583+
posbuf_addr = bus->addr_host_to_hdac(bus, bus->posbuf.addr);
584+
585+
snd_hdac_chip_writel(bus, DPLBASE, (u32)posbuf_addr);
586+
snd_hdac_chip_writel(bus, DPUBASE, upper_32_bits(posbuf_addr));
574587
}
575588

576589
bus->chip_init = true;

sound/hda/hdac_device.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus,
5050
dev->bus = &snd_hda_bus_type;
5151
dev->release = default_release;
5252
dev->groups = hdac_dev_attr_groups;
53+
dev_set_uevent_suppress(dev, 1);
5354
dev_set_name(dev, "%s", name);
5455
device_enable_async_suspend(dev);
5556

sound/hda/hdac_stream.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ int snd_hdac_stream_setup(struct hdac_stream *azx_dev)
278278
{
279279
struct hdac_bus *bus = azx_dev->bus;
280280
struct snd_pcm_runtime *runtime;
281+
dma_addr_t bdl_addr, posbuf_addr;
281282
unsigned int val;
282283

283284
if (azx_dev->substream)
@@ -305,17 +306,24 @@ int snd_hdac_stream_setup(struct hdac_stream *azx_dev)
305306
snd_hdac_stream_writew(azx_dev, SD_LVI, azx_dev->frags - 1);
306307

307308
/* program the BDL address */
309+
bdl_addr = azx_dev->bdl.addr;
310+
if (bus->addr_host_to_hdac)
311+
bdl_addr = bus->addr_host_to_hdac(bus, azx_dev->bdl.addr);
308312
/* lower BDL address */
309-
snd_hdac_stream_writel(azx_dev, SD_BDLPL, (u32)azx_dev->bdl.addr);
313+
snd_hdac_stream_writel(azx_dev, SD_BDLPL, (u32)bdl_addr);
310314
/* upper BDL address */
311315
snd_hdac_stream_writel(azx_dev, SD_BDLPU,
312-
upper_32_bits(azx_dev->bdl.addr));
316+
upper_32_bits(bdl_addr));
313317

314318
/* enable the position buffer */
315319
if (bus->use_posbuf && bus->posbuf.addr) {
320+
posbuf_addr = bus->posbuf.addr;
321+
if (bus->addr_host_to_hdac)
322+
posbuf_addr = bus->addr_host_to_hdac(bus, bus->posbuf.addr);
323+
316324
if (!(snd_hdac_chip_readl(bus, DPLBASE) & AZX_DPLBASE_ENABLE))
317325
snd_hdac_chip_writel(bus, DPLBASE,
318-
(u32)bus->posbuf.addr | AZX_DPLBASE_ENABLE);
326+
(u32)posbuf_addr| AZX_DPLBASE_ENABLE);
319327
}
320328

321329
/* set the interrupt enable bits in the descriptor control register */
@@ -475,6 +483,9 @@ static int setup_bdle(struct hdac_bus *bus,
475483
return -EINVAL;
476484

477485
addr = snd_sgbuf_get_addr(dmab, ofs);
486+
if (bus->addr_host_to_hdac)
487+
addr = bus->addr_host_to_hdac(bus, addr);
488+
478489
/* program the address field of the BDL entry */
479490
bdl[0] = cpu_to_le32((u32)addr);
480491
bdl[1] = cpu_to_le32(upper_32_bits(addr));

sound/pci/hda/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ config SND_HDA_TEGRA
5858
To compile this driver as a module, choose M here: the module
5959
will be called snd-hda-tegra.
6060

61+
config SND_HDA_CIX_IPBLOQ
62+
tristate "CIX IPBLOQ HD Audio"
63+
select SND_HDA
64+
select SND_HDA_ALIGNED_MMIO
65+
help
66+
Say Y here to support the HDA controller present in CIX SoCs
67+
68+
This options enables support for the HD Audio controller
69+
present in some CIX SoCs.
70+
71+
To compile this driver as a module, choose M here: the module
72+
will be called snd-hda-cix-ipbloq.
73+
6174
if SND_HDA
6275

6376
config SND_HDA_HWDEP

sound/pci/hda/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
snd-hda-intel-objs := hda_intel.o
33
snd-hda-tegra-objs := hda_tegra.o
44
snd-hda-phytium-objs := hda_phytium.o
5+
snd-hda-cix-ipbloq-objs := hda_cix_ipbloq.o
56

67
snd-hda-codec-y := hda_bind.o hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o
78
snd-hda-codec-y += hda_controller.o
@@ -72,3 +73,4 @@ obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_I2C) += snd-hda-scodec-tas2781-i2c.o
7273
obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
7374
obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o
7475
obj-$(CONFIG_SND_HDA_PHYTIUM) += snd-hda-phytium.o
76+
obj-$(CONFIG_SND_HDA_CIX_IPBLOQ) += snd-hda-cix-ipbloq.o

0 commit comments

Comments
 (0)