/** * dtvtuner_pm_dev_tuner_power_off() - power off dtvtuner pm device. * @drvdata: [IN] driver data * * Return codes * 0 - Success */ static int dtvtuner_pm_dev_tuner_power_off( struct dtvtuner_pm_drvdata *drvdata ) { int ret = 0; struct dtvtuner_pm_platform_data *pfdata = drvdata->pdev->dev.platform_data; msleep(D_DTVTUNER_DEVICE_RST_WAITTIME); dtvtuner_pm_dev_gpio_put(pfdata->gpio_rst, 0); msleep(D_DTVTUNER_DEVICE_RST_WAITTIME); if (!IS_ERR_OR_NULL(reg_cfg)) { dev_info(&drvdata->pdev->dev, "regulator_disable call\n"); ret = regulator_disable(reg_cfg); if (ret) { dev_err(&drvdata->pdev->dev, "regulator_disable error ret[%d]\n", ret); } regulator_put(reg_cfg); reg_cfg = NULL; } dev_info(&drvdata->pdev->dev, "PowerOff\n"); return 0; }
/** * dtvtuner_pm_dev_tuner_HW_reset() - dtvtuner HW reset. * @drvdata: [IN] driver data * * Return codes * 0 - Success */ static int dtvtuner_pm_dev_tuner_HW_reset( struct dtvtuner_pm_drvdata *drvdata ) { struct dtvtuner_pm_platform_data *pfdata = drvdata->pdev->dev.platform_data; // reset HW(H) dtvtuner_pm_dev_gpio_put(pfdata->gpio_rst, 1); dev_info(&drvdata->pdev->dev, "HW reset(H)\n"); msleep(D_DTVTUNER_DEVICE_RST_WAITTIME); return 0; }
static int dtvtuner_pm_dev_tuner_power_on( struct dtvtuner_pm_drvdata *drvdata ) { int ret = 0; struct dtvtuner_pm_platform_data *pfdata = drvdata->pdev->dev.platform_data; // power on reg_cfg = regulator_get(NULL, pfdata->regulator_id); if (IS_ERR(reg_cfg)) { ret = PTR_ERR(reg_cfg); dev_err(&drvdata->pdev->dev, "regulator_get error[%d]\n", ret); goto out; } ret = regulator_set_voltage(reg_cfg, 1200000, 1400000); if (ret) { dev_err(&drvdata->pdev->dev, "regulator_set_voltage error ret[%d]\n", ret); goto regulator_free; } ret = regulator_set_optimum_mode(reg_cfg, 150000); if (ret < 0) { dev_err(&drvdata->pdev->dev, "regulator_set_optimum_mode error ret[%d]\n", ret); goto regulator_free; } ret = regulator_enable(reg_cfg); if (ret) { dev_err(&drvdata->pdev->dev, "regulator_enable error ret[%d]\n", ret); goto regulator_free; } dev_info(&drvdata->pdev->dev, "PowerOn success\n"); // reset HW(L) dtvtuner_pm_dev_gpio_put(pfdata->gpio_rst, 0); dev_info(&drvdata->pdev->dev, "HW reset(L)\n"); msleep(D_DTVTUNER_DEVICE_RST_WAITTIME); return 0; regulator_free: regulator_put(reg_cfg); reg_cfg=NULL; out: return ret; }