Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ODROID-C2 kernel patch for hyperion(Ambilight)
diff --git a/arch/arm64/configs/odroidc2_defconfig b/arch/arm64/configs/odroidc2_defconfig
index fd4f69f..5c4df94 100644
--- a/arch/arm64/configs/odroidc2_defconfig
+++ b/arch/arm64/configs/odroidc2_defconfig
@@ -1227,7 +1227,7 @@ CONFIG_AM_VDEC_AVS=y
CONFIG_AM_TIMESYNC=y
CONFIG_AM_STREAMING=y
CONFIG_AM_SUBTITLE=y
-# CONFIG_AM_VIDEOCAPTURE is not set
+CONFIG_AM_VIDEOCAPTURE=y
#
# Deinterlace driver
diff --git a/drivers/amlogic/amports/amvideocap.c b/drivers/amlogic/amports/amvideocap.c
index e2d0abc..ed89956 100644
--- a/drivers/amlogic/amports/amvideocap.c
+++ b/drivers/amlogic/amports/amvideocap.c
@@ -64,7 +64,7 @@
#define CAP_WIDTH_MAX 1920
#define CAP_HEIGHT_MAX 1080
-#define BUF_SIZE_MAX (0x800000) /* 1920 * 1088 * 4 */
+#define BUF_SIZE_MAX (0x1fffff) /* 1920 * 1088 */
MODULE_DESCRIPTION("Video Frame capture");
MODULE_AUTHOR("amlogic-bj");
diff --git a/drivers/amlogic/display/ge2d/ge2d_wq.c b/drivers/amlogic/display/ge2d/ge2d_wq.c
index 8b92abe..a8fa99d 100755
--- a/drivers/amlogic/display/ge2d/ge2d_wq.c
+++ b/drivers/amlogic/display/ge2d/ge2d_wq.c
@@ -258,9 +258,12 @@ static int ge2d_process_work_queue(struct ge2d_context_s *wq)
} while (pos != head);
ge2d_manager.last_wq = wq;
exit:
+ spin_lock(&ge2d_manager.state_lock);
if (ge2d_manager.ge2d_state == GE2D_STATE_REMOVING_WQ)
complete(&ge2d_manager.event.process_complete);
ge2d_manager.ge2d_state = GE2D_STATE_IDLE;
+ spin_unlock(&ge2d_manager.state_lock);
+
return ret;
}
@@ -1083,9 +1086,17 @@ int destroy_ge2d_work_queue(struct ge2d_context_s *ge2d_work_queue)
spin_unlock(&ge2d_manager.event.sem_lock);
if ((ge2d_manager.current_wq == ge2d_work_queue) &&
(ge2d_manager.ge2d_state == GE2D_STATE_RUNNING)) {
- ge2d_manager.ge2d_state = GE2D_STATE_REMOVING_WQ;
- wait_for_completion(
- &ge2d_manager.event.process_complete);
+ // check again with lock
+ int wasRunning = 0;
+ spin_lock(&ge2d_manager.state_lock);
+ if (ge2d_manager.ge2d_state== GE2D_STATE_RUNNING)
+ {
+ ge2d_manager.ge2d_state=GE2D_STATE_REMOVING_WQ;
+ wasRunning = 1;
+ }
+ spin_unlock(&ge2d_manager.state_lock);
+ if (wasRunning)
+ wait_for_completion(&ge2d_manager.event.process_complete);
/* condition so complex ,simplify it . */
ge2d_manager.last_wq = NULL;
} /* else we can delete it safely. */
@@ -1138,6 +1149,7 @@ int ge2d_wq_init(struct platform_device *pdev,
/* prepare bottom half */
spin_lock_init(&ge2d_manager.event.sem_lock);
+ spin_lock_init(&ge2d_manager.state_lock);
sema_init(&ge2d_manager.event.cmd_in_sem, 1);
init_waitqueue_head(&ge2d_manager.event.cmd_complete);
init_completion(&ge2d_manager.event.process_complete);
diff --git a/include/linux/amlogic/ge2d/ge2d.h b/include/linux/amlogic/ge2d/ge2d.h
index cd13a61..8a93c24 100644
--- a/include/linux/amlogic/ge2d/ge2d.h
+++ b/include/linux/amlogic/ge2d/ge2d.h
@@ -586,6 +586,7 @@ struct ge2d_manager_s {
struct ge2d_event_s event;
int irq_num;
int ge2d_state;
+ spinlock_t state_lock;
int process_queue_state;
struct platform_device *pdev;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment