More atomisp fixes and cleanups
Subsystems (4)
cover More atomisp fixes and cleanups
Most of the code here is meant to make the IRQ handling code clearer, and the ISP frequency setting (DFS).
There's a fix there at the DFS setting: right now, if the sensor doesn't provide the number of frames per second, DFS is kept on its minimal value, with will likely fail. The logic at patch 13 changes it to default to the maximum value. While this will drain more power, the camera should be able to work.
Mauro Carvalho Chehab (15):
media: atomisp: improve IRQ handling debug messages
media: atomisp: do some cleanup at irq_local.h
media: atomisp: get rid of a duplicated file
media: atomisp: get rid of ifdef nonsense
media: atomisp: simplify IRQ ifdef logic
media: atomisp: remove some unused defines from *mamoiada_params.h
media: atomisp: use just one mamoiada_params.h
media: atomisp: get rid of a detection hack for a BYT Andorid-based
tablet
media: atomisp: don't set hpll_freq twice with different values
media: atomisp: use macros from intel-family.h
media: atomisp: change the detection of ISP2401 at runtime
media: atomisp: use different dfs failed messages
media: atomisp: set DFS to MAX if sensor doesn't report fps
media: atomisp: use strscpy() instead of less secure variants
media: atomisp: get rid of a string_support.h abstraction layer
.../media/atomisp/include/linux/atomisp.h | 3 -
.../atomisp/include/linux/atomisp_platform.h | 21 +-
.../staging/media/atomisp/pci/atomisp_cmd.c | 71 +++---
.../media/atomisp/pci/atomisp_common.h | 4 -
.../media/atomisp/pci/atomisp_compat_css20.c | 14 +-
.../staging/media/atomisp/pci/atomisp_file.c | 2 +-
.../media/atomisp/pci/atomisp_gmin_platform.c | 2 +-
.../staging/media/atomisp/pci/atomisp_ioctl.c | 46 ++--
.../media/atomisp/pci/atomisp_subdev.c | 2 +-
.../staging/media/atomisp/pci/atomisp_tpg.c | 2 +-
.../media/atomisp/pci/atomisp_trace_event.h | 6 +-
.../staging/media/atomisp/pci/atomisp_v4l2.c | 110 +++------
.../pci/camera/pipe/src/pipe_binarydesc.c | 4 +-
.../hrt/isp2400_mamoiada_params.h | 229 ------------------
.../pci/hive_isp_css_2401_irq_types_hrt.h | 69 ------
.../pci/hive_isp_css_common/host/irq.c | 29 +--
.../pci/hive_isp_css_common/host/irq_local.h | 17 +-
.../pci/hive_isp_css_common/irq_global.h | 10 +-
.../pci/hive_isp_css_common/isp_global.h | 12 +-
.../pci/hive_isp_css_common/sp_global.h | 10 -
.../hive_isp_css_include/host/irq_public.h | 16 +-
.../pci/hive_isp_css_include/string_support.h | 165 -------------
...sp_css_irq_types_hrt.h => irq_types_hrt.h} | 0
.../ctc/ctc_1.0/ia_css_ctc_table.host.c | 3 +-
.../kernels/gc/gc_1.0/ia_css_gc_table.host.c | 3 +-
.../kernels/gc/gc_2/ia_css_gc2_table.host.c | 3 +-
.../xnr/xnr_1.0/ia_css_xnr_table.host.c | 3 +-
.../atomisp/pci/isp2400_input_system_local.h | 15 +-
.../media/atomisp/pci/isp2400_system_global.h | 31 ---
.../media/atomisp/pci/isp2400_system_local.h | 8 -
.../media/atomisp/pci/isp2401_system_global.h | 31 ---
.../media/atomisp/pci/isp2401_system_local.h | 8 -
...01_mamoiada_params.h => mamoiada_params.h} | 20 +-
.../atomisp/pci/runtime/binary/src/binary.c | 4 +-
.../pci/runtime/debug/src/ia_css_debug.c | 65 ++---
.../pci/runtime/isys/src/virtual_isys.c | 29 +--
.../tagger/interface/ia_css_tagger_common.h | 4 -
drivers/staging/media/atomisp/pci/sh_css.c | 50 ++--
.../media/atomisp/pci/sh_css_firmware.c | 6 +-
.../media/atomisp/pci/sh_css_internal.h | 10 -
.../staging/media/atomisp/pci/sh_css_mipi.c | 8 +-
.../staging/media/atomisp/pci/sh_css_params.c | 22 +-
drivers/staging/media/atomisp/pci/sh_css_sp.c | 5 +-
.../media/atomisp/pci/sh_css_version.c | 5 +-
44 files changed, 247 insertions(+), 930 deletions(-)
delete mode 100644 drivers/staging/media/atomisp/pci/css_2400_system/hrt/isp2400_mamoiada_params.h
delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_2401_irq_types_hrt.h
delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/string_support.h
rename drivers/staging/media/atomisp/pci/{css_2400_system/hrt/hive_isp_css_irq_types_hrt.h => irq_types_hrt.h} (100%)
rename drivers/staging/media/atomisp/pci/{isp2401_mamoiada_params.h => mamoiada_params.h} (91%)Signature · 1 line
2.26.2
PATCH 1/15 media: atomisp: improve IRQ handling debug messages
When an IRQ is not handled, it is nice to know what's the reason.
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +6 -5
@@ -566,7 +566,7 @@ irqreturn_t atomisp_isr(int irq, void *dev)if (irq_infos &IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF ) {dev_dbg_ratelimited (isp->dev, -"irq:0x%x (IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF)\n" , +"irq:0x%x (SOF)\n" , irq_infos); irq_infos &= ~IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF ; }
@@ -591,14 +591,14 @@ irqreturn_t atomisp_isr(int irq, void *dev)/* EOF Event does not have the css_pipe returned */ asd =__get_asd_from_port (isp, eof_event.event.port);if (!asd) { -dev_err (isp->dev,"%s:no subdev.event:%d" , +dev_err (isp->dev,"%s: ISYS event, but no subdev.event:%d" , __func__, eof_event.event.type);continue ; }atomisp_eof_event (asd, eof_event.event.exp_id);dev_dbg_ratelimited (isp->dev, -"%s EOF exp_id %d, asd %d\n" , +"%s ISYS event: EOF exp_id %d, asd %d\n" , __func__, eof_event.event.exp_id, asd->index); }
@@ -610,7 +610,7 @@ irqreturn_t atomisp_isr(int irq, void *dev)spin_unlock_irqrestore (&isp->lock, flags); -dev_dbg_ratelimited (isp->dev,"irq:0x%x\n" , irq_infos); +dev_dbg_ratelimited (isp->dev,"irq:0x%x (unhandled)\n" , irq_infos);return IRQ_WAKE_THREAD ;
@@ -618,7 +618,8 @@ irqreturn_t atomisp_isr(int irq, void *dev)spin_unlock_irqrestore (&isp->lock, flags);if (irq_infos) -dev_dbg_ratelimited (isp->dev,"irq:0x%x\n" , irq_infos); +dev_dbg_ratelimited (isp->dev,"irq:0x%x (ignored, as not streaming anymore)\n" , + irq_infos);return IRQ_HANDLED ; }
Signature · 1 line
2.26.2
PATCH 2/15 media: atomisp: do some cleanup at irq_local.h
In reply to Mauro Carvalho Chehab- Get rid of typedefs;
- Get rid of a duplicated enum type with different names for ISP2400 and ISP2401;
- adjust indentation on the touched code.
--- .../pci/hive_isp_css_common/host/irq.c | 29 +++++++++---------- .../pci/hive_isp_css_common/host/irq_local.h | 17 +++-------- .../hive_isp_css_include/host/irq_public.h | 16 +++++----- .../pci/runtime/debug/src/ia_css_debug.c | 2 +- drivers/staging/media/atomisp/pci/sh_css.c | 10 +++---- 5 files changed, 30 insertions(+), 44 deletions(-)
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq.c +13 -16
@@ -29,9 +29,8 @@ static inline void irq_wait_for_write_complete(static inline bool any_irq_channel_enabled (const irq_ID_t ID ); -static inline irq_ID_t virq_get_irq_id ( -const virq_id_t irq_ID, -unsigned int *channel_ID); +static inline irq_ID_t virq_get_irq_id (const enum virq_id irq_ID, +unsigned int *channel_ID);#ifndef __INLINE_IRQ__#include "irq_private.h"
@@ -52,7 +51,7 @@ static unsigned short IRQ_N_ID_OFFSET[N_IRQ_ID + 1] = {IRQ_END_OFFSET }; -static virq_id_t IRQ_NESTING_ID [N_IRQ_ID ] = { +static enum virq_id IRQ_NESTING_ID [N_IRQ_ID ] = { N_virq_id, virq_ifmt, virq_isys,
@@ -228,9 +227,8 @@ void irq_raise(return ; } -void irq_controller_get_state ( -const irq_ID_t ID , -irq_controller_state_t *state) +void irq_controller_get_state (const irq_ID_t ID , +struct irq_controller_state *state) {assert (ID <N_IRQ_ID );assert (state);
@@ -257,7 +255,7 @@ bool any_virq_signal(void) }void cnd_virq_enable_channel ( -const virq_id_t irq_ID, +const enum virq_id irq_ID,const bool en) {irq_ID_t i;
@@ -297,8 +295,8 @@ void virq_clear_all(void)return ; } -enum hrt_isp_css_irq_status virq_get_channel_signals ( -virq_info_t *irq_info) +enum hrt_isp_css_irq_status +virq_get_channel_signals (struct virq_info *irq_info) {enum hrt_isp_css_irq_status irq_status = hrt_isp_css_irq_status_error;irq_ID_t ID ;
@@ -327,8 +325,7 @@ enum hrt_isp_css_irq_status virq_get_channel_signals(return irq_status; } -void virq_clear_info ( -virq_info_t *irq_info) +void virq_clear_info (struct virq_info *irq_info) {irq_ID_t ID ;
@@ -341,7 +338,7 @@ void virq_clear_info( }enum hrt_isp_css_irq_status virq_get_channel_id ( -virq_id_t *irq_id) +enum virq_id *irq_id) {unsigned int irq_status =irq_reg_load (IRQ0_ID , _HRT_IRQ_CONTROLLER_STATUS_REG_IDX);
@@ -368,7 +365,7 @@ enum hrt_isp_css_irq_status virq_get_channel_id(/* Check whether we have an IRQ on one of the nested devices */ for (ID =N_IRQ_ID -1 ;ID > (irq_ID_t )0 ;ID --) { -if (IRQ_NESTING_ID [ID ] == (virq_id_t )idx) { +if (IRQ_NESTING_ID [ID ] == (enum virq_id )idx) {break ; } }
@@ -405,7 +402,7 @@ enum hrt_isp_css_irq_status virq_get_channel_id( idx +=IRQ_N_ID_OFFSET [ID ];if (irq_id) - *irq_id = (virq_id_t )idx; + *irq_id = (enum virq_id )idx;return status; }
@@ -433,7 +430,7 @@ static inline bool any_irq_channel_enabled( }static inline irq_ID_t virq_get_irq_id ( -const virq_id_t irq_ID, +const enum virq_id irq_ID,unsigned int *channel_ID) {irq_ID_t ID ;
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq_local.h +4 -13
@@ -43,10 +43,7 @@#define IRQ2_ID_N_CHANNEL HIVE_ISYS_IRQ_NUM_BITS#define IRQ3_ID_N_CHANNEL HIVE_ISEL_IRQ_NUM_IRQS -typedef struct virq_info_s virq_info_t ; -typedef struct irq_controller_state_s irq_controller_state_t ; - -typedef enum { +enum virq_id { virq_gpio_pin_0 =IRQ0_ID_OFFSET +HIVE_GP_DEV_IRQ_GPIO_PIN_0_BIT_ID , virq_gpio_pin_1 =IRQ0_ID_OFFSET +HIVE_GP_DEV_IRQ_GPIO_PIN_1_BIT_ID , virq_gpio_pin_2 =IRQ0_ID_OFFSET +HIVE_GP_DEV_IRQ_GPIO_PIN_2_BIT_ID ,
@@ -67,13 +64,7 @@ typedef enum { virq_sp_stream_mon =IRQ0_ID_OFFSET +HIVE_GP_DEV_IRQ_SP_STREAM_MON_BIT_ID , virq_isp_stream_mon =IRQ0_ID_OFFSET +HIVE_GP_DEV_IRQ_ISP_STREAM_MON_BIT_ID , virq_mod_stream_mon =IRQ0_ID_OFFSET +HIVE_GP_DEV_IRQ_MOD_STREAM_MON_BIT_ID , -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM) virq_isp_pmem_error =IRQ0_ID_OFFSET +HIVE_GP_DEV_IRQ_ISP_PMEM_ERROR_BIT_ID , -#elif defined(IS_ISP_2401_MAMOIADA_SYSTEM) - virq_isys_2401 = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_PMEM_ERROR_BIT_ID, -#else -#error "irq_local.h: 2400_SYSTEM must be one of {2400, 2401 }" -#endif virq_isp_bamem_error =IRQ0_ID_OFFSET +HIVE_GP_DEV_IRQ_ISP_BAMEM_ERROR_BIT_ID , virq_isp_dmem_error =IRQ0_ID_OFFSET +HIVE_GP_DEV_IRQ_ISP_DMEM_ERROR_BIT_ID , virq_sp_icache_mem_error = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_SP_ICACHE_MEM_ERROR_BIT_ID,
@@ -118,13 +109,13 @@ typedef enum { virq_isel_eol =IRQ3_ID_OFFSET +HIVE_ISEL_IRQ_SYNC_GEN_EOL_BIT_ID , N_virq_id =IRQ_END_OFFSET -} virq_id_t; +}; -struct virq_info_s { +struct virq_info {hrt_data irq_status_reg[N_IRQ_ID ]; }; -struct irq_controller_state_s { +struct irq_controller_state {unsigned int irq_edge;unsigned int irq_mask;unsigned int irq_status;
drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h +7 -9
@@ -26,9 +26,8 @@\return none, state = IRQ[ID].state */ -void irq_controller_get_state ( -const irq_ID_t ID , -irq_controller_state_t *state); +void irq_controller_get_state (const irq_ID_t ID , +struct irq_controller_state *state);/*! Write to a control register of IRQ[ID]
@@ -137,7 +136,7 @@ bool any_virq_signal(void);\return none, VIRQ.channel[irq_ID].enable = en */ void cnd_virq_enable_channel ( -const virq_id_t irq_ID, +const enum virq_id irq_ID,const bool en);/*! Clear the state of all IRQ channels of the virtual super IRQ
@@ -152,8 +151,7 @@ void virq_clear_all(void);\return none */ -void virq_clear_info ( -virq_info_t *irq_info); +void virq_clear_info (struct virq_info *irq_info);/*! Return the ID of a signalling IRQ channel of the virtual super IRQ
@@ -166,7 +164,7 @@ void virq_clear_info(\return state(IRQ[...]) */ enum hrt_isp_css_irq_status virq_get_channel_id ( -virq_id_t *irq_id); +enum virq_id *irq_id);/*! Return the IDs of all signaling IRQ channels of the virtual super IRQ
@@ -179,7 +177,7 @@ enum hrt_isp_css_irq_status virq_get_channel_id(\return (error(state(IRQ[...])) */ -enum hrt_isp_css_irq_status virq_get_channel_signals ( -virq_info_t *irq_info); +enum hrt_isp_css_irq_status +virq_get_channel_signals (struct virq_info *irq_info);#endif /* __IRQ_PUBLIC_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +1 -1
@@ -2228,7 +2228,7 @@ void ia_css_debug_dump_debug_info(const char *context)ia_css_debug_dump_isys_state (); { -irq_controller_state_t state; +struct irq_controller_state state;irq_controller_get_state (IRQ2_ID , &state);
drivers/staging/media/atomisp/pci/sh_css.c +5 -5
@@ -1546,16 +1546,16 @@ enable_interrupts(enum ia_css_irq_type irq_type)/* Enable SW interrupt 0, this is used to signal ISYS events */ cnd_virq_enable_channel ( - (virq_id_t)(IRQ_SW_CHANNEL0_ID +IRQ_SW_CHANNEL_OFFSET ), + (enum virq_id )(IRQ_SW_CHANNEL0_ID +IRQ_SW_CHANNEL_OFFSET ), true);/* Enable SW interrupt 1, this is used to signal PSYS events */ cnd_virq_enable_channel ( - (virq_id_t)(IRQ_SW_CHANNEL1_ID +IRQ_SW_CHANNEL_OFFSET ), + (enum virq_id )(IRQ_SW_CHANNEL1_ID +IRQ_SW_CHANNEL_OFFSET ), true);#if !defined(HAS_IRQ_MAP_VERSION_2 )/* IRQ_SW_CHANNEL2_ID does not exist on 240x systems */ cnd_virq_enable_channel ( - (virq_id_t)(IRQ_SW_CHANNEL2_ID +IRQ_SW_CHANNEL_OFFSET ), + (enum virq_id )(IRQ_SW_CHANNEL2_ID +IRQ_SW_CHANNEL_OFFSET ), true);virq_clear_all ();#endif
@@ -2549,7 +2549,7 @@ ia_css_uninit(void)int ia_css_irq_translate (unsigned int *irq_infos) { -virq_id_t irq; +enum virq_id irq;enum hrt_isp_css_irq_status status = hrt_isp_css_irq_status_more_irqs;unsigned int infos =0 ;
@@ -2622,7 +2622,7 @@ int ia_css_irq_enable( enum ia_css_irq_info info, bool enable) { -virq_id_t irq = N_virq_id; +enum virq_id irq = N_virq_id;IA_CSS_ENTER ("info=%d, enable=%d" , info, enable);
Signature · 1 line
2.26.2
PATCH 3/15 media: atomisp: get rid of a duplicated file
In reply to Mauro Carvalho ChehabThe contents of hive_isp_css_2401_irq_types_hrt.h and hive_isp_css_common/irq_global.h are identical, except for one unused enum:
On isp2401, this IRQ line has this name:
hrt_isp_css_irq_is2401 = HIVE_GP_DEV_IRQ_ISP_PMEM_ERROR_BIT_ID,
While the same bit is named as:
hrt_isp_css_irq_isp_pmem_error = HIVE_GP_DEV_IRQ_ISP_PMEM_ERROR_BIT_ID,
At the isp2400 version.
Remove one of them, in order to reduce the code differences between those two versions.
---
.../pci/hive_isp_css_2401_irq_types_hrt.h | 69 -------------------
.../pci/hive_isp_css_common/irq_global.h | 10 +--
...sp_css_irq_types_hrt.h => irq_types_hrt.h} | 0
3 files changed, 1 insertion(+), 78 deletions(-)
delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_2401_irq_types_hrt.h
rename drivers/staging/media/atomisp/pci/{css_2400_system/hrt/hive_isp_css_irq_types_hrt.h => irq_types_hrt.h} (100%)drivers/staging/media/atomisp/pci/hive_isp_css_2401_irq_types_hrt.h deleted +0 -69
@@ -1,69 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* Support for Intel Camera Imaging ISP subsystem. -* Copyright (c) 2015, Intel Corporation. -* -* This program is free software; you can redistribute it and/or modify it -* under the terms and conditions of the GNU General Public License, -* version 2, as published by the Free Software Foundation. -* -* This program is distributed in the hope it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -*/ - -#ifndef _HIVE_ISP_CSS_2401_IRQ_TYPES_HRT_H_ -#define _HIVE_ISP_CSS_2401_IRQ_TYPES_HRT_H_ - -/* -* These are the indices of each interrupt in the interrupt -* controller's registers. these can be used as the irq_id -* argument to the hrt functions irq_controller.h. -* -* The definitions are taken from <system>_defs.h -*/ -typedef enum hrt_isp_css_irq { - hrt_isp_css_irq_gpio_pin_0 =HIVE_GP_DEV_IRQ_GPIO_PIN_0_BIT_ID , - hrt_isp_css_irq_gpio_pin_1 =HIVE_GP_DEV_IRQ_GPIO_PIN_1_BIT_ID , - hrt_isp_css_irq_gpio_pin_2 =HIVE_GP_DEV_IRQ_GPIO_PIN_2_BIT_ID , - hrt_isp_css_irq_gpio_pin_3 =HIVE_GP_DEV_IRQ_GPIO_PIN_3_BIT_ID , - hrt_isp_css_irq_gpio_pin_4 =HIVE_GP_DEV_IRQ_GPIO_PIN_4_BIT_ID , - hrt_isp_css_irq_gpio_pin_5 =HIVE_GP_DEV_IRQ_GPIO_PIN_5_BIT_ID , - hrt_isp_css_irq_gpio_pin_6 =HIVE_GP_DEV_IRQ_GPIO_PIN_6_BIT_ID , - hrt_isp_css_irq_gpio_pin_7 =HIVE_GP_DEV_IRQ_GPIO_PIN_7_BIT_ID , - hrt_isp_css_irq_gpio_pin_8 =HIVE_GP_DEV_IRQ_GPIO_PIN_8_BIT_ID , - hrt_isp_css_irq_gpio_pin_9 =HIVE_GP_DEV_IRQ_GPIO_PIN_9_BIT_ID , - hrt_isp_css_irq_gpio_pin_10 =HIVE_GP_DEV_IRQ_GPIO_PIN_10_BIT_ID , - hrt_isp_css_irq_gpio_pin_11 =HIVE_GP_DEV_IRQ_GPIO_PIN_11_BIT_ID , - hrt_isp_css_irq_sp =HIVE_GP_DEV_IRQ_SP_BIT_ID , - hrt_isp_css_irq_isp =HIVE_GP_DEV_IRQ_ISP_BIT_ID , - hrt_isp_css_irq_isys =HIVE_GP_DEV_IRQ_ISYS_BIT_ID , - hrt_isp_css_irq_isel =HIVE_GP_DEV_IRQ_ISEL_BIT_ID , - hrt_isp_css_irq_ifmt =HIVE_GP_DEV_IRQ_IFMT_BIT_ID , - hrt_isp_css_irq_sp_stream_mon =HIVE_GP_DEV_IRQ_SP_STREAM_MON_BIT_ID , - hrt_isp_css_irq_isp_stream_mon =HIVE_GP_DEV_IRQ_ISP_STREAM_MON_BIT_ID , - hrt_isp_css_irq_mod_stream_mon =HIVE_GP_DEV_IRQ_MOD_STREAM_MON_BIT_ID , - hrt_isp_css_irq_is2401 =HIVE_GP_DEV_IRQ_ISP_PMEM_ERROR_BIT_ID , - hrt_isp_css_irq_isp_bamem_error =HIVE_GP_DEV_IRQ_ISP_BAMEM_ERROR_BIT_ID , - hrt_isp_css_irq_isp_dmem_error =HIVE_GP_DEV_IRQ_ISP_DMEM_ERROR_BIT_ID , - hrt_isp_css_irq_sp_icache_mem_error =HIVE_GP_DEV_IRQ_SP_ICACHE_MEM_ERROR_BIT_ID , - hrt_isp_css_irq_sp_dmem_error =HIVE_GP_DEV_IRQ_SP_DMEM_ERROR_BIT_ID , - hrt_isp_css_irq_mmu_cache_mem_error =HIVE_GP_DEV_IRQ_MMU_CACHE_MEM_ERROR_BIT_ID , - hrt_isp_css_irq_gp_timer_0 =HIVE_GP_DEV_IRQ_GP_TIMER_0_BIT_ID , - hrt_isp_css_irq_gp_timer_1 =HIVE_GP_DEV_IRQ_GP_TIMER_1_BIT_ID , - hrt_isp_css_irq_sw_pin_0 =HIVE_GP_DEV_IRQ_SW_PIN_0_BIT_ID , - hrt_isp_css_irq_sw_pin_1 =HIVE_GP_DEV_IRQ_SW_PIN_1_BIT_ID , - hrt_isp_css_irq_dma =HIVE_GP_DEV_IRQ_DMA_BIT_ID , - hrt_isp_css_irq_sp_stream_mon_b =HIVE_GP_DEV_IRQ_SP_STREAM_MON_B_BIT_ID , -/* this must (obviously) be the last on in the enum */ - hrt_isp_css_irq_num_irqs -}hrt_isp_css_irq_t ; - -typedef enum hrt_isp_css_irq_status { - hrt_isp_css_irq_status_error, - hrt_isp_css_irq_status_more_irqs, - hrt_isp_css_irq_status_success -}hrt_isp_css_irq_status_t ; - -#endif /* _HIVE_ISP_CSS_2401_IRQ_TYPES_HRT_H_ */
drivers/staging/media/atomisp/pci/hive_isp_css_common/irq_global.h +1 -9
@@ -23,15 +23,7 @@/* We cannot include the (hrt host ID) file defining the "CSS_RECEIVER" property without side effects */ #ifndef HAS_NO_RX -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM ) -/*#define CSS_RECEIVER testbench_isp_inp_sys_csi_receiver*/ -#include "hive_isp_css_irq_types_hrt.h" /* enum hrt_isp_css_irq */ -#elif defined(IS_ISP_2401_MAMOIADA_SYSTEM ) -/*#define CSS_RECEIVER testbench_isp_is_2400_inp_sys_csi_receiver*/ -#include "hive_isp_css_2401_irq_types_hrt.h" /* enum hrt_isp_css_irq */ -#else -#error "irq_global.h: 2400_SYSTEM must be one of {2400, 2401 }" -#endif +#include "irq_types_hrt.h" #endif /* The IRQ is not mapped uniformly on its related interfaces */
drivers/staging/media/atomisp/pci/irq_types_hrt.h renamed from drivers/staging/media/atomisp/pci/css_2400_system/hrt/hive_isp_css_irq_types_hrt.h +0 -0
Signature · 1 line
2.26.2
PATCH 4/15 media: atomisp: get rid of ifdef nonsense
In reply to Mauro Carvalho ChehabThere are some ifdefs there that end doing the same thing. Get rid of them.
--- .../atomisp/pci/isp2400_input_system_local.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/staging/media/atomisp/pci/isp2400_input_system_local.h +7 -8
@@ -21,15 +21,14 @@#include "input_system_global.h" #include "input_system_defs.h" /* HIVE_ISYS_GPREG_MULTICAST_A_IDX,... */ -#include "css_receiver_2400_defs.h" /* _HRT_CSS_RECEIVER_2400_TWO_PIXEL_EN_REG_IDX, _HRT_CSS_RECEIVER_2400_CSI2_FUNC_PROG_REG_IDX,... */ -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM ) + +/* +* _HRT_CSS_RECEIVER_2400_TWO_PIXEL_EN_REG_IDX, * _HRT_CSS_RECEIVER_2400_CSI2_FUNC_PROG_REG_IDX,... +*/ +#include "css_receiver_2400_defs.h" +#include "isp_capture_defs.h" -#elif defined(IS_ISP_2401_MAMOIADA_SYSTEM ) -/* Same name, but keep the distinction,it is a different device */ -#include "isp_capture_defs.h" -#else -#error "input_system_local.h: 2400_SYSTEM must be one of {2400, 2401 }" -#endif +#include "isp_acquisition_defs.h" #include "input_system_ctrl_defs.h"
Signature · 1 line
2.26.2
PATCH 5/15 media: atomisp: simplify IRQ ifdef logic
In reply to Mauro Carvalho ChehabThere are lots of mess with IRQ ifdef settings. As the *_global.h will already detect the type of IRQ system at compile time, we can get rid of them, replacing by just one ifdef for ISP2401.
--- .../pci/hive_isp_css_common/isp_global.h | 10 ++---- .../pci/hive_isp_css_common/sp_global.h | 10 ------ .../media/atomisp/pci/isp2400_system_global.h | 31 ------------------- .../media/atomisp/pci/isp2400_system_local.h | 8 ----- .../media/atomisp/pci/isp2401_system_global.h | 31 ------------------- .../media/atomisp/pci/isp2401_system_local.h | 8 ----- .../pci/runtime/debug/src/ia_css_debug.c | 10 ------ .../tagger/interface/ia_css_tagger_common.h | 4 --- .../media/atomisp/pci/sh_css_internal.h | 10 ------ 9 files changed, 2 insertions(+), 120 deletions(-)
drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h +2 -8
@@ -18,16 +18,10 @@#include <system_local.h> -#if defined(HAS_ISP_2401_MAMOIADA ) -#define IS_ISP_2401_MAMOIADA - +#ifdef ISP2401 #include "isp2401_mamoiada_params.h" -#elif defined(HAS_ISP_2400_MAMOIADA ) -#define IS_ISP_2400_MAMOIADA - +#else #include "isp2400_mamoiada_params.h" -#else -#error "isp_global_h: ISP_2400_MAMOIDA must be one of {2400, 2401 }"#endif #define ISP_PMEM_WIDTH_LOG2 ISP_LOG2_PMEM_WIDTH
drivers/staging/media/atomisp/pci/hive_isp_css_common/sp_global.h +0 -10
@@ -18,17 +18,7 @@#include <system_local.h> -#if defined(HAS_SP_2401 ) -#define IS_SP_2401 -/* 2401 uses 2400 */ #include <scalar_processor_2400_params.h> -#elif defined(HAS_SP_2400 ) -#define IS_SP_2400 - -#include <scalar_processor_2400_params.h> -#else -#error "sp_global.h: SP_2400 must be one of {2400, 2401 }" -#endif #define SP_PMEM_WIDTH_LOG2 SP_PMEM_LOG_WIDTH_BITS#define SP_PMEM_SIZE SP_PMEM_DEPTH
drivers/staging/media/atomisp/pci/isp2400_system_global.h +0 -31
@@ -47,27 +47,6 @@* N.B. the 3 input formatters are of 2 different classess */ -/* -* Since this file is visible everywhere and the system definition -* macros are not, detect the separate definitions for {host, SP, ISP} -* -* The 2401 system has the nice property that it uses a vanilla 2400 SP -* so the SP will believe it is a 2400 system rather than 2401... -*/ -//#if defined(SYSTEM_hive_isp_css_2401_system) || defined(__isp2401_mamoiada) || defined(__scalar_processor_2401) -#if defined(SYSTEM_hive_isp_css_2401_system) || defined(__isp2401_mamoiada) -#define IS_ISP_2401_MAMOIADA_SYSTEM -#define HAS_ISP_2401_MAMOIADA -#define HAS_SP_2400 -//#elif defined(SYSTEM_hive_isp_css_2400_system) || defined(__isp2400_mamoiada) || defined(__scalar_processor_2400) -#elif defined(SYSTEM_hive_isp_css_2400_system) || defined(__isp2400_mamoiada) -#define IS_ISP_2400_MAMOIADA_SYSTEM -#define HAS_ISP_2400_MAMOIADA -#define HAS_SP_2400 -#else -#error "system_global.h: 2400_SYSTEM must be one of {2400, 2401 }" -#endif -#define USE_INPUT_SYSTEM_VERSION_2 #define HAS_MMU_VERSION_2
@@ -130,21 +109,11 @@ typedef enum {N_SP_ID } sp_ID_t; -#if defined(IS_ISP_2401_MAMOIADA_SYSTEM )typedef enum {MMU0_ID =0 ,MMU1_ID ,N_MMU_ID }mmu_ID_t ; -#elif defined(IS_ISP_2400_MAMOIADA_SYSTEM ) -typedef enum { -MMU0_ID =0 , -MMU1_ID , -N_MMU_ID -}mmu_ID_t ; -#else -#error "system_global.h: SYSTEM must be one of {2400, 2401}" -#endif typedef enum { DMA0_ID = 0,
drivers/staging/media/atomisp/pci/isp2400_system_local.h +0 -8
@@ -82,7 +82,6 @@ static const hrt_address SP_PMEM_BASE[N_SP_ID] = { };/* MMU */ -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM ) || defined(IS_ISP_2401_MAMOIADA_SYSTEM )/* * MMU0_ID: The data MMU * MMU1_ID: The icache MMU
@@ -91,9 +90,6 @@ static const hrt_address MMU_BASE[N_MMU_ID] = { (hrt_address )0x0000000000070000ULL , (hrt_address )0x00000000000A0000ULL }; -#else -#error "system_local.h: SYSTEM must be one of {2400, 2401 }" -#endif /* DMA */ static const hrt_address DMA_BASE[N_DMA_ID] = {
@@ -225,7 +221,6 @@ static const hrt_address SP_PMEM_BASE[N_SP_ID] = { };/* MMU */ -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM ) || defined(IS_ISP_2401_MAMOIADA_SYSTEM )/* * MMU0_ID: The data MMU * MMU1_ID: The icache MMU
@@ -234,9 +229,6 @@ static const hrt_address MMU_BASE[N_MMU_ID] = { (hrt_address )0x00070000UL , (hrt_address )0x000A0000UL }; -#else -#error "system_local.h: SYSTEM must be one of {2400, 2401 }" -#endif /* DMA */ static const hrt_address DMA_BASE[N_DMA_ID] = {
drivers/staging/media/atomisp/pci/isp2401_system_global.h +0 -31
@@ -53,27 +53,6 @@#define USE_INPUT_SYSTEM_VERSION_2401 -/* -* Since this file is visible everywhere and the system definition -* macros are not, detect the separate definitions for {host, SP, ISP} -* -* The 2401 system has the nice property that it uses a vanilla 2400 SP -* so the SP will believe it is a 2400 system rather than 2401... -*/ -/* #if defined(SYSTEM_hive_isp_css_2401_system) || defined(__isp2401_mamoiada) || defined(__scalar_processor_2401) */ -#if defined(SYSTEM_hive_isp_css_2401_system) || defined(__isp2401_mamoiada) -#define IS_ISP_2401_MAMOIADA_SYSTEM -#define HAS_ISP_2401_MAMOIADA -#define HAS_SP_2400 -/* #elif defined(SYSTEM_hive_isp_css_2400_system) || defined(__isp2400_mamoiada) || defined(__scalar_processor_2400)*/ -#elif defined(SYSTEM_hive_isp_css_2400_system) || defined(__isp2400_mamoiada) -#define IS_ISP_2400_MAMOIADA_SYSTEM -#define HAS_ISP_2400_MAMOIADA -#define HAS_SP_2400 -#else -#error "system_global.h: 2400_SYSTEM must be one of {2400, 2401 }" -#endif -#define HAS_MMU_VERSION_2 #define HAS_DMA_VERSION_2 #define HAS_GDC_VERSION_2
@@ -144,21 +123,11 @@ typedef enum {N_SP_ID } sp_ID_t; -#if defined(IS_ISP_2401_MAMOIADA_SYSTEM )typedef enum {MMU0_ID =0 ,MMU1_ID ,N_MMU_ID }mmu_ID_t ; -#elif defined(IS_ISP_2400_MAMOIADA_SYSTEM ) -typedef enum { -MMU0_ID =0 , -MMU1_ID , -N_MMU_ID -}mmu_ID_t ; -#else -#error "system_global.h: SYSTEM must be one of {2400, 2401}" -#endif typedef enum { DMA0_ID = 0,
drivers/staging/media/atomisp/pci/isp2401_system_local.h +0 -8
@@ -76,7 +76,6 @@ static const hrt_address SP_DMEM_BASE[N_SP_ID] = { };/* MMU */ -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM ) || defined(IS_ISP_2401_MAMOIADA_SYSTEM )/* * MMU0_ID: The data MMU * MMU1_ID: The icache MMU
@@ -85,9 +84,6 @@ static const hrt_address MMU_BASE[N_MMU_ID] = {0x0000000000070000ULL ,0x00000000000A0000ULL }; -#else -#error "system_local.h: SYSTEM must be one of {2400, 2401 }" -#endif /* DMA */ static const hrt_address DMA_BASE[N_DMA_ID] = {
@@ -261,7 +257,6 @@ static const hrt_address SP_DMEM_BASE[N_SP_ID] = { };/* MMU */ -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM ) || defined(IS_ISP_2401_MAMOIADA_SYSTEM )/* * MMU0_ID: The data MMU * MMU1_ID: The icache MMU
@@ -270,9 +265,6 @@ static const hrt_address MMU_BASE[N_MMU_ID] = {0x00070000UL ,0x000A0000UL }; -#else -#error "system_local.h: SYSTEM must be one of {2400, 2401 }" -#endif /* DMA */ static const hrt_address DMA_BASE[N_DMA_ID] = {
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +0 -10
@@ -460,7 +460,6 @@ void ia_css_debug_dump_isp_state(void)#endif ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"[2] dma_FIFO stalled" , stall.fifo2); -#if defined(HAS_ISP_2400_MAMOIADA ) || defined(HAS_ISP_2401_MAMOIADA ) || defined(IS_ISP_2500_SYSTEM )ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"[3] gdc0_FIFO stalled" , stall.fifo3);
@@ -472,9 +471,6 @@ void ia_css_debug_dump_isp_state(void)#endif ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"[6] sp_FIFO stalled" , stall.fifo6); -#else -#error "ia_css_debug: ISP cell must be one of {2400_MAMOIADA,, 2401_MAMOIADA, 2500_SKYCAM}" -#endif ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"status & control stalled" , stall.stat_ctrl);
@@ -486,14 +482,12 @@ void ia_css_debug_dump_isp_state(void) stall.vamem1);ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"vamem2 stalled" , stall.vamem2); -#if defined(HAS_ISP_2400_MAMOIADA ) || defined(HAS_ISP_2401_MAMOIADA )ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"vamem3 stalled" , stall.vamem3);ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"hmem stalled" , stall.hmem);ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"pmem stalled" , stall.pmem); -#endif }return ; }
@@ -506,7 +500,6 @@ void ia_css_debug_dump_sp_state(void)sp_get_state (SP0_ID , &state, &stall);debug_print_sp_state (&state,"SP" );if (state.is_stalling) { -#if defined(HAS_SP_2400 ) || defined(IS_ISP_2500_SYSTEM )#if !defined(HAS_NO_INPUT_SYSTEM )ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"isys_FIFO stalled" , stall.fifo0);
@@ -537,9 +530,6 @@ void ia_css_debug_dump_sp_state(void)#endif ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"irq FIFO stalled" , stall.fifoa); -#else -#error "ia_css_debug: SP cell must be one of {SP2400, SP2500}" -#endif ia_css_debug_dtrace (2 ,"\t%-32s: %d\n" ,"dmem stalled" , stall.dmem); ia_css_debug_dtrace(2, "\t%-32s: %d\n",
drivers/staging/media/atomisp/pci/runtime/tagger/interface/ia_css_tagger_common.h +0 -4
@@ -24,11 +24,7 @@* * Should be one less than NUM_CONTINUOUS_FRAMES in sh_css_internal.h */ -#if defined(HAS_SP_2400 )#define MAX_CB_ELEMS_FOR_TAGGER 14 -#else -#define MAX_CB_ELEMS_FOR_TAGGER 9 -#endif /** * @brief Data structure for the tagger buffer element.
drivers/staging/media/atomisp/pci/sh_css_internal.h +0 -10
@@ -76,11 +76,7 @@#define SH_CSS_REF_BIT_DEPTH 8/* keep next up to date with the definition for MAX_CB_ELEMS_FOR_TAGGER in tagger.sp.c */ -#if defined(HAS_SP_2400 )#define NUM_CONTINUOUS_FRAMES 15 -#else -#define NUM_CONTINUOUS_FRAMES 10 -#endif #define NUM_MIPI_FRAMES_PER_STREAM 2#define NUM_ONLINE_INIT_CONTINUOUS_FRAMES 2
@@ -729,15 +725,9 @@ struct sh_css_sp_output {* separate SP thread for this. */ #define IA_CSS_NUM_ELEMS_HOST2SP_ISYS_EVENT_QUEUE (2 * N_CSI_PORTS) -#if defined(HAS_SP_2400 )#define IA_CSS_NUM_ELEMS_HOST2SP_PSYS_EVENT_QUEUE 13#define IA_CSS_NUM_ELEMS_SP2HOST_BUFFER_QUEUE 19#define IA_CSS_NUM_ELEMS_SP2HOST_PSYS_EVENT_QUEUE 26/* holds events for all type of buffers, hence deeper */ -#else -#define IA_CSS_NUM_ELEMS_HOST2SP_PSYS_EVENT_QUEUE 6 -#define IA_CSS_NUM_ELEMS_SP2HOST_BUFFER_QUEUE 6 -#define IA_CSS_NUM_ELEMS_SP2HOST_PSYS_EVENT_QUEUE 6 -#endif struct sh_css_hmm_buffer { union {
Signature · 1 line
2.26.2
PATCH 6/15 media: atomisp: remove some unused defines from *mamoiada_params.h
In reply to Mauro Carvalho ChehabThere are some parameters that are different between isp2400 and isp2401. None of those are actually used.
So, get rid of them.
--- .../hrt/isp2400_mamoiada_params.h | 20 +------------------ .../atomisp/pci/isp2401_mamoiada_params.h | 20 +------------------ 2 files changed, 2 insertions(+), 38 deletions(-)
drivers/staging/media/atomisp/pci/css_2400_system/hrt/isp2400_mamoiada_params.h +1 -19
@@ -16,11 +16,6 @@/* Version */ #define RTL_VERSION -/* Cell name */ -#define ISP_CELL_TYPE isp2400_mamoiada -#define ISP_VMEM simd_vmem -#define _HRT_ISP_VMEM isp2400_mamoiada_simd_vmem -/* instruction pipeline depth */ #define ISP_BRANCHDELAY 5
@@ -154,12 +149,6 @@#define ISP_VEC_ALIGN ISP_VMEM_ALIGN -/* HRT specific vector support */ -#define isp2400_mamoiada_vector_alignment ISP_VEC_ALIGN -#define isp2400_mamoiada_vector_elem_bits ISP_VMEM_ELEMBITS -#define isp2400_mamoiada_vector_elem_precision ISP_VMEM_ELEM_PRECISION -#define isp2400_mamoiada_vector_num_elems ISP_VEC_NELEMS -/* register file sizes */ #define ISP_RF0_SIZE 64#define ISP_RF1_SIZE 16
@@ -173,14 +162,7 @@#define ISP_RF9_SIZE 16#define ISP_RF10_SIZE 16#define ISP_RF11_SIZE 16 -#define ISP_VRF1_SIZE 24 -#define ISP_VRF2_SIZE 24 -#define ISP_VRF3_SIZE 24 -#define ISP_VRF4_SIZE 24 -#define ISP_VRF5_SIZE 24 -#define ISP_VRF6_SIZE 24 -#define ISP_VRF7_SIZE 24 -#define ISP_VRF8_SIZE 24 +#define ISP_SRF1_SIZE 4#define ISP_SRF2_SIZE 64#define ISP_SRF3_SIZE 64
drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h +1 -19
@@ -16,11 +16,6 @@/* Version */ #define RTL_VERSION -/* Cell name */ -#define ISP_CELL_TYPE isp2401_mamoiada -#define ISP_VMEM simd_vmem -#define _HRT_ISP_VMEM isp2401_mamoiada_simd_vmem -/* instruction pipeline depth */ #define ISP_BRANCHDELAY 5
@@ -154,12 +149,6 @@#define ISP_VEC_ALIGN ISP_VMEM_ALIGN -/* HRT specific vector support */ -#define isp2401_mamoiada_vector_alignment ISP_VEC_ALIGN -#define isp2401_mamoiada_vector_elem_bits ISP_VMEM_ELEMBITS -#define isp2401_mamoiada_vector_elem_precision ISP_VMEM_ELEM_PRECISION -#define isp2401_mamoiada_vector_num_elems ISP_VEC_NELEMS -/* register file sizes */ #define ISP_RF0_SIZE 64#define ISP_RF1_SIZE 16
@@ -173,14 +162,7 @@#define ISP_RF9_SIZE 16#define ISP_RF10_SIZE 16#define ISP_RF11_SIZE 16 -#define ISP_VRF1_SIZE 32 -#define ISP_VRF2_SIZE 32 -#define ISP_VRF3_SIZE 32 -#define ISP_VRF4_SIZE 32 -#define ISP_VRF5_SIZE 32 -#define ISP_VRF6_SIZE 32 -#define ISP_VRF7_SIZE 32 -#define ISP_VRF8_SIZE 32 +#define ISP_SRF1_SIZE 4#define ISP_SRF2_SIZE 64#define ISP_SRF3_SIZE 64
Signature · 1 line
2.26.2
PATCH 7/15 media: atomisp: use just one mamoiada_params.h
In reply to Mauro Carvalho ChehabAs both isp2400 and isp2401 files are identical, remove one of them and remove the test for ISP variant.
---
.../pci/hive_isp_css_common/isp_global.h | 6 +-
.../atomisp/pci/isp2401_mamoiada_params.h | 211 ------------------
...00_mamoiada_params.h => mamoiada_params.h} | 0
3 files changed, 1 insertion(+), 216 deletions(-)
delete mode 100644 drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h
rename drivers/staging/media/atomisp/pci/{css_2400_system/hrt/isp2400_mamoiada_params.h => mamoiada_params.h} (100%)drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h +1 -5
@@ -18,11 +18,7 @@#include <system_local.h> -#ifdef ISP2401 -#include "isp2401_mamoiada_params.h" -#else -#include "isp2400_mamoiada_params.h" -#endif +#include "mamoiada_params.h" #define ISP_PMEM_WIDTH_LOG2 ISP_LOG2_PMEM_WIDTH#define ISP_PMEM_SIZE ISP_PMEM_DEPTH
drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h deleted +0 -211
211 lines not on this page · raw message
drivers/staging/media/atomisp/pci/mamoiada_params.h renamed from drivers/staging/media/atomisp/pci/css_2400_system/hrt/isp2400_mamoiada_params.h +0 -0
Signature · 1 line
2.26.2
PATCH 8/15 media: atomisp: get rid of a detection hack for a BYT Andorid-based tablet
In reply to Mauro Carvalho ChehabThere's a hack at the driver that selects a different table for a BYT tablet, which sets the maximum frequency to 320 MHz, instead of 400 MHz.
After looking at the Intel Aero Yocto's version from:
https://download.01.org/aero/deb/pool/main/l/linux-4.4.76-aero-1.3/
It was noticed that this depends on an Android-specific modprobe parameter, which uses a macro (INTEL_MID_BOARD) from this file:
arch/x86/include/asm/spid.h
From the comments there, it looks like this macro parses a variable passed at boot time:
cmdline : androidboot.spid=vend:cust:manu:plat:prod:hard
The devices in question are identified there as:
INTEL_BYT_TABLET_BLK_PRO = 0x0000 INTEL_BYT_TABLET_BLK_ENG = 0x8000
Well, this is something that we don't have upstream. So, without further details about that, we can't really parse it.
If we ever end supporting those devices with the upstream driver, this patch can be reverted and the device can be detected via DMI (or maybe via PCI ID?).
--- .../staging/media/atomisp/pci/atomisp_v4l2.c | 83 ++++--------------- 1 file changed, 18 insertions(+), 65 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +18 -65
@@ -354,60 +354,6 @@ static const struct atomisp_dfs_config dfs_config_byt = { .dfs_table_size = ARRAY_SIZE(dfs_rules_byt), }; -static const struct atomisp_freq_scaling_rule dfs_rules_byt_cr[] = { - { - .width =ISP_FREQ_RULE_ANY , - .height =ISP_FREQ_RULE_ANY , - .fps =ISP_FREQ_RULE_ANY , - .isp_freq =ISP_FREQ_320MHZ , - .run_mode =ATOMISP_RUN_MODE_VIDEO , - }, - { - .width =ISP_FREQ_RULE_ANY , - .height =ISP_FREQ_RULE_ANY , - .fps =ISP_FREQ_RULE_ANY , - .isp_freq =ISP_FREQ_320MHZ , - .run_mode =ATOMISP_RUN_MODE_STILL_CAPTURE , - }, - { - .width =ISP_FREQ_RULE_ANY , - .height =ISP_FREQ_RULE_ANY , - .fps =ISP_FREQ_RULE_ANY , - .isp_freq =ISP_FREQ_320MHZ , - .run_mode =ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE , - }, - { - .width =ISP_FREQ_RULE_ANY , - .height =ISP_FREQ_RULE_ANY , - .fps =ISP_FREQ_RULE_ANY , - .isp_freq =ISP_FREQ_320MHZ , - .run_mode =ATOMISP_RUN_MODE_PREVIEW , - }, - { - .width =ISP_FREQ_RULE_ANY , - .height =ISP_FREQ_RULE_ANY , - .fps =ISP_FREQ_RULE_ANY , - .isp_freq =ISP_FREQ_320MHZ , - .run_mode =ATOMISP_RUN_MODE_SDV , - }, -}; - -#ifdef FIXME -/* -* Disable this, as it is used only when this is true: -* INTEL_MID_BOARD(3, TABLET, BYT, BLK, PRO, CRV2) || -* INTEL_MID_BOARD(3, TABLET, BYT, BLK, ENG, CRV2)) -* However, the original code is commented -*/ -static const struct atomisp_dfs_config dfs_config_byt_cr = { - .lowest_freq =ISP_FREQ_200MHZ , - .max_freq_at_vmin =ISP_FREQ_320MHZ , - .highest_freq =ISP_FREQ_320MHZ , - .dfs_table = dfs_rules_byt_cr, - .dfs_table_size =ARRAY_SIZE (dfs_rules_byt_cr), -}; -#endif -static const struct atomisp_freq_scaling_rule dfs_rules_cht[] = { { .width =ISP_FREQ_RULE_ANY ,
@@ -1696,17 +1642,24 @@ static int atomisp_pci_probe(struct pci_dev *dev, (ATOMISP_HW_REVISION_ISP2400 <<ATOMISP_HW_REVISION_SHIFT ) |ATOMISP_HW_STEPPING_B0 ; -#ifdef FIXME -if (INTEL_MID_BOARD (3 ,TABLET ,BYT ,BLK ,PRO ,CRV2 ) || -INTEL_MID_BOARD (3 ,TABLET ,BYT ,BLK ,ENG ,CRV2 )) { - isp->dfs = &dfs_config_byt_cr; - isp->hpll_freq =HPLL_FREQ_2000MHZ ; - } else -#endif - { - isp->dfs = &dfs_config_byt; - isp->hpll_freq =HPLL_FREQ_1600MHZ ; - } + +/* +* Note: some Intel-based tablets with Android use a different +* DFS table. Based on the comments at the Yocto Aero meta +* version of this driver (at the ssid.h header), they're +* identified via a "spid" var: +* +* androidboot.spid=vend:cust:manu:plat:prod:hard +* +* As we don't have this upstream, nor we know enough details +* to use a DMI or PCI match table, the old code was just +* removed, but let's keep a note here as a reminder that, +* for certain devices, we may need to limit the max DFS +* frequency to be below certain values, adjusting the +* resolution accordingly. +*/ + isp->dfs = &dfs_config_byt; + isp->hpll_freq =HPLL_FREQ_1600MHZ ;/* HPLL frequency is known to be device-specific, but we don't * have specs yet for exactly how it varies. Default to * BYT-CR but let provisioning set it via EFI variable */
Signature · 1 line
2.26.2
PATCH 9/15 media: atomisp: don't set hpll_freq twice with different values
In reply to Mauro Carvalho ChehabThe logic which sets the hpll_freq for BYT sets hpll_freq to 1600MHz, but ignores it, and sets it again after reading from-device-specific EFI vars (this time, using a default of 2000MHz).
Remove the first set, as this will be overriden anyway.
While here, do minor adjustments on comments and on a printk message.
--- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +6 -4
@@ -1659,10 +1659,12 @@ static int atomisp_pci_probe(struct pci_dev *dev,* resolution accordingly. */ isp->dfs = &dfs_config_byt; - isp->hpll_freq =HPLL_FREQ_1600MHZ ; -/* HPLL frequency is known to be device-specific, but we don't + +/* +* HPLL frequency is known to be device-specific, but we don't * have specs yet for exactly how it varies. Default to -* BYT-CR but let provisioning set it via EFI variable */ +* BYT-CR but let provisioning set it via EFI variable +*/ isp->hpll_freq =gmin_get_var_int (&dev->dev, false,"HpllFreq" ,HPLL_FREQ_2000MHZ );
@@ -1714,7 +1716,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,default : isp->hpll_freq =HPLL_FREQ_1600MHZ ;dev_warn (isp->dev, -"read HPLL from cck failed.default 1600MHz.\n" ); +"read HPLL from cck failed. Default to 1600 MHz.\n" ); }break ;default :
Signature · 1 line
2.26.2
PATCH 10/15 media: atomisp: use macros from intel-family.h
In reply to Mauro Carvalho ChehabInstead of hardcoding the intel family values there, use the already defined ones from asm/intel-family.h.
--- .../media/atomisp/include/linux/atomisp_platform.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/include/linux/atomisp_platform.h +6 -4
@@ -18,6 +18,8 @@#ifndef ATOMISP_PLATFORM_H_ #define ATOMISP_PLATFORM_H_ +#include <asm/intel-family.h> +#include <linux/i2c.h> #include <linux/sfi.h> #include <media/v4l2-subdev.h>
@@ -240,9 +242,9 @@ const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void); boot_cpu_data.x86 == 6 && \ boot_cpu_data.x86_model == x) -#define IS_MFLD __IS_SOC(0x27) -#define IS_BYT __IS_SOC(0x37) -#define IS_CHT __IS_SOC(0x4C) -#define IS_MOFD __IS_SOC(0x5A) +#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_MOFD __IS_SOC(INTEL_FAM6_ATOM_AIRMONT_MID)#endif /* ATOMISP_PLATFORM_H_ */
Signature · 1 line
2.26.2
PATCH 11/15 media: atomisp: change the detection of ISP2401 at runtime
In reply to Mauro Carvalho ChehabInstead of having a static var to detect it, let's use the already-existing arch-specific bytes, as this is how other parts of the code also checks when it needs to do something different, depending on an specific chipset version.
--- .../media/atomisp/include/linux/atomisp.h | 3 -- .../atomisp/include/linux/atomisp_platform.h | 11 ++++- .../staging/media/atomisp/pci/atomisp_cmd.c | 48 +++++++++---------- .../media/atomisp/pci/atomisp_common.h | 4 -- .../media/atomisp/pci/atomisp_compat_css20.c | 14 +++--- .../staging/media/atomisp/pci/atomisp_ioctl.c | 28 +++++------ .../media/atomisp/pci/atomisp_subdev.c | 2 +- .../staging/media/atomisp/pci/atomisp_v4l2.c | 17 ++----- .../pci/camera/pipe/src/pipe_binarydesc.c | 4 +- .../atomisp/pci/runtime/binary/src/binary.c | 4 +- .../pci/runtime/debug/src/ia_css_debug.c | 8 ++-- drivers/staging/media/atomisp/pci/sh_css.c | 40 ++++++++-------- .../media/atomisp/pci/sh_css_firmware.c | 4 +- .../staging/media/atomisp/pci/sh_css_mipi.c | 8 ++-- .../staging/media/atomisp/pci/sh_css_params.c | 22 ++++----- drivers/staging/media/atomisp/pci/sh_css_sp.c | 2 +- .../media/atomisp/pci/sh_css_version.c | 3 +- 17 files changed, 108 insertions(+), 114 deletions(-)
drivers/staging/media/atomisp/include/linux/atomisp.h +0 -3
@@ -70,9 +70,6 @@#define V4L2_MBUS_FMT_CUSTOM_M10MO_RAW 0x800b#endif -/* FIXME: for now, let's use a boolean to identify the type of atomisp chipset */ -extern bool atomisp_hw_is_isp2401; -/* Configuration used by Bayer noise reduction and YCC noise reduction */ struct atomisp_nr_config {/* [gain] Strength of noise reduction for Bayer NR (Used by Bayer NR) */
drivers/staging/media/atomisp/include/linux/atomisp_platform.h +10 -1
@@ -19,6 +19,7 @@#define ATOMISP_PLATFORM_H_ #include <asm/intel-family.h> +#include <asm/processor.h> #include <linux/i2c.h> #include <linux/sfi.h>
@@ -240,11 +241,19 @@ const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void);/* API from old platform_camera.h, new CPUID implementation */ #define __IS_SOC (x) (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && \ boot_cpu_data.x86 == 6 && \ - boot_cpu_data.x86_model == x) + boot_cpu_data.x86_model == (x)) +#define __IS_SOCS (x,y) (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && \ + boot_cpu_data.x86 == 6 && \ + (boot_cpu_data.x86_model == (x) || \ + boot_cpu_data.x86_model == (y)))#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_MOFD __IS_SOC(INTEL_FAM6_ATOM_AIRMONT_MID) +/* Both CHT and MOFD come with ISP2401 */ +#define IS_ISP2401 __IS_SOCS(INTEL_FAM6_ATOM_AIRMONT, \ + INTEL_FAM6_ATOM_AIRMONT_MID) +#endif /* ATOMISP_PLATFORM_H_ */
drivers/staging/media/atomisp/pci/atomisp_cmd.c +24 -24
186 lines not on this page · raw message
drivers/staging/media/atomisp/pci/atomisp_common.h +0 -4
@@ -44,10 +44,6 @@ extern int pad_h;/* ISP2401 */ #define ATOMISP_CSS_ISP_PIPE_VERSION_2_7 1 -#define IS_ISP2401 (isp) \ - (((isp)->media_dev.hw_revision & ATOMISP_HW_REVISION_MASK) \ - >= (ATOMISP_HW_REVISION_ISP2401_LEGACY << ATOMISP_HW_REVISION_SHIFT)) -struct atomisp_format_bridge {unsigned int pixelformat;unsigned int depth;
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +7 -7
@@ -612,7 +612,7 @@ static void __apply_additional_pipe_config( default_capture_config.mode == IA_CSS_CAPTURE_MODE_RAW) stream_env->pipe_configs[pipe_id].enable_dz = false; -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {/* the isp default to use ISP2.2 and the camera hal will * control whether use isp2.7 */ if (asd->select_isp_version->val ==ATOMISP_CSS_ISP_PIPE_VERSION_2_7 )
@@ -4159,7 +4159,7 @@ int atomisp_css_isr_thread(struct atomisp_device *isp,for (i =0 ; i < isp->num_of_streams; i++)atomisp_wdt_stop (&isp->asd[i],0 ); -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 )atomisp_wdt (&isp->asd[0 ].wdt);else queue_work (isp->wdt_work_queue, &isp->wdt_work);
@@ -4193,7 +4193,7 @@ int atomisp_css_isr_thread(struct atomisp_device *isp,atomisp_buf_done (asd,0 ,IA_CSS_BUFFER_TYPE_OUTPUT_FRAME , current_event.pipe, true, stream_id); -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) reset_wdt_timer[asd->index] = true;/* ISP running */ break ;
@@ -4203,7 +4203,7 @@ int atomisp_css_isr_thread(struct atomisp_device *isp,atomisp_buf_done (asd,0 ,IA_CSS_BUFFER_TYPE_SEC_OUTPUT_FRAME , current_event.pipe, true, stream_id); -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) reset_wdt_timer[asd->index] = true;/* ISP running */ break ;
@@ -4227,7 +4227,7 @@ int atomisp_css_isr_thread(struct atomisp_device *isp,IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME , current_event.pipe, true, stream_id); -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) reset_wdt_timer[asd->index] = true;/* ISP running */ break ;
@@ -4236,7 +4236,7 @@ int atomisp_css_isr_thread(struct atomisp_device *isp,atomisp_buf_done (asd,0 ,IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME , current_event.pipe, true, stream_id); -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) reset_wdt_timer[asd->index] = true;/* ISP running */ break ;
@@ -4262,7 +4262,7 @@ int atomisp_css_isr_thread(struct atomisp_device *isp, } } -if (atomisp_hw_is_isp2401) +if (IS_ISP2401 )return 0 ;/* ISP2400: If there are no buffers queued then delete wdt timer. */
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +14 -14
@@ -582,7 +582,7 @@ static int atomisp_enum_input(struct file *file, void *fh,* ioctl is the only way to enum inputs + possible external actuators * for 3A tuning purpose. */ -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) motor = isp->inputs[index].motor;else motor = isp->motor;
@@ -732,7 +732,7 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) goto error; } -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) { motor = isp->inputs[input].motor; }else { motor = isp->motor;
@@ -1264,7 +1264,7 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) }else {atomisp_qbuffers_to_css (asd); -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {if (!atomisp_is_wdt_running (asd) &&atomisp_buffers_queued (asd))atomisp_wdt_start (asd); }else {
@@ -1288,7 +1288,7 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) pipe->capq.streaming && !asd->enable_raw_buffer_lock->val && asd->params.offline_parm.num_captures == 1) { -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) { asd->pending_capture_request++;dev_dbg (isp->dev,"Add one pending capture request.\n" ); }else {
@@ -1687,7 +1687,7 @@ static int atomisp_streamon(struct file *file, void *fh,/* Reset pending capture request count. */ asd->pending_capture_request =0 ; -if (atomisp_hw_is_isp2401) +if (IS_ISP2401 ) asd->re_trigger_capture = false; if ((atomisp_subdev_streaming_count(asd) > sensor_start_stream) &&
@@ -1828,7 +1828,7 @@ static int atomisp_streamon(struct file *file, void *fh,dev_err (isp->dev,"master slave sensor stream on failed!\n" ); goto out; } -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {__wdt_on_master_slave_sensor (isp, wdt_duration); }else {__wdt_on_master_slave_sensor_pipe (pipe, wdt_duration, true);
@@ -1836,7 +1836,7 @@ static int atomisp_streamon(struct file *file, void *fh, goto start_delay_wq; }else if (asd->depth_mode->val && (atomisp_streaming_count (isp) <ATOMISP_DEPTH_SENSOR_STREAMON_COUNT )) { -if (atomisp_hw_is_isp2401) +if (IS_ISP2401 )__wdt_on_master_slave_sensor_pipe (pipe, wdt_duration, false); goto start_delay_wq; }
@@ -1858,7 +1858,7 @@ static int atomisp_streamon(struct file *file, void *fh, goto out; } -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {if (atomisp_buffers_queued (asd))atomisp_wdt_refresh (asd, wdt_duration); }else {
@@ -2317,7 +2317,7 @@ static int atomisp_queryctl(struct file *file, void *fh,case V4L2_CID_FOCUS_ABSOLUTE :case V4L2_CID_FOCUS_RELATIVE :case V4L2_CID_FOCUS_STATUS : -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {return v4l2_queryctrl (isp->inputs[asd->input_curr].camera-> ctrl_handler, qc); }
@@ -2358,7 +2358,7 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh,int i;int ret =0 ; -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) motor = isp->inputs[asd->input_curr].motor;else motor = isp->motor;
@@ -2467,7 +2467,7 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh,int i;int ret =0 ; -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) motor = isp->inputs[asd->input_curr].motor;else motor = isp->motor;
@@ -2696,7 +2696,7 @@ static long atomisp_vidioc_default(struct file *file, void *fh,else asd =atomisp_to_video_pipe (vdev)->asd; -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) motor = isp->inputs[asd->input_curr].motor;else motor = isp->motor;
@@ -2721,7 +2721,7 @@ static long atomisp_vidioc_default(struct file *file, void *fh, }switch (cmd) {case ATOMISP_IOC_S_SENSOR_RUNMODE : -if (atomisp_hw_is_isp2401) +if (IS_ISP2401 ) err =atomisp_set_sensor_runmode (asd, arg);else err = -EINVAL ;
@@ -2896,7 +2896,7 @@ static long atomisp_vidioc_default(struct file *file, void *fh, core, ioctl, cmd, arg);break ;case ATOMISP_IOC_G_UPDATE_EXPOSURE : -if (atomisp_hw_is_isp2401) +if (IS_ISP2401 ) err =v4l2_subdev_call (isp->inputs[asd->input_curr].camera, core, ioctl, cmd, arg);else
drivers/staging/media/atomisp/pci/atomisp_subdev.c +1 -1
@@ -1222,7 +1222,7 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)v4l2_ctrl_new_custom (&asd->ctrl_handler, &ctrl_disable_dz,NULL ); -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) { asd->select_isp_version =v4l2_ctrl_new_custom (&asd->ctrl_handler, &ctrl_select_isp_version,NULL );
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +4 -13
@@ -124,11 +124,6 @@ MODULE_PARM_DESC(pad_h, "extra data for ISP processing");* be to replace this to something stored inside atomisp allocated * structures. */ -bool atomisp_hw_is_isp2401; - -/* Types of atomisp hardware */ -#define HW_IS_ISP2400 0 -#define HW_IS_ISP2401 1struct device *atomisp_dev;
@@ -1465,21 +1460,17 @@ static bool is_valid_device(struct pci_dev *dev,switch (id->device &ATOMISP_PCI_DEVICE_SOC_MASK ) {case ATOMISP_PCI_DEVICE_SOC_MRFLD : a0_max_id =ATOMISP_PCI_REV_MRFLD_A0_MAX ; - atomisp_hw_is_isp2401 = false; name ="Merrifield" ;break ;case ATOMISP_PCI_DEVICE_SOC_BYT : a0_max_id =ATOMISP_PCI_REV_BYT_A0_MAX ; - atomisp_hw_is_isp2401 = false; name ="Baytrail" ;break ;case ATOMISP_PCI_DEVICE_SOC_ANN : name ="Anniedale" ; - atomisp_hw_is_isp2401 = true;break ;case ATOMISP_PCI_DEVICE_SOC_CHT : name ="Cherrytrail" ; - atomisp_hw_is_isp2401 = true;break ;default : dev_err(&dev->dev, "%s: unknown device ID %x04:%x04\n",
@@ -1499,13 +1490,13 @@ static bool is_valid_device(struct pci_dev *dev,*/ #if defined(ISP2400 ) -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {dev_err (&dev->dev,"Support for %s (ISP2401) was disabled at compile time\n" , name);return false; }#else -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {dev_err (&dev->dev,"Support for %s (ISP2400) was disabled at compile time\n" , name);return false;
@@ -1514,7 +1505,7 @@ static bool is_valid_device(struct pci_dev *dev,dev_info (&dev->dev,"Detected %s version %d (ISP240%c) on %s\n" , name, dev->revision, - atomisp_hw_is_isp2401 ?'1' :'0' , +IS_ISP2401 ?'1' :'0' , product);return true;
@@ -1536,7 +1527,7 @@ static int init_atomisp_wdts(struct atomisp_device *isp)for (i =0 ; i < isp->num_of_streams; i++) {struct atomisp_sub_device *asd = &isp->asd[i]; -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 )timer_setup (&asd->wdt, atomisp_wdt,0 );else { timer_setup(&asd->video_out_capture.wdt,
drivers/staging/media/atomisp/pci/camera/pipe/src/pipe_binarydesc.c +2 -2
@@ -608,7 +608,7 @@ void ia_css_pipe_get_primary_binarydesc(* since it has better performance. */ if (pipe_version ==IA_CSS_PIPE_VERSION_2_6_1 ) prim_descr->striped = false; -else if (!atomisp_hw_is_isp2401) { +else if (!IS_ISP2401 ) { prim_descr->striped = prim_descr->continuous && (!pipe->stream->stop_copy_preview || !pipe->stream->disable_cont_vf); }else {
@@ -849,7 +849,7 @@ void ia_css_pipe_get_ldc_binarydesc(assert (out_info);IA_CSS_ENTER_PRIVATE ("" ); -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) { *in_info = *out_info; }else {if (pipe->out_yuv_ds_input_info.res.width)
drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c +2 -2
@@ -1342,7 +1342,7 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,if (info->enable.sc) { -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) { binary->sctbl_width_per_color =_ISP2400_SCTBL_WIDTH_PER_COLOR (sc_3a_dis_padded_width, s3a_log_deci); binary->sctbl_aligned_width_per_color =ISP2400_SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR ; binary->sctbl_height =_ISP2400_SCTBL_HEIGHT (sc_3a_dis_height, s3a_log_deci);
@@ -1358,7 +1358,7 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo, binary->sctbl_width_per_color =0 ; binary->sctbl_aligned_width_per_color =0 ; binary->sctbl_height =0 ; -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) { binary->sctbl_legacy_width_per_color =0 ; binary->sctbl_legacy_height =0 ; }
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +4 -4
@@ -3087,7 +3087,7 @@ ia_css_debug_dump_pipe_config( "capt_pp_in_res");ia_css_debug_dump_resolution (&config->vf_pp_in_res,"vf_pp_in_res" ); -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {ia_css_debug_dump_resolution (&config->output_system_in_res,"output_system_in_res" ); }
@@ -3315,7 +3315,7 @@ static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id)return ; } -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) { tmp =ia_css_device_load_uint32 (start_addr); point_num = (tmp >>16 ) &0xFFFF ;
@@ -3349,7 +3349,7 @@ static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id)if ((limit == (-1 )) && (trace_read_buf[i] ==0 )) limit = i; } -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"Status:\n" );for (i =0 ; i <SH_CSS_MAX_SP_THREADS ; i++) ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
@@ -3382,7 +3382,7 @@ static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id)for (i =0 ; i < point_num; i++) { j = (limit + i) % point_num;if (trace_read_buf[j]) { -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {TRACE_DUMP_FORMAT dump_format =FIELD_FORMAT_UNPACK (trace_read_buf[j]); }else { tid_val =FIELD_TID_UNPACK (trace_read_buf[j]);
drivers/staging/media/atomisp/pci/sh_css.c +20 -20
@@ -584,7 +584,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) { vblank_cycles = vblank_lines * (width + hblank_cycles);sh_css_sp_configure_sync_gen (width, height, hblank_cycles, vblank_cycles); -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {if (pipe->stream->config.mode ==IA_CSS_INPUT_MODE_TPG ) {/* TODO: move define to proper file in tools */ ia_css_device_store_uint32 (GP_ISEL_TPG_MODE ,0 );
@@ -1471,7 +1471,7 @@ static void start_pipe(assert (me);/* all callers are in this file and call with non null argument */ -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) { coord = &me->config.internal_frame_origin_bqs_on_sctbl; params = me->stream->isp_params_configs; }
@@ -2938,7 +2938,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) {if (err)return err; -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {/* The delay latency determines the number of invalid frames after * a stream is started. */ pipe->num_invalid_frames = pipe->dvs_frame_delay;
@@ -3009,7 +3009,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) {* where the driver chooses for memory based input frames. In these cases, a copy binary (which typical * copies sensor data to DDR) does not have much use. */ -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) need_isp_copy_binary = !online && !continuous;else need_isp_copy_binary = !online && !continuous && !(pipe->stream->config.mode ==IA_CSS_INPUT_MODE_MEMORY );
@@ -4028,7 +4028,7 @@ preview_start(struct ia_css_pipe *pipe) { } } -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) { coord = &pipe->config.internal_frame_origin_bqs_on_sctbl; params = pipe->stream->isp_params_configs; }
@@ -5725,7 +5725,7 @@ static int load_video_binaries(struct ia_css_pipe *pipe) tnr_info = mycs->video_binary.out_frame_info[0 ]; -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {/* Select resolution for TNR. If * output_system_in_resolution(GDC_out_resolution) is * being used, then select that as it will also be in resolution for
@@ -5846,7 +5846,7 @@ static int video_start(struct ia_css_pipe *pipe) } } -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) { coord = &pipe->config.internal_frame_origin_bqs_on_sctbl; params = pipe->stream->isp_params_configs; }
@@ -6004,7 +6004,7 @@ static bool need_capture_pp(assert (pipe);assert (pipe->mode ==IA_CSS_PIPE_ID_CAPTURE ); -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {/* ldc and capture_pp are not supported in the same pipeline */ if (need_capt_ldc (pipe) == true)return false;
@@ -6212,7 +6212,7 @@ static int load_primary_binaries(/* TODO Do we disable ldc for skycam */ need_ldc =need_capt_ldc (pipe); -if (atomisp_hw_is_isp2401 && need_ldc) { +if (IS_ISP2401 && need_ldc) {/* ldc and capt_pp are not supported in the same pipeline */ struct ia_css_binary_descr capt_ldc_descr;
@@ -6235,7 +6235,7 @@ static int load_primary_binaries(if (need_pp) {struct ia_css_binary_descr capture_pp_descr; -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) capt_pp_in_info = need_ldc ? &capt_ldc_out_info : &prim_out_info;else capt_pp_in_info = &prim_out_info;
@@ -9556,7 +9556,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, effective_res.height); } -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {for (i =0 ; i < num_pipes; i++) {if (pipes[i]->config.mode !=IA_CSS_PIPE_MODE_ACC && pipes[i]->config.mode !=IA_CSS_PIPE_MODE_COPY ) {
@@ -9610,7 +9610,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, curr_stream->cont_capt = true; curr_stream->disable_cont_vf = curr_stream->config.disable_cont_viewfinder; -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) curr_stream->stop_copy_preview = my_css.stop_copy_preview; }
@@ -9670,7 +9670,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,/* set current stream */ curr_pipe->stream = curr_stream; -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {/* take over effective info */ effective_res = curr_pipe->config.input_effective_res;
@@ -9705,11 +9705,11 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, goto ERR; } -if (atomisp_hw_is_isp2401) +if (IS_ISP2401 ) pipe_info->output_system_in_res_info = curr_pipe->config.output_system_in_res;if (!spcopyonly) { -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) err =sh_css_pipe_get_shading_info (curr_pipe, &pipe_info->shading_info,NULL );else
@@ -9834,7 +9834,7 @@ ia_css_stream_destroy(struct ia_css_stream *stream) { } } free_mpi = stream->config.mode ==IA_CSS_INPUT_MODE_BUFFERED_SENSOR ; -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) { free_mpi |= stream->config.mode ==IA_CSS_INPUT_MODE_TPG ; free_mpi |= stream->config.mode ==IA_CSS_INPUT_MODE_PRBS ; }
@@ -9932,7 +9932,7 @@ ia_css_stream_get_info(const struct ia_css_stream *stream,*/ int ia_css_stream_load (struct ia_css_stream *stream) { -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {int i;int err;
@@ -10058,7 +10058,7 @@ ia_css_stream_stop(struct ia_css_stream *stream) { }#endif -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) { err =ia_css_pipeline_request_stop (&stream->last_pipe->pipeline); }else { err =sh_css_pipes_stop (stream);
@@ -10080,7 +10080,7 @@ ia_css_stream_has_stopped(struct ia_css_stream *stream) {assert (stream); -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) { stopped =ia_css_pipeline_has_stopped (&stream->last_pipe->pipeline); }else { stopped =sh_css_pipes_have_stopped (stream);
@@ -10426,7 +10426,7 @@ ia_css_stop_sp(void) { }/* For now, stop whole SP */ -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {sh_css_write_host2sp_command (host2sp_cmd_terminate); }else {if (!sh_css_write_host2sp_command (host2sp_cmd_terminate))
drivers/staging/media/atomisp/pci/sh_css_firmware.c +2 -2
@@ -189,7 +189,7 @@ sh_css_check_firmware_version(struct device *dev, const char *fw_data)const char *release_version; -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) release_version = isp2400_release_version;else release_version = isp2401_release_version;
@@ -230,7 +230,7 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,int ret;const char *release_version; -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) release_version = isp2400_release_version;else release_version = isp2401_release_version;
drivers/staging/media/atomisp/pci/sh_css_mipi.c +4 -4
@@ -391,7 +391,7 @@ calculate_mipi_buff_size(static bool buffers_needed (struct ia_css_pipe *pipe) { -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {if (pipe->stream->config.mode ==IA_CSS_INPUT_MODE_BUFFERED_SENSOR )return false;else
@@ -445,7 +445,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,return 0 ;/* AM TODO: Check */ } -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) port = (unsigned int )pipe->stream->config.source.port.port;else err =ia_css_mipi_is_source_port_valid (pipe, &port);
@@ -594,7 +594,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) {return err; } -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) port = (unsigned int )pipe->stream->config.source.port.port;else err =ia_css_mipi_is_source_port_valid (pipe, &port);
@@ -710,7 +710,7 @@ send_mipi_frames(struct ia_css_pipe *pipe) {/* TODO: AM: maybe this should be returning an error. */ } -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) port = (unsigned int )pipe->stream->config.source.port.port;else err =ia_css_mipi_is_source_port_valid (pipe, &port);
drivers/staging/media/atomisp/pci/sh_css_params.c +11 -11
@@ -2161,7 +2161,7 @@ ia_css_set_param_exceptions(const struct ia_css_pipe *pipe, params->dp_config.b = params->wb_config.b; params->dp_config.gb = params->wb_config.gb; -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {assert (pipe);assert (pipe->mode <IA_CSS_PIPE_ID_NUM );
@@ -2630,7 +2630,7 @@ sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe,* before (NORM+OBC) or after. The folllowing code to set the * DPC configuration should be updated when this interface is made * available */ -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {sh_css_set_dp_config (pipe, params, config->dp_config);ia_css_set_param_exceptions (pipe, params); }
@@ -2651,7 +2651,7 @@ sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe, goto exit; } -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 )ia_css_set_param_exceptions (pipe, params); exit:
@@ -3069,7 +3069,7 @@ sh_css_init_isp_params_from_global(struct ia_css_stream *stream,ia_css_set_ob_config (params, &default_ob_config);ia_css_set_dp_config (params, &default_dp_config); -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) {ia_css_set_param_exceptions (pipe_in, params); }else {for (i =0 ; i < stream->num_pipes; i++) {
@@ -3196,7 +3196,7 @@ sh_css_init_isp_params_from_global(struct ia_css_stream *stream, retval = false; goto exit; } -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {if (stream->pipes[i]->mode <IA_CSS_PIPE_ID_NUM ) {sh_css_set_dp_config (stream->pipes[i], params, &stream_params->pipe_dp_config[stream->pipes[i]->mode]);
@@ -3208,7 +3208,7 @@ sh_css_init_isp_params_from_global(struct ia_css_stream *stream, } } -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 )ia_css_set_param_exceptions (pipe_in, params); params->fpn_config.data = stream_params->fpn_config.data;
@@ -3362,7 +3362,7 @@ int ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe, pipe->scaler_pp_lut = mmgr_NULL;if (!stream_started) { -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) pipe->scaler_pp_lut =hmm_alloc (sizeof (zoom_table),HMM_BO_PRIVATE ,0 ,NULL ,0 );else pipe->scaler_pp_lut =sh_css_params_alloc_gdc_lut ();
@@ -3407,7 +3407,7 @@ int sh_css_params_map_and_store_default_gdc_lut(void)host_lut_store ((void *)zoom_table); -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) default_gdc_lut =hmm_alloc (sizeof (zoom_table),HMM_BO_PRIVATE ,0 ,NULL ,0 );else default_gdc_lut =sh_css_params_alloc_gdc_lut ();
@@ -4020,7 +4020,7 @@ sh_css_params_write_to_ddr_internal(u32 enable_conv;size_t bytes; -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) bytes =ISP2400_SCTBL_BYTES (binary);else bytes =ISP2401_SCTBL_BYTES (binary);
@@ -4117,7 +4117,7 @@ sh_css_params_write_to_ddr_internal(/* DPC configuration is made pipe specific to allow flexibility in positioning of the * DPC kernel. The code below sets the pipe specific configuration to * individual binaries. */ -if (atomisp_hw_is_isp2401 && +if (IS_ISP2401 && params->pipe_dpc_config_changed[pipe_id] && binary->info->sp.enable.dpc) { unsigned int size =
@@ -4220,7 +4220,7 @@ sh_css_params_write_to_ddr_internal(if (!params->pipe_dvs_6axis_config[pipe_id]) {struct ia_css_resolution dvs_offset = {0 }; -if (!atomisp_hw_is_isp2401) { +if (!IS_ISP2401 ) { dvs_offset.width = (PIX_SHIFT_FILTER_RUN_IN_X + binary->dvs_envelope.width) /2 ; }else {if (binary->dvs_envelope.width || binary->dvs_envelope.height) {
drivers/staging/media/atomisp/pci/sh_css_sp.c +1 -1
@@ -1343,7 +1343,7 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, }#endif -if (atomisp_hw_is_isp2401) { +if (IS_ISP2401 ) {/* For the shading correction type 1 (the legacy shading table conversion in css is not used), * the parameters are passed to the isp for the shading table centering. */
drivers/staging/media/atomisp/pci/sh_css_version.c +2 -1
@@ -14,6 +14,7 @@*/ #include "../../include/linux/atomisp.h" +#include "../../include/linux/atomisp_platform.h" #include "ia_css_version.h" #include "ia_css_version_data.h" #include "ia_css_err.h"
@@ -23,7 +24,7 @@ int ia_css_get_version(char *version, int max_size) {char *css_version; -if (!atomisp_hw_is_isp2401) +if (!IS_ISP2401 ) css_version =ISP2400_CSS_VERSION_STRING ;else css_version =ISP2401_CSS_VERSION_STRING ;
Signature · 1 line
2.26.2
PATCH 12/15 media: atomisp: use different dfs failed messages
In reply to Mauro Carvalho ChehabThere are several parts of the driver that could produce a "dfs failed!" message. Change the texts, in order to help identifying from where they're coming.
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 4 ++-- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +2 -2
@@ -1407,10 +1407,10 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout) atomisp_css_valid_sof(isp));if (atomisp_freq_scaling (isp,ATOMISP_DFS_MODE_AUTO , true) <0 ) -dev_dbg (isp->dev,"dfs failed!\n" ); +dev_dbg (isp->dev,"DFS auto failed while recovering!\n" ); }else {if (atomisp_freq_scaling (isp,ATOMISP_DFS_MODE_MAX , true) <0 ) -dev_dbg (isp->dev,"dfs failed!\n" ); +dev_dbg (isp->dev,"DFS max failed while recovering!\n" ); }for (i =0 ; i < isp->num_of_streams; i++) {
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +3 -3
@@ -1810,15 +1810,15 @@ static int atomisp_streamon(struct file *file, void *fh,if (atomisp_streaming_count (isp) >1 ) {if (atomisp_freq_scaling (isp,ATOMISP_DFS_MODE_MAX , false) <0 ) -dev_dbg (isp->dev,"dfs failed!\n" ); +dev_dbg (isp->dev,"DFS max mode failed!\n" ); }else {if (atomisp_freq_scaling (isp,ATOMISP_DFS_MODE_AUTO , false) <0 ) -dev_dbg (isp->dev,"dfs failed!\n" ); +dev_dbg (isp->dev,"DFS auto mode failed!\n" ); } } else {if (atomisp_freq_scaling (isp,ATOMISP_DFS_MODE_MAX , false) <0 ) -dev_dbg (isp->dev,"dfs failed!\n" ); +dev_dbg (isp->dev,"DFS max mode failed!\n" ); } if (asd->depth_mode->val && atomisp_streaming_count(isp) ==
Signature · 1 line
2.26.2
PATCH 13/15 media: atomisp: set DFS to MAX if sensor doesn't report fps
In reply to Mauro Carvalho ChehabIf the sensor doesn't implement support for g_frame_interval, it won't return the expected fps rate.
Instead of keeping DFS on its minimal value (which will likely not work), set it to the max.
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +6 -2
@@ -243,8 +243,12 @@ int atomisp_freq_scaling(struct atomisp_device *isp, } fps =atomisp_get_sensor_fps (asd); -if (fps ==0 ) -return -EINVAL ; +if (fps ==0 ) { +dev_info (isp->dev, +"Sensor didn't report FPS. Using DFS max mode.\n" ); + new_freq = dfs->highest_freq; + goto done; + } curr_rules.width = asd->fmt[asd->capture_pad].fmt.width; curr_rules.height = asd->fmt[asd->capture_pad].fmt.height;
Signature · 1 line
2.26.2
PATCH 14/15 media: atomisp: use strscpy() instead of less secure variants
In reply to Mauro Carvalho ChehabReplace usages of strcpy(), strlcpy() and strncpy() in favor of strscpy().
--- drivers/staging/media/atomisp/pci/atomisp_file.c | 2 +- .../media/atomisp/pci/atomisp_gmin_platform.c | 2 +- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 12 ++++++------ drivers/staging/media/atomisp/pci/atomisp_tpg.c | 2 +- .../staging/media/atomisp/pci/atomisp_trace_event.h | 6 +++--- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 2 +- drivers/staging/media/atomisp/pci/sh_css_sp.c | 3 +-- drivers/staging/media/atomisp/pci/sh_css_version.c | 2 +- 8 files changed, 15 insertions(+), 16 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_file.c +1 -1
@@ -219,7 +219,7 @@ int atomisp_file_input_init(struct atomisp_device *isp)v4l2_subdev_init (sd, &file_input_ops); sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; -strcpy (sd->name,"file_input_subdev" ); +strscpy (sd->name,"file_input_subdev" ,sizeof (sd->name));v4l2_set_subdevdata (sd, file_dev); pads[0 ].flags =MEDIA_PAD_FL_SINK ;
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +1 -1
@@ -936,7 +936,7 @@ static int gmin_get_hardcoded_var(struct gmin_cfg_var *varlist,if (vl > *out_len -1 )return -ENOSPC ; -strcpy (out, gv->val); +strscpy (out, gv->val, *out_len); *out_len = vl;return 0 ; }
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +6 -6
@@ -547,8 +547,8 @@ static int atomisp_querycap(struct file *file, void *fh,struct video_device *vdev =video_devdata (file);struct atomisp_device *isp =video_get_drvdata (vdev); -strscpy (cap->driver,DRIVER ,sizeof (cap->driver) -1 ); -strscpy (cap->card,CARD ,sizeof (cap->card) -1 ); +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));
@@ -573,8 +573,8 @@ static int atomisp_enum_input(struct file *file, void *fh,return -EINVAL ;memset (input,0 ,sizeof (struct v4l2_input )); -strncpy (input->name, isp->inputs[index].camera->name, -sizeof (input->name) -1 ); +strscpy (input->name, isp->inputs[index].camera->name, +sizeof (input->name));/* * HACK: append actuator's name to sensor's
@@ -593,8 +593,8 @@ static int atomisp_enum_input(struct file *file, void *fh,if (max_size >1 ) { input->name[cur_len] ='+' ; -strncpy (&input->name[cur_len +1 ], - motor->name, max_size -1 ); +strscpy (&input->name[cur_len +1 ], + motor->name, max_size); } }
drivers/staging/media/atomisp/pci/atomisp_tpg.c +1 -1
@@ -148,7 +148,7 @@ int atomisp_tpg_init(struct atomisp_device *isp) tpg->isp = isp;v4l2_subdev_init (sd, &tpg_ops); sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; -strcpy (sd->name,"tpg_subdev" ); +strscpy (sd->name,"tpg_subdev" ,sizeof (sd->name));v4l2_set_subdevdata (sd, tpg); pads[0 ].flags =MEDIA_PAD_FL_SINK ;
drivers/staging/media/atomisp/pci/atomisp_trace_event.h +3 -3
@@ -44,7 +44,7 @@ TRACE_EVENT(camera_meminfo, ), TP_fast_assign( - strlcpy(__entry->name, name, 24); + strscpy(__entry->name, name, 24); __entry->uptr_size = uptr_size; __entry->counter = counter; __entry->sys_size = sys_size;
@@ -74,8 +74,8 @@ TRACE_EVENT(camera_debug, ), TP_fast_assign( - strlcpy(__entry->name, name, 24); -strlcpy (__entry->info, info,24 ); + strscpy(__entry->name, name, 24); +strscpy (__entry->info, info,24 ); __entry->line = line; ),
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +1 -1
@@ -1212,7 +1212,7 @@ static int atomisp_register_entities(struct atomisp_device *isp) isp->media_dev.dev = isp->dev; -strlcpy (isp->media_dev.model,"Intel Atom ISP" , +strscpy (isp->media_dev.model,"Intel Atom ISP" ,sizeof (isp->media_dev.model));media_device_init (&isp->media_dev);
drivers/staging/media/atomisp/pci/sh_css_sp.c +1 -2
@@ -991,8 +991,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,/* Make sure binary name is smaller than allowed string size */ assert (strlen (binary_name) <SH_CSS_MAX_BINARY_NAME -1 ); -strncpy (sh_css_isp_stage.binary_name, binary_name,SH_CSS_MAX_BINARY_NAME -1 ); - sh_css_isp_stage.binary_name[SH_CSS_MAX_BINARY_NAME -1 ] =0 ; +strscpy (sh_css_isp_stage.binary_name, binary_name,SH_CSS_MAX_BINARY_NAME ); sh_css_isp_stage.mem_initializers = *isp_mem_if;/*
drivers/staging/media/atomisp/pci/sh_css_version.c +1 -1
@@ -31,7 +31,7 @@ ia_css_get_version(char *version, int max_size) {if (max_size <= (int )strlen (css_version) + (int )strlen (sh_css_get_fw_version ()) +5 )return -EINVAL ; -strcpy (version, css_version); +strscpy (version, css_version, max_size);strcat (version,"FW:" );strcat (version,sh_css_get_fw_version ());strcat (version,"; " );
Signature · 1 line
2.26.2
PATCH 15/15 media: atomisp: get rid of a string_support.h abstraction layer
In reply to Mauro Carvalho ChehabSome parts of the driver have their own implementation of memcpy() & friends. Replace all of them by strscpy().
--- .../pci/hive_isp_css_include/string_support.h | 165 ------------------ .../ctc/ctc_1.0/ia_css_ctc_table.host.c | 3 +- .../kernels/gc/gc_1.0/ia_css_gc_table.host.c | 3 +- .../kernels/gc/gc_2/ia_css_gc2_table.host.c | 3 +- .../xnr/xnr_1.0/ia_css_xnr_table.host.c | 3 +- .../pci/runtime/debug/src/ia_css_debug.c | 45 +++-- .../pci/runtime/isys/src/virtual_isys.c | 29 +-- .../media/atomisp/pci/sh_css_firmware.c | 2 +- 8 files changed, 38 insertions(+), 215 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/string_support.h
drivers/staging/media/atomisp/pci/hive_isp_css_include/string_support.h deleted +0 -165
@@ -1,165 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* Support for Intel Camera Imaging ISP subsystem. -* Copyright (c) 2015, Intel Corporation. -* -* This program is free software; you can redistribute it and/or modify it -* under the terms and conditions of the GNU General Public License, -* version 2, as published by the Free Software Foundation. -* -* This program is distributed in the hope it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -*/ - -#ifndef __STRING_SUPPORT_H_INCLUDED__ -#define __STRING_SUPPORT_H_INCLUDED__ -#include <platform_support.h> -#include <type_support.h> - -/* -* For all non microsoft cases, we need the following functions -*/ - -/* @brief Copy from src_buf to dest_buf. -* -* @param[out] dest_buf. Destination buffer to copy to -* @param[in] dest_size. The size of the destination buffer in bytes -* @param[in] src_buf. The source buffer -* @param[in] src_size. The size of the source buffer in bytes -* @return 0 on success, error code on failure -* @return -EINVAL on Invalid arguments -* @return ERANGE on Destination size too small -*/ -static inline int memcpy_s ( -void *dest_buf, -size_t dest_size, -const void *src_buf, -size_t src_size) -{ -if ((!src_buf) || (!dest_buf)) { -/* Invalid arguments*/ -return -EINVAL ; - } - -if ((dest_size < src_size) || (src_size ==0 )) { -/* Destination too small*/ -return ERANGE ; - } - -memcpy (dest_buf, src_buf, src_size); -return 0 ; -} - -/* @brief Get the length of the string, excluding the null terminator -* -* @param[in] src_str. The source string -* @param[in] max_len. Look only for max_len bytes in the string -* @return Return the string length excluding null character -* @return Return max_len if no null character in the first max_len bytes -* @return Returns 0 if src_str is NULL -*/ -static size_t strnlen_s ( -const char *src_str, -size_t max_len) -{ -size_t ix; - -if (!src_str) { -/* Invalid arguments*/ -return 0 ; - } - -for (ix =0 ; ix < max_len && src_str[ix] !='\0' ; ix++) - ; - -/* On Error, it will return src_size == max_len*/ -return ix; -} - -/* @brief Copy string from src_str to dest_str -* -* @param[out] dest_str. Destination buffer to copy to -* @param[in] dest_size. The size of the destination buffer in bytes -* @param[in] src_str. The source buffer -* @param[in] src_size. The size of the source buffer in bytes -* @return Returns 0 on success -* @return Returns -EINVAL on invalid arguments -* @return Returns ERANGE on destination size too small -*/ -static inline int strncpy_s ( -char *dest_str, -size_t dest_size, -const char *src_str, -size_t src_size) -{ -size_t len; - -if (!dest_str) { -/* Invalid arguments*/ -return -EINVAL ; - } - -if ((!src_str) || (dest_size ==0 )) { -/* Invalid arguments*/ - dest_str[0 ] ='\0' ; -return -EINVAL ; - } - - len =strnlen_s (src_str, src_size); - -if (len >= dest_size) { -/* Destination too small*/ - dest_str[0 ] ='\0' ; -return ERANGE ; - } - -/* dest_str is big enough for the len */ -strncpy (dest_str, src_str, len); - dest_str[len] ='\0' ; -return 0 ; -} - -/* @brief Copy string from src_str to dest_str -* -* @param[out] dest_str. Destination buffer to copy to -* @param[in] dest_size. The size of the destination buffer in bytes -* @param[in] src_str. The source buffer -* @return Returns 0 on success -* @return Returns -EINVAL on invalid arguments -* @return Returns ERANGE on destination size too small -*/ -static inline int strcpy_s ( -char *dest_str, -size_t dest_size, -const char *src_str) -{ -size_t len; - -if (!dest_str) { -/* Invalid arguments*/ -return -EINVAL ; - } - -if ((!src_str) || (dest_size ==0 )) { -/* Invalid arguments*/ - dest_str[0 ] ='\0' ; -return -EINVAL ; - } - - len =strnlen_s (src_str, dest_size); - -if (len >= dest_size) { -/* Destination too small*/ - dest_str[0 ] ='\0' ; -return ERANGE ; - } - -/* dest_str is big enough for the len */ -strncpy (dest_str, src_str, len); - dest_str[len] ='\0' ; -return 0 ; -} - -#endif /* __STRING_SUPPORT_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c +2 -1
@@ -13,8 +13,9 @@* more details. */ +#include <linux/string.h> /* for memcpy() */ +#include <type_support.h> -#include <string_support.h> /* memcpy */ #include "system_global.h" #include "vamem.h" #include "ia_css_types.h"
drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c +2 -1
@@ -13,8 +13,9 @@* more details. */ +#include <linux/string.h> /* for memcpy() */ +#include <type_support.h> -#include <string_support.h> /* memcpy */ #include "system_global.h" #include "vamem.h" #include "ia_css_types.h"
drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c +2 -1
@@ -13,8 +13,9 @@* more details. */ +#include <linux/string.h> /* for memcpy() */ +#include <type_support.h> -#include <string_support.h> /* memcpy */ #include "system_global.h" #include "vamem.h" #include "ia_css_types.h"
drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c +2 -1
@@ -13,8 +13,9 @@* more details. */ +#include <linux/string.h> /* for memcpy() */ +#include <type_support.h> -#include <string_support.h> /* memcpy */ #include "system_global.h" #include "vamem.h" #include "ia_css_types.h"
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +21 -24
94 lines not on this page · raw message
drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c +8 -21
@@ -13,6 +13,8 @@* more details. */ +#include <linux/string.h> /* for memcpy() */ +#include "system_global.h" #ifdef USE_INPUT_SYSTEM_VERSION_2401
@@ -20,7 +22,6 @@#include "ia_css_isys.h" #include "ia_css_debug.h" #include "math_support.h" -#include "string_support.h" #include "virtual_isys.h" #include "isp.h" #include "sh_css_defs.h"
@@ -650,14 +651,8 @@ static bool calculate_tpg_cfg( input_system_cfg_t *isys_cfg, pixelgen_tpg_cfg_t *cfg) { - (void )channel; - (void )input_port; +memcpy (cfg, &isys_cfg->tpg_port_attr,sizeof (pixelgen_tpg_cfg_t)); -memcpy_s ( - (void *)cfg, -sizeof (pixelgen_tpg_cfg_t), - (void *)(&isys_cfg->tpg_port_attr), -sizeof (pixelgen_tpg_cfg_t));return true; }
@@ -667,14 +662,8 @@ static bool calculate_prbs_cfg( input_system_cfg_t *isys_cfg, pixelgen_prbs_cfg_t *cfg) { - (void )channel; - (void )input_port; +memcpy (cfg, &isys_cfg->prbs_port_attr,sizeof (pixelgen_prbs_cfg_t)); -memcpy_s ( - (void *)cfg, -sizeof (pixelgen_prbs_cfg_t), - (void *)(&isys_cfg->prbs_port_attr), -sizeof (pixelgen_prbs_cfg_t));return true; }
@@ -692,12 +681,10 @@ static bool calculate_be_cfg(bool metadata, csi_rx_backend_cfg_t *cfg) { - memcpy_s( - (void *)(&cfg->lut_entry), - sizeof(csi_rx_backend_lut_entry_t), - metadata ? (void *)(&input_port->metadata.backend_lut_entry) : - (void *)(&input_port->csi_rx.backend_lut_entry), - sizeof(csi_rx_backend_lut_entry_t)); + memcpy(&cfg->lut_entry, + metadata ? &input_port->metadata.backend_lut_entry : + &input_port->csi_rx.backend_lut_entry, + sizeof(csi_rx_backend_lut_entry_t)); cfg->csi_mipi_cfg.virtual_channel = isys_cfg->csi_port_attr.ch_id;if (metadata) {
drivers/staging/media/atomisp/pci/sh_css_firmware.c +1 -1
@@ -13,6 +13,7 @@* more details. */ +#include <linux/string.h> /* for memcpy() */ #include <linux/slab.h> #include <linux/vmalloc.h>
@@ -28,7 +29,6 @@#include "ia_css_isp_param.h" #include "assert_support.h" -#include "string_support.h" #include "isp.h" /* PMEM_WIDTH_LOG2 */
Signature · 1 line
2.26.2