181-media-atmel-atmel-isc-create-an-adapt-pipeline-callb.patch 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. From 8601f1fc0a9a22788bfa6369fbbf83b3828a5b42 Mon Sep 17 00:00:00 2001
  2. From: Eugen Hristev <[email protected]>
  3. Date: Tue, 13 Apr 2021 12:57:23 +0200
  4. Subject: [PATCH 181/247] media: atmel: atmel-isc: create an adapt pipeline
  5. callback for product specific
  6. Once the pipeline is set in the base code, create a callback that will adapt
  7. the ISC pipeline to each product.
  8. Create the adapt_pipeline callback that will be used in this fashion.
  9. [hverkuil: made isc_sama5d2_adapt_pipeline static]
  10. Signed-off-by: Eugen Hristev <[email protected]>
  11. Signed-off-by: Hans Verkuil <[email protected]>
  12. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  13. ---
  14. drivers/media/platform/atmel/atmel-isc-base.c | 4 ++++
  15. drivers/media/platform/atmel/atmel-isc.h | 5 +++++
  16. drivers/media/platform/atmel/atmel-sama5d2-isc.c | 11 +++++++++++
  17. 3 files changed, 20 insertions(+)
  18. --- a/drivers/media/platform/atmel/atmel-isc-base.c
  19. +++ b/drivers/media/platform/atmel/atmel-isc-base.c
  20. @@ -1059,6 +1059,10 @@ static int isc_try_configure_pipeline(st
  21. default:
  22. isc->try_config.bits_pipeline = 0x0;
  23. }
  24. +
  25. + /* Tune the pipeline to product specific */
  26. + isc->adapt_pipeline(isc);
  27. +
  28. return 0;
  29. }
  30. --- a/drivers/media/platform/atmel/atmel-isc.h
  31. +++ b/drivers/media/platform/atmel/atmel-isc.h
  32. @@ -235,6 +235,9 @@ struct isc_reg_offsets {
  33. * @config_ctrls: pointer to a functoin that initializes product
  34. * specific v4l2 controls.
  35. *
  36. + * @adapt_pipeline: pointer to a function that adapts the pipeline bits
  37. + * to the product specific pipeline
  38. + *
  39. * @offsets: struct holding the product specific register offsets
  40. * @controller_formats: pointer to the array of possible formats that the
  41. * controller can output
  42. @@ -320,6 +323,8 @@ struct isc_device {
  43. void (*config_ctrls)(struct isc_device *isc,
  44. const struct v4l2_ctrl_ops *ops);
  45. +
  46. + void (*adapt_pipeline)(struct isc_device *isc);
  47. };
  48. struct isc_reg_offsets offsets;
  49. --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  50. +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  51. @@ -54,6 +54,10 @@
  52. #define ISC_CLK_MAX_DIV 255
  53. +#define ISC_SAMA5D2_PIPELINE \
  54. + (WB_ENABLE | CFA_ENABLE | CC_ENABLE | GAM_ENABLES | CSC_ENABLE | \
  55. + CBC_ENABLE | SUB422_ENABLE | SUB420_ENABLE)
  56. +
  57. /* This is a list of the formats that the ISC can *output* */
  58. static const struct isc_format sama5d2_controller_formats[] = {
  59. {
  60. @@ -257,6 +261,11 @@ static void isc_sama5d2_config_rlp(struc
  61. ISC_RLP_CFG_MODE_MASK, rlp_mode);
  62. }
  63. +static void isc_sama5d2_adapt_pipeline(struct isc_device *isc)
  64. +{
  65. + isc->try_config.bits_pipeline &= ISC_SAMA5D2_PIPELINE;
  66. +}
  67. +
  68. /* Gamma table with gamma 1/2.2 */
  69. static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
  70. /* 0 --> gamma 1/1.8 */
  71. @@ -431,6 +440,8 @@ static int atmel_isc_probe(struct platfo
  72. isc->config_rlp = isc_sama5d2_config_rlp;
  73. isc->config_ctrls = isc_sama5d2_config_ctrls;
  74. + isc->adapt_pipeline = isc_sama5d2_adapt_pipeline;
  75. +
  76. isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
  77. isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;
  78. isc->offsets.sub422 = ISC_SAMA5D2_SUB422_OFFSET;