public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
	Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Cc: ezequiel@collabora.com, helen.koike@collabora.com,
	Laurent.pinchart@ideasonboard.com,
	linux-rockchip@lists.infradead.org, linux-media@vger.kernel.org
Subject: Re: [PATCH v2 3/7] media: rockchip: rkisp1: make some isp-param functions variable
Date: Wed, 16 Jun 2021 00:44:59 +0200	[thread overview]
Message-ID: <12510054.RiKt1P0BV1@diego> (raw)
In-Reply-To: <c0587502-9ee4-69c5-a6ba-75e9a7ec467c@collabora.com>

Am Dienstag, 15. Juni 2021, 07:53:19 CEST schrieb Dafna Hirschfeld:
> 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 for catching that. You're right of course and actually
my work branch had a fixup commit to do that, I just seem to have
forgotten to merge it back into the patch I wanted to sent ;-)


Heiko


> >   
> >   	/* 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)
> > 
> 





  reply	other threads:[~2021-06-15 22:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15  0:37 [PATCH v2 0/7] rkisp1 support for px30 Heiko Stuebner
2021-06-15  0:37 ` [PATCH v2 1/7] media: rockchip: rkisp1: remove unused irq variable Heiko Stuebner
2021-06-15  5:44   ` Dafna Hirschfeld
2021-06-15  0:37 ` [PATCH v2 2/7] media: rockchip: rkisp1: allow separate interrupts Heiko Stuebner
2021-06-15  5:42   ` Dafna Hirschfeld
2021-06-15  0:37 ` [PATCH v2 3/7] media: rockchip: rkisp1: make some isp-param functions variable Heiko Stuebner
2021-06-15  5:53   ` Dafna Hirschfeld
2021-06-15 22:44     ` Heiko Stübner [this message]
2021-06-16 18:17   ` kernel test robot
2021-06-15  0:37 ` [PATCH v2 4/7] media: rockchip: rkisp1: make some isp-stats " Heiko Stuebner
2021-06-15  0:37 ` [PATCH v2 5/7] media: rockchip: rkisp1: add prefixes for v10 specific parts Heiko Stuebner
2021-06-15  6:06   ` Dafna Hirschfeld
2021-06-16 19:36   ` kernel test robot
2021-06-15  0:37 ` [PATCH v2 6/7] media: rockchip: rkisp1: add support for v12 isp variants Heiko Stuebner
2021-06-15  6:33   ` Dafna Hirschfeld
2021-06-15 22:31     ` Heiko Stübner
2021-06-15  0:37 ` [PATCH v2 7/7] media: rockchip: rkisp1: add support for px30 isp version Heiko Stuebner
2021-06-15  6:31   ` Dafna Hirschfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12510054.RiKt1P0BV1@diego \
    --to=heiko@sntech.de \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=dafna.hirschfeld@collabora.com \
    --cc=ezequiel@collabora.com \
    --cc=helen.koike@collabora.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox