• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 #include "hdmi_init.h"
19 #include "hi_common.h"
20 
21 #define HDMI_DEV_NAME_LENGTH 16
22 
hi35xx_hdmi_probe(struct platform_device * pdev)23 static int hi35xx_hdmi_probe(struct platform_device *pdev)
24 {
25     struct resource *mem = NULL;
26     hi_char *hdmi_reg = NULL;
27     hi_char hdmi_dev_name[HDMI_DEV_NAME_LENGTH] = "hdmi0";
28 
29     mem = osal_platform_get_resource_byname(pdev, IORESOURCE_MEM, hdmi_dev_name);
30     hdmi_reg = devm_ioremap_resource(&pdev->dev, mem);
31     if (IS_ERR(hdmi_reg)) {
32         return PTR_ERR(hdmi_reg);
33     }
34     hdmi_set_reg(hdmi_reg);
35 
36     return hdmi_drv_mod_init();
37 }
38 
hi35xx_hdmi_remove(struct platform_device * pdev)39 static int hi35xx_hdmi_remove(struct platform_device *pdev)
40 {
41     hi_unused(pdev);
42     hdmi_drv_mod_exit();
43     hdmi_set_reg(NULL);
44     return HI_SUCCESS;
45 }
46 
47 static const struct of_device_id g_hi35xx_hdmi_match[] = {
48     { .compatible = "hisilicon,hisi-hdmi" },
49     {}
50 };
51 
52 MODULE_DEVICE_TABLE(of, g_hi35xx_hdmi_match);
53 
54 static struct platform_driver g_hi35xx_hdmi_driver = {
55     .probe  = hi35xx_hdmi_probe,
56     .remove = hi35xx_hdmi_remove,
57     .driver = {
58         .name = "hi35xx_hdmi",
59         .of_match_table = g_hi35xx_hdmi_match,
60     },
61 };
62 
63 osal_module_platform_driver(g_hi35xx_hdmi_driver);
64 
65 MODULE_LICENSE("GPL");
66 MODULE_AUTHOR("Hisilicon");
67 MODULE_DESCRIPTION("HISI HDMI Driver Init");
68 
69