aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-12-12 19:10:45 -0500
committerOlof Johansson <olof@lixom.net>2012-12-12 19:10:45 -0500
commit9c7466b217af784280d9fc841bbd559ef3bf33e9 (patch)
treec21ee243e48912201b4041fbf3f9bd9165603bd8 /arch/arm/plat-samsung
parent4a76411ea3f1da9032e031f8fff8894b97d141b2 (diff)
parent48d224d1efec98b0b78e511150b4f5752beceb7c (diff)
ARM: arm-soc: Merge branch 'next/pm2' into next/pm
Another smaller branch merged into next/pm before pull request. Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r--arch/arm/plat-samsung/adc.c48
-rw-r--r--arch/arm/plat-samsung/devs.c5
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/mfc.h11
-rw-r--r--arch/arm/plat-samsung/s5p-dev-mfc.c34
5 files changed, 59 insertions, 41 deletions
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index b1e05ccff3ac..37542c2689a2 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -344,7 +344,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
344 int ret; 344 int ret;
345 unsigned tmp; 345 unsigned tmp;
346 346
347 adc = kzalloc(sizeof(struct adc_device), GFP_KERNEL); 347 adc = devm_kzalloc(dev, sizeof(struct adc_device), GFP_KERNEL);
348 if (adc == NULL) { 348 if (adc == NULL) {
349 dev_err(dev, "failed to allocate adc_device\n"); 349 dev_err(dev, "failed to allocate adc_device\n");
350 return -ENOMEM; 350 return -ENOMEM;
@@ -355,50 +355,46 @@ static int s3c_adc_probe(struct platform_device *pdev)
355 adc->pdev = pdev; 355 adc->pdev = pdev;
356 adc->prescale = S3C2410_ADCCON_PRSCVL(49); 356 adc->prescale = S3C2410_ADCCON_PRSCVL(49);
357 357
358 adc->vdd = regulator_get(dev, "vdd"); 358 adc->vdd = devm_regulator_get(dev, "vdd");
359 if (IS_ERR(adc->vdd)) { 359 if (IS_ERR(adc->vdd)) {
360 dev_err(dev, "operating without regulator \"vdd\" .\n"); 360 dev_err(dev, "operating without regulator \"vdd\" .\n");
361 ret = PTR_ERR(adc->vdd); 361 return PTR_ERR(adc->vdd);
362 goto err_alloc;
363 } 362 }
364 363
365 adc->irq = platform_get_irq(pdev, 1); 364 adc->irq = platform_get_irq(pdev, 1);
366 if (adc->irq <= 0) { 365 if (adc->irq <= 0) {
367 dev_err(dev, "failed to get adc irq\n"); 366 dev_err(dev, "failed to get adc irq\n");
368 ret = -ENOENT; 367 return -ENOENT;
369 goto err_reg;
370 } 368 }
371 369
372 ret = request_irq(adc->irq, s3c_adc_irq, 0, dev_name(dev), adc); 370 ret = devm_request_irq(dev, adc->irq, s3c_adc_irq, 0, dev_name(dev),
371 adc);
373 if (ret < 0) { 372 if (ret < 0) {
374 dev_err(dev, "failed to attach adc irq\n"); 373 dev_err(dev, "failed to attach adc irq\n");
375 goto err_reg; 374 return ret;
376 } 375 }
377 376
378 adc->clk = clk_get(dev, "adc"); 377 adc->clk = devm_clk_get(dev, "adc");
379 if (IS_ERR(adc->clk)) { 378 if (IS_ERR(adc->clk)) {
380 dev_err(dev, "failed to get adc clock\n"); 379 dev_err(dev, "failed to get adc clock\n");
381 ret = PTR_ERR(adc->clk); 380 return PTR_ERR(adc->clk);
382 goto err_irq;
383 } 381 }
384 382
385 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 383 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
386 if (!regs) { 384 if (!regs) {
387 dev_err(dev, "failed to find registers\n"); 385 dev_err(dev, "failed to find registers\n");
388 ret = -ENXIO; 386 return -ENXIO;
389 goto err_clk;
390 } 387 }
391 388
392 adc->regs = ioremap(regs->start, resource_size(regs)); 389 adc->regs = devm_request_and_ioremap(dev, regs);
393 if (!adc->regs) { 390 if (!adc->regs) {
394 dev_err(dev, "failed to map registers\n"); 391 dev_err(dev, "failed to map registers\n");
395 ret = -ENXIO; 392 return -ENXIO;
396 goto err_clk;
397 } 393 }
398 394
399 ret = regulator_enable(adc->vdd); 395 ret = regulator_enable(adc->vdd);
400 if (ret) 396 if (ret)
401 goto err_ioremap; 397 return ret;
402 398
403 clk_enable(adc->clk); 399 clk_enable(adc->clk);
404 400
@@ -418,32 +414,14 @@ static int s3c_adc_probe(struct platform_device *pdev)
418 adc_dev = adc; 414 adc_dev = adc;
419 415
420 return 0; 416 return 0;
421
422 err_ioremap:
423 iounmap(adc->regs);
424 err_clk:
425 clk_put(adc->clk);
426
427 err_irq:
428 free_irq(adc->irq, adc);
429 err_reg:
430 regulator_put(adc->vdd);
431 err_alloc:
432 kfree(adc);
433 return ret;
434} 417}
435 418
436static int __devexit s3c_adc_remove(struct platform_device *pdev) 419static int __devexit s3c_adc_remove(struct platform_device *pdev)
437{ 420{
438 struct adc_device *adc = platform_get_drvdata(pdev); 421 struct adc_device *adc = platform_get_drvdata(pdev);
439 422
440 iounmap(adc->regs);
441 free_irq(adc->irq, adc);
442 clk_disable(adc->clk); 423 clk_disable(adc->clk);
443 regulator_disable(adc->vdd); 424 regulator_disable(adc->vdd);
444 regulator_put(adc->vdd);
445 clk_put(adc->clk);
446 kfree(adc);
447 425
448 return 0; 426 return 0;
449} 427}
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 03f654d55eff..bc50b20a8ffc 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -486,11 +486,7 @@ static struct resource s3c_i2c0_resource[] = {
486 486
487struct platform_device s3c_device_i2c0 = { 487struct platform_device s3c_device_i2c0 = {
488 .name = "s3c2410-i2c", 488 .name = "s3c2410-i2c",
489#ifdef CONFIG_S3C_DEV_I2C1
490 .id = 0, 489 .id = 0,
491#else
492 .id = -1,
493#endif
494 .num_resources = ARRAY_SIZE(s3c_i2c0_resource), 490 .num_resources = ARRAY_SIZE(s3c_i2c0_resource),
495 .resource = s3c_i2c0_resource, 491 .resource = s3c_i2c0_resource,
496}; 492};
@@ -933,6 +929,7 @@ struct platform_device s5p_device_mfc_r = {
933 .coherent_dma_mask = DMA_BIT_MASK(32), 929 .coherent_dma_mask = DMA_BIT_MASK(32),
934 }, 930 },
935}; 931};
932
936#endif /* CONFIG_S5P_DEV_MFC */ 933#endif /* CONFIG_S5P_DEV_MFC */
937 934
938/* MIPI CSIS */ 935/* MIPI CSIS */
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index 5da4b4f38f40..133e3e4170fb 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -133,8 +133,6 @@ extern struct platform_device exynos4_device_pcm1;
133extern struct platform_device exynos4_device_pcm2; 133extern struct platform_device exynos4_device_pcm2;
134extern struct platform_device exynos4_device_spdif; 134extern struct platform_device exynos4_device_spdif;
135 135
136extern struct platform_device exynos_device_drm;
137
138extern struct platform_device samsung_asoc_dma; 136extern struct platform_device samsung_asoc_dma;
139extern struct platform_device samsung_asoc_idma; 137extern struct platform_device samsung_asoc_idma;
140extern struct platform_device samsung_device_keypad; 138extern struct platform_device samsung_device_keypad;
diff --git a/arch/arm/plat-samsung/include/plat/mfc.h b/arch/arm/plat-samsung/include/plat/mfc.h
index ac13227272f0..e6d7c42d68b6 100644
--- a/arch/arm/plat-samsung/include/plat/mfc.h
+++ b/arch/arm/plat-samsung/include/plat/mfc.h
@@ -10,6 +10,14 @@
10#ifndef __PLAT_SAMSUNG_MFC_H 10#ifndef __PLAT_SAMSUNG_MFC_H
11#define __PLAT_SAMSUNG_MFC_H __FILE__ 11#define __PLAT_SAMSUNG_MFC_H __FILE__
12 12
13struct s5p_mfc_dt_meminfo {
14 unsigned long loff;
15 unsigned long lsize;
16 unsigned long roff;
17 unsigned long rsize;
18 char *compatible;
19};
20
13/** 21/**
14 * s5p_mfc_reserve_mem - function to early reserve memory for MFC driver 22 * s5p_mfc_reserve_mem - function to early reserve memory for MFC driver
15 * @rbase: base address for MFC 'right' memory interface 23 * @rbase: base address for MFC 'right' memory interface
@@ -24,4 +32,7 @@
24void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize, 32void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
25 phys_addr_t lbase, unsigned int lsize); 33 phys_addr_t lbase, unsigned int lsize);
26 34
35int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname,
36 int depth, void *data);
37
27#endif /* __PLAT_SAMSUNG_MFC_H */ 38#endif /* __PLAT_SAMSUNG_MFC_H */
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/plat-samsung/s5p-dev-mfc.c
index ad6089465e2a..5ec104b5408b 100644
--- a/arch/arm/plat-samsung/s5p-dev-mfc.c
+++ b/arch/arm/plat-samsung/s5p-dev-mfc.c
@@ -14,6 +14,8 @@
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/memblock.h> 15#include <linux/memblock.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/of_fdt.h>
18#include <linux/of.h>
17 19
18#include <mach/map.h> 20#include <mach/map.h>
19#include <plat/devs.h> 21#include <plat/devs.h>
@@ -69,3 +71,35 @@ static int __init s5p_mfc_memory_init(void)
69 return 0; 71 return 0;
70} 72}
71device_initcall(s5p_mfc_memory_init); 73device_initcall(s5p_mfc_memory_init);
74
75#ifdef CONFIG_OF
76int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname,
77 int depth, void *data)
78{
79 __be32 *prop;
80 unsigned long len;
81 struct s5p_mfc_dt_meminfo *mfc_mem = data;
82
83 if (!data)
84 return 0;
85
86 if (!of_flat_dt_is_compatible(node, mfc_mem->compatible))
87 return 0;
88
89 prop = of_get_flat_dt_prop(node, "samsung,mfc-l", &len);
90 if (!prop || (len != 2 * sizeof(unsigned long)))
91 return 0;
92
93 mfc_mem->loff = be32_to_cpu(prop[0]);
94 mfc_mem->lsize = be32_to_cpu(prop[1]);
95
96 prop = of_get_flat_dt_prop(node, "samsung,mfc-r", &len);
97 if (!prop || (len != 2 * sizeof(unsigned long)))
98 return 0;
99
100 mfc_mem->roff = be32_to_cpu(prop[0]);
101 mfc_mem->rsize = be32_to_cpu(prop[1]);
102
103 return 1;
104}
105#endif