Loading drivers/soc/qcom/eud.c +60 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <linux/tty_flip.h> #include <linux/serial_core.h> #include <linux/serial.h> #include <linux/clk.h> #include <linux/workqueue.h> #include <linux/power_supply.h> #include <soc/qcom/scm.h> Loading Loading @@ -70,7 +71,9 @@ struct eud_chip { struct work_struct eud_work; struct power_supply *batt_psy; bool secure_eud_en; bool need_phy_clk_vote; phys_addr_t eud_mode_mgr2_phys_base; struct clk *eud_ahb2phy_clk; }; static const unsigned int eud_extcon_cable[] = { Loading Loading @@ -506,6 +509,31 @@ static irqreturn_t handle_eud_irq(int irq, void *data) return IRQ_HANDLED; } static int msm_eud_suspend(struct device *dev) { struct eud_chip *chip = dev_get_drvdata(dev); if (chip->need_phy_clk_vote && chip->eud_ahb2phy_clk) clk_disable_unprepare(chip->eud_ahb2phy_clk); return 0; } static int msm_eud_resume(struct device *dev) { struct eud_chip *chip = dev_get_drvdata(dev); int ret = 0; if (chip->need_phy_clk_vote && chip->eud_ahb2phy_clk) { ret = clk_prepare_enable(chip->eud_ahb2phy_clk); if (ret) dev_err(chip->dev, "%s failed to vote ahb2phy clk %d\n", __func__, ret); } return ret; } static int msm_eud_probe(struct platform_device *pdev) { struct eud_chip *chip; Loading Loading @@ -565,12 +593,26 @@ static int msm_eud_probe(struct platform_device *pdev) chip->eud_mode_mgr2_phys_base = res->start; } chip->need_phy_clk_vote = of_property_read_bool(pdev->dev.of_node, "qcom,eud-clock-vote-req"); if (chip->need_phy_clk_vote) { chip->eud_ahb2phy_clk = devm_clk_get(&pdev->dev, "eud_ahb2phy_clk"); if (IS_ERR(chip->eud_ahb2phy_clk)) { ret = PTR_ERR(chip->eud_ahb2phy_clk); return ret; } ret = clk_prepare_enable(chip->eud_ahb2phy_clk); if (ret) return ret; } ret = devm_request_irq(&pdev->dev, chip->eud_irq, handle_eud_irq, IRQF_TRIGGER_HIGH, "eud_irq", chip); if (ret) { dev_err(chip->dev, "%s: request failed for eud irq\n", __func__); return ret; dev_err(chip->dev, "request failed for eud irq\n"); goto error; } device_init_wakeup(&pdev->dev, true); Loading @@ -591,8 +633,8 @@ static int msm_eud_probe(struct platform_device *pdev) ret = uart_add_one_port(&eud_uart_driver, port); if (!ret) { dev_err(chip->dev, "%s: failed to add uart port\n", __func__); return ret; dev_err(chip->dev, "failed to add uart port!\n"); goto error; } eud_private = pdev; Loading @@ -603,6 +645,12 @@ static int msm_eud_probe(struct platform_device *pdev) enable_eud(pdev); return 0; error: if (chip->need_phy_clk_vote && chip->eud_ahb2phy_clk) clk_disable_unprepare(chip->eud_ahb2phy_clk); return ret; } static int msm_eud_remove(struct platform_device *pdev) Loading @@ -612,6 +660,8 @@ static int msm_eud_remove(struct platform_device *pdev) uart_remove_one_port(&eud_uart_driver, port); device_init_wakeup(chip->dev, false); if (chip->need_phy_clk_vote) clk_disable_unprepare(chip->eud_ahb2phy_clk); return 0; } Loading @@ -622,12 +672,17 @@ static const struct of_device_id msm_eud_dt_match[] = { }; MODULE_DEVICE_TABLE(of, msm_eud_dt_match); static const struct dev_pm_ops msm_eud_dev_pm_ops = { SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(msm_eud_suspend, msm_eud_resume) }; static struct platform_driver msm_eud_driver = { .probe = msm_eud_probe, .remove = msm_eud_remove, .driver = { .name = "msm-eud", .owner = THIS_MODULE, .pm = &msm_eud_dev_pm_ops, .of_match_table = msm_eud_dt_match, }, }; Loading Loading
drivers/soc/qcom/eud.c +60 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <linux/tty_flip.h> #include <linux/serial_core.h> #include <linux/serial.h> #include <linux/clk.h> #include <linux/workqueue.h> #include <linux/power_supply.h> #include <soc/qcom/scm.h> Loading Loading @@ -70,7 +71,9 @@ struct eud_chip { struct work_struct eud_work; struct power_supply *batt_psy; bool secure_eud_en; bool need_phy_clk_vote; phys_addr_t eud_mode_mgr2_phys_base; struct clk *eud_ahb2phy_clk; }; static const unsigned int eud_extcon_cable[] = { Loading Loading @@ -506,6 +509,31 @@ static irqreturn_t handle_eud_irq(int irq, void *data) return IRQ_HANDLED; } static int msm_eud_suspend(struct device *dev) { struct eud_chip *chip = dev_get_drvdata(dev); if (chip->need_phy_clk_vote && chip->eud_ahb2phy_clk) clk_disable_unprepare(chip->eud_ahb2phy_clk); return 0; } static int msm_eud_resume(struct device *dev) { struct eud_chip *chip = dev_get_drvdata(dev); int ret = 0; if (chip->need_phy_clk_vote && chip->eud_ahb2phy_clk) { ret = clk_prepare_enable(chip->eud_ahb2phy_clk); if (ret) dev_err(chip->dev, "%s failed to vote ahb2phy clk %d\n", __func__, ret); } return ret; } static int msm_eud_probe(struct platform_device *pdev) { struct eud_chip *chip; Loading Loading @@ -565,12 +593,26 @@ static int msm_eud_probe(struct platform_device *pdev) chip->eud_mode_mgr2_phys_base = res->start; } chip->need_phy_clk_vote = of_property_read_bool(pdev->dev.of_node, "qcom,eud-clock-vote-req"); if (chip->need_phy_clk_vote) { chip->eud_ahb2phy_clk = devm_clk_get(&pdev->dev, "eud_ahb2phy_clk"); if (IS_ERR(chip->eud_ahb2phy_clk)) { ret = PTR_ERR(chip->eud_ahb2phy_clk); return ret; } ret = clk_prepare_enable(chip->eud_ahb2phy_clk); if (ret) return ret; } ret = devm_request_irq(&pdev->dev, chip->eud_irq, handle_eud_irq, IRQF_TRIGGER_HIGH, "eud_irq", chip); if (ret) { dev_err(chip->dev, "%s: request failed for eud irq\n", __func__); return ret; dev_err(chip->dev, "request failed for eud irq\n"); goto error; } device_init_wakeup(&pdev->dev, true); Loading @@ -591,8 +633,8 @@ static int msm_eud_probe(struct platform_device *pdev) ret = uart_add_one_port(&eud_uart_driver, port); if (!ret) { dev_err(chip->dev, "%s: failed to add uart port\n", __func__); return ret; dev_err(chip->dev, "failed to add uart port!\n"); goto error; } eud_private = pdev; Loading @@ -603,6 +645,12 @@ static int msm_eud_probe(struct platform_device *pdev) enable_eud(pdev); return 0; error: if (chip->need_phy_clk_vote && chip->eud_ahb2phy_clk) clk_disable_unprepare(chip->eud_ahb2phy_clk); return ret; } static int msm_eud_remove(struct platform_device *pdev) Loading @@ -612,6 +660,8 @@ static int msm_eud_remove(struct platform_device *pdev) uart_remove_one_port(&eud_uart_driver, port); device_init_wakeup(chip->dev, false); if (chip->need_phy_clk_vote) clk_disable_unprepare(chip->eud_ahb2phy_clk); return 0; } Loading @@ -622,12 +672,17 @@ static const struct of_device_id msm_eud_dt_match[] = { }; MODULE_DEVICE_TABLE(of, msm_eud_dt_match); static const struct dev_pm_ops msm_eud_dev_pm_ops = { SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(msm_eud_suspend, msm_eud_resume) }; static struct platform_driver msm_eud_driver = { .probe = msm_eud_probe, .remove = msm_eud_remove, .driver = { .name = "msm-eud", .owner = THIS_MODULE, .pm = &msm_eud_dev_pm_ops, .of_match_table = msm_eud_dt_match, }, }; Loading