static int amlogic_thermal_probe(struct platform_device *pdev) { int ret, trim_flag; struct amlogic_thermal_platform_data *pdata=NULL; device_rename(&pdev->dev, "thermal"); dbg_dev = &pdev->dev; ret = thermal_firmware_init(); if (ret < 0) { THERMAL_INFO("this chip is not trimmed, can't use thermal\n"); trim_flag = 0; return -ENODEV; } else { THERMAL_INFO("this chip is trimmed, use thermal\n"); trim_flag = 1; } pdata = amlogic_thermal_initialize(pdev, trim_flag); if (!pdata) { dev_err(&pdev->dev, "Failed to initialize thermal\n"); goto err; } mutex_init(&pdata->lock); pdev->dev.platform_data=pdata; platform_set_drvdata(pdev, pdata); ret = amlogic_register_thermal(pdata, pdev); if (ret) { dev_err(&pdev->dev, "Failed to register thermal interface\n"); goto err; } return 0; err: platform_set_drvdata(pdev, NULL); return ret; }
static int amlogic_thermal_probe(struct platform_device *pdev) { int ret; struct amlogic_thermal_platform_data *pdata=NULL; //pdata = amlogic_get_driver_data(pdev); #ifdef CONFIG_AML_VIRTUAL_THERMAL ret=thermal_firmware_init(); if(ret<0){ printk("%s, this chip is not trimmed, use virtual thermal\n", __func__); trim_flag = 0; }else{ printk("%s, this chip is trimmed, use thermal\n", __func__); trim_flag = 1; } if(!trim_flag){ aml_virtaul_thermal_probe(pdev); INIT_DELAYED_WORK(&freq_collect_work, collect_freq_work); schedule_delayed_work(&freq_collect_work, msecs_to_jiffies(100)); atomic_set(&freq_update_flag, 0); } #else ret=thermal_firmware_init(); if(ret<0) return ret; #endif dev_info(&pdev->dev, "amlogic thermal probe start\n"); pdata = amlogic_thermal_initialize(pdev); if (!pdata) { dev_err(&pdev->dev, "Failed to initialize thermal\n"); goto err; } mutex_init(&pdata->lock); pdev->dev.platform_data=pdata; platform_set_drvdata(pdev, pdata); ret = amlogic_register_thermal(pdata); if (ret) { dev_err(&pdev->dev, "Failed to register thermal interface\n"); goto err; } dev_info(&pdev->dev, "amlogic thermal probe done\n"); return 0; err: platform_set_drvdata(pdev, NULL); return ret; }