diff options
| author | Ryo Kataoka <ryo.kataoka.wt@renesas.com> | 2014-08-20 20:53:03 -0400 |
|---|---|---|
| committer | Vinod Koul <vinod.koul@intel.com> | 2014-08-28 03:12:10 -0400 |
| commit | b19f40b8bf87bfc32b91260a90a7fa2cdebcd9bb (patch) | |
| tree | 330d7c082128195a1447d982ff5a9aad33130515 | |
| parent | 58d06e989e1321b43c1e42bdf3846113e9e16ecd (diff) | |
dma: rcar-audmapp: Fix for no corresponding slave ID
In case of no corresponding slave ID, the audmapp_set_slave() returns
-ENXIO same as sh_dmae_set_slave() of shdmac.c.
DMAEngine might return wrong channel without this patch
Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
Signed-off-by: Jun Watanabe <jun.watanabe.ue@renesas.com>,
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
| -rw-r--r-- | drivers/dma/sh/rcar-audmapp.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/dma/sh/rcar-audmapp.c b/drivers/dma/sh/rcar-audmapp.c index dabbf0aba2e9..80fd2aeb4870 100644 --- a/drivers/dma/sh/rcar-audmapp.c +++ b/drivers/dma/sh/rcar-audmapp.c | |||
| @@ -117,7 +117,7 @@ static void audmapp_start_xfer(struct shdma_chan *schan, | |||
| 117 | audmapp_write(auchan, chcr, PDMACHCR); | 117 | audmapp_write(auchan, chcr, PDMACHCR); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | static void audmapp_get_config(struct audmapp_chan *auchan, int slave_id, | 120 | static int audmapp_get_config(struct audmapp_chan *auchan, int slave_id, |
| 121 | u32 *chcr, dma_addr_t *dst) | 121 | u32 *chcr, dma_addr_t *dst) |
| 122 | { | 122 | { |
| 123 | struct audmapp_device *audev = to_dev(auchan); | 123 | struct audmapp_device *audev = to_dev(auchan); |
| @@ -131,20 +131,22 @@ static void audmapp_get_config(struct audmapp_chan *auchan, int slave_id, | |||
| 131 | if (!pdata) { /* DT */ | 131 | if (!pdata) { /* DT */ |
| 132 | *chcr = ((u32)slave_id) << 16; | 132 | *chcr = ((u32)slave_id) << 16; |
| 133 | auchan->shdma_chan.slave_id = (slave_id) >> 8; | 133 | auchan->shdma_chan.slave_id = (slave_id) >> 8; |
| 134 | return; | 134 | return 0; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | /* non-DT */ | 137 | /* non-DT */ |
| 138 | 138 | ||
| 139 | if (slave_id >= AUDMAPP_SLAVE_NUMBER) | 139 | if (slave_id >= AUDMAPP_SLAVE_NUMBER) |
| 140 | return; | 140 | return -ENXIO; |
| 141 | 141 | ||
| 142 | for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++) | 142 | for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++) |
| 143 | if (cfg->slave_id == slave_id) { | 143 | if (cfg->slave_id == slave_id) { |
| 144 | *chcr = cfg->chcr; | 144 | *chcr = cfg->chcr; |
| 145 | *dst = cfg->dst; | 145 | *dst = cfg->dst; |
| 146 | break; | 146 | return 0; |
| 147 | } | 147 | } |
| 148 | |||
| 149 | return -ENXIO; | ||
| 148 | } | 150 | } |
| 149 | 151 | ||
| 150 | static int audmapp_set_slave(struct shdma_chan *schan, int slave_id, | 152 | static int audmapp_set_slave(struct shdma_chan *schan, int slave_id, |
| @@ -153,8 +155,11 @@ static int audmapp_set_slave(struct shdma_chan *schan, int slave_id, | |||
| 153 | struct audmapp_chan *auchan = to_chan(schan); | 155 | struct audmapp_chan *auchan = to_chan(schan); |
| 154 | u32 chcr; | 156 | u32 chcr; |
| 155 | dma_addr_t dst; | 157 | dma_addr_t dst; |
| 158 | int ret; | ||
| 156 | 159 | ||
| 157 | audmapp_get_config(auchan, slave_id, &chcr, &dst); | 160 | ret = audmapp_get_config(auchan, slave_id, &chcr, &dst); |
| 161 | if (ret < 0) | ||
| 162 | return ret; | ||
| 158 | 163 | ||
| 159 | if (try) | 164 | if (try) |
| 160 | return 0; | 165 | return 0; |
