From 1b84244a0e9bcb40cb60eaeab04a6a7845f51f40 Mon Sep 17 00:00:00 2001 From: Patrik Jakobsson Date: Sun, 3 Jul 2016 01:13:21 +0200 Subject: [PATCH] fthd: Clean up debug/info/error messages Go for the pr_ macros instead of dev_ Signed-off-by: Patrik Jakobsson --- fthd_buffer.c | 5 +-- fthd_drv.c | 21 +++++----- fthd_hw.c | 106 ++++++++++++++++++------------------------------- fthd_hw.h | 18 +++------ fthd_isp.c | 99 +++++++++++++++++++++++---------------------- fthd_ringbuf.c | 7 ++-- 6 files changed, 112 insertions(+), 144 deletions(-) diff --git a/fthd_buffer.c b/fthd_buffer.c index ca2ecca..fe20ca3 100644 --- a/fthd_buffer.c +++ b/fthd_buffer.c @@ -69,9 +69,8 @@ struct iommu_obj *fthd_iommu_alloc_sgtable(struct fthd_private *dev_priv, ret = allocate_resource(root, &obj->base, total_len, root->start, root->end, 1, NULL, NULL); if (ret) { - dev_err(&dev_priv->pdev->dev, - "Failed to allocate resource (size: %d, start: %Ld, end: %Ld)\n", - total_len, root->start, root->end); + pr_err("Failed to allocate resource (size: %d, start: %Ld, end: %Ld)\n", + total_len, root->start, root->end); kfree(obj); obj = NULL; diff --git a/fthd_drv.c b/fthd_drv.c index 7717c47..343e516 100644 --- a/fthd_drv.c +++ b/fthd_drv.c @@ -45,13 +45,13 @@ static int fthd_pci_reserve_mem(struct fthd_private *dev_priv) /* Reserve resources */ ret = pci_request_region(dev_priv->pdev, FTHD_PCI_S2_IO, "S2 IO"); if (ret) { - dev_err(&dev_priv->pdev->dev, "Failed to request S2 IO\n"); + pr_err("Failed to request S2 IO\n"); return ret; } ret = pci_request_region(dev_priv->pdev, FTHD_PCI_ISP_IO, "ISP IO"); if (ret) { - dev_err(&dev_priv->pdev->dev, "Failed to request ISP IO\n"); + pr_err("Failed to request ISP IO\n"); pci_release_region(dev_priv->pdev, FTHD_PCI_S2_IO); return ret; } @@ -265,7 +265,7 @@ static void fthd_irq_work(struct work_struct *work) } if (i >= 500) { - dev_err(&dev_priv->pdev->dev, "irq stuck, disabling\n"); + pr_err("irq stuck, disabling\n"); fthd_irq_uninstall(dev_priv); } pci_write_config_dword(dev_priv->pdev, 0x94, 0x200); @@ -297,7 +297,7 @@ static int fthd_irq_install(struct fthd_private *dev_priv) KBUILD_MODNAME, (void *)dev_priv); if (ret) - dev_err(&dev_priv->pdev->dev, "Failed to request IRQ\n"); + pr_err("Failed to request IRQ\n"); return ret; } @@ -309,7 +309,7 @@ static int fthd_pci_set_dma_mask(struct fthd_private *dev_priv, ret = dma_set_mask_and_coherent(&dev_priv->pdev->dev, DMA_BIT_MASK(mask)); if (ret) { - dev_err(&dev_priv->pdev->dev, "Failed to set %u pci dma mask\n", + pr_err("Failed to set %u pci dma mask\n", mask); return ret; } @@ -373,7 +373,7 @@ static int fthd_pci_init(struct fthd_private *dev_priv) ret = pci_enable_device(pdev); if (ret) { - dev_err(&pdev->dev, "Failed to enable device\n"); + pr_err("Failed to enable device\n"); return ret; } @@ -383,7 +383,7 @@ static int fthd_pci_init(struct fthd_private *dev_priv) ret = pci_enable_msi(pdev); if (ret) { - dev_err(&pdev->dev, "Failed to enable MSI\n"); + pr_err("Failed to enable MSI\n"); goto fail_reserve; } @@ -398,7 +398,7 @@ static int fthd_pci_init(struct fthd_private *dev_priv) if (ret) goto fail_irq; - dev_info(&pdev->dev, "Setting %ubit DMA mask\n", dev_priv->dma_mask); + pr_debug("Setting %ubit DMA mask\n", dev_priv->dma_mask); pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(dev_priv->dma_mask)); pci_set_master(pdev); @@ -448,12 +448,11 @@ static int fthd_pci_probe(struct pci_dev *pdev, struct fthd_private *dev_priv; int ret; - dev_info(&pdev->dev, "Found FaceTime HD camera with device id: %x\n", - pdev->device); + pr_info("Found FaceTime HD camera with device id: %x\n", pdev->device); dev_priv = kzalloc(sizeof(struct fthd_private), GFP_KERNEL); if (!dev_priv) { - dev_err(&pdev->dev, "Failed to allocate memory\n"); + pr_err("Failed to allocate memory\n"); return -ENOMEM; } diff --git a/fthd_hw.c b/fthd_hw.c index 8d4af55..6befbb8 100644 --- a/fthd_hw.c +++ b/fthd_hw.c @@ -60,7 +60,7 @@ static int fthd_hw_s2_pll_reset(struct fthd_private *dev_priv) FTHD_S2_REG_WRITE(0x3, S2_PLL_CTRL_14); - dev_info(&dev_priv->pdev->dev, "PLL reset finished\n"); + pr_debug("PLL reset finished\n"); return 0; } @@ -79,13 +79,12 @@ static int fthd_hw_s2_init_pcie_link(struct fthd_private *dev_priv) /* Check if PLL is powered down when S2 PCIe link is in L1 state */ reg = FTHD_S2_REG_READ(S2_PCIE_LINK_D124); if (reg != 0xac5800) { - dev_err(&dev_priv->pdev->dev, - "Failed to init S2 PCIe link: %08x\n", reg); + pr_err("Failed to init S2 PCIe link: %08x\n", reg); return -EIO; } /* PLL is powered down */ - dev_info(&dev_priv->pdev->dev, "S2 PCIe link init succeeded\n"); + pr_debug("S2 PCIe link init succeeded\n"); FTHD_S2_REG_WRITE(0x1f08, S2_PCIE_LINK_D128); FTHD_S2_REG_WRITE(0x80008610, S2_PCIE_LINK_D12C); @@ -109,9 +108,9 @@ static int fthd_hw_s2_pll_init(struct fthd_private *dev_priv, u32 ddr_speed) ref_clk_25 = reg & S2_PLL_REFCLK_25MHZ ? 1 : 0; if (ref_clk_25) - dev_info(&dev_priv->pdev->dev, "Refclk: 25MHz (0x%x)\n", reg); + pr_info("Refclk: 25MHz (0x%x)\n", reg); else - dev_info(&dev_priv->pdev->dev, "Refclk: 24MHz (0x%x\n", reg); + pr_info("Refclk: 24MHz (0x%x\n", reg); if (ddr_speed == 400) { if (ref_clk_25) { @@ -145,9 +144,8 @@ static int fthd_hw_s2_pll_init(struct fthd_private *dev_priv, u32 ddr_speed) } } else { if (ddr_speed != 450) { - dev_err(&dev_priv->pdev->dev, - "Unsupported DDR speed %uMHz, using 450MHz\n", - ddr_speed); + pr_err("Unsupported DDR speed %uMHz, using 450MHz\n", + ddr_speed); ddr_speed = 450; } @@ -165,7 +163,7 @@ static int fthd_hw_s2_pll_init(struct fthd_private *dev_priv, u32 ddr_speed) fthd_hw_s2_pll_reset(dev_priv); - dev_info(&dev_priv->pdev->dev, "Waiting for S2 PLL to lock at %d MHz\n", + pr_debug("Waiting for S2 PLL to lock at %d MHz\n", ddr_speed); do { @@ -175,12 +173,10 @@ static int fthd_hw_s2_pll_init(struct fthd_private *dev_priv, u32 ddr_speed) } while (((reg & 0xff00) & S2_PLL_CMU_STATUS_LOCKED) && retries <= 10000); if (retries > 10000) { - dev_info(&dev_priv->pdev->dev, "Failed to lock S2 PLL: 0x%x\n", - reg); + pr_err("Failed to lock S2 PLL: 0x%x\n", reg); return -EINVAL; } else { - dev_info(&dev_priv->pdev->dev, "S2 PLL is locked after %d us\n", - (retries * 10)); + pr_debug("S2 PLL is locked after %d us\n", (retries * 10)); } reg = FTHD_S2_REG_READ(S2_PLL_STATUS_A8); @@ -189,9 +185,9 @@ static int fthd_hw_s2_pll_init(struct fthd_private *dev_priv, u32 ddr_speed) reg = FTHD_S2_REG_READ(S2_PLL_STATUS_A8); if (reg & S2_PLL_BYPASS) - dev_info(&dev_priv->pdev->dev, "S2 PLL is in bypass mode\n"); + pr_debug("S2 PLL is in bypass mode\n"); else - dev_info(&dev_priv->pdev->dev, "S2 PLL is in non-bypass mode\n"); + pr_debug("S2 PLL is in non-bypass mode\n"); return 0; } @@ -240,9 +236,8 @@ static inline int fthd_hw_ddr_status_busy(struct fthd_private *dev_priv, } if (i >= retries) { - dev_err(&dev_priv->pdev->dev, - "S2_DDR_STATUS_2018 busy: retries=%d, udelay=%d, reg=0x%08x\n", - retries, delay, reg); + pr_err("S2_DDR_STATUS_2018 busy: retries=%d, udelay=%d, reg=0x%08x\n", + retries, delay, reg); return -EBUSY; } @@ -282,8 +277,7 @@ static int fthd_hw_ddr_rewrite_mode_regs(struct fthd_private *dev_priv) if (ret != 0) return ret; - dev_info(&dev_priv->pdev->dev, - "Rewrite DDR mode registers succeeded\n"); + pr_debug("Rewrite DDR mode registers succeeded\n"); return 0; } @@ -300,13 +294,12 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) /* Read PCI config command register */ ret = pci_read_config_dword(dev_priv->pdev, 4, &cmd); if (ret) { - dev_err(&dev_priv->pdev->dev, "Failed to read PCI config\n"); + pr_err("Failed to read PCI config\n"); return -EIO; } if ((cmd & 0x07) == 0) { - dev_err(&dev_priv->pdev->dev, - "PCI link in illegal state, cfg_cmd_reg: 0x%x\n", cmd); + pr_err("PCI link in illegal state, cfg_cmd_reg: 0x%x\n", cmd); return -EIO; } @@ -339,8 +332,7 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) } if (i > 10000) { - dev_err(&dev_priv->pdev->dev, - "Failed to lock DDR PHY PLL in stage 1\n"); + pr_err("Failed to lock DDR PHY PLL in stage 1\n"); return -EIO; } @@ -354,8 +346,7 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) } if (i > 10000) { - dev_err(&dev_priv->pdev->dev, - "Failed to lock DDR PHY PLL in stage 2\n"); + pr_err("Failed to lock DDR PHY PLL in stage 2\n"); return -EIO; } @@ -373,13 +364,11 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) } if (i > 10000) { - dev_err(&dev_priv->pdev->dev, - "Failed to lock DDR PHY PLL in stage 3\n"); + pr_err("Failed to lock DDR PHY PLL in stage 3\n"); return -EIO; } - dev_info(&dev_priv->pdev->dev, - "DDR40 PHY PLL locked on safe settings\n"); + pr_debug("DDR40 PHY PLL locked on safe settings\n"); /* Default is DDR model 4 */ switch (dev_priv->ddr_model) { @@ -430,22 +419,19 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) } if (i >= 10000) { - dev_err(&dev_priv->pdev->dev, - "Timeout waiting for STRAP valid\n"); + pr_err("Timeout waiting for STRAP valid\n"); return -ENODEV; } else { - dev_info(&dev_priv->pdev->dev, "STRAP valid\n"); + pr_debug("STRAP valid\n"); } /* Manual DDR40 PHY init */ if (dev_priv->ddr_speed != 450) { - dev_warn(&dev_priv->pdev->dev, - "DDR frequency is %u (should be 450 MHz)", + pr_warn("DDR frequency is %u (should be 450 MHz)", dev_priv->ddr_speed); } - dev_info(&dev_priv->pdev->dev, - "Configuring DDR PLLs for %u MHz\n", dev_priv->ddr_speed); + pr_debug("Configuring DDR PLLs for %u MHz\n", dev_priv->ddr_speed); if ((dev_priv->ddr_speed * 2) < 500) val = 0x2040; @@ -473,11 +459,11 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) } if (i >= 100) { - dev_err(&dev_priv->pdev->dev, "Failed to lock the DDR PLL\n"); + pr_err("Failed to lock the DDR PLL\n"); return -ENODEV; } - dev_info(&dev_priv->pdev->dev, "DDR40 PLL is locked after %d us\n", i); + pr_info("DDR40 PLL is locked after %d us\n", i); /* Configure DDR40 VDL */ FTHD_S2_REG_WRITE(0, S2_DDR40_PHY_VDL_CTL); @@ -492,18 +478,13 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) } if (reg & 0x1) { - dev_info(&dev_priv->pdev->dev, - "First DDR40 VDL calibration completed after %d us", - i); + pr_debug("First DDR40 VDL calibration completed after %d us", i); - if ((reg & 0x2) == 0) { - dev_info(&dev_priv->pdev->dev, - "...but failed to lock\n"); - } + if ((reg & 0x2) == 0) + pr_debug("...but failed to lock\n"); } else { - dev_err(&dev_priv->pdev->dev, - "First DDR40 VDL calibration failed\n"); + pr_err("First DDR40 VDL calibration failed\n"); } FTHD_S2_REG_WRITE(0, S2_DDR40_PHY_VDL_CTL); @@ -517,20 +498,17 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) udelay(1); } - dev_info(&dev_priv->pdev->dev, - "Second DDR40 VDL calibration completed after %d us\n", i); + pr_debug("Second DDR40 VDL calibration completed after %d us\n", i); if (reg & 0x2) { step_size = (reg & S2_DDR40_PHY_VDL_STEP_MASK) >> S2_DDR40_PHY_VDL_STEP_SHIFT; - dev_info(&dev_priv->pdev->dev, "Using step size %u\n", - step_size); + pr_debug("Using step size %u\n", step_size); } else { val = 1000000 / dev_priv->ddr_speed; step_size = (val * 0x4ec4ec4f) >> 22; - dev_info(&dev_priv->pdev->dev, "Using default step size (%u)\n", - step_size); + pr_debug("Using default step size (%u)\n", step_size); } dev_priv->vdl_step_size = step_size; @@ -558,8 +536,7 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) FTHD_S2_REG_WRITE(vdl_coarse, S2_DDR40_PHY_VDL_OVR_COARSE); - dev_info(&dev_priv->pdev->dev, - "VDL set to: coarse=0x%x, fine=0x%x\n", + pr_debug("VDL set to: coarse=0x%x, fine=0x%x\n", vdl_coarse, vdl_fine); } @@ -573,7 +550,7 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) FTHD_S2_REG_WRITE(0x4, S2_DDR40_PHY_VTT_CTL); - dev_info(&dev_priv->pdev->dev, "Virtual VTT enabled"); + pr_debug("Virtual VTT enabled"); /* Process, Voltage and Temperature compensation */ FTHD_S2_REG_WRITE(0xc0fff, S2_DDR40_PHY_ZQ_PVT_COMP_CTL); @@ -616,8 +593,7 @@ static int fthd_hw_s2_init_ddr_controller_soc(struct fthd_private *dev_priv) /* Read DRAM mem address (FIXME: Need to mask a few bits here) */ reg = FTHD_S2_REG_READ(S2_DDR40_STRAP_STATUS); - dev_info(&dev_priv->pdev->dev, - "S2 DRAM memory address: 0x%08x\n", reg); + pr_debug("S2 DRAM memory address: 0x%08x\n", reg); switch (dev_priv->ddr_model) { case 4: @@ -695,11 +671,9 @@ int fthd_hw_init(struct fthd_private *dev_priv) ret = fthd_ddr_verify_mem(dev_priv, 0, 1024 * 1024); if (ret) { - dev_err(&dev_priv->pdev->dev, - "Full memory verification failed! (%d)\n", ret); + pr_err("Memory verification failed! (%d)\n", ret); } else { - dev_info(&dev_priv->pdev->dev, - "Full memory verification succeeded! (%d)\n", ret); + pr_debug("Memory verification succeeded!\n"); } /* Save our working configuration */ @@ -714,7 +688,6 @@ int fthd_hw_init(struct fthd_private *dev_priv) if (ret) goto out; - dev_info(&dev_priv->pdev->dev, "Enabling interrupts\n"); fthd_irq_enable(dev_priv); out: return ret; @@ -722,7 +695,6 @@ out: void fthd_hw_deinit(struct fthd_private *dev_priv) { - dev_info(&dev_priv->pdev->dev, "%s", __FUNCTION__); FTHD_ISP_REG_WRITE(0, ISP_REG_41020); fthd_irq_disable(dev_priv); } diff --git a/fthd_hw.h b/fthd_hw.h index eae89b3..56597e5 100644 --- a/fthd_hw.h +++ b/fthd_hw.h @@ -42,8 +42,7 @@ static inline void fthd_hw_pci_post(struct fthd_private *dev_priv) static inline u32 _FTHD_S2_REG_READ(struct fthd_private *dev_priv, u32 offset) { if (offset >= dev_priv->s2_io_len) { - dev_err(&dev_priv->pdev->dev, - "S2 IO read out of range at %u\n", offset); + pr_err("S2 IO read out of range at %u\n", offset); return 0; } @@ -54,8 +53,7 @@ static inline void _FTHD_S2_REG_WRITE(struct fthd_private *dev_priv, u32 val, u32 offset) { if (offset >= dev_priv->s2_io_len) { - dev_err(&dev_priv->pdev->dev, - "S2 IO write out of range at %u\n", offset); + pr_err("S2 IO write out of range at %u\n", offset); return; } @@ -66,8 +64,7 @@ static inline void _FTHD_S2_REG_WRITE(struct fthd_private *dev_priv, u32 val, static inline u32 _FTHD_S2_MEM_READ(struct fthd_private *dev_priv, u32 offset) { if (offset >= dev_priv->s2_mem_len) { - dev_err(&dev_priv->pdev->dev, - "S2 MEM read out of range at %u\n", offset); + pr_err("S2 MEM read out of range at %u\n", offset); return 0; } @@ -78,8 +75,7 @@ static inline void _FTHD_S2_MEM_WRITE(struct fthd_private *dev_priv, u32 val, u32 offset) { if (offset >= dev_priv->s2_mem_len) { - dev_err(&dev_priv->pdev->dev, - "S2 MEM write out of range at %u\n", offset); + pr_err("S2 MEM write out of range at %u\n", offset); return; } @@ -102,8 +98,7 @@ static inline void _FTHD_S2_MEMCPY_FROMIO(struct fthd_private *dev_priv, void *b static inline u32 _FTHD_ISP_REG_READ(struct fthd_private *dev_priv, u32 offset) { if (offset >= dev_priv->isp_io_len) { - dev_err(&dev_priv->pdev->dev, - "ISP IO read out of range at %u\n", offset); + pr_err("ISP IO read out of range at %u\n", offset); return 0; } @@ -114,8 +109,7 @@ static inline void _FTHD_ISP_REG_WRITE(struct fthd_private *dev_priv, u32 val, u32 offset) { if (offset >= dev_priv->isp_io_len) { - dev_err(&dev_priv->pdev->dev, - "ISP IO write out of range at %u\n", offset); + pr_err("ISP IO write out of range at %u\n", offset); return; } diff --git a/fthd_isp.c b/fthd_isp.c index 9dba848..7af13a0 100644 --- a/fthd_isp.c +++ b/fthd_isp.c @@ -44,10 +44,10 @@ int isp_mem_init(struct fthd_private *dev_priv) FTHD_MEM_FW_SIZE); if (!dev_priv->firmware) { - dev_err(&dev_priv->pdev->dev, - "Failed to preallocate firmware memory\n"); + pr_err("Failed to preallocate firmware memory\n"); return -ENOMEM; } + return 0; } @@ -67,9 +67,8 @@ struct isp_mem_obj *isp_mem_create(struct fthd_private *dev_priv, ret = allocate_resource(root, &obj->base, size, root->start, root->end, PAGE_SIZE, NULL, NULL); if (ret) { - dev_err(&dev_priv->pdev->dev, - "Failed to allocate resource (size: %Ld, start: %Ld, end: %Ld)\n", - size, root->start, root->end); + pr_err("Failed to allocate resource (size: %Ld, start: %Ld, end: %Ld)\n", + size, root->start, root->end); kfree(obj); obj = NULL; } @@ -101,11 +100,9 @@ static int isp_acpi_set_power(struct fthd_private *dev_priv, int power) union acpi_object *result; int ret = 0; - handle = ACPI_HANDLE(&dev_priv->pdev->dev); - if(!handle) { - dev_err(&dev_priv->pdev->dev, - "Failed to get S2 CMPE ACPI handle\n"); + if (!handle) { + pr_err("Failed to get S2 CMPE ACPI handle\n"); ret = -ENODEV; goto out; } @@ -118,8 +115,7 @@ static int isp_acpi_set_power(struct fthd_private *dev_priv, int power) status = acpi_evaluate_object(handle, "CMPE", &arg_list, &buffer); if (ACPI_FAILURE(status)) { - dev_err(&dev_priv->pdev->dev, - "Failed to execute S2 CMPE ACPI method\n"); + pr_err("Failed to execute S2 CMPE ACPI method\n"); ret = -ENODEV; goto out; } @@ -127,8 +123,7 @@ static int isp_acpi_set_power(struct fthd_private *dev_priv, int power) result = buffer.pointer; if (result->type != ACPI_TYPE_INTEGER || result->integer.value != 0) { - dev_err(&dev_priv->pdev->dev, - "Invalid ACPI response (len: %Ld)\n", buffer.length); + pr_err("Invalid ACPI response (len: %Ld)\n", buffer.length); ret = -EINVAL; } @@ -156,11 +151,11 @@ static int isp_load_firmware(struct fthd_private *dev_priv) return -ENOMEM; if (dev_priv->firmware->base.start != dev_priv->mem->start) { - dev_err(&dev_priv->pdev->dev, - "Misaligned firmware memory object (offset: %lu)\n", - dev_priv->firmware->offset); + pr_err("Misaligned firmware memory object (offset: %lu)\n", + dev_priv->firmware->offset); isp_mem_destroy(dev_priv->firmware); dev_priv->firmware = NULL; + return -EBUSY; } @@ -168,8 +163,7 @@ static int isp_load_firmware(struct fthd_private *dev_priv) /* Might need a flush here if we map ISP memory cached */ - dev_info(&dev_priv->pdev->dev, "Loaded firmware, size: %lukb\n", - fw->size / 1024); + pr_debug("Loaded firmware, size: %lukb\n", fw->size / 1024); release_firmware(fw); @@ -254,10 +248,11 @@ static int isp_fill_channel_info(struct fthd_private *dev_priv, int offset, int || !dev_priv->channel_shared_malloc || !dev_priv->channel_io || !dev_priv->channel_buf_h2t || !dev_priv->channel_buf_t2h || !dev_priv->channel_io_t2h) { - dev_err(&dev_priv->pdev->dev, "did not find all of the required channels\n"); + pr_err("Did not find all of the required channels\n"); goto out; } return 0; + out: isp_free_channel_info(dev_priv); return -ENOMEM; @@ -285,7 +280,7 @@ static int fthd_isp_cmd(struct fthd_private *dev_priv, enum fthd_isp_cmds comman request = isp_mem_create(dev_priv, FTHD_MEM_CMD, len); if (!request) { - dev_err(&dev_priv->pdev->dev, "failed to allocate cmd memory object\n"); + pr_err("Failed to allocate cmd memory object\n"); return -ENOMEM; } @@ -356,11 +351,11 @@ int fthd_isp_debug_cmd(struct fthd_private *dev_priv, enum fthd_isp_cmds command } len += sizeof(struct isp_cmd_hdr); - pr_debug("sending debug cmd %d to firmware\n", command); + pr_debug("Sending debug cmd %d to firmware\n", command); request = isp_mem_create(dev_priv, FTHD_MEM_CMD, len); if (!request) { - dev_err(&dev_priv->pdev->dev, "failed to allocate cmd memory object\n"); + pr_err("Failed to allocate cmd memory object\n"); return -ENOMEM; } @@ -368,10 +363,14 @@ int fthd_isp_debug_cmd(struct fthd_private *dev_priv, enum fthd_isp_cmds command FTHD_S2_MEMCPY_TOIO(request->offset, &cmd, sizeof(struct isp_cmd_hdr)); if (request_len) - FTHD_S2_MEMCPY_TOIO(request->offset + sizeof(struct isp_cmd_hdr), buf, request_len); + FTHD_S2_MEMCPY_TOIO(request->offset + sizeof(struct isp_cmd_hdr), + buf, request_len); ret = fthd_channel_ringbuf_send(dev_priv, dev_priv->channel_debug, - request->offset, request_len + 8, (response_len ? *response_len : 0) + 8, &entry); + request->offset, request_len + 8, + (response_len ? *response_len : 0) + 8, + &entry); + if (ret) goto out; @@ -380,26 +379,30 @@ int fthd_isp_debug_cmd(struct fthd_private *dev_priv, enum fthd_isp_cmds command goto out; } - ret = fthd_channel_wait_ready(dev_priv, dev_priv->channel_debug, entry, 20000); + ret = fthd_channel_wait_ready(dev_priv, dev_priv->channel_debug, entry, + 20000); if (ret) { if (response_len) *response_len = 0; goto out; } - FTHD_S2_MEMCPY_FROMIO(&cmd, request->offset, sizeof(struct isp_cmd_hdr)); + FTHD_S2_MEMCPY_FROMIO(&cmd, request->offset, + sizeof(struct isp_cmd_hdr)); address = FTHD_S2_MEM_READ(entry + FTHD_RINGBUF_ADDRESS_FLAGS); request_size = FTHD_S2_MEM_READ(entry + FTHD_RINGBUF_REQUEST_SIZE); response_size = FTHD_S2_MEM_READ(entry + FTHD_RINGBUF_RESPONSE_SIZE); - /* XXX: response size in the ringbuf is zero after command completion, how is buffer size - verification done? */ + /* + * FIXME: response size in the ringbuf is zero after command completion, + * how is buffer size verification done? + **/ if (response_len && *response_len) FTHD_S2_MEMCPY_FROMIO(buf, (address & ~3) + sizeof(struct isp_cmd_hdr), *response_len); - pr_info("status %04x, request_len %d response len %d address_flags %x\n", cmd.status, - request_size, response_size, address); + pr_info("status %04x, request_len %d response len %d address_flags %x\n", + cmd.status, request_size, response_size, address); ret = 0; out: @@ -465,9 +468,10 @@ int isp_powerdown(struct fthd_private *dev_priv) } if (retries >= 100) { - dev_info(&dev_priv->pdev->dev, "deinit failed!\n"); + pr_debug("deinit failed!\n"); return -EIO; } + return 0; } @@ -1310,25 +1314,22 @@ int isp_init(struct fthd_private *dev_priv) } if (retries >= 1000) { - dev_info(&dev_priv->pdev->dev, "Init failed! No wake signal\n"); + pr_debug("Init failed! No wake signal\n"); return -EIO; } - dev_info(&dev_priv->pdev->dev, "ISP woke up after %dms\n", - (retries - 1) * 10); + pr_debug("ISP woke up after %dms\n", (retries - 1) * 10); FTHD_ISP_REG_WRITE(0xffffffff, ISP_IRQ_CLEAR); num_channels = FTHD_ISP_REG_READ(ISP_FW_CHAN_CTRL); queue_size = FTHD_ISP_REG_READ(ISP_FW_QUEUE_CTRL) + 1; - dev_info(&dev_priv->pdev->dev, - "Number of IPC channels: %u, queue size: %u\n", + pr_debug("Number of IPC channels: %u, queue size: %u\n", num_channels, queue_size); if (num_channels > 32) { - dev_info(&dev_priv->pdev->dev, "Too many IPC channels: %u\n", - num_channels); + pr_err("Too many IPC channels: %u\n", num_channels); return -EIO; } @@ -1352,13 +1353,12 @@ int isp_init(struct fthd_private *dev_priv) heap_size = (heap_size < 0x1000) ? 0x1000 : heap_size; if (heap_size > 0x400000) { - dev_info(&dev_priv->pdev->dev, - "Firmware heap request size too big (%ukb)\n", + pr_err("Firmware heap request size too big (%ukb)\n", heap_size / 1024); return -ENOMEM; } - dev_info(&dev_priv->pdev->dev, "Firmware requested heap size: %ukb\n", + pr_debug("Firmware requested heap size: %ukb\n", heap_size / 1024); heap = isp_mem_create(dev_priv, FTHD_MEM_HEAP, heap_size); @@ -1401,18 +1401,20 @@ int isp_init(struct fthd_private *dev_priv) } if (retries >= 1000) { - dev_info(&dev_priv->pdev->dev, "Init failed! No second int\n"); + pr_err("Init failed! No second int\n"); return -EIO; } /* FIXME: free on error path */ - dev_info(&dev_priv->pdev->dev, "ISP second int after %dms\n", - (retries - 1) * 10); + pr_debug("ISP second init after %dms\n", (retries - 1) * 10); offset = FTHD_ISP_REG_READ(ISP_FW_CHAN_CTRL); - dev_info(&dev_priv->pdev->dev, "Channel description table at %08x\n", offset); + pr_debug("Channel description table at %08x\n", offset); + ret = isp_fill_channel_info(dev_priv, offset, num_channels); - if (ret) + if (ret) { + pr_err("Failed to fill ISP channel info\n"); return ret; + } fthd_channel_ringbuf_init(dev_priv, dev_priv->channel_terminal); fthd_channel_ringbuf_init(dev_priv, dev_priv->channel_io); @@ -1432,11 +1434,12 @@ int isp_init(struct fthd_private *dev_priv) } if (retries >= 1000) { - dev_info(&dev_priv->pdev->dev, "Init failed! No magic value\n"); + pr_err("Init failed! No magic value\n"); isp_uninit(dev_priv); return -EIO; } /* FIXME: free on error path */ - dev_info(&dev_priv->pdev->dev, "magic value: %08x after %d ms\n", reg, (retries - 1) * 10); + + pr_debug("Magic value: %08x after %d ms\n", reg, (retries - 1) * 10); } return 0; diff --git a/fthd_ringbuf.c b/fthd_ringbuf.c index 8e9dcc8..db98319 100644 --- a/fthd_ringbuf.c +++ b/fthd_ringbuf.c @@ -133,10 +133,11 @@ out: int fthd_channel_wait_ready(struct fthd_private *dev_priv, struct fw_channel *chan, u32 entry, int timeout) { if (wait_event_interruptible_timeout(chan->wq, - (FTHD_S2_MEM_READ(entry + FTHD_RINGBUF_ADDRESS_FLAGS) & 1) ^ (chan->type != 0), - msecs_to_jiffies(timeout)) <= 0) { - dev_err(&dev_priv->pdev->dev, "%s: timeout\n", chan->name); + (FTHD_S2_MEM_READ(entry + FTHD_RINGBUF_ADDRESS_FLAGS) & 1) ^ + (chan->type != RINGBUF_TYPE_H2T), msecs_to_jiffies(timeout)) <= 0) { + pr_err("%s: timeout\n", chan->name); fthd_channel_ringbuf_dump(dev_priv, chan); + return -ETIMEDOUT; } return 0;