Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'media/v5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media into master

Pull media fixes from Mauro Carvalho Chehab:
"A series of fixes for the upcoming atomisp driver. They solve issues
when probing atomisp on devices with multiple cameras and get rid of
warnings when built with W=1.

The diffstat is a bit long, as this driver has several abstractions.
The patches that solved the issues with W=1 had to get rid of some
duplicated code (there used to have 2 versions of the same code, one
for ISP2401 and another one for ISP2400).

As this driver is not in 5.7, such changes won't cause regressions"

* tag 'media/v5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (38 commits)
Revert "media: atomisp: keep the ISP powered on when setting it"
media: atomisp: fix mask and shift operation on ISPSSPM0
media: atomisp: move system_local consts into a C file
media: atomisp: get rid of version-specific system_local.h
media: atomisp: move global stuff into a common header
media: atomisp: remove non-used 32-bits consts at system_local
media: atomisp: get rid of some unused static vars
media: atomisp: Fix error code in ov5693_probe()
media: atomisp: Replace trace_printk by pr_info
media: atomisp: Fix __func__ style warnings
media: atomisp: fix help message for ISP2401 selection
media: atomisp: i2c: atomisp-ov2680.c: fixed a brace coding style issue.
media: atomisp: make const arrays static, makes object smaller
media: atomisp: Clean up non-existing folders from Makefile
media: atomisp: Get rid of ACPI specifics in gmin_subdev_add()
media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add()
media: atomisp: Use temporary variable for device in gmin_subdev_add()
media: atomisp: Refactor PMIC detection to a separate function
media: atomisp: Deduplicate return ret in gmin_i2c_write()
media: atomisp: Make pointer to PMIC client global
...

+1280 -1929
+1
arch/x86/include/asm/iosf_mbi.h
··· 39 39 #define BT_MBI_UNIT_PMC 0x04 40 40 #define BT_MBI_UNIT_GFX 0x06 41 41 #define BT_MBI_UNIT_SMI 0x0C 42 + #define BT_MBI_UNIT_CCK 0x14 42 43 #define BT_MBI_UNIT_USB 0x43 43 44 #define BT_MBI_UNIT_SATA 0xA3 44 45 #define BT_MBI_UNIT_PCIE 0xA6
+1 -1
drivers/staging/media/atomisp/Kconfig
··· 22 22 module will be called atomisp 23 23 24 24 config VIDEO_ATOMISP_ISP2401 25 - bool "VIDEO_ATOMISP_ISP2401" 25 + bool "Use Intel Atom ISP on Cherrytail/Anniedale (ISP2401)" 26 26 depends on VIDEO_ATOMISP 27 27 help 28 28 Enable support for Atom ISP2401-based boards.
+1 -5
drivers/staging/media/atomisp/Makefile
··· 156 156 pci/hive_isp_css_common/host/timed_ctrl.o \ 157 157 pci/hive_isp_css_common/host/vmem.o \ 158 158 pci/hive_isp_css_shared/host/tag.o \ 159 + pci/system_local.o \ 159 160 160 161 obj-byt = \ 161 162 pci/css_2400_system/hive/ia_css_isp_configs.o \ ··· 183 182 -I$(atomisp)/include/hmm/ \ 184 183 -I$(atomisp)/include/mmu/ \ 185 184 -I$(atomisp)/pci/ \ 186 - -I$(atomisp)/pci/hrt/ \ 187 185 -I$(atomisp)/pci/base/circbuf/interface/ \ 188 186 -I$(atomisp)/pci/base/refcount/interface/ \ 189 187 -I$(atomisp)/pci/camera/pipe/interface/ \ ··· 192 192 -I$(atomisp)/pci/hive_isp_css_include/ \ 193 193 -I$(atomisp)/pci/hive_isp_css_include/device_access/ \ 194 194 -I$(atomisp)/pci/hive_isp_css_include/host/ \ 195 - -I$(atomisp)/pci/hive_isp_css_include/memory_access/ \ 196 195 -I$(atomisp)/pci/hive_isp_css_shared/ \ 197 196 -I$(atomisp)/pci/hive_isp_css_shared/host/ \ 198 197 -I$(atomisp)/pci/isp/kernels/ \ ··· 310 311 -I$(atomisp)/pci/runtime/tagger/interface/ 311 312 312 313 INCLUDES_byt += \ 313 - -I$(atomisp)/pci/css_2400_system/ \ 314 314 -I$(atomisp)/pci/css_2400_system/hive/ \ 315 - -I$(atomisp)/pci/css_2400_system/hrt/ \ 316 315 317 316 INCLUDES_cht += \ 318 317 -I$(atomisp)/pci/css_2401_system/ \ ··· 318 321 -I$(atomisp)/pci/css_2401_system/hive/ \ 319 322 -I$(atomisp)/pci/css_2401_system/hrt/ \ 320 323 321 - # -I$(atomisp)/pci/css_2401_system/hrt/ \ 322 324 # -I$(atomisp)/pci/css_2401_system/hive_isp_css_2401_system_generated/ \ 323 325 324 326 DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__
+3 -3
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
··· 495 495 ret = ov2680_read_reg(client, 1, OV2680_MIRROR_REG, &val); 496 496 if (ret) 497 497 return ret; 498 - if (value) { 498 + if (value) 499 499 val |= OV2680_FLIP_MIRROR_BIT_ENABLE; 500 - } else { 500 + else 501 501 val &= ~OV2680_FLIP_MIRROR_BIT_ENABLE; 502 - } 502 + 503 503 ret = ov2680_write_reg(client, 1, 504 504 OV2680_MIRROR_REG, val); 505 505 if (ret)
+4 -2
drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c
··· 1899 1899 { 1900 1900 struct ov5693_device *dev; 1901 1901 int i2c; 1902 - int ret = 0; 1902 + int ret; 1903 1903 void *pdata; 1904 1904 unsigned int i; 1905 1905 ··· 1929 1929 pdata = gmin_camera_platform_data(&dev->sd, 1930 1930 ATOMISP_INPUT_FORMAT_RAW_10, 1931 1931 atomisp_bayer_order_bggr); 1932 - if (!pdata) 1932 + if (!pdata) { 1933 + ret = -EINVAL; 1933 1934 goto out_free; 1935 + } 1934 1936 1935 1937 ret = ov5693_s_config(&dev->sd, client->irq, pdata); 1936 1938 if (ret)
+1
drivers/staging/media/atomisp/include/linux/atomisp_platform.h
··· 250 250 #define IS_MFLD __IS_SOC(INTEL_FAM6_ATOM_SALTWELL_MID) 251 251 #define IS_BYT __IS_SOC(INTEL_FAM6_ATOM_SILVERMONT) 252 252 #define IS_CHT __IS_SOC(INTEL_FAM6_ATOM_AIRMONT) 253 + #define IS_MRFD __IS_SOC(INTEL_FAM6_ATOM_SILVERMONT_MID) 253 254 #define IS_MOFD __IS_SOC(INTEL_FAM6_ATOM_AIRMONT_MID) 254 255 255 256 /* Both CHT and MOFD come with ISP2401 */
-3
drivers/staging/media/atomisp/pci/atomisp-regs.h
··· 20 20 #define ATOMISP_REGS_H 21 21 22 22 /* common register definitions */ 23 - #define PUNIT_PORT 0x04 24 - #define CCK_PORT 0x14 25 - 26 23 #define PCICMDSTS 0x01 27 24 #define INTR 0x0f 28 25 #define MSI_CAPID 0x24
+2 -2
drivers/staging/media/atomisp/pci/atomisp_acc.c
··· 355 355 356 356 pgnr = DIV_ROUND_UP(map->length, PAGE_SIZE); 357 357 if (pgnr < ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) { 358 - dev_err(atomisp_dev, 358 + dev_err(asd->isp->dev, 359 359 "user space memory size is less than the expected size..\n"); 360 360 return -ENOMEM; 361 361 } else if (pgnr > ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) { 362 - dev_err(atomisp_dev, 362 + dev_err(asd->isp->dev, 363 363 "user space memory size is large than the expected size..\n"); 364 364 return -ENOMEM; 365 365 }
+32 -27
drivers/staging/media/atomisp/pci/atomisp_cmd.c
··· 21 21 #include <linux/firmware.h> 22 22 #include <linux/pci.h> 23 23 #include <linux/interrupt.h> 24 + #include <linux/io.h> 24 25 #include <linux/kernel.h> 25 26 #include <linux/kfifo.h> 26 27 #include <linux/pm_runtime.h> ··· 110 109 111 110 static unsigned short atomisp_get_sensor_fps(struct atomisp_sub_device *asd) 112 111 { 113 - struct v4l2_subdev_frame_interval fi; 112 + struct v4l2_subdev_frame_interval fi = { 0 }; 114 113 struct atomisp_device *isp = asd->isp; 115 114 116 115 unsigned short fps = 0; ··· 207 206 enum atomisp_dfs_mode mode, 208 207 bool force) 209 208 { 209 + struct pci_dev *pdev = to_pci_dev(isp->dev); 210 210 /* FIXME! Only use subdev[0] status yet */ 211 211 struct atomisp_sub_device *asd = &isp->asd[0]; 212 212 const struct atomisp_dfs_config *dfs; ··· 221 219 return -EINVAL; 222 220 } 223 221 224 - if ((isp->pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) == 222 + if ((pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) == 225 223 ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd)) 226 224 isp->dfs = &dfs_config_cht_soc; 227 225 ··· 359 357 irq_clear_all(IRQ0_ID); 360 358 } 361 359 362 - void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev) 360 + void atomisp_msi_irq_init(struct atomisp_device *isp) 363 361 { 362 + struct pci_dev *pdev = to_pci_dev(isp->dev); 364 363 u32 msg32; 365 364 u16 msg16; 366 365 367 - pci_read_config_dword(dev, PCI_MSI_CAPID, &msg32); 366 + pci_read_config_dword(pdev, PCI_MSI_CAPID, &msg32); 368 367 msg32 |= 1 << MSI_ENABLE_BIT; 369 - pci_write_config_dword(dev, PCI_MSI_CAPID, msg32); 368 + pci_write_config_dword(pdev, PCI_MSI_CAPID, msg32); 370 369 371 370 msg32 = (1 << INTR_IER) | (1 << INTR_IIR); 372 - pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, msg32); 371 + pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, msg32); 373 372 374 - pci_read_config_word(dev, PCI_COMMAND, &msg16); 373 + pci_read_config_word(pdev, PCI_COMMAND, &msg16); 375 374 msg16 |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | 376 375 PCI_COMMAND_INTX_DISABLE); 377 - pci_write_config_word(dev, PCI_COMMAND, msg16); 376 + pci_write_config_word(pdev, PCI_COMMAND, msg16); 378 377 } 379 378 380 - void atomisp_msi_irq_uninit(struct atomisp_device *isp, struct pci_dev *dev) 379 + void atomisp_msi_irq_uninit(struct atomisp_device *isp) 381 380 { 381 + struct pci_dev *pdev = to_pci_dev(isp->dev); 382 382 u32 msg32; 383 383 u16 msg16; 384 384 385 - pci_read_config_dword(dev, PCI_MSI_CAPID, &msg32); 385 + pci_read_config_dword(pdev, PCI_MSI_CAPID, &msg32); 386 386 msg32 &= ~(1 << MSI_ENABLE_BIT); 387 - pci_write_config_dword(dev, PCI_MSI_CAPID, msg32); 387 + pci_write_config_dword(pdev, PCI_MSI_CAPID, msg32); 388 388 389 389 msg32 = 0x0; 390 - pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, msg32); 390 + pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, msg32); 391 391 392 - pci_read_config_word(dev, PCI_COMMAND, &msg16); 392 + pci_read_config_word(pdev, PCI_COMMAND, &msg16); 393 393 msg16 &= ~(PCI_COMMAND_MASTER); 394 - pci_write_config_word(dev, PCI_COMMAND, msg16); 394 + pci_write_config_word(pdev, PCI_COMMAND, msg16); 395 395 } 396 396 397 397 static void atomisp_sof_event(struct atomisp_sub_device *asd) ··· 484 480 /* Clear irq reg */ 485 481 static void clear_irq_reg(struct atomisp_device *isp) 486 482 { 483 + struct pci_dev *pdev = to_pci_dev(isp->dev); 487 484 u32 msg_ret; 488 485 489 - pci_read_config_dword(isp->pdev, PCI_INTERRUPT_CTRL, &msg_ret); 486 + pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &msg_ret); 490 487 msg_ret |= 1 << INTR_IIR; 491 - pci_write_config_dword(isp->pdev, PCI_INTERRUPT_CTRL, msg_ret); 488 + pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, msg_ret); 492 489 } 493 490 494 491 static struct atomisp_sub_device * ··· 670 665 void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr, 671 666 unsigned int size) 672 667 { 673 - u32 __iomem *io_virt_addr; 674 668 unsigned int data = 0; 675 669 unsigned int size32 = DIV_ROUND_UP(size, sizeof(u32)); 676 670 677 - dev_dbg(isp->dev, "atomisp_io_base:%p\n", atomisp_io_base); 671 + dev_dbg(isp->dev, "atomisp mmio base: %p\n", isp->base); 678 672 dev_dbg(isp->dev, "%s, addr:0x%x, size: %d, size32: %d\n", __func__, 679 673 addr, size, size32); 680 674 if (size32 * 4 + addr > 0x4000) { ··· 682 678 return; 683 679 } 684 680 addr += SP_DMEM_BASE; 685 - io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF); 681 + addr &= 0x003FFFFF; 686 682 do { 687 - data = *io_virt_addr; 683 + data = readl(isp->base + addr); 688 684 dev_dbg(isp->dev, "%s, \t [0x%x]:0x%x\n", __func__, addr, data); 689 - io_virt_addr += sizeof(u32); 690 - size32 -= 1; 691 - } while (size32 > 0); 685 + addr += sizeof(u32); 686 + } while (--size32); 692 687 } 693 688 694 689 static struct videobuf_buffer *atomisp_css_frame_to_vbuf( ··· 1292 1289 1293 1290 static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout) 1294 1291 { 1292 + struct pci_dev *pdev = to_pci_dev(isp->dev); 1295 1293 enum ia_css_pipe_id css_pipe_id; 1296 1294 bool stream_restart[MAX_STREAM_NUM] = {0}; 1297 1295 bool depth_mode = false; ··· 1376 1372 clear_isp_irq(hrt_isp_css_irq_sp); 1377 1373 1378 1374 /* Set the SRSE to 3 before resetting */ 1379 - pci_write_config_dword(isp->pdev, PCI_I_CONTROL, isp->saved_regs.i_control | 1380 - MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK); 1375 + pci_write_config_dword(pdev, PCI_I_CONTROL, 1376 + isp->saved_regs.i_control | MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK); 1381 1377 1382 1378 /* reset ISP and restore its state */ 1383 1379 isp->isp_timeout = true; ··· 6162 6158 /*Turn off ISP dphy */ 6163 6159 int atomisp_ospm_dphy_down(struct atomisp_device *isp) 6164 6160 { 6161 + struct pci_dev *pdev = to_pci_dev(isp->dev); 6165 6162 unsigned long flags; 6166 6163 u32 reg; 6167 6164 ··· 6184 6179 * MRFLD HW design need all CSI ports are disabled before 6185 6180 * powering down the IUNIT. 6186 6181 */ 6187 - pci_read_config_dword(isp->pdev, MRFLD_PCI_CSI_CONTROL, &reg); 6182 + pci_read_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, &reg); 6188 6183 reg |= MRFLD_ALL_CSI_PORTS_OFF_MASK; 6189 - pci_write_config_dword(isp->pdev, MRFLD_PCI_CSI_CONTROL, reg); 6184 + pci_write_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, reg); 6190 6185 return 0; 6191 6186 } 6192 6187
+2 -2
drivers/staging/media/atomisp/pci/atomisp_cmd.h
··· 68 68 /* 69 69 * Interrupt functions 70 70 */ 71 - void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev); 72 - void atomisp_msi_irq_uninit(struct atomisp_device *isp, struct pci_dev *dev); 71 + void atomisp_msi_irq_init(struct atomisp_device *isp); 72 + void atomisp_msi_irq_uninit(struct atomisp_device *isp); 73 73 void atomisp_wdt_work(struct work_struct *work); 74 74 void atomisp_wdt(struct timer_list *t); 75 75 void atomisp_setup_flash(struct atomisp_sub_device *asd);
-2
drivers/staging/media/atomisp/pci/atomisp_compat.h
··· 29 29 struct video_device; 30 30 enum atomisp_input_stream_id; 31 31 32 - extern void __iomem *atomisp_io_base; 33 - 34 32 struct atomisp_metadata_buf { 35 33 struct ia_css_metadata *metadata; 36 34 void *md_vptr;
+34 -36
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
··· 33 33 #include "atomisp_ioctl.h" 34 34 #include "atomisp_acc.h" 35 35 36 - #include <asm/intel-mid.h> 37 - 38 36 #include "ia_css_debug.h" 39 37 #include "ia_css_isp_param.h" 40 38 #include "sh_css_hrt.h" 41 39 #include "ia_css_isys.h" 42 40 41 + #include <linux/io.h> 43 42 #include <linux/pm_runtime.h> 44 43 45 44 /* Assume max number of ACC stages */ ··· 68 69 69 70 static void atomisp_css2_hw_store_8(hrt_address addr, uint8_t data) 70 71 { 71 - s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF); 72 + struct atomisp_device *isp = dev_get_drvdata(atomisp_dev); 72 73 unsigned long flags; 73 74 74 75 spin_lock_irqsave(&mmio_lock, flags); 75 - *io_virt_addr = data; 76 + writeb(data, isp->base + (addr & 0x003FFFFF)); 76 77 spin_unlock_irqrestore(&mmio_lock, flags); 77 78 } 78 79 79 80 static void atomisp_css2_hw_store_16(hrt_address addr, uint16_t data) 80 81 { 81 - s16 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF); 82 + struct atomisp_device *isp = dev_get_drvdata(atomisp_dev); 82 83 unsigned long flags; 83 84 84 85 spin_lock_irqsave(&mmio_lock, flags); 85 - *io_virt_addr = data; 86 + writew(data, isp->base + (addr & 0x003FFFFF)); 86 87 spin_unlock_irqrestore(&mmio_lock, flags); 87 88 } 88 89 89 90 void atomisp_css2_hw_store_32(hrt_address addr, uint32_t data) 90 91 { 91 - s32 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF); 92 + struct atomisp_device *isp = dev_get_drvdata(atomisp_dev); 92 93 unsigned long flags; 93 94 94 95 spin_lock_irqsave(&mmio_lock, flags); 95 - *io_virt_addr = data; 96 + writel(data, isp->base + (addr & 0x003FFFFF)); 96 97 spin_unlock_irqrestore(&mmio_lock, flags); 97 98 } 98 99 99 100 static uint8_t atomisp_css2_hw_load_8(hrt_address addr) 100 101 { 101 - s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF); 102 + struct atomisp_device *isp = dev_get_drvdata(atomisp_dev); 102 103 unsigned long flags; 103 104 u8 ret; 104 105 105 106 spin_lock_irqsave(&mmio_lock, flags); 106 - ret = *io_virt_addr; 107 + ret = readb(isp->base + (addr & 0x003FFFFF)); 107 108 spin_unlock_irqrestore(&mmio_lock, flags); 108 109 return ret; 109 110 } 110 111 111 112 static uint16_t atomisp_css2_hw_load_16(hrt_address addr) 112 113 { 113 - s16 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF); 114 + struct atomisp_device *isp = dev_get_drvdata(atomisp_dev); 114 115 unsigned long flags; 115 116 u16 ret; 116 117 117 118 spin_lock_irqsave(&mmio_lock, flags); 118 - ret = *io_virt_addr; 119 + ret = readw(isp->base + (addr & 0x003FFFFF)); 119 120 spin_unlock_irqrestore(&mmio_lock, flags); 120 121 return ret; 121 122 } 122 123 123 124 static uint32_t atomisp_css2_hw_load_32(hrt_address addr) 124 125 { 125 - s32 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF); 126 + struct atomisp_device *isp = dev_get_drvdata(atomisp_dev); 126 127 unsigned long flags; 127 128 u32 ret; 128 129 129 130 spin_lock_irqsave(&mmio_lock, flags); 130 - ret = *io_virt_addr; 131 + ret = readl(isp->base + (addr & 0x003FFFFF)); 131 132 spin_unlock_irqrestore(&mmio_lock, flags); 132 133 return ret; 133 134 } 134 135 135 - static void atomisp_css2_hw_store(hrt_address addr, 136 - const void *from, uint32_t n) 136 + static void atomisp_css2_hw_store(hrt_address addr, const void *from, uint32_t n) 137 137 { 138 - s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF); 138 + struct atomisp_device *isp = dev_get_drvdata(atomisp_dev); 139 139 unsigned long flags; 140 140 unsigned int i; 141 141 142 + addr &= 0x003FFFFF; 142 143 spin_lock_irqsave(&mmio_lock, flags); 143 - for (i = 0; i < n; i++, io_virt_addr++, from++) 144 - *io_virt_addr = *(s8 *)from; 144 + for (i = 0; i < n; i++, from++) 145 + writeb(*(s8 *)from, isp->base + addr + i); 146 + 145 147 spin_unlock_irqrestore(&mmio_lock, flags); 146 148 } 147 149 148 150 static void atomisp_css2_hw_load(hrt_address addr, void *to, uint32_t n) 149 151 { 150 - s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF); 152 + struct atomisp_device *isp = dev_get_drvdata(atomisp_dev); 151 153 unsigned long flags; 152 154 unsigned int i; 153 155 156 + addr &= 0x003FFFFF; 154 157 spin_lock_irqsave(&mmio_lock, flags); 155 - for (i = 0; i < n; i++, to++, io_virt_addr++) 156 - *(s8 *)to = *io_virt_addr; 158 + for (i = 0; i < n; i++, to++) 159 + *(s8 *)to = readb(isp->base + addr + i); 157 160 spin_unlock_irqrestore(&mmio_lock, flags); 158 161 } 159 162 ··· 182 181 *data = atomisp_css2_hw_load_32(addr); 183 182 } 184 183 185 - static int hmm_get_mmu_base_addr(unsigned int *mmu_base_addr) 184 + static int hmm_get_mmu_base_addr(struct device *dev, unsigned int *mmu_base_addr) 186 185 { 187 186 if (!sh_mmu_mrfld.get_pd_base) { 188 - dev_err(atomisp_dev, "get mmu base address failed.\n"); 187 + dev_err(dev, "get mmu base address failed.\n"); 189 188 return -EINVAL; 190 189 } 191 190 ··· 840 839 int ret; 841 840 int err; 842 841 843 - ret = hmm_get_mmu_base_addr(&mmu_base_addr); 842 + ret = hmm_get_mmu_base_addr(isp->dev, &mmu_base_addr); 844 843 if (ret) 845 844 return ret; 846 845 ··· 942 941 unsigned int mmu_base_addr; 943 942 int ret; 944 943 945 - ret = hmm_get_mmu_base_addr(&mmu_base_addr); 944 + ret = hmm_get_mmu_base_addr(isp->dev, &mmu_base_addr); 946 945 if (ret) { 947 946 dev_err(isp->dev, "get base address error.\n"); 948 947 return -EINVAL; ··· 1967 1966 true, 1968 1967 0x13000, 1969 1968 &size_mem_words) != 0) { 1970 - if (intel_mid_identify_cpu() == 1971 - INTEL_MID_CPU_CHIP_TANGIER) 1969 + if (IS_MRFD) 1972 1970 size_mem_words = CSS_MIPI_FRAME_BUFFER_SIZE_2; 1973 1971 else 1974 1972 size_mem_words = CSS_MIPI_FRAME_BUFFER_SIZE_1; ··· 2414 2414 struct ia_css_resolution *effective_res = 2415 2415 &stream_config->input_config.effective_res; 2416 2416 2417 - const struct bayer_ds_factor bds_fct[] = {{2, 1}, {3, 2}, {5, 4} }; 2417 + static const struct bayer_ds_factor bds_fct[] = {{2, 1}, {3, 2}, {5, 4} }; 2418 2418 /* 2419 2419 * BZ201033: YUV decimation factor of 4 causes couple of rightmost 2420 2420 * columns to be shaded. Remove this factor to work around the CSS bug. 2421 2421 * const unsigned int yuv_dec_fct[] = {4, 2}; 2422 2422 */ 2423 - const unsigned int yuv_dec_fct[] = { 2 }; 2423 + static const unsigned int yuv_dec_fct[] = { 2 }; 2424 2424 unsigned int i; 2425 2425 2426 2426 if (width == 0 && height == 0) ··· 2540 2540 struct ia_css_resolution *effective_res = 2541 2541 &stream_config->input_config.effective_res; 2542 2542 2543 - const struct bayer_ds_factor bds_factors[] = { 2543 + static const struct bayer_ds_factor bds_factors[] = { 2544 2544 {8, 1}, {6, 1}, {4, 1}, {3, 1}, {2, 1}, {3, 2} 2545 2545 }; 2546 2546 unsigned int i; ··· 4337 4337 [IA_CSS_ACC_STANDALONE] = "Stand-alone acceleration", 4338 4338 }; 4339 4339 4340 - int atomisp_css_dump_blob_infor(void) 4340 + int atomisp_css_dump_blob_infor(struct atomisp_device *isp) 4341 4341 { 4342 4342 struct ia_css_blob_descr *bd = sh_css_blob_info; 4343 4343 unsigned int i, nm = sh_css_num_binaries; ··· 4354 4354 for (i = 0; i < sh_css_num_binaries - NUM_OF_SPS; i++) { 4355 4355 switch (bd[i].header.type) { 4356 4356 case ia_css_isp_firmware: 4357 - dev_dbg(atomisp_dev, 4358 - "Num%2d type %s (%s), binary id is %2d, name is %s\n", 4357 + dev_dbg(isp->dev, "Num%2d type %s (%s), binary id is %2d, name is %s\n", 4359 4358 i + NUM_OF_SPS, 4360 4359 fw_type_name[bd[i].header.type], 4361 4360 fw_acc_type_name[bd[i].header.info.isp.type], ··· 4362 4363 bd[i].name); 4363 4364 break; 4364 4365 default: 4365 - dev_dbg(atomisp_dev, 4366 - "Num%2d type %s, name is %s\n", 4366 + dev_dbg(isp->dev, "Num%2d type %s, name is %s\n", 4367 4367 i + NUM_OF_SPS, fw_type_name[bd[i].header.type], 4368 4368 bd[i].name); 4369 4369 }
+1 -1
drivers/staging/media/atomisp/pci/atomisp_compat_css20.h
··· 153 153 154 154 int atomisp_css_dump_sp_raw_copy_linecount(bool reduced); 155 155 156 - int atomisp_css_dump_blob_infor(void); 156 + int atomisp_css_dump_blob_infor(struct atomisp_device *isp); 157 157 158 158 void atomisp_css_set_isp_config_id(struct atomisp_sub_device *asd, 159 159 uint32_t isp_config_id);
+7 -7
drivers/staging/media/atomisp/pci/atomisp_drvfs.c
··· 62 62 63 63 if (opt & OPTION_VALID) { 64 64 if (opt & OPTION_BIN_LIST) { 65 - ret = atomisp_css_dump_blob_infor(); 65 + ret = atomisp_css_dump_blob_infor(isp); 66 66 if (ret) { 67 - dev_err(atomisp_dev, "%s dump blob infor err[ret:%d]\n", 67 + dev_err(isp->dev, "%s dump blob infor err[ret:%d]\n", 68 68 __func__, ret); 69 69 goto opt_err; 70 70 } ··· 76 76 atomisp_css_debug_dump_isp_binary(); 77 77 } else { 78 78 ret = -EPERM; 79 - dev_err(atomisp_dev, "%s dump running bin err[ret:%d]\n", 79 + dev_err(isp->dev, "%s dump running bin err[ret:%d]\n", 80 80 __func__, ret); 81 81 goto opt_err; 82 82 } ··· 86 86 hmm_show_mem_stat(__func__, __LINE__); 87 87 } else { 88 88 ret = -EINVAL; 89 - dev_err(atomisp_dev, "%s dump nothing[ret=%d]\n", __func__, 90 - ret); 89 + dev_err(isp->dev, "%s dump nothing[ret=%d]\n", __func__, ret); 91 90 } 92 91 93 92 opt_err: ··· 184 185 driver_remove_file(drv, &iunit_drvfs_attrs[i]); 185 186 } 186 187 187 - int atomisp_drvfs_init(struct device_driver *drv, struct atomisp_device *isp) 188 + int atomisp_drvfs_init(struct atomisp_device *isp) 188 189 { 190 + struct device_driver *drv = isp->dev->driver; 189 191 int ret; 190 192 191 193 iunit_debug.isp = isp; ··· 194 194 195 195 ret = iunit_drvfs_create_files(iunit_debug.drv); 196 196 if (ret) { 197 - dev_err(atomisp_dev, "drvfs_create_files error: %d\n", ret); 197 + dev_err(isp->dev, "drvfs_create_files error: %d\n", ret); 198 198 iunit_drvfs_remove_files(iunit_debug.drv); 199 199 } 200 200
+1 -1
drivers/staging/media/atomisp/pci/atomisp_drvfs.h
··· 19 19 #ifndef __ATOMISP_DRVFS_H__ 20 20 #define __ATOMISP_DRVFS_H__ 21 21 22 - int atomisp_drvfs_init(struct device_driver *drv, struct atomisp_device *isp); 22 + int atomisp_drvfs_init(struct atomisp_device *isp); 23 23 void atomisp_drvfs_exit(void); 24 24 25 25 #endif /* __ATOMISP_DRVFS_H__ */
+352 -187
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
··· 26 26 #define CLK_RATE_19_2MHZ 19200000 27 27 #define CLK_RATE_25_0MHZ 25000000 28 28 29 + /* Valid clock number range from 0 to 5 */ 30 + #define MAX_CLK_COUNT 5 31 + 29 32 /* X-Powers AXP288 register set */ 30 33 #define ALDO1_SEL_REG 0x28 31 34 #define ALDO1_CTRL3_REG 0x13 ··· 64 61 65 62 struct gmin_subdev { 66 63 struct v4l2_subdev *subdev; 67 - int clock_num; 68 64 enum clock_rate clock_src; 69 - bool clock_on; 70 65 struct clk *pmc_clk; 71 66 struct gpio_desc *gpio0; 72 67 struct gpio_desc *gpio1; ··· 76 75 unsigned int csi_lanes; 77 76 enum atomisp_input_format csi_fmt; 78 77 enum atomisp_bayer_order csi_bayer; 78 + 79 + bool clock_on; 79 80 bool v1p8_on; 80 81 bool v2p8_on; 81 82 bool v1p2_on; 82 83 bool v2p8_vcm_on; 84 + 85 + int v1p8_gpio; 86 + int v2p8_gpio; 83 87 84 88 u8 pwm_i2c_addr; 85 89 ··· 96 90 static struct gmin_subdev gmin_subdevs[MAX_SUBDEVS]; 97 91 98 92 /* ACPI HIDs for the PMICs that could be used by this driver */ 99 - #define PMIC_ACPI_AXP "INT33F4:00" /* XPower AXP288 PMIC */ 100 - #define PMIC_ACPI_TI "INT33F5:00" /* Dollar Cove TI PMIC */ 101 - #define PMIC_ACPI_CRYSTALCOVE "INT33FD:00" /* Crystal Cove PMIC */ 93 + #define PMIC_ACPI_AXP "INT33F4" /* XPower AXP288 PMIC */ 94 + #define PMIC_ACPI_TI "INT33F5" /* Dollar Cove TI PMIC */ 95 + #define PMIC_ACPI_CRYSTALCOVE "INT33FD" /* Crystal Cove PMIC */ 102 96 103 97 #define PMIC_PLATFORM_TI "intel_soc_pmic_chtdc_ti" 104 98 ··· 111 105 } pmic_id; 112 106 113 107 static const char *pmic_name[] = { 114 - [PMIC_UNSET] = "unset", 108 + [PMIC_UNSET] = "ACPI device PM", 115 109 [PMIC_REGULATOR] = "regulator driver", 116 110 [PMIC_AXP] = "XPower AXP288 PMIC", 117 111 [PMIC_TI] = "Dollar Cove TI PMIC", ··· 124 118 static const struct atomisp_platform_data pdata = { 125 119 .subdevs = pdata_subdevs, 126 120 }; 127 - 128 - /* 129 - * Something of a hack. The ECS E7 board drives camera 2.8v from an 130 - * external regulator instead of the PMIC. There's a gmin_CamV2P8 131 - * config variable that specifies the GPIO to handle this particular 132 - * case, but this needs a broader architecture for handling camera 133 - * power. 134 - */ 135 - enum { V2P8_GPIO_UNSET = -2, V2P8_GPIO_NONE = -1 }; 136 - static int v2p8_gpio = V2P8_GPIO_UNSET; 137 - 138 - /* 139 - * Something of a hack. The CHT RVP board drives camera 1.8v from an 140 - * external regulator instead of the PMIC just like ECS E7 board, see the 141 - * comments above. 142 - */ 143 - enum { V1P8_GPIO_UNSET = -2, V1P8_GPIO_NONE = -1 }; 144 - static int v1p8_gpio = V1P8_GPIO_UNSET; 145 121 146 122 static LIST_HEAD(vcm_devices); 147 123 static DEFINE_MUTEX(vcm_lock); ··· 187 199 * gmin_subdev struct is already initialized for us. 188 200 */ 189 201 gs = find_gmin_subdev(subdev); 202 + if (!gs) 203 + return -ENODEV; 190 204 191 205 pdata.subdevs[i].type = type; 192 206 pdata.subdevs[i].port = gs->csi_port; ··· 284 294 {"INT33F8:00_CsiFmt", "13"}, 285 295 {"INT33F8:00_CsiBayer", "0"}, 286 296 {"INT33F8:00_CamClk", "0"}, 297 + 287 298 {"INT33F9:00_CamType", "1"}, 288 299 {"INT33F9:00_CsiPort", "0"}, 289 300 {"INT33F9:00_CsiLanes", "1"}, ··· 300 309 {"INT33BE:00_CsiFmt", "13"}, 301 310 {"INT33BE:00_CsiBayer", "2"}, 302 311 {"INT33BE:00_CamClk", "0"}, 312 + 303 313 {"INT33F0:00_CsiPort", "0"}, 304 314 {"INT33F0:00_CsiLanes", "1"}, 305 315 {"INT33F0:00_CsiFmt", "13"}, ··· 314 322 {"XXOV2680:00_CsiPort", "1"}, 315 323 {"XXOV2680:00_CsiLanes", "1"}, 316 324 {"XXOV2680:00_CamClk", "0"}, 325 + 317 326 {"XXGC0310:00_CsiPort", "0"}, 318 327 {"XXGC0310:00_CsiLanes", "1"}, 319 328 {"XXGC0310:00_CamClk", "1"}, ··· 374 381 #define GMIN_PMC_CLK_NAME 14 /* "pmc_plt_clk_[0..5]" */ 375 382 static char gmin_pmc_clk_name[GMIN_PMC_CLK_NAME]; 376 383 377 - static int gmin_i2c_match_one(struct device *dev, const void *data) 378 - { 379 - const char *name = data; 380 - struct i2c_client *client; 381 - 382 - if (dev->type != &i2c_client_type) 383 - return 0; 384 - 385 - client = to_i2c_client(dev); 386 - 387 - return (!strcmp(name, client->name)); 388 - } 389 - 390 384 static struct i2c_client *gmin_i2c_dev_exists(struct device *dev, char *name, 391 385 struct i2c_client **client) 392 386 { 387 + struct acpi_device *adev; 393 388 struct device *d; 394 389 395 - while ((d = bus_find_device(&i2c_bus_type, NULL, name, 396 - gmin_i2c_match_one))) { 397 - *client = to_i2c_client(d); 398 - dev_dbg(dev, "found '%s' at address 0x%02x, adapter %d\n", 399 - (*client)->name, (*client)->addr, 400 - (*client)->adapter->nr); 401 - return *client; 402 - } 390 + adev = acpi_dev_get_first_match_dev(name, NULL, -1); 391 + if (!adev) 392 + return NULL; 403 393 404 - return NULL; 394 + d = bus_find_device_by_acpi_dev(&i2c_bus_type, adev); 395 + acpi_dev_put(adev); 396 + if (!d) 397 + return NULL; 398 + 399 + *client = i2c_verify_client(d); 400 + put_device(d); 401 + 402 + dev_dbg(dev, "found '%s' at address 0x%02x, adapter %d\n", 403 + (*client)->name, (*client)->addr, (*client)->adapter->nr); 404 + return *client; 405 405 } 406 406 407 407 static int gmin_i2c_write(struct device *dev, u16 i2c_addr, u8 reg, ··· 413 427 "I2C write, addr: 0x%02x, reg: 0x%02x, value: 0x%02x, mask: 0x%02x\n", 414 428 i2c_addr, reg, value, mask); 415 429 416 - ret = intel_soc_pmic_exec_mipi_pmic_seq_element(i2c_addr, reg, 417 - value, mask); 418 - 419 - if (ret == -EOPNOTSUPP) { 430 + ret = intel_soc_pmic_exec_mipi_pmic_seq_element(i2c_addr, reg, value, mask); 431 + if (ret == -EOPNOTSUPP) 420 432 dev_err(dev, 421 433 "ACPI didn't mapped the OpRegion needed to access I2C address 0x%02x.\n" 422 - "Need to compile the Kernel using CONFIG_*_PMIC_OPREGION settings\n", 434 + "Need to compile the kernel using CONFIG_*_PMIC_OPREGION settings\n", 423 435 i2c_addr); 424 - return ret; 425 - } 426 436 427 437 return ret; 428 438 } 429 439 430 - static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) 440 + static int atomisp_get_acpi_power(struct device *dev) 431 441 { 432 - struct i2c_client *power = NULL, *client = v4l2_get_subdevdata(subdev); 433 - struct acpi_device *adev; 434 - acpi_handle handle; 435 - struct device *dev; 436 - int i, ret; 442 + char name[5]; 443 + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 444 + struct acpi_buffer b_name = { sizeof(name), name }; 445 + union acpi_object *package, *element; 446 + acpi_handle handle = ACPI_HANDLE(dev); 447 + acpi_handle rhandle; 448 + acpi_status status; 449 + int clock_num = -1; 450 + int i; 437 451 438 - if (!client) 439 - return NULL; 452 + status = acpi_evaluate_object(handle, "_PR0", NULL, &buffer); 453 + if (!ACPI_SUCCESS(status)) 454 + return -1; 440 455 441 - dev = &client->dev; 456 + package = buffer.pointer; 442 457 443 - handle = ACPI_HANDLE(dev); 458 + if (!buffer.length || !package 459 + || package->type != ACPI_TYPE_PACKAGE 460 + || !package->package.count) 461 + goto fail; 444 462 445 - // FIXME: may need to release resources allocated by acpi_bus_get_device() 446 - if (!handle || acpi_bus_get_device(handle, &adev)) { 447 - dev_err(dev, "Error could not get ACPI device\n"); 448 - return NULL; 463 + for (i = 0; i < package->package.count; i++) { 464 + element = &package->package.elements[i]; 465 + 466 + if (element->type != ACPI_TYPE_LOCAL_REFERENCE) 467 + continue; 468 + 469 + rhandle = element->reference.handle; 470 + if (!rhandle) 471 + goto fail; 472 + 473 + acpi_get_name(rhandle, ACPI_SINGLE_NAME, &b_name); 474 + 475 + dev_dbg(dev, "Found PM resource '%s'\n", name); 476 + if (strlen(name) == 4 && !strncmp(name, "CLK", 3)) { 477 + if (name[3] >= '0' && name[3] <= '4') 478 + clock_num = name[3] - '0'; 479 + #if 0 480 + /* 481 + * We could abort here, but let's parse all resources, 482 + * as this is helpful for debugging purposes 483 + */ 484 + if (clock_num >= 0) 485 + break; 486 + #endif 487 + } 449 488 } 450 489 451 - dev_info(&client->dev, "%s: ACPI detected it on bus ID=%s, HID=%s\n", 452 - __func__, acpi_device_bid(adev), acpi_device_hid(adev)); 490 + fail: 491 + ACPI_FREE(buffer.pointer); 453 492 454 - if (!pmic_id) { 455 - if (gmin_i2c_dev_exists(dev, PMIC_ACPI_TI, &power)) 456 - pmic_id = PMIC_TI; 457 - else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_AXP, &power)) 458 - pmic_id = PMIC_AXP; 459 - else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_CRYSTALCOVE, &power)) 460 - pmic_id = PMIC_CRYSTALCOVE; 461 - else 462 - pmic_id = PMIC_REGULATOR; 463 - } 493 + return clock_num; 494 + } 464 495 465 - for (i = 0; i < MAX_SUBDEVS && gmin_subdevs[i].subdev; i++) 466 - ; 467 - if (i >= MAX_SUBDEVS) 468 - return NULL; 496 + static u8 gmin_get_pmic_id_and_addr(struct device *dev) 497 + { 498 + struct i2c_client *power; 499 + static u8 pmic_i2c_addr; 469 500 470 - if (power) { 471 - gmin_subdevs[i].pwm_i2c_addr = power->addr; 472 - dev_info(dev, 473 - "gmin: power management provided via %s (i2c addr 0x%02x)\n", 474 - pmic_name[pmic_id], power->addr); 475 - } else { 476 - dev_info(dev, "gmin: power management provided via %s\n", 477 - pmic_name[pmic_id]); 478 - } 501 + if (pmic_id) 502 + return pmic_i2c_addr; 479 503 480 - gmin_subdevs[i].subdev = subdev; 481 - gmin_subdevs[i].clock_num = gmin_get_var_int(dev, false, "CamClk", 0); 504 + if (gmin_i2c_dev_exists(dev, PMIC_ACPI_TI, &power)) 505 + pmic_id = PMIC_TI; 506 + else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_AXP, &power)) 507 + pmic_id = PMIC_AXP; 508 + else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_CRYSTALCOVE, &power)) 509 + pmic_id = PMIC_CRYSTALCOVE; 510 + else 511 + pmic_id = PMIC_REGULATOR; 512 + 513 + pmic_i2c_addr = power ? power->addr : 0; 514 + return pmic_i2c_addr; 515 + } 516 + 517 + static int gmin_detect_pmic(struct v4l2_subdev *subdev) 518 + { 519 + struct i2c_client *client = v4l2_get_subdevdata(subdev); 520 + struct device *dev = &client->dev; 521 + u8 pmic_i2c_addr; 522 + 523 + pmic_i2c_addr = gmin_get_pmic_id_and_addr(dev); 524 + dev_info(dev, "gmin: power management provided via %s (i2c addr 0x%02x)\n", 525 + pmic_name[pmic_id], pmic_i2c_addr); 526 + return pmic_i2c_addr; 527 + } 528 + 529 + static int gmin_subdev_add(struct gmin_subdev *gs) 530 + { 531 + struct i2c_client *client = v4l2_get_subdevdata(gs->subdev); 532 + struct device *dev = &client->dev; 533 + struct acpi_device *adev = ACPI_COMPANION(dev); 534 + int ret, clock_num = -1; 535 + 536 + dev_info(dev, "%s: ACPI path is %pfw\n", __func__, dev_fwnode(dev)); 537 + 482 538 /*WA:CHT requires XTAL clock as PLL is not stable.*/ 483 - gmin_subdevs[i].clock_src = gmin_get_var_int(dev, false, "ClkSrc", 484 - VLV2_CLK_PLL_19P2MHZ); 485 - gmin_subdevs[i].csi_port = gmin_get_var_int(dev, false, "CsiPort", 0); 486 - gmin_subdevs[i].csi_lanes = gmin_get_var_int(dev, false, "CsiLanes", 1); 539 + gs->clock_src = gmin_get_var_int(dev, false, "ClkSrc", 540 + VLV2_CLK_PLL_19P2MHZ); 487 541 488 - /* get PMC clock with clock framework */ 489 - snprintf(gmin_pmc_clk_name, 490 - sizeof(gmin_pmc_clk_name), 491 - "%s_%d", "pmc_plt_clk", gmin_subdevs[i].clock_num); 542 + gs->csi_port = gmin_get_var_int(dev, false, "CsiPort", 0); 543 + gs->csi_lanes = gmin_get_var_int(dev, false, "CsiLanes", 1); 492 544 493 - gmin_subdevs[i].pmc_clk = devm_clk_get(dev, gmin_pmc_clk_name); 494 - if (IS_ERR(gmin_subdevs[i].pmc_clk)) { 495 - ret = PTR_ERR(gmin_subdevs[i].pmc_clk); 545 + gs->gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW); 546 + if (IS_ERR(gs->gpio0)) 547 + gs->gpio0 = NULL; 548 + else 549 + dev_info(dev, "will handle gpio0 via ACPI\n"); 496 550 497 - dev_err(dev, 498 - "Failed to get clk from %s : %d\n", 499 - gmin_pmc_clk_name, 500 - ret); 551 + gs->gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW); 552 + if (IS_ERR(gs->gpio1)) 553 + gs->gpio1 = NULL; 554 + else 555 + dev_info(dev, "will handle gpio1 via ACPI\n"); 501 556 502 - return NULL; 557 + /* 558 + * Those are used only when there is an external regulator apart 559 + * from the PMIC that would be providing power supply, like on the 560 + * two cases below: 561 + * 562 + * The ECS E7 board drives camera 2.8v from an external regulator 563 + * instead of the PMIC. There's a gmin_CamV2P8 config variable 564 + * that specifies the GPIO to handle this particular case, 565 + * but this needs a broader architecture for handling camera power. 566 + * 567 + * The CHT RVP board drives camera 1.8v from an* external regulator 568 + * instead of the PMIC just like ECS E7 board. 569 + */ 570 + 571 + gs->v1p8_gpio = gmin_get_var_int(dev, true, "V1P8GPIO", -1); 572 + gs->v2p8_gpio = gmin_get_var_int(dev, true, "V2P8GPIO", -1); 573 + 574 + /* 575 + * FIXME: 576 + * 577 + * The ACPI handling code checks for the _PR? tables in order to 578 + * know what is required to switch the device from power state 579 + * D0 (_PR0) up to D3COLD (_PR3). 580 + * 581 + * The adev->flags.power_manageable is set to true if the device 582 + * has a _PR0 table, which can be checked by calling 583 + * acpi_device_power_manageable(adev). 584 + * 585 + * However, this only says that the device can be set to power off 586 + * mode. 587 + * 588 + * At least on the DSDT tables we've seen so far, there's no _PR3, 589 + * nor _PS3 (which would have a somewhat similar effect). 590 + * So, using ACPI for power management won't work, except if adding 591 + * an ACPI override logic somewhere. 592 + * 593 + * So, at least for the existing devices we know, the check below 594 + * will always be false. 595 + */ 596 + if (acpi_device_can_wakeup(adev) && 597 + acpi_device_can_poweroff(adev)) { 598 + dev_info(dev, 599 + "gmin: power management provided via device PM\n"); 600 + return 0; 503 601 } 602 + 603 + /* 604 + * The code below is here due to backward compatibility with devices 605 + * whose ACPI BIOS may not contain everything that would be needed 606 + * in order to set clocks and do power management. 607 + */ 608 + 609 + /* 610 + * According with : 611 + * https://github.com/projectceladon/hardware-intel-kernelflinger/blob/master/doc/fastboot.md 612 + * 613 + * The "CamClk" EFI var is set via fastboot on some Android devices, 614 + * and seems to contain the number of the clock used to feed the 615 + * sensor. 616 + * 617 + * On systems with a proper ACPI table, this is given via the _PR0 618 + * power resource table. The logic below should first check if there 619 + * is a power resource already, falling back to the EFI vars detection 620 + * otherwise. 621 + */ 622 + 623 + /* Try first to use ACPI to get the clock resource */ 624 + if (acpi_device_power_manageable(adev)) 625 + clock_num = atomisp_get_acpi_power(dev); 626 + 627 + /* Fall-back use EFI and/or DMI match */ 628 + if (clock_num < 0) 629 + clock_num = gmin_get_var_int(dev, false, "CamClk", 0); 630 + 631 + if (clock_num < 0 || clock_num > MAX_CLK_COUNT) { 632 + dev_err(dev, "Invalid clock number\n"); 633 + return -EINVAL; 634 + } 635 + 636 + snprintf(gmin_pmc_clk_name, sizeof(gmin_pmc_clk_name), 637 + "%s_%d", "pmc_plt_clk", clock_num); 638 + 639 + gs->pmc_clk = devm_clk_get(dev, gmin_pmc_clk_name); 640 + if (IS_ERR(gs->pmc_clk)) { 641 + ret = PTR_ERR(gs->pmc_clk); 642 + dev_err(dev, "Failed to get clk from %s: %d\n", gmin_pmc_clk_name, ret); 643 + return ret; 644 + } 645 + dev_info(dev, "Will use CLK%d (%s)\n", clock_num, gmin_pmc_clk_name); 504 646 505 647 /* 506 648 * The firmware might enable the clock at ··· 640 526 * to disable a clock that has not been enabled, 641 527 * we need to enable the clock first. 642 528 */ 643 - ret = clk_prepare_enable(gmin_subdevs[i].pmc_clk); 529 + ret = clk_prepare_enable(gs->pmc_clk); 644 530 if (!ret) 645 - clk_disable_unprepare(gmin_subdevs[i].pmc_clk); 646 - 647 - gmin_subdevs[i].gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW); 648 - if (IS_ERR(gmin_subdevs[i].gpio0)) 649 - gmin_subdevs[i].gpio0 = NULL; 650 - 651 - gmin_subdevs[i].gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW); 652 - if (IS_ERR(gmin_subdevs[i].gpio1)) 653 - gmin_subdevs[i].gpio1 = NULL; 531 + clk_disable_unprepare(gs->pmc_clk); 654 532 655 533 switch (pmic_id) { 656 534 case PMIC_REGULATOR: 657 - gmin_subdevs[i].v1p8_reg = regulator_get(dev, "V1P8SX"); 658 - gmin_subdevs[i].v2p8_reg = regulator_get(dev, "V2P8SX"); 535 + gs->v1p8_reg = regulator_get(dev, "V1P8SX"); 536 + gs->v2p8_reg = regulator_get(dev, "V2P8SX"); 659 537 660 - gmin_subdevs[i].v1p2_reg = regulator_get(dev, "V1P2A"); 661 - gmin_subdevs[i].v2p8_vcm_reg = regulator_get(dev, "VPROG4B"); 538 + gs->v1p2_reg = regulator_get(dev, "V1P2A"); 539 + gs->v2p8_vcm_reg = regulator_get(dev, "VPROG4B"); 662 540 663 541 /* Note: ideally we would initialize v[12]p8_on to the 664 542 * output of regulator_is_enabled(), but sadly that ··· 662 556 break; 663 557 664 558 case PMIC_AXP: 665 - gmin_subdevs[i].eldo1_1p8v = gmin_get_var_int(dev, false, 666 - "eldo1_1p8v", 667 - ELDO1_1P8V); 668 - gmin_subdevs[i].eldo1_sel_reg = gmin_get_var_int(dev, false, 669 - "eldo1_sel_reg", 670 - ELDO1_SEL_REG); 671 - gmin_subdevs[i].eldo1_ctrl_shift = gmin_get_var_int(dev, false, 672 - "eldo1_ctrl_shift", 673 - ELDO1_CTRL_SHIFT); 674 - gmin_subdevs[i].eldo2_1p8v = gmin_get_var_int(dev, false, 675 - "eldo2_1p8v", 676 - ELDO2_1P8V); 677 - gmin_subdevs[i].eldo2_sel_reg = gmin_get_var_int(dev, false, 678 - "eldo2_sel_reg", 679 - ELDO2_SEL_REG); 680 - gmin_subdevs[i].eldo2_ctrl_shift = gmin_get_var_int(dev, false, 681 - "eldo2_ctrl_shift", 682 - ELDO2_CTRL_SHIFT); 683 - gmin_subdevs[i].pwm_i2c_addr = power->addr; 559 + gs->eldo1_1p8v = gmin_get_var_int(dev, false, 560 + "eldo1_1p8v", 561 + ELDO1_1P8V); 562 + gs->eldo1_sel_reg = gmin_get_var_int(dev, false, 563 + "eldo1_sel_reg", 564 + ELDO1_SEL_REG); 565 + gs->eldo1_ctrl_shift = gmin_get_var_int(dev, false, 566 + "eldo1_ctrl_shift", 567 + ELDO1_CTRL_SHIFT); 568 + gs->eldo2_1p8v = gmin_get_var_int(dev, false, 569 + "eldo2_1p8v", 570 + ELDO2_1P8V); 571 + gs->eldo2_sel_reg = gmin_get_var_int(dev, false, 572 + "eldo2_sel_reg", 573 + ELDO2_SEL_REG); 574 + gs->eldo2_ctrl_shift = gmin_get_var_int(dev, false, 575 + "eldo2_ctrl_shift", 576 + ELDO2_CTRL_SHIFT); 684 577 break; 685 578 686 579 default: 687 580 break; 688 581 } 689 582 690 - return &gmin_subdevs[i]; 583 + return 0; 691 584 } 692 585 693 586 static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev) ··· 696 591 for (i = 0; i < MAX_SUBDEVS; i++) 697 592 if (gmin_subdevs[i].subdev == subdev) 698 593 return &gmin_subdevs[i]; 699 - return gmin_subdev_add(subdev); 594 + return NULL; 595 + } 596 + 597 + static struct gmin_subdev *find_free_gmin_subdev_slot(void) 598 + { 599 + unsigned int i; 600 + 601 + for (i = 0; i < MAX_SUBDEVS; i++) 602 + if (gmin_subdevs[i].subdev == NULL) 603 + return &gmin_subdevs[i]; 604 + return NULL; 700 605 } 701 606 702 607 static int axp_regulator_set(struct device *dev, struct gmin_subdev *gs, ··· 815 700 { 816 701 struct gmin_subdev *gs = find_gmin_subdev(subdev); 817 702 int ret; 818 - struct device *dev; 819 - struct i2c_client *client = v4l2_get_subdevdata(subdev); 820 703 int value; 821 704 822 - dev = &client->dev; 823 - 824 - if (v1p8_gpio == V1P8_GPIO_UNSET) { 825 - v1p8_gpio = gmin_get_var_int(dev, true, 826 - "V1P8GPIO", V1P8_GPIO_NONE); 827 - if (v1p8_gpio != V1P8_GPIO_NONE) { 828 - pr_info("atomisp_gmin_platform: 1.8v power on GPIO %d\n", 829 - v1p8_gpio); 830 - ret = gpio_request(v1p8_gpio, "camera_v1p8_en"); 831 - if (!ret) 832 - ret = gpio_direction_output(v1p8_gpio, 0); 833 - if (ret) 834 - pr_err("V1P8 GPIO initialization failed\n"); 835 - } 705 + if (gs->v1p8_gpio >= 0) { 706 + pr_info("atomisp_gmin_platform: 1.8v power on GPIO %d\n", 707 + gs->v1p8_gpio); 708 + ret = gpio_request(gs->v1p8_gpio, "camera_v1p8_en"); 709 + if (!ret) 710 + ret = gpio_direction_output(gs->v1p8_gpio, 0); 711 + if (ret) 712 + pr_err("V1P8 GPIO initialization failed\n"); 836 713 } 837 714 838 715 if (!gs || gs->v1p8_on == on) 839 716 return 0; 840 717 gs->v1p8_on = on; 841 718 842 - if (v1p8_gpio >= 0) 843 - gpio_set_value(v1p8_gpio, on); 719 + if (gs->v1p8_gpio >= 0) 720 + gpio_set_value(gs->v1p8_gpio, on); 844 721 845 722 if (gs->v1p8_reg) { 846 723 regulator_set_voltage(gs->v1p8_reg, 1800000, 1800000); ··· 869 762 { 870 763 struct gmin_subdev *gs = find_gmin_subdev(subdev); 871 764 int ret; 872 - struct device *dev; 873 - struct i2c_client *client = v4l2_get_subdevdata(subdev); 874 765 int value; 875 766 876 - dev = &client->dev; 877 - 878 - if (v2p8_gpio == V2P8_GPIO_UNSET) { 879 - v2p8_gpio = gmin_get_var_int(dev, true, 880 - "V2P8GPIO", V2P8_GPIO_NONE); 881 - if (v2p8_gpio != V2P8_GPIO_NONE) { 882 - pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n", 883 - v2p8_gpio); 884 - ret = gpio_request(v2p8_gpio, "camera_v2p8"); 885 - if (!ret) 886 - ret = gpio_direction_output(v2p8_gpio, 0); 887 - if (ret) 888 - pr_err("V2P8 GPIO initialization failed\n"); 889 - } 767 + if (gs->v2p8_gpio >= 0) { 768 + pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n", 769 + gs->v2p8_gpio); 770 + ret = gpio_request(gs->v2p8_gpio, "camera_v2p8"); 771 + if (!ret) 772 + ret = gpio_direction_output(gs->v2p8_gpio, 0); 773 + if (ret) 774 + pr_err("V2P8 GPIO initialization failed\n"); 890 775 } 891 776 892 777 if (!gs || gs->v2p8_on == on) 893 778 return 0; 894 779 gs->v2p8_on = on; 895 780 896 - if (v2p8_gpio >= 0) 897 - gpio_set_value(v2p8_gpio, on); 781 + if (gs->v2p8_gpio >= 0) 782 + gpio_set_value(gs->v2p8_gpio, on); 898 783 899 784 if (gs->v2p8_reg) { 900 785 regulator_set_voltage(gs->v2p8_reg, 2900000, 2900000); ··· 916 817 } 917 818 918 819 return -EINVAL; 820 + } 821 + 822 + static int gmin_acpi_pm_ctrl(struct v4l2_subdev *subdev, int on) 823 + { 824 + int ret = 0; 825 + struct gmin_subdev *gs = find_gmin_subdev(subdev); 826 + struct i2c_client *client = v4l2_get_subdevdata(subdev); 827 + struct acpi_device *adev = ACPI_COMPANION(&client->dev); 828 + 829 + /* Use the ACPI power management to control it */ 830 + on = !!on; 831 + if (gs->clock_on == on) 832 + return 0; 833 + 834 + dev_dbg(subdev->dev, "Setting power state to %s\n", 835 + on ? "on" : "off"); 836 + 837 + if (on) 838 + ret = acpi_device_set_power(adev, 839 + ACPI_STATE_D0); 840 + else 841 + ret = acpi_device_set_power(adev, 842 + ACPI_STATE_D3_COLD); 843 + 844 + if (!ret) 845 + gs->clock_on = on; 846 + else 847 + dev_err(subdev->dev, "Couldn't set power state to %s\n", 848 + on ? "on" : "off"); 849 + 850 + return ret; 919 851 } 920 852 921 853 static int gmin_flisclk_ctrl(struct v4l2_subdev *subdev, int on) ··· 1014 884 return NULL; 1015 885 } 1016 886 1017 - static struct camera_sensor_platform_data gmin_plat = { 887 + static struct camera_sensor_platform_data pmic_gmin_plat = { 1018 888 .gpio0_ctrl = gmin_gpio0_ctrl, 1019 889 .gpio1_ctrl = gmin_gpio1_ctrl, 1020 890 .v1p8_ctrl = gmin_v1p8_ctrl, ··· 1025 895 .get_vcm_ctrl = gmin_get_vcm_ctrl, 1026 896 }; 1027 897 898 + static struct camera_sensor_platform_data acpi_gmin_plat = { 899 + .gpio0_ctrl = gmin_gpio0_ctrl, 900 + .gpio1_ctrl = gmin_gpio1_ctrl, 901 + .v1p8_ctrl = gmin_acpi_pm_ctrl, 902 + .v2p8_ctrl = gmin_acpi_pm_ctrl, 903 + .v1p2_ctrl = gmin_acpi_pm_ctrl, 904 + .flisclk_ctrl = gmin_acpi_pm_ctrl, 905 + .csi_cfg = gmin_csi_cfg, 906 + .get_vcm_ctrl = gmin_get_vcm_ctrl, 907 + }; 908 + 1028 909 struct camera_sensor_platform_data *gmin_camera_platform_data( 1029 910 struct v4l2_subdev *subdev, 1030 911 enum atomisp_input_format csi_format, 1031 912 enum atomisp_bayer_order csi_bayer) 1032 913 { 1033 - struct gmin_subdev *gs = find_gmin_subdev(subdev); 914 + u8 pmic_i2c_addr = gmin_detect_pmic(subdev); 915 + struct gmin_subdev *gs; 1034 916 917 + gs = find_free_gmin_subdev_slot(); 918 + gs->subdev = subdev; 1035 919 gs->csi_fmt = csi_format; 1036 920 gs->csi_bayer = csi_bayer; 921 + gs->pwm_i2c_addr = pmic_i2c_addr; 1037 922 1038 - return &gmin_plat; 923 + gmin_subdev_add(gs); 924 + if (gs->pmc_clk) 925 + return &pmic_gmin_plat; 926 + else 927 + return &acpi_gmin_plat; 1039 928 } 1040 929 EXPORT_SYMBOL_GPL(gmin_camera_platform_data); 1041 930 ··· 1106 957 union acpi_object *obj, *cur = NULL; 1107 958 int i; 1108 959 960 + /* 961 + * The data reported by "CamClk" seems to be either 0 or 1 at the 962 + * _DSM table. 963 + * 964 + * At the ACPI tables we looked so far, this is not related to the 965 + * actual clock source for the sensor, which is given by the 966 + * _PR0 ACPI table. So, ignore it, as otherwise this will be 967 + * set to a wrong value. 968 + */ 969 + if (!strcmp(var, "CamClk")) 970 + return -EINVAL; 971 + 1109 972 obj = acpi_evaluate_dsm(handle, &atomisp_dsm_guid, 0, 0, NULL); 1110 973 if (!obj) { 1111 974 dev_info_once(dev, "Didn't find ACPI _DSM table.\n"); 1112 975 return -EINVAL; 1113 976 } 977 + 978 + /* Return on unexpected object type */ 979 + if (obj->type != ACPI_TYPE_PACKAGE) 980 + return -EINVAL; 1114 981 1115 982 #if 0 /* Just for debugging purposes */ 1116 983 for (i = 0; i < obj->package.count; i++) { ··· 1320 1155 * trying. The driver itself does direct calls to the PUNIT to manage 1321 1156 * ISP power. 1322 1157 */ 1323 - static void isp_pm_cap_fixup(struct pci_dev *dev) 1158 + static void isp_pm_cap_fixup(struct pci_dev *pdev) 1324 1159 { 1325 - dev_info(&dev->dev, "Disabling PCI power management on camera ISP\n"); 1326 - dev->pm_cap = 0; 1160 + dev_info(&pdev->dev, "Disabling PCI power management on camera ISP\n"); 1161 + pdev->pm_cap = 0; 1327 1162 } 1328 1163 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0f38, isp_pm_cap_fixup); 1329 1164
+1 -1
drivers/staging/media/atomisp/pci/atomisp_internal.h
··· 216 216 * ci device struct 217 217 */ 218 218 struct atomisp_device { 219 - struct pci_dev *pdev; 220 219 struct device *dev; 221 220 struct v4l2_device v4l2_dev; 222 221 struct media_device media_dev; 223 222 struct atomisp_platform_data *pdata; 224 223 void *mmu_l1_base; 224 + void __iomem *base; 225 225 const struct firmware *firmware; 226 226 227 227 struct pm_qos_request pm_qos;
+9 -10
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
··· 549 549 550 550 strscpy(cap->driver, DRIVER, sizeof(cap->driver)); 551 551 strscpy(cap->card, CARD, sizeof(cap->card)); 552 - snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", 553 - pci_name(isp->pdev)); 552 + snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", dev_name(isp->dev)); 554 553 555 554 return 0; 556 555 } ··· 1634 1635 struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); 1635 1636 struct atomisp_sub_device *asd = pipe->asd; 1636 1637 struct atomisp_device *isp = video_get_drvdata(vdev); 1638 + struct pci_dev *pdev = to_pci_dev(isp->dev); 1637 1639 enum ia_css_pipe_id css_pipe_id; 1638 1640 unsigned int sensor_start_stream; 1639 1641 unsigned int wdt_duration = ATOMISP_ISP_TIMEOUT_DURATION; ··· 1844 1844 /* Enable the CSI interface on ANN B0/K0 */ 1845 1845 if (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 << 1846 1846 ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0)) { 1847 - pci_write_config_word(isp->pdev, MRFLD_PCI_CSI_CONTROL, 1848 - isp->saved_regs.csi_control | 1849 - MRFLD_PCI_CSI_CONTROL_CSI_READY); 1847 + pci_write_config_word(pdev, MRFLD_PCI_CSI_CONTROL, 1848 + isp->saved_regs.csi_control | MRFLD_PCI_CSI_CONTROL_CSI_READY); 1850 1849 } 1851 1850 1852 1851 /* stream on the sensor */ ··· 1890 1891 { 1891 1892 struct video_device *vdev = video_devdata(file); 1892 1893 struct atomisp_device *isp = video_get_drvdata(vdev); 1894 + struct pci_dev *pdev = to_pci_dev(isp->dev); 1893 1895 struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); 1894 1896 struct atomisp_sub_device *asd = pipe->asd; 1895 1897 struct atomisp_video_pipe *capture_pipe = NULL; ··· 2076 2076 /* Disable the CSI interface on ANN B0/K0 */ 2077 2077 if (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 << 2078 2078 ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0)) { 2079 - pci_write_config_word(isp->pdev, MRFLD_PCI_CSI_CONTROL, 2080 - isp->saved_regs.csi_control & 2081 - ~MRFLD_PCI_CSI_CONTROL_CSI_READY); 2079 + pci_write_config_word(pdev, MRFLD_PCI_CSI_CONTROL, 2080 + isp->saved_regs.csi_control & ~MRFLD_PCI_CSI_CONTROL_CSI_READY); 2082 2081 } 2083 2082 2084 2083 if (atomisp_freq_scaling(isp, ATOMISP_DFS_MODE_LOW, false)) ··· 2110 2111 } 2111 2112 2112 2113 /* disable PUNIT/ISP acknowlede/handshake - SRSE=3 */ 2113 - pci_write_config_dword(isp->pdev, PCI_I_CONTROL, isp->saved_regs.i_control | 2114 - MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK); 2114 + pci_write_config_dword(pdev, PCI_I_CONTROL, 2115 + isp->saved_regs.i_control | MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK); 2115 2116 dev_err(isp->dev, "atomisp_reset"); 2116 2117 atomisp_reset(isp); 2117 2118 for (i = 0; i < isp->num_of_streams; i++) {
+125 -156
drivers/staging/media/atomisp/pci/atomisp_v4l2.c
··· 127 127 128 128 struct device *atomisp_dev; 129 129 130 - void __iomem *atomisp_io_base; 131 - 132 130 static const struct atomisp_freq_scaling_rule dfs_rules_merr[] = { 133 131 { 134 132 .width = ISP_FREQ_RULE_ANY, ··· 510 512 511 513 static int atomisp_save_iunit_reg(struct atomisp_device *isp) 512 514 { 513 - struct pci_dev *dev = isp->pdev; 515 + struct pci_dev *pdev = to_pci_dev(isp->dev); 514 516 515 517 dev_dbg(isp->dev, "%s\n", __func__); 516 518 517 - pci_read_config_word(dev, PCI_COMMAND, &isp->saved_regs.pcicmdsts); 519 + pci_read_config_word(pdev, PCI_COMMAND, &isp->saved_regs.pcicmdsts); 518 520 /* isp->saved_regs.ispmmadr is set from the atomisp_pci_probe() */ 519 - pci_read_config_dword(dev, PCI_MSI_CAPID, &isp->saved_regs.msicap); 520 - pci_read_config_dword(dev, PCI_MSI_ADDR, &isp->saved_regs.msi_addr); 521 - pci_read_config_word(dev, PCI_MSI_DATA, &isp->saved_regs.msi_data); 522 - pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &isp->saved_regs.intr); 523 - pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, 524 - &isp->saved_regs.interrupt_control); 521 + pci_read_config_dword(pdev, PCI_MSI_CAPID, &isp->saved_regs.msicap); 522 + pci_read_config_dword(pdev, PCI_MSI_ADDR, &isp->saved_regs.msi_addr); 523 + pci_read_config_word(pdev, PCI_MSI_DATA, &isp->saved_regs.msi_data); 524 + pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &isp->saved_regs.intr); 525 + pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &isp->saved_regs.interrupt_control); 525 526 526 - pci_read_config_dword(dev, MRFLD_PCI_PMCS, 527 - &isp->saved_regs.pmcs); 527 + pci_read_config_dword(pdev, MRFLD_PCI_PMCS, &isp->saved_regs.pmcs); 528 528 /* Ensure read/write combining is enabled. */ 529 - pci_read_config_dword(dev, PCI_I_CONTROL, 530 - &isp->saved_regs.i_control); 529 + pci_read_config_dword(pdev, PCI_I_CONTROL, &isp->saved_regs.i_control); 531 530 isp->saved_regs.i_control |= 532 531 MRFLD_PCI_I_CONTROL_ENABLE_READ_COMBINING | 533 532 MRFLD_PCI_I_CONTROL_ENABLE_WRITE_COMBINING; 534 - pci_read_config_dword(dev, MRFLD_PCI_CSI_ACCESS_CTRL_VIOL, 533 + pci_read_config_dword(pdev, MRFLD_PCI_CSI_ACCESS_CTRL_VIOL, 535 534 &isp->saved_regs.csi_access_viol); 536 - pci_read_config_dword(dev, MRFLD_PCI_CSI_RCOMP_CONTROL, 535 + pci_read_config_dword(pdev, MRFLD_PCI_CSI_RCOMP_CONTROL, 537 536 &isp->saved_regs.csi_rcomp_config); 538 537 /* 539 538 * Hardware bugs require setting CSI_HS_OVR_CLK_GATE_ON_UPDATE. ··· 540 545 * is missed, and IUNIT can hang. 541 546 * For both issues, setting this bit is a workaround. 542 547 */ 543 - isp->saved_regs.csi_rcomp_config |= 544 - MRFLD_PCI_CSI_HS_OVR_CLK_GATE_ON_UPDATE; 545 - pci_read_config_dword(dev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL, 548 + isp->saved_regs.csi_rcomp_config |= MRFLD_PCI_CSI_HS_OVR_CLK_GATE_ON_UPDATE; 549 + pci_read_config_dword(pdev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL, 546 550 &isp->saved_regs.csi_afe_dly); 547 - pci_read_config_dword(dev, MRFLD_PCI_CSI_CONTROL, 551 + pci_read_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, 548 552 &isp->saved_regs.csi_control); 549 553 if (isp->media_dev.hw_revision >= 550 554 (ATOMISP_HW_REVISION_ISP2401 << ATOMISP_HW_REVISION_SHIFT)) 551 - isp->saved_regs.csi_control |= 552 - MRFLD_PCI_CSI_CONTROL_PARPATHEN; 555 + isp->saved_regs.csi_control |= MRFLD_PCI_CSI_CONTROL_PARPATHEN; 553 556 /* 554 557 * On CHT CSI_READY bit should be enabled before stream on 555 558 */ 556 559 if (IS_CHT && (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 << 557 560 ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0))) 558 - isp->saved_regs.csi_control |= 559 - MRFLD_PCI_CSI_CONTROL_CSI_READY; 560 - pci_read_config_dword(dev, MRFLD_PCI_CSI_AFE_RCOMP_CONTROL, 561 + isp->saved_regs.csi_control |= MRFLD_PCI_CSI_CONTROL_CSI_READY; 562 + pci_read_config_dword(pdev, MRFLD_PCI_CSI_AFE_RCOMP_CONTROL, 561 563 &isp->saved_regs.csi_afe_rcomp_config); 562 - pci_read_config_dword(dev, MRFLD_PCI_CSI_AFE_HS_CONTROL, 564 + pci_read_config_dword(pdev, MRFLD_PCI_CSI_AFE_HS_CONTROL, 563 565 &isp->saved_regs.csi_afe_hs_control); 564 - pci_read_config_dword(dev, MRFLD_PCI_CSI_DEADLINE_CONTROL, 566 + pci_read_config_dword(pdev, MRFLD_PCI_CSI_DEADLINE_CONTROL, 565 567 &isp->saved_regs.csi_deadline_control); 566 568 return 0; 567 569 } 568 570 569 571 static int __maybe_unused atomisp_restore_iunit_reg(struct atomisp_device *isp) 570 572 { 571 - struct pci_dev *dev = isp->pdev; 573 + struct pci_dev *pdev = to_pci_dev(isp->dev); 572 574 573 575 dev_dbg(isp->dev, "%s\n", __func__); 574 576 575 - pci_write_config_word(dev, PCI_COMMAND, isp->saved_regs.pcicmdsts); 576 - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 577 - isp->saved_regs.ispmmadr); 578 - pci_write_config_dword(dev, PCI_MSI_CAPID, isp->saved_regs.msicap); 579 - pci_write_config_dword(dev, PCI_MSI_ADDR, isp->saved_regs.msi_addr); 580 - pci_write_config_word(dev, PCI_MSI_DATA, isp->saved_regs.msi_data); 581 - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, isp->saved_regs.intr); 582 - pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, 583 - isp->saved_regs.interrupt_control); 584 - pci_write_config_dword(dev, PCI_I_CONTROL, 585 - isp->saved_regs.i_control); 577 + pci_write_config_word(pdev, PCI_COMMAND, isp->saved_regs.pcicmdsts); 578 + pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, isp->saved_regs.ispmmadr); 579 + pci_write_config_dword(pdev, PCI_MSI_CAPID, isp->saved_regs.msicap); 580 + pci_write_config_dword(pdev, PCI_MSI_ADDR, isp->saved_regs.msi_addr); 581 + pci_write_config_word(pdev, PCI_MSI_DATA, isp->saved_regs.msi_data); 582 + pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, isp->saved_regs.intr); 583 + pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, isp->saved_regs.interrupt_control); 584 + pci_write_config_dword(pdev, PCI_I_CONTROL, isp->saved_regs.i_control); 586 585 587 - pci_write_config_dword(dev, MRFLD_PCI_PMCS, 588 - isp->saved_regs.pmcs); 589 - pci_write_config_dword(dev, MRFLD_PCI_CSI_ACCESS_CTRL_VIOL, 586 + pci_write_config_dword(pdev, MRFLD_PCI_PMCS, isp->saved_regs.pmcs); 587 + pci_write_config_dword(pdev, MRFLD_PCI_CSI_ACCESS_CTRL_VIOL, 590 588 isp->saved_regs.csi_access_viol); 591 - pci_write_config_dword(dev, MRFLD_PCI_CSI_RCOMP_CONTROL, 589 + pci_write_config_dword(pdev, MRFLD_PCI_CSI_RCOMP_CONTROL, 592 590 isp->saved_regs.csi_rcomp_config); 593 - pci_write_config_dword(dev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL, 591 + pci_write_config_dword(pdev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL, 594 592 isp->saved_regs.csi_afe_dly); 595 - pci_write_config_dword(dev, MRFLD_PCI_CSI_CONTROL, 593 + pci_write_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, 596 594 isp->saved_regs.csi_control); 597 - pci_write_config_dword(dev, MRFLD_PCI_CSI_AFE_RCOMP_CONTROL, 595 + pci_write_config_dword(pdev, MRFLD_PCI_CSI_AFE_RCOMP_CONTROL, 598 596 isp->saved_regs.csi_afe_rcomp_config); 599 - pci_write_config_dword(dev, MRFLD_PCI_CSI_AFE_HS_CONTROL, 597 + pci_write_config_dword(pdev, MRFLD_PCI_CSI_AFE_HS_CONTROL, 600 598 isp->saved_regs.csi_afe_hs_control); 601 - pci_write_config_dword(dev, MRFLD_PCI_CSI_DEADLINE_CONTROL, 599 + pci_write_config_dword(pdev, MRFLD_PCI_CSI_DEADLINE_CONTROL, 602 600 isp->saved_regs.csi_deadline_control); 603 601 604 602 /* ··· 607 619 608 620 static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp) 609 621 { 610 - struct pci_dev *dev = isp->pdev; 622 + struct pci_dev *pdev = to_pci_dev(isp->dev); 611 623 u32 irq; 612 624 unsigned long flags; 613 625 ··· 623 635 * So, here we need to check if there is any pending 624 636 * IRQ, if so, waiting for it to be served 625 637 */ 626 - pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq); 638 + pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq); 627 639 irq = irq & 1 << INTR_IIR; 628 - pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq); 640 + pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, irq); 629 641 630 - pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq); 642 + pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq); 631 643 if (!(irq & (1 << INTR_IIR))) 632 644 goto done; 633 645 ··· 640 652 spin_unlock_irqrestore(&isp->lock, flags); 641 653 return -EAGAIN; 642 654 } else { 643 - pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq); 655 + pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq); 644 656 irq = irq & 1 << INTR_IIR; 645 - pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq); 657 + pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, irq); 646 658 647 - pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq); 659 + pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq); 648 660 if (!(irq & (1 << INTR_IIR))) { 649 661 atomisp_css2_hw_store_32(MRFLD_INTR_ENABLE_REG, 0x0); 650 662 goto done; ··· 663 675 * to IIR. It could block subsequent interrupt messages. 664 676 * HW sighting:4568410. 665 677 */ 666 - pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq); 678 + pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq); 667 679 irq &= ~(1 << INTR_IER); 668 - pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq); 680 + pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, irq); 669 681 670 - atomisp_msi_irq_uninit(isp, dev); 682 + atomisp_msi_irq_uninit(isp); 671 683 atomisp_freq_scaling(isp, ATOMISP_DFS_MODE_LOW, true); 672 684 spin_unlock_irqrestore(&isp->lock, flags); 673 685 ··· 743 755 744 756 /* Wait until ISPSSPM0 bit[25:24] shows the right value */ 745 757 iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, MRFLD_ISPSSPM0, &tmp); 746 - tmp = (tmp & MRFLD_ISPSSPM0_ISPSSC_MASK) >> MRFLD_ISPSSPM0_ISPSSS_OFFSET; 758 + tmp = (tmp >> MRFLD_ISPSSPM0_ISPSSS_OFFSET) & MRFLD_ISPSSPM0_ISPSSC_MASK; 747 759 if (tmp == val) { 748 760 trace_ipu_cstate(enable); 749 761 return 0; ··· 766 778 /* Workaround for pmu_nc_set_power_state not ready in MRFLD */ 767 779 int atomisp_mrfld_power_down(struct atomisp_device *isp) 768 780 { 769 - // FIXME: at least with ISP2401, enabling this code causes the driver to break 770 - return 0 && atomisp_mrfld_power(isp, false); 781 + return atomisp_mrfld_power(isp, false); 771 782 } 772 783 773 784 /* Workaround for pmu_nc_set_power_state not ready in MRFLD */ 774 785 int atomisp_mrfld_power_up(struct atomisp_device *isp) 775 786 { 776 - // FIXME: at least with ISP2401, enabling this code causes the driver to break 777 - return 0 && atomisp_mrfld_power(isp, true); 787 + return atomisp_mrfld_power(isp, true); 778 788 } 779 789 780 790 int atomisp_runtime_suspend(struct device *dev) ··· 888 902 889 903 int atomisp_csi_lane_config(struct atomisp_device *isp) 890 904 { 905 + struct pci_dev *pdev = to_pci_dev(isp->dev); 891 906 static const struct { 892 907 u8 code; 893 908 u8 lanes[MRFLD_PORT_NUM]; ··· 990 1003 return -EINVAL; 991 1004 } 992 1005 993 - pci_read_config_dword(isp->pdev, MRFLD_PCI_CSI_CONTROL, &csi_control); 1006 + pci_read_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, &csi_control); 994 1007 csi_control &= ~port_config_mask; 995 1008 csi_control |= (portconfigs[i].code << MRFLD_PORT_CONFIGCODE_SHIFT) 996 1009 | (portconfigs[i].lanes[0] ? 0 : (1 << MRFLD_PORT1_ENABLE_SHIFT)) ··· 1000 1013 | (((1 << portconfigs[i].lanes[1]) - 1) << MRFLD_PORT2_LANES_SHIFT) 1001 1014 | (((1 << portconfigs[i].lanes[2]) - 1) << port3_lanes_shift); 1002 1015 1003 - pci_write_config_dword(isp->pdev, MRFLD_PCI_CSI_CONTROL, csi_control); 1016 + pci_write_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, csi_control); 1004 1017 1005 1018 dev_dbg(isp->dev, 1006 1019 "%s: the portconfig is %d-%d-%d, CSI_CONTROL is 0x%08X\n", ··· 1427 1440 * Check for flags the driver was compiled with against the PCI 1428 1441 * device. Always returns true on other than ISP 2400. 1429 1442 */ 1430 - static bool is_valid_device(struct pci_dev *dev, 1431 - const struct pci_device_id *id) 1443 + static bool is_valid_device(struct pci_dev *pdev, const struct pci_device_id *id) 1432 1444 { 1433 1445 unsigned int a0_max_id = 0; 1434 1446 const char *name; ··· 1451 1465 name = "Cherrytrail"; 1452 1466 break; 1453 1467 default: 1454 - dev_err(&dev->dev, "%s: unknown device ID %x04:%x04\n", 1468 + dev_err(&pdev->dev, "%s: unknown device ID %x04:%x04\n", 1455 1469 product, id->vendor, id->device); 1456 1470 return false; 1457 1471 } 1458 1472 1459 - if (dev->revision <= ATOMISP_PCI_REV_BYT_A0_MAX) { 1460 - dev_err(&dev->dev, "%s revision %d is not unsupported\n", 1461 - name, dev->revision); 1473 + if (pdev->revision <= ATOMISP_PCI_REV_BYT_A0_MAX) { 1474 + dev_err(&pdev->dev, "%s revision %d is not unsupported\n", 1475 + name, pdev->revision); 1462 1476 return false; 1463 1477 } 1464 1478 ··· 1469 1483 1470 1484 #if defined(ISP2400) 1471 1485 if (IS_ISP2401) { 1472 - dev_err(&dev->dev, "Support for %s (ISP2401) was disabled at compile time\n", 1486 + dev_err(&pdev->dev, "Support for %s (ISP2401) was disabled at compile time\n", 1473 1487 name); 1474 1488 return false; 1475 1489 } 1476 1490 #else 1477 1491 if (!IS_ISP2401) { 1478 - dev_err(&dev->dev, "Support for %s (ISP2400) was disabled at compile time\n", 1492 + dev_err(&pdev->dev, "Support for %s (ISP2400) was disabled at compile time\n", 1479 1493 name); 1480 1494 return false; 1481 1495 } 1482 1496 #endif 1483 1497 1484 - dev_info(&dev->dev, "Detected %s version %d (ISP240%c) on %s\n", 1485 - name, dev->revision, 1486 - IS_ISP2401 ? '1' : '0', 1487 - product); 1498 + dev_info(&pdev->dev, "Detected %s version %d (ISP240%c) on %s\n", 1499 + name, pdev->revision, IS_ISP2401 ? '1' : '0', product); 1488 1500 1489 1501 return true; 1490 1502 } ··· 1522 1538 1523 1539 #define ATOM_ISP_PCI_BAR 0 1524 1540 1525 - static int atomisp_pci_probe(struct pci_dev *dev, 1526 - const struct pci_device_id *id) 1541 + static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 1527 1542 { 1528 1543 const struct atomisp_platform_data *pdata; 1529 1544 struct atomisp_device *isp; 1530 1545 unsigned int start; 1531 - void __iomem *base; 1532 1546 int err, val; 1533 1547 u32 irq; 1534 1548 1535 - if (!is_valid_device(dev, id)) 1549 + if (!is_valid_device(pdev, id)) 1536 1550 return -ENODEV; 1537 1551 1538 1552 /* Pointer to struct device. */ 1539 - atomisp_dev = &dev->dev; 1553 + atomisp_dev = &pdev->dev; 1540 1554 1541 1555 pdata = atomisp_get_platform_data(); 1542 1556 if (!pdata) 1543 - dev_warn(&dev->dev, "no platform data available\n"); 1557 + dev_warn(&pdev->dev, "no platform data available\n"); 1544 1558 1545 - err = pcim_enable_device(dev); 1559 + err = pcim_enable_device(pdev); 1546 1560 if (err) { 1547 - dev_err(&dev->dev, "Failed to enable CI ISP device (%d)\n", 1548 - err); 1561 + dev_err(&pdev->dev, "Failed to enable CI ISP device (%d)\n", err); 1549 1562 return err; 1550 1563 } 1551 1564 1552 - start = pci_resource_start(dev, ATOM_ISP_PCI_BAR); 1553 - dev_dbg(&dev->dev, "start: 0x%x\n", start); 1565 + start = pci_resource_start(pdev, ATOM_ISP_PCI_BAR); 1566 + dev_dbg(&pdev->dev, "start: 0x%x\n", start); 1554 1567 1555 - err = pcim_iomap_regions(dev, 1 << ATOM_ISP_PCI_BAR, pci_name(dev)); 1568 + err = pcim_iomap_regions(pdev, 1 << ATOM_ISP_PCI_BAR, pci_name(pdev)); 1556 1569 if (err) { 1557 - dev_err(&dev->dev, "Failed to I/O memory remapping (%d)\n", 1558 - err); 1570 + dev_err(&pdev->dev, "Failed to I/O memory remapping (%d)\n", err); 1559 1571 goto ioremap_fail; 1560 1572 } 1561 1573 1562 - base = pcim_iomap_table(dev)[ATOM_ISP_PCI_BAR]; 1563 - dev_dbg(&dev->dev, "base: %p\n", base); 1564 - 1565 - atomisp_io_base = base; 1566 - 1567 - dev_dbg(&dev->dev, "atomisp_io_base: %p\n", atomisp_io_base); 1568 - 1569 - isp = devm_kzalloc(&dev->dev, sizeof(struct atomisp_device), GFP_KERNEL); 1574 + isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL); 1570 1575 if (!isp) { 1571 1576 err = -ENOMEM; 1572 1577 goto atomisp_dev_alloc_fail; 1573 1578 } 1574 - isp->pdev = dev; 1575 - isp->dev = &dev->dev; 1579 + 1580 + isp->dev = &pdev->dev; 1581 + isp->base = pcim_iomap_table(pdev)[ATOM_ISP_PCI_BAR]; 1576 1582 isp->sw_contex.power_state = ATOM_ISP_POWER_UP; 1577 1583 isp->saved_regs.ispmmadr = start; 1584 + 1585 + dev_dbg(&pdev->dev, "atomisp mmio base: %p\n", isp->base); 1578 1586 1579 1587 rt_mutex_init(&isp->mutex); 1580 1588 mutex_init(&isp->streamoff_mutex); 1581 1589 spin_lock_init(&isp->lock); 1582 1590 1583 1591 /* This is not a true PCI device on SoC, so the delay is not needed. */ 1584 - isp->pdev->d3_delay = 0; 1592 + pdev->d3_delay = 0; 1593 + 1594 + pci_set_drvdata(pdev, isp); 1585 1595 1586 1596 switch (id->device & ATOMISP_PCI_DEVICE_SOC_MASK) { 1587 1597 case ATOMISP_PCI_DEVICE_SOC_MRFLD: ··· 1626 1648 * have specs yet for exactly how it varies. Default to 1627 1649 * BYT-CR but let provisioning set it via EFI variable 1628 1650 */ 1629 - isp->hpll_freq = gmin_get_var_int(&dev->dev, false, "HpllFreq", 1630 - HPLL_FREQ_2000MHZ); 1651 + isp->hpll_freq = gmin_get_var_int(&pdev->dev, false, "HpllFreq", HPLL_FREQ_2000MHZ); 1631 1652 1632 1653 /* 1633 1654 * for BYT/CHT we are put isp into D3cold to avoid pci registers access 1634 1655 * in power off. Set d3cold_delay to 0 since default 100ms is not 1635 1656 * necessary. 1636 1657 */ 1637 - isp->pdev->d3cold_delay = 0; 1658 + pdev->d3cold_delay = 0; 1638 1659 break; 1639 1660 case ATOMISP_PCI_DEVICE_SOC_ANN: 1640 1661 isp->media_dev.hw_revision = ( ··· 1643 1666 ATOMISP_HW_REVISION_ISP2401_LEGACY 1644 1667 #endif 1645 1668 << ATOMISP_HW_REVISION_SHIFT); 1646 - isp->media_dev.hw_revision |= isp->pdev->revision < 2 ? 1669 + isp->media_dev.hw_revision |= pdev->revision < 2 ? 1647 1670 ATOMISP_HW_STEPPING_A0 : ATOMISP_HW_STEPPING_B0; 1648 1671 isp->dfs = &dfs_config_merr; 1649 1672 isp->hpll_freq = HPLL_FREQ_1600MHZ; ··· 1656 1679 ATOMISP_HW_REVISION_ISP2401_LEGACY 1657 1680 #endif 1658 1681 << ATOMISP_HW_REVISION_SHIFT); 1659 - isp->media_dev.hw_revision |= isp->pdev->revision < 2 ? 1682 + isp->media_dev.hw_revision |= pdev->revision < 2 ? 1660 1683 ATOMISP_HW_STEPPING_A0 : ATOMISP_HW_STEPPING_B0; 1661 1684 1662 1685 isp->dfs = &dfs_config_cht; 1663 - isp->pdev->d3cold_delay = 0; 1686 + pdev->d3cold_delay = 0; 1664 1687 1665 - iosf_mbi_read(CCK_PORT, MBI_REG_READ, CCK_FUSE_REG_0, &val); 1688 + iosf_mbi_read(BT_MBI_UNIT_CCK, MBI_REG_READ, CCK_FUSE_REG_0, &val); 1666 1689 switch (val & CCK_FUSE_HPLL_FREQ_MASK) { 1667 1690 case 0x00: 1668 1691 isp->hpll_freq = HPLL_FREQ_800MHZ; ··· 1675 1698 break; 1676 1699 default: 1677 1700 isp->hpll_freq = HPLL_FREQ_1600MHZ; 1678 - dev_warn(isp->dev, 1679 - "read HPLL from cck failed. Default to 1600 MHz.\n"); 1701 + dev_warn(&pdev->dev, "read HPLL from cck failed. Default to 1600 MHz.\n"); 1680 1702 } 1681 1703 break; 1682 1704 default: 1683 - dev_err(&dev->dev, "un-supported IUNIT device\n"); 1705 + dev_err(&pdev->dev, "un-supported IUNIT device\n"); 1684 1706 err = -ENODEV; 1685 1707 goto atomisp_dev_alloc_fail; 1686 1708 } 1687 1709 1688 - dev_info(&dev->dev, "ISP HPLL frequency base = %d MHz\n", 1689 - isp->hpll_freq); 1710 + dev_info(&pdev->dev, "ISP HPLL frequency base = %d MHz\n", isp->hpll_freq); 1690 1711 1691 1712 isp->max_isr_latency = ATOMISP_MAX_ISR_LATENCY; 1692 1713 ··· 1693 1718 isp->firmware = atomisp_load_firmware(isp); 1694 1719 if (!isp->firmware) { 1695 1720 err = -ENOENT; 1696 - dev_dbg(&dev->dev, "Firmware load failed\n"); 1721 + dev_dbg(&pdev->dev, "Firmware load failed\n"); 1697 1722 goto load_fw_fail; 1698 1723 } 1699 1724 1700 - err = sh_css_check_firmware_version(isp->dev, 1701 - isp->firmware->data); 1725 + err = sh_css_check_firmware_version(isp->dev, isp->firmware->data); 1702 1726 if (err) { 1703 - dev_dbg(&dev->dev, "Firmware version check failed\n"); 1727 + dev_dbg(&pdev->dev, "Firmware version check failed\n"); 1704 1728 goto fw_validation_fail; 1705 1729 } 1706 1730 } else { 1707 - dev_info(&dev->dev, "Firmware load will be deferred\n"); 1731 + dev_info(&pdev->dev, "Firmware load will be deferred\n"); 1708 1732 } 1709 1733 1710 - pci_set_master(dev); 1711 - pci_set_drvdata(dev, isp); 1734 + pci_set_master(pdev); 1712 1735 1713 - err = pci_enable_msi(dev); 1736 + err = pci_enable_msi(pdev); 1714 1737 if (err) { 1715 - dev_err(&dev->dev, "Failed to enable msi (%d)\n", err); 1738 + dev_err(&pdev->dev, "Failed to enable msi (%d)\n", err); 1716 1739 goto enable_msi_fail; 1717 1740 } 1718 1741 1719 - atomisp_msi_irq_init(isp, dev); 1742 + atomisp_msi_irq_init(isp); 1720 1743 1721 1744 cpu_latency_qos_add_request(&isp->pm_qos, PM_QOS_DEFAULT_VALUE); 1722 1745 ··· 1735 1762 * Workaround for imbalance data eye issue which is observed 1736 1763 * on TNG B0. 1737 1764 */ 1738 - pci_read_config_dword(dev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL, 1739 - &csi_afe_trim); 1765 + pci_read_config_dword(pdev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL, &csi_afe_trim); 1740 1766 csi_afe_trim &= ~((MRFLD_PCI_CSI_HSRXCLKTRIM_MASK << 1741 1767 MRFLD_PCI_CSI1_HSRXCLKTRIM_SHIFT) | 1742 1768 (MRFLD_PCI_CSI_HSRXCLKTRIM_MASK << ··· 1748 1776 MRFLD_PCI_CSI2_HSRXCLKTRIM_SHIFT) | 1749 1777 (MRFLD_PCI_CSI3_HSRXCLKTRIM << 1750 1778 MRFLD_PCI_CSI3_HSRXCLKTRIM_SHIFT); 1751 - pci_write_config_dword(dev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL, 1752 - csi_afe_trim); 1779 + pci_write_config_dword(pdev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL, csi_afe_trim); 1753 1780 } 1754 1781 1755 1782 err = atomisp_initialize_modules(isp); 1756 1783 if (err < 0) { 1757 - dev_err(&dev->dev, "atomisp_initialize_modules (%d)\n", err); 1784 + dev_err(&pdev->dev, "atomisp_initialize_modules (%d)\n", err); 1758 1785 goto initialize_modules_fail; 1759 1786 } 1760 1787 1761 1788 err = atomisp_register_entities(isp); 1762 1789 if (err < 0) { 1763 - dev_err(&dev->dev, "atomisp_register_entities failed (%d)\n", 1764 - err); 1790 + dev_err(&pdev->dev, "atomisp_register_entities failed (%d)\n", err); 1765 1791 goto register_entities_fail; 1766 1792 } 1767 1793 err = atomisp_create_pads_links(isp); ··· 1772 1802 /* save the iunit context only once after all the values are init'ed. */ 1773 1803 atomisp_save_iunit_reg(isp); 1774 1804 1775 - pm_runtime_put_noidle(&dev->dev); 1776 - pm_runtime_allow(&dev->dev); 1805 + pm_runtime_put_noidle(&pdev->dev); 1806 + pm_runtime_allow(&pdev->dev); 1777 1807 1778 1808 hmm_init_mem_stat(repool_pgnr, dypool_enable, dypool_pgnr); 1779 1809 err = hmm_pool_register(repool_pgnr, HMM_POOL_TYPE_RESERVED); 1780 1810 if (err) { 1781 - dev_err(&dev->dev, "Failed to register reserved memory pool.\n"); 1811 + dev_err(&pdev->dev, "Failed to register reserved memory pool.\n"); 1782 1812 goto hmm_pool_fail; 1783 1813 } 1784 1814 1785 1815 /* Init ISP memory management */ 1786 1816 hmm_init(); 1787 1817 1788 - err = devm_request_threaded_irq(&dev->dev, dev->irq, 1818 + err = devm_request_threaded_irq(&pdev->dev, pdev->irq, 1789 1819 atomisp_isr, atomisp_isr_thread, 1790 1820 IRQF_SHARED, "isp_irq", isp); 1791 1821 if (err) { 1792 - dev_err(&dev->dev, "Failed to request irq (%d)\n", err); 1822 + dev_err(&pdev->dev, "Failed to request irq (%d)\n", err); 1793 1823 goto request_irq_fail; 1794 1824 } 1795 1825 ··· 1797 1827 if (!defer_fw_load) { 1798 1828 err = atomisp_css_load_firmware(isp); 1799 1829 if (err) { 1800 - dev_err(&dev->dev, "Failed to init css.\n"); 1830 + dev_err(&pdev->dev, "Failed to init css.\n"); 1801 1831 goto css_init_fail; 1802 1832 } 1803 1833 } else { 1804 - dev_dbg(&dev->dev, "Skip css init.\n"); 1834 + dev_dbg(&pdev->dev, "Skip css init.\n"); 1805 1835 } 1806 1836 /* Clear FW image from memory */ 1807 1837 release_firmware(isp->firmware); 1808 1838 isp->firmware = NULL; 1809 1839 isp->css_env.isp_css_fw.data = NULL; 1810 1840 1811 - atomisp_drvfs_init(&dev->driver->driver, isp); 1841 + atomisp_drvfs_init(isp); 1812 1842 1813 1843 return 0; 1814 1844 1815 1845 css_init_fail: 1816 - devm_free_irq(&dev->dev, dev->irq, isp); 1846 + devm_free_irq(&pdev->dev, pdev->irq, isp); 1817 1847 request_irq_fail: 1818 1848 hmm_cleanup(); 1819 1849 hmm_pool_unregister(HMM_POOL_TYPE_RESERVED); ··· 1826 1856 atomisp_uninitialize_modules(isp); 1827 1857 initialize_modules_fail: 1828 1858 cpu_latency_qos_remove_request(&isp->pm_qos); 1829 - atomisp_msi_irq_uninit(isp, dev); 1830 - pci_disable_msi(dev); 1859 + atomisp_msi_irq_uninit(isp); 1860 + pci_disable_msi(pdev); 1831 1861 enable_msi_fail: 1832 1862 fw_validation_fail: 1833 1863 release_firmware(isp->firmware); ··· 1839 1869 * The following lines have been copied from atomisp suspend path 1840 1870 */ 1841 1871 1842 - pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq); 1872 + pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq); 1843 1873 irq = irq & 1 << INTR_IIR; 1844 - pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq); 1874 + pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, irq); 1845 1875 1846 - pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq); 1876 + pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq); 1847 1877 irq &= ~(1 << INTR_IER); 1848 - pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq); 1878 + pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, irq); 1849 1879 1850 - atomisp_msi_irq_uninit(isp, dev); 1880 + atomisp_msi_irq_uninit(isp); 1851 1881 1852 1882 atomisp_ospm_dphy_down(isp); 1853 1883 1854 1884 /* Address later when we worry about the ...field chips */ 1855 1885 if (IS_ENABLED(CONFIG_PM) && atomisp_mrfld_power_down(isp)) 1856 - dev_err(&dev->dev, "Failed to switch off ISP\n"); 1886 + dev_err(&pdev->dev, "Failed to switch off ISP\n"); 1857 1887 1858 1888 atomisp_dev_alloc_fail: 1859 - pcim_iounmap_regions(dev, 1 << ATOM_ISP_PCI_BAR); 1889 + pcim_iounmap_regions(pdev, 1 << ATOM_ISP_PCI_BAR); 1860 1890 1861 1891 ioremap_fail: 1862 1892 return err; 1863 1893 } 1864 1894 1865 - static void atomisp_pci_remove(struct pci_dev *dev) 1895 + static void atomisp_pci_remove(struct pci_dev *pdev) 1866 1896 { 1867 - struct atomisp_device *isp = (struct atomisp_device *) 1868 - pci_get_drvdata(dev); 1897 + struct atomisp_device *isp = pci_get_drvdata(pdev); 1869 1898 1870 - dev_info(&dev->dev, "Removing atomisp driver\n"); 1899 + dev_info(&pdev->dev, "Removing atomisp driver\n"); 1871 1900 1872 1901 atomisp_drvfs_exit(); 1873 1902 ··· 1875 1906 ia_css_unload_firmware(); 1876 1907 hmm_cleanup(); 1877 1908 1878 - pm_runtime_forbid(&dev->dev); 1879 - pm_runtime_get_noresume(&dev->dev); 1909 + pm_runtime_forbid(&pdev->dev); 1910 + pm_runtime_get_noresume(&pdev->dev); 1880 1911 cpu_latency_qos_remove_request(&isp->pm_qos); 1881 1912 1882 - atomisp_msi_irq_uninit(isp, dev); 1913 + atomisp_msi_irq_uninit(isp); 1883 1914 atomisp_unregister_entities(isp); 1884 1915 1885 1916 destroy_workqueue(isp->wdt_work_queue);
+14 -14
drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c
··· 48 48 return NULL; 49 49 if (!myrefcount.items) { 50 50 ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, 51 - "refcount_find_entry(): Ref count not initialized!\n"); 51 + "%s(): Ref count not initialized!\n", __func__); 52 52 return NULL; 53 53 } 54 54 ··· 73 73 74 74 if (size == 0) { 75 75 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, 76 - "ia_css_refcount_init(): Size of 0 for Ref count init!\n"); 76 + "%s(): Size of 0 for Ref count init!\n", __func__); 77 77 return -EINVAL; 78 78 } 79 79 if (myrefcount.items) { 80 80 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, 81 - "ia_css_refcount_init(): Ref count is already initialized\n"); 81 + "%s(): Ref count is already initialized\n", __func__); 82 82 return -EINVAL; 83 83 } 84 84 myrefcount.items = ··· 99 99 u32 i; 100 100 101 101 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, 102 - "ia_css_refcount_uninit() entry\n"); 102 + "%s() entry\n", __func__); 103 103 for (i = 0; i < myrefcount.size; i++) { 104 104 /* driver verifier tool has issues with &arr[i] 105 105 and prefers arr + i; as these are actually equivalent ··· 120 120 myrefcount.items = NULL; 121 121 myrefcount.size = 0; 122 122 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, 123 - "ia_css_refcount_uninit() leave\n"); 123 + "%s() leave\n", __func__); 124 124 } 125 125 126 126 ia_css_ptr ia_css_refcount_increment(s32 id, ia_css_ptr ptr) ··· 133 133 entry = refcount_find_entry(ptr, false); 134 134 135 135 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, 136 - "ia_css_refcount_increment(%x) 0x%x\n", id, ptr); 136 + "%s(%x) 0x%x\n", __func__, id, ptr); 137 137 138 138 if (!entry) { 139 139 entry = refcount_find_entry(ptr, true); ··· 145 145 146 146 if (entry->id != id) { 147 147 ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, 148 - "ia_css_refcount_increment(): Ref count IDS do not match!\n"); 148 + "%s(): Ref count IDS do not match!\n", __func__); 149 149 return mmgr_NULL; 150 150 } 151 151 ··· 165 165 struct ia_css_refcount_entry *entry; 166 166 167 167 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, 168 - "ia_css_refcount_decrement(%x) 0x%x\n", id, ptr); 168 + "%s(%x) 0x%x\n", __func__, id, ptr); 169 169 170 170 if (ptr == mmgr_NULL) 171 171 return false; ··· 175 175 if (entry) { 176 176 if (entry->id != id) { 177 177 ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, 178 - "ia_css_refcount_decrement(): Ref count IDS do not match!\n"); 178 + "%s(): Ref count IDS do not match!\n", __func__); 179 179 return false; 180 180 } 181 181 if (entry->count > 0) { ··· 225 225 u32 count = 0; 226 226 227 227 assert(clear_func_ptr); 228 - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_refcount_clear(%x)\n", 229 - id); 228 + ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "%s(%x)\n", 229 + __func__, id); 230 230 231 231 for (i = 0; i < myrefcount.size; i++) { 232 232 /* driver verifier tool has issues with &arr[i] ··· 236 236 entry = myrefcount.items + i; 237 237 if ((entry->data != mmgr_NULL) && (entry->id == id)) { 238 238 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, 239 - "ia_css_refcount_clear: %x: 0x%x\n", 239 + "%s: %x: 0x%x\n", __func__, 240 240 id, entry->data); 241 241 if (clear_func_ptr) { 242 242 /* clear using provided function */ 243 243 clear_func_ptr(entry->data); 244 244 } else { 245 245 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, 246 - "ia_css_refcount_clear: using hmm_free: no clear_func\n"); 246 + "%s: using hmm_free: no clear_func\n", __func__); 247 247 hmm_free(entry->data); 248 248 } 249 249 ··· 260 260 } 261 261 } 262 262 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, 263 - "ia_css_refcount_clear(%x): cleared %d\n", id, 263 + "%s(%x): cleared %d\n", __func__, id, 264 264 count); 265 265 } 266 266
+3 -21
drivers/staging/media/atomisp/pci/hive_types.h
··· 52 52 typedef unsigned int hive_uint32; 53 53 typedef unsigned long long hive_uint64; 54 54 55 - /* by default assume 32 bit master port (both data and address) */ 56 - #ifndef HRT_DATA_WIDTH 57 - #define HRT_DATA_WIDTH 32 58 - #endif 59 - #ifndef HRT_ADDRESS_WIDTH 60 - #define HRT_ADDRESS_WIDTH 32 61 - #endif 62 - 55 + #define HRT_DATA_WIDTH 32 56 + #define HRT_ADDRESS_WIDTH 64 63 57 #define HRT_DATA_BYTES (HRT_DATA_WIDTH / 8) 64 58 #define HRT_ADDRESS_BYTES (HRT_ADDRESS_WIDTH / 8) 59 + #define SIZEOF_HRT_REG (HRT_DATA_WIDTH >> 3) 65 60 66 - #if HRT_DATA_WIDTH == 64 67 - typedef hive_uint64 hrt_data; 68 - #elif HRT_DATA_WIDTH == 32 69 61 typedef hive_uint32 hrt_data; 70 - #else 71 - #error data width not supported 72 - #endif 73 - 74 - #if HRT_ADDRESS_WIDTH == 64 75 62 typedef hive_uint64 hrt_address; 76 - #elif HRT_ADDRESS_WIDTH == 32 77 - typedef hive_uint32 hrt_address; 78 - #else 79 - #error adddres width not supported 80 - #endif 81 63 82 64 /* use 64 bit addresses in simulation, where possible */ 83 65 typedef hive_uint64 hive_sim_address;
+5 -5
drivers/staging/media/atomisp/pci/hmm/hmm.c
··· 735 735 736 736 void hmm_show_mem_stat(const char *func, const int line) 737 737 { 738 - trace_printk("tol_cnt=%d usr_size=%d res_size=%d res_cnt=%d sys_size=%d dyc_thr=%d dyc_size=%d.\n", 739 - hmm_mem_stat.tol_cnt, 740 - hmm_mem_stat.usr_size, hmm_mem_stat.res_size, 741 - hmm_mem_stat.res_cnt, hmm_mem_stat.sys_size, 742 - hmm_mem_stat.dyc_thr, hmm_mem_stat.dyc_size); 738 + pr_info("tol_cnt=%d usr_size=%d res_size=%d res_cnt=%d sys_size=%d dyc_thr=%d dyc_size=%d.\n", 739 + hmm_mem_stat.tol_cnt, 740 + hmm_mem_stat.usr_size, hmm_mem_stat.res_size, 741 + hmm_mem_stat.res_cnt, hmm_mem_stat.sys_size, 742 + hmm_mem_stat.dyc_thr, hmm_mem_stat.dyc_size); 743 743 } 744 744 745 745 void hmm_init_mem_stat(int res_pgnr, int dyc_en, int dyc_pgnr)
-302
drivers/staging/media/atomisp/pci/isp2400_system_global.h
··· 13 13 * more details. 14 14 */ 15 15 16 - #ifndef __SYSTEM_GLOBAL_H_INCLUDED__ 17 - #define __SYSTEM_GLOBAL_H_INCLUDED__ 18 - 19 - #include <hive_isp_css_defs.h> 20 - #include <type_support.h> 21 - 22 - /* 23 - * The longest allowed (uninteruptible) bus transfer, does not 24 - * take stalling into account 25 - */ 26 - #define HIVE_ISP_MAX_BURST_LENGTH 1024 27 - 28 - /* 29 - * Maximum allowed burst length in words for the ISP DMA 30 - */ 31 - #define ISP_DMA_MAX_BURST_LENGTH 128 32 - 33 - /* 34 - * Create a list of HAS and IS properties that defines the system 35 - * 36 - * The configuration assumes the following 37 - * - The system is hetereogeneous; Multiple cells and devices classes 38 - * - The cell and device instances are homogeneous, each device type 39 - * belongs to the same class 40 - * - Device instances supporting a subset of the class capabilities are 41 - * allowed 42 - * 43 - * We could manage different device classes through the enumerated 44 - * lists (C) or the use of classes (C++), but that is presently not 45 - * fully supported 46 - * 47 - * N.B. the 3 input formatters are of 2 different classess 48 - */ 49 - 50 16 #define USE_INPUT_SYSTEM_VERSION_2 51 - 52 - #define HAS_MMU_VERSION_2 53 - #define HAS_DMA_VERSION_2 54 - #define HAS_GDC_VERSION_2 55 - #define HAS_VAMEM_VERSION_2 56 - #define HAS_HMEM_VERSION_1 57 - #define HAS_BAMEM_VERSION_2 58 - #define HAS_IRQ_VERSION_2 59 - #define HAS_IRQ_MAP_VERSION_2 60 - #define HAS_INPUT_FORMATTER_VERSION_2 61 - /* 2401: HAS_INPUT_SYSTEM_VERSION_2401 */ 62 - #define HAS_INPUT_SYSTEM_VERSION_2 63 - #define HAS_BUFFERED_SENSOR 64 - #define HAS_FIFO_MONITORS_VERSION_2 65 - /* #define HAS_GP_REGS_VERSION_2 */ 66 - #define HAS_GP_DEVICE_VERSION_2 67 - #define HAS_GPIO_VERSION_1 68 - #define HAS_TIMED_CTRL_VERSION_1 69 - #define HAS_RX_VERSION_2 70 - 71 - #define DMA_DDR_TO_VAMEM_WORKAROUND 72 - #define DMA_DDR_TO_HMEM_WORKAROUND 73 - 74 - /* 75 - * Semi global. "HRT" is accessible from SP, but the HRT types do not fully apply 76 - */ 77 - #define HRT_VADDRESS_WIDTH 32 78 - //#define HRT_ADDRESS_WIDTH 64 /* Surprise, this is a local property*/ 79 - #define HRT_DATA_WIDTH 32 80 - 81 - #define SIZEOF_HRT_REG (HRT_DATA_WIDTH >> 3) 82 - #define HIVE_ISP_CTRL_DATA_BYTES (HIVE_ISP_CTRL_DATA_WIDTH / 8) 83 - 84 - /* The main bus connecting all devices */ 85 - #define HRT_BUS_WIDTH HIVE_ISP_CTRL_DATA_WIDTH 86 - #define HRT_BUS_BYTES HIVE_ISP_CTRL_DATA_BYTES 87 - 88 - /* per-frame parameter handling support */ 89 - #define SH_CSS_ENABLE_PER_FRAME_PARAMS 90 - 91 - typedef u32 hrt_bus_align_t; 92 - 93 - /* 94 - * Enumerate the devices, device access through the API is by ID, through the DLI by address 95 - * The enumerator terminators are used to size the wiring arrays and as an exception value. 96 - */ 97 - typedef enum { 98 - DDR0_ID = 0, 99 - N_DDR_ID 100 - } ddr_ID_t; 101 - 102 - typedef enum { 103 - ISP0_ID = 0, 104 - N_ISP_ID 105 - } isp_ID_t; 106 - 107 - typedef enum { 108 - SP0_ID = 0, 109 - N_SP_ID 110 - } sp_ID_t; 111 - 112 - typedef enum { 113 - MMU0_ID = 0, 114 - MMU1_ID, 115 - N_MMU_ID 116 - } mmu_ID_t; 117 - 118 - typedef enum { 119 - DMA0_ID = 0, 120 - N_DMA_ID 121 - } dma_ID_t; 122 - 123 - typedef enum { 124 - GDC0_ID = 0, 125 - GDC1_ID, 126 - N_GDC_ID 127 - } gdc_ID_t; 128 - 129 - #define N_GDC_ID_CPP 2 // this extra define is needed because we want to use it also in the preprocessor, and that doesn't work with enums. 130 - 131 - typedef enum { 132 - VAMEM0_ID = 0, 133 - VAMEM1_ID, 134 - VAMEM2_ID, 135 - N_VAMEM_ID 136 - } vamem_ID_t; 137 - 138 - typedef enum { 139 - BAMEM0_ID = 0, 140 - N_BAMEM_ID 141 - } bamem_ID_t; 142 - 143 - typedef enum { 144 - HMEM0_ID = 0, 145 - N_HMEM_ID 146 - } hmem_ID_t; 147 - 148 - /* 149 - typedef enum { 150 - IRQ0_ID = 0, 151 - N_IRQ_ID 152 - } irq_ID_t; 153 - */ 154 - 155 - typedef enum { 156 - IRQ0_ID = 0, // GP IRQ block 157 - IRQ1_ID, // Input formatter 158 - IRQ2_ID, // input system 159 - IRQ3_ID, // input selector 160 - N_IRQ_ID 161 - } irq_ID_t; 162 - 163 - typedef enum { 164 - FIFO_MONITOR0_ID = 0, 165 - N_FIFO_MONITOR_ID 166 - } fifo_monitor_ID_t; 167 - 168 - /* 169 - * Deprecated: Since all gp_reg instances are different 170 - * and put in the address maps of other devices we cannot 171 - * enumerate them as that assumes the instrances are the 172 - * same. 173 - * 174 - * We define a single GP_DEVICE containing all gp_regs 175 - * w.r.t. a single base address 176 - * 177 - typedef enum { 178 - GP_REGS0_ID = 0, 179 - N_GP_REGS_ID 180 - } gp_regs_ID_t; 181 - */ 182 - typedef enum { 183 - GP_DEVICE0_ID = 0, 184 - N_GP_DEVICE_ID 185 - } gp_device_ID_t; 186 - 187 - typedef enum { 188 - GP_TIMER0_ID = 0, 189 - GP_TIMER1_ID, 190 - GP_TIMER2_ID, 191 - GP_TIMER3_ID, 192 - GP_TIMER4_ID, 193 - GP_TIMER5_ID, 194 - GP_TIMER6_ID, 195 - GP_TIMER7_ID, 196 - N_GP_TIMER_ID 197 - } gp_timer_ID_t; 198 - 199 - typedef enum { 200 - GPIO0_ID = 0, 201 - N_GPIO_ID 202 - } gpio_ID_t; 203 - 204 - typedef enum { 205 - TIMED_CTRL0_ID = 0, 206 - N_TIMED_CTRL_ID 207 - } timed_ctrl_ID_t; 208 - 209 - typedef enum { 210 - INPUT_FORMATTER0_ID = 0, 211 - INPUT_FORMATTER1_ID, 212 - INPUT_FORMATTER2_ID, 213 - INPUT_FORMATTER3_ID, 214 - N_INPUT_FORMATTER_ID 215 - } input_formatter_ID_t; 216 - 217 - /* The IF RST is outside the IF */ 218 - #define INPUT_FORMATTER0_SRST_OFFSET 0x0824 219 - #define INPUT_FORMATTER1_SRST_OFFSET 0x0624 220 - #define INPUT_FORMATTER2_SRST_OFFSET 0x0424 221 - #define INPUT_FORMATTER3_SRST_OFFSET 0x0224 222 - 223 - #define INPUT_FORMATTER0_SRST_MASK 0x0001 224 - #define INPUT_FORMATTER1_SRST_MASK 0x0002 225 - #define INPUT_FORMATTER2_SRST_MASK 0x0004 226 - #define INPUT_FORMATTER3_SRST_MASK 0x0008 227 - 228 - typedef enum { 229 - INPUT_SYSTEM0_ID = 0, 230 - N_INPUT_SYSTEM_ID 231 - } input_system_ID_t; 232 - 233 - typedef enum { 234 - RX0_ID = 0, 235 - N_RX_ID 236 - } rx_ID_t; 237 - 238 - enum mipi_port_id { 239 - MIPI_PORT0_ID = 0, 240 - MIPI_PORT1_ID, 241 - MIPI_PORT2_ID, 242 - N_MIPI_PORT_ID 243 - }; 244 - 245 - #define N_RX_CHANNEL_ID 4 246 - 247 - /* Generic port enumeration with an internal port type ID */ 248 - typedef enum { 249 - CSI_PORT0_ID = 0, 250 - CSI_PORT1_ID, 251 - CSI_PORT2_ID, 252 - TPG_PORT0_ID, 253 - PRBS_PORT0_ID, 254 - FIFO_PORT0_ID, 255 - MEMORY_PORT0_ID, 256 - N_INPUT_PORT_ID 257 - } input_port_ID_t; 258 - 259 - typedef enum { 260 - CAPTURE_UNIT0_ID = 0, 261 - CAPTURE_UNIT1_ID, 262 - CAPTURE_UNIT2_ID, 263 - ACQUISITION_UNIT0_ID, 264 - DMA_UNIT0_ID, 265 - CTRL_UNIT0_ID, 266 - GPREGS_UNIT0_ID, 267 - FIFO_UNIT0_ID, 268 - IRQ_UNIT0_ID, 269 - N_SUB_SYSTEM_ID 270 - } sub_system_ID_t; 271 - 272 - #define N_CAPTURE_UNIT_ID 3 273 - #define N_ACQUISITION_UNIT_ID 1 274 - #define N_CTRL_UNIT_ID 1 275 - 276 - enum ia_css_isp_memories { 277 - IA_CSS_ISP_PMEM0 = 0, 278 - IA_CSS_ISP_DMEM0, 279 - IA_CSS_ISP_VMEM0, 280 - IA_CSS_ISP_VAMEM0, 281 - IA_CSS_ISP_VAMEM1, 282 - IA_CSS_ISP_VAMEM2, 283 - IA_CSS_ISP_HMEM0, 284 - IA_CSS_SP_DMEM0, 285 - IA_CSS_DDR, 286 - N_IA_CSS_MEMORIES 287 - }; 288 - 289 - #define IA_CSS_NUM_MEMORIES 9 290 - /* For driver compatibility */ 291 - #define N_IA_CSS_ISP_MEMORIES IA_CSS_NUM_MEMORIES 292 - #define IA_CSS_NUM_ISP_MEMORIES IA_CSS_NUM_MEMORIES 293 - 294 - #if 0 295 - typedef enum { 296 - dev_chn, /* device channels, external resource */ 297 - ext_mem, /* external memories */ 298 - int_mem, /* internal memories */ 299 - int_chn /* internal channels, user defined */ 300 - } resource_type_t; 301 - 302 - /* if this enum is extended with other memory resources, pls also extend the function resource_to_memptr() */ 303 - typedef enum { 304 - vied_nci_dev_chn_dma_ext0, 305 - int_mem_vmem0, 306 - int_mem_dmem0 307 - } resource_id_t; 308 - 309 - /* enum listing the different memories within a program group. 310 - This enum is used in the mem_ptr_t type */ 311 - typedef enum { 312 - buf_mem_invalid = 0, 313 - buf_mem_vmem_prog0, 314 - buf_mem_dmem_prog0 315 - } buf_mem_t; 316 - 317 - #endif 318 - #endif /* __SYSTEM_GLOBAL_H_INCLUDED__ */
-321
drivers/staging/media/atomisp/pci/isp2400_system_local.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Support for Intel Camera Imaging ISP subsystem. 4 - * Copyright (c) 2010-2015, Intel Corporation. 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms and conditions of the GNU General Public License, 8 - * version 2, as published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope it will be useful, but WITHOUT 11 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 - * more details. 14 - */ 15 - 16 - #ifndef __SYSTEM_LOCAL_H_INCLUDED__ 17 - #define __SYSTEM_LOCAL_H_INCLUDED__ 18 - 19 - #ifdef HRT_ISP_CSS_CUSTOM_HOST 20 - #ifndef HRT_USE_VIR_ADDRS 21 - #define HRT_USE_VIR_ADDRS 22 - #endif 23 - #endif 24 - 25 - #include "system_global.h" 26 - 27 - /* HRT assumes 32 by default (see Linux/include/hive_types.h), overrule it in case it is different */ 28 - #undef HRT_ADDRESS_WIDTH 29 - #define HRT_ADDRESS_WIDTH 64 /* Surprise, this is a local property */ 30 - 31 - /* This interface is deprecated */ 32 - #include "hive_types.h" 33 - 34 - /* 35 - * Cell specific address maps 36 - */ 37 - #if HRT_ADDRESS_WIDTH == 64 38 - 39 - #define GP_FIFO_BASE ((hrt_address)0x0000000000090104) /* This is NOT a base address */ 40 - 41 - /* DDR */ 42 - static const hrt_address DDR_BASE[N_DDR_ID] = { 43 - (hrt_address)0x0000000120000000ULL 44 - }; 45 - 46 - /* ISP */ 47 - static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = { 48 - (hrt_address)0x0000000000020000ULL 49 - }; 50 - 51 - static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = { 52 - (hrt_address)0x0000000000200000ULL 53 - }; 54 - 55 - static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = { 56 - (hrt_address)0x0000000000100000ULL 57 - }; 58 - 59 - static const hrt_address ISP_VAMEM_BASE[N_VAMEM_ID] = { 60 - (hrt_address)0x00000000001C0000ULL, 61 - (hrt_address)0x00000000001D0000ULL, 62 - (hrt_address)0x00000000001E0000ULL 63 - }; 64 - 65 - static const hrt_address ISP_HMEM_BASE[N_HMEM_ID] = { 66 - (hrt_address)0x00000000001F0000ULL 67 - }; 68 - 69 - /* SP */ 70 - static const hrt_address SP_CTRL_BASE[N_SP_ID] = { 71 - (hrt_address)0x0000000000010000ULL 72 - }; 73 - 74 - static const hrt_address SP_DMEM_BASE[N_SP_ID] = { 75 - (hrt_address)0x0000000000300000ULL 76 - }; 77 - 78 - static const hrt_address SP_PMEM_BASE[N_SP_ID] = { 79 - (hrt_address)0x00000000000B0000ULL 80 - }; 81 - 82 - /* MMU */ 83 - /* 84 - * MMU0_ID: The data MMU 85 - * MMU1_ID: The icache MMU 86 - */ 87 - static const hrt_address MMU_BASE[N_MMU_ID] = { 88 - (hrt_address)0x0000000000070000ULL, 89 - (hrt_address)0x00000000000A0000ULL 90 - }; 91 - 92 - /* DMA */ 93 - static const hrt_address DMA_BASE[N_DMA_ID] = { 94 - (hrt_address)0x0000000000040000ULL 95 - }; 96 - 97 - /* IRQ */ 98 - static const hrt_address IRQ_BASE[N_IRQ_ID] = { 99 - (hrt_address)0x0000000000000500ULL, 100 - (hrt_address)0x0000000000030A00ULL, 101 - (hrt_address)0x000000000008C000ULL, 102 - (hrt_address)0x0000000000090200ULL 103 - }; 104 - 105 - /* 106 - (hrt_address)0x0000000000000500ULL}; 107 - */ 108 - 109 - /* GDC */ 110 - static const hrt_address GDC_BASE[N_GDC_ID] = { 111 - (hrt_address)0x0000000000050000ULL, 112 - (hrt_address)0x0000000000060000ULL 113 - }; 114 - 115 - /* FIFO_MONITOR (not a subset of GP_DEVICE) */ 116 - static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = { 117 - (hrt_address)0x0000000000000000ULL 118 - }; 119 - 120 - /* 121 - static const hrt_address GP_REGS_BASE[N_GP_REGS_ID] = { 122 - (hrt_address)0x0000000000000000ULL}; 123 - 124 - static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = { 125 - (hrt_address)0x0000000000090000ULL}; 126 - */ 127 - 128 - /* GP_DEVICE (single base for all separate GP_REG instances) */ 129 - static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = { 130 - (hrt_address)0x0000000000000000ULL 131 - }; 132 - 133 - /*GP TIMER , all timer registers are inter-twined, 134 - * so, having multiple base addresses for 135 - * different timers does not help*/ 136 - static const hrt_address GP_TIMER_BASE = 137 - (hrt_address)0x0000000000000600ULL; 138 - /* GPIO */ 139 - static const hrt_address GPIO_BASE[N_GPIO_ID] = { 140 - (hrt_address)0x0000000000000400ULL 141 - }; 142 - 143 - /* TIMED_CTRL */ 144 - static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = { 145 - (hrt_address)0x0000000000000100ULL 146 - }; 147 - 148 - /* INPUT_FORMATTER */ 149 - static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = { 150 - (hrt_address)0x0000000000030000ULL, 151 - (hrt_address)0x0000000000030200ULL, 152 - (hrt_address)0x0000000000030400ULL, 153 - (hrt_address)0x0000000000030600ULL 154 - }; /* memcpy() */ 155 - 156 - /* INPUT_SYSTEM */ 157 - static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = { 158 - (hrt_address)0x0000000000080000ULL 159 - }; 160 - 161 - /* (hrt_address)0x0000000000081000ULL, */ /* capture A */ 162 - /* (hrt_address)0x0000000000082000ULL, */ /* capture B */ 163 - /* (hrt_address)0x0000000000083000ULL, */ /* capture C */ 164 - /* (hrt_address)0x0000000000084000ULL, */ /* Acquisition */ 165 - /* (hrt_address)0x0000000000085000ULL, */ /* DMA */ 166 - /* (hrt_address)0x0000000000089000ULL, */ /* ctrl */ 167 - /* (hrt_address)0x000000000008A000ULL, */ /* GP regs */ 168 - /* (hrt_address)0x000000000008B000ULL, */ /* FIFO */ 169 - /* (hrt_address)0x000000000008C000ULL, */ /* IRQ */ 170 - 171 - /* RX, the MIPI lane control regs start at offset 0 */ 172 - static const hrt_address RX_BASE[N_RX_ID] = { 173 - (hrt_address)0x0000000000080100ULL 174 - }; 175 - 176 - #elif HRT_ADDRESS_WIDTH == 32 177 - 178 - #define GP_FIFO_BASE ((hrt_address)0x00090104) /* This is NOT a base address */ 179 - 180 - /* DDR : Attention, this value not defined in 32-bit */ 181 - static const hrt_address DDR_BASE[N_DDR_ID] = { 182 - (hrt_address)0x00000000UL 183 - }; 184 - 185 - /* ISP */ 186 - static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = { 187 - (hrt_address)0x00020000UL 188 - }; 189 - 190 - static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = { 191 - (hrt_address)0x00200000UL 192 - }; 193 - 194 - static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = { 195 - (hrt_address)0x100000UL 196 - }; 197 - 198 - static const hrt_address ISP_VAMEM_BASE[N_VAMEM_ID] = { 199 - (hrt_address)0xffffffffUL, 200 - (hrt_address)0xffffffffUL, 201 - (hrt_address)0xffffffffUL 202 - }; 203 - 204 - static const hrt_address ISP_HMEM_BASE[N_HMEM_ID] = { 205 - (hrt_address)0xffffffffUL 206 - }; 207 - 208 - /* SP */ 209 - static const hrt_address SP_CTRL_BASE[N_SP_ID] = { 210 - (hrt_address)0x00010000UL 211 - }; 212 - 213 - static const hrt_address SP_DMEM_BASE[N_SP_ID] = { 214 - (hrt_address)0x00300000UL 215 - }; 216 - 217 - static const hrt_address SP_PMEM_BASE[N_SP_ID] = { 218 - (hrt_address)0x000B0000UL 219 - }; 220 - 221 - /* MMU */ 222 - /* 223 - * MMU0_ID: The data MMU 224 - * MMU1_ID: The icache MMU 225 - */ 226 - static const hrt_address MMU_BASE[N_MMU_ID] = { 227 - (hrt_address)0x00070000UL, 228 - (hrt_address)0x000A0000UL 229 - }; 230 - 231 - /* DMA */ 232 - static const hrt_address DMA_BASE[N_DMA_ID] = { 233 - (hrt_address)0x00040000UL 234 - }; 235 - 236 - /* IRQ */ 237 - static const hrt_address IRQ_BASE[N_IRQ_ID] = { 238 - (hrt_address)0x00000500UL, 239 - (hrt_address)0x00030A00UL, 240 - (hrt_address)0x0008C000UL, 241 - (hrt_address)0x00090200UL 242 - }; 243 - 244 - /* 245 - (hrt_address)0x00000500UL}; 246 - */ 247 - 248 - /* GDC */ 249 - static const hrt_address GDC_BASE[N_GDC_ID] = { 250 - (hrt_address)0x00050000UL, 251 - (hrt_address)0x00060000UL 252 - }; 253 - 254 - /* FIFO_MONITOR (not a subset of GP_DEVICE) */ 255 - static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = { 256 - (hrt_address)0x00000000UL 257 - }; 258 - 259 - /* 260 - static const hrt_address GP_REGS_BASE[N_GP_REGS_ID] = { 261 - (hrt_address)0x00000000UL}; 262 - 263 - static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = { 264 - (hrt_address)0x00090000UL}; 265 - */ 266 - 267 - /* GP_DEVICE (single base for all separate GP_REG instances) */ 268 - static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = { 269 - (hrt_address)0x00000000UL 270 - }; 271 - 272 - /*GP TIMER , all timer registers are inter-twined, 273 - * so, having multiple base addresses for 274 - * different timers does not help*/ 275 - static const hrt_address GP_TIMER_BASE = 276 - (hrt_address)0x00000600UL; 277 - 278 - /* GPIO */ 279 - static const hrt_address GPIO_BASE[N_GPIO_ID] = { 280 - (hrt_address)0x00000400UL 281 - }; 282 - 283 - /* TIMED_CTRL */ 284 - static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = { 285 - (hrt_address)0x00000100UL 286 - }; 287 - 288 - /* INPUT_FORMATTER */ 289 - static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = { 290 - (hrt_address)0x00030000UL, 291 - (hrt_address)0x00030200UL, 292 - (hrt_address)0x00030400UL 293 - }; 294 - 295 - /* (hrt_address)0x00030600UL, */ /* memcpy() */ 296 - 297 - /* INPUT_SYSTEM */ 298 - static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = { 299 - (hrt_address)0x00080000UL 300 - }; 301 - 302 - /* (hrt_address)0x00081000UL, */ /* capture A */ 303 - /* (hrt_address)0x00082000UL, */ /* capture B */ 304 - /* (hrt_address)0x00083000UL, */ /* capture C */ 305 - /* (hrt_address)0x00084000UL, */ /* Acquisition */ 306 - /* (hrt_address)0x00085000UL, */ /* DMA */ 307 - /* (hrt_address)0x00089000UL, */ /* ctrl */ 308 - /* (hrt_address)0x0008A000UL, */ /* GP regs */ 309 - /* (hrt_address)0x0008B000UL, */ /* FIFO */ 310 - /* (hrt_address)0x0008C000UL, */ /* IRQ */ 311 - 312 - /* RX, the MIPI lane control regs start at offset 0 */ 313 - static const hrt_address RX_BASE[N_RX_ID] = { 314 - (hrt_address)0x00080100UL 315 - }; 316 - 317 - #else 318 - #error "system_local.h: HRT_ADDRESS_WIDTH must be one of {32,64}" 319 - #endif 320 - 321 - #endif /* __SYSTEM_LOCAL_H_INCLUDED__ */
+2 -410
drivers/staging/media/atomisp/pci/isp2401_system_global.h
··· 13 13 * more details. 14 14 */ 15 15 16 - #ifndef __SYSTEM_GLOBAL_H_INCLUDED__ 17 - #define __SYSTEM_GLOBAL_H_INCLUDED__ 18 - 19 - #include <hive_isp_css_defs.h> 20 - #include <type_support.h> 21 - 22 - /* 23 - * The longest allowed (uninteruptible) bus transfer, does not 24 - * take stalling into account 25 - */ 26 - #define HIVE_ISP_MAX_BURST_LENGTH 1024 27 - 28 - /* 29 - * Maximum allowed burst length in words for the ISP DMA 30 - * This value is set to 2 to prevent the ISP DMA from blocking 31 - * the bus for too long; as the input system can only buffer 32 - * 2 lines on Moorefield and Cherrytrail, the input system buffers 33 - * may overflow if blocked for too long (BZ 2726). 34 - */ 35 - #define ISP_DMA_MAX_BURST_LENGTH 2 36 - 37 - /* 38 - * Create a list of HAS and IS properties that defines the system 39 - * 40 - * The configuration assumes the following 41 - * - The system is hetereogeneous; Multiple cells and devices classes 42 - * - The cell and device instances are homogeneous, each device type 43 - * belongs to the same class 44 - * - Device instances supporting a subset of the class capabilities are 45 - * allowed 46 - * 47 - * We could manage different device classes through the enumerated 48 - * lists (C) or the use of classes (C++), but that is presently not 49 - * fully supported 50 - * 51 - * N.B. the 3 input formatters are of 2 different classess 52 - */ 53 - 54 - #define USE_INPUT_SYSTEM_VERSION_2401 55 - 56 - #define HAS_MMU_VERSION_2 57 - #define HAS_DMA_VERSION_2 58 - #define HAS_GDC_VERSION_2 59 - #define HAS_VAMEM_VERSION_2 60 - #define HAS_HMEM_VERSION_1 61 - #define HAS_BAMEM_VERSION_2 62 - #define HAS_IRQ_VERSION_2 63 - #define HAS_IRQ_MAP_VERSION_2 64 - #define HAS_INPUT_FORMATTER_VERSION_2 65 - /* 2401: HAS_INPUT_SYSTEM_VERSION_3 */ 66 - /* 2400: HAS_INPUT_SYSTEM_VERSION_2 */ 67 - #define HAS_INPUT_SYSTEM_VERSION_2 68 - #define HAS_INPUT_SYSTEM_VERSION_2401 69 - #define HAS_BUFFERED_SENSOR 70 - #define HAS_FIFO_MONITORS_VERSION_2 71 - /* #define HAS_GP_REGS_VERSION_2 */ 72 - #define HAS_GP_DEVICE_VERSION_2 73 - #define HAS_GPIO_VERSION_1 74 - #define HAS_TIMED_CTRL_VERSION_1 75 - #define HAS_RX_VERSION_2 76 16 #define HAS_NO_INPUT_FORMATTER 77 - /*#define HAS_NO_PACKED_RAW_PIXELS*/ 78 - /*#define HAS_NO_DVS_6AXIS_CONFIG_UPDATE*/ 79 - 80 - #define DMA_DDR_TO_VAMEM_WORKAROUND 81 - #define DMA_DDR_TO_HMEM_WORKAROUND 82 - 83 - /* 84 - * Semi global. "HRT" is accessible from SP, but 85 - * the HRT types do not fully apply 86 - */ 87 - #define HRT_VADDRESS_WIDTH 32 88 - /* Surprise, this is a local property*/ 89 - /*#define HRT_ADDRESS_WIDTH 64 */ 90 - #define HRT_DATA_WIDTH 32 91 - 92 - #define SIZEOF_HRT_REG (HRT_DATA_WIDTH >> 3) 93 - #define HIVE_ISP_CTRL_DATA_BYTES (HIVE_ISP_CTRL_DATA_WIDTH / 8) 94 - 95 - /* The main bus connecting all devices */ 96 - #define HRT_BUS_WIDTH HIVE_ISP_CTRL_DATA_WIDTH 97 - #define HRT_BUS_BYTES HIVE_ISP_CTRL_DATA_BYTES 98 - 17 + #define USE_INPUT_SYSTEM_VERSION_2401 18 + #define HAS_INPUT_SYSTEM_VERSION_2401 99 19 #define CSI2P_DISABLE_ISYS2401_ONLINE_MODE 100 - 101 - /* per-frame parameter handling support */ 102 - #define SH_CSS_ENABLE_PER_FRAME_PARAMS 103 - 104 - typedef u32 hrt_bus_align_t; 105 - 106 - /* 107 - * Enumerate the devices, device access through the API is by ID, 108 - * through the DLI by address. The enumerator terminators are used 109 - * to size the wiring arrays and as an exception value. 110 - */ 111 - typedef enum { 112 - DDR0_ID = 0, 113 - N_DDR_ID 114 - } ddr_ID_t; 115 - 116 - typedef enum { 117 - ISP0_ID = 0, 118 - N_ISP_ID 119 - } isp_ID_t; 120 - 121 - typedef enum { 122 - SP0_ID = 0, 123 - N_SP_ID 124 - } sp_ID_t; 125 - 126 - typedef enum { 127 - MMU0_ID = 0, 128 - MMU1_ID, 129 - N_MMU_ID 130 - } mmu_ID_t; 131 - 132 - typedef enum { 133 - DMA0_ID = 0, 134 - N_DMA_ID 135 - } dma_ID_t; 136 - 137 - typedef enum { 138 - GDC0_ID = 0, 139 - GDC1_ID, 140 - N_GDC_ID 141 - } gdc_ID_t; 142 - 143 - /* this extra define is needed because we want to use it also 144 - in the preprocessor, and that doesn't work with enums. 145 - */ 146 - #define N_GDC_ID_CPP 2 147 - 148 - typedef enum { 149 - VAMEM0_ID = 0, 150 - VAMEM1_ID, 151 - VAMEM2_ID, 152 - N_VAMEM_ID 153 - } vamem_ID_t; 154 - 155 - typedef enum { 156 - BAMEM0_ID = 0, 157 - N_BAMEM_ID 158 - } bamem_ID_t; 159 - 160 - typedef enum { 161 - HMEM0_ID = 0, 162 - N_HMEM_ID 163 - } hmem_ID_t; 164 - 165 - typedef enum { 166 - ISYS_IRQ0_ID = 0, /* port a */ 167 - ISYS_IRQ1_ID, /* port b */ 168 - ISYS_IRQ2_ID, /* port c */ 169 - N_ISYS_IRQ_ID 170 - } isys_irq_ID_t; 171 - 172 - typedef enum { 173 - IRQ0_ID = 0, /* GP IRQ block */ 174 - IRQ1_ID, /* Input formatter */ 175 - IRQ2_ID, /* input system */ 176 - IRQ3_ID, /* input selector */ 177 - N_IRQ_ID 178 - } irq_ID_t; 179 - 180 - typedef enum { 181 - FIFO_MONITOR0_ID = 0, 182 - N_FIFO_MONITOR_ID 183 - } fifo_monitor_ID_t; 184 - 185 - /* 186 - * Deprecated: Since all gp_reg instances are different 187 - * and put in the address maps of other devices we cannot 188 - * enumerate them as that assumes the instrances are the 189 - * same. 190 - * 191 - * We define a single GP_DEVICE containing all gp_regs 192 - * w.r.t. a single base address 193 - * 194 - typedef enum { 195 - GP_REGS0_ID = 0, 196 - N_GP_REGS_ID 197 - } gp_regs_ID_t; 198 - */ 199 - typedef enum { 200 - GP_DEVICE0_ID = 0, 201 - N_GP_DEVICE_ID 202 - } gp_device_ID_t; 203 - 204 - typedef enum { 205 - GP_TIMER0_ID = 0, 206 - GP_TIMER1_ID, 207 - GP_TIMER2_ID, 208 - GP_TIMER3_ID, 209 - GP_TIMER4_ID, 210 - GP_TIMER5_ID, 211 - GP_TIMER6_ID, 212 - GP_TIMER7_ID, 213 - N_GP_TIMER_ID 214 - } gp_timer_ID_t; 215 - 216 - typedef enum { 217 - GPIO0_ID = 0, 218 - N_GPIO_ID 219 - } gpio_ID_t; 220 - 221 - typedef enum { 222 - TIMED_CTRL0_ID = 0, 223 - N_TIMED_CTRL_ID 224 - } timed_ctrl_ID_t; 225 - 226 - typedef enum { 227 - INPUT_FORMATTER0_ID = 0, 228 - INPUT_FORMATTER1_ID, 229 - INPUT_FORMATTER2_ID, 230 - INPUT_FORMATTER3_ID, 231 - N_INPUT_FORMATTER_ID 232 - } input_formatter_ID_t; 233 - 234 - /* The IF RST is outside the IF */ 235 - #define INPUT_FORMATTER0_SRST_OFFSET 0x0824 236 - #define INPUT_FORMATTER1_SRST_OFFSET 0x0624 237 - #define INPUT_FORMATTER2_SRST_OFFSET 0x0424 238 - #define INPUT_FORMATTER3_SRST_OFFSET 0x0224 239 - 240 - #define INPUT_FORMATTER0_SRST_MASK 0x0001 241 - #define INPUT_FORMATTER1_SRST_MASK 0x0002 242 - #define INPUT_FORMATTER2_SRST_MASK 0x0004 243 - #define INPUT_FORMATTER3_SRST_MASK 0x0008 244 - 245 - typedef enum { 246 - INPUT_SYSTEM0_ID = 0, 247 - N_INPUT_SYSTEM_ID 248 - } input_system_ID_t; 249 - 250 - typedef enum { 251 - RX0_ID = 0, 252 - N_RX_ID 253 - } rx_ID_t; 254 - 255 - enum mipi_port_id { 256 - MIPI_PORT0_ID = 0, 257 - MIPI_PORT1_ID, 258 - MIPI_PORT2_ID, 259 - N_MIPI_PORT_ID 260 - }; 261 - 262 - #define N_RX_CHANNEL_ID 4 263 - 264 - /* Generic port enumeration with an internal port type ID */ 265 - typedef enum { 266 - CSI_PORT0_ID = 0, 267 - CSI_PORT1_ID, 268 - CSI_PORT2_ID, 269 - TPG_PORT0_ID, 270 - PRBS_PORT0_ID, 271 - FIFO_PORT0_ID, 272 - MEMORY_PORT0_ID, 273 - N_INPUT_PORT_ID 274 - } input_port_ID_t; 275 - 276 - typedef enum { 277 - CAPTURE_UNIT0_ID = 0, 278 - CAPTURE_UNIT1_ID, 279 - CAPTURE_UNIT2_ID, 280 - ACQUISITION_UNIT0_ID, 281 - DMA_UNIT0_ID, 282 - CTRL_UNIT0_ID, 283 - GPREGS_UNIT0_ID, 284 - FIFO_UNIT0_ID, 285 - IRQ_UNIT0_ID, 286 - N_SUB_SYSTEM_ID 287 - } sub_system_ID_t; 288 - 289 - #define N_CAPTURE_UNIT_ID 3 290 - #define N_ACQUISITION_UNIT_ID 1 291 - #define N_CTRL_UNIT_ID 1 292 - 293 - /* 294 - * Input-buffer Controller. 295 - */ 296 - typedef enum { 297 - IBUF_CTRL0_ID = 0, /* map to ISYS2401_IBUF_CNTRL_A */ 298 - IBUF_CTRL1_ID, /* map to ISYS2401_IBUF_CNTRL_B */ 299 - IBUF_CTRL2_ID, /* map ISYS2401_IBUF_CNTRL_C */ 300 - N_IBUF_CTRL_ID 301 - } ibuf_ctrl_ID_t; 302 - /* end of Input-buffer Controller */ 303 - 304 - /* 305 - * Stream2MMIO. 306 - */ 307 - typedef enum { 308 - STREAM2MMIO0_ID = 0, /* map to ISYS2401_S2M_A */ 309 - STREAM2MMIO1_ID, /* map to ISYS2401_S2M_B */ 310 - STREAM2MMIO2_ID, /* map to ISYS2401_S2M_C */ 311 - N_STREAM2MMIO_ID 312 - } stream2mmio_ID_t; 313 - 314 - typedef enum { 315 - /* 316 - * Stream2MMIO 0 has 8 SIDs that are indexed by 317 - * [STREAM2MMIO_SID0_ID...STREAM2MMIO_SID7_ID]. 318 - * 319 - * Stream2MMIO 1 has 4 SIDs that are indexed by 320 - * [STREAM2MMIO_SID0_ID...TREAM2MMIO_SID3_ID]. 321 - * 322 - * Stream2MMIO 2 has 4 SIDs that are indexed by 323 - * [STREAM2MMIO_SID0_ID...STREAM2MMIO_SID3_ID]. 324 - */ 325 - STREAM2MMIO_SID0_ID = 0, 326 - STREAM2MMIO_SID1_ID, 327 - STREAM2MMIO_SID2_ID, 328 - STREAM2MMIO_SID3_ID, 329 - STREAM2MMIO_SID4_ID, 330 - STREAM2MMIO_SID5_ID, 331 - STREAM2MMIO_SID6_ID, 332 - STREAM2MMIO_SID7_ID, 333 - N_STREAM2MMIO_SID_ID 334 - } stream2mmio_sid_ID_t; 335 - /* end of Stream2MMIO */ 336 - 337 - /** 338 - * Input System 2401: CSI-MIPI recevier. 339 - */ 340 - typedef enum { 341 - CSI_RX_BACKEND0_ID = 0, /* map to ISYS2401_MIPI_BE_A */ 342 - CSI_RX_BACKEND1_ID, /* map to ISYS2401_MIPI_BE_B */ 343 - CSI_RX_BACKEND2_ID, /* map to ISYS2401_MIPI_BE_C */ 344 - N_CSI_RX_BACKEND_ID 345 - } csi_rx_backend_ID_t; 346 - 347 - typedef enum { 348 - CSI_RX_FRONTEND0_ID = 0, /* map to ISYS2401_CSI_RX_A */ 349 - CSI_RX_FRONTEND1_ID, /* map to ISYS2401_CSI_RX_B */ 350 - CSI_RX_FRONTEND2_ID, /* map to ISYS2401_CSI_RX_C */ 351 - #define N_CSI_RX_FRONTEND_ID (CSI_RX_FRONTEND2_ID + 1) 352 - } csi_rx_frontend_ID_t; 353 - 354 - typedef enum { 355 - CSI_RX_DLANE0_ID = 0, /* map to DLANE0 in CSI RX */ 356 - CSI_RX_DLANE1_ID, /* map to DLANE1 in CSI RX */ 357 - CSI_RX_DLANE2_ID, /* map to DLANE2 in CSI RX */ 358 - CSI_RX_DLANE3_ID, /* map to DLANE3 in CSI RX */ 359 - N_CSI_RX_DLANE_ID 360 - } csi_rx_fe_dlane_ID_t; 361 - /* end of CSI-MIPI receiver */ 362 - 363 - typedef enum { 364 - ISYS2401_DMA0_ID = 0, 365 - N_ISYS2401_DMA_ID 366 - } isys2401_dma_ID_t; 367 - 368 - /** 369 - * Pixel-generator. ("system_global.h") 370 - */ 371 - typedef enum { 372 - PIXELGEN0_ID = 0, 373 - PIXELGEN1_ID, 374 - PIXELGEN2_ID, 375 - N_PIXELGEN_ID 376 - } pixelgen_ID_t; 377 - /* end of pixel-generator. ("system_global.h") */ 378 - 379 - typedef enum { 380 - INPUT_SYSTEM_CSI_PORT0_ID = 0, 381 - INPUT_SYSTEM_CSI_PORT1_ID, 382 - INPUT_SYSTEM_CSI_PORT2_ID, 383 - 384 - INPUT_SYSTEM_PIXELGEN_PORT0_ID, 385 - INPUT_SYSTEM_PIXELGEN_PORT1_ID, 386 - INPUT_SYSTEM_PIXELGEN_PORT2_ID, 387 - 388 - N_INPUT_SYSTEM_INPUT_PORT_ID 389 - } input_system_input_port_ID_t; 390 - 391 - #define N_INPUT_SYSTEM_CSI_PORT 3 392 - 393 - typedef enum { 394 - ISYS2401_DMA_CHANNEL_0 = 0, 395 - ISYS2401_DMA_CHANNEL_1, 396 - ISYS2401_DMA_CHANNEL_2, 397 - ISYS2401_DMA_CHANNEL_3, 398 - ISYS2401_DMA_CHANNEL_4, 399 - ISYS2401_DMA_CHANNEL_5, 400 - ISYS2401_DMA_CHANNEL_6, 401 - ISYS2401_DMA_CHANNEL_7, 402 - ISYS2401_DMA_CHANNEL_8, 403 - ISYS2401_DMA_CHANNEL_9, 404 - ISYS2401_DMA_CHANNEL_10, 405 - ISYS2401_DMA_CHANNEL_11, 406 - N_ISYS2401_DMA_CHANNEL 407 - } isys2401_dma_channel; 408 - 409 - enum ia_css_isp_memories { 410 - IA_CSS_ISP_PMEM0 = 0, 411 - IA_CSS_ISP_DMEM0, 412 - IA_CSS_ISP_VMEM0, 413 - IA_CSS_ISP_VAMEM0, 414 - IA_CSS_ISP_VAMEM1, 415 - IA_CSS_ISP_VAMEM2, 416 - IA_CSS_ISP_HMEM0, 417 - IA_CSS_SP_DMEM0, 418 - IA_CSS_DDR, 419 - N_IA_CSS_MEMORIES 420 - }; 421 - 422 - #define IA_CSS_NUM_MEMORIES 9 423 - /* For driver compatibility */ 424 - #define N_IA_CSS_ISP_MEMORIES IA_CSS_NUM_MEMORIES 425 - #define IA_CSS_NUM_ISP_MEMORIES IA_CSS_NUM_MEMORIES 426 - 427 - #endif /* __SYSTEM_GLOBAL_H_INCLUDED__ */
-402
drivers/staging/media/atomisp/pci/isp2401_system_local.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Support for Intel Camera Imaging ISP subsystem. 4 - * Copyright (c) 2015, Intel Corporation. 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms and conditions of the GNU General Public License, 8 - * version 2, as published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope it will be useful, but WITHOUT 11 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 - * more details. 14 - */ 15 - 16 - #ifndef __SYSTEM_LOCAL_H_INCLUDED__ 17 - #define __SYSTEM_LOCAL_H_INCLUDED__ 18 - 19 - #ifdef HRT_ISP_CSS_CUSTOM_HOST 20 - #ifndef HRT_USE_VIR_ADDRS 21 - #define HRT_USE_VIR_ADDRS 22 - #endif 23 - #endif 24 - 25 - #include "system_global.h" 26 - 27 - #define HRT_ADDRESS_WIDTH 64 /* Surprise, this is a local property */ 28 - 29 - /* This interface is deprecated */ 30 - #include "hive_types.h" 31 - 32 - /* 33 - * Cell specific address maps 34 - */ 35 - #if HRT_ADDRESS_WIDTH == 64 36 - 37 - #define GP_FIFO_BASE ((hrt_address)0x0000000000090104) /* This is NOT a base address */ 38 - 39 - /* DDR */ 40 - static const hrt_address DDR_BASE[N_DDR_ID] = { 41 - 0x0000000120000000ULL 42 - }; 43 - 44 - /* ISP */ 45 - static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = { 46 - 0x0000000000020000ULL 47 - }; 48 - 49 - static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = { 50 - 0x0000000000200000ULL 51 - }; 52 - 53 - static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = { 54 - 0x0000000000100000ULL 55 - }; 56 - 57 - static const hrt_address ISP_VAMEM_BASE[N_VAMEM_ID] = { 58 - 0x00000000001C0000ULL, 59 - 0x00000000001D0000ULL, 60 - 0x00000000001E0000ULL 61 - }; 62 - 63 - static const hrt_address ISP_HMEM_BASE[N_HMEM_ID] = { 64 - 0x00000000001F0000ULL 65 - }; 66 - 67 - /* SP */ 68 - static const hrt_address SP_CTRL_BASE[N_SP_ID] = { 69 - 0x0000000000010000ULL 70 - }; 71 - 72 - static const hrt_address SP_DMEM_BASE[N_SP_ID] = { 73 - 0x0000000000300000ULL 74 - }; 75 - 76 - /* MMU */ 77 - /* 78 - * MMU0_ID: The data MMU 79 - * MMU1_ID: The icache MMU 80 - */ 81 - static const hrt_address MMU_BASE[N_MMU_ID] = { 82 - 0x0000000000070000ULL, 83 - 0x00000000000A0000ULL 84 - }; 85 - 86 - /* DMA */ 87 - static const hrt_address DMA_BASE[N_DMA_ID] = { 88 - 0x0000000000040000ULL 89 - }; 90 - 91 - static const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = { 92 - 0x00000000000CA000ULL 93 - }; 94 - 95 - /* IRQ */ 96 - static const hrt_address IRQ_BASE[N_IRQ_ID] = { 97 - 0x0000000000000500ULL, 98 - 0x0000000000030A00ULL, 99 - 0x000000000008C000ULL, 100 - 0x0000000000090200ULL 101 - }; 102 - 103 - /* 104 - 0x0000000000000500ULL}; 105 - */ 106 - 107 - /* GDC */ 108 - static const hrt_address GDC_BASE[N_GDC_ID] = { 109 - 0x0000000000050000ULL, 110 - 0x0000000000060000ULL 111 - }; 112 - 113 - /* FIFO_MONITOR (not a subset of GP_DEVICE) */ 114 - static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = { 115 - 0x0000000000000000ULL 116 - }; 117 - 118 - /* 119 - static const hrt_address GP_REGS_BASE[N_GP_REGS_ID] = { 120 - 0x0000000000000000ULL}; 121 - 122 - static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = { 123 - 0x0000000000090000ULL}; 124 - */ 125 - 126 - /* GP_DEVICE (single base for all separate GP_REG instances) */ 127 - static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = { 128 - 0x0000000000000000ULL 129 - }; 130 - 131 - /*GP TIMER , all timer registers are inter-twined, 132 - * so, having multiple base addresses for 133 - * different timers does not help*/ 134 - static const hrt_address GP_TIMER_BASE = 135 - (hrt_address)0x0000000000000600ULL; 136 - 137 - /* GPIO */ 138 - static const hrt_address GPIO_BASE[N_GPIO_ID] = { 139 - 0x0000000000000400ULL 140 - }; 141 - 142 - /* TIMED_CTRL */ 143 - static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = { 144 - 0x0000000000000100ULL 145 - }; 146 - 147 - /* INPUT_FORMATTER */ 148 - static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = { 149 - 0x0000000000030000ULL, 150 - 0x0000000000030200ULL, 151 - 0x0000000000030400ULL, 152 - 0x0000000000030600ULL 153 - }; /* memcpy() */ 154 - 155 - /* INPUT_SYSTEM */ 156 - static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = { 157 - 0x0000000000080000ULL 158 - }; 159 - 160 - /* 0x0000000000081000ULL, */ /* capture A */ 161 - /* 0x0000000000082000ULL, */ /* capture B */ 162 - /* 0x0000000000083000ULL, */ /* capture C */ 163 - /* 0x0000000000084000ULL, */ /* Acquisition */ 164 - /* 0x0000000000085000ULL, */ /* DMA */ 165 - /* 0x0000000000089000ULL, */ /* ctrl */ 166 - /* 0x000000000008A000ULL, */ /* GP regs */ 167 - /* 0x000000000008B000ULL, */ /* FIFO */ 168 - /* 0x000000000008C000ULL, */ /* IRQ */ 169 - 170 - /* RX, the MIPI lane control regs start at offset 0 */ 171 - static const hrt_address RX_BASE[N_RX_ID] = { 172 - 0x0000000000080100ULL 173 - }; 174 - 175 - /* IBUF_CTRL, part of the Input System 2401 */ 176 - static const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = { 177 - 0x00000000000C1800ULL, /* ibuf controller A */ 178 - 0x00000000000C3800ULL, /* ibuf controller B */ 179 - 0x00000000000C5800ULL /* ibuf controller C */ 180 - }; 181 - 182 - /* ISYS IRQ Controllers, part of the Input System 2401 */ 183 - static const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = { 184 - 0x00000000000C1400ULL, /* port a */ 185 - 0x00000000000C3400ULL, /* port b */ 186 - 0x00000000000C5400ULL /* port c */ 187 - }; 188 - 189 - /* CSI FE, part of the Input System 2401 */ 190 - static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = { 191 - 0x00000000000C0400ULL, /* csi fe controller A */ 192 - 0x00000000000C2400ULL, /* csi fe controller B */ 193 - 0x00000000000C4400ULL /* csi fe controller C */ 194 - }; 195 - 196 - /* CSI BE, part of the Input System 2401 */ 197 - static const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = { 198 - 0x00000000000C0800ULL, /* csi be controller A */ 199 - 0x00000000000C2800ULL, /* csi be controller B */ 200 - 0x00000000000C4800ULL /* csi be controller C */ 201 - }; 202 - 203 - /* PIXEL Generator, part of the Input System 2401 */ 204 - static const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = { 205 - 0x00000000000C1000ULL, /* pixel gen controller A */ 206 - 0x00000000000C3000ULL, /* pixel gen controller B */ 207 - 0x00000000000C5000ULL /* pixel gen controller C */ 208 - }; 209 - 210 - /* Stream2MMIO, part of the Input System 2401 */ 211 - static const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = { 212 - 0x00000000000C0C00ULL, /* stream2mmio controller A */ 213 - 0x00000000000C2C00ULL, /* stream2mmio controller B */ 214 - 0x00000000000C4C00ULL /* stream2mmio controller C */ 215 - }; 216 - #elif HRT_ADDRESS_WIDTH == 32 217 - 218 - #define GP_FIFO_BASE ((hrt_address)0x00090104) /* This is NOT a base address */ 219 - 220 - /* DDR : Attention, this value not defined in 32-bit */ 221 - static const hrt_address DDR_BASE[N_DDR_ID] = { 222 - 0x00000000UL 223 - }; 224 - 225 - /* ISP */ 226 - static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = { 227 - 0x00020000UL 228 - }; 229 - 230 - static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = { 231 - 0xffffffffUL 232 - }; 233 - 234 - static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = { 235 - 0xffffffffUL 236 - }; 237 - 238 - static const hrt_address ISP_VAMEM_BASE[N_VAMEM_ID] = { 239 - 0xffffffffUL, 240 - 0xffffffffUL, 241 - 0xffffffffUL 242 - }; 243 - 244 - static const hrt_address ISP_HMEM_BASE[N_HMEM_ID] = { 245 - 0xffffffffUL 246 - }; 247 - 248 - /* SP */ 249 - static const hrt_address SP_CTRL_BASE[N_SP_ID] = { 250 - 0x00010000UL 251 - }; 252 - 253 - static const hrt_address SP_DMEM_BASE[N_SP_ID] = { 254 - 0x00300000UL 255 - }; 256 - 257 - /* MMU */ 258 - /* 259 - * MMU0_ID: The data MMU 260 - * MMU1_ID: The icache MMU 261 - */ 262 - static const hrt_address MMU_BASE[N_MMU_ID] = { 263 - 0x00070000UL, 264 - 0x000A0000UL 265 - }; 266 - 267 - /* DMA */ 268 - static const hrt_address DMA_BASE[N_DMA_ID] = { 269 - 0x00040000UL 270 - }; 271 - 272 - static const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = { 273 - 0x000CA000UL 274 - }; 275 - 276 - /* IRQ */ 277 - static const hrt_address IRQ_BASE[N_IRQ_ID] = { 278 - 0x00000500UL, 279 - 0x00030A00UL, 280 - 0x0008C000UL, 281 - 0x00090200UL 282 - }; 283 - 284 - /* 285 - 0x00000500UL}; 286 - */ 287 - 288 - /* GDC */ 289 - static const hrt_address GDC_BASE[N_GDC_ID] = { 290 - 0x00050000UL, 291 - 0x00060000UL 292 - }; 293 - 294 - /* FIFO_MONITOR (not a subset of GP_DEVICE) */ 295 - static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = { 296 - 0x00000000UL 297 - }; 298 - 299 - /* 300 - static const hrt_address GP_REGS_BASE[N_GP_REGS_ID] = { 301 - 0x00000000UL}; 302 - 303 - static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = { 304 - 0x00090000UL}; 305 - */ 306 - 307 - /* GP_DEVICE (single base for all separate GP_REG instances) */ 308 - static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = { 309 - 0x00000000UL 310 - }; 311 - 312 - /*GP TIMER , all timer registers are inter-twined, 313 - * so, having multiple base addresses for 314 - * different timers does not help*/ 315 - static const hrt_address GP_TIMER_BASE = 316 - (hrt_address)0x00000600UL; 317 - /* GPIO */ 318 - static const hrt_address GPIO_BASE[N_GPIO_ID] = { 319 - 0x00000400UL 320 - }; 321 - 322 - /* TIMED_CTRL */ 323 - static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = { 324 - 0x00000100UL 325 - }; 326 - 327 - /* INPUT_FORMATTER */ 328 - static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = { 329 - 0x00030000UL, 330 - 0x00030200UL, 331 - 0x00030400UL 332 - }; 333 - 334 - /* 0x00030600UL, */ /* memcpy() */ 335 - 336 - /* INPUT_SYSTEM */ 337 - static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = { 338 - 0x00080000UL 339 - }; 340 - 341 - /* 0x00081000UL, */ /* capture A */ 342 - /* 0x00082000UL, */ /* capture B */ 343 - /* 0x00083000UL, */ /* capture C */ 344 - /* 0x00084000UL, */ /* Acquisition */ 345 - /* 0x00085000UL, */ /* DMA */ 346 - /* 0x00089000UL, */ /* ctrl */ 347 - /* 0x0008A000UL, */ /* GP regs */ 348 - /* 0x0008B000UL, */ /* FIFO */ 349 - /* 0x0008C000UL, */ /* IRQ */ 350 - 351 - /* RX, the MIPI lane control regs start at offset 0 */ 352 - static const hrt_address RX_BASE[N_RX_ID] = { 353 - 0x00080100UL 354 - }; 355 - 356 - /* IBUF_CTRL, part of the Input System 2401 */ 357 - static const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = { 358 - 0x000C1800UL, /* ibuf controller A */ 359 - 0x000C3800UL, /* ibuf controller B */ 360 - 0x000C5800UL /* ibuf controller C */ 361 - }; 362 - 363 - /* ISYS IRQ Controllers, part of the Input System 2401 */ 364 - static const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = { 365 - 0x000C1400ULL, /* port a */ 366 - 0x000C3400ULL, /* port b */ 367 - 0x000C5400ULL /* port c */ 368 - }; 369 - 370 - /* CSI FE, part of the Input System 2401 */ 371 - static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = { 372 - 0x000C0400UL, /* csi fe controller A */ 373 - 0x000C2400UL, /* csi fe controller B */ 374 - 0x000C4400UL /* csi fe controller C */ 375 - }; 376 - 377 - /* CSI BE, part of the Input System 2401 */ 378 - static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = { 379 - 0x000C0800UL, /* csi be controller A */ 380 - 0x000C2800UL, /* csi be controller B */ 381 - 0x000C4800UL /* csi be controller C */ 382 - }; 383 - 384 - /* PIXEL Generator, part of the Input System 2401 */ 385 - static const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = { 386 - 0x000C1000UL, /* pixel gen controller A */ 387 - 0x000C3000UL, /* pixel gen controller B */ 388 - 0x000C5000UL /* pixel gen controller C */ 389 - }; 390 - 391 - /* Stream2MMIO, part of the Input System 2401 */ 392 - static const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = { 393 - 0x000C0C00UL, /* stream2mmio controller A */ 394 - 0x000C2C00UL, /* stream2mmio controller B */ 395 - 0x000C4C00UL /* stream2mmio controller C */ 396 - }; 397 - 398 - #else 399 - #error "system_local.h: HRT_ADDRESS_WIDTH must be one of {32,64}" 400 - #endif 401 - 402 - #endif /* __SYSTEM_LOCAL_H_INCLUDED__ */
+7 -2
drivers/staging/media/atomisp/pci/sh_css.c
··· 1841 1841 #endif 1842 1842 1843 1843 #if !defined(HAS_NO_INPUT_SYSTEM) 1844 - dma_set_max_burst_size(DMA0_ID, HIVE_DMA_BUS_DDR_CONN, 1845 - ISP_DMA_MAX_BURST_LENGTH); 1844 + 1845 + if (!IS_ISP2401) 1846 + dma_set_max_burst_size(DMA0_ID, HIVE_DMA_BUS_DDR_CONN, 1847 + ISP2400_DMA_MAX_BURST_LENGTH); 1848 + else 1849 + dma_set_max_burst_size(DMA0_ID, HIVE_DMA_BUS_DDR_CONN, 1850 + ISP2401_DMA_MAX_BURST_LENGTH); 1846 1851 1847 1852 if (ia_css_isys_init() != INPUT_SYSTEM_ERR_NO_ERROR) 1848 1853 err = -EINVAL;
+395
drivers/staging/media/atomisp/pci/system_global.h
··· 4 4 * (c) 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> 5 5 */ 6 6 7 + #ifndef __SYSTEM_GLOBAL_H_INCLUDED__ 8 + #define __SYSTEM_GLOBAL_H_INCLUDED__ 9 + 10 + /* 11 + * Create a list of HAS and IS properties that defines the system 12 + * Those are common for both ISP2400 and ISP2401 13 + * 14 + * The configuration assumes the following 15 + * - The system is hetereogeneous; Multiple cells and devices classes 16 + * - The cell and device instances are homogeneous, each device type 17 + * belongs to the same class 18 + * - Device instances supporting a subset of the class capabilities are 19 + * allowed 20 + * 21 + * We could manage different device classes through the enumerated 22 + * lists (C) or the use of classes (C++), but that is presently not 23 + * fully supported 24 + * 25 + * N.B. the 3 input formatters are of 2 different classess 26 + */ 27 + 28 + #define HAS_MMU_VERSION_2 29 + #define HAS_DMA_VERSION_2 30 + #define HAS_GDC_VERSION_2 31 + #define HAS_VAMEM_VERSION_2 32 + #define HAS_HMEM_VERSION_1 33 + #define HAS_BAMEM_VERSION_2 34 + #define HAS_IRQ_VERSION_2 35 + #define HAS_IRQ_MAP_VERSION_2 36 + #define HAS_INPUT_FORMATTER_VERSION_2 37 + #define HAS_INPUT_SYSTEM_VERSION_2 38 + #define HAS_BUFFERED_SENSOR 39 + #define HAS_FIFO_MONITORS_VERSION_2 40 + #define HAS_GP_DEVICE_VERSION_2 41 + #define HAS_GPIO_VERSION_1 42 + #define HAS_TIMED_CTRL_VERSION_1 43 + #define HAS_RX_VERSION_2 44 + 45 + /* per-frame parameter handling support */ 46 + #define SH_CSS_ENABLE_PER_FRAME_PARAMS 47 + 48 + #define DMA_DDR_TO_VAMEM_WORKAROUND 49 + #define DMA_DDR_TO_HMEM_WORKAROUND 50 + 51 + /* 52 + * The longest allowed (uninteruptible) bus transfer, does not 53 + * take stalling into account 54 + */ 55 + #define HIVE_ISP_MAX_BURST_LENGTH 1024 56 + 57 + /* 58 + * Maximum allowed burst length in words for the ISP DMA 59 + * This value is set to 2 to prevent the ISP DMA from blocking 60 + * the bus for too long; as the input system can only buffer 61 + * 2 lines on Moorefield and Cherrytrail, the input system buffers 62 + * may overflow if blocked for too long (BZ 2726). 63 + */ 64 + #define ISP2400_DMA_MAX_BURST_LENGTH 128 65 + #define ISP2401_DMA_MAX_BURST_LENGTH 2 66 + 7 67 #ifdef ISP2401 8 68 # include "isp2401_system_global.h" 9 69 #else 10 70 # include "isp2400_system_global.h" 11 71 #endif 72 + 73 + #include <hive_isp_css_defs.h> 74 + #include <type_support.h> 75 + 76 + /* This interface is deprecated */ 77 + #include "hive_types.h" 78 + 79 + /* 80 + * Semi global. "HRT" is accessible from SP, but the HRT types do not fully apply 81 + */ 82 + #define HRT_VADDRESS_WIDTH 32 83 + 84 + #define SIZEOF_HRT_REG (HRT_DATA_WIDTH >> 3) 85 + #define HIVE_ISP_CTRL_DATA_BYTES (HIVE_ISP_CTRL_DATA_WIDTH / 8) 86 + 87 + /* The main bus connecting all devices */ 88 + #define HRT_BUS_WIDTH HIVE_ISP_CTRL_DATA_WIDTH 89 + #define HRT_BUS_BYTES HIVE_ISP_CTRL_DATA_BYTES 90 + 91 + typedef u32 hrt_bus_align_t; 92 + 93 + /* 94 + * Enumerate the devices, device access through the API is by ID, 95 + * through the DLI by address. The enumerator terminators are used 96 + * to size the wiring arrays and as an exception value. 97 + */ 98 + typedef enum { 99 + DDR0_ID = 0, 100 + N_DDR_ID 101 + } ddr_ID_t; 102 + 103 + typedef enum { 104 + ISP0_ID = 0, 105 + N_ISP_ID 106 + } isp_ID_t; 107 + 108 + typedef enum { 109 + SP0_ID = 0, 110 + N_SP_ID 111 + } sp_ID_t; 112 + 113 + typedef enum { 114 + MMU0_ID = 0, 115 + MMU1_ID, 116 + N_MMU_ID 117 + } mmu_ID_t; 118 + 119 + typedef enum { 120 + DMA0_ID = 0, 121 + N_DMA_ID 122 + } dma_ID_t; 123 + 124 + typedef enum { 125 + GDC0_ID = 0, 126 + GDC1_ID, 127 + N_GDC_ID 128 + } gdc_ID_t; 129 + 130 + /* this extra define is needed because we want to use it also 131 + in the preprocessor, and that doesn't work with enums. 132 + */ 133 + #define N_GDC_ID_CPP 2 134 + 135 + typedef enum { 136 + VAMEM0_ID = 0, 137 + VAMEM1_ID, 138 + VAMEM2_ID, 139 + N_VAMEM_ID 140 + } vamem_ID_t; 141 + 142 + typedef enum { 143 + BAMEM0_ID = 0, 144 + N_BAMEM_ID 145 + } bamem_ID_t; 146 + 147 + typedef enum { 148 + HMEM0_ID = 0, 149 + N_HMEM_ID 150 + } hmem_ID_t; 151 + 152 + typedef enum { 153 + IRQ0_ID = 0, /* GP IRQ block */ 154 + IRQ1_ID, /* Input formatter */ 155 + IRQ2_ID, /* input system */ 156 + IRQ3_ID, /* input selector */ 157 + N_IRQ_ID 158 + } irq_ID_t; 159 + 160 + typedef enum { 161 + FIFO_MONITOR0_ID = 0, 162 + N_FIFO_MONITOR_ID 163 + } fifo_monitor_ID_t; 164 + 165 + typedef enum { 166 + GP_DEVICE0_ID = 0, 167 + N_GP_DEVICE_ID 168 + } gp_device_ID_t; 169 + 170 + typedef enum { 171 + GP_TIMER0_ID = 0, 172 + GP_TIMER1_ID, 173 + GP_TIMER2_ID, 174 + GP_TIMER3_ID, 175 + GP_TIMER4_ID, 176 + GP_TIMER5_ID, 177 + GP_TIMER6_ID, 178 + GP_TIMER7_ID, 179 + N_GP_TIMER_ID 180 + } gp_timer_ID_t; 181 + 182 + typedef enum { 183 + GPIO0_ID = 0, 184 + N_GPIO_ID 185 + } gpio_ID_t; 186 + 187 + typedef enum { 188 + TIMED_CTRL0_ID = 0, 189 + N_TIMED_CTRL_ID 190 + } timed_ctrl_ID_t; 191 + 192 + typedef enum { 193 + INPUT_FORMATTER0_ID = 0, 194 + INPUT_FORMATTER1_ID, 195 + INPUT_FORMATTER2_ID, 196 + INPUT_FORMATTER3_ID, 197 + N_INPUT_FORMATTER_ID 198 + } input_formatter_ID_t; 199 + 200 + /* The IF RST is outside the IF */ 201 + #define INPUT_FORMATTER0_SRST_OFFSET 0x0824 202 + #define INPUT_FORMATTER1_SRST_OFFSET 0x0624 203 + #define INPUT_FORMATTER2_SRST_OFFSET 0x0424 204 + #define INPUT_FORMATTER3_SRST_OFFSET 0x0224 205 + 206 + #define INPUT_FORMATTER0_SRST_MASK 0x0001 207 + #define INPUT_FORMATTER1_SRST_MASK 0x0002 208 + #define INPUT_FORMATTER2_SRST_MASK 0x0004 209 + #define INPUT_FORMATTER3_SRST_MASK 0x0008 210 + 211 + typedef enum { 212 + INPUT_SYSTEM0_ID = 0, 213 + N_INPUT_SYSTEM_ID 214 + } input_system_ID_t; 215 + 216 + typedef enum { 217 + RX0_ID = 0, 218 + N_RX_ID 219 + } rx_ID_t; 220 + 221 + enum mipi_port_id { 222 + MIPI_PORT0_ID = 0, 223 + MIPI_PORT1_ID, 224 + MIPI_PORT2_ID, 225 + N_MIPI_PORT_ID 226 + }; 227 + 228 + #define N_RX_CHANNEL_ID 4 229 + 230 + /* Generic port enumeration with an internal port type ID */ 231 + typedef enum { 232 + CSI_PORT0_ID = 0, 233 + CSI_PORT1_ID, 234 + CSI_PORT2_ID, 235 + TPG_PORT0_ID, 236 + PRBS_PORT0_ID, 237 + FIFO_PORT0_ID, 238 + MEMORY_PORT0_ID, 239 + N_INPUT_PORT_ID 240 + } input_port_ID_t; 241 + 242 + typedef enum { 243 + CAPTURE_UNIT0_ID = 0, 244 + CAPTURE_UNIT1_ID, 245 + CAPTURE_UNIT2_ID, 246 + ACQUISITION_UNIT0_ID, 247 + DMA_UNIT0_ID, 248 + CTRL_UNIT0_ID, 249 + GPREGS_UNIT0_ID, 250 + FIFO_UNIT0_ID, 251 + IRQ_UNIT0_ID, 252 + N_SUB_SYSTEM_ID 253 + } sub_system_ID_t; 254 + 255 + #define N_CAPTURE_UNIT_ID 3 256 + #define N_ACQUISITION_UNIT_ID 1 257 + #define N_CTRL_UNIT_ID 1 258 + 259 + 260 + enum ia_css_isp_memories { 261 + IA_CSS_ISP_PMEM0 = 0, 262 + IA_CSS_ISP_DMEM0, 263 + IA_CSS_ISP_VMEM0, 264 + IA_CSS_ISP_VAMEM0, 265 + IA_CSS_ISP_VAMEM1, 266 + IA_CSS_ISP_VAMEM2, 267 + IA_CSS_ISP_HMEM0, 268 + IA_CSS_SP_DMEM0, 269 + IA_CSS_DDR, 270 + N_IA_CSS_MEMORIES 271 + }; 272 + 273 + #define IA_CSS_NUM_MEMORIES 9 274 + /* For driver compatibility */ 275 + #define N_IA_CSS_ISP_MEMORIES IA_CSS_NUM_MEMORIES 276 + #define IA_CSS_NUM_ISP_MEMORIES IA_CSS_NUM_MEMORIES 277 + 278 + /* 279 + * ISP2401 specific enums 280 + */ 281 + 282 + typedef enum { 283 + ISYS_IRQ0_ID = 0, /* port a */ 284 + ISYS_IRQ1_ID, /* port b */ 285 + ISYS_IRQ2_ID, /* port c */ 286 + N_ISYS_IRQ_ID 287 + } isys_irq_ID_t; 288 + 289 + 290 + /* 291 + * Input-buffer Controller. 292 + */ 293 + typedef enum { 294 + IBUF_CTRL0_ID = 0, /* map to ISYS2401_IBUF_CNTRL_A */ 295 + IBUF_CTRL1_ID, /* map to ISYS2401_IBUF_CNTRL_B */ 296 + IBUF_CTRL2_ID, /* map ISYS2401_IBUF_CNTRL_C */ 297 + N_IBUF_CTRL_ID 298 + } ibuf_ctrl_ID_t; 299 + /* end of Input-buffer Controller */ 300 + 301 + /* 302 + * Stream2MMIO. 303 + */ 304 + typedef enum { 305 + STREAM2MMIO0_ID = 0, /* map to ISYS2401_S2M_A */ 306 + STREAM2MMIO1_ID, /* map to ISYS2401_S2M_B */ 307 + STREAM2MMIO2_ID, /* map to ISYS2401_S2M_C */ 308 + N_STREAM2MMIO_ID 309 + } stream2mmio_ID_t; 310 + 311 + typedef enum { 312 + /* 313 + * Stream2MMIO 0 has 8 SIDs that are indexed by 314 + * [STREAM2MMIO_SID0_ID...STREAM2MMIO_SID7_ID]. 315 + * 316 + * Stream2MMIO 1 has 4 SIDs that are indexed by 317 + * [STREAM2MMIO_SID0_ID...TREAM2MMIO_SID3_ID]. 318 + * 319 + * Stream2MMIO 2 has 4 SIDs that are indexed by 320 + * [STREAM2MMIO_SID0_ID...STREAM2MMIO_SID3_ID]. 321 + */ 322 + STREAM2MMIO_SID0_ID = 0, 323 + STREAM2MMIO_SID1_ID, 324 + STREAM2MMIO_SID2_ID, 325 + STREAM2MMIO_SID3_ID, 326 + STREAM2MMIO_SID4_ID, 327 + STREAM2MMIO_SID5_ID, 328 + STREAM2MMIO_SID6_ID, 329 + STREAM2MMIO_SID7_ID, 330 + N_STREAM2MMIO_SID_ID 331 + } stream2mmio_sid_ID_t; 332 + /* end of Stream2MMIO */ 333 + 334 + /** 335 + * Input System 2401: CSI-MIPI recevier. 336 + */ 337 + typedef enum { 338 + CSI_RX_BACKEND0_ID = 0, /* map to ISYS2401_MIPI_BE_A */ 339 + CSI_RX_BACKEND1_ID, /* map to ISYS2401_MIPI_BE_B */ 340 + CSI_RX_BACKEND2_ID, /* map to ISYS2401_MIPI_BE_C */ 341 + N_CSI_RX_BACKEND_ID 342 + } csi_rx_backend_ID_t; 343 + 344 + typedef enum { 345 + CSI_RX_FRONTEND0_ID = 0, /* map to ISYS2401_CSI_RX_A */ 346 + CSI_RX_FRONTEND1_ID, /* map to ISYS2401_CSI_RX_B */ 347 + CSI_RX_FRONTEND2_ID, /* map to ISYS2401_CSI_RX_C */ 348 + #define N_CSI_RX_FRONTEND_ID (CSI_RX_FRONTEND2_ID + 1) 349 + } csi_rx_frontend_ID_t; 350 + 351 + typedef enum { 352 + CSI_RX_DLANE0_ID = 0, /* map to DLANE0 in CSI RX */ 353 + CSI_RX_DLANE1_ID, /* map to DLANE1 in CSI RX */ 354 + CSI_RX_DLANE2_ID, /* map to DLANE2 in CSI RX */ 355 + CSI_RX_DLANE3_ID, /* map to DLANE3 in CSI RX */ 356 + N_CSI_RX_DLANE_ID 357 + } csi_rx_fe_dlane_ID_t; 358 + /* end of CSI-MIPI receiver */ 359 + 360 + typedef enum { 361 + ISYS2401_DMA0_ID = 0, 362 + N_ISYS2401_DMA_ID 363 + } isys2401_dma_ID_t; 364 + 365 + /** 366 + * Pixel-generator. ("system_global.h") 367 + */ 368 + typedef enum { 369 + PIXELGEN0_ID = 0, 370 + PIXELGEN1_ID, 371 + PIXELGEN2_ID, 372 + N_PIXELGEN_ID 373 + } pixelgen_ID_t; 374 + /* end of pixel-generator. ("system_global.h") */ 375 + 376 + typedef enum { 377 + INPUT_SYSTEM_CSI_PORT0_ID = 0, 378 + INPUT_SYSTEM_CSI_PORT1_ID, 379 + INPUT_SYSTEM_CSI_PORT2_ID, 380 + 381 + INPUT_SYSTEM_PIXELGEN_PORT0_ID, 382 + INPUT_SYSTEM_PIXELGEN_PORT1_ID, 383 + INPUT_SYSTEM_PIXELGEN_PORT2_ID, 384 + 385 + N_INPUT_SYSTEM_INPUT_PORT_ID 386 + } input_system_input_port_ID_t; 387 + 388 + #define N_INPUT_SYSTEM_CSI_PORT 3 389 + 390 + typedef enum { 391 + ISYS2401_DMA_CHANNEL_0 = 0, 392 + ISYS2401_DMA_CHANNEL_1, 393 + ISYS2401_DMA_CHANNEL_2, 394 + ISYS2401_DMA_CHANNEL_3, 395 + ISYS2401_DMA_CHANNEL_4, 396 + ISYS2401_DMA_CHANNEL_5, 397 + ISYS2401_DMA_CHANNEL_6, 398 + ISYS2401_DMA_CHANNEL_7, 399 + ISYS2401_DMA_CHANNEL_8, 400 + ISYS2401_DMA_CHANNEL_9, 401 + ISYS2401_DMA_CHANNEL_10, 402 + ISYS2401_DMA_CHANNEL_11, 403 + N_ISYS2401_DMA_CHANNEL 404 + } isys2401_dma_channel; 405 + 406 + #endif /* __SYSTEM_GLOBAL_H_INCLUDED__ */
+179
drivers/staging/media/atomisp/pci/system_local.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Support for Intel Camera Imaging ISP subsystem. 4 + * Copyright (c) 2015, Intel Corporation. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 14 + */ 15 + 16 + #include "system_local.h" 17 + 18 + /* ISP */ 19 + const hrt_address ISP_CTRL_BASE[N_ISP_ID] = { 20 + 0x0000000000020000ULL 21 + }; 22 + 23 + const hrt_address ISP_DMEM_BASE[N_ISP_ID] = { 24 + 0x0000000000200000ULL 25 + }; 26 + 27 + const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = { 28 + 0x0000000000100000ULL 29 + }; 30 + 31 + /* SP */ 32 + const hrt_address SP_CTRL_BASE[N_SP_ID] = { 33 + 0x0000000000010000ULL 34 + }; 35 + 36 + const hrt_address SP_DMEM_BASE[N_SP_ID] = { 37 + 0x0000000000300000ULL 38 + }; 39 + 40 + /* MMU */ 41 + /* 42 + * MMU0_ID: The data MMU 43 + * MMU1_ID: The icache MMU 44 + */ 45 + const hrt_address MMU_BASE[N_MMU_ID] = { 46 + 0x0000000000070000ULL, 47 + 0x00000000000A0000ULL 48 + }; 49 + 50 + /* DMA */ 51 + const hrt_address DMA_BASE[N_DMA_ID] = { 52 + 0x0000000000040000ULL 53 + }; 54 + 55 + const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = { 56 + 0x00000000000CA000ULL 57 + }; 58 + 59 + /* IRQ */ 60 + const hrt_address IRQ_BASE[N_IRQ_ID] = { 61 + 0x0000000000000500ULL, 62 + 0x0000000000030A00ULL, 63 + 0x000000000008C000ULL, 64 + 0x0000000000090200ULL 65 + }; 66 + 67 + /* 68 + 0x0000000000000500ULL}; 69 + */ 70 + 71 + /* GDC */ 72 + const hrt_address GDC_BASE[N_GDC_ID] = { 73 + 0x0000000000050000ULL, 74 + 0x0000000000060000ULL 75 + }; 76 + 77 + /* FIFO_MONITOR (not a subset of GP_DEVICE) */ 78 + const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = { 79 + 0x0000000000000000ULL 80 + }; 81 + 82 + /* 83 + const hrt_address GP_REGS_BASE[N_GP_REGS_ID] = { 84 + 0x0000000000000000ULL}; 85 + 86 + const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = { 87 + 0x0000000000090000ULL}; 88 + */ 89 + 90 + /* GP_DEVICE (single base for all separate GP_REG instances) */ 91 + const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = { 92 + 0x0000000000000000ULL 93 + }; 94 + 95 + /*GP TIMER , all timer registers are inter-twined, 96 + * so, having multiple base addresses for 97 + * different timers does not help*/ 98 + const hrt_address GP_TIMER_BASE = 99 + (hrt_address)0x0000000000000600ULL; 100 + 101 + /* GPIO */ 102 + const hrt_address GPIO_BASE[N_GPIO_ID] = { 103 + 0x0000000000000400ULL 104 + }; 105 + 106 + /* TIMED_CTRL */ 107 + const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = { 108 + 0x0000000000000100ULL 109 + }; 110 + 111 + /* INPUT_FORMATTER */ 112 + const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = { 113 + 0x0000000000030000ULL, 114 + 0x0000000000030200ULL, 115 + 0x0000000000030400ULL, 116 + 0x0000000000030600ULL 117 + }; /* memcpy() */ 118 + 119 + /* INPUT_SYSTEM */ 120 + const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = { 121 + 0x0000000000080000ULL 122 + }; 123 + 124 + /* 0x0000000000081000ULL, */ /* capture A */ 125 + /* 0x0000000000082000ULL, */ /* capture B */ 126 + /* 0x0000000000083000ULL, */ /* capture C */ 127 + /* 0x0000000000084000ULL, */ /* Acquisition */ 128 + /* 0x0000000000085000ULL, */ /* DMA */ 129 + /* 0x0000000000089000ULL, */ /* ctrl */ 130 + /* 0x000000000008A000ULL, */ /* GP regs */ 131 + /* 0x000000000008B000ULL, */ /* FIFO */ 132 + /* 0x000000000008C000ULL, */ /* IRQ */ 133 + 134 + /* RX, the MIPI lane control regs start at offset 0 */ 135 + const hrt_address RX_BASE[N_RX_ID] = { 136 + 0x0000000000080100ULL 137 + }; 138 + 139 + /* IBUF_CTRL, part of the Input System 2401 */ 140 + const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = { 141 + 0x00000000000C1800ULL, /* ibuf controller A */ 142 + 0x00000000000C3800ULL, /* ibuf controller B */ 143 + 0x00000000000C5800ULL /* ibuf controller C */ 144 + }; 145 + 146 + /* ISYS IRQ Controllers, part of the Input System 2401 */ 147 + const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = { 148 + 0x00000000000C1400ULL, /* port a */ 149 + 0x00000000000C3400ULL, /* port b */ 150 + 0x00000000000C5400ULL /* port c */ 151 + }; 152 + 153 + /* CSI FE, part of the Input System 2401 */ 154 + const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = { 155 + 0x00000000000C0400ULL, /* csi fe controller A */ 156 + 0x00000000000C2400ULL, /* csi fe controller B */ 157 + 0x00000000000C4400ULL /* csi fe controller C */ 158 + }; 159 + 160 + /* CSI BE, part of the Input System 2401 */ 161 + const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = { 162 + 0x00000000000C0800ULL, /* csi be controller A */ 163 + 0x00000000000C2800ULL, /* csi be controller B */ 164 + 0x00000000000C4800ULL /* csi be controller C */ 165 + }; 166 + 167 + /* PIXEL Generator, part of the Input System 2401 */ 168 + const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = { 169 + 0x00000000000C1000ULL, /* pixel gen controller A */ 170 + 0x00000000000C3000ULL, /* pixel gen controller B */ 171 + 0x00000000000C5000ULL /* pixel gen controller C */ 172 + }; 173 + 174 + /* Stream2MMIO, part of the Input System 2401 */ 175 + const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = { 176 + 0x00000000000C0C00ULL, /* stream2mmio controller A */ 177 + 0x00000000000C2C00ULL, /* stream2mmio controller B */ 178 + 0x00000000000C4C00ULL /* stream2mmio controller C */ 179 + };
+98 -6
drivers/staging/media/atomisp/pci/system_local.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 - // SPDX-License-Identifier: GPL-2.0-or-later 3 2 /* 4 - * (c) 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> 3 + * Support for Intel Camera Imaging ISP subsystem. 4 + * Copyright (c) 2015, Intel Corporation. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 5 14 */ 6 15 7 - #ifdef ISP2401 8 - # include "isp2401_system_local.h" 9 - #else 10 - # include "isp2400_system_local.h" 16 + #ifndef __SYSTEM_LOCAL_H_INCLUDED__ 17 + #define __SYSTEM_LOCAL_H_INCLUDED__ 18 + 19 + #ifdef HRT_ISP_CSS_CUSTOM_HOST 20 + #ifndef HRT_USE_VIR_ADDRS 21 + #define HRT_USE_VIR_ADDRS 11 22 #endif 23 + #endif 24 + 25 + #include "system_global.h" 26 + 27 + /* This interface is deprecated */ 28 + #include "hive_types.h" 29 + 30 + /* 31 + * Cell specific address maps 32 + */ 33 + 34 + #define GP_FIFO_BASE ((hrt_address)0x0000000000090104) /* This is NOT a base address */ 35 + 36 + /* ISP */ 37 + extern const hrt_address ISP_CTRL_BASE[N_ISP_ID]; 38 + extern const hrt_address ISP_DMEM_BASE[N_ISP_ID]; 39 + extern const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID]; 40 + 41 + /* SP */ 42 + extern const hrt_address SP_CTRL_BASE[N_SP_ID]; 43 + extern const hrt_address SP_DMEM_BASE[N_SP_ID]; 44 + 45 + /* MMU */ 46 + 47 + extern const hrt_address MMU_BASE[N_MMU_ID]; 48 + 49 + /* DMA */ 50 + extern const hrt_address DMA_BASE[N_DMA_ID]; 51 + extern const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID]; 52 + 53 + /* IRQ */ 54 + extern const hrt_address IRQ_BASE[N_IRQ_ID]; 55 + 56 + /* GDC */ 57 + extern const hrt_address GDC_BASE[N_GDC_ID]; 58 + 59 + /* FIFO_MONITOR (not a subset of GP_DEVICE) */ 60 + extern const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID]; 61 + 62 + /* GP_DEVICE (single base for all separate GP_REG instances) */ 63 + extern const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID]; 64 + 65 + /*GP TIMER , all timer registers are inter-twined, 66 + * so, having multiple base addresses for 67 + * different timers does not help*/ 68 + extern const hrt_address GP_TIMER_BASE; 69 + 70 + /* GPIO */ 71 + extern const hrt_address GPIO_BASE[N_GPIO_ID]; 72 + 73 + /* TIMED_CTRL */ 74 + extern const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID]; 75 + 76 + /* INPUT_FORMATTER */ 77 + extern const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID]; 78 + 79 + /* INPUT_SYSTEM */ 80 + extern const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID]; 81 + 82 + /* RX, the MIPI lane control regs start at offset 0 */ 83 + extern const hrt_address RX_BASE[N_RX_ID]; 84 + 85 + /* IBUF_CTRL, part of the Input System 2401 */ 86 + extern const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID]; 87 + 88 + /* ISYS IRQ Controllers, part of the Input System 2401 */ 89 + extern const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID]; 90 + 91 + /* CSI FE, part of the Input System 2401 */ 92 + extern const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID]; 93 + 94 + /* CSI BE, part of the Input System 2401 */ 95 + extern const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID]; 96 + 97 + /* PIXEL Generator, part of the Input System 2401 */ 98 + extern const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID]; 99 + 100 + /* Stream2MMIO, part of the Input System 2401 */ 101 + extern const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID]; 102 + 103 + #endif /* __SYSTEM_LOCAL_H_INCLUDED__ */