media: atmel: atmel-isc: split driver into driver base and isc
Subsystems (2)
PATCH v4 1/2 media: atmel: atmel-isc: split driver into driver base and isc
From: Eugen Hristev <[email protected]>
This splits the Atmel ISC driver into a common base: atmel-isc-base.c and the driver probe/dt part , atmel-isc.c
This is needed to keep a common ground for the sensor controller which will be reused.
The atmel-isc will use the common symbols inside the atmel-isc-base Future driver will also use the same symbols and redefine different aspects, for a different version of the ISC.
This is done to avoid complete code duplication by creating a totally different driver for the new variant of the ISC.
---
Hello Hans and Sakari,
I did minor changes in this versions according to your reviews. Regarding the old checkpatch issues, the patch 2/2 of this series addresses those. Regarding Sakari's review, I will come up with a follow-up patch. This patch is just a split, so, it keeps the original code as it is now in the media_tree.git . Once the split is done I can do changes to fix up the minor issues in separate patches, to not mix up things.
Thanks !
Eugen
Changes in v4:
- Removed Songjun's e-mail address as it's no longer valid. Only kept his name
Changes in v3:
- Fixed up the externs, moved to header file
- moved the module parameters to atmel-isc-base.c
Changes in v2:
- renamed atmel-isc.c to atmel-sama5d2-isc.c as sama5d2 is the SoC that includes this hardware block. The module will still be named atmel-isc.ko
- removed ifdef around definition of ATMEL_ISC_NAME
- moved external declarations in the specific files, this was breaking module loading
MAINTAINERS | 4 +- drivers/media/platform/atmel/Makefile | 4 +- drivers/media/platform/atmel/atmel-isc-base.c | 2153 ++++++++++++++++++ drivers/media/platform/atmel/atmel-isc.c | 2634 ---------------------- drivers/media/platform/atmel/atmel-isc.h | 208 ++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 344 +++ 6 files changed, 2711 insertions(+), 2636 deletions(-) create mode 100644 drivers/media/platform/atmel/atmel-isc-base.c delete mode 100644 drivers/media/platform/atmel/atmel-isc.c create mode 100644 drivers/media/platform/atmel/atmel-isc.h create mode 100644 drivers/media/platform/atmel/atmel-sama5d2-isc.c
MAINTAINERS +3 -1
@@ -10270,7 +10270,9 @@ MICROCHIP ISC DRIVER M: Eugen Hristev <[email protected]> L: [email protected] S: Supported -F: drivers/media/platform/atmel/atmel-isc.c +F: drivers/media/platform/atmel/atmel-sama5d2-isc.c +F: drivers/media/platform/atmel/atmel-isc.h +F: drivers/media/platform/atmel/atmel-isc-base.c F: drivers/media/platform/atmel/atmel-isc-regs.h F: Documentation/devicetree/bindings/media/atmel-isc.txt
drivers/media/platform/atmel/Makefile +3 -1
@@ -1,2 +1,4 @@ -obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel-isc.o +atmel-isc-objs = atmel-sama5d2-isc.o atmel-isc-base.o + obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o +obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel-isc.o
drivers/media/platform/atmel/atmel-isc-base.c new file +2153 -0
2,153 lines not on this page · raw message
drivers/media/platform/atmel/atmel-isc.c deleted +0 -2634
832 lines not on this page · raw message
drivers/media/platform/atmel/atmel-isc.h new file +208 -0
208 lines not on this page · raw message
drivers/media/platform/atmel/atmel-sama5d2-isc.c new file +344 -0
344 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
PATCH v4 2/2 media: atmel: atmel-sama5d2-isc: fixed checkpatch warnings
From: Eugen Hristev <[email protected]>
Checkpatch complaining that locks do not have comments, unaligned code and macro reuse of same argument in to_isc_clk. Fixed them by renaming, realigning and adding struct comments
---
Changes in v4:
- s/sync/serialize as requested by Sakari
Changes in v3:
- new patch, addresses the checkpatch issues that Hans asked to fix
drivers/media/platform/atmel/atmel-isc.h | 51 +++++++++++++++++++++--- drivers/media/platform/atmel/atmel-sama5d2-isc.c | 4 +- 2 files changed, 48 insertions(+), 7 deletions(-)
drivers/media/platform/atmel/atmel-isc.h +46 -5
@@ -24,14 +24,14 @@ struct isc_clk {struct clk_hw hw;struct clk *clk;struct regmap *regmap; -spinlock_t lock; +spinlock_t lock;/* serialize access to clock registers */ u8 id;u8 parent_id;u32 div;struct device *dev; }; -#define to_isc_clk (hw) container_of(hw, struct isc_clk, hw) +#define to_isc_clk (v) container_of(v, struct isc_clk, hw)struct isc_buffer {struct vb2_v4l2_buffer vb;
@@ -146,6 +146,47 @@ struct isc_ctrls {#define ISC_PIPE_LINE_NODE_NUM 11 +/* +* struct isc_device - ISC device driver data/config struct +* @regmap: Register map +* @hclock: Hclock clock input (refer datasheet) +* @ispck: iscpck clock (refer datasheet) +* @isc_clks: ISC clocks +* +* @dev: Registered device driver +* @v4l2_dev: v4l2 registered device +* @video_dev: registered video device +* +* @vb2_vidq: video buffer 2 video queue +* @dma_queue_lock: lock to serialize the dma buffer queue +* @dma_queue: the queue for dma buffers +* @cur_frm: current isc frame/buffer +* @sequence: current frame number +* @stop: true if isc is not streaming, false if streaming +* @comp: completion reference that signals frame completion +* +* @fmt: current v42l format +* @user_formats: list of formats that are supported and agreed with sd +* @num_user_formats: how many formats are in user_formats +* +* @config: current ISC format configuration +* @try_config: the current ISC try format , not yet activated +* +* @ctrls: holds information about ISC controls +* @do_wb_ctrl: control regarding the DO_WHITE_BALANCE button +* @awb_work: workqueue reference for autowhitebalance histogram +* analysis +* +* @lock: lock for serializing userspace file operations +* with ISC operations +* @awb_lock: lock for serializing awb work queue operations +* with DMA/buffer operations +* +* @pipeline: configuration of the ISC pipeline +* +* @current_subdev: current subdevice: the sensor +* @subdev_entities: list of subdevice entitites +*/ struct isc_device {struct regmap *regmap;struct clk *hclock;
@@ -157,7 +198,7 @@ struct isc_device {struct video_device video_dev;struct vb2_queue vb2_vidq; -spinlock_t dma_queue_lock; +spinlock_t dma_queue_lock;/* serialize access to dma queue */ struct list_head dma_queue;struct isc_buffer *cur_frm;unsigned int sequence;
@@ -175,8 +216,8 @@ struct isc_device {struct v4l2_ctrl *do_wb_ctrl;struct work_struct awb_work; -struct mutex lock; -spinlock_t awb_lock; +struct mutex lock;/* serialize access to file operations */ +spinlock_t awb_lock;/* serialize access to DMA buffers from awb work queue */ struct regmap_field *pipeline[ISC_PIPE_LINE_NODE_NUM ];
drivers/media/platform/atmel/atmel-sama5d2-isc.c +2 -2
@@ -87,8 +87,8 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)break ; } - subdev_entity =devm_kzalloc (dev, -sizeof (*subdev_entity),GFP_KERNEL ); + subdev_entity =devm_kzalloc (dev,sizeof (*subdev_entity), +GFP_KERNEL );if (!subdev_entity) {of_node_put (rem); ret = -ENOMEM ;
Signature · 1 line
2.7.4