]> www.infradead.org Git - users/willy/linux.git/commitdiff
media: atomisp: remove some trivial wrappers from compat css20
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 28 May 2020 07:31:23 +0000 (09:31 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 11 Jun 2020 16:20:41 +0000 (18:20 +0200)
There are tons of code inside atomisp_compat_css20.c, but
several of them are just trivial wrappers to other functions.

Getting rid of all of them will take some time, but let's
start getting rid of some of the trivial ones.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_cmd.c
drivers/staging/media/atomisp/pci/atomisp_compat.h
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
drivers/staging/media/atomisp/pci/atomisp_compat_css20.h
drivers/staging/media/atomisp/pci/atomisp_csi2.c
drivers/staging/media/atomisp/pci/atomisp_drvfs.c
drivers/staging/media/atomisp/pci/atomisp_fops.c
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
drivers/staging/media/atomisp/pci/atomisp_v4l2.c
drivers/staging/media/atomisp/pci/mmu/sh_mmu_mrfld.c
drivers/staging/media/atomisp/pci/sh_css_firmware.c

index 5f34e7586ee4da1b20015b73e5e67d46624c9dd4..2758c2da60da0752fb4634b1c3335fdd37a6837f 100644 (file)
@@ -57,6 +57,7 @@
 
 #include "ia_css_types.h"
 #include "ia_css_stream.h"
+#include "ia_css_debug.h"
 #include "error_support.h"
 #include "bits.h"
 
@@ -1503,8 +1504,8 @@ void atomisp_wdt_work(struct work_struct *work)
        }
 
        if (css_recover) {
-               atomisp_css_debug_dump_sp_sw_debug_info();
-               atomisp_css_debug_dump_debug_info(__func__);
+               ia_css_debug_dump_sp_sw_debug_info();
+               ia_css_debug_dump_debug_info(__func__);
                for (i = 0; i < isp->num_of_streams; i++) {
                        struct atomisp_sub_device *asd = &isp->asd[i];
 
index 8693f228a875f57e19cf63c7e01477972269032d..87677e1117ff59147d39ab8fe1644fe6856a864f 100644 (file)
@@ -34,11 +34,7 @@ struct atomisp_metadata_buf {
        struct list_head list;
 };
 
-void atomisp_css_debug_dump_sp_sw_debug_info(void);
-void atomisp_css_debug_dump_debug_info(const char *context);
-void atomisp_css_debug_set_dtrace_level(const unsigned int trace_level);
-
-void atomisp_store_uint32(hrt_address addr, uint32_t data);
+void atomisp_css2_hw_store_32(hrt_address addr, uint32_t data);
 void atomisp_load_uint32(hrt_address addr, uint32_t *data);
 
 int atomisp_css_init(struct atomisp_device *isp);
@@ -84,9 +80,9 @@ int atomisp_q_dis_buffer_to_css(struct atomisp_sub_device *asd,
                                enum atomisp_input_stream_id stream_id,
                                enum ia_css_pipe_id css_pipe_id);
 
-void atomisp_css_mmu_invalidate_cache(void);
+void ia_css_mmu_invalidate_cache(void);
 
-void atomisp_css_mmu_invalidate_tlb(void);
+void ia_css_mmu_invalidate_cache(void);
 
 int atomisp_css_start(struct atomisp_sub_device *asd,
                      enum ia_css_pipe_id pipe_id, bool in_reset);
index 2164dd0d49c024c7d3a7b11978c1d58e582dd9f9..f398b052711c8bdd5c197b4bbda0f193c5cc2fbb 100644 (file)
@@ -66,26 +66,6 @@ struct bayer_ds_factor {
        unsigned int denominator;
 };
 
-void atomisp_css_debug_dump_sp_sw_debug_info(void)
-{
-       ia_css_debug_dump_sp_sw_debug_info();
-}
-
-void atomisp_css_debug_dump_debug_info(const char *context)
-{
-       ia_css_debug_dump_debug_info(context);
-}
-
-void atomisp_css_debug_set_dtrace_level(const unsigned int trace_level)
-{
-       ia_css_debug_set_dtrace_level(trace_level);
-}
-
-unsigned int atomisp_css_debug_get_dtrace_level(void)
-{
-       return dbg_level;
-}
-
 static void atomisp_css2_hw_store_8(hrt_address addr, uint8_t data)
 {
        unsigned long flags;
@@ -104,7 +84,7 @@ static void atomisp_css2_hw_store_16(hrt_address addr, uint16_t data)
        spin_unlock_irqrestore(&mmio_lock, flags);
 }
 
-static void atomisp_css2_hw_store_32(hrt_address addr, uint32_t data)
+void atomisp_css2_hw_store_32(hrt_address addr, uint32_t data)
 {
        unsigned long flags;
 
@@ -191,11 +171,6 @@ static int atomisp_css2_err_print(const char *fmt, va_list args)
        return 0;
 }
 
-void atomisp_store_uint32(hrt_address addr, uint32_t data)
-{
-       atomisp_css2_hw_store_32(addr, data);
-}
-
 void atomisp_load_uint32(hrt_address addr, uint32_t *data)
 {
        *data = atomisp_css2_hw_load_32(addr);
@@ -213,16 +188,6 @@ static int hmm_get_mmu_base_addr(unsigned int *mmu_base_addr)
        return 0;
 }
 
-static void atomisp_isp_parameters_clean_up(
-    struct ia_css_isp_config *config)
-{
-       /*
-        * Set NULL to configs pointer to avoid they are set into isp again when
-        * some configs are changed and need to be updated later.
-        */
-       memset(config, 0, sizeof(*config));
-}
-
 static void __dump_pipe_config(struct atomisp_sub_device *asd,
                               struct atomisp_stream_env *stream_env,
                               unsigned int pipe_id)
@@ -905,14 +870,6 @@ static inline int __set_css_print_env(struct atomisp_device *isp, int opt)
        return ret;
 }
 
-int atomisp_css_check_firmware_version(struct atomisp_device *isp)
-{
-       if (!sh_css_check_firmware_version(isp->dev, (void *)isp->firmware->data)) {
-               return -EINVAL;
-       }
-       return 0;
-}
-
 int atomisp_css_load_firmware(struct atomisp_device *isp)
 {
        enum ia_css_err err;
@@ -952,11 +909,6 @@ int atomisp_css_load_firmware(struct atomisp_device *isp)
        return 0;
 }
 
-void atomisp_css_unload_firmware(struct atomisp_device *isp)
-{
-       ia_css_unload_firmware();
-}
-
 void atomisp_css_uninit(struct atomisp_device *isp)
 {
        struct atomisp_sub_device *asd;
@@ -964,7 +916,7 @@ void atomisp_css_uninit(struct atomisp_device *isp)
 
        for (i = 0; i < isp->num_of_streams; i++) {
                asd = &isp->asd[i];
-               atomisp_isp_parameters_clean_up(&asd->params.config);
+               memset(&asd->params.config, 0, sizeof(asd->params.config));
                asd->params.css_update_params_needed = false;
        }
 
@@ -1152,16 +1104,6 @@ int atomisp_q_dis_buffer_to_css(struct atomisp_sub_device *asd,
        return 0;
 }
 
-void atomisp_css_mmu_invalidate_cache(void)
-{
-       ia_css_mmu_invalidate_cache();
-}
-
-void atomisp_css_mmu_invalidate_tlb(void)
-{
-       ia_css_mmu_invalidate_cache();
-}
-
 int atomisp_css_start(struct atomisp_sub_device *asd,
                      enum ia_css_pipe_id pipe_id, bool in_reset)
 {
@@ -1285,7 +1227,7 @@ void atomisp_css_update_isp_params(struct atomisp_sub_device *asd)
        ia_css_stream_set_isp_config(
            asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream,
            &asd->params.config);
-       atomisp_isp_parameters_clean_up(&asd->params.config);
+       memset(&asd->params.config, 0, sizeof(asd->params.config));
 }
 
 void atomisp_css_update_isp_params_on_pipe(struct atomisp_sub_device *asd,
@@ -1309,7 +1251,7 @@ void atomisp_css_update_isp_params_on_pipe(struct atomisp_sub_device *asd,
        if (ret != IA_CSS_SUCCESS)
                dev_warn(asd->isp->dev, "%s: ia_css_stream_set_isp_config_on_pipe failed %d\n",
                         __func__, ret);
-       atomisp_isp_parameters_clean_up(&asd->params.config);
+       memset(&asd->params.config, 0, sizeof(asd->params.config));
 }
 
 int atomisp_css_queue_buffer(struct atomisp_sub_device *asd,
@@ -2264,7 +2206,7 @@ int atomisp_css_stop(struct atomisp_sub_device *asd,
                        ia_css_stream_config_defaults(
                            &stream_env->stream_config);
                }
-               atomisp_isp_parameters_clean_up(&asd->params.config);
+               memset(&asd->params.config, 0, sizeof(asd->params.config));
                asd->params.css_update_params_needed = false;
        }
 
@@ -4215,8 +4157,8 @@ int atomisp_css_wait_acc_finish(struct atomisp_sub_device *asd)
        if (wait_for_completion_interruptible_timeout(&asd->acc.acc_done,
                ATOMISP_ISP_TIMEOUT_DURATION) == 0) {
                dev_err(isp->dev, "<%s: completion timeout\n", __func__);
-               atomisp_css_debug_dump_sp_sw_debug_info();
-               atomisp_css_debug_dump_debug_info(__func__);
+               ia_css_debug_dump_sp_sw_debug_info();
+               ia_css_debug_dump_debug_info(__func__);
                ret = -EIO;
        }
        rt_mutex_lock(&isp->mutex);
index ba8e6aed12de73d616502f7b946bf7ff3e78d7e3..e8b330dacba9c50ceadffe775e95a908e63bf18a 100644 (file)
@@ -155,17 +155,11 @@ void atomisp_css_set_b_gamma_table(struct atomisp_sub_device *asd,
 void atomisp_css_set_anr_thres(struct atomisp_sub_device *asd,
                               struct ia_css_anr_thres *anr_thres);
 
-int atomisp_css_check_firmware_version(struct atomisp_device *isp);
-
 int atomisp_css_load_firmware(struct atomisp_device *isp);
 
-void atomisp_css_unload_firmware(struct atomisp_device *isp);
-
 void atomisp_css_set_dvs_6axis(struct atomisp_sub_device *asd,
                               struct ia_css_dvs_6axis_config *dvs_6axis);
 
-unsigned int atomisp_css_debug_get_dtrace_level(void);
-
 int atomisp_css_debug_dump_isp_binary(void);
 
 int atomisp_css_dump_sp_raw_copy_linecount(bool reduced);
index a2638863206e63f205ec61d69b1db3d20668c20e..24e421e3009dc3100d734d6536b50483f3fa38ef 100644 (file)
@@ -384,9 +384,9 @@ static void atomisp_csi2_configure_isp2401(struct atomisp_sub_device *asd)
        for (n = 0; n < csi2_port_lanes[port] + 1; n++) {
                hrt_address base = csi2_port_base[port] + csi2_lane_base[n];
 
-               atomisp_store_uint32(base + CSI2_REG_RX_CSI_DLY_CNT_TERMEN,
+               atomisp_css2_hw_store_32(base + CSI2_REG_RX_CSI_DLY_CNT_TERMEN,
                                     n == 0 ? clk_termen : dat_termen);
-               atomisp_store_uint32(base + CSI2_REG_RX_CSI_DLY_CNT_SETTLE,
+               atomisp_css2_hw_store_32(base + CSI2_REG_RX_CSI_DLY_CNT_SETTLE,
                                     n == 0 ? clk_settle : dat_settle);
        }
 }
index 4a6ea021ddcc3c5a1cd70f0cbf9dfb36000ac422..f14c7673653c0508164bc5455aa5afd4d515cfbf 100644 (file)
@@ -24,6 +24,7 @@
 #include "atomisp_ioctl.h"
 #include "atomisp_drvfs.h"
 #include "hmm/hmm.h"
+#include "ia_css_debug.h"
 
 /*
  * _iunit_debug:
@@ -94,7 +95,7 @@ opt_err:
 
 static ssize_t iunit_dbglvl_show(struct device_driver *drv, char *buf)
 {
-       iunit_debug.dbglvl = atomisp_css_debug_get_dtrace_level();
+       iunit_debug.dbglvl = dbg_level;
        return sprintf(buf, "dtrace level:%u\n", iunit_debug.dbglvl);
 }
 
@@ -106,7 +107,7 @@ static ssize_t iunit_dbglvl_store(struct device_driver *drv, const char *buf,
            || iunit_debug.dbglvl > 9) {
                return -ERANGE;
        }
-       atomisp_css_debug_set_dtrace_level(iunit_debug.dbglvl);
+       ia_css_debug_set_dtrace_level(iunit_debug.dbglvl);
 
        return size;
 }
index 1588e84a6b91996906050a72ac51529dc839b454..3e5806403b31f48cf25644116be507570ef1ae47 100644 (file)
@@ -997,7 +997,7 @@ subdev_uninit:
        atomisp_css_uninit(isp);
 
        if (defer_fw_load) {
-               atomisp_css_unload_firmware(isp);
+               ia_css_unload_firmware();
                isp->css_env.isp_css_fw.data = NULL;
                isp->css_env.isp_css_fw.bytes = 0;
        }
index 765e1a8c31fa8945bdb95f21a4bd7d80e417af4c..d02c500d53b74163758a17d269502eb6afe3214c 100644 (file)
@@ -1619,9 +1619,9 @@ static void atomisp_dma_burst_len_cfg(struct atomisp_sub_device *asd)
                                       ATOMISP_SUBDEV_PAD_SINK);
 
        if (sink->width * sink->height >= 4096 * 3072)
-               atomisp_store_uint32(DMA_BURST_SIZE_REG, 0x7F);
+               atomisp_css2_hw_store_32(DMA_BURST_SIZE_REG, 0x7F);
        else
-               atomisp_store_uint32(DMA_BURST_SIZE_REG, 0x00);
+               atomisp_css2_hw_store_32(DMA_BURST_SIZE_REG, 0x00);
 }
 
 /*
index 22206d192362284634649a3469a38ea0dd3356b1..24b3748fee4a54f26e67654f0abd1b621474f716 100644 (file)
@@ -42,6 +42,8 @@
 #include "hmm/hmm.h"
 #include "atomisp_trace_event.h"
 
+#include "sh_css_firmware.h"
+
 #include "device_access.h"
 
 /* Timeouts to wait for all subdevs to be registered */
@@ -657,7 +659,7 @@ static int __maybe_unused atomisp_restore_iunit_reg(struct atomisp_device *isp)
         * which has bugs(like sighting:4567697 and 4567699) and
         * will be removed in B0
         */
-       atomisp_store_uint32(MRFLD_CSI_RECEIVER_SELECTION_REG, 1);
+       atomisp_css2_hw_store_32(MRFLD_CSI_RECEIVER_SELECTION_REG, 1);
        return 0;
 }
 
@@ -687,7 +689,7 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp)
        if (!(irq & (1 << INTR_IIR)))
                goto done;
 
-       atomisp_store_uint32(MRFLD_INTR_CLEAR_REG, 0xFFFFFFFF);
+       atomisp_css2_hw_store_32(MRFLD_INTR_CLEAR_REG, 0xFFFFFFFF);
        atomisp_load_uint32(MRFLD_INTR_STATUS_REG, &irq);
        if (irq != 0) {
                dev_err(isp->dev,
@@ -702,7 +704,7 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp)
 
                pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq);
                if (!(irq & (1 << INTR_IIR))) {
-                       atomisp_store_uint32(MRFLD_INTR_ENABLE_REG, 0x0);
+                       atomisp_css2_hw_store_32(MRFLD_INTR_ENABLE_REG, 0x0);
                        goto done;
                }
                dev_err(isp->dev,
@@ -1757,7 +1759,8 @@ static int atomisp_pci_probe(struct pci_dev *dev,
                        goto load_fw_fail;
                }
 
-               err = atomisp_css_check_firmware_version(isp);
+               err = sh_css_check_firmware_version(isp->dev,
+                                                   isp->firmware->data);
                if (err) {
                        dev_dbg(&dev->dev, "Firmware version check failed\n");
                        goto fw_validation_fail;
@@ -1786,7 +1789,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
         * bugs(like sighting:4567697 and 4567699) and will be removed
         * in B0
         */
-       atomisp_store_uint32(MRFLD_CSI_RECEIVER_SELECTION_REG, 1);
+       atomisp_css2_hw_store_32(MRFLD_CSI_RECEIVER_SELECTION_REG, 1);
 
        if ((id->device & ATOMISP_PCI_DEVICE_SOC_MASK) ==
            ATOMISP_PCI_DEVICE_SOC_MRFLD) {
@@ -1937,7 +1940,7 @@ static void atomisp_pci_remove(struct pci_dev *dev)
 
        atomisp_acc_cleanup(isp);
 
-       atomisp_css_unload_firmware(isp);
+       ia_css_unload_firmware();
        hmm_cleanup();
 
        pm_runtime_forbid(&dev->dev);
index 0f55978ad2bdc2f49a912f6cf9c4dc29f61f385d..2e5ce822f55b851b0e80718c6c0f255dbfc5cd25 100644 (file)
@@ -62,7 +62,7 @@ static unsigned int sh_get_pd_base(struct isp_mmu *mmu,
  */
 static void sh_tlb_flush(struct isp_mmu *mmu)
 {
-       atomisp_css_mmu_invalidate_cache();
+       ia_css_mmu_invalidate_cache();
 }
 
 struct isp_mmu_client sh_mmu_mrfld = {
index ee23d28b1bef9fd2de21b1f7c1b1cb6546dfd848..ddeb953a93cf2a28d9cc28ee18719065fd897bc6 100644 (file)
@@ -203,7 +203,7 @@ sh_css_check_firmware_version(struct device *dev, const char *fw_data)
        }
 
        /* For now, let's just accept a wrong version, even if wrong */
-       return true;
+       return 0;
 }
 
 enum ia_css_err
@@ -212,7 +212,7 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,
        unsigned int i;
        struct ia_css_fw_info *binaries;
        struct sh_css_fw_bi_file_h *file_header;
-       bool valid_firmware = false;
+       int ret;
        const char *release_version;
 
        if (!atomisp_hw_is_isp2401)
@@ -224,8 +224,8 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,
        file_header = &firmware_header->file_header;
        binaries = &firmware_header->binary_header;
        strscpy(FW_rel_ver_name, file_header->version, min(sizeof(FW_rel_ver_name), sizeof(file_header->version)));
-       valid_firmware = sh_css_check_firmware_version(dev, fw_data);
-       if (!valid_firmware) {
+       ret = sh_css_check_firmware_version(dev, fw_data);
+       if (ret) {
                IA_CSS_ERROR("CSS code version (%s) and firmware version (%s) mismatch!",
                             file_header->version, release_version);
                return IA_CSS_ERR_VERSION_MISMATCH;