2 * Copyright (C) 2013 Spreadtrum Communications Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef _SPRD_DRM_IRQ_H_
15 #define _SPRD_DRM_IRQ_H_
18 #include <mach/irqs.h>
19 #include <linux/types.h>
21 #define ONE_MICRO_SEC 1000000
22 #define VBLANK_INTERVAL(x) (ONE_MICRO_SEC / (x))
23 #define VBLANK_DEF_HZ 60
24 #define VBLANK_LIMIT 20
26 irqreturn_t sprd_drm_irq_handler(DRM_IRQ_ARGS);
27 int sprd_drm_irq_init(struct drm_device *dev, unsigned long flags);
28 int sprd_drm_irq_uninit(struct drm_device *dev);
29 u32 sprd_drm_get_vblank_counter(struct drm_device *dev, int crtc);
30 int sprd_prepare_vblank(struct drm_device *dev, int crtc, struct drm_file *file_priv);
31 int sprd_enable_vblank(struct drm_device *dev, int crtc);
32 void sprd_disable_vblank(struct drm_device *dev, int crtc);
33 void sprd_drm_handle_vblank(struct drm_device *dev, int crtc);
34 int sprd_drm_notifier_ctrl(struct notifier_block *this,
35 unsigned long cmd, void *_data);
36 int sprd_drm_cpuidle_notify(struct notifier_block *nb, unsigned long event, void *dummy);
37 void sprd_drm_fake_vblank_handler(struct work_struct *work);
38 int sprd_drm_vblank_freq_show(struct device *dev, struct device_attribute *attr, char *buf);
39 int sprd_drm_vblank_freq_store(struct device *dev, struct device_attribute *attr,
40 const char *buf, size_t len);
42 #endif/* _SPRD_DRM_IRQ_H_ */