diff options
author | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | 2019-05-24 13:52:44 +0100 |
---|---|---|
committer | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | 2019-05-24 13:52:44 +0100 |
commit | 54c8f7e76706b805ba473c976847017f1ca3d990 (patch) | |
tree | 1c0de3374ccfc8275b1bacaf48027c965309c9a1 | |
parent | 3f034f76525ea3736acb4ab091581023fc48d6e7 (diff) |
local changeswip/soundwire-v2
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
-rw-r--r-- | drivers/soundwire/bus.c | 8 | ||||
-rw-r--r-- | drivers/soundwire/qcom.c | 164 | ||||
-rw-r--r-- | drivers/soundwire/stream.c | 19 | ||||
-rw-r--r-- | include/linux/soundwire/sdw.h | 3 | ||||
-rw-r--r-- | sound/soc/codecs/wsa881x.c | 90 |
5 files changed, 188 insertions, 96 deletions
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 808f3bd1135d4..04f2b211b3f69 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -620,12 +620,12 @@ int sdw_configure_dpn_intr(struct sdw_slave *slave, val &= ~(mask); val &= ~SDW_DPN_INT_PORT_READY; } - +#if 0 ret = sdw_update(slave, addr, (mask | SDW_DPN_INT_PORT_READY), val); if (ret < 0) dev_err(slave->bus->dev, "SDW_DPN_INTMASK write failed:%d", val); - +#endif return ret; } @@ -634,7 +634,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave) struct sdw_slave_prop *prop = &slave->prop; int ret; u8 val; - +#if 0 /* * Set bus clash, parity and SCP implementation * defined interrupt mask @@ -666,7 +666,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave) "SDW_DP0_INTMASK read failed:%d", ret); return val; } - +#endif return 0; } diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index c7b3cc0fa24e9..c05ca35675765 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -104,9 +104,7 @@ #define SWM_MCP_STATUS_BANK_NUM_MASK BIT(0) #define SWM_MCP_SLV_STATUS 0x1090 #define SWM_MCP_SLV_STATUS_MASK GENMASK(1, 0) -#define SWM_DP_PORT_CTRL_BANK(n, m) (0x1124 + \ - 0x100*(n-1) + \ - 0x40*m) +#define SWM_DP_PORT_CTRL_BANK(n, m) (0x1124 + 0x100*(n-1) + 0x40*m) #define SWM_DP_PORT_CTRL_EN_CHAN_SHFT 0x18 #define SWM_DP_PORT_CTRL_OFFSET2_SHFT 0x10 #define SWM_DP_PORT_CTRL_OFFSET1_SHFT 0x08 @@ -135,20 +133,23 @@ struct qcom_swm_ctrl { int fifo_status; void __iomem *base; struct mutex lock; + struct mutex rlock; struct clk *hclk; + u8 wr_cmd_id; + u8 rd_cmd_id; int irq; unsigned int version; struct wcd934x_data *data; struct slim_device *slim; enum sdw_slave_status status[SDW_MAX_DEVICES]; - int (*reg_read)(struct qcom_swm_ctrl *ctrl, int reg); + u32 (*reg_read)(struct qcom_swm_ctrl *ctrl, int reg); int (*reg_write)(struct qcom_swm_ctrl *ctrl, int reg, int val); }; -static int qcom_swm_slim_reg_read(struct qcom_swm_ctrl *ctrl, int reg) +static u32 qcom_swm_slim_reg_read(struct qcom_swm_ctrl *ctrl, int reg) { struct regmap *wcd_regmap = ctrl->regmap; - int val = 0, ret; + u32 val = 0, ret; regmap_bulk_write(wcd_regmap, WCD934X_SWM_AHB_BRIDGE_RD_ADDR_0, (u8 *)®, 4); @@ -160,7 +161,7 @@ static int qcom_swm_slim_reg_read(struct qcom_swm_ctrl *ctrl, int reg) return val; } -static int qcom_swm_mmio_reg_read(struct qcom_swm_ctrl *ctrl, int reg) +static u32 qcom_swm_mmio_reg_read(struct qcom_swm_ctrl *ctrl, int reg) { return readl_relaxed(ctrl->base + reg); } @@ -184,10 +185,15 @@ static int qcom_swm_slim_reg_write(struct qcom_swm_ctrl *ctrl, int reg, int val) buf[0] = val; buf[1] = reg; +// if ((val &0xFFFF) == 0x70) +// dump_stack(); + +// if (reg != 0x304) { if (reg == 0x300) pr_err("SWRS-W: %x-> %x \n", val & 0xFFFF, 0xff &(val >> 24)); else pr_err("SWR-W: %x-> %x \n", reg, val); + //} regmap_bulk_write(wcd_regmap, WCD934X_SWM_AHB_BRIDGE_WR_DATA_0, (u8 *)&val, 4); /* write address register */ @@ -197,19 +203,40 @@ static int qcom_swm_slim_reg_write(struct qcom_swm_ctrl *ctrl, int reg, int val) return 0; } +static u8 qcom_swm_get_next_cmd_id(u8 *cmd_id) +{ + u32 val; + u8 id = *cmd_id; + + //SPECIAL Command + if (id != 0x0F) { + if (id < 14) + id += 1; + else + id = 0; + *cmd_id = id; + } + + return *cmd_id; +} int qcom_swm_ni_writes; #define TIMEOUT_MS 1000 + static int qcom_swm_cmd_fifo_wr_cmd(struct qcom_swm_ctrl *ctrl, u8 cmd_data, u8 dev_addr, u16 reg_addr) { u32 val; int ret = 0; - int cmd_id = 0; + u8 cmd_id = 0; // if (!qcom_swm_ni_writes) // return 0; mutex_lock(&ctrl->lock); - + if (dev_addr == SDW_BROADCAST_DEV_NUM) + cmd_id = 0xF; + else + cmd_id = qcom_swm_get_next_cmd_id(&ctrl->wr_cmd_id); +// pr_err("DEBUG: %s: cmd_id %x \n", __func__, cmd_id); val = SWM_REG_VAL_PACK(cmd_data, dev_addr, cmd_id, reg_addr); ret = ctrl->reg_write(ctrl, SWM_CMD_FIFO_WR_CMD, val); if (ret < 0) { @@ -218,6 +245,17 @@ static int qcom_swm_cmd_fifo_wr_cmd(struct qcom_swm_ctrl *ctrl, u8 cmd_data, goto err; } + if (cmd_id == 0xf) { + ctrl->fifo_status = 0; + ret = wait_for_completion_timeout(&ctrl->fifo_comp, msecs_to_jiffies(TIMEOUT_MS)); + + if (!ret || ctrl->fifo_status) { + dev_err(ctrl->dev, "%s: reg 0x%x write failed, err:%d\n", + __func__, val, ctrl->fifo_status); + ret = -ENODATA; + goto err; + } + } err: mutex_unlock(&ctrl->lock); return ret; @@ -229,12 +267,17 @@ static int qcom_swm_cmd_fifo_rd_cmd(struct qcom_swm_ctrl *ctrl, { int i, ret = 0; u32 val; - int cmd_id = 0; + u8 cmd_id = 0; + int nwords = (len + 3)/4; + u32 *vals = (u32 *) rval; mutex_lock(&ctrl->lock); if (reg_addr == SDW_SCP_DEVID_0) cmd_id = 0xf; + else + cmd_id = qcom_swm_get_next_cmd_id(&ctrl->rd_cmd_id); + //pr_err("DEBUG: %s: cmd_id %x words %d vs len%d\n", __func__, cmd_id, nwords, len); val = SWM_REG_VAL_PACK(len, dev_addr, cmd_id, reg_addr); ret = ctrl->reg_write(ctrl, SWM_CMD_FIFO_RD_CMD, val); if (ret < 0) { @@ -243,7 +286,7 @@ static int qcom_swm_cmd_fifo_rd_cmd(struct qcom_swm_ctrl *ctrl, goto err; } - if (cmd_id) { + if (cmd_id == 0xf) { ctrl->fifo_status = 0; ret = wait_for_completion_timeout(&ctrl->fifo_comp, msecs_to_jiffies(TIMEOUT_MS)); @@ -254,8 +297,13 @@ static int qcom_swm_cmd_fifo_rd_cmd(struct qcom_swm_ctrl *ctrl, goto err; } } - for (i = 0; i < len; i++) - rval[i] = ctrl->reg_read(ctrl, SWM_CMD_FIFO_RD_FIFO_ADDR) & 0xff; + for (i = 0; i < len; i++) { + rval[i] = ctrl->reg_read(ctrl, SWM_CMD_FIFO_RD_FIFO_ADDR); +// pr_err("DEBUG: %s: val[%d] = %x\n", __func__, i, rval[i]); + rval[i] &= 0xFF; + } + + err: mutex_unlock(&ctrl->lock); @@ -274,6 +322,7 @@ static void qcom_swm_get_device_status(struct qcom_swm_ctrl *ctrl) s = (val >> (i * 2)); s &= SWM_MCP_SLV_STATUS_MASK; ctrl->status[i] = s; + pr_err("DEBUG: %s: slv-%d status %x \n", __func__, i, s); } } @@ -284,13 +333,54 @@ static irqreturn_t qcom_swm_irq_handler(int irq, void *dev_id) sts = ctrl->reg_read(ctrl, SWM_INTERRUPT_STATUS); + if (sts & SWM_INTERRUPT_STATUS_SLAVE_PEND_IRQ) { + dev_err(ctrl->dev, "SWR-IRQ:: slave pend irq\n"); + //qcom_swm_get_device_status(ctrl); + // schedule_work(&ctrl->slave_work); + } + + if (sts & SWM_INTERRUPT_STATUS_NEW_SLAVE_ATTACHED) + dev_err(ctrl->dev, "SWR-IRQ:: new slave attached\n"); + + if (sts & SWM_INTERRUPT_STATUS_MASTER_CLASH_DET) + dev_err_ratelimited(ctrl->dev, "SWR-IRQ:: bus clash detected\n"); + + if (sts & SWM_INTERRUPT_STATUS_RD_FIFO_OVERFLOW) + dev_err(ctrl->dev, "SWR-IRQ:: read FIFO overflow\n"); + + if (sts & SWM_INTERRUPT_STATUS_RD_FIFO_UNDERFLOW) + dev_err(ctrl->dev, "SWR-IRQ:: read FIFO underflow\n"); + + if (sts & SWM_INTERRUPT_STATUS_WR_CMD_FIFO_OVERFLOW) + dev_err(ctrl->dev, "SWR-IRQ:: write FIFO overflow\n"); + + if (sts & SWM_INTERRUPT_STATUS_DOUT_PORT_COLLISION) + dev_err(ctrl->dev, "SWR-IRQ:: Port collision detected\n"); + + if (sts & SWM_INTERRUPT_STATUS_READ_EN_RD_VALID_MISMATCH) + dev_err(ctrl->dev, "SWR-IRQ:: read enable valid mismatch\n"); + + if (sts & SWM_INTERRUPT_STATUS_SPECIAL_CMD_ID_FINISHED) + dev_err(ctrl->dev, "SWR-IRQ:: cmd id finished\n"); + + if (sts & SWM_INTERRUPT_STATUS_NEW_SLAVE_AUTO_ENUM_FINISHED) + dev_err(ctrl->dev, "SWR-IRQ:: Auto enum finished finished\n"); + + if (sts & SWM_INTERRUPT_STATUS_AUTO_ENUM_FAILED) + dev_err(ctrl->dev, "SWR-IRQ:: Auto enum failed finished\n"); + + if (sts & SWM_INTERRUPT_STATUS_BUS_RESET_FINISHED) + dev_err(ctrl->dev, "SWR-IRQ:: bus reset finished\n"); + + if (sts & SWM_INTERRUPT_STATUS_CLK_STOP_FINISHED) + dev_err_ratelimited(ctrl->dev, "SWR-IRQ:: unknown interrupt\n"); + if (sts & SWM_INTERRUPT_STATUS_SPECIAL_CMD_ID_FINISHED) complete(&ctrl->fifo_comp); if (sts & SWM_INTERRUPT_STATUS_CMD_ERROR) { value = ctrl->reg_read(ctrl, SWM_CMD_FIFO_STATUS); - - dev_err_ratelimited(ctrl->dev, "SWR CMD error, fifo status 0x%x, flushing fifo\n", + dev_err_ratelimited(ctrl->dev, "SWR-IRQ:: CMD error, fifo status 0x%x, flushing fifo\n", value); ctrl->reg_write(ctrl, SWM_CMD_FIFO_CMD, 0x1); if ((value & 0xF) == 0xF) { @@ -302,7 +392,7 @@ static irqreturn_t qcom_swm_irq_handler(int irq, void *dev_id) if ((sts & SWM_INTERRUPT_STATUS_NEW_SLAVE_ATTACHED) || sts & SWM_INTERRUPT_STATUS_CHANGE_ENUM_SLAVE_STATUS) { - dev_err(ctrl->dev, "SWR new slave attached/alert\n"); + dev_err(ctrl->dev, "SWR-IRQ:: new slave attached/alert\n"); if (sts & SWM_INTERRUPT_STATUS_NEW_SLAVE_ATTACHED) ctrl->status[0] = SDW_SLAVE_ATTACHED; @@ -452,7 +542,8 @@ static int qcom_swm_bus_conf(struct sdw_bus *bus, struct sdw_bus_params *params) struct qcom_swm_ctrl *ctrl = to_qcom_sdw(bus); int divider; u32 val; - + pr_err("DEBUG: ENTER %s: %d \n", __func__, __LINE__); +#if 0 if (!params->curr_dr_freq) { dev_err(ctrl->dev, "NULL curr_dr_freq"); return -EINVAL; @@ -467,6 +558,22 @@ static int qcom_swm_bus_conf(struct sdw_bus *bus, struct sdw_bus_params *params) (divider << SWM_MCP_FRAME_CTRL_BANK_CLK_DIV_VALUE_SHFT)); ctrl->reg_write(ctrl, SWM_MCP_FRAME_CTRL_BANK_ADDR(params->next_bank), val); +#endif + pr_err("DEBUG: LEAVE %s: %d \n", __func__, __LINE__); + return 0; +} + +static int qcom_swm_pre_bank_switch(struct sdw_bus *bus) +{ + struct qcom_swm_ctrl *ctrl = to_qcom_sdw(bus); + int divider; + u32 val; + pr_err("DEBUG: ENTER %s: %d \n", __func__, __LINE__); + val = ctrl->reg_read(ctrl, SWM_MCP_FRAME_CTRL_BANK_ADDR(bus->params.next_bank)); + val |= ((0 << SWM_MCP_FRAME_CTRL_BANK_ROW_CTRL_SHFT) | + (7l << SWM_MCP_FRAME_CTRL_BANK_COL_CTRL_SHFT)); + ctrl->reg_write(ctrl, SWM_MCP_FRAME_CTRL_BANK_ADDR(bus->params.next_bank), val); + pr_err("DEBUG: EXIT %s: %d \n", __func__, __LINE__); return 0; } @@ -498,6 +605,17 @@ static int qcom_swm_port_prep(struct sdw_bus *bus, bool prepare; unsigned int bank; #endif + struct qcom_swm_ctrl *ctrl = to_qcom_sdw(bus); + u32 value; + value = ctrl->reg_read(ctrl, SWM_DP_PORT_CTRL_BANK(prepare_ch->bank, prepare_ch->num)); + pr_err("DEBUG %s: %d bank %d port_num %d channel mask %x regval %x\n", __func__, __LINE__, prepare_ch->bank, prepare_ch->num, prepare_ch->ch_mask, value); + +// value = prepare_ch->ch_mask << 24; + +// ctrl->reg_write(ctrl, SWM_DP_PORT_CTRL_BANK(prepare_ch->num, prepare_ch->bank), value); + + + return 0; } @@ -508,6 +626,7 @@ static int qcom_swm_transport_params(struct sdw_bus *bus, struct qcom_swm_ctrl *ctrl = to_qcom_sdw(bus); u32 value; + pr_err("DEBUG %s: %d bank %d port %d \n", __func__, __LINE__, bank, params->port_num); value = ctrl->reg_read(ctrl, SWM_DP_PORT_CTRL_BANK(bank, params->port_num)); value |= params->offset1 << SWM_DP_PORT_CTRL_OFFSET1_SHFT; @@ -515,6 +634,7 @@ static int qcom_swm_transport_params(struct sdw_bus *bus, value |= params->sample_interval; ctrl->reg_write(ctrl, SWM_DP_PORT_CTRL_BANK((params->port_num), bank), value); + pr_err("DEBUG %s: %d bank %d port %d value %x \n", __func__, __LINE__, bank, params->port_num, value); //FIXME Grouping support ... Where is SWM_DP%n_BLOCK_CTRL2_BANK register ??? @@ -528,7 +648,9 @@ static int qcom_swm_port_enable(struct sdw_bus *bus, u32 val; val = ctrl->reg_read(ctrl, SWM_DP_PORT_CTRL_BANK(enable_ch->port_num, bank)); + val |= ((enable_ch->ch_mask * enable_ch->enable) << SWM_DP_PORT_CTRL_EN_CHAN_SHFT); + pr_err("DEBUG %s: %d bank %d port_num %d channel mask %x regval %x\n", __func__, __LINE__, bank, enable_ch->port_num, enable_ch->ch_mask, val); ctrl->reg_write(ctrl, SWM_DP_PORT_CTRL_BANK((enable_ch->port_num), bank), val); @@ -546,6 +668,7 @@ static struct sdw_master_ops qcom_swm_ops = { .xfer_msg = qcom_swm_xfer_msg, .xfer_msg_defer = qcom_swm_xfer_msg_defer, .set_bus_conf = qcom_swm_bus_conf, + .pre_bank_switch = qcom_swm_pre_bank_switch, }; struct usecase { @@ -722,11 +845,8 @@ static int qcom_swm_compute_params(struct sdw_bus *bus) u32 num_ch = 0; u32 portcount = 0; int i, uc_idx = 0; -pr_err("DEBUG: %s: %d \n", __func__, __LINE__); list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) { -pr_err("DEBUG: %s: %d \n", __func__, __LINE__); list_for_each_entry(p_rt, &m_rt->port_list, port_node) { -pr_err("DEBUG: %s: %d \n", __func__, __LINE__); pr_err("DEBUG: port %d ch_rate %d ch_mask %d \n", p_rt->num, p_rt->ch_rate, p_rt->ch_mask); ch_rate += p_rt->ch_rate; num_ch += __sw_hweight8(p_rt->ch_mask); @@ -871,6 +991,8 @@ pr_err("DEBUG: %s: %d \n", __func__, __LINE__); dev_set_drvdata(&pdev->dev, ctrl); init_completion(&ctrl->fifo_comp); mutex_init(&ctrl->lock); + mutex_init(&ctrl->rlock); + INIT_WORK(&ctrl->slave_work, qcom_SWM_slave_wq); ctrl->bus.dev = dev; @@ -893,8 +1015,8 @@ pr_err("DEBUG: %s: %d \n", __func__, __LINE__); prop->num_clk_gears = 0; prop->num_freq = MAX_FREQ_NUM; prop->freq = &qcom_swm_freq_tbl[0]; - prop->default_row = 48; prop->default_col = 16; + prop->default_row = 48; pr_err("DEBUG: %s: %d \n", __func__, __LINE__); //FIXME diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index b970cb31f3131..fbdaf624cb1b9 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -131,17 +131,12 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus, int ret; u8 wbuf; -pr_err("DEBUG: %s: %d \n", __func__, __LINE__); dpn_prop = sdw_get_slave_dpn_prop(s_rt->slave, s_rt->direction, t_params->port_num); - if (!dpn_prop) { - - pr_err("DEBUG: %s: %d INVAL \n", __func__, __LINE__); + if (!dpn_prop) return -EINVAL; - } -pr_err("DEBUG: %s: %d \n", __func__, __LINE__); addr1 = SDW_DPN_PORTCTRL(t_params->port_num); addr2 = SDW_DPN_BLOCKCTRL1(t_params->port_num); @@ -161,7 +156,7 @@ pr_err("DEBUG: %s: %d \n", __func__, __LINE__); /* Program DPN_PortCtrl register */ wbuf = p_params->data_mode << SDW_REG_SHIFT(SDW_DPN_PORTCTRL_DATAMODE); wbuf |= p_params->flow_mode; - +#if 0 ret = sdw_update(s_rt->slave, addr1, 0xF, wbuf); if (ret < 0) { dev_err(&s_rt->slave->dev, @@ -178,7 +173,7 @@ pr_err("DEBUG: %s: %d \n", __func__, __LINE__); t_params->port_num); return ret; } - +#endif /* Program DPN_SampleCtrl1 register */ wbuf = (t_params->sample_interval - 1) & SDW_DPN_SAMPLECTRL_LOW; ret = sdw_write(s_rt->slave, addr3, wbuf); @@ -324,6 +319,9 @@ static int sdw_enable_disable_slave_ports(struct sdw_bus *bus, "Slave chn_en reg write failed:%d port:%d", ret, t_params->port_num); + pr_err("DEBUG: %s: port %d channelen status %x vs ch_mask %x \n", + __func__, p_rt->num, sdw_read(s_rt->slave, addr), p_rt->ch_mask); + return ret; } @@ -389,6 +387,8 @@ static int sdw_enable_disable_ports(struct sdw_master_runtime *m_rt, bool en) return ret; } + + return 0; } @@ -1189,7 +1189,6 @@ static struct sdw_port_runtime *sdw_port_alloc(struct device *dev, p_rt->ch_mask = port_config[port_index].ch_mask; p_rt->num = port_config[port_index].num; - pr_err("DEBUG: %s: %d: port number %d port index %d\n", __func__, __LINE__, p_rt->num, port_index); p_rt->ch_rate = port_config[port_index].ch_rate; return p_rt; @@ -1202,7 +1201,6 @@ static int sdw_master_port_config(struct sdw_bus *bus, { struct sdw_port_runtime *p_rt; int i; - pr_err("DEBUG: %s: %d: port numbers %d \n", __func__, __LINE__, num_ports); /* Iterate for number of ports to perform initialization */ for (i = 0; i < num_ports; i++) { @@ -1419,7 +1417,6 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave, } for (i = 0; i < num_ports; i++) { - pr_err("DEBUG: %s: %d %d vs %d\n", __func__, __LINE__, dpn_prop[i].num, port_num); if (dpn_prop[i].num == port_num) return &dpn_prop[i]; } diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 29e19f5c1bca7..cd8d0c857b3f1 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -629,8 +629,7 @@ struct sdw_defer { */ struct sdw_master_ops { int (*read_prop)(struct sdw_bus *bus); - - enum sdw_command_response (*xfer_msg) +enum sdw_command_response (*xfer_msg) (struct sdw_bus *bus, struct sdw_msg *msg); enum sdw_command_response (*xfer_msg_defer) (struct sdw_bus *bus, struct sdw_msg *msg, diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c index 9de82221a5d73..6d6897d23c0dd 100644 --- a/sound/soc/codecs/wsa881x.c +++ b/sound/soc/codecs/wsa881x.c @@ -12,6 +12,7 @@ #include <linux/slab.h> #include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw_type.h> +#include <linux/soundwire/sdw_registers.h> #define WSA881X_DIGITAL_BASE 0x3000 #define WSA881X_ANALOG_BASE 0x3100 @@ -705,53 +706,6 @@ static struct snd_soc_dai_driver wsa881x_dais[] = { extern int qcom_swm_do_test(struct sdw_bus *bus); extern int qcom_swm_ni_writes; -static void do_test(struct sdw_slave *slave) -{ - pr_err("DEBUG: %s: %d \n", __func__, __LINE__); - int i; -#if 0 - qcom_swm_ni_writes = true; - sdw_write(slave, 0x3005, 0x3); - sdw_write(slave, 0x3009, 0x10); - sdw_write(slave, 0x300b, 0x7); - sdw_write(slave, 0x300c, 0x0); - sdw_write(slave, 0x300f, 0x1); - sdw_write(slave, 0x3021, 0x1b); - sdw_write(slave, 0x3045, 0x0); - sdw_write(slave, 0x309c, 0x3a); - sdw_write(slave, 0x309d, 0x3f); - sdw_write(slave, 0x309e, 0x1); - sdw_write(slave, 0x3109, 0x3); - sdw_write(slave, 0x3114, 0x45); - sdw_write(slave, 0x311a, 0x7c); - sdw_write(slave, 0x311b, 0xc1); - sdw_write(slave, 0x311c, 0x42); - sdw_write(slave, 0x311f, 0xf2); - sdw_write(slave, 0x3121, 0x2); - sdw_write(slave, 0x3122, 0x86); - sdw_write(slave, 0x3123, 0x7); - sdw_write(slave, 0x3124, 0x0); - sdw_write(slave, 0x3125, 0x4e); - sdw_write(slave, 0x3127, 0x44); - sdw_write(slave, 0x312b, 0x78); - sdw_write(slave, 0x312c, 0xa0); - sdw_write(slave, 0x312d, 0xb7); - sdw_write(slave, 0x312e, 0x30); - sdw_write(slave, 0x3131, 0x74); - sdw_write(slave, 0x3133, 0x8f); - sdw_write(slave, 0x3135, 0xa0); - sdw_write(slave, 0x3137, 0x14); - sdw_write(slave, 0x313f, 0x2); - sdw_write(slave, 0x3142, 0xb2); - sdw_write(slave, 0x3143, 0x5); -#endif - qcom_swm_do_test(slave->bus); - //sdw_write(slave, 0x3140, 0x85); -// sdw_write(slave, 0x313f, 0xa); -// sdw_write(slave, 0x313a, 0x47); - qcom_swm_ni_writes = false; -} - static void wsa881x_init(struct snd_soc_component *comp) {pr_err("DEBUG: %s: %d \n", __func__, __LINE__); struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(comp); @@ -1355,6 +1309,7 @@ static int wsa881x_spkr_pa_event(struct snd_soc_dapm_widget *w, struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(comp); int min_gain, max_gain; + u32 addr; dev_dbg(comp->dev, "%s: %s %d\n", __func__, w->name, event); //FIXME not sure why the system is hangling when we run this @@ -1368,7 +1323,6 @@ static int wsa881x_spkr_pa_event(struct snd_soc_dapm_widget *w, ARRAY_SIZE(wsa881x_pre_pmu_pa_2_0)); sdw_enable_stream(wsa881x->sruntime); sdw_enable_stream(wsa881x->mruntime); -// do_test(wsa881x->slave); //FIXME // swr_slvdev_datapath_control(wsa881x->swr_slave, // wsa881x->swr_slave->dev_num, @@ -1383,6 +1337,25 @@ static int wsa881x_spkr_pa_event(struct snd_soc_dapm_widget *w, break; case SND_SOC_DAPM_POST_PMU: pr_err("DEBUG: %s: %d \n", __func__, __LINE__); + addr = SDW_DPN_CHANNELEN_B1(1); + pr_err("DEBUG: %s: channelen status %x \n",__func__, sdw_read(wsa881x->slave, addr)); + addr = SDW_DPN_CHANNELEN_B1(2); + pr_err("DEBUG: %s: channelen status %x \n",__func__, sdw_read(wsa881x->slave, addr)); + addr = SDW_DPN_CHANNELEN_B1(3); + pr_err("DEBUG: %s: channelen status %x \n",__func__, sdw_read(wsa881x->slave, addr)); + addr = SDW_DPN_CHANNELEN_B1(4); + pr_err("DEBUG: %s: channelen status %x \n",__func__, sdw_read(wsa881x->slave, addr)); + + addr = SDW_DPN_CHANNELEN_B0(1); + pr_err("DEBUG: %s: channelen status %x \n",__func__, sdw_read(wsa881x->slave, addr)); + addr = SDW_DPN_CHANNELEN_B0(2); + pr_err("DEBUG: %s: channelen status %x \n",__func__, sdw_read(wsa881x->slave, addr)); + addr = SDW_DPN_CHANNELEN_B0(3); + pr_err("DEBUG: %s: channelen status %x \n",__func__, sdw_read(wsa881x->slave, addr)); + addr = SDW_DPN_CHANNELEN_B0(4); + pr_err("DEBUG: %s: channelen status %x \n",__func__, sdw_read(wsa881x->slave, addr)); + + if (!wsa881x->comp_enable) { max_gain = wsa881x->pa_gain; /* @@ -1476,26 +1449,26 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = { /* DAC */ .num = 1, .type = SDW_DPN_SIMPLE, -// .min_ch = 1, -// .max_ch = 8, + .min_ch = 1, + .max_ch = 8, }, { /* COMP */ .num = 2, .type = SDW_DPN_SIMPLE, -// .min_ch = 1, -// .max_ch = 8, + .min_ch = 1, + .max_ch = 8, }, { /* BOOST */ .num = 3, .type = SDW_DPN_SIMPLE, -// .min_ch = 1, -// .max_ch = 8, + .min_ch = 1, + .max_ch = 8, }, { /* VISENSE */ .num = 4, .type = SDW_DPN_SIMPLE, -// .min_ch = 1, -// .max_ch = 8, + .min_ch = 1, + .max_ch = 8, } }; @@ -1547,12 +1520,13 @@ static int wsa881x_bus_config(struct sdw_slave *slave, { pr_err("DEBUG: %s: %d \n", __func__, __LINE__); - sdw_write(slave, - SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(params->next_bank), 0x01); +// sdw_write(slave, +// SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(params->next_bank), 0x01); // swrm_cmd_fifo_wr_cmd(swrm, 0x01, 0xF, 0x00, // SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(bank)); +pr_err("DEBUG: DONE..%s: %d \n", __func__, __LINE__); return 0; } |