Re: [PATCH 1/4] clk: propagate parent change up one level

2014-06-18 Thread Tomasz Stanislawski
Hi Mike,
Do you have any comments about this patch?
The patch is needed to provide a clean fix for recently
broken support for HDMI on Exynos4210 SoC in mainline.

Regards,
Tomasz Stanislawski


On 05/01/2014 12:19 AM, Tomasz Figa wrote:
 Mike,
 
 On 08.04.2014 17:45, Tomasz Figa wrote:
 Hi,

 On 04.04.2014 16:53, Tomasz Stanislawski wrote:
 This patch adds support for propagation of setup of clock's parent one
 level
 up.

 This feature is helpful when a driver changes topology of its clocks
 using
 clk_set_parent().  The problem occurs when on one platform/SoC
 driver's clock
 is located at MUX output but on the other platform/SoC there is a
 gated proxy
 clock between the MUX and driver's clock.  In such a case, driver's
 code has to
 be modified to use one clock for enabling and the other clock for
 setup of a
 parent.

 The code updates are avoided by propagating setup of a parent up one
 level.

 Additionally, this patch adds CLK_SET_PARENT_PARENT (sorry for naming)
 flag to
 inform clk-core that clk_set_parent() should be propagated.

 Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
 ---
   drivers/clk/clk.c|6 ++
   include/linux/clk-provider.h |1 +
   2 files changed, 7 insertions(+)

 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
 index dff0373..53bbfda 100644
 --- a/drivers/clk/clk.c
 +++ b/drivers/clk/clk.c
 @@ -1737,6 +1737,12 @@ int clk_set_parent(struct clk *clk, struct clk
 *parent)

   /* try finding the new parent index */
   if (parent) {
 +if ((clk-flags  CLK_SET_PARENT_PARENT)
 + clk-num_parents == 1) {
 +ret = clk_set_parent(clk-parent, parent);
 +goto out;
 +}
 +
   p_index = clk_fetch_parent_index(clk, parent);
   p_rate = parent-rate;
   if (p_index  0) {
 diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
 index 5119174..daa0b03 100644
 --- a/include/linux/clk-provider.h
 +++ b/include/linux/clk-provider.h
 @@ -30,6 +30,7 @@
   #define CLK_GET_RATE_NOCACHEBIT(6) /* do not use the cached clk
 rate */
   #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate
 change */
   #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk
 accuracy */
 +#define CLK_SET_PARENT_PARENTBIT(9) /* propagate parent change up
 one level */

   struct clk_hw;
   struct dentry;


 This would be very useful, at least on Exynos platforms, with
 mux-div-gate clock paths. PARENT_PARENT sounds a bit funny, though.

 Reviewed-by: Tomasz Figa t.f...@samsung.com
 
 Your opinion on this would be greatly appreciated.
 
 Best regards,
 Tomasz

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2 1/3] phy: Add exynos-simple-phy driver

2014-05-07 Thread Tomasz Stanislawski
On 05/07/2014 12:38 PM, Rahul Sharma wrote:
 On 5 May 2014 15:14, Kishon Vijay Abraham I kis...@ti.com wrote:
 Hi,

 On Wednesday 09 April 2014 03:31 PM, Sylwester Nawrocki wrote:
 Hi,

 On 09/04/14 11:12, Rahul Sharma wrote:
 Idea looks good. How about keeping compatible which is independent
 of SoC, something like samsung,exynos-simple-phy and provide Reg
 and Bit through phy provider node. This way we can avoid SoC specific
 hardcoding in phy driver and don't need to look into dt bindings for
 each new SoC.

 I believe it is a not recommended approach.

 Why not? We should try to avoid hard coding in the driver code. Moreover by
 avoiding hardcoding we can make it a generic driver for single bit PHYs.

 
 +1.
 
 @Tomasz, any plans to consider this approach for simple phy driver?
 
 Regards,
 Rahul Sharma.
 

Hi Rahul,
Initially, I wanted to make a very generic driver and to add bit and
register (or its offset) attribute to the PHY node.
However, there was a very strong opposition from DT maintainers
to adding any bit related configuration to DT.
The current solution was designed to be a trade-off between
being generic and being accepted :).

Regards,
Tomasz Stanislawski



 Cheers
 Kishon
 

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: exynos4412: porting hdmiddc and hdmiphy node entries

2014-05-05 Thread Tomasz Stanislawski
Hi Tobias,
Sorry for a late reply.
Please refer to the comments below.

On 04/27/2014 02:33 AM, Tobias Jakobi wrote:
 Hello,
 
 I'm trying to get the HDMI port working on a Exynos4412 based board.
 Attached is a snippet of a dts. This config was supposed to work in
 the past.
 
 However with 3.15-rc1 some things changed. samsung,exynos4210-hdmiddc
 and samsung,exynos4212-hdmiphy have no function anymore, the code that
 previously handled these compatible strings is gone.
 
 So, it looks like that without some patching, HDMI support is atm broken.
 
 I have applied these:
 http://www.spinics.net/lists/linux-samsung-soc/msg28161.html
 http://www.spinics.net/lists/linux-samsung-soc/msg28259.html
 
 With the first one I can drop a clock from the hdmi node. But then
 trouble starts.
 
 So, first of all I'm unsure what the 'hdmiddc' node should be converted
 to. Documentation (exynos_hdmi.txt) doesn't help here, since it just
 says phandle to the hdmi ddc node. What kind of 'hdmi ddc node'? From
 the code it looks like that it should point to an i2c adapter now. So
 should it point to 'i2c_2' now?

The spec is wrong. It should be a handle to I2C adapter.
The semantics of this node was changed in patch
drm/exynos: hdmi: use i2c_adapter instead of i2c_client
8fa04aae2aa8bafcfc027856904ebee0060506d0

 
 The second thing is 'phy', which should be a phandle to the hdmi ddc
 node. Again, no idea what that node should be. Apparantly such nodes
 can't be created with current kernel code anyway, primary reason to
 apply the simply-phy patches.

The meaning of hdmiphy is ambiguous.
In exynos4 spec there are _TWO_ components named HDMIPHY.
The first one is a PLL that generates a clock for HDMI subsystem.
This PLL is controlled by I2C.

You can find an example of its bindings at:
http://lists.freedesktop.org/archives/dri-devel/2013-October/047687.html


The second one is HDMI's physical interface located in PMU unit.

The exynos-simple-phy is dedicated to controller the former (component of PMU).

The 'phy' attribute in DT refers to the PLL.
There is a debate if 'phy' should refer to I2C device itself or
rather to I2C bus. Currently it refers to driverless instance
of I2C device.

 
 OK, so I have to put a simple-phys node in my dts now. Or, wait, do I
 just replace the hdmiphy node with a simple-phys node?
 
 Would look something like this:
 hdmiphy: simple-phys@38 {
   compatible = samsung,exynos4412-simple-phy;
   reg = 0x38 0x1;
   #phy-cells = 1;
 };
 
 Somehow this doesn't look right. And indeed:
 https://patchwork.kernel.org/patch/4021121/
 
 At least for exynos5250 this node is not a child on an i2c adapter.

This is a completely different HDMIPHY.

 
 And yes, I would still have to add 'phys' and 'phy-names' to the hdmi
 node. This looks wrong again. Why do I have to specify 'phys' when I
 already have 'phy' there? Isn't that redundant?

'phys' and 'phy-names' refers to PHY interfaces delivered by phy-core.
The attribute named 'phy' refers to I2C device used to controller HDMI's PLL.
The naming convention is very misleading.

 
 Well, you see, lots of confusion here. I would appreciate any kind of
 help on how to proceed here.

The documentation for HDMI's bindings should be fixed.

 
 With best wishes,
 Tobias
 

Regards,
Tomasz Stanislawski

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] Add support for sii9234 chip

2014-05-05 Thread Tomasz Stanislawski
On 05/04/2014 01:17 AM, Greg KH wrote:
 On Fri, Apr 11, 2014 at 01:48:28PM +0200, Tomasz Stanislawski wrote:
 Hi everyone,
 This patchset adds support for sii9234 HD Mobile Link Bridge.  The chip is 
 used
 to convert HDMI signal into MHL.  The driver enables HDMI output on Trats and
 Trats2 boards.

 The code is based on the driver [1] developed by:
Adam Hampson ahamp...@sta.samsung.com
Erik Gilling konk...@android.com
 with additional contributions from:
Shankar Bandal shanka...@samsung.com
Dharam Kumar dharam...@samsung.com

 The drivers architecture was greatly simplified and transformed into a form
 accepted (hopefully) by opensource community.  The main differences from
 original code are:
 * using single I2C client instead of 4 subclients
 * remove all logic non-related to establishing HDMI link
 * simplify error handling
 * rewrite state machine in interrupt handler
 * wakeup and discovery triggered by an extcon event
 * integrate with Device Tree

 For now, the driver is added to drivers/misc/ directory because it has 
 neigher
 userspace nor kernel interface.  The chip is capable of receiving and
 processing CEC events, so the driver may export an input device in /dev/ in 
 the
 future.  However CEC could be also handled by HDMI driver.

 I kindly ask for suggestions about the best location for this driver.
 
 It really is an extcon driver, so why not put it in drivers/extcon?  And
 that might solve any build issues you have if you don't select extcon in
 your .config file and try to build this code :)
 
 thanks,

Hi Greg,
Thank you for your comments.

As I understand, drivers/extcon contains only extcon providers.
This driver is an extcon client, so mentioned location may not be adequate.

I am surprised that there are no comments about this driver.
Sii9234 chip is present on many exynos based boards/phones
and HDMI subsystem will not work without this code.

Regards,
Tomasz Stanislawski

 
 greg k-h
 

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2 1/3] phy: Add exynos-simple-phy driver

2014-04-30 Thread Tomasz Stanislawski
Hi Rahul,
I will prepare we v3 version.
Do you want me to add your patches for exynos5?50 to the patchset?
Regards,
Tomasz Stanislawski

On 04/30/2014 08:37 AM, Rahul Sharma wrote:
 Hi Tomasz,
 
 I have tested your patches for exynos5250 and 5420. Works fine. Are
 you planning to post v3? If you want I can share hand with you for v3.
 
 Regards,
 Rahul Sharma
 
 On 9 April 2014 17:17, Andreas Oberritter o...@saftware.de wrote:
 Hello Andrzej,

 On 09.04.2014 10:37, Andrzej Hajda wrote:
 +static int exynos_phy_probe(struct platform_device *pdev)
 +{
 +const struct of_device_id *of_id = of_match_device(
 +of_match_ptr(exynos_phy_of_match), pdev-dev);
 +const u32 *offsets = of_id-data;
 +int count;
 +struct device *dev = pdev-dev;
 +struct phy **phys;
 +struct resource *res;
 +void __iomem *regs;
 +int i;
 +struct phy_provider *phy_provider;
 +
 +/* count number of phys to create */
 +for (count = 0; offsets[count] != ~0; ++count)
 +;

 count = ARRAY_SIZE(offsets) - 1;

 u32 *offsets is not an array.

 Regards,
 Andreas
 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv3 1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data

2014-04-17 Thread Tomasz Stanislawski
Hi Joonyoung,

On 04/17/2014 03:54 AM, Joonyoung Shim wrote:
 Hi Tomasz,
 
 On 04/17/2014 12:12 AM, Tomasz Stanislawski wrote:
 This patch continues shift of DRM EXYNOS to DT-only configuration.
 The usage of the old structure for HDMI's platform data is
 removed.

 Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com

[snip]

   +ret = drm_hdmi_dt_parse(hdata, dev-of_node);
 +if (ret)
 +return -EINVAL;
 
 It's better to return ret value.
 

I was considering return ret value. However, I preferred to
be consistent with other 'returns' which returns error literals.

Anyway, I will change it to 'return ret'.

Regards,
Tomasz Stanislawski
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] arm: dts: exynos4: add missing pinctrls for I2C controllers

2014-04-16 Thread Tomasz Stanislawski
This patch adds missing pinctrls for I2C controllers 2-7.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 arch/arm/boot/dts/exynos4.dtsi |   12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index 0401f4d..288aa81 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -357,6 +357,8 @@
interrupts = 0 60 0;
clocks = clock CLK_I2C2;
clock-names = i2c;
+   pinctrl-names = default;
+   pinctrl-0 = i2c2_bus;
status = disabled;
};

@@ -368,6 +370,8 @@
interrupts = 0 61 0;
clocks = clock CLK_I2C3;
clock-names = i2c;
+   pinctrl-names = default;
+   pinctrl-0 = i2c3_bus;
status = disabled;
};

@@ -379,6 +383,8 @@
interrupts = 0 62 0;
clocks = clock CLK_I2C4;
clock-names = i2c;
+   pinctrl-names = default;
+   pinctrl-0 = i2c4_bus;
status = disabled;
};

@@ -390,6 +396,8 @@
interrupts = 0 63 0;
clocks = clock CLK_I2C5;
clock-names = i2c;
+   pinctrl-names = default;
+   pinctrl-0 = i2c5_bus;
status = disabled;
};

@@ -401,6 +409,8 @@
interrupts = 0 64 0;
clocks = clock CLK_I2C6;
clock-names = i2c;
+   pinctrl-names = default;
+   pinctrl-0 = i2c6_bus;
status = disabled;
};

@@ -412,6 +422,8 @@
interrupts = 0 65 0;
clocks = clock CLK_I2C7;
clock-names = i2c;
+   pinctrl-names = default;
+   pinctrl-0 = i2c7_bus;
status = disabled;
};

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 2/5] drm: exynos: hdmi: simplify extracting hpd-gpio from DT

2014-04-16 Thread Tomasz Stanislawski
This patch eliminates redundant checks while retrieving HPD gpio from DT during
HDMI's probe().

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 482ca77..176e764 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2012,15 +2012,12 @@ fail:
 
 static int drm_hdmi_dt_parse(struct hdmi_context *hdata, struct device_node 
*np)
 {
-   u32 value;
-
-   if (!of_find_property(np, hpd-gpio, value)) {
+   hdata-hpd_gpio = of_get_named_gpio(np, hpd-gpio, 0);
+   if (!gpio_is_valid(hdata-hpd_gpio)) {
DRM_ERROR(no hpd gpio property found\n);
return -ENOENT;
}
 
-   hdata-hpd_gpio = of_get_named_gpio(np, hpd-gpio, 0);
-
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 0/5] drm: exynos: update/fixes to HDMI driver

2014-04-16 Thread Tomasz Stanislawski
Hi everyone,
This patchset adds 5 fixes/updates to EXYNOS DRM driver for
HDMI subsystem.

All comments are welcome.

Regards,
Tomasz Stanislawski

Changelog:

v3:
* remove usage of s5p_hdmi_platform_data
* return MODE_CLOCK_HIGH instead of MODE_CLOCK_BAD

v2:
* fix check with gpio_is_valid()
* use U32_MAX instead of ULONG_MAX to be 64-bit-friendly
* use hdmi_driver_data as hdmi's compatile data

v1:
* initial version

Tomasz Stanislawski (5):
  drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data
  drm: exynos: hdmi: simplify extracting hpd-gpio from DT
  drm: exynos: mixer: fix using usleep() in atomic context
  drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210
SoC
  drm: exynos: hdmi: add support for pixel clock limitation

 .../devicetree/bindings/video/exynos_hdmi.txt  |4 ++
 drivers/gpu/drm/exynos/exynos_hdmi.c   |   49 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c  |5 +-
 3 files changed, 33 insertions(+), 25 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 3/5] drm: exynos: mixer: fix using usleep() in atomic context

2014-04-16 Thread Tomasz Stanislawski
This patch fixes calling usleep_range() after taking reg_slock
using spin_lock_irqsave(). The mdelay() is used instead.
Waiting in atomic context is not the best idea in general.
Hopefully, waiting occurs only when Video Processor fails
to reset correctly.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_mixer.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index ce28881..e3306c8 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -615,7 +615,7 @@ static void vp_win_reset(struct mixer_context *ctx)
/* waiting until VP_SRESET_PROCESSING is 0 */
if (~vp_reg_read(res, VP_SRESET)  VP_SRESET_PROCESSING)
break;
-   usleep_range(1, 12000);
+   mdelay(10);
}
WARN(tries == 0, failed to reset Video Processor\n);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data

2014-04-16 Thread Tomasz Stanislawski
This patch continues shift of DRM EXYNOS to DT-only configuration.
The usage of the old structure for HDMI's platform data is
removed.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   30 --
 1 file changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 9a6d652..482ca77 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -43,7 +43,6 @@
 #include exynos_mixer.h
 
 #include linux/gpio.h
-#include media/s5p_hdmi.h
 
 #define get_hdmi_display(dev)  platform_get_drvdata(to_platform_device(dev))
 #define ctx_from_connector(c)  container_of(c, struct hdmi_context, connector)
@@ -2011,28 +2010,18 @@ fail:
return -ENODEV;
 }
 
-static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
-   (struct device *dev)
+static int drm_hdmi_dt_parse(struct hdmi_context *hdata, struct device_node 
*np)
 {
-   struct device_node *np = dev-of_node;
-   struct s5p_hdmi_platform_data *pd;
u32 value;
 
-   pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
-   if (!pd)
-   goto err_data;
-
if (!of_find_property(np, hpd-gpio, value)) {
DRM_ERROR(no hpd gpio property found\n);
-   goto err_data;
+   return -ENOENT;
}
 
-   pd-hpd_gpio = of_get_named_gpio(np, hpd-gpio, 0);
-
-   return pd;
+   hdata-hpd_gpio = of_get_named_gpio(np, hpd-gpio, 0);
 
-err_data:
-   return NULL;
+   return 0;
 }
 
 static struct of_device_id hdmi_match_types[] = {
@@ -2051,7 +2040,6 @@ static int hdmi_probe(struct platform_device *pdev)
 {
struct device *dev = pdev-dev;
struct hdmi_context *hdata;
-   struct s5p_hdmi_platform_data *pdata;
struct resource *res;
const struct of_device_id *match;
struct device_node *ddc_node, *phy_node;
@@ -2061,14 +2049,14 @@ static int hdmi_probe(struct platform_device *pdev)
 if (!dev-of_node)
return -ENODEV;
 
-   pdata = drm_hdmi_dt_parse_pdata(dev);
-   if (!pdata)
-   return -EINVAL;
-
hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
if (!hdata)
return -ENOMEM;
 
+   ret = drm_hdmi_dt_parse(hdata, dev-of_node);
+   if (ret)
+   return -EINVAL;
+
mutex_init(hdata-hdmi_mutex);
 
platform_set_drvdata(pdev, hdmi_display);
@@ -2079,8 +2067,6 @@ static int hdmi_probe(struct platform_device *pdev)
 
drv_data = (struct hdmi_driver_data *)match-data;
hdata-type = drv_data-type;
-
-   hdata-hpd_gpio = pdata-hpd_gpio;
hdata-dev = dev;
 
ret = hdmi_resources_init(hdata);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 5/5] drm: exynos: hdmi: add support for pixel clock limitation

2014-04-16 Thread Tomasz Stanislawski
Adds support for limitation of maximal pixel clock of HDMI
signal. This feature is needed on boards that contains
lines or bridges with frequency limitations.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 .../devicetree/bindings/video/exynos_hdmi.txt  |4 
 drivers/gpu/drm/exynos/exynos_hdmi.c   |   11 +++
 2 files changed, 15 insertions(+)

diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt 
b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
index f9187a2..8718f8d 100644
--- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt
+++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
@@ -28,6 +28,10 @@ Required properties:
 - ddc: phandle to the hdmi ddc node
 - phy: phandle to the hdmi phy node
 
+Optional properties:
+- max-pixel-clock: used to limit the maximal pixel clock if a board has lines,
+   connectors or bridges not capable of carring higher frequencies
+
 Example:
 
hdmi {
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 9adbd34..e012ba9 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -194,6 +194,7 @@ struct hdmi_context {
struct hdmi_resources   res;
 
int hpd_gpio;
+   u32 max_pixel_clock;
 
enum hdmi_type  type;
 };
@@ -886,6 +887,9 @@ static int hdmi_mode_valid(struct drm_connector *connector,
if (ret)
return MODE_BAD;
 
+   if (mode-clock * 1000  hdata-max_pixel_clock)
+   return MODE_CLOCK_HIGH;
+
ret = hdmi_find_phy_conf(hdata, mode-clock * 1000);
if (ret  0)
return MODE_BAD;
@@ -2022,6 +2026,13 @@ static int drm_hdmi_dt_parse(struct hdmi_context *hdata, 
struct device_node *np)
return -ENOENT;
}
 
+   of_property_read_u32(np, max-pixel-clock, hdata-max_pixel_clock);
+   if (!hdata-max_pixel_clock) {
+   DRM_INFO(max-pixel-clock is zero, using INF\n);
+   hdata-max_pixel_clock = U32_MAX;
+   }
+
+
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 4/5] drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC

2014-04-16 Thread Tomasz Stanislawski
This patch add proper compatibles for Mixer and HDMI chip
available on exynos4210 SoCs.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c  |7 +++
 drivers/gpu/drm/exynos/exynos_mixer.c |3 +++
 2 files changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 176e764..9adbd34 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -203,6 +203,10 @@ struct hdmiphy_config {
u8 conf[32];
 };
 
+struct hdmi_driver_data exynos4210_hdmi_driver_data = {
+   .type   = HDMI_TYPE13,
+};
+
 struct hdmi_driver_data exynos4212_hdmi_driver_data = {
.type   = HDMI_TYPE14,
 };
@@ -2023,6 +2027,9 @@ static int drm_hdmi_dt_parse(struct hdmi_context *hdata, 
struct device_node *np)
 
 static struct of_device_id hdmi_match_types[] = {
{
+   .compatible = samsung,exynos4210-hdmi,
+   .data = exynos4210_hdmi_driver_data,
+   }, {
.compatible = samsung,exynos5-hdmi,
.data = exynos5_hdmi_driver_data,
}, {
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index e3306c8..fd8a9a0 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -1187,6 +1187,9 @@ static struct platform_device_id mixer_driver_types[] = {
 
 static struct of_device_id mixer_match_types[] = {
{
+   .compatible = samsung,exynos4210-mixer,
+   .data   = exynos4210_mxr_drv_data,
+   }, {
.compatible = samsung,exynos5-mixer,
.data   = exynos5250_mxr_drv_data,
}, {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 0/4] drm: exynos: update/fixes to HDMI driver

2014-04-15 Thread Tomasz Stanislawski
Hi everyone,
This patchset adds 4 fixes/updates to EXYNOS DRM driver for
HDMI subsystem.

All comments are welcome.

Regards,
Tomasz Stanislawski

Changelog:

v2:
* fix check with gpio_is_valid()
* use U32_MAX instead of ULONG_MAX to be 64-bit-friendly
* use hdmi_driver_data as hdmi's compatile data

v1:
* initial version

Tomasz Stanislawski (4):
  drm: exynos: hdmi: simplify extracting hpd-gpio from DT
  drm: exynos: mixer: fix using usleep() in atomic context
  drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210
SoC
  drm: exynos: hdmi: add support for pixel clock limitation

 .../devicetree/bindings/video/exynos_hdmi.txt  |4 +++
 drivers/gpu/drm/exynos/exynos_hdmi.c   |   30 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c  |5 +++-
 include/media/s5p_hdmi.h   |1 +
 4 files changed, 31 insertions(+), 9 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 1/4] drm: exynos: hdmi: simplify extracting hpd-gpio from DT

2014-04-15 Thread Tomasz Stanislawski
This patch eliminates redundant checks while retrieving HPD gpio from DT during
HDMI's probe().

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 9a6d652..47c6e85 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2016,23 +2016,18 @@ static struct s5p_hdmi_platform_data 
*drm_hdmi_dt_parse_pdata
 {
struct device_node *np = dev-of_node;
struct s5p_hdmi_platform_data *pd;
-   u32 value;
 
pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
if (!pd)
-   goto err_data;
+   return NULL;
 
-   if (!of_find_property(np, hpd-gpio, value)) {
+   pd-hpd_gpio = of_get_named_gpio(np, hpd-gpio, 0);
+   if (!gpio_is_valid(pd-hpd_gpio)) {
DRM_ERROR(no hpd gpio property found\n);
-   goto err_data;
+   return NULL;
}
 
-   pd-hpd_gpio = of_get_named_gpio(np, hpd-gpio, 0);
-
return pd;
-
-err_data:
-   return NULL;
 }
 
 static struct of_device_id hdmi_match_types[] = {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 2/4] drm: exynos: mixer: fix using usleep() in atomic context

2014-04-15 Thread Tomasz Stanislawski
This patch fixes calling usleep_range() after taking reg_slock
using spin_lock_irqsave(). The mdelay() is used instead.
Waiting in atomic context is not the best idea in general.
Hopefully, waiting occurs only when Video Processor fails
to reset correctly.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_mixer.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index ce28881..e3306c8 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -615,7 +615,7 @@ static void vp_win_reset(struct mixer_context *ctx)
/* waiting until VP_SRESET_PROCESSING is 0 */
if (~vp_reg_read(res, VP_SRESET)  VP_SRESET_PROCESSING)
break;
-   usleep_range(1, 12000);
+   mdelay(10);
}
WARN(tries == 0, failed to reset Video Processor\n);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 4/4] drm: exynos: hdmi: add support for pixel clock limitation

2014-04-15 Thread Tomasz Stanislawski
Adds support for limitation of maximal pixel clock of HDMI
signal. This feature is needed on boards that contains
lines or bridges with frequency limitations.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 .../devicetree/bindings/video/exynos_hdmi.txt  |4 
 drivers/gpu/drm/exynos/exynos_hdmi.c   |   12 
 include/media/s5p_hdmi.h   |1 +
 3 files changed, 17 insertions(+)

diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt 
b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
index f9187a2..8718f8d 100644
--- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt
+++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
@@ -28,6 +28,10 @@ Required properties:
 - ddc: phandle to the hdmi ddc node
 - phy: phandle to the hdmi phy node
 
+Optional properties:
+- max-pixel-clock: used to limit the maximal pixel clock if a board has lines,
+   connectors or bridges not capable of carring higher frequencies
+
 Example:
 
hdmi {
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 2a18f4e..404f1b7 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -195,6 +195,7 @@ struct hdmi_context {
struct hdmi_resources   res;
 
int hpd_gpio;
+   u32 max_pixel_clock;
 
enum hdmi_type  type;
 };
@@ -887,6 +888,9 @@ static int hdmi_mode_valid(struct drm_connector *connector,
if (ret)
return MODE_BAD;
 
+   if (mode-clock * 1000  hdata-max_pixel_clock)
+   return MODE_BAD;
+
ret = hdmi_find_phy_conf(hdata, mode-clock * 1000);
if (ret  0)
return MODE_BAD;
@@ -2031,6 +2035,8 @@ static struct s5p_hdmi_platform_data 
*drm_hdmi_dt_parse_pdata
return NULL;
}
 
+   of_property_read_u32(np, max-pixel-clock, pd-max_pixel_clock);
+
return pd;
 }
 
@@ -2067,6 +2073,11 @@ static int hdmi_probe(struct platform_device *pdev)
if (!pdata)
return -EINVAL;
 
+   if (!pdata-max_pixel_clock) {
+   DRM_INFO(max-pixel-clock is zero, using INF\n);
+   pdata-max_pixel_clock = U32_MAX;
+   }
+
hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
if (!hdata)
return -ENOMEM;
@@ -2083,6 +2094,7 @@ static int hdmi_probe(struct platform_device *pdev)
hdata-type = drv_data-type;
 
hdata-hpd_gpio = pdata-hpd_gpio;
+   hdata-max_pixel_clock = pdata-max_pixel_clock;
hdata-dev = dev;
 
ret = hdmi_resources_init(hdata);
diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
index 181642b..7272d65 100644
--- a/include/media/s5p_hdmi.h
+++ b/include/media/s5p_hdmi.h
@@ -31,6 +31,7 @@ struct s5p_hdmi_platform_data {
int mhl_bus;
struct i2c_board_info *mhl_info;
int hpd_gpio;
+   u32 max_pixel_clock;
 };
 
 #endif /* S5P_HDMI_H */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 3/4] drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC

2014-04-15 Thread Tomasz Stanislawski
This patch add proper compatibles for Mixer and HDMI chip
available on exynos4210 SoCs.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c  |7 +++
 drivers/gpu/drm/exynos/exynos_mixer.c |3 +++
 2 files changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 47c6e85..2a18f4e 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -204,6 +204,10 @@ struct hdmiphy_config {
u8 conf[32];
 };
 
+struct hdmi_driver_data exynos4210_hdmi_driver_data = {
+   .type   = HDMI_TYPE13,
+};
+
 struct hdmi_driver_data exynos4212_hdmi_driver_data = {
.type   = HDMI_TYPE14,
 };
@@ -2032,6 +2036,9 @@ static struct s5p_hdmi_platform_data 
*drm_hdmi_dt_parse_pdata
 
 static struct of_device_id hdmi_match_types[] = {
{
+   .compatible = samsung,exynos4210-hdmi,
+   .data = exynos4210_hdmi_driver_data,
+   }, {
.compatible = samsung,exynos5-hdmi,
.data = exynos5_hdmi_driver_data,
}, {
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index e3306c8..fd8a9a0 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -1187,6 +1187,9 @@ static struct platform_device_id mixer_driver_types[] = {
 
 static struct of_device_id mixer_match_types[] = {
{
+   .compatible = samsung,exynos4210-mixer,
+   .data   = exynos4210_mxr_drv_data,
+   }, {
.compatible = samsung,exynos5-mixer,
.data   = exynos5250_mxr_drv_data,
}, {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2 4/4] drm: exynos: hdmi: add support for pixel clock limitation

2014-04-15 Thread Tomasz Stanislawski
On 04/15/2014 11:42 AM, Rahul Sharma wrote:
 Hi Tomasz,
 
 On 15 April 2014 14:57, Tomasz Stanislawski t.stanisl...@samsung.com wrote:
 Adds support for limitation of maximal pixel clock of HDMI
 signal. This feature is needed on boards that contains
 lines or bridges with frequency limitations.

 Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
 ---
  .../devicetree/bindings/video/exynos_hdmi.txt  |4 
  drivers/gpu/drm/exynos/exynos_hdmi.c   |   12 
  include/media/s5p_hdmi.h   |1 +
  3 files changed, 17 insertions(+)

 diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt 
 b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
 index f9187a2..8718f8d 100644
 --- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt
 +++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
 @@ -28,6 +28,10 @@ Required properties:
  - ddc: phandle to the hdmi ddc node
  - phy: phandle to the hdmi phy node

 +Optional properties:
 +- max-pixel-clock: used to limit the maximal pixel clock if a board has 
 lines,
 +   connectors or bridges not capable of carring higher frequencies
 +
  Example:

 hdmi {
 diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
 b/drivers/gpu/drm/exynos/exynos_hdmi.c
 index 2a18f4e..404f1b7 100644
 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
 +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
 @@ -195,6 +195,7 @@ struct hdmi_context {
 struct hdmi_resources   res;

 int hpd_gpio;
 +   u32 max_pixel_clock;

 enum hdmi_type  type;
  };
 @@ -887,6 +888,9 @@ static int hdmi_mode_valid(struct drm_connector 
 *connector,
 if (ret)
 return MODE_BAD;

 +   if (mode-clock * 1000  hdata-max_pixel_clock)
 +   return MODE_BAD;
 +
 ret = hdmi_find_phy_conf(hdata, mode-clock * 1000);
 if (ret  0)
 return MODE_BAD;
 @@ -2031,6 +2035,8 @@ static struct s5p_hdmi_platform_data 
 *drm_hdmi_dt_parse_pdata
 return NULL;
 }

 +   of_property_read_u32(np, max-pixel-clock, pd-max_pixel_clock);
 +
 return pd;
  }

 @@ -2067,6 +2073,11 @@ static int hdmi_probe(struct platform_device *pdev)
 if (!pdata)
 return -EINVAL;

 +   if (!pdata-max_pixel_clock) {
 +   DRM_INFO(max-pixel-clock is zero, using INF\n);
 +   pdata-max_pixel_clock = U32_MAX;
 +   }
 +
 hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
 if (!hdata)
 return -ENOMEM;
 @@ -2083,6 +2094,7 @@ static int hdmi_probe(struct platform_device *pdev)
 hdata-type = drv_data-type;

 hdata-hpd_gpio = pdata-hpd_gpio;
 +   hdata-max_pixel_clock = pdata-max_pixel_clock;
 hdata-dev = dev;

 ret = hdmi_resources_init(hdata);
 diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
 index 181642b..7272d65 100644
 --- a/include/media/s5p_hdmi.h
 +++ b/include/media/s5p_hdmi.h
 @@ -31,6 +31,7 @@ struct s5p_hdmi_platform_data {
 int mhl_bus;
 struct i2c_board_info *mhl_info;
 int hpd_gpio;
 +   u32 max_pixel_clock;
  };
 
 We have already removed Non DT support from the drm hdmi
 driver. IMO we should not be extending the pdata struct.
 
 Regards,
 Rahul Sharma

Hi Rahul,

This is not a non-DT patch. The s5p_hdmi_platform_data is
generated from DT itself. This structure is just
a parsed version of DT attributes.

It may be a good idea to rename s5p_hdmi_platform_data
to exynos_hdmi_pdata and move it to exynos_hdmi_drm.c file
or parse DT directly in probe function.

I can prepare a patch for that.

Regards,
Tomasz Stanislawski


 

  #endif /* S5P_HDMI_H */
 --
 1.7.9.5

 ___
 dri-devel mailing list
 dri-de...@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] arm: dts: exynos4412-trats2: rename alias for i2c_ak8975 label

2014-04-15 Thread Tomasz Stanislawski
The i2c_ak8975 controler uses label i2c8.
This alias is already used for I2C controller 8 defined
in file arch/arm/boot/dts/exynos4.dtsi.

This patch renames a label for i2c_ak8975 to i2c9.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 arch/arm/boot/dts/exynos4412-trats2.dts |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts 
b/arch/arm/boot/dts/exynos4412-trats2.dts
index c16b315..5add765 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -20,7 +20,7 @@
compatible = samsung,trats2, samsung,exynos4412, samsung,exynos4;

aliases {
-   i2c8 = i2c_ak8975;
+   i2c9 = i2c_ak8975;
};

memory {
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2 4/4] drm: exynos: hdmi: add support for pixel clock limitation

2014-04-15 Thread Tomasz Stanislawski
On 04/15/2014 03:42 PM, Rahul Sharma wrote:
 On 15 April 2014 18:41, Tomasz Stanislawski t.stanisl...@samsung.com wrote:
 On 04/15/2014 11:42 AM, Rahul Sharma wrote:
 Hi Tomasz,

 On 15 April 2014 14:57, Tomasz Stanislawski t.stanisl...@samsung.com 
 wrote:
 Adds support for limitation of maximal pixel clock of HDMI
 signal. This feature is needed on boards that contains
 lines or bridges with frequency limitations.

 Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
[snip]

 diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
 index 181642b..7272d65 100644
 --- a/include/media/s5p_hdmi.h
 +++ b/include/media/s5p_hdmi.h
 @@ -31,6 +31,7 @@ struct s5p_hdmi_platform_data {
 int mhl_bus;
 struct i2c_board_info *mhl_info;
 int hpd_gpio;
 +   u32 max_pixel_clock;
  };

 We have already removed Non DT support from the drm hdmi
 driver. IMO we should not be extending the pdata struct.

 Regards,
 Rahul Sharma

 Hi Rahul,

 This is not a non-DT patch. The s5p_hdmi_platform_data is
 generated from DT itself. This structure is just
 a parsed version of DT attributes.

 It may be a good idea to rename s5p_hdmi_platform_data
 to exynos_hdmi_pdata and move it to exynos_hdmi_drm.c file
 or parse DT directly in probe function.

 I can prepare a patch for that.
 
 Else we can completely remove the dependency from
 s5p_hdmi_platform_data. We can directly assign to hdmi context
 variables. Later we can remove that struct itself from include/.
 What you say?

This structure cannot be removed from include yet because it is used by s5p-tv 
driver.
However its usage can be removed from both drivers.
I can prepare both.

 
 Regards,
 Rahul Sharma
 

Regards,
Tomasz Stanislawski


 Regards,
 Tomasz Stanislawski




  #endif /* S5P_HDMI_H */
 --
 1.7.9.5

 ___
 dri-devel mailing list
 dri-de...@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/dri-devel

 

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drm: exynos: hdmi: simplify extracting hpd-gpio from DT

2014-04-14 Thread Tomasz Stanislawski
This patch eliminates redundant checks while retrieving HPD gpio from DT during
HDMI's probe().

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index e1a2e88..300c2af 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2011,23 +2011,18 @@ static struct s5p_hdmi_platform_data 
*drm_hdmi_dt_parse_pdata
 {
struct device_node *np = dev-of_node;
struct s5p_hdmi_platform_data *pd;
-   u32 value;

pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
if (!pd)
-   goto err_data;
+   return NULL;

-   if (!of_find_property(np, hpd-gpio, value)) {
+   pd-hpd_gpio = of_get_named_gpio_flags(np, hpd-gpio, 0, NULL);
+   if (pd-hpd_gpio  0) {
DRM_ERROR(no hpd gpio property found\n);
-   goto err_data;
+   return NULL;
}

-   pd-hpd_gpio = of_get_named_gpio(np, hpd-gpio, 0);
-
return pd;
-
-err_data:
-   return NULL;
 }

 static struct of_device_id hdmi_match_types[] = {

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] drm: exynos: mixer: fix using usleep() in atomic context

2014-04-14 Thread Tomasz Stanislawski
This patch fixes calling usleep_range() after taking reg_slock
using spin_lock_irqsave(). The mdelay() is used instead.
Waiting in atomic context is not the best idea in general.
Hopefully, waiting occurs only when Video Processor fails
to reset correctly.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_mixer.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index ce28881..e3306c8 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -615,7 +615,7 @@ static void vp_win_reset(struct mixer_context *ctx)
/* waiting until VP_SRESET_PROCESSING is 0 */
if (~vp_reg_read(res, VP_SRESET)  VP_SRESET_PROCESSING)
break;
-   usleep_range(1, 12000);
+   mdelay(10);
}
WARN(tries == 0, failed to reset Video Processor\n);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC

2014-04-14 Thread Tomasz Stanislawski
This patch add proper compatibles for Mixer and HDMI chip
available on exynos4210 SoCs.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c  |3 +++
 drivers/gpu/drm/exynos/exynos_mixer.c |3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index d2d6e2e..6fa63ea 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2032,6 +2032,9 @@ static struct s5p_hdmi_platform_data 
*drm_hdmi_dt_parse_pdata
 
 static struct of_device_id hdmi_match_types[] = {
{
+   .compatible = samsung,exynos4210-hdmi,
+   .data   = (void *)HDMI_TYPE13,
+   }, {
.compatible = samsung,exynos5-hdmi,
.data = exynos5_hdmi_driver_data,
}, {
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index e3306c8..fd8a9a0 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -1187,6 +1187,9 @@ static struct platform_device_id mixer_driver_types[] = {
 
 static struct of_device_id mixer_match_types[] = {
{
+   .compatible = samsung,exynos4210-mixer,
+   .data   = exynos4210_mxr_drv_data,
+   }, {
.compatible = samsung,exynos5-mixer,
.data   = exynos5250_mxr_drv_data,
}, {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] drm: exynos: hdmi: add support for pixel clock limitation

2014-04-14 Thread Tomasz Stanislawski
Adds support for limitation of maximal pixel clock of HDMI
signal. This feature is needed on boards that contains
lines or bridges with frequency limitations.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 .../devicetree/bindings/video/exynos_hdmi.txt  |4 
 drivers/gpu/drm/exynos/exynos_hdmi.c   |   12 
 include/media/s5p_hdmi.h   |1 +
 3 files changed, 17 insertions(+)

diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt 
b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
index f9187a2..8718f8d 100644
--- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt
+++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
@@ -28,6 +28,10 @@ Required properties:
 - ddc: phandle to the hdmi ddc node
 - phy: phandle to the hdmi phy node
 
+Optional properties:
+- max-pixel-clock: used to limit the maximal pixel clock if a board has lines,
+   connectors or bridges not capable of carring higher frequencies
+
 Example:
 
hdmi {
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 6fa63ea..ca313b3 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -195,6 +195,7 @@ struct hdmi_context {
struct hdmi_resources   res;
 
int hpd_gpio;
+   u32 max_pixel_clock;
 
enum hdmi_type  type;
 };
@@ -883,6 +884,9 @@ static int hdmi_mode_valid(struct drm_connector *connector,
if (ret)
return MODE_BAD;
 
+   if (mode-clock * 1000  hdata-max_pixel_clock)
+   return MODE_BAD;
+
ret = hdmi_find_phy_conf(hdata, mode-clock * 1000);
if (ret  0)
return MODE_BAD;
@@ -2027,6 +2031,8 @@ static struct s5p_hdmi_platform_data 
*drm_hdmi_dt_parse_pdata
return NULL;
}
 
+   of_property_read_u32(np, max-pixel-clock, pd-max_pixel_clock);
+
return pd;
 }
 
@@ -2063,6 +2069,11 @@ static int hdmi_probe(struct platform_device *pdev)
if (!pdata)
return -EINVAL;
 
+   if (!pdata-max_pixel_clock) {
+   DRM_INFO(max-pixel-clock is zero, using INF\n);
+   pdata-max_pixel_clock = ULONG_MAX;
+   }
+
hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
if (!hdata)
return -ENOMEM;
@@ -2079,6 +2090,7 @@ static int hdmi_probe(struct platform_device *pdev)
hdata-type = drv_data-type;
 
hdata-hpd_gpio = pdata-hpd_gpio;
+   hdata-max_pixel_clock = pdata-max_pixel_clock;
hdata-dev = dev;
 
ret = hdmi_resources_init(hdata);
diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
index 181642b..7272d65 100644
--- a/include/media/s5p_hdmi.h
+++ b/include/media/s5p_hdmi.h
@@ -31,6 +31,7 @@ struct s5p_hdmi_platform_data {
int mhl_bus;
struct i2c_board_info *mhl_info;
int hpd_gpio;
+   u32 max_pixel_clock;
 };
 
 #endif /* S5P_HDMI_H */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] drm: exynos: hdmi: simplify extracting hpd-gpio from DT

2014-04-14 Thread Tomasz Stanislawski
This patch eliminates redundant checks while retrieving HPD gpio from DT during
HDMI's probe().

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 9a6d652..d2d6e2e 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2016,23 +2016,18 @@ static struct s5p_hdmi_platform_data 
*drm_hdmi_dt_parse_pdata
 {
struct device_node *np = dev-of_node;
struct s5p_hdmi_platform_data *pd;
-   u32 value;
 
pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
if (!pd)
-   goto err_data;
+   return NULL;
 
-   if (!of_find_property(np, hpd-gpio, value)) {
+   pd-hpd_gpio = of_get_named_gpio(np, hpd-gpio, 0);
+   if (gpio_is_valid(pd-hpd_gpio)) {
DRM_ERROR(no hpd gpio property found\n);
-   goto err_data;
+   return NULL;
}
 
-   pd-hpd_gpio = of_get_named_gpio(np, hpd-gpio, 0);
-
return pd;
-
-err_data:
-   return NULL;
 }
 
 static struct of_device_id hdmi_match_types[] = {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] drm: exynos: update/fixes to HDMI driver

2014-04-14 Thread Tomasz Stanislawski
Hi everyone,
This patchset adds 4 fixes/updates to EXYNOS DRM driver for
HDMI subsystem.

All comments are welcome.

Regards,
Tomasz Stanislawski

Tomasz Stanislawski (4):
  drm: exynos: hdmi: simplify extracting hpd-gpio from DT
  drm: exynos: mixer: fix using usleep() in atomic context
  drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210
SoC
  drm: exynos: hdmi: add support for pixel clock limitation

 .../devicetree/bindings/video/exynos_hdmi.txt  |4 +++
 drivers/gpu/drm/exynos/exynos_hdmi.c   |   26 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c  |5 +++-
 include/media/s5p_hdmi.h   |1 +
 4 files changed, 27 insertions(+), 9 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] arm: dts: trats2: add SiI9234 node

2014-04-11 Thread Tomasz Stanislawski
This patch adds configuration of SiI9234 bridge to Trats2 board.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 arch/arm/boot/dts/exynos4412-trats2.dts |   43 +++
 1 file changed, 43 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts 
b/arch/arm/boot/dts/exynos4412-trats2.dts
index 9583563d..65fd1d4 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -680,4 +680,47 @@
pulldown-ohm = 10; /* 100K */
io-channels = adc 2;  /* Battery temperature */
};
+
+   vsil: voltage-regulator-vsil {
+   compatible = regulator-fixed;
+   regulator-name = HDMI_5V;
+   regulator-min-microvolt = 500;
+   regulator-max-microvolt = 500;
+   gpio = gpl0 4 0;
+   enable-active-high;
+   vin-supply = buck7_reg;
+   };
+
+   i2c-mhl {
+   compatible = i2c-gpio;
+   gpios = gpf0 4 0 gpf0 6 0;
+   i2c-gpio,delay-us = 100;
+   #address-cells = 1;
+   #size-cells = 0;
+
+   pinctrl-0 = i2c_mhl_bus;
+   pinctrl-names = default;
+   status = okay;
+
+   sii9234: sii9234@39 {
+   compatible = sil,sii9234;
+   vcc-supply = vsil;
+   gpio-reset = gpf3 4 0;
+   gpio-int = gpf3 5 0;
+   reg = 0x39;
+   };
+   };
+};
+
+pinctrl_0 {
+   mhl_int: mhl-int {
+   samsung,pins = gpf3-5;
+   samsung,pin-pud = 0;
+   };
+   i2c_mhl_bus: i2c-mhl-bus {
+   samsung,pins = gpf0-4, gpf0-6;
+   samsung,pin-function = 2;
+   samsung,pin-pud = 1;
+   samsung,pin-drv = 0;
+   };
 };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] misc: add sii9234 driver

2014-04-11 Thread Tomasz Stanislawski
Add driver for HDMI bridge using MHL connection.
Contains refactored code for MHL driver developed by:

Adam Hampson ahamp...@sta.samsung.com
Erik Gilling konk...@android.com
Shankar Bandal shanka...@samsung.com
Dharam Kumar dharam...@samsung.com

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/devicetree/bindings/sii9234.txt |   22 +
 drivers/misc/Kconfig  |8 +
 drivers/misc/Makefile |1 +
 drivers/misc/sii9234.c| 1081 +
 4 files changed, 1112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sii9234.txt
 create mode 100644 drivers/misc/sii9234.c

diff --git a/Documentation/devicetree/bindings/sii9234.txt 
b/Documentation/devicetree/bindings/sii9234.txt
new file mode 100644
index 000..4431139
--- /dev/null
+++ b/Documentation/devicetree/bindings/sii9234.txt
@@ -0,0 +1,22 @@
+SiI9234 Mobile HD Link Transmitter
+
+Required properties:
+- compatible : sil,sii9234.
+- reg : I2C address for TPI interface, use 0x39
+- vcc-supply : regulator that supplies the chip
+- gpio-reset : GPIO connected to RESET_N pin
+- gpio-int : GPIO connected to INT pin
+
+Optional properties:
+- extcon : phandle to extcon that wakes up the chip
+
+Additional compatible properties are also allowed.
+
+Example:
+   sii9234@39 {
+   compatible = sil,sii9234;
+   reg = 0x39;
+   vcc-supply = vsil;
+   gpio-reset = gpf3 4 0;
+   gpio-int = gpf3 5 0;
+   };
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 1cb7408..3b7f266 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -515,6 +515,14 @@ config SRAM
  the genalloc API. It is supposed to be used for small on-chip SRAM
  areas found on many SoCs.
 
+config SII9234
+   tristate Silicon Image SII9234 Driver
+   depends on I2C
+   help
+ Say Y here if you want support for the MHL interface.
+ It is an I2C driver, that detects connection of MHL bridge
+ and starts encapsulation of HDMI signal.
+
 source drivers/misc/c2port/Kconfig
 source drivers/misc/eeprom/Kconfig
 source drivers/misc/cb710/Kconfig
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 7eb4b69..145a47a 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -55,3 +55,4 @@ obj-$(CONFIG_SRAM)+= sram.o
 obj-y  += mic/
 obj-$(CONFIG_GENWQE)   += genwqe/
 obj-$(CONFIG_ECHO) += echo/
+obj-$(CONFIG_SII9234)  += sii9234.o
diff --git a/drivers/misc/sii9234.c b/drivers/misc/sii9234.c
new file mode 100644
index 000..60b7c66
--- /dev/null
+++ b/drivers/misc/sii9234.c
@@ -0,0 +1,1081 @@
+/*
+ * Copyright (C) 2014 Samsung Electronics
+ *
+ * Author: Tomasz Stanislawski t.stanisl...@samsung.com
+ *
+ * Based on sii9234 driver created by:
+ *Adam Hampson ahamp...@sta.samsung.com
+ *Erik Gilling konk...@android.com
+ *Shankar Bandal shanka...@samsung.com
+ *Dharam Kumar dharam...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program
+ *
+ */
+
+#include linux/delay.h
+#include linux/err.h
+#include linux/gpio.h
+#include linux/i2c.h
+#include linux/interrupt.h
+#include linux/irq.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/platform_device.h
+#include linux/slab.h
+#include linux/wait.h
+#include linux/file.h
+#include linux/uaccess.h
+#include linux/proc_fs.h
+#include linux/extcon.h
+#include linux/of.h
+#include linux/of_gpio.h
+#include linux/extcon.h
+#include linux/regulator/machine.h
+
+/* MHL Tx registers and bits */
+#define MHL_TX_SRST 0x05
+#define MHL_TX_SYSSTAT_REG  0x09
+#define RSEN_STATUS (12)
+#define MHL_TX_INTR1_REG0x71
+#define HPD_CHANGE_INT  (16)
+#define RSEN_CHANGE_INT (15)
+#define MHL_TX_INTR4_REG0x74
+#define RGND_READY_INT  (16)
+#define VBUS_LOW_INT(15)
+#define CBUS_LKOUT_INT  (14)
+#define MHL_DISC_FAIL_INT   (13)
+#define MHL_EST_INT (12)
+#define MHL_TX_INTR1_ENABLE_REG 0x75
+#define HPD_CHANGE_INT_MASK (16)
+#define

[PATCH 0/2] Add support for sii9234 chip

2014-04-11 Thread Tomasz Stanislawski
Hi everyone,
This patchset adds support for sii9234 HD Mobile Link Bridge.  The chip is used
to convert HDMI signal into MHL.  The driver enables HDMI output on Trats and
Trats2 boards.

The code is based on the driver [1] developed by:
   Adam Hampson ahamp...@sta.samsung.com
   Erik Gilling konk...@android.com
with additional contributions from:
   Shankar Bandal shanka...@samsung.com
   Dharam Kumar dharam...@samsung.com

The drivers architecture was greatly simplified and transformed into a form
accepted (hopefully) by opensource community.  The main differences from
original code are:
* using single I2C client instead of 4 subclients
* remove all logic non-related to establishing HDMI link
* simplify error handling
* rewrite state machine in interrupt handler
* wakeup and discovery triggered by an extcon event
* integrate with Device Tree

For now, the driver is added to drivers/misc/ directory because it has neigher
userspace nor kernel interface.  The chip is capable of receiving and
processing CEC events, so the driver may export an input device in /dev/ in the
future.  However CEC could be also handled by HDMI driver.

I kindly ask for suggestions about the best location for this driver.

Both the chip and the driver are quite autonomic. The chip works as 'invisible
proxy' for HDMI signal, so there is no need to integrate it with HDMI drivers
by helper-subsystems like v4l2_subdev or drm_bridge.  If the driver is merged
then the driver from drivers/media/platform/s5p-tv/sii9234_drv.c could be safely
removed.

All comments are welcome.

Regards,
Tomasz Stanislawski


References:
[1] 
https://github.com/junpei0824/SC02C-linux/tree/master-jelly-cm-aokp/drivers/media/video/mhl


Tomasz Stanislawski (2):
  misc: add sii9234 driver
  arm: dts: trats2: add SiI9234 node

 Documentation/devicetree/bindings/sii9234.txt |   22 +
 arch/arm/boot/dts/exynos4412-trats2.dts   |   43 +
 drivers/misc/Kconfig  |8 +
 drivers/misc/Makefile |1 +
 drivers/misc/sii9234.c| 1081 +
 5 files changed, 1155 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sii9234.txt
 create mode 100644 drivers/misc/sii9234.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2 2/3] drm: exynos: hdmi: use hdmiphy as PHY

2014-04-09 Thread Tomasz Stanislawski
Hi Andrzej,
This issue could be solved by exporting a regmap from PMU driver
or Exynos clock provider for the usage by exynos-simple-phy.
The operations on PHYs from exynos-simple-phy provider would
be chained to PMU driver and protected by a spinlock in the regmap.

Luckily, the divider is not used as far as I know.

Regards,
Tomasz Stanislawski

On 04/09/2014 12:30 PM, Andrzej Hajda wrote:
 Hi Tomasz,
 
 On 04/08/2014 04:37 PM, Tomasz Stanislawski wrote:
 The HDMIPHY (physical interface) is controlled by a single
 bit in a power controller's regiter. It was implemented
 as clock. It was a simple but effective hack.
 
 This power controller register has also bits to control HDMI clock
 divider ratio. I guess current drivers do not change it, but how do you
 want to implement access to it if some HDMI driver in the future will
 need to change ratio. I guess in case of clk it would be easier.
 
 Regards
 Andrzej
 
 

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2 1/3] phy: Add exynos-simple-phy driver

2014-04-09 Thread Tomasz Stanislawski
Hi Rahul,

On 04/09/2014 11:12 AM, Rahul Sharma wrote:
 Hi Tomasz,
 
 On 9 April 2014 14:07, Andrzej Hajda a.ha...@samsung.com wrote:
 Hi Tomasz,

 On 04/08/2014 04:37 PM, Tomasz Stanislawski wrote:
 Add exynos-simple-phy driver to support a single register
 PHY interfaces present on Exynos4 SoC.

 Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com

[snip]

 +
 + regs = devm_ioremap(dev, res-start, res-end - res-start);
 + if (!regs) {
 + dev_err(dev, failed to ioremap registers\n);
 + return -EFAULT;
 + }

 Why not devm_ioremap_resource? If not, resource_size function calculates
 length of resource correctly.

 Anyway I like the idea of implementing multiple phys in one driver.
 The only drawback I see is that some phys will be created even there are
 no consumers for them. To avoid such situation you can try to use
 lazy approach - create phy only if there is request for it,
 exynos_phy_xlate callback should allow this.

 Regards
 Andrzej

 
 Idea looks good. How about keeping compatible which is independent
 of SoC, something like samsung,exynos-simple-phy and provide Reg
 and Bit through phy provider node. This way we can avoid SoC specific
 hardcoding in phy driver and don't need to look into dt bindings for
 each new SoC.

A very nice idea BUT there is a very strong pressure from DT guys
to avoid adding any bit fields/offsets/masks in DT nodes.

Hopefully, as long as driver name starts with exynos- prefix
one can hide SoCs specific tricks deep inside driver code.

The idea behind this driver was not to create a generic phy for 1-bit
devices but rather to hide SoC-specific issues from client drivers
like DRM-HDMI.

 
 We can use syscon interface to access PMU bits like USB phy.
 PMU is already registered as system controller
 

Ok. I will try to use it in PATCHv3.

 Regards,
 Rahul Sharma.
 

Regards,
Tomasz Stanislawski


--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 3/3] s5p-tv: hdmi: use hdmiphy as PHY

2014-04-08 Thread Tomasz Stanislawski
The HDMIPHY (physical interface) is controlled by a single
bit in a power controller's regiter. It was implemented
as clock. It was a simple but effective hack.

This patch makes S5P-HDMI driver to control HDMIPHY via PHY interface.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/media/platform/s5p-tv/hdmi_drv.c |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c 
b/drivers/media/platform/s5p-tv/hdmi_drv.c
index 534722c..8013e52 100644
--- a/drivers/media/platform/s5p-tv/hdmi_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
@@ -32,6 +32,7 @@
 #include linux/clk.h
 #include linux/regulator/consumer.h
 #include linux/v4l2-dv-timings.h
+#include linux/phy/phy.h
 
 #include media/s5p_hdmi.h
 #include media/v4l2-common.h
@@ -66,7 +67,7 @@ struct hdmi_resources {
struct clk *sclk_hdmi;
struct clk *sclk_pixel;
struct clk *sclk_hdmiphy;
-   struct clk *hdmiphy;
+   struct phy *hdmiphy;
struct regulator_bulk_data *regul_bulk;
int regul_count;
 };
@@ -586,7 +587,7 @@ static int hdmi_resource_poweron(struct hdmi_resources *res)
if (ret  0)
return ret;
/* power-on hdmi physical interface */
-   clk_enable(res-hdmiphy);
+   phy_power_on(res-hdmiphy);
/* use VPP as parent clock; HDMIPHY is not working yet */
clk_set_parent(res-sclk_hdmi, res-sclk_pixel);
/* turn clocks on */
@@ -600,7 +601,7 @@ static void hdmi_resource_poweroff(struct hdmi_resources 
*res)
/* turn clocks off */
clk_disable(res-sclk_hdmi);
/* power-off hdmiphy */
-   clk_disable(res-hdmiphy);
+   phy_power_off(res-hdmiphy);
/* turn HDMI power off */
regulator_bulk_disable(res-regul_count, res-regul_bulk);
 }
@@ -784,7 +785,7 @@ static void hdmi_resources_cleanup(struct hdmi_device *hdev)
/* kfree is NULL-safe */
kfree(res-regul_bulk);
if (!IS_ERR(res-hdmiphy))
-   clk_put(res-hdmiphy);
+   phy_put(res-hdmiphy);
if (!IS_ERR(res-sclk_hdmiphy))
clk_put(res-sclk_hdmiphy);
if (!IS_ERR(res-sclk_pixel))
@@ -835,7 +836,7 @@ static int hdmi_resources_init(struct hdmi_device *hdev)
dev_err(dev, failed to get clock 'sclk_hdmiphy'\n);
goto fail;
}
-   res-hdmiphy = clk_get(dev, hdmiphy);
+   res-hdmiphy = phy_get(dev, hdmiphy);
if (IS_ERR(res-hdmiphy)) {
dev_err(dev, failed to get clock 'hdmiphy'\n);
goto fail;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 2/3] drm: exynos: hdmi: use hdmiphy as PHY

2014-04-08 Thread Tomasz Stanislawski
The HDMIPHY (physical interface) is controlled by a single
bit in a power controller's regiter. It was implemented
as clock. It was a simple but effective hack.

This patch makes HDMI driver to control HDMIPHY via PHY interface.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 9a6d652..ef1cdd0 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -36,6 +36,7 @@
 #include linux/i2c.h
 #include linux/of_gpio.h
 #include linux/hdmi.h
+#include linux/phy/phy.h
 
 #include drm/exynos_drm.h
 
@@ -74,8 +75,8 @@ struct hdmi_resources {
struct clk  *sclk_hdmi;
struct clk  *sclk_pixel;
struct clk  *sclk_hdmiphy;
-   struct clk  *hdmiphy;
struct clk  *mout_hdmi;
+   struct phy  *hdmiphy;
struct regulator_bulk_data  *regul_bulk;
int regul_count;
 };
@@ -1854,7 +1855,7 @@ static void hdmi_poweron(struct exynos_drm_display 
*display)
if (regulator_bulk_enable(res-regul_count, res-regul_bulk))
DRM_DEBUG_KMS(failed to enable regulator bulk\n);
 
-   clk_prepare_enable(res-hdmiphy);
+   phy_power_on(res-hdmiphy);
clk_prepare_enable(res-hdmi);
clk_prepare_enable(res-sclk_hdmi);
 
@@ -1881,7 +1882,7 @@ static void hdmi_poweroff(struct exynos_drm_display 
*display)
 
clk_disable_unprepare(res-sclk_hdmi);
clk_disable_unprepare(res-hdmi);
-   clk_disable_unprepare(res-hdmiphy);
+   phy_power_off(res-hdmiphy);
regulator_bulk_disable(res-regul_count, res-regul_bulk);
 
pm_runtime_put_sync(hdata-dev);
@@ -1977,9 +1978,9 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
DRM_ERROR(failed to get clock 'sclk_hdmiphy'\n);
goto fail;
}
-   res-hdmiphy = devm_clk_get(dev, hdmiphy);
+   res-hdmiphy = devm_phy_get(dev, hdmiphy);
if (IS_ERR(res-hdmiphy)) {
-   DRM_ERROR(failed to get clock 'hdmiphy'\n);
+   DRM_ERROR(failed to get phy 'hdmiphy'\n);
goto fail;
}
res-mout_hdmi = devm_clk_get(dev, mout_hdmi);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 1/3] phy: Add exynos-simple-phy driver

2014-04-08 Thread Tomasz Stanislawski
Add exynos-simple-phy driver to support a single register
PHY interfaces present on Exynos4 SoC.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 .../devicetree/bindings/phy/samsung-phy.txt|   24 +++
 drivers/phy/Kconfig|5 +
 drivers/phy/Makefile   |1 +
 drivers/phy/exynos-simple-phy.c|  154 
 4 files changed, 184 insertions(+)
 create mode 100644 drivers/phy/exynos-simple-phy.c

diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt 
b/Documentation/devicetree/bindings/phy/samsung-phy.txt
index b422e38..f97c4c3 100644
--- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
+++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
@@ -114,3 +114,27 @@ Example:
compatible = samsung,exynos-sataphy-i2c;
reg = 0x38;
};
+
+Samsung S5P/EXYNOS SoC series SIMPLE PHY
+-
+
+Required properties:
+- compatible : should be one of the listed compatibles:
+   - samsung,exynos4210-simple-phy
+   - samsung,exynos4412-simple-phy
+- reg : offset and length of the register set;
+- #phy-cells : from the generic phy bindings, must be 1;
+
+For samsung,exynos4210-simple-phy compatible PHYs the second cell in
+the PHY specifier identifies the PHY and its meaning is as follows:
+  0 - HDMI PHY,
+  1 - DAC PHY,
+  2 - ADC PHY,
+  3 - PCIE PHY.
+  4 - SATA PHY.
+
+For samsung,exynos4412-simple-phy compatible PHYs the second cell in
+the PHY specifier identifies the PHY and its meaning is as follows:
+  0 - HDMI PHY,
+  1 - ADC PHY,
+
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 3bb05f1..65ab783 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -166,4 +166,9 @@ config PHY_XGENE
help
  This option enables support for APM X-Gene SoC multi-purpose PHY.
 
+config EXYNOS_SIMPLE_PHY
+   tristate Exynos Simple PHY driver
+   help
+ Support for 1-bit PHY controllers on SoCs from Exynos family.
+
 endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 2faf78e..88c5b60 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_PHY_EXYNOS4210_USB2) += phy-exynos4210-usb2.o
 obj-$(CONFIG_PHY_EXYNOS4X12_USB2)  += phy-exynos4x12-usb2.o
 obj-$(CONFIG_PHY_EXYNOS5250_USB2)  += phy-exynos5250-usb2.o
 obj-$(CONFIG_PHY_XGENE)+= phy-xgene.o
+obj-$(CONFIG_EXYNOS_SIMPLE_PHY)+= exynos-simple-phy.o
diff --git a/drivers/phy/exynos-simple-phy.c b/drivers/phy/exynos-simple-phy.c
new file mode 100644
index 000..57ad338
--- /dev/null
+++ b/drivers/phy/exynos-simple-phy.c
@@ -0,0 +1,154 @@
+/*
+ * Exynos Simple PHY driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Tomasz Stanislawski t.stanisl...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/io.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_address.h
+#include linux/of_device.h
+#include linux/phy/phy.h
+
+#define EXYNOS_PHY_ENABLE  (1  0)
+
+static int exynos_phy_power_on(struct phy *phy)
+{
+   void __iomem *reg = phy_get_drvdata(phy);
+   u32 val;
+
+   val = readl(reg);
+   val |= EXYNOS_PHY_ENABLE;
+   writel(val, reg);
+
+   return 0;
+}
+
+static int exynos_phy_power_off(struct phy *phy)
+{
+   void __iomem *reg = phy_get_drvdata(phy);
+   u32 val;
+
+   val = readl(reg);
+   val = ~EXYNOS_PHY_ENABLE;
+   writel(val, reg);
+
+   return 0;
+}
+
+static struct phy_ops exynos_phy_ops = {
+   .power_on   = exynos_phy_power_on,
+   .power_off  = exynos_phy_power_off,
+   .owner  = THIS_MODULE,
+};
+
+static const u32 exynos4210_offsets[] = {
+   0x0700, /* HDMI_PHY */
+   0x070C, /* DAC_PHY */
+   0x0718, /* ADC_PHY */
+   0x071C, /* PCIE_PHY */
+   0x0720, /* SATA_PHY */
+   ~0, /* end mark */
+};
+
+static const u32 exynos4412_offsets[] = {
+   0x0700, /* HDMI_PHY */
+   0x0718, /* ADC_PHY */
+   ~0, /* end mark */
+};
+
+static const struct of_device_id exynos_phy_of_match[] = {
+   { .compatible = samsung,exynos4210-simple-phy,
+ .data = exynos4210_offsets},
+   { .compatible = samsung,exynos4412-simple-phy,
+ .data = exynos4412_offsets},
+   { },
+};
+MODULE_DEVICE_TABLE(of, exynos_phy_of_match);
+
+static struct phy *exynos_phy_xlate(struct device *dev,
+   struct of_phandle_args *args)
+{
+   struct phy **phys = dev_get_drvdata(dev);
+   int index = args-args[0];
+   int i;
+
+   /* verify if index is valid */
+   for (i = 0; i = index; ++i

[PATCHv2 0/3] phy: Add exynos-simple-phy driver

2014-04-08 Thread Tomasz Stanislawski
Hello everyone,

The Samsung SoCs from Exynos family are enhanced with a bunch of devices that
provide functionality of a physical layer for interfaces like USB, HDMI, SATA,
etc. They are controlled by a simple interface, often a single bit that enables
and/or resets the physical layer.

An IP driver should to control such a controller in an abstract manner.
Therefore, such 'enablers' were implemented as clocks in older versions of
Linux kernel.  With the dawn of PHY subsystems, PHYs become a natural way of
exporting the 'enabler' functionality to drivers.  However, there is an
unexpected consequence. Some of those 1-bit PHYs were implemented as separate
drivers.  This means that one has to create a struct device, struct phy, its
phy provider and 100-150 lines of driver code to basically set one bit.

The DP phy driver is a good example:
https://lkml.org/lkml/2013/7/18/53

And simple-phy RFC (shares only driver code but not other resources):
https://lkml.org/lkml/2013/10/21/313

To avoid waste of resources I propose to create all such 1-bit phys from Exynos
SoC using a single device, driver and phy provider.

This patchset contains a proposed solution.

All comment are welcome.

Hopefully in future the functionality introduced by this patch may be merged
into a larger Power Management Unit (PMU) gluer driver.  On Samsusng SoC , the
PMU part contains a number of register barely linked to power management (like
clock gating, clock dividers, CPU resetting, etc.).  It may be tempting to
create a hybrid driver that export clocks/phys/etc that are controlled by PMU
unit.

Alternative solutions might be:
* exporting a regmap to the IP driver and allow the driver to control the PHY 
layer
  like in the patch:
  http://thread.gmane.org/gmane.linux.kernel.samsung-soc/28617/focus=28648

* create a dedicated power domain for hdmiphy

Regards,
Tomasz Stanislawski

Changelog:
v2:
* rename to exynos-simple-phy
* fix usage of devm_ioremap()
* add documentation for DT bindings
* add patches to client drivers

v1: initial version

Tomasz Stanislawski (3):
  phy: Add exynos-simple-phy driver
  drm: exynos: hdmi: use hdmiphy as PHY
  s5p-tv: hdmi: use hdmiphy as PHY

 .../devicetree/bindings/phy/samsung-phy.txt|   24 +++
 drivers/gpu/drm/exynos/exynos_hdmi.c   |   11 +-
 drivers/media/platform/s5p-tv/hdmi_drv.c   |   11 +-
 drivers/phy/Kconfig|5 +
 drivers/phy/Makefile   |1 +
 drivers/phy/exynos-simple-phy.c|  154 
 6 files changed, 196 insertions(+), 10 deletions(-)
 create mode 100644 drivers/phy/exynos-simple-phy.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] Update to Exynos clocks

2014-04-04 Thread Tomasz Stanislawski
This patchset adds some updates to clocks for Exynos4 platform and to the clock
core.  The patches are rebased on linux/next.

An interesting part might be 'propagation of clk_set_parent()'.  This feature
simplifies configuration of complex topologyof clocks by drivers.  Such a
situation happens for Exynos HDMI driver.

The HDMI device is clocked by sclk_hdmi clock. In older versions of SoC and its
driver, the clock had two parent clocks: sclk_hdmiphy and sclk_pixel.
The sclk_hdmi was a gated clock.

In the recent version of Exynos clock provider this topology was slightly
changed. A new clock named mout_hdmi was introduced.  This new clock represents
the output of multiplexer that selects between sclk_hdmiphy and sclk_pixel.

After the change the sclk_hdmi is still gated but has a single parent -
mout_hdmi.

This change caused interesting situation in Exynos HDMI driver because this
driver used only sclk_hdmi.  Now clk_set_parent(sclk_hdmi, ...) fails because
sclk_hdmi has a single parent now.  Using mout_hdmi instead of sclk_hdmi will
not work because clk_enable(mout_hdmi) is not propagated to sclk_hdmi.

To solve this problem, the setup of mout_hdmi was added to Exynos HDMI in the
patch: drm/exynos: add mout_hdmi clock in hdmi driver to change parent

IMO, this change breaks abstraction of clock API reveling too detailed
information about clock topology to the driver.

Moreover, the driver no longer works with old DT bindings because they provide
no mout_hdmi clock.

The clock set_parent propagation can be used to fix this.  The clk_set_parent()
is propagated to a parent as long as the current clock has a single parent and
has the flag CLK_SET_PARENT_PARENT set.

Now Exynos HDMI can use only sclk_hdmi clock. The clk_enable() gates this clock
directly and clk_set_parent() is propagated to mout_hdmi.

This new behaviour does not break DT bindings because mout_hdmi would be simply
ignored.

After this change the 'add mout_hdmi clock' is no longer needed.

Regards,
Tomasz Stanislawski

Tomasz Stanislawski (4):
  clk: propagate parent change up one level
  clk: exynos4: export sclk_hdmiphy clock
  clk: exynos4: enable clk_set_parent() propagation for sclk_hdmi and
sclk_mixer clocks
  Revert drm/exynos: add mout_hdmi clock in hdmi driver to change
parent

 drivers/clk/clk.c|6 ++
 drivers/clk/samsung/clk-exynos4.c|8 +---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   14 --
 include/dt-bindings/clock/exynos4.h  |1 +
 include/linux/clk-provider.h |1 +
 5 files changed, 17 insertions(+), 13 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] clk: exynos4: export sclk_hdmiphy clock

2014-04-04 Thread Tomasz Stanislawski
Export sclk_hdmiphy clock to be usable from DT.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/clk/samsung/clk-exynos4.c   |2 +-
 include/dt-bindings/clock/exynos4.h |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/samsung/clk-exynos4.c 
b/drivers/clk/samsung/clk-exynos4.c
index b4f9672..528f8eb 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -428,7 +428,7 @@ static struct samsung_fixed_rate_clock 
exynos4_fixed_rate_ext_clks[] __initdata
 /* fixed rate clocks generated inside the soc */
 static struct samsung_fixed_rate_clock exynos4_fixed_rate_clks[] __initdata = {
FRATE(0, sclk_hdmi24m, NULL, CLK_IS_ROOT, 2400),
-   FRATE(0, sclk_hdmiphy, NULL, CLK_IS_ROOT, 2700),
+   FRATE(CLK_SCLK_HDMIPHY, sclk_hdmiphy, NULL, CLK_IS_ROOT, 2700),
FRATE(0, sclk_usbphy0, NULL, CLK_IS_ROOT, 4800),
 };
 
diff --git a/include/dt-bindings/clock/exynos4.h 
b/include/dt-bindings/clock/exynos4.h
index 75aff33..0e245eb 100644
--- a/include/dt-bindings/clock/exynos4.h
+++ b/include/dt-bindings/clock/exynos4.h
@@ -33,6 +33,7 @@
 #define CLK_MOUT_MPLL_USER_C   18 /* Exynos4x12 only */
 #define CLK_MOUT_CORE  19
 #define CLK_MOUT_APLL  20
+#define CLK_SCLK_HDMIPHY   22
 
 /* gate for special clocks (sclk) */
 #define CLK_SCLK_FIMC0 128
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] Revert drm/exynos: add mout_hdmi clock in hdmi driver to change parent

2014-04-04 Thread Tomasz Stanislawski
This reverts commit 59956d35a8618235ea715280b49447bb36f2c975.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 9a6d652..8ebb4bf 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -75,7 +75,6 @@ struct hdmi_resources {
struct clk  *sclk_pixel;
struct clk  *sclk_hdmiphy;
struct clk  *hdmiphy;
-   struct clk  *mout_hdmi;
struct regulator_bulk_data  *regul_bulk;
int regul_count;
 };
@@ -1282,7 +1281,7 @@ static void hdmi_v13_mode_apply(struct hdmi_context 
*hdata)
}
 
clk_disable_unprepare(hdata-res.sclk_hdmi);
-   clk_set_parent(hdata-res.mout_hdmi, hdata-res.sclk_hdmiphy);
+   clk_set_parent(hdata-res.sclk_hdmi, hdata-res.sclk_hdmiphy);
clk_prepare_enable(hdata-res.sclk_hdmi);
 
/* enable HDMI and timing generator */
@@ -1449,7 +1448,7 @@ static void hdmi_v14_mode_apply(struct hdmi_context 
*hdata)
}
 
clk_disable_unprepare(hdata-res.sclk_hdmi);
-   clk_set_parent(hdata-res.mout_hdmi, hdata-res.sclk_hdmiphy);
+   clk_set_parent(hdata-res.sclk_hdmi, hdata-res.sclk_hdmiphy);
clk_prepare_enable(hdata-res.sclk_hdmi);
 
/* enable HDMI and timing generator */
@@ -1475,7 +1474,7 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata)
u32 reg;
 
clk_disable_unprepare(hdata-res.sclk_hdmi);
-   clk_set_parent(hdata-res.mout_hdmi, hdata-res.sclk_pixel);
+   clk_set_parent(hdata-res.sclk_hdmi, hdata-res.sclk_pixel);
clk_prepare_enable(hdata-res.sclk_hdmi);
 
/* operation mode */
@@ -1982,13 +1981,8 @@ static int hdmi_resources_init(struct hdmi_context 
*hdata)
DRM_ERROR(failed to get clock 'hdmiphy'\n);
goto fail;
}
-   res-mout_hdmi = devm_clk_get(dev, mout_hdmi);
-   if (IS_ERR(res-mout_hdmi)) {
-   DRM_ERROR(failed to get clock 'mout_hdmi'\n);
-   goto fail;
-   }
 
-   clk_set_parent(res-mout_hdmi, res-sclk_pixel);
+   clk_set_parent(res-sclk_hdmi, res-sclk_pixel);
 
res-regul_bulk = devm_kzalloc(dev, ARRAY_SIZE(supply) *
sizeof(res-regul_bulk[0]), GFP_KERNEL);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] clk: propagate parent change up one level

2014-04-04 Thread Tomasz Stanislawski
This patch adds support for propagation of setup of clock's parent one level
up.

This feature is helpful when a driver changes topology of its clocks using
clk_set_parent().  The problem occurs when on one platform/SoC driver's clock
is located at MUX output but on the other platform/SoC there is a gated proxy
clock between the MUX and driver's clock.  In such a case, driver's code has to
be modified to use one clock for enabling and the other clock for setup of a
parent.

The code updates are avoided by propagating setup of a parent up one level.

Additionally, this patch adds CLK_SET_PARENT_PARENT (sorry for naming) flag to
inform clk-core that clk_set_parent() should be propagated.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/clk/clk.c|6 ++
 include/linux/clk-provider.h |1 +
 2 files changed, 7 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index dff0373..53bbfda 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1737,6 +1737,12 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
 
/* try finding the new parent index */
if (parent) {
+   if ((clk-flags  CLK_SET_PARENT_PARENT)
+clk-num_parents == 1) {
+   ret = clk_set_parent(clk-parent, parent);
+   goto out;
+   }
+
p_index = clk_fetch_parent_index(clk, parent);
p_rate = parent-rate;
if (p_index  0) {
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 5119174..daa0b03 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -30,6 +30,7 @@
 #define CLK_GET_RATE_NOCACHE   BIT(6) /* do not use the cached clk rate */
 #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
 #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy 
*/
+#define CLK_SET_PARENT_PARENT  BIT(9) /* propagate parent change up one level 
*/
 
 struct clk_hw;
 struct dentry;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] phy: Add exynos-phy driver

2013-11-27 Thread Tomasz Stanislawski
Hello everyone,
The Samsung SoCs from Exynos family are enhanced with a bunch of switches
dedicated for IP blocks. Those switches are called PHYs in Exynos
specification. They are usually controlled by a single bit in a single
one-word-long register.

A IP driver has to control such a switch in an abstract manner.  Therefore,
such 'enablers' were implemented as clocks in older versions of Linux kernel.
With the dawn of PHY subsystems, PHYs become a natural way of exporting the
'enabler' functionality to drivers.  However, there is an unexpected
consequence. Some of those 1-bit PHYs were implemented as separate drivers.
This means that one has to create a struct device, struct phy, its phy provider
and 100-150 lines of driver code to basically set one bit.

The DP phy driver is a good example:
https://lkml.org/lkml/2013/7/18/53

And simple-phy RFC (shares only driver code but not other resources):
https://lkml.org/lkml/2013/10/21/313

To avoid waste of resources I propose to create all such 1-bit phys from Exynos
SoC using a single device, driver and phy provider.

This patchset contains a proposed solution.

All comment are welcome.

Hopefully in future the functionality introduced by this patch may be merged
into a larger Power Management Unit (PMU) gluer driver.  On Samsusng SoC , the
PMU part contains a number of register barely linked to power management (like
clock gating, clock dividers, CPU resetting, etc.).  It may be tempting to
create a hybrid driver that export clocks/phys/etc that are controlled by PMU
unit.

Regards,
Tomasz Stanislawski

Tomasz Stanislawski (1):
  phy: Add exynos-phy driver

 drivers/phy/Kconfig  |5 ++
 drivers/phy/Makefile |1 +
 drivers/phy/exynos-phy.c |  152 ++
 3 files changed, 158 insertions(+)
 create mode 100644 drivers/phy/exynos-phy.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] phy: Add exynos-phy driver

2013-11-27 Thread Tomasz Stanislawski
Add exynos-phy driver to support a single register
PHY interfaces present on Exynos4 SoC.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/phy/Kconfig  |5 ++
 drivers/phy/Makefile |1 +
 drivers/phy/exynos-phy.c |  152 ++
 3 files changed, 158 insertions(+)
 create mode 100644 drivers/phy/exynos-phy.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index a344f3d..4414c73 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -51,4 +51,9 @@ config PHY_EXYNOS_DP_VIDEO
help
  Support for Display Port PHY found on Samsung EXYNOS SoCs.
 
+config EXYNOS_PHY
+   tristate Exynos PHY driver
+   help
+ Support for PHY controllers on SoCs from Exynos family.
+
 endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index d0caae9..b2a833d 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -5,5 +5,6 @@
 obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
 obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO)  += phy-exynos-dp-video.o
 obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o
+obj-$(CONFIG_EXYNOS_PHY)   += exynos-phy.o
 obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o
 obj-$(CONFIG_TWL4030_USB)  += phy-twl4030-usb.o
diff --git a/drivers/phy/exynos-phy.c b/drivers/phy/exynos-phy.c
new file mode 100644
index 000..5a1ae6d
--- /dev/null
+++ b/drivers/phy/exynos-phy.c
@@ -0,0 +1,152 @@
+/*
+ * Exynos PHY driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Tomasz Stanislawski t.stanisl...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/io.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_address.h
+#include linux/of_device.h
+#include linux/phy/phy.h
+
+#define EXYNOS_PHY_ENABLE  (1  0)
+
+static int exynos_phy_power_on(struct phy *phy)
+{
+   void __iomem *reg = phy_get_drvdata(phy);
+   u32 val;
+
+   val = readl(reg);
+   val |= EXYNOS_PHY_ENABLE;
+   writel(val, reg);
+
+   return 0;
+}
+
+static int exynos_phy_power_off(struct phy *phy)
+{
+   void __iomem *reg = phy_get_drvdata(phy);
+   u32 val;
+
+   val = readl(reg);
+   val = ~EXYNOS_PHY_ENABLE;
+   writel(val, reg);
+
+   return 0;
+}
+
+static struct phy_ops exynos_phy_ops = {
+   .power_on   = exynos_phy_power_on,
+   .power_off  = exynos_phy_power_off,
+   .owner  = THIS_MODULE,
+};
+
+static const u32 exynos4210_offsets[] = {
+   0x0700, /* HDMI_PHY */
+   0x070C, /* DAC_PHY */
+   0x0718, /* ADC_PHY */
+   0x071C, /* PCIE_PHY */
+   0x0720, /* SATA_PHY */
+   ~0, /* end mark */
+};
+
+static const u32 exynos4412_offsets[] = {
+   0x0700, /* HDMI_PHY */
+   0x0718, /* ADC_PHY */
+   ~0, /* end mark */
+};
+
+static const struct of_device_id exynos_phy_of_match[] = {
+   { .compatible = exynos4210-phy, .data = exynos4210_offsets},
+   { .compatible = exynos4412-phy, .data = exynos4412_offsets},
+   { },
+};
+MODULE_DEVICE_TABLE(of, exynos_phy_of_match);
+
+static struct phy *exynos_phy_xlate(struct device *dev,
+   struct of_phandle_args *args)
+{
+   struct phy **phys = dev_get_drvdata(dev);
+   int index = args-args[0];
+   int i;
+
+   /* verify if index is valid */
+   for (i = 0; i = index; ++i)
+   if (!phys[i])
+   return ERR_PTR(-ENODEV);
+
+   return phys[index];
+}
+
+static int exynos_phy_probe(struct platform_device *pdev)
+{
+   const struct of_device_id *of_id = of_match_device(
+   of_match_ptr(exynos_phy_of_match), pdev-dev);
+   const u32 *offsets = of_id-data;
+   int count;
+   struct device *dev = pdev-dev;
+   struct phy **phys;
+   struct resource *res;
+   void __iomem *regs;
+   int i;
+   struct phy_provider *phy_provider;
+
+   /* count number of phys to create */
+   for (count = 0; offsets[count] != ~0; ++count)
+   ;
+
+   phys = devm_kzalloc(dev, (count + 1) * sizeof(phys[0]), GFP_KERNEL);
+   if (!phys)
+   return -ENOMEM;
+
+   dev_set_drvdata(dev, phys);
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+   regs = devm_ioremap(dev, res-start, res-end);
+   if (IS_ERR(regs)) {
+   dev_err(dev, failed to ioremap registers\n);
+   return PTR_ERR(regs);
+   }
+
+   /* NOTE: last entry in phys[] is NULL */
+   for (i = 0; i  count; ++i) {
+   phys[i] = devm_phy_create(dev, exynos_phy_ops, NULL);
+   if (IS_ERR(phys[i])) {
+   dev_err

Re: [RFC 04/12] phy: Add simple-phy driver

2013-10-25 Thread Tomasz Stanislawski
Hi,
Please refer to the comments below.

On 10/24/2013 05:52 PM, Kishon Vijay Abraham I wrote:
 Hi,
 
 On Monday 21 October 2013 07:48 PM, Tomasz Stanislawski wrote:
 Add simple-phy driver to support a single register
 PHY interfaces present on Exynos4 SoC.
 
 How are these PHY interfaces modelled in the SoC? Where does the register
 actually reside?

Initially, I was planning to add PHY for HDMI_PHY register in
power management register set on s5pv310 soc.

However other PHYs use very similar interface (setting bit 0).
This includes DAC_PHY, ADC_PHY, PCIe_PHY, SATA_PHY.
Moreover it suits well to USBDEVICE_PHY, USBHOST_PHY.
That is why I thought about using something more generic
to handle all those phys without introducing a herd of
200-lines-long drivers.


 Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
 ---
  drivers/phy/Kconfig  |5 ++
  drivers/phy/Makefile |1 +
  drivers/phy/phy-simple.c |  128 
 ++
  3 files changed, 134 insertions(+)
  create mode 100644 drivers/phy/phy-simple.c

 diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
 index ac239ac..619c657 100644
 --- a/drivers/phy/Kconfig
 +++ b/drivers/phy/Kconfig
 @@ -38,4 +38,9 @@ config TWL4030_USB
This transceiver supports high and full speed devices plus,
in host mode, low speed.
  
 +config PHY_SIMPLE
 +tristate Simple PHY driver
 
 This is too generic a name to be used. Lets name it something specific to what
 it is used for (EXYNOS/HDMI.. ?).

Ok. It could be renamed to EXYNOS-SIMPLE-PHY or EXYNOS-1BIT-PHY or 
EXYNOS-GENERIC-PHY
or something similar. Any ideas?

 +help
 +  Support for PHY controllers configured using single register.
 +
  endmenu
 diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
 index 0dd8a98..3d68e19 100644
 --- a/drivers/phy/Makefile
 +++ b/drivers/phy/Makefile
 @@ -5,3 +5,4 @@
  obj-$(CONFIG_GENERIC_PHY)   += phy-core.o
  obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o
  obj-$(CONFIG_TWL4030_USB)   += phy-twl4030-usb.o
 +obj-$(CONFIG_PHY_SIMPLE)+= phy-simple.o
 diff --git a/drivers/phy/phy-simple.c b/drivers/phy/phy-simple.c
 new file mode 100644
 index 000..4a28af7
 --- /dev/null
 +++ b/drivers/phy/phy-simple.c
 @@ -0,0 +1,128 @@
 +/*
 + * Simple PHY driver
 + *
 + * Copyright (C) 2013 Samsung Electronics Co., Ltd.
 + * Author: Tomasz Stanislawski t.stanisl...@samsung.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +
 +#include linux/io.h
 +#include linux/kernel.h
 +#include linux/module.h
 +#include linux/of.h
 +#include linux/of_address.h
 +#include linux/phy/phy.h
 +#include linux/platform_device.h
 +#include linux/spinlock.h
 +
 +struct simple_phy {
 +spinlock_t slock;
 +u32 on_value;
 +u32 off_value;
 +u32 mask;
 +void __iomem *regs;
 +};
 +
 +static int sphy_set(struct simple_phy *sphy, bool on)
 +{
 +u32 reg;
 +
 +spin_lock(sphy-slock);
 
 Lets add spin_lock only when it is absolutely necessary. When your PHY 
 provider
 implements only a single PHY, it is not needed. phy_power_on and phy_power_off
 is already protected by the framework.

ok

 +
 +reg = readl(sphy-regs);
 +reg = ~sphy-mask;
 +reg |= sphy-mask  (on ? sphy-on_value : sphy-off_value);
 +writel(reg, sphy-regs);
 +
 +spin_unlock(sphy-slock);
 +
 +return 0;
 +}
 +
 +static int simple_phy_power_on(struct phy *phy)
 +{
 +return sphy_set(phy_get_drvdata(phy), 1);
 +}
 +
 +static int simple_phy_power_off(struct phy *phy)
 +{
 +return sphy_set(phy_get_drvdata(phy), 0);
 +}
 +
 +static struct phy_ops simple_phy_ops = {
 +.power_on   = simple_phy_power_on,
 +.power_off  = simple_phy_power_off,
 +.owner  = THIS_MODULE,
 +};
 +
 +static int simple_phy_probe(struct platform_device *pdev)
 +{
 +struct device *dev = pdev-dev;
 +struct simple_phy *sphy;
 +struct resource *res;
 +struct phy_provider *phy_provider;
 +struct phy *phy;
 +
 +sphy = devm_kzalloc(dev, sizeof(*sphy), GFP_KERNEL);
 +if (!sphy)
 +return -ENOMEM;
 +
 +res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 +
 +sphy-regs = devm_ioremap_resource(dev, res);
 +if (IS_ERR(sphy-regs)) {
 +dev_err(dev, failed to ioremap registers\n);
 +return PTR_ERR(sphy-regs);
 +}
 +
 +spin_lock_init(sphy-slock);
 +
 +phy_provider = devm_of_phy_provider_register(dev, NULL);
 
 pass 'of_phy_simple_xlate' instead of NULL.
 +if (IS_ERR(phy_provider)) {
 +dev_err(dev, failed to register PHY provider\n);
 +return PTR_ERR(phy_provider);
 +}
 +
 +phy = devm_phy_create(dev, simple_phy_ops, NULL);
 +if (IS_ERR(phy)) {
 +dev_err(dev, failed to create PHY\n);
 +return PTR_ERR(phy);
 +}
 +
 +sphy

Re: [PATCH 5/7] phy: Add driver for Exynos DP PHY

2013-10-24 Thread Tomasz Stanislawski
Hi Kishon,
Recently, I posted 'simple-phy' driver.
It is a part of patchset for HDMI enabling on Exynos4 using Device Tree.

http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg23655.html

The simple-phy was dedicated for single register PHYs like HDMI or DP.
Using such a generic phy may help to avoid code duplication.

Regards,
Tomasz Stanislawski


On 10/16/2013 06:28 PM, Kishon Vijay Abraham I wrote:
 From: Jingoo Han jg1@samsung.com
 
 Add a PHY provider driver for the Samsung Exynos SoC Display Port PHY.
 
 Signed-off-by: Jingoo Han jg1@samsung.com
 Reviewed-by: Tomasz Figa t.f...@samsung.com
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Acked-by: Felipe Balbi ba...@ti.com
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  .../devicetree/bindings/phy/samsung-phy.txt|8 ++
  drivers/phy/Kconfig|7 ++
  drivers/phy/Makefile   |1 +
  drivers/phy/phy-exynos-dp-video.c  |  111 
 
  4 files changed, 127 insertions(+)
  create mode 100644 drivers/phy/phy-exynos-dp-video.c
 

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 02/12] clk: exynos4: export sclk_hdmiphy clock

2013-10-21 Thread Tomasz Stanislawski
Export sclk_hdmiphy clock to be usable from DT.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 .../devicetree/bindings/clock/exynos4-clock.txt|1 +
 drivers/clk/samsung/clk-exynos4.c  |4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/exynos4-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos4-clock.txt
index c6bf8a6..cb08f5d 100644
--- a/Documentation/devicetree/bindings/clock/exynos4-clock.txt
+++ b/Documentation/devicetree/bindings/clock/exynos4-clock.txt
@@ -46,6 +46,7 @@ Exynos4 SoC and this is specified where applicable.
   mout_mpll_user_c18  Exynos4x12
   mout_core   19
   mout_apll   20
+  sclk_hdmiphy21
 
 
 [Clock Gate for Special Clocks]
diff --git a/drivers/clk/samsung/clk-exynos4.c 
b/drivers/clk/samsung/clk-exynos4.c
index ad5ff50..df79ca6 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -148,7 +148,7 @@ enum exynos4_clks {
xxti, xusbxti, fin_pll, fout_apll, fout_mpll, fout_epll, fout_vpll,
sclk_apll, sclk_mpll, sclk_epll, sclk_vpll, arm_clk, aclk200, aclk100,
aclk160, aclk133, mout_mpll_user_t, mout_mpll_user_c, mout_core,
-   mout_apll, /* 20 */
+   mout_apll, sclk_hdmiphy, /* 21 */
 
/* gate for special clocks (sclk) */
sclk_fimc0 = 128, sclk_fimc1, sclk_fimc2, sclk_fimc3, sclk_cam0,
@@ -354,7 +354,7 @@ static struct samsung_fixed_rate_clock 
exynos4_fixed_rate_ext_clks[] __initdata
 /* fixed rate clocks generated inside the soc */
 static struct samsung_fixed_rate_clock exynos4_fixed_rate_clks[] __initdata = {
FRATE(none, sclk_hdmi24m, NULL, CLK_IS_ROOT, 2400),
-   FRATE(none, sclk_hdmiphy, NULL, CLK_IS_ROOT, 2700),
+   FRATE(sclk_hdmiphy, sclk_hdmiphy, NULL, CLK_IS_ROOT, 2700),
FRATE(none, sclk_usbphy0, NULL, CLK_IS_ROOT, 4800),
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 01/12] clk: propagate parent change up one level

2013-10-21 Thread Tomasz Stanislawski
This patch adds support for propagation of setup of clock's parent one level
up.

This feature is helpful when a driver changes topology of its clocks using
clk_set_parent().  The problem occurs when on one platform/SoC driver's clock
is located at MUX output but on the other platform/SoC there is a gated proxy
clock between the MUX and driver's clock.  In such a case, driver's code has to
be modified to use one clock for enabling and the other clock for setup of a
parent.

The code updates are avoided by propagating setup of a parent up one level.

Additionally, this patch adds CLK_SET_PARENT_PARENT (sorry for naming) flag to
inform clk-core that clk_set_parent() should be propagated.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/clk/clk.c|6 ++
 include/linux/clk-provider.h |1 +
 2 files changed, 7 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index a004769..14eda80 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1595,6 +1595,12 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
 
/* try finding the new parent index */
if (parent) {
+   if ((clk-flags  CLK_SET_PARENT_PARENT)
+clk-num_parents == 1) {
+   ret = clk_set_parent(clk-parent, parent);
+   goto out;
+   }
+
p_index = clk_fetch_parent_index(clk, parent);
p_rate = parent-rate;
if (p_index == clk-num_parents) {
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 73bdb69..83c98d5 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -29,6 +29,7 @@
 #define CLK_IS_BASIC   BIT(5) /* Basic clk, can't do a to_clk_foo() */
 #define CLK_GET_RATE_NOCACHE   BIT(6) /* do not use the cached clk rate */
 #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
+#define CLK_SET_PARENT_PARENT  BIT(8) /* propagate parent change up one level 
*/
 
 struct clk_hw;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 00/12] Add DRM Exynos HDMI on SoCs from Exynos4 family

2013-10-21 Thread Tomasz Stanislawski
This patchset adds support for HDMI at SoCs from Exynos4 family. The patches
are rebased on kishon/next. Additionally, The patchset contains small fixes to
PHY and CLK frameworks.  I preferred to keep all the patches together for the
first version of the RFC.

The interesting part might be 'propagation of clk_set_parent()'.  This feature
allows to remove the usage of artificial clocks in drivers.  Such a situation
happens for Exynos HDMI and 'mout_hdmi' where the clock is not even mentioned in
some versions of SoC's documentation. Since enabling and setting rate can be
propagated I think that clk_set_parent() should also be propagated. This would
simplify driver's code and make it less dependant on SoC's version.

Another interesting feature refers to simple PHY driver.  This driver register
a PHY interface that operates by setting a special bit in platform register.
This situation is very common in Exynos SoCs.  The current version supports
only one phy per node.  The code might be modified to support multiple phys
from single simple-phy provider to avoid creation of multiple nodes in DT.

All comments are welcome.

Regards,
Tomasz Stanislawski


Tomasz Stanislawski (12):
  clk: propagate parent change up one level
  clk: exynos4: export sclk_hdmiphy clock
  clk: exynos4: enable clk_set_parent() propagation for sclk_hdmi and
sclk_mixer clocks
  phy: Add simple-phy driver
  phy: use of_phy_simple_xlate for NULL xlate function
  Revert drm/exynos: add mout_hdmi clock in hdmi driver to change
parent
  drm: exynos: hdmi: use hdmiphy as PHY
  drm: exynos: hdmi: simplify extracting hpd-gpio from DT
  drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210
SoC
  arm: dts: exynos4: add i2c controller for HDMIPHY
  arm: dts: exynos4: add HDMI devices
  arm: dts: universal_c210: add HDMI devices

 .../devicetree/bindings/clock/exynos4-clock.txt|1 +
 arch/arm/boot/dts/exynos4.dtsi |   43 +++
 arch/arm/boot/dts/exynos4210-universal_c210.dts|   53 
 arch/arm/boot/dts/exynos4210.dtsi  |4 +
 drivers/clk/clk.c  |6 +
 drivers/clk/samsung/clk-exynos4.c  |   10 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c   |   41 +++
 drivers/gpu/drm/exynos/exynos_mixer.c  |3 +
 drivers/phy/Kconfig|5 +
 drivers/phy/Makefile   |1 +
 drivers/phy/phy-core.c |2 +-
 drivers/phy/phy-simple.c   |  128 
 include/linux/clk-provider.h   |1 +
 13 files changed, 269 insertions(+), 29 deletions(-)
 create mode 100644 drivers/phy/phy-simple.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 11/12] arm: dts: exynos4: add HDMI devices

2013-10-21 Thread Tomasz Stanislawski
This patch adds DT nodes for HDMI related devices on SoCs from Exynos4 family.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 arch/arm/boot/dts/exynos4.dtsi|   27 +++
 arch/arm/boot/dts/exynos4210.dtsi |4 
 2 files changed, 31 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index a5f6b8b..a5df9fe 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -522,4 +522,31 @@
samsung,power-domain = pd_lcd0;
status = disabled;
};
+
+   hdmi_phy: hdmi-phy@10020700 {
+   compatible = simple-phy;
+   reg = 0x10020700 0x4;
+   mask = 1;
+   #phy-cells = 0;
+   };
+
+   hdmi: hdmi@12D0 {
+   reg = 0x12D0 0x7;
+   interrupts = 0 92 0;
+   clock-names = hdmi, sclk_hdmi, sclk_pixel, sclk_hdmiphy;
+   clocks = clock 271, clock 136, clock 139, clock 21;
+   phys = hdmi_phy;
+   phy-names = hdmiphy;
+   status = disabled;
+   samsung,power-domain = pd_tv;
+   };
+
+   mixer: mixer@12C1 {
+   compatible = samsung,exynos4-mixer;
+   interrupts = 0 91 0;
+   reg = 0x12C1 0x2100, 0x12c0 0x300;
+   clock-names = mixer, sclk_hdmi, vp, sclk_dac, 
sclk_mixer;
+   clocks = clock 269, clock 136, clock 268, clock 
138, clock 137;
+   samsung,power-domain = pd_tv;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos4210.dtsi 
b/arch/arm/boot/dts/exynos4210.dtsi
index 057d682..75fd845 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -155,4 +155,8 @@
samsung,lcd-wb;
};
};
+
+   hdmi: hdmi@12D0 {
+   compatible = samsung,exynos4210-hdmi;
+   };
 };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 12/12] arm: dts: universal_c210: add HDMI devices

2013-10-21 Thread Tomasz Stanislawski
This patch adds configuration of HDMI devices on Universal C210 board.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 arch/arm/boot/dts/exynos4210-universal_c210.dts |   53 +++
 1 file changed, 53 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4210-universal_c210.dts 
b/arch/arm/boot/dts/exynos4210-universal_c210.dts
index 889cdad..2d94a02 100644
--- a/arch/arm/boot/dts/exynos4210-universal_c210.dts
+++ b/arch/arm/boot/dts/exynos4210-universal_c210.dts
@@ -349,4 +349,57 @@
compatible = samsung,s5p6440-pwm;
status = okay;
};
+
+   hdmi_en: voltage-regulator-hdmi-5v {
+   compatible = regulator-fixed;
+   regulator-name = HDMI_5V;
+   regulator-min-microvolt = 500;
+   regulator-max-microvolt = 500;
+   gpio = gpe0 1 0;
+   enable-active-high;
+   };
+
+   i2c-ddc {
+   compatible = i2c-gpio;
+   gpios = gpe4 2 0 gpe4 3 0;
+   i2c-gpio,delay-us = 100;
+   #address-cells = 1;
+   #size-cells = 0;
+
+   pinctrl-0 = i2c_ddc_bus;
+   pinctrl-names = default;
+   status = okay;
+
+   hdmiddc@72 {
+   compatible = samsung,exynos5-hdmiddc;
+   reg = 0x72;
+   };
+   };
+
+   hdmi: hdmi@12D0 {
+   hpd-gpio = gpx3 7 0;
+   pinctrl-names = default;
+   pinctrl-0 = hdmi_hpd;
+   hdmi-en-supply = hdmi_en;
+   vdd-supply = ldo3_reg;
+   vdd_osc-supply = ldo4_reg;
+   vdd_pll-supply = ldo3_reg;
+   status = okay;
+   };
+};
+
+pinctrl_1 {
+   hdmi_hpd: hdmi-hpd {
+   samsung,pins = gpx3-7;
+   samsung,pin-pud = 0;
+   };
+};
+
+pinctrl_0 {
+   i2c_ddc_bus: i2c-ddc-bus {
+   samsung,pins = gpe4-2, gpe4-3;
+   samsung,pin-function = 2;
+   samsung,pin-pud = 3;
+   samsung,pin-drv = 0;
+   };
 };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 10/12] arm: dts: exynos4: add i2c controller for HDMIPHY

2013-10-21 Thread Tomasz Stanislawski
This patch adds DT nodes for I2C controller dedicated for HDMIPHY.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 arch/arm/boot/dts/exynos4.dtsi |   16 
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index caadc02..a5f6b8b 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -36,6 +36,7 @@
i2c5 = i2c_5;
i2c6 = i2c_6;
i2c7 = i2c_7;
+   i2c8 = i2c_8;
csis0 = csis_0;
csis1 = csis_1;
fimc0 = fimc_0;
@@ -399,6 +400,21 @@
status = disabled;
};
 
+   i2c_8: i2c@138E {
+   #address-cells = 1;
+   #size-cells = 0;
+   compatible = samsung,s3c2440-hdmiphy-i2c;
+   reg = 0x138E 0x100;
+   interrupts = 0 93 0;
+   clocks = clock 325;
+   clock-names = i2c;
+
+   hdmiphy@38 {
+   compatible = samsung,exynos5-hdmiphy;
+   reg = 0x38;
+   };
+   };
+
spi_0: spi@1392 {
compatible = samsung,exynos4210-spi;
reg = 0x1392 0x100;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 08/12] drm: exynos: hdmi: simplify extracting hpd-gpio from DT

2013-10-21 Thread Tomasz Stanislawski
This patch eliminates redundant checks while retrieving HPD gpio from DT during
HDMI's probe().

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index e36588a..5adb5c1 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1858,23 +1858,18 @@ static struct s5p_hdmi_platform_data 
*drm_hdmi_dt_parse_pdata
 {
struct device_node *np = dev-of_node;
struct s5p_hdmi_platform_data *pd;
-   u32 value;
 
pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
if (!pd)
-   goto err_data;
+   return NULL;
 
-   if (!of_find_property(np, hpd-gpio, value)) {
+   pd-hpd_gpio = of_get_named_gpio_flags(np, hpd-gpio, 0, NULL);
+   if (pd-hpd_gpio  0) {
DRM_ERROR(no hpd gpio property found\n);
-   goto err_data;
+   return NULL;
}
 
-   pd-hpd_gpio = of_get_named_gpio(np, hpd-gpio, 0);
-
return pd;
-
-err_data:
-   return NULL;
 }
 
 static struct of_device_id hdmi_match_types[] = {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 09/12] drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC

2013-10-21 Thread Tomasz Stanislawski
This patch add proper compatibles for Mixer and HDMI chip
available on exynos4210 SoCs.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c  |3 +++
 drivers/gpu/drm/exynos/exynos_mixer.c |3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 5adb5c1..ae21fa5 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1874,6 +1874,9 @@ static struct s5p_hdmi_platform_data 
*drm_hdmi_dt_parse_pdata
 
 static struct of_device_id hdmi_match_types[] = {
{
+   .compatible = samsung,exynos4210-hdmi,
+   .data   = (void *)HDMI_TYPE13,
+   }, {
.compatible = samsung,exynos5-hdmi,
.data   = (void *)HDMI_TYPE14,
}, {
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 63bc5f9..892afb5 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -1161,6 +1161,9 @@ static struct platform_device_id mixer_driver_types[] = {
 
 static struct of_device_id mixer_match_types[] = {
{
+   .compatible = samsung,exynos4-mixer,
+   .data   = exynos4_mxr_drv_data,
+   }, {
.compatible = samsung,exynos5-mixer,
.data   = exynos5250_mxr_drv_data,
}, {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 03/12] clk: exynos4: enable clk_set_parent() propagation for sclk_hdmi and sclk_mixer clocks

2013-10-21 Thread Tomasz Stanislawski
This patch enables clk_set_parent() propagation for clocks used
by s5p-tv and exynos-drm drivers.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/clk/samsung/clk-exynos4.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos4.c 
b/drivers/clk/samsung/clk-exynos4.c
index df79ca6..1f58b7c 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -605,7 +605,8 @@ static struct samsung_gate_clock exynos4_gate_clks[] 
__initdata = {
 * the device name and clock alias names specified below for some
 * of the clocks can be removed.
 */
-   GATE(sclk_hdmi, sclk_hdmi, mout_hdmi, SRC_MASK_TV, 0, 0, 0),
+   GATE(sclk_hdmi, sclk_hdmi, mout_hdmi, SRC_MASK_TV, 0,
+   CLK_SET_PARENT_PARENT, 0),
GATE(sclk_spdif, sclk_spdif, mout_spdif, SRC_MASK_PERIL1, 8, 0, 0),
GATE(jpeg, jpeg, aclk160, GATE_IP_CAM, 6, 0, 0),
GATE(mie0, mie0, aclk160, GATE_IP_LCD0, 1, 0, 0),
@@ -801,7 +802,8 @@ static struct samsung_gate_clock exynos4210_gate_clks[] 
__initdata = {
E4210_SRC_MASK_LCD1, 12, CLK_SET_RATE_PARENT, 0),
GATE(sclk_sata, sclk_sata, div_sata,
SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0),
-   GATE(sclk_mixer, sclk_mixer, mout_mixer, SRC_MASK_TV, 4, 0, 0),
+   GATE(sclk_mixer, sclk_mixer, mout_mixer, SRC_MASK_TV, 4,
+   CLK_SET_PARENT_PARENT, 0),
GATE(sclk_dac, sclk_dac, mout_dac, SRC_MASK_TV, 8, 0, 0),
GATE(tsadc, tsadc, aclk100, GATE_IP_PERIL, 15,
0, 0),
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 04/12] phy: Add simple-phy driver

2013-10-21 Thread Tomasz Stanislawski
Add simple-phy driver to support a single register
PHY interfaces present on Exynos4 SoC.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/phy/Kconfig  |5 ++
 drivers/phy/Makefile |1 +
 drivers/phy/phy-simple.c |  128 ++
 3 files changed, 134 insertions(+)
 create mode 100644 drivers/phy/phy-simple.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index ac239ac..619c657 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -38,4 +38,9 @@ config TWL4030_USB
  This transceiver supports high and full speed devices plus,
  in host mode, low speed.
 
+config PHY_SIMPLE
+   tristate Simple PHY driver
+   help
+ Support for PHY controllers configured using single register.
+
 endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 0dd8a98..3d68e19 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -5,3 +5,4 @@
 obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
 obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o
 obj-$(CONFIG_TWL4030_USB)  += phy-twl4030-usb.o
+obj-$(CONFIG_PHY_SIMPLE)   += phy-simple.o
diff --git a/drivers/phy/phy-simple.c b/drivers/phy/phy-simple.c
new file mode 100644
index 000..4a28af7
--- /dev/null
+++ b/drivers/phy/phy-simple.c
@@ -0,0 +1,128 @@
+/*
+ * Simple PHY driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Tomasz Stanislawski t.stanisl...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/io.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_address.h
+#include linux/phy/phy.h
+#include linux/platform_device.h
+#include linux/spinlock.h
+
+struct simple_phy {
+   spinlock_t slock;
+   u32 on_value;
+   u32 off_value;
+   u32 mask;
+   void __iomem *regs;
+};
+
+static int sphy_set(struct simple_phy *sphy, bool on)
+{
+   u32 reg;
+
+   spin_lock(sphy-slock);
+
+   reg = readl(sphy-regs);
+   reg = ~sphy-mask;
+   reg |= sphy-mask  (on ? sphy-on_value : sphy-off_value);
+   writel(reg, sphy-regs);
+
+   spin_unlock(sphy-slock);
+
+   return 0;
+}
+
+static int simple_phy_power_on(struct phy *phy)
+{
+   return sphy_set(phy_get_drvdata(phy), 1);
+}
+
+static int simple_phy_power_off(struct phy *phy)
+{
+   return sphy_set(phy_get_drvdata(phy), 0);
+}
+
+static struct phy_ops simple_phy_ops = {
+   .power_on   = simple_phy_power_on,
+   .power_off  = simple_phy_power_off,
+   .owner  = THIS_MODULE,
+};
+
+static int simple_phy_probe(struct platform_device *pdev)
+{
+   struct device *dev = pdev-dev;
+   struct simple_phy *sphy;
+   struct resource *res;
+   struct phy_provider *phy_provider;
+   struct phy *phy;
+
+   sphy = devm_kzalloc(dev, sizeof(*sphy), GFP_KERNEL);
+   if (!sphy)
+   return -ENOMEM;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+   sphy-regs = devm_ioremap_resource(dev, res);
+   if (IS_ERR(sphy-regs)) {
+   dev_err(dev, failed to ioremap registers\n);
+   return PTR_ERR(sphy-regs);
+   }
+
+   spin_lock_init(sphy-slock);
+
+   phy_provider = devm_of_phy_provider_register(dev, NULL);
+   if (IS_ERR(phy_provider)) {
+   dev_err(dev, failed to register PHY provider\n);
+   return PTR_ERR(phy_provider);
+   }
+
+   phy = devm_phy_create(dev, simple_phy_ops, NULL);
+   if (IS_ERR(phy)) {
+   dev_err(dev, failed to create PHY\n);
+   return PTR_ERR(phy);
+   }
+
+   sphy-mask = 1;
+   sphy-on_value = ~0;
+   sphy-off_value = 0;
+
+   of_property_read_u32(dev-of_node, mask, sphy-mask);
+   of_property_read_u32(dev-of_node, on-value, sphy-on_value);
+   of_property_read_u32(dev-of_node, off-value, sphy-off_value);
+
+   phy_set_drvdata(phy, sphy);
+
+   dev_info(dev, probe successful\n);
+
+   return 0;
+}
+
+static const struct of_device_id simple_phy_of_match[] = {
+   { .compatible = simple-phy },
+   { },
+};
+MODULE_DEVICE_TABLE(of, simple_phy_of_match);
+
+static struct platform_driver simple_phy_driver = {
+   .probe  = simple_phy_probe,
+   .driver = {
+   .of_match_table = simple_phy_of_match,
+   .name  = simple-phy,
+   .owner = THIS_MODULE,
+   }
+};
+module_platform_driver(simple_phy_driver);
+
+MODULE_DESCRIPTION(Simple PHY driver);
+MODULE_AUTHOR(Tomasz Stanislawski t.stanisl...@samsung.com);
+MODULE_LICENSE(GPL v2);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http

[RFC 07/12] drm: exynos: hdmi: use hdmiphy as PHY

2013-10-21 Thread Tomasz Stanislawski
The HDMIPHY (physical interface) is controlled by a single
bit in a power controller's regiter. It was implemented
as clock. It was a simple but effective hack.

This patch makes HDMI driver to control HDMIPHY via PHY interface.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index fcfa23a..e36588a 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -34,6 +34,7 @@
 #include linux/io.h
 #include linux/of.h
 #include linux/of_gpio.h
+#include linux/phy/phy.h
 
 #include drm/exynos_drm.h
 
@@ -82,7 +83,7 @@ struct hdmi_resources {
struct clk  *sclk_hdmi;
struct clk  *sclk_pixel;
struct clk  *sclk_hdmiphy;
-   struct clk  *hdmiphy;
+   struct phy  *hdmiphy;
struct regulator_bulk_data  *regul_bulk;
int regul_count;
 };
@@ -1685,7 +1686,7 @@ static void hdmi_poweron(struct hdmi_context *hdata)
if (regulator_bulk_enable(res-regul_count, res-regul_bulk))
DRM_DEBUG_KMS(failed to enable regulator bulk\n);
 
-   clk_prepare_enable(res-hdmiphy);
+   phy_power_on(res-hdmiphy);
clk_prepare_enable(res-hdmi);
clk_prepare_enable(res-sclk_hdmi);
 
@@ -1710,7 +1711,7 @@ static void hdmi_poweroff(struct hdmi_context *hdata)
 
clk_disable_unprepare(res-sclk_hdmi);
clk_disable_unprepare(res-hdmi);
-   clk_disable_unprepare(res-hdmiphy);
+   phy_power_off(res-hdmiphy);
regulator_bulk_disable(res-regul_count, res-regul_bulk);
 
mutex_lock(hdata-hdmi_mutex);
@@ -1809,9 +1810,9 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
DRM_ERROR(failed to get clock 'sclk_hdmiphy'\n);
goto fail;
}
-   res-hdmiphy = devm_clk_get(dev, hdmiphy);
+   res-hdmiphy = devm_phy_get(dev, hdmiphy);
if (IS_ERR(res-hdmiphy)) {
-   DRM_ERROR(failed to get clock 'hdmiphy'\n);
+   DRM_ERROR(failed to get phy 'hdmiphy'\n);
goto fail;
}
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 05/12] phy: use of_phy_simple_xlate for NULL xlate function

2013-10-21 Thread Tomasz Stanislawski
Use default handler of_phy_simple_xlate() when NULL is passed as argument to
of_phy_provider_register().

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 drivers/phy/phy-core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 03cf8fb..c38ae1e7 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -575,7 +575,7 @@ struct phy_provider *__of_phy_provider_register(struct 
device *dev,
 
phy_provider-dev = dev;
phy_provider-owner = owner;
-   phy_provider-of_xlate = of_xlate;
+   phy_provider-of_xlate = of_xlate ? of_xlate : of_phy_simple_xlate;
 
mutex_lock(phy_provider_mutex);
list_add_tail(phy_provider-list, phy_provider_list);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/13] s5p-tv: Move HDMIPHY and MHL subdev probing to dedicated function

2012-04-13 Thread Tomasz Stanislawski
Hi Karol,
Thank you for the patch.

On 04/12/2012 08:45 PM, Karol Lewandowski wrote:
 Signed-off-by: Karol Lewandowski k.lewando...@samsung.com
 Cc: Tomasz Stanislawski t.stanisl...@samsung.com
 ---
  drivers/media/video/s5p-tv/hdmi_drv.c |   90 
 ++---
  1 files changed, 49 insertions(+), 41 deletions(-)
 
 diff --git a/drivers/media/video/s5p-tv/hdmi_drv.c 
 b/drivers/media/video/s5p-tv/hdmi_drv.c
 index 4865d25..fff3cab 100644
 --- a/drivers/media/video/s5p-tv/hdmi_drv.c
 +++ b/drivers/media/video/s5p-tv/hdmi_drv.c
 @@ -865,11 +865,47 @@ fail:
   return -ENODEV;
  }
  
 +static struct v4l2_subdev *hdmi_get_subdev(
 + struct hdmi_device *hdmi_dev,
 + struct i2c_board_info *bdinfo,
 + int bus,
 + const char *propname)
 +{
 + struct v4l2_subdev *sd = NULL;
 + struct i2c_adapter *adapter;
 + struct device *dev = hdmi_dev-dev;
 +
 + if (!bdinfo) {
 + dev_err(dev, %s info is missing in platform data\n,
 + propname);
 + return ERR_PTR(-ENXIO);
 + }
 +
 + adapter = i2c_get_adapter(bus);
 + if (adapter == NULL) {
 + dev_err(dev, %s adapter request failed, name\n,
 + propname);
 + return ERR_PTR(-ENXIO);
 + }
 +
 + sd = v4l2_i2c_new_subdev_board(hdmi_dev-v4l2_dev,
 +adapter, bdinfo, NULL);
 +
 + /* on failure or not adapter is no longer useful */
 + i2c_put_adapter(adapter);
 +
 + if (sd == NULL) {
 + dev_err(dev, missing subdev for %s\n, propname);
 + return ERR_PTR(-ENODEV);
 + }
 +
 + return sd;
 +}
 +
  static int __devinit hdmi_probe(struct platform_device *pdev)
  {
   struct device *dev = pdev-dev;
   struct resource *res;
 - struct i2c_adapter *adapter;
   struct v4l2_subdev *sd;
   struct hdmi_device *hdmi_dev = NULL;
   struct s5p_hdmi_platform_data *pdata = dev-platform_data;
 @@ -937,51 +973,23 @@ static int __devinit hdmi_probe(struct platform_device 
 *pdev)
   goto fail_init;
   }
  
 - /* testing if hdmiphy info is present */
 - if (!pdata-hdmiphy_info) {
 - dev_err(dev, hdmiphy info is missing in platform data\n);
 - ret = -ENXIO;
 + hdmi_dev-phy_sd = hdmi_get_subdev(hdmi_dev,

If we know that plat data is missing so what is the purpose of calling
hdmi_get_subdev while we know that this function is going to fail?

 +pdata ? pdata-hdmiphy_info : NULL,
 +pdata ? pdata-hdmiphy_bus : -1,
 +phy);
 + if (IS_ERR_OR_NULL(hdmi_dev-phy_sd)) {
 + ret = PTR_ERR(hdmi_dev-phy_sd);
   goto fail_vdev;
   }
 -
 - adapter = i2c_get_adapter(pdata-hdmiphy_bus);
 - if (adapter == NULL) {
 - dev_err(dev, hdmiphy adapter request failed\n);
 - ret = -ENXIO;
 + hdmi_dev-mhl_sd = hdmi_get_subdev(hdmi_dev,
 +pdata ? pdata-mhl_info : NULL ,
 +pdata ? pdata-mhl_bus : -1,
 +mhl);
 + if (IS_ERR_OR_NULL(hdmi_dev-mhl_sd)) {
 + ret = PTR_ERR(hdmi_dev-mhl_sd)

The MHL is an optional subdev. There are platforms that support HDMI but does
not have MHL on board like Universal C210. Failing due to a lack of
MHL plat data will break HDMI support on Universal.

;
   goto fail_vdev;
   }
  
 - hdmi_dev-phy_sd = v4l2_i2c_new_subdev_board(hdmi_dev-v4l2_dev,
 - adapter, pdata-hdmiphy_info, NULL);
 - /* on failure or not adapter is no longer useful */
 - i2c_put_adapter(adapter);
 - if (hdmi_dev-phy_sd == NULL) {
 - dev_err(dev, missing subdev for hdmiphy\n);
 - ret = -ENODEV;
 - goto fail_vdev;
 - }
 -
 - /* initialization of MHL interface if present */
 - if (pdata-mhl_info) {
 - adapter = i2c_get_adapter(pdata-mhl_bus);
 - if (adapter == NULL) {
 - dev_err(dev, MHL adapter request failed\n);
 - ret = -ENXIO;
 - goto fail_vdev;
 - }
 -
 - hdmi_dev-mhl_sd = v4l2_i2c_new_subdev_board(
 - hdmi_dev-v4l2_dev, adapter,
 - pdata-mhl_info, NULL);
 - /* on failure or not adapter is no longer useful */
 - i2c_put_adapter(adapter);
 - if (hdmi_dev-mhl_sd == NULL) {
 - dev_err(dev, missing subdev for MHL\n);
 - ret = -ENODEV;
 - goto fail_vdev;
 - }
 - }
 -
   clk_enable(hdmi_dev-res.hdmi);
  
   pm_runtime_enable(dev);

Regards,
Tomasz Stanislawski
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message

Re: [PATCH 10/13] s5p-tv: Add DT-support for HDMI driver

2012-04-13 Thread Tomasz Stanislawski
Hi Karol,
Thanks for the patch.

Please refer to the comments below.

On 04/12/2012 08:45 PM, Karol Lewandowski wrote:
 Includes v4l2/dt helper function (hdmi_of_get_i2c_subdev() that probably
 should be implemented in v4l2 core itself.
 
 Signed-off-by: Karol Lewandowski k.lewando...@samsung.com
 Cc: Tomasz Stanislawski t.stanisl...@samsung.com
 ---
  drivers/media/video/s5p-tv/hdmi_drv.c |   68 
 -
  1 files changed, 67 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/media/video/s5p-tv/hdmi_drv.c 
 b/drivers/media/video/s5p-tv/hdmi_drv.c
 index fff3cab..a402e8f 100644
 --- a/drivers/media/video/s5p-tv/hdmi_drv.c
 +++ b/drivers/media/video/s5p-tv/hdmi_drv.c
 @@ -29,6 +29,8 @@
  #include linux/pm_runtime.h
  #include linux/clk.h
  #include linux/regulator/consumer.h
 +#include linux/of.h
 +#include linux/of_i2c.h
  
  #include media/s5p_hdmi.h
  #include media/v4l2-common.h
 @@ -712,6 +714,56 @@ static int hdmi_enum_dv_presets(struct v4l2_subdev *sd,
   return v4l_fill_dv_preset_info(hdmi_conf[preset-index].preset, preset);
  }
  
 +#ifdef CONFIG_OF
 +/* Heavily based[1] on v4l2_i2c_new_subdev_board()
 + *
 + * [1] Copy-pasted, that is
 + */
 +struct v4l2_subdev *hdmi_of_get_i2c_subdev(struct v4l2_device *v4l2_dev,
 + struct device_node *np, const char *propname)
 +{
 + struct v4l2_subdev *sd = NULL;
 + struct i2c_client *client;
 + struct device_node *cnp;
 +
 + BUG_ON(!v4l2_dev);

Crashing a kernel is not a good idea in general. Especially when it is possible
to handle a situation. I think that if (WARN_ON(..)) return NULL combo
is a preferred way for handling such an error.

 +
 + cnp = of_parse_phandle(np, propname, 0);
 + if (!cnp) {
 + dev_err(v4l2_dev-dev, Can't find subdev %s\n, propname);
 + goto err;
 + }
 +
 + client = of_find_i2c_device_by_node(cnp);
 + if (!client) {
 + dev_err(v4l2_dev-dev, subdev %s doesn't reference correct 
 node\n,
 + propname);
 + goto err;
 + }
 +

Maybe you should combine the check below with the check above.

 + if (client == NULL || client-driver == NULL)
 + goto err;
 +
 + /* Lock the module so we can safely get the v4l2_subdev pointer */
 + if (!try_module_get(client-driver-driver.owner))
 + goto err;
 + sd = i2c_get_clientdata(client);
 +
 + /* Register with the v4l2_device which increases the module's
 +use count as well. */
 + if (v4l2_device_register_subdev(v4l2_dev, sd)) {
 + printk(KERN_ERR %s: failed to register subdev\n, __func__);
 + sd = NULL;
 + }
 + /* Decrease the module use count to match the first try_module_get. */
 + module_put(client-driver-driver.owner);

This label 'err' is not only used for error cleanups. Maybe you should rename it
to 'cleanup' or 'done'.

 +err:
 + of_node_put(cnp);
 +
 + return sd;
 +}
 +#endif

I think that you should strongly consider adding the function above to
the V4L2 core to drivers/media/video/videobuf2-core.c file and post
the patch to linux-media list.

 +
  static const struct v4l2_subdev_core_ops hdmi_sd_core_ops = {
   .s_power = hdmi_s_power,
  };
 @@ -875,6 +927,12 @@ static struct v4l2_subdev *hdmi_get_subdev(
   struct i2c_adapter *adapter;
   struct device *dev = hdmi_dev-dev;
 

Now I see why hdmi_get_subdev is called with NULL arguments in the
previous patch :).

However I think that you should introduce two explicit paths in probe
function for handling non-DT and DT cases.

 +#ifdef CONFIG_OF
 + if (dev-of_node)
 + return hdmi_of_get_i2c_subdev(hdmi_dev-v4l2_dev,
 +dev-of_node, propname);
 +#endif
 +
   if (!bdinfo) {
   dev_err(dev, %s info is missing in platform data\n,
   propname);
 @@ -913,7 +971,7 @@ static int __devinit hdmi_probe(struct platform_device 
 *pdev)
  
   dev_dbg(dev, probe start\n);
  
 - if (!pdata) {
 + if (!pdata  !dev-of_node) {
   dev_err(dev, platform data is missing\n);
   ret = -ENODEV;
   goto fail;
 @@ -1037,6 +1095,13 @@ static int __devexit hdmi_remove(struct 
 platform_device *pdev)
   return 0;
  }
  
 +#ifdef CONFIG_OF
 +static struct of_device_id hdmi_dt_match[] = {
 + { .compatible = samsung,s5pv210-hdmi },
 + { },
 +};
 +#endif
 +
  static struct platform_driver hdmi_driver __refdata = {
   .probe = hdmi_probe,
   .remove = __devexit_p(hdmi_remove),
 @@ -1045,6 +1110,7 @@ static struct platform_driver hdmi_driver __refdata = {
   .name = s5p-hdmi,
   .owner = THIS_MODULE,
   .pm = hdmi_pm_ops,
 + .of_match_table = of_match_ptr(hdmi_dt_match),
   }
  };
 

Regards,
Tomasz Stanislawski

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord

Re: [PATCH 1/2] ARM: SAMSUNG: Add API to set platform data for s5p-tv driver

2012-04-05 Thread Tomasz Stanislawski
Hi Tushbar Behera,

On 04/05/2012 10:24 AM, Tushar Behera wrote:
 Commit 350f2f4dad64 ([media] v4l: s5p-tv: hdmi: add support for
 platform data) makes the presence of platform data mandatory for s5p-tv
 driver. Adding an API to plat-samsung for this purpose.
 
 Signed-off-by: Tushar Behera tushar.beh...@linaro.org
 ---
  arch/arm/plat-samsung/devs.c  |   25 +
  arch/arm/plat-samsung/include/plat/hdmi.h |   16 
  2 files changed, 41 insertions(+), 0 deletions(-)
  create mode 100644 arch/arm/plat-samsung/include/plat/hdmi.h
 
 diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
 index 8b928f9..0ac3884 100644
 --- a/arch/arm/plat-samsung/devs.c
 +++ b/arch/arm/plat-samsung/devs.c
 @@ -31,6 +31,8 @@
  #include linux/ioport.h
  #include linux/platform_data/s3c-hsudc.h
  
 +#include media/s5p_hdmi.h
 +
  #include asm/irq.h
  #include asm/pmu.h
  #include asm/mach/arch.h
 @@ -770,6 +772,29 @@ void __init s5p_i2c_hdmiphy_set_platdata(struct 
 s3c2410_platform_i2c *pd)
   npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
  s5p_device_i2c_hdmiphy);
  }
 +
 +struct s5p_hdmi_platform_data s5p_hdmi_def_platdata;
 +
 +void __init s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info,
 + struct i2c_board_info *mhl_info, int mhl_bus)
 +{
 + struct s5p_hdmi_platform_data *pd = s5p_hdmi_def_platdata;
 +
 + if (soc_is_exynos4210())
 + pd-hdmiphy_bus = 8;

I found that hdmiphy is installed on 8th controller on all probably all
chips from Exynos4*1* family not only 4210. It should be reflected here.

 + else if (soc_is_s5pv210())
 + pd-hdmiphy_bus = 3;
 + else
 + pd-hdmiphy_bus = 0;
 +
 + pd-hdmiphy_info = hdmiphy_info;
 + pd-mhl_info = mhl_info;
 + pd-mhl_bus = mhl_bus;
 +
 + s3c_set_platdata(pd, sizeof(struct s5p_hdmi_platform_data),
 + s5p_device_hdmi);
 +}
 +
  #endif /* CONFIG_S5P_DEV_I2C_HDMIPHY */
  
  /* I2S */
 diff --git a/arch/arm/plat-samsung/include/plat/hdmi.h 
 b/arch/arm/plat-samsung/include/plat/hdmi.h
 new file mode 100644
 index 000..5dc7347
 --- /dev/null
 +++ b/arch/arm/plat-samsung/include/plat/hdmi.h
 @@ -0,0 +1,16 @@
 +/*
 + * Copyright (C) 2012 Samsung Electronics Co.Ltd
 + *
 + * This program is free software; you can redistribute  it and/or modify it
 + * under  the terms of  the GNU General  Public License as published by the
 + * Free Software Foundation;  either version 2 of the  License, or (at your
 + * option) any later version.
 + */
 +
 +#ifndef __PLAT_SAMSUNG_HDMI_H
 +#define __PLAT_SAMSUNG_HDMI_H __FILE__
 +
 +extern void s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info,
 + struct i2c_board_info *mhl_info, int mhl_bus);
 +
 +#endif /* __PLAT_SAMSUNG_HDMI_H */

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] ARM: EXYNOS: Set HDMI platform data in Origen board

2012-04-05 Thread Tomasz Stanislawski
Hi Tushar Behera,

On 04/05/2012 10:24 AM, Tushar Behera wrote:
 Signed-off-by: Tushar Behera tushar.beh...@linaro.org
 ---
  arch/arm/mach-exynos/mach-origen.c |7 +++
  1 files changed, 7 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/mach-exynos/mach-origen.c 
 b/arch/arm/mach-exynos/mach-origen.c
 index 878d4c9..ac6f78f 100644
 --- a/arch/arm/mach-exynos/mach-origen.c
 +++ b/arch/arm/mach-exynos/mach-origen.c
 @@ -41,6 +41,7 @@
  #include plat/pd.h
  #include plat/fb.h
  #include plat/mfc.h
 +#include plat/hdmi.h
  
  #include mach/ohci.h
  #include mach/map.h
 @@ -671,6 +672,11 @@ static void __init origen_bt_setup(void)
   s3c_gpio_setpull(EXYNOS4_GPX2(2), S3C_GPIO_PULL_NONE);
  }
  
 +/* I2C module and id for HDMIPHY */
 +static struct i2c_board_info hdmiphy_info = {
 + I2C_BOARD_INFO(hdmiphy, 0x38),

I warn you :) that the s5p-hdmiphy driver is going to use driver variant
to handle per-platform setup arrays for HDMIPHY. Refer to patch

http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/45756/focus=45757

If the mentioned patch gets merged into the mainline then the support
for HDMI will be broken on your machine.

Regards,
Tomasz Stanislawski

 +};
 +
  static void s5p_tv_setup(void)
  {
   /* Direct HPD to HDMI chip */
 @@ -718,6 +724,7 @@ static void __init origen_machine_init(void)
  
   s5p_tv_setup();
   s5p_i2c_hdmiphy_set_platdata(NULL);
 + s5p_hdmi_set_platdata(hdmiphy_info, NULL, 0);
  
   s5p_fimd0_set_platdata(origen_lcd_pdata);
  

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] i2c-s3c2410: Add HDMIPHY quirk for S3C2440

2012-03-13 Thread Tomasz Stanislawski
Hi Karol,
Please refer to comments below,

Regards,
Tomasz Stanislawski

On 03/13/2012 05:54 PM, Karol Lewandowski wrote:
 This patch adds support for s3c2440 I2C bus controller dedicated HDMIPHY 
 device on
 Exynos4 platform. Some quirks are introduced due to differences between 
 HDMIPHY
 and other I2C controllers on Exynos4.  These differences are:
 - no GPIOs, HDMIPHY is inside the SoC and the controller is connected
   internally
 - due to unknown reason (probably HW bug in HDMIPHY and/or the controller) a
   transfer fails to finish. The controller hangs after sending the last byte,
   the workaround for this bug is resetting the controller after each transfer
 
 Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
 Signed-off-by: Karol Lewandowski k.lewando...@samsung.com
 Tested-by: Tomasz Stanislawski t.stanisl...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  .../devicetree/bindings/i2c/samsung-i2c.txt|   10 -
  drivers/i2c/busses/i2c-s3c2410.c   |   36 
 
  2 files changed, 44 insertions(+), 2 deletions(-)
 
[snip]
 @@ -871,6 +896,14 @@ s3c24xx_i2c_parse_dt(struct device_node *np, struct 
 s3c24xx_i2c *i2c)
   return;
  
   pdata-bus_num = -1; /* i2c bus number is dynamically assigned */
 +
 + if (s3c24xx_i2c_is_type(i2c, TYPE_S3C2440) 

I think that type checking should be removed because hdmiphy quirk is something
orthogonal to the controller type.

 + of_get_property(np, samsung,i2c-quirk-hdmiphy, NULL))
 + i2c-type |= FLAG_HDMIPHY;
 +
 + if (of_get_property(np, samsung,i2c-no-gpio, NULL))
 + i2c-type |= FLAG_NO_GPIO;
 +
   of_property_read_u32(np, samsung,i2c-sda-delay, pdata-sda_delay);
   of_property_read_u32(np, samsung,i2c-slave-addr, pdata-slave_addr);
   of_property_read_u32(np, samsung,i2c-max-bus-freq,
 @@ -1128,6 +1161,9 @@ static struct platform_device_id s3c24xx_driver_ids[] = 
 {
   }, {
   .name   = s3c2440-i2c,
   .driver_data= TYPE_S3C2440,
 + }, {
 + .name   = s3c2440-hdmiphy-i2c,
 + .driver_data= TYPE_S3C2440 | FLAG_HDMIPHY | FLAG_NO_GPIO,
   }, { },
  };
  MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] S5P-TV support for Exynos Nuri and Universal boards

2012-01-26 Thread Tomasz Stanislawski
Hello,

This patch series contains platform definitions for s5p-tv driver. It includes
fixes to HDMI support on Exynos Universal.  It adds S5P-TV support on Nuri
board.

Please refer to patchset 'Updates to S5P-TV drivers' on linux-media where
definitions of platform data for SII0234 were introduced.

Regards
Tomasz Stanislawski

Tomasz Stanislawski (2):
  ARM: Exynos4: enable TV support on Nuri board
  ARM: Exynos4: fix TV support on Universal_C210 board

 arch/arm/mach-exynos/Kconfig   |2 +
 arch/arm/mach-exynos/mach-nuri.c   |   99 
 arch/arm/mach-exynos/mach-universal_c210.c |   14 
 3 files changed, 115 insertions(+), 0 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ARM: Exynos4: fix TV support on Universal_C210 board

2012-01-26 Thread Tomasz Stanislawski
This patch adds support for HDMI platform data.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-exynos/mach-universal_c210.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-universal_c210.c 
b/arch/arm/mach-exynos/mach-universal_c210.c
index 37ac93e..bec57c0 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -45,6 +45,8 @@
 
 #include media/v4l2-mediabus.h
 #include media/s5p_fimc.h
+#include media/s5p_hdmi.h
+
 #include media/m5mols.h
 
 #include common.h
@@ -997,6 +999,15 @@ static void __init universal_map_io(void)
s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
 }
 
+static struct i2c_board_info s5p_hdmiphy_info = {
+   I2C_BOARD_INFO(hdmiphy, 0x70  1),
+};
+
+static struct s5p_hdmi_platform_data s5p_hdmi_pdata = {
+   .hdmiphy_info = s5p_hdmiphy_info,
+   .hdmiphy_bus = 8,
+};
+
 void s5p_tv_setup(void)
 {
/* direct HPD to HDMI chip */
@@ -1004,6 +1015,9 @@ void s5p_tv_setup(void)
s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
 
+   /* setting platform data */
+   s5p_device_hdmi.dev.platform_data = s5p_hdmi_pdata;
+
/* setup dependencies between TV devices */
s5p_device_hdmi.dev.parent = exynos4_device_pd[PD_TV].dev;
s5p_device_mixer.dev.parent = exynos4_device_pd[PD_TV].dev;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ARM: Exynos4: enable TV support on Nuri board

2012-01-26 Thread Tomasz Stanislawski
This patch adds platform devices and regulators for TV devices on
Samsung Nuri board.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-exynos/Kconfig |2 +
 arch/arm/mach-exynos/mach-nuri.c |   99 ++
 2 files changed, 101 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 5d602f6..4cb5225 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -268,12 +268,14 @@ config MACH_NURI
select S3C_DEV_I2C1
select S3C_DEV_I2C3
select S3C_DEV_I2C5
+   select S5P_DEV_I2C_HDMIPHY
select S5P_DEV_CSIS0
select S5P_DEV_FIMC0
select S5P_DEV_FIMC1
select S5P_DEV_FIMC2
select S5P_DEV_FIMC3
select S5P_DEV_MFC
+   select S5P_DEV_TV
select S5P_DEV_USB_EHCI
select S5P_SETUP_MIPIPHY
select EXYNOS4_DEV_DMA
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index b895ec0..7d04844 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 
+#include linux/delay.h
 #include linux/platform_device.h
 #include linux/serial_core.h
 #include linux/input.h
@@ -29,6 +30,8 @@
 #include video/platform_lcd.h
 #include media/m5mols.h
 #include media/s5p_fimc.h
+#include media/s5p_hdmi.h
+#include media/sii9234.h
 #include media/v4l2-mediabus.h
 
 #include asm/mach/arch.h
@@ -75,6 +78,7 @@ enum fixed_regulator_id {
FIXED_REG_ID_MAX8903,
FIXED_REG_ID_CAM_A28V,
FIXED_REG_ID_CAM_12V,
+   FIXED_REG_ID_HDMI_EN,
 };
 
 static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
@@ -389,9 +393,12 @@ static void __init nuri_tsp_init(void)
 
 static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
REGULATOR_SUPPLY(vdd, s5p-adc), /* Used by CPU's ADC drv */
+   REGULATOR_SUPPLY(vdd_osc, exynos4-hdmi), /* HDMI */
 };
 static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
REGULATOR_SUPPLY(vdd11, s5p-mipi-csis.0), /* MIPI */
+   REGULATOR_SUPPLY(vdd, exynos4-hdmi), /* HDMI */
+   REGULATOR_SUPPLY(vdd_pll, exynos4-hdmi), /* HDMI */
 };
 static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
REGULATOR_SUPPLY(vdd18, s5p-mipi-csis.0), /* MIPI */
@@ -563,6 +570,51 @@ static struct regulator_init_data __initdata 
max8997_ldo7_data = {
.consumer_supplies  = max8997_ldo7_,
 };
 
+static struct regulator_consumer_supply hdmi_fixed_consumer[] = {
+   REGULATOR_SUPPLY(hdmi-en, exynos4-hdmi),
+   REGULATOR_SUPPLY(hdmi-en, 15-0039), /* sii9234 */
+};
+
+static struct regulator_init_data hdmi_fixed_voltage_init_data = {
+   .constraints= {
+   .name   = HDMI_5V,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .num_consumer_supplies  = ARRAY_SIZE(hdmi_fixed_consumer),
+   .consumer_supplies  = hdmi_fixed_consumer,
+};
+
+static struct fixed_voltage_config hdmi_fixed_voltage_config = {
+   .supply_name= HDMI_EN1,
+   .microvolts = 500,
+   .gpio   = EXYNOS4_GPX2(4),
+   .enable_high= true,
+   .init_data  = hdmi_fixed_voltage_init_data,
+};
+
+static struct platform_device hdmi_fixed_voltage = {
+   .name   = reg-fixed-voltage,
+   .id = FIXED_REG_ID_HDMI_EN,
+   .dev= {
+   .platform_data  = hdmi_fixed_voltage_config,
+   },
+};
+
+/* I2C-GPIO15: MHL */
+static struct i2c_gpio_platform_data i2c15_gpio_data = {
+   .sda_pin= EXYNOS4_GPY3(0),  /* XM0ADDR_0 */
+   .scl_pin= EXYNOS4_GPY3(2),  /* XM0ADDR_2 */
+   .udelay = 2,
+};
+
+static struct platform_device i2c15_gpio = {
+   .name   = i2c-gpio,
+   .id = 15,
+   .dev= {
+   .platform_data  = i2c15_gpio_data,
+   },
+};
+
 static struct regulator_init_data __initdata max8997_ldo8_data = {
.constraints= {
.name   = VUSB/VDAC_3.3V_C210,
@@ -1267,6 +1319,11 @@ static struct platform_device *nuri_devices[] __initdata 
= {
exynos4_device_pd[PD_LCD0],
exynos4_device_pd[PD_CAM],
s5p_device_fimc_md,
+   exynos4_device_pd[PD_TV],
+   hdmi_fixed_voltage,
+   s5p_device_i2c_hdmiphy,
+   s5p_device_hdmi,
+   s5p_device_mixer,
 
/* NURI Devices */
nuri_gpio_keys,
@@ -1276,6 +1333,7 @@ static struct platform_device *nuri_devices[] __initdata 
= {
nuri_max8903_device,
cam_vdda_fixed_rdev,
cam_8m_12v_fixed_rdev,
+   i2c15_gpio,
 };
 
 static void __init

Re: [PATCH RESEND] drivers: i2c: s3c2410: add support for HDMIPHY dedicated controller

2011-11-22 Thread Tomasz Stanislawski

Hello Ben,
Recently, I've been asked a few times for help with S5P-TV drivers.
The problems were caused by HDMIPHY driver. The driver failed due to the 
lack of i2c-s3c2410 patch. Merging the patch is needed for HDMI support 
for S5P platform.


What is the current state of the patch?
Is it going to be merged in 3.3?

Best regards,
Tomasz Stanislawski

On 10/11/2011 01:01 PM, Kukjin Kim wrote:

Marek Szyprowski wrote:


From: Tomasz Stanislawskit.stanisl...@samsung.com

This patch adds support for I2C HDMIPHY dedicated controller. It has
different timeout handling and reset conditions.

Signed-off-by: Tomasz Stanislawskit.stanisl...@samsung.com
Signed-off-by: Kyungmin Parkkyungmin.p...@samsung.com
Signed-off-by: Marek Szyprowskim.szyprow...@samsung.com


Acked-by: Kukjin Kimkgene@samsung.com

Hi Ben,

If you're ok with this, please apply this to go to upstream via your i2c
tree.

Thanks.

Best regards,
Kgene.
--


--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RESEND] drivers: i2c: s3c2410: add support for HDMIPHY dedicated controller

2011-11-22 Thread Tomasz Stanislawski

Hello Ben,
Recently, I've been asked a few times for help with S5P-TV drivers.
The problems were caused by HDMIPHY driver. The driver failed due to the 
lack of i2c-s3c2410 patch. Merging the patch is needed for HDMI support 
for S5P platform.


What is the current state of the patch?
Is it going to be merged in 3.3?

Best regards,
Tomasz Stanislawski

On 10/11/2011 01:01 PM, Kukjin Kim wrote:

Marek Szyprowski wrote:


From: Tomasz Stanislawskit.stanisl...@samsung.com

This patch adds support for I2C HDMIPHY dedicated controller. It has
different timeout handling and reset conditions.

Signed-off-by: Tomasz Stanislawskit.stanisl...@samsung.com
Signed-off-by: Kyungmin Parkkyungmin.p...@samsung.com
Signed-off-by: Marek Szyprowskim.szyprow...@samsung.com


Acked-by: Kukjin Kimkgene@samsung.com

Hi Ben,

If you're ok with this, please apply this to go to upstream via your i2c
tree.

Thanks.

Best regards,
Kgene.
--
Kukjin Kimkgene@samsung.com, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] ARM: Exynos4: enable TV support on Universal_C210 board

2011-10-07 Thread Tomasz Stanislawski

Hi Sachin Kamat,
The hdmi-en regulator was used to enable DC-DC converter(s).
The converters supply HDMI hardware or produce 5V for HDMI connector. 
According to Origen schematics 'DC5V' line is used to supply 5V to HDMI 
connector. Therefore regulator 'hdmi-en' refers to the regulator 
associated with 'DC5V' line. If the 'DC5V' regulator is not present in 
mach-origen.c (???) then 'hdmi-en' becomes a dummy regulator.


Try to enable REGULATOR_DUMMY in kernel config.

The regulator framework would associate a dummy regulator to 'hdmi-en' 
if it fails to find it.


I hope you find this information useful.

Best regards,
Tomasz Stanislawski


On 10/07/2011 12:00 PM, Sachin Kamat wrote:

Hi Tomasz,
What is the significance of hdmi-en as a regulator? Is this specific
to your board.
I am unable to relate the GPIO pin corresponding to it on Origen board.
Thanks and regards
Sachin

On 12 August 2011 15:15, Tomasz Stanislawski t.stanisl...@samsung.com
mailto:t.stanisl...@samsung.com wrote:

This patch adds platform devices and regulators for TV devices on
Samsung Universal C210 board.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
mailto:t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
mailto:kyungmin.p...@samsung.com
Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
mailto:m.szyprow...@samsung.com
---
  arch/arm/mach-exynos4/Kconfig   |2 +
  arch/arm/mach-exynos4/mach-universal_c210.c |   74
+++
  2 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/Kconfig
b/arch/arm/mach-exynos4/Kconfig
index 3ceefdb..144c05d 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -184,9 +184,11 @@ config MACH_UNIVERSAL_C210
select S3C_DEV_I2C1
select S3C_DEV_I2C3
select S3C_DEV_I2C5
+   select S5P_DEV_I2C_HDMIPHY
select S5P_DEV_MFC
select S5P_DEV_ONENAND
select EXYNOS4_DEV_PD
+   select S5P_DEV_TV
select EXYNOS4_SETUP_I2C1
select EXYNOS4_SETUP_I2C3
select EXYNOS4_SETUP_I2C5
diff --git a/arch/arm/mach-exynos4/mach-universal_c210.c
b/arch/arm/mach-exynos4/mach-universal_c210.c
index 0e280d1..e9dbe79 100644
--- a/arch/arm/mach-exynos4/mach-universal_c210.c
+++ b/arch/arm/mach-exynos4/mach-universal_c210.c
@@ -110,6 +110,9 @@ static struct regulator_consumer_supply
lp3974_buck1_consumer =
  static struct regulator_consumer_supply lp3974_buck2_consumer =
REGULATOR_SUPPLY(vddg3d, NULL);

+static struct regulator_consumer_supply lp3974_buck3_consumer =
+   REGULATOR_SUPPLY(vdet, s5p-sdo);
+
  static struct regulator_init_data lp3974_buck1_data = {
.constraints= {
.name   = VINT_1.1V,
@@ -153,6 +156,8 @@ static struct regulator_init_data
lp3974_buck3_data = {
.enabled= 1,
},
},
+   .num_consumer_supplies = 1,
+   .consumer_supplies = lp3974_buck3_consumer,
  };

  static struct regulator_init_data lp3974_buck4_data = {
@@ -181,6 +186,11 @@ static struct regulator_init_data
lp3974_ldo2_data = {
},
  };

+static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
+   REGULATOR_SUPPLY(vdd, exynos4-hdmi),
+   REGULATOR_SUPPLY(vdd_pll, exynos4-hdmi),
+};
+
  static struct regulator_init_data lp3974_ldo3_data = {
.constraints= {
.name   = VUSB+MIPI_1.1V,
@@ -192,6 +202,12 @@ static struct regulator_init_data
lp3974_ldo3_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo3_consumer),
+   .consumer_supplies = lp3974_ldo3_consumer,
+};
+
+static struct regulator_consumer_supply lp3974_ldo4_consumer[] = {
+   REGULATOR_SUPPLY(vdd_osc, exynos4-hdmi),
  };

  static struct regulator_init_data lp3974_ldo4_data = {
@@ -205,6 +221,8 @@ static struct regulator_init_data
lp3974_ldo4_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo4_consumer),
+   .consumer_supplies = lp3974_ldo4_consumer,
  };

  static struct regulator_init_data lp3974_ldo5_data = {
@@ -246,6 +264,10 @@ static struct regulator_init_data
lp3974_ldo7_data = {
},
  };

+static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
+   REGULATOR_SUPPLY(vdd33a_dac, s5p-sdo),
+};
+
  static struct regulator_init_data lp3974_ldo8_data = {
.constraints= {
.name

Re: [PATCH 1/2] ARM: EXYNOS4: Add TVOUT support for SMDKV310

2011-09-19 Thread Tomasz Stanislawski

Hi Hatim Ali,

On 08/26/2011 08:39 AM, Hatim Ali wrote:

Add support for TVOUT on SMDKV310 board.

Signed-off-by: Hatim Alihatim...@samsung.com
---
  arch/arm/mach-exynos4/Kconfig |2 ++
  arch/arm/mach-exynos4/mach-smdkv310.c |5 +
  2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index e6925de..4c399c0 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -139,6 +139,7 @@ config MACH_SMDKV310
select S3C_DEV_RTC
select S3C_DEV_WDT
select S3C_DEV_I2C1
+   select S5P_DEV_I2C_HDMIPHY
select S5P_DEV_MFC
select S3C_DEV_HSMMC
select S3C_DEV_HSMMC1
@@ -148,6 +149,7 @@ config MACH_SMDKV310
select EXYNOS4_DEV_AHCI
select SAMSUNG_DEV_KEYPAD
select EXYNOS4_DEV_PD
+   select S5P_DEV_TV
select SAMSUNG_DEV_PWM
select EXYNOS4_DEV_SYSMMU
select EXYNOS4_SETUP_FIMD0
diff --git a/arch/arm/mach-exynos4/mach-smdkv310.c 
b/arch/arm/mach-exynos4/mach-smdkv310.c
index 5f62b2b..8fdba16 100644
--- a/arch/arm/mach-exynos4/mach-smdkv310.c
+++ b/arch/arm/mach-exynos4/mach-smdkv310.c
@@ -173,6 +173,7 @@ static struct platform_device *smdkv310_devices[] 
__initdata = {
s3c_device_hsmmc2,
s3c_device_hsmmc3,
s3c_device_i2c1,
+   s5p_device_i2c_hdmiphy,
s3c_device_rtc,
s3c_device_wdt,
exynos4_device_ac97,
@@ -194,6 +195,8 @@ static struct platform_device *smdkv310_devices[] 
__initdata = {
samsung_asoc_idma,
smdkv310_smsc911x,
exynos4_device_ahci,
+   s5p_device_hdmi,
+   s5p_device_mixer,

I should add TV power domain device exynos4_device_pd[PD_TV]  here.

  };

  static void __init smdkv310_smsc911x_init(void)
@@ -254,6 +257,8 @@ static void __init smdkv310_machine_init(void)
s3c_sdhci2_set_platdata(smdkv310_hsmmc2_pdata);
s3c_sdhci3_set_platdata(smdkv310_hsmmc3_pdata);

+   s5p_i2c_hdmiphy_set_platdata(NULL);
+
You should set mixer's and hdmi's parents here to device for TV power 
domain.
You should also configure gpio for hot-plug detection. Please refer to 
function s5p_tv_setup

in arch/arm/mach-exynos4/mach-universal_c210.c:1012.

samsung_keypad_set_platdata(smdkv310_keypad_data);

samsung_bl_set(smdkv310_bl_gpio_info,smdkv310_bl_data);

I hope you find this information useful.

Best regards,
Tomasz Stanislawski
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/4] Updated s5p-tv platform definitions

2011-08-12 Thread Tomasz Stanislawski
Hello,

This patch series contains platform definitions for s5p-tv driver
rebased onto latest for-next branch (including generic GIC and clockdev
changes).

Changes since v3:
- vpll code was fixed and moved back to mach-dependant code
- changed naming from IIC to I2C

Changes since v2:
- moved vpll code to plat-s5p/clock-vpll.c

Changes since v1:
- renamed i2c8 to common i2c-hdmiphy
- moved common vpll code to plat-s5p/clock.c
- added check for pll locking
- various minor coding style fixes here and there

Best regards

Tomasz Stanislawski (4):
  ARM: Samsung: add i2c hdmiphy controller definitions
  ARM: S5P: add support for tv device
  ARM: Exynos4: enable TV support on Universal_C210 board
  ARM: S5PV210: enable TV support on GONI board

 arch/arm/mach-exynos4/Kconfig|2 +
 arch/arm/mach-exynos4/clock.c|  200 +-
 arch/arm/mach-exynos4/cpu.c  |2 +
 arch/arm/mach-exynos4/include/mach/i2c-hdmiphy.h |   16 ++
 arch/arm/mach-exynos4/include/mach/irqs.h|4 +
 arch/arm/mach-exynos4/include/mach/map.h |   12 ++
 arch/arm/mach-exynos4/include/mach/regs-pmu.h|6 +
 arch/arm/mach-exynos4/mach-universal_c210.c  |   74 
 arch/arm/mach-s5pv210/Kconfig|1 +
 arch/arm/mach-s5pv210/clock.c|  137 ++--
 arch/arm/mach-s5pv210/cpu.c  |4 +
 arch/arm/mach-s5pv210/include/mach/i2c-hdmiphy.h |   16 ++
 arch/arm/mach-s5pv210/include/mach/irqs.h|4 +-
 arch/arm/mach-s5pv210/include/mach/map.h |   13 ++
 arch/arm/mach-s5pv210/include/mach/regs-clock.h  |3 +-
 arch/arm/mach-s5pv210/mach-goni.c|9 +
 arch/arm/plat-s5p/Kconfig|   10 +
 arch/arm/plat-s5p/Makefile   |2 +
 arch/arm/plat-s5p/dev-i2c-hdmiphy.c  |   59 +++
 arch/arm/plat-s5p/dev-tv.c   |   98 +++
 arch/arm/plat-s5p/include/plat/pll.h |   14 ++-
 arch/arm/plat-samsung/include/plat/devs.h|6 +
 arch/arm/plat-samsung/include/plat/iic.h |1 +
 arch/arm/plat-samsung/include/plat/tv-core.h |   44 +
 24 files changed, 720 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/mach-exynos4/include/mach/i2c-hdmiphy.h
 create mode 100644 arch/arm/mach-s5pv210/include/mach/i2c-hdmiphy.h
 create mode 100644 arch/arm/plat-s5p/dev-i2c-hdmiphy.c
 create mode 100644 arch/arm/plat-s5p/dev-tv.c
 create mode 100644 arch/arm/plat-samsung/include/plat/tv-core.h

-- 
1.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] ARM: S5PV210: enable TV support on GONI board

2011-08-12 Thread Tomasz Stanislawski
This patch adds platform devices and regulators for TV devices on
Samsung Goni board.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
---
 arch/arm/mach-s5pv210/Kconfig |1 +
 arch/arm/mach-s5pv210/mach-goni.c |9 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 69dd87c..ab6a87c 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -94,6 +94,7 @@ config MACH_GONI
select S3C_DEV_USB_HSOTG
select S5P_DEV_ONENAND
select SAMSUNG_DEV_KEYPAD
+   select S5P_DEV_TV
select S5PV210_SETUP_FB_24BPP
select S5PV210_SETUP_I2C1
select S5PV210_SETUP_I2C2
diff --git a/arch/arm/mach-s5pv210/mach-goni.c 
b/arch/arm/mach-s5pv210/mach-goni.c
index 85c2d51..14578f5 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -285,6 +285,7 @@ static struct regulator_consumer_supply 
goni_ldo5_consumers[] = {
 
 static struct regulator_consumer_supply goni_ldo8_consumers[] = {
REGULATOR_SUPPLY(vusb_d, s3c-hsotg),
+   REGULATOR_SUPPLY(vdd33a_dac, s5p-sdo),
 };
 
 static struct regulator_consumer_supply goni_ldo11_consumers[] = {
@@ -475,6 +476,10 @@ static struct regulator_consumer_supply buck1_consumer =
 static struct regulator_consumer_supply buck2_consumer =
REGULATOR_SUPPLY(vddint, NULL);
 
+static struct regulator_consumer_supply buck3_consumer =
+   REGULATOR_SUPPLY(vdet, s5p-sdo);
+
+
 static struct regulator_init_data goni_buck1_data = {
.constraints= {
.name   = VARM_1.2V,
@@ -511,6 +516,8 @@ static struct regulator_init_data goni_buck3_data = {
.enabled = 1,
},
},
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = buck3_consumer,
 };
 
 static struct regulator_init_data goni_buck4_data = {
@@ -812,6 +819,8 @@ static struct platform_device *goni_devices[] __initdata = {
s5p_device_mfc,
s5p_device_mfc_l,
s5p_device_mfc_r,
+   s5p_device_mixer,
+   s5p_device_sdo,
s3c_device_i2c0,
s5p_device_fimc0,
s5p_device_fimc1,
-- 
1.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] ARM: Exynos4: enable TV support on Universal_C210 board

2011-08-12 Thread Tomasz Stanislawski
This patch adds platform devices and regulators for TV devices on
Samsung Universal C210 board.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
---
 arch/arm/mach-exynos4/Kconfig   |2 +
 arch/arm/mach-exynos4/mach-universal_c210.c |   74 +++
 2 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index 3ceefdb..144c05d 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -184,9 +184,11 @@ config MACH_UNIVERSAL_C210
select S3C_DEV_I2C1
select S3C_DEV_I2C3
select S3C_DEV_I2C5
+   select S5P_DEV_I2C_HDMIPHY
select S5P_DEV_MFC
select S5P_DEV_ONENAND
select EXYNOS4_DEV_PD
+   select S5P_DEV_TV
select EXYNOS4_SETUP_I2C1
select EXYNOS4_SETUP_I2C3
select EXYNOS4_SETUP_I2C5
diff --git a/arch/arm/mach-exynos4/mach-universal_c210.c 
b/arch/arm/mach-exynos4/mach-universal_c210.c
index 0e280d1..e9dbe79 100644
--- a/arch/arm/mach-exynos4/mach-universal_c210.c
+++ b/arch/arm/mach-exynos4/mach-universal_c210.c
@@ -110,6 +110,9 @@ static struct regulator_consumer_supply 
lp3974_buck1_consumer =
 static struct regulator_consumer_supply lp3974_buck2_consumer =
REGULATOR_SUPPLY(vddg3d, NULL);
 
+static struct regulator_consumer_supply lp3974_buck3_consumer =
+   REGULATOR_SUPPLY(vdet, s5p-sdo);
+
 static struct regulator_init_data lp3974_buck1_data = {
.constraints= {
.name   = VINT_1.1V,
@@ -153,6 +156,8 @@ static struct regulator_init_data lp3974_buck3_data = {
.enabled= 1,
},
},
+   .num_consumer_supplies = 1,
+   .consumer_supplies = lp3974_buck3_consumer,
 };
 
 static struct regulator_init_data lp3974_buck4_data = {
@@ -181,6 +186,11 @@ static struct regulator_init_data lp3974_ldo2_data = {
},
 };
 
+static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
+   REGULATOR_SUPPLY(vdd, exynos4-hdmi),
+   REGULATOR_SUPPLY(vdd_pll, exynos4-hdmi),
+};
+
 static struct regulator_init_data lp3974_ldo3_data = {
.constraints= {
.name   = VUSB+MIPI_1.1V,
@@ -192,6 +202,12 @@ static struct regulator_init_data lp3974_ldo3_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo3_consumer),
+   .consumer_supplies = lp3974_ldo3_consumer,
+};
+
+static struct regulator_consumer_supply lp3974_ldo4_consumer[] = {
+   REGULATOR_SUPPLY(vdd_osc, exynos4-hdmi),
 };
 
 static struct regulator_init_data lp3974_ldo4_data = {
@@ -205,6 +221,8 @@ static struct regulator_init_data lp3974_ldo4_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo4_consumer),
+   .consumer_supplies = lp3974_ldo4_consumer,
 };
 
 static struct regulator_init_data lp3974_ldo5_data = {
@@ -246,6 +264,10 @@ static struct regulator_init_data lp3974_ldo7_data = {
},
 };
 
+static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
+   REGULATOR_SUPPLY(vdd33a_dac, s5p-sdo),
+};
+
 static struct regulator_init_data lp3974_ldo8_data = {
.constraints= {
.name   = VUSB+VDAC_3.3V,
@@ -257,6 +279,8 @@ static struct regulator_init_data lp3974_ldo8_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo8_consumer),
+   .consumer_supplies = lp3974_ldo8_consumer,
 };
 
 static struct regulator_init_data lp3974_ldo9_data = {
@@ -472,6 +496,34 @@ static struct max8998_platform_data universal_lp3974_pdata 
= {
.wakeup = true,
 };
 
+static struct regulator_consumer_supply hdmi_fixed_consumer =
+   REGULATOR_SUPPLY(hdmi-en, exynos4-hdmi);
+
+static struct regulator_init_data hdmi_fixed_voltage_init_data = {
+   .constraints= {
+   .name   = HDMI_5V,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = hdmi_fixed_consumer,
+};
+
+static struct fixed_voltage_config hdmi_fixed_voltage_config = {
+   .supply_name= HDMI_EN1,
+   .microvolts = 500,
+   .gpio   = EXYNOS4_GPE0(1),
+   .enable_high= true,
+   .init_data  = hdmi_fixed_voltage_init_data,
+};
+
+static struct platform_device hdmi_fixed_voltage = {
+   .name   = reg-fixed-voltage,
+   .id = 6,
+   .dev= {
+   .platform_data  = hdmi_fixed_voltage_config,
+   },
+};
+
 /* GPIO I2C 5 (PMIC

[PATCH 1/4] ARM: Samsung: add i2c hdmiphy controller definitions

2011-08-12 Thread Tomasz Stanislawski
This patch adds hdmiphy dedicated i2c controller definitions.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
[m.szyprowski: renamed to i2c-hdmiphy and squashed Exynos4 and S5PV210 patches]
Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
---
 arch/arm/mach-exynos4/clock.c|6 ++
 arch/arm/mach-exynos4/include/mach/i2c-hdmiphy.h |   16 ++
 arch/arm/mach-exynos4/include/mach/irqs.h|2 +
 arch/arm/mach-exynos4/include/mach/map.h |4 ++
 arch/arm/mach-s5pv210/clock.c|6 ++
 arch/arm/mach-s5pv210/include/mach/i2c-hdmiphy.h |   16 ++
 arch/arm/mach-s5pv210/include/mach/irqs.h|2 +-
 arch/arm/mach-s5pv210/include/mach/map.h |3 +
 arch/arm/plat-s5p/Kconfig|5 ++
 arch/arm/plat-s5p/Makefile   |1 +
 arch/arm/plat-s5p/dev-i2c-hdmiphy.c  |   59 ++
 arch/arm/plat-samsung/include/plat/devs.h|1 +
 arch/arm/plat-samsung/include/plat/iic.h |1 +
 13 files changed, 121 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-exynos4/include/mach/i2c-hdmiphy.h
 create mode 100644 arch/arm/mach-s5pv210/include/mach/i2c-hdmiphy.h
 create mode 100644 arch/arm/plat-s5p/dev-i2c-hdmiphy.c

diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 851dea0..953bdad 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -581,6 +581,12 @@ static struct clk init_clocks_off[] = {
.enable = exynos4_clk_ip_peril_ctrl,
.ctrlbit= (1  13),
}, {
+   .name   = i2c,
+   .devname= s3c2440-hdmiphy-i2c,
+   .parent = clk_aclk_100.clk,
+   .enable = exynos4_clk_ip_peril_ctrl,
+   .ctrlbit= (1  14),
+   }, {
.name   = SYSMMU_MDMA,
.enable = exynos4_clk_ip_image_ctrl,
.ctrlbit= (1  5),
diff --git a/arch/arm/mach-exynos4/include/mach/i2c-hdmiphy.h 
b/arch/arm/mach-exynos4/include/mach/i2c-hdmiphy.h
new file mode 100644
index 000..9dbe317
--- /dev/null
+++ b/arch/arm/mach-exynos4/include/mach/i2c-hdmiphy.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics Co., Ltd.
+ *
+ * S5P series i2c hdmiphy helper definitions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef PLAT_S5P_I2C_HDMIPHY_H_
+#define PLAT_S5P_I2C_HDMIPHY_H_
+
+#define S5P_I2C_HDMIPHY_BUS_NUM(8)
+
+#endif
diff --git a/arch/arm/mach-exynos4/include/mach/irqs.h 
b/arch/arm/mach-exynos4/include/mach/irqs.h
index 934d2a4..c56645f 100644
--- a/arch/arm/mach-exynos4/include/mach/irqs.h
+++ b/arch/arm/mach-exynos4/include/mach/irqs.h
@@ -94,6 +94,8 @@
 #define IRQ_2D IRQ_SPI(89)
 #define IRQ_PCIE   IRQ_SPI(90)
 
+#define IRQ_IIC_HDMIPHYIRQ_SPI(93)
+
 #define IRQ_MFCIRQ_SPI(94)
 
 #define IRQ_AUDIO_SS   IRQ_SPI(96)
diff --git a/arch/arm/mach-exynos4/include/mach/map.h 
b/arch/arm/mach-exynos4/include/mach/map.h
index d32296d..380feb9 100644
--- a/arch/arm/mach-exynos4/include/mach/map.h
+++ b/arch/arm/mach-exynos4/include/mach/map.h
@@ -112,6 +112,8 @@
 
 #define EXYNOS4_PA_UART0x1380
 
+#define EXYNOS4_PA_IIC_HDMIPHY 0x138E
+
 #define EXYNOS4_PA_IIC(x)  (0x1386 + ((x) * 0x1))
 
 #define EXYNOS4_PA_ADC 0x1391
@@ -161,6 +163,8 @@
 #define S5P_PA_TIMER   EXYNOS4_PA_TIMER
 #define S5P_PA_EHCIEXYNOS4_PA_EHCI
 
+#define S5P_PA_IIC_HDMIPHY EXYNOS4_PA_IIC_HDMIPHY
+
 #define SAMSUNG_PA_KEYPAD  EXYNOS4_PA_KEYPAD
 
 /* UART */
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index 52a8e60..90a1966 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -407,6 +407,12 @@ static struct clk init_clocks_off[] = {
.enable = s5pv210_clk_ip3_ctrl,
.ctrlbit= (19),
}, {
+   .name   = i2c,
+   .devname= s3c2440-hdmiphy-i2c,
+   .parent = clk_pclk_psys.clk,
+   .enable = s5pv210_clk_ip3_ctrl,
+   .ctrlbit= (1  11),
+   }, {
.name   = spi,
.devname= s3c64xx-spi.0,
.parent = clk_pclk_psys.clk,
diff --git a/arch/arm/mach-s5pv210/include/mach/i2c-hdmiphy.h 
b/arch/arm/mach-s5pv210/include/mach/i2c-hdmiphy.h
new file mode 100644
index 000..6afa624
--- /dev/null
+++ b/arch/arm/mach

[PATCH 2/4] ARM: S5P: add support for tv device

2011-08-12 Thread Tomasz Stanislawski
This patch adds all the resources for TV drivers and devices for Samsung
Exynos4 and S5PV210 platforms.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
[m.szyprowski: squashed Exynos4 and S5PV210 patches and rewrote commit message]
Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
---
 arch/arm/mach-exynos4/clock.c   |  194 ++-
 arch/arm/mach-exynos4/cpu.c |2 +
 arch/arm/mach-exynos4/include/mach/irqs.h   |4 +-
 arch/arm/mach-exynos4/include/mach/map.h|8 +
 arch/arm/mach-exynos4/include/mach/regs-pmu.h   |6 +
 arch/arm/mach-s5pv210/clock.c   |  131 ++--
 arch/arm/mach-s5pv210/cpu.c |4 +
 arch/arm/mach-s5pv210/include/mach/irqs.h   |2 +-
 arch/arm/mach-s5pv210/include/mach/map.h|   10 ++
 arch/arm/mach-s5pv210/include/mach/regs-clock.h |3 +-
 arch/arm/plat-s5p/Kconfig   |5 +
 arch/arm/plat-s5p/Makefile  |1 +
 arch/arm/plat-s5p/dev-tv.c  |   98 
 arch/arm/plat-s5p/include/plat/pll.h|   14 ++-
 arch/arm/plat-samsung/include/plat/devs.h   |5 +
 arch/arm/plat-samsung/include/plat/tv-core.h|   44 +
 16 files changed, 514 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/plat-s5p/dev-tv.c
 create mode 100644 arch/arm/plat-samsung/include/plat/tv-core.h

diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 953bdad..53e333b 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -83,6 +83,11 @@ static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int 
enable)
return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable);
 }
 
+static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKSRC_MASK_TV, clk, enable);
+}
+
 static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
 {
return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
@@ -123,6 +128,16 @@ static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int 
enable)
return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
 }
 
+static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
+}
+
+static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
+}
+
 /* Core list of CMU_CPU side */
 
 static struct clksrc_clk clk_mout_apll = {
@@ -449,6 +464,36 @@ static struct clk init_clocks_off[] = {
.enable = exynos4_clk_ip_fsys_ctrl,
.ctrlbit= (1  9),
}, {
+   .name   = dac,
+   .devname= s5p-sdo,
+   .enable = exynos4_clk_ip_tv_ctrl,
+   .ctrlbit= (1  2),
+   }, {
+   .name   = mixer,
+   .devname= s5p-mixer,
+   .enable = exynos4_clk_ip_tv_ctrl,
+   .ctrlbit= (1  1),
+   }, {
+   .name   = vp,
+   .devname= s5p-mixer,
+   .enable = exynos4_clk_ip_tv_ctrl,
+   .ctrlbit= (1  0),
+   }, {
+   .name   = hdmi,
+   .devname= exynos4-hdmi,
+   .enable = exynos4_clk_ip_tv_ctrl,
+   .ctrlbit= (1  3),
+   }, {
+   .name   = hdmiphy,
+   .devname= exynos4-hdmi,
+   .enable = exynos4_clk_hdmiphy_ctrl,
+   .ctrlbit= (1  0),
+   }, {
+   .name   = dacphy,
+   .devname= s5p-sdo,
+   .enable = exynos4_clk_dac_ctrl,
+   .ctrlbit= (1  0),
+   }, {
.name   = sata,
.parent = clk_aclk_133.clk,
.enable = exynos4_clk_ip_fsys_ctrl,
@@ -788,6 +833,81 @@ static struct clksrc_sources clkset_mout_mfc = {
.nr_sources = ARRAY_SIZE(clkset_mout_mfc_list),
 };
 
+static struct clk *clkset_sclk_dac_list[] = {
+   [0] = clk_sclk_vpll.clk,
+   [1] = clk_sclk_hdmiphy,
+};
+
+static struct clksrc_sources clkset_sclk_dac = {
+   .sources= clkset_sclk_dac_list,
+   .nr_sources = ARRAY_SIZE(clkset_sclk_dac_list),
+};
+
+static struct clksrc_clk clk_sclk_dac = {
+   .clk= {
+   .name   = sclk_dac,
+   .enable = exynos4_clksrc_mask_tv_ctrl,
+   .ctrlbit= (1  8),
+   },
+   .sources = clkset_sclk_dac,
+   .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 8, .size = 1 },
+};
+
+static struct clksrc_clk clk_sclk_pixel = {
+   .clk= {
+   .name

[PATCH v4 4/9] arm: s5pv210: i2c: add controller 3 (HDMIPHY)

2011-05-25 Thread Tomasz Stanislawski
Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-s5pv210/Kconfig |7 ++
 arch/arm/mach-s5pv210/Makefile|1 +
 arch/arm/mach-s5pv210/clock.c |6 +
 arch/arm/mach-s5pv210/cpu.c   |2 +
 arch/arm/mach-s5pv210/include/mach/map.h  |2 +
 arch/arm/mach-s5pv210/setup-i2c3.c|   27 +
 arch/arm/plat-samsung/include/plat/iic-core.h |7 ++
 7 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv210/setup-i2c3.c

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 37b5a97..7e73ae8 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -28,6 +28,11 @@ config S5PV210_SETUP_I2C2
help
  Common setup code for i2c bus 2.
 
+config S5PV210_SETUP_I2C3
+   bool
+   help
+ Common setup code for i2c bus 3.
+
 config S5PV210_SETUP_IDE
bool
help
@@ -90,12 +95,14 @@ config MACH_GONI
select S3C_DEV_HSMMC2
select S3C_DEV_I2C1
select S3C_DEV_I2C2
+   select S3C_DEV_I2C3
select S3C_DEV_USB_HSOTG
select S5P_DEV_ONENAND
select SAMSUNG_DEV_KEYPAD
select S5PV210_SETUP_FB_24BPP
select S5PV210_SETUP_I2C1
select S5PV210_SETUP_I2C2
+   select S5PV210_SETUP_I2C3
select S5PV210_SETUP_KEYPAD
select S5PV210_SETUP_SDHCI
help
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 11f1790..2bcf782 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_S5PV210_SETUP_FB_24BPP)  += setup-fb-24bpp.o
 obj-$(CONFIG_S5PV210_SETUP_FIMC)   += setup-fimc.o
 obj-$(CONFIG_S5PV210_SETUP_I2C1)   += setup-i2c1.o
 obj-$(CONFIG_S5PV210_SETUP_I2C2)   += setup-i2c2.o
+obj-$(CONFIG_S5PV210_SETUP_I2C3)   += setup-i2c3.o
 obj-$(CONFIG_S5PV210_SETUP_IDE)+= setup-ide.o
 obj-$(CONFIG_S5PV210_SETUP_KEYPAD) += setup-keypad.o
 obj-$(CONFIG_S5PV210_SETUP_SDHCI)   += setup-sdhci.o
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index 2d59949..db4eee7 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -431,6 +431,12 @@ static struct clk init_clocks_off[] = {
.enable = s5pv210_clk_ip3_ctrl,
.ctrlbit= (19),
}, {
+   .name   = i2c,
+   .id = 3,
+   .parent = clk_pclk_psys.clk,
+   .enable = s5pv210_clk_ip3_ctrl,
+   .ctrlbit= (1  11),
+   }, {
.name   = spi,
.id = 0,
.parent = clk_pclk_psys.clk,
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c
index 61e6c24..61ea36e 100644
--- a/arch/arm/mach-s5pv210/cpu.c
+++ b/arch/arm/mach-s5pv210/cpu.c
@@ -130,6 +130,8 @@ void __init s5pv210_map_io(void)
 
s3c_cfcon_setname(s5pv210-pata);
 
+   s3c_i2c3_setname(s3c2440-hdmiphy-i2c);
+
s3c_fimc_setname(0, s5pv210-fimc);
s3c_fimc_setname(1, s5pv210-fimc);
s3c_fimc_setname(2, s5pv210-fimc);
diff --git a/arch/arm/mach-s5pv210/include/mach/map.h 
b/arch/arm/mach-s5pv210/include/mach/map.h
index 1dd5883..f6bb269 100644
--- a/arch/arm/mach-s5pv210/include/mach/map.h
+++ b/arch/arm/mach-s5pv210/include/mach/map.h
@@ -41,6 +41,7 @@
 #define S5PV210_PA_IIC00xE180
 #define S5PV210_PA_IIC10xFAB0
 #define S5PV210_PA_IIC20xE1A0
+#define S5PV210_PA_IIC30xFA90
 
 #define S5PV210_PA_AC970xE220
 
@@ -98,6 +99,7 @@
 #define S3C_PA_IIC S5PV210_PA_IIC0
 #define S3C_PA_IIC1S5PV210_PA_IIC1
 #define S3C_PA_IIC2S5PV210_PA_IIC2
+#define S3C_PA_IIC3S5PV210_PA_IIC3
 #define S3C_PA_RTC S5PV210_PA_RTC
 #define S3C_PA_USB_HSOTG   S5PV210_PA_HSOTG
 #define S3C_PA_WDT S5PV210_PA_WATCHDOG
diff --git a/arch/arm/mach-s5pv210/setup-i2c3.c 
b/arch/arm/mach-s5pv210/setup-i2c3.c
new file mode 100644
index 000..b77de7a
--- /dev/null
+++ b/arch/arm/mach-s5pv210/setup-i2c3.c
@@ -0,0 +1,27 @@
+/* linux/arch/arm/mach-s5pv210/setup-i2c3.c
+ *
+ * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * I2C3 GPIO configuration.
+ *
+ * based on linux/arch/arm/mach-s5pv210/setup-i2c2.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include linux/kernel.h

[PATCH v4 3/9] arm: exynos4: i2c: add controller 8 (HDMIPHY)

2011-05-25 Thread Tomasz Stanislawski
Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-exynos4/clock.c |6 ++
 arch/arm/mach-exynos4/cpu.c   |3 +
 arch/arm/mach-exynos4/include/mach/irqs.h |4 ++
 arch/arm/mach-exynos4/include/mach/map.h  |1 +
 arch/arm/plat-samsung/Kconfig |5 ++
 arch/arm/plat-samsung/Makefile|1 +
 arch/arm/plat-samsung/dev-i2c8.c  |   68 +
 arch/arm/plat-samsung/include/plat/devs.h |1 +
 arch/arm/plat-samsung/include/plat/iic-core.h |7 +++
 arch/arm/plat-samsung/include/plat/iic.h  |1 +
 10 files changed, 97 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/dev-i2c8.c

diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 871f9d5..035eacc 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -614,6 +614,12 @@ static struct clk init_clocks_off[] = {
.enable = exynos4_clk_ip_peril_ctrl,
.ctrlbit= (1  13),
}, {
+   .name   = i2c,
+   .id = 8,
+   .parent = clk_aclk_100.clk,
+   .enable = exynos4_clk_ip_peril_ctrl,
+   .ctrlbit= (1  14),
+   }, {
.name   = SYSMMU_MDMA,
.id = -1,
.enable = exynos4_clk_ip_image_ctrl,
diff --git a/arch/arm/mach-exynos4/cpu.c b/arch/arm/mach-exynos4/cpu.c
index 7930113..52b145e 100644
--- a/arch/arm/mach-exynos4/cpu.c
+++ b/arch/arm/mach-exynos4/cpu.c
@@ -23,6 +23,7 @@
 #include plat/sdhci.h
 #include plat/devs.h
 #include plat/fimc-core.h
+#include plat/iic-core.h
 
 #include mach/regs-irq.h
 
@@ -123,6 +124,8 @@ void __init exynos4_map_io(void)
exynos4_default_sdhci2();
exynos4_default_sdhci3();
 
+   s3c_i2c8_setname(s3c2440-hdmiphy-i2c);
+
s3c_fimc_setname(0, exynos4-fimc);
s3c_fimc_setname(1, exynos4-fimc);
s3c_fimc_setname(2, exynos4-fimc);
diff --git a/arch/arm/mach-exynos4/include/mach/irqs.h 
b/arch/arm/mach-exynos4/include/mach/irqs.h
index 5d03730..7e9eb1c 100644
--- a/arch/arm/mach-exynos4/include/mach/irqs.h
+++ b/arch/arm/mach-exynos4/include/mach/irqs.h
@@ -76,6 +76,9 @@
 #define IRQ_PDMA0  COMBINER_IRQ(21, 0)
 #define IRQ_PDMA1  COMBINER_IRQ(21, 1)
 
+#define IRQ_HDMI   COMBINER_IRQ(16, 0)
+#define IRQ_HDMI_I2C   COMBINER_IRQ(16, 1)
+
 #define IRQ_TIMER0_VIC COMBINER_IRQ(22, 0)
 #define IRQ_TIMER1_VIC COMBINER_IRQ(22, 1)
 #define IRQ_TIMER2_VIC COMBINER_IRQ(22, 2)
@@ -102,6 +105,7 @@
 #define IRQ_IIC5   COMBINER_IRQ(27, 5)
 #define IRQ_IIC6   COMBINER_IRQ(27, 6)
 #define IRQ_IIC7   COMBINER_IRQ(27, 7)
+#define IRQ_IIC8   IRQ_HDMI_I2C
 
 #define IRQ_HSMMC0 COMBINER_IRQ(29, 0)
 #define IRQ_HSMMC1 COMBINER_IRQ(29, 1)
diff --git a/arch/arm/mach-exynos4/include/mach/map.h 
b/arch/arm/mach-exynos4/include/mach/map.h
index 6330b73..263f38b 100644
--- a/arch/arm/mach-exynos4/include/mach/map.h
+++ b/arch/arm/mach-exynos4/include/mach/map.h
@@ -127,6 +127,7 @@
 #define S3C_PA_IIC5EXYNOS4_PA_IIC(5)
 #define S3C_PA_IIC6EXYNOS4_PA_IIC(6)
 #define S3C_PA_IIC7EXYNOS4_PA_IIC(7)
+#define S3C_PA_IIC8EXYNOS4_PA_IIC(8)
 #define S3C_PA_RTC EXYNOS4_PA_RTC
 #define S3C_PA_WDT EXYNOS4_PA_WATCHDOG
 
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index be72100..c764227 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -211,6 +211,11 @@ config S3C_DEV_I2C7
help
  Compile in platform device definition for I2C controller 7
 
+config S3C_DEV_I2C8
+   bool
+   help
+ Compile in platform device definitions for I2C channel 8 (HDMIPHY)
+
 config S3C_DEV_FB
bool
help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index e9de58a..752df43 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_S3C_DEV_I2C4)+= dev-i2c4.o
 obj-$(CONFIG_S3C_DEV_I2C5) += dev-i2c5.o
 obj-$(CONFIG_S3C_DEV_I2C6) += dev-i2c6.o
 obj-$(CONFIG_S3C_DEV_I2C7) += dev-i2c7.o
+obj-$(CONFIG_S3C_DEV_I2C8) += dev-i2c8.o
 obj-$(CONFIG_S3C_DEV_FB)   += dev-fb.o
 obj-y  += dev-uart.o
 obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o
diff --git a/arch/arm/plat-samsung/dev-i2c8.c b/arch/arm/plat-samsung/dev-i2c8.c
new file mode 100644
index 000..1a4a4aa
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c8.c
@@ -0,0 +1,68 @@
+/* linux/arch/arm/plat-samsung/dev-i2c7.c
+ *
+ * Copyright

[PATCH v4 1/9] arm: exynos4: pd: fixes block gating and code cleanup

2011-05-25 Thread Tomasz Stanislawski
This patch extends power domain driver with support for enabling and
disabling modules in S5P_CLKGATE_BLOCK register. It also performs a
little code cleanup to avoid confusion between exynos4_device_pd array
index and power domain id.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
---
 arch/arm/mach-exynos4/dev-pd.c  |   93 +--
 arch/arm/mach-exynos4/include/mach/regs-clock.h |7 ++
 arch/arm/plat-samsung/include/plat/pd.h |1 +
 3 files changed, 79 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-exynos4/dev-pd.c b/arch/arm/mach-exynos4/dev-pd.c
index 3273f25..44c6597 100644
--- a/arch/arm/mach-exynos4/dev-pd.c
+++ b/arch/arm/mach-exynos4/dev-pd.c
@@ -16,13 +16,17 @@
 #include linux/delay.h
 
 #include mach/regs-pmu.h
+#include mach/regs-clock.h
 
 #include plat/pd.h
 
+static DEFINE_SPINLOCK(gate_block_slock);
+
 static int exynos4_pd_enable(struct device *dev)
 {
struct samsung_pd_info *pdata =  dev-platform_data;
u32 timeout;
+   int ret = 0;
 
__raw_writel(S5P_INT_LOCAL_PWR_EN, pdata-base);
 
@@ -31,21 +35,39 @@ static int exynos4_pd_enable(struct device *dev)
while ((__raw_readl(pdata-base + 0x4)  S5P_INT_LOCAL_PWR_EN)
!= S5P_INT_LOCAL_PWR_EN) {
if (timeout == 0) {
-   printk(KERN_ERR Power domain %s enable failed.\n,
-   dev_name(dev));
-   return -ETIMEDOUT;
+   dev_err(dev, enable failed\n);
+   ret = -ETIMEDOUT;
+   goto done;
}
timeout--;
udelay(100);
}
 
-   return 0;
+   /* configure clk gate mask if it is present */
+   if (pdata-gate_mask) {
+   unsigned long flags;
+   unsigned long value;
+
+   spin_lock_irqsave(gate_block_slock, flags);
+
+   value  = __raw_readl(S5P_CLKGATE_BLOCK);
+   value |= pdata-gate_mask;
+   __raw_writel(value, S5P_CLKGATE_BLOCK);
+
+   spin_unlock_irqrestore(gate_block_slock, flags);
+   }
+
+done:
+   dev_info(dev, enable finished\n);
+
+   return ret;
 }
 
 static int exynos4_pd_disable(struct device *dev)
 {
struct samsung_pd_info *pdata =  dev-platform_data;
u32 timeout;
+   int ret = 0;
 
__raw_writel(0, pdata-base);
 
@@ -53,81 +75,108 @@ static int exynos4_pd_disable(struct device *dev)
timeout = 10;
while (__raw_readl(pdata-base + 0x4)  S5P_INT_LOCAL_PWR_EN) {
if (timeout == 0) {
-   printk(KERN_ERR Power domain %s disable failed.\n,
-   dev_name(dev));
-   return -ETIMEDOUT;
+   dev_err(dev, disable failed\n);
+   ret = -ETIMEDOUT;
+   goto done;
}
timeout--;
udelay(100);
}
 
-   return 0;
+   if (pdata-gate_mask) {
+   unsigned long flags;
+   unsigned long value;
+
+   spin_lock_irqsave(gate_block_slock, flags);
+
+   value  = __raw_readl(S5P_CLKGATE_BLOCK);
+   value = ~pdata-gate_mask;
+   __raw_writel(value, S5P_CLKGATE_BLOCK);
+
+   spin_unlock_irqrestore(gate_block_slock, flags);
+   }
+done:
+   dev_info(dev, disable finished\n);
+
+   return ret;
 }
 
 struct platform_device exynos4_device_pd[] = {
-   {
+   [PD_MFC] = {
.name   = samsung-pd,
-   .id = 0,
+   .id = PD_MFC,
.dev = {
.platform_data = (struct samsung_pd_info) {
.enable = exynos4_pd_enable,
.disable= exynos4_pd_disable,
.base   = S5P_PMU_MFC_CONF,
+   .gate_mask  = S5P_CLKGATE_BLOCK_MFC,
},
},
-   }, {
+   },
+   [PD_G3D] = {
.name   = samsung-pd,
-   .id = 1,
+   .id = PD_G3D,
.dev = {
.platform_data = (struct samsung_pd_info) {
.enable = exynos4_pd_enable,
.disable= exynos4_pd_disable,
.base   = S5P_PMU_G3D_CONF,
+   .gate_mask  = S5P_CLKGATE_BLOCK_G3D,
},
},
-   }, {
+   },
+   [PD_LCD0] = {
.name   = samsung-pd,
-   .id = 2

[PATCH v4 2/9] i2c-s3c2410: fix I2C dedicated for hdmiphy

2011-05-25 Thread Tomasz Stanislawski
The I2C HDMIPHY dedicated controller has different timeout
handling and reset conditions.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/i2c/busses/i2c-s3c2410.c |   36 +++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 6c00c10..99cfe2f 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -54,6 +54,7 @@ enum s3c24xx_i2c_state {
 enum s3c24xx_i2c_type {
TYPE_S3C2410,
TYPE_S3C2440,
+   TYPE_S3C2440_HDMIPHY,
 };
 
 struct s3c24xx_i2c {
@@ -96,7 +97,21 @@ static inline int s3c24xx_i2c_is2440(struct s3c24xx_i2c *i2c)
enum s3c24xx_i2c_type type;
 
type = platform_get_device_id(pdev)-driver_data;
-   return type == TYPE_S3C2440;
+   return type == TYPE_S3C2440 || type == TYPE_S3C2440_HDMIPHY;
+}
+
+/* s3c24xx_i2c_is2440_hdmiphy()
+ *
+ * return true is this is an s3c2440 dedicated for HDMIPHY interface
+*/
+
+static inline int s3c24xx_i2c_is2440_hdmiphy(struct s3c24xx_i2c *i2c)
+{
+   struct platform_device *pdev = to_platform_device(i2c-dev);
+   enum s3c24xx_i2c_type type;
+
+   type = platform_get_device_id(pdev)-driver_data;
+   return type == TYPE_S3C2440_HDMIPHY;
 }
 
 /* s3c24xx_i2c_master_complete
@@ -461,6 +476,13 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
unsigned long iicstat;
int timeout = 400;
 
+   /* if hang-up of HDMIPHY occured reduce timeout
+* The controller will work after reset, so waiting
+* 400 ms will cause unneccessary system hangup
+*/
+   if (s3c24xx_i2c_is2440_hdmiphy(i2c))
+   timeout = 10;
+
while (timeout--  0) {
iicstat = readl(i2c-regs + S3C2410_IICSTAT);
 
@@ -470,6 +492,15 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
msleep(1);
}
 
+   /* hang-up of bus dedicated for HDMIPHY occured, resetting */
+   if (s3c24xx_i2c_is2440_hdmiphy(i2c)) {
+   writel(0, i2c-regs + S3C2410_IICCON);
+   writel(0, i2c-regs + S3C2410_IICSTAT);
+   writel(0, i2c-regs + S3C2410_IICDS);
+
+   return 0;
+   }
+
return -ETIMEDOUT;
 }
 
@@ -1009,6 +1040,9 @@ static struct platform_device_id s3c24xx_driver_ids[] = {
}, {
.name   = s3c2440-i2c,
.driver_data= TYPE_S3C2440,
+   }, {
+   .name   = s3c2440-hdmiphy-i2c,
+   .driver_data= TYPE_S3C2440_HDMIPHY,
}, { },
 };
 MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);
-- 
1.7.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 5/9] arm: plat-s5p: add TV support

2011-05-25 Thread Tomasz Stanislawski
This patch adds:
- resources for TV drivers and devices
- setters for names of TV devices

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 arch/arm/plat-s5p/Kconfig|5 ++
 arch/arm/plat-s5p/Makefile   |1 +
 arch/arm/plat-s5p/dev-tv.c   |  100 ++
 arch/arm/plat-samsung/include/plat/devs.h|5 ++
 arch/arm/plat-samsung/include/plat/tv-core.h |   45 
 5 files changed, 156 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-s5p/dev-tv.c
 create mode 100644 arch/arm/plat-samsung/include/plat/tv-core.h

diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index 8492297..585754b 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -85,6 +85,11 @@ config S5P_DEV_CSIS1
help
  Compile in platform device definitions for MIPI-CSIS channel 1
 
+config S5P_DEV_TV
+   bool
+   help
+ Compile in platform device definition for TV interface
+
 config S5P_SETUP_MIPIPHY
bool
help
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile
index 42afff7..073f363 100644
--- a/arch/arm/plat-s5p/Makefile
+++ b/arch/arm/plat-s5p/Makefile
@@ -33,4 +33,5 @@ obj-$(CONFIG_S5P_DEV_FIMC3)   += dev-fimc3.o
 obj-$(CONFIG_S5P_DEV_ONENAND)  += dev-onenand.o
 obj-$(CONFIG_S5P_DEV_CSIS0)+= dev-csis0.o
 obj-$(CONFIG_S5P_DEV_CSIS1)+= dev-csis1.o
+obj-$(CONFIG_S5P_DEV_TV)   += dev-tv.o
 obj-$(CONFIG_S5P_SETUP_MIPIPHY)+= setup-mipiphy.o
diff --git a/arch/arm/plat-s5p/dev-tv.c b/arch/arm/plat-s5p/dev-tv.c
new file mode 100644
index 000..28f43a2
--- /dev/null
+++ b/arch/arm/plat-s5p/dev-tv.c
@@ -0,0 +1,100 @@
+/* linux/arch/arm/plat-s5p/dev-tv.c
+ *
+ * Copyright 2011 Samsung Electronics
+ *  Tomasz Stanislawski t.stanisl...@samsung.com
+ *
+ * S5P series device definition for TV device
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include linux/dma-mapping.h
+
+#include mach/irqs.h
+#include mach/map.h
+
+#include plat/devs.h
+
+/* HDMI interface */
+static struct resource s5p_hdmi_resources[] = {
+   [0] = {
+   .start  = S5P_PA_HDMI,
+   .end= S5P_PA_HDMI + S5P_SZ_HDMI - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   [1] = {
+   .start  = IRQ_HDMI,
+   .end= IRQ_HDMI,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+struct platform_device s5p_device_hdmi = {
+   .name   = s5p-hdmi,
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(s5p_hdmi_resources),
+   .resource   = s5p_hdmi_resources,
+};
+EXPORT_SYMBOL(s5p_device_hdmi);
+
+/* MIXER */
+static struct resource s5p_mixer_resources[] = {
+   [0] = {
+   .start  = S5P_PA_MIXER,
+   .end= S5P_PA_MIXER + S5P_SZ_MIXER - 1,
+   .flags  = IORESOURCE_MEM,
+   .name   = mxr
+   },
+   [1] = {
+   .start  = S5P_PA_VP,
+   .end= S5P_PA_VP + S5P_SZ_VP - 1,
+   .flags  = IORESOURCE_MEM,
+   .name   = vp
+   },
+   [2] = {
+   .start  = IRQ_MIXER,
+   .end= IRQ_MIXER,
+   .flags  = IORESOURCE_IRQ,
+   .name   = irq
+   },
+};
+
+struct platform_device s5p_device_mixer = {
+   .name   = s5p-mixer,
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(s5p_mixer_resources),
+   .resource   = s5p_mixer_resources,
+   .dev= {
+   .coherent_dma_mask = DMA_BIT_MASK(32),
+   .dma_mask = s5p_device_mixer.dev.coherent_dma_mask,
+   }
+};
+EXPORT_SYMBOL(s5p_device_mixer);
+
+/* HDMI interface */
+static struct resource s5p_sdo_resources[] = {
+   [0] = {
+   .start  = S5P_PA_SDO,
+   .end= S5P_PA_SDO + S5P_SZ_SDO - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   [1] = {
+   .start  = IRQ_SDO,
+   .end= IRQ_SDO,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+struct platform_device s5p_device_sdo = {
+   .name   = s5p-sdo,
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(s5p_sdo_resources),
+   .resource   = s5p_sdo_resources,
+   .dev= {
+   .coherent_dma_mask = DMA_BIT_MASK(32),
+   .dma_mask = s5p_device_sdo.dev.coherent_dma_mask,
+   }
+};
+EXPORT_SYMBOL(s5p_device_sdo);
diff --git a/arch/arm/plat-samsung/include/plat/devs.h 
b/arch/arm/plat-samsung/include/plat/devs.h
index cd52d88..f3e88db 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -140,6 +140,11 @@ extern struct platform_device s5p_device_fimc1;
 extern struct

[PATCH v4 7/9] arm: exynos4: universal_c210: add TV support

2011-05-25 Thread Tomasz Stanislawski
Add platform devices and regulator and for TV devices on Samsung
Universal C210 board.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
---
 arch/arm/mach-exynos4/Kconfig   |3 +
 arch/arm/mach-exynos4/mach-universal_c210.c |   80 +++
 2 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index e849f67..700967b 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -153,7 +153,10 @@ config MACH_UNIVERSAL_C210
select S3C_DEV_HSMMC3
select S3C_DEV_I2C1
select S3C_DEV_I2C5
+   select S3C_DEV_I2C8
select S5P_DEV_ONENAND
+   select S5P_DEV_TV
+   select EXYNOS4_DEV_PD
select EXYNOS4_SETUP_I2C1
select EXYNOS4_SETUP_I2C5
select EXYNOS4_SETUP_SDHCI
diff --git a/arch/arm/mach-exynos4/mach-universal_c210.c 
b/arch/arm/mach-exynos4/mach-universal_c210.c
index 97d329f..58a099c 100644
--- a/arch/arm/mach-exynos4/mach-universal_c210.c
+++ b/arch/arm/mach-exynos4/mach-universal_c210.c
@@ -26,7 +26,9 @@
 #include plat/exynos4.h
 #include plat/cpu.h
 #include plat/devs.h
+#include plat/gpio-cfg.h
 #include plat/iic.h
+#include plat/pd.h
 #include plat/sdhci.h
 
 #include mach/map.h
@@ -136,6 +138,9 @@ static struct regulator_init_data lp3974_buck2_data = {
.consumer_supplies = lp3974_buck2_consumer,
 };
 
+static struct regulator_consumer_supply lp3974_buck3_consumer =
+   REGULATOR_SUPPLY(vdet, s5p-sdo);
+
 static struct regulator_init_data lp3974_buck3_data = {
.constraints= {
.name   = VCC_1.8V,
@@ -147,6 +152,8 @@ static struct regulator_init_data lp3974_buck3_data = {
.enabled= 1,
},
},
+   .num_consumer_supplies = 1,
+   .consumer_supplies = lp3974_buck3_consumer,
 };
 
 static struct regulator_init_data lp3974_buck4_data = {
@@ -175,6 +182,12 @@ static struct regulator_init_data lp3974_ldo2_data = {
},
 };
 
+static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
+   REGULATOR_SUPPLY(vusb_a, s3c-hsotg),
+   REGULATOR_SUPPLY(vdd, exynos4-hdmi),
+   REGULATOR_SUPPLY(vdd_pll, exynos4-hdmi),
+};
+
 static struct regulator_init_data lp3974_ldo3_data = {
.constraints= {
.name   = VUSB+MIPI_1.1V,
@@ -186,6 +199,12 @@ static struct regulator_init_data lp3974_ldo3_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo3_consumer),
+   .consumer_supplies = lp3974_ldo3_consumer,
+};
+
+static struct regulator_consumer_supply lp3974_ldo4_consumer[] = {
+   REGULATOR_SUPPLY(vdd_osc, exynos4-hdmi),
 };
 
 static struct regulator_init_data lp3974_ldo4_data = {
@@ -199,6 +218,8 @@ static struct regulator_init_data lp3974_ldo4_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo4_consumer),
+   .consumer_supplies = lp3974_ldo4_consumer,
 };
 
 static struct regulator_init_data lp3974_ldo5_data = {
@@ -240,6 +261,11 @@ static struct regulator_init_data lp3974_ldo7_data = {
},
 };
 
+static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
+   REGULATOR_SUPPLY(vusb_d, s3c-hsotg),
+   REGULATOR_SUPPLY(vdd33a_dac, s5p-sdo),
+};
+
 static struct regulator_init_data lp3974_ldo8_data = {
.constraints= {
.name   = VUSB+VDAC_3.3V,
@@ -251,6 +277,8 @@ static struct regulator_init_data lp3974_ldo8_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo8_consumer),
+   .consumer_supplies = lp3974_ldo8_consumer,
 };
 
 static struct regulator_init_data lp3974_ldo9_data = {
@@ -466,6 +494,34 @@ static struct max8998_platform_data universal_lp3974_pdata 
= {
.wakeup = true,
 };
 
+static struct regulator_consumer_supply hdmi_fixed_consumer =
+   REGULATOR_SUPPLY(hdmi-en, exynos4-hdmi);
+
+static struct regulator_init_data hdmi_fixed_voltage_init_data = {
+   .constraints= {
+   .name   = HDMI_5V,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = hdmi_fixed_consumer,
+};
+
+static struct fixed_voltage_config hdmi_fixed_voltage_config = {
+   .supply_name= HDMI_EN1,
+   .microvolts = 500,
+   .gpio   = EXYNOS4_GPE0(1),
+   .enable_high= true,
+   .init_data  = hdmi_fixed_voltage_init_data,
+};
+
+static struct platform_device hdmi_fixed_voltage = {
+   .name   = reg-fixed-voltage,
+   .id = 6,
+   .dev

[PATCH v4 6/9] arm: exynos4: add TV support

2011-05-25 Thread Tomasz Stanislawski
Add clocks and definitions needed by TV driver infrastructure for Samsung 
Exynos4 machine.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Reviewed-by: Marek Szyprowski m.szyprow...@samsung.com
---
 arch/arm/mach-exynos4/clock.c   |  217 ++-
 arch/arm/mach-exynos4/cpu.c |4 +
 arch/arm/mach-exynos4/include/mach/irqs.h   |4 +
 arch/arm/mach-exynos4/include/mach/map.h|   26 +++
 arch/arm/mach-exynos4/include/mach/regs-clock.h |1 +
 arch/arm/mach-exynos4/include/mach/regs-pmu.h   |6 +
 6 files changed, 257 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 035eacc..6ac2cbd 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -87,6 +87,11 @@ static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int 
enable)
return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable);
 }
 
+static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKSRC_MASK_TV, clk, enable);
+}
+
 static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
 {
return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
@@ -127,6 +132,16 @@ static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int 
enable)
return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
 }
 
+static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
+}
+
+static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
+}
+
 /* Core list of CMU_CPU side */
 
 static struct clksrc_clk clk_mout_apll = {
@@ -473,6 +488,36 @@ static struct clk init_clocks_off[] = {
.enable = exynos4_clk_ip_fsys_ctrl,
.ctrlbit= (1  8),
}, {
+   .name   = dac,
+   .id = -1,
+   .enable = exynos4_clk_ip_tv_ctrl,
+   .ctrlbit= (1  2),
+   }, {
+   .name   = mixer,
+   .id = -1,
+   .enable = exynos4_clk_ip_tv_ctrl,
+   .ctrlbit= (1  1),
+   }, {
+   .name   = vp,
+   .id = -1,
+   .enable = exynos4_clk_ip_tv_ctrl,
+   .ctrlbit= (1  0),
+   }, {
+   .name   = hdmi,
+   .id = -1,
+   .enable = exynos4_clk_ip_tv_ctrl,
+   .ctrlbit= (1  3),
+   }, {
+   .name   = hdmiphy,
+   .id = -1,
+   .enable = exynos4_clk_hdmiphy_ctrl,
+   .ctrlbit= (1  0),
+   }, {
+   .name   = dacphy,
+   .id = -1,
+   .enable = exynos4_clk_dac_ctrl,
+   .ctrlbit= (1  0),
+   }, {
.name   = hsmmc,
.id = 4,
.parent = clk_aclk_133.clk,
@@ -791,6 +836,93 @@ static struct clksrc_sources clkset_mout_g2d = {
.nr_sources = ARRAY_SIZE(clkset_mout_g2d_list),
 };
 
+/* --
+ * TV subsystem CLOCKS
+ * --
+ */
+
+static struct clk *clkset_sclk_dac_list[] = {
+   [0] = clk_sclk_vpll.clk,
+   [1] = clk_sclk_hdmiphy,
+};
+
+static struct clksrc_sources clkset_sclk_dac = {
+   .sources= clkset_sclk_dac_list,
+   .nr_sources = ARRAY_SIZE(clkset_sclk_dac_list),
+};
+
+static struct clksrc_clk clk_sclk_dac = {
+   .clk= {
+   .name   = sclk_dac,
+   .id = -1,
+   .enable = exynos4_clksrc_mask_tv_ctrl,
+   .ctrlbit= (1  8),
+   },
+   .sources = clkset_sclk_dac,
+   .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 8, .size = 1 },
+};
+
+static struct clksrc_clk clk_sclk_pixel  = {
+   .clk= {
+   .name   = sclk_pixel,
+   .id = -1,
+   .parent = clk_sclk_vpll.clk,
+   },
+   .reg_div = { .reg = S5P_CLKDIV_TV, .shift = 0, .size = 4 },
+};
+
+static struct clk *clkset_sclk_hdmi_list[] = {
+   [0] = clk_sclk_pixel.clk,
+   [1] = clk_sclk_hdmiphy,
+};
+
+static struct clksrc_sources clkset_sclk_hdmi = {
+   .sources= clkset_sclk_hdmi_list,
+   .nr_sources = ARRAY_SIZE(clkset_sclk_hdmi_list),
+};
+
+static struct clksrc_clk clk_sclk_hdmi = {
+   .clk= {
+   .name   = sclk_hdmi,
+   .id = -1,
+   .enable = exynos4_clksrc_mask_tv_ctrl,
+   .ctrlbit

[PATCH v3 0/4] TV driver for Samsung Exynos4 platform (platform-part)

2011-04-11 Thread Tomasz Stanislawski
Hello Everyone,
This patchset introduce TV devices to Samsung Exynos4 platform (former
s5pv310). It is dedicated for 2.6.39-rc1 kernel. It is the third version of a
TV driver. The platform part was moved to a separate patchset. Moreover, the
patchset adds following auxiliary entities:
- I2C controller 8 for HDMI physical interface
- power regulators
- TV clocks, include ops for fout_vpll clock
- dependencies between TV and Power Domain devices 

Please refer to post 'TV driver for Samsung Exynos4 platform (media part)' for
sources of the TV driver.  Link missing due to circular dependency between both
posts.

*** BLURB HERE ***

Tomasz Stanislawski (4):
  i2c-s3c2410: fix I2C dedicated for hdmiphy
  exynos4: add i2c controller 8 (HDMIPHY)
  arm: exynos4: add s5p-tv
  arm: exynos4: universal_c210: add s5p-tv

 arch/arm/mach-exynos4/Kconfig   |7 +
 arch/arm/mach-exynos4/Makefile  |1 +
 arch/arm/mach-exynos4/clock.c   |  223 ++-
 arch/arm/mach-exynos4/cpu.c |3 +
 arch/arm/mach-exynos4/dev-tv.c  |  114 
 arch/arm/mach-exynos4/include/mach/irqs.h   |8 +
 arch/arm/mach-exynos4/include/mach/map.h|   27 +++
 arch/arm/mach-exynos4/include/mach/regs-clock.h |1 +
 arch/arm/mach-exynos4/include/mach/regs-pmu.h   |6 +
 arch/arm/mach-exynos4/mach-universal_c210.c |   81 
 arch/arm/plat-samsung/Kconfig   |5 +
 arch/arm/plat-samsung/Makefile  |1 +
 arch/arm/plat-samsung/dev-i2c8.c|   68 +++
 arch/arm/plat-samsung/include/plat/devs.h   |6 +
 arch/arm/plat-samsung/include/plat/iic-core.h   |7 +
 arch/arm/plat-samsung/include/plat/iic.h|1 +
 drivers/i2c/busses/i2c-s3c2410.c|   36 -
 17 files changed, 593 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-exynos4/dev-tv.c
 create mode 100644 arch/arm/plat-samsung/dev-i2c8.c

-- 
1.7.4.3
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] arm: exynos4: universal_c210: add s5p-tv

2011-04-11 Thread Tomasz Stanislawski
universal_c210: tv: fix configuration of regulator

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Reviewed-by: Marek Szyprowski m.szyprow...@samsung.com
---
 arch/arm/mach-exynos4/Kconfig   |2 +
 arch/arm/mach-exynos4/mach-universal_c210.c |   81 +++
 2 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index 0f830b8..ad3a6e0 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -162,9 +162,11 @@ config MACH_UNIVERSAL_C210
select S3C_DEV_HSMMC3
select S3C_DEV_I2C1
select S3C_DEV_I2C5
+   select S3C_DEV_I2C8
select S5P_DEV_ONENAND
select EXYNOS4_DEV_PD
select EXYNOS4_DEV_SYSMMU
+   select EXYNOS4_DEV_TV
select EXYNOS4_SETUP_I2C1
select EXYNOS4_SETUP_I2C5
select EXYNOS4_SETUP_SDHCI
diff --git a/arch/arm/mach-exynos4/mach-universal_c210.c 
b/arch/arm/mach-exynos4/mach-universal_c210.c
index 7ff2f5f..25ca9c6 100644
--- a/arch/arm/mach-exynos4/mach-universal_c210.c
+++ b/arch/arm/mach-exynos4/mach-universal_c210.c
@@ -26,6 +26,7 @@
 #include plat/exynos4.h
 #include plat/cpu.h
 #include plat/devs.h
+#include plat/gpio-cfg.h
 #include plat/iic.h
 #include plat/pd.h
 #include plat/sdhci.h
@@ -139,6 +140,9 @@ static struct regulator_init_data lp3974_buck2_data = {
.consumer_supplies = lp3974_buck2_consumer,
 };
 
+static struct regulator_consumer_supply lp3974_buck3_consumer =
+   REGULATOR_SUPPLY(vdet, s5p-sdo);
+
 static struct regulator_init_data lp3974_buck3_data = {
.constraints= {
.name   = VCC_1.8V,
@@ -150,6 +154,8 @@ static struct regulator_init_data lp3974_buck3_data = {
.enabled= 1,
},
},
+   .num_consumer_supplies = 1,
+   .consumer_supplies = lp3974_buck3_consumer,
 };
 
 static struct regulator_init_data lp3974_buck4_data = {
@@ -178,6 +184,12 @@ static struct regulator_init_data lp3974_ldo2_data = {
},
 };
 
+static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
+   REGULATOR_SUPPLY(vusb_a, s3c-hsotg),
+   REGULATOR_SUPPLY(vdd, s5p-hdmi),
+   REGULATOR_SUPPLY(vdd_pll, s5p-hdmi),
+};
+
 static struct regulator_init_data lp3974_ldo3_data = {
.constraints= {
.name   = VUSB+MIPI_1.1V,
@@ -189,6 +201,12 @@ static struct regulator_init_data lp3974_ldo3_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo3_consumer),
+   .consumer_supplies = lp3974_ldo3_consumer,
+};
+
+static struct regulator_consumer_supply lp3974_ldo4_consumer[] = {
+   REGULATOR_SUPPLY(vdd_osc, s5p-hdmi),
 };
 
 static struct regulator_init_data lp3974_ldo4_data = {
@@ -202,6 +220,8 @@ static struct regulator_init_data lp3974_ldo4_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo4_consumer),
+   .consumer_supplies = lp3974_ldo4_consumer,
 };
 
 static struct regulator_init_data lp3974_ldo5_data = {
@@ -243,6 +263,11 @@ static struct regulator_init_data lp3974_ldo7_data = {
},
 };
 
+static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
+   REGULATOR_SUPPLY(vusb_d, s3c-hsotg),
+   REGULATOR_SUPPLY(vdd33a_dac, s5p-sdo),
+};
+
 static struct regulator_init_data lp3974_ldo8_data = {
.constraints= {
.name   = VUSB+VDAC_3.3V,
@@ -254,6 +279,8 @@ static struct regulator_init_data lp3974_ldo8_data = {
.disabled   = 1,
},
},
+   .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo8_consumer),
+   .consumer_supplies = lp3974_ldo8_consumer,
 };
 
 static struct regulator_init_data lp3974_ldo9_data = {
@@ -469,6 +496,34 @@ static struct max8998_platform_data universal_lp3974_pdata 
= {
.wakeup = true,
 };
 
+static struct regulator_consumer_supply hdmi_fixed_consumer =
+   REGULATOR_SUPPLY(hdmi-en, s5p-hdmi);
+
+static struct regulator_init_data hdmi_fixed_voltage_init_data = {
+   .constraints= {
+   .name   = HDMI_5V,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = hdmi_fixed_consumer,
+};
+
+static struct fixed_voltage_config hdmi_fixed_voltage_config = {
+   .supply_name= HDMI_EN1,
+   .microvolts = 500,
+   .gpio   = EXYNOS4_GPE0(1),
+   .enable_high= true,
+   .init_data  = hdmi_fixed_voltage_init_data,
+};
+
+static struct platform_device hdmi_fixed_voltage = {
+   .name   = reg-fixed-voltage,
+   .id

[PATCH 2/4] exynos4: add i2c controller 8 (HDMIPHY)

2011-04-11 Thread Tomasz Stanislawski
Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-exynos4/clock.c |6 ++
 arch/arm/mach-exynos4/cpu.c   |3 +
 arch/arm/mach-exynos4/include/mach/irqs.h |4 ++
 arch/arm/mach-exynos4/include/mach/map.h  |1 +
 arch/arm/plat-samsung/Kconfig |5 ++
 arch/arm/plat-samsung/Makefile|1 +
 arch/arm/plat-samsung/dev-i2c8.c  |   68 +
 arch/arm/plat-samsung/include/plat/devs.h |1 +
 arch/arm/plat-samsung/include/plat/iic-core.h |7 +++
 arch/arm/plat-samsung/include/plat/iic.h  |1 +
 10 files changed, 97 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/dev-i2c8.c

diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 963195e..40a231a 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -619,6 +619,12 @@ static struct clk init_clocks_off[] = {
.enable = exynos4_clk_ip_peril_ctrl,
.ctrlbit= (1  13),
}, {
+   .name   = i2c,
+   .id = 8,
+   .parent = clk_aclk_100.clk,
+   .enable = exynos4_clk_ip_peril_ctrl,
+   .ctrlbit= (1  14),
+   }, {
.name   = sysmmu,
.id = S5P_SYSMMU_MDMA,
.enable = exynos4_clk_ip_image_ctrl,
diff --git a/arch/arm/mach-exynos4/cpu.c b/arch/arm/mach-exynos4/cpu.c
index 7930113..52b145e 100644
--- a/arch/arm/mach-exynos4/cpu.c
+++ b/arch/arm/mach-exynos4/cpu.c
@@ -23,6 +23,7 @@
 #include plat/sdhci.h
 #include plat/devs.h
 #include plat/fimc-core.h
+#include plat/iic-core.h
 
 #include mach/regs-irq.h
 
@@ -123,6 +124,8 @@ void __init exynos4_map_io(void)
exynos4_default_sdhci2();
exynos4_default_sdhci3();
 
+   s3c_i2c8_setname(s3c2440-hdmiphy-i2c);
+
s3c_fimc_setname(0, exynos4-fimc);
s3c_fimc_setname(1, exynos4-fimc);
s3c_fimc_setname(2, exynos4-fimc);
diff --git a/arch/arm/mach-exynos4/include/mach/irqs.h 
b/arch/arm/mach-exynos4/include/mach/irqs.h
index ad1d00c..dd048f8 100644
--- a/arch/arm/mach-exynos4/include/mach/irqs.h
+++ b/arch/arm/mach-exynos4/include/mach/irqs.h
@@ -76,6 +76,9 @@
 #define IRQ_PDMA0  COMBINER_IRQ(21, 0)
 #define IRQ_PDMA1  COMBINER_IRQ(21, 1)
 
+#define IRQ_HDMI   COMBINER_IRQ(16, 0)
+#define IRQ_HDMI_I2C   COMBINER_IRQ(16, 1)
+
 #define IRQ_TIMER0_VIC COMBINER_IRQ(22, 0)
 #define IRQ_TIMER1_VIC COMBINER_IRQ(22, 1)
 #define IRQ_TIMER2_VIC COMBINER_IRQ(22, 2)
@@ -102,6 +105,7 @@
 #define IRQ_IIC5   COMBINER_IRQ(27, 5)
 #define IRQ_IIC6   COMBINER_IRQ(27, 6)
 #define IRQ_IIC7   COMBINER_IRQ(27, 7)
+#define IRQ_IIC8   IRQ_HDMI_I2C
 
 #define IRQ_HSMMC0 COMBINER_IRQ(29, 0)
 #define IRQ_HSMMC1 COMBINER_IRQ(29, 1)
diff --git a/arch/arm/mach-exynos4/include/mach/map.h 
b/arch/arm/mach-exynos4/include/mach/map.h
index 862967f..ff98626 100644
--- a/arch/arm/mach-exynos4/include/mach/map.h
+++ b/arch/arm/mach-exynos4/include/mach/map.h
@@ -127,6 +127,7 @@
 #define S3C_PA_IIC5EXYNOS4_PA_IIC(5)
 #define S3C_PA_IIC6EXYNOS4_PA_IIC(6)
 #define S3C_PA_IIC7EXYNOS4_PA_IIC(7)
+#define S3C_PA_IIC8EXYNOS4_PA_IIC(8)
 #define S3C_PA_RTC EXYNOS4_PA_RTC
 #define S3C_PA_WDT EXYNOS4_PA_WATCHDOG
 
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index be72100..c764227 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -211,6 +211,11 @@ config S3C_DEV_I2C7
help
  Compile in platform device definition for I2C controller 7
 
+config S3C_DEV_I2C8
+   bool
+   help
+ Compile in platform device definitions for I2C channel 8 (HDMIPHY)
+
 config S3C_DEV_FB
bool
help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index e9de58a..752df43 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_S3C_DEV_I2C4)+= dev-i2c4.o
 obj-$(CONFIG_S3C_DEV_I2C5) += dev-i2c5.o
 obj-$(CONFIG_S3C_DEV_I2C6) += dev-i2c6.o
 obj-$(CONFIG_S3C_DEV_I2C7) += dev-i2c7.o
+obj-$(CONFIG_S3C_DEV_I2C8) += dev-i2c8.o
 obj-$(CONFIG_S3C_DEV_FB)   += dev-fb.o
 obj-y  += dev-uart.o
 obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o
diff --git a/arch/arm/plat-samsung/dev-i2c8.c b/arch/arm/plat-samsung/dev-i2c8.c
new file mode 100644
index 000..1a4a4aa
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c8.c
@@ -0,0 +1,68 @@
+/* linux/arch/arm/plat-samsung/dev-i2c7.c

[PATCH v2 0/6] HDMI driver for Samsung S5PV310 platform

2011-03-04 Thread Tomasz Stanislawski
, 1080P59_94 and 1080P60 work.
7. Positioning layer's window on output display using S_CROP, G_GROP, CROPCAP.
8. Positioning and cropping data in buffer using S_CROP, G_GROP, CROPCAP with
buffer type OVERLAY. *

TODOs:
- add analog TVOUT driver
- add S_OUTPUT
- add S_STD ioctl
- add control of alpha blending / chroma keying via V4L2 controls
- add controls for luminance curve and sharpness in VP
- consider exporting all output functionalities to separate video node
- consider media controller framework
- better control over debugging
- fix dependency between all TV drivers

* The need of cropping in source buffers came from problem with MFC driver for
S5P. The MFC supports only width divisible by 64. If a width of a decoded movie
is not aligned do 64 then padding pixels are filled with zeros. This is an ugly
green color in YCbCr colorspace. Filling it with zeros by a CPU is a waste of
resources since an image can be cropped in VP. Is it possible to set crops for
user data for M2M devices. V4L2 lacks such functionality of non-M2M devices.
Therefore cropping in buffer V4L2_BUF_TYPE_VIDEO_OVERLAY was used as an work
around.

=
 Device Architecture
=

Three drivers are added in this patch.

1. HDMIPHY. It is an I2C driver for HDMIPHY interface. It exports following
callback by V4L2 subdevice:
- s_power: currently stub
- s_stream: configures and starts/stops HDMIPHY
- s_dv_preset: used to choose proper frequency of clock for other TV devices

2. HDMI. The auxiliary driver used to control HDMI interface. It exports its
subdev to a subdev pool for use by other drivers. The following callbacks are
implemented:
- s_power: runs HDMI hardware, regulators and clocks.
- s_stream: runs HDMIPHY and starts generation of video frames.
- enum_dv_presets
- s_dv_preset
- g_mbus_format: returns information on data format expected by on HDMI input
  The driver supports an interrupt. It is used to detect plug/unplug events in
kernel debugs.  The API for detection of such an events in V4L2 API is to be
defined.

3. Mixer  Video Processor driver. It is called 's5p-mixer' because of
historical reasons. It was decided combine VP and MXR drivers into one because
of shared interrupt and very similar interface via V4L2 nodes. The driver is a
realization of many-to-many relation between multiple input layers and multiple
outputs. All shared resources are kept in struct mxr_device. It provides
utilities for management and synchronization of access to resources and
reference counting. The outputs are obtained from subdev pool basing on names
supplied in platform data. One layer is a single video node. Since layers
differs simple inheritance is applied. Every layer type implements set of ops.
There are different ops for Mixer layers and other for VP layer.

The videobuf2 framework was used for the management of buffers and streaming.
All other V4L2 ioctls are processed in layers common interface. The CMA was
used as memory allocator for Mixer's buffers. It could be easily exchanged with
any other allocator integrated with videobuf2 framework.

Driver is not yet integrated with power domain driver. Moreover one of mixer's
clocks has to change parent while entering streaming mode. Therefore all power
and clock management was moved to platform data until final solutions emerges.

===
 Usage summary
===

Follow steps below to display double-buffered animation on HDMI output.

01. Open video node named graph0.
02. S_FMT(type = OUTPUT, pixelformat = V4L2_PIX_FMT_RGB*, width, height, ...)
03. REQ_BUFS(type = OUTPUT, memory = MMAP, count = 2)
04. MMAP(type = OUTPUT, index = 0)
05. MMAP(type = OUTPUT, index = 1)
06. Fill buffer 0 with data
07. QBUF(type = OUTPUT, index = 0)
08. STREAM_ON(type = OUTPUT)
09. Fill buffer 1 with data
10. QBUF(type = OUTPUT, index = 1)
11. DQBUF(type = OUTPUT)
12. QBUF(type = OUTPUT, index = 0)
13. DQBUF(type = OUTPUT)
14. Goto 09

===
 Patch Summary
===

Tomasz Stanislawski (6):
  i2c-s3c2410: fix I2C dedicated for hdmiphy
  universal: i2c: add I2C controller 8 (HDMIPHY)
  v4l: add macro for 1080p59_54 preset
  s5p-tv: add driver for HDMI output on S5PC210 platform
  s5pv310: add s5p-tv to platform devices
  s5pv310: add s5p-tv to Universal C210 board

 arch/arm/mach-s5pv310/Kconfig   |7 +
 arch/arm/mach-s5pv310/Makefile  |1 +
 arch/arm/mach-s5pv310/clock.c   |  138 ++-
 arch/arm/mach-s5pv310/dev-tv.c  |  103 ++
 arch/arm/mach-s5pv310/include/mach/irqs.h   |8 +
 arch/arm/mach-s5pv310/include/mach/map.h|   27 +
 arch/arm/mach-s5pv310/include/mach/regs-clock.h |3 +
 arch/arm/mach-s5pv310/include/mach/regs-pmu.h   |2 +
 arch/arm/mach-s5pv310/mach-universal_c210.c |   54 +
 arch/arm/plat-samsung/Kconfig   |5 +
 arch/arm/plat-samsung/Makefile  |1 +
 arch/arm/plat-samsung/dev-i2c8.c|   68

[PATCH 1/6] i2c-s3c2410: fix I2C dedicated for hdmiphy

2011-03-04 Thread Tomasz Stanislawski
The I2C HDMIPHY dedicated controller has different timeout
handling and reset conditions.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
CC: ben-li...@fluff.org
---
 drivers/i2c/busses/i2c-s3c2410.c |   36 +++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 6c00c10..99cfe2f 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -54,6 +54,7 @@ enum s3c24xx_i2c_state {
 enum s3c24xx_i2c_type {
TYPE_S3C2410,
TYPE_S3C2440,
+   TYPE_S3C2440_HDMIPHY,
 };
 
 struct s3c24xx_i2c {
@@ -96,7 +97,21 @@ static inline int s3c24xx_i2c_is2440(struct s3c24xx_i2c *i2c)
enum s3c24xx_i2c_type type;
 
type = platform_get_device_id(pdev)-driver_data;
-   return type == TYPE_S3C2440;
+   return type == TYPE_S3C2440 || type == TYPE_S3C2440_HDMIPHY;
+}
+
+/* s3c24xx_i2c_is2440_hdmiphy()
+ *
+ * return true is this is an s3c2440 dedicated for HDMIPHY interface
+*/
+
+static inline int s3c24xx_i2c_is2440_hdmiphy(struct s3c24xx_i2c *i2c)
+{
+   struct platform_device *pdev = to_platform_device(i2c-dev);
+   enum s3c24xx_i2c_type type;
+
+   type = platform_get_device_id(pdev)-driver_data;
+   return type == TYPE_S3C2440_HDMIPHY;
 }
 
 /* s3c24xx_i2c_master_complete
@@ -461,6 +476,13 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
unsigned long iicstat;
int timeout = 400;
 
+   /* if hang-up of HDMIPHY occured reduce timeout
+* The controller will work after reset, so waiting
+* 400 ms will cause unneccessary system hangup
+*/
+   if (s3c24xx_i2c_is2440_hdmiphy(i2c))
+   timeout = 10;
+
while (timeout--  0) {
iicstat = readl(i2c-regs + S3C2410_IICSTAT);
 
@@ -470,6 +492,15 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
msleep(1);
}
 
+   /* hang-up of bus dedicated for HDMIPHY occured, resetting */
+   if (s3c24xx_i2c_is2440_hdmiphy(i2c)) {
+   writel(0, i2c-regs + S3C2410_IICCON);
+   writel(0, i2c-regs + S3C2410_IICSTAT);
+   writel(0, i2c-regs + S3C2410_IICDS);
+
+   return 0;
+   }
+
return -ETIMEDOUT;
 }
 
@@ -1009,6 +1040,9 @@ static struct platform_device_id s3c24xx_driver_ids[] = {
}, {
.name   = s3c2440-i2c,
.driver_data= TYPE_S3C2440,
+   }, {
+   .name   = s3c2440-hdmiphy-i2c,
+   .driver_data= TYPE_S3C2440_HDMIPHY,
}, { },
 };
 MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);
-- 
1.7.1.569.g6f426
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] universal: i2c: add I2C controller 8 (HDMIPHY)

2011-03-04 Thread Tomasz Stanislawski
Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-s5pv310/clock.c |6 +++
 arch/arm/mach-s5pv310/include/mach/irqs.h |4 ++
 arch/arm/mach-s5pv310/include/mach/map.h  |1 +
 arch/arm/plat-samsung/Kconfig |5 ++
 arch/arm/plat-samsung/Makefile|1 +
 arch/arm/plat-samsung/dev-i2c8.c  |   68 +
 arch/arm/plat-samsung/include/plat/devs.h |1 +
 arch/arm/plat-samsung/include/plat/iic.h  |1 +
 8 files changed, 87 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/dev-i2c8.c

diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c
index d28fa6f..465beb9 100644
--- a/arch/arm/mach-s5pv310/clock.c
+++ b/arch/arm/mach-s5pv310/clock.c
@@ -685,6 +685,12 @@ static struct clk init_clocks_off[] = {
.parent = clk_aclk_100.clk,
.enable = s5pv310_clk_ip_peril_ctrl,
.ctrlbit= (1  13),
+   }, {
+   .name   = i2c,
+   .id = 8,
+   .parent = clk_aclk_100.clk,
+   .enable = s5pv310_clk_ip_peril_ctrl,
+   .ctrlbit= (1  14),
},
 };
 
diff --git a/arch/arm/mach-s5pv310/include/mach/irqs.h 
b/arch/arm/mach-s5pv310/include/mach/irqs.h
index f6b99c6..f7ddc98 100644
--- a/arch/arm/mach-s5pv310/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv310/include/mach/irqs.h
@@ -77,6 +77,9 @@
 #define IRQ_PDMA0  COMBINER_IRQ(21, 0)
 #define IRQ_PDMA1  COMBINER_IRQ(21, 1)
 
+#define IRQ_HDMI   COMBINER_IRQ(16, 0)
+#define IRQ_HDMI_I2C   COMBINER_IRQ(16, 1)
+
 #define IRQ_TIMER0_VIC COMBINER_IRQ(22, 0)
 #define IRQ_TIMER1_VIC COMBINER_IRQ(22, 1)
 #define IRQ_TIMER2_VIC COMBINER_IRQ(22, 2)
@@ -100,6 +103,7 @@
 #define IRQ_IIC5   COMBINER_IRQ(27, 5)
 #define IRQ_IIC6   COMBINER_IRQ(27, 6)
 #define IRQ_IIC7   COMBINER_IRQ(27, 7)
+#define IRQ_IIC8   IRQ_HDMI_I2C
 
 #define IRQ_HSMMC0 COMBINER_IRQ(29, 0)
 #define IRQ_HSMMC1 COMBINER_IRQ(29, 1)
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h 
b/arch/arm/mach-s5pv310/include/mach/map.h
index 576ba55..0aa0171 100644
--- a/arch/arm/mach-s5pv310/include/mach/map.h
+++ b/arch/arm/mach-s5pv310/include/mach/map.h
@@ -120,6 +120,7 @@
 #define S3C_PA_IIC5S5PV310_PA_IIC(5)
 #define S3C_PA_IIC6S5PV310_PA_IIC(6)
 #define S3C_PA_IIC7S5PV310_PA_IIC(7)
+#define S3C_PA_IIC8S5PV310_PA_IIC(8)
 #define S3C_PA_RTC S5PV310_PA_RTC
 #define S3C_PA_WDT S5PV310_PA_WATCHDOG
 
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 32be05c..dd1fd15 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -211,6 +211,11 @@ config S3C_DEV_I2C7
help
  Compile in platform device definition for I2C controller 7
 
+config S3C_DEV_I2C8
+   bool
+   help
+ Compile in platform device definitions for I2C channel 8 (HDMIPHY)
+
 config S3C_DEV_FB
bool
help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 7e92457..826ae4f 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_S3C_DEV_I2C4)+= dev-i2c4.o
 obj-$(CONFIG_S3C_DEV_I2C5) += dev-i2c5.o
 obj-$(CONFIG_S3C_DEV_I2C6) += dev-i2c6.o
 obj-$(CONFIG_S3C_DEV_I2C7) += dev-i2c7.o
+obj-$(CONFIG_S3C_DEV_I2C8) += dev-i2c8.o
 obj-$(CONFIG_S3C_DEV_FB)   += dev-fb.o
 obj-y  += dev-uart.o
 obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o
diff --git a/arch/arm/plat-samsung/dev-i2c8.c b/arch/arm/plat-samsung/dev-i2c8.c
new file mode 100644
index 000..8edba7f
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c8.c
@@ -0,0 +1,68 @@
+/* linux/arch/arm/plat-samsung/dev-i2c7.c
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * S3C series device definition for i2c device 8
+ *
+ * Based on plat-samsung/dev-i2c8.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include linux/gfp.h
+#include linux/kernel.h
+#include linux/string.h
+#include linux/platform_device.h
+
+#include mach/irqs.h
+#include mach/map.h
+
+#include plat/regs-iic.h
+#include plat/iic.h
+#include plat/devs.h
+#include plat/cpu.h
+
+static struct resource s3c_i2c_resource[] = {
+   [0] = {
+   .start = S3C_PA_IIC8,
+   .end   = S3C_PA_IIC8 + SZ_4K - 1,
+   .flags = IORESOURCE_MEM,
+   },
+   [1

[PATCH 6/6] s5pv310: add s5p-tv to Universal C210 board

2011-03-04 Thread Tomasz Stanislawski
Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-s5pv310/Kconfig   |2 +
 arch/arm/mach-s5pv310/mach-universal_c210.c |   54 +++
 2 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig
index 4c863850..9acf9c0 100644
--- a/arch/arm/mach-s5pv310/Kconfig
+++ b/arch/arm/mach-s5pv310/Kconfig
@@ -112,10 +112,12 @@ config MACH_UNIVERSAL_C210
select S5PV310_SETUP_SDHCI
select S3C_DEV_I2C1
select S3C_DEV_I2C5
+   select S3C_DEV_I2C8
select S5P_DEV_MFC
select S5PV310_DEV_PD
select S5PV310_DEV_SYSMMU
select S5PV310_SETUP_I2C1
+   select S5PV310_DEV_TV
select S5PV310_SETUP_I2C5
help
  Machine support for Samsung Mobile Universal S5PC210 Reference
diff --git a/arch/arm/mach-s5pv310/mach-universal_c210.c 
b/arch/arm/mach-s5pv310/mach-universal_c210.c
index ce88262..206c539 100644
--- a/arch/arm/mach-s5pv310/mach-universal_c210.c
+++ b/arch/arm/mach-s5pv310/mach-universal_c210.c
@@ -27,6 +27,7 @@
 #include plat/pd.h
 #include plat/sdhci.h
 #include plat/sysmmu.h
+#include plat/gpio-cfg.h
 
 #include mach/map.h
 #include mach/gpio.h
@@ -812,6 +813,35 @@ static struct i2c_board_info i2c1_devs[] __initdata = {
/* Gyro, To be updated */
 };
 
+static struct regulator_consumer_supply hdmi_supplies[] = {
+   REGULATOR_SUPPLY(hdmi-en, s5p-hdmi),
+};
+
+static struct regulator_init_data hdmi_fixed_voltage_init_data = {
+   .constraints= {
+   .name   = HDMI_5V,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .num_consumer_supplies  = ARRAY_SIZE(mmc0_supplies),
+   .consumer_supplies  = hdmi_supplies,
+};
+
+static struct fixed_voltage_config hdmi_fixed_voltage_config = {
+   .supply_name= HDMI_EN1,
+   .microvolts = 500,
+   .gpio   = S5PV310_GPE0(1),
+   .enable_high= true,
+   .init_data  = hdmi_fixed_voltage_init_data,
+};
+
+static struct platform_device hdmi_fixed_voltage = {
+   .name   = reg-fixed-voltage,
+   .id = 6,
+   .dev= {
+   .platform_data  = hdmi_fixed_voltage_config,
+   },
+};
+
 static struct platform_device *universal_devices[] __initdata = {
/* Samsung Platform Devices */
mmc0_fixed_voltage,
@@ -831,8 +861,14 @@ static struct platform_device *universal_devices[] 
__initdata = {
s5pv310_device_pd[PD_MFC],
s5pv310_device_sysmmu[S5P_SYSMMU_MFC_L],
s5pv310_device_sysmmu[S5P_SYSMMU_MFC_R],
+   s3c_device_i2c8,
+   s5p_device_hdmi,
+   s5p_device_mixer,
+   s5pv310_device_pd[PD_TV],
+   s5pv310_device_sysmmu[S5P_SYSMMU_TV],
 
/* Universal Devices */
+   hdmi_fixed_voltage,
universal_gpio_keys,
s3c_device_i2c5,
s5p_device_onenand,
@@ -845,6 +881,21 @@ static void __init universal_map_io(void)
s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
 }
 
+void s5p_tv_setup(void)
+{
+   /* direct HPD to HDMI chip */
+   gpio_request(S5PV310_GPX3(7), hpd-plug);
+
+   gpio_direction_input(S5PV310_GPX3(7));
+   s3c_gpio_cfgpin(S5PV310_GPX3(7), S3C_GPIO_SFN(0x3));
+   s3c_gpio_setpull(S5PV310_GPX3(7), S3C_GPIO_PULL_NONE);
+
+   /* setup dependencies between TV devices */
+   s5p_device_hdmi.dev.parent = s5pv310_device_pd[PD_TV].dev;
+   s5p_device_mixer.dev.parent = s5pv310_device_pd[PD_TV].dev;
+   s5pv310_device_sysmmu[S5P_SYSMMU_TV].dev.parent = 
s5pv310_device_pd[PD_TV].dev;
+}
+
 static void __init universal_machine_init(void)
 {
universal_sdhci_init();
@@ -853,6 +904,7 @@ static void __init universal_machine_init(void)
i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
 
s3c_i2c5_set_platdata(NULL);
+   s3c_i2c8_set_platdata(NULL);
i2c_register_board_info(5, i2c_devs5, ARRAY_SIZE(i2c_devs5));
 
/* Last */
@@ -870,6 +922,8 @@ static void __init universal_machine_init(void)
s5p_device_mfc.dev.parent = s5pv310_device_pd[PD_MFC].dev;
s5pv310_device_sysmmu[S5P_SYSMMU_MFC_L].dev.parent = 
s5pv310_device_pd[PD_MFC].dev;
s5pv310_device_sysmmu[S5P_SYSMMU_MFC_R].dev.parent = 
s5pv310_device_pd[PD_MFC].dev;
+
+   s5p_tv_setup();
 }
 
 MACHINE_START(UNIVERSAL_C210, UNIVERSAL_C210)
-- 
1.7.1.569.g6f426
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH/RFC 0/5] HDMI driver for Samsung S5PV310 platform

2011-02-08 Thread Tomasz Stanislawski
 is a waste of
resources since an image can be cropped in VP. Is it possible to set crops for
user data for M2M devices. V4L2 lacks such functionality of non-M2M devices.
Therefore cropping in buffer V4L2_BUF_TYPE_VIDEO_OVERLAY was used as an work
around.

=
 Device Architecture
=

Three drivers are added in this patch.

1. HDMIPHY. It is an I2C driver for HDMIPHY interface. It exports following
callback by V4L2 subdevice:
- s_power: currently stub
- s_stream: configures and starts/stops HDMIPHY
- s_dv_preset: used to choose proper frequency of clock for other TV devices

2. HDMI. The auxiliary driver used to control HDMI interface. It exports its
subdev to a subdev pool for use by other drivers. The following callbacks are
implemented:
- s_power: runs HDMI hardware, regulators and clocks.
- s_stream: runs HDMIPHY and starts generation of video frames.
- enum_dv_presets
- s_dv_preset
- g_mbus_format: returns information on data format expected by on HDMI input
  The driver supports an interrupt. It is used to detect plug/unplug events in
kernel debugs.  The API for detection of such an events in V4L2 API is to be
defined.

3. Mixer  Video Processor driver. It is called 's5p-mixer' because of
historical reasons. It was decided combine VP and MXR drivers into one because
of shared interrupt and very similar interface via V4L2 nodes. The driver is a
realization of many-to-many relation between multiple input layers and multiple
outputs. All shared resources are kept in struct mxr_device. It provides
utilities for management and synchronization of access to resources and
reference counting. The outputs are obtained from subdev pool basing on names
supplied in platform data. One layer is a single video node. Since layers
differs simple inheritance is applied. Every layer type implements set of ops.
There are different ops for Mixer layers and other for VP layer.

The videobuf2 framework was used for the management of buffers and streaming.
All other V4L2 ioctls are processed in layers common interface. The CMA was
used as memory allocator for Mixer's buffers. It could be easily exchanged with
any other allocator integrated with videobuf2 framework.

Driver is not yet integrated with power domain driver. Moreover one of mixer's
clocks has to change parent while entering streaming mode. Therefore all power
and clock management was moved to platform data until final solutions emerges.

===
 Usage summary
===

Follow steps below to display double-buffered animation on HDMI output.

01. Open video node named graph0.
02. S_FMT(type = OUTPUT, pixelformat = V4L2_PIX_FMT_RGB*, width, height, ...)
03. REQ_BUFS(type = OUTPUT, memory = MMAP, count = 2)
04. MMAP(type = OUTPUT, index = 0)
05. MMAP(type = OUTPUT, index = 1)
06. Fill buffer 0 with data
07. QBUF(type = OUTPUT, index = 0)
08. STREAM_ON(type = OUTPUT)
09. Fill buffer 1 with data
10. QBUF(type = OUTPUT, index = 1)
11. DQBUF(type = OUTPUT)
12. QBUF(type = OUTPUT, index = 0)
13. DQBUF(type = OUTPUT)
14. Goto 09

===
 Patch Summary
===

Tomasz Stanislawski (5):
  i2c-s3c2410: fix I2C dedicated for hdmiphy
  universal: i2c: add I2C controller 8 (HDMIPHY)
  v4l: add macro for 1080p59_54 preset
  s5p-tv: add driver for HDMI output on S5PC210 platform
  s5pc210: add s5p-tv to platform devices

 arch/arm/mach-s5pv310/Kconfig   |7 +
 arch/arm/mach-s5pv310/Makefile  |1 +
 arch/arm/mach-s5pv310/clock.c   |  132 ++-
 arch/arm/mach-s5pv310/dev-tv.c  |  450 ++
 arch/arm/mach-s5pv310/include/mach/irqs.h   |8 +
 arch/arm/mach-s5pv310/include/mach/map.h|   27 +
 arch/arm/mach-s5pv310/include/mach/regs-clock.h |   15 +
 arch/arm/plat-samsung/Kconfig   |5 +
 arch/arm/plat-samsung/Makefile  |1 +
 arch/arm/plat-samsung/dev-i2c8.c|   68 +
 arch/arm/plat-samsung/include/plat/devs.h   |3 +
 arch/arm/plat-samsung/include/plat/iic.h|1 +
 arch/arm/plat-samsung/include/plat/tv.h |   36 +
 drivers/i2c/busses/i2c-s3c2410.c|   36 +-
 drivers/media/video/Kconfig |8 +
 drivers/media/video/Makefile|1 +
 drivers/media/video/s5p-tv/Kconfig  |   42 +
 drivers/media/video/s5p-tv/Makefile |   15 +
 drivers/media/video/s5p-tv/hdmi.h   |   74 +
 drivers/media/video/s5p-tv/hdmi_drv.c   |  795 ++
 drivers/media/video/s5p-tv/hdmiphy.h|   37 +
 drivers/media/video/s5p-tv/hdmiphy_drv.c|  228 +++
 drivers/media/video/s5p-tv/mixer.h  |  281 
 drivers/media/video/s5p-tv/mixer_drv.c  |  362 +
 drivers/media/video/s5p-tv/mixer_grp_layer.c|  181 +++
 drivers/media/video/s5p-tv/mixer_reg.c  |  532 +++
 drivers/media/video/s5p-tv/mixer_reg.h  |   44 +
 drivers/media/video/s5p

[PATCH 1/5] i2c-s3c2410: fix I2C dedicated for hdmiphy

2011-02-08 Thread Tomasz Stanislawski
The I2C HDMIPHY dedicated controller has different timeout
handling and reset conditions.

Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/i2c/busses/i2c-s3c2410.c |   36 +++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 6c00c10..99cfe2f 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -54,6 +54,7 @@ enum s3c24xx_i2c_state {
 enum s3c24xx_i2c_type {
TYPE_S3C2410,
TYPE_S3C2440,
+   TYPE_S3C2440_HDMIPHY,
 };
 
 struct s3c24xx_i2c {
@@ -96,7 +97,21 @@ static inline int s3c24xx_i2c_is2440(struct s3c24xx_i2c *i2c)
enum s3c24xx_i2c_type type;
 
type = platform_get_device_id(pdev)-driver_data;
-   return type == TYPE_S3C2440;
+   return type == TYPE_S3C2440 || type == TYPE_S3C2440_HDMIPHY;
+}
+
+/* s3c24xx_i2c_is2440_hdmiphy()
+ *
+ * return true is this is an s3c2440 dedicated for HDMIPHY interface
+*/
+
+static inline int s3c24xx_i2c_is2440_hdmiphy(struct s3c24xx_i2c *i2c)
+{
+   struct platform_device *pdev = to_platform_device(i2c-dev);
+   enum s3c24xx_i2c_type type;
+
+   type = platform_get_device_id(pdev)-driver_data;
+   return type == TYPE_S3C2440_HDMIPHY;
 }
 
 /* s3c24xx_i2c_master_complete
@@ -461,6 +476,13 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
unsigned long iicstat;
int timeout = 400;
 
+   /* if hang-up of HDMIPHY occured reduce timeout
+* The controller will work after reset, so waiting
+* 400 ms will cause unneccessary system hangup
+*/
+   if (s3c24xx_i2c_is2440_hdmiphy(i2c))
+   timeout = 10;
+
while (timeout--  0) {
iicstat = readl(i2c-regs + S3C2410_IICSTAT);
 
@@ -470,6 +492,15 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
msleep(1);
}
 
+   /* hang-up of bus dedicated for HDMIPHY occured, resetting */
+   if (s3c24xx_i2c_is2440_hdmiphy(i2c)) {
+   writel(0, i2c-regs + S3C2410_IICCON);
+   writel(0, i2c-regs + S3C2410_IICSTAT);
+   writel(0, i2c-regs + S3C2410_IICDS);
+
+   return 0;
+   }
+
return -ETIMEDOUT;
 }
 
@@ -1009,6 +1040,9 @@ static struct platform_device_id s3c24xx_driver_ids[] = {
}, {
.name   = s3c2440-i2c,
.driver_data= TYPE_S3C2440,
+   }, {
+   .name   = s3c2440-hdmiphy-i2c,
+   .driver_data= TYPE_S3C2440_HDMIPHY,
}, { },
 };
 MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);
-- 
1.7.3.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] universal: i2c: add I2C controller 8 (HDMIPHY)

2011-02-08 Thread Tomasz Stanislawski
Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-s5pv310/clock.c |6 +++
 arch/arm/mach-s5pv310/include/mach/irqs.h |4 ++
 arch/arm/mach-s5pv310/include/mach/map.h  |1 +
 arch/arm/plat-samsung/Kconfig |5 ++
 arch/arm/plat-samsung/Makefile|1 +
 arch/arm/plat-samsung/dev-i2c8.c  |   68 +
 arch/arm/plat-samsung/include/plat/devs.h |1 +
 arch/arm/plat-samsung/include/plat/iic.h  |1 +
 8 files changed, 87 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/dev-i2c8.c

diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c
index fc7c2f8..6161b54 100644
--- a/arch/arm/mach-s5pv310/clock.c
+++ b/arch/arm/mach-s5pv310/clock.c
@@ -589,6 +589,12 @@ static struct clk init_clocks_off[] = {
.parent = clk_aclk_100.clk,
.enable = s5pv310_clk_ip_peril_ctrl,
.ctrlbit= (1  13),
+   }, {
+   .name   = i2c,
+   .id = 8,
+   .parent = clk_aclk_100.clk,
+   .enable = s5pv310_clk_ip_peril_ctrl,
+   .ctrlbit= (1  14),
},
 };
 
diff --git a/arch/arm/mach-s5pv310/include/mach/irqs.h 
b/arch/arm/mach-s5pv310/include/mach/irqs.h
index 536b0b5..0ba778b 100644
--- a/arch/arm/mach-s5pv310/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv310/include/mach/irqs.h
@@ -76,6 +76,9 @@
 #define IRQ_PDMA0  COMBINER_IRQ(21, 0)
 #define IRQ_PDMA1  COMBINER_IRQ(21, 1)
 
+#define IRQ_HDMI   COMBINER_IRQ(16, 0)
+#define IRQ_HDMI_I2C   COMBINER_IRQ(16, 1)
+
 #define IRQ_TIMER0_VIC COMBINER_IRQ(22, 0)
 #define IRQ_TIMER1_VIC COMBINER_IRQ(22, 1)
 #define IRQ_TIMER2_VIC COMBINER_IRQ(22, 2)
@@ -99,6 +102,7 @@
 #define IRQ_IIC5   COMBINER_IRQ(27, 5)
 #define IRQ_IIC6   COMBINER_IRQ(27, 6)
 #define IRQ_IIC7   COMBINER_IRQ(27, 7)
+#define IRQ_IIC8   IRQ_HDMI_I2C
 
 #define IRQ_HSMMC0 COMBINER_IRQ(29, 0)
 #define IRQ_HSMMC1 COMBINER_IRQ(29, 1)
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h 
b/arch/arm/mach-s5pv310/include/mach/map.h
index 74d4006..845b739 100644
--- a/arch/arm/mach-s5pv310/include/mach/map.h
+++ b/arch/arm/mach-s5pv310/include/mach/map.h
@@ -141,6 +141,7 @@
 #define S3C_PA_IIC5S5PV310_PA_IIC(5)
 #define S3C_PA_IIC6S5PV310_PA_IIC(6)
 #define S3C_PA_IIC7S5PV310_PA_IIC(7)
+#define S3C_PA_IIC8S5PV310_PA_IIC(8)
 #define S3C_PA_RTC S5PV310_PA_RTC
 #define S3C_PA_WDT S5PV310_PA_WATCHDOG
 #define S5P_PA_MIPI_CSIS0  S5PV310_PA_MIPI_CSIS0
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 32be05c..dd1fd15 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -211,6 +211,11 @@ config S3C_DEV_I2C7
help
  Compile in platform device definition for I2C controller 7
 
+config S3C_DEV_I2C8
+   bool
+   help
+ Compile in platform device definitions for I2C channel 8 (HDMIPHY)
+
 config S3C_DEV_FB
bool
help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 29932f8..5df8db7 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_S3C_DEV_I2C4)+= dev-i2c4.o
 obj-$(CONFIG_S3C_DEV_I2C5) += dev-i2c5.o
 obj-$(CONFIG_S3C_DEV_I2C6) += dev-i2c6.o
 obj-$(CONFIG_S3C_DEV_I2C7) += dev-i2c7.o
+obj-$(CONFIG_S3C_DEV_I2C8) += dev-i2c8.o
 obj-$(CONFIG_S3C_DEV_FB)   += dev-fb.o
 obj-y  += dev-uart.o
 obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o
diff --git a/arch/arm/plat-samsung/dev-i2c8.c b/arch/arm/plat-samsung/dev-i2c8.c
new file mode 100644
index 000..8edba7f
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c8.c
@@ -0,0 +1,68 @@
+/* linux/arch/arm/plat-samsung/dev-i2c7.c
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * S3C series device definition for i2c device 8
+ *
+ * Based on plat-samsung/dev-i2c8.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include linux/gfp.h
+#include linux/kernel.h
+#include linux/string.h
+#include linux/platform_device.h
+
+#include mach/irqs.h
+#include mach/map.h
+
+#include plat/regs-iic.h
+#include plat/iic.h
+#include plat/devs.h
+#include plat/cpu.h
+
+static struct resource s3c_i2c_resource[] = {
+   [0] = {
+   .start = S3C_PA_IIC8,
+   .end   = S3C_PA_IIC8 + SZ_4K - 1

[PATCH 5/5] s5pc210: add s5p-tv to platform devices

2011-02-08 Thread Tomasz Stanislawski
Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Reviewed-by: Marek Szyprowski m.szyprow...@samsung.com
---
 arch/arm/mach-s5pv310/Kconfig   |7 +
 arch/arm/mach-s5pv310/Makefile  |1 +
 arch/arm/mach-s5pv310/clock.c   |  126 +++-
 arch/arm/mach-s5pv310/dev-tv.c  |  450 +++
 arch/arm/mach-s5pv310/include/mach/irqs.h   |4 +
 arch/arm/mach-s5pv310/include/mach/map.h|   26 ++
 arch/arm/mach-s5pv310/include/mach/regs-clock.h |   15 +
 arch/arm/plat-samsung/include/plat/devs.h   |2 +
 8 files changed, 630 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/dev-tv.c

diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig
index 09c4c21..e62103b 100644
--- a/arch/arm/mach-s5pv310/Kconfig
+++ b/arch/arm/mach-s5pv310/Kconfig
@@ -20,6 +20,11 @@ config S5PV310_DEV_PD
help
  Compile in platform device definitions for Power Domain
 
+config S5PV310_DEV_TV
+   bool
+   help
+ Compile in platform device definition for TV interface
+
 config S5PV310_SETUP_I2C1
bool
help
@@ -102,6 +107,8 @@ config MACH_UNIVERSAL_C210
select S3C_DEV_HSMMC3
select S5PV310_SETUP_SDHCI
select S3C_DEV_I2C1
+   select S3C_DEV_I2C8
+   select S5PV310_DEV_TV
select S5PV310_SETUP_I2C1
help
  Machine support for Samsung Mobile Universal S5PC210 Reference
diff --git a/arch/arm/mach-s5pv310/Makefile b/arch/arm/mach-s5pv310/Makefile
index 036fb38..a234b80 100644
--- a/arch/arm/mach-s5pv310/Makefile
+++ b/arch/arm/mach-s5pv310/Makefile
@@ -32,6 +32,7 @@ obj-y += dev-audio.o
 obj-$(CONFIG_S5PV310_DEV_PD)   += dev-pd.o
 obj-$(CONFIG_S5PV310_DEV_SYSMMU)   += dev-sysmmu.o
 
+obj-$(CONFIG_S5PV310_DEV_TV)   += dev-tv.o
 obj-$(CONFIG_S5PV310_SETUP_I2C1)   += setup-i2c1.o
 obj-$(CONFIG_S5PV310_SETUP_I2C2)   += setup-i2c2.o
 obj-$(CONFIG_S5PV310_SETUP_I2C3)   += setup-i2c3.o
diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c
index 6161b54..5bca261 100644
--- a/arch/arm/mach-s5pv310/clock.c
+++ b/arch/arm/mach-s5pv310/clock.c
@@ -81,6 +81,11 @@ static int s5pv310_clksrc_mask_peril1_ctrl(struct clk *clk, 
int enable)
return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable);
 }
 
+static int s5pv310_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKSRC_MASK_TV, clk, enable);
+}
+
 static int s5pv310_clk_ip_cam_ctrl(struct clk *clk, int enable)
 {
return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
@@ -116,6 +121,11 @@ static int s5pv310_clk_ip_perir_ctrl(struct clk *clk, int 
enable)
return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
 }
 
+static int s5pv310_clk_ip_tv_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable);
+}
+
 /* Core list of CMU_CPU side */
 
 static struct clksrc_clk clk_mout_apll = {
@@ -432,6 +442,26 @@ static struct clk init_clocks_off[] = {
.enable = s5pv310_clk_ip_lcd1_ctrl,
.ctrlbit= (1  0),
}, {
+   .name   = dac,
+   .id = -1,
+   .enable = s5pv310_clk_ip_tv_ctrl,
+   .ctrlbit= (1  2),
+   }, {
+   .name   = mixer,
+   .id = -1,
+   .enable = s5pv310_clk_ip_tv_ctrl,
+   .ctrlbit= (1  1),
+   }, {
+   .name   = vp,
+   .id = -1,
+   .enable = s5pv310_clk_ip_tv_ctrl,
+   .ctrlbit= (1  0),
+   }, {
+   .name   = hdmi,
+   .id = -1,
+   .enable = s5pv310_clk_ip_tv_ctrl,
+   .ctrlbit= (1  3),
+   }, {
.name   = hsmmc,
.id = 0,
.parent = clk_aclk_133.clk,
@@ -697,6 +727,93 @@ static struct clksrc_sources clkset_mout_g2d = {
.nr_sources = ARRAY_SIZE(clkset_mout_g2d_list),
 };
 
+/* --
+ * TV subsystem CLOCKS
+ * --
+ */
+
+static struct clk *clkset_sclk_dac_list[] = {
+   [0] = clk_sclk_vpll.clk,
+   [1] = clk_sclk_hdmiphy,
+};
+
+static struct clksrc_sources clkset_sclk_dac = {
+   .sources= clkset_sclk_dac_list,
+   .nr_sources = ARRAY_SIZE(clkset_sclk_dac_list),
+};
+
+static struct clksrc_clk clk_sclk_dac = {
+   .clk= {
+   .name   = sclk_dac,
+   .id = -1,
+   .enable = s5pv310_clksrc_mask_tv_ctrl,
+   .ctrlbit= (1  8

Re: [PATCH/RFC 0/5] HDMI driver for Samsung S5PV310 platform

2011-02-08 Thread Tomasz Stanislawski

Hans Verkuil wrote:

Just two quick notes. I'll try to do a full review this weekend.

On Tuesday, February 08, 2011 10:30:22 Tomasz Stanislawski wrote:

==
 Introduction
==

The purpose of this RFC is to discuss the driver for a TV output interface
available in upcoming Samsung SoC. The HW is able to generate digital and
analog signals. Current version of the driver supports only digital output.

Internally the driver uses videobuf2 framework, and CMA memory allocator.  

Not

all of them are merged by now, but I decided to post the sources to start
discussion driver's design.

==
 Hardware description
==

The SoC contains a few HW sub-blocks:

1. Video Processor (VP). It is used for processing of NV12 data.  An image
stored in RAM is accessed by DMA. Pixels are cropped, scaled. Additionally,
post processing operations like brightness, sharpness and contrast 

adjustments

could be performed. The output in YCbCr444 format is send to Mixer.

2. Mixer (MXR). The piece of hardware responsible for mixing and blending
multiple data inputs before passing it to an output device.  The MXR is 

capable
of handling up to three image layers. One is the output of VP.  Other two 

are
images in RGB format (multiple variants are supported).  The layers are 

scaled,

cropped and blended with background color.  The blending factor, and layers'
priority are controlled by MXR's registers. The output is passed either to 

HDMI

or TVOUT.

3. HDMI. The piece of HW responsible for generation of HDMI packets. It 

takes

pixel data from mixer and transforms it into data frames. The output is send
to HDMIPHY interface.

4. HDMIPHY. Physical interface for HDMI. Its duties are sending HDMI packets 

to

HDMI connector. Basically, it contains a PLL that produces source clock for
Mixer, VP and HDMI during streaming.

5. TVOUT. Generation of TV analog signal. (driver not implemented)

6. VideoDAC. Modulator for TVOUT signal. (driver not implemented)


The diagram below depicts connection between all HW pieces.
+---+
NV12 data ---dma---|   Video   |
| Processor |
+---+
  |
  V
+---+
RGB data  ---dma---|   |
|   Mixer   |
RGB data  ---dma---|   |
+---+
  |
  * dmux
 /
  +-*   *--+
  ||
  VV
+---++---+
|HDMI   ||   TVOUT   |
+---++---+
  ||
  VV
+---++---+
|  HDMIPHY  ||  VideoDAC |
+---++---+
  ||
  VV
HDMI   Composite
 connector connector


==
 Driver interface
==

The posted driver implements three V4L2 nodes. Every video node implements 

V4L2
output buffer. One of nodes corresponds to input of Video Processor. The 

other
two nodes correspond to RGB inputs of Mixer. All nodes share the same 

output.
It is one of the Mixer's outputs: TVOUT or HDMI. Changing output in one 

layer

using S_OUTPUT would change outputs of all other video nodes. The same thing
happens if one try to reconfigure output i.e. by calling S_DV_PRESET. 

However
it not possible to change or reconfigure the output while streaming. To sum 

up,

all features in posted version of driver goes as follows:

1. QUERYCAP
2. S_FMT, G_FMT - single and multiplanar API
  a) node named video0 supports formats NV12, NV12, NV12T (tiled version of
NV12), NV12MT (multiplane version of NV12T).
  b) nodes named graph0 and graph1 support formats RGB565, ARGB1555, 

ARGB,

ARGB.


graph0? Do you perhaps mean fb0? I haven't heard about nodes names 'graph' 
before.



Hello,
Of course all nodes are named using /dev/video* pattern. By video0, 
graph0, graph1 I mean struct video_device.name. Internal name of a 
mixer's layer.


Regards,
Tomasz Stanislawski





3. Buffer with USERPTR and MMAP memory.
4. Streaming and buffer control. (STREAMON, STREAMOFF, REQBUF, QBUF, DQBUF)
5. OUTPUT enumeration.
6. DV preset control (SET, GET, ENUM). Currently modes 480P59_94, 720P59_94,
1080P30, 1080P59_94 and 1080P60 work.
7. Positioning layer's window on output display using S_CROP, G_GROP, 

CROPCAP.
8. Positioning and cropping data in buffer using S_CROP, G_GROP, CROPCAP 

with

buffer type OVERLAY. *

TODOs:
- add analog TVOUT driver
- add S_OUTPUT
- add S_STD ioctl
- add control of alpha blending / chroma keying via V4L2 controls
- add controls for luminance curve and sharpness in VP