From: Takashi Iwai Subject: Re: [PATCHv2 3/5] ASoC: Intel: Add Intel SST audio DSP Firmware loader. Date: Mon, 17 Feb 2014 14:48:49 +0100 Message-ID: References: <1392643930-6030-1-git-send-email-liam.r.girdwood@linux.intel.com> <1392643930-6030-3-git-send-email-liam.r.girdwood@linux.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id BF321261B19 for ; Mon, 17 Feb 2014 14:48:50 +0100 (CET) In-Reply-To: <1392643930-6030-3-git-send-email-liam.r.girdwood@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Liam Girdwood Cc: alsa-devel@alsa-project.org, Mark Brown , Benson Leung , Jarkko Nikula List-Id: alsa-devel@alsa-project.org At Mon, 17 Feb 2014 13:32:08 +0000, Liam Girdwood wrote: > > Provide services for Intel SST drivers to load SST modular firmware. > > SST Firmware can be made up of several modules. These modules can exist > within any of the compatible SST memory blocks. Provide a generic memory > block and firmware module manager that can be used with any SST firmware > and core. > > Signed-off-by: Liam Girdwood > --- > sound/soc/intel/sst-firmware.c | 586 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 586 insertions(+) > create mode 100644 sound/soc/intel/sst-firmware.c > > diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c > new file mode 100644 > index 0000000..b6f9b5e > --- /dev/null > +++ b/sound/soc/intel/sst-firmware.c > @@ -0,0 +1,586 @@ > +/* > + * Intel SST Firmware Loader > + * > + * Copyright (C) 2013, Intel Corporation. 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 as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include "sst-dsp.h" > +#include "sst-dsp-priv.h" > + > +static void sst_memcpy32(void *dest, void *src, u32 bytes) > +{ > + u32 i; > + > + /* copy one 32 bit word at a time as 64 bit access is not supported */ > + for (i = 0; i < bytes; i += 4) > + memcpy_toio(dest + i, src + i, 4); > +} > + > +/* create new generic firmware object */ > +struct sst_fw *sst_fw_new(struct sst_dsp *dsp, > + const struct firmware *fw, void *private) > +{ > + struct sst_fw *sst_fw; > + int err; > + > + if (!dsp->ops->parse_fw) > + return NULL; > + > + sst_fw = kzalloc(sizeof(*sst_fw), GFP_KERNEL); > + if (sst_fw == NULL) > + return NULL; > + > + sst_fw->dsp = dsp; > + sst_fw->private = private; > + sst_fw->size = fw->size; > + > + err = dma_coerce_mask_and_coherent(dsp->dev, DMA_BIT_MASK(32)); > + if (err < 0) { > + kfree(sst_fw); > + return NULL; > + } > + > + /* allocate DMA buffer to store FW data */ > + sst_fw->dma_buf = dma_alloc_coherent(dsp->dev, sst_fw->size, > + &sst_fw->dmable_fw_paddr, GFP_DMA); Missing GFP_KERNEL? Takashi