Skip to content

Commit

Permalink
Merge pull request #26 from lgirdwood/topic/sof-dev-sparse
Browse files Browse the repository at this point in the history
Topic/sof dev sparse
  • Loading branch information
lgirdwood committed Jul 5, 2018
2 parents 8ab299b + 7de8df0 commit bbe7c7a
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 100 deletions.
4 changes: 2 additions & 2 deletions sound/soc/sof/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct snd_sof_pcm *snd_sof_find_spcm_dai(struct snd_sof_dev *sdev,
struct snd_sof_pcm *spcm = NULL;

list_for_each_entry(spcm, &sdev->pcm_list, list) {
if (spcm->pcm.dai_id == rtd->dai_link->id)
if (le32_to_cpu(spcm->pcm.dai_id) == rtd->dai_link->id)
return spcm;
}

Expand Down Expand Up @@ -87,7 +87,7 @@ struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_sof_dev *sdev,
struct snd_sof_pcm *spcm = NULL;

list_for_each_entry(spcm, &sdev->pcm_list, list) {
if (spcm->pcm.pcm_id == pcm_id)
if (le32_to_cpu(spcm->pcm.pcm_id) == pcm_id)
return spcm;
}

Expand Down
7 changes: 4 additions & 3 deletions sound/soc/sof/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static int sof_dfsentry_open(struct inode *inode, struct file *file)
static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer,
size_t count, loff_t *ppos)
{
struct snd_sof_dfsentry *dfse = file->private_data;
struct snd_sof_dfsentry_io *dfse = file->private_data;
struct snd_sof_dev *sdev = dfse->sdev;
int size;
u32 *buf;
Expand Down Expand Up @@ -78,7 +78,7 @@ int snd_sof_debugfs_create_item(struct snd_sof_dev *sdev,
void __iomem *base, size_t size,
const char *name)
{
struct snd_sof_dfsentry *dfse;
struct snd_sof_dfsentry_io *dfse;

if (!sdev)
return -EINVAL;
Expand Down Expand Up @@ -118,7 +118,8 @@ int snd_sof_dbg_init(struct snd_sof_dev *sdev)
for (i = 0; i < ops->debug_map_count; i++) {
map = &ops->debug_map[i];

err = snd_sof_debugfs_create_item(sdev, sdev->bar[map->bar] +
err = snd_sof_debugfs_create_item(sdev,
sdev->bar[map->bar] +
map->offset, map->size,
map->name);
if (err < 0)
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/sof/intel/bdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ static void bdw_block_write(struct snd_sof_dev *sdev, u32 offset, void *src,
n = size % 4;

/* __iowrite32_copy use 32bit size values so divide by 4 */
__iowrite32_copy((void *)dest, src, m);
__iowrite32_copy(dest, src, m);

if (n) {
for (i = 0; i < n; i++)
tmp |= (u32)*(src_byte + m * 4 + i) << (i * 8);
__iowrite32_copy((void *)(dest + m * 4), &tmp, 1);
__iowrite32_copy(dest + m * 4, &tmp, 1);
}
}

Expand Down
4 changes: 2 additions & 2 deletions sound/soc/sof/intel/byt.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ static void byt_block_write(struct snd_sof_dev *sdev, u32 offset, void *src,
n = size % 4;

/* __iowrite32_copy use 32bit size values so divide by 4 */
__iowrite32_copy((void *)dest, src, m);
__iowrite32_copy(dest, src, m);

if (n) {
for (i = 0; i < n; i++)
tmp |= (u32)*(src_byte + m * 4 + i) << (i * 8);
__iowrite32_copy((void *)(dest + m * 4), &tmp, 1);
__iowrite32_copy(dest + m * 4, &tmp, 1);
}
}

Expand Down
4 changes: 2 additions & 2 deletions sound/soc/sof/intel/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ void hda_dsp_block_write(struct snd_sof_dev *sdev, u32 offset, void *src,
n = size % 4;

/* __iowrite32_copy use 32bit size values so divide by 4 */
__iowrite32_copy((void *)dest, src, m);
__iowrite32_copy(dest, src, m);

if (n) {
for (i = 0; i < n; i++)
tmp |= (u32)*(src_byte + m * 4 + i) << (i * 8);
__iowrite32_copy((void *)(dest + m * 4), &tmp, 1);
__iowrite32_copy(dest + m * 4, &tmp, 1);
}
}

Expand Down
4 changes: 2 additions & 2 deletions sound/soc/sof/intel/hsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ static void hsw_block_write(struct snd_sof_dev *sdev, u32 offset, void *src,
n = size % 4;

/* __iowrite32_copy use 32bit size values so divide by 4 */
__iowrite32_copy((void *)dest, src, m);
__iowrite32_copy(dest, src, m);

if (n) {
for (i = 0; i < n; i++)
tmp |= (u32)*(src_byte + m * 4 + i) << (i * 8);
__iowrite32_copy((void *)(dest + m * 4), &tmp, 1);
__iowrite32_copy(dest + m * 4, &tmp, 1);
}
}

Expand Down
9 changes: 4 additions & 5 deletions sound/soc/sof/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ static void ipc_tx_next_msg(struct work_struct *work)
}

/* find original TX message from DSP reply */
struct snd_sof_ipc_msg *sof_ipc_reply_find_msg(struct snd_sof_ipc *ipc,
u32 header)
static struct snd_sof_ipc_msg *sof_ipc_reply_find_msg(struct snd_sof_ipc *ipc,
u32 header)
{
struct snd_sof_dev *sdev = ipc->sdev;
struct snd_sof_ipc_msg *msg;
Expand All @@ -213,11 +213,10 @@ struct snd_sof_ipc_msg *sof_ipc_reply_find_msg(struct snd_sof_ipc *ipc,
header);
return NULL;
}
EXPORT_SYMBOL(sof_ipc_reply_find_msg);

/* mark IPC message as complete - locks held by caller */
void sof_ipc_tx_msg_reply_complete(struct snd_sof_ipc *ipc,
struct snd_sof_ipc_msg *msg)
static void sof_ipc_tx_msg_reply_complete(struct snd_sof_ipc *ipc,
struct snd_sof_ipc_msg *msg)
{
msg->complete = true;
wake_up(&msg->waitq);
Expand Down
32 changes: 16 additions & 16 deletions sound/soc/sof/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ static int sof_pcm_open(struct snd_pcm_substream *substream)
/* set any runtime constraints based on topology */
snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
caps->period_size_min);
le32_to_cpu(caps->period_size_min));
snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
caps->period_size_min);
le32_to_cpu(caps->period_size_min));

/* set runtime config */
runtime->hw.info = SNDRV_PCM_INFO_MMAP |
Expand All @@ -303,12 +303,12 @@ static int sof_pcm_open(struct snd_pcm_substream *substream)
SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_RESUME |
SNDRV_PCM_INFO_NO_PERIOD_WAKEUP;
runtime->hw.formats = caps->formats;
runtime->hw.period_bytes_min = caps->period_size_min;
runtime->hw.period_bytes_max = caps->period_size_max;
runtime->hw.periods_min = caps->periods_min;
runtime->hw.periods_max = caps->periods_max;
runtime->hw.buffer_bytes_max = caps->buffer_size_max;
runtime->hw.formats = le64_to_cpu(caps->formats);
runtime->hw.period_bytes_min = le32_to_cpu(caps->period_size_min);
runtime->hw.period_bytes_max = le32_to_cpu(caps->period_size_max);
runtime->hw.periods_min = le32_to_cpu(caps->periods_min);
runtime->hw.periods_max = le32_to_cpu(caps->periods_max);
runtime->hw.buffer_bytes_max = le32_to_cpu(caps->buffer_size_max);

dev_dbg(sdev->dev, "period min %zd max %zd bytes\n",
runtime->hw.period_bytes_min,
Expand Down Expand Up @@ -398,8 +398,8 @@ static int sof_pcm_new(struct snd_soc_pcm_runtime *rtd)

ret = snd_pcm_lib_preallocate_pages(pcm->streams[stream].substream,
SNDRV_DMA_TYPE_DEV_SG, sdev->parent,
caps->buffer_size_min,
caps->buffer_size_max);
le32_to_cpu(caps->buffer_size_min),
le32_to_cpu(caps->buffer_size_max));
if (ret) {
dev_err(sdev->dev, "error: can't alloc DMA buffer size 0x%x/0x%x for %s %d\n",
caps->buffer_size_min, caps->buffer_size_max,
Expand Down Expand Up @@ -431,8 +431,8 @@ static int sof_pcm_new(struct snd_soc_pcm_runtime *rtd)

ret = snd_pcm_lib_preallocate_pages(pcm->streams[stream].substream,
SNDRV_DMA_TYPE_DEV_SG, sdev->parent,
caps->buffer_size_min,
caps->buffer_size_max);
le32_to_cpu(caps->buffer_size_min),
le32_to_cpu(caps->buffer_size_max));
if (ret) {
dev_err(sdev->dev, "error: can't alloc DMA buffer size 0x%x/0x%x for %s %d\n",
caps->buffer_size_min, caps->buffer_size_max,
Expand Down Expand Up @@ -506,7 +506,7 @@ static int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
channels->max = 2;

snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);
snd_mask_set(fmt, (__force int)SNDRV_PCM_FORMAT_S16_LE);

return 0;
}
Expand All @@ -516,13 +516,13 @@ static int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,

switch (dai->comp_dai.config.frame_fmt) {
case SOF_IPC_FRAME_S16_LE:
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);
snd_mask_set(fmt, (__force int)SNDRV_PCM_FORMAT_S16_LE);
break;
case SOF_IPC_FRAME_S24_4LE:
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set(fmt, (__force int)SNDRV_PCM_FORMAT_S24_LE);
break;
case SOF_IPC_FRAME_S32_LE:
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S32_LE);
snd_mask_set(fmt, (__force int)SNDRV_PCM_FORMAT_S32_LE);
break;
default:
dev_err(sdev->dev, "No available DAI format!\n");
Expand Down
14 changes: 11 additions & 3 deletions sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ struct snd_sof_dsp_ops {

/* mailbox */
void (*mailbox_read)(struct snd_sof_dev *sof_dev, u32 offset,
void __iomem *addr, size_t bytes);
void *addr, size_t bytes);
void (*mailbox_write)(struct snd_sof_dev *sof_dev, u32 offset,
void __iomem *addr, size_t bytes);
void *addr, size_t bytes);

/* ipc */
int (*send_msg)(struct snd_sof_dev *sof_dev,
Expand Down Expand Up @@ -171,7 +171,14 @@ struct sof_ops_table {
};

/* FS entry for debug files that can expose DSP memories, registers */
struct snd_sof_dfsentry {
struct snd_sof_dfsentry_io {
struct dentry *dfsentry;
size_t size;
void __iomem *buf;
struct snd_sof_dev *sdev;
};

struct snd_sof_dfsentry_buf {
struct dentry *dfsentry;
size_t size;
void *buf;
Expand Down Expand Up @@ -401,6 +408,7 @@ struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_sof_dev *sdev,
int *direction);
struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_sof_dev *sdev,
unsigned int pcm_id);
void sof_ipc_drop_all(struct snd_sof_ipc *ipc);

/*
* Stream IPC
Expand Down
Loading

0 comments on commit bbe7c7a

Please sign in to comment.