diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2017-03-23 09:44:36 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-03-23 09:44:35 -0700 |
| commit | de85a911ed0b04b0aad35f7deebd9bdeeee32e0f (patch) | |
| tree | 5a66d3dc56151e3a1b8e4a1f104f5424575a9c1f | |
| parent | f2e9e4fdd316a6ac1563b61bf33871502aebad17 (diff) | |
| parent | bd01dc59f24581bd81bbe682d41bd490d474f532 (diff) | |
Merge "ASoC: swr-wcd: Reduce latency for cold start on speaker"
| -rw-r--r-- | drivers/soundwire/swr-wcd-ctrl.c | 20 | ||||
| -rwxr-xr-x | drivers/soundwire/swr-wcd-ctrl.h | 7 | ||||
| -rwxr-xr-x | drivers/soundwire/swrm_registers.h | 3 |
3 files changed, 26 insertions, 4 deletions
diff --git a/drivers/soundwire/swr-wcd-ctrl.c b/drivers/soundwire/swr-wcd-ctrl.c index 63bc3961de3b..e72663bd2138 100644 --- a/drivers/soundwire/swr-wcd-ctrl.c +++ b/drivers/soundwire/swr-wcd-ctrl.c @@ -224,6 +224,12 @@ static struct dentry *debugfs_poke; static struct dentry *debugfs_reg_dump; static unsigned int read_data; + +static bool swrm_is_msm_variant(int val) +{ + return (val == SWRM_VERSION_1_3); +} + static int swrm_debug_open(struct inode *inode, struct file *file) { file->private_data = inode->i_private; @@ -514,8 +520,17 @@ static int swrm_cmd_fifo_wr_cmd(struct swr_mstr_ctrl *swrm, u8 cmd_data, __func__, val, ret); goto err; } - if (cmd_id == 0xF) - wait_for_completion_timeout(&swrm->broadcast, (2 * HZ/10)); + if (cmd_id == 0xF) { + /* + * sleep for 10ms for MSM soundwire variant to allow broadcast + * command to complete. + */ + if (swrm_is_msm_variant(swrm->version)) + usleep_range(10000, 10100); + else + wait_for_completion_timeout(&swrm->broadcast, + (2 * HZ/10)); + } err: return ret; } @@ -1472,6 +1487,7 @@ static int swrm_probe(struct platform_device *pdev) mutex_unlock(&swrm->mlock); goto err_mstr_fail; } + swrm->version = swrm->read(swrm->handle, SWRM_COMP_HW_VERSION); /* Enumerate slave devices */ list_for_each_entry_safe(swr_dev, safe, &swrm->master.devices, diff --git a/drivers/soundwire/swr-wcd-ctrl.h b/drivers/soundwire/swr-wcd-ctrl.h index 8992318cdbd3..b7a3edac3e00 100755 --- a/drivers/soundwire/swr-wcd-ctrl.h +++ b/drivers/soundwire/swr-wcd-ctrl.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -23,6 +23,10 @@ #define SWR_MSTR_PORT_LEN 8 /* Number of master ports */ +#define SWRM_VERSION_1_0 0x01010000 +#define SWRM_VERSION_1_2 0x01030000 +#define SWRM_VERSION_1_3 0x01040000 + enum { SWR_MSTR_PAUSE, SWR_MSTR_RESUME, @@ -88,6 +92,7 @@ struct swr_mstr_ctrl { int (*reg_irq)(void *handle, irqreturn_t(*irq_handler)(int irq, void *data), void *swr_handle, int type); int irq; + int version; int num_enum_slaves; int slave_status; struct swr_mstr_port *mstr_port; diff --git a/drivers/soundwire/swrm_registers.h b/drivers/soundwire/swrm_registers.h index c6923f301f9f..50c3ecfdd47d 100755 --- a/drivers/soundwire/swrm_registers.h +++ b/drivers/soundwire/swrm_registers.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -15,6 +15,7 @@ #define SWRM_BASE_ADDRESS 0x00 +#define SWRM_COMP_HW_VERSION SWRM_BASE_ADDRESS #define SWRM_COMP_CFG_ADDR (SWRM_BASE_ADDRESS+0x00000004) #define SWRM_COMP_CFG_RMSK 0x3 #define SWRM_COMP_CFG_IRQ_LEVEL_OR_PULSE_BMSK 0x2 |
