static bool lpass_cpu_regmap_readable(struct device *dev, unsigned int reg) { int i; for (i = 0; i < LPAIF_I2S_PORT_NUM; ++i) if (reg == LPAIF_I2SCTL_REG(i)) return true; for (i = 0; i < LPAIF_IRQ_PORT_NUM; ++i) { if (reg == LPAIF_IRQEN_REG(i)) return true; if (reg == LPAIF_IRQSTAT_REG(i)) return true; } for (i = 0; i < LPAIF_RDMA_CHAN_NUM; ++i) { if (reg == LPAIF_RDMACTL_REG(i)) return true; if (reg == LPAIF_RDMABASE_REG(i)) return true; if (reg == LPAIF_RDMABUFF_REG(i)) return true; if (reg == LPAIF_RDMACURR_REG(i)) return true; if (reg == LPAIF_RDMAPER_REG(i)) return true; } return false; }
static bool lpass_cpu_regmap_readable(struct device *dev, unsigned int reg) { struct lpass_data *drvdata = dev_get_drvdata(dev); struct lpass_variant *v = drvdata->variant; int i; for (i = 0; i < v->i2s_ports; ++i) if (reg == LPAIF_I2SCTL_REG(v, i)) return true; for (i = 0; i < v->irq_ports; ++i) { if (reg == LPAIF_IRQEN_REG(v, i)) return true; if (reg == LPAIF_IRQSTAT_REG(v, i)) return true; } for (i = 0; i < v->rdma_channels; ++i) { if (reg == LPAIF_RDMACTL_REG(v, i)) return true; if (reg == LPAIF_RDMABASE_REG(v, i)) return true; if (reg == LPAIF_RDMABUFF_REG(v, i)) return true; if (reg == LPAIF_RDMACURR_REG(v, i)) return true; if (reg == LPAIF_RDMAPER_REG(v, i)) return true; } return false; }
static snd_pcm_uframes_t lpass_platform_pcmops_pointer( struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; struct lpass_data *drvdata = snd_soc_platform_get_drvdata(soc_runtime->platform); unsigned int base_addr, curr_addr; int ret; ret = regmap_read(drvdata->lpaif_map, LPAIF_RDMABASE_REG(LPAIF_RDMA_CHAN_MI2S), &base_addr); if (ret) { dev_err(soc_runtime->dev, "%s() error reading from rdmabase reg: %d\n", __func__, ret); return ret; } ret = regmap_read(drvdata->lpaif_map, LPAIF_RDMACURR_REG(LPAIF_RDMA_CHAN_MI2S), &curr_addr); if (ret) { dev_err(soc_runtime->dev, "%s() error reading from rdmacurr reg: %d\n", __func__, ret); return ret; } return bytes_to_frames(substream->runtime, curr_addr - base_addr); }
static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg) { int i; for (i = 0; i < LPAIF_IRQ_PORT_NUM; ++i) if (reg == LPAIF_IRQSTAT_REG(i)) return true; for (i = 0; i < LPAIF_RDMA_CHAN_NUM; ++i) if (reg == LPAIF_RDMACURR_REG(i)) return true; return false; }
static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg) { struct lpass_data *drvdata = dev_get_drvdata(dev); struct lpass_variant *v = drvdata->variant; int i; for (i = 0; i < v->irq_ports; ++i) if (reg == LPAIF_IRQSTAT_REG(v, i)) return true; for (i = 0; i < v->rdma_channels; ++i) if (reg == LPAIF_RDMACURR_REG(v, i)) return true; return false; }