Skip to content

Commit c4901f5

Browse files
CL WangMina-Chou
authored andcommitted
The FTSSDP010 DMA driver init is adjusted to occur after ATCDMAC300(torvalds#261)
Due to the change in the ATCDMAC300 DMA engine driver's initialization order 'commit 4267e26 ("[backport] Support AIA extension on Andes ae350 platform (torvalds#240)")', the FTSSP010 DMA driver must be initialized after ATCDMAC300 to ensure proper DMA functionality. Reviewed-on: https://gitea.andestech.com/RD-SW/linux/pulls/261 Reviewed-by: Tim Shih-Ting OuYang <[email protected]> Reviewed-by: Charles Ci-Jyun Wu <[email protected]> Reviewed-by: randolph <[email protected]> Co-authored-by: CL Wang <[email protected]> Co-committed-by: CL Wang <[email protected]>
1 parent 2b66d6e commit c4901f5

File tree

3 files changed

+37
-45
lines changed

3 files changed

+37
-45
lines changed

sound/v5/ftssp010_alsa.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,11 +1433,16 @@ static int atf_ac97_probe(struct platform_device *pdev)
14331433
return -ENXIO;
14341434
}
14351435

1436+
ret = dmad_init();
1437+
if (ret)
1438+
return ret;
1439+
14361440
return ftssp_alsa_init(pdev);
14371441
}
14381442

14391443
static void atf_ac97_remove(struct platform_device *pdev)
14401444
{
1445+
dmad_release();
14411446
return ftssp_alsa_i2c_i2s_exit();
14421447
}
14431448

sound/v5/ftssp010_dma.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,12 +2342,3 @@ int dmad_release(void)
23422342

23432343
return 0;
23442344
}
2345-
2346-
subsys_initcall(dmad_init);
2347-
2348-
static void __exit dmad_exit(void)
2349-
{
2350-
dmad_release();
2351-
}
2352-
2353-
module_exit(dmad_exit);

sound/v5/ftssp010_dma.h

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -410,44 +410,40 @@ typedef struct dmad_drb {
410410

411411
} dmad_drb;
412412

413-
/******************************************************************************
414-
* DMAD Driver Interface
415-
******************************************************************************/
416-
extern int dmad_channel_alloc(dmad_chreq *ch_req);
417-
extern int dmad_channel_free(dmad_chreq *ch_req);
418-
extern int dmad_channel_enable(const dmad_chreq *ch_req, u8 enable);
419-
extern u32 dmad_max_size_per_drb(dmad_chreq *ch_req);
420-
extern u32 dmad_bytes_to_cycles(dmad_chreq *ch_req, u32 byte_size);
421-
422-
extern int dmad_kickoff_requests(dmad_chreq *ch_req);
423-
extern int dmad_drain_requests(dmad_chreq *ch_req, u8 shutdown);
424-
425-
/* for performance reason, these two functions are platform-specific */
426-
extern int dmad_probe_irq_source_ahb(void);
427-
/* note: hw_ptr here is phyical address of dma source or destination */
428-
extern dma_addr_t dmad_probe_hw_ptr_src(dmad_chreq *ch_req);
429-
extern dma_addr_t dmad_probe_hw_ptr_dst(dmad_chreq *ch_req);
413+
/* DMAD Driver Interface */
414+
int dmad_init(void);
415+
int dmad_release(void);
416+
int dmad_channel_alloc(dmad_chreq *ch_req);
417+
int dmad_channel_free(dmad_chreq *ch_req);
418+
int dmad_channel_enable(const dmad_chreq *ch_req, u8 enable);
419+
u32 dmad_max_size_per_drb(dmad_chreq *ch_req);
420+
u32 dmad_bytes_to_cycles(dmad_chreq *ch_req, u32 byte_size);
421+
int dmad_kickoff_requests(dmad_chreq *ch_req);
422+
int dmad_drain_requests(dmad_chreq *ch_req, u8 shutdown);
423+
424+
/* For performance reasons, these two functions are platform specific. */
425+
int dmad_probe_irq_source_ahb(void);
426+
427+
/* Note: hw_ptr here is phyical address of dma source or destination. */
428+
dma_addr_t dmad_probe_hw_ptr_src(dmad_chreq *ch_req);
429+
dma_addr_t dmad_probe_hw_ptr_dst(dmad_chreq *ch_req);
430+
431+
/* Routines are only valid in discrete (non-ring) mode */
432+
int dmad_config_channel_dir(dmad_chreq *ch_req, u8 dir, dmad_drb *drb);
433+
int dmad_alloc_drb(dmad_chreq *ch_req, dmad_drb **drb);
434+
int dmad_free_drb(dmad_chreq *ch_req, dmad_drb *drb);
435+
int dmad_submit_request(dmad_chreq *ch_req, dmad_drb *drb, u8 keep_fired);
436+
int dmad_withdraw_request(dmad_chreq *ch_req, dmad_drb *drb);
430437

431-
/*****************************************************************************
432-
* routines only valid in discrete (non-ring) mode
433-
*/
434-
extern int dmad_config_channel_dir(dmad_chreq *ch_req, u8 dir, dmad_drb *drb);
435-
extern int dmad_alloc_drb(dmad_chreq *ch_req, dmad_drb **drb);
436-
extern int dmad_free_drb(dmad_chreq *ch_req, dmad_drb *drb);
437-
extern int dmad_submit_request(dmad_chreq *ch_req,
438-
dmad_drb *drb, u8 keep_fired);
439-
extern int dmad_withdraw_request(dmad_chreq *ch_req, dmad_drb *drb);
440-
/****************************************************************************/
441-
442-
/*****************************************************************************
443-
* routines only valid in ring mode
444-
* note: sw_ptr and hw_ptr are values offset from the ring buffer base
445-
* unit of sw_ptr is data-width
446-
* unit of hw_ptr returned is byte
438+
/*
439+
* Routines are only valid in ring mode
440+
* Note: sw_ptr and hw_ptr are values offset from the ring buffer base
441+
* - Unit of sw_ptr is data width
442+
* - Unit of hw_ptr returned is byte
447443
*/
448444
int dmad_update_ring(dmad_chreq *ch_req);
449-
int dmad_update_ring_sw_ptr(dmad_chreq *ch_req,
450-
dma_addr_t sw_ptr, u8 keep_fired);
445+
int dmad_update_ring_sw_ptr(dmad_chreq *ch_req, dma_addr_t sw_ptr,
446+
u8 keep_fired);
451447
dma_addr_t dmad_probe_ring_hw_ptr(dmad_chreq *ch_req);
452448

453-
#endif /* __NDS_DMAD_ATF_INC__ */
449+
#endif

0 commit comments

Comments
 (0)