diff --git a/drivers/amlogic/media/gdc/app/gdc_module.c b/drivers/amlogic/media/gdc/app/gdc_module.c index 1dd5eb9bf573..7933c576b739 100644 --- a/drivers/amlogic/media/gdc/app/gdc_module.c +++ b/drivers/amlogic/media/gdc/app/gdc_module.c @@ -1900,6 +1900,8 @@ static int gdc_platform_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gdc_dev); gdc_pwr_config(false); + gdc_manager.probed = 1; + return rc; } diff --git a/drivers/amlogic/media/gdc/app/gdc_wq.c b/drivers/amlogic/media/gdc/app/gdc_wq.c index f2fb62f7ee2b..29180925a851 100644 --- a/drivers/amlogic/media/gdc/app/gdc_wq.c +++ b/drivers/amlogic/media/gdc/app/gdc_wq.c @@ -324,6 +324,15 @@ static inline int work_queue_no_space(struct gdc_context_s *queue) return list_empty(&queue->free_queue); } +bool is_gdc_supported(void) +{ + if (gdc_manager.probed) + return true; + + return false; +} +EXPORT_SYMBOL(is_gdc_supported); + struct gdc_context_s *create_gdc_work_queue(void) { int i; @@ -331,6 +340,10 @@ struct gdc_context_s *create_gdc_work_queue(void) struct gdc_context_s *gdc_work_queue; int empty; + if (!gdc_manager.probed) { + gdc_log(LOG_INFO, "GDC is not supported for this chip\n"); + return NULL; + } gdc_work_queue = kzalloc(sizeof(struct gdc_context_s), GFP_KERNEL); if (IS_ERR(gdc_work_queue)) { gdc_log(LOG_ERR, "can't create work queue\n"); diff --git a/drivers/amlogic/media/gdc/inc/gdc/gdc_config.h b/drivers/amlogic/media/gdc/inc/gdc/gdc_config.h index 866b2756f7c1..5cc598b0e27b 100644 --- a/drivers/amlogic/media/gdc/inc/gdc/gdc_config.h +++ b/drivers/amlogic/media/gdc/inc/gdc/gdc_config.h @@ -56,6 +56,7 @@ struct gdc_manager_s { int gdc_state; int process_queue_state;//thread running flag struct meson_gdc_dev_t *gdc_dev; + int probed; }; extern struct gdc_manager_s gdc_manager; diff --git a/include/linux/amlogic/media/gdc/gdc.h b/include/linux/amlogic/media/gdc/gdc.h index 15c9faa9f07b..42c4b80c0c4b 100644 --- a/include/linux/amlogic/media/gdc/gdc.h +++ b/include/linux/amlogic/media/gdc/gdc.h @@ -165,9 +165,10 @@ struct gdc_phy_setting { char config_name[CONFIG_PATH_LENG]; }; +bool is_gdc_supported(void); +struct gdc_context_s *create_gdc_work_queue(void); int gdc_process_phys(struct gdc_context_s *context, struct gdc_phy_setting *gs); -struct gdc_context_s *create_gdc_work_queue(void); int destroy_gdc_work_queue(struct gdc_context_s *gdc_work_queue); #endif