media: atomisp: Replace last use of Intel MID APIs
Subsystems (5)
PATCH 1/9 media: atomisp: Replace last use of Intel MID APIs
Intel MID special header is not in use in this driver. Replace it with a better macro for now on.
--- .../staging/media/atomisp/include/linux/atomisp_platform.h | 1 + drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/include/linux/atomisp_platform.h +1 -0
@@ -250,6 +250,7 @@ const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void);#define IS_MFLD __IS_SOC(INTEL_FAM6_ATOM_SALTWELL_MID)#define IS_BYT __IS_SOC(INTEL_FAM6_ATOM_SILVERMONT)#define IS_CHT __IS_SOC(INTEL_FAM6_ATOM_AIRMONT) +#define IS_MRFD __IS_SOC(INTEL_FAM6_ATOM_SILVERMONT_MID)#define IS_MOFD __IS_SOC(INTEL_FAM6_ATOM_AIRMONT_MID)/* Both CHT and MOFD come with ISP2401 */
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +1 -4
@@ -33,8 +33,6 @@#include "atomisp_ioctl.h" #include "atomisp_acc.h" -#include <asm/intel-mid.h> -#include "ia_css_debug.h" #include "ia_css_isp_param.h" #include "sh_css_hrt.h"
@@ -1966,8 +1964,7 @@ void atomisp_css_input_set_mode(struct atomisp_sub_device *asd, true, 0x13000, &size_mem_words) != 0) { -if (intel_mid_identify_cpu () == -INTEL_MID_CPU_CHIP_TANGIER ) +if (IS_MRFD ) size_mem_words =CSS_MIPI_FRAME_BUFFER_SIZE_2 ;else size_mem_words =CSS_MIPI_FRAME_BUFFER_SIZE_1 ;
Signature · 1 line
2.27.0
PATCH 2/9 media: atomisp: move CCK endpoint address to generic header
IOSF MBI header contains a lot of definitions, such as end point addresses of IPs. Move CCK address from AtomISP driver to generic header.
While here, drop unused one.
--- arch/x86/include/asm/iosf_mbi.h | 1 + drivers/staging/media/atomisp/pci/atomisp-regs.h | 3 --- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-)
arch/x86/include/asm/iosf_mbi.h +1 -0
@@ -39,6 +39,7 @@#define BT_MBI_UNIT_PMC 0x04#define BT_MBI_UNIT_GFX 0x06#define BT_MBI_UNIT_SMI 0x0C +#define BT_MBI_UNIT_CCK 0x14#define BT_MBI_UNIT_USB 0x43#define BT_MBI_UNIT_SATA 0xA3#define BT_MBI_UNIT_PCIE 0xA6
drivers/staging/media/atomisp/pci/atomisp-regs.h +0 -3
@@ -20,9 +20,6 @@#define ATOMISP_REGS_H /* common register definitions */ -#define PUNIT_PORT 0x04 -#define CCK_PORT 0x14 -#define PCICMDSTS 0x01#define INTR 0x0f#define MSI_CAPID 0x24
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +1 -1
@@ -1685,7 +1685,7 @@ static int atomisp_pci_probe(struct pci_dev *dev, isp->dfs = &dfs_config_cht; isp->pdev->d3cold_delay =0 ; -iosf_mbi_read (CCK_PORT ,MBI_REG_READ ,CCK_FUSE_REG_0 , &val); +iosf_mbi_read (BT_MBI_UNIT_CCK ,MBI_REG_READ ,CCK_FUSE_REG_0 , &val);switch (val &CCK_FUSE_HPLL_FREQ_MASK ) {case 0x00 : isp->hpll_freq =HPLL_FREQ_800MHZ ;
Signature · 1 line
2.27.0
PATCH 3/9 media: atomisp: Use proper APIs to find I²C client device by ACPI HID
In reply to Andy ShevchenkoThere are specific ACPI and I²C APIs to match device by different parameters, such as ACPI HID, and retrieve an I²C client. Use them instead of home grown approach. Note, it fixes a resource leak as well.
--- .../media/atomisp/pci/atomisp_gmin_platform.c | 43 ++++++++----------- 1 file changed, 18 insertions(+), 25 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +18 -25
@@ -90,9 +90,9 @@ struct gmin_subdev {static struct gmin_subdev gmin_subdevs[MAX_SUBDEVS ];/* ACPI HIDs for the PMICs that could be used by this driver */ -#define PMIC_ACPI_AXP "INT33F4:00"/* XPower AXP288 PMIC */ -#define PMIC_ACPI_TI "INT33F5:00"/* Dollar Cove TI PMIC */ -#define PMIC_ACPI_CRYSTALCOVE "INT33FD:00"/* Crystal Cove PMIC */ +#define PMIC_ACPI_AXP "INT33F4"/* XPower AXP288 PMIC */ +#define PMIC_ACPI_TI "INT33F5"/* Dollar Cove TI PMIC */ +#define PMIC_ACPI_CRYSTALCOVE "INT33FD"/* Crystal Cove PMIC */ #define PMIC_PLATFORM_TI "intel_soc_pmic_chtdc_ti"
@@ -381,34 +381,27 @@ static const guid_t atomisp_dsm_guid = GUID_INIT(0xdc2f6c4f, 0x045b, 0x4f1d,#define GMIN_PMC_CLK_NAME 14/* "pmc_plt_clk_[0..5]" */ static char gmin_pmc_clk_name[GMIN_PMC_CLK_NAME ]; -static int gmin_i2c_match_one (struct device *dev,const void *data) -{ -const char *name = data; -struct i2c_client *client; - -if (dev->type != &i2c_client_type) -return 0 ; - - client =to_i2c_client (dev); - -return (!strcmp (name, client->name)); -} -static struct i2c_client *gmin_i2c_dev_exists (struct device *dev,char *name,struct i2c_client **client) { +struct acpi_device *adev;struct device *d; -while ((d =bus_find_device (&i2c_bus_type,NULL , name, - gmin_i2c_match_one))) { - *client =to_i2c_client (d); -dev_dbg (dev,"found '%s' at address 0x%02x, adapter %d\n" , - (*client)->name, (*client)->addr, - (*client)->adapter->nr); -return *client; - } + adev =acpi_dev_get_first_match_dev (name,NULL ,-1 ); +if (!adev) +return NULL ; -return NULL ; + d =bus_find_device_by_acpi_dev (&i2c_bus_type, adev); +acpi_dev_put (adev); +if (!d) +return NULL ; + + *client =i2c_verify_client (d); +put_device (d); + +dev_dbg (dev,"found '%s' at address 0x%02x, adapter %d\n" , + (*client)->name, (*client)->addr, (*client)->adapter->nr); +return *client; } static int gmin_i2c_write(struct device *dev, u16 i2c_addr, u8 reg,
Signature · 1 line
2.27.0
PATCH 4/9 media: atomisp: don't pass struct device_driver as parameter
In reply to Andy ShevchenkoThere is no need to pass a pointer to struct device_driver when we have an access to struct device already.
--- drivers/staging/media/atomisp/pci/atomisp_drvfs.c | 3 ++- drivers/staging/media/atomisp/pci/atomisp_drvfs.h | 2 +- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_drvfs.c +2 -1
@@ -185,8 +185,9 @@ static void iunit_drvfs_remove_files(struct device_driver *drv)driver_remove_file (drv, &iunit_drvfs_attrs[i]); } -int atomisp_drvfs_init (struct device_driver *drv,struct atomisp_device *isp) +int atomisp_drvfs_init (struct atomisp_device *isp) { +struct device_driver *drv = isp->dev->driver;int ret; iunit_debug.isp = isp;
drivers/staging/media/atomisp/pci/atomisp_drvfs.h +1 -1
@@ -19,7 +19,7 @@#ifndef __ATOMISP_DRVFS_H__#define __ATOMISP_DRVFS_H__ -int atomisp_drvfs_init (struct device_driver *drv,struct atomisp_device *isp); +int atomisp_drvfs_init (struct atomisp_device *isp);void atomisp_drvfs_exit (void );#endif /* __ATOMISP_DRVFS_H__ */
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +1 -1
@@ -1838,7 +1838,7 @@ static int atomisp_pci_probe(struct pci_dev *dev, isp->firmware =NULL ; isp->css_env.isp_css_fw.data =NULL ; -atomisp_drvfs_init (&dev->driver->driver, isp); +atomisp_drvfs_init (isp);return 0 ;
Signature · 1 line
2.27.0
PATCH 5/9 media: atomisp: Get rid of struct pci_dev in struct atomisp_device
In reply to Andy Shevchenkostruct atomisp device has struct device and struct pci_dev pointers which are basically duplicates of each other. Drop the latter in favour of the former.
While here, unify pdev to be pointer to struct pci_device and reindent some (touched) lines for better readability.
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 24 +++++++++----- .../staging/media/atomisp/pci/atomisp_cmd.h | 4 +-- .../media/atomisp/pci/atomisp_internal.h | 1 - .../staging/media/atomisp/pci/atomisp_ioctl.c | 19 +++++------ .../staging/media/atomisp/pci/atomisp_v4l2.c | 33 ++++++++++--------- 5 files changed, 43 insertions(+), 38 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +15 -9
@@ -206,6 +206,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp, enum atomisp_dfs_mode mode, bool force) { +struct pci_dev *pdev =to_pci_dev (isp->dev);/* FIXME! Only use subdev[0] status yet */ struct atomisp_sub_device *asd = &isp->asd[0 ];const struct atomisp_dfs_config *dfs;
@@ -219,7 +220,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp,return -EINVAL ; } -if ((isp->pdev->device &ATOMISP_PCI_DEVICE_SOC_MASK ) == +if ((pdev->device &ATOMISP_PCI_DEVICE_SOC_MASK ) ==ATOMISP_PCI_DEVICE_SOC_CHT &&ATOMISP_USE_YUVPP (asd)) isp->dfs = &dfs_config_cht_soc;
@@ -357,8 +358,9 @@ static void clear_isp_irq(enum hrt_isp_css_irq irq)irq_clear_all (IRQ0_ID ); } -void atomisp_msi_irq_init (struct atomisp_device *isp,struct pci_dev *dev) +void atomisp_msi_irq_init (struct atomisp_device *isp) { +struct pci_dev *dev =to_pci_dev (isp->dev);u32 msg32;u16 msg16;
@@ -375,8 +377,9 @@ void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev)pci_write_config_word (dev,PCI_COMMAND , msg16); } -void atomisp_msi_irq_uninit (struct atomisp_device *isp,struct pci_dev *dev) +void atomisp_msi_irq_uninit (struct atomisp_device *isp) { +struct pci_dev *dev =to_pci_dev (isp->dev);u32 msg32;u16 msg16;
@@ -480,11 +483,12 @@ static void print_csi_rx_errors(enum mipi_port_id port,/* Clear irq reg */ static void clear_irq_reg (struct atomisp_device *isp) { +struct pci_dev *pdev =to_pci_dev (isp->dev);u32 msg_ret; -pci_read_config_dword (isp->pdev,PCI_INTERRUPT_CTRL , &msg_ret); +pci_read_config_dword (pdev,PCI_INTERRUPT_CTRL , &msg_ret); msg_ret |=1 <<INTR_IIR ; -pci_write_config_dword (isp->pdev,PCI_INTERRUPT_CTRL , msg_ret); +pci_write_config_dword (pdev,PCI_INTERRUPT_CTRL , msg_ret); } static struct atomisp_sub_device *
@@ -1289,6 +1293,7 @@ void atomisp_delayed_init_work(struct work_struct *work)static void __atomisp_css_recover (struct atomisp_device *isp,bool isp_timeout) { +struct pci_dev *pdev =to_pci_dev (isp->dev);enum ia_css_pipe_id css_pipe_id;bool stream_restart[MAX_STREAM_NUM ] = {0 };bool depth_mode = false;
@@ -1372,8 +1377,8 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)clear_isp_irq (hrt_isp_css_irq_sp);/* Set the SRSE to 3 before resetting */ -pci_write_config_dword (isp->pdev,PCI_I_CONTROL , isp->saved_regs.i_control | -MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK ); +pci_write_config_dword (pdev,PCI_I_CONTROL , + isp->saved_regs.i_control |MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK );/* reset ISP and restore its state */ isp->isp_timeout = true;
@@ -6158,6 +6163,7 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd,/*Turn off ISP dphy */ int atomisp_ospm_dphy_down (struct atomisp_device *isp) { +struct pci_dev *pdev =to_pci_dev (isp->dev);unsigned long flags;u32 reg;
@@ -6179,9 +6185,9 @@ int atomisp_ospm_dphy_down(struct atomisp_device *isp)* MRFLD HW design need all CSI ports are disabled before * powering down the IUNIT. */ -pci_read_config_dword (isp->pdev,MRFLD_PCI_CSI_CONTROL , ®); +pci_read_config_dword (pdev,MRFLD_PCI_CSI_CONTROL , ®); reg |=MRFLD_ALL_CSI_PORTS_OFF_MASK ; -pci_write_config_dword (isp->pdev,MRFLD_PCI_CSI_CONTROL , reg); +pci_write_config_dword (pdev,MRFLD_PCI_CSI_CONTROL , reg);return 0 ; }
drivers/staging/media/atomisp/pci/atomisp_cmd.h +2 -2
@@ -68,8 +68,8 @@ bool atomisp_buffers_queued_pipe(struct atomisp_video_pipe *pipe);/* * Interrupt functions */ -void atomisp_msi_irq_init (struct atomisp_device *isp,struct pci_dev *dev); -void atomisp_msi_irq_uninit (struct atomisp_device *isp,struct pci_dev *dev); +void atomisp_msi_irq_init (struct atomisp_device *isp); +void atomisp_msi_irq_uninit (struct atomisp_device *isp);void atomisp_wdt_work (struct work_struct *work);void atomisp_wdt (struct timer_list *t);void atomisp_setup_flash (struct atomisp_sub_device *asd);
drivers/staging/media/atomisp/pci/atomisp_internal.h +0 -1
@@ -216,7 +216,6 @@ struct atomisp_sw_contex {* ci device struct */ struct atomisp_device { -struct pci_dev *pdev;struct device *dev;struct v4l2_device v4l2_dev;struct media_device media_dev;
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +9 -10
@@ -549,8 +549,7 @@ static int atomisp_querycap(struct file *file, void *fh,strscpy (cap->driver,DRIVER ,sizeof (cap->driver));strscpy (cap->card,CARD ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" , -pci_name (isp->pdev)); +snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" ,dev_name (isp->dev));return 0 ; }
@@ -1635,6 +1634,7 @@ static int atomisp_streamon(struct file *file, void *fh,struct atomisp_video_pipe *pipe =atomisp_to_video_pipe (vdev);struct atomisp_sub_device *asd = pipe->asd;struct atomisp_device *isp =video_get_drvdata (vdev); +struct pci_dev *pdev =to_pci_dev (isp->dev);enum ia_css_pipe_id css_pipe_id;unsigned int sensor_start_stream;unsigned int wdt_duration =ATOMISP_ISP_TIMEOUT_DURATION ;
@@ -1844,9 +1844,8 @@ static int atomisp_streamon(struct file *file, void *fh,/* Enable the CSI interface on ANN B0/K0 */ if (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 <<ATOMISP_HW_REVISION_SHIFT ) |ATOMISP_HW_STEPPING_B0 )) { -pci_write_config_word (isp->pdev,MRFLD_PCI_CSI_CONTROL , - isp->saved_regs.csi_control | -MRFLD_PCI_CSI_CONTROL_CSI_READY ); +pci_write_config_word (pdev,MRFLD_PCI_CSI_CONTROL , + isp->saved_regs.csi_control |MRFLD_PCI_CSI_CONTROL_CSI_READY ); }/* stream on the sensor */
@@ -1891,6 +1890,7 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) {struct video_device *vdev =video_devdata (file);struct atomisp_device *isp =video_get_drvdata (vdev); +struct pci_dev *pdev =to_pci_dev (isp->dev);struct atomisp_video_pipe *pipe =atomisp_to_video_pipe (vdev);struct atomisp_sub_device *asd = pipe->asd;struct atomisp_video_pipe *capture_pipe =NULL ;
@@ -2076,9 +2076,8 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)/* Disable the CSI interface on ANN B0/K0 */ if (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 <<ATOMISP_HW_REVISION_SHIFT ) |ATOMISP_HW_STEPPING_B0 )) { -pci_write_config_word (isp->pdev,MRFLD_PCI_CSI_CONTROL , - isp->saved_regs.csi_control & - ~MRFLD_PCI_CSI_CONTROL_CSI_READY ); +pci_write_config_word (pdev,MRFLD_PCI_CSI_CONTROL , + isp->saved_regs.csi_control & ~MRFLD_PCI_CSI_CONTROL_CSI_READY ); }if (atomisp_freq_scaling (isp,ATOMISP_DFS_MODE_LOW , false))
@@ -2111,8 +2110,8 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) }/* disable PUNIT/ISP acknowlede/handshake - SRSE=3 */ -pci_write_config_dword (isp->pdev,PCI_I_CONTROL , isp->saved_regs.i_control | -MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK ); +pci_write_config_dword (pdev,PCI_I_CONTROL , + isp->saved_regs.i_control |MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK );dev_err (isp->dev,"atomisp_reset" );atomisp_reset (isp);for (i =0 ; i < isp->num_of_streams; i++) {
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +17 -16
@@ -512,7 +512,7 @@ void atomisp_acc_unregister(struct atomisp_acc_pipe *video)static int atomisp_save_iunit_reg (struct atomisp_device *isp) { -struct pci_dev *dev = isp->pdev; +struct pci_dev *dev =to_pci_dev (isp->dev);dev_dbg (isp->dev,"%s\n" , __func__);
@@ -573,7 +573,7 @@ static int atomisp_save_iunit_reg(struct atomisp_device *isp)static int __maybe_unused atomisp_restore_iunit_reg (struct atomisp_device *isp) { -struct pci_dev *dev = isp->pdev; +struct pci_dev *dev =to_pci_dev (isp->dev);dev_dbg (isp->dev,"%s\n" , __func__);
@@ -619,7 +619,7 @@ static int __maybe_unused atomisp_restore_iunit_reg(struct atomisp_device *isp)static int atomisp_mrfld_pre_power_down (struct atomisp_device *isp) { -struct pci_dev *dev = isp->pdev; +struct pci_dev *dev =to_pci_dev (isp->dev);u32 irq;unsigned long flags;
@@ -679,7 +679,7 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp) irq &= ~(1 <<INTR_IER );pci_write_config_dword (dev,PCI_INTERRUPT_CTRL , irq); -atomisp_msi_irq_uninit (isp, dev); +atomisp_msi_irq_uninit (isp);atomisp_freq_scaling (isp,ATOMISP_DFS_MODE_LOW , true);spin_unlock_irqrestore (&isp->lock, flags);
@@ -902,6 +902,7 @@ static int __maybe_unused atomisp_resume(struct device *dev)int atomisp_csi_lane_config (struct atomisp_device *isp) { +struct pci_dev *pdev =to_pci_dev (isp->dev); static const struct { u8 code; u8 lanes[MRFLD_PORT_NUM];
@@ -1003,7 +1004,7 @@ int atomisp_csi_lane_config(struct atomisp_device *isp)return -EINVAL ; } -pci_read_config_dword (isp->pdev,MRFLD_PCI_CSI_CONTROL , &csi_control); +pci_read_config_dword (pdev,MRFLD_PCI_CSI_CONTROL , &csi_control); csi_control &= ~port_config_mask; csi_control |= (portconfigs[i].code <<MRFLD_PORT_CONFIGCODE_SHIFT ) | (portconfigs[i].lanes[0 ] ?0 : (1 <<MRFLD_PORT1_ENABLE_SHIFT ))
@@ -1013,7 +1014,7 @@ int atomisp_csi_lane_config(struct atomisp_device *isp) | (((1 << portconfigs[i].lanes[1]) - 1) << MRFLD_PORT2_LANES_SHIFT) | (((1 << portconfigs[i].lanes[2 ]) -1 ) << port3_lanes_shift); -pci_write_config_dword (isp->pdev,MRFLD_PCI_CSI_CONTROL , csi_control); +pci_write_config_dword (pdev,MRFLD_PCI_CSI_CONTROL , csi_control); dev_dbg(isp->dev, "%s: the portconfig is %d-%d-%d, CSI_CONTROL is 0x%08X\n",
@@ -1587,7 +1588,7 @@ static int atomisp_pci_probe(struct pci_dev *dev, err = -ENOMEM ; goto atomisp_dev_alloc_fail; } - isp->pdev = dev; + isp->dev = &dev->dev; isp->sw_contex.power_state =ATOM_ISP_POWER_UP ; isp->saved_regs.ispmmadr = start;
@@ -1597,7 +1598,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,spin_lock_init (&isp->lock);/* This is not a true PCI device on SoC, so the delay is not needed. */ - isp->pdev->d3_delay =0 ; + dev->d3_delay =0 ;switch (id->device &ATOMISP_PCI_DEVICE_SOC_MASK ) {case ATOMISP_PCI_DEVICE_SOC_MRFLD :
@@ -1656,7 +1657,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,* in power off. Set d3cold_delay to 0 since default 100ms is not * necessary. */ - isp->pdev->d3cold_delay =0 ; + dev->d3cold_delay =0 ;break ;case ATOMISP_PCI_DEVICE_SOC_ANN : isp->media_dev.hw_revision = (
@@ -1666,7 +1667,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,ATOMISP_HW_REVISION_ISP2401_LEGACY #endif << ATOMISP_HW_REVISION_SHIFT); - isp->media_dev.hw_revision |= isp->pdev->revision <2 ? + isp->media_dev.hw_revision |= dev->revision <2 ?ATOMISP_HW_STEPPING_A0 :ATOMISP_HW_STEPPING_B0 ; isp->dfs = &dfs_config_merr; isp->hpll_freq =HPLL_FREQ_1600MHZ ;
@@ -1679,11 +1680,11 @@ static int atomisp_pci_probe(struct pci_dev *dev,ATOMISP_HW_REVISION_ISP2401_LEGACY #endif << ATOMISP_HW_REVISION_SHIFT); - isp->media_dev.hw_revision |= isp->pdev->revision <2 ? + isp->media_dev.hw_revision |= dev->revision <2 ?ATOMISP_HW_STEPPING_A0 :ATOMISP_HW_STEPPING_B0 ; isp->dfs = &dfs_config_cht; - isp->pdev->d3cold_delay =0 ; + dev->d3cold_delay =0 ;iosf_mbi_read (BT_MBI_UNIT_CCK ,MBI_REG_READ ,CCK_FUSE_REG_0 , &val);switch (val &CCK_FUSE_HPLL_FREQ_MASK ) {
@@ -1741,7 +1742,7 @@ static int atomisp_pci_probe(struct pci_dev *dev, goto enable_msi_fail; } -atomisp_msi_irq_init (isp, dev); +atomisp_msi_irq_init (isp);cpu_latency_qos_add_request (&isp->pm_qos,PM_QOS_DEFAULT_VALUE );
@@ -1856,7 +1857,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,atomisp_uninitialize_modules (isp); initialize_modules_fail:cpu_latency_qos_remove_request (&isp->pm_qos); -atomisp_msi_irq_uninit (isp, dev); +atomisp_msi_irq_uninit (isp);pci_disable_msi (dev); enable_msi_fail: fw_validation_fail:
@@ -1877,7 +1878,7 @@ static int atomisp_pci_probe(struct pci_dev *dev, irq &= ~(1 <<INTR_IER );pci_write_config_dword (dev,PCI_INTERRUPT_CTRL , irq); -atomisp_msi_irq_uninit (isp, dev); +atomisp_msi_irq_uninit (isp);atomisp_ospm_dphy_down (isp);
@@ -1910,7 +1911,7 @@ static void atomisp_pci_remove(struct pci_dev *dev)pm_runtime_get_noresume (&dev->dev);cpu_latency_qos_remove_request (&isp->pm_qos); -atomisp_msi_irq_uninit (isp, dev); +atomisp_msi_irq_uninit (isp);atomisp_unregister_entities (isp);destroy_workqueue (isp->wdt_work_queue);
Signature · 1 line
2.27.0
PATCH 6/9 media: atomisp: Unify pdev to be pointer to struct pci_device
In reply to Andy ShevchenkoUnify pdev to be pointer to struct pci_device.
While here, reindent some (touched) lines for better readability.
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 24 +- .../media/atomisp/pci/atomisp_gmin_platform.c | 6 +- .../staging/media/atomisp/pci/atomisp_v4l2.c | 248 ++++++++---------- 3 files changed, 127 insertions(+), 151 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +12 -12
@@ -360,39 +360,39 @@ static void clear_isp_irq(enum hrt_isp_css_irq irq)void atomisp_msi_irq_init (struct atomisp_device *isp) { -struct pci_dev *dev =to_pci_dev (isp->dev); +struct pci_dev *pdev =to_pci_dev (isp->dev);u32 msg32;u16 msg16; -pci_read_config_dword (dev,PCI_MSI_CAPID , &msg32); +pci_read_config_dword (pdev,PCI_MSI_CAPID , &msg32); msg32 |=1 <<MSI_ENABLE_BIT ; -pci_write_config_dword (dev,PCI_MSI_CAPID , msg32); +pci_write_config_dword (pdev,PCI_MSI_CAPID , msg32); msg32 = (1 <<INTR_IER ) | (1 <<INTR_IIR ); -pci_write_config_dword (dev,PCI_INTERRUPT_CTRL , msg32); +pci_write_config_dword (pdev,PCI_INTERRUPT_CTRL , msg32); -pci_read_config_word (dev,PCI_COMMAND , &msg16); +pci_read_config_word (pdev,PCI_COMMAND , &msg16); msg16 |= (PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER |PCI_COMMAND_INTX_DISABLE ); -pci_write_config_word (dev,PCI_COMMAND , msg16); +pci_write_config_word (pdev,PCI_COMMAND , msg16); }void atomisp_msi_irq_uninit (struct atomisp_device *isp) { -struct pci_dev *dev =to_pci_dev (isp->dev); +struct pci_dev *pdev =to_pci_dev (isp->dev);u32 msg32;u16 msg16; -pci_read_config_dword (dev,PCI_MSI_CAPID , &msg32); +pci_read_config_dword (pdev,PCI_MSI_CAPID , &msg32); msg32 &= ~(1 <<MSI_ENABLE_BIT ); -pci_write_config_dword (dev,PCI_MSI_CAPID , msg32); +pci_write_config_dword (pdev,PCI_MSI_CAPID , msg32); msg32 =0x0 ; -pci_write_config_dword (dev,PCI_INTERRUPT_CTRL , msg32); +pci_write_config_dword (pdev,PCI_INTERRUPT_CTRL , msg32); -pci_read_config_word (dev,PCI_COMMAND , &msg16); +pci_read_config_word (pdev,PCI_COMMAND , &msg16); msg16 &= ~(PCI_COMMAND_MASTER ); -pci_write_config_word (dev,PCI_COMMAND , msg16); +pci_write_config_word (pdev,PCI_COMMAND , msg16); }static void atomisp_sof_event (struct atomisp_sub_device *asd)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +3 -3
@@ -1148,10 +1148,10 @@ EXPORT_SYMBOL_GPL(camera_sensor_csi);* trying. The driver itself does direct calls to the PUNIT to manage * ISP power. */ -static void isp_pm_cap_fixup (struct pci_dev *dev) +static void isp_pm_cap_fixup (struct pci_dev *pdev) { -dev_info (&dev->dev,"Disabling PCI power management on camera ISP\n" ); - dev->pm_cap =0 ; +dev_info (&pdev->dev,"Disabling PCI power management on camera ISP\n" ); + pdev->pm_cap =0 ; }DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x0f38 , isp_pm_cap_fixup);
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +112 -136
547 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH 7/9 media: atomisp: Replace direct access to MMIO with proper helpers
In reply to Andy ShevchenkoWe have special helpers to access MMIO. Use them.
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 13 +++--- .../media/atomisp/pci/atomisp_compat.h | 2 - .../media/atomisp/pci/atomisp_compat_css20.c | 43 ++++++++++--------- .../media/atomisp/pci/atomisp_internal.h | 1 + .../staging/media/atomisp/pci/atomisp_v4l2.c | 16 +++---- 5 files changed, 35 insertions(+), 40 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +6 -7
@@ -21,6 +21,7 @@#include <linux/firmware.h> #include <linux/pci.h> #include <linux/interrupt.h> +#include <linux/io.h> #include <linux/kernel.h> #include <linux/kfifo.h> #include <linux/pm_runtime.h>
@@ -669,11 +670,10 @@ bool atomisp_buffers_queued_pipe(struct atomisp_video_pipe *pipe)void dump_sp_dmem (struct atomisp_device *isp,unsigned int addr,unsigned int size) { -u32 __iomem *io_virt_addr;unsigned int data =0 ;unsigned int size32 =DIV_ROUND_UP (size,sizeof (u32)); -dev_dbg (isp->dev,"atomisp_io_base:%p\n" , atomisp_io_base); +dev_dbg (isp->dev,"atomisp mmio base: %p\n" , isp->base);dev_dbg (isp->dev,"%s, addr:0x%x, size: %d, size32: %d\n" , __func__, addr, size, size32);if (size32 *4 + addr >0x4000 ) {
@@ -682,13 +682,12 @@ void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr,return ; } addr +=SP_DMEM_BASE ; - io_virt_addr = atomisp_io_base + (addr &0x003FFFFF ); + addr &=0x003FFFFF ;do { - data = *io_virt_addr; + data =readl (isp->base + addr);dev_dbg (isp->dev,"%s, \t [0x%x]:0x%x\n" , __func__, addr, data); - io_virt_addr +=sizeof (u32); - size32 -=1 ; - }while (size32 >0 ); + addr +=sizeof (u32); + }while (--size32); } static struct videobuf_buffer *atomisp_css_frame_to_vbuf(
drivers/staging/media/atomisp/pci/atomisp_compat.h +0 -2
@@ -29,8 +29,6 @@ struct atomisp_sub_device;struct video_device ;enum atomisp_input_stream_id ; -extern void __iomem *atomisp_io_base; -struct atomisp_metadata_buf {struct ia_css_metadata *metadata;void *md_vptr;
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +23 -20
121 lines not on this page · raw message
drivers/staging/media/atomisp/pci/atomisp_internal.h +1 -0
@@ -221,6 +221,7 @@ struct atomisp_device {struct media_device media_dev;struct atomisp_platform_data *pdata;void *mmu_l1_base; +void __iomem *base;const struct firmware *firmware;struct pm_qos_request pm_qos;
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +5 -11
@@ -127,8 +127,6 @@ MODULE_PARM_DESC(pad_h, "extra data for ISP processing");struct device *atomisp_dev; -void __iomem *atomisp_io_base; -static const struct atomisp_freq_scaling_rule dfs_rules_merr[] = { { .width =ISP_FREQ_RULE_ANY ,
@@ -1531,7 +1529,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *iconst struct atomisp_platform_data *pdata;struct atomisp_device *isp;unsigned int start; -void __iomem *base;int err, val;u32 irq;
@@ -1560,13 +1557,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i goto ioremap_fail; } - base =pcim_iomap_table (pdev)[ATOM_ISP_PCI_BAR ]; -dev_dbg (&pdev->dev,"base: %p\n" , base); - - atomisp_io_base = base; - -dev_dbg (&pdev->dev,"atomisp_io_base: %p\n" , atomisp_io_base); - isp =devm_kzalloc (&pdev->dev,sizeof (*isp),GFP_KERNEL );if (!isp) { err = -ENOMEM ;
@@ -1574,9 +1564,12 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i } isp->dev = &pdev->dev; + isp->base =pcim_iomap_table (pdev)[ATOM_ISP_PCI_BAR ]; isp->sw_contex.power_state =ATOM_ISP_POWER_UP ; isp->saved_regs.ispmmadr = start; +dev_dbg (&pdev->dev,"atomisp mmio base: %p\n" , isp->base); +rt_mutex_init (&isp->mutex);mutex_init (&isp->streamoff_mutex);spin_lock_init (&isp->lock);
@@ -1584,6 +1577,8 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i/* This is not a true PCI device on SoC, so the delay is not needed. */ pdev->d3_delay =0 ; +pci_set_drvdata (pdev, isp); +switch (id->device &ATOMISP_PCI_DEVICE_SOC_MASK ) {case ATOMISP_PCI_DEVICE_SOC_MRFLD : isp->media_dev.hw_revision =
@@ -1714,7 +1709,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i }pci_set_master (pdev); -pci_set_drvdata (pdev, isp); err =pci_enable_msi (pdev);if (err) {
Signature · 1 line
2.27.0
PATCH 8/9 media: atomisp: Drop global atomisp_dev variable (easy cases)
In reply to Andy ShevchenkoRefactor code to avoid use of atomisp_dev global variable where it's easy to achieve.
--- drivers/staging/media/atomisp/pci/atomisp_acc.c | 4 ++-- .../media/atomisp/pci/atomisp_compat_css20.c | 16 +++++++--------- .../media/atomisp/pci/atomisp_compat_css20.h | 2 +- .../staging/media/atomisp/pci/atomisp_drvfs.c | 11 +++++------ 4 files changed, 15 insertions(+), 18 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_acc.c +2 -2
@@ -355,11 +355,11 @@ int atomisp_acc_map(struct atomisp_sub_device *asd, struct atomisp_acc_map *map) pgnr =DIV_ROUND_UP (map->length,PAGE_SIZE );if (pgnr < ((PAGE_ALIGN (map->length)) >>PAGE_SHIFT )) { -dev_err (atomisp_dev, +dev_err (asd->isp->dev,"user space memory size is less than the expected size..\n" );return -ENOMEM ; }else if (pgnr > ((PAGE_ALIGN (map->length)) >>PAGE_SHIFT )) { -dev_err (atomisp_dev, +dev_err (asd->isp->dev,"user space memory size is large than the expected size..\n" );return -ENOMEM ; }
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +7 -9
@@ -182,10 +182,10 @@ void atomisp_load_uint32(hrt_address addr, uint32_t *data) *data =atomisp_css2_hw_load_32 (addr); } -static int hmm_get_mmu_base_addr (unsigned int *mmu_base_addr) +static int hmm_get_mmu_base_addr (struct device *dev,unsigned int *mmu_base_addr) {if (!sh_mmu_mrfld.get_pd_base) { -dev_err (atomisp_dev,"get mmu base address failed.\n" ); +dev_err (dev,"get mmu base address failed.\n" );return -EINVAL ; }
@@ -840,7 +840,7 @@ int atomisp_css_init(struct atomisp_device *isp)int ret;int err; - ret =hmm_get_mmu_base_addr (&mmu_base_addr); + ret =hmm_get_mmu_base_addr (isp->dev, &mmu_base_addr);if (ret)return ret;
@@ -942,7 +942,7 @@ int atomisp_css_resume(struct atomisp_device *isp)unsigned int mmu_base_addr;int ret; - ret =hmm_get_mmu_base_addr (&mmu_base_addr); + ret =hmm_get_mmu_base_addr (isp->dev, &mmu_base_addr);if (ret) {dev_err (isp->dev,"get base address error.\n" );return -EINVAL ;
@@ -4337,7 +4337,7 @@ static const char * const fw_acc_type_name[] = { [IA_CSS_ACC_STANDALONE] = "Stand-alone acceleration", }; -int atomisp_css_dump_blob_infor (void ) +int atomisp_css_dump_blob_infor (struct atomisp_device *isp) {struct ia_css_blob_descr *bd = sh_css_blob_info;unsigned int i, nm = sh_css_num_binaries;
@@ -4354,8 +4354,7 @@ int atomisp_css_dump_blob_infor(void)for (i =0 ; i < sh_css_num_binaries -NUM_OF_SPS ; i++) {switch (bd[i].header.type) {case ia_css_isp_firmware: - dev_dbg(atomisp_dev, - "Num%2d type %s (%s), binary id is %2d, name is %s\n", + dev_dbg(isp->dev, "Num%2d type %s (%s), binary id is %2d, name is %s\n", i + NUM_OF_SPS, fw_type_name[bd[i].header.type], fw_acc_type_name[bd[i].header.info.isp.type],
@@ -4363,8 +4362,7 @@ int atomisp_css_dump_blob_infor(void) bd[i].name);break ;default : -dev_dbg (atomisp_dev, -"Num%2d type %s, name is %s\n" , +dev_dbg (isp->dev,"Num%2d type %s, name is %s\n" , i +NUM_OF_SPS , fw_type_name[bd[i].header.type], bd[i].name); }
drivers/staging/media/atomisp/pci/atomisp_compat_css20.h +1 -1
@@ -153,7 +153,7 @@ int atomisp_css_debug_dump_isp_binary(void);int atomisp_css_dump_sp_raw_copy_linecount (bool reduced); -int atomisp_css_dump_blob_infor (void ); +int atomisp_css_dump_blob_infor (struct atomisp_device *isp);void atomisp_css_set_isp_config_id (struct atomisp_sub_device *asd,uint32_t isp_config_id);
drivers/staging/media/atomisp/pci/atomisp_drvfs.c +5 -6
@@ -62,9 +62,9 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,if (opt &OPTION_VALID ) {if (opt &OPTION_BIN_LIST ) { - ret =atomisp_css_dump_blob_infor (); + ret =atomisp_css_dump_blob_infor (isp);if (ret) { -dev_err (atomisp_dev,"%s dump blob infor err[ret:%d]\n" , +dev_err (isp->dev,"%s dump blob infor err[ret:%d]\n" , __func__, ret); goto opt_err; }
@@ -76,7 +76,7 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,atomisp_css_debug_dump_isp_binary (); }else { ret = -EPERM ; -dev_err (atomisp_dev,"%s dump running bin err[ret:%d]\n" , +dev_err (isp->dev,"%s dump running bin err[ret:%d]\n" , __func__, ret); goto opt_err; }
@@ -86,8 +86,7 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,hmm_show_mem_stat (__func__, __LINE__); }else { ret = -EINVAL ; -dev_err (atomisp_dev,"%s dump nothing[ret=%d]\n" , __func__, - ret); +dev_err (isp->dev,"%s dump nothing[ret=%d]\n" , __func__, ret); } opt_err:
@@ -195,7 +194,7 @@ int atomisp_drvfs_init(struct atomisp_device *isp) ret =iunit_drvfs_create_files (iunit_debug.drv);if (ret) { -dev_err (atomisp_dev,"drvfs_create_files error: %d\n" , ret); +dev_err (isp->dev,"drvfs_create_files error: %d\n" , ret);iunit_drvfs_remove_files (iunit_debug.drv); }
Signature · 1 line
2.27.0
PATCH 9/9 media: atomisp: make platform data more readable
In reply to Andy ShevchenkoAdd few blank lines to make platform data more readable.
--- drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +3 -0
@@ -294,6 +294,7 @@ static struct gmin_cfg_var mrd7_vars[] = { {"INT33F8:00_CsiFmt", "13"}, {"INT33F8:00_CsiBayer", "0"}, {"INT33F8:00_CamClk", "0"}, + {"INT33F9:00_CamType", "1"}, {"INT33F9:00_CsiPort", "0"}, {"INT33F9:00_CsiLanes", "1"},
@@ -309,6 +310,7 @@ static struct gmin_cfg_var ecs7_vars[] = { {"INT33BE:00_CsiFmt", "13"}, {"INT33BE:00_CsiBayer", "2"}, {"INT33BE:00_CamClk", "0"}, + {"INT33F0:00_CsiPort", "0"}, {"INT33F0:00_CsiLanes", "1"}, {"INT33F0:00_CsiFmt", "13"},
@@ -322,6 +324,7 @@ static struct gmin_cfg_var i8880_vars[] = { {"XXOV2680:00_CsiPort", "1"}, {"XXOV2680:00_CsiLanes", "1"}, {"XXOV2680:00_CamClk", "0"}, + {"XXGC0310:00_CsiPort", "0"}, {"XXGC0310:00_CsiLanes", "1"}, {"XXGC0310:00_CamClk", "1"},
Signature · 1 line
2.27.0