M: Nanxin Qin <nanxin.qin@amlogic.com>
F: drivers/amlogic/media/common/codec_mm/configs/*
+AMLOGIC sync
+M: Sky Zhou <sky.zhou@amlogic.com>
+F: include/linux/amlogic/aml_sync_api.h
+
AMLOGIC ADD PARTITION NORMAL & AB DTS
M: Xindong Xu <xindong.xu@amlogic.com>
F: arch/arm64/boot/dts/amlogic/partition_mbox_ab.dtsi
M: JinTao Xu <jintao.xu@amlogic.com>
F: drivers/amlogic/media/video_processor/ionvideo/ion_priv.h
F: drivers/amlogic/media/video_processor/ionvideo/videobuf2-ion.c
-F: drivers/amlogic/media/video_processor/ionvideo/videobuf2-ion.h
\ No newline at end of file
+F: drivers/amlogic/media/video_processor/ionvideo/videobuf2-ion.h
CONFIG_LEDS_TRIGGER_ONESHOT=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
+CONFIG_SYNC_FILE=y
+CONFIG_SW_SYNC=y
CONFIG_UIO=y
CONFIG_UIO_PDRV_GENIRQ=y
CONFIG_VIRTIO_MMIO=y
CONFIG_ASHMEM=y
CONFIG_ANDROID_LOGGER=y
CONFIG_ANDROID_LOW_MEMORY_KILLER=y
-CONFIG_SYNC=y
-CONFIG_SW_SYNC=y
-CONFIG_SW_SYNC_USER=y
CONFIG_PM_DEVFREQ=y
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
CONFIG_DEVFREQ_GOV_PERFORMANCE=y
.unlocked_ioctl = sw_sync_ioctl,
.compat_ioctl = sw_sync_ioctl,
};
+
+
+/*api for amlogic use.*/
+void *aml_sync_create_timeline(const char *tname)
+{
+ struct sync_timeline *timeline;
+
+ timeline = sync_timeline_create(tname);
+ return (void *)timeline;
+}
+EXPORT_SYMBOL(aml_sync_create_timeline);
+
+int aml_sync_create_fence(void *timeline, unsigned int value)
+{
+ struct sync_timeline *tl = (struct sync_timeline *)timeline;
+ int fd;
+ int err;
+ struct sync_pt *pt;
+ struct sync_file *sync_file;
+
+ if (tl == NULL)
+ return -EPERM;
+
+ fd = get_unused_fd_flags(O_CLOEXEC);
+ if (fd < 0)
+ return -EBADF;
+
+ pt = sync_pt_create(tl, sizeof(*pt), value);
+ if (!pt) {
+ err = -ENOMEM;
+ goto err;
+ }
+
+ sync_file = sync_file_create(&pt->base);
+ fence_put(&pt->base);
+ if (!sync_file) {
+ err = -ENOMEM;
+ goto err;
+ }
+
+ fd_install(fd, sync_file->file);
+ return fd;
+
+err:
+ put_unused_fd(fd);
+ return err;
+}
+EXPORT_SYMBOL(aml_sync_create_fence);
+
+void aml_sync_inc_timeline(void *timeline, unsigned int value)
+{
+ struct sync_timeline *tl = (struct sync_timeline *)timeline;
+
+ if (tl == NULL)
+ return;
+ sync_timeline_signal(tl, value);
+}
+EXPORT_SYMBOL(aml_sync_inc_timeline);
+
+struct fence *aml_sync_get_fence(int syncfile_fd)
+{
+ return sync_file_get_fence(syncfile_fd);
+}
+EXPORT_SYMBOL(aml_sync_get_fence);
+
+int aml_sync_wait_fence(struct fence *fence, long timeout)
+{
+ long ret;
+
+ ret = fence_wait_timeout(fence, false, timeout);
+ return ret;
+}
+EXPORT_SYMBOL(aml_sync_wait_fence);
+
+void aml_sync_put_fence(struct fence *fence)
+{
+ fence_put(fence);
+}
+EXPORT_SYMBOL(aml_sync_put_fence);
--- /dev/null
+/*
+ * include/linux/amlogic/aml_sync_api.h
+ *
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ */
+
+struct fence;
+
+void *aml_sync_create_timeline(const char *tname);
+int aml_sync_create_fence(void *timeline, unsigned int value);
+int aml_sync_inc_timeline(void *timeline, unsigned int value);
+
+struct fence *aml_sync_get_fence(int syncfile_fd);
+int aml_sync_wait_fence(struct fence *syncfile, long timeout);
+void aml_sync_put_fence(struct fence *syncfile);