Release 4.15 drivers/gpu/drm/msm/hdmi/hdmi_phy.c
  
  
  
/*
 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#include <linux/of_device.h>
#include "hdmi.h"
static int msm_hdmi_phy_resource_init(struct hdmi_phy *phy)
{
	struct hdmi_phy_cfg *cfg = phy->cfg;
	struct device *dev = &phy->pdev->dev;
	int i, ret;
	phy->regs = devm_kzalloc(dev, sizeof(phy->regs[0]) * cfg->num_regs,
				 GFP_KERNEL);
	if (!phy->regs)
		return -ENOMEM;
	phy->clks = devm_kzalloc(dev, sizeof(phy->clks[0]) * cfg->num_clks,
				 GFP_KERNEL);
	if (!phy->clks)
		return -ENOMEM;
	for (i = 0; i < cfg->num_regs; i++) {
		struct regulator *reg;
		reg = devm_regulator_get(dev, cfg->reg_names[i]);
		if (IS_ERR(reg)) {
			ret = PTR_ERR(reg);
			dev_err(dev, "failed to get phy regulator: %s (%d)\n",
				cfg->reg_names[i], ret);
			return ret;
		}
		phy->regs[i] = reg;
	}
	for (i = 0; i < cfg->num_clks; i++) {
		struct clk *clk;
		clk = msm_clk_get(phy->pdev, cfg->clk_names[i]);
		if (IS_ERR(clk)) {
			ret = PTR_ERR(clk);
			dev_err(dev, "failed to get phy clock: %s (%d)\n",
				cfg->clk_names[i], ret);
			return ret;
		}
		phy->clks[i] = clk;
	}
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 269 | 98.18% | 1 | 33.33% | 
| Rob Clark | 4 | 1.46% | 1 | 33.33% | 
| Arnd Bergmann | 1 | 0.36% | 1 | 33.33% | 
| Total | 274 | 100.00% | 3 | 100.00% | 
int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy)
{
	struct hdmi_phy_cfg *cfg = phy->cfg;
	struct device *dev = &phy->pdev->dev;
	int i, ret = 0;
	pm_runtime_get_sync(dev);
	for (i = 0; i < cfg->num_regs; i++) {
		ret = regulator_enable(phy->regs[i]);
		if (ret)
			dev_err(dev, "failed to enable regulator: %s (%d)\n",
				cfg->reg_names[i], ret);
	}
	for (i = 0; i < cfg->num_clks; i++) {
		ret = clk_prepare_enable(phy->clks[i]);
		if (ret)
			dev_err(dev, "failed to enable clock: %s (%d)\n",
				cfg->clk_names[i], ret);
	}
	return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 143 | 99.31% | 1 | 50.00% | 
| Arnd Bergmann | 1 | 0.69% | 1 | 50.00% | 
| Total | 144 | 100.00% | 2 | 100.00% | 
void msm_hdmi_phy_resource_disable(struct hdmi_phy *phy)
{
	struct hdmi_phy_cfg *cfg = phy->cfg;
	struct device *dev = &phy->pdev->dev;
	int i;
	for (i = cfg->num_clks - 1; i >= 0; i--)
		clk_disable_unprepare(phy->clks[i]);
	for (i = cfg->num_regs - 1; i >= 0; i--)
		regulator_disable(phy->regs[i]);
	pm_runtime_put_sync(dev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 92 | 98.92% | 1 | 50.00% | 
| Arnd Bergmann | 1 | 1.08% | 1 | 50.00% | 
| Total | 93 | 100.00% | 2 | 100.00% | 
void msm_hdmi_phy_powerup(struct hdmi_phy *phy, unsigned long int pixclock)
{
	if (!phy || !phy->cfg->powerup)
		return;
	phy->cfg->powerup(phy, pixclock);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 38 | 97.44% | 1 | 50.00% | 
| Arnd Bergmann | 1 | 2.56% | 1 | 50.00% | 
| Total | 39 | 100.00% | 2 | 100.00% | 
void msm_hdmi_phy_powerdown(struct hdmi_phy *phy)
{
	if (!phy || !phy->cfg->powerdown)
		return;
	phy->cfg->powerdown(phy);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 31 | 96.88% | 1 | 50.00% | 
| Arnd Bergmann | 1 | 3.12% | 1 | 50.00% | 
| Total | 32 | 100.00% | 2 | 100.00% | 
static int msm_hdmi_phy_pll_init(struct platform_device *pdev,
			     enum hdmi_phy_type type)
{
	int ret;
	switch (type) {
	case MSM_HDMI_PHY_8960:
		ret = msm_hdmi_pll_8960_init(pdev);
		break;
	case MSM_HDMI_PHY_8996:
		ret = msm_hdmi_pll_8996_init(pdev);
		break;
	/*
         * we don't have PLL support for these, don't report an error for now
         */
	case MSM_HDMI_PHY_8x60:
	case MSM_HDMI_PHY_8x74:
	default:
		ret = 0;
		break;
	}
	return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 59 | 95.16% | 2 | 66.67% | 
| Arnd Bergmann | 3 | 4.84% | 1 | 33.33% | 
| Total | 62 | 100.00% | 3 | 100.00% | 
static int msm_hdmi_phy_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct hdmi_phy *phy;
	int ret;
	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
	if (!phy)
		return -ENODEV;
	phy->cfg = (struct hdmi_phy_cfg *)of_device_get_match_data(dev);
	if (!phy->cfg)
		return -ENODEV;
	phy->mmio = msm_ioremap(pdev, "hdmi_phy", "HDMI_PHY");
	if (IS_ERR(phy->mmio)) {
		dev_err(dev, "%s: failed to map phy base\n", __func__);
		return -ENOMEM;
	}
	phy->pdev = pdev;
	ret = msm_hdmi_phy_resource_init(phy);
	if (ret)
		return ret;
	pm_runtime_enable(&pdev->dev);
	ret = msm_hdmi_phy_resource_enable(phy);
	if (ret)
		return ret;
	ret = msm_hdmi_phy_pll_init(pdev, phy->cfg->type);
	if (ret) {
		dev_err(dev, "couldn't init PLL\n");
		msm_hdmi_phy_resource_disable(phy);
		return ret;
	}
	msm_hdmi_phy_resource_disable(phy);
	platform_set_drvdata(pdev, phy);
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 200 | 97.09% | 2 | 66.67% | 
| Arnd Bergmann | 6 | 2.91% | 1 | 33.33% | 
| Total | 206 | 100.00% | 3 | 100.00% | 
static int msm_hdmi_phy_remove(struct platform_device *pdev)
{
	pm_runtime_disable(&pdev->dev);
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 21 | 95.45% | 1 | 50.00% | 
| Arnd Bergmann | 1 | 4.55% | 1 | 50.00% | 
| Total | 22 | 100.00% | 2 | 100.00% | 
static const struct of_device_id msm_hdmi_phy_dt_match[] = {
	{ .compatible = "qcom,hdmi-phy-8660",
	  .data = &msm_hdmi_phy_8x60_cfg },
	{ .compatible = "qcom,hdmi-phy-8960",
	  .data = &msm_hdmi_phy_8960_cfg },
	{ .compatible = "qcom,hdmi-phy-8974",
	  .data = &msm_hdmi_phy_8x74_cfg },
	{ .compatible = "qcom,hdmi-phy-8084",
	  .data = &msm_hdmi_phy_8x74_cfg },
	{ .compatible = "qcom,hdmi-phy-8996",
	  .data = &msm_hdmi_phy_8996_cfg },
	{}
};
static struct platform_driver msm_hdmi_phy_platform_driver = {
	.probe      = msm_hdmi_phy_probe,
	.remove     = msm_hdmi_phy_remove,
	.driver     = {
		.name   = "msm_hdmi_phy",
		.of_match_table = msm_hdmi_phy_dt_match,
        },
};
void __init msm_hdmi_phy_driver_register(void)
{
	platform_driver_register(&msm_hdmi_phy_platform_driver);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 12 | 85.71% | 1 | 50.00% | 
| Arnd Bergmann | 2 | 14.29% | 1 | 50.00% | 
| Total | 14 | 100.00% | 2 | 100.00% | 
void __exit msm_hdmi_phy_driver_unregister(void)
{
	platform_driver_unregister(&msm_hdmi_phy_platform_driver);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 12 | 85.71% | 1 | 50.00% | 
| Arnd Bergmann | 2 | 14.29% | 1 | 50.00% | 
| Total | 14 | 100.00% | 2 | 100.00% | 
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 982 | 96.75% | 3 | 60.00% | 
| Arnd Bergmann | 29 | 2.86% | 1 | 20.00% | 
| Rob Clark | 4 | 0.39% | 1 | 20.00% | 
| Total | 1015 | 100.00% | 5 | 100.00% | 
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.