static vpu_service_info service;
static vpu_device dec_dev;
static vpu_device enc_dev;
+static unsigned int irq_vdpu = IRQ_VDPU;
+static unsigned int irq_vepu = IRQ_VEPU;
+static bool dev_already_added = false;
#define VPU_POWER_OFF_DELAY 4*HZ /* 4s */
#define VPU_TIMEOUT_DELAY 2*HZ /* 2s */
.id = -1,
};
+static int vpu_service_probe(struct platform_device *pdev)
+{
+ int irq;
+
+ if (dev_already_added)
+ return -EEXIST;
+
+ irq = platform_get_irq_byname(pdev, "irq_vdpu");
+ if (irq > 0)
+ irq_vdpu = irq;
+ irq = platform_get_irq_byname(pdev, "irq_vepu");
+ if (irq > 0)
+ irq_vepu = irq;
+
+ dev_already_added = true;
+
+ return 0;
+}
+
static struct platform_driver vpu_service_driver = {
+ .probe = vpu_service_probe,
.driver = {
.name = "vpu_service",
.owner = THIS_MODULE,
{
int ret;
- pr_debug("baseaddr = 0x%08x vdpu irq = %d vepu irq = %d\n", VCODEC_PHYS, IRQ_VDPU, IRQ_VEPU);
+ platform_driver_register(&vpu_service_driver);
+ pr_debug("baseaddr = 0x%08x vdpu irq = %d vepu irq = %d\n", VCODEC_PHYS, irq_vdpu, irq_vepu);
wake_lock_init(&service.wake_lock, WAKE_LOCK_SUSPEND, "vpu");
INIT_LIST_HEAD(&service.waiting);
}
/* get the IRQ line */
- ret = request_threaded_irq(IRQ_VDPU, vdpu_irq, vdpu_isr, IRQF_SHARED, "vdpu", (void *)&dec_dev);
+ ret = request_threaded_irq(irq_vdpu, vdpu_irq, vdpu_isr, 0, "vdpu", (void *)&dec_dev);
if (ret) {
- pr_err("error: can't request vdpu irq %d\n", IRQ_VDPU);
+ pr_err("error: can't request vdpu irq %d\n", irq_vdpu);
goto err_req_vdpu_irq;
}
- ret = request_threaded_irq(IRQ_VEPU, vepu_irq, vepu_isr, IRQF_SHARED, "vepu", (void *)&enc_dev);
+ ret = request_threaded_irq(irq_vepu, vepu_irq, vepu_isr, 0, "vepu", (void *)&enc_dev);
if (ret) {
- pr_err("error: can't request vepu irq %d\n", IRQ_VEPU);
+ pr_err("error: can't request vepu irq %d\n", irq_vepu);
goto err_req_vepu_irq;
}
goto err_register;
}
- platform_device_register(&vpu_service_device);
- platform_driver_probe(&vpu_service_driver, NULL);
+ if (!dev_already_added)
+ platform_device_register(&vpu_service_device);
get_hw_info();
vpu_service_power_off();
pr_info("init success\n");
return 0;
err_register:
- free_irq(IRQ_VEPU, (void *)&enc_dev);
+ free_irq(irq_vepu, (void *)&enc_dev);
err_req_vepu_irq:
- free_irq(IRQ_VDPU, (void *)&dec_dev);
+ free_irq(irq_vdpu, (void *)&dec_dev);
err_req_vdpu_irq:
pr_info("init failed\n");
err_reserve_io:
platform_device_unregister(&vpu_service_device);
platform_driver_unregister(&vpu_service_driver);
misc_deregister(&vpu_service_misc_device);
- free_irq(IRQ_VEPU, (void *)&enc_dev);
- free_irq(IRQ_VDPU, (void *)&dec_dev);
+ free_irq(irq_vepu, (void *)&enc_dev);
+ free_irq(irq_vdpu, (void *)&dec_dev);
vpu_service_release_io();
vpu_put_clk();
wake_lock_destroy(&service.wake_lock);