diff options
author | Vinod Koul <vinod.koul@intel.com> | 2018-03-12 14:57:00 +0530 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2018-03-12 14:57:00 +0530 |
commit | 27f947d0b46b2e083da7652f59fc3dd2e2018dba (patch) | |
tree | 6ed65a62d0ade0300ee663eea24eee852e18a2c5 | |
parent | feb38c0335cd9eb1fbda54e58b58d59ee55988ef (diff) | |
download | sdw_old-topic/vkoul/sdw_remove_ml3.tar.gz |
patch 10 fixes: soundwire: cdns: Add port routinestopic/vkoul/sdw_remove_ml3
Fixes to patch 10. Some code logic and cleanups
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/soundwire/cadence_master.c | 45 | ||||
-rw-r--r-- | drivers/soundwire/intel.c | 2 |
2 files changed, 29 insertions, 18 deletions
diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 8292561687b23..fe4b6a55c37a9 100644 --- a/drivers/soundwire/cadence_master.c +++ b/drivers/soundwire/cadence_master.c @@ -690,7 +690,7 @@ EXPORT_SYMBOL(sdw_cdns_enable_interrupt); static int cdns_allocate_pdi(struct sdw_cdns *cdns, struct sdw_cdns_pdi **stream, - u32 start, u32 num, u32 pdi_offset, bool pcm) + u32 start, u32 num, u32 pdi_offset) { struct sdw_cdns_pdi *pdi; int i; @@ -721,8 +721,7 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, struct sdw_cdns_stream_config config) { struct sdw_cdns_streams *stream; - int off = CDNS_PCM_PDI_OFFSET; - int i, ret; + int offset, i, ret; cdns->pcm.num_bd = config.pcm_bd; cdns->pcm.num_in = config.pcm_in; @@ -736,21 +735,25 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, /* First two PDIs are reserved for bulk transfers */ stream->num_bd -= CDNS_PCM_PDI_OFFSET; + offset = CDNS_PCM_PDI_OFFSET; - ret = cdns_allocate_pdi(cdns, &stream->bd, 0, stream->num_bd, off, 1); + ret = cdns_allocate_pdi(cdns, &stream->bd, 0, + stream->num_bd, offset); if (ret) goto pcm_error; - off += stream->num_bd; + offset += stream->num_bd; - ret = cdns_allocate_pdi(cdns, &stream->in, 0, stream->num_in, off, 1); + ret = cdns_allocate_pdi(cdns, &stream->in, 0, + stream->num_in, offset); if (ret) goto pcm_error; - off += stream->num_in; + offset += stream->num_in; - ret = cdns_allocate_pdi(cdns, &stream->out, 0, stream->num_out, off, 1); + ret = cdns_allocate_pdi(cdns, &stream->out, 0, + stream->num_out, offset); if (ret) goto pcm_error; @@ -760,20 +763,23 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, /* Allocate PDIs for PDMs */ stream = &cdns->pdm; - off = CDNS_PDM_PDI_OFFSET; - ret = cdns_allocate_pdi(cdns, &stream->bd, 0, stream->num_bd, off, 0); + offset = CDNS_PDM_PDI_OFFSET; + ret = cdns_allocate_pdi(cdns, &stream->bd, 0, + stream->num_bd, offset); if (ret) goto pdm_error; - off += stream->num_bd; + offset += stream->num_bd; - ret = cdns_allocate_pdi(cdns, &stream->in, 0, stream->num_in, off, 0); + ret = cdns_allocate_pdi(cdns, &stream->in, 0, + stream->num_in, offset); if (ret) goto pdm_error; - off += stream->num_in; + offset += stream->num_in; - ret = cdns_allocate_pdi(cdns, &stream->out, 0, stream->num_out, off, 0); + ret = cdns_allocate_pdi(cdns, &stream->out, 0, + stream->num_out, offset); if (ret) goto pdm_error; @@ -783,12 +789,14 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, cdns->ports = devm_kcalloc(cdns->dev, cdns->num_ports, sizeof(*cdns->ports), GFP_KERNEL); - if (!cdns->ports) + if (!cdns->ports) { + ret = -ENOMEM; goto pdm_error; + } for (i = 0; i < cdns->num_ports; i++) { cdns->ports[i].assigned = false; - cdns->ports[i].num = i + 1; + cdns->ports[i].num = i + 1; /* Port 0 reserved for bulk */ } return 0; @@ -874,6 +882,11 @@ int cdns_bus_conf(struct sdw_bus *bus, struct sdw_bus_params *params) int mcp_clkctrl_off, mcp_clkctrl; int divider; + if (!params->curr_dr_freq) { + dev_err(cdns->dev, "NULL curr_dr_freq"); + return -EINVAL; + } + divider = (params->max_dr_freq / params->curr_dr_freq) - 1; if (params->next_bank) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 4b6518d6188ba..93dd336d4386d 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -906,8 +906,6 @@ static struct sdw_master_ops sdw_intel_ops = { .xfer_msg_defer = cdns_xfer_msg_defer, .reset_page_addr = cdns_reset_page_addr, .set_bus_conf = cdns_bus_conf, - .pre_bank_switch = NULL, - .post_bank_switch = NULL, }; /* |