Message ID | 20210615003741.3758316-4-heiko@sntech.de |
---|---|
State | Superseded |
Headers | show |
Series | None | expand |
Hi, On 15.06.21 03:37, Heiko Stuebner wrote: > From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> > > The isp block evolved in subsequent socs, so some functions > will behave differently on newer variants. > > Therefore make it possible to override the needed params functions. > > Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> > --- > .../platform/rockchip/rkisp1/rkisp1-common.h | 25 ++++++++ > .../platform/rockchip/rkisp1/rkisp1-params.c | 64 ++++++++++++------- > 2 files changed, 65 insertions(+), 24 deletions(-) > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h > index 25dd5c93620e..74ddd8256366 100644 > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h > @@ -254,11 +254,35 @@ struct rkisp1_stats { > struct v4l2_format vdev_fmt; > }; > > +struct rkisp1_params; > +struct rkisp1_params_ops { > + void (*lsc_matrix_config)(struct rkisp1_params *params, > + const struct rkisp1_cif_isp_lsc_config *pconfig); > + void (*goc_config)(struct rkisp1_params *params, > + const struct rkisp1_cif_isp_goc_config *arg); > + void (*awb_meas_config)(struct rkisp1_params *params, > + const struct rkisp1_cif_isp_awb_meas_config *arg); > + void (*awb_meas_enable)(struct rkisp1_params *params, > + const struct rkisp1_cif_isp_awb_meas_config *arg, > + bool en); > + void (*awb_gain_config)(struct rkisp1_params *params, > + const struct rkisp1_cif_isp_awb_gain_config *arg); > + void (*aec_config)(struct rkisp1_params *params, > + const struct rkisp1_cif_isp_aec_config *arg); > + void (*hst_config)(struct rkisp1_params *params, > + const struct rkisp1_cif_isp_hst_config *arg); > + void (*hst_enable)(struct rkisp1_params *params, > + const struct rkisp1_cif_isp_hst_config *arg, bool en); > + void (*afm_config)(struct rkisp1_params *params, > + const struct rkisp1_cif_isp_afc_config *arg); > +}; > + > /* > * struct rkisp1_params - ISP input parameters device > * > * @vnode: video node > * @rkisp1: pointer to the rkisp1 device > + * @ops: pointer to the variant-specific operations > * @config_lock: locks the buffer list 'params' > * @params: queue of rkisp1_buffer > * @vdev_fmt: v4l2_format of the metadata format > @@ -268,6 +292,7 @@ struct rkisp1_stats { > struct rkisp1_params { > struct rkisp1_vdev_node vnode; > struct rkisp1_device *rkisp1; > + struct rkisp1_params_ops *ops; > > spinlock_t config_lock; /* locks the buffers list 'params' */ > struct list_head params; > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c > index b6beddd988d0..a971892ba81d 100644 > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c > @@ -185,8 +185,8 @@ static void rkisp1_bls_config(struct rkisp1_params *params, > > /* ISP LS correction interface function */ > static void > -rkisp1_lsc_correct_matrix_config(struct rkisp1_params *params, > - const struct rkisp1_cif_isp_lsc_config *pconfig) > +rkisp1_lsc_matrix_config(struct rkisp1_params *params, > + const struct rkisp1_cif_isp_lsc_config *pconfig) > { > unsigned int isp_lsc_status, sram_addr, isp_lsc_table_sel, i, j, data; > > @@ -265,7 +265,7 @@ static void rkisp1_lsc_config(struct rkisp1_params *params, > lsc_ctrl = rkisp1_read(params->rkisp1, RKISP1_CIF_ISP_LSC_CTRL); > rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_LSC_CTRL, > RKISP1_CIF_ISP_LSC_CTRL_ENA); > - rkisp1_lsc_correct_matrix_config(params, arg); > + params->ops->lsc_matrix_config(params, arg); > > for (i = 0; i < RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE / 2; i++) { > /* program x size tables */ > @@ -955,7 +955,7 @@ rkisp1_isp_isr_other_config(struct rkisp1_params *params, > > /* update awb gains */ > if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AWB_GAIN) > - rkisp1_awb_gain_config(params, &new_params->others.awb_gain_config); > + params->ops->awb_gain_config(params, &new_params->others.awb_gain_config); > > if (module_en_update & RKISP1_CIF_ISP_MODULE_AWB_GAIN) { > if (module_ens & RKISP1_CIF_ISP_MODULE_AWB_GAIN) > @@ -1010,8 +1010,7 @@ rkisp1_isp_isr_other_config(struct rkisp1_params *params, > > /* update goc config */ > if (module_cfg_update & RKISP1_CIF_ISP_MODULE_GOC) > - rkisp1_goc_config(params, > - &new_params->others.goc_config); > + params->ops->goc_config(params, &new_params->others.goc_config); > > if (module_en_update & RKISP1_CIF_ISP_MODULE_GOC) { > if (module_ens & RKISP1_CIF_ISP_MODULE_GOC) > @@ -1081,17 +1080,17 @@ static void rkisp1_isp_isr_meas_config(struct rkisp1_params *params, > > /* update awb config */ > if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AWB) > - rkisp1_awb_meas_config(params, &new_params->meas.awb_meas_config); > + params->ops->awb_meas_config(params, &new_params->meas.awb_meas_config); > > if (module_en_update & RKISP1_CIF_ISP_MODULE_AWB) > - rkisp1_awb_meas_enable(params, > - &new_params->meas.awb_meas_config, > - !!(module_ens & RKISP1_CIF_ISP_MODULE_AWB)); > + params->ops->awb_meas_enable(params, > + &new_params->meas.awb_meas_config, > + !!(module_ens & RKISP1_CIF_ISP_MODULE_AWB)); > > /* update afc config */ > if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AFC) > - rkisp1_afm_config(params, > - &new_params->meas.afc_config); > + params->ops->afm_config(params, > + &new_params->meas.afc_config); > > if (module_en_update & RKISP1_CIF_ISP_MODULE_AFC) { > if (module_ens & RKISP1_CIF_ISP_MODULE_AFC) > @@ -1106,18 +1105,21 @@ static void rkisp1_isp_isr_meas_config(struct rkisp1_params *params, > > /* update hst config */ > if (module_cfg_update & RKISP1_CIF_ISP_MODULE_HST) > - rkisp1_hst_config(params, > - &new_params->meas.hst_config); > + params->ops->hst_config(params, > + &new_params->meas.hst_config); > > if (module_en_update & RKISP1_CIF_ISP_MODULE_HST) > + params->ops->hst_enable(params, > + &new_params->meas.hst_config, > + !!(module_ens & RKISP1_CIF_ISP_MODULE_HST)); > rkisp1_hst_enable(params, > &new_params->meas.hst_config, > !!(module_ens & RKISP1_CIF_ISP_MODULE_HST)); shouldn't rkisp1_hst_enable call be removed? Thanks, Dafna > > /* update aec config */ > if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AEC) > - rkisp1_aec_config(params, > - &new_params->meas.aec_config); > + params->ops->aec_config(params, > + &new_params->meas.aec_config); > > if (module_en_update & RKISP1_CIF_ISP_MODULE_AEC) { > if (module_ens & RKISP1_CIF_ISP_MODULE_AEC) > @@ -1218,20 +1220,20 @@ static void rkisp1_params_config_parameter(struct rkisp1_params *params) > { > struct rkisp1_cif_isp_hst_config hst = rkisp1_hst_params_default_config; > > - rkisp1_awb_meas_config(params, &rkisp1_awb_params_default_config); > - rkisp1_awb_meas_enable(params, &rkisp1_awb_params_default_config, > - true); > + params->ops->awb_meas_config(params, &rkisp1_awb_params_default_config); > + params->ops->awb_meas_enable(params, &rkisp1_awb_params_default_config, > + true); > > - rkisp1_aec_config(params, &rkisp1_aec_params_default_config); > + params->ops->aec_config(params, &rkisp1_aec_params_default_config); > rkisp1_param_set_bits(params, RKISP1_CIF_ISP_EXP_CTRL, > RKISP1_CIF_ISP_EXP_ENA); > > - rkisp1_afm_config(params, &rkisp1_afc_params_default_config); > + params->ops->afm_config(params, &rkisp1_afc_params_default_config); > rkisp1_param_set_bits(params, RKISP1_CIF_ISP_AFM_CTRL, > RKISP1_CIF_ISP_AFM_ENA); > > memset(hst.hist_weight, 0x01, sizeof(hst.hist_weight)); > - rkisp1_hst_config(params, &hst); > + params->ops->hst_config(params, &hst); > rkisp1_param_set_bits(params, RKISP1_CIF_ISP_HIST_PROP, > rkisp1_hst_params_default_config.mode); > > @@ -1275,7 +1277,7 @@ void rkisp1_params_disable(struct rkisp1_params *params) > RKISP1_CIF_ISP_DEMOSAIC_BYPASS); > rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_FILT_MODE, > RKISP1_CIF_ISP_FLT_ENA); > - rkisp1_awb_meas_enable(params, NULL, false); > + params->ops->awb_meas_enable(params, NULL, false); > rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_CTRL, > RKISP1_CIF_ISP_CTRL_ISP_AWB_ENA); > rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_EXP_CTRL, > @@ -1283,7 +1285,7 @@ void rkisp1_params_disable(struct rkisp1_params *params) > rkisp1_ctk_enable(params, false); > rkisp1_param_clear_bits(params, RKISP1_CIF_C_PROC_CTRL, > RKISP1_CIF_C_PROC_CTR_ENABLE); > - rkisp1_hst_enable(params, NULL, false); > + params->ops->hst_enable(params, NULL, false); > rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_AFM_CTRL, > RKISP1_CIF_ISP_AFM_ENA); > rkisp1_ie_enable(params, false); > @@ -1291,6 +1293,18 @@ void rkisp1_params_disable(struct rkisp1_params *params) > RKISP1_CIF_ISP_DPF_MODE_EN); > } > > +static struct rkisp1_params_ops rkisp1_params_ops = { > + .lsc_matrix_config = rkisp1_lsc_matrix_config, > + .goc_config = rkisp1_goc_config, > + .awb_meas_config = rkisp1_awb_meas_config, > + .awb_meas_enable = rkisp1_awb_meas_enable, > + .awb_gain_config = rkisp1_awb_gain_config, > + .aec_config = rkisp1_aec_config, > + .hst_config = rkisp1_hst_config, > + .hst_enable = rkisp1_hst_enable, > + .afm_config = rkisp1_afm_config, > +}; > + > static int rkisp1_params_enum_fmt_meta_out(struct file *file, void *priv, > struct v4l2_fmtdesc *f) > { > @@ -1457,6 +1471,8 @@ static void rkisp1_init_params(struct rkisp1_params *params) > V4L2_META_FMT_RK_ISP1_PARAMS; > params->vdev_fmt.fmt.meta.buffersize = > sizeof(struct rkisp1_params_cfg); > + > + params->ops = &rkisp1_params_ops; > } > > int rkisp1_params_register(struct rkisp1_device *rkisp1) >
Hi Heiko,
I love your patch! Perhaps something to improve:
[auto build test WARNING on rockchip/for-next]
[also build test WARNING on v5.13-rc6 next-20210616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Heiko-Stuebner/rkisp1-support-for-px30/20210616-201601
base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
config: ia64-randconfig-s032-20210615 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/3495922d4cf7d39e4a52d3b8588f8c46ab19e151
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Heiko-Stuebner/rkisp1-support-for-px30/20210616-201601
git checkout 3495922d4cf7d39e4a52d3b8588f8c46ab19e151
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c: In function 'rkisp1_isp_isr_meas_config':
>> drivers/media/platform/rockchip/rkisp1/rkisp1-params.c:1111:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1111 | if (module_en_update & RKISP1_CIF_ISP_MODULE_HST)
| ^~
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c:1115:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1115 | rkisp1_hst_enable(params,
| ^~~~~~~~~~~~~~~~~
vim +/if +1111 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1071
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1072 static void rkisp1_isp_isr_meas_config(struct rkisp1_params *params,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1073 struct rkisp1_params_cfg *new_params)
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1074 {
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1075 unsigned int module_en_update, module_cfg_update, module_ens;
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1076
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1077 module_en_update = new_params->module_en_update;
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1078 module_cfg_update = new_params->module_cfg_update;
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1079 module_ens = new_params->module_ens;
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1080
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1081 /* update awb config */
db1733ce23bd375 drivers/staging/media/rkisp1/rkisp1-params.c Dafna Hirschfeld 2020-10-19 1082 if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AWB)
3495922d4cf7d39 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c Heiko Stuebner 2021-06-15 1083 params->ops->awb_meas_config(params, &new_params->meas.awb_meas_config);
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1084
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1085 if (module_en_update & RKISP1_CIF_ISP_MODULE_AWB)
3495922d4cf7d39 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c Heiko Stuebner 2021-06-15 1086 params->ops->awb_meas_enable(params,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1087 &new_params->meas.awb_meas_config,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1088 !!(module_ens & RKISP1_CIF_ISP_MODULE_AWB));
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1089
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1090 /* update afc config */
db1733ce23bd375 drivers/staging/media/rkisp1/rkisp1-params.c Dafna Hirschfeld 2020-10-19 1091 if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AFC)
3495922d4cf7d39 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c Heiko Stuebner 2021-06-15 1092 params->ops->afm_config(params,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1093 &new_params->meas.afc_config);
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1094
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1095 if (module_en_update & RKISP1_CIF_ISP_MODULE_AFC) {
cdda99d70d73d08 drivers/staging/media/rkisp1/rkisp1-params.c Dafna Hirschfeld 2020-10-19 1096 if (module_ens & RKISP1_CIF_ISP_MODULE_AFC)
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1097 rkisp1_param_set_bits(params,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1098 RKISP1_CIF_ISP_AFM_CTRL,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1099 RKISP1_CIF_ISP_AFM_ENA);
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1100 else
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1101 rkisp1_param_clear_bits(params,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1102 RKISP1_CIF_ISP_AFM_CTRL,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1103 RKISP1_CIF_ISP_AFM_ENA);
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1104 }
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1105
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1106 /* update hst config */
db1733ce23bd375 drivers/staging/media/rkisp1/rkisp1-params.c Dafna Hirschfeld 2020-10-19 1107 if (module_cfg_update & RKISP1_CIF_ISP_MODULE_HST)
3495922d4cf7d39 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c Heiko Stuebner 2021-06-15 1108 params->ops->hst_config(params,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1109 &new_params->meas.hst_config);
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1110
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 @1111 if (module_en_update & RKISP1_CIF_ISP_MODULE_HST)
3495922d4cf7d39 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c Heiko Stuebner 2021-06-15 1112 params->ops->hst_enable(params,
3495922d4cf7d39 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c Heiko Stuebner 2021-06-15 1113 &new_params->meas.hst_config,
3495922d4cf7d39 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c Heiko Stuebner 2021-06-15 1114 !!(module_ens & RKISP1_CIF_ISP_MODULE_HST));
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1115 rkisp1_hst_enable(params,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1116 &new_params->meas.hst_config,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1117 !!(module_ens & RKISP1_CIF_ISP_MODULE_HST));
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1118
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1119 /* update aec config */
db1733ce23bd375 drivers/staging/media/rkisp1/rkisp1-params.c Dafna Hirschfeld 2020-10-19 1120 if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AEC)
3495922d4cf7d39 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c Heiko Stuebner 2021-06-15 1121 params->ops->aec_config(params,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1122 &new_params->meas.aec_config);
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1123
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1124 if (module_en_update & RKISP1_CIF_ISP_MODULE_AEC) {
cdda99d70d73d08 drivers/staging/media/rkisp1/rkisp1-params.c Dafna Hirschfeld 2020-10-19 1125 if (module_ens & RKISP1_CIF_ISP_MODULE_AEC)
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1126 rkisp1_param_set_bits(params,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1127 RKISP1_CIF_ISP_EXP_CTRL,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1128 RKISP1_CIF_ISP_EXP_ENA);
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1129 else
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1130 rkisp1_param_clear_bits(params,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1131 RKISP1_CIF_ISP_EXP_CTRL,
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1132 RKISP1_CIF_ISP_EXP_ENA);
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1133 }
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1134 }
bae1155cf5798cc drivers/staging/media/rkisp1/rkisp1-params.c Jacob Chen 2020-01-08 1135
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h index 25dd5c93620e..74ddd8256366 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h @@ -254,11 +254,35 @@ struct rkisp1_stats { struct v4l2_format vdev_fmt; }; +struct rkisp1_params; +struct rkisp1_params_ops { + void (*lsc_matrix_config)(struct rkisp1_params *params, + const struct rkisp1_cif_isp_lsc_config *pconfig); + void (*goc_config)(struct rkisp1_params *params, + const struct rkisp1_cif_isp_goc_config *arg); + void (*awb_meas_config)(struct rkisp1_params *params, + const struct rkisp1_cif_isp_awb_meas_config *arg); + void (*awb_meas_enable)(struct rkisp1_params *params, + const struct rkisp1_cif_isp_awb_meas_config *arg, + bool en); + void (*awb_gain_config)(struct rkisp1_params *params, + const struct rkisp1_cif_isp_awb_gain_config *arg); + void (*aec_config)(struct rkisp1_params *params, + const struct rkisp1_cif_isp_aec_config *arg); + void (*hst_config)(struct rkisp1_params *params, + const struct rkisp1_cif_isp_hst_config *arg); + void (*hst_enable)(struct rkisp1_params *params, + const struct rkisp1_cif_isp_hst_config *arg, bool en); + void (*afm_config)(struct rkisp1_params *params, + const struct rkisp1_cif_isp_afc_config *arg); +}; + /* * struct rkisp1_params - ISP input parameters device * * @vnode: video node * @rkisp1: pointer to the rkisp1 device + * @ops: pointer to the variant-specific operations * @config_lock: locks the buffer list 'params' * @params: queue of rkisp1_buffer * @vdev_fmt: v4l2_format of the metadata format @@ -268,6 +292,7 @@ struct rkisp1_stats { struct rkisp1_params { struct rkisp1_vdev_node vnode; struct rkisp1_device *rkisp1; + struct rkisp1_params_ops *ops; spinlock_t config_lock; /* locks the buffers list 'params' */ struct list_head params; diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c index b6beddd988d0..a971892ba81d 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c @@ -185,8 +185,8 @@ static void rkisp1_bls_config(struct rkisp1_params *params, /* ISP LS correction interface function */ static void -rkisp1_lsc_correct_matrix_config(struct rkisp1_params *params, - const struct rkisp1_cif_isp_lsc_config *pconfig) +rkisp1_lsc_matrix_config(struct rkisp1_params *params, + const struct rkisp1_cif_isp_lsc_config *pconfig) { unsigned int isp_lsc_status, sram_addr, isp_lsc_table_sel, i, j, data; @@ -265,7 +265,7 @@ static void rkisp1_lsc_config(struct rkisp1_params *params, lsc_ctrl = rkisp1_read(params->rkisp1, RKISP1_CIF_ISP_LSC_CTRL); rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_LSC_CTRL, RKISP1_CIF_ISP_LSC_CTRL_ENA); - rkisp1_lsc_correct_matrix_config(params, arg); + params->ops->lsc_matrix_config(params, arg); for (i = 0; i < RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE / 2; i++) { /* program x size tables */ @@ -955,7 +955,7 @@ rkisp1_isp_isr_other_config(struct rkisp1_params *params, /* update awb gains */ if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AWB_GAIN) - rkisp1_awb_gain_config(params, &new_params->others.awb_gain_config); + params->ops->awb_gain_config(params, &new_params->others.awb_gain_config); if (module_en_update & RKISP1_CIF_ISP_MODULE_AWB_GAIN) { if (module_ens & RKISP1_CIF_ISP_MODULE_AWB_GAIN) @@ -1010,8 +1010,7 @@ rkisp1_isp_isr_other_config(struct rkisp1_params *params, /* update goc config */ if (module_cfg_update & RKISP1_CIF_ISP_MODULE_GOC) - rkisp1_goc_config(params, - &new_params->others.goc_config); + params->ops->goc_config(params, &new_params->others.goc_config); if (module_en_update & RKISP1_CIF_ISP_MODULE_GOC) { if (module_ens & RKISP1_CIF_ISP_MODULE_GOC) @@ -1081,17 +1080,17 @@ static void rkisp1_isp_isr_meas_config(struct rkisp1_params *params, /* update awb config */ if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AWB) - rkisp1_awb_meas_config(params, &new_params->meas.awb_meas_config); + params->ops->awb_meas_config(params, &new_params->meas.awb_meas_config); if (module_en_update & RKISP1_CIF_ISP_MODULE_AWB) - rkisp1_awb_meas_enable(params, - &new_params->meas.awb_meas_config, - !!(module_ens & RKISP1_CIF_ISP_MODULE_AWB)); + params->ops->awb_meas_enable(params, + &new_params->meas.awb_meas_config, + !!(module_ens & RKISP1_CIF_ISP_MODULE_AWB)); /* update afc config */ if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AFC) - rkisp1_afm_config(params, - &new_params->meas.afc_config); + params->ops->afm_config(params, + &new_params->meas.afc_config); if (module_en_update & RKISP1_CIF_ISP_MODULE_AFC) { if (module_ens & RKISP1_CIF_ISP_MODULE_AFC) @@ -1106,18 +1105,21 @@ static void rkisp1_isp_isr_meas_config(struct rkisp1_params *params, /* update hst config */ if (module_cfg_update & RKISP1_CIF_ISP_MODULE_HST) - rkisp1_hst_config(params, - &new_params->meas.hst_config); + params->ops->hst_config(params, + &new_params->meas.hst_config); if (module_en_update & RKISP1_CIF_ISP_MODULE_HST) + params->ops->hst_enable(params, + &new_params->meas.hst_config, + !!(module_ens & RKISP1_CIF_ISP_MODULE_HST)); rkisp1_hst_enable(params, &new_params->meas.hst_config, !!(module_ens & RKISP1_CIF_ISP_MODULE_HST)); /* update aec config */ if (module_cfg_update & RKISP1_CIF_ISP_MODULE_AEC) - rkisp1_aec_config(params, - &new_params->meas.aec_config); + params->ops->aec_config(params, + &new_params->meas.aec_config); if (module_en_update & RKISP1_CIF_ISP_MODULE_AEC) { if (module_ens & RKISP1_CIF_ISP_MODULE_AEC) @@ -1218,20 +1220,20 @@ static void rkisp1_params_config_parameter(struct rkisp1_params *params) { struct rkisp1_cif_isp_hst_config hst = rkisp1_hst_params_default_config; - rkisp1_awb_meas_config(params, &rkisp1_awb_params_default_config); - rkisp1_awb_meas_enable(params, &rkisp1_awb_params_default_config, - true); + params->ops->awb_meas_config(params, &rkisp1_awb_params_default_config); + params->ops->awb_meas_enable(params, &rkisp1_awb_params_default_config, + true); - rkisp1_aec_config(params, &rkisp1_aec_params_default_config); + params->ops->aec_config(params, &rkisp1_aec_params_default_config); rkisp1_param_set_bits(params, RKISP1_CIF_ISP_EXP_CTRL, RKISP1_CIF_ISP_EXP_ENA); - rkisp1_afm_config(params, &rkisp1_afc_params_default_config); + params->ops->afm_config(params, &rkisp1_afc_params_default_config); rkisp1_param_set_bits(params, RKISP1_CIF_ISP_AFM_CTRL, RKISP1_CIF_ISP_AFM_ENA); memset(hst.hist_weight, 0x01, sizeof(hst.hist_weight)); - rkisp1_hst_config(params, &hst); + params->ops->hst_config(params, &hst); rkisp1_param_set_bits(params, RKISP1_CIF_ISP_HIST_PROP, rkisp1_hst_params_default_config.mode); @@ -1275,7 +1277,7 @@ void rkisp1_params_disable(struct rkisp1_params *params) RKISP1_CIF_ISP_DEMOSAIC_BYPASS); rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_FILT_MODE, RKISP1_CIF_ISP_FLT_ENA); - rkisp1_awb_meas_enable(params, NULL, false); + params->ops->awb_meas_enable(params, NULL, false); rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_CTRL, RKISP1_CIF_ISP_CTRL_ISP_AWB_ENA); rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_EXP_CTRL, @@ -1283,7 +1285,7 @@ void rkisp1_params_disable(struct rkisp1_params *params) rkisp1_ctk_enable(params, false); rkisp1_param_clear_bits(params, RKISP1_CIF_C_PROC_CTRL, RKISP1_CIF_C_PROC_CTR_ENABLE); - rkisp1_hst_enable(params, NULL, false); + params->ops->hst_enable(params, NULL, false); rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_AFM_CTRL, RKISP1_CIF_ISP_AFM_ENA); rkisp1_ie_enable(params, false); @@ -1291,6 +1293,18 @@ void rkisp1_params_disable(struct rkisp1_params *params) RKISP1_CIF_ISP_DPF_MODE_EN); } +static struct rkisp1_params_ops rkisp1_params_ops = { + .lsc_matrix_config = rkisp1_lsc_matrix_config, + .goc_config = rkisp1_goc_config, + .awb_meas_config = rkisp1_awb_meas_config, + .awb_meas_enable = rkisp1_awb_meas_enable, + .awb_gain_config = rkisp1_awb_gain_config, + .aec_config = rkisp1_aec_config, + .hst_config = rkisp1_hst_config, + .hst_enable = rkisp1_hst_enable, + .afm_config = rkisp1_afm_config, +}; + static int rkisp1_params_enum_fmt_meta_out(struct file *file, void *priv, struct v4l2_fmtdesc *f) { @@ -1457,6 +1471,8 @@ static void rkisp1_init_params(struct rkisp1_params *params) V4L2_META_FMT_RK_ISP1_PARAMS; params->vdev_fmt.fmt.meta.buffersize = sizeof(struct rkisp1_params_cfg); + + params->ops = &rkisp1_params_ops; } int rkisp1_params_register(struct rkisp1_device *rkisp1)