media: atmel: atmel-isc: add support for xisc
cover media: atmel: atmel-isc: add support for xisc
Hello,
This series adds support for a variant of the ISC named XISC. This block is present in the product named sama7g5.
I started by moving code around, the code which was specialized for sama5d2 type of ISC, to have it inside the dedicated sama5d2 file.
I added several new pipeline elements to the code base, which would be common to sama5d2 and the new sama7g5, but only used by the new style pipeline.
I separated the input and output formats on a per-product separate array.
I added the new sama7g5 compatible driver for the xisc, which is similar with the sama5d2, but with differences in terms of DT, clocks and callbacks to specific operations.
I added the binding for the xisc by copying and modifying the existing isc one. I know that it has to be converted to yaml, and I will do that if it looks good.
Feedback is appreciated.
Thanks,
Eugen
Eugen Hristev (30):
media: atmel: atmel-isc: specialize gamma table into product specific
media: atmel: atmel-isc: specialize driver name constant
media: atmel: atmel-isc: add checks for limiting frame sizes
media: atmel: atmel-isc: specialize max width and max height
media: atmel: atmel-isc: specialize dma cfg
media: atmel: atmel-isc: extract CSC submodule config into separate
function
media: atmel: atmel-isc-base: add id to clock debug message
media: atmel: atmel-isc: create register offsets struct
media: atmel: atmel-isc: extract CBC submodule config into separate
function
media: atmel: atmel-isc: add CBC to the reg offsets struct
media: atmel: atmel-isc: add SUB422 and SUB420 to register offsets
media: atmel: atmel-isc: add RLP to register offsets
media: atmel: atmel-isc: add HIS to register offsets
media: atmel: atmel-isc: add DMA to register offsets
media: atmel: atmel-isc: add support for version register
media: atmel: atmel-isc: add his_entry to register offsets
media: atmel: atmel-isc: add register description for additional
modules
media: atmel: atmel-isc: extend pipeline with extra modules
media: atmel: atmel-isc: add CC initialization function
media: atmel: atmel-isc: create product specific v4l2 controls config
media: atmel: atmel-isc: create callback for DPC submodule product
specific
media: atmel: atmel-isc: create callback for GAM submodule product
specific
media: atmel: atmel-isc: create callback for RLP submodule product
specific
media: atmel: atmel-isc: move the formats list into product specific
code
media: atmel: atmel-isc: create an adapt pipeline callback for product
specific
media: atmel: atmel-isc-regs: add additional fields for sama7g5 type
pipeline
media: atmel: atmel-isc-base: add support for more formats and
additional pipeline modules
dt-bindings: media: atmel: add microchip-xisc binding
media: atmel: atmel-isc-sama5d2: remove duplicate define
media: atmel: atmel-isc: add microchip-xisc driver
.../bindings/media/microchip-xisc.txt | 64 ++ drivers/media/platform/Makefile | 1 + drivers/media/platform/atmel/Kconfig | 11 + drivers/media/platform/atmel/Makefile | 2 + drivers/media/platform/atmel/atmel-isc-base.c | 381 ++++------- drivers/media/platform/atmel/atmel-isc-regs.h | 133 +++- drivers/media/platform/atmel/atmel-isc.h | 122 +++- .../media/platform/atmel/atmel-sama5d2-isc.c | 300 +++++++- .../media/platform/atmel/atmel-sama7g5-isc.c | 644 ++++++++++++++++++ 9 files changed, 1381 insertions(+), 277 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/microchip-xisc.txt create mode 100644 drivers/media/platform/atmel/atmel-sama7g5-isc.c
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/30 media: atmel: atmel-isc: specialize gamma table into product specific
Separate the gamma table from the isc base file into the specific sama5d2 product file.
Add a pointer to the gamma table and entries count inside the platform driver specific struct.
--- drivers/media/platform/atmel/atmel-isc-base.c | 47 ++----------------- drivers/media/platform/atmel/atmel-isc.h | 11 +++-- .../media/platform/atmel/atmel-sama5d2-isc.c | 45 ++++++++++++++++++ 3 files changed, 56 insertions(+), 47 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +3 -44
@@ -176,48 +176,6 @@ struct isc_format formats_list[] = { }; -/* Gamma table with gamma 1/2.2 */ -const u32 isc_gamma_table[GAMMA_MAX +1 ][GAMMA_ENTRIES ] = { -/* 0 --> gamma 1/1.8 */ - {0x65 ,0x66002F ,0x950025 ,0xBB0020 ,0xDB001D ,0xF8001A , -0x1130018 ,0x12B0017 ,0x1420016 ,0x1580014 ,0x16D0013 ,0x1810012 , -0x1940012 ,0x1A60012 ,0x1B80011 ,0x1C90010 ,0x1DA0010 ,0x1EA000F , -0x1FA000F ,0x209000F ,0x218000F ,0x227000E ,0x235000E ,0x243000E , -0x251000E ,0x25F000D ,0x26C000D ,0x279000D ,0x286000D ,0x293000C , -0x2A0000C ,0x2AC000C ,0x2B8000C ,0x2C4000C ,0x2D0000B ,0x2DC000B , -0x2E7000B ,0x2F3000B ,0x2FE000B ,0x309000B ,0x314000B ,0x31F000A , -0x32A000A ,0x334000B ,0x33F000A ,0x349000A ,0x354000A ,0x35E000A , -0x368000A ,0x372000A ,0x37C000A ,0x386000A ,0x3900009 ,0x399000A , -0x3A30009 ,0x3AD0009 ,0x3B60009 ,0x3BF000A ,0x3C90009 ,0x3D20009 , -0x3DB0009 ,0x3E40009 ,0x3ED0009 ,0x3F60009 }, - -/* 1 --> gamma 1/2 */ - {0x7F ,0x800034 ,0xB50028 ,0xDE0021 ,0x100001E ,0x11E001B , -0x1390019 ,0x1520017 ,0x16A0015 ,0x1800014 ,0x1940014 ,0x1A80013 , -0x1BB0012 ,0x1CD0011 ,0x1DF0010 ,0x1EF0010 ,0x200000F ,0x20F000F , -0x21F000E ,0x22D000F ,0x23C000E ,0x24A000E ,0x258000D ,0x265000D , -0x273000C ,0x27F000D ,0x28C000C ,0x299000C ,0x2A5000C ,0x2B1000B , -0x2BC000C ,0x2C8000B ,0x2D3000C ,0x2DF000B ,0x2EA000A ,0x2F5000A , -0x2FF000B ,0x30A000A ,0x314000B ,0x31F000A ,0x329000A ,0x333000A , -0x33D0009 ,0x3470009 ,0x350000A ,0x35A0009 ,0x363000A ,0x36D0009 , -0x3760009 ,0x37F0009 ,0x3880009 ,0x3910009 ,0x39A0009 ,0x3A30009 , -0x3AC0008 ,0x3B40009 ,0x3BD0008 ,0x3C60008 ,0x3CE0008 ,0x3D60009 , -0x3DF0008 ,0x3E70008 ,0x3EF0008 ,0x3F70008 }, - -/* 2 --> gamma 1/2.2 */ - {0x99 ,0x9B0038 ,0xD4002A ,0xFF0023 ,0x122001F ,0x141001B , -0x15D0019 ,0x1760017 ,0x18E0015 ,0x1A30015 ,0x1B80013 ,0x1CC0012 , -0x1DE0011 ,0x1F00010 ,0x2010010 ,0x2110010 ,0x221000F ,0x230000F , -0x23F000E ,0x24D000E ,0x25B000D ,0x269000C ,0x276000C ,0x283000C , -0x28F000C ,0x29B000C ,0x2A7000C ,0x2B3000B ,0x2BF000B ,0x2CA000B , -0x2D5000B ,0x2E0000A ,0x2EB000A ,0x2F5000A ,0x2FF000A ,0x30A000A , -0x3140009 ,0x31E0009 ,0x327000A ,0x3310009 ,0x33A0009 ,0x3440009 , -0x34D0009 ,0x3560009 ,0x35F0009 ,0x3680008 ,0x3710008 ,0x3790009 , -0x3820008 ,0x38A0008 ,0x3930008 ,0x39B0008 ,0x3A30008 ,0x3AB0008 , -0x3B30008 ,0x3BB0008 ,0x3C30008 ,0x3CB0007 ,0x3D20008 ,0x3DA0007 , -0x3E20007 ,0x3E90007 ,0x3F00008 ,0x3F80007 }, -}; -#define ISC_IS_FORMAT_RAW (mbus_code) \ (((mbus_code) & 0xf000) == 0x3000)
@@ -683,7 +641,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline)regmap_write (regmap,ISC_CFA_CFG , bay_cfg |ISC_CFA_CFG_EITPOL ); - gamma = &isc_gamma_table[ctrls->gamma_index][0 ]; + gamma = &isc->gamma_table[ctrls->gamma_index][0 ];regmap_bulk_write (regmap,ISC_GAM_BENTRY , gamma,GAMMA_ENTRIES );regmap_bulk_write (regmap,ISC_GAM_GENTRY , gamma,GAMMA_ENTRIES );regmap_bulk_write (regmap,ISC_GAM_RENTRY , gamma,GAMMA_ENTRIES );
@@ -2070,7 +2028,8 @@ static int isc_ctrl_init(struct isc_device *isc)v4l2_ctrl_new_std (hdl, ops,V4L2_CID_BRIGHTNESS ,-1024 ,1023 ,1 ,0 );v4l2_ctrl_new_std (hdl, ops,V4L2_CID_CONTRAST ,-2048 ,2047 ,1 ,256 ); -v4l2_ctrl_new_std (hdl, ops,V4L2_CID_GAMMA ,0 ,GAMMA_MAX ,1 ,2 ); +v4l2_ctrl_new_std (hdl, ops,V4L2_CID_GAMMA ,0 , isc->gamma_max,1 , + isc->gamma_max); isc->awb_ctrl =v4l2_ctrl_new_std (hdl, &isc_awb_ops,V4L2_CID_AUTO_WHITE_BALANCE ,0 ,1 ,1 ,1 );
drivers/media/platform/atmel/atmel-isc.h +8 -3
@@ -187,6 +187,10 @@ struct isc_ctrls {* * @current_subdev: current subdevice: the sensor * @subdev_entities: list of subdevice entitites +* +* @gamma_table: pointer to the table with gamma values, has +* gamma_max sets of GAMMA_ENTRIES entries each +* @gamma_max: maximum number of sets of inside the gamma_table */ struct isc_device {struct regmap *regmap;
@@ -245,16 +249,17 @@ struct isc_device {struct v4l2_ctrl *gr_off_ctrl;struct v4l2_ctrl *gb_off_ctrl; }; -}; -#define GAMMA_MAX 2#define GAMMA_ENTRIES 64 +/* pointer to the defined gamma table */ +const u32 (*gamma_table)[GAMMA_ENTRIES ]; +u32 gamma_max; +};#define ATMEL_ISC_NAME "atmel-isc"extern struct isc_format formats_list[];extern const struct isc_format controller_formats[]; -extern const u32 isc_gamma_table[GAMMA_MAX +1 ][GAMMA_ENTRIES ];extern const struct regmap_config isc_regmap_config;extern const struct v4l2_async_notifier_operations isc_async_ops;
drivers/media/platform/atmel/atmel-sama5d2-isc.c +45 -0
57 lines not on this page · raw message
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/30 media: atmel: atmel-isc: specialize driver name constant
In reply to Eugen HristevThe driver name constant must defined based on product driver, thus moving the constant directly where it's required. This will allow each ISC based product to define it's own name.
--- drivers/media/platform/atmel/atmel-isc-base.c | 4 ++-- drivers/media/platform/atmel/atmel-isc.h | 2 -- drivers/media/platform/atmel/atmel-sama5d2-isc.c | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +2 -2
@@ -896,7 +896,7 @@ static int isc_querycap(struct file *file, void *priv, {struct isc_device *isc =video_drvdata (file); -strscpy (cap->driver,ATMEL_ISC_NAME ,sizeof (cap->driver)); +strscpy (cap->driver,"microchip-isc" ,sizeof (cap->driver));strscpy (cap->card,"Atmel Image Sensor Controller" ,sizeof (cap->card));snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , isc->v4l2_dev.name);
@@ -2246,7 +2246,7 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier) }/* Register video device */ -strscpy (vdev->name,ATMEL_ISC_NAME ,sizeof (vdev->name)); +strscpy (vdev->name,"microchip-isc" ,sizeof (vdev->name)); vdev->release = video_device_release_empty; vdev->fops = &isc_fops; vdev->ioctl_ops = &isc_ioctl_ops;
drivers/media/platform/atmel/atmel-isc.h +0 -2
@@ -256,8 +256,6 @@ struct isc_device {u32 gamma_max; }; -#define ATMEL_ISC_NAME "atmel-isc" -extern struct isc_format formats_list[];extern const struct isc_format controller_formats[];extern const struct regmap_config isc_regmap_config;
drivers/media/platform/atmel/atmel-sama5d2-isc.c +2 -2
@@ -185,7 +185,7 @@ static int atmel_isc_probe(struct platform_device *pdev)return irq; ret =devm_request_irq (dev, irq, isc_interrupt,0 , -ATMEL_ISC_NAME , isc); +"atmel-sama5d2-isc" , isc);if (ret <0 ) {dev_err (dev,"can't register ISR for IRQ %u (ret=%i)\n" , irq, ret);
@@ -364,7 +364,7 @@ static struct platform_driver atmel_isc_driver = { .probe = atmel_isc_probe, .remove = atmel_isc_remove, .driver = { - .name = ATMEL_ISC_NAME, + .name = "atmel-sama5d2-isc", .pm = &atmel_isc_dev_pm_ops, .of_match_table = of_match_ptr(atmel_isc_of_match), },
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 3/30 media: atmel: atmel-isc: add checks for limiting frame sizes
In reply to Eugen HristevWhen calling the subdev, certain subdev drivers will overwrite the frame size and adding sizes which are beyond the ISC's capabilities. Thus we need to ensure the frame size is cropped to the maximum caps.
--- drivers/media/platform/atmel/atmel-isc-base.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/media/platform/atmel/atmel-isc-base.c +12 -0
@@ -1326,6 +1326,12 @@ static int isc_try_fmt(struct isc_device *isc, struct v4l2_format *f,v4l2_fill_pix_format (pixfmt, &format.format); +/* Limit to Atmel ISC hardware capabilities */ +if (pixfmt->width >ISC_MAX_SUPPORT_WIDTH ) + pixfmt->width =ISC_MAX_SUPPORT_WIDTH ; +if (pixfmt->height >ISC_MAX_SUPPORT_HEIGHT ) + pixfmt->height =ISC_MAX_SUPPORT_HEIGHT ; + pixfmt->field =V4L2_FIELD_NONE ; pixfmt->bytesperline = (pixfmt->width * isc->try_config.bpp) >>3 ; pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height;
@@ -1361,6 +1367,12 @@ static int isc_set_fmt(struct isc_device *isc, struct v4l2_format *f)if (ret <0 )return ret; +/* Limit to Atmel ISC hardware capabilities */ +if (pixfmt->width >ISC_MAX_SUPPORT_WIDTH ) + pixfmt->width =ISC_MAX_SUPPORT_WIDTH ; +if (pixfmt->height >ISC_MAX_SUPPORT_HEIGHT ) + pixfmt->height =ISC_MAX_SUPPORT_HEIGHT ; + isc->fmt = *f; if (isc->try_config.sd_format && isc->config.sd_format &&
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 4/30 media: atmel: atmel-isc: specialize max width and max height
In reply to Eugen HristevMove the max width and max height constants to the product specific driver and have them in the device struct.
--- drivers/media/platform/atmel/atmel-isc-base.c | 28 +++++++++---------- drivers/media/platform/atmel/atmel-isc.h | 9 ++++-- .../media/platform/atmel/atmel-sama5d2-isc.c | 7 +++-- 3 files changed, 25 insertions(+), 19 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +14 -14
@@ -1204,8 +1204,8 @@ static void isc_try_fse(struct isc_device *isc,* just use the maximum ISC can receive. */ if (ret) { - pad_cfg->try_crop.width =ISC_MAX_SUPPORT_WIDTH ; - pad_cfg->try_crop.height =ISC_MAX_SUPPORT_HEIGHT ; + pad_cfg->try_crop.width = isc->max_width; + pad_cfg->try_crop.height = isc->max_height; }else { pad_cfg->try_crop.width = fse.max_width; pad_cfg->try_crop.height = fse.max_height;
@@ -1282,10 +1282,10 @@ static int isc_try_fmt(struct isc_device *isc, struct v4l2_format *f, isc->try_config.sd_format = sd_fmt;/* Limit to Atmel ISC hardware capabilities */ -if (pixfmt->width >ISC_MAX_SUPPORT_WIDTH ) - pixfmt->width =ISC_MAX_SUPPORT_WIDTH ; -if (pixfmt->height >ISC_MAX_SUPPORT_HEIGHT ) - pixfmt->height =ISC_MAX_SUPPORT_HEIGHT ; +if (pixfmt->width > isc->max_width) + pixfmt->width = isc->max_width; +if (pixfmt->height > isc->max_height) + pixfmt->height = isc->max_height;/* * The mbus format is the one the subdev outputs.
@@ -1327,10 +1327,10 @@ static int isc_try_fmt(struct isc_device *isc, struct v4l2_format *f,v4l2_fill_pix_format (pixfmt, &format.format);/* Limit to Atmel ISC hardware capabilities */ -if (pixfmt->width >ISC_MAX_SUPPORT_WIDTH ) - pixfmt->width =ISC_MAX_SUPPORT_WIDTH ; -if (pixfmt->height >ISC_MAX_SUPPORT_HEIGHT ) - pixfmt->height =ISC_MAX_SUPPORT_HEIGHT ; +if (pixfmt->width > isc->max_width) + pixfmt->width = isc->max_width; +if (pixfmt->height > isc->max_height) + pixfmt->height = isc->max_height; pixfmt->field =V4L2_FIELD_NONE ; pixfmt->bytesperline = (pixfmt->width * isc->try_config.bpp) >>3 ;
@@ -1368,10 +1368,10 @@ static int isc_set_fmt(struct isc_device *isc, struct v4l2_format *f)return ret;/* Limit to Atmel ISC hardware capabilities */ -if (pixfmt->width >ISC_MAX_SUPPORT_WIDTH ) - pixfmt->width =ISC_MAX_SUPPORT_WIDTH ; -if (pixfmt->height >ISC_MAX_SUPPORT_HEIGHT ) - pixfmt->height =ISC_MAX_SUPPORT_HEIGHT ; +if (f->fmt.pix.width > isc->max_width) + f->fmt.pix.width = isc->max_width; +if (f->fmt.pix.height > isc->max_height) + f->fmt.pix.height = isc->max_height; isc->fmt = *f;
drivers/media/platform/atmel/atmel-isc.h +6 -3
@@ -10,9 +10,6 @@*/ #ifndef _ATMEL_ISC_H_ -#define ISC_MAX_SUPPORT_WIDTH 2592 -#define ISC_MAX_SUPPORT_HEIGHT 1944 -#define ISC_CLK_MAX_DIV 255 enum isc_clk_id {
@@ -191,6 +188,9 @@ struct isc_ctrls {* @gamma_table: pointer to the table with gamma values, has * gamma_max sets of GAMMA_ENTRIES entries each * @gamma_max: maximum number of sets of inside the gamma_table +* +* @max_width: maximum frame width, dependent on the internal RAM +* @max_height: maximum frame height, dependent on the internal RAM */ struct isc_device {struct regmap *regmap;
@@ -254,6 +254,9 @@ struct isc_device {/* pointer to the defined gamma table */ const u32 (*gamma_table)[GAMMA_ENTRIES ];u32 gamma_max; + +u32 max_width; +u32 max_height; };extern struct isc_format formats_list[];
drivers/media/platform/atmel/atmel-sama5d2-isc.c +5 -2
@@ -49,8 +49,8 @@#include "atmel-isc-regs.h" #include "atmel-isc.h" -#define ISC_MAX_SUPPORT_WIDTH 2592 -#define ISC_MAX_SUPPORT_HEIGHT 1944 +#define ISC_SAMA5D2_MAX_SUPPORT_WIDTH 2592 +#define ISC_SAMA5D2_MAX_SUPPORT_HEIGHT 1944#define ISC_CLK_MAX_DIV 255
@@ -195,6 +195,9 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->gamma_table = isc_sama5d2_gamma_table; isc->gamma_max =2 ; + isc->max_width =ISC_SAMA5D2_MAX_SUPPORT_WIDTH ; + isc->max_height =ISC_SAMA5D2_MAX_SUPPORT_HEIGHT ; + ret =isc_pipeline_init (isc);if (ret)return ret;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 5/30 media: atmel: atmel-isc: specialize dma cfg
In reply to Eugen HristevThe dma configuration (DCFG) is specific to the product. Move this configuration in the product specific driver, and add the field inside the driver struct.
--- drivers/media/platform/atmel/atmel-isc-base.c | 3 +-- drivers/media/platform/atmel/atmel-isc.h | 2 ++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +1 -2
@@ -716,8 +716,7 @@ static int isc_configure(struct isc_device *isc) rlp_mode = isc->config.rlp_cfg_mode; pipeline = isc->config.bits_pipeline; - dcfg = isc->config.dcfg_imode | -ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ; + dcfg = isc->config.dcfg_imode | isc->dcfg; pfe_cfg0 |= subdev->pfe_cfg0 |ISC_PFE_CFG0_MODE_PROGRESSIVE ; mask = ISC_PFE_CFG0_BPS_MASK | ISC_PFE_CFG0_HPOL_LOW |
drivers/media/platform/atmel/atmel-isc.h +2 -0
@@ -150,6 +150,7 @@ struct isc_ctrls {* @hclock: Hclock clock input (refer datasheet) * @ispck: iscpck clock (refer datasheet) * @isc_clks: ISC clocks +* @dcfg: DMA master configuration, architecture dependent * * @dev: Registered device driver * @v4l2_dev: v4l2 registered device
@@ -197,6 +198,7 @@ struct isc_device {struct clk *hclock;struct clk *ispck;struct isc_clk isc_clks[2 ]; +u32 dcfg;struct device *dev;struct v4l2_device v4l2_dev;
drivers/media/platform/atmel/atmel-sama5d2-isc.c +3 -0
@@ -198,6 +198,9 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->max_width =ISC_SAMA5D2_MAX_SUPPORT_WIDTH ; isc->max_height =ISC_SAMA5D2_MAX_SUPPORT_HEIGHT ; +/* sama5d2-isc - 8 bits per beat */ + isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ; + ret =isc_pipeline_init (isc);if (ret)return ret;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 6/30 media: atmel: atmel-isc: extract CSC submodule config into separate function
In reply to Eugen HristevThe CSC submodule should be initialized in the product specific driver as it's product specific. Other products can implement it differently.
--- drivers/media/platform/atmel/atmel-isc-base.c | 8 +------- drivers/media/platform/atmel/atmel-isc.h | 7 +++++++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 7 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +1 -7
@@ -646,13 +646,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline)regmap_bulk_write (regmap,ISC_GAM_GENTRY , gamma,GAMMA_ENTRIES );regmap_bulk_write (regmap,ISC_GAM_RENTRY , gamma,GAMMA_ENTRIES ); -/* Convert RGB to YUV */ -regmap_write (regmap,ISC_CSC_YR_YG ,0x42 | (0x81 <<16 )); -regmap_write (regmap,ISC_CSC_YB_OY ,0x19 | (0x10 <<16 )); -regmap_write (regmap,ISC_CSC_CBR_CBG ,0xFDA | (0xFB6 <<16 )); -regmap_write (regmap,ISC_CSC_CBB_OCB ,0x70 | (0x80 <<16 )); -regmap_write (regmap,ISC_CSC_CRR_CRG ,0x70 | (0xFA2 <<16 )); -regmap_write (regmap,ISC_CSC_CRB_OCR ,0xFEE | (0x80 <<16 )); + isc->config_csc (isc);regmap_write (regmap,ISC_CBC_BRIGHT , ctrls->brightness);regmap_write (regmap,ISC_CBC_CONTRAST , ctrls->contrast);
drivers/media/platform/atmel/atmel-isc.h +7 -0
@@ -192,6 +192,9 @@ struct isc_ctrls {* * @max_width: maximum frame width, dependent on the internal RAM * @max_height: maximum frame height, dependent on the internal RAM +* +* @config_csc: pointer to a function that initializes product +* specific CSC module */ struct isc_device {struct regmap *regmap;
@@ -259,6 +262,10 @@ struct isc_device {u32 max_width;u32 max_height; + +struct { +void (*config_csc)(struct isc_device *isc); + }; };extern struct isc_format formats_list[];
drivers/media/platform/atmel/atmel-sama5d2-isc.c +15 -0
@@ -54,6 +54,19 @@#define ISC_CLK_MAX_DIV 255 +void isc_sama5d2_config_csc (struct isc_device *isc) +{ +struct regmap *regmap = isc->regmap; + +/* Convert RGB to YUV */ +regmap_write (regmap,ISC_CSC_YR_YG ,0x42 | (0x81 <<16 )); +regmap_write (regmap,ISC_CSC_YB_OY ,0x19 | (0x10 <<16 )); +regmap_write (regmap,ISC_CSC_CBR_CBG ,0xFDA | (0xFB6 <<16 )); +regmap_write (regmap,ISC_CSC_CBB_OCB ,0x70 | (0x80 <<16 )); +regmap_write (regmap,ISC_CSC_CRR_CRG ,0x70 | (0xFA2 <<16 )); +regmap_write (regmap,ISC_CSC_CRB_OCR ,0xFEE | (0x80 <<16 )); +} +/* Gamma table with gamma 1/2.2 */ const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES ] = {/* 0 --> gamma 1/1.8 */
@@ -198,6 +211,8 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->max_width =ISC_SAMA5D2_MAX_SUPPORT_WIDTH ; isc->max_height =ISC_SAMA5D2_MAX_SUPPORT_HEIGHT ; + isc->config_csc = isc_sama5d2_config_csc; +/* sama5d2-isc - 8 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 7/30 media: atmel: atmel-isc-base: add id to clock debug message
In reply to Eugen HristevAdd the clock id to the debug message regarding clock setup
--- drivers/media/platform/atmel/atmel-isc-base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +2 -2
@@ -277,8 +277,8 @@ static int isc_clk_enable(struct clk_hw *hw)unsigned long flags;unsigned int status; -dev_dbg (isc_clk->dev,"ISC CLK: %s, div = %d, parent id = %d\n" , - __func__, isc_clk->div, isc_clk->parent_id); +dev_dbg (isc_clk->dev,"ISC CLK: %s, id = %d, div = %d, parent id = %d\n" , + __func__, id, isc_clk->div, isc_clk->parent_id);spin_lock_irqsave (&isc_clk->lock, flags); regmap_update_bits(regmap, ISC_CLKCFG,
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 8/30 media: atmel: atmel-isc: create register offsets struct
In reply to Eugen HristevCreate a struct that holds register offsets that are product specific. Add initially the CSC register.
This allows each product that contains a variant of the ISC to add their own register offset.
--- drivers/media/platform/atmel/atmel-isc-base.c | 2 +- drivers/media/platform/atmel/atmel-isc-regs.h | 3 +++ drivers/media/platform/atmel/atmel-isc.h | 12 +++++++++++ .../media/platform/atmel/atmel-sama5d2-isc.c | 20 +++++++++++++------ 4 files changed, 30 insertions(+), 7 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +1 -1
@@ -2311,7 +2311,7 @@ int isc_pipeline_init(struct isc_device *isc)REG_FIELD (ISC_GAM_CTRL ,1 ,1 ),REG_FIELD (ISC_GAM_CTRL ,2 ,2 ),REG_FIELD (ISC_GAM_CTRL ,3 ,3 ), -REG_FIELD (ISC_CSC_CTRL ,0 ,0 ), +REG_FIELD (ISC_CSC_CTRL + isc->offsets.csc,0 ,0 ),REG_FIELD (ISC_CBC_CTRL ,0 ,0 ),REG_FIELD (ISC_SUB422_CTRL ,0 ,0 ), REG_FIELD(ISC_SUB420_CTRL, 0, 0),
drivers/media/platform/atmel/atmel-isc-regs.h +3 -0
@@ -153,6 +153,9 @@/* ISC_Gamma Correction Green Entry Register */ #define ISC_GAM_RENTRY 0x00000298 +/* Offset for CSC register specific to sama5d2 product */ +#define ISC_SAMA5D2_CSC_OFFSET 0 +/* Color Space Conversion Control Register */ #define ISC_CSC_CTRL 0x00000398
drivers/media/platform/atmel/atmel-isc.h +12 -0
@@ -144,6 +144,14 @@ struct isc_ctrls {#define ISC_PIPE_LINE_NODE_NUM 11 +/* +* struct isc_reg_offsets - ISC device register offsets +* @csc: Offset for the CSC register +*/ +struct isc_reg_offsets { +u32 csc; +}; +/* * struct isc_device - ISC device driver data/config struct * @regmap: Register map
@@ -195,6 +203,8 @@ struct isc_ctrls {* * @config_csc: pointer to a function that initializes product * specific CSC module +* +* @offsets: struct holding the product specific register offsets */ struct isc_device {struct regmap *regmap;
@@ -266,6 +276,8 @@ struct isc_device {struct {void (*config_csc)(struct isc_device *isc); }; + +struct isc_reg_offsets offsets; };extern struct isc_format formats_list[];
drivers/media/platform/atmel/atmel-sama5d2-isc.c +14 -6
@@ -59,12 +59,18 @@ void isc_sama5d2_config_csc(struct isc_device *isc)struct regmap *regmap = isc->regmap;/* Convert RGB to YUV */ -regmap_write (regmap,ISC_CSC_YR_YG ,0x42 | (0x81 <<16 )); -regmap_write (regmap,ISC_CSC_YB_OY ,0x19 | (0x10 <<16 )); -regmap_write (regmap,ISC_CSC_CBR_CBG ,0xFDA | (0xFB6 <<16 )); -regmap_write (regmap,ISC_CSC_CBB_OCB ,0x70 | (0x80 <<16 )); -regmap_write (regmap,ISC_CSC_CRR_CRG ,0x70 | (0xFA2 <<16 )); -regmap_write (regmap,ISC_CSC_CRB_OCR ,0xFEE | (0x80 <<16 )); +regmap_write (regmap,ISC_CSC_YR_YG + isc->offsets.csc, +0x42 | (0x81 <<16 )); +regmap_write (regmap,ISC_CSC_YB_OY + isc->offsets.csc, +0x19 | (0x10 <<16 )); +regmap_write (regmap,ISC_CSC_CBR_CBG + isc->offsets.csc, +0xFDA | (0xFB6 <<16 )); +regmap_write (regmap,ISC_CSC_CBB_OCB + isc->offsets.csc, +0x70 | (0x80 <<16 )); +regmap_write (regmap,ISC_CSC_CRR_CRG + isc->offsets.csc, +0x70 | (0xFA2 <<16 )); +regmap_write (regmap,ISC_CSC_CRB_OCR + isc->offsets.csc, +0xFEE | (0x80 <<16 )); }/* Gamma table with gamma 1/2.2 */
@@ -213,6 +219,8 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->config_csc = isc_sama5d2_config_csc; + isc->offsets.csc =ISC_SAMA5D2_CSC_OFFSET ; +/* sama5d2-isc - 8 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 9/30 media: atmel: atmel-isc: extract CBC submodule config into separate function
In reply to Eugen HristevThe CBC submodule should be initialized in the product specific driver as it's product specific. Other products can implement it differently
--- drivers/media/platform/atmel/atmel-isc-base.c | 4 +--- drivers/media/platform/atmel/atmel-isc.h | 3 +++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 9 +++++++++ 3 files changed, 13 insertions(+), 3 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +1 -3
@@ -647,9 +647,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline)regmap_bulk_write (regmap,ISC_GAM_RENTRY , gamma,GAMMA_ENTRIES ); isc->config_csc (isc); - -regmap_write (regmap,ISC_CBC_BRIGHT , ctrls->brightness); -regmap_write (regmap,ISC_CBC_CONTRAST , ctrls->contrast); + isc->config_cbc (isc); }static int isc_update_profile (struct isc_device *isc)
drivers/media/platform/atmel/atmel-isc.h +3 -0
@@ -203,6 +203,8 @@ struct isc_reg_offsets {* * @config_csc: pointer to a function that initializes product * specific CSC module +* @config_cbc: pointer to a function that initializes product +* specific CBC module * * @offsets: struct holding the product specific register offsets */
@@ -275,6 +277,7 @@ struct isc_device {struct {void (*config_csc)(struct isc_device *isc); +void (*config_cbc)(struct isc_device *isc); };struct isc_reg_offsets offsets;
drivers/media/platform/atmel/atmel-sama5d2-isc.c +9 -0
@@ -73,6 +73,14 @@ void isc_sama5d2_config_csc(struct isc_device *isc) 0xFEE | (0x80 << 16)); } +void isc_sama5d2_config_cbc (struct isc_device *isc) +{ +struct regmap *regmap = isc->regmap; + +regmap_write (regmap,ISC_CBC_BRIGHT , isc->ctrls.brightness); +regmap_write (regmap,ISC_CBC_CONTRAST , isc->ctrls.contrast); +} +/* Gamma table with gamma 1/2.2 */ const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES ] = {/* 0 --> gamma 1/1.8 */
@@ -218,6 +226,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->max_height =ISC_SAMA5D2_MAX_SUPPORT_HEIGHT ; isc->config_csc = isc_sama5d2_config_csc; + isc->config_cbc = isc_sama5d2_config_cbc; isc->offsets.csc =ISC_SAMA5D2_CSC_OFFSET ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 10/30 media: atmel: atmel-isc: add CBC to the reg offsets struct
In reply to Eugen HristevAdd cbc to the reg offsets struct. This will allow different products to have a different reg offset for this particular module.
--- drivers/media/platform/atmel/atmel-isc-base.c | 2 +- drivers/media/platform/atmel/atmel-isc-regs.h | 3 +++ drivers/media/platform/atmel/atmel-isc.h | 2 ++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 7 +++++-- 4 files changed, 11 insertions(+), 3 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +1 -1
@@ -2310,7 +2310,7 @@ int isc_pipeline_init(struct isc_device *isc)REG_FIELD (ISC_GAM_CTRL ,2 ,2 ),REG_FIELD (ISC_GAM_CTRL ,3 ,3 ),REG_FIELD (ISC_CSC_CTRL + isc->offsets.csc,0 ,0 ), -REG_FIELD (ISC_CBC_CTRL ,0 ,0 ), +REG_FIELD (ISC_CBC_CTRL + isc->offsets.cbc,0 ,0 ),REG_FIELD (ISC_SUB422_CTRL ,0 ,0 ), REG_FIELD(ISC_SUB420_CTRL, 0, 0), };
drivers/media/platform/atmel/atmel-isc-regs.h +3 -0
@@ -177,6 +177,9 @@/* Color Space Conversion CRB OCR Register */ #define ISC_CSC_CRB_OCR 0x000003b0 +/* Offset for CBC register specific to sama5d2 product */ +#define ISC_SAMA5D2_CBC_OFFSET 0 +/* Contrast And Brightness Control Register */ #define ISC_CBC_CTRL 0x000003b4
drivers/media/platform/atmel/atmel-isc.h +2 -0
@@ -147,9 +147,11 @@ struct isc_ctrls {/* * struct isc_reg_offsets - ISC device register offsets * @csc: Offset for the CSC register +* @cbc: Offset for the CBC register */ struct isc_reg_offsets {u32 csc; +u32 cbc; };/*
drivers/media/platform/atmel/atmel-sama5d2-isc.c +5 -2
@@ -77,8 +77,10 @@ void isc_sama5d2_config_cbc(struct isc_device *isc) {struct regmap *regmap = isc->regmap; -regmap_write (regmap,ISC_CBC_BRIGHT , isc->ctrls.brightness); -regmap_write (regmap,ISC_CBC_CONTRAST , isc->ctrls.contrast); +regmap_write (regmap,ISC_CBC_BRIGHT + isc->offsets.cbc, + isc->ctrls.brightness); +regmap_write (regmap,ISC_CBC_CONTRAST + isc->offsets.cbc, + isc->ctrls.contrast); }/* Gamma table with gamma 1/2.2 */
@@ -229,6 +231,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->config_cbc = isc_sama5d2_config_cbc; isc->offsets.csc =ISC_SAMA5D2_CSC_OFFSET ; + isc->offsets.cbc =ISC_SAMA5D2_CBC_OFFSET ;/* sama5d2-isc - 8 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 11/30 media: atmel: atmel-isc: add SUB422 and SUB420 to register offsets
In reply to Eugen HristevAdd sub420 and sub422 to the reg offsets struct.
This will allow different products to have a different reg offset for these particular modules.
--- drivers/media/platform/atmel/atmel-isc-base.c | 4 ++-- drivers/media/platform/atmel/atmel-isc-regs.h | 4 ++++ drivers/media/platform/atmel/atmel-isc.h | 4 ++++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +2 -2
@@ -2311,8 +2311,8 @@ int isc_pipeline_init(struct isc_device *isc)REG_FIELD (ISC_GAM_CTRL ,3 ,3 ),REG_FIELD (ISC_CSC_CTRL + isc->offsets.csc,0 ,0 ),REG_FIELD (ISC_CBC_CTRL + isc->offsets.cbc,0 ,0 ), -REG_FIELD (ISC_SUB422_CTRL ,0 ,0 ), - REG_FIELD(ISC_SUB420_CTRL, 0, 0), +REG_FIELD (ISC_SUB422_CTRL + isc->offsets.sub422,0 ,0 ), + REG_FIELD(ISC_SUB420_CTRL + isc->offsets.sub420, 0, 0), };for (i =0 ; i <ISC_PIPE_LINE_NODE_NUM ; i++) {
drivers/media/platform/atmel/atmel-isc-regs.h +4 -0
@@ -194,9 +194,13 @@#define ISC_CBC_CONTRAST 0x000003c0#define ISC_CBC_CONTRAST_MASK GENMASK(11, 0) +/* Offset for SUB422 register specific to sama5d2 product */ +#define ISC_SAMA5D2_SUB422_OFFSET 0/* Subsampling 4:4:4 to 4:2:2 Control Register */ #define ISC_SUB422_CTRL 0x000003c4 +/* Offset for SUB420 register specific to sama5d2 product */ +#define ISC_SAMA5D2_SUB420_OFFSET 0/* Subsampling 4:2:2 to 4:2:0 Control Register */ #define ISC_SUB420_CTRL 0x000003cc
drivers/media/platform/atmel/atmel-isc.h +4 -0
@@ -148,10 +148,14 @@ struct isc_ctrls {* struct isc_reg_offsets - ISC device register offsets * @csc: Offset for the CSC register * @cbc: Offset for the CBC register +* @sub422: Offset for the SUB422 register +* @sub420: Offset for the SUB420 register */ struct isc_reg_offsets {u32 csc;u32 cbc; +u32 sub422; +u32 sub420; };/*
drivers/media/platform/atmel/atmel-sama5d2-isc.c +2 -0
@@ -232,6 +232,8 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->offsets.csc =ISC_SAMA5D2_CSC_OFFSET ; isc->offsets.cbc =ISC_SAMA5D2_CBC_OFFSET ; + isc->offsets.sub422 =ISC_SAMA5D2_SUB422_OFFSET ; + isc->offsets.sub420 =ISC_SAMA5D2_SUB420_OFFSET ;/* sama5d2-isc - 8 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 12/30 media: atmel: atmel-isc: add RLP to register offsets
In reply to Eugen HristevAdd rlp to the reg offsets struct.
This will allow different products to have a different reg offset for this particular module.
--- drivers/media/platform/atmel/atmel-isc-base.c | 4 ++-- drivers/media/platform/atmel/atmel-isc-regs.h | 2 ++ drivers/media/platform/atmel/atmel-isc.h | 2 ++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 1 + 4 files changed, 7 insertions(+), 2 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +2 -2
@@ -718,8 +718,8 @@ static int isc_configure(struct isc_device *isc)regmap_update_bits (regmap,ISC_PFE_CFG0 , mask, pfe_cfg0); -regmap_update_bits (regmap,ISC_RLP_CFG ,ISC_RLP_CFG_MODE_MASK , - rlp_mode); +regmap_update_bits (regmap,ISC_RLP_CFG + isc->offsets.rlp, +ISC_RLP_CFG_MODE_MASK , rlp_mode);regmap_write (regmap,ISC_DCFG , dcfg);
drivers/media/platform/atmel/atmel-isc-regs.h +2 -0
@@ -204,6 +204,8 @@/* Subsampling 4:2:2 to 4:2:0 Control Register */ #define ISC_SUB420_CTRL 0x000003cc +/* Offset for RLP register specific to sama5d2 product */ +#define ISC_SAMA5D2_RLP_OFFSET 0/* Rounding, Limiting and Packing Configuration Register */ #define ISC_RLP_CFG 0x000003d0
drivers/media/platform/atmel/atmel-isc.h +2 -0
@@ -150,12 +150,14 @@ struct isc_ctrls {* @cbc: Offset for the CBC register * @sub422: Offset for the SUB422 register * @sub420: Offset for the SUB420 register +* @rlp: Offset for the RLP register */ struct isc_reg_offsets {u32 csc;u32 cbc;u32 sub422;u32 sub420; +u32 rlp; };/*
drivers/media/platform/atmel/atmel-sama5d2-isc.c +1 -0
@@ -234,6 +234,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->offsets.cbc =ISC_SAMA5D2_CBC_OFFSET ; isc->offsets.sub422 =ISC_SAMA5D2_SUB422_OFFSET ; isc->offsets.sub420 =ISC_SAMA5D2_SUB420_OFFSET ; + isc->offsets.rlp =ISC_SAMA5D2_RLP_OFFSET ;/* sama5d2-isc - 8 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 13/30 media: atmel: atmel-isc: add HIS to register offsets
In reply to Eugen HristevAdd his to the reg offsets struct.
This will allow different products to have a different reg offset for this particular module.
--- drivers/media/platform/atmel/atmel-isc-base.c | 11 +++++++---- drivers/media/platform/atmel/atmel-isc-regs.h | 2 ++ drivers/media/platform/atmel/atmel-isc.h | 2 ++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 1 + 4 files changed, 12 insertions(+), 4 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +7 -4
@@ -678,12 +678,13 @@ static void isc_set_histogram(struct isc_device *isc, bool enable)struct isc_ctrls *ctrls = &isc->ctrls;if (enable) { -regmap_write (regmap,ISC_HIS_CFG , +regmap_write (regmap,ISC_HIS_CFG + isc->offsets.his,ISC_HIS_CFG_MODE_GR | (isc->config.sd_format->cfa_baycfg <<ISC_HIS_CFG_BAYSEL_SHIFT ) |ISC_HIS_CFG_RAR ); -regmap_write (regmap,ISC_HIS_CTRL ,ISC_HIS_CTRL_EN ); +regmap_write (regmap,ISC_HIS_CTRL + isc->offsets.his, +ISC_HIS_CTRL_EN );regmap_write (regmap,ISC_INTEN ,ISC_INT_HISDONE ); ctrls->hist_id =ISC_HIS_CFG_MODE_GR ;isc_update_profile (isc);
@@ -692,7 +693,8 @@ static void isc_set_histogram(struct isc_device *isc, bool enable) ctrls->hist_stat =HIST_ENABLED ; }else {regmap_write (regmap,ISC_INTDIS ,ISC_INT_HISDONE ); -regmap_write (regmap,ISC_HIS_CTRL ,ISC_HIS_CTRL_DIS ); +regmap_write (regmap,ISC_HIS_CTRL + isc->offsets.his, +ISC_HIS_CTRL_DIS ); ctrls->hist_stat =HIST_DISABLED ; }
@@ -1821,7 +1823,8 @@ static void isc_awb_work(struct work_struct *w) ctrls->awb =ISC_WB_NONE ; } } -regmap_write (regmap,ISC_HIS_CFG , hist_id | baysel |ISC_HIS_CFG_RAR ); +regmap_write (regmap,ISC_HIS_CFG + isc->offsets.his, + hist_id | baysel |ISC_HIS_CFG_RAR );isc_update_profile (isc);/* if awb has been disabled, we don't need to start another histogram */ if (ctrls->awb)
drivers/media/platform/atmel/atmel-isc-regs.h +2 -0
@@ -224,6 +224,8 @@#define ISC_RLP_CFG_MODE_YYCC_LIMITED 0xc#define ISC_RLP_CFG_MODE_MASK GENMASK(3, 0) +/* Offset for HIS register specific to sama5d2 product */ +#define ISC_SAMA5D2_HIS_OFFSET 0/* Histogram Control Register */ #define ISC_HIS_CTRL 0x000003d4
drivers/media/platform/atmel/atmel-isc.h +2 -0
@@ -151,6 +151,7 @@ struct isc_ctrls {* @sub422: Offset for the SUB422 register * @sub420: Offset for the SUB420 register * @rlp: Offset for the RLP register +* @his: Offset for the HIS related registers */ struct isc_reg_offsets {u32 csc;
@@ -158,6 +159,7 @@ struct isc_reg_offsets {u32 sub422;u32 sub420;u32 rlp; +u32 his; };/*
drivers/media/platform/atmel/atmel-sama5d2-isc.c +1 -0
@@ -235,6 +235,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->offsets.sub422 =ISC_SAMA5D2_SUB422_OFFSET ; isc->offsets.sub420 =ISC_SAMA5D2_SUB420_OFFSET ; isc->offsets.rlp =ISC_SAMA5D2_RLP_OFFSET ; + isc->offsets.his =ISC_SAMA5D2_HIS_OFFSET ;/* sama5d2-isc - 8 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 14/30 media: atmel: atmel-isc: add DMA to register offsets
In reply to Eugen HristevAdd dma to the reg offsets struct.
This will allow different products to have a different reg offset for this particular module.
--- drivers/media/platform/atmel/atmel-isc-base.c | 19 ++++++++++++------- drivers/media/platform/atmel/atmel-isc-regs.h | 3 +++ drivers/media/platform/atmel/atmel-isc.h | 2 ++ .../media/platform/atmel/atmel-sama5d2-isc.c | 1 + 4 files changed, 18 insertions(+), 7 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +12 -7
@@ -593,16 +593,20 @@ static void isc_start_dma(struct isc_device *isc) ISC_PFE_CFG0_COLEN | ISC_PFE_CFG0_ROWEN); addr0 =vb2_dma_contig_plane_dma_addr (&isc->cur_frm->vb.vb2_buf,0 ); -regmap_write (regmap,ISC_DAD0 , addr0); +regmap_write (regmap,ISC_DAD0 + isc->offsets.dma, addr0);switch (isc->config.fourcc) {case V4L2_PIX_FMT_YUV420 : -regmap_write (regmap,ISC_DAD1 , addr0 + (sizeimage *2 ) /3 ); -regmap_write (regmap,ISC_DAD2 , addr0 + (sizeimage *5 ) /6 ); +regmap_write (regmap,ISC_DAD1 + isc->offsets.dma, + addr0 + (sizeimage *2 ) /3 ); +regmap_write (regmap,ISC_DAD2 + isc->offsets.dma, + addr0 + (sizeimage *5 ) /6 );break ;case V4L2_PIX_FMT_YUV422P : -regmap_write (regmap,ISC_DAD1 , addr0 + sizeimage /2 ); -regmap_write (regmap,ISC_DAD2 , addr0 + (sizeimage *3 ) /4 ); +regmap_write (regmap,ISC_DAD1 + isc->offsets.dma, + addr0 + sizeimage /2 ); +regmap_write (regmap,ISC_DAD2 + isc->offsets.dma, + addr0 + (sizeimage *3 ) /4 );break ;default :break ;
@@ -610,7 +614,8 @@ static void isc_start_dma(struct isc_device *isc) dctrl_dview = isc->config.dctrl_dview; -regmap_write (regmap,ISC_DCTRL , dctrl_dview |ISC_DCTRL_IE_IS ); +regmap_write (regmap,ISC_DCTRL + isc->offsets.dma, + dctrl_dview |ISC_DCTRL_IE_IS );spin_lock (&isc->awb_lock);regmap_write (regmap,ISC_CTRLEN ,ISC_CTRL_CAPTURE );spin_unlock (&isc->awb_lock);
@@ -723,7 +728,7 @@ static int isc_configure(struct isc_device *isc)regmap_update_bits (regmap,ISC_RLP_CFG + isc->offsets.rlp,ISC_RLP_CFG_MODE_MASK , rlp_mode); -regmap_write (regmap,ISC_DCFG , dcfg); +regmap_write (regmap,ISC_DCFG + isc->offsets.dma, dcfg);/* Set the pipeline */ isc_set_pipeline (isc, pipeline);
drivers/media/platform/atmel/atmel-isc-regs.h +3 -0
@@ -247,6 +247,9 @@#define ISC_HIS_CFG_RAR BIT(8) +/* Offset for DMA register specific to sama5d2 product */ +#define ISC_SAMA5D2_DMA_OFFSET 0 +/* DMA Configuration Register */ #define ISC_DCFG 0x000003e0#define ISC_DCFG_IMODE_PACKED8 0x0
drivers/media/platform/atmel/atmel-isc.h +2 -0
@@ -152,6 +152,7 @@ struct isc_ctrls {* @sub420: Offset for the SUB420 register * @rlp: Offset for the RLP register * @his: Offset for the HIS related registers +* @dma: Offset for the DMA related registers */ struct isc_reg_offsets {u32 csc;
@@ -160,6 +161,7 @@ struct isc_reg_offsets {u32 sub420;u32 rlp;u32 his; +u32 dma; };/*
drivers/media/platform/atmel/atmel-sama5d2-isc.c +1 -0
@@ -236,6 +236,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->offsets.sub420 =ISC_SAMA5D2_SUB420_OFFSET ; isc->offsets.rlp =ISC_SAMA5D2_RLP_OFFSET ; isc->offsets.his =ISC_SAMA5D2_HIS_OFFSET ; + isc->offsets.dma =ISC_SAMA5D2_DMA_OFFSET ;/* sama5d2-isc - 8 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 15/30 media: atmel: atmel-isc: add support for version register
In reply to Eugen HristevAdd support for version register and print it at probe time.
--- drivers/media/platform/atmel/atmel-isc-regs.h | 5 +++++ drivers/media/platform/atmel/atmel-isc.h | 2 ++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 5 +++++ 3 files changed, 12 insertions(+)
drivers/media/platform/atmel/atmel-isc-regs.h +5 -0
@@ -295,6 +295,11 @@/* DMA Address 2 Register */ #define ISC_DAD2 0x000003fc +/* Offset for version register specific to sama5d2 product */ +#define ISC_SAMA5D2_VERSION_OFFSET 0 +/* Version Register */ +#define ISC_VERSION 0x0000040c +/* Histogram Entry */ #define ISC_HIS_ENTRY 0x00000410
drivers/media/platform/atmel/atmel-isc.h +2 -0
@@ -153,6 +153,7 @@ struct isc_ctrls {* @rlp: Offset for the RLP register * @his: Offset for the HIS related registers * @dma: Offset for the DMA related registers +* @version: Offset for the version register */ struct isc_reg_offsets {u32 csc;
@@ -162,6 +163,7 @@ struct isc_reg_offsets {u32 rlp;u32 his;u32 dma; +u32 version; };/*
drivers/media/platform/atmel/atmel-sama5d2-isc.c +5 -0
@@ -189,6 +189,7 @@ static int atmel_isc_probe(struct platform_device *pdev)struct isc_subdev_entity *subdev_entity;int irq;int ret; +u32 ver; isc =devm_kzalloc (dev,sizeof (*isc),GFP_KERNEL );if (!isc)
@@ -237,6 +238,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->offsets.rlp =ISC_SAMA5D2_RLP_OFFSET ; isc->offsets.his =ISC_SAMA5D2_HIS_OFFSET ; isc->offsets.dma =ISC_SAMA5D2_DMA_OFFSET ; + isc->offsets.version =ISC_SAMA5D2_VERSION_OFFSET ;/* sama5d2-isc - 8 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ;
@@ -332,6 +334,9 @@ static int atmel_isc_probe(struct platform_device *pdev)pm_runtime_enable (dev);pm_request_idle (dev); +regmap_read (isc->regmap,ISC_VERSION + isc->offsets.version, &ver); +dev_info (dev,"Microchip ISC version %x\n" , ver); +return 0 ; cleanup_subdev:
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 16/30 media: atmel: atmel-isc: add his_entry to register offsets
In reply to Eugen HristevAdd his_entry to the reg offsets struct.
This will allow different products to have a different reg offset for this particular module.
--- drivers/media/platform/atmel/atmel-isc-base.c | 3 ++- drivers/media/platform/atmel/atmel-isc-regs.h | 2 ++ drivers/media/platform/atmel/atmel-isc.h | 2 ++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 1 + 4 files changed, 7 insertions(+), 1 deletion(-)
drivers/media/platform/atmel/atmel-isc-base.c +2 -1
@@ -1672,7 +1672,8 @@ static void isc_hist_count(struct isc_device *isc, u32 *min, u32 *max) *min =0 ; *max =HIST_ENTRIES ; -regmap_bulk_read (regmap,ISC_HIS_ENTRY , hist_entry,HIST_ENTRIES ); +regmap_bulk_read (regmap,ISC_HIS_ENTRY + isc->offsets.his_entry, + hist_entry,HIST_ENTRIES ); *hist_count =0 ;/*
drivers/media/platform/atmel/atmel-isc-regs.h +2 -0
@@ -300,6 +300,8 @@/* Version Register */ #define ISC_VERSION 0x0000040c +/* Offset for version register specific to sama5d2 product */ +#define ISC_SAMA5D2_HIS_ENTRY_OFFSET 0/* Histogram Entry */ #define ISC_HIS_ENTRY 0x00000410
drivers/media/platform/atmel/atmel-isc.h +2 -0
@@ -154,6 +154,7 @@ struct isc_ctrls {* @his: Offset for the HIS related registers * @dma: Offset for the DMA related registers * @version: Offset for the version register +* @his_entry: Offset for the HIS entries registers */ struct isc_reg_offsets {u32 csc;
@@ -164,6 +165,7 @@ struct isc_reg_offsets {u32 his;u32 dma;u32 version; +u32 his_entry; };/*
drivers/media/platform/atmel/atmel-sama5d2-isc.c +1 -0
@@ -239,6 +239,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->offsets.his =ISC_SAMA5D2_HIS_OFFSET ; isc->offsets.dma =ISC_SAMA5D2_DMA_OFFSET ; isc->offsets.version =ISC_SAMA5D2_VERSION_OFFSET ; + isc->offsets.his_entry =ISC_SAMA5D2_HIS_ENTRY_OFFSET ;/* sama5d2-isc - 8 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 17/30 media: atmel: atmel-isc: add register description for additional modules
In reply to Eugen HristevAdd register description for additional pipeline modules: the Defective Pixel Correction (DPC) and the Vertical and Horizontal Scaler(VHXS)
--- drivers/media/platform/atmel/atmel-isc-regs.h | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+)
drivers/media/platform/atmel/atmel-isc-regs.h +67 -0
@@ -90,6 +90,46 @@#define ISC_INT_DDONE BIT(8)#define ISC_INT_HISDONE BIT(12) +/* ISC DPC Control Register */ +#define ISC_DPC_CTRL 0x40 + +#define ISC_DPC_CTRL_DPCEN BIT(0) +#define ISC_DPC_CTRL_GDCEN BIT(1) +#define ISC_DPC_CTRL_BLCEN BIT(2) + +/* ISC DPC Config Register */ +#define ISC_DPC_CFG 0x44 + +#define ISC_DPC_CFG_BAYSEL_SHIFT 0 + +#define ISC_DPC_CFG_EITPOL BIT(4) + +#define ISC_DPC_CFG_TA_ENABLE BIT(14) +#define ISC_DPC_CFG_TC_ENABLE BIT(13) +#define ISC_DPC_CFG_TM_ENABLE BIT(12) + +#define ISC_DPC_CFG_RE_MODE BIT(17) + +#define ISC_DPC_CFG_GDCCLP_SHIFT 20 +#define ISC_DPC_CFG_GDCCLP_MASK GENMASK(22, 20) + +#define ISC_DPC_CFG_BLOFF_SHIFT 24 +#define ISC_DPC_CFG_BLOFF_MASK GENMASK(31, 24) + +#define ISC_DPC_CFG_BAYCFG_SHIFT 0 +#define ISC_DPC_CFG_BAYCFG_MASK GENMASK(1, 0) +/* ISC DPC Threshold Median Register */ +#define ISC_DPC_THRESHM 0x48 + +/* ISC DPC Threshold Closest Register */ +#define ISC_DPC_THRESHC 0x4C + +/* ISC DPC Threshold Average Register */ +#define ISC_DPC_THRESHA 0x50 + +/* ISC DPC STatus Register */ +#define ISC_DPC_SR 0x54 +/* ISC White Balance Control Register */ #define ISC_WB_CTRL 0x00000058
@@ -153,6 +193,33 @@/* ISC_Gamma Correction Green Entry Register */ #define ISC_GAM_RENTRY 0x00000298 +/* ISC VHXS Control Register */ +#define ISC_VHXS_CTRL 0x398 + +/* ISC VHXS Source Size Register */ +#define ISC_VHXS_SS 0x39C + +/* ISC VHXS Destination Size Register */ +#define ISC_VHXS_DS 0x3A0 + +/* ISC Vertical Factor Register */ +#define ISC_VXS_FACT 0x3a4 + +/* ISC Horizontal Factor Register */ +#define ISC_HXS_FACT 0x3a8 + +/* ISC Vertical Config Register */ +#define ISC_VXS_CFG 0x3ac + +/* ISC Horizontal Config Register */ +#define ISC_HXS_CFG 0x3b0 + +/* ISC Vertical Tap Register */ +#define ISC_VXS_TAP 0x3b4 + +/* ISC Horizontal Tap Register */ +#define ISC_HXS_TAP 0x434 +/* Offset for CSC register specific to sama5d2 product */ #define ISC_SAMA5D2_CSC_OFFSET 0
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 18/30 media: atmel: atmel-isc: extend pipeline with extra modules
In reply to Eugen HristevNewer ISC pipelines have the additional modules of Defective Pixel Correction -> DPC itself,
Defective Pixel Correction -> Green Disparity Correction (DPC_GDC) Defective Pixel Correction -> Black Level Correction (DPC_BLC) Vertical and Horizontal Scaler -> VHXS
Some products have this full pipeline (sama7g5), other products do not (sama5d2)
Add the modules to the isc base, and also extend the register range to include the modules.
--- drivers/media/platform/atmel/atmel-isc-base.c | 11 ++++++-- drivers/media/platform/atmel/atmel-isc.h | 28 +++++++++++-------- 2 files changed, 25 insertions(+), 14 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +9 -2
@@ -2309,8 +2309,14 @@ int isc_pipeline_init(struct isc_device *isc)struct regmap_field *regs;unsigned int i; -/* WB-->CFA-->CC-->GAM-->CSC-->CBC-->SUB422-->SUB420 */ +/* +* DPCEN-->GDCEN-->BLCEN-->WB-->CFA-->CC--> +* GAM-->VHXS-->CSC-->CBC-->SUB422-->SUB420 +*/ const struct reg_field regfields[ISC_PIPE_LINE_NODE_NUM ] = { +REG_FIELD (ISC_DPC_CTRL ,0 ,0 ), +REG_FIELD (ISC_DPC_CTRL ,1 ,1 ), +REG_FIELD (ISC_DPC_CTRL ,2 ,2 ),REG_FIELD (ISC_WB_CTRL ,0 ,0 ),REG_FIELD (ISC_CFA_CTRL ,0 ,0 ),REG_FIELD (ISC_CC_CTRL ,0 ,0 ),
@@ -2318,6 +2324,7 @@ int isc_pipeline_init(struct isc_device *isc)REG_FIELD (ISC_GAM_CTRL ,1 ,1 ),REG_FIELD (ISC_GAM_CTRL ,2 ,2 ),REG_FIELD (ISC_GAM_CTRL ,3 ,3 ), +REG_FIELD (ISC_VHXS_CTRL ,0 ,0 ),REG_FIELD (ISC_CSC_CTRL + isc->offsets.csc,0 ,0 ),REG_FIELD (ISC_CBC_CTRL + isc->offsets.cbc,0 ,0 ), REG_FIELD(ISC_SUB422_CTRL + isc->offsets.sub422, 0, 0),
@@ -2336,7 +2343,7 @@ int isc_pipeline_init(struct isc_device *isc) }/* regmap configuration */ -#define ATMEL_ISC_REG_MAX 0xbfc +#define ATMEL_ISC_REG_MAX 0xd5cconst struct regmap_config isc_regmap_config = { .reg_bits =32 , .reg_stride =4 ,
drivers/media/platform/atmel/atmel-isc.h +16 -12
@@ -68,17 +68,21 @@ struct isc_format { };/* Pipeline bitmap */ -#define WB_ENABLE BIT(0) -#define CFA_ENABLE BIT(1) -#define CC_ENABLE BIT(2) -#define GAM_ENABLE BIT(3) -#define GAM_BENABLE BIT(4) -#define GAM_GENABLE BIT(5) -#define GAM_RENABLE BIT(6) -#define CSC_ENABLE BIT(7) -#define CBC_ENABLE BIT(8) -#define SUB422_ENABLE BIT(9) -#define SUB420_ENABLE BIT(10) +#define DPC_DPCENABLE BIT(0) +#define DPC_GDCENABLE BIT(1) +#define DPC_BLCENABLE BIT(2) +#define WB_ENABLE BIT(3) +#define CFA_ENABLE BIT(4) +#define CC_ENABLE BIT(5) +#define GAM_ENABLE BIT(6) +#define GAM_BENABLE BIT(7) +#define GAM_GENABLE BIT(8) +#define GAM_RENABLE BIT(9) +#define VHXS_ENABLE BIT(10) +#define CSC_ENABLE BIT(11) +#define CBC_ENABLE BIT(12) +#define SUB422_ENABLE BIT(13) +#define SUB420_ENABLE BIT(14)#define GAM_ENABLES (GAM_RENABLE | GAM_GENABLE | GAM_BENABLE | GAM_ENABLE)
@@ -142,7 +146,7 @@ struct isc_ctrls {u32 hist_minmax[HIST_BAYER ][2 ]; }; -#define ISC_PIPE_LINE_NODE_NUM 11 +#define ISC_PIPE_LINE_NODE_NUM 15/* * struct isc_reg_offsets - ISC device register offsets
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 19/30 media: atmel: atmel-isc: add CC initialization function
In reply to Eugen HristevImplement the color correction (CC) submodule initialization, as a product specific function, which currently configures the neutral point in color correction.
--- drivers/media/platform/atmel/atmel-isc-base.c | 1 + drivers/media/platform/atmel/atmel-isc.h | 3 +++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 14 ++++++++++++++ 3 files changed, 18 insertions(+)
drivers/media/platform/atmel/atmel-isc-base.c +1 -0
@@ -653,6 +653,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline) isc->config_csc (isc); isc->config_cbc (isc); + isc->config_cc (isc); }static int isc_update_profile (struct isc_device *isc)
drivers/media/platform/atmel/atmel-isc.h +3 -0
@@ -225,6 +225,8 @@ struct isc_reg_offsets {* specific CSC module * @config_cbc: pointer to a function that initializes product * specific CBC module +* @config_cc: pointer to a function that initializes product +* specific CC module * * @offsets: struct holding the product specific register offsets */
@@ -298,6 +300,7 @@ struct isc_device {struct {void (*config_csc)(struct isc_device *isc);void (*config_cbc)(struct isc_device *isc); +void (*config_cc)(struct isc_device *isc); };struct isc_reg_offsets offsets;
drivers/media/platform/atmel/atmel-sama5d2-isc.c +14 -0
@@ -83,6 +83,19 @@ void isc_sama5d2_config_cbc(struct isc_device *isc) isc->ctrls.contrast); } +void isc_sama5d2_config_cc (struct isc_device *isc) +{ +struct regmap *regmap = isc->regmap; + +/* Configure each register at the neutral fixed point 1.0 or 0.0 */ +regmap_write (regmap,ISC_CC_RR_RG , (1 <<8 )); +regmap_write (regmap,ISC_CC_RB_OR ,0 ); +regmap_write (regmap,ISC_CC_GR_GG , (1 <<8 ) <<16 ); +regmap_write (regmap,ISC_CC_GB_OG ,0 ); +regmap_write (regmap,ISC_CC_BR_BG ,0 ); +regmap_write (regmap,ISC_CC_BB_OB , (1 <<8 )); +} +/* Gamma table with gamma 1/2.2 */ const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES ] = {/* 0 --> gamma 1/1.8 */
@@ -230,6 +243,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->config_csc = isc_sama5d2_config_csc; isc->config_cbc = isc_sama5d2_config_cbc; + isc->config_cc = isc_sama5d2_config_cc; isc->offsets.csc =ISC_SAMA5D2_CSC_OFFSET ; isc->offsets.cbc =ISC_SAMA5D2_CBC_OFFSET ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 20/30 media: atmel: atmel-isc: create product specific v4l2 controls config
In reply to Eugen HristevCreate product specific callback for initializing v4l2 controls. Call this from v4l2 controls init function.
--- drivers/media/platform/atmel/atmel-isc-base.c | 5 +++-- drivers/media/platform/atmel/atmel-isc.h | 5 +++++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 12 ++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +3 -2
@@ -2036,11 +2036,12 @@ static int isc_ctrl_init(struct isc_device *isc)if (ret <0 )return ret; +/* Initialize product specific controls. For example, contrast */ + isc->config_ctrls (isc, ops); + ctrls->brightness =0 ; - ctrls->contrast =256 ;v4l2_ctrl_new_std (hdl, ops,V4L2_CID_BRIGHTNESS ,-1024 ,1023 ,1 ,0 ); -v4l2_ctrl_new_std (hdl, ops,V4L2_CID_CONTRAST ,-2048 ,2047 ,1 ,256 );v4l2_ctrl_new_std (hdl, ops,V4L2_CID_GAMMA ,0 , isc->gamma_max,1 , isc->gamma_max); isc->awb_ctrl = v4l2_ctrl_new_std(hdl, &isc_awb_ops,
drivers/media/platform/atmel/atmel-isc.h +5 -0
@@ -227,6 +227,8 @@ struct isc_reg_offsets {* specific CBC module * @config_cc: pointer to a function that initializes product * specific CC module +* @config_ctrls: pointer to a functoin that initializes product +* specific v4l2 controls. * * @offsets: struct holding the product specific register offsets */
@@ -301,6 +303,9 @@ struct isc_device {void (*config_csc)(struct isc_device *isc);void (*config_cbc)(struct isc_device *isc);void (*config_cc)(struct isc_device *isc); + +void (*config_ctrls)(struct isc_device *isc, +const struct v4l2_ctrl_ops *ops); };struct isc_reg_offsets offsets;
drivers/media/platform/atmel/atmel-sama5d2-isc.c +12 -0
@@ -96,6 +96,17 @@ void isc_sama5d2_config_cc(struct isc_device *isc)regmap_write (regmap,ISC_CC_BB_OB , (1 <<8 )); } +void isc_sama5d2_config_ctrls (struct isc_device *isc, +const struct v4l2_ctrl_ops *ops) +{ +struct isc_ctrls *ctrls = &isc->ctrls; +struct v4l2_ctrl_handler *hdl = &ctrls->handler; + + ctrls->contrast =256 ; + +v4l2_ctrl_new_std (hdl, ops,V4L2_CID_CONTRAST ,-2048 ,2047 ,1 ,256 ); +} +/* Gamma table with gamma 1/2.2 */ const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES ] = {/* 0 --> gamma 1/1.8 */
@@ -244,6 +255,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->config_csc = isc_sama5d2_config_csc; isc->config_cbc = isc_sama5d2_config_cbc; isc->config_cc = isc_sama5d2_config_cc; + isc->config_ctrls = isc_sama5d2_config_ctrls; isc->offsets.csc =ISC_SAMA5D2_CSC_OFFSET ; isc->offsets.cbc =ISC_SAMA5D2_CBC_OFFSET ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 21/30 media: atmel: atmel-isc: create callback for DPC submodule product specific
In reply to Eugen HristevCreate a product specific callback for initializing the DPC submodule of the pipeline.
For sama5d2 product, this module does not exist, thus this function is a noop.
--- drivers/media/platform/atmel/atmel-isc-base.c | 1 + drivers/media/platform/atmel/atmel-isc.h | 3 +++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 6 ++++++ 3 files changed, 10 insertions(+)
drivers/media/platform/atmel/atmel-isc-base.c +1 -0
@@ -651,6 +651,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline)regmap_bulk_write (regmap,ISC_GAM_GENTRY , gamma,GAMMA_ENTRIES );regmap_bulk_write (regmap,ISC_GAM_RENTRY , gamma,GAMMA_ENTRIES ); + isc->config_dpc (isc); isc->config_csc (isc); isc->config_cbc (isc); isc->config_cc (isc);
drivers/media/platform/atmel/atmel-isc.h +3 -0
@@ -221,6 +221,8 @@ struct isc_reg_offsets {* @max_width: maximum frame width, dependent on the internal RAM * @max_height: maximum frame height, dependent on the internal RAM * +* @config_dpc: pointer to a function that initializes product +* specific DPC module * @config_csc: pointer to a function that initializes product * specific CSC module * @config_cbc: pointer to a function that initializes product
@@ -300,6 +302,7 @@ struct isc_device {u32 max_height;struct { +void (*config_dpc)(struct isc_device *isc);void (*config_csc)(struct isc_device *isc);void (*config_cbc)(struct isc_device *isc);void (*config_cc)(struct isc_device *isc);
drivers/media/platform/atmel/atmel-sama5d2-isc.c +6 -0
@@ -107,6 +107,11 @@ void isc_sama5d2_config_ctrls(struct isc_device *isc,v4l2_ctrl_new_std (hdl, ops,V4L2_CID_CONTRAST ,-2048 ,2047 ,1 ,256 ); } +void isc_sama5d2_config_dpc (struct isc_device *isc) +{ +/* This module is not present on sama5d2 pipeline */ +} +/* Gamma table with gamma 1/2.2 */ const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES ] = {/* 0 --> gamma 1/1.8 */
@@ -252,6 +257,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->max_width =ISC_SAMA5D2_MAX_SUPPORT_WIDTH ; isc->max_height =ISC_SAMA5D2_MAX_SUPPORT_HEIGHT ; + isc->config_dpc = isc_sama5d2_config_dpc; isc->config_csc = isc_sama5d2_config_csc; isc->config_cbc = isc_sama5d2_config_cbc; isc->config_cc = isc_sama5d2_config_cc;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 22/30 media: atmel: atmel-isc: create callback for GAM submodule product specific
In reply to Eugen HristevCreate a product specific callback for initializing the GAM submodule of the pipeline.
For sama5d2 product, there is no special configuration at this moment, thus this function is a noop.
--- drivers/media/platform/atmel/atmel-isc-base.c | 1 + drivers/media/platform/atmel/atmel-isc.h | 3 +++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 6 ++++++ 3 files changed, 10 insertions(+)
drivers/media/platform/atmel/atmel-isc-base.c +1 -0
@@ -655,6 +655,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline) isc->config_csc (isc); isc->config_cbc (isc); isc->config_cc (isc); + isc->config_gam (isc); }static int isc_update_profile (struct isc_device *isc)
drivers/media/platform/atmel/atmel-isc.h +3 -0
@@ -229,6 +229,8 @@ struct isc_reg_offsets {* specific CBC module * @config_cc: pointer to a function that initializes product * specific CC module +* @config_gam: pointer to a function that initializes product +* specific GAMMA module * @config_ctrls: pointer to a functoin that initializes product * specific v4l2 controls. *
@@ -306,6 +308,7 @@ struct isc_device {void (*config_csc)(struct isc_device *isc);void (*config_cbc)(struct isc_device *isc);void (*config_cc)(struct isc_device *isc); +void (*config_gam)(struct isc_device *isc);void (*config_ctrls)(struct isc_device *isc,const struct v4l2_ctrl_ops *ops);
drivers/media/platform/atmel/atmel-sama5d2-isc.c +6 -0
@@ -112,6 +112,11 @@ void isc_sama5d2_config_dpc(struct isc_device *isc)/* This module is not present on sama5d2 pipeline */ } +void isc_sama5d2_config_gam (struct isc_device *isc) +{ +/* No specific gamma configuration */ +} +/* Gamma table with gamma 1/2.2 */ const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES ] = {/* 0 --> gamma 1/1.8 */
@@ -261,6 +266,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->config_csc = isc_sama5d2_config_csc; isc->config_cbc = isc_sama5d2_config_cbc; isc->config_cc = isc_sama5d2_config_cc; + isc->config_gam = isc_sama5d2_config_gam; isc->config_ctrls = isc_sama5d2_config_ctrls; isc->offsets.csc =ISC_SAMA5D2_CSC_OFFSET ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 24/30 media: atmel: atmel-isc: move the formats list into product specific code
In reply to Eugen HristevThe list of input and output formats has to be product specific. Move this list into the product specific code.
Have pointers to these arrays inside the device struct.
--- drivers/media/platform/atmel/atmel-isc-base.c | 167 ++---------------- drivers/media/platform/atmel/atmel-isc.h | 12 +- .../media/platform/atmel/atmel-sama5d2-isc.c | 136 ++++++++++++++ 3 files changed, 165 insertions(+), 150 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +19 -148
@@ -45,137 +45,6 @@ module_param(sensor_preferred, uint, 0644);MODULE_PARM_DESC (sensor_preferred,"Sensor is preferred to output the specified format (1-on 0-off), default 1" ); -/* This is a list of the formats that the ISC can *output* */ -const struct isc_format controller_formats[] = { - { - .fourcc =V4L2_PIX_FMT_ARGB444 , - }, - { - .fourcc =V4L2_PIX_FMT_ARGB555 , - }, - { - .fourcc =V4L2_PIX_FMT_RGB565 , - }, - { - .fourcc =V4L2_PIX_FMT_ABGR32 , - }, - { - .fourcc =V4L2_PIX_FMT_XBGR32 , - }, - { - .fourcc =V4L2_PIX_FMT_YUV420 , - }, - { - .fourcc =V4L2_PIX_FMT_YUYV , - }, - { - .fourcc =V4L2_PIX_FMT_YUV422P , - }, - { - .fourcc =V4L2_PIX_FMT_GREY , - }, - { - .fourcc =V4L2_PIX_FMT_Y10 , - }, -}; - -/* This is a list of formats that the ISC can receive as *input* */ -struct isc_format formats_list[] = { - { - .fourcc =V4L2_PIX_FMT_SBGGR8 , - .mbus_code =MEDIA_BUS_FMT_SBGGR8_1X8 , - .pfe_cfg0_bps =ISC_PFE_CFG0_BPS_EIGHT , - .cfa_baycfg =ISC_BAY_CFG_BGBG , - }, - { - .fourcc =V4L2_PIX_FMT_SGBRG8 , - .mbus_code =MEDIA_BUS_FMT_SGBRG8_1X8 , - .pfe_cfg0_bps =ISC_PFE_CFG0_BPS_EIGHT , - .cfa_baycfg =ISC_BAY_CFG_GBGB , - }, - { - .fourcc =V4L2_PIX_FMT_SGRBG8 , - .mbus_code =MEDIA_BUS_FMT_SGRBG8_1X8 , - .pfe_cfg0_bps =ISC_PFE_CFG0_BPS_EIGHT , - .cfa_baycfg =ISC_BAY_CFG_GRGR , - }, - { - .fourcc =V4L2_PIX_FMT_SRGGB8 , - .mbus_code =MEDIA_BUS_FMT_SRGGB8_1X8 , - .pfe_cfg0_bps =ISC_PFE_CFG0_BPS_EIGHT , - .cfa_baycfg =ISC_BAY_CFG_RGRG , - }, - { - .fourcc =V4L2_PIX_FMT_SBGGR10 , - .mbus_code =MEDIA_BUS_FMT_SBGGR10_1X10 , - .pfe_cfg0_bps =ISC_PFG_CFG0_BPS_TEN , - .cfa_baycfg =ISC_BAY_CFG_RGRG , - }, - { - .fourcc =V4L2_PIX_FMT_SGBRG10 , - .mbus_code =MEDIA_BUS_FMT_SGBRG10_1X10 , - .pfe_cfg0_bps =ISC_PFG_CFG0_BPS_TEN , - .cfa_baycfg =ISC_BAY_CFG_GBGB , - }, - { - .fourcc =V4L2_PIX_FMT_SGRBG10 , - .mbus_code =MEDIA_BUS_FMT_SGRBG10_1X10 , - .pfe_cfg0_bps =ISC_PFG_CFG0_BPS_TEN , - .cfa_baycfg =ISC_BAY_CFG_GRGR , - }, - { - .fourcc =V4L2_PIX_FMT_SRGGB10 , - .mbus_code =MEDIA_BUS_FMT_SRGGB10_1X10 , - .pfe_cfg0_bps =ISC_PFG_CFG0_BPS_TEN , - .cfa_baycfg =ISC_BAY_CFG_RGRG , - }, - { - .fourcc =V4L2_PIX_FMT_SBGGR12 , - .mbus_code =MEDIA_BUS_FMT_SBGGR12_1X12 , - .pfe_cfg0_bps =ISC_PFG_CFG0_BPS_TWELVE , - .cfa_baycfg =ISC_BAY_CFG_BGBG , - }, - { - .fourcc =V4L2_PIX_FMT_SGBRG12 , - .mbus_code =MEDIA_BUS_FMT_SGBRG12_1X12 , - .pfe_cfg0_bps =ISC_PFG_CFG0_BPS_TWELVE , - .cfa_baycfg =ISC_BAY_CFG_GBGB , - }, - { - .fourcc =V4L2_PIX_FMT_SGRBG12 , - .mbus_code =MEDIA_BUS_FMT_SGRBG12_1X12 , - .pfe_cfg0_bps =ISC_PFG_CFG0_BPS_TWELVE , - .cfa_baycfg =ISC_BAY_CFG_GRGR , - }, - { - .fourcc =V4L2_PIX_FMT_SRGGB12 , - .mbus_code =MEDIA_BUS_FMT_SRGGB12_1X12 , - .pfe_cfg0_bps =ISC_PFG_CFG0_BPS_TWELVE , - .cfa_baycfg =ISC_BAY_CFG_RGRG , - }, - { - .fourcc =V4L2_PIX_FMT_GREY , - .mbus_code =MEDIA_BUS_FMT_Y8_1X8 , - .pfe_cfg0_bps =ISC_PFE_CFG0_BPS_EIGHT , - }, - { - .fourcc =V4L2_PIX_FMT_YUYV , - .mbus_code =MEDIA_BUS_FMT_YUYV8_2X8 , - .pfe_cfg0_bps =ISC_PFE_CFG0_BPS_EIGHT , - }, - { - .fourcc =V4L2_PIX_FMT_RGB565 , - .mbus_code =MEDIA_BUS_FMT_RGB565_2X8_LE , - .pfe_cfg0_bps =ISC_PFE_CFG0_BPS_EIGHT , - }, - { - .fourcc =V4L2_PIX_FMT_Y10 , - .mbus_code =MEDIA_BUS_FMT_Y10_1X10 , - .pfe_cfg0_bps =ISC_PFG_CFG0_BPS_TEN , - }, - -}; -#define ISC_IS_FORMAT_RAW (mbus_code) \ (((mbus_code) & 0xf000) == 0x3000)
@@ -906,25 +775,26 @@ static int isc_querycap(struct file *file, void *priv,static int isc_enum_fmt_vid_cap (struct file *file,void *priv,struct v4l2_fmtdesc *f) { +struct isc_device *isc =video_drvdata (file);u32 index = f->index;u32 i, supported_index; -if (index <ARRAY_SIZE (controller_formats)) { - f->pixelformat = controller_formats[index].fourcc; +if (index < isc->controller_formats_size) { + f->pixelformat = isc->controller_formats[index].fourcc;return 0 ; } - index -=ARRAY_SIZE (controller_formats); + index -= isc->controller_formats_size; i =0 ; supported_index =0 ; -for (i =0 ; i <ARRAY_SIZE (formats_list); i++) { -if (!ISC_IS_FORMAT_RAW (formats_list[i].mbus_code) || - !formats_list[i].sd_support) +for (i =0 ; i < isc->formats_list_size; i++) { +if (!ISC_IS_FORMAT_RAW (isc->formats_list[i].mbus_code) || + !isc->formats_list[i].sd_support)continue ;if (supported_index == index) { - f->pixelformat = formats_list[i].fourcc; + f->pixelformat = isc->formats_list[i].fourcc;return 0 ; } supported_index++;
@@ -1465,8 +1335,8 @@ static int isc_enum_framesizes(struct file *file, void *fh,if (isc->user_formats[i]->fourcc == fsize->pixel_format) ret =0 ; -for (i =0 ; i <ARRAY_SIZE (controller_formats); i++) -if (controller_formats[i].fourcc == fsize->pixel_format) +for (i =0 ; i < isc->controller_formats_size; i++) +if (isc->controller_formats[i].fourcc == fsize->pixel_format) ret =0 ;if (ret)
@@ -1502,8 +1372,8 @@ static int isc_enum_frameintervals(struct file *file, void *fh,if (isc->user_formats[i]->fourcc == fival->pixel_format) ret =0 ; -for (i =0 ; i <ARRAY_SIZE (controller_formats); i++) -if (controller_formats[i].fourcc == fival->pixel_format) +for (i =0 ; i < isc->controller_formats_size; i++) +if (isc->controller_formats[i].fourcc == fival->pixel_format) ret =0 ;if (ret)
@@ -2111,12 +1981,13 @@ static void isc_async_unbind(struct v4l2_async_notifier *notifier,v4l2_ctrl_handler_free (&isc->ctrls.handler); } -static struct isc_format *find_format_by_code (unsigned int code,int *index) +static struct isc_format *find_format_by_code (struct isc_device *isc, +unsigned int code,int *index) { -struct isc_format *fmt = &formats_list[0 ]; +struct isc_format *fmt = &isc->formats_list[0 ];unsigned int i; -for (i =0 ; i <ARRAY_SIZE (formats_list); i++) { +for (i =0 ; i < isc->formats_list_size; i++) {if (fmt->mbus_code == code) { *index = i;return fmt;
@@ -2133,7 +2004,7 @@ static int isc_formats_init(struct isc_device *isc)struct isc_format *fmt;struct v4l2_subdev *subdev = isc->current_subdev->sd;unsigned int num_fmts, i, j; -u32 list_size =ARRAY_SIZE (formats_list); +u32 list_size = isc->formats_list_size;struct v4l2_subdev_mbus_code_enum mbus_code = { .which =V4L2_SUBDEV_FORMAT_ACTIVE , };
@@ -2143,7 +2014,7 @@ static int isc_formats_init(struct isc_device *isc) NULL, &mbus_code)) { mbus_code.index++; - fmt =find_format_by_code (mbus_code.code, &i); + fmt =find_format_by_code (isc, mbus_code.code, &i);if (!fmt) {v4l2_warn (&isc->v4l2_dev,"Mbus code %x not supported\n" , mbus_code.code);
@@ -2164,7 +2035,7 @@ static int isc_formats_init(struct isc_device *isc)if (!isc->user_formats)return -ENOMEM ; - fmt = &formats_list[0 ]; + fmt = &isc->formats_list[0 ];for (i =0 , j =0 ; i < list_size; i++) {if (fmt->sd_support) isc->user_formats[j++] = fmt;
drivers/media/platform/atmel/atmel-isc.h +10 -2
@@ -237,6 +237,12 @@ struct isc_reg_offsets {* specific v4l2 controls. * * @offsets: struct holding the product specific register offsets +* @controller_formats: pointer to the array of possible formats that the +* controller can output +* @formats_list: pointer to the array of possible formats that can +* be used as an input to the controller +* @controller_formats_size: size of controller_formats array +* @formats_list_size: size of formats_list array */ struct isc_device {struct regmap *regmap;
@@ -318,10 +324,12 @@ struct isc_device { };struct isc_reg_offsets offsets; +const struct isc_format *controller_formats; +struct isc_format *formats_list; +u32 controller_formats_size; +u32 formats_list_size; }; -extern struct isc_format formats_list[]; -extern const struct isc_format controller_formats[];extern const struct regmap_config isc_regmap_config;extern const struct v4l2_async_notifier_operations isc_async_ops;
drivers/media/platform/atmel/atmel-sama5d2-isc.c +136 -0
148 lines not on this page · raw message
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 25/30 media: atmel: atmel-isc: create an adapt pipeline callback for product specific
In reply to Eugen HristevOnce 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.
--- 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 | 11 +++++++++++ 3 files changed, 20 insertions(+)
drivers/media/platform/atmel/atmel-isc-base.c +4 -0
@@ -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 ; }
drivers/media/platform/atmel/atmel-isc.h +5 -0
@@ -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;
drivers/media/platform/atmel/atmel-sama5d2-isc.c +11 -0
@@ -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* */ const struct isc_format sama5d2_controller_formats[] = { {
@@ -257,6 +261,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 */
@@ -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 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 23/30 media: atmel: atmel-isc: create callback for RLP submodule product specific
In reply to Eugen HristevCreate a product specific callback for initializing the RLP submodule of the pipeline
--- drivers/media/platform/atmel/atmel-isc-base.c | 6 ++---- drivers/media/platform/atmel/atmel-isc.h | 3 +++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 10 ++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +2 -4
@@ -711,11 +711,10 @@ static void isc_set_histogram(struct isc_device *isc, bool enable)static int isc_configure (struct isc_device *isc) {struct regmap *regmap = isc->regmap; -u32 pfe_cfg0, rlp_mode, dcfg, mask, pipeline; +u32 pfe_cfg0, dcfg, mask, pipeline;struct isc_subdev_entity *subdev = isc->current_subdev; pfe_cfg0 = isc->config.sd_format->pfe_cfg0_bps; - rlp_mode = isc->config.rlp_cfg_mode; pipeline = isc->config.bits_pipeline; dcfg = isc->config.dcfg_imode | isc->dcfg;
@@ -728,8 +727,7 @@ static int isc_configure(struct isc_device *isc)regmap_update_bits (regmap,ISC_PFE_CFG0 , mask, pfe_cfg0); -regmap_update_bits (regmap,ISC_RLP_CFG + isc->offsets.rlp, -ISC_RLP_CFG_MODE_MASK , rlp_mode); + isc->config_rlp (isc);regmap_write (regmap,ISC_DCFG + isc->offsets.dma, dcfg);
drivers/media/platform/atmel/atmel-isc.h +3 -0
@@ -231,6 +231,8 @@ struct isc_reg_offsets {* specific CC module * @config_gam: pointer to a function that initializes product * specific GAMMA module +* @config_rlp: pointer to a function that initializes product +* specific RLP module * @config_ctrls: pointer to a functoin that initializes product * specific v4l2 controls. *
@@ -309,6 +311,7 @@ struct isc_device {void (*config_cbc)(struct isc_device *isc);void (*config_cc)(struct isc_device *isc);void (*config_gam)(struct isc_device *isc); +void (*config_rlp)(struct isc_device *isc);void (*config_ctrls)(struct isc_device *isc,const struct v4l2_ctrl_ops *ops);
drivers/media/platform/atmel/atmel-sama5d2-isc.c +10 -0
@@ -117,6 +117,15 @@ void isc_sama5d2_config_gam(struct isc_device *isc)/* No specific gamma configuration */ } +void isc_sama5d2_config_rlp (struct isc_device *isc) +{ +struct regmap *regmap = isc->regmap; +u32 rlp_mode = isc->config.rlp_cfg_mode; + +regmap_update_bits (regmap,ISC_RLP_CFG + isc->offsets.rlp, +ISC_RLP_CFG_MODE_MASK , rlp_mode); +} +/* Gamma table with gamma 1/2.2 */ const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES ] = {/* 0 --> gamma 1/1.8 */
@@ -267,6 +276,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->config_cbc = isc_sama5d2_config_cbc; isc->config_cc = isc_sama5d2_config_cc; isc->config_gam = isc_sama5d2_config_gam; + isc->config_rlp = isc_sama5d2_config_rlp; isc->config_ctrls = isc_sama5d2_config_ctrls; isc->offsets.csc =ISC_SAMA5D2_CSC_OFFSET ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 26/30 media: atmel: atmel-isc-regs: add additional fields for sama7g5 type pipeline
In reply to Eugen HristevAdd additional fields for registers present in sama7g5 type pipeline. Extend register masks for additional bits in sama7g5 type pipeline registers.
--- drivers/media/platform/atmel/atmel-isc-regs.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/media/platform/atmel/atmel-isc-regs.h +14 -2
@@ -289,8 +289,18 @@#define ISC_RLP_CFG_MODE_ARGB32 0xa#define ISC_RLP_CFG_MODE_YYCC 0xb#define ISC_RLP_CFG_MODE_YYCC_LIMITED 0xc +#define ISC_RLP_CFG_MODE_YCYC 0xd#define ISC_RLP_CFG_MODE_MASK GENMASK(3, 0) +#define ISC_RLP_CFG_LSH BIT(5) + +#define ISC_RLP_CFG_YMODE_YUYV (3 << 6) +#define ISC_RLP_CFG_YMODE_YVYU (2 << 6) +#define ISC_RLP_CFG_YMODE_VYUY (0 << 6) +#define ISC_RLP_CFG_YMODE_UYVY (1 << 6) + +#define ISC_RLP_CFG_YMODE_MASK GENMASK(7, 6) +/* Offset for HIS register specific to sama5d2 product */ #define ISC_SAMA5D2_HIS_OFFSET 0/* Histogram Control Register */
@@ -332,13 +342,15 @@#define ISC_DCFG_YMBSIZE_BEATS4 (0x1 << 4)#define ISC_DCFG_YMBSIZE_BEATS8 (0x2 << 4)#define ISC_DCFG_YMBSIZE_BEATS16 (0x3 << 4) -#define ISC_DCFG_YMBSIZE_MASK GENMASK(5, 4) +#define ISC_DCFG_YMBSIZE_BEATS32 (0x4 << 4) +#define ISC_DCFG_YMBSIZE_MASK GENMASK(6, 4)#define ISC_DCFG_CMBSIZE_SINGLE (0x0 << 8)#define ISC_DCFG_CMBSIZE_BEATS4 (0x1 << 8)#define ISC_DCFG_CMBSIZE_BEATS8 (0x2 << 8)#define ISC_DCFG_CMBSIZE_BEATS16 (0x3 << 8) -#define ISC_DCFG_CMBSIZE_MASK GENMASK(9, 8) +#define ISC_DCFG_CMBSIZE_BEATS32 (0x4 << 8) +#define ISC_DCFG_CMBSIZE_MASK GENMASK(10, 8)/* DMA Control Register */ #define ISC_DCTRL 0x000003e4
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 27/30 media: atmel: atmel-isc-base: add support for more formats and additional pipeline modules
In reply to Eugen HristevAdd support for additional formats supported by newer pipelines, and for additional pipeline modules.
--- drivers/media/platform/atmel/atmel-isc-base.c | 48 +++++++++++++++---- 1 file changed, 38 insertions(+), 10 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +38 -10
@@ -843,6 +843,8 @@ static int isc_try_validate_formats(struct isc_device *isc)case V4L2_PIX_FMT_YUV420 :case V4L2_PIX_FMT_YUV422P :case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_UYVY : +case V4L2_PIX_FMT_VYUY : ret =0 ; yuv = true;break ;
@@ -857,6 +859,7 @@ static int isc_try_validate_formats(struct isc_device *isc)break ;case V4L2_PIX_FMT_GREY :case V4L2_PIX_FMT_Y10 : +case V4L2_PIX_FMT_Y16 : ret =0 ; grey = true;break ;
@@ -887,6 +890,8 @@ static int isc_try_validate_formats(struct isc_device *isc)*/ static int isc_try_configure_rlp_dma (struct isc_device *isc,bool direct_dump) { + isc->try_config.rlp_cfg_mode =0 ; +switch (isc->try_config.fourcc) {case V4L2_PIX_FMT_SBGGR8 :case V4L2_PIX_FMT_SGBRG8 :
@@ -953,7 +958,19 @@ static int isc_try_configure_rlp_dma(struct isc_device *isc, bool direct_dump) isc->try_config.bpp =16 ;break ;case V4L2_PIX_FMT_YUYV : - isc->try_config.rlp_cfg_mode =ISC_RLP_CFG_MODE_YYCC ; + isc->try_config.rlp_cfg_mode =ISC_RLP_CFG_MODE_YCYC |ISC_RLP_CFG_YMODE_YUYV ; + isc->try_config.dcfg_imode =ISC_DCFG_IMODE_PACKED32 ; + isc->try_config.dctrl_dview =ISC_DCTRL_DVIEW_PACKED ; + isc->try_config.bpp =16 ; +break ; +case V4L2_PIX_FMT_UYVY : + isc->try_config.rlp_cfg_mode =ISC_RLP_CFG_MODE_YCYC |ISC_RLP_CFG_YMODE_UYVY ; + isc->try_config.dcfg_imode =ISC_DCFG_IMODE_PACKED32 ; + isc->try_config.dctrl_dview =ISC_DCTRL_DVIEW_PACKED ; + isc->try_config.bpp =16 ; +break ; +case V4L2_PIX_FMT_VYUY : + isc->try_config.rlp_cfg_mode =ISC_RLP_CFG_MODE_YCYC |ISC_RLP_CFG_YMODE_VYUY ; isc->try_config.dcfg_imode =ISC_DCFG_IMODE_PACKED32 ; isc->try_config.dctrl_dview =ISC_DCTRL_DVIEW_PACKED ; isc->try_config.bpp =16 ;
@@ -964,8 +981,11 @@ static int isc_try_configure_rlp_dma(struct isc_device *isc, bool direct_dump) isc->try_config.dctrl_dview =ISC_DCTRL_DVIEW_PACKED ; isc->try_config.bpp =8 ;break ; +case V4L2_PIX_FMT_Y16 : + isc->try_config.rlp_cfg_mode =ISC_RLP_CFG_MODE_DATY10 |ISC_RLP_CFG_LSH ; + fallthrough;case V4L2_PIX_FMT_Y10 : - isc->try_config.rlp_cfg_mode =ISC_RLP_CFG_MODE_DATY10 ; + isc->try_config.rlp_cfg_mode |=ISC_RLP_CFG_MODE_DATY10 ; isc->try_config.dcfg_imode =ISC_DCFG_IMODE_PACKED16 ; isc->try_config.dctrl_dview =ISC_DCTRL_DVIEW_PACKED ; isc->try_config.bpp =16 ;
@@ -999,7 +1019,8 @@ static int isc_try_configure_pipeline(struct isc_device *isc)/* if sensor format is RAW, we convert inside ISC */ if (ISC_IS_FORMAT_RAW (isc->try_config.sd_format->mbus_code)) { isc->try_config.bits_pipeline =CFA_ENABLE | -WB_ENABLE |GAM_ENABLES ; +WB_ENABLE |GAM_ENABLES |DPC_BLCENABLE | +CC_ENABLE ; }else { isc->try_config.bits_pipeline =0x0 ; }
@@ -1008,8 +1029,9 @@ static int isc_try_configure_pipeline(struct isc_device *isc)/* if sensor format is RAW, we convert inside ISC */ if (ISC_IS_FORMAT_RAW (isc->try_config.sd_format->mbus_code)) { isc->try_config.bits_pipeline =CFA_ENABLE | -CSC_ENABLE |WB_ENABLE |GAM_ENABLES | -SUB420_ENABLE |SUB422_ENABLE |CBC_ENABLE ; +CSC_ENABLE |GAM_ENABLES |WB_ENABLE | +SUB420_ENABLE |SUB422_ENABLE |CBC_ENABLE | +DPC_BLCENABLE ; }else { isc->try_config.bits_pipeline =0x0 ; }
@@ -1019,33 +1041,39 @@ static int isc_try_configure_pipeline(struct isc_device *isc)if (ISC_IS_FORMAT_RAW (isc->try_config.sd_format->mbus_code)) { isc->try_config.bits_pipeline =CFA_ENABLE |CSC_ENABLE |WB_ENABLE |GAM_ENABLES | -SUB422_ENABLE |CBC_ENABLE ; +SUB422_ENABLE |CBC_ENABLE |DPC_BLCENABLE ; }else { isc->try_config.bits_pipeline =0x0 ; }break ;case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_UYVY : +case V4L2_PIX_FMT_VYUY :/* if sensor format is RAW, we convert inside ISC */ if (ISC_IS_FORMAT_RAW (isc->try_config.sd_format->mbus_code)) { isc->try_config.bits_pipeline =CFA_ENABLE |CSC_ENABLE |WB_ENABLE |GAM_ENABLES | -SUB422_ENABLE |CBC_ENABLE ; +SUB422_ENABLE |CBC_ENABLE |DPC_BLCENABLE ; }else { isc->try_config.bits_pipeline =0x0 ; }break ;case V4L2_PIX_FMT_GREY : -if (ISC_IS_FORMAT_RAW (isc->try_config.sd_format->mbus_code)) { +case V4L2_PIX_FMT_Y16 :/* if sensor format is RAW, we convert inside ISC */ +if (ISC_IS_FORMAT_RAW (isc->try_config.sd_format->mbus_code)) { isc->try_config.bits_pipeline =CFA_ENABLE |CSC_ENABLE |WB_ENABLE |GAM_ENABLES | -CBC_ENABLE ; +CBC_ENABLE |DPC_BLCENABLE ; }else { isc->try_config.bits_pipeline =0x0 ; }break ;default : - isc->try_config.bits_pipeline =0x0 ; +if (ISC_IS_FORMAT_RAW (isc->try_config.sd_format->mbus_code)) + isc->try_config.bits_pipeline =WB_ENABLE |DPC_BLCENABLE ; +else + isc->try_config.bits_pipeline =0x0 ; }/* Tune the pipeline to product specific */
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 28/30 dt-bindings: media: atmel: add microchip-xisc binding
In reply to Eugen HristevAdd bindings for the microchip xisc, a driver based on atmel-isc. It shares common code with atmel-isc, but the xisc is the next generation ISC which is present on sama7g5 product.
It has an enhanced pipeline, additional modules, formats, and it supports not only parallel sensors, but also serial sensors, by connecting to a demux endpoint present on sama7g5.
One of the key points for creating a new binding is the clocking scheme, as atmel-isc requires 3 mandatory clocks, the microchip-xisc requires a single input clock.
---
Hello Rob, all,
I did not convert this yet to yaml because I would like first your feedback if the binding is good.
If it's fine I will convert both this new binding and the old atmel-isc to yaml.
Thanks for your feedback,
Eugen
.../bindings/media/microchip-xisc.txt | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/microchip-xisc.txt
Documentation/devicetree/bindings/media/microchip-xisc.txt new file +64 -0
@@ -0,0 +1,64 @@ +Microchip eXtended Image Sensor Controller (XISC) +---------------------------------------------- + +Required properties for XISC: +- compatible + Must be "microchip,sama7g5-xisc". +- reg + Physical base address and length of the registers set for the device. +- interrupts + Should contain IRQ line for the XISC. +- clocks + List of clock specifiers, corresponding to entries in + the clock-names property; + Please refer to clock-bindings.txt. +- clock-names + Required elements: "hclock". + This is the clock that clocks the sensor controller, and is usually + fed from the clock tree. It is used for the internal controller logic. +- #clock-cells + Should be 0. +- clock-output-names + Should be "isc-mck". +- pinctrl-names, pinctrl-0 + Please refer to pinctrl-bindings.txt. + +Optional properties for XISC: +- microchip,mipi-mode; + As the XISC is usually connected to a demux/bridge, the XISC receives + the same type of input, however, it should be aware of the type of + signals received. The mipi-mode enables different internal handling + of the data and clock lines. + +XISC supports a single port node with internal parallel bus. +It should contain one 'port' child node with child 'endpoint' node. +Please refer to the bindings defined in +Documentation/devicetree/bindings/media/video-interfaces.txt. + +This endpoint has to be connected to a bridge that acts as a demux from either +a serial interface or acts as a simple direct bridge to a parallel sensor. + +Example: +xisc: xisc@e1408000 { + compatible = "microchip,sama7g5-isc"; + reg = <0xe1408000 0x2000>; + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 56>; + clock-names = "hclock"; + #clock-cells = <0>; + clock-output-names = "isc-mck"; + microchip,mipi-mode; + + port@1 { + reg = <1>; + xisc_in: endpoint { + bus-width = <12>; + hsync-active = <1>; + vsync-active = <1>; + remote-endpoint = <&csi2dc_out>; + }; + }; +}; +
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 29/30 media: atmel: atmel-isc-sama5d2: remove duplicate define
In reply to Eugen HristevRemove a duplicate definition of clock max divider
--- drivers/media/platform/atmel/atmel-sama5d2-isc.c | 2 -- 1 file changed, 2 deletions(-)
drivers/media/platform/atmel/atmel-sama5d2-isc.c +0 -2
@@ -52,8 +52,6 @@#define ISC_SAMA5D2_MAX_SUPPORT_WIDTH 2592#define ISC_SAMA5D2_MAX_SUPPORT_HEIGHT 1944 -#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)
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 30/30 media: atmel: atmel-isc: add microchip-xisc driver
In reply to Eugen HristevAdd driver for the extended variant of the isc, the microchip XISC present on sama7g5 product.
--- drivers/media/platform/Makefile | 1 + drivers/media/platform/atmel/Kconfig | 11 + drivers/media/platform/atmel/Makefile | 2 + drivers/media/platform/atmel/atmel-isc-base.c | 2 +- drivers/media/platform/atmel/atmel-isc-regs.h | 26 + .../media/platform/atmel/atmel-sama7g5-isc.c | 644 ++++++++++++++++++ 6 files changed, 685 insertions(+), 1 deletion(-) create mode 100644 drivers/media/platform/atmel/atmel-sama7g5-isc.c
drivers/media/platform/Makefile +1 -0
@@ -67,6 +67,7 @@ obj-$(CONFIG_VIDEO_RCAR_VIN) += rcar-vin/ obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel/ obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel/ +obj-$(CONFIG_VIDEO_ATMEL_XISC) += atmel/ obj-$(CONFIG_VIDEO_STM32_DCMI) += stm32/
drivers/media/platform/atmel/Kconfig +11 -0
@@ -12,6 +12,17 @@ config VIDEO_ATMEL_ISC This module makes the ATMEL Image Sensor Controller available as a v4l2 device. +config VIDEO_ATMEL_XISC + tristate "ATMEL eXtended Image Sensor Controller (XISC) support" + depends on VIDEO_V4L2 && COMMON_CLK && VIDEO_V4L2_SUBDEV_API + depends on ARCH_AT91 || COMPILE_TEST + select VIDEOBUF2_DMA_CONTIG + select REGMAP_MMIO + select V4L2_FWNODE + help + This module makes the ATMEL eXtended Image Sensor Controller + available as a v4l2 device. + config VIDEO_ATMEL_ISI tristate "ATMEL Image Sensor Interface (ISI) support" depends on VIDEO_V4L2 && OF
drivers/media/platform/atmel/Makefile +2 -0
@@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only atmel-isc-objs = atmel-sama5d2-isc.o atmel-isc-base.o +atmel-xisc-objs = atmel-sama7g5-isc.o atmel-isc-base.o obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel-isc.o +obj-$(CONFIG_VIDEO_ATMEL_XISC) += atmel-xisc.o
drivers/media/platform/atmel/atmel-isc-base.c +1 -1
@@ -592,7 +592,7 @@ static int isc_configure(struct isc_device *isc) mask =ISC_PFE_CFG0_BPS_MASK |ISC_PFE_CFG0_HPOL_LOW |ISC_PFE_CFG0_VPOL_LOW |ISC_PFE_CFG0_PPOL_LOW |ISC_PFE_CFG0_MODE_MASK |ISC_PFE_CFG0_CCIR_CRC | -ISC_PFE_CFG0_CCIR656 ; +ISC_PFE_CFG0_CCIR656 |ISC_PFE_CFG0_MIPI ;regmap_update_bits (regmap,ISC_PFE_CFG0 , mask, pfe_cfg0);
drivers/media/platform/atmel/atmel-isc-regs.h +26 -0
@@ -26,6 +26,7 @@#define ISC_PFE_CFG0_PPOL_LOW BIT(2)#define ISC_PFE_CFG0_CCIR656 BIT(9)#define ISC_PFE_CFG0_CCIR_CRC BIT(10) +#define ISC_PFE_CFG0_MIPI BIT(14)#define ISC_PFE_CFG0_MODE_PROGRESSIVE (0x0 << 4)#define ISC_PFE_CFG0_MODE_MASK GENMASK(6, 4)
@@ -184,6 +185,8 @@/* ISC Gamma Correction Control Register */ #define ISC_GAM_CTRL 0x00000094 +#define ISC_GAM_CTRL_BIPART BIT(4) +/* ISC_Gamma Correction Blue Entry Register */ #define ISC_GAM_BENTRY 0x00000098
@@ -222,6 +225,8 @@/* Offset for CSC register specific to sama5d2 product */ #define ISC_SAMA5D2_CSC_OFFSET 0 +/* Offset for CSC register specific to sama7g5 product */ +#define ISC_SAMA7G5_CSC_OFFSET 0x11c/* Color Space Conversion Control Register */ #define ISC_CSC_CTRL 0x00000398
@@ -246,6 +251,8 @@/* Offset for CBC register specific to sama5d2 product */ #define ISC_SAMA5D2_CBC_OFFSET 0 +/* Offset for CBC register specific to sama7g5 product */ +#define ISC_SAMA7G5_CBC_OFFSET 0x11c/* Contrast And Brightness Control Register */ #define ISC_CBC_CTRL 0x000003b4
@@ -261,18 +268,30 @@#define ISC_CBC_CONTRAST 0x000003c0#define ISC_CBC_CONTRAST_MASK GENMASK(11, 0) +/* Hue Register */ +#define ISC_CBCHS_HUE 0x4e0 +/* Saturation Register */ +#define ISC_CBCHS_SAT 0x4e4 +/* Offset for SUB422 register specific to sama5d2 product */ #define ISC_SAMA5D2_SUB422_OFFSET 0 +/* Offset for SUB422 register specific to sama7g5 product */ +#define ISC_SAMA7G5_SUB422_OFFSET 0x124 +/* Subsampling 4:4:4 to 4:2:2 Control Register */ #define ISC_SUB422_CTRL 0x000003c4/* Offset for SUB420 register specific to sama5d2 product */ #define ISC_SAMA5D2_SUB420_OFFSET 0 +/* Offset for SUB420 register specific to sama7g5 product */ +#define ISC_SAMA7G5_SUB420_OFFSET 0x124/* Subsampling 4:2:2 to 4:2:0 Control Register */ #define ISC_SUB420_CTRL 0x000003cc/* Offset for RLP register specific to sama5d2 product */ #define ISC_SAMA5D2_RLP_OFFSET 0 +/* Offset for RLP register specific to sama7g5 product */ +#define ISC_SAMA7G5_RLP_OFFSET 0x124/* Rounding, Limiting and Packing Configuration Register */ #define ISC_RLP_CFG 0x000003d0
@@ -303,6 +322,8 @@/* Offset for HIS register specific to sama5d2 product */ #define ISC_SAMA5D2_HIS_OFFSET 0 +/* Offset for HIS register specific to sama7g5 product */ +#define ISC_SAMA7G5_HIS_OFFSET 0x124/* Histogram Control Register */ #define ISC_HIS_CTRL 0x000003d4
@@ -326,6 +347,8 @@/* Offset for DMA register specific to sama5d2 product */ #define ISC_SAMA5D2_DMA_OFFSET 0 +/* Offset for DMA register specific to sama7g5 product */ +#define ISC_SAMA7G5_DMA_OFFSET 0x13c/* DMA Configuration Register */ #define ISC_DCFG 0x000003e0
@@ -376,11 +399,14 @@/* Offset for version register specific to sama5d2 product */ #define ISC_SAMA5D2_VERSION_OFFSET 0 +#define ISC_SAMA7G5_VERSION_OFFSET 0x13c/* Version Register */ #define ISC_VERSION 0x0000040c/* Offset for version register specific to sama5d2 product */ #define ISC_SAMA5D2_HIS_ENTRY_OFFSET 0 +/* Offset for version register specific to sama7g5 product */ +#define ISC_SAMA7G5_HIS_ENTRY_OFFSET 0x14c/* Histogram Entry */ #define ISC_HIS_ENTRY 0x00000410
drivers/media/platform/atmel/atmel-sama7g5-isc.c new file +644 -0
644 lines not on this page · raw message
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
kernel test robot
build botRe: [PATCH 06/30] media: atmel: atmel-isc: extract CSC submodule config into separate function
In reply to Eugen HristevI love your patch! Perhaps something to improve:
Hi Eugen,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v5.12-rc5 next-20210401]
[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/Eugen-Hristev/media-atmel-atmel-isc-add-support-for-xisc/20210402-024144 base: git://linuxtv.org/media_tree.git master config: arm64-randconfig-r024-20210401 (attached as .config) compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/16c4afad71c41ecb74d0afff8e7ccc7e868d3cdd
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eugen-Hristev/media-atmel-atmel-isc-add-support-for-xisc/20210402-024144 git checkout 16c4afad71c41ecb74d0afff8e7ccc7e868d3cdd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/media/platform/atmel/atmel-sama5d2-isc.c:57:6: warning: no previous prototype for 'isc_sama5d2_config_csc' [-Wmissing-prototypes]
57 | void isc_sama5d2_config_csc(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~~
vim +/isc_sama5d2_config_csc +57 drivers/media/platform/atmel/atmel-sama5d2-isc.c
56
> 57 void isc_sama5d2_config_csc(struct isc_device *isc)
58 {
59 struct regmap *regmap = isc->regmap;
60
61 /* Convert RGB to YUV */
62 regmap_write(regmap, ISC_CSC_YR_YG, 0x42 | (0x81 << 16));
63 regmap_write(regmap, ISC_CSC_YB_OY, 0x19 | (0x10 << 16));
64 regmap_write(regmap, ISC_CSC_CBR_CBG, 0xFDA | (0xFB6 << 16));
65 regmap_write(regmap, ISC_CSC_CBB_OCB, 0x70 | (0x80 << 16));
66 regmap_write(regmap, ISC_CSC_CRR_CRG, 0x70 | (0xFA2 << 16));
67 regmap_write(regmap, ISC_CSC_CRB_OCR, 0xFEE | (0x80 << 16));
68 }
69 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
kernel test robot
build botRe: [PATCH 30/30] media: atmel: atmel-isc: add microchip-xisc driver
In reply to Eugen HristevI love your patch! Perhaps something to improve:
Hi Eugen,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v5.12-rc5 next-20210401]
[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/Eugen-Hristev/media-atmel-atmel-isc-add-support-for-xisc/20210402-024144 base: git://linuxtv.org/media_tree.git master config: nios2-allyesconfig (attached as .config) compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/5940a9ab90aba6cd4c659b9df3ab1b8bb0ce0e43
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eugen-Hristev/media-atmel-atmel-isc-add-support-for-xisc/20210402-024144 git checkout 5940a9ab90aba6cd4c659b9df3ab1b8bb0ce0e43
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/media/platform/atmel/atmel-sama7g5-isc.c:207:6: warning: no previous prototype for 'isc_sama7g5_config_csc' [-Wmissing-prototypes]
207 | void isc_sama7g5_config_csc(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/atmel/atmel-sama7g5-isc.c:226:6: warning: no previous prototype for 'isc_sama7g5_config_cbc' [-Wmissing-prototypes]
226 | void isc_sama7g5_config_cbc(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/atmel/atmel-sama7g5-isc.c:238:6: warning: no previous prototype for 'isc_sama7g5_config_cc' [-Wmissing-prototypes]
238 | void isc_sama7g5_config_cc(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/atmel/atmel-sama7g5-isc.c:251:6: warning: no previous prototype for 'isc_sama7g5_config_ctrls' [-Wmissing-prototypes]
251 | void isc_sama7g5_config_ctrls(struct isc_device *isc,
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/atmel/atmel-sama7g5-isc.c:262:6: warning: no previous prototype for 'isc_sama7g5_config_dpc' [-Wmissing-prototypes]
262 | void isc_sama7g5_config_dpc(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/atmel/atmel-sama7g5-isc.c:273:6: warning: no previous prototype for 'isc_sama7g5_config_gam' [-Wmissing-prototypes]
273 | void isc_sama7g5_config_gam(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/atmel/atmel-sama7g5-isc.c:281:6: warning: no previous prototype for 'isc_sama7g5_config_rlp' [-Wmissing-prototypes]
281 | void isc_sama7g5_config_rlp(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/atmel/atmel-sama7g5-isc.c:291:6: warning: no previous prototype for 'isc_sama7g5_adapt_pipeline' [-Wmissing-prototypes]
291 | void isc_sama7g5_adapt_pipeline(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/atmel/atmel-sama7g5-isc.c: In function 'microchip_xisc_probe':
drivers/media/platform/atmel/atmel-sama7g5-isc.c:530:9: error: implicit declaration of function 'v4l2_async_notifier_add_subdev'; did you mean 'v4l2_async_notifier_add_i2c_subdev'? [-Werror=implicit-function-declaration]
530 | ret = v4l2_async_notifier_add_subdev(&subdev_entity->notifier,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| v4l2_async_notifier_add_i2c_subdevcc1: some warnings being treated as errors
vim +/isc_sama7g5_config_csc +207 drivers/media/platform/atmel/atmel-sama7g5-isc.c
206
> 207 void isc_sama7g5_config_csc(struct isc_device *isc)
208 {
209 struct regmap *regmap = isc->regmap;
210
211 /* Convert RGB to YUV */
212 regmap_write(regmap, ISC_CSC_YR_YG + isc->offsets.csc,
213 0x42 | (0x81 << 16));
214 regmap_write(regmap, ISC_CSC_YB_OY + isc->offsets.csc,
215 0x19 | (0x10 << 16));
216 regmap_write(regmap, ISC_CSC_CBR_CBG + isc->offsets.csc,
217 0xFDA | (0xFB6 << 16));
218 regmap_write(regmap, ISC_CSC_CBB_OCB + isc->offsets.csc,
219 0x70 | (0x80 << 16));
220 regmap_write(regmap, ISC_CSC_CRR_CRG + isc->offsets.csc,
221 0x70 | (0xFA2 << 16));
222 regmap_write(regmap, ISC_CSC_CRB_OCR + isc->offsets.csc,
223 0xFEE | (0x80 << 16));
224 }
225
> 226 void isc_sama7g5_config_cbc(struct isc_device *isc)
227 {
228 struct regmap *regmap = isc->regmap;
229
230 /* Configure what is set via v4l2 ctrls */
231 regmap_write(regmap, ISC_CBC_BRIGHT + isc->offsets.cbc, isc->ctrls.brightness);
232 regmap_write(regmap, ISC_CBC_CONTRAST + isc->offsets.cbc, isc->ctrls.contrast);
233 /* Configure Hue and Saturation as neutral midpoint */
234 regmap_write(regmap, ISC_CBCHS_HUE, 0);
235 regmap_write(regmap, ISC_CBCHS_SAT, (1 << 4));
236 }
237
> 238 void isc_sama7g5_config_cc(struct isc_device *isc)
239 {
240 struct regmap *regmap = isc->regmap;
241
242 /* Configure each register at the neutral fixed point 1.0 or 0.0 */
243 regmap_write(regmap, ISC_CC_RR_RG, (1 << 8));
244 regmap_write(regmap, ISC_CC_RB_OR, 0);
245 regmap_write(regmap, ISC_CC_GR_GG, (1 << 8) << 16);
246 regmap_write(regmap, ISC_CC_GB_OG, 0);
247 regmap_write(regmap, ISC_CC_BR_BG, 0);
248 regmap_write(regmap, ISC_CC_BB_OB, (1 << 8));
249 }
250
> 251 void isc_sama7g5_config_ctrls(struct isc_device *isc,
252 const struct v4l2_ctrl_ops *ops)
253 {
254 struct isc_ctrls *ctrls = &isc->ctrls;
255 struct v4l2_ctrl_handler *hdl = &ctrls->handler;
256
257 ctrls->contrast = 16;
258
259 v4l2_ctrl_new_std(hdl, ops, V4L2_CID_CONTRAST, -2048, 2047, 1, 16);
260 }
261
> 262 void isc_sama7g5_config_dpc(struct isc_device *isc)
263 {
264 u32 bay_cfg = isc->config.sd_format->cfa_baycfg;
265 struct regmap *regmap = isc->regmap;
266
267 regmap_update_bits(regmap, ISC_DPC_CFG, ISC_DPC_CFG_BLOFF_MASK,
268 (64 << ISC_DPC_CFG_BLOFF_SHIFT));
269 regmap_update_bits(regmap, ISC_DPC_CFG, ISC_DPC_CFG_BAYCFG_MASK,
270 (bay_cfg << ISC_DPC_CFG_BAYCFG_SHIFT));
271 }
272
> 273 void isc_sama7g5_config_gam(struct isc_device *isc)
274 {
275 struct regmap *regmap = isc->regmap;
276
277 regmap_update_bits(regmap, ISC_GAM_CTRL, ISC_GAM_CTRL_BIPART,
278 ISC_GAM_CTRL_BIPART);
279 }
280
> 281 void isc_sama7g5_config_rlp(struct isc_device *isc)
282 {
283 struct regmap *regmap = isc->regmap;
284 u32 rlp_mode = isc->config.rlp_cfg_mode;
285
286 regmap_update_bits(regmap, ISC_RLP_CFG + isc->offsets.rlp,
287 ISC_RLP_CFG_MODE_MASK | ISC_RLP_CFG_LSH |
288 ISC_RLP_CFG_YMODE_MASK, rlp_mode);
289 }
290
> 291 void isc_sama7g5_adapt_pipeline(struct isc_device *isc) 292 {
293 isc->try_config.bits_pipeline &= ISC_SAMA7G5_PIPELINE;
294 }
295
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH 09/30] media: atmel: atmel-isc: extract CBC submodule config into separate function
In reply to Eugen HristevI love your patch! Perhaps something to improve:
Hi Eugen,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v5.12-rc5 next-20210401]
[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/Eugen-Hristev/media-atmel-atmel-isc-add-support-for-xisc/20210402-024144 base: git://linuxtv.org/media_tree.git master config: arm64-randconfig-r024-20210401 (attached as .config) compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/0136fa35e972de936a196a353496986799606b7b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eugen-Hristev/media-atmel-atmel-isc-add-support-for-xisc/20210402-024144 git checkout 0136fa35e972de936a196a353496986799606b7b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/media/platform/atmel/atmel-sama5d2-isc.c:57:6: warning: no previous prototype for 'isc_sama5d2_config_csc' [-Wmissing-prototypes]
57 | void isc_sama5d2_config_csc(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/atmel/atmel-sama5d2-isc.c:76:6: warning: no previous prototype for 'isc_sama5d2_config_cbc' [-Wmissing-prototypes]
76 | void isc_sama5d2_config_cbc(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~~
vim +/isc_sama5d2_config_cbc +76 drivers/media/platform/atmel/atmel-sama5d2-isc.c
56
> 57 void isc_sama5d2_config_csc(struct isc_device *isc)
58 {
59 struct regmap *regmap = isc->regmap;
60
61 /* Convert RGB to YUV */
62 regmap_write(regmap, ISC_CSC_YR_YG + isc->offsets.csc,
63 0x42 | (0x81 << 16));
64 regmap_write(regmap, ISC_CSC_YB_OY + isc->offsets.csc,
65 0x19 | (0x10 << 16));
66 regmap_write(regmap, ISC_CSC_CBR_CBG + isc->offsets.csc,
67 0xFDA | (0xFB6 << 16));
68 regmap_write(regmap, ISC_CSC_CBB_OCB + isc->offsets.csc,
69 0x70 | (0x80 << 16));
70 regmap_write(regmap, ISC_CSC_CRR_CRG + isc->offsets.csc,
71 0x70 | (0xFA2 << 16));
72 regmap_write(regmap, ISC_CSC_CRB_OCR + isc->offsets.csc,
73 0xFEE | (0x80 << 16));
74 }
75
> 76 void isc_sama5d2_config_cbc(struct isc_device *isc)
77 {
78 struct regmap *regmap = isc->regmap;
79
80 regmap_write(regmap, ISC_CBC_BRIGHT, isc->ctrls.brightness);
81 regmap_write(regmap, ISC_CBC_CONTRAST, isc->ctrls.contrast);
82 }
83 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org