本文整理汇总了C++中release_firmware函数的典型用法代码示例。如果您正苦于以下问题:C++ release_firmware函数的具体用法?C++ release_firmware怎么用?C++ release_firmware使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了release_firmware函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: softing_load_app_fw
int softing_load_app_fw(const char *file, struct softing *card)
{
const struct firmware *fw;
const uint8_t *mem, *end, *dat;
int ret, j;
uint16_t type, len;
uint32_t addr, start_addr = 0;
unsigned int sum, rx_sum;
int8_t type_end = 0, type_entrypoint = 0;
ret = request_firmware(&fw, file, &card->pdev->dev);
if (ret)
return ret;
dev_dbg(&card->pdev->dev, "firmware(%s) got %lu bytes\n",
file, (unsigned long)fw->size);
/* parse the firmware */
mem = fw->data;
end = &mem[fw->size];
/* look for header record */
ret = fw_parse(&mem, &type, &addr, &len, &dat);
if (ret)
goto failed;
ret = -EINVAL;
if (type != 0xffff) {
dev_alert(&card->pdev->dev, "firmware starts with type 0x%x\n",
type);
goto failed;
}
if (strncmp("Structured Binary Format, Softing GmbH", dat, len)) {
dev_alert(&card->pdev->dev, "firmware string '%.*s' fault\n",
len, dat);
goto failed;
}
/* ok, we had a header */
while (mem < end) {
ret = fw_parse(&mem, &type, &addr, &len, &dat);
if (ret)
goto failed;
if (type == 3) {
/* start address */
start_addr = addr;
type_entrypoint = 1;
continue;
} else if (type == 1) {
/* eof */
type_end = 1;
break;
} else if (type != 0) {
dev_alert(&card->pdev->dev,
"unknown record type 0x%04x\n", type);
ret = -EINVAL;
goto failed;
}
/* regualar data */
for (sum = 0, j = 0; j < len; ++j)
sum += dat[j];
/* work in 16bit (target) */
sum &= 0xffff;
memcpy_toio(&card->dpram[card->pdat->app.offs], dat, len);
iowrite32(card->pdat->app.offs + card->pdat->app.addr,
&card->dpram[DPRAM_COMMAND + 2]);
iowrite32(addr, &card->dpram[DPRAM_COMMAND + 6]);
iowrite16(len, &card->dpram[DPRAM_COMMAND + 10]);
iowrite8(1, &card->dpram[DPRAM_COMMAND + 12]);
ret = softing_bootloader_command(card, 1, "loading app.");
if (ret < 0)
goto failed;
/* verify checksum */
rx_sum = ioread16(&card->dpram[DPRAM_RECEIPT + 2]);
if (rx_sum != sum) {
dev_alert(&card->pdev->dev, "SRAM seems to be damaged"
", wanted 0x%04x, got 0x%04x\n", sum, rx_sum);
ret = -EIO;
goto failed;
}
}
if (!type_end || !type_entrypoint)
goto failed;
/* start application in card */
iowrite32(start_addr, &card->dpram[DPRAM_COMMAND + 2]);
iowrite8(1, &card->dpram[DPRAM_COMMAND + 6]);
ret = softing_bootloader_command(card, 3, "start app.");
if (ret < 0)
goto failed;
ret = 0;
failed:
release_firmware(fw);
if (ret < 0)
dev_info(&card->pdev->dev, "firmware %s failed\n", file);
return ret;
}
开发者ID:shinsec,项目名称:linux-parrot,代码行数:94,代码来源:softing_fw.c
示例2: load_kernel_fw_bootmode
static int load_kernel_fw_bootmode(struct spi_device *spi, const char *pFn)
{
const struct firmware *fw = NULL;
int remaining;
unsigned int uPos = 0;
unsigned int fw_addr = STM_APP_ADDR;
int iRet;
int block = STM_MAX_XFER_SIZE;
int count = 0;
int err_count = 0;
int retry_count = 0;
pr_info("[SSP] ssp_load_fw start!!!\n");
iRet = request_firmware(&fw, pFn, &spi->dev);
if (iRet) {
pr_err("[SSP] Unable to open firmware %s\n", pFn);
return iRet;
}
remaining = fw->size;
while (remaining > 0) {
if (block > remaining)
block = remaining;
while (retry_count < 3) {
iRet = fw_write_stm(spi, fw_addr, block, fw->data + uPos);
if (iRet < block) {
pr_err("[SSP] Error writing to addr 0x%08X\n", fw_addr);
if (iRet < 0) {
pr_err("[SSP] Erro was %d\n", iRet);
} else {
pr_err("[SSP] Incomplete write of %d bytes\n",
iRet);
iRet = -EIO;
}
retry_count++;
err_count++;
} else {
retry_count = 0;
break;
}
}
if (iRet < 0) {
pr_err("[SSP] Writing MEM failed: %d, retry cont: %d\n", iRet, err_count);
goto out_load_kernel;
}
remaining -= block;
uPos += block;
fw_addr += block;
if (count++ == 20) {
pr_info("[SSP] Updated %u bytes / %u bytes\n", uPos,
fw->size);
count = 0;
}
}
pr_info("[SSP] Firmware download is success.(%d bytes, retry %d)\n", uPos, err_count);
out_load_kernel:
release_firmware(fw);
return iRet;
}
开发者ID:davidmueller13,项目名称:davidskernel_lt03lte_tw_5.1.1,代码行数:63,代码来源:ssp_firmware.c
示例3: pil_mss_reset_load_mba
int pil_mss_reset_load_mba(struct pil_desc *pil)
{
struct q6v5_data *drv = container_of(pil, struct q6v5_data, desc);
struct modem_data *md = dev_get_drvdata(pil->dev);
const struct firmware *fw, *dp_fw;
char fw_name_legacy[10] = "mba.b00";
char fw_name[10] = "mba.mbn";
char *dp_name = "msadp";
char *fw_name_p;
void *mba_virt;
dma_addr_t mba_phys, mba_phys_end;
int ret, count;
const u8 *data;
fw_name_p = drv->non_elf_image ? fw_name_legacy : fw_name;
/* Load and authenticate mba image */
ret = request_firmware(&fw, fw_name_p, pil->dev);
if (ret) {
dev_err(pil->dev, "Failed to locate %s\n",
fw_name_p);
return ret;
}
drv->mba_size = SZ_1M;
md->mba_mem_dev.coherent_dma_mask =
DMA_BIT_MASK(sizeof(dma_addr_t) * 8);
init_dma_attrs(&md->attrs_dma);
dma_set_attr(DMA_ATTR_STRONGLY_ORDERED, &md->attrs_dma);
mba_virt = dma_alloc_attrs(&md->mba_mem_dev, drv->mba_size,
&mba_phys, GFP_KERNEL, &md->attrs_dma);
if (!mba_virt) {
dev_err(pil->dev, "MBA metadata buffer allocation failed\n");
ret = -ENOMEM;
goto err_dma_alloc;
}
drv->mba_phys = mba_phys;
drv->mba_virt = mba_virt;
mba_phys_end = mba_phys + drv->mba_size;
dev_info(pil->dev, "MBA: loading from %pa to %pa\n", &mba_phys,
&mba_phys_end);
/* Load the MBA image into memory */
data = fw ? fw->data : NULL;
if (!data) {
dev_err(pil->dev, "MBA data is NULL\n");
ret = -ENOMEM;
goto err_mba_data;
}
count = fw->size;
memcpy(mba_virt, data, count);
wmb();
/* Load modem debug policy */
ret = request_firmware(&dp_fw, dp_name, pil->dev);
if (ret) {
drv->dp_virt = NULL;
dev_warn(pil->dev, "MBA: Debug policy not present - %s\n",
dp_name);
} else {
if (!dp_fw || !dp_fw->data) {
dev_err(pil->dev, "Invalid DP firmware\n");
ret = -ENOMEM;
goto err_invalid_fw;
}
mba_virt = dma_alloc_attrs(&md->mba_mem_dev, dp_fw->size,
&mba_phys, GFP_KERNEL, &md->attrs_dma);
if (!mba_virt) {
dev_err(pil->dev, "MBA: DP metadata buffer allocation failed\n");
ret = -ENOMEM;
goto err_invalid_fw;
}
drv->dp_size = dp_fw->size;
drv->dp_phys = mba_phys;
drv->dp_virt = mba_virt;
mba_phys_end = mba_phys + drv->dp_size;
dev_info(pil->dev, "MBA: DP loading from %pa to %pa\n",
&mba_phys, &mba_phys_end);
memcpy(mba_virt, dp_fw->data, dp_fw->size);
/* Ensure memcpy is done before powering up modem */
wmb();
}
ret = pil_mss_reset(pil);
if (ret) {
dev_err(pil->dev, "MBA boot failed.\n");
goto err_mss_reset;
}
if (drv->dp_virt)
release_firmware(dp_fw);
release_firmware(fw);
return 0;
err_mss_reset:
if (drv->dp_virt)
dma_free_attrs(&md->mba_mem_dev, dp_fw->size, drv->dp_virt,
drv->dp_phys, &md->attrs_dma);
//.........这里部分代码省略.........
开发者ID:moonlightly,项目名称:NX523J_kernel,代码行数:101,代码来源:pil-msa.c
示例4: mfc_probe
//.........这里部分代码省略.........
printk(KERN_ERR "failed to init. MFC memory manager\n");
goto err_mem_mgr;
}
/*
* loading firmware
*/
ret = request_firmware_nowait(THIS_MODULE,
FW_ACTION_HOTPLUG,
MFC_FW_NAME,
&pdev->dev,
GFP_KERNEL,
pdev,
mfc_firmware_request_complete_handler);
if (ret) {
dev_err(&pdev->dev, "could not load firmware (err=%d)\n", ret);
goto err_fw_req;
}
#if defined(SYSMMU_MFC_ON) && defined(CONFIG_VIDEO_MFC_VCM_UMP)
ret = vcm_activate(mfcdev->vcm_info.sysmmu_vcm);
if (ret < 0) {
mfc_err("failed to activate VCM: %d", ret);
goto err_act_vcm;
}
#endif
/*
* initialize buffer manager
*/
mfc_init_buf();
/* FIXME: final dec & enc */
mfc_init_decoders();
mfc_init_encoders();
ret = misc_register(&mfc_miscdev);
if (ret) {
mfc_err("MFC can't misc register on minor=%d\n", MFC_MINOR);
goto err_misc_reg;
}
mfc_info("MFC(Multi Function Codec - FIMV v5.x) registered successfully\n");
return 0;
err_misc_reg:
mfc_final_buf();
#ifdef SYSMMU_MFC_ON
#ifdef CONFIG_VIDEO_MFC_VCM_UMP
mfc_clock_on();
vcm_deactivate(mfcdev->vcm_info.sysmmu_vcm);
mfc_clock_off();
err_act_vcm:
#endif
mfc_clock_on();
sysmmu_off(SYSMMU_MFC_L);
sysmmu_off(SYSMMU_MFC_R);
mfc_clock_off();
#endif
if (mfcdev->fw.info)
release_firmware(mfcdev->fw.info);
err_fw_req:
/* FIXME: make kenel dump when probe fail */
mfc_clock_on();
mfc_final_mem_mgr(mfcdev);
mfc_clock_off();
err_mem_mgr:
mfc_final_pm(mfcdev);
err_pm_if:
free_irq(mfcdev->irq, mfcdev);
err_irq_req:
err_irq_res:
iounmap(mfcdev->reg.base);
err_mem_map:
release_mem_region(mfcdev->reg.rsrc_start, mfcdev->reg.rsrc_len);
err_mem_req:
err_mem_res:
platform_set_drvdata(pdev, NULL);
mutex_destroy(&mfcdev->lock);
kfree(mfcdev);
return ret;
}
开发者ID:FrozenData,项目名称:SGS2-Kernel-Update2,代码行数:101,代码来源:mfc_dev.c
示例5: btbcm_patchram
int btbcm_patchram(struct hci_dev *hdev, const char *firmware)
{
const struct hci_command_hdr *cmd;
const struct firmware *fw;
const u8 *fw_ptr;
size_t fw_size;
struct sk_buff *skb;
u16 opcode;
int err;
err = request_firmware(&fw, firmware, &hdev->dev);
if (err < 0) {
BT_INFO("%s: BCM: Patch %s not found", hdev->name, firmware);
return err;
}
/* Start Download */
skb = __hci_cmd_sync(hdev, 0xfc2e, 0, NULL, HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
err = PTR_ERR(skb);
BT_ERR("%s: BCM: Download Minidrv command failed (%d)",
hdev->name, err);
goto done;
}
kfree_skb(skb);
/* 50 msec delay after Download Minidrv completes */
msleep(50);
fw_ptr = fw->data;
fw_size = fw->size;
while (fw_size >= sizeof(*cmd)) {
const u8 *cmd_param;
cmd = (struct hci_command_hdr *)fw_ptr;
fw_ptr += sizeof(*cmd);
fw_size -= sizeof(*cmd);
if (fw_size < cmd->plen) {
BT_ERR("%s: BCM: Patch %s is corrupted", hdev->name,
firmware);
err = -EINVAL;
goto done;
}
cmd_param = fw_ptr;
fw_ptr += cmd->plen;
fw_size -= cmd->plen;
opcode = le16_to_cpu(cmd->opcode);
skb = __hci_cmd_sync(hdev, opcode, cmd->plen, cmd_param,
HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
err = PTR_ERR(skb);
BT_ERR("%s: BCM: Patch command %04x failed (%d)",
hdev->name, opcode, err);
goto done;
}
kfree_skb(skb);
}
/* 250 msec delay after Launch Ram completes */
msleep(250);
done:
release_firmware(fw);
return err;
}
开发者ID:Claude1986,项目名称:Atheros-CSI-Tool,代码行数:70,代码来源:btbcm.c
示例6: ft1000_probe
static int ft1000_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
struct usb_device *dev;
unsigned numaltsetting;
int i, ret = 0, size;
struct ft1000_usb *ft1000dev;
struct ft1000_info *pft1000info = NULL;
const struct firmware *dsp_fw;
ft1000dev = kzalloc(sizeof(struct ft1000_usb), GFP_KERNEL);
if (!ft1000dev)
return -ENOMEM;
dev = interface_to_usbdev(interface);
DEBUG("ft1000_probe: usb device descriptor info:\n");
DEBUG("ft1000_probe: number of configuration is %d\n",
dev->descriptor.bNumConfigurations);
ft1000dev->dev = dev;
ft1000dev->status = 0;
ft1000dev->net = NULL;
ft1000dev->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
ft1000dev->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!ft1000dev->tx_urb || !ft1000dev->rx_urb) {
ret = -ENOMEM;
goto err_fw;
}
DEBUG("ft1000_probe is called\n");
numaltsetting = interface->num_altsetting;
DEBUG("ft1000_probe: number of alt settings is :%d\n", numaltsetting);
iface_desc = interface->cur_altsetting;
DEBUG("ft1000_probe: number of endpoints is %d\n",
iface_desc->desc.bNumEndpoints);
DEBUG("ft1000_probe: descriptor type is %d\n",
iface_desc->desc.bDescriptorType);
DEBUG("ft1000_probe: interface number is %d\n",
iface_desc->desc.bInterfaceNumber);
DEBUG("ft1000_probe: alternatesetting is %d\n",
iface_desc->desc.bAlternateSetting);
DEBUG("ft1000_probe: interface class is %d\n",
iface_desc->desc.bInterfaceClass);
DEBUG("ft1000_probe: control endpoint info:\n");
DEBUG("ft1000_probe: descriptor0 type -- %d\n",
iface_desc->endpoint[0].desc.bmAttributes);
DEBUG("ft1000_probe: descriptor1 type -- %d\n",
iface_desc->endpoint[1].desc.bmAttributes);
DEBUG("ft1000_probe: descriptor2 type -- %d\n",
iface_desc->endpoint[2].desc.bmAttributes);
for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
endpoint =
(struct usb_endpoint_descriptor *)&iface_desc->
endpoint[i].desc;
DEBUG("endpoint %d\n", i);
DEBUG("bEndpointAddress=%x, bmAttributes=%x\n",
endpoint->bEndpointAddress, endpoint->bmAttributes);
if ((endpoint->bEndpointAddress & USB_DIR_IN)
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK)) {
ft1000dev->bulk_in_endpointAddr =
endpoint->bEndpointAddress;
DEBUG("ft1000_probe: in: %d\n",
endpoint->bEndpointAddress);
}
if (!(endpoint->bEndpointAddress & USB_DIR_IN)
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK)) {
ft1000dev->bulk_out_endpointAddr =
endpoint->bEndpointAddress;
DEBUG("ft1000_probe: out: %d\n",
endpoint->bEndpointAddress);
}
}
DEBUG("bulk_in=%d, bulk_out=%d\n", ft1000dev->bulk_in_endpointAddr,
ft1000dev->bulk_out_endpointAddr);
ret = request_firmware(&dsp_fw, "ft3000.img", &dev->dev);
if (ret < 0) {
pr_err("Error request_firmware().\n");
goto err_fw;
}
size = max_t(uint, dsp_fw->size, 4096);
pFileStart = kmalloc(size, GFP_KERNEL);
if (!pFileStart) {
release_firmware(dsp_fw);
ret = -ENOMEM;
goto err_fw;
}
memcpy(pFileStart, dsp_fw->data, dsp_fw->size);
FileLength = dsp_fw->size;
//.........这里部分代码省略.........
开发者ID:borkmann,项目名称:kasan,代码行数:101,代码来源:ft1000_usb.c
示例7: switch
static const char *lme_firmware_switch(struct dvb_usb_device *d, int cold)
{
struct lme2510_state *st = d->priv;
struct usb_device *udev = d->udev;
const struct firmware *fw = NULL;
const char *fw_lme;
int ret = 0;
cold = (cold > 0) ? (cold & 1) : 0;
switch (le16_to_cpu(udev->descriptor.idProduct)) {
case 0x1122:
switch (st->dvb_usb_lme2510_firmware) {
default:
st->dvb_usb_lme2510_firmware = TUNER_S0194;
case TUNER_S0194:
fw_lme = fw_s0194;
ret = request_firmware(&fw, fw_lme, &udev->dev);
if (ret == 0) {
cold = 0;
break;
}
st->dvb_usb_lme2510_firmware = TUNER_LG;
case TUNER_LG:
fw_lme = fw_lg;
ret = request_firmware(&fw, fw_lme, &udev->dev);
if (ret == 0)
break;
st->dvb_usb_lme2510_firmware = TUNER_DEFAULT;
break;
}
break;
case 0x1120:
switch (st->dvb_usb_lme2510_firmware) {
default:
st->dvb_usb_lme2510_firmware = TUNER_S7395;
case TUNER_S7395:
fw_lme = fw_c_s7395;
ret = request_firmware(&fw, fw_lme, &udev->dev);
if (ret == 0) {
cold = 0;
break;
}
st->dvb_usb_lme2510_firmware = TUNER_LG;
case TUNER_LG:
fw_lme = fw_c_lg;
ret = request_firmware(&fw, fw_lme, &udev->dev);
if (ret == 0)
break;
st->dvb_usb_lme2510_firmware = TUNER_S0194;
case TUNER_S0194:
fw_lme = fw_c_s0194;
ret = request_firmware(&fw, fw_lme, &udev->dev);
if (ret == 0)
break;
st->dvb_usb_lme2510_firmware = TUNER_DEFAULT;
cold = 0;
break;
}
break;
case 0x22f0:
fw_lme = fw_c_rs2000;
st->dvb_usb_lme2510_firmware = TUNER_RS2000;
break;
default:
fw_lme = fw_c_s7395;
}
release_firmware(fw);
if (cold) {
dvb_usb_lme2510_firmware = st->dvb_usb_lme2510_firmware;
info("FRM Changing to %s firmware", fw_lme);
lme_coldreset(d);
return NULL;
}
return fw_lme;
}
开发者ID:AiWinters,项目名称:linux,代码行数:79,代码来源:lmedm04.c
示例8: ar9170_usb_probe
static int ar9170_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct ar9170_usb *aru;
struct ar9170 *ar;
struct usb_device *udev;
int err;
aru = ar9170_alloc(sizeof(*aru));
if (IS_ERR(aru)) {
err = PTR_ERR(aru);
goto out;
}
udev = interface_to_usbdev(intf);
usb_get_dev(udev);
aru->udev = udev;
aru->intf = intf;
ar = &aru->common;
aru->req_one_stage_fw = ar9170_requires_one_stage(id);
usb_set_intfdata(intf, aru);
SET_IEEE80211_DEV(ar->hw, &intf->dev);
init_usb_anchor(&aru->rx_submitted);
init_usb_anchor(&aru->tx_pending);
init_usb_anchor(&aru->tx_submitted);
init_completion(&aru->cmd_wait);
spin_lock_init(&aru->tx_urb_lock);
aru->tx_pending_urbs = 0;
atomic_set(&aru->tx_submitted_urbs, 0);
aru->common.stop = ar9170_usb_stop;
aru->common.flush = ar9170_usb_flush;
aru->common.open = ar9170_usb_open;
aru->common.tx = ar9170_usb_tx;
aru->common.exec_cmd = ar9170_usb_exec_cmd;
aru->common.callback_cmd = ar9170_usb_callback_cmd;
#ifdef CONFIG_PM
udev->reset_resume = 1;
#endif /* CONFIG_PM */
err = ar9170_usb_reset(aru);
if (err)
goto err_freehw;
err = ar9170_usb_request_firmware(aru);
if (err)
goto err_freehw;
err = ar9170_usb_init_device(aru);
if (err)
goto err_freefw;
err = ar9170_usb_open(ar);
if (err)
goto err_unrx;
err = ar9170_register(ar, &udev->dev);
ar9170_usb_stop(ar);
if (err)
goto err_unrx;
return 0;
err_unrx:
ar9170_usb_cancel_urbs(aru);
err_freefw:
release_firmware(aru->init_values);
release_firmware(aru->firmware);
err_freehw:
usb_set_intfdata(intf, NULL);
usb_put_dev(udev);
ieee80211_free_hw(ar->hw);
out:
return err;
}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:82,代码来源:usb.c
示例9: setup_instance
static int __devinit
setup_instance(struct sfax_hw *card)
{
const struct firmware *firmware;
int i, err;
u_long flags;
snprintf(card->name, MISDN_MAX_IDLEN - 1, "Speedfax.%d", sfax_cnt + 1);
write_lock_irqsave(&card_lock, flags);
list_add_tail(&card->list, &Cards);
write_unlock_irqrestore(&card_lock, flags);
_set_debug(card);
spin_lock_init(&card->lock);
card->isac.hwlock = &card->lock;
card->isar.hwlock = &card->lock;
card->isar.ctrl = (void *)&sfax_ctrl;
card->isac.name = card->name;
card->isar.name = card->name;
card->isar.owner = THIS_MODULE;
err = request_firmware(&firmware, "isdn/ISAR.BIN", &card->pdev->dev);
if (err < 0) {
pr_info("%s: firmware request failed %d\n",
card->name, err);
goto error_fw;
}
if (debug & DEBUG_HW)
pr_notice("%s: got firmware %zu bytes\n",
card->name, firmware->size);
mISDNisac_init(&card->isac, card);
card->isac.dch.dev.D.ctrl = sfax_dctrl;
card->isac.dch.dev.Bprotocols =
mISDNisar_init(&card->isar, card);
for (i = 0; i < 2; i++) {
set_channelmap(i + 1, card->isac.dch.dev.channelmap);
list_add(&card->isar.ch[i].bch.ch.list,
&card->isac.dch.dev.bchannels);
}
err = setup_speedfax(card);
if (err)
goto error_setup;
err = card->isar.init(&card->isar);
if (err)
goto error;
err = mISDN_register_device(&card->isac.dch.dev,
&card->pdev->dev, card->name);
if (err)
goto error;
err = init_card(card);
if (err)
goto error_init;
err = card->isar.firmware(&card->isar, firmware->data, firmware->size);
if (!err) {
release_firmware(firmware);
sfax_cnt++;
pr_notice("SpeedFax %d cards installed\n", sfax_cnt);
return 0;
}
disable_hwirq(card);
free_irq(card->irq, card);
error_init:
mISDN_unregister_device(&card->isac.dch.dev);
error:
release_region(card->cfg, 256);
error_setup:
card->isac.release(&card->isac);
card->isar.release(&card->isar);
release_firmware(firmware);
error_fw:
pci_disable_device(card->pdev);
write_lock_irqsave(&card_lock, flags);
list_del(&card->list);
write_unlock_irqrestore(&card_lock, flags);
kfree(card);
return err;
}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:79,代码来源:speedfax.c
示例10: res_trk_download_firmware
u32 res_trk_download_firmware(void)
{
const struct firmware *fw_boot = NULL;
const struct firmware *fw_mpg4_dec = NULL;
const struct firmware *fw_h263_dec = NULL;
const struct firmware *fw_h264_dec = NULL;
const struct firmware *fw_mpg4_enc = NULL;
const struct firmware *fw_h264_enc = NULL;
const struct firmware *fw_vc1_dec = NULL;
int rc = 0;
u32 status = true;
VCDRES_MSG_HIGH("%s(): Request firmware download\n",
__func__);
mutex_lock(&resource_context.lock);
rc = request_firmware(&fw_boot, VIDC_BOOT_FW,
resource_context.device);
if (rc) {
VCDRES_MSG_ERROR("request_firmware for %s error %d\n",
VIDC_BOOT_FW, rc);
mutex_unlock(&resource_context.lock);
return false;
}
vidc_command_control_fw = (unsigned char *)fw_boot->data;
vidc_command_control_fw_size = (u32) fw_boot->size;
rc = request_firmware(&fw_mpg4_dec, VIDC_MPG4_DEC_FW,
resource_context.device);
if (rc) {
VCDRES_MSG_ERROR("request_firmware for %s error %d\n",
VIDC_MPG4_DEC_FW, rc);
status = false;
goto boot_fw_free;
}
vidc_mpg4_dec_fw = (unsigned char *)fw_mpg4_dec->data;
vidc_mpg4_dec_fw_size = (u32) fw_mpg4_dec->size;
rc = request_firmware(&fw_h263_dec, VIDC_H263_DEC_FW,
resource_context.device);
if (rc) {
VCDRES_MSG_ERROR("request_firmware for %s error %d\n",
VIDC_H263_DEC_FW, rc);
status = false;
goto mp4dec_fw_free;
}
vidc_h263_dec_fw = (unsigned char *)fw_h263_dec->data;
vidc_h263_dec_fw_size = (u32) fw_h263_dec->size;
rc = request_firmware(&fw_h264_dec, VIDC_H264_DEC_FW,
resource_context.device);
if (rc) {
VCDRES_MSG_ERROR("request_firmware for %s error %d\n",
VIDC_H264_DEC_FW, rc);
status = false;
goto h263dec_fw_free;
}
vidc_h264_dec_fw = (unsigned char *)fw_h264_dec->data;
vidc_h264_dec_fw_size = (u32) fw_h264_dec->size;
rc = request_firmware(&fw_mpg4_enc, VIDC_MPG4_ENC_FW,
resource_context.device);
if (rc) {
VCDRES_MSG_ERROR("request_firmware for %s error %d\n",
VIDC_MPG4_ENC_FW, rc);
status = false;
goto h264dec_fw_free;
}
vidc_mpg4_enc_fw = (unsigned char *)fw_mpg4_enc->data;
vidc_mpg4_enc_fw_size = (u32) fw_mpg4_enc->size;
rc = request_firmware(&fw_h264_enc, VIDC_H264_ENC_FW,
resource_context.device);
if (rc) {
VCDRES_MSG_ERROR("request_firmware for %s error %d\n",
VIDC_H264_ENC_FW, rc);
status = false;
goto mp4enc_fw_free;
}
vidc_h264_enc_fw = (unsigned char *)fw_h264_enc->data;
vidc_h264_enc_fw_size = (u32) fw_h264_enc->size;
rc = request_firmware(&fw_vc1_dec, VIDC_VC1_DEC_FW,
resource_context.device);
if (rc) {
VCDRES_MSG_ERROR("request_firmware for %s error %d\n",
VIDC_VC1_DEC_FW, rc);
status = false;
goto h264enc_fw_free;
}
vidc_vc1_dec_fw = (unsigned char *)fw_vc1_dec->data;
vidc_vc1_dec_fw_size = (u32) fw_vc1_dec->size;
mutex_unlock(&resource_context.lock);
return status;
h264enc_fw_free:
release_firmware(fw_h264_enc);
mp4enc_fw_free:
release_firmware(fw_mpg4_enc);
h264dec_fw_free:
//.........这里部分代码省略.........
开发者ID:mifl,项目名称:android_kernel_pantech_msm8660-common,代码行数:101,代码来源:vcd_res_tracker.c
示例11: load_code
static void load_code(struct icom_port *icom_port)
{
const struct firmware *fw;
char __iomem *iram_ptr;
int index;
int status = 0;
void __iomem *dram_ptr = icom_port->dram;
dma_addr_t temp_pci;
unsigned char *new_page = NULL;
unsigned char cable_id = NO_CABLE;
struct pci_dev *dev = icom_port->adapter->pci_dev;
/* Clear out any pending interrupts */
writew(0x3FFF, icom_port->int_reg);
trace(icom_port, "CLEAR_INTERRUPTS", 0);
/* Stop processor */
stop_processor(icom_port);
/* Zero out DRAM */
memset_io(dram_ptr, 0, 512);
/* Load Call Setup into Adapter */
if (request_firmware(&fw, "icom_call_setup.bin", &dev->dev) < 0) {
dev_err(&dev->dev,"Unable to load icom_call_setup.bin firmware image\n");
status = -1;
goto load_code_exit;
}
if (fw->size > ICOM_DCE_IRAM_OFFSET) {
dev_err(&dev->dev, "Invalid firmware image for icom_call_setup.bin found.\n");
release_firmware(fw);
status = -1;
goto load_code_exit;
}
iram_ptr = (char __iomem *)icom_port->dram + ICOM_IRAM_OFFSET;
for (index = 0; index < fw->size; index++)
writeb(fw->data[index], &iram_ptr[index]);
release_firmware(fw);
/* Load Resident DCE portion of Adapter */
if (request_firmware(&fw, "icom_res_dce.bin", &dev->dev) < 0) {
dev_err(&dev->dev,"Unable to load icom_res_dce.bin firmware image\n");
status = -1;
goto load_code_exit;
}
if (fw->size > ICOM_IRAM_SIZE) {
dev_err(&dev->dev, "Invalid firmware image for icom_res_dce.bin found.\n");
release_firmware(fw);
status = -1;
goto load_code_exit;
}
iram_ptr = (char __iomem *) icom_port->dram + ICOM_IRAM_OFFSET;
for (index = ICOM_DCE_IRAM_OFFSET; index < fw->size; index++)
writeb(fw->data[index], &iram_ptr[index]);
release_firmware(fw);
/* Set Hardware level */
if ((icom_port->adapter->version | ADAPTER_V2) == ADAPTER_V2)
writeb(V2_HARDWARE, &(icom_port->dram->misc_flags));
/* Start the processor in Adapter */
start_processor(icom_port);
writeb((HDLC_PPP_PURE_ASYNC | HDLC_FF_FILL),
&(icom_port->dram->HDLCConfigReg));
writeb(0x04, &(icom_port->dram->FlagFillIdleTimer)); /* 0.5 seconds */
writeb(0x00, &(icom_port->dram->CmdReg));
writeb(0x10, &(icom_port->dram->async_config3));
writeb((ICOM_ACFG_DRIVE1 | ICOM_ACFG_NO_PARITY | ICOM_ACFG_8BPC |
ICOM_ACFG_1STOP_BIT), &(icom_port->dram->async_config2));
/*Set up data in icom DRAM to indicate where personality
*code is located and its length.
*/
new_page = pci_alloc_consistent(dev, 4096, &temp_pci);
if (!new_page) {
dev_err(&dev->dev, "Can not allocate DMA buffer\n");
status = -1;
goto load_code_exit;
}
if (request_firmware(&fw, "icom_asc.bin", &dev->dev) < 0) {
dev_err(&dev->dev,"Unable to load icom_asc.bin firmware image\n");
status = -1;
goto load_code_exit;
}
if (fw->size > ICOM_DCE_IRAM_OFFSET) {
dev_err(&dev->dev, "Invalid firmware image for icom_asc.bin found.\n");
release_firmware(fw);
status = -1;
goto load_code_exit;
//.........这里部分代码省略.........
开发者ID:mecke,项目名称:linux-2.6,代码行数:101,代码来源:icom.c
示例12: ath9k_eeprom_release
static void ath9k_eeprom_release(struct ath_softc *sc)
{
release_firmware(sc->sc_ah->eeprom_blob);
}
开发者ID:513855417,项目名称:linux,代码行数:4,代码来源:init.c
示例13: fimc_is_ois_open_fw
int fimc_is_ois_open_fw(struct fimc_is_core *core, char *name, u8 **buf)
{
int ret = 0;
u32 size = 0;
const struct firmware *fw_blob = NULL;
static char fw_name[100];
struct file *fp = NULL;
mm_segment_t old_fs;
long nread;
int fw_requested = 1;
int retry_count = 0;
old_fs = get_fs();
set_fs(KERNEL_DS);
snprintf(fw_name, sizeof(fw_name), "%s%s",FIMC_IS_SETFILE_SDCARD_PATH, name);
fp = filp_open(fw_name, O_RDONLY, 0);
if (IS_ERR_OR_NULL(fp)) {
err("failed to open SDCARD fw!!!");
goto request_fw;
}
fw_requested = 0;
size = fp->f_path.dentry->d_inode->i_size;
pr_info("start read sdcard, file path %s, size %d Bytes\n", fw_name, size);
*buf = vmalloc(size);
if (!(*buf)) {
err("failed to allocate memory");
ret = -ENOMEM;
goto p_err;
}
nread = vfs_read(fp, (char __user *)(*buf), size, &fp->f_pos);
if (nread != size) {
err("failed to read firmware file, %ld Bytes\n", nread);
ret = -EIO;
goto p_err;
}
memcpy(ois_pinfo.header_ver, *buf + nread - OIS_VER_OFFSET, 6);
memcpy(bootCode, *buf, OIS_BOOT_FW_SIZE);
memcpy(progCode, *buf + nread - OIS_PROG_FW_SIZE, OIS_PROG_FW_SIZE);
request_fw:
if (fw_requested) {
snprintf(fw_name, sizeof(fw_name), "%s", name);
set_fs(old_fs);
retry_count = 3;
ret = request_firmware(&fw_blob, fw_name, &core->companion->pdev->dev);
while (--retry_count && ret == -EAGAIN) {
err("request_firmware retry(count:%d)", retry_count);
ret = request_firmware(&fw_blob, fw_name, &core->companion->pdev->dev);
}
if (ret) {
err("request_firmware is fail(ret:%d)", ret);
ret = -EINVAL;
goto p_err;
}
if (!fw_blob) {
err("fw_blob is NULL");
ret = -EINVAL;
goto p_err;
}
if (!fw_blob->data) {
err("fw_blob->data is NULL");
ret = -EINVAL;
goto p_err;
}
size = fw_blob->size;
*buf = vmalloc(size);
if (!(*buf)) {
err("failed to allocate memory");
ret = -ENOMEM;
goto p_err;
}
memcpy((void *)(*buf), fw_blob->data, size);
memcpy(ois_pinfo.header_ver, *buf + size - OIS_VER_OFFSET, 6);
memcpy(bootCode, *buf, OIS_BOOT_FW_SIZE);
memcpy(progCode, *buf + size - OIS_PROG_FW_SIZE, OIS_PROG_FW_SIZE);
}
p_err:
if (!fw_requested) {
if (!IS_ERR_OR_NULL(fp)) {
filp_close(fp, current->files);
}
set_fs(old_fs);
} else {
if (!IS_ERR_OR_NULL(fw_blob)) {
release_firmware(fw_blob);
}
}
return ret;
}
开发者ID:bju2000,项目名称:android_kernel_samsung_slteskt,代码行数:100,代码来源:fimc-is-device-ois.c
示例14: sdma_v3_0_init_microcode
/**
* sdma_v3_0_init_microcode - load ucode images from disk
*
* @adev: amdgpu_device pointer
*
* Use the firmware interface to load the ucode images into
* the driver (not loaded into hw).
* Returns 0 on success, error on failure.
*/
static int sdma_v3_0_init_microcode(struct amdgpu_device *adev)
{
const char *chip_name;
char fw_name[30];
int err = 0, i;
struct amdgpu_firmware_info *info = NULL;
const struct common_firmware_header *header = NULL;
const struct sdma_firmware_header_v1_0 *hdr;
DRM_DEBUG("\n");
switch (adev->asic_type) {
case CHIP_TONGA:
chip_name = "tonga";
break;
case CHIP_FIJI:
chip_name = "fiji";
break;
case CHIP_POLARIS11:
chip_name = "polaris11";
break;
case CHIP_POLARIS10:
chip_name = "polaris10";
break;
case CHIP_POLARIS12:
chip_name = "polaris12";
break;
case CHIP_CARRIZO:
chip_name = "carrizo";
break;
case CHIP_STONEY:
chip_name = "stoney";
break;
default: BUG();
}
for (i = 0; i < adev->sdma.num_instances; i++) {
if (i == 0)
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name);
else
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name);
err = request_firmware(&adev->sdma.instance[i].fw, fw_name, adev->dev);
if (err)
goto out;
err = amdgpu_ucode_validate(adev->sdma.instance[i].fw);
if (err)
goto out;
hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma.instance[i].fw->data;
adev->sdma.instance[i].fw_version = le32_to_cpu(hdr->header.ucode_version);
adev->sdma.instance[i].feature_version = le32_to_cpu(hdr->ucode_feature_version);
if (adev->sdma.instance[i].feature_version >= 20)
adev->sdma.instance[i].burst_nop = true;
if (adev->firmware.smu_load) {
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];
info->ucode_id = AMDGPU_UCODE_ID_SDMA0 + i;
info->fw = adev->sdma.instance[i].fw;
header = (const struct common_firmware_header *)info->fw->data;
adev->firmware.fw_size +=
ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
}
}
out:
if (err) {
printk(KERN_ERR
"sdma_v3_0: Failed to load firmware \"%s\"\n",
fw_name);
for (i = 0; i < adev->sdma.num_instances; i++) {
release_firmware(adev->sdma.instance[i].fw);
adev->sdma.instance[i].fw = NULL;
}
}
return err;
}
开发者ID:igithubaccount,项目名称:linux,代码行数:83,代码来源:sdma_v3_0.c
示例15: msenc_read_ucode
int msenc_read_ucode(struct platform_device *dev, const char *fw_name)
{
struct msenc *m = get_msenc(dev);
const struct firmware *ucode_fw;
int err;
ucode_fw = nvhost_client_request_firmware(dev, fw_name);
if (IS_ERR_OR_NULL(ucode_fw)) {
dev_err(&dev->dev, "failed to get msenc firmware\n");
err = -ENOENT;
return err;
}
/* allocate pages for ucode */
m->mem_r = mem_op().alloc(nvhost_get_host(dev)->memmgr,
roundup(ucode_fw->size, PAGE_SIZE),
PAGE_SIZE, mem_mgr_flag_uncacheable);
if (IS_ERR_OR_NULL(m->mem_r)) {
dev_err(&dev->dev, "nvmap alloc failed");
err = -ENOMEM;
goto clean_up;
}
m->pa = mem_op().pin(nvhost_get_host(dev)->memmgr, m->mem_r);
if (IS_ERR_OR_NULL(m->pa)) {
dev_err(&dev->dev, "nvmap pin failed for ucode");
err = PTR_ERR(m->pa);
m->pa = NULL;
goto clean_up;
}
m->mapped = mem_op().mmap(m->mem_r);
if (IS_ERR_OR_NULL(m->mapped)) {
dev_err(&dev->dev, "nvmap mmap failed");
err = -ENOMEM;
goto clean_up;
}
err = msenc_setup_ucode_image(dev, (u32 *)m->mapped, ucode_fw);
if (err) {
dev_err(&dev->dev, "failed to parse firmware image\n");
return err;
}
m->valid = true;
release_firmware(ucode_fw);
return 0;
clean_up:
if (m->mapped) {
mem_op().munmap(m->mem_r, (u32 *)m->mapped);
m->mapped = NULL;
}
if (m->pa) {
mem_op().unpin(nvhost_get_host(dev)->memmgr, m->mem_r, m->pa);
m->pa = NULL;
}
if (m->mem_r) {
mem_op().put(nvhost_get_host(dev)->memmgr, m->mem_r);
m->mem_r = NULL;
}
release_firmware(ucode_fw);
return err;
}
开发者ID:vocoderism,项目名称:Tegra-Note-7,代码行数:66,代码来源:msenc.c
示例16: fake_wb_bus_exit
static void __exit fake_wb_bus_exit(void)
{
wb_unregister_bus(&fake_wb_bus);
release_firmware(wb_fw);
device_unregister(&fake_wbbus_device);
}
开发者ID:qermit,项目名称:fpga-config-space,代码行数:6,代码来源:fake_wb_bus.c
示例17: init_firmware
bool init_firmware(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
bool rt_status = TRUE;
u32 file_length = 0;
u8 *mapped_file = NULL;
u32 init_step = 0;
opt_rst_type_e rst_opt = OPT_SYSTEM_RESET;
firmware_init_step_e starting_state = FW_INIT_STEP0_BOOT;
rt_firmware *pfirmware = priv->pFirmware;
const struct firmware *fw_entry;
const char *fw_name[3] = { "RTL8192U/boot.img",
"RTL8192U/main.img",
"RTL8192U/data.img"};
int rc;
RT_TRACE(COMP_FIRMWARE, " PlatformInitFirmware()==>\n");
if (pfirmware->firmware_status == FW_STATUS_0_INIT ) {
/* it is called by reset */
rst_opt = OPT_SYSTEM_RESET;
starting_state = FW_INIT_STEP0_BOOT;
// TODO: system reset
}else if(pfirmware->firmware_status == FW_STATUS_5_READY) {
/* it is called by Initialize */
rst_opt = OPT_FIRMWARE_RESET;
starting_state = FW_INIT_STEP2_DATA;
}else {
RT_TRACE(COMP_FIRMWARE, "PlatformInitFirmware: undefined firmware state\n");
}
/*
* Download boot, main, and data image for System reset.
* Download data image for firmware reset
*/
for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) {
/*
* Open image file, and map file to continuous memory if open file success.
* or read image file from array. Default load from IMG file
*/
if(rst_opt == OPT_SYSTEM_RESET) {
rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev);
if(rc < 0 ) {
RT_TRACE(COMP_ERR, "request firmware fail!\n");
goto download_firmware_fail;
}
if(fw_entry->size > sizeof(pfirmware->firmware_buf)) {
RT_TRACE(COMP_ERR, "img file size exceed the container buffer fail!\n");
goto download_firmware_fail;
}
if(init_step != FW_INIT_STEP1_MAIN) {
memcpy(pfirmware->firmware_buf,fw_entry->data,fw_entry->size);
mapped_file = pfirmware->firmware_buf;
file_length = fw_entry->size;
} else {
#ifdef RTL8190P
memcpy(pfirmware->firmware_buf,fw_entry->data,fw_entry->size);
mapped_file = pfirmware->firmware_buf;
file_length = fw_entry->size;
#else
memset(pfirmware->firmware_buf,0,128);
memcpy(&pfirmware->firmware_buf[128],fw_entry->data,fw_entry->size);
mapped_file = pfirmware->firmware_buf;
file_length = fw_entry->size + 128;
#endif
}
pfirmware->firmware_buf_size = file_length;
}else if(rst_opt == OPT_FIRMWARE_RESET ) {
/* we only need to download data.img here */
mapped_file = pfirmware->firmware_buf;
file_length = pfirmware->firmware_buf_size;
}
/* Download image file */
/* The firmware download process is just as following,
* 1. that is each packet will be segmented and inserted to the wait queue.
* 2. each packet segment will be put in the skb_buff packet.
* 3. each skb_buff packet data content will already include the firmware info
* and Tx descriptor info
* */
rt_status = fw_download_code(dev,mapped_file,file_length);
if(rst_opt == OPT_SYSTEM_RESET) {
release_firmware(fw_entry);
}
if(rt_status != TRUE) {
goto download_firmware_fail;
}
switch(init_step) {
case FW_INIT_STEP0_BOOT:
/* Download boot
* initialize command descriptor.
* will set polling bit when firmware code is also configured
*/
//.........这里部分代码省略.........
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:101,代码来源:r819xU_firmware.c
示例18: switch
/*
* predef should be 0 for loading user defined mcs
* predef should be YAM_1200 for loading predef 1200 mcs
* predef should be YAM_9600 for loading predef 9600 mcs
*/
static unsigned char *add_mcs(unsigned char *bits, int bitrate,
unsigned int predef)
{
const char *fw_name[2] = {FIRMWARE_9600, FIRMWARE_1200};
const struct firmware *fw;
struct platform_device *pdev;
struct yam_mcs *p;
int err;
switch (predef) {
case 0:
fw = NULL;
break;
case YAM_1200:
case YAM_9600:
predef--;
pdev = platform_device_register_simple("yam", 0, NULL, 0);
if (IS_ERR(pdev)) {
printk(KERN_ERR "yam: Failed to register firmware\n");
return NULL;
}
err = request_firmware(&fw, fw_name[predef], &pdev->dev);
platform_device_unregister(pdev);
if (err) {
printk(KERN_ERR "Failed to load firmware \"%s\"\n",
fw_name[predef]);
return NULL;
}
if (fw->size != YAM_FPGA_SIZE) {
printk(KERN_ERR "Bogus length %zu in firmware \"%s\"\n",
fw->size, fw_name[predef]);
release_firmware(fw);
return NULL;
}
bits
|
请发表评论