Skip to content

Commit 84049e2

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: Intel: avs: Remove unused IRQ-related code
Most IRQ-related code is duplicated in the driver. Switch to the new implementation and remove unused members. While the change is non-trivial, from functional perspective status quo is achieved. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20240419084857.2719593-3-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 7ce6cee commit 84049e2

9 files changed

Lines changed: 7 additions & 249 deletions

File tree

sound/soc/intel/avs/apl.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@ const struct avs_dsp_ops avs_apl_dsp_ops = {
255255
.reset = avs_dsp_core_reset,
256256
.stall = avs_dsp_core_stall,
257257
.dsp_interrupt = avs_apl_dsp_interrupt,
258-
.irq_handler = avs_irq_handler,
259-
.irq_thread = avs_skl_irq_thread,
260258
.int_control = avs_dsp_interrupt_control,
261259
.load_basefw = avs_hda_load_basefw,
262260
.load_lib = avs_hda_load_library,

sound/soc/intel/avs/avs.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ struct avs_dsp_ops {
4747
int (* const reset)(struct avs_dev *, u32, bool);
4848
int (* const stall)(struct avs_dev *, u32, bool);
4949
irqreturn_t (* const dsp_interrupt)(struct avs_dev *);
50-
irqreturn_t (* const irq_handler)(struct avs_dev *);
51-
irqreturn_t (* const irq_thread)(struct avs_dev *);
5250
void (* const int_control)(struct avs_dev *, bool);
5351
int (* const load_basefw)(struct avs_dev *, struct firmware *);
5452
int (* const load_lib)(struct avs_dev *, struct firmware *, u32);
@@ -246,7 +244,6 @@ struct avs_ipc {
246244
#define AVS_IPC_RET(ret) \
247245
(((ret) <= 0) ? (ret) : -AVS_EIPC)
248246

249-
irqreturn_t avs_irq_handler(struct avs_dev *adev);
250247
void avs_dsp_process_response(struct avs_dev *adev, u64 header);
251248
int avs_dsp_send_msg_timeout(struct avs_dev *adev, struct avs_ipc_msg *request,
252249
struct avs_ipc_msg *reply, int timeout, const char *name);
@@ -268,8 +265,6 @@ void avs_ipc_block(struct avs_ipc *ipc);
268265
int avs_dsp_disable_d0ix(struct avs_dev *adev);
269266
int avs_dsp_enable_d0ix(struct avs_dev *adev);
270267

271-
irqreturn_t avs_skl_irq_thread(struct avs_dev *adev);
272-
irqreturn_t avs_cnl_irq_thread(struct avs_dev *adev);
273268
void avs_skl_ipc_interrupt(struct avs_dev *adev);
274269
irqreturn_t avs_cnl_dsp_interrupt(struct avs_dev *adev);
275270
int avs_apl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_period,

sound/soc/intel/avs/cldma.c

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -248,28 +248,6 @@ void hda_cldma_setup(struct hda_cldma *cl)
248248
snd_hdac_stream_writel(cl, CL_SPBFCTL, 1);
249249
}
250250

251-
static irqreturn_t cldma_irq_handler(int irq, void *dev_id)
252-
{
253-
struct hda_cldma *cl = dev_id;
254-
u32 adspis;
255-
256-
adspis = snd_hdac_adsp_readl(cl, AVS_ADSP_REG_ADSPIS);
257-
if (adspis == UINT_MAX)
258-
return IRQ_NONE;
259-
if (!(adspis & AVS_ADSP_ADSPIS_CLDMA))
260-
return IRQ_NONE;
261-
262-
cl->sd_status = snd_hdac_stream_readb(cl, SD_STS);
263-
dev_warn(cl->dev, "%s sd_status: 0x%08x\n", __func__, cl->sd_status);
264-
265-
/* disable CLDMA interrupt */
266-
snd_hdac_adsp_updatel(cl, AVS_ADSP_REG_ADSPIC, AVS_ADSP_ADSPIC_CLDMA, 0);
267-
268-
complete(&cl->completion);
269-
270-
return IRQ_HANDLED;
271-
}
272-
273251
void hda_cldma_interrupt(struct hda_cldma *cl)
274252
{
275253
/* disable CLDMA interrupt */
@@ -284,44 +262,29 @@ void hda_cldma_interrupt(struct hda_cldma *cl)
284262
int hda_cldma_init(struct hda_cldma *cl, struct hdac_bus *bus, void __iomem *dsp_ba,
285263
unsigned int buffer_size)
286264
{
287-
struct pci_dev *pci = to_pci_dev(bus->dev);
288265
int ret;
289266

290267
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, bus->dev, buffer_size, &cl->dmab_data);
291268
if (ret < 0)
292269
return ret;
293270

294271
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, bus->dev, BDL_SIZE, &cl->dmab_bdl);
295-
if (ret < 0)
296-
goto alloc_err;
272+
if (ret < 0) {
273+
snd_dma_free_pages(&cl->dmab_data);
274+
return ret;
275+
}
297276

298277
cl->dev = bus->dev;
299278
cl->bus = bus;
300279
cl->dsp_ba = dsp_ba;
301280
cl->buffer_size = buffer_size;
302281
cl->sd_addr = dsp_ba + AZX_CL_SD_BASE;
303282

304-
ret = pci_request_irq(pci, 0, cldma_irq_handler, NULL, cl, "CLDMA");
305-
if (ret < 0) {
306-
dev_err(cl->dev, "Failed to request CLDMA IRQ handler: %d\n", ret);
307-
goto req_err;
308-
}
309-
310283
return 0;
311-
312-
req_err:
313-
snd_dma_free_pages(&cl->dmab_bdl);
314-
alloc_err:
315-
snd_dma_free_pages(&cl->dmab_data);
316-
317-
return ret;
318284
}
319285

320286
void hda_cldma_free(struct hda_cldma *cl)
321287
{
322-
struct pci_dev *pci = to_pci_dev(cl->dev);
323-
324-
pci_free_irq(pci, 0, cl);
325288
snd_dma_free_pages(&cl->dmab_data);
326289
snd_dma_free_pages(&cl->dmab_bdl);
327290
}

sound/soc/intel/avs/cnl.c

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,6 @@
1010
#include "avs.h"
1111
#include "messages.h"
1212

13-
irqreturn_t avs_cnl_irq_thread(struct avs_dev *adev)
14-
{
15-
union avs_reply_msg msg;
16-
u32 hipctdr, hipctdd, hipctda;
17-
18-
hipctdr = snd_hdac_adsp_readl(adev, CNL_ADSP_REG_HIPCTDR);
19-
hipctdd = snd_hdac_adsp_readl(adev, CNL_ADSP_REG_HIPCTDD);
20-
21-
/* Ensure DSP sent new response to process. */
22-
if (!(hipctdr & CNL_ADSP_HIPCTDR_BUSY))
23-
return IRQ_NONE;
24-
25-
msg.primary = hipctdr;
26-
msg.ext.val = hipctdd;
27-
avs_dsp_process_response(adev, msg.val);
28-
29-
/* Tell DSP we accepted its message. */
30-
snd_hdac_adsp_updatel(adev, CNL_ADSP_REG_HIPCTDR,
31-
CNL_ADSP_HIPCTDR_BUSY, CNL_ADSP_HIPCTDR_BUSY);
32-
/* Ack this response. */
33-
snd_hdac_adsp_updatel(adev, CNL_ADSP_REG_HIPCTDA,
34-
CNL_ADSP_HIPCTDA_DONE, CNL_ADSP_HIPCTDA_DONE);
35-
/* HW might have been clock gated, give some time for change to propagate. */
36-
snd_hdac_adsp_readl_poll(adev, CNL_ADSP_REG_HIPCTDA, hipctda,
37-
!(hipctda & CNL_ADSP_HIPCTDA_DONE), 10, 1000);
38-
/* Unmask busy interrupt. */
39-
snd_hdac_adsp_updatel(adev, CNL_ADSP_REG_HIPCCTL,
40-
AVS_ADSP_HIPCCTL_BUSY, AVS_ADSP_HIPCCTL_BUSY);
41-
42-
return IRQ_HANDLED;
43-
}
44-
4513
static void avs_cnl_ipc_interrupt(struct avs_dev *adev)
4614
{
4715
const struct avs_spec *spec = adev->spec;
@@ -109,8 +77,6 @@ const struct avs_dsp_ops avs_cnl_dsp_ops = {
10977
.reset = avs_dsp_core_reset,
11078
.stall = avs_dsp_core_stall,
11179
.dsp_interrupt = avs_cnl_dsp_interrupt,
112-
.irq_handler = avs_irq_handler,
113-
.irq_thread = avs_cnl_irq_thread,
11480
.int_control = avs_dsp_interrupt_control,
11581
.load_basefw = avs_hda_load_basefw,
11682
.load_lib = avs_hda_load_library,

sound/soc/intel/avs/core.c

Lines changed: 3 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -257,85 +257,6 @@ static void hdac_update_stream(struct hdac_bus *bus, struct hdac_stream *stream)
257257
}
258258
}
259259

260-
static irqreturn_t hdac_bus_irq_handler(int irq, void *context)
261-
{
262-
struct hdac_bus *bus = context;
263-
u32 mask, int_enable;
264-
u32 status;
265-
int ret = IRQ_NONE;
266-
267-
if (!pm_runtime_active(bus->dev))
268-
return ret;
269-
270-
spin_lock(&bus->reg_lock);
271-
272-
status = snd_hdac_chip_readl(bus, INTSTS);
273-
if (status == 0 || status == UINT_MAX) {
274-
spin_unlock(&bus->reg_lock);
275-
return ret;
276-
}
277-
278-
/* clear rirb int */
279-
status = snd_hdac_chip_readb(bus, RIRBSTS);
280-
if (status & RIRB_INT_MASK) {
281-
if (status & RIRB_INT_RESPONSE)
282-
snd_hdac_bus_update_rirb(bus);
283-
snd_hdac_chip_writeb(bus, RIRBSTS, RIRB_INT_MASK);
284-
}
285-
286-
mask = (0x1 << bus->num_streams) - 1;
287-
288-
status = snd_hdac_chip_readl(bus, INTSTS);
289-
status &= mask;
290-
if (status) {
291-
/* Disable stream interrupts; Re-enable in bottom half */
292-
int_enable = snd_hdac_chip_readl(bus, INTCTL);
293-
snd_hdac_chip_writel(bus, INTCTL, (int_enable & (~mask)));
294-
ret = IRQ_WAKE_THREAD;
295-
} else {
296-
ret = IRQ_HANDLED;
297-
}
298-
299-
spin_unlock(&bus->reg_lock);
300-
return ret;
301-
}
302-
303-
static irqreturn_t hdac_bus_irq_thread(int irq, void *context)
304-
{
305-
struct hdac_bus *bus = context;
306-
u32 status;
307-
u32 int_enable;
308-
u32 mask;
309-
unsigned long flags;
310-
311-
status = snd_hdac_chip_readl(bus, INTSTS);
312-
313-
snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream);
314-
315-
/* Re-enable stream interrupts */
316-
mask = (0x1 << bus->num_streams) - 1;
317-
spin_lock_irqsave(&bus->reg_lock, flags);
318-
int_enable = snd_hdac_chip_readl(bus, INTCTL);
319-
snd_hdac_chip_writel(bus, INTCTL, (int_enable | mask));
320-
spin_unlock_irqrestore(&bus->reg_lock, flags);
321-
322-
return IRQ_HANDLED;
323-
}
324-
325-
static irqreturn_t avs_dsp_irq_handler(int irq, void *dev_id)
326-
{
327-
struct avs_dev *adev = dev_id;
328-
329-
return avs_dsp_op(adev, irq_handler);
330-
}
331-
332-
static irqreturn_t avs_dsp_irq_thread(int irq, void *dev_id)
333-
{
334-
struct avs_dev *adev = dev_id;
335-
336-
return avs_dsp_op(adev, irq_thread);
337-
}
338-
339260
static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus)
340261
{
341262
irqreturn_t ret = IRQ_NONE;
@@ -359,7 +280,6 @@ static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus)
359280
return ret;
360281
}
361282

362-
__maybe_unused
363283
static irqreturn_t avs_hda_irq_handler(int irq, void *dev_id)
364284
{
365285
struct hdac_bus *bus = dev_id;
@@ -375,7 +295,6 @@ static irqreturn_t avs_hda_irq_handler(int irq, void *dev_id)
375295
return IRQ_WAKE_THREAD;
376296
}
377297

378-
__maybe_unused
379298
static irqreturn_t avs_hda_irq_thread(int irq, void *dev_id)
380299
{
381300
struct hdac_bus *bus = dev_id;
@@ -391,16 +310,14 @@ static irqreturn_t avs_hda_irq_thread(int irq, void *dev_id)
391310
return IRQ_HANDLED;
392311
}
393312

394-
__maybe_unused
395-
static irqreturn_t avs_dsp_irq_handler2(int irq, void *dev_id)
313+
static irqreturn_t avs_dsp_irq_handler(int irq, void *dev_id)
396314
{
397315
struct avs_dev *adev = dev_id;
398316

399317
return avs_hda_irq_handler(irq, &adev->base.core);
400318
}
401319

402-
__maybe_unused
403-
static irqreturn_t avs_dsp_irq_thread2(int irq, void *dev_id)
320+
static irqreturn_t avs_dsp_irq_thread(int irq, void *dev_id)
404321
{
405322
struct avs_dev *adev = dev_id;
406323
struct hdac_bus *bus = &adev->base.core;
@@ -429,7 +346,7 @@ static int avs_hdac_acquire_irq(struct avs_dev *adev)
429346
return ret;
430347
}
431348

432-
ret = pci_request_irq(pci, 0, hdac_bus_irq_handler, hdac_bus_irq_thread, bus,
349+
ret = pci_request_irq(pci, 0, avs_hda_irq_handler, avs_hda_irq_thread, bus,
433350
KBUILD_MODNAME);
434351
if (ret < 0) {
435352
dev_err(adev->dev, "Failed to request stream IRQ handler: %d\n", ret);
@@ -610,8 +527,6 @@ static void avs_pci_shutdown(struct pci_dev *pci)
610527
snd_hdac_bus_stop_chip(bus);
611528
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
612529

613-
if (avs_platattr_test(adev, CLDMA))
614-
pci_free_irq(pci, 0, &code_loader);
615530
pci_free_irq(pci, 0, adev);
616531
pci_free_irq(pci, 0, bus);
617532
pci_free_irq_vectors(pci);

sound/soc/intel/avs/icl.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ const struct avs_dsp_ops avs_icl_dsp_ops = {
189189
.reset = avs_dsp_core_reset,
190190
.stall = avs_dsp_core_stall,
191191
.dsp_interrupt = avs_cnl_dsp_interrupt,
192-
.irq_handler = avs_irq_handler,
193-
.irq_thread = avs_cnl_irq_thread,
194192
.int_control = avs_dsp_interrupt_control,
195193
.load_basefw = avs_icl_load_basefw,
196194
.load_lib = avs_hda_load_library,

sound/soc/intel/avs/ipc.c

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -301,54 +301,6 @@ void avs_dsp_process_response(struct avs_dev *adev, u64 header)
301301
complete(&ipc->busy_completion);
302302
}
303303

304-
irqreturn_t avs_irq_handler(struct avs_dev *adev)
305-
{
306-
struct avs_ipc *ipc = adev->ipc;
307-
const struct avs_spec *const spec = adev->spec;
308-
u32 adspis, hipc_rsp, hipc_ack;
309-
irqreturn_t ret = IRQ_NONE;
310-
311-
adspis = snd_hdac_adsp_readl(adev, AVS_ADSP_REG_ADSPIS);
312-
if (adspis == UINT_MAX || !(adspis & AVS_ADSP_ADSPIS_IPC))
313-
return ret;
314-
315-
hipc_ack = snd_hdac_adsp_readl(adev, spec->hipc->ack_offset);
316-
hipc_rsp = snd_hdac_adsp_readl(adev, spec->hipc->rsp_offset);
317-
318-
/* DSP acked host's request */
319-
if (hipc_ack & spec->hipc->ack_done_mask) {
320-
/*
321-
* As an extra precaution, mask done interrupt. Code executed
322-
* due to complete() found below does not assume any masking.
323-
*/
324-
snd_hdac_adsp_updatel(adev, spec->hipc->ctl_offset,
325-
AVS_ADSP_HIPCCTL_DONE, 0);
326-
327-
complete(&ipc->done_completion);
328-
329-
/* tell DSP it has our attention */
330-
snd_hdac_adsp_updatel(adev, spec->hipc->ack_offset,
331-
spec->hipc->ack_done_mask,
332-
spec->hipc->ack_done_mask);
333-
/* unmask done interrupt */
334-
snd_hdac_adsp_updatel(adev, spec->hipc->ctl_offset,
335-
AVS_ADSP_HIPCCTL_DONE,
336-
AVS_ADSP_HIPCCTL_DONE);
337-
ret = IRQ_HANDLED;
338-
}
339-
340-
/* DSP sent new response to process */
341-
if (hipc_rsp & spec->hipc->rsp_busy_mask) {
342-
/* mask busy interrupt */
343-
snd_hdac_adsp_updatel(adev, spec->hipc->ctl_offset,
344-
AVS_ADSP_HIPCCTL_BUSY, 0);
345-
346-
ret = IRQ_WAKE_THREAD;
347-
}
348-
349-
return ret;
350-
}
351-
352304
static bool avs_ipc_is_busy(struct avs_ipc *ipc)
353305
{
354306
struct avs_dev *adev = to_avs_dev(ipc->dev);

0 commit comments

Comments
 (0)