Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v3.16-rc1 111 lines 2.8 kB view raw
1/* 2 * Samsung EXYNOS SoC series Display Port PHY driver 3 * 4 * Copyright (C) 2013 Samsung Electronics Co., Ltd. 5 * Author: Jingoo Han <jg1.han@samsung.com> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as 9 * published by the Free Software Foundation. 10 */ 11 12#include <linux/io.h> 13#include <linux/kernel.h> 14#include <linux/module.h> 15#include <linux/of.h> 16#include <linux/of_address.h> 17#include <linux/phy/phy.h> 18#include <linux/platform_device.h> 19 20/* DPTX_PHY_CONTROL register */ 21#define EXYNOS_DPTX_PHY_ENABLE (1 << 0) 22 23struct exynos_dp_video_phy { 24 void __iomem *regs; 25}; 26 27static int __set_phy_state(struct exynos_dp_video_phy *state, unsigned int on) 28{ 29 u32 reg; 30 31 reg = readl(state->regs); 32 if (on) 33 reg |= EXYNOS_DPTX_PHY_ENABLE; 34 else 35 reg &= ~EXYNOS_DPTX_PHY_ENABLE; 36 writel(reg, state->regs); 37 38 return 0; 39} 40 41static int exynos_dp_video_phy_power_on(struct phy *phy) 42{ 43 struct exynos_dp_video_phy *state = phy_get_drvdata(phy); 44 45 return __set_phy_state(state, 1); 46} 47 48static int exynos_dp_video_phy_power_off(struct phy *phy) 49{ 50 struct exynos_dp_video_phy *state = phy_get_drvdata(phy); 51 52 return __set_phy_state(state, 0); 53} 54 55static struct phy_ops exynos_dp_video_phy_ops = { 56 .power_on = exynos_dp_video_phy_power_on, 57 .power_off = exynos_dp_video_phy_power_off, 58 .owner = THIS_MODULE, 59}; 60 61static int exynos_dp_video_phy_probe(struct platform_device *pdev) 62{ 63 struct exynos_dp_video_phy *state; 64 struct device *dev = &pdev->dev; 65 struct resource *res; 66 struct phy_provider *phy_provider; 67 struct phy *phy; 68 69 state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); 70 if (!state) 71 return -ENOMEM; 72 73 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 74 75 state->regs = devm_ioremap_resource(dev, res); 76 if (IS_ERR(state->regs)) 77 return PTR_ERR(state->regs); 78 79 phy = devm_phy_create(dev, &exynos_dp_video_phy_ops, NULL); 80 if (IS_ERR(phy)) { 81 dev_err(dev, "failed to create Display Port PHY\n"); 82 return PTR_ERR(phy); 83 } 84 phy_set_drvdata(phy, state); 85 86 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 87 if (IS_ERR(phy_provider)) 88 return PTR_ERR(phy_provider); 89 90 return 0; 91} 92 93static const struct of_device_id exynos_dp_video_phy_of_match[] = { 94 { .compatible = "samsung,exynos5250-dp-video-phy" }, 95 { }, 96}; 97MODULE_DEVICE_TABLE(of, exynos_dp_video_phy_of_match); 98 99static struct platform_driver exynos_dp_video_phy_driver = { 100 .probe = exynos_dp_video_phy_probe, 101 .driver = { 102 .name = "exynos-dp-video-phy", 103 .owner = THIS_MODULE, 104 .of_match_table = exynos_dp_video_phy_of_match, 105 } 106}; 107module_platform_driver(exynos_dp_video_phy_driver); 108 109MODULE_AUTHOR("Jingoo Han <jg1.han@samsung.com>"); 110MODULE_DESCRIPTION("Samsung EXYNOS SoC DP PHY driver"); 111MODULE_LICENSE("GPL v2");