Skip to content

Commit

Permalink
ARM: SAMSUNG: Move HWMON from plat-s3c24xx to plat-samsung
Browse files Browse the repository at this point in the history
Move HWMON platform definition from plat-s3c24xx to plat-samsung
and adjust mach-bast to use the new s3c_hwmon_set_platdata().
This allows usage of dev-hwmon by other Samsung SoCs.

Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Maurus Cuelenaere authored and Ben Dooks committed May 12, 2010
1 parent 7ebd467 commit 6cd82ff
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 9 deletions.
1 change: 1 addition & 0 deletions arch/arm/mach-s3c2410/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ config ARCH_BAST
select MACH_BAST_IDE
select S3C24XX_DCLK
select ISA
select S3C_DEV_HWMON
select S3C_DEV_USB_HOST
select S3C_DEV_NAND
help
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-s3c2410/mach-bast.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ static void __init bast_map_io(void)

s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));

s3c_device_hwmon.dev.platform_data = &bast_hwmon_info;
s3c_hwmon_set_platdata(&bast_hwmon_info);

s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
s3c24xx_init_clocks(0);
Expand Down
8 changes: 0 additions & 8 deletions arch/arm/plat-s3c24xx/devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,6 @@ struct platform_device s3c_device_adc = {
.resource = s3c_adc_resource,
};

/* HWMON */

struct platform_device s3c_device_hwmon = {
.name = "s3c-hwmon",
.id = -1,
.dev.parent = &s3c_device_adc.dev,
};

/* SDI */

static struct resource s3c_sdi_resource[] = {
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/plat-samsung/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ config S3C_DEV_HSMMC2
help
Compile in platform device definitions for HSMMC channel 2

config S3C_DEV_HWMON
bool
help
Compile in platform device definitions for HWMON

config S3C_DEV_I2C1
bool
help
Expand Down
1 change: 1 addition & 0 deletions arch/arm/plat-samsung/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ obj-$(CONFIG_S3C_ADC) += adc.o
obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o
obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o
obj-$(CONFIG_S3C_DEV_HSMMC2) += dev-hsmmc2.o
obj-$(CONFIG_S3C_DEV_HWMON) += dev-hwmon.o
obj-y += dev-i2c0.o
obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o
obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o
Expand Down
42 changes: 42 additions & 0 deletions arch/arm/plat-samsung/dev-hwmon.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* linux/arch/arm/plat-samsung/dev-hwmon.c
*
* Copyright 2008 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
* http://armlinux.simtec.co.uk/
*
* Adapted for HWMON by Maurus Cuelenaere
*
* Samsung series device definition for HWMON
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#include <linux/kernel.h>
#include <linux/platform_device.h>

#include <plat/devs.h>
#include <plat/hwmon.h>

struct platform_device s3c_device_hwmon = {
.name = "s3c-hwmon",
.id = -1,
.dev.parent = &s3c_device_adc.dev,
};

void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd)
{
struct s3c_hwmon_pdata *npd;

if (!pd) {
printk(KERN_ERR "%s: no platform data\n", __func__);
return;
}

npd = kmemdup(pd, sizeof(struct s3c_hwmon_pdata), GFP_KERNEL);
if (!npd)
printk(KERN_ERR "%s: no memory for platform data\n", __func__);

s3c_device_hwmon.dev.platform_data = npd;
}
10 changes: 10 additions & 0 deletions arch/arm/plat-samsung/include/plat/hwmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,15 @@ struct s3c_hwmon_pdata {
struct s3c_hwmon_chcfg *in[8];
};

/**
* s3c_hwmon_set_platdata - Set platform data for S3C HWMON device
* @pd: Platform data to register to device.
*
* Register the given platform data for use with the S3C HWMON device.
* The call will copy the platform data, so the board definitions can
* make the structure itself __initdata.
*/
extern void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd);

#endif /* __ASM_ARCH_ADC_HWMON_H */

0 comments on commit 6cd82ff

Please sign in to comment.