Re: [PATCH 3/3] ARM: s3c24xx: H1940: Move gpiochip_add call into core_init() callback

2015-05-04 Thread Vasily Khoruzhick
On Mon, May 4, 2015 at 6:23 AM, Krzysztof Kozlowski
k.kozlow...@samsung.com wrote:
 2015-05-04 3:15 GMT+09:00 Vasily Khoruzhick anars...@gmail.com:
 gpiochip_add() allocates memory, however it's not possible anymore

 ...to call it...? Something is missing in the sentence.

it replaces memory allocation here (kzalloc fails)

 from
 machine map_io() callback thus it failed and prevented machine from booting
 properly.

 Signed-off-by: Vasily Khoruzhick anars...@gmail.com
 ---
  arch/arm/mach-s3c24xx/mach-h1940.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

 diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c 
 b/arch/arm/mach-s3c24xx/mach-h1940.c
 index 86d9ec7..744aa4f 100644
 --- a/arch/arm/mach-s3c24xx/mach-h1940.c
 +++ b/arch/arm/mach-s3c24xx/mach-h1940.c
 @@ -777,9 +777,14 @@ static void __init h1940_map_io(void)

 /* Add latch gpio chip, set latch initial value */
 h1940_latch_control(0, 0);
 -   WARN_ON(gpiochip_add(h1940_latch_gpiochip));
  }

 +static __init int h1940_gpiolib_init(void)
 +{
 +   return gpiochip_add(h1940_latch_gpiochip);
 +}
 +core_initcall(h1940_gpiolib_init);
 +

 arch_initcall() or init_machine() callback seems more appropriate.
 What do you think?

I did the same way as Kukjin Kim did in samsung gpio driver.

 Best regards,
 Krzysztof
--
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 00/10] ARM: s3c64xx multiplatform, help needed

2015-03-02 Thread Vasily Khoruzhick
On Mon, Mar 2, 2015 at 8:37 PM, Dmitry Torokhov
dmitry.torok...@gmail.com wrote:

 I think Vasily had access to hardware with s3c2410_ts at some point...

Hi,

Yep, I have s3c24xx hardware to test rewritten s3c2410_ts driver. Will
try it this weekend.

Regards,
Vasily
--
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: DT on s3c24xx

2014-12-18 Thread Vasily Khoruzhick
On Thu, Dec 18, 2014 at 10:52 AM, Uwe Kleine-König
u.kleine-koe...@pengutronix.de wrote:
 Hello,

Hi Uwe,

 [Cc += linusw, linux-gpio]

 On Wed, Dec 17, 2014 at 10:04:24PM +0300, Vasily Khoruzhick wrote:
 I'd like to port several s3c24xx to DT, and I'm stuck with s3c24xx LCD
 controller and power drivers for H1940 and RX1950.

 Please see [1]. I want to move this function into another LCD power
 driver, but I'm not sure what to do with s3c_gpio_cfgpin(). I need to
 change pin function in runtime, and as far as I understand it should
 be handled via pinctrl driver somehow. But how?
 You can pass 1 pinctrl setups to a node:

 somedevice {
 pinctrl-names = default, foo, bar;
 pinctrl-0 = pinctrl_somedevice_default;
 pinctrl-1 = pinctrl_somedevice_foo;
 pinctrl-2 = pinctrl_somedevice_bar;
 cfg-gpios = gpio4 12 3, gpio2 7 5;
 };

 Then I think you can fiddle with pinctrl_select_state(). For the gpios
 you can then use the standard gpiod_{request,direction_{in,out}put}
 combo.

Thanks for you response!

Can I change pin function after gpio was requested? In low-power state
(i.e. when display is disabled) it's gpio driving some level,
and in active state it's some LCD controller pin (don't remember which
one exactly)

Regards,
Vasily


 Best regards
 Uwe

 --
 Pengutronix e.K.   | Uwe Kleine-König|
 Industrial Linux Solutions | http://www.pengutronix.de/  |
--
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


DT on s3c24xx

2014-12-17 Thread Vasily Khoruzhick
Hi,

I'd like to port several s3c24xx to DT, and I'm stuck with s3c24xx LCD
controller and power drivers for H1940 and RX1950.

Please see [1]. I want to move this function into another LCD power
driver, but I'm not sure what to do with s3c_gpio_cfgpin(). I need to
change pin function in runtime, and as far as I understand it should
be handled via pinctrl driver somehow. But how?

Also please see [2] and [3]. s3c2410fb driver modifies gpio registers
(and pinmux, they're same block on s3c24xx) directly. What would be
best way to get rid of that?

Regards
Vasily

[1] 
https://github.com/anarsoul/linux-2.6/blob/v3.18-anarsoul-wip/arch/arm/mach-s3c24xx/mach-h1940.c#L599
[2] 
https://github.com/anarsoul/linux-2.6/blob/v3.18-anarsoul-wip/arch/arm/mach-s3c24xx/mach-h1940.c#L221
[3] 
https://github.com/anarsoul/linux-2.6/blob/v3.18-anarsoul-wip/drivers/video/fbdev/s3c2410fb.c#L709
--
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] Input: s3c2410_ts: Move to clk_prepare_enable/clk_disable_unprepare

2014-07-09 Thread Vasily Khoruzhick
On 8 July 2014 18:00:49 Dmitry Torokhov wrote:

Hi Dmitry,

  
  -   clk_disable(ts.clock);
  +   clk_disable_unprepare(ts.clock);
 
 Do we really need to unprepare on suspend? Why simply disabling is not
 enough here?

You're right, disabling should be enough here. I'll resend a patch after 
testing on a hardware.

Regards
Vasily
--
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 1/2] clk: samsung: fix several typos to fix boot on s3c2410

2014-06-30 Thread Vasily Khoruzhick
On 30 June 2014 15:49:58 Tomasz Figa wrote:
 On 23.06.2014 22:29, Vasily Khoruzhick wrote:
  There's a several typos in a driver: 2410 instead of S3C2410
  and wrong argument to ARRAY_SIZE(). They prevent s3c2410
  from properly booting.
  
  Signed-off-by: Vasily Khoruzhick anars...@gmail.com
  ---
  
   drivers/clk/samsung/clk-s3c2410.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
 
 Applied as a fix for 3.16.

Hi Tomasz,

I also have clk fixes for s3c24xx touchscreen, framebuffer, adc, usb and nand 
drivers (to replace clk_enable with clk_prepare_enable and clk_disable with 
clk_disable_unprepare),

Should they be merged through different trees or it's possible to merge them 
through a single tree?

 
 Best regards,
 Tomasz

Regards
Vasily
--
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 1/2] clk: samsung: fix several typos to fix boot on s3c2410

2014-06-30 Thread Vasily Khoruzhick
On 30 June 2014 16:07:24 Tomasz Figa wrote:
 Hi Vasily,
 
 On 30.06.2014 16:02, Vasily Khoruzhick wrote:
  On 30 June 2014 15:49:58 Tomasz Figa wrote:
  On 23.06.2014 22:29, Vasily Khoruzhick wrote:
  There's a several typos in a driver: 2410 instead of S3C2410
  and wrong argument to ARRAY_SIZE(). They prevent s3c2410
  from properly booting.
  
  Signed-off-by: Vasily Khoruzhick anars...@gmail.com
  ---
  
   drivers/clk/samsung/clk-s3c2410.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
  
  Applied as a fix for 3.16.
  
  Hi Tomasz,
  
  I also have clk fixes for s3c24xx touchscreen, framebuffer, adc, usb and
  nand drivers (to replace clk_enable with clk_prepare_enable and
  clk_disable with clk_disable_unprepare),
  
  Should they be merged through different trees or it's possible to merge
  them through a single tree?
 
 I'd say they should all go through respective subsystem trees, unless
 they directly depend on patches I already applied, which is not the case
 as far as I can see.

Hm, they aren't necessary for compiling the kernel, but system fails to boot 
without these patches due to merge of common clk changes for s3c24xx.

 Best regards,
 Tomasz

P.S. Sorry for 2nd mail, Tomasz, I've occassionally omited MLs.
--
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] mtd: s3c2410: Move to clk_prepare_enable/clk_disable_unprepare

2014-06-30 Thread Vasily Khoruzhick
Use clk_prepare_enable/clk_disable_unprepare to make the driver
work properly with common clock framework.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 drivers/mtd/nand/s3c2410.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 79acbb8..6b97bf1 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -208,10 +208,10 @@ static void s3c2410_nand_clk_set_state(struct 
s3c2410_nand_info *info,
 
if (info-clk_state == CLOCK_ENABLE) {
if (new_state != CLOCK_ENABLE)
-   clk_disable(info-clk);
+   clk_disable_unprepare(info-clk);
} else {
if (new_state == CLOCK_ENABLE)
-   clk_enable(info-clk);
+   clk_prepare_enable(info-clk);
}
 
info-clk_state = new_state;
-- 
2.0.0

--
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] usb: gadget: s3c2410: Move to clk_prepare_enable/clk_disable_unprepare

2014-06-30 Thread Vasily Khoruzhick
Use clk_prepare_enable/clk_disable_unprepare to make the driver
work properly with common clock framework.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 drivers/usb/gadget/s3c2410_udc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index 7987aa0..357b58e 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -1788,7 +1788,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
return PTR_ERR(usb_bus_clock);
}
 
-   clk_enable(usb_bus_clock);
+   clk_prepare_enable(usb_bus_clock);
 
udc_clock = clk_get(NULL, usb-device);
if (IS_ERR(udc_clock)) {
@@ -1796,7 +1796,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
return PTR_ERR(udc_clock);
}
 
-   clk_enable(udc_clock);
+   clk_prepare_enable(udc_clock);
 
mdelay(10);
 
@@ -1952,13 +1952,13 @@ static int s3c2410_udc_remove(struct platform_device 
*pdev)
release_mem_region(rsrc_start, rsrc_len);
 
if (!IS_ERR(udc_clock)  udc_clock != NULL) {
-   clk_disable(udc_clock);
+   clk_disable_unprepare(udc_clock);
clk_put(udc_clock);
udc_clock = NULL;
}
 
if (!IS_ERR(usb_bus_clock)  usb_bus_clock != NULL) {
-   clk_disable(usb_bus_clock);
+   clk_disable_unprepare(usb_bus_clock);
clk_put(usb_bus_clock);
usb_bus_clock = NULL;
}
-- 
2.0.0

--
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] video: fbdev: s3c2410fb: Move to clk_prepare_enable/clk_disable_unprepare

2014-06-30 Thread Vasily Khoruzhick
Use clk_prepare_enable/clk_disable_unprepare to make the driver
work properly with common clock framework.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 drivers/video/fbdev/s3c2410fb.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/s3c2410fb.c b/drivers/video/fbdev/s3c2410fb.c
index 81af5a6..d68595d 100644
--- a/drivers/video/fbdev/s3c2410fb.c
+++ b/drivers/video/fbdev/s3c2410fb.c
@@ -932,7 +932,7 @@ static int s3c24xxfb_probe(struct platform_device *pdev,
goto release_irq;
}
 
-   clk_enable(info-clk);
+   clk_prepare_enable(info-clk);
dprintk(got and enabled clock\n);
 
usleep_range(1000, 1100);
@@ -996,7 +996,7 @@ static int s3c24xxfb_probe(struct platform_device *pdev,
 free_video_memory:
s3c2410fb_unmap_video_memory(fbinfo);
 release_clock:
-   clk_disable(info-clk);
+   clk_disable_unprepare(info-clk);
clk_put(info-clk);
 release_irq:
free_irq(irq, info);
@@ -1038,7 +1038,7 @@ static int s3c2410fb_remove(struct platform_device *pdev)
s3c2410fb_unmap_video_memory(fbinfo);
 
if (info-clk) {
-   clk_disable(info-clk);
+   clk_disable_unprepare(info-clk);
clk_put(info-clk);
info-clk = NULL;
}
@@ -1070,7 +1070,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, 
pm_message_t state)
 * before the clock goes off again (bjd) */
 
usleep_range(1000, 1100);
-   clk_disable(info-clk);
+   clk_disable_unprepare(info-clk);
 
return 0;
 }
@@ -1080,7 +1080,7 @@ static int s3c2410fb_resume(struct platform_device *dev)
struct fb_info *fbinfo = platform_get_drvdata(dev);
struct s3c2410fb_info *info = fbinfo-par;
 
-   clk_enable(info-clk);
+   clk_prepare_enable(info-clk);
usleep_range(1000, 1100);
 
s3c2410fb_init_registers(fbinfo);
-- 
2.0.0

--
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] Input: s3c2410_ts: Move to clk_prepare_enable/clk_disable_unprepare

2014-06-30 Thread Vasily Khoruzhick
Use clk_prepare_enable/clk_disable_unprepare to make the driver
work properly with common clock framework.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 drivers/input/touchscreen/s3c2410_ts.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/s3c2410_ts.c 
b/drivers/input/touchscreen/s3c2410_ts.c
index 19cb247..c0e0baa 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -264,7 +264,7 @@ static int s3c2410ts_probe(struct platform_device *pdev)
return -ENOENT;
}
 
-   clk_enable(ts.clock);
+   clk_prepare_enable(ts.clock);
dev_dbg(dev, got and enabled clocks\n);
 
ts.irq_tc = ret = platform_get_irq(pdev, 0);
@@ -369,7 +369,7 @@ static int s3c2410ts_remove(struct platform_device *pdev)
free_irq(ts.irq_tc, ts.input);
del_timer_sync(touch_timer);
 
-   clk_disable(ts.clock);
+   clk_disable_unprepare(ts.clock);
clk_put(ts.clock);
 
input_unregister_device(ts.input);
@@ -383,7 +383,7 @@ static int s3c2410ts_suspend(struct device *dev)
 {
writel(TSC_SLEEP, ts.io + S3C2410_ADCTSC);
disable_irq(ts.irq_tc);
-   clk_disable(ts.clock);
+   clk_disable_unprepare(ts.clock);
 
return 0;
 }
@@ -393,7 +393,7 @@ static int s3c2410ts_resume(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);
struct s3c2410_ts_mach_info *info = dev_get_platdata(pdev-dev);
 
-   clk_enable(ts.clock);
+   clk_prepare_enable(ts.clock);
enable_irq(ts.irq_tc);
 
/* Initialise registers */
-- 
2.0.0

--
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 6/6] ARM: s3c24xx: RX1950: Add DMA device

2014-06-30 Thread Vasily Khoruzhick
Add a corresponding device for a new dmaengine driver.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c24xx/mach-rx1950.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c 
b/arch/arm/mach-s3c24xx/mach-rx1950.c
index e2c6541..95b88a6 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -710,6 +710,7 @@ static struct i2c_board_info rx1950_i2c_devices[] = {
 
 static struct platform_device *rx1950_devices[] __initdata = {
s3c2410_device_dclk,
+   s3c2410_device_dma,
s3c_device_lcd,
s3c_device_wdt,
s3c_device_i2c0,
-- 
2.0.0

--
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/6] ARM: s3c24xx: Remove S3C24XX_DMA dependency from S3C2410_DMA

2014-06-30 Thread Vasily Khoruzhick
S3C24XX_DMA enables legacy DMA driver, and since we want to
move to introduced generic dmaengine s3c24xx-dma driver,
it's necessary to remove this redundant dependency.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c24xx/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 04284de..8c2a7f3 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -133,7 +133,6 @@ config S3C2410_DMA_DEBUG
 
 config S3C2410_DMA
bool
-   depends on S3C24XX_DMA  (CPU_S3C2410 || CPU_S3C2442)
help
  DMA device selection for S3C2410 and compatible CPUs
 
-- 
2.0.0

--
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 5/6] ARM: s3c24xx: Kconfig: Fix unmet dependency on S3C2440_PLL_* symbols for S3C2442

2014-06-30 Thread Vasily Khoruzhick
It's possible to build kernel with S3C2442, but without S3C2440 support, and
some S3C2442 machines depend on CONFIG_S3C2440_PLL_16934400

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c24xx/Kconfig | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 8c2a7f3..2305a5f 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -437,12 +437,7 @@ config MACH_S3C2416_DT
 
 endif  # CPU_S3C2416
 
-if CPU_S3C2440
-
-config S3C2440_DMA
-   bool
-   help
- Support for S3C2440 specific DMA code5A
+if CPU_S3C2440 || CPU_S3C2442
 
 config S3C2440_XTAL_1200
bool
@@ -469,6 +464,14 @@ config S3C2440_PLL_16934400
default y if S3C24XX_PLL
help
  PLL tables for S3C2440 or S3C2442 CPUs with 16.934MHz crystals.
+endif
+
+if CPU_S3C2440
+
+config S3C2440_DMA
+   bool
+   help
+ Support for S3C2440 specific DMA code5A
 
 comment S3C2440 Boards
 
-- 
2.0.0

--
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/6] ARM: s3c24xx: h1940: Add DMA device

2014-06-30 Thread Vasily Khoruzhick
Add a corresponding device for a new dmaengine driver.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c24xx/mach-h1940.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c 
b/arch/arm/mach-s3c24xx/mach-h1940.c
index fbf5487..cf36f26 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -623,6 +623,7 @@ static struct platform_device h1940_dev_buttons = {
 
 static struct platform_device *h1940_devices[] __initdata = {
h1940_dev_buttons,
+   s3c2410_device_dma,
s3c_device_ohci,
s3c_device_lcd,
s3c_device_wdt,
-- 
2.0.0

--
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/6] ARM: s3c24xx: DMA: SDI channel requires handshake

2014-06-30 Thread Vasily Khoruzhick
At least Windows Mobile driver enables it.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c24xx/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 2fa0a99..e505114 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -322,7 +322,7 @@ static struct resource s3c2410_dma_resource[] = {
 static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
[DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
[DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
-   [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
+   [DMACH_SDI] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 0) |
S3C24XX_DMA_CHANREQ(2, 2) |
S3C24XX_DMA_CHANREQ(1, 3),
},
-- 
2.0.0

--
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] ARM: s3c24xx: add dma_coherent_mask for DMA devices

2014-06-30 Thread Vasily Khoruzhick
Otherwise dma_alloc_coherent() fails.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c24xx/common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index c0763b8..2fa0a99 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -358,6 +358,7 @@ struct platform_device s3c2410_device_dma = {
.resource   = s3c2410_dma_resource,
.dev= {
.platform_data  = s3c2410_dma_platdata,
+   .coherent_dma_mask = ~0,
},
 };
 #endif
@@ -455,6 +456,7 @@ struct platform_device s3c2440_device_dma = {
.resource   = s3c2410_dma_resource,
.dev= {
.platform_data  = s3c2440_dma_platdata,
+   .coherent_dma_mask = ~0,
},
 };
 #endif
-- 
2.0.0

--
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 v3 4/4] ASoC: samsung: s3c24xx-i2s: Move to clk_prepare_enable/clk_disable_unprepare

2014-06-23 Thread Vasily Khoruzhick
Use clk_prepare_enable/clk_disable_unprepare to make the driver
work properly with common clock framework.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 sound/soc/samsung/s3c24xx-i2s.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
index 6f3ee87..e8b9852 100644
--- a/sound/soc/samsung/s3c24xx-i2s.c
+++ b/sound/soc/samsung/s3c24xx-i2s.c
@@ -373,7 +373,7 @@ static int s3c24xx_i2s_probe(struct snd_soc_dai *dai)
pr_err(failed to get iis_clock\n);
return PTR_ERR(s3c24xx_i2s.iis_clk);
}
-   clk_enable(s3c24xx_i2s.iis_clk);
+   clk_prepare_enable(s3c24xx_i2s.iis_clk);
 
/* Configure the I2S pins (GPE0...GPE4) in correct mode */
s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
@@ -397,7 +397,7 @@ static int s3c24xx_i2s_suspend(struct snd_soc_dai *cpu_dai)
s3c24xx_i2s.iisfcon = readl(s3c24xx_i2s.regs + S3C2410_IISFCON);
s3c24xx_i2s.iispsr = readl(s3c24xx_i2s.regs + S3C2410_IISPSR);
 
-   clk_disable(s3c24xx_i2s.iis_clk);
+   clk_disable_unprepare(s3c24xx_i2s.iis_clk);
 
return 0;
 }
@@ -405,7 +405,7 @@ static int s3c24xx_i2s_suspend(struct snd_soc_dai *cpu_dai)
 static int s3c24xx_i2s_resume(struct snd_soc_dai *cpu_dai)
 {
pr_debug(Entered %s\n, __func__);
-   clk_enable(s3c24xx_i2s.iis_clk);
+   clk_prepare_enable(s3c24xx_i2s.iis_clk);
 
writel(s3c24xx_i2s.iiscon, s3c24xx_i2s.regs + S3C2410_IISCON);
writel(s3c24xx_i2s.iismod, s3c24xx_i2s.regs + S3C2410_IISMOD);
-- 
2.0.0

--
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 v3 2/4] ASoC: samsung: drop support for legacy S3C24XX DMA API

2014-06-23 Thread Vasily Khoruzhick
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 sound/soc/samsung/Kconfig  |   3 -
 sound/soc/samsung/Makefile |   2 -
 sound/soc/samsung/dma.c| 454 -
 3 files changed, 459 deletions(-)

diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index 98767d3..17547a4 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -13,9 +13,6 @@ config SND_SOC_SAMSUNG
 config SND_S3C_DMA
tristate
 
-config SND_S3C_DMA_LEGACY
-   tristate
-
 config SND_S3C24XX_I2S
tristate
 
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile
index 6d0212b..6469199 100644
--- a/sound/soc/samsung/Makefile
+++ b/sound/soc/samsung/Makefile
@@ -1,6 +1,5 @@
 # S3c24XX Platform Support
 snd-soc-s3c-dma-objs := dmaengine.o
-snd-soc-s3c-dma-legacy-objs := dma.o
 snd-soc-idma-objs := idma.o
 snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o
 snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o
@@ -11,7 +10,6 @@ snd-soc-pcm-objs := pcm.o
 snd-soc-i2s-objs := i2s.o
 
 obj-$(CONFIG_SND_S3C_DMA) += snd-soc-s3c-dma.o
-obj-$(CONFIG_SND_S3C_DMA_LEGACY) += snd-soc-s3c-dma-legacy.o
 obj-$(CONFIG_SND_S3C24XX_I2S) += snd-soc-s3c24xx-i2s.o
 obj-$(CONFIG_SND_SAMSUNG_AC97) += snd-soc-ac97.o
 obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
deleted file mode 100644
index d9dc7bc..000
--- a/sound/soc/samsung/dma.c
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * dma.c  --  ALSA Soc Audio Layer
- *
- * (c) 2006 Wolfson Microelectronics PLC.
- * Graeme Gregory graeme.greg...@wolfsonmicro.com or li...@wolfsonmicro.com
- *
- * Copyright 2004-2005 Simtec Electronics
- * http://armlinux.simtec.co.uk/
- * Ben Dooks b...@simtec.co.uk
- *
- *  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/slab.h
-#include linux/dma-mapping.h
-#include linux/module.h
-
-#include sound/soc.h
-#include sound/pcm_params.h
-
-#include asm/dma.h
-#include mach/hardware.h
-#include mach/dma.h
-
-#include dma.h
-
-#define ST_RUNNING (10)
-#define ST_OPENED  (11)
-
-static const struct snd_pcm_hardware dma_hardware = {
-   .info   = SNDRV_PCM_INFO_INTERLEAVED |
-   SNDRV_PCM_INFO_BLOCK_TRANSFER |
-   SNDRV_PCM_INFO_MMAP |
-   SNDRV_PCM_INFO_MMAP_VALID,
-   .buffer_bytes_max   = 128*1024,
-   .period_bytes_min   = PAGE_SIZE,
-   .period_bytes_max   = PAGE_SIZE*2,
-   .periods_min= 2,
-   .periods_max= 128,
-   .fifo_size  = 32,
-};
-
-struct runtime_data {
-   spinlock_t lock;
-   int state;
-   unsigned int dma_loaded;
-   unsigned int dma_period;
-   dma_addr_t dma_start;
-   dma_addr_t dma_pos;
-   dma_addr_t dma_end;
-   struct s3c_dma_params *params;
-};
-
-static void audio_buffdone(void *data);
-
-/* dma_enqueue
- *
- * place a dma buffer onto the queue for the dma system
- * to handle.
- */
-static void dma_enqueue(struct snd_pcm_substream *substream)
-{
-   struct runtime_data *prtd = substream-runtime-private_data;
-   dma_addr_t pos = prtd-dma_pos;
-   unsigned int limit;
-   struct samsung_dma_prep dma_info;
-
-   pr_debug(Entered %s\n, __func__);
-
-   limit = (prtd-dma_end - prtd-dma_start) / prtd-dma_period;
-
-   pr_debug(%s: loaded %d, limit %d\n,
-   __func__, prtd-dma_loaded, limit);
-
-   dma_info.cap = (samsung_dma_has_circular() ? DMA_CYCLIC : DMA_SLAVE);
-   dma_info.direction =
-   (substream-stream == SNDRV_PCM_STREAM_PLAYBACK
-   ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
-   dma_info.fp = audio_buffdone;
-   dma_info.fp_param = substream;
-   dma_info.period = prtd-dma_period;
-   dma_info.len = prtd-dma_period*limit;
-
-   if (dma_info.cap == DMA_CYCLIC) {
-   dma_info.buf = pos;
-   prtd-params-ops-prepare(prtd-params-ch, dma_info);
-   prtd-dma_loaded += limit;
-   return;
-   }
-
-   while (prtd-dma_loaded  limit) {
-   pr_debug(dma_loaded: %d\n, prtd-dma_loaded);
-
-   if ((pos + dma_info.period)  prtd-dma_end) {
-   dma_info.period  = prtd-dma_end - pos;
-   pr_debug(%s: corrected dma len %ld\n,
-   __func__, dma_info.period);
-   }
-
-   dma_info.buf = pos;
-   prtd-params-ops-prepare(prtd-params-ch, dma_info);
-
-   prtd-dma_loaded++;
-   pos += prtd-dma_period;
-   if (pos = prtd

[PATCH v3 3/4] ASoC: samsung: s3c2412-i2s: Move to clk_prepare_enable/clk_disable_unprepare

2014-06-23 Thread Vasily Khoruzhick
Use clk_prepare_enable/clk_disable_unprepare to make the driver
work properly with common clock framework.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 sound/soc/samsung/s3c2412-i2s.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index d9d27cc..d6bc6dc 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -76,7 +76,7 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
/* Set MPLL as the source for IIS CLK */
 
clk_set_parent(s3c2412_i2s.iis_cclk, clk_get(NULL, mpll));
-   clk_enable(s3c2412_i2s.iis_cclk);
+   clk_prepare_enable(s3c2412_i2s.iis_cclk);
 
s3c2412_i2s.iis_cclk = s3c2412_i2s.iis_pclk;
 
@@ -89,7 +89,7 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
 
 static int s3c2412_i2s_remove(struct snd_soc_dai *dai)
 {
-   clk_disable(s3c2412_i2s.iis_cclk);
+   clk_disable_unprepare(s3c2412_i2s.iis_cclk);
 
return 0;
 }
-- 
2.0.0

--
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 v3 1/4] ASoC: samsung: s3c24{xx,12}-i2s: port to use generic dmaengine API

2014-06-23 Thread Vasily Khoruzhick
Use dmaengine instead of legacy s3c24xx DMA API for s3c24xx and s3c2412

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 sound/soc/samsung/Kconfig   |  9 +++
 sound/soc/samsung/dmaengine.c   |  3 +++
 sound/soc/samsung/s3c-i2s-v2.c  | 17 +
 sound/soc/samsung/s3c2412-i2s.c | 47 +-
 sound/soc/samsung/s3c24xx-i2s.c | 56 +++--
 5 files changed, 56 insertions(+), 76 deletions(-)

diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index 753b8c9..98767d3 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -1,11 +1,10 @@
 config SND_SOC_SAMSUNG
tristate ASoC support for Samsung
depends on PLAT_SAMSUNG
-   select S3C2410_DMA if ARCH_S3C24XX
+   select S3C24XX_DMAC if ARCH_S3C24XX
select S3C64XX_PL080 if ARCH_S3C64XX
-   select SND_S3C_DMA if !ARCH_S3C24XX
-   select SND_S3C_DMA_LEGACY if ARCH_S3C24XX
-   select SND_SOC_GENERIC_DMAENGINE_PCM if !ARCH_S3C24XX
+   select SND_S3C_DMA
+   select SND_SOC_GENERIC_DMAENGINE_PCM
help
  Say Y or M if you want to add support for codecs attached to
  the Samsung SoCs' Audio interfaces. You will also need to
@@ -19,7 +18,6 @@ config SND_S3C_DMA_LEGACY
 
 config SND_S3C24XX_I2S
tristate
-   select S3C24XX_DMA
 
 config SND_S3C_I2SV2_SOC
tristate
@@ -27,7 +25,6 @@ config SND_S3C_I2SV2_SOC
 config SND_S3C2412_SOC_I2S
tristate
select SND_S3C_I2SV2_SOC
-   select S3C2410_DMA
 
 config SND_SAMSUNG_PCM
tristate
diff --git a/sound/soc/samsung/dmaengine.c b/sound/soc/samsung/dmaengine.c
index a0e4e79..506f5bf 100644
--- a/sound/soc/samsung/dmaengine.c
+++ b/sound/soc/samsung/dmaengine.c
@@ -17,6 +17,7 @@
 
 #include linux/module.h
 #include linux/amba/pl08x.h
+#include linux/platform_data/dma-s3c24xx.h
 
 #include sound/core.h
 #include sound/pcm.h
@@ -29,6 +30,8 @@
 
 #ifdef CONFIG_ARCH_S3C64XX
 #define filter_fn pl08x_filter_id
+#elif defined(CONFIG_ARCH_S3C24XX)
+#define filter_fn s3c24xx_dma_filter
 #else
 #define filter_fn NULL
 #endif
diff --git a/sound/soc/samsung/s3c-i2s-v2.c b/sound/soc/samsung/s3c-i2s-v2.c
index 0ff4bbe..de6c321 100644
--- a/sound/soc/samsung/s3c-i2s-v2.c
+++ b/sound/soc/samsung/s3c-i2s-v2.c
@@ -392,8 +392,6 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream 
*substream, int cmd,
int capture = (substream-stream == SNDRV_PCM_STREAM_CAPTURE);
unsigned long irqs;
int ret = 0;
-   struct s3c_dma_params *dma_data =
-   snd_soc_dai_get_dma_data(rtd-cpu_dai, substream);
 
pr_debug(Entered %s\n, __func__);
 
@@ -424,13 +422,6 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream 
*substream, int cmd,
 
local_irq_restore(irqs);
 
-   /*
-* Load the next buffer to DMA to meet the reqirement
-* of the auto reload mechanism of S3C24XX.
-* This call won't bother S3C64XX.
-*/
-   s3c2410_dma_ctrl(dma_data-channel, S3C2410_DMAOP_STARTED);
-
break;
 
case SNDRV_PCM_TRIGGER_STOP:
@@ -644,12 +635,6 @@ int s3c_i2sv2_probe(struct snd_soc_dai *dai,
/* record our i2s structure for later use in the callbacks */
snd_soc_dai_set_drvdata(dai, i2s);
 
-   i2s-regs = ioremap(base, 0x100);
-   if (i2s-regs == NULL) {
-   dev_err(dev, cannot ioremap registers\n);
-   return -ENXIO;
-   }
-
i2s-iis_pclk = clk_get(dev, iis);
if (IS_ERR(i2s-iis_pclk)) {
dev_err(dev, failed to get iis_clock\n);
@@ -729,7 +714,7 @@ int s3c_i2sv2_register_component(struct device *dev, int id,
   struct snd_soc_component_driver *cmp_drv,
   struct snd_soc_dai_driver *dai_drv)
 {
-   struct snd_soc_dai_ops *ops = dai_drv-ops;
+   struct snd_soc_dai_ops *ops = (struct snd_soc_dai_ops *)dai_drv-ops;
 
ops-trigger = s3c2412_i2s_trigger;
if (!ops-hw_params)
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index 08c059b..d9d27cc 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -33,25 +33,19 @@
 #include regs-i2s-v2.h
 #include s3c2412-i2s.h
 
-static struct s3c_dma_client s3c2412_dma_client_out = {
-   .name   = I2S PCM Stereo out
-};
-
-static struct s3c_dma_client s3c2412_dma_client_in = {
-   .name   = I2S PCM Stereo in
-};
-
 static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = {
-   .client = s3c2412_dma_client_out,
+   .client =
+   (struct s3c_dma_client *)s3c2412_i2s_pcm_stereo_out,
.channel= DMACH_I2S_OUT,
-   .dma_addr   = S3C2410_PA_IIS + S3C2412_IISTXD,
+   .ch_name= tx,
.dma_size   = 4,
 };
 
 static struct s3c_dma_params

[PATCH v3 0/4] ASoc: samsung: update s3c24xx to dmaengine and common clk framework

2014-06-23 Thread Vasily Khoruzhick
This series updates s3c24{xx,12}-i2s driver to use newer DMA and CLK APIs.

v2: use hardcoded dma channel number
v3: rebase onto v3.16-rc1, add common clk framework-related changes

Vasily Khoruzhick (4):
  ASoC: samsung: s3c24{xx,12}-i2s: port to use generic dmaengine API
  ASoC: samsung: drop support for legacy S3C24XX DMA API
  ASoC: samsung: s3c2412-i2s: Move to
clk_prepare_enable/clk_disable_unprepare
  ASoC: samsung: s3c24xx-i2s: Move to
clk_prepare_enable/clk_disable_unprepare

 sound/soc/samsung/Kconfig   |  12 +-
 sound/soc/samsung/Makefile  |   2 -
 sound/soc/samsung/dma.c | 454 
 sound/soc/samsung/dmaengine.c   |   3 +
 sound/soc/samsung/s3c-i2s-v2.c  |  17 +-
 sound/soc/samsung/s3c2412-i2s.c |  51 +++--
 sound/soc/samsung/s3c24xx-i2s.c |  62 +++---
 7 files changed, 61 insertions(+), 540 deletions(-)
 delete mode 100644 sound/soc/samsung/dma.c

-- 
2.0.0

--
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] clk: samsung: fix several typos to fix boot on s3c2410

2014-06-23 Thread Vasily Khoruzhick
There's a several typos in a driver: 2410 instead of S3C2410
and wrong argument to ARRAY_SIZE(). They prevent s3c2410
from properly booting.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 drivers/clk/samsung/clk-s3c2410.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/samsung/clk-s3c2410.c 
b/drivers/clk/samsung/clk-s3c2410.c
index ba07168..bd9a873 100644
--- a/drivers/clk/samsung/clk-s3c2410.c
+++ b/drivers/clk/samsung/clk-s3c2410.c
@@ -378,7 +378,7 @@ void __init s3c2410_common_clk_init(struct device_node *np, 
unsigned long xti_f,
if (!np)
s3c2410_common_clk_register_fixed_ext(ctx, xti_f);
 
-   if (current_soc == 2410) {
+   if (current_soc == S3C2410) {
if (_get_rate(xti) == 12 * MHZ) {
s3c2410_plls[mpll].rate_table = pll_s3c2410_12mhz_tbl;
s3c2410_plls[upll].rate_table = pll_s3c2410_12mhz_tbl;
@@ -432,7 +432,7 @@ void __init s3c2410_common_clk_init(struct device_node *np, 
unsigned long xti_f,
samsung_clk_register_fixed_factor(ctx, s3c2410_ffactor,
ARRAY_SIZE(s3c2410_ffactor));
samsung_clk_register_alias(ctx, s3c2410_aliases,
-   ARRAY_SIZE(s3c2410_common_aliases));
+   ARRAY_SIZE(s3c2410_aliases));
break;
case S3C2440:
samsung_clk_register_mux(ctx, s3c2440_muxes,
-- 
2.0.0

--
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] clk: samsung: add more aliases for s3c24xx

2014-06-23 Thread Vasily Khoruzhick
Without these aliases clock lookup fails in s3c2410fb,
s3cmci, s3c2410-nand, s3c24xx-i2s, and i2c-s3c2410 drivers.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 drivers/clk/samsung/clk-s3c2410.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/samsung/clk-s3c2410.c 
b/drivers/clk/samsung/clk-s3c2410.c
index bd9a873..140f473 100644
--- a/drivers/clk/samsung/clk-s3c2410.c
+++ b/drivers/clk/samsung/clk-s3c2410.c
@@ -152,6 +152,11 @@ struct samsung_clock_alias s3c2410_common_aliases[] 
__initdata = {
ALIAS(HCLK, NULL, hclk),
ALIAS(MPLL, NULL, mpll),
ALIAS(FCLK, NULL, fclk),
+   ALIAS(PCLK, NULL, watchdog),
+   ALIAS(PCLK_SDI, NULL, sdi),
+   ALIAS(HCLK_NAND, NULL, nand),
+   ALIAS(PCLK_I2S, NULL, iis),
+   ALIAS(PCLK_I2C, NULL, i2c),
 };
 
 /* S3C2410 specific clocks */
-- 
2.0.0

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


[RESEND PATCH v2 2/2] ASoC: samsung: drop support for legacy S3C24XX DMA API

2014-06-01 Thread Vasily Khoruzhick
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
v2: No changes

 sound/soc/samsung/Kconfig  |   3 -
 sound/soc/samsung/Makefile |   2 -
 sound/soc/samsung/dma.c| 460 -
 3 files changed, 465 deletions(-)
 delete mode 100644 sound/soc/samsung/dma.c

diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index 022c7a4..bf4bb7b 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -13,9 +13,6 @@ config SND_SOC_SAMSUNG
 config SND_S3C_DMA
tristate
 
-config SND_S3C_DMA_LEGACY
-   tristate
-
 config SND_S3C24XX_I2S
tristate
 
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile
index 86715d8..bc02da0 100644
--- a/sound/soc/samsung/Makefile
+++ b/sound/soc/samsung/Makefile
@@ -1,6 +1,5 @@
 # S3c24XX Platform Support
 snd-soc-s3c-dma-objs := dmaengine.o
-snd-soc-s3c-dma-legacy-objs := dma.o
 snd-soc-idma-objs := idma.o
 snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o
 snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o
@@ -11,7 +10,6 @@ snd-soc-pcm-objs := pcm.o
 snd-soc-i2s-objs := i2s.o
 
 obj-$(CONFIG_SND_S3C_DMA) += snd-soc-s3c-dma.o
-obj-$(CONFIG_SND_S3C_DMA_LEGACY) += snd-soc-s3c-dma-legacy.o
 obj-$(CONFIG_SND_S3C24XX_I2S) += snd-soc-s3c24xx-i2s.o
 obj-$(CONFIG_SND_SAMSUNG_AC97) += snd-soc-ac97.o
 obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
deleted file mode 100644
index dc09b71..000
--- a/sound/soc/samsung/dma.c
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * dma.c  --  ALSA Soc Audio Layer
- *
- * (c) 2006 Wolfson Microelectronics PLC.
- * Graeme Gregory graeme.greg...@wolfsonmicro.com or li...@wolfsonmicro.com
- *
- * Copyright 2004-2005 Simtec Electronics
- * http://armlinux.simtec.co.uk/
- * Ben Dooks b...@simtec.co.uk
- *
- *  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/slab.h
-#include linux/dma-mapping.h
-#include linux/module.h
-
-#include sound/soc.h
-#include sound/pcm_params.h
-
-#include asm/dma.h
-#include mach/hardware.h
-#include mach/dma.h
-
-#include dma.h
-
-#define ST_RUNNING (10)
-#define ST_OPENED  (11)
-
-static const struct snd_pcm_hardware dma_hardware = {
-   .info   = SNDRV_PCM_INFO_INTERLEAVED |
-   SNDRV_PCM_INFO_BLOCK_TRANSFER |
-   SNDRV_PCM_INFO_MMAP |
-   SNDRV_PCM_INFO_MMAP_VALID,
-   .buffer_bytes_max   = 128*1024,
-   .period_bytes_min   = PAGE_SIZE,
-   .period_bytes_max   = PAGE_SIZE*2,
-   .periods_min= 2,
-   .periods_max= 128,
-   .fifo_size  = 32,
-};
-
-struct runtime_data {
-   spinlock_t lock;
-   int state;
-   unsigned int dma_loaded;
-   unsigned int dma_period;
-   dma_addr_t dma_start;
-   dma_addr_t dma_pos;
-   dma_addr_t dma_end;
-   struct s3c_dma_params *params;
-};
-
-static void audio_buffdone(void *data);
-
-/* dma_enqueue
- *
- * place a dma buffer onto the queue for the dma system
- * to handle.
- */
-static void dma_enqueue(struct snd_pcm_substream *substream)
-{
-   struct runtime_data *prtd = substream-runtime-private_data;
-   dma_addr_t pos = prtd-dma_pos;
-   unsigned int limit;
-   struct samsung_dma_prep dma_info;
-
-   pr_debug(Entered %s\n, __func__);
-
-   limit = (prtd-dma_end - prtd-dma_start) / prtd-dma_period;
-
-   pr_debug(%s: loaded %d, limit %d\n,
-   __func__, prtd-dma_loaded, limit);
-
-   dma_info.cap = (samsung_dma_has_circular() ? DMA_CYCLIC : DMA_SLAVE);
-   dma_info.direction =
-   (substream-stream == SNDRV_PCM_STREAM_PLAYBACK
-   ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
-   dma_info.fp = audio_buffdone;
-   dma_info.fp_param = substream;
-   dma_info.period = prtd-dma_period;
-   dma_info.len = prtd-dma_period*limit;
-
-   if (dma_info.cap == DMA_CYCLIC) {
-   dma_info.buf = pos;
-   prtd-params-ops-prepare(prtd-params-ch, dma_info);
-   prtd-dma_loaded += limit;
-   return;
-   }
-
-   while (prtd-dma_loaded  limit) {
-   pr_debug(dma_loaded: %d\n, prtd-dma_loaded);
-
-   if ((pos + dma_info.period)  prtd-dma_end) {
-   dma_info.period  = prtd-dma_end - pos;
-   pr_debug(%s: corrected dma len %ld\n,
-   __func__, dma_info.period);
-   }
-
-   dma_info.buf = pos;
-   prtd-params-ops-prepare(prtd-params-ch, dma_info);
-
-   prtd-dma_loaded

[RESEND PATCH v2 1/2] ASoC: samsung: s3c24{xx,12}-i2s: port to use generic dmaengine API

2014-06-01 Thread Vasily Khoruzhick
Use dmaengine instead of legacy s3c24xx DMA API for s3c24xx and s3c2412

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
v2: use hardcoded dma channel number

 sound/soc/samsung/Kconfig   |  9 +++
 sound/soc/samsung/dmaengine.c   |  3 +++
 sound/soc/samsung/s3c-i2s-v2.c  | 17 +
 sound/soc/samsung/s3c2412-i2s.c | 47 +-
 sound/soc/samsung/s3c24xx-i2s.c | 56 +++--
 5 files changed, 56 insertions(+), 76 deletions(-)

diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index 3507574..022c7a4 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -1,11 +1,10 @@
 config SND_SOC_SAMSUNG
tristate ASoC support for Samsung
depends on PLAT_SAMSUNG
-   select S3C2410_DMA if ARCH_S3C24XX
+   select S3C24XX_DMAC if ARCH_S3C24XX
select S3C64XX_PL080 if ARCH_S3C64XX
-   select SND_S3C_DMA if !ARCH_S3C24XX
-   select SND_S3C_DMA_LEGACY if ARCH_S3C24XX
-   select SND_SOC_GENERIC_DMAENGINE_PCM if !ARCH_S3C24XX
+   select SND_S3C_DMA
+   select SND_SOC_GENERIC_DMAENGINE_PCM
help
  Say Y or M if you want to add support for codecs attached to
  the Samsung SoCs' Audio interfaces. You will also need to
@@ -19,7 +18,6 @@ config SND_S3C_DMA_LEGACY
 
 config SND_S3C24XX_I2S
tristate
-   select S3C24XX_DMA
 
 config SND_S3C_I2SV2_SOC
tristate
@@ -27,7 +25,6 @@ config SND_S3C_I2SV2_SOC
 config SND_S3C2412_SOC_I2S
tristate
select SND_S3C_I2SV2_SOC
-   select S3C2410_DMA
 
 config SND_SAMSUNG_PCM
tristate
diff --git a/sound/soc/samsung/dmaengine.c b/sound/soc/samsung/dmaengine.c
index 750ce58..72f27d1 100644
--- a/sound/soc/samsung/dmaengine.c
+++ b/sound/soc/samsung/dmaengine.c
@@ -17,6 +17,7 @@
 
 #include linux/module.h
 #include linux/amba/pl08x.h
+#include linux/platform_data/dma-s3c24xx.h
 
 #include sound/core.h
 #include sound/pcm.h
@@ -29,6 +30,8 @@
 
 #ifdef CONFIG_ARCH_S3C64XX
 #define filter_fn pl08x_filter_id
+#elif defined(CONFIG_ARCH_S3C24XX)
+#define filter_fn s3c24xx_dma_filter
 #else
 #define filter_fn NULL
 #endif
diff --git a/sound/soc/samsung/s3c-i2s-v2.c b/sound/soc/samsung/s3c-i2s-v2.c
index 79e7efb..1a74051 100644
--- a/sound/soc/samsung/s3c-i2s-v2.c
+++ b/sound/soc/samsung/s3c-i2s-v2.c
@@ -392,8 +392,6 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream 
*substream, int cmd,
int capture = (substream-stream == SNDRV_PCM_STREAM_CAPTURE);
unsigned long irqs;
int ret = 0;
-   struct s3c_dma_params *dma_data =
-   snd_soc_dai_get_dma_data(rtd-cpu_dai, substream);
 
pr_debug(Entered %s\n, __func__);
 
@@ -424,13 +422,6 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream 
*substream, int cmd,
 
local_irq_restore(irqs);
 
-   /*
-* Load the next buffer to DMA to meet the reqirement
-* of the auto reload mechanism of S3C24XX.
-* This call won't bother S3C64XX.
-*/
-   s3c2410_dma_ctrl(dma_data-channel, S3C2410_DMAOP_STARTED);
-
break;
 
case SNDRV_PCM_TRIGGER_STOP:
@@ -644,12 +635,6 @@ int s3c_i2sv2_probe(struct snd_soc_dai *dai,
/* record our i2s structure for later use in the callbacks */
snd_soc_dai_set_drvdata(dai, i2s);
 
-   i2s-regs = ioremap(base, 0x100);
-   if (i2s-regs == NULL) {
-   dev_err(dev, cannot ioremap registers\n);
-   return -ENXIO;
-   }
-
i2s-iis_pclk = clk_get(dev, iis);
if (IS_ERR(i2s-iis_pclk)) {
dev_err(dev, failed to get iis_clock\n);
@@ -729,7 +714,7 @@ int s3c_i2sv2_register_component(struct device *dev, int id,
   struct snd_soc_component_driver *cmp_drv,
   struct snd_soc_dai_driver *dai_drv)
 {
-   struct snd_soc_dai_ops *ops = dai_drv-ops;
+   struct snd_soc_dai_ops *ops = (struct snd_soc_dai_ops *)dai_drv-ops;
 
ops-trigger = s3c2412_i2s_trigger;
if (!ops-hw_params)
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index d079445..ba084e3 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -33,25 +33,19 @@
 #include regs-i2s-v2.h
 #include s3c2412-i2s.h
 
-static struct s3c2410_dma_client s3c2412_dma_client_out = {
-   .name   = I2S PCM Stereo out
-};
-
-static struct s3c2410_dma_client s3c2412_dma_client_in = {
-   .name   = I2S PCM Stereo in
-};
-
 static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = {
-   .client = s3c2412_dma_client_out,
+   .client =
+   (struct s3c2410_dma_client *)s3c2412_i2s_pcm_stereo_out,
.channel= DMACH_I2S_OUT,
-   .dma_addr   = S3C2410_PA_IIS + S3C2412_IISTXD,
+   .ch_name= tx,
.dma_size   = 4

Re: [alsa-devel] [PATCH v2 1/2] ASoC: samsung: s3c24{xx, 12}-i2s: port to use generic dmaengine API

2014-05-21 Thread Vasily Khoruzhick
On Wed, May 21, 2014 at 4:28 PM, Tomasz Figa t.f...@samsung.com wrote:
 Hi Vasily,

Hi Tomasz,

 Please remember to keep linux-samsung-soc ML on Cc when sending patches
 related to Samsung platforms. It is essential to let Samsung people
 review them.

Ok, I'll keep it in mind. I've just checked and get_maintainer.pl
outputs linux-samsung-soc ML for these
patches. I've omitted it occasionally, because it wasn't necessary to
keep it in CC back in 2011
(year of my last sound-related patch for s3c24xx).

 Please resend the series with this in mind.

Is it really necessary? This patch is supposed to go through ASoC
tree, not through Samsung's.
And I really doubt that Samsung guys test kernel for s3c24xx boards nowadays.

 The patch in general looks good to me. Might be a good idea to specify
 on what board(s) and how it was tested, though.

It was tested on s3c2410-based iPAQ h1940, s3c2412 part was only
compile-tested, as I don't have s3c2412 hardware.

 Best regards,
 Tomasz

Regards
Vasily
--
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: [alsa-devel] [PATCH v2 1/2] ASoC: samsung: s3c24{xx, 12}-i2s: port to use generic dmaengine API

2014-05-21 Thread Vasily Khoruzhick
On Wed, May 21, 2014 at 6:07 PM, Tomasz Figa t.f...@samsung.com wrote:


 Is it really necessary? This patch is supposed to go through ASoC
 tree, not through Samsung's.
 And I really doubt that Samsung guys test kernel for s3c24xx boards nowadays.

 Maybe not test, but at least review the code. Also there might be other
 people following that list that might be interested in looking at this
 series, while not subscribed to alsa-devel - I can name at least Heiko
 Stübner, who should be able to test it on further s3c24xx-based boards.

Ok, will resend tonight.

Regards
Vasily
--
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: [alsa-devel] [PATCH v2 1/2] ASoC: samsung: s3c24{xx, 12}-i2s: port to use generic dmaengine API

2014-05-21 Thread Vasily Khoruzhick
On Wed, May 21, 2014 at 6:29 PM, Heiko Stübner he...@sntech.de wrote:
 Am Mittwoch, 21. Mai 2014, 17:07:47 schrieb Tomasz Figa:
 On 21.05.2014 16:53, Vasily Khoruzhick wrote:
  On Wed, May 21, 2014 at 4:28 PM, Tomasz Figa t.f...@samsung.com wrote:
  Please remember to keep linux-samsung-soc ML on Cc when sending patches
  related to Samsung platforms. It is essential to let Samsung people
  review them.
 
  Ok, I'll keep it in mind. I've just checked and get_maintainer.pl
  outputs linux-samsung-soc ML for these
  patches. I've omitted it occasionally, because it wasn't necessary to
  keep it in CC back in 2011
  (year of my last sound-related patch for s3c24xx).
 
  Please resend the series with this in mind.
 
  Is it really necessary? This patch is supposed to go through ASoC
  tree, not through Samsung's.
  And I really doubt that Samsung guys test kernel for s3c24xx boards
  nowadays.
 Maybe not test, but at least review the code. Also there might be other
 people following that list that might be interested in looking at this
 series, while not subscribed to alsa-devel - I can name at least Heiko
 Stübner, who should be able to test it on further s3c24xx-based boards.

 Sadly, I don't have a working sound setup on my 2 s3c boards.

What are they btw? Is it too time-consuming to make sound working on them?
It would be nice if anyone except me could test these patches.

 Heiko

Regards
Vasily
--
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: [alsa-devel] [PATCH v2 1/2] ASoC: samsung: s3c24{xx, 12}-i2s: port to use generic dmaengine API

2014-05-21 Thread Vasily Khoruzhick
On Wed, May 21, 2014 at 6:56 PM, Heiko Stübner he...@sntech.de wrote:

 Openmoko Freerunner (S3C2440) where there may be sound reachable someway and a
 Oyo ebook-reader (S3C2416) whose i2s is I think compatible with the s3c64xx
 instead of the s3c24xx ones and with a completely unsupported codec.

Freerunner is s3c2442, and actually I can test s3c2442 on my iPAQ rx1950.
s3c2416 may be supported by s3c2412-i2s, I have no spec at the hand,
so I can't check.

Regards
Vasily

 But in general I'm fairly confident that if you hear sounds on your device 
 your
 conversion would be fine test-wise :-)


 Heiko
--
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 CFT] ARM:S3C24XX: Enable ARM_PATCH_PHYS_VIRT and AUTO_ZRELADDR by default

2013-12-13 Thread Vasily Khoruzhick
On Fri, Dec 13, 2013 at 2:28 PM, panchaxari
panchaxari.prasannamur...@linaro.org wrote:
 Configs ARM_PATCH_PHYS_VIRT and AUTO_ZRELADDR are enabled as default
 to platform S3C24XX.

 Introduction of PHYS_VIRT config as default would enable phy-to-virt and
 virt-to-phy translation function at boot and module loading time
 and enforce dynamic reallocation of memory. AUTO_ZRELADDR config would
 enable calculation of kernel load address at run time.

 PHYS_VIRT config is mutually exclusive to XIP_KERNEL, XIP_KERNEL is used in
 systems with NOR flash devices, and ZRELADDR config is mutually exclusive
 to ZBOOT_ROM.

 CFT::Call For Testing

 Requesting maintainers of S3C24XX  platforms to evaluate the changes on the
 board and comment, as I dont have the board for testing and also requesting
 an ACK the changes.

Hi,

I guess AUTO_ZRELADDR will break S2RAM on h1940/rx1950 and rx3715
machines. Those machines require reservation of 4k at 0x30003000 and
4k at 0x30081000, because bootloader
will corrupt these areas on resume. See .reserve callback in
arch/arm/mach-s3c24xx/mach-{h1940,rx1950,rx3715}

Regards
Vasily


 Signed-off-by: panchaxari panchaxari.prasannamur...@linaro.org
 Cc: Heiko Stuebner he...@sntech.de
 Cc: Ben Dooks ben-li...@fluff.org
 Cc: Kukjin Kim kgene@samsung.com
 Cc: Russell King li...@arm.linux.org.uk
 Cc: Linus Walleij linus.wall...@linaro.org
 Cc: linux-arm-ker...@lists.infradead.org
 Cc: linux-samsung-soc@vger.kernel.org
 Cc: linux-ker...@vger.kernel.org

 ---
 S3C24XX is basically a Samsung SOC with ARM920T instruction set, and has
 an operating frquency of 203MHz, it also has enhanced MMU architecture
 to support WinCE, EPOC 32 and Linux.

 This SOC is an Integrated system for hand-held devices and general
 embedded systems.

 Supports various types of ROM for booting (NOR/NAND Flash, EEPROM, and 
 others).
 Supports 8 memory banks, 128M for each bank, with a total of 1GB.
 ---
  arch/arm/Kconfig |2 ++
  1 file changed, 2 insertions(+)

 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
 index 32acacb..ec1faea 100644
 --- a/arch/arm/Kconfig
 +++ b/arch/arm/Kconfig
 @@ -708,6 +708,8 @@ config ARCH_S3C24XX
 bool Samsung S3C24XX SoCs
 select ARCH_HAS_CPUFREQ
 select ARCH_REQUIRE_GPIOLIB
 +   select ARM_PATCH_PHYS_VIRT
 +   select AUTO_ZRELADDR
 select CLKDEV_LOOKUP
 select CLKSRC_SAMSUNG_PWM
 select GENERIC_CLOCKEVENTS
 --
 1.7.10.4


 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
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] ARM: S3C24XX: Add WIZnet W5300E01-ARM board support

2012-09-03 Thread Vasily Khoruzhick
On Mon, Sep 3, 2012 at 9:20 AM, Taehun Kim kth3...@gmail.com wrote:
 This patch adds WIZnet W5300E01 board. I tested this code in the board.
 Please review this patch and apply it if do not have any problems.

Hi,

 Taehun kim

 Signed-off-by: Taehun Kim kth3...@gmail.com
 ---
  arch/arm/mach-s3c24xx/Kconfig |5 +
  arch/arm/mach-s3c24xx/Makefile|1 +
  arch/arm/mach-s3c24xx/mach-w5300e01.c |  186 
 +
  3 files changed, 192 insertions(+)
  create mode 100644 arch/arm/mach-s3c24xx/mach-w5300e01.c

 diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
 index d56b0f7..94b60ca 100644
 --- a/arch/arm/mach-s3c24xx/Kconfig
 +++ b/arch/arm/mach-s3c24xx/Kconfig
 @@ -248,6 +248,11 @@ config MACH_VR1000
 help
   Say Y here if you are using the Thorcom VR1000 board.

 +config MACH_W5300E01
 +   bool WIZnet W5300E01-ARM Board
 +   help
 + Say Y here if you are using the Wiznet W5300E01-ARM board.
 +
  endif  # CPU_S3C2410

  config S3C2412_PM_SLEEP
 diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile
 index 0ab6ab1..fc1a89e 100644
 --- a/arch/arm/mach-s3c24xx/Makefile
 +++ b/arch/arm/mach-s3c24xx/Makefile
 @@ -61,6 +61,7 @@ obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o
  obj-$(CONFIG_ARCH_SMDK2410)+= mach-smdk2410.o
  obj-$(CONFIG_MACH_TCT_HAMMER)  += mach-tct_hammer.o
  obj-$(CONFIG_MACH_VR1000)  += mach-vr1000.o
 +obj-$(CONFIG_MACH_W5300E01)+= mach-w5300e01.o

  obj-$(CONFIG_MACH_JIVE)+= mach-jive.o
  obj-$(CONFIG_MACH_SMDK2413)+= mach-smdk2413.o
 diff --git a/arch/arm/mach-s3c24xx/mach-w5300e01.c 
 b/arch/arm/mach-s3c24xx/mach-w5300e01.c
 new file mode 100644
 index 000..5ed79f5
 --- /dev/null
 +++ b/arch/arm/mach-s3c24xx/mach-w5300e01.c
 @@ -0,0 +1,186 @@
 +/* linux/arch/arm/mach-s3c24xx/mach-w5300e01.c
 + *
 + * Copyright (c) 2012 Taehun Kim kth3...@gmail.com
 + *
 + * For product information, visit http://www.wiznet.co.kr/
 + *
 + * 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.
 + *
 + * @History:
 + * derived from linux/arch/arm/mach-s3c24xx/mach-bast.c, written by
 + * Ben Dooks b...@simtec.co.uk
 + */
 +
 +#include linux/kernel.h
 +#include linux/types.h
 +#include linux/interrupt.h
 +#include linux/list.h
 +#include linux/timer.h
 +#include linux/init.h
 +#include linux/serial_core.h
 +#include linux/platform_device.h
 +#include linux/gpio.h
 +#include linux/io.h
 +#include linux/mtd/mtd.h
 +#include linux/mtd/nand.h
 +#include linux/mtd/map.h
 +#include linux/mtd/partitions.h
 +
 +#include asm/mach/arch.h
 +#include asm/mach/map.h
 +#include asm/mach/irq.h
 +#include asm/mach-types.h
 +
 +#include mach/regs-gpio.h
 +#include plat/gpio-cfg.h
 +#include plat/cpu.h
 +#include plat/devs.h
 +#include plat/regs-serial.h
 +#include plat/nand.h
 +#include plat/pm.h
 +
 +static struct map_desc w5300e01_iodesc[] __initdata = {
 +   /* Character LCD register map. */
 +   { 0xf800, __phys_to_pfn(S3C2410_CS3), SZ_1M, MT_DEVICE }
 +};
 +
 +#define UCON S3C2410_UCON_DEFAULT
 +#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
 +#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
 +
 +static struct s3c2410_uartcfg w5300e01_uartcfgs[] __initdata = {
 +   [0] = {
 +   .hwport  = 0,
 +   .flags   = 0,
 +   .ucon= UCON,
 +   .ulcon   = ULCON,
 +   .ufcon   = UFCON,
 +   },
 +   [1] = {
 +   .hwport  = 1,
 +   .flags   = 0,
 +   .ucon= UCON,
 +   .ulcon   = ULCON,
 +   .ufcon   = UFCON,
 +   },
 +   [2] = {
 +   .hwport  = 2,
 +   .flags   = 0,
 +   .ucon= UCON,
 +   .ulcon   = ULCON,
 +   .ufcon   = UFCON,
 +   }
 +};
 +
 +static struct mtd_partition w5300e01_mtd_partitions[] = {
 +   [0] = {
 +   .name   = Bootloader,
 +   .size   = 0x2,
 +   .offset = 0,
 +   .mask_flags = MTD_WRITEABLE,
 +   },
 +   [1] = {
 +   .name   = Boot Param,
 +   .size   = 0x2,
 +   .offset = MTDPART_OFS_APPEND,
 +   },
 +   [2] = {
 +   .name   = Kernel,
 +   .size   = 0x3C,
 +   .offset = MTDPART_OFS_APPEND,
 +   },
 +   [3] = {
 +   .name   = Ramdisk,
 +   .size   = 0x100,
 +   .offset = MTDPART_OFS_APPEND,
 +   },
 +   [4] = {
 +   .name   = JFFS2 FileSystem,
 +   .size   = MTDPART_SIZ_FULL,
 +   .offset = MTDPART_OFS_APPEND,
 

Re: [PATCH v2] ARM: S3C24XX: Add WIZnet W5300E01-ARM board support

2012-09-03 Thread Vasily Khoruzhick
On Mon, Sep 3, 2012 at 8:36 PM, Taehun Kim kth3...@gmail.com wrote:
 This patch adds WIZnet W5300E01 board changed to the new gpio functions.
 Please review this patch and apply it if do not have any problems.

 Signed-off-by: Taehun Kim kth3...@gmail.com
 ---
  arch/arm/mach-s3c24xx/Kconfig |5 +
  arch/arm/mach-s3c24xx/Makefile|1 +
  arch/arm/mach-s3c24xx/mach-w5300e01.c |  186
 +
  3 files changed, 192 insertions(+)
  create mode 100644 arch/arm/mach-s3c24xx/mach-w5300e01.c

 diff --git a/arch/arm/mach-s3c24xx/Kconfig
 b/arch/arm/mach-s3c24xx/Kconfig
 index d56b0f7..94b60ca 100644
 --- a/arch/arm/mach-s3c24xx/Kconfig
 +++ b/arch/arm/mach-s3c24xx/Kconfig
 @@ -248,6 +248,11 @@ config MACH_VR1000
 help
   Say Y here if you are using the Thorcom VR1000 board.

 +config MACH_W5300E01
 +   bool WIZnet W5300E01-ARM Board
 +   help
 + Say Y here if you are using the Wiznet W5300E01-ARM board.
 +
  endif  # CPU_S3C2410

  config S3C2412_PM_SLEEP
 diff --git a/arch/arm/mach-s3c24xx/Makefile
 b/arch/arm/mach-s3c24xx/Makefile
 index 0ab6ab1..fc1a89e 100644
 --- a/arch/arm/mach-s3c24xx/Makefile
 +++ b/arch/arm/mach-s3c24xx/Makefile
 @@ -61,6 +61,7 @@ obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o
  obj-$(CONFIG_ARCH_SMDK2410)+= mach-smdk2410.o
  obj-$(CONFIG_MACH_TCT_HAMMER)  += mach-tct_hammer.o
  obj-$(CONFIG_MACH_VR1000)  += mach-vr1000.o
 +obj-$(CONFIG_MACH_W5300E01)+= mach-w5300e01.o

  obj-$(CONFIG_MACH_JIVE)+= mach-jive.o
  obj-$(CONFIG_MACH_SMDK2413)+= mach-smdk2413.o
 diff --git a/arch/arm/mach-s3c24xx/mach-w5300e01.c
 b/arch/arm/mach-s3c24xx/mach-w5300e01.c
 new file mode 100644
 index 000..7daf82e
 --- /dev/null
 +++ b/arch/arm/mach-s3c24xx/mach-w5300e01.c
 @@ -0,0 +1,186 @@
 +/* linux/arch/arm/mach-s3c24xx/mach-w5300e01.c
 + *
 + * Copyright (c) 2012 Taehun Kim kth3...@gmail.com
 + *
 + * For product information, visit http://www.wiznet.co.kr/
 + *
 + * 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.
 + *
 + * @History:
 + * derived from linux/arch/arm/mach-s3c24xx/mach-bast.c, written by
 + * Ben Dooks b...@simtec.co.uk
 + */
 +
 +#include linux/kernel.h
 +#include linux/types.h
 +#include linux/interrupt.h
 +#include linux/list.h
 +#include linux/timer.h
 +#include linux/init.h
 +#include linux/serial_core.h
 +#include linux/platform_device.h
 +#include linux/gpio.h
 +#include linux/io.h
 +#include linux/mtd/mtd.h
 +#include linux/mtd/nand.h
 +#include linux/mtd/map.h
 +#include linux/mtd/partitions.h
 +
 +#include asm/mach/arch.h
 +#include asm/mach/map.h
 +#include asm/mach/irq.h
 +#include asm/mach-types.h
 +
 +#include mach/regs-gpio.h
 +#include plat/gpio-cfg.h
 +#include plat/cpu.h
 +#include plat/devs.h
 +#include plat/regs-serial.h
 +#include plat/nand.h
 +#include plat/pm.h
 +
 +static struct map_desc w5300e01_iodesc[] __initdata = {
 +   /* Character LCD register map. */
 +   { 0xf800, __phys_to_pfn(S3C2410_CS3), SZ_1M, MT_DEVICE }
 +};
 +
 +#define UCON S3C2410_UCON_DEFAULT
 +#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE |
 S3C2410_LCON_STOPB)
 +#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
 +
 +static struct s3c2410_uartcfg w5300e01_uartcfgs[] __initdata = {
 +   [0] = {
 +   .hwport = 0,
 +   .flags  = 0,
 +   .ucon   = UCON,
 +   .ulcon  = ULCON,
 +   .ufcon  = UFCON,
 +   },
 +   [1] = {
 +   .hwport = 1,
 +   .flags  = 0,
 +   .ucon   = UCON,
 +   .ulcon  = ULCON,
 +   .ufcon  = UFCON,
 +   },
 +   [2] = {
 +   .hwport = 2,
 +   .flags  = 0,
 +   .ucon   = UCON,
 +   .ulcon  = ULCON,
 +   .ufcon  = UFCON,
 +   }
 +};
 +
 +static struct mtd_partition w5300e01_mtd_partitions[] = {
 +   [0] = {
 +   .name   = Bootloader,
 +   .size   = 0x2,
 +   .offset = 0,
 +   .mask_flags = MTD_WRITEABLE,
 +   },
 +   [1] = {
 +   .name   = Boot Param,
 +   .size   = 0x2,
 +   .offset = MTDPART_OFS_APPEND,
 +   },
 +   [2] = {
 +   .name   = Kernel,
 +   .size   = 0x3C,
 +   .offset = MTDPART_OFS_APPEND,
 +   },
 +   [3] = {
 +   .name   = Ramdisk,
 +   .size   = 0x100,
 +   .offset = MTDPART_OFS_APPEND,
 +   },
 +   [4] = {
 +   .name   = JFFS2 FileSystem,
 +   .size   = MTDPART_SIZ_FULL,
 +   

Re: [PATCH] gpio: samsung: add devicetree init for s3c24xx arches

2012-08-27 Thread Vasily Khoruzhick
Hi,

On Mon, Aug 27, 2012 at 11:01 AM, Heiko Stübner he...@sntech.de wrote:
 Hi Thomas,

 thanks for your review:

 Hmmm, but the logic to drive the gpio controller is the same for all arches.
 The only difference is the number to use for the different pull up/down
 settings. So I think the samsung,s3c24xx-gpio is ok but the documentation
 should simply reflect the different pull settings.


Also s3c2410 and s3c2440 has different count of GPIOs. And that could
be a problem on machines
with GPIO-expanders (h1940 machine)

 It would be informative to add information about the 'mux function'
 cell here as well. Specifically, on how to handle the banks that have
 an extended GPxSEL register that allow additional pin function
 selection.

 Will add a mux function description.

 Until now I've never realised the existence of the GPxSEL registers, so thanks
 for the pointer :-).

 But is this used in the driver at all? All the setcfg/getcfg functions in
 gpio-samsung.c only handle the GPxCON registers - I haven't found code to
 handle the GPxSEL registers at all. So my guess is that this was never
 implemented - or that I'm blind ;-) .

There're no GPxSEL registers on s3c2410/s3c2440/s3c2442. Is it
something s3c2412/sec2416 specific?

Regards
Vasily
--
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] gpio: samsung: add devicetree init for s3c24xx arches

2012-08-27 Thread Vasily Khoruzhick
On Mon, Aug 27, 2012 at 12:44 PM, Heiko Stübner he...@sntech.de wrote:
 Hi Vasily,

 I'm not sure I follow :-) .

 The compatible property here only sets the mechanism on how to handle the
 gpios defined in the devicetree - here to use the s3c24xx-style. As you can
 see in gpio-samsung.c the handling is already unified for all the s3c24xx
 architectures.

 The definition of what gpio banks exist is then done in the respective
 devicetree file for the individual SoC. And of course here one would have
 individual definitions, depending on the banks present.

 For reference my quite empty s3c2416.dtsi file currently looks like:

 /include/ skeleton.dtsi

 / {
 compatible = samsung,s3c2416;

 cpus {
 cpu@0 {
 compatible = arm,arm926ejs;
 };
 };

 gpio-controllers {
 #address-cells = 1;
 #size-cells = 1;
 gpio-controller;
 ranges;

 gpa: gpio-controller@5600 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x5600 0x10;
 #gpio-cells = 3;
 };

 gpb: gpio-controller@5610 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x5610 0x10;
 #gpio-cells = 3;
 };

 gpc: gpio-controller@5620 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x5620 0x10;
 #gpio-cells = 3;
 };

 gpd: gpio-controller@5630 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x5630 0x10;
 #gpio-cells = 3;
 };

 gpe: gpio-controller@5640 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x5640 0x10;
 #gpio-cells = 3;
 };

 gpf: gpio-controller@5650 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x5650 0x10;
 #gpio-cells = 3;
 };

 gpg: gpio-controller@5660 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x5660 0x10;
 #gpio-cells = 3;
 };

 gph: gpio-controller@5670 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x5670 0x10;
 #gpio-cells = 3;
 };

 /* s3c2443 and later */
 gpj: gpio-controller@56D0 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x56D0 0x10;
 #gpio-cells = 3;
 };

 gpk: gpio-controller@56E0 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x56E0 0x10;
 #gpio-cells = 3;
 };

 gpl: gpio-controller@56F0 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x56F0 0x10;
 #gpio-cells = 3;
 };

 gpm: gpio-controller@56000100 {
 compatible = samsung,s3c24xx-gpio;
 reg = 0x56000100 0x10;
 #gpio-cells = 3;
 };
 };
 };

 Other s3c24xx SoCs would of course need to define their own.

I see. But how does it handle GPA bank (which is output-only, and
GPACON differs a bit from GP{B-J}CON? And some banks has lower number
(not 16) of GPIOs, like GPH.

Also, what would be value for S3C_GPIO_END?

Regards
Vasily
--
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 v3 1/6] Samsung SoC ADC: use regulator (VDD for ADC).

2011-06-30 Thread Vasily Khoruzhick
On Thursday 30 June 2011 10:49:30 MyungJoo Ham wrote:
 This patch allows the Samsung ADC driver to enable VDD regulator at
 probe and resume and to disable at exit and suspend.
 In a platform where ADC's VDD regulator is not always-on, this control
 is required although this patch does not provide fine-grained power
 control (turning on the regulator only when being accessed).
 
 However, if VDD regulator (vdd for the adc device) is not provided,
 the regulator control will not be activated because there are platforms
 that do not provide regulator for ADC device.
 
 arch_initcall has been modified to module_init in order to allow
 regulators to be available at probe.
 
 Signed-off-by: MyungJoo Ham myungjoo@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com


 --
 changed from v2 with valuable comments from Mark Brown.
 - Bugfix on error handling
 - Faster escape when error at resume function
 changes from v1
 - Removed macro defining the name of regulator.
 - Handle error from regulator_enable.
 - Do not allow not to have the regulator if CONFIG_REGULATOR.
 - Seperate a patch dealing with arch_initcall-module_init
 ---
  arch/arm/plat-samsung/adc.c |   31 +++
  1 files changed, 27 insertions(+), 4 deletions(-)
 
 diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
 index e8f2be2..2224128 100644
 --- a/arch/arm/plat-samsung/adc.c
 +++ b/arch/arm/plat-samsung/adc.c
 @@ -21,6 +21,7 @@
  #include linux/clk.h
  #include linux/interrupt.h
  #include linux/io.h
 +#include linux/regulator/consumer.h
 
  #include plat/regs-adc.h
  #include plat/adc.h
 @@ -71,6 +72,7 @@ struct adc_device {
   unsigned int prescale;
 
   int  irq;
 + struct regulator*vdd;
  };
 
  static struct adc_device *adc_dev;
 @@ -338,17 +340,24 @@ static int s3c_adc_probe(struct platform_device
 *pdev) adc-pdev = pdev;
   adc-prescale = S3C2410_ADCCON_PRSCVL(49);
 
 + adc-vdd = regulator_get(dev, vdd);
 + if (IS_ERR(adc-vdd)) {
 + dev_err(dev, operating without regulator \vdd\ .\n);
 + ret = PTR_ERR(adc-vdd);
 + goto err_alloc;
 + }
 +

NACK. Make it optional, otherwise it breaks s3c24xx.

   adc-irq = platform_get_irq(pdev, 1);
   if (adc-irq = 0) {
   dev_err(dev, failed to get adc irq\n);
   ret = -ENOENT;
 - goto err_alloc;
 + goto err_reg;
   }
 
   ret = request_irq(adc-irq, s3c_adc_irq, 0, dev_name(dev), adc);
   if (ret  0) {
   dev_err(dev, failed to attach adc irq\n);
 - goto err_alloc;
 + goto err_reg;
   }
 
   adc-clk = clk_get(dev, adc);
 @@ -372,6 +381,10 @@ static int s3c_adc_probe(struct platform_device *pdev)
   goto err_clk;
   }
 
 + ret = regulator_enable(adc-vdd);
 + if (ret)
 + goto err_ioremap;
 +
   clk_enable(adc-clk);
 
   tmp = adc-prescale | S3C2410_ADCCON_PRSCEN;
 @@ -388,12 +401,15 @@ static int s3c_adc_probe(struct platform_device
 *pdev)
 
   return 0;
 
 + err_ioremap:
 + iounmap(adc-regs);
   err_clk:
   clk_put(adc-clk);
 
   err_irq:
   free_irq(adc-irq, adc);
 -
 + err_reg:
 + regulator_put(adc-vdd);
   err_alloc:
   kfree(adc);
   return ret;
 @@ -406,6 +422,8 @@ static int __devexit s3c_adc_remove(struct
 platform_device *pdev) iounmap(adc-regs);
   free_irq(adc-irq, adc);
   clk_disable(adc-clk);
 + regulator_disable(adc-vdd);
 + regulator_put(adc-vdd);
   clk_put(adc-clk);
   kfree(adc);
 
 @@ -428,6 +446,7 @@ static int s3c_adc_suspend(struct platform_device
 *pdev, pm_message_t state) disable_irq(adc-irq);
   spin_unlock_irqrestore(adc-lock, flags);
   clk_disable(adc-clk);
 + regulator_disable(adc-vdd);
 
   return 0;
  }
 @@ -435,7 +454,11 @@ static int s3c_adc_suspend(struct platform_device
 *pdev, pm_message_t state) static int s3c_adc_resume(struct
 platform_device *pdev)
  {
   struct adc_device *adc = platform_get_drvdata(pdev);
 + int ret;
 
 + ret = regulator_enable(adc-vdd);
 + if (ret)
 + return ret;
   clk_enable(adc-clk);
   enable_irq(adc-irq);
 
 @@ -485,4 +508,4 @@ static int __init adc_init(void)
   return ret;
  }
 
 -arch_initcall(adc_init);
 +module_init(adc_init);
--
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/7] ARM: Removing ARCH_S5PC100

2011-05-13 Thread Vasily Khoruzhick
On Thursday 12 May 2011 04:11:07 Kukjin Kim wrote:
 This patch remvoes mach-s5pc100 directory for ARCH_S5PC100 in arch/arm.

Hm, what's the point of removing this code?

 If any problems, please let me know immediately.
 
 [PATCH 1/7] ARM: S5PC100: Removing ARCH_S5PC100
 [PATCH 2/7] ASoC: Remove to support sound for S5PC100
 [PATCH 3/7] [media] s5p-fimc: Remove to support fimc for S5PC100
 [PATCH 4/7] mtd: OneNAND: Remove to support onenand for S5PC100
 [PATCH 5/7] tty: Remove to support serial for S5PC100
 [PATCH 6/7] video: s3c-fb: Remove to support fb for S5PC100
 [PATCH 7/7] libata: Remove to support pata for S5PC100
--
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] rtc: rtc-s3c: fix compile error due to missing s3c_rtc_setpie

2011-03-24 Thread Vasily Khoruzhick
s3c_rtc_setpie was removed, and it resulted in compiler error:

drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_release’:
drivers/rtc/rtc-s3c.c:339:2: error: implicit declaration of function
‘s3c_rtc_setpie’

Fix it by removing s3c_rtc_release calls.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 drivers/rtc/rtc-s3c.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 7149649..b3466c4 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -336,7 +336,6 @@ static void s3c_rtc_release(struct device *dev)
 
/* do not clear AIE here, it may be needed for wake */
 
-   s3c_rtc_setpie(dev, 0);
free_irq(s3c_rtc_alarmno, rtc_dev);
free_irq(s3c_rtc_tickno, rtc_dev);
 }
@@ -408,7 +407,6 @@ static int __devexit s3c_rtc_remove(struct platform_device 
*dev)
platform_set_drvdata(dev, NULL);
rtc_device_unregister(rtc);
 
-   s3c_rtc_setpie(dev-dev, 0);
s3c_rtc_setaie(dev-dev, 0);
 
clk_disable(rtc_clk);
-- 
1.7.4.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 0/7] ARM: S3C24XX: H1940 and RX1950 series

2011-01-06 Thread Vasily Khoruzhick
This series improves HP iPAQ H1940 and RX1950 support.

Changes introduced by these patches:
1. Add support for H1940 buttons
2. Compile fix for h1940-bluetooth.c
3. Use leds-gpio to drive LEDs on H1940
4. Add support for battery monitoring and charging on H1940
5. Improve LCD power-on sequence
6. Retain LEDs state on RX1950 in suspend
7. Add support for HW LEDs blinking on RX1950

--
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/7] ARM: S3C2410: H1940: Add keys device

2011-01-06 Thread Vasily Khoruzhick
From: Arnaud Patard (Rtp) arnaud.pat...@rtp-net.org

Add buttons definition for H1940.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/mach-h1940.c |   39 
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2410/mach-h1940.c 
b/arch/arm/mach-s3c2410/mach-h1940.c
index 1a81fe1..641586a 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -23,6 +23,8 @@
 #include linux/platform_device.h
 #include linux/io.h
 #include linux/gpio.h
+#include linux/input.h
+#include linux/gpio_keys.h
 #include linux/pwm_backlight.h
 #include linux/i2c.h
 #include video/platform_lcd.h
@@ -381,7 +383,44 @@ static struct i2c_board_info h1940_i2c_devices[] = {
},
 };
 
+#define DECLARE_BUTTON(p, k, n, w) \
+   {   \
+   .gpio   = p,\
+   .code   = k,\
+   .desc   = n,\
+   .wakeup = w,\
+   .active_low = 1,\
+   }
+
+static struct gpio_keys_button h1940_buttons[] = {
+   DECLARE_BUTTON(S3C2410_GPF(0),   KEY_POWER,  Power, 1),
+   DECLARE_BUTTON(S3C2410_GPF(6),   KEY_ENTER, Select, 1),
+   DECLARE_BUTTON(S3C2410_GPF(7),  KEY_RECORD, Record, 0),
+   DECLARE_BUTTON(S3C2410_GPG(0), KEY_F11,   Calendar, 0),
+   DECLARE_BUTTON(S3C2410_GPG(2), KEY_F12,   Contacts, 0),
+   DECLARE_BUTTON(S3C2410_GPG(3),KEY_MAIL,   Mail, 0),
+   DECLARE_BUTTON(S3C2410_GPG(6),KEY_LEFT, Left_arrow, 0),
+   DECLARE_BUTTON(S3C2410_GPG(7),KEY_HOMEPAGE,   Home, 0),
+   DECLARE_BUTTON(S3C2410_GPG(8),   KEY_RIGHT,Right_arrow, 0),
+   DECLARE_BUTTON(S3C2410_GPG(9),  KEY_UP,   Up_arrow, 0),
+   DECLARE_BUTTON(S3C2410_GPG(10),   KEY_DOWN, Down_arrow, 0),
+};
+
+static struct gpio_keys_platform_data h1940_buttons_data = {
+   .buttons= h1940_buttons,
+   .nbuttons   = ARRAY_SIZE(h1940_buttons),
+};
+
+static struct platform_device h1940_dev_buttons = {
+   .name   = gpio-keys,
+   .id = -1,
+   .dev= {
+   .platform_data  = h1940_buttons_data,
+   }
+};
+
 static struct platform_device *h1940_devices[] __initdata = {
+   h1940_dev_buttons,
s3c_device_ohci,
s3c_device_lcd,
s3c_device_wdt,
-- 
1.7.3.2

--
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/7] ARM: S3C2410: H1940: Make h1940-bluetooth.c compile again

2011-01-06 Thread Vasily Khoruzhick
It was broken by removal of rfkill_set_led_trigger_name function,
and now compiler complains about implicit declaration.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/h1940-bluetooth.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c 
b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 6b86a72..6c59ef5 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -85,7 +85,6 @@ static int __devinit h1940bt_probe(struct platform_device 
*pdev)
s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
 
-
rfk = rfkill_alloc(DRV_NAME, pdev-dev, RFKILL_TYPE_BLUETOOTH,
h1940bt_rfkill_ops, NULL);
if (!rfk) {
@@ -93,8 +92,6 @@ static int __devinit h1940bt_probe(struct platform_device 
*pdev)
goto err_rfk_alloc;
}
 
-   rfkill_set_led_trigger_name(rfk, h1940-bluetooth);
-
ret = rfkill_register(rfk);
if (ret)
goto err_rfkill;
-- 
1.7.3.2

--
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/7] ARM: S3C2410: H1940: Use leds-gpio driver for LEDs managing

2011-01-06 Thread Vasily Khoruzhick
We can use generic leds-gpio driver, as latch api was converted
to gpiolib.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/h1940-bluetooth.c|8 ++-
 arch/arm/mach-s3c2410/include/mach/h1940.h |3 +
 arch/arm/mach-s3c2410/mach-h1940.c |   93 +++-
 3 files changed, 101 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c 
b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 6c59ef5..2c126bb 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -18,12 +18,14 @@
 #include linux/leds.h
 #include linux/gpio.h
 #include linux/rfkill.h
+#include linux/leds.h
 
 #include mach/regs-gpio.h
 #include mach/hardware.h
 #include mach/h1940-latch.h
+#include mach/h1940.h
 
-#define DRV_NAME  h1940-bt
+#define DRV_NAME h1940-bt
 
 /* Bluetooth control */
 static void h1940bt_enable(int on)
@@ -37,6 +39,8 @@ static void h1940bt_enable(int on)
gpio_set_value(S3C2410_GPH(1), 1);
mdelay(10);
gpio_set_value(S3C2410_GPH(1), 0);
+
+   h1940_led_blink_set(-EINVAL, GPIO_LED_BLINK, NULL, NULL);
}
else {
gpio_set_value(S3C2410_GPH(1), 1);
@@ -44,6 +48,8 @@ static void h1940bt_enable(int on)
gpio_set_value(S3C2410_GPH(1), 0);
mdelay(10);
gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0);
+
+   h1940_led_blink_set(-EINVAL, GPIO_LED_NO_BLINK_LOW, NULL, NULL);
}
 }
 
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940.h 
b/arch/arm/mach-s3c2410/include/mach/h1940.h
index 4559784..2aa683c 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940.h
@@ -17,5 +17,8 @@
 #define H1940_SUSPEND_CHECK(0x3008)
 
 extern void h1940_pm_return(void);
+extern int h1940_led_blink_set(unsigned gpio, int state,
+   unsigned long *delay_on, unsigned long *delay_off);
+
 
 #endif /* __ASM_ARCH_H1940_H */
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c 
b/arch/arm/mach-s3c2410/mach-h1940.c
index 641586a..5d0d2ae 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -27,6 +27,8 @@
 #include linux/gpio_keys.h
 #include linux/pwm_backlight.h
 #include linux/i2c.h
+#include linux/leds.h
+
 #include video/platform_lcd.h
 
 #include linux/mmc/host.h
@@ -235,9 +237,87 @@ static struct s3c2410fb_mach_info h1940_fb_info __initdata 
= {
.gpdup_mask=0x,
 };
 
+DEFINE_SPINLOCK(h1940_blink_spin);
+
+int h1940_led_blink_set(unsigned gpio, int state,
+   unsigned long *delay_on, unsigned long *delay_off)
+{
+   int blink_gpio, check_gpio1, check_gpio2;
+
+   switch (gpio) {
+   case H1940_LATCH_LED_GREEN:
+   blink_gpio = S3C2410_GPA(7);
+   check_gpio1 = S3C2410_GPA(1);
+   check_gpio2 = S3C2410_GPA(3);
+   break;
+   case H1940_LATCH_LED_RED:
+   blink_gpio = S3C2410_GPA(1);
+   check_gpio1 = S3C2410_GPA(7);
+   check_gpio2 = S3C2410_GPA(3);
+   break;
+   default:
+   blink_gpio = S3C2410_GPA(3);
+   check_gpio1 = S3C2410_GPA(1);
+   check_gpio1 = S3C2410_GPA(7);
+   break;
+   }
+
+   if (delay_on  delay_off  !*delay_on  !*delay_off)
+   *delay_on = *delay_off = 500;
+
+   spin_lock(h1940_blink_spin);
+
+   switch (state) {
+   case GPIO_LED_NO_BLINK_LOW:
+   case GPIO_LED_NO_BLINK_HIGH:
+   if (!gpio_get_value(check_gpio1) 
+   !gpio_get_value(check_gpio2))
+   gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+   gpio_set_value(blink_gpio, 0);
+   if (gpio_is_valid(gpio))
+   gpio_set_value(gpio, state);
+   break;
+   case GPIO_LED_BLINK:
+   if (gpio_is_valid(gpio))
+   gpio_set_value(gpio, 0);
+   gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+   gpio_set_value(blink_gpio, 1);
+   break;
+   }
+
+   spin_unlock(h1940_blink_spin);
+
+   return 0;
+}
+EXPORT_SYMBOL(h1940_led_blink_set);
+
+static struct gpio_led h1940_leds_desc[] = {
+   {
+   .name   = Green,
+   .default_trigger= main-battery-charging-or-full,
+   .gpio   = H1940_LATCH_LED_GREEN,
+   .retain_state_suspended = 1,
+   },
+   {
+   .name   = Red,
+   .default_trigger= main-battery-full,
+   .gpio   = H1940_LATCH_LED_RED,
+   .retain_state_suspended = 1,
+   },
+};
+
+static struct gpio_led_platform_data h1940_leds_pdata = {
+   .num_leds   = ARRAY_SIZE(h1940_leds_desc),
+   .leds

[PATCH 4/7] ARM: S3C2410: H1940: Add battery support

2011-01-06 Thread Vasily Khoruzhick
Add battery monitoring/charging support via pda_power and
s3c_adc_battery drivers

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/mach-h1940.c |  144 
 1 files changed, 144 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2410/mach-h1940.c 
b/arch/arm/mach-s3c2410/mach-h1940.c
index 5d0d2ae..6a3cf78 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -28,6 +28,8 @@
 #include linux/pwm_backlight.h
 #include linux/i2c.h
 #include linux/leds.h
+#include linux/pda_power.h
+#include linux/s3c_adc_battery.h
 
 #include video/platform_lcd.h
 
@@ -237,6 +239,146 @@ static struct s3c2410fb_mach_info h1940_fb_info 
__initdata = {
.gpdup_mask=0x,
 };
 
+static int power_supply_init(struct device *dev)
+{
+   return gpio_request(S3C2410_GPF(2), cable plugged);
+}
+
+static int h1940_is_ac_online(void)
+{
+   return !gpio_get_value(S3C2410_GPF(2));
+}
+
+static void power_supply_exit(struct device *dev)
+{
+   gpio_free(S3C2410_GPF(2));
+}
+
+static char *h1940_supplicants[] = {
+   main-battery,
+   backup-battery,
+};
+
+static struct pda_power_pdata power_supply_info = {
+   .init   = power_supply_init,
+   .is_ac_online   = h1940_is_ac_online,
+   .exit   = power_supply_exit,
+   .supplied_to= h1940_supplicants,
+   .num_supplicants= ARRAY_SIZE(h1940_supplicants),
+};
+
+static struct resource power_supply_resources[] = {
+   [0] = {
+   .name   = ac,
+   .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE |
+ IORESOURCE_IRQ_HIGHEDGE,
+   .start  = IRQ_EINT2,
+   .end= IRQ_EINT2,
+   },
+};
+
+static struct platform_device power_supply = {
+   .name   = pda-power,
+   .id = -1,
+   .dev= {
+   .platform_data =
+   power_supply_info,
+   },
+   .resource   = power_supply_resources,
+   .num_resources  = ARRAY_SIZE(power_supply_resources),
+};
+
+static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
+   { .volt = 4070, .cur = 162, .level = 100},
+   { .volt = 4040, .cur = 165, .level = 95},
+   { .volt = 4016, .cur = 164, .level = 90},
+   { .volt = 3996, .cur = 166, .level = 85},
+   { .volt = 3971, .cur = 168, .level = 80},
+   { .volt = 3951, .cur = 168, .level = 75},
+   { .volt = 3931, .cur = 170, .level = 70},
+   { .volt = 3903, .cur = 172, .level = 65},
+   { .volt = 3886, .cur = 172, .level = 60},
+   { .volt = 3858, .cur = 176, .level = 55},
+   { .volt = 3842, .cur = 176, .level = 50},
+   { .volt = 3818, .cur = 176, .level = 45},
+   { .volt = 3789, .cur = 180, .level = 40},
+   { .volt = 3769, .cur = 180, .level = 35},
+   { .volt = 3749, .cur = 184, .level = 30},
+   { .volt = 3732, .cur = 184, .level = 25},
+   { .volt = 3716, .cur = 184, .level = 20},
+   { .volt = 3708, .cur = 184, .level = 15},
+   { .volt = 3716, .cur = 96, .level = 10},
+   { .volt = 3700, .cur = 96, .level = 5},
+   { .volt = 3684, .cur = 96, .level = 0},
+};
+
+static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
+   { .volt = 4130, .cur = 0, .level = 100},
+   { .volt = 3982, .cur = 0, .level = 50},
+   { .volt = 3854, .cur = 0, .level = 10},
+   { .volt = 3841, .cur = 0, .level = 0},
+};
+
+int h1940_bat_init(void)
+{
+   int ret;
+
+   ret = gpio_request(H1940_LATCH_SM803_ENABLE, h1940-charger-enable);
+   if (ret)
+   return ret;
+   gpio_direction_output(H1940_LATCH_SM803_ENABLE, 0);
+
+   return 0;
+
+}
+
+void h1940_bat_exit(void)
+{
+   gpio_free(H1940_LATCH_SM803_ENABLE);
+}
+
+void h1940_enable_charger(void)
+{
+   gpio_set_value(H1940_LATCH_SM803_ENABLE, 1);
+}
+
+void h1940_disable_charger(void)
+{
+   gpio_set_value(H1940_LATCH_SM803_ENABLE, 0);
+}
+
+static struct s3c_adc_bat_pdata h1940_bat_cfg = {
+   .init = h1940_bat_init,
+   .exit = h1940_bat_exit,
+   .enable_charger = h1940_enable_charger,
+   .disable_charger = h1940_disable_charger,
+   .gpio_charge_finished = S3C2410_GPF(3),
+   .gpio_inverted = 1,
+   .lut_noac = bat_lut_noac,
+   .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac),
+   .lut_acin = bat_lut_acin,
+   .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin),
+   .volt_channel = 0,
+   .current_channel = 1,
+   .volt_mult = 4056,
+   .current_mult = 1893,
+   .internal_impedance = 200,
+   .backup_volt_channel = 3,
+   /* TODO Check backup volt multiplier */
+   .backup_volt_mult = 4056,
+   .backup_volt_min = 0,
+   .backup_volt_max = 4149288
+};
+
+static struct platform_device h1940_battery

[PATCH 5/7] ARM: S3C2410: H1940: Fix lcd_power_set function

2011-01-06 Thread Vasily Khoruzhick
Current implementation of lcd_power_set is not reliable, sometimes
it does not enable LCD at all.
Mimic WinCE behavior to fix this issue.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/mach-h1940.c |   26 +++---
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-s3c2410/mach-h1940.c 
b/arch/arm/mach-s3c2410/mach-h1940.c
index 6a3cf78..5531c4c 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -30,6 +30,7 @@
 #include linux/leds.h
 #include linux/pda_power.h
 #include linux/s3c_adc_battery.h
+#include linux/delay.h
 
 #include video/platform_lcd.h
 
@@ -228,15 +229,15 @@ static struct s3c2410fb_mach_info h1940_fb_info 
__initdata = {
.num_displays = 1,
.default_display = 0,
 
-   .lpcsel=0x02,
-   .gpccon=0xaa940659,
-   .gpccon_mask=   0x,
-   .gpcup= 0x,
-   .gpcup_mask=0x,
-   .gpdcon=0xaa84aaa0,
-   .gpdcon_mask=   0x,
-   .gpdup= 0xfaff,
-   .gpdup_mask=0x,
+   .lpcsel =   0x02,
+   .gpccon =   0xaa940659,
+   .gpccon_mask =  0xc0f0,
+   .gpcup =0x,
+   .gpcup_mask =   0x,
+   .gpdcon =   0xaa84aaa0,
+   .gpdcon_mask =  0x,
+   .gpdup =0xfaff,
+   .gpdup_mask =   0x,
 };
 
 static int power_supply_init(struct device *dev)
@@ -545,14 +546,14 @@ static struct platform_device h1940_backlight = {
 static void h1940_lcd_power_set(struct plat_lcd_data *pd,
unsigned int power)
 {
-   int value;
+   int value, retries = 100;
 
if (!power) {
gpio_set_value(S3C2410_GPC(0), 0);
/* wait for 3ac */
do {
value = gpio_get_value(S3C2410_GPC(6));
-   } while (value);
+   } while (value  retries--);
 
gpio_set_value(H1940_LATCH_LCD_P2, 0);
gpio_set_value(H1940_LATCH_LCD_P3, 0);
@@ -570,6 +571,9 @@ static void h1940_lcd_power_set(struct plat_lcd_data *pd,
gpio_set_value(H1940_LATCH_LCD_P0, 1);
gpio_set_value(H1940_LATCH_LCD_P1, 1);
 
+   gpio_direction_input(S3C2410_GPC(1));
+   gpio_direction_input(S3C2410_GPC(4));
+   mdelay(10);
s3c_gpio_cfgpin(S3C2410_GPC(1), S3C_GPIO_SFN(2));
s3c_gpio_cfgpin(S3C2410_GPC(4), S3C_GPIO_SFN(2));
 
-- 
1.7.3.2

--
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 6/7] ARM: S3C2442: RX1950: Retain LEDs state in suspend

2011-01-06 Thread Vasily Khoruzhick
s3c_adc_battery uses LEDs to indicate charging process,
retain LEDs state in suspend, otherwise user have no information if PDA
battery is charging after he put it to suspend.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2440/mach-rx1950.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c 
b/arch/arm/mach-s3c2440/mach-rx1950.c
index eab6ae5..e7cc993 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -268,16 +268,19 @@ static struct gpio_led rx1950_leds_desc[] = {
.name   = Green,
.default_trigger= main-battery-charging-or-full,
.gpio   = S3C2410_GPA(6),
+   .retain_state_suspended = 1,
},
{
.name   = Red,
.default_trigger= main-battery-full,
.gpio   = S3C2410_GPA(7),
+   .retain_state_suspended = 1,
},
{
.name   = Blue,
.default_trigger= rx1950-acx-mem,
.gpio   = S3C2410_GPA(11),
+   .retain_state_suspended = 1,
},
 };
 
-- 
1.7.3.2

--
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: S3C2442: rx1950: Retain LEDs state in suspend

2010-12-08 Thread Vasily Khoruzhick
s3c_adc_battery uses LEDs to indicate charging process,
retain LEDs state in suspend, otherwise user have no information if PDA
battery is charging after he put it to suspend.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2440/mach-rx1950.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c 
b/arch/arm/mach-s3c2440/mach-rx1950.c
index e0622bb..2c41254 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -268,16 +268,19 @@ static struct gpio_led rx1950_leds_desc[] = {
.name   = Green,
.default_trigger= main-battery-charging-or-full,
.gpio   = S3C2410_GPA(6),
+   .retain_state_suspended = 1,
},
{
.name   = Red,
.default_trigger= main-battery-full,
.gpio   = S3C2410_GPA(7),
+   .retain_state_suspended = 1,
},
{
.name   = Blue,
.default_trigger= rx1950-acx-mem,
.gpio   = S3C2410_GPA(11),
+   .retain_state_suspended = 1,
},
 };
 
-- 
1.7.3.2

--
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] h1940-leds: Fix compile issue introduced by latch-related changes

2010-12-06 Thread Vasily Khoruzhick
On Monday 08 November 2010 22:31:48 Vasily Khoruzhick wrote:
 Latch API was converted to gpiolib API as result we got this compile
 error:
 
 drivers/leds/leds-h1940.c: In function 'h1940_greenled_set':
 drivers/leds/leds-h1940.c:33: error: implicit declaration of function
 'h1940_latch_control
 
 Adapt h1940-leds driver to new changes and fix compile issue.
 
 Signed-off-by: Vasily Khoruzhick anars...@gmail.com
 ---
  drivers/leds/leds-h1940.c |   67
 - 1 files changed, 48
 insertions(+), 19 deletions(-)
 
 diff --git a/drivers/leds/leds-h1940.c b/drivers/leds/leds-h1940.c
 index 173d104..d9c2729 100644
 --- a/drivers/leds/leds-h1940.c
 +++ b/drivers/leds/leds-h1940.c
 @@ -30,18 +30,18 @@ static void h1940_greenled_set(struct led_classdev
 *led_dev, {
   switch (value) {
   case LED_HALF:
 - h1940_latch_control(0, H1940_LATCH_LED_FLASH);
 - s3c2410_gpio_setpin(S3C2410_GPA7, 1);
 + gpio_set_value(H1940_LATCH_LED_FLASH, 1);
 + gpio_set_value(S3C2410_GPA(7), 1);
   break;
   case LED_FULL:
 - h1940_latch_control(0, H1940_LATCH_LED_GREEN);
 - s3c2410_gpio_setpin(S3C2410_GPA7, 1);
 + gpio_set_value(H1940_LATCH_LED_GREEN, 1);
 + gpio_set_value(S3C2410_GPA(7), 1);
   break;
   default:
   case LED_OFF:
 - h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
 - h1940_latch_control(H1940_LATCH_LED_GREEN, 0);
 - s3c2410_gpio_setpin(S3C2410_GPA7, 0);
 + gpio_set_value(H1940_LATCH_LED_FLASH, 0);
 + gpio_set_value(H1940_LATCH_LED_GREEN, 0);
 + gpio_set_value(S3C2410_GPA(7), 0);
   break;
   }
  }
 @@ -60,18 +60,18 @@ static void h1940_redled_set(struct led_classdev
 *led_dev, {
   switch (value) {
   case LED_HALF:
 - h1940_latch_control(0, H1940_LATCH_LED_FLASH);
 - s3c2410_gpio_setpin(S3C2410_GPA1, 1);
 + gpio_set_value(H1940_LATCH_LED_FLASH, 1);
 + gpio_set_value(S3C2410_GPA(1), 1);
   break;
   case LED_FULL:
 - h1940_latch_control(0, H1940_LATCH_LED_RED);
 - s3c2410_gpio_setpin(S3C2410_GPA1, 1);
 + gpio_set_value(H1940_LATCH_LED_RED, 1);
 + gpio_set_value(S3C2410_GPA(1), 1);
   break;
   default:
   case LED_OFF:
 - h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
 - h1940_latch_control(H1940_LATCH_LED_RED, 0);
 - s3c2410_gpio_setpin(S3C2410_GPA1, 0);
 + gpio_set_value(H1940_LATCH_LED_FLASH, 0);
 + gpio_set_value(H1940_LATCH_LED_RED, 0);
 + gpio_set_value(S3C2410_GPA(1), 0);
   break;
   }
  }
 @@ -91,11 +91,11 @@ static void h1940_blueled_set(struct led_classdev
 *led_dev, {
   if (value) {
   /* flashing Blue */
 - h1940_latch_control(0, H1940_LATCH_LED_FLASH);
 - s3c2410_gpio_setpin(S3C2410_GPA3, 1);
 + gpio_set_value(H1940_LATCH_LED_FLASH, 1);
 + gpio_set_value(S3C2410_GPA(3), 1);
   } else {
 - h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
 - s3c2410_gpio_setpin(S3C2410_GPA3, 0);
 + gpio_set_value(H1940_LATCH_LED_FLASH, 0);
 + gpio_set_value(S3C2410_GPA(3), 0);
   }
 
  }
 @@ -108,7 +108,24 @@ static struct led_classdev h1940_blueled = {
 
  static int __devinit h1940leds_probe(struct platform_device *pdev)
  {
 - int ret;
 + int ret, gpioidx = 0;
 + int led_gpios[] = {
 + H1940_LATCH_LED_GREEN,
 + H1940_LATCH_LED_RED,
 + H1940_LATCH_LED_FLASH,
 + S3C2410_GPA(1),
 + S3C2410_GPA(3),
 + S3C2410_GPA(7),
 + };
 +
 + for (gpioidx = 0; gpioidx  ARRAY_SIZE(led_gpios); gpioidx++) {
 + ret = gpio_request(led_gpios[gpioidx], h1940 leds);
 + if (ret  0)
 + goto err_gpio;
 + ret = gpio_direction_output(led_gpios[gpioidx], 0);
 + if (ret  0)
 + goto err_gpio;
 + }
 
   ret = led_classdev_register(pdev-dev, h1940_greenled);
   if (ret)
 @@ -129,6 +146,10 @@ err_blue:
  err_red:
   led_classdev_unregister(h1940_greenled);
  err_green:
 +err_gpio:
 + while (--gpioidx = 0)
 + gpio_free(led_gpios[gpioidx]);
 +
   return ret;
  }
 
 @@ -137,6 +158,14 @@ static int h1940leds_remove(struct platform_device
 *pdev) led_classdev_unregister(h1940_greenled);
   led_classdev_unregister(h1940_redled);
   led_classdev_unregister(h1940_blueled);
 +
 + gpio_free(H1940_LATCH_LED_GREEN);
 + gpio_free(H1940_LATCH_LED_RED);
 + gpio_free(H1940_LATCH_LED_FLASH);
 + gpio_free(S3C2410_GPA(1));
 + gpio_free(S3C2410_GPA(3));
 + gpio_free(S3C2410_GPA(7));
 +
   return 0;
  }

Added Richard Purdie

Re: [PATCH v5] ARM: s3c244x: Fix mess with gpio {set,get}_pull callbacks

2010-12-01 Thread Vasily Khoruzhick
On Wednesday 01 December 2010 09:26:31 Kukjin Kim wrote:

 How about following...
 
 +void __init s3c2440_map_io(void)
 +{
 + s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1up;
 + s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1up;
 +
 + s3c244x_map_io();
 +}

What's difference except order?
 
 Yeah, however, in my opinion, need to add following during gpiolib_init().
 
 @@ -222,6 +222,11 @@ static __init int s3c24xx_gpiolib_init(void)
 if (!chip-config)
 chip-config = s3c24xx_gpiocfg_default;
 
 +   if (!chip-config-set_pull)
 +   chip-config-set_pull = s3c_gpio_setpull_1up;
 +   if (!chip-config-get_pull)
 +   chip-config-get_pull = s3c_gpio_getpull_1up;
 +
 s3c_gpiolib_add(chip);
 }

Pull callbacks are soc-specific, s3c24xx_gpiolib_init is common for all socs, 
so we can't do like this.

Btw, I've sent v6 version of patch, it still with empty line issues, should I 
resend v7 version or maintainers can fixup it at their side? :)

Regards
Vasily
--
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 v5] ARM: s3c244x: Fix mess with gpio {set,get}_pull callbacks

2010-12-01 Thread Vasily Khoruzhick
On Wednesday 01 December 2010 14:05:00 Kukjin Kim wrote:
 Yeah, right...it depends on each SoCs. But, if there is no setup it in
 map_io(), there is no functions of set_pull() and get_pull(). As you know,
 used s3c_gpio_{set,get}pull_1up as default before your patch...
 
 Hmm...however, I will think about its necessity again.

In this case it will fail if SoC does not support pull up, so does it matter 
how it will fail?
 
 Ok..I will do it and will apply.
 Then, will be sent to Linus during 37-rc.

Thanks

Regards
Vasily
--
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 v3] ARM: s3c2442: Setup gpio {set,get}_pull callbacks

2010-11-30 Thread Vasily Khoruzhick
On Tuesday 30 November 2010 13:53:43 Lars-Peter Clausen wrote:

  Hmm...how about s3c_gpio_setpull_1updown(...)?
  And actually, not used 3rd argument, pull now.
  I prefer follwoing.
 
 You need the 4th arguemnt, because the s3c2440 only supports pullups and
 the s3c2442 only supports pulldowns. So you want to return -EINVAL if
 somebody tries to set a pullup on a s3c2442 based board.
 Your proposed solution would return 0 and set a pulldown instead.

Well, at least it allows single-binary kernel for s3c24xx to exist. I think 
it's OK, as setting pull{up,down} bit for any non S3C_GPIO_PULL_NONE arg 
preserves semantics for all SoCs (s3c2410/s3c2440/s3c2442) by cost of not 
handling errors. Anyway, who wants to call cfgpull with S3C_GPIO_PULL_DOWN on 
s3c2410/s3c2440 or with S3C_GPIO_PULL_UP on s3c2442?
 
Regards
Vasily
--
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 v3] ARM: s3c2442: Setup gpio {set,get}_pull callbacks

2010-11-30 Thread Vasily Khoruzhick
On Tuesday 30 November 2010 15:12:37 Lars-Peter Clausen wrote:

 Hi
 
 While this might work for setting the pullup, what to you want to return in
 get_pull?

Some custom value like S3C_GPIO_PULL_ENABLED?
 
 The reason why s3c24xx_gpiocfg_default needs to have {get,set}_pull set at
 compile time is that the board init code is called before the cpu init
 code. Which is in my opinion a bit odd and should be fixed instead.

That's because cpu init code is arch_initcall. Kernel calls mdesc-
init_machine before any arch_initcall function, not sure if it can be fixed 
without massive rework of existing code.

 If it is not fixed for whatever reason we could fallback to using some sort
 of cpu_is_s3c2442() ? S3C_GPIO_PULL_UP : S3C_GPIO_PULL_DOWN

AFAIK, Ben does not like runtime CPUtype checks

Regards
Vasily
--
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 v3] ARM: s3c2442: Setup gpio {set,get}_pull callbacks

2010-11-30 Thread Vasily Khoruzhick
On Tuesday 30 November 2010 16:53:09 Lars-Peter Clausen wrote:

 Both the cpu init code and the machine init code are run at arch_initcall.

Yeah, you're right.
--
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 v4] ARM: s3c244x: Fix mess with gpio {set,get}_pull callbacks

2010-11-30 Thread Vasily Khoruzhick
On Tuesday 30 November 2010 21:59:01 Lars-Peter Clausen wrote:
 On 11/30/2010 08:46 PM, Vasily Khoruzhick wrote:
  Currently the {set,get}_pull callbacks of the s3c24xx_gpiocfg_default
  structure are initalized via s3c_gpio_{get,set}pull_1up. This results in
  a linker error when only CONFIG_CPU_S3C2442 is selected:
  
  arch/arm/plat-s3c24xx/built-in.o:(.data+0x13f4): undefined reference to
  `s3c_gpio_getpull_1up'
  arch/arm/plat-s3c24xx/built-in.o:(.data+0x13f8): undefined reference to
  `s3c_gpio_setpull_1up'
  
  The s3c2442 has pulldowns instead of pullups compared to the s3c2440.
  The method of controlling them is the same though.
  So this patch modifies the existing s3c_gpio_{get,set}pull_1up helper
  functions to take an additional parameter deciding whether the pin has a
  pullup or pulldown. The s3c_gpio_{get,set}pull_1{down,up} functions then
  wrap that functions passing either S3C_GPIO_PULL_UP or
  S3C_GPIO_PULL_DOWN.
  
  Furthermore this patch sets up the s3c24xx_gpiocfg_default.{get,set}_pull
  fields in the s3c244{0,2}_map_io function to the new pulldown helper
  functions.
  
  Based on patch from Lars-Peter Clausen l...@metafoo.de
  
  Signed-off-by: Vasily Khoruzhick anars...@gmail.com
  ---
  v2: adapt patch for 2.6.37-rc1
  v3: restore default pull callbacks, add default pull callbacks for
  s3c2442 v4: remove default pull callbacks, set them in per-soc map_io
  function instead.
  
   arch/arm/mach-s3c2440/Kconfig  |1 +
   arch/arm/mach-s3c2440/s3c2440.c|   11 -
   arch/arm/mach-s3c2440/s3c2442.c|   14 ++
   arch/arm/plat-s3c24xx/cpu.c|8 ++--
   arch/arm/plat-s3c24xx/gpiolib.c|2 -
   arch/arm/plat-s3c24xx/include/plat/s3c244x.h   |7 +++-
   arch/arm/plat-samsung/gpio-config.c|   45
    .../plat-samsung/include/plat/gpio-cfg-helpers.h  
   |   11 + 8 files changed, 80 insertions(+), 19 deletions(-)
  
  ...
  
  +static int s3c_gpio_setpull_1(struct s3c_gpio_chip *chip,
  +unsigned int off, s3c_gpio_pull_t pull,
  +s3c_gpio_pull_t updown)
  
   {
   
  void __iomem *reg = chip-base + 0x08;
  u32 pup = __raw_readl(reg);
  
  -   pup = __raw_readl(reg);
  -
  -   if (pup == S3C_GPIO_PULL_UP)
  +   if (pup == updown)
 
 This should be pull == updown, otherwise looks fine to me

You're right. Btw, can you test this patch on your s3c24xx-machine?

  pup = ~(1  off);
  
  else if (pup == S3C_GPIO_PULL_NONE)
  
  pup |= (1  off);
  
  @@ -300,17 +299,45 @@ int s3c_gpio_setpull_1up(struct s3c_gpio_chip
  *chip,
  
  return 0;
   
   }
 
 - Lars

Regards
Vasily
--
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 v4] ARM: s3c244x: Fix mess with gpio {set,get}_pull callbacks

2010-11-30 Thread Vasily Khoruzhick
On Wednesday 01 December 2010 07:28:17 Kukjin Kim wrote:
 else if (pup == S3C_GPIO_PULL_NONE)
 
 pull == S3C_GPIO_PULL_NONE?

Yep, thanks
--
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 v3] ARM: s3c2442: Setup gpio {set,get}_pull callbacks

2010-11-29 Thread Vasily Khoruzhick
On Monday 08 November 2010 22:26:23 Vasily Khoruzhick wrote:
 Currently the {set,get}_pull callbacks of the s3c24xx_gpiocfg_default
 structure are initalized via s3c_gpio_{get,set}pull_1up. This results in a
 linker error when compiling kernel for s3c2442:
 
 arch/arm/plat-s3c24xx/built-in.o:(.data+0x13f4): undefined reference to
 `s3c_gpio_getpull_1up'
 arch/arm/plat-s3c24xx/built-in.o:(.data+0x13f8): undefined reference to
 `s3c_gpio_setpull_1up'
 
 The s3c2442 has pulldowns instead of pullups compared to the s3c2440.
 The method of controlling them is the same though.
 So this patch modifies the existing s3c_gpio_{get,set}pull_1up helper
 functions to take an additional parameter deciding whether the pin has a
 pullup or pulldown. The s3c_gpio_{get,set}pull_1{down,up} functions then
 wrap that functions passing either S3C_GPIO_PULL_UP or S3C_GPIO_PULL_DOWN.
 
 Furthermore this patch sets up the s3c24xx_gpiocfg_default.{get,set}_pull
 fields in the s3c2442 cpu init function to the new pulldown helper
 functions.
 
 Based on patch from Lars-Peter Clausen l...@metafoo.de

Hi there,

Can any samsung-soc maintainer review/merge this patch?

I should admit that merging patches through samsung maintainers became pretty 
impossible - response latency is about 1 month, some patches (not mine) are 
still pending. I've sent first version of this patch on 6th of November, few 
weeks of standby - and we'll get 2.6.37 with broken s3c2442 support. Yeah, I 
know that maintainers are living people too, and they need to pay attention to 
real life, work, family, etc, but now merging some samsung-soc-related patch 
is really painfull and slow proccess, and it would be nice if it could be 
somehow improved.

Regards
Vasily
--
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 v3] ARM: s3c2442: Setup gpio {set,get}_pull callbacks

2010-11-29 Thread Vasily Khoruzhick
On Monday 29 November 2010 12:15:03 Kukjin Kim wrote:

 Hi,
 
 Actually, I didn't get your patch through my e-mail.
 Maybe you missed my e-mail in Cc at that time and I missed your patch in
 mailing list. Could you please re-send it so that can get the patch via
 e-mail?

Ok, will do in few minutes

 Now, thanks for adding me, will review...

Thanks

 I think, we have some time to fix it for 37, so don't worry about broken
 37-stable.

Ok

Regards
Vasily
--
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 RESEND v3] ARM: s3c2442: Setup gpio {set,get}_pull callbacks

2010-11-29 Thread Vasily Khoruzhick
Currently the {set,get}_pull callbacks of the s3c24xx_gpiocfg_default structure
are initalized via s3c_gpio_{get,set}pull_1up. This results in a linker
error when compiling kernel for s3c2442:

arch/arm/plat-s3c24xx/built-in.o:(.data+0x13f4): undefined reference to
`s3c_gpio_getpull_1up'
arch/arm/plat-s3c24xx/built-in.o:(.data+0x13f8): undefined reference to
`s3c_gpio_setpull_1up'

The s3c2442 has pulldowns instead of pullups compared to the s3c2440.
The method of controlling them is the same though.
So this patch modifies the existing s3c_gpio_{get,set}pull_1up helper functions
to take an additional parameter deciding whether the pin has a pullup or 
pulldown.
The s3c_gpio_{get,set}pull_1{down,up} functions then wrap that functions passing
either S3C_GPIO_PULL_UP or S3C_GPIO_PULL_DOWN.

Furthermore this patch sets up the s3c24xx_gpiocfg_default.{get,set}_pull fields
in the s3c2442 cpu init function to the new pulldown helper functions.

Based on patch from Lars-Peter Clausen l...@metafoo.de

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
v2: adapt patch for 2.6.37-rc1
v3: restore default pull callbacks, add default pull callbacks for s3c2442
 arch/arm/mach-s3c2440/Kconfig  |1 +
 arch/arm/mach-s3c2440/s3c2442.c|7 +++
 arch/arm/plat-s3c24xx/gpiolib.c|9 +++-
 arch/arm/plat-samsung/gpio-config.c|   44 ---
 .../plat-samsung/include/plat/gpio-cfg-helpers.h   |   11 +
 5 files changed, 63 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index ff024a6..478fae0 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -18,6 +18,7 @@ config CPU_S3C2440
 config CPU_S3C2442
bool
select CPU_ARM920T
+   select S3C_GPIO_PULL_DOWN
select S3C2410_CLOCK
select S3C2410_GPIO
select S3C2410_PM if PM
diff --git a/arch/arm/mach-s3c2440/s3c2442.c b/arch/arm/mach-s3c2440/s3c2442.c
index 188ad1e..0dbc91c 100644
--- a/arch/arm/mach-s3c2440/s3c2442.c
+++ b/arch/arm/mach-s3c2440/s3c2442.c
@@ -32,6 +32,7 @@
 #include linux/interrupt.h
 #include linux/ioport.h
 #include linux/mutex.h
+#include linux/gpio.h
 #include linux/clk.h
 #include linux/io.h
 
@@ -44,6 +45,10 @@
 #include plat/clock.h
 #include plat/cpu.h
 
+#include plat/gpio-core.h
+#include plat/gpio-cfg.h
+#include plat/gpio-cfg-helpers.h
+
 /* S3C2442 extended clock support */
 
 static unsigned long s3c2442_camif_upll_round(struct clk *clk,
@@ -160,6 +165,8 @@ static struct sys_device s3c2442_sysdev = {
 int __init s3c2442_init(void)
 {
printk(S3C2442: Initialising architecture\n);
+   s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1down;
+   s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1down;
 
return sysdev_register(s3c2442_sysdev);
 }
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c
index 24c6f5a..b805dab 100644
--- a/arch/arm/plat-s3c24xx/gpiolib.c
+++ b/arch/arm/plat-s3c24xx/gpiolib.c
@@ -82,8 +82,13 @@ static struct s3c_gpio_cfg s3c24xx_gpiocfg_banka = {
 struct s3c_gpio_cfg s3c24xx_gpiocfg_default = {
.set_config = s3c_gpio_setcfg_s3c24xx,
.get_config = s3c_gpio_getcfg_s3c24xx,
-   .set_pull   = s3c_gpio_setpull_1up,
-   .get_pull   = s3c_gpio_getpull_1up,
+#if defined(CONFIG_S3C_GPIO_PULL_UP)
+   .set_pull   = s3c_gpio_setpull_1up,
+   .get_pull   = s3c_gpio_getpull_1up,
+#elif defined(CONFIG_S3C_GPIO_PULL_DOWN)
+   .set_pull   = s3c_gpio_setpull_1down,
+   .get_pull   = s3c_gpio_getpull_1down,
+#endif
 };
 
 struct s3c_gpio_chip s3c24xx_gpios[] = {
diff --git a/arch/arm/plat-samsung/gpio-config.c 
b/arch/arm/plat-samsung/gpio-config.c
index b732b77..ac7f13f 100644
--- a/arch/arm/plat-samsung/gpio-config.c
+++ b/arch/arm/plat-samsung/gpio-config.c
@@ -280,16 +280,17 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct 
s3c_gpio_chip *chip,
 }
 #endif
 
-#ifdef CONFIG_S3C_GPIO_PULL_UP
-int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip,
-unsigned int off, s3c_gpio_pull_t pull)
+#if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN)
+static int s3c_gpio_setpull_1(struct s3c_gpio_chip *chip,
+unsigned int off, s3c_gpio_pull_t pull,
+s3c_gpio_pull_t updown)
 {
void __iomem *reg = chip-base + 0x08;
u32 pup = __raw_readl(reg);
 
pup = __raw_readl(reg);
 
-   if (pup == S3C_GPIO_PULL_UP)
+   if (pup == updown)
pup = ~(1  off);
else if (pup == S3C_GPIO_PULL_NONE)
pup |= (1  off);
@@ -300,17 +301,46 @@ int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip,
return 0;
 }
 
-s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip,
-unsigned int off)
+static s3c_gpio_pull_t s3c_gpio_getpull_1

Re: [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes

2010-11-16 Thread Vasily Khoruzhick
On Wednesday 17 November 2010 01:12:58 Ben Dooks wrote:

 it's a pitty we can't remove the driver totally and use the
 gpio leds.

Why? It's possible to use leds-gpio driver. Additional gpios (blink, etc) can 
be handled via platform_gpio_blink_set callback.

Regards
Vasily
--
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: Build error with s3c2410_defconfig

2010-11-08 Thread Vasily Khoruzhick
On Monday 08 November 2010 09:15:55 Kukjin Kim wrote:
 Hi Vasily,
 
 Now, happens following build error due to commit
 14477095abc661a9f195ca4733bb739c54794b32 'ARM: h1940: Use gpiolib for latch
 access' with s3c2410_defconfig.
 
 drivers/leds/leds-h1940.c: In function 'h1940_greenled_set':
 drivers/leds/leds-h1940.c:33: error: implicit declaration of function
 'h1940_latch_control'
 
 The h1940_greenled_set(), h1940_redled_set(), and h1940_blueled_set() in
 drivers/leds/leds-h1940.c call h1940_latch_control()...
 
 Need to fix it up.
 
 Thanks.

Hi, I'm aware of a problem, will fix and send patch tonight (however, 
h1940_leds driver should be marked as deprecated)
--
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 v2] ARM: s3c2442: Setup gpio {set,get}_pull callbacks

2010-11-08 Thread Vasily Khoruzhick
On Saturday 06 November 2010 18:09:37 Abdoulaye Walsimou GAYE wrote:

Restored CC list, please don't clean it next time.

  -   .set_pull   = s3c_gpio_setpull_1up,
  -   .get_pull   = s3c_gpio_getpull_1up,
  
};
 
 This part of your patch will prevent s3c2440 based boards to boot see [1]

Well, your patch breaks compilation for s3c2442 at all (see comment from my 
patch)

Ben, why machine-specific init is called before cpu init?

Regards
Vasily
--
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: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes

2010-11-08 Thread Vasily Khoruzhick
Replace in s3c_gpio_cfgpull with s3c_gpio_setpull.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/h1940-bluetooth.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c 
b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 8aa2f19..6b86a72 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -77,13 +77,13 @@ static int __devinit h1940bt_probe(struct platform_device 
*pdev)
 
/* Configures BT serial port GPIOs */
s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
-   s3c_gpio_cfgpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT);
-   s3c_gpio_cfgpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0);
-   s3c_gpio_cfgpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
-   s3c_gpio_cfgpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
 
 
rfk = rfkill_alloc(DRV_NAME, pdev-dev, RFKILL_TYPE_BLUETOOTH,
-- 
1.7.3.2

--
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] ARM: s3c2442: Setup gpio {set,get}_pull callbacks

2010-11-06 Thread Vasily Khoruzhick
Currently the {set,get}_pull callbacks of the s3c24xx_gpiocfg_default structure
are initalized via s3c_gpio_{get,set}pull_1up. This results in a linker
error:

arch/arm/plat-s3c24xx/built-in.o:(.data+0x13f4): undefined reference to
`s3c_gpio_getpull_1up'
arch/arm/plat-s3c24xx/built-in.o:(.data+0x13f8): undefined reference to
`s3c_gpio_setpull_1up'

The s3c2442 has pulldowns instead of pullups compared to the s3c2440.
The method of controlling them is the same though.
So this patch modifies the existing s3c_gpio_{get,set}pull_1up helper functions
to take an additional parameter deciding whether the pin has a pullup or 
pulldown.
The s3c_gpio_{get,set}pull_1{down,up} functions then wrap that functions passing
either S3C_GPIO_PULL_UP or S3C_GPIO_PULL_DOWN.

Furthermore this patch sets up the s3c24xx_gpiocfg_default.{get,set}_pull fields
in the s3c2442 cpu init function to the new pulldown helper functions.

Based on patch from Lars-Peter Clausen l...@metafoo.de

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
v2: adapted patch for 2.6.37-rc1

 arch/arm/mach-s3c2440/Kconfig  |1 +
 arch/arm/mach-s3c2440/s3c2442.c|7 +++
 arch/arm/plat-s3c24xx/gpiolib.c|2 -
 arch/arm/plat-samsung/gpio-config.c|   44 ---
 .../plat-samsung/include/plat/gpio-cfg-helpers.h   |   11 +
 5 files changed, 56 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index ff024a6..478fae0 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -18,6 +18,7 @@ config CPU_S3C2440
 config CPU_S3C2442
bool
select CPU_ARM920T
+   select S3C_GPIO_PULL_DOWN
select S3C2410_CLOCK
select S3C2410_GPIO
select S3C2410_PM if PM
diff --git a/arch/arm/mach-s3c2440/s3c2442.c b/arch/arm/mach-s3c2440/s3c2442.c
index 188ad1e..0dbc91c 100644
--- a/arch/arm/mach-s3c2440/s3c2442.c
+++ b/arch/arm/mach-s3c2440/s3c2442.c
@@ -32,6 +32,7 @@
 #include linux/interrupt.h
 #include linux/ioport.h
 #include linux/mutex.h
+#include linux/gpio.h
 #include linux/clk.h
 #include linux/io.h
 
@@ -44,6 +45,10 @@
 #include plat/clock.h
 #include plat/cpu.h
 
+#include plat/gpio-core.h
+#include plat/gpio-cfg.h
+#include plat/gpio-cfg-helpers.h
+
 /* S3C2442 extended clock support */
 
 static unsigned long s3c2442_camif_upll_round(struct clk *clk,
@@ -160,6 +165,8 @@ static struct sys_device s3c2442_sysdev = {
 int __init s3c2442_init(void)
 {
printk(S3C2442: Initialising architecture\n);
+   s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1down;
+   s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1down;
 
return sysdev_register(s3c2442_sysdev);
 }
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c
index 24c6f5a..243b641 100644
--- a/arch/arm/plat-s3c24xx/gpiolib.c
+++ b/arch/arm/plat-s3c24xx/gpiolib.c
@@ -82,8 +82,6 @@ static struct s3c_gpio_cfg s3c24xx_gpiocfg_banka = {
 struct s3c_gpio_cfg s3c24xx_gpiocfg_default = {
.set_config = s3c_gpio_setcfg_s3c24xx,
.get_config = s3c_gpio_getcfg_s3c24xx,
-   .set_pull   = s3c_gpio_setpull_1up,
-   .get_pull   = s3c_gpio_getpull_1up,
 };
 
 struct s3c_gpio_chip s3c24xx_gpios[] = {
diff --git a/arch/arm/plat-samsung/gpio-config.c 
b/arch/arm/plat-samsung/gpio-config.c
index b732b77..ac7f13f 100644
--- a/arch/arm/plat-samsung/gpio-config.c
+++ b/arch/arm/plat-samsung/gpio-config.c
@@ -280,16 +280,17 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct 
s3c_gpio_chip *chip,
 }
 #endif
 
-#ifdef CONFIG_S3C_GPIO_PULL_UP
-int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip,
-unsigned int off, s3c_gpio_pull_t pull)
+#if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN)
+static int s3c_gpio_setpull_1(struct s3c_gpio_chip *chip,
+unsigned int off, s3c_gpio_pull_t pull,
+s3c_gpio_pull_t updown)
 {
void __iomem *reg = chip-base + 0x08;
u32 pup = __raw_readl(reg);
 
pup = __raw_readl(reg);
 
-   if (pup == S3C_GPIO_PULL_UP)
+   if (pup == updown)
pup = ~(1  off);
else if (pup == S3C_GPIO_PULL_NONE)
pup |= (1  off);
@@ -300,17 +301,46 @@ int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip,
return 0;
 }
 
-s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip,
-unsigned int off)
+static s3c_gpio_pull_t s3c_gpio_getpull_1(struct s3c_gpio_chip *chip,
+unsigned int off, s3c_gpio_pull_t updown)
 {
void __iomem *reg = chip-base + 0x08;
u32 pup = __raw_readl(reg);
 
pup = (1  off);
-   return pup ? S3C_GPIO_PULL_NONE : S3C_GPIO_PULL_UP;
+   return pup ? S3C_GPIO_PULL_NONE : updown;
+}
+#endif /* CONFIG_S3C_GPIO_PULL_UP || CONFIG_S3C_GPIO_PULL_DOWN

Re: [patch 1/1] i2c-s3c2410: Enable i2c clock only when doing some transfert

2010-10-01 Thread Vasily Khoruzhick
On 27 of August 2010 22:33:00 Vasily Khoruzhick wrote:

 This patch has problem with suspend/resume, clock needs to be enabled on
 i2c re-init. Here's fixed version of patch in attachment.

Ping
--
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 v3 5/5] h1940: add UDA1380 to i2c devices list

2010-10-01 Thread Vasily Khoruzhick
On 27 of September 2010 09:32:49 Vasily Khoruzhick wrote:
 Register UDA1380 codec during H1940 machine init
 
 Signed-off-by: Vasily Khoruzhick anars...@gmail.com

Ping


signature.asc
Description: This is a digitally signed message part.


[PATCH v3 5/5] h1940: add UDA1380 to i2c devices list

2010-09-27 Thread Vasily Khoruzhick
Register UDA1380 codec during H1940 machine init

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
v2: Add UDA1380 reset pin
v3: Add verbose comment to patch

 arch/arm/mach-s3c2410/mach-h1940.c |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2410/mach-h1940.c 
b/arch/arm/mach-s3c2410/mach-h1940.c
index 974c6e4..a5cd324 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -24,6 +24,7 @@
 #include linux/io.h
 #include linux/gpio.h
 #include linux/pwm_backlight.h
+#include linux/i2c.h
 #include video/platform_lcd.h
 
 #include linux/mmc/host.h
@@ -59,6 +60,8 @@
 #include plat/mci.h
 #include plat/ts.h
 
+#include sound/uda1380.h
+
 #define H1940_LATCH((void __force __iomem *)0xF800)
 
 #define H1940_PA_LATCH S3C2410_CS2
@@ -365,12 +368,26 @@ static struct platform_device h1940_lcd_powerdev = {
.dev.platform_data  = h1940_lcd_power_data,
 };
 
+static struct uda1380_platform_data uda1380_info = {
+   .gpio_power = H1940_LATCH_UDA_POWER,
+   .gpio_reset = S3C2410_GPA(12),
+   .dac_clk= UDA1380_DAC_CLK_SYSCLK,
+};
+
+static struct i2c_board_info h1940_i2c_devices[] = {
+   {
+   I2C_BOARD_INFO(uda1380, 0x1a),
+   .platform_data = uda1380_info,
+   },
+};
+
 static struct platform_device *h1940_devices[] __initdata = {
s3c_device_ohci,
s3c_device_lcd,
s3c_device_wdt,
s3c_device_i2c0,
s3c_device_iis,
+   s3c_device_pcm,
s3c_device_usbgadget,
h1940_device_leds,
h1940_device_bluetooth,
@@ -465,6 +482,9 @@ static void __init h1940_init(void)
gpio_direction_output(H1940_LATCH_SD_POWER, 0);
 
platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
+
+   i2c_register_board_info(0, h1940_i2c_devices,
+   ARRAY_SIZE(h1940_i2c_devices));
 }
 
 MACHINE_START(H1940, IPAQ-H1940)
-- 
1.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


[PATCH v2 3/5] h1940: implement mmc_power function

2010-09-26 Thread Vasily Khoruzhick
This patch implements h1940-specific set_power callback for
s3cmci driver, so card power can be disabled when card is not inserted
or before suspend. Without this patch PDA consumes power in suspend when
card is inserted.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
v2: Add description to patch

 arch/arm/mach-s3c2410/include/mach/h1940-latch.h |2 +-
 arch/arm/mach-s3c2410/mach-h1940.c   |   23 +++--
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h 
b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index 73586f2..ef7d8cf 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -35,7 +35,7 @@
 #define H1940_LATCH_AUDIO_POWERH1940_LATCH_GPIO(9)
 #define H1940_LATCH_SM803_ENABLE   H1940_LATCH_GPIO(10)
 #define H1940_LATCH_LCD_P4 H1940_LATCH_GPIO(11)
-#define H1940_LATCH_CPUQ5  H1940_LATCH_GPIO(12)
+#define H1940_LATCH_SD_POWER   H1940_LATCH_GPIO(12)
 #define H1940_LATCH_BLUETOOTH_POWERH1940_LATCH_GPIO(13)
 #define H1940_LATCH_LED_GREEN  H1940_LATCH_GPIO(14)
 #define H1940_LATCH_LED_FLASH  H1940_LATCH_GPIO(15)
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c 
b/arch/arm/mach-s3c2410/mach-h1940.c
index f0493bd..cc8660e 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -112,8 +112,7 @@ static unsigned int latch_state = 
H1940_LATCH_BIT(H1940_LATCH_LCD_P4) |
H1940_LATCH_BIT(H1940_LATCH_LCD_P1) |
H1940_LATCH_BIT(H1940_LATCH_LCD_P2) |
H1940_LATCH_BIT(H1940_LATCH_LCD_P3) |
-   H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN)   |
-   H1940_LATCH_BIT(H1940_LATCH_CPUQ5);
+   H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN);
 
 static void h1940_latch_control(unsigned int clear, unsigned int set)
 {
@@ -247,10 +246,25 @@ static struct platform_device h1940_device_bluetooth = {
.id   = -1,
 };
 
+static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)
+{
+   switch (power_mode) {
+   case MMC_POWER_OFF:
+   gpio_set_value(H1940_LATCH_SD_POWER, 0);
+   break;
+   case MMC_POWER_UP:
+   case MMC_POWER_ON:
+   gpio_set_value(H1940_LATCH_SD_POWER, 1);
+   break;
+   default:
+   break;
+   };
+}
+
 static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
.gpio_detect   = S3C2410_GPF(5),
.gpio_wprotect = S3C2410_GPH(8),
-   .set_power = NULL,
+   .set_power = h1940_set_mmc_power,
.ocr_avail = MMC_VDD_32_33,
 };
 
@@ -397,6 +411,9 @@ static void __init h1940_init(void)
gpio_request(H1940_LATCH_USB_DP, USB pullup);
gpio_direction_output(H1940_LATCH_USB_DP, 0);
 
+   gpio_request(H1940_LATCH_SD_POWER, SD power);
+   gpio_direction_output(H1940_LATCH_SD_POWER, 0);
+
platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 }
 
-- 
1.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


[PATCH v2 4/5] h1940: Fix backlight and LCD power functions

2010-09-11 Thread Vasily Khoruzhick
v2: init gpio mode/value right after gpio_request

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/include/mach/h1940-latch.h |2 +-
 arch/arm/mach-s3c2410/mach-h1940.c   |   80 ++
 2 files changed, 66 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h 
b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index ef7d8cf..97e42bf 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -20,7 +20,7 @@
 
 /* SD layer latch */
 
-#define H1940_LATCH_SDQ1   H1940_LATCH_GPIO(0)
+#define H1940_LATCH_LCD_P0 H1940_LATCH_GPIO(0)
 #define H1940_LATCH_LCD_P1 H1940_LATCH_GPIO(1)
 #define H1940_LATCH_LCD_P2 H1940_LATCH_GPIO(2)
 #define H1940_LATCH_LCD_P3 H1940_LATCH_GPIO(3)
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c 
b/arch/arm/mach-s3c2410/mach-h1940.c
index cc8660e..974c6e4 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -106,13 +106,7 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata 
= {
 
 /* Board control latch control */
 
-static unsigned int latch_state = H1940_LATCH_BIT(H1940_LATCH_LCD_P4) |
-   H1940_LATCH_BIT(H1940_LATCH_SM803_ENABLE)   |
-   H1940_LATCH_BIT(H1940_LATCH_SDQ1)   |
-   H1940_LATCH_BIT(H1940_LATCH_LCD_P1) |
-   H1940_LATCH_BIT(H1940_LATCH_LCD_P2) |
-   H1940_LATCH_BIT(H1940_LATCH_LCD_P3) |
-   H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN);
+static unsigned int latch_state;
 
 static void h1940_latch_control(unsigned int clear, unsigned int set)
 {
@@ -275,15 +269,32 @@ static int h1940_backlight_init(struct device *dev)
gpio_direction_output(S3C2410_GPB(0), 0);
s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+   gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
 
return 0;
 }
 
+static int h1940_backlight_notify(struct device *dev, int brightness)
+{
+   if (!brightness) {
+   gpio_direction_output(S3C2410_GPB(0), 1);
+   gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
+   } else {
+   gpio_direction_output(S3C2410_GPB(0), 0);
+   s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
+   s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+   gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
+   }
+   return brightness;
+}
+
 static void h1940_backlight_exit(struct device *dev)
 {
gpio_direction_output(S3C2410_GPB(0), 1);
+   gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
 }
 
+
 static struct platform_pwm_backlight_data backlight_data = {
.pwm_id = 0,
.max_brightness = 100,
@@ -291,6 +302,7 @@ static struct platform_pwm_backlight_data backlight_data = {
/* tcnt = 0x31 */
.pwm_period_ns  = 36296,
.init   = h1940_backlight_init,
+   .notify = h1940_backlight_notify,
.exit   = h1940_backlight_exit,
 };
 
@@ -309,19 +321,37 @@ static void h1940_lcd_power_set(struct plat_lcd_data *pd,
int value;
 
if (!power) {
-   /* set to 3ec */
-   gpio_direction_output(S3C2410_GPC(0), 0);
+   gpio_set_value(S3C2410_GPC(0), 0);
/* wait for 3ac */
do {
value = gpio_get_value(S3C2410_GPC(6));
} while (value);
-   /* set to 38c */
-   gpio_direction_output(S3C2410_GPC(5), 0);
+
+   gpio_set_value(H1940_LATCH_LCD_P2, 0);
+   gpio_set_value(H1940_LATCH_LCD_P3, 0);
+   gpio_set_value(H1940_LATCH_LCD_P4, 0);
+
+   gpio_direction_output(S3C2410_GPC(1), 0);
+   gpio_direction_output(S3C2410_GPC(4), 0);
+
+   gpio_set_value(H1940_LATCH_LCD_P1, 0);
+   gpio_set_value(H1940_LATCH_LCD_P0, 0);
+
+   gpio_set_value(S3C2410_GPC(5), 0);
+
} else {
-   /* Set to 3ac */
-   gpio_direction_output(S3C2410_GPC(5), 1);
-   /* Set to 3ad */
-   gpio_direction_output(S3C2410_GPC(0), 1);
+   gpio_set_value(H1940_LATCH_LCD_P0, 1);
+   gpio_set_value(H1940_LATCH_LCD_P1, 1);
+
+   s3c_gpio_cfgpin(S3C2410_GPC(1), S3C_GPIO_SFN(2));
+   s3c_gpio_cfgpin(S3C2410_GPC(4), S3C_GPIO_SFN(2));
+
+   gpio_set_value(S3C2410_GPC(5), 1);
+   gpio_set_value(S3C2410_GPC(0), 1);
+
+   gpio_set_value(H1940_LATCH_LCD_P3, 1);
+   gpio_set_value(H1940_LATCH_LCD_P2, 1);
+   gpio_set_value(H1940_LATCH_LCD_P4, 1);
}
 }
 
@@ -366,6 +396,8 @@ static void __init h1940_map_io(void)
 #endif

[PATCH v2 1/3] rx1950: add battery device

2010-09-08 Thread Vasily Khoruzhick
v2: don't force usage of battery driver,
use named initialisers in LUTs.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2440/mach-rx1950.c |  316 +++
 1 files changed, 316 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c 
b/arch/arm/mach-s3c2440/mach-rx1950.c
index 142d1f9..2bfa43a 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -25,8 +25,10 @@
 #include linux/input.h
 #include linux/gpio_keys.h
 #include linux/sysdev.h
+#include linux/pda_power.h
 #include linux/pwm_backlight.h
 #include linux/pwm.h
+#include linux/s3c_adc_battery.h
 
 #include linux/mtd/mtd.h
 #include linux/mtd/partitions.h
@@ -127,6 +129,318 @@ static struct s3c2410fb_display rx1950_display = {
 
 };
 
+static int power_supply_init(struct device *dev)
+{
+   return gpio_request(S3C2410_GPF(2), cable plugged);
+}
+
+static int rx1950_is_ac_online(void)
+{
+   return !gpio_get_value(S3C2410_GPF(2));
+}
+
+static void power_supply_exit(struct device *dev)
+{
+   gpio_free(S3C2410_GPF(2));
+}
+
+static char *rx1950_supplicants[] = {
+   main-battery
+};
+
+static struct pda_power_pdata power_supply_info = {
+   .init   = power_supply_init,
+   .is_ac_online   = rx1950_is_ac_online,
+   .exit   = power_supply_exit,
+   .supplied_to= rx1950_supplicants,
+   .num_supplicants= ARRAY_SIZE(rx1950_supplicants),
+};
+
+static struct resource power_supply_resources[] = {
+   [0] = {
+   .name   = ac,
+   .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE |
+ IORESOURCE_IRQ_HIGHEDGE,
+   .start  = IRQ_EINT2,
+   .end= IRQ_EINT2,
+   },
+};
+
+static struct platform_device power_supply = {
+   .name   = pda-power,
+   .id = -1,
+   .dev= {
+   .platform_data =
+   power_supply_info,
+   },
+   .resource   = power_supply_resources,
+   .num_resources  = ARRAY_SIZE(power_supply_resources),
+};
+
+static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
+   {
+   .volt = 4100,
+   .cur = 156,
+   .level = 100
+   },
+   {
+   .volt = 4050,
+   .cur = 156,
+   .level = 95
+   },
+   {
+   .volt = 4025,
+   .cur = 141,
+   .level = 90
+   },
+   {
+   .volt = 3995,
+   .cur = 144,
+   .level = 85
+   },
+   {
+   .volt = 3957,
+   .cur = 162,
+   .level = 80
+   },
+   {
+   .volt = 3931,
+   .cur = 147,
+   .level = 75
+   },
+   {
+   .volt = 3902,
+   .cur = 147,
+   .level = 70
+   },
+   {
+   .volt = 3863,
+   .cur = 153,
+   .level = 65
+   },
+   {
+   .volt = 3838,
+   .cur = 150,
+   .level = 60
+   },
+   {
+   .volt = 3800,
+   .cur = 153,
+   .level = 55
+   },
+   {
+   .volt = 3765,
+   .cur = 153,
+   .level = 50
+   },
+   {
+   .volt = 3748,
+   .cur = 172,
+   .level = 45
+   },
+   {
+   .volt = 3740,
+   .cur = 153,
+   .level = 40
+   },
+   {
+   .volt = 3714,
+   .cur = 175,
+   .level = 35
+   },
+   {
+   .volt = 3710,
+   .cur = 156,
+   .level = 30
+   },
+   {
+   .volt = 3963,
+   .cur = 156,
+   .level = 25
+   },
+   {
+   .volt = 3672,
+   .cur = 178,
+   .level = 20
+   },
+   {
+   .volt = 3651,
+   .cur = 178,
+   .level = 15
+   },
+   {
+   .volt = 3629,
+   .cur = 178,
+   .level = 10
+   },
+   {
+   .volt = 3612,
+   .cur = 162,
+   .level = 5
+   },
+   {
+   .volt = 3605,
+   .cur = 162,
+   .level = 0
+   },
+};
+
+static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
+   {
+   .volt = 4200,
+   .cur = 0,
+   .level = 100
+   },
+   {
+   .volt = 4190,
+   .cur = 0,
+   .level = 99
+   },
+   {
+   .volt = 4178,
+   .cur = 0,
+   .level = 95

[PATCH v2 1/5] h1940: use gpiolib for latch access

2010-09-08 Thread Vasily Khoruzhick
This patch adds gpiolib support for h1940 latch.
With this patch it's possible to use leds-gpio and uda1380
drivers (they require gpiolib support for appropriate pins).
And now it's possible to drop leds-h1940 driver.

v2: removed unnecessary direction_input callback,
minor formatting cleanup

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/h1940-bluetooth.c  |   13 -
 arch/arm/mach-s3c2410/include/mach/h1940-latch.h |   57 ++-
 arch/arm/mach-s3c2410/mach-h1940.c   |   64 --
 arch/arm/plat-s3c24xx/Kconfig|1 +
 4 files changed, 87 insertions(+), 48 deletions(-)

diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c 
b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 8cdeb14..8aa2f19 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -30,7 +30,7 @@ static void h1940bt_enable(int on)
 {
if (on) {
/* Power on the chip */
-   h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER);
+   gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 1);
/* Reset the chip */
mdelay(10);
 
@@ -43,7 +43,7 @@ static void h1940bt_enable(int on)
mdelay(10);
gpio_set_value(S3C2410_GPH(1), 0);
mdelay(10);
-   h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0);
+   gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0);
}
 }
 
@@ -64,7 +64,14 @@ static int __devinit h1940bt_probe(struct platform_device 
*pdev)
 
ret = gpio_request(S3C2410_GPH(1), dev_name(pdev-dev));
if (ret) {
-   dev_err(pdev-dev, could not get GPH1\n);\
+   dev_err(pdev-dev, could not get GPH1\n);
+   return ret;
+   }
+
+   ret = gpio_request(H1940_LATCH_BLUETOOTH_POWER, dev_name(pdev-dev));
+   if (ret) {
+   gpio_free(S3C2410_GPH(1));
+   dev_err(pdev-dev, could not get BT_POWER\n);
return ret;
}
 
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h 
b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index d8a8327..73586f2 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -14,51 +14,30 @@
 #ifndef __ASM_ARCH_H1940_LATCH_H
 #define __ASM_ARCH_H1940_LATCH_H
 
+#include mach/gpio.h
 
-#ifndef __ASSEMBLY__
-#define H1940_LATCH((void __force __iomem *)0xF800)
-#else
-#define H1940_LATCH0xF800
-#endif
-
-#define H1940_PA_LATCH (S3C2410_CS2)
+#define H1940_LATCH_GPIO(x)(S3C_GPIO_END + (x))
 
 /* SD layer latch */
 
-#define H1940_LATCH_SDQ1   (116)
-#define H1940_LATCH_LCD_P1 (117)
-#define H1940_LATCH_LCD_P2 (118)
-#define H1940_LATCH_LCD_P3 (119)
-#define H1940_LATCH_MAX1698_nSHUTDOWN  (120) /* LCD backlight */
-#define H1940_LATCH_LED_RED(121)
-#define H1940_LATCH_SDQ7   (122)
-#define H1940_LATCH_USB_DP (123)
+#define H1940_LATCH_SDQ1   H1940_LATCH_GPIO(0)
+#define H1940_LATCH_LCD_P1 H1940_LATCH_GPIO(1)
+#define H1940_LATCH_LCD_P2 H1940_LATCH_GPIO(2)
+#define H1940_LATCH_LCD_P3 H1940_LATCH_GPIO(3)
+#define H1940_LATCH_MAX1698_nSHUTDOWN  H1940_LATCH_GPIO(4)
+#define H1940_LATCH_LED_REDH1940_LATCH_GPIO(5)
+#define H1940_LATCH_SDQ7   H1940_LATCH_GPIO(6)
+#define H1940_LATCH_USB_DP H1940_LATCH_GPIO(7)
 
 /* CPU layer latch */
 
-#define H1940_LATCH_UDA_POWER  (124)
-#define H1940_LATCH_AUDIO_POWER(125)
-#define H1940_LATCH_SM803_ENABLE   (126)
-#define H1940_LATCH_LCD_P4 (127)
-#define H1940_LATCH_CPUQ5  (128) /* untraced */
-#define H1940_LATCH_BLUETOOTH_POWER(129) /* active high */
-#define H1940_LATCH_LED_GREEN  (130)
-#define H1940_LATCH_LED_FLASH  (131)
-
-/* default settings */
-
-#define H1940_LATCH_DEFAULT\
-   H1940_LATCH_LCD_P4  | \
-   H1940_LATCH_SM803_ENABLE| \
-   H1940_LATCH_SDQ1| \
-   H1940_LATCH_LCD_P1  | \
-   H1940_LATCH_LCD_P2  | \
-   H1940_LATCH_LCD_P3  | \
-   H1940_LATCH_MAX1698_nSHUTDOWN   | \
-   H1940_LATCH_CPUQ5
-
-/* control functions */
-
-extern void h1940_latch_control(unsigned int clear, unsigned int set);
+#define H1940_LATCH_UDA_POWER  H1940_LATCH_GPIO(8)
+#define H1940_LATCH_AUDIO_POWERH1940_LATCH_GPIO(9)
+#define H1940_LATCH_SM803_ENABLE   H1940_LATCH_GPIO(10)
+#define H1940_LATCH_LCD_P4 H1940_LATCH_GPIO(11)
+#define H1940_LATCH_CPUQ5  H1940_LATCH_GPIO(12)
+#define H1940_LATCH_BLUETOOTH_POWERH1940_LATCH_GPIO(13)
+#define H1940_LATCH_LED_GREEN

[PATCH 3/3] rx1950: add UDA1380 to i2c devices list

2010-09-07 Thread Vasily Khoruzhick
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2440/mach-rx1950.c |   25 +++--
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c 
b/arch/arm/mach-s3c2440/mach-rx1950.c
index 3328c86..d971aa9 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -30,6 +30,7 @@
 #include linux/pwm.h
 #include linux/s3c_adc_battery.h
 #include linux/leds.h
+#include linux/i2c.h
 
 #include linux/mtd/mtd.h
 #include linux/mtd/partitions.h
@@ -58,6 +59,8 @@
 #include plat/irq.h
 #include plat/ts.h
 
+#include sound/uda1380.h
+
 #define LCD_PWM_PERIOD 192960
 #define LCD_PWM_DUTY 127353
 
@@ -671,11 +674,17 @@ static struct platform_device rx1950_device_gpiokeys = {
.dev.platform_data = rx1950_gpio_keys_data,
 };
 
-static struct s3c2410_platform_i2c rx1950_i2c_data = {
-   .flags = 0,
-   .slave_addr = 0x42,
-   .frequency = 400 * 1000,
-   .sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON,
+static struct uda1380_platform_data uda1380_info = {
+   .gpio_power = S3C2410_GPJ(0),
+   .gpio_reset = S3C2410_GPD(0),
+   .dac_clk= UDA1380_DAC_CLK_SYSCLK,
+};
+
+static struct i2c_board_info rx1950_i2c_devices[] = {
+   {
+   I2C_BOARD_INFO(uda1380, 0x1a),
+   .platform_data = uda1380_info,
+   },
 };
 
 static struct platform_device *rx1950_devices[] __initdata = {
@@ -683,6 +692,7 @@ static struct platform_device *rx1950_devices[] __initdata 
= {
s3c_device_wdt,
s3c_device_i2c0,
s3c_device_iis,
+   s3c_device_pcm,
s3c_device_usbgadget,
s3c_device_rtc,
s3c_device_nand,
@@ -731,7 +741,7 @@ static void __init rx1950_init_machine(void)
s3c24xx_udc_set_platdata(rx1950_udc_cfg);
s3c24xx_ts_set_platdata(rx1950_ts_cfg);
s3c24xx_mci_set_platdata(rx1950_mmc_cfg);
-   s3c_i2c0_set_platdata(rx1950_i2c_data);
+   s3c_i2c0_set_platdata(NULL);
s3c_nand_set_platdata(rx1950_nand_info);
 
/* Turn off suspend on both USB ports, and switch the
@@ -762,6 +772,9 @@ static void __init rx1950_init_machine(void)
WARN_ON(gpio_request(S3C2410_GPB(1), LCD power));
 
platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
+
+   i2c_register_board_info(0, rx1950_i2c_devices,
+   ARRAY_SIZE(rx1950_i2c_devices));
 }
 
 /* H1940 and RX3715 need to reserve this for suspend */
-- 
1.7.2.2

--
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/3] rx1950: add LEDs support

2010-09-07 Thread Vasily Khoruzhick
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2440/mach-rx1950.c |   33 +
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c 
b/arch/arm/mach-s3c2440/mach-rx1950.c
index 1197ab4..3328c86 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -29,6 +29,7 @@
 #include linux/pwm_backlight.h
 #include linux/pwm.h
 #include linux/s3c_adc_battery.h
+#include linux/leds.h
 
 #include linux/mtd/mtd.h
 #include linux/mtd/partitions.h
@@ -259,6 +260,37 @@ void rx1950_disable_charger(void)
gpio_direction_output(S3C2410_GPJ(3), 0);
 }
 
+static struct gpio_led rx1950_leds_desc[] = {
+   {
+   .name   = Green,
+   .default_trigger= main-battery-charging-or-full,
+   .gpio   = S3C2410_GPA(6),
+   },
+   {
+   .name   = Red,
+   .default_trigger= main-battery-full,
+   .gpio   = S3C2410_GPA(7),
+   },
+   {
+   .name   = Blue,
+   .default_trigger= rx1950-acx-mem,
+   .gpio   = S3C2410_GPA(11),
+   },
+};
+
+static struct gpio_led_platform_data rx1950_leds_pdata = {
+   .num_leds   = ARRAY_SIZE(rx1950_leds_desc),
+   .leds   = rx1950_leds_desc,
+};
+
+static struct platform_device rx1950_leds = {
+   .name   = leds-gpio,
+   .id = -1,
+   .dev= {
+   .platform_data = rx1950_leds_pdata,
+   },
+};
+
 static struct s3c_adc_bat_pdata rx1950_bat_cfg = {
.init = rx1950_bat_init,
.exit = rx1950_bat_exit,
@@ -663,6 +695,7 @@ static struct platform_device *rx1950_devices[] __initdata 
= {
rx1950_device_gpiokeys,
power_supply,
rx1950_battery,
+   rx1950_leds,
 };
 
 static struct clk *rx1950_clocks[] __initdata = {
-- 
1.7.2.2

--
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] h1940: fix h1940-bluetooth compilation

2010-09-07 Thread Vasily Khoruzhick
h1940-bluetooth.c doesn't compile after s3c gpio API changes,
this patch fixes issue.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/h1940-bluetooth.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c 
b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 8aa2f19..6b86a72 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -77,13 +77,13 @@ static int __devinit h1940bt_probe(struct platform_device 
*pdev)
 
/* Configures BT serial port GPIOs */
s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
-   s3c_gpio_cfgpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT);
-   s3c_gpio_cfgpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0);
-   s3c_gpio_cfgpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
-   s3c_gpio_cfgpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
 
 
rfk = rfkill_alloc(DRV_NAME, pdev-dev, RFKILL_TYPE_BLUETOOTH,
-- 
1.7.2.2

--
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/5] h1940: Fix backlight and LCD power functions

2010-09-07 Thread Vasily Khoruzhick
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/include/mach/h1940-latch.h |2 +-
 arch/arm/mach-s3c2410/mach-h1940.c   |   68 ++
 2 files changed, 58 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h 
b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index ef7d8cf..97e42bf 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -20,7 +20,7 @@
 
 /* SD layer latch */
 
-#define H1940_LATCH_SDQ1   H1940_LATCH_GPIO(0)
+#define H1940_LATCH_LCD_P0 H1940_LATCH_GPIO(0)
 #define H1940_LATCH_LCD_P1 H1940_LATCH_GPIO(1)
 #define H1940_LATCH_LCD_P2 H1940_LATCH_GPIO(2)
 #define H1940_LATCH_LCD_P3 H1940_LATCH_GPIO(3)
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c 
b/arch/arm/mach-s3c2410/mach-h1940.c
index 1741aa2..d235e0a 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -106,13 +106,7 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata 
= {
 
 /* Board control latch control */
 
-static unsigned int latch_state = H1940_LATCH_BIT(H1940_LATCH_LCD_P4) |
-   H1940_LATCH_BIT(H1940_LATCH_SM803_ENABLE)   |
-   H1940_LATCH_BIT(H1940_LATCH_SDQ1)   |
-   H1940_LATCH_BIT(H1940_LATCH_LCD_P1) |
-   H1940_LATCH_BIT(H1940_LATCH_LCD_P2) |
-   H1940_LATCH_BIT(H1940_LATCH_LCD_P3) |
-   H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN);
+static unsigned int latch_state = H1940_LATCH_BIT(H1940_LATCH_SM803_ENABLE);
 
 static void h1940_latch_control(unsigned int clear, unsigned int set)
 {
@@ -283,15 +277,32 @@ static int h1940_backlight_init(struct device *dev)
gpio_direction_output(S3C2410_GPB(0), 0);
s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+   gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
 
return 0;
 }
 
+static int h1940_backlight_notify(struct device *dev, int brightness)
+{
+   if (!brightness) {
+   gpio_direction_output(S3C2410_GPB(0), 1);
+   gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
+   } else {
+   gpio_direction_output(S3C2410_GPB(0), 0);
+   s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
+   s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+   gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
+   }
+   return brightness;
+}
+
 static void h1940_backlight_exit(struct device *dev)
 {
gpio_direction_output(S3C2410_GPB(0), 1);
+   gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
 }
 
+
 static struct platform_pwm_backlight_data backlight_data = {
.pwm_id = 0,
.max_brightness = 100,
@@ -299,6 +310,7 @@ static struct platform_pwm_backlight_data backlight_data = {
/* tcnt = 0x31 */
.pwm_period_ns  = 36296,
.init   = h1940_backlight_init,
+   .notify = h1940_backlight_notify,
.exit   = h1940_backlight_exit,
 };
 
@@ -317,19 +329,37 @@ static void h1940_lcd_power_set(struct plat_lcd_data *pd,
int value;
 
if (!power) {
-   /* set to 3ec */
gpio_direction_output(S3C2410_GPC(0), 0);
/* wait for 3ac */
do {
value = gpio_get_value(S3C2410_GPC(6));
} while (value);
-   /* set to 38c */
+
+   gpio_set_value(H1940_LATCH_LCD_P2, 0);
+   gpio_set_value(H1940_LATCH_LCD_P3, 0);
+   gpio_set_value(H1940_LATCH_LCD_P4, 0);
+
+   gpio_direction_output(S3C2410_GPC(1), 0);
+   gpio_direction_output(S3C2410_GPC(4), 0);
+
+   gpio_set_value(H1940_LATCH_LCD_P1, 0);
+   gpio_set_value(H1940_LATCH_LCD_P0, 0);
+
gpio_direction_output(S3C2410_GPC(5), 0);
+
} else {
-   /* Set to 3ac */
+   gpio_set_value(H1940_LATCH_LCD_P0, 1);
+   gpio_set_value(H1940_LATCH_LCD_P1, 1);
+
+   s3c_gpio_cfgpin(S3C2410_GPC(1), S3C_GPIO_SFN(2));
+   s3c_gpio_cfgpin(S3C2410_GPC(4), S3C_GPIO_SFN(2));
+
gpio_direction_output(S3C2410_GPC(5), 1);
-   /* Set to 3ad */
gpio_direction_output(S3C2410_GPC(0), 1);
+
+   gpio_set_value(H1940_LATCH_LCD_P3, 1);
+   gpio_set_value(H1940_LATCH_LCD_P2, 1);
+   gpio_set_value(H1940_LATCH_LCD_P4, 1);
}
 }
 
@@ -374,6 +404,8 @@ static void __init h1940_map_io(void)
 #endif
s3c_pm_init();
 
+   /* Add latch gpio chip, set latch initial value */
+   h1940_latch_control(0, 0);
WARN_ON(gpiochip_add(h1940_latch_gpiochip));
 }
 
@@ -412,8 +444,22

Re: [PATCH 1/3] rx1950: add battery device

2010-09-07 Thread Vasily Khoruzhick
В сообщении от 8 сентября 2010 02:06:19 автор Ben Dooks написал:
 On 07/09/10 15:32, Vasily Khoruzhick wrote:
  Signed-off-by: Vasily Khoruzhick anars...@gmail.com
  ---
  
   arch/arm/mach-s3c2440/Kconfig   |3 +
   arch/arm/mach-s3c2440/mach-rx1950.c |  160
   +++ 2 files changed, 163 insertions(+),
   0 deletions(-)
  
  diff --git a/arch/arm/mach-s3c2440/Kconfig
  b/arch/arm/mach-s3c2440/Kconfig index cd8e7de..9b6b026 100644
  --- a/arch/arm/mach-s3c2440/Kconfig
  +++ b/arch/arm/mach-s3c2440/Kconfig
  @@ -198,6 +198,9 @@ config MACH_RX1950
  
  select S3C_DEV_NAND
  select S3C2410_IOTIMING if S3C2440_CPUFREQ
  select S3C2440_XTAL_16934400
  
  +   select S3C_ADC
  +   select PDA_POWER
  +   select BATTERY_S3C_ADC
 
 not keen on forcing these on unless they are required for the
 system to work.

Ok

  +   {3629, 178, 10},
  +   {3612, 162, 5},
  +   {3605, 162, 0},
  +
 
 at least add a space after { and before }
 it would be nice to have named initialisers.

Ok, I'll add named initialisers

Regards
Vasily


signature.asc
Description: This is a digitally signed message part.


Re: [patch 1/1] i2c-s3c2410: Enable i2c clock only when doing some transfert

2010-08-27 Thread Vasily Khoruzhick
В сообщении от 23 июля 2010 12:02:49 автор Vasily Khoruzhick написал:
 В сообщении от 15 июля 2010 16:06:14 автор Arnaud Patard написал:
  This patch modify the s3c2410 i2c driver behaviour to enable the
  i2c clock only when needed. I'm not sure if this has a big impact
  on power usage but at least it's fixing a bug with the uda1380
  codec which needs to be hard reset'ed if the i2c clock is enabled
  before it's powered on (at least on h1940).
  
  Signed-off-by: Arnaud Patard arnaud.pat...@rtp-net.org
 
 Fixes same bug with uda1380 on rx1950 aswell.
 
 Tested-by: Vasily Khoruzhick anars...@gmail.com

This patch has problem with suspend/resume, clock needs to be enabled on i2c 
re-init. Here's fixed version of patch in attachment.
From a7b655bc82e21dcd8ae380efd39ec0455cd48779 Mon Sep 17 00:00:00 2001
From: Arnaud Patard (Rtp) arnaud.pat...@rtp-net.org
Date: Thu, 15 Jul 2010 15:06:14 +0200
Subject: [PATCH v2 1/1] i2c-s3c2410: Enable i2c clock only when doing some transfert

This patch modify the s3c2410 i2c driver behaviour to enable the
i2c clock only when needed. I'm not sure if this has a big impact
on power usage but at least it's fixing a bug with the uda1380
codec which needs to be hard reset'ed if the i2c clock is enabled
before it's powered on (at least on h1940).

v2: enable clock on i2c init in resume handler

Signed-off-by: Arnaud Patard arnaud.pat...@rtp-net.org
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 drivers/i2c/busses/i2c-s3c2410.c |   10 +-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 72902e0..0e2a2c7 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -555,18 +555,23 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
 	int retry;
 	int ret;
 
+	clk_enable(i2c-clk);
+
 	for (retry = 0; retry  adap-retries; retry++) {
 
 		ret = s3c24xx_i2c_doxfer(i2c, msgs, num);
 
-		if (ret != -EAGAIN)
+		if (ret != -EAGAIN) {
+			clk_disable(i2c-clk);
 			return ret;
+		}
 
 		dev_dbg(i2c-dev, Retrying transmission (%d)\n, retry);
 
 		udelay(100);
 	}
 
+	clk_disable(i2c-clk);
 	return -EREMOTEIO;
 }
 
@@ -911,6 +916,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, i2c);
 
 	dev_info(pdev-dev, %s: S3C I2C adapter\n, dev_name(i2c-adap.dev));
+	clk_disable(i2c-clk);
 	return 0;
 
  err_cpufreq:
@@ -978,7 +984,9 @@ static int s3c24xx_i2c_resume(struct device *dev)
 	struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
 
 	i2c-suspended = 0;
+	clk_enable(i2c-clk);
 	s3c24xx_i2c_init(i2c);
+	clk_disable(i2c-clk);
 
 	return 0;
 }
-- 
1.7.2



[PATCH v2 1/2] s3c24xx: DMA: don't use autoreload feature

2010-08-27 Thread Vasily Khoruzhick
Some integrated DMA-capable hardware doesn't like autoreload
feature of s3c24xx DMA-engine, that's why s3cmci driver
didn't work with DMA transfers enabled.

I rewrote DMA driver not to use autoreload feature and removed
all pre-loading features. Buffer re-load is fast enought to perform
it in IRQ handler, and anyway I don't see any reason to waste CPU
cycles on waiting for buffer load. Driver is much simplier now,
it was tested with s3cmci and s3c24xx-i2s drivers on s3c2442 and
s3c2410 SoCs and works just nice.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/include/mach/dma.h |   13 +-
 arch/arm/plat-s3c24xx/dma.c  |  442 +-
 2 files changed, 75 insertions(+), 380 deletions(-)

diff --git a/arch/arm/mach-s3c2410/include/mach/dma.h 
b/arch/arm/mach-s3c2410/include/mach/dma.h
index cf68136..198826f 100644
--- a/arch/arm/mach-s3c2410/include/mach/dma.h
+++ b/arch/arm/mach-s3c2410/include/mach/dma.h
@@ -79,16 +79,9 @@ enum s3c2410_dma_state {
  *
  * There are no buffers loaded (the channel should be inactive)
  *
- * S3C2410_DMA_1LOADED
- *
- * There is one buffer loaded, however it has not been confirmed to be
- * loaded by the DMA engine. This may be because the channel is not
- * yet running, or the DMA driver decided that it was too costly to
- * sit and wait for it to happen.
- *
  * S3C2410_DMA_1RUNNING
  *
- * The buffer has been confirmed running, and not finisged
+ * The buffer has been confirmed running, and not finished
  *
  * S3C2410_DMA_1LOADED_1RUNNING
  *
@@ -98,9 +91,7 @@ enum s3c2410_dma_state {
 
 enum s3c2410_dma_loadst {
S3C2410_DMALOAD_NONE,
-   S3C2410_DMALOAD_1LOADED,
S3C2410_DMALOAD_1RUNNING,
-   S3C2410_DMALOAD_1LOADED_1RUNNING,
 };
 
 
@@ -129,6 +120,7 @@ struct s3c2410_dma_buf {
dma_addr_t   data;  /* start of DMA data */
dma_addr_t   ptr;   /* where the DMA got to [1] */
void*id;/* client's id */
+   unsigned inttimestamp;
 };
 
 /* [1] is this updated for both recv/send modes? */
@@ -189,6 +181,7 @@ struct s3c2410_dma_chan {
struct s3c2410_dma_buf  *curr;  /* current dma buffer */
struct s3c2410_dma_buf  *next;  /* next buffer to load */
struct s3c2410_dma_buf  *end;   /* end of queue */
+   spinlock_t  queue_lock;
 
/* system device */
struct sys_device   dev;
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 6ad274e..5ed045b 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -133,70 +133,6 @@ dmadbg_showregs(const char *fname, int line, struct 
s3c2410_dma_chan *chan)
 #define dbg_showchan(chan) do { } while(0)
 #endif /* CONFIG_S3C2410_DMA_DEBUG */
 
-/* s3c2410_dma_stats_timeout
- *
- * Update DMA stats from timeout info
-*/
-
-static void
-s3c2410_dma_stats_timeout(struct s3c2410_dma_stats *stats, int val)
-{
-   if (stats == NULL)
-   return;
-
-   if (val  stats-timeout_longest)
-   stats-timeout_longest = val;
-   if (val  stats-timeout_shortest)
-   stats-timeout_shortest = val;
-
-   stats-timeout_avg += val;
-}
-
-/* s3c2410_dma_waitforload
- *
- * wait for the DMA engine to load a buffer, and update the state accordingly
-*/
-
-static int
-s3c2410_dma_waitforload(struct s3c2410_dma_chan *chan, int line)
-{
-   int timeout = chan-load_timeout;
-   int took;
-
-   if (chan-load_state != S3C2410_DMALOAD_1LOADED) {
-   printk(KERN_ERR dma%d: s3c2410_dma_waitforload() called in 
loadstate %d from line %d\n, chan-number, chan-load_state, line);
-   return 0;
-   }
-
-   if (chan-stats != NULL)
-   chan-stats-loads++;
-
-   while (--timeout  0) {
-   if ((dma_rdreg(chan, S3C2410_DMA_DSTAT)  (32-20)) != 0) {
-   took = chan-load_timeout - timeout;
-
-   s3c2410_dma_stats_timeout(chan-stats, took);
-
-   switch (chan-load_state) {
-   case S3C2410_DMALOAD_1LOADED:
-   chan-load_state = S3C2410_DMALOAD_1RUNNING;
-   break;
-
-   default:
-   printk(KERN_ERR dma%d: unknown load_state in 
s3c2410_dma_waitforload() %d\n, chan-number, chan-load_state);
-   }
-
-   return 1;
-   }
-   }
-
-   if (chan-stats != NULL) {
-   chan-stats-timeout_failed++;
-   }
-
-   return 0;
-}
-
 /* s3c2410_dma_loadbuffer
  *
  * load a buffer, and update the channel state
@@ -206,66 +142,35 @@ static inline int
 s3c2410_dma_loadbuffer(struct s3c2410_dma_chan *chan,
   struct s3c2410_dma_buf *buf)
 {
-   unsigned long reload

Re: [PATCH 0/3] h1940 series

2010-08-24 Thread Vasily Khoruzhick
В сообщении от 19 августа 2010 18:00:00 автор Vasily Khoruzhick написал:
 This patch series replaces h1940-specific latch-related
 functions with gpiolib, fixes compilation error for h1940-bluetooth
 and adds PM support for mmc driver.

Ping


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH 2/3] h1940: fix h1940-bluetooth compilation

2010-08-24 Thread Vasily Khoruzhick
В сообщении от 24 августа 2010 16:50:46 автор Marek Vasut написал:
 Dne Čt 19. srpna 2010 17:00:02 Vasily Khoruzhick napsal(a):
  Signed-off-by: Vasily Khoruzhick anars...@gmail.com
 
 Errr ... fix ... in what way? What was broken? I don't understand, please
 add more explanatory text. Thanks
 Cheers

It's compile fix, without this patch it just doesn't compile.


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH 3/3] h1940: implement mmc_power function

2010-08-24 Thread Vasily Khoruzhick
В сообщении от 24 августа 2010 16:52:42 автор Marek Vasut написал:
 Dne Čt 19. srpna 2010 17:00:03 Vasily Khoruzhick napsal(a):
  Signed-off-by: Vasily Khoruzhick anars...@gmail.com
  ---
  
   arch/arm/mach-s3c2410/include/mach/h1940-latch.h |2 +-
   arch/arm/mach-s3c2410/mach-h1940.c   |   23
  
  +++-- 2 files changed, 21 insertions(+), 4 deletions(-)
  
  diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
  b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h index 73586f2..ef7d8cf
  100644
  --- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
  +++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
  @@ -35,7 +35,7 @@
  
   #define H1940_LATCH_AUDIO_POWERH1940_LATCH_GPIO(9)
   #define H1940_LATCH_SM803_ENABLE   H1940_LATCH_GPIO(10)
   #define H1940_LATCH_LCD_P4 H1940_LATCH_GPIO(11)
  
  -#define H1940_LATCH_CPUQ5  H1940_LATCH_GPIO(12)
  +#define H1940_LATCH_SD_POWER   H1940_LATCH_GPIO(12)
  
   #define H1940_LATCH_BLUETOOTH_POWERH1940_LATCH_GPIO(13)
   #define H1940_LATCH_LED_GREEN  H1940_LATCH_GPIO(14)
   #define H1940_LATCH_LED_FLASH  H1940_LATCH_GPIO(15)
  
  diff --git a/arch/arm/mach-s3c2410/mach-h1940.c
  b/arch/arm/mach-s3c2410/mach-h1940.c index 9717790..c1ccc8e 100644
  --- a/arch/arm/mach-s3c2410/mach-h1940.c
  +++ b/arch/arm/mach-s3c2410/mach-h1940.c
  @@ -116,8 +116,7 @@ static unsigned int latch_state =
  H1940_LATCH_BIT(H1940_LATCH_LCD_P4) |
  H1940_LATCH_BIT(H1940_LATCH_LCD_P1) |
  
  H1940_LATCH_BIT(H1940_LATCH_LCD_P2) |
  H1940_LATCH_BIT(H1940_LATCH_LCD_P3) |
  
  -   H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN)   |
  -   H1940_LATCH_BIT(H1940_LATCH_CPUQ5);
  +   H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN);
  
   static void h1940_latch_control(unsigned int clear, unsigned int set)
   {
  
  @@ -259,10 +258,25 @@ static struct platform_device
  h1940_device_bluetooth = { .id   = -1,
  
   };
  
  +static void h1940_set_mmc_power(unsigned char power_mode, unsigned short
  vdd) +{
  +   switch (power_mode) {
  +   case MMC_POWER_OFF:
  +   gpio_set_value(H1940_LATCH_SD_POWER, 0);
  +   break;
  +   case MMC_POWER_UP:
  +   case MMC_POWER_ON:
  +   gpio_set_value(H1940_LATCH_SD_POWER, 1);
  +   break;
  +   default:
  +   break;
  +   };
  +}
  +
  
   static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
   
  .gpio_detect   = S3C2410_GPF(5),
  .gpio_wprotect = S3C2410_GPH(8),
  
  -   .set_power = NULL,
  +   .set_power = h1940_set_mmc_power,
  
  .ocr_avail = MMC_VDD_32_33,
   
   };
 
 Can't you implement gpio_power into the s3c24xx mmc driver ? Then you can
 fix mach-n30 too.

Well, I'm happy with callback. However, maybe it worth to replace set_power 
callback with regulator.

  @@ -402,6 +416,9 @@ static void __init h1940_init(void)
  
  gpio_request(H1940_LATCH_USB_DP, USB pullup);
  gpio_direction_output(H1940_LATCH_USB_DP, 0);
  
  +   gpio_request(H1940_LATCH_SD_POWER, SD power);
  +   gpio_direction_output(H1940_LATCH_SD_POWER, 0);
 
 Please handle possible return values here !

Ok, I suppose WARN_ON will be enought?


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH 1/3] h1940: use gpiolib for latch access

2010-08-24 Thread Vasily Khoruzhick
В сообщении от 24 августа 2010 16:49:51 автор Marek Vasut написал:

  +   ret = gpio_request(H1940_LATCH_BLUETOOTH_POWER, dev_name(pdev-
dev));
 
 This should contain the name of the GPIO, not dev_name I assume.

Ok

  +   if (ret) {
  +   gpio_free(S3C2410_GPH(1));
 
 What's this constant (the 1) here ? Maybe some sane #define wont hurt or
 comment around it.

GPH(1) specifies gpio bit, that's not magic constant.

  +#ifndef __ASSEMBLY__
  +#define H1940_LATCH((void __force __iomem *)0xF800)
  +#else
  +#define H1940_LATCH0xF800
  +#endif
 
 Is the __ASSEMBLY__ really needed ? You can establish mapping when the
 kernel boots (looks like you're doing that already) but then use
 __raw_readX __raw_writeX to access that space instead of this stuff above.

Uh, I just moved this code from another file, not sure if __ASSEMBLY__ is 
necessary, I'll remove it if it is not.
 
Thanks for review :)

Regards
Vasily


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH 3/3] h1940: implement mmc_power function

2010-08-24 Thread Vasily Khoruzhick
В сообщении от 24 августа 2010 17:41:57 автор Marek Vasut написал:
 Dne Út 24. srpna 2010 16:21:01 Vasily Khoruzhick napsal(a):
  В сообщении от 24 августа 2010 17:01:12 автор Marek Vasut написал:
   pr_err() and don't probe the device for which you couldn't request
   GPIO.
  
  Well, handling those errors in machine init functions doesn't make sense.
  PDA is not usable without basic hardware.
 
 You can use PDA without LCD for example (there are such people, trust me).
 So, this comment really isn't too valid. You can also use PDA without MMC
 support, you still have onboard flash, etc. etc.

But error handling here just increases code size, and gpio_request in init 
function should always succeed. It means something's going really wrong 
(kernel bug or misconfiguration) if gpio_request fails. Btw, Ben suggested to 
use WARN_ON in machine init, look through init functions of qt2410, n30, 
rx1950, vr1000, etc.

Regards
Vasily


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH RFC] h1940: use gpiolib for latch access

2010-08-19 Thread Vasily Khoruzhick
В сообщении от 4 августа 2010 18:26:35 автор Ben Dooks написал:
  /* Configures BT serial port GPIOs */
  s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
  
  -   s3c_gpio_cfgpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
  +   s3c_gpio_setpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
  
  s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT);
  
  -   s3c_gpio_cfgpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
  +   s3c_gpio_setpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
  
  s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0);
  
  -   s3c_gpio_cfgpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
  +   s3c_gpio_setpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
  
  s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
  
  -   s3c_gpio_cfgpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
  +   s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
 
 Is this an error, or have you merged a part of a different patch
 into this one?

Will move into separate patch
 
  +#define H1940_PA_LATCH (S3C2410_CS2)
  +
  +#define H1940_LATCH_GPIO(x)(S3C_GPIO_END + x)
  +
  +#define H1940_LATCH_BIT(x) (1  (x + 16 - S3C_GPIO_END))
 
 you probably want an () around the 'x's in the above defines.

Yep
 
 computing the bit seperately to the call to h1940_latch_control
 would have made the code easier to read.
 
  +   h1940_latch_control(value ? 0 : (1  (offset + 16)),
  +   value ? (1  (offset + 16)) : 0);

Ok

Regards
Vasily


signature.asc
Description: This is a digitally signed message part.


[PATCH 0/3] h1940 series

2010-08-19 Thread Vasily Khoruzhick
This patch series replaces h1940-specific latch-related
functions with gpiolib, fixes compilation error for h1940-bluetooth
and adds PM support for mmc driver.

--
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/3] h1940: fix h1940-bluetooth compilation

2010-08-19 Thread Vasily Khoruzhick
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/h1940-bluetooth.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c 
b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 8aa2f19..6b86a72 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -77,13 +77,13 @@ static int __devinit h1940bt_probe(struct platform_device 
*pdev)
 
/* Configures BT serial port GPIOs */
s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
-   s3c_gpio_cfgpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT);
-   s3c_gpio_cfgpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0);
-   s3c_gpio_cfgpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
-   s3c_gpio_cfgpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
 
 
rfk = rfkill_alloc(DRV_NAME, pdev-dev, RFKILL_TYPE_BLUETOOTH,
-- 
1.7.2

--
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/3] h1940: implement mmc_power function

2010-08-19 Thread Vasily Khoruzhick
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/include/mach/h1940-latch.h |2 +-
 arch/arm/mach-s3c2410/mach-h1940.c   |   23 +++--
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h 
b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index 73586f2..ef7d8cf 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -35,7 +35,7 @@
 #define H1940_LATCH_AUDIO_POWERH1940_LATCH_GPIO(9)
 #define H1940_LATCH_SM803_ENABLE   H1940_LATCH_GPIO(10)
 #define H1940_LATCH_LCD_P4 H1940_LATCH_GPIO(11)
-#define H1940_LATCH_CPUQ5  H1940_LATCH_GPIO(12)
+#define H1940_LATCH_SD_POWER   H1940_LATCH_GPIO(12)
 #define H1940_LATCH_BLUETOOTH_POWERH1940_LATCH_GPIO(13)
 #define H1940_LATCH_LED_GREEN  H1940_LATCH_GPIO(14)
 #define H1940_LATCH_LED_FLASH  H1940_LATCH_GPIO(15)
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c 
b/arch/arm/mach-s3c2410/mach-h1940.c
index 9717790..c1ccc8e 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -116,8 +116,7 @@ static unsigned int latch_state = 
H1940_LATCH_BIT(H1940_LATCH_LCD_P4) |
H1940_LATCH_BIT(H1940_LATCH_LCD_P1) |
H1940_LATCH_BIT(H1940_LATCH_LCD_P2) |
H1940_LATCH_BIT(H1940_LATCH_LCD_P3) |
-   H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN)   |
-   H1940_LATCH_BIT(H1940_LATCH_CPUQ5);
+   H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN);
 
 static void h1940_latch_control(unsigned int clear, unsigned int set)
 {
@@ -259,10 +258,25 @@ static struct platform_device h1940_device_bluetooth = {
.id   = -1,
 };
 
+static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)
+{
+   switch (power_mode) {
+   case MMC_POWER_OFF:
+   gpio_set_value(H1940_LATCH_SD_POWER, 0);
+   break;
+   case MMC_POWER_UP:
+   case MMC_POWER_ON:
+   gpio_set_value(H1940_LATCH_SD_POWER, 1);
+   break;
+   default:
+   break;
+   };
+}
+
 static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
.gpio_detect   = S3C2410_GPF(5),
.gpio_wprotect = S3C2410_GPH(8),
-   .set_power = NULL,
+   .set_power = h1940_set_mmc_power,
.ocr_avail = MMC_VDD_32_33,
 };
 
@@ -402,6 +416,9 @@ static void __init h1940_init(void)
gpio_request(H1940_LATCH_USB_DP, USB pullup);
gpio_direction_output(H1940_LATCH_USB_DP, 0);
 
+   gpio_request(H1940_LATCH_SD_POWER, SD power);
+   gpio_direction_output(H1940_LATCH_SD_POWER, 0);
+
platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 }
 
-- 
1.7.2

--
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] s3c24xx: DMA: don't use autoreload feature

2010-08-18 Thread Vasily Khoruzhick
Some integrated DMA-capable hardware doesn't like autoreload
feature of s3c24xx DMA-engine, that's why s3cmci driver
didn't work with DMA transfers enabled.

I rewrote DMA driver not to use autoreload feature and removed
all pre-loading features. Buffer re-load is fast enought to perform
it in IRQ handler, and anyway I don't see any reason to waste CPU
cycles on waiting for buffer load. Driver is much simplier now,
it was tested with s3cmci and s3c24xx-i2s drivers on s3c2442 and
s3c2410 SoCs and works just nice.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/include/mach/dma.h |   13 +-
 arch/arm/plat-s3c24xx/dma.c  |  426 +-
 2 files changed, 68 insertions(+), 371 deletions(-)

diff --git a/arch/arm/mach-s3c2410/include/mach/dma.h 
b/arch/arm/mach-s3c2410/include/mach/dma.h
index cf68136..198826f 100644
--- a/arch/arm/mach-s3c2410/include/mach/dma.h
+++ b/arch/arm/mach-s3c2410/include/mach/dma.h
@@ -79,16 +79,9 @@ enum s3c2410_dma_state {
  *
  * There are no buffers loaded (the channel should be inactive)
  *
- * S3C2410_DMA_1LOADED
- *
- * There is one buffer loaded, however it has not been confirmed to be
- * loaded by the DMA engine. This may be because the channel is not
- * yet running, or the DMA driver decided that it was too costly to
- * sit and wait for it to happen.
- *
  * S3C2410_DMA_1RUNNING
  *
- * The buffer has been confirmed running, and not finisged
+ * The buffer has been confirmed running, and not finished
  *
  * S3C2410_DMA_1LOADED_1RUNNING
  *
@@ -98,9 +91,7 @@ enum s3c2410_dma_state {
 
 enum s3c2410_dma_loadst {
S3C2410_DMALOAD_NONE,
-   S3C2410_DMALOAD_1LOADED,
S3C2410_DMALOAD_1RUNNING,
-   S3C2410_DMALOAD_1LOADED_1RUNNING,
 };
 
 
@@ -129,6 +120,7 @@ struct s3c2410_dma_buf {
dma_addr_t   data;  /* start of DMA data */
dma_addr_t   ptr;   /* where the DMA got to [1] */
void*id;/* client's id */
+   unsigned inttimestamp;
 };
 
 /* [1] is this updated for both recv/send modes? */
@@ -189,6 +181,7 @@ struct s3c2410_dma_chan {
struct s3c2410_dma_buf  *curr;  /* current dma buffer */
struct s3c2410_dma_buf  *next;  /* next buffer to load */
struct s3c2410_dma_buf  *end;   /* end of queue */
+   spinlock_t  queue_lock;
 
/* system device */
struct sys_device   dev;
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 6ad274e..926fc9e 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -133,70 +133,6 @@ dmadbg_showregs(const char *fname, int line, struct 
s3c2410_dma_chan *chan)
 #define dbg_showchan(chan) do { } while(0)
 #endif /* CONFIG_S3C2410_DMA_DEBUG */
 
-/* s3c2410_dma_stats_timeout
- *
- * Update DMA stats from timeout info
-*/
-
-static void
-s3c2410_dma_stats_timeout(struct s3c2410_dma_stats *stats, int val)
-{
-   if (stats == NULL)
-   return;
-
-   if (val  stats-timeout_longest)
-   stats-timeout_longest = val;
-   if (val  stats-timeout_shortest)
-   stats-timeout_shortest = val;
-
-   stats-timeout_avg += val;
-}
-
-/* s3c2410_dma_waitforload
- *
- * wait for the DMA engine to load a buffer, and update the state accordingly
-*/
-
-static int
-s3c2410_dma_waitforload(struct s3c2410_dma_chan *chan, int line)
-{
-   int timeout = chan-load_timeout;
-   int took;
-
-   if (chan-load_state != S3C2410_DMALOAD_1LOADED) {
-   printk(KERN_ERR dma%d: s3c2410_dma_waitforload() called in 
loadstate %d from line %d\n, chan-number, chan-load_state, line);
-   return 0;
-   }
-
-   if (chan-stats != NULL)
-   chan-stats-loads++;
-
-   while (--timeout  0) {
-   if ((dma_rdreg(chan, S3C2410_DMA_DSTAT)  (32-20)) != 0) {
-   took = chan-load_timeout - timeout;
-
-   s3c2410_dma_stats_timeout(chan-stats, took);
-
-   switch (chan-load_state) {
-   case S3C2410_DMALOAD_1LOADED:
-   chan-load_state = S3C2410_DMALOAD_1RUNNING;
-   break;
-
-   default:
-   printk(KERN_ERR dma%d: unknown load_state in 
s3c2410_dma_waitforload() %d\n, chan-number, chan-load_state);
-   }
-
-   return 1;
-   }
-   }
-
-   if (chan-stats != NULL) {
-   chan-stats-timeout_failed++;
-   }
-
-   return 0;
-}
-
 /* s3c2410_dma_loadbuffer
  *
  * load a buffer, and update the channel state
@@ -206,8 +142,6 @@ static inline int
 s3c2410_dma_loadbuffer(struct s3c2410_dma_chan *chan,
   struct s3c2410_dma_buf *buf)
 {
-   unsigned long reload

[PATCH RFC] h1940: use gpiolib for latch access

2010-07-25 Thread Vasily Khoruzhick
This patch adds gpiolib support for h1940 latch.
With this patch it's possible to use leds-gpio and uda1380
drivers (they require gpiolib support for appropriate pins).
And now it's possible to drop leds-h1940 driver.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
 arch/arm/mach-s3c2410/h1940-bluetooth.c  |   21 --
 arch/arm/mach-s3c2410/include/mach/h1940-latch.h |   57 ++
 arch/arm/mach-s3c2410/mach-h1940.c   |   71 --
 arch/arm/plat-s3c24xx/Kconfig|1 +
 4 files changed, 99 insertions(+), 51 deletions(-)

diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c 
b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 8cdeb14..6b86a72 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -30,7 +30,7 @@ static void h1940bt_enable(int on)
 {
if (on) {
/* Power on the chip */
-   h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER);
+   gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 1);
/* Reset the chip */
mdelay(10);
 
@@ -43,7 +43,7 @@ static void h1940bt_enable(int on)
mdelay(10);
gpio_set_value(S3C2410_GPH(1), 0);
mdelay(10);
-   h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0);
+   gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0);
}
 }
 
@@ -64,19 +64,26 @@ static int __devinit h1940bt_probe(struct platform_device 
*pdev)
 
ret = gpio_request(S3C2410_GPH(1), dev_name(pdev-dev));
if (ret) {
-   dev_err(pdev-dev, could not get GPH1\n);\
+   dev_err(pdev-dev, could not get GPH1\n);
+   return ret;
+   }
+
+   ret = gpio_request(H1940_LATCH_BLUETOOTH_POWER, dev_name(pdev-dev));
+   if (ret) {
+   gpio_free(S3C2410_GPH(1));
+   dev_err(pdev-dev, could not get BT_POWER\n);
return ret;
}
 
/* Configures BT serial port GPIOs */
s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
-   s3c_gpio_cfgpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT);
-   s3c_gpio_cfgpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0);
-   s3c_gpio_cfgpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
-   s3c_gpio_cfgpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
+   s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
 
 
rfk = rfkill_alloc(DRV_NAME, pdev-dev, RFKILL_TYPE_BLUETOOTH,
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h 
b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index d8a8327..4607d5c 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -14,51 +14,30 @@
 #ifndef __ASM_ARCH_H1940_LATCH_H
 #define __ASM_ARCH_H1940_LATCH_H
 
+#include mach/gpio.h
 
-#ifndef __ASSEMBLY__
-#define H1940_LATCH((void __force __iomem *)0xF800)
-#else
-#define H1940_LATCH0xF800
-#endif
-
-#define H1940_PA_LATCH (S3C2410_CS2)
+#define H1940_LATCH_GPIO(x)(S3C_GPIO_END + x)
 
 /* SD layer latch */
 
-#define H1940_LATCH_SDQ1   (116)
-#define H1940_LATCH_LCD_P1 (117)
-#define H1940_LATCH_LCD_P2 (118)
-#define H1940_LATCH_LCD_P3 (119)
-#define H1940_LATCH_MAX1698_nSHUTDOWN  (120) /* LCD backlight */
-#define H1940_LATCH_LED_RED(121)
-#define H1940_LATCH_SDQ7   (122)
-#define H1940_LATCH_USB_DP (123)
+#define H1940_LATCH_SDQ1   H1940_LATCH_GPIO(0)
+#define H1940_LATCH_LCD_P1 H1940_LATCH_GPIO(1)
+#define H1940_LATCH_LCD_P2 H1940_LATCH_GPIO(2)
+#define H1940_LATCH_LCD_P3 H1940_LATCH_GPIO(3)
+#define H1940_LATCH_MAX1698_nSHUTDOWN  H1940_LATCH_GPIO(4)
+#define H1940_LATCH_LED_REDH1940_LATCH_GPIO(5)
+#define H1940_LATCH_SDQ7   H1940_LATCH_GPIO(6)
+#define H1940_LATCH_USB_DP H1940_LATCH_GPIO(7)
 
 /* CPU layer latch */
 
-#define H1940_LATCH_UDA_POWER  (124)
-#define H1940_LATCH_AUDIO_POWER(125)
-#define H1940_LATCH_SM803_ENABLE   (126)
-#define H1940_LATCH_LCD_P4 (127)
-#define H1940_LATCH_CPUQ5  (128) /* untraced */
-#define H1940_LATCH_BLUETOOTH_POWER(129) /* active high */
-#define H1940_LATCH_LED_GREEN  (130)
-#define H1940_LATCH_LED_FLASH  (131)
-
-/* default settings */
-
-#define H1940_LATCH_DEFAULT\
-   H1940_LATCH_LCD_P4  | \
-   H1940_LATCH_SM803_ENABLE

Re: [PATCH RFC] h1940: use gpiolib for latch access

2010-07-25 Thread Vasily Khoruzhick
В сообщении от 26 июля 2010 01:35:21 автор Russell King - ARM Linux написал:
 On Sun, Jul 25, 2010 at 07:41:12PM +0300, Vasily Khoruzhick wrote:
  diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
  b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h index
  d8a8327..4607d5c 100644
  --- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
  +++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
  @@ -14,51 +14,30 @@
  
   #ifndef __ASM_ARCH_H1940_LATCH_H
   #define __ASM_ARCH_H1940_LATCH_H
  
  +#include mach/gpio.h
 
 Would linux/gpio.h make more sense here?

Nope, mach/gpio.h is for S3C_GPIO_END

Regards
Vasily


signature.asc
Description: This is a digitally signed message part.


Re: [patch 1/1] i2c-s3c2410: Enable i2c clock only when doing some transfert

2010-07-23 Thread Vasily Khoruzhick
В сообщении от 15 июля 2010 16:06:14 автор Arnaud Patard написал:
 This patch modify the s3c2410 i2c driver behaviour to enable the
 i2c clock only when needed. I'm not sure if this has a big impact
 on power usage but at least it's fixing a bug with the uda1380
 codec which needs to be hard reset'ed if the i2c clock is enabled
 before it's powered on (at least on h1940).
 
 Signed-off-by: Arnaud Patard arnaud.pat...@rtp-net.org

Fixes same bug with uda1380 on rx1950 aswell.

Tested-by: Vasily Khoruzhick anars...@gmail.com


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH 1/4] ARM: S3C24XX: Fix gpiolib support for ports K..M

2010-06-22 Thread Vasily Khoruzhick
В сообщении от 22 июня 2010 16:16:22 автор Yauhen Kharuzhy написал:
 S3C2443 and S3C2416 has 12 GPIO banks (from A to M), increase
 ARCH_NR_GPIOS for this architectures.
 
 Also typo from previous commit has been fixed: CONFIG_CPU_S3C24XX
 instead CONFIG_CPU_244X.
 
 Signed-off-by: Yauhen Kharuzhy jek...@gmail.com

Tested-by: Vasily Khoruzhick anars...@gmail.com

 ---
  arch/arm/mach-s3c2410/include/mach/gpio.h |   10 +++---
  1 files changed, 7 insertions(+), 3 deletions(-)
 
 diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h
 b/arch/arm/mach-s3c2410/include/mach/gpio.h index b649bf2..f7f6b07 100644
 --- a/arch/arm/mach-s3c2410/include/mach/gpio.h
 +++ b/arch/arm/mach-s3c2410/include/mach/gpio.h
 @@ -22,6 +22,8 @@
 
  #ifdef CONFIG_CPU_S3C244X
  #define ARCH_NR_GPIOS(32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA)
 +#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
 +#define ARCH_NR_GPIOS(32 * 12 + CONFIG_S3C24XX_GPIO_EXTRA)
  #else
  #define ARCH_NR_GPIOS(256 + CONFIG_S3C24XX_GPIO_EXTRA)
  #endif
 @@ -30,8 +32,10 @@
  #include mach/gpio-nrs.h
  #include mach/gpio-fns.h
 
 -#ifdef CONFIG_CPU_S3C24XX
 -#define S3C_GPIO_END (S3C2410_GPIO_BANKJ + 32)
 +#ifdef CONFIG_CPU_S3C244X
 +#define S3C_GPIO_END (S3C2410_GPJ(0) + 32)
 +#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
 +#define S3C_GPIO_END (S3C2410_GPM(0) + 32)
  #else
 -#define S3C_GPIO_END (S3C2410_GPIO_BANKH + 32)
 +#define S3C_GPIO_END (S3C2410_GPH(0) + 32)
  #endif


signature.asc
Description: This is a digitally signed message part.


Re: approaching last call for updatyes

2010-05-13 Thread Vasily Khoruzhick
В сообщении от 13 мая 2010 12:37:30 автор christian pellegrin написал:
 The fix for NAND clock stop on idle is missing. Without it I suggest
 to mark the option CONFIG_MTD_NAND_S3C2410_CLKSTOP broken.

Confirmed, CLKSTOP option is not working on my rx1950, I'm not able to
read NAND after resume from suspend with CLKSTOP enabled.

Regards
Vasily


signature.asc
Description: This is a digitally signed message part.


Re: SAMSUNG kernel tree merge plans

2010-05-06 Thread Vasily Khoruzhick
В сообщении от 6 мая 2010 08:46:51 автор Ben Dooks написал:
 I'm busy sorting out the trees for the next mege window, and should
 have a new next-samsung out in the next two or three days.
 
 As such, if there is anything that needs to go via Russell's tree, then
 it needs to be merged as soon as possible. I would like to send a pull
 before Wednesday.
 
 Anything else, if it is not merged into one of my trees by the end of
 next week (May 14th) then there is no guarantees that it will be merged.
 
 If everyone interested in this could check my trees after the weekend and
 make any reminders of other stuff to fix at that point as there is still
 items being processed.
 
 http://git.fluff.org/gitweb?p=bjdooks/linux.git;a=summary

Is there any chance that my rx1950-support patch series will be merged? I've 
almost finished moving to gpiolib and can send series after this weekend. What 
branch of your tree should I use as base?

Regards
Vasily


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH v2.6.34-rc2] s3c: Fix GPIOs bank H and J not being preserved during suspend on S3C24XX

2010-04-23 Thread Vasily Khoruzhick
В сообщении от 30 марта 2010 11:23:06 автор Christian Pellegrin написал:
 With this patch the platform-specific define for the last defined GPIO
 on S3C machines is used instead of a hard-coded value (which is right
 only for the s3c2410). The gpio_nr being incremented by 1 too much (look
 for the gpio_nr++ in the for instruction) is fixed too although it
 doesn't make any trouble on current S3C implementations.
 
 Signed-off-by: Christian Pellegrin chrip...@fsfe.org
Tested-by: Vasily Khoruzhick anars...@gmail.com

 ---
  arch/arm/mach-s3c2410/include/mach/gpio-track.h |2 +-
  arch/arm/plat-samsung/pm-gpio.c |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-track.h
 b/arch/arm/mach-s3c2410/include/mach/gpio-track.h index acb2591..6371eaa
 100644
 --- a/arch/arm/mach-s3c2410/include/mach/gpio-track.h
 +++ b/arch/arm/mach-s3c2410/include/mach/gpio-track.h
 @@ -23,7 +23,7 @@ static inline struct s3c_gpio_chip
 *s3c_gpiolib_getchip(unsigned int pin) {
   struct s3c_gpio_chip *chip;
 
 - if (pin  S3C2410_GPG(10))
 + if (pin  S3C_GPIO_END)
   return NULL;
 
   chip = s3c24xx_gpios[pin/32];
 diff --git a/arch/arm/plat-samsung/pm-gpio.c
 b/arch/arm/plat-samsung/pm-gpio.c index 69a4c7f..1aac746 100644
 --- a/arch/arm/plat-samsung/pm-gpio.c
 +++ b/arch/arm/plat-samsung/pm-gpio.c
 @@ -343,7 +343,7 @@ void s3c_pm_save_gpios(void)
 ourchip-pm_save[2],
 ourchip-pm_save[3]);
 
 - gpio_nr += ourchip-chip.ngpio;
 + gpio_nr += ourchip-chip.ngpio - 1;
   gpio_nr += CONFIG_S3C_GPIO_SPACE;
   }
  }


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH v2.6.34-rc2] s3c: Adds support for banks H and J on S3C244X CPUs

2010-04-23 Thread Vasily Khoruzhick
В сообщении от 30 марта 2010 11:22:47 автор Christian Pellegrin написал:
 This patch adds support to gpiolib for GPIO bank J present on S3C244X
 CPUs.
 
 Signed-off-by: Christian Pellegrin chrip...@fsfe.org
Tested-by: Vasily Khoruzhick anars...@gmail.com

 ---
  arch/arm/mach-s3c2410/include/mach/gpio-nrs.h |4 
  arch/arm/mach-s3c2410/include/mach/gpio.h |8 
  arch/arm/plat-s3c24xx/gpiolib.c   |   16 +++-
  3 files changed, 27 insertions(+), 1 deletions(-)
 
 diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h
 b/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h index 2edbb9c..f1f32e2
 100644
 --- a/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h
 +++ b/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h
 @@ -24,6 +24,7 @@
  #define S3C2410_GPIO_BANKF   (32*5)
  #define S3C2410_GPIO_BANKG   (32*6)
  #define S3C2410_GPIO_BANKH   (32*7)
 +#define S3C2410_GPIO_BANKJ   (32*8)
 
  /* GPIO bank sizes */
  #define S3C2410_GPIO_A_NR(32)
 @@ -34,6 +35,7 @@
  #define S3C2410_GPIO_F_NR(32)
  #define S3C2410_GPIO_G_NR(32)
  #define S3C2410_GPIO_H_NR(32)
 +#define S3C2410_GPIO_J_NR(32)
 
  #if CONFIG_S3C_GPIO_SPACE != 0
  #error CONFIG_S3C_GPIO_SPACE cannot be zero at the moment
 @@ -53,6 +55,7 @@ enum s3c_gpio_number {
   S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E),
   S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F),
   S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G),
 + S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H),
  };
 
  #endif /* __ASSEMBLY__ */
 @@ -67,6 +70,7 @@ enum s3c_gpio_number {
  #define S3C2410_GPF(_nr) (S3C2410_GPIO_F_START + (_nr))
  #define S3C2410_GPG(_nr) (S3C2410_GPIO_G_START + (_nr))
  #define S3C2410_GPH(_nr) (S3C2410_GPIO_H_START + (_nr))
 +#define S3C2410_GPJ(_nr) (S3C2410_GPIO_J_START + (_nr))
 
  /* compatibility until drivers can be modified */
 
 diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h
 b/arch/arm/mach-s3c2410/include/mach/gpio.h index 15f0b3e..1528fc7 100644
 --- a/arch/arm/mach-s3c2410/include/mach/gpio.h
 +++ b/arch/arm/mach-s3c2410/include/mach/gpio.h
 @@ -20,10 +20,18 @@
   * devices that need GPIO.
   */
 
 +#ifdef CONFIG_CPU_S3C244X
 +#define ARCH_NR_GPIOS(32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA)
 +#else
  #define ARCH_NR_GPIOS(256 + CONFIG_S3C24XX_GPIO_EXTRA)
 +#endif
 
  #include asm-generic/gpio.h
  #include mach/gpio-nrs.h
  #include mach/gpio-fns.h
 
 +#ifdef CONFIG_CPU_S3C244X
 +#define S3C_GPIO_END (S3C2410_GPIO_BANKJ + 32)
 +#else
  #define S3C_GPIO_END (S3C2410_GPIO_BANKH + 32)
 +#endif
 diff --git a/arch/arm/plat-s3c24xx/gpiolib.c
 b/arch/arm/plat-s3c24xx/gpiolib.c index 4f0f11a..0818a6e 100644
 --- a/arch/arm/plat-s3c24xx/gpiolib.c
 +++ b/arch/arm/plat-s3c24xx/gpiolib.c
 @@ -26,6 +26,7 @@
  #include plat/pm.h
 
  #include mach/regs-gpio.h
 +#include mach/regs-gpioj.h
 
  static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned
 offset) {
 @@ -151,7 +152,8 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
   .ngpio  = 16,
   .to_irq = s3c24xx_gpiolib_bankg_toirq,
   },
 - }, {
 + },
 + [7] = {
   .base   = S3C2410_GPHCON,
   .pm = __gpio_pm(s3c_gpio_pm_2bit),
   .chip   = {
 @@ -161,6 +163,18 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
   .ngpio  = 11,
   },
   },
 +#ifdef CONFIG_CPU_S3C244X
 + [8] = {
 + .base   = S3C2440_GPJCON,
 + .pm = __gpio_pm(s3c_gpio_pm_2bit),
 + .chip   = {
 + .base   = S3C2410_GPJ(0),
 + .owner  = THIS_MODULE,
 + .label  = GPIOJ,
 + .ngpio  = 13,
 + },
 + },
 +#endif
  };
 
  static __init int s3c24xx_gpiolib_init(void)


signature.asc
Description: This is a digitally signed message part.


Re: [patch 1/1] TOUCHSCREEN: S3C24XX touchscreen driver from Arnaud Patard.

2009-11-19 Thread Vasily Khoruzhick
В сообщении от 19 ноября 2009 1:29:40 автор Ben Dooks написал:
skipped
 + /* Initialise registers */
 + if ((info-delay  0x)  0)
 + writel(info-delay  0x, ts.io + S3C2410_ADCDLY);

As for me, it's not OK to modity ADC-related registers in touchscreen driver, 
adc driver should be modified to support delay.

Regards
Vasily


signature.asc
Description: This is a digitally signed message part.