lkml.org 
[lkml]   [2021]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] soundwire: qcom: add debugfs entry for soundwire register dump
From
Date


On 9/30/21 11:20 PM, Vinod Koul wrote:
> HI Srini,
>
> On 07-09-21, 11:56, Srinivas Kandagatla wrote:
>> +#ifdef CONFIG_DEBUG_FS
>> +static int swrm_reg_show(struct seq_file *s_file, void *data)
>> +{
>> + struct qcom_swrm_ctrl *swrm = s_file->private;
>> + int reg, reg_val;
>> +
>> + for (reg = 0; reg <= SWR_MSTR_MAX_REG_ADDR; reg += 4) {
>> + swrm->reg_read(swrm, reg, &reg_val);
>
> Why not use regmap_read here, that would avoid reading from the bus when
> we already have the values...

It's an indirect read based on regmap.

ctrl->reg_read = qcom_swrm_ahb_reg_read;
ctrl->reg_write = qcom_swrm_ahb_reg_write;

static int qcom_swrm_ahb_reg_read(struct qcom_swrm_ctrl *ctrl, int reg,
u32 *val)
{
struct regmap *wcd_regmap = ctrl->regmap;
int ret;

/* pg register + offset */
ret = regmap_bulk_write(wcd_regmap, SWRM_AHB_BRIDGE_RD_ADDR_0,
(u8 *)&reg, 4);
if (ret < 0)
return SDW_CMD_FAIL;

ret = regmap_bulk_read(wcd_regmap, SWRM_AHB_BRIDGE_RD_DATA_0,
val, 4);
if (ret < 0)
return SDW_CMD_FAIL;

return SDW_CMD_OK;
}

> Second make sure later when pm_runtime support is added, this take a
> reference ..

Yes indeed, the SoundWire regmap doesn't change the pm_runtime status.

\
 
 \ /
  Last update: 2021-10-01 13:50    [W:2.930 / U:1.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site