[PATCH v2 25/30] media: atmel: atmel-isc: create an adapt pipeline callback for product specific
Eugen Hristev
eugen.hristev at microchip.com
Mon Apr 5 16:51:00 BST 2021
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.
Signed-off-by: Eugen Hristev <eugen.hristev at microchip.com>
---
Changes in v2:
- addded function prototype to avoid warning with W=1
drivers/media/platform/atmel/atmel-isc-base.c | 4 ++++
drivers/media/platform/atmel/atmel-isc.h | 5 +++++
drivers/media/platform/atmel/atmel-sama5d2-isc.c | 12 ++++++++++++
3 files changed, 21 insertions(+)
diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
index 6746c9060e3f..a3c299068bd5 100644
--- a/drivers/media/platform/atmel/atmel-isc-base.c
+++ b/drivers/media/platform/atmel/atmel-isc-base.c
@@ -1047,6 +1047,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;
}
diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h
index 14e318a7373c..19cc60dfcbe0 100644
--- a/drivers/media/platform/atmel/atmel-isc.h
+++ b/drivers/media/platform/atmel/atmel-isc.h
@@ -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;
diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
index a5823a3a6111..b2ace528b260 100644
--- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
+++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
@@ -54,12 +54,17 @@
#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)
+
void isc_sama5d2_config_csc(struct isc_device *isc);
void isc_sama5d2_config_cbc(struct isc_device *isc);
void isc_sama5d2_config_cc(struct isc_device *isc);
void isc_sama5d2_config_dpc(struct isc_device *isc);
void isc_sama5d2_config_gam(struct isc_device *isc);
void isc_sama5d2_config_rlp(struct isc_device *isc);
+void isc_sama5d2_adapt_pipeline(struct isc_device *isc);
void isc_sama5d2_config_ctrls(struct isc_device *isc,
const struct v4l2_ctrl_ops *ops);
@@ -267,6 +272,11 @@ void isc_sama5d2_config_rlp(struct isc_device *isc)
ISC_RLP_CFG_MODE_MASK, rlp_mode);
}
+void isc_sama5d2_adapt_pipeline(struct isc_device *isc)
+{
+ isc->try_config.bits_pipeline &= ISC_SAMA5D2_PIPELINE;
+}
+
/* Gamma table with gamma 1/2.2 */
const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
/* 0 --> gamma 1/1.8 */
@@ -420,6 +430,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;
--
2.25.1
More information about the linux-arm-kernel
mailing list