|
9 | 9 | #include <linux/module.h> |
10 | 10 | #include <linux/phy/phy.h> |
11 | 11 | #include <linux/platform_device.h> |
| 12 | +#include <linux/regulator/driver.h> |
| 13 | +#include <linux/regulator/of_regulator.h> |
12 | 14 | #include <linux/types.h> |
13 | 15 | #include <linux/units.h> |
14 | 16 | #include <linux/nvmem-consumer.h> |
@@ -478,8 +480,50 @@ static int mtk_hdmi_phy_configure(struct phy *phy, union phy_configure_opts *opt |
478 | 480 | return ret; |
479 | 481 | } |
480 | 482 |
|
| 483 | +static int mtk_hdmi_phy_pwr5v_enable(struct regulator_dev *rdev) |
| 484 | +{ |
| 485 | + struct mtk_hdmi_phy *hdmi_phy = rdev_get_drvdata(rdev); |
| 486 | + |
| 487 | + mtk_phy_set_bits(hdmi_phy->regs + HDMI_CTL_1, RG_HDMITX_PWR5V_O); |
| 488 | + |
| 489 | + return 0; |
| 490 | +} |
| 491 | + |
| 492 | +static int mtk_hdmi_phy_pwr5v_disable(struct regulator_dev *rdev) |
| 493 | +{ |
| 494 | + struct mtk_hdmi_phy *hdmi_phy = rdev_get_drvdata(rdev); |
| 495 | + |
| 496 | + mtk_phy_clear_bits(hdmi_phy->regs + HDMI_CTL_1, RG_HDMITX_PWR5V_O); |
| 497 | + |
| 498 | + return 0; |
| 499 | +} |
| 500 | + |
| 501 | +static int mtk_hdmi_phy_pwr5v_is_enabled(struct regulator_dev *rdev) |
| 502 | +{ |
| 503 | + struct mtk_hdmi_phy *hdmi_phy = rdev_get_drvdata(rdev); |
| 504 | + |
| 505 | + return !!(readl(hdmi_phy->regs + HDMI_CTL_1) & RG_HDMITX_PWR5V_O); |
| 506 | +} |
| 507 | + |
| 508 | +static const struct regulator_ops mtk_hdmi_pwr5v_regulator_ops = { |
| 509 | + .enable = mtk_hdmi_phy_pwr5v_enable, |
| 510 | + .disable = mtk_hdmi_phy_pwr5v_disable, |
| 511 | + .is_enabled = mtk_hdmi_phy_pwr5v_is_enabled |
| 512 | +}; |
| 513 | + |
| 514 | +static const struct regulator_desc mtk_hdmi_phy_pwr5v_desc = { |
| 515 | + .name = "hdmi-pwr5v", |
| 516 | + .id = -1, |
| 517 | + .n_voltages = 1, |
| 518 | + .fixed_uV = 5000000, |
| 519 | + .ops = &mtk_hdmi_pwr5v_regulator_ops, |
| 520 | + .type = REGULATOR_VOLTAGE, |
| 521 | + .owner = THIS_MODULE, |
| 522 | +}; |
| 523 | + |
481 | 524 | struct mtk_hdmi_phy_conf mtk_hdmi_phy_8195_conf = { |
482 | 525 | .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, |
| 526 | + .hdmi_phy_regulator_desc = &mtk_hdmi_phy_pwr5v_desc, |
483 | 527 | .hdmi_phy_clk_ops = &mtk_hdmi_pll_ops, |
484 | 528 | .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, |
485 | 529 | .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds, |
|
0 commit comments