[PATCH] backlight: add regulator support for platform_lcd driver

2011-12-05 Thread Thomas Abraham
The power source to the lcd panel or the lcd interface such as lvds
transmitters could be controlled by a regulator supply. Add support
for enabling/disabling the regulator when switching power to lcd.

Two new elements 'min_uV' and 'max_uV' in the platform data are added
to allow platform code to specifiy the desired output voltage from the
regulator.

Cc: Ben Dooks ben-li...@fluff.org
Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
---
 drivers/video/backlight/platform_lcd.c |   29 +
 include/video/platform_lcd.h   |7 +++
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/drivers/video/backlight/platform_lcd.c 
b/drivers/video/backlight/platform_lcd.c
index 302330a..ffa8108 100644
--- a/drivers/video/backlight/platform_lcd.c
+++ b/drivers/video/backlight/platform_lcd.c
@@ -17,6 +17,8 @@
 #include linux/backlight.h
 #include linux/lcd.h
 #include linux/slab.h
+#include linux/regulator/consumer.h
+#include linux/regulator/machine.h
 
 #include video/platform_lcd.h
 
@@ -44,11 +46,38 @@ static int platform_lcd_get_power(struct lcd_device *lcd)
 static int platform_lcd_set_power(struct lcd_device *lcd, int power)
 {
struct platform_lcd *plcd = to_our_lcd(lcd);
+   struct regulator *lcd_regulator;
int lcd_power = 1;
 
if (power == FB_BLANK_POWERDOWN || plcd-suspended)
lcd_power = 0;
 
+   /*
+* If power to lcd and/or lcd interface is controlled using a regulator,
+* enable or disable the regulator based in the power setting.
+*/
+   lcd_regulator = regulator_get(plcd-us, vcc_lcd);
+   if (IS_ERR(lcd_regulator)) {
+   dev_info(plcd-us, could not get regulator\n);
+   goto set_power;
+   }
+
+   if (lcd_power) {
+   if (plcd-pdata-min_uV || plcd-pdata-max_uV)
+   if (regulator_set_voltage(lcd_regulator,
+   plcd-pdata-min_uV, plcd-pdata-max_uV))
+   dev_info(plcd-us,
+   regulator voltage set failed\n);
+
+   if (regulator_enable(lcd_regulator))
+   dev_info(plcd-us, failed to enable regulator\n);
+   } else {
+   regulator_disable(lcd_regulator);
+   }
+
+   regulator_put(lcd_regulator);
+
+set_power:
plcd-pdata-set_power(plcd-pdata, lcd_power);
plcd-power = power;
 
diff --git a/include/video/platform_lcd.h b/include/video/platform_lcd.h
index ad3bdfe..acd5d21 100644
--- a/include/video/platform_lcd.h
+++ b/include/video/platform_lcd.h
@@ -14,8 +14,15 @@
 struct plat_lcd_data;
 struct fb_info;
 
+/**
+ * struct plat_lcd_data - platform data for platform_lcd driver.
+ * @min_uV: Minimum required voltage output from the regulator.
+ * @max_uV: Maximum acceptable voltage output from the regulator.
+ */
 struct plat_lcd_data {
void(*set_power)(struct plat_lcd_data *, unsigned int power);
int (*match_fb)(struct plat_lcd_data *, struct fb_info *);
+   int min_uV;
+   int max_uV;
 };
 
-- 
1.6.6.rc2

--
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: exynos: allow platform-lcd driver to control lcd regulator source on origen

2011-12-05 Thread Thomas Abraham
The buck7 regulator of max8997 pmic which provides the power source to lcd panel
and the lvds transmitter is allowed to be controlled by the platform-lcd driver.
It is not required to apply the voltage source by default. Also, the voltage
range for buck7 regulator is modified as the per the values in the datasheet.

Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
---
 arch/arm/mach-exynos/mach-origen.c |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-origen.c 
b/arch/arm/mach-exynos/mach-origen.c
index f56d027..5456254 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -126,7 +126,7 @@ static struct regulator_consumer_supply __initdata 
buck3_consumer[] = {
REGULATOR_SUPPLY(vdd_g3d, mali_drm), /* G3D */
 };
 static struct regulator_consumer_supply __initdata buck7_consumer[] = {
-   REGULATOR_SUPPLY(vcc, platform-lcd), /* LCD */
+   REGULATOR_SUPPLY(vcc_lcd, platform-lcd.0), /* LCD */
 };
 
 static struct regulator_init_data __initdata max8997_ldo1_data = {
@@ -379,11 +379,11 @@ static struct regulator_init_data __initdata 
max8997_buck5_data = {
 static struct regulator_init_data __initdata max8997_buck7_data = {
.constraints= {
.name   = VDD_LCD_3.3V,
-   .min_uV = 330,
-   .max_uV = 330,
+   .min_uV = 75,
+   .max_uV = 390,
.boot_on= 1,
-   .apply_uV   = 1,
-   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS |
+   REGULATOR_CHANGE_VOLTAGE,
.state_mem  = {
.disabled   = 1
},
@@ -562,6 +562,8 @@ static void lcd_hv070wsa_set_power(struct plat_lcd_data 
*pd, unsigned int power)
 
 static struct plat_lcd_data origen_lcd_hv070wsa_data = {
.set_power = lcd_hv070wsa_set_power,
+   .min_uV = 330,
+   .max_uV = 330,
 };
 
 static struct platform_device origen_lcd_hv070wsa = {
-- 
1.6.6.rc2

--
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] backlight: add regulator support for platform_lcd driver

2011-12-05 Thread Felipe Balbi
Hi,

On Mon, Dec 05, 2011 at 02:18:41PM +0530, Thomas Abraham wrote:
 The power source to the lcd panel or the lcd interface such as lvds
 transmitters could be controlled by a regulator supply. Add support
 for enabling/disabling the regulator when switching power to lcd.
 
 Two new elements 'min_uV' and 'max_uV' in the platform data are added
 to allow platform code to specifiy the desired output voltage from the
 regulator.
 
 Cc: Ben Dooks ben-li...@fluff.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
  drivers/video/backlight/platform_lcd.c |   29 +
  include/video/platform_lcd.h   |7 +++
  2 files changed, 36 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/video/backlight/platform_lcd.c 
 b/drivers/video/backlight/platform_lcd.c
 index 302330a..ffa8108 100644
 --- a/drivers/video/backlight/platform_lcd.c
 +++ b/drivers/video/backlight/platform_lcd.c
 @@ -17,6 +17,8 @@
  #include linux/backlight.h
  #include linux/lcd.h
  #include linux/slab.h
 +#include linux/regulator/consumer.h
 +#include linux/regulator/machine.h
  
  #include video/platform_lcd.h
  
 @@ -44,11 +46,38 @@ static int platform_lcd_get_power(struct lcd_device *lcd)
  static int platform_lcd_set_power(struct lcd_device *lcd, int power)
  {
   struct platform_lcd *plcd = to_our_lcd(lcd);
 + struct regulator *lcd_regulator;
   int lcd_power = 1;
  
   if (power == FB_BLANK_POWERDOWN || plcd-suspended)
   lcd_power = 0;
  
 + /*
 +  * If power to lcd and/or lcd interface is controlled using a regulator,
 +  * enable or disable the regulator based in the power setting.
 +  */
 + lcd_regulator = regulator_get(plcd-us, vcc_lcd);
 + if (IS_ERR(lcd_regulator)) {
 + dev_info(plcd-us, could not get regulator\n);
 + goto set_power;
 + }
 +
 + if (lcd_power) {
 + if (plcd-pdata-min_uV || plcd-pdata-max_uV)
 + if (regulator_set_voltage(lcd_regulator,
 + plcd-pdata-min_uV, plcd-pdata-max_uV))
 + dev_info(plcd-us,
 + regulator voltage set failed\n);
 +
 + if (regulator_enable(lcd_regulator))
 + dev_info(plcd-us, failed to enable regulator\n);
 + } else {
 + regulator_disable(lcd_regulator);
 + }
 +
 + regulator_put(lcd_regulator);

I wonder why you -get() and -put() everytime here. Wouldn't it be
enough to -get() on probe() and -put() on remove() ??

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] backlight: add regulator support for platform_lcd driver

2011-12-05 Thread Thomas Abraham
Hi Felipe,

On 5 December 2011 14:22, Felipe Balbi ba...@ti.com wrote:

[...]

 +     if (lcd_power) {
 +             if (plcd-pdata-min_uV || plcd-pdata-max_uV)
 +                     if (regulator_set_voltage(lcd_regulator,
 +                             plcd-pdata-min_uV, plcd-pdata-max_uV))
 +                             dev_info(plcd-us,
 +                                     regulator voltage set failed\n);
 +
 +             if (regulator_enable(lcd_regulator))
 +                     dev_info(plcd-us, failed to enable regulator\n);
 +     } else {
 +             regulator_disable(lcd_regulator);
 +     }
 +
 +     regulator_put(lcd_regulator);

 I wonder why you -get() and -put() everytime here. Wouldn't it be
 enough to -get() on probe() and -put() on remove() ??

Thanks for the suggestion. It would be simpler if done in probe. I
will redo this patch.

Regards,
Thomas.


 --
 balbi

--
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: MFC V1.0 questions

2011-12-05 Thread Kamil Debski
Hi,

 From: linux-samsung-soc-ow...@vger.kernel.org [mailto:linux-samsung-soc-
 ow...@vger.kernel.org] On Behalf Of Dron Gus
 Sent: 02 December 2011 12:17

 Hello

 I am interested in a couple of questions related to mfv v1.0, used in
 the s3c6410.
 1) Does anyone work on mfc v1.0 driver for mainline?

There is no driver in the mainline. However you may find it in some repos
on the web http://www.google.com/search?q=samsung+kernel+mfc10+driver
that have an MFC 1.0 driver present.

 2) whether there is a newer firmware for MFC processor other than the V137?

I have no idea. You may want to contact Samsung LSI in this matter
http://www.samsung.com/global/business/semiconductor/footer/Footer_ContactUs.html

 3) how much different MFC version 1.0 (6410) and 4.0 (pv210). Should I
 rely on the driver for MFC v4.0, when writing a driver for V1.0?

These MFC version are very different. In addition there are many differences 
between
version 4.0 and 5.0, although you can find some similarities between 4.0 and 
5.0.

For version 5.0 you can find the driver in mainline http://goo.gl/fbCKF.

If you want to write the driver then you should consider using the V4L2 codec 
API.

Best wishes,
Kamil Debski


The above message is intended solely for the named addressee and may contain 
trade secret, industrial technology or privileged and confidential information 
otherwise protected under applicable law. Any unauthorized dissemination, 
distribution, copying or use of the information contained in this communication 
is strictly prohibited. If you have received this communication in error, 
please notify sender by email and delete this communication immediately.


Powyższa wiadomość przeznaczona jest wyłącznie dla adresata niniejszej 
wiadomości i może zawierać informacje będące tajemnicą handlową, tajemnicą 
przedsiębiorstwa oraz informacje o charakterze poufnym chronione obowiązującymi 
przepisami prawa. Jakiekolwiek nieuprawnione ich rozpowszechnianie, 
dystrybucja, kopiowanie lub użycie informacji zawartych w powyższej wiadomości 
jest zabronione. Jeśli otrzymałeś powyższą wiadomość omyłkowo, uprzejmie proszę 
poinformuj o tym fakcie drogą mailową nadawcę tej wiadomości oraz niezwłocznie 
usuń powyższą wiadomość ze swojego komputera.


Re: [PATCH] backlight: add regulator support for platform_lcd driver

2011-12-05 Thread Kyungmin Park
On 12/5/11, Thomas Abraham thomas.abra...@linaro.org wrote:
 The power source to the lcd panel or the lcd interface such as lvds
 transmitters could be controlled by a regulator supply. Add support
 for enabling/disabling the regulator when switching power to lcd.

 Two new elements 'min_uV' and 'max_uV' in the platform data are added
 to allow platform code to specifiy the desired output voltage from the
 regulator.

 Cc: Ben Dooks ben-li...@fluff.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
  drivers/video/backlight/platform_lcd.c |   29 +
  include/video/platform_lcd.h   |7 +++
  2 files changed, 36 insertions(+), 0 deletions(-)

 diff --git a/drivers/video/backlight/platform_lcd.c
 b/drivers/video/backlight/platform_lcd.c
 index 302330a..ffa8108 100644
 --- a/drivers/video/backlight/platform_lcd.c
 +++ b/drivers/video/backlight/platform_lcd.c
 @@ -17,6 +17,8 @@
  #include linux/backlight.h
  #include linux/lcd.h
  #include linux/slab.h
 +#include linux/regulator/consumer.h
 +#include linux/regulator/machine.h

  #include video/platform_lcd.h

 @@ -44,11 +46,38 @@ static int platform_lcd_get_power(struct lcd_device
 *lcd)
  static int platform_lcd_set_power(struct lcd_device *lcd, int power)
  {
   struct platform_lcd *plcd = to_our_lcd(lcd);
 + struct regulator *lcd_regulator;
   int lcd_power = 1;

   if (power == FB_BLANK_POWERDOWN || plcd-suspended)
   lcd_power = 0;

 + /*
 +  * If power to lcd and/or lcd interface is controlled using a regulator,
 +  * enable or disable the regulator based in the power setting.
 +  */
 + lcd_regulator = regulator_get(plcd-us, vcc_lcd);
 + if (IS_ERR(lcd_regulator)) {
 + dev_info(plcd-us, could not get regulator\n);
 + goto set_power;
 + }

Recent regulator discussion. it should be failed instead fall through
gracefully.
 +
 + if (lcd_power) {
 + if (plcd-pdata-min_uV || plcd-pdata-max_uV)
 + if (regulator_set_voltage(lcd_regulator,
 + plcd-pdata-min_uV, plcd-pdata-max_uV))
 + dev_info(plcd-us,
 + regulator voltage set failed\n);
Are there case to change the voltage? Doesn't it easy to set the
voltage at board file? I mean don't need to setup at drivers?

Thank you,
Kyungmin Park
 +
 + if (regulator_enable(lcd_regulator))
 + dev_info(plcd-us, failed to enable regulator\n);
 + } else {
 + regulator_disable(lcd_regulator);
 + }
 +
 + regulator_put(lcd_regulator);
 +
 +set_power:
   plcd-pdata-set_power(plcd-pdata, lcd_power);
   plcd-power = power;

 diff --git a/include/video/platform_lcd.h b/include/video/platform_lcd.h
 index ad3bdfe..acd5d21 100644
 --- a/include/video/platform_lcd.h
 +++ b/include/video/platform_lcd.h
 @@ -14,8 +14,15 @@
  struct plat_lcd_data;
  struct fb_info;

 +/**
 + * struct plat_lcd_data - platform data for platform_lcd driver.
 + * @min_uV: Minimum required voltage output from the regulator.
 + * @max_uV: Maximum acceptable voltage output from the regulator.
 + */
  struct plat_lcd_data {
   void(*set_power)(struct plat_lcd_data *, unsigned int power);
   int (*match_fb)(struct plat_lcd_data *, struct fb_info *);
 + int min_uV;
 + int max_uV;
  };

 --
 1.6.6.rc2

 --
 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: [PATCH 2/2] arm: exynos: allow platform-lcd driver to control lcd regulator source on origen

2011-12-05 Thread Kyungmin Park
On 12/5/11, Thomas Abraham thomas.abra...@linaro.org wrote:
 The buck7 regulator of max8997 pmic which provides the power source to lcd
 panel
 and the lvds transmitter is allowed to be controlled by the platform-lcd
 driver.
 It is not required to apply the voltage source by default. Also, the voltage
 range for buck7 regulator is modified as the per the values in the
 datasheet.

 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
  arch/arm/mach-exynos/mach-origen.c |   12 +++-
  1 files changed, 7 insertions(+), 5 deletions(-)

 diff --git a/arch/arm/mach-exynos/mach-origen.c
 b/arch/arm/mach-exynos/mach-origen.c
 index f56d027..5456254 100644
 --- a/arch/arm/mach-exynos/mach-origen.c
 +++ b/arch/arm/mach-exynos/mach-origen.c
 @@ -126,7 +126,7 @@ static struct regulator_consumer_supply __initdata
 buck3_consumer[] = {
   REGULATOR_SUPPLY(vdd_g3d, mali_drm), /* G3D */
  };
  static struct regulator_consumer_supply __initdata buck7_consumer[] = {
 - REGULATOR_SUPPLY(vcc, platform-lcd), /* LCD */
 + REGULATOR_SUPPLY(vcc_lcd, platform-lcd.0), /* LCD */
  };

  static struct regulator_init_data __initdata max8997_ldo1_data = {
 @@ -379,11 +379,11 @@ static struct regulator_init_data __initdata
 max8997_buck5_data = {
  static struct regulator_init_data __initdata max8997_buck7_data = {
   .constraints= {
   .name   = VDD_LCD_3.3V,
 - .min_uV = 330,
 - .max_uV = 330,
 + .min_uV = 75,
 + .max_uV = 390,
It can support the voltage change at buck itself, but in board it's
fixed. I'm not sure it's correct usage at board file.

I think original code is better to understand and use it as name, it's
fixed v3.3 voltage.

Thank you,
Kyungmin Park
   .boot_on= 1,
 - .apply_uV   = 1,
 - .valid_ops_mask = REGULATOR_CHANGE_STATUS,
 + .valid_ops_mask = REGULATOR_CHANGE_STATUS |
 + REGULATOR_CHANGE_VOLTAGE,
   .state_mem  = {
   .disabled   = 1
   },
 @@ -562,6 +562,8 @@ static void lcd_hv070wsa_set_power(struct plat_lcd_data
 *pd, unsigned int power)

  static struct plat_lcd_data origen_lcd_hv070wsa_data = {
   .set_power = lcd_hv070wsa_set_power,
 + .min_uV = 330,
 + .max_uV = 330,
  };

  static struct platform_device origen_lcd_hv070wsa = {
 --
 1.6.6.rc2

 --
 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: [PATCH] backlight: add regulator support for platform_lcd driver

2011-12-05 Thread Mark Brown
On Mon, Dec 05, 2011 at 07:10:03PM +0900, Kyungmin Park wrote:

  +   if (plcd-pdata-min_uV || plcd-pdata-max_uV)
  +   if (regulator_set_voltage(lcd_regulator,
  +   plcd-pdata-min_uV, plcd-pdata-max_uV))
  +   dev_info(plcd-us,
  +   regulator voltage set failed\n);

 Are there case to change the voltage? Doesn't it easy to set the
 voltage at board file? I mean don't need to setup at drivers?

Yes, unless the driver changes the voltage it should just assume the
voltage is already set up sensibly and leave it up to the board to
do any configuration which is required on boot.

There is one existing driver which implements things this way in the
video subsystem but that should be fixed.
--
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] backlight: add regulator support for platform_lcd driver

2011-12-05 Thread Thomas Abraham
Dear Mr. Park,

On 5 December 2011 15:40, Kyungmin Park kmp...@infradead.org wrote:
[...]

 +     /*
 +      * If power to lcd and/or lcd interface is controlled using a 
 regulator,
 +      * enable or disable the regulator based in the power setting.
 +      */
 +     lcd_regulator = regulator_get(plcd-us, vcc_lcd);
 +     if (IS_ERR(lcd_regulator)) {
 +             dev_info(plcd-us, could not get regulator\n);
 +             goto set_power;
 +     }

 Recent regulator discussion. it should be failed instead fall through
 gracefully.

Ok. But in this case, there could be boards that do not use a
regulator for the lcd/display interface. Is it mandatory for fail if
regulator is not found. Sorry, I have not read through the regulator
discussion.

 +
 +     if (lcd_power) {
 +             if (plcd-pdata-min_uV || plcd-pdata-max_uV)
 +                     if (regulator_set_voltage(lcd_regulator,
 +                             plcd-pdata-min_uV, plcd-pdata-max_uV))
 +                             dev_info(plcd-us,
 +                                     regulator voltage set failed\n);
 Are there case to change the voltage? Doesn't it easy to set the
 voltage at board file? I mean don't need to setup at drivers?

The constraint 'apply_uV' cannot be expressed with a device tree. So
there has be a mechanism to set the required output voltage for a
regulator.

In case of platform-lcd driver, the power source should be turned off
to the lcd/interfaces until the display controller driver is enabled.
Powering on the lcd/interfaces at boot time by default would not be
ideal.

Thanks for your review and comments.

Regards,
Thomas.


 Thank you,
 Kyungmin Park

[...]
--
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: allow platform-lcd driver to control lcd regulator source on origen

2011-12-05 Thread Thomas Abraham
Dear Mr. Park,

On 5 December 2011 15:44, Kyungmin Park kmp...@infradead.org wrote:

[...]

  static struct regulator_init_data __initdata max8997_ldo1_data = {
 @@ -379,11 +379,11 @@ static struct regulator_init_data __initdata
 max8997_buck5_data = {
  static struct regulator_init_data __initdata max8997_buck7_data = {
       .constraints    = {
               .name           = VDD_LCD_3.3V,
 -             .min_uV         = 330,
 -             .max_uV         = 330,
 +             .min_uV         = 75,
 +             .max_uV         = 390,
 It can support the voltage change at buck itself, but in board it's
 fixed. I'm not sure it's correct usage at board file.

 I think original code is better to understand and use it as name, it's
 fixed v3.3 voltage.

Yes, that is true. If the board cannot support any other voltage for
buck7, there is no need to change min_uV and max_uV. I will revert it
to the original values.

Thanks,
Thomas.


 Thank you,
 Kyungmin Park

[...]
--
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] backlight: add regulator support for platform_lcd driver

2011-12-05 Thread Mark Brown
On Mon, Dec 05, 2011 at 04:06:17PM +0530, Thomas Abraham wrote:
 On 5 December 2011 15:40, Kyungmin Park kmp...@infradead.org wrote:

  Recent regulator discussion. it should be failed instead fall through
  gracefully.

 Ok. But in this case, there could be boards that do not use a
 regulator for the lcd/display interface. Is it mandatory for fail if
 regulator is not found. Sorry, I have not read through the regulator
 discussion.

The boards should supply a fixed voltage regulator representing the
supply (or use CONFIG_REGULATOR_DUMMY to substitute in a dummy regulator
when not needed).  Sascha Hauer had some patches to add a flag that
could be set to enable this mode on init rather than through Kconfig but
they needed a bit of cleanup, not sure what the status is there.

 The constraint 'apply_uV' cannot be expressed with a device tree. So
 there has be a mechanism to set the required output voltage for a
 regulator.

It's not an option to not have it with device tree - if there's a single
voltage specified apply_uV is assumed.
--
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 3/5] ARM: s5p: add L2 early resume code

2011-12-05 Thread Amit Daniel Kachhap
This patch adds code to resume L2 before MMU is enabled in
suspend and cpuidle resume paths. s3c_cpu_resume is moved to the
data section with appropriate comments.

Signed-off-by: Lorenzo Pieralisi lorenzo.pieral...@arm.com
Signed-off-by: Amit Daniel Kachhap amit.kach...@linaro.org
---
 arch/arm/plat-s5p/sleep.S |   44 ++--
 1 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-s5p/sleep.S b/arch/arm/plat-s5p/sleep.S
index 0fd591b..006bd01 100644
--- a/arch/arm/plat-s5p/sleep.S
+++ b/arch/arm/plat-s5p/sleep.S
@@ -23,9 +23,18 @@
 */
 
 #include linux/linkage.h
-#include asm/assembler.h
+#include asm/asm-offsets.h
+#include asm/hardware/cache-l2x0.h
 
-   .text
+/*
+ *  The following code is located into the .data section. This is to
+ *  allow l2x0_regs_phys to be accessed with a relative load while we
+ *  can't rely on any MMU translation. We could have put l2x0_regs_phys
+ *  in the .text section as well, but some setups might insist on it to
+ *  be truly read-only. (Reference from: arch/arm/kernel/sleep.S)
+ */
+   .data
+   .align
 
/*
 * sleep magic, to allow the bootloader to check for an valid
@@ -39,11 +48,34 @@
 * s3c_cpu_resume
 *
 * resume code entry for bootloader to call
-*
-* we must put this code here in the data segment as we have no
-* other way of restoring the stack pointer after sleep, and we
-* must not write to the code segment (code is read-only)
 */
 
 ENTRY(s3c_cpu_resume)
+#ifdef CONFIG_CACHE_L2X0
+   adr r0, l2x0_regs_phys
+   ldr r0, [r0]
+   ldr r1, [r0, #L2X0_R_PHY_BASE]
+   ldr r2, [r1, #L2X0_CTRL]
+   tst r2, #0x1
+   bne resume_l2on
+   ldr r2, [r0, #L2X0_R_AUX_CTRL]
+   str r2, [r1, #L2X0_AUX_CTRL]
+   ldr r2, [r0, #L2X0_R_TAG_LATENCY]
+   str r2, [r1, #L2X0_TAG_LATENCY_CTRL]
+   ldr r2, [r0, #L2X0_R_DATA_LATENCY]
+   str r2, [r1, #L2X0_DATA_LATENCY_CTRL]
+   ldr r2, [r0, #L2X0_R_PREFETCH_CTRL]
+   str r2, [r1, #L2X0_PREFETCH_CTRL]
+   ldr r2, [r0, #L2X0_R_PWR_CTRL]
+   str r2, [r1, #L2X0_POWER_CTRL]
+   mov r2, #1
+   str r2, [r1, #L2X0_CTRL]
+resume_l2on:
+#endif
b   cpu_resume
+ENDPROC(s3c_cpu_resume)
+#ifdef CONFIG_CACHE_L2X0
+   .globl l2x0_regs_phys
+l2x0_regs_phys:
+   .long   0
+#endif
-- 
1.7.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 4/5] ARM: exynos: remove useless code to save/restore L2

2011-12-05 Thread Amit Daniel Kachhap
Following the merge of CPU PM notifiers and L2 resume code, this patch
removes useless code to save and restore L2 registers.

This is now automatically covered by suspend calls which integrated
CPU PM notifiers and new sleep code that allows to resume L2 before MMU
is turned on.

Signed-off-by: Lorenzo Pieralisi lorenzo.pieral...@arm.com
Signed-off-by: Amit Daniel Kachhap amit.kach...@linaro.org
---
 arch/arm/mach-exynos/pm.c |   15 ---
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 4093fea..1883cc9 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -155,13 +155,6 @@ static struct sleep_save exynos4_core_save[] = {
SAVE_ITEM(S5P_SROM_BC3),
 };
 
-static struct sleep_save exynos4_l2cc_save[] = {
-   SAVE_ITEM(S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL),
-   SAVE_ITEM(S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL),
-   SAVE_ITEM(S5P_VA_L2CC + L2X0_PREFETCH_CTRL),
-   SAVE_ITEM(S5P_VA_L2CC + L2X0_POWER_CTRL),
-   SAVE_ITEM(S5P_VA_L2CC + L2X0_AUX_CTRL),
-};
 
 /* For Cortex-A9 Diagnostic and Power control register */
 static unsigned int save_arm_register[2];
@@ -182,7 +175,6 @@ static void exynos4_pm_prepare(void)
u32 tmp;
 
s3c_pm_do_save(exynos4_core_save, ARRAY_SIZE(exynos4_core_save));
-   s3c_pm_do_save(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save));
s3c_pm_do_save(exynos4_epll_save, ARRAY_SIZE(exynos4_epll_save));
s3c_pm_do_save(exynos4_vpll_save, ARRAY_SIZE(exynos4_vpll_save));
 
@@ -384,13 +376,6 @@ static void exynos4_pm_resume(void)
 
scu_enable(S5P_VA_SCU);
 
-#ifdef CONFIG_CACHE_L2X0
-   s3c_pm_do_restore_core(exynos4_l2cc_save, 
ARRAY_SIZE(exynos4_l2cc_save));
-   outer_inv_all();
-   /* enable L2X0*/
-   writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL);
-#endif
-
 early_wakeup:
return;
 }
-- 
1.7.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/5] ARM: exynos: Enable l2 configuration through device tree

2011-12-05 Thread Amit Daniel Kachhap
This patch enables calling generic l2 setup functions if device tree is used.

Signed-off-by: Amit Daniel Kachhap amit.kach...@linaro.org
---
 arch/arm/mach-exynos/cpu.c |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/cpu.c b/arch/arm/mach-exynos/cpu.c
index 252e346..b62a90f 100644
--- a/arch/arm/mach-exynos/cpu.c
+++ b/arch/arm/mach-exynos/cpu.c
@@ -37,6 +37,9 @@
 #include mach/regs-pmu.h
 #include mach/pmu.h
 
+#define L2_AUX_VAL 0x7C470001
+#define L2_AUX_MASK 0xC200
+
 unsigned int gic_bank_offset __read_mostly;
 
 extern int combiner_init(unsigned int combiner_nr, void __iomem *base,
@@ -299,6 +302,7 @@ core_initcall(exynos4_core_init);
 #ifdef CONFIG_CACHE_L2X0
 static int __init exynos4_l2x0_cache_init(void)
 {
+#ifndef CONFIG_OF
if (!(__raw_readl(S5P_VA_L2CC + L2X0_CTRL)  0x1)) {
l2x0_saved_regs.phy_base = EXYNOS4_PA_L2CC;
/* TAG, Data Latency Control: 2 cycles */
@@ -332,8 +336,12 @@ static int __init exynos4_l2x0_cache_init(void)
clean_dcache_area(l2x0_saved_regs, sizeof(struct l2x0_regs));
}
 
-   l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200);
-
+   l2x0_init(S5P_VA_L2CC, L2_AUX_VAL, L2_AUX_MASK);
+#else
+   l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
+   l2x0_regs_phys = virt_to_phys(l2x0_saved_regs);
+   clean_dcache_area(l2x0_regs_phys, sizeof(unsigned long));
+#endif
return 0;
 }
 
-- 
1.7.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 2/2] i2c-s3c2410: Add stub runtime power management

2011-12-05 Thread Mark Brown
Add stub runtime_pm calls which go through the flow of enabling and
disabling but don't actually do anything with the device itself as
there's nothing useful we can do. This provides the core PM framework
with information about when the device is idle, enabling chip wide
power savings.

Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
---
 drivers/i2c/busses/i2c-s3c2410.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index ed62a7f..065c316 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -31,6 +31,7 @@
 #include linux/errno.h
 #include linux/err.h
 #include linux/platform_device.h
+#include linux/pm_runtime.h
 #include linux/clk.h
 #include linux/cpufreq.h
 #include linux/slab.h
@@ -563,6 +564,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
int retry;
int ret;
 
+   pm_runtime_get_sync(adap-dev);
clk_enable(i2c-clk);
 
for (retry = 0; retry  adap-retries; retry++) {
@@ -571,6 +573,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
 
if (ret != -EAGAIN) {
clk_disable(i2c-clk);
+   pm_runtime_put_sync(adap-dev);
return ret;
}
 
@@ -580,6 +583,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
}
 
clk_disable(i2c-clk);
+   pm_runtime_put_sync(adap-dev);
return -EREMOTEIO;
 }
 
@@ -1012,6 +1016,9 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
of_i2c_register_devices(i2c-adap);
platform_set_drvdata(pdev, i2c);
 
+   pm_runtime_enable(pdev-dev);
+   pm_runtime_enable(i2c-adap.dev);
+
dev_info(pdev-dev, %s: S3C I2C adapter\n, dev_name(i2c-adap.dev));
clk_disable(i2c-clk);
return 0;
@@ -1046,6 +1053,9 @@ static int s3c24xx_i2c_remove(struct platform_device 
*pdev)
 {
struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
 
+   pm_runtime_disable(i2c-adap.dev);
+   pm_runtime_disable(pdev-dev);
+
s3c24xx_i2c_deregister_cpufreq(i2c);
 
i2c_del_adapter(i2c-adap);
-- 
1.7.7.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


Re: [PATCH v7 0/2] iommu/exynos: Add IOMMU/System MMU driver for Samsung Exynos

2011-12-05 Thread Kyungmin Park
On 12/6/11, Joerg Roedel joerg.roe...@amd.com wrote:
 On Fri, Nov 18, 2011 at 06:47:28PM +0900, KyongHo Cho wrote:
 Patch Summary:
 [PATCH v7 1/2] ARM: EXYNOS: Change System MMU platform device definitions
 [PATCH v7 2/2] iommu/exynos: Add iommu driver for Exynos Platforms

 Okay, I merged it into arm/exynos, but it is not pushed yet. Actually
 there were conflicts while merging, which I resolved. What I failed
 to find is a config for Exynos that actually builds for upstream Linux.
 Probably I havn't tried hard enough to find one... Can you provide a
 kernel config that I can use for my testing and that builds a current
 3.2-rc4 kernel for Exynos?
and I hope to see the real example how to use it with exynos platform.

Now I can't find the interface between exynos platform and generic exynos iommu.
BTW, how do you test it at mainline kernel?

Thank you,
Kyungmin Park


 Thanks,

   Joerg

 --
 AMD Operating System Research Center

 Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
 General Managers: Alberto Bozzo, Andrew Bowd
 Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr.
 43632

 --
 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


[PATCH resend3] arm: s3c24xx: Add new LCD (W35i) support for Mini2440 board

2011-12-05 Thread Denis Kuzmenko
Add new LCD (W35i) support for Mini2440 board

Signed-off-by: Denis Kuzmenko li...@solonet.org.ua
---

diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c
b/arch/arm/mach-s3c2440/mach-mini2440.c
index fc2dc0b..951eadd 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -167,6 +167,24 @@ static struct s3c2410fb_display mini2440_lcd_cfg[]
__initdata = {
.lcdcon5= (S3C2410_LCDCON5_FRM565 |
   S3C2410_LCDCON5_HWSWP),
},
+   /* mini2440 + 3.5 TFT (LCD-W35i, LQ035Q1DG06 type) + touchscreen*/
+   [3] = {
+   _LCD_DECLARE(
+   /* clock */
+   7,
+   /* xres, margin_right, margin_left, hsync */
+   320, 68, 66, 4,
+   /* yres, margin_top, margin_bottom, vsync */
+   240, 4, 4, 9,
+   /* refresh rate */
+   60),
+   .lcdcon5= (S3C2410_LCDCON5_FRM565 |
+  S3C2410_LCDCON5_INVVDEN |
+  S3C2410_LCDCON5_INVVFRAME |
+  S3C2410_LCDCON5_INVVLINE |
+  S3C2410_LCDCON5_INVVCLK |
+  S3C2410_LCDCON5_HWSWP),
+   },
 };
  /* todo - put into gpio header */
--
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 resend2] s3c24xx: cpufreq: Fix compilation error when CONFIG_CPU_FREQ_S3C24XX_DEBUGFS selected.

2011-12-05 Thread Denis Kuzmenko
Fix compilation error when CONFIG_CPU_FREQ_S3C24XX_DEBUGFS selected.

Signed-off-by: Denis Kuzmenko li...@solonet.org.ua
---

Patch is against 3.2-rc3.
CONFIG_S3C2410_IOTIMING wasn't present in Kconfig but was referenced by
Makefile. Because of this the file s3c2410-iotiming.c was not ever compiled
and enabling CONFIG_CPU_FREQ_S3C24XX_DEBUGFS option caused undefined
reference to function s3c2410_iotiming_debugfs defined in that file.

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 44789ef..81d7025 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2104,9 +2104,31 @@ config CPU_FREQ_S3C24XX_DEBUG
help
  Enable s3c_freq_dbg for the Samsung S3C CPUfreq core
 +config S3C2410_IOTIMING
+   bool CPUfreq iotiming for Samsung S3C2410 series CPUs
+   depends on ARCH_S3C2410  CPU_FREQ  CPU_FREQ_S3C24XX  EXPERIMENTAL
+   help
+ This enables the CPUfreq driver for the Samsung S3C24XX to change
+ IO timing according to the CPU frequency.
+
+ For details, take a look at file:Documentation/cpu-freq.
+
+ If in doubt, say Y.
+
+config S3C2412_IOTIMING
+   bool CPUfreq iotiming for Samsung S3C2412 series CPUs
+   depends on ARCH_S3C2412  CPU_FREQ  CPU_FREQ_S3C24XX  EXPERIMENTAL
+   help
+ This enables the CPUfreq driver for the Samsung S3C2412 to change
+ IO timing according to the CPU frequency.
+
+ For details, take a look at file:Documentation/cpu-freq.
+
+ If in doubt, say Y.
+
 config CPU_FREQ_S3C24XX_IODEBUG
bool Debug CPUfreq Samsung driver IO timing
-   depends on CPU_FREQ_S3C24XX
+   depends on CPU_FREQ_S3C24XX  (S3C2410_IOTIMING || S3C2412_IOTIMING)
help
  Enable s3c_freq_iodbg for the Samsung S3C CPUfreq core
 diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
index dac4760..c465252 100644
--- a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
+++ b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
@@ -202,13 +202,23 @@ extern int s3c_plltab_register(struct
cpufreq_frequency_table *plls,
 extern struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void);
 extern struct s3c_iotimings *s3c_cpufreq_getiotimings(void);
 -extern void s3c2410_iotiming_debugfs(struct seq_file *seq,
-struct s3c_cpufreq_config *cfg,
-union s3c_iobank *iob);
-
-extern void s3c2412_iotiming_debugfs(struct seq_file *seq,
-struct s3c_cpufreq_config *cfg,
-union s3c_iobank *iob);
+#ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS
+   #ifdef CONFIG_S3C2410_IOTIMING
+   extern void s3c2410_iotiming_debugfs(struct seq_file *seq,
+struct s3c_cpufreq_config *cfg,
+union s3c_iobank *iob);
+   #else
+   #define s3c2410_iotiming_debugfsNULL
+   #endif
+
+   #ifdef CONFIG_S3C2412_IOTIMING
+   extern void s3c2412_iotiming_debugfs(struct seq_file *seq,
+struct s3c_cpufreq_config *cfg,
+union s3c_iobank *iob);
+   #else
+   #define s3c2412_iotiming_debugfsNULL
+   #endif
+#endif
  #ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS
 #define s3c_cpufreq_debugfs_call(x) x
@@ -241,10 +251,7 @@ extern void s3c2410_iotiming_set(struct
s3c_cpufreq_config *cfg,
 #endif /* CONFIG_S3C2410_IOTIMING */
  /* S3C2412 compatible routines */
-
-extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
-   struct s3c_iotimings *timings);
-
+#ifdef CONFIG_S3C2412_IOTIMING
 extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
struct s3c_iotimings *timings);
 @@ -253,6 +260,11 @@ extern int s3c2412_iotiming_calc(struct
s3c_cpufreq_config *cfg,
  extern void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
 struct s3c_iotimings *iot);
+#else
+#define s3c2412_iotiming_calc NULL
+#define s3c2412_iotiming_get NULL
+#define s3c2412_iotiming_set NULL
+#endif
  #ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUG
 #define s3c_freq_dbg(x...) printk(KERN_INFO x)
--
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 v2 0/3] Support Samsung Exynos OHCI device and driver

2011-12-05 Thread Jingoo Han
Hello.

This patch series adds USB OHCI device and initial driver for Samsung
Exynos SoCs and is based from linux-samsung for-next branch.
I have tested on SMDKV310 board using EXYNOS4.

Thanks.

Jingoo Han (3) :
   ARM: EXYNOS: Add USB OHCI device
   ARM: EXYNOS: Add USB OHCI support to SMDKV310 board
   USB: Add Samsung Exynos OHCI diver

Changes since v1:
- Replace ohci-s5p with ohci-exynos
- Check phy control


--
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 v2 1/3] ARM: EXYNOS: Add USB OHCI device

2011-12-05 Thread Jingoo Han
This patch adds USB ohci device definition for Exynos SoCs.

Signed-off-by: Jingoo Han jg1@samsung.com
---
 arch/arm/mach-exynos/Kconfig  |5 +++
 arch/arm/mach-exynos/Makefile |1 +
 arch/arm/mach-exynos/dev-ohci.c   |   52 +
 arch/arm/mach-exynos/include/mach/map.h   |1 +
 arch/arm/mach-exynos/include/mach/ohci.h  |   21 +++
 arch/arm/mach-exynos/setup-usb-phy.c  |   15 
 arch/arm/plat-samsung/include/plat/devs.h |1 +
 7 files changed, 96 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-exynos/dev-ohci.c
 create mode 100644 arch/arm/mach-exynos/include/mach/ohci.h

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 0afcc3b..dec3ee3 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -87,6 +87,11 @@ config EXYNOS4_DEV_DWMCI
help
  Compile in platform device definitions for DWMCI
 
+config EXYNOS4_DEV_USB_OHCI
+   bool
+   help
+ Compile in platform device definition for USB OHCI
+
 config EXYNOS4_SETUP_I2C1
bool
help
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 57e5296..a81a1c1 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_EXYNOS4_DEV_AHCI)+= dev-ahci.o
 obj-$(CONFIG_EXYNOS4_DEV_PD)   += dev-pd.o
 obj-$(CONFIG_EXYNOS4_DEV_SYSMMU)   += dev-sysmmu.o
 obj-$(CONFIG_EXYNOS4_DEV_DWMCI)+= dev-dwmci.o
+obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o
 obj-$(CONFIG_EXYNOS4_DEV_DMA)  += dma.o
 
 obj-$(CONFIG_EXYNOS4_SETUP_FIMC)   += setup-fimc.o
diff --git a/arch/arm/mach-exynos/dev-ohci.c b/arch/arm/mach-exynos/dev-ohci.c
new file mode 100644
index 000..b8e7530
--- /dev/null
+++ b/arch/arm/mach-exynos/dev-ohci.c
@@ -0,0 +1,52 @@
+/* linux/arch/arm/mach-exynos/dev-ohci.c
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * EXYNOS - OHCI support
+ *
+ * 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 linux/platform_device.h
+
+#include mach/irqs.h
+#include mach/map.h
+#include mach/ohci.h
+
+#include plat/devs.h
+#include plat/usb-phy.h
+
+static struct resource exynos4_ohci_resource[] = {
+   [0] = DEFINE_RES_MEM(EXYNOS4_PA_OHCI, SZ_256),
+   [1] = DEFINE_RES_IRQ(IRQ_USB_HOST),
+};
+
+static u64 exynos4_ohci_dma_mask = DMA_BIT_MASK(32);
+
+struct platform_device exynos4_device_ohci = {
+   .name   = exynos-ohci,
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(exynos4_ohci_resource),
+   .resource   = exynos4_ohci_resource,
+   .dev= {
+   .dma_mask   = exynos4_ohci_dma_mask,
+   .coherent_dma_mask  = DMA_BIT_MASK(32),
+   }
+};
+
+void __init exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd)
+{
+   struct exynos4_ohci_platdata *npd;
+
+   npd = s3c_set_platdata(pd, sizeof(struct exynos4_ohci_platdata),
+   exynos4_device_ohci);
+
+   if (!npd-phy_init)
+   npd-phy_init = s5p_usb_phy_init;
+   if (!npd-phy_exit)
+   npd-phy_exit = s5p_usb_phy_exit;
+}
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index 03e2c99..a9897b4 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -108,6 +108,7 @@
 #define EXYNOS4_PA_SROMC   0x1257
 
 #define EXYNOS4_PA_EHCI0x1258
+#define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
 #define EXYNOS4_PA_MFC 0x1340
 
diff --git a/arch/arm/mach-exynos/include/mach/ohci.h 
b/arch/arm/mach-exynos/include/mach/ohci.h
new file mode 100644
index 000..c256c59
--- /dev/null
+++ b/arch/arm/mach-exynos/include/mach/ohci.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ * http://www.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.
+ */
+
+#ifndef __MACH_EXYNOS_OHCI_H
+#define __MACH_EXYNOS_OHCI_H
+
+struct exynos4_ohci_platdata {
+   int (*phy_init)(struct platform_device *pdev, int type);
+   int (*phy_exit)(struct platform_device *pdev, int type);
+};
+
+extern void exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd);
+
+#endif /* __MACH_EXYNOS_OHCI_H */
diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 

[PATCH v2 2/3] ARM: EXYNOS: Add USB OHCI support to SMDKV310 board

2011-12-05 Thread Jingoo Han
This patch adds USB OHCI support to SMDKV310 board.

Signed-off-by: Jingoo Han jg1@samsung.com
---
 arch/arm/mach-exynos/Kconfig |1 +
 arch/arm/mach-exynos/mach-smdkv310.c |   13 +
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index dec3ee3..bd1bb9f 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -190,6 +190,7 @@ config MACH_SMDKV310
select EXYNOS4_DEV_DMA
select EXYNOS4_DEV_PD
select SAMSUNG_DEV_PWM
+   select EXYNOS4_DEV_USB_OHCI
select EXYNOS4_DEV_SYSMMU
select EXYNOS4_SETUP_FIMD0
select EXYNOS4_SETUP_I2C1
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c 
b/arch/arm/mach-exynos/mach-smdkv310.c
index cec2afa..25a5a40 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -42,6 +42,7 @@
 #include plat/clock.h
 
 #include mach/map.h
+#include mach/ohci.h
 
 /* Following are default values for UCON, ULCON and UFCON UART registers */
 #define SMDKV310_UCON_DEFAULT  (S3C2410_UCON_TXILEVEL |\
@@ -245,6 +246,16 @@ static void __init smdkv310_ehci_init(void)
s5p_ehci_set_platdata(pdata);
 }
 
+/* USB OHCI */
+static struct exynos4_ohci_platdata smdkv310_ohci_pdata;
+
+static void __init smdkv310_ohci_init(void)
+{
+   struct exynos4_ohci_platdata *pdata = smdkv310_ohci_pdata;
+
+   exynos4_ohci_set_platdata(pdata);
+}
+
 static struct platform_device *smdkv310_devices[] __initdata = {
s3c_device_hsmmc0,
s3c_device_hsmmc1,
@@ -261,6 +272,7 @@ static struct platform_device *smdkv310_devices[] 
__initdata = {
s5p_device_fimc3,
exynos4_device_ac97,
exynos4_device_i2s0,
+   exynos4_device_ohci,
samsung_device_keypad,
s5p_device_mfc,
s5p_device_mfc_l,
@@ -363,6 +375,7 @@ static void __init smdkv310_machine_init(void)
s5p_fimd0_set_platdata(smdkv310_lcd0_pdata);
 
smdkv310_ehci_init();
+   smdkv310_ohci_init();
clk_xusbxti.rate = 2400;
 
platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
-- 
1.7.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 v2 3/3] USB: Add Samsung Exynos OHCI diver

2011-12-05 Thread Jingoo Han
This patch adds USB OHCI driver for Samsung Exynos SoCs.

Signed-off-by: Jingoo Han jg1@samsung.com
---
 drivers/usb/Kconfig|1 +
 drivers/usb/host/Kconfig   |6 +
 drivers/usb/host/ohci-exynos.c |  274 
 drivers/usb/host/ohci-hcd.c|5 +
 4 files changed, 286 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ohci-exynos.c

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 791f11b..75823a1 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -48,6 +48,7 @@ config USB_ARCH_HAS_OHCI
default y if ARCH_DAVINCI_DA8XX
default y if ARCH_CNS3XXX
default y if PLAT_SPEAR
+   default y if ARCH_EXYNOS
# PPC:
default y if STB03xxx
default y if PPC_MPC52xx
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 060e0e2..eea85dc 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -371,6 +371,12 @@ config USB_OHCI_SH
  Enables support for the on-chip OHCI controller on the SuperH.
  If you use the PCI OHCI controller, this option is not necessary.
 
+config USB_OHCI_EXYNOS
+   boolean OHCI support for Samsung EXYNOS SoC Series
+   depends on USB_OHCI_HCD  ARCH_EXYNOS
+   help
+Enable support for the Samsung Exynos SOC's on-chip OHCI controller.
+
 config USB_CNS3XXX_OHCI
bool Cavium CNS3XXX OHCI Module
depends on USB_OHCI_HCD  ARCH_CNS3XXX
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
new file mode 100644
index 000..55aa35a
--- /dev/null
+++ b/drivers/usb/host/ohci-exynos.c
@@ -0,0 +1,274 @@
+/*
+ * SAMSUNG EXYNOS USB HOST OHCI Controller
+ *
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ * Author: Jingoo Han jg1@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.
+ *
+ */
+
+#include linux/clk.h
+#include linux/platform_device.h
+#include mach/ohci.h
+#include plat/usb-phy.h
+
+struct exynos_ohci_hcd {
+   struct device *dev;
+   struct usb_hcd *hcd;
+   struct clk *clk;
+};
+
+static int ohci_exynos_start(struct usb_hcd *hcd)
+{
+   struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+   int ret;
+
+   ohci_dbg(ohci, ohci_exynos_start, ohci:%p, ohci);
+
+   ret = ohci_init(ohci);
+   if (ret  0)
+   return ret;
+
+   ret = ohci_run(ohci);
+   if (ret  0) {
+   err(can't start %s, hcd-self.bus_name);
+   ohci_stop(hcd);
+   return ret;
+   }
+
+   return 0;
+}
+
+static const struct hc_driver exynos_ohci_hc_driver = {
+   .description= hcd_name,
+   .product_desc   = EXYNOS OHCI Host Controller,
+   .hcd_priv_size  = sizeof(struct ohci_hcd),
+
+   .irq= ohci_irq,
+   .flags  = HCD_MEMORY|HCD_USB11,
+
+   .start  = ohci_exynos_start,
+   .stop   = ohci_stop,
+   .shutdown   = ohci_shutdown,
+
+   .get_frame_number   = ohci_get_frame,
+
+   .urb_enqueue= ohci_urb_enqueue,
+   .urb_dequeue= ohci_urb_dequeue,
+   .endpoint_disable   = ohci_endpoint_disable,
+
+   .hub_status_data= ohci_hub_status_data,
+   .hub_control= ohci_hub_control,
+#ifdef CONFIG_PM
+   .bus_suspend= ohci_bus_suspend,
+   .bus_resume = ohci_bus_resume,
+#endif
+   .start_port_reset   = ohci_start_port_reset,
+};
+
+static int __devinit exynos_ohci_probe(struct platform_device *pdev)
+{
+   struct exynos4_ohci_platdata *pdata;
+   struct exynos_ohci_hcd *exynos_ohci;
+   struct usb_hcd *hcd;
+   struct ohci_hcd *ohci;
+   struct resource *res;
+   int irq;
+   int err;
+
+   pdata = pdev-dev.platform_data;
+   if (!pdata) {
+   dev_err(pdev-dev, No platform data defined\n);
+   return -EINVAL;
+   }
+
+   exynos_ohci = kzalloc(sizeof(struct exynos_ohci_hcd), GFP_KERNEL);
+   if (!exynos_ohci)
+   return -ENOMEM;
+
+   exynos_ohci-dev = pdev-dev;
+
+   hcd = usb_create_hcd(exynos_ohci_hc_driver, pdev-dev,
+   dev_name(pdev-dev));
+   if (!hcd) {
+   dev_err(pdev-dev, Unable to create HCD\n);
+   err = -ENOMEM;
+   goto fail_hcd;
+   }
+
+   exynos_ohci-hcd = hcd;
+   exynos_ohci-clk = clk_get(pdev-dev, usbhost);
+
+   if (IS_ERR(exynos_ohci-clk)) {
+   dev_err(pdev-dev, Failed to get usbhost clock\n);
+   err = PTR_ERR(exynos_ohci-clk);
+   goto fail_clk;
+   }
+
+   err = 

Re: MFC V1.0 questions

2011-12-05 Thread Dron Gus
Hi.

On Mon, Dec 5, 2011 at 1:47 PM, Kamil Debski k.deb...@samsung.com wrote:
 Hi,

 From: linux-samsung-soc-ow...@vger.kernel.org [mailto:linux-samsung-soc-
 ow...@vger.kernel.org] On Behalf Of Dron Gus
 Sent: 02 December 2011 12:17

 Hello

 I am interested in a couple of questions related to mfv v1.0, used in
 the s3c6410.
 1) Does anyone work on mfc v1.0 driver for mainline?

 There is no driver in the mainline. However you may find it in some repos
 on the web http://www.google.com/search?q=samsung+kernel+mfc10+driver
 that have an MFC 1.0 driver present.
Thank you. I saw this driver. But it does not use v4l2, so I think it
makes no sense to port it as is.

 2) whether there is a newer firmware for MFC processor other than the V137?

 I have no idea. You may want to contact Samsung LSI in this matter
 http://www.samsung.com/global/business/semiconductor/footer/Footer_ContactUs.html
Ok. I'll try.

 3) how much different MFC version 1.0 (6410) and 4.0 (pv210). Should I
 rely on the driver for MFC v4.0, when writing a driver for V1.0?

 These MFC version are very different. In addition there are many differences 
 between
 version 4.0 and 5.0, although you can find some similarities between 4.0 and 
 5.0.

 For version 5.0 you can find the driver in mainline http://goo.gl/fbCKF.

 If you want to write the driver then you should consider using the V4L2 codec 
 API.
All right. The above driver, I'll use as a reference on working with
hardware, driver for MFC v5.0 as a reference on working with V4L2 API.
--
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