Commit 049a38fc authored by Eugen Hristev's avatar Eugen Hristev Committed by Mauro Carvalho Chehab
Browse files

media: atmel: atmel-isc: create an adapt pipeline callback for product specific



Once the pipeline is set in the base code, create a callback that will adapt
the ISC pipeline to each product.
Create the adapt_pipeline callback that will be used in this fashion.

[hverkuil: made isc_sama5d2_adapt_pipeline static]

Signed-off-by: default avatarEugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 415dbe4e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1059,6 +1059,10 @@ static int isc_try_configure_pipeline(struct isc_device *isc)
	default:
		isc->try_config.bits_pipeline = 0x0;
	}

	/* Tune the pipeline to product specific */
	isc->adapt_pipeline(isc);

	return 0;
}

+5 −0
Original line number Diff line number Diff line
@@ -236,6 +236,9 @@ struct isc_reg_offsets {
 * @config_ctrls:	pointer to a functoin that initializes product
 *			specific v4l2 controls.
 *
 * @adapt_pipeline:	pointer to a function that adapts the pipeline bits
 *			to the product specific pipeline
 *
 * @offsets:		struct holding the product specific register offsets
 * @controller_formats:	pointer to the array of possible formats that the
 *			controller can output
@@ -321,6 +324,8 @@ struct isc_device {

		void (*config_ctrls)(struct isc_device *isc,
				     const struct v4l2_ctrl_ops *ops);

		void (*adapt_pipeline)(struct isc_device *isc);
	};

	struct isc_reg_offsets		offsets;
+11 −0
Original line number Diff line number Diff line
@@ -54,6 +54,10 @@

#define ISC_CLK_MAX_DIV		255

#define ISC_SAMA5D2_PIPELINE \
	(WB_ENABLE | CFA_ENABLE | CC_ENABLE | GAM_ENABLES | CSC_ENABLE | \
	CBC_ENABLE | SUB422_ENABLE | SUB420_ENABLE)

/* This is a list of the formats that the ISC can *output* */
static const struct isc_format sama5d2_controller_formats[] = {
	{
@@ -257,6 +261,11 @@ static void isc_sama5d2_config_rlp(struct isc_device *isc)
			   ISC_RLP_CFG_MODE_MASK, rlp_mode);
}

static void isc_sama5d2_adapt_pipeline(struct isc_device *isc)
{
	isc->try_config.bits_pipeline &= ISC_SAMA5D2_PIPELINE;
}

/* Gamma table with gamma 1/2.2 */
static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
	/* 0 --> gamma 1/1.8 */
@@ -410,6 +419,8 @@ static int atmel_isc_probe(struct platform_device *pdev)
	isc->config_rlp = isc_sama5d2_config_rlp;
	isc->config_ctrls = isc_sama5d2_config_ctrls;

	isc->adapt_pipeline = isc_sama5d2_adapt_pipeline;

	isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
	isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;
	isc->offsets.sub422 = ISC_SAMA5D2_SUB422_OFFSET;