diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 18:54:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 18:54:04 -0400 |
commit | b779b332d0e1ef68f40867948ae5526a3e925163 (patch) | |
tree | d2fc8bb455d696fbdb288055ce0a4f0cfcee31fd /drivers/mfd/ab3100-core.c | |
parent | a0cadc2777a71b1fde62e6417284b38e52128e88 (diff) | |
parent | 0f48285755991b73c14b6eeeee464590f490ac25 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (73 commits)
power: Revert "power_supply: Mark twl4030_charger as broken"
mfd: Fix a memory leak when unload mc13xxx-core module
mfd: Fix resource reclaim for max8998
mfd: Remove unneeded ret value checking for max8998 register updates
mfd: Add free max8998->ono irq in max8998_irq_exit()
mfd: Fix resource reclaim in pcf50633_remove()
omap4: pandaboard: fix up mmc card detect logic
mfd: Fix ezx_pcap_probe error path
mfd: Fix off-by-one value range checking for tps6507x
mfd: Remove __devinitdata from tc6393xb_mmc_resources
mfd: Add WM831x SPI support
mfd: Factor out WM831x I2C I/O from the core driver
mfd: Remove DEBUG defines from mc13xxx-core
mfd: Fix jz4740_adc_set_enabled
mfd: Add TPS658621C device ID
mfd: Fix twl-irq function declaration warnings
regulator: max8998 BUCK1/2 voltage change with use of GPIOs
mfd: Voltages and GPIOs platform_data definitions for max8998
regulator: max8998 BUCK1/2 internal voltages and indexes defined
mfd: Support for ICs compliant with max8998
...
Diffstat (limited to 'drivers/mfd/ab3100-core.c')
-rw-r--r-- | drivers/mfd/ab3100-core.c | 143 |
1 files changed, 75 insertions, 68 deletions
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c index b048ecc56db9..4193af5f2743 100644 --- a/drivers/mfd/ab3100-core.c +++ b/drivers/mfd/ab3100-core.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/debugfs.h> | 19 | #include <linux/debugfs.h> |
20 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
21 | #include <linux/uaccess.h> | 21 | #include <linux/uaccess.h> |
22 | #include <linux/mfd/core.h> | ||
22 | #include <linux/mfd/abx500.h> | 23 | #include <linux/mfd/abx500.h> |
23 | 24 | ||
24 | /* These are the only registers inside AB3100 used in this main file */ | 25 | /* These are the only registers inside AB3100 used in this main file */ |
@@ -146,7 +147,7 @@ static int ab3100_set_test_register_interruptible(struct ab3100 *ab3100, | |||
146 | } | 147 | } |
147 | 148 | ||
148 | static int ab3100_get_register_interruptible(struct ab3100 *ab3100, | 149 | static int ab3100_get_register_interruptible(struct ab3100 *ab3100, |
149 | u8 reg, u8 *regval) | 150 | u8 reg, u8 *regval) |
150 | { | 151 | { |
151 | int err; | 152 | int err; |
152 | 153 | ||
@@ -202,7 +203,7 @@ static int ab3100_get_register_interruptible(struct ab3100 *ab3100, | |||
202 | } | 203 | } |
203 | 204 | ||
204 | static int get_register_interruptible(struct device *dev, u8 bank, u8 reg, | 205 | static int get_register_interruptible(struct device *dev, u8 bank, u8 reg, |
205 | u8 *value) | 206 | u8 *value) |
206 | { | 207 | { |
207 | struct ab3100 *ab3100 = dev_get_drvdata(dev->parent); | 208 | struct ab3100 *ab3100 = dev_get_drvdata(dev->parent); |
208 | 209 | ||
@@ -666,7 +667,7 @@ struct ab3100_init_setting { | |||
666 | u8 setting; | 667 | u8 setting; |
667 | }; | 668 | }; |
668 | 669 | ||
669 | static const struct ab3100_init_setting __initconst | 670 | static const struct ab3100_init_setting __devinitconst |
670 | ab3100_init_settings[] = { | 671 | ab3100_init_settings[] = { |
671 | { | 672 | { |
672 | .abreg = AB3100_MCA, | 673 | .abreg = AB3100_MCA, |
@@ -713,7 +714,7 @@ ab3100_init_settings[] = { | |||
713 | }, | 714 | }, |
714 | }; | 715 | }; |
715 | 716 | ||
716 | static int __init ab3100_setup(struct ab3100 *ab3100) | 717 | static int __devinit ab3100_setup(struct ab3100 *ab3100) |
717 | { | 718 | { |
718 | int err = 0; | 719 | int err = 0; |
719 | int i; | 720 | int i; |
@@ -743,52 +744,64 @@ static int __init ab3100_setup(struct ab3100 *ab3100) | |||
743 | return err; | 744 | return err; |
744 | } | 745 | } |
745 | 746 | ||
746 | /* | 747 | /* The subdevices of the AB3100 */ |
747 | * Here we define all the platform devices that appear | 748 | static struct mfd_cell ab3100_devs[] = { |
748 | * as children of the AB3100. These are regular platform | 749 | { |
749 | * devices with the IORESOURCE_IO .start and .end set | 750 | .name = "ab3100-dac", |
750 | * to correspond to the internal AB3100 register range | 751 | .id = -1, |
751 | * mapping to the corresponding subdevice. | 752 | }, |
752 | */ | 753 | { |
753 | 754 | .name = "ab3100-leds", | |
754 | #define AB3100_DEVICE(devname, devid) \ | 755 | .id = -1, |
755 | static struct platform_device ab3100_##devname##_device = { \ | 756 | }, |
756 | .name = devid, \ | 757 | { |
757 | .id = -1, \ | 758 | .name = "ab3100-power", |
758 | } | 759 | .id = -1, |
759 | 760 | }, | |
760 | /* This lists all the subdevices */ | 761 | { |
761 | AB3100_DEVICE(dac, "ab3100-dac"); | 762 | .name = "ab3100-regulators", |
762 | AB3100_DEVICE(leds, "ab3100-leds"); | 763 | .id = -1, |
763 | AB3100_DEVICE(power, "ab3100-power"); | 764 | }, |
764 | AB3100_DEVICE(regulators, "ab3100-regulators"); | 765 | { |
765 | AB3100_DEVICE(sim, "ab3100-sim"); | 766 | .name = "ab3100-sim", |
766 | AB3100_DEVICE(uart, "ab3100-uart"); | 767 | .id = -1, |
767 | AB3100_DEVICE(rtc, "ab3100-rtc"); | 768 | }, |
768 | AB3100_DEVICE(charger, "ab3100-charger"); | 769 | { |
769 | AB3100_DEVICE(boost, "ab3100-boost"); | 770 | .name = "ab3100-uart", |
770 | AB3100_DEVICE(adc, "ab3100-adc"); | 771 | .id = -1, |
771 | AB3100_DEVICE(fuelgauge, "ab3100-fuelgauge"); | 772 | }, |
772 | AB3100_DEVICE(vibrator, "ab3100-vibrator"); | 773 | { |
773 | AB3100_DEVICE(otp, "ab3100-otp"); | 774 | .name = "ab3100-rtc", |
774 | AB3100_DEVICE(codec, "ab3100-codec"); | 775 | .id = -1, |
775 | 776 | }, | |
776 | static struct platform_device * | 777 | { |
777 | ab3100_platform_devs[] = { | 778 | .name = "ab3100-charger", |
778 | &ab3100_dac_device, | 779 | .id = -1, |
779 | &ab3100_leds_device, | 780 | }, |
780 | &ab3100_power_device, | 781 | { |
781 | &ab3100_regulators_device, | 782 | .name = "ab3100-boost", |
782 | &ab3100_sim_device, | 783 | .id = -1, |
783 | &ab3100_uart_device, | 784 | }, |
784 | &ab3100_rtc_device, | 785 | { |
785 | &ab3100_charger_device, | 786 | .name = "ab3100-adc", |
786 | &ab3100_boost_device, | 787 | .id = -1, |
787 | &ab3100_adc_device, | 788 | }, |
788 | &ab3100_fuelgauge_device, | 789 | { |
789 | &ab3100_vibrator_device, | 790 | .name = "ab3100-fuelgauge", |
790 | &ab3100_otp_device, | 791 | .id = -1, |
791 | &ab3100_codec_device, | 792 | }, |
793 | { | ||
794 | .name = "ab3100-vibrator", | ||
795 | .id = -1, | ||
796 | }, | ||
797 | { | ||
798 | .name = "ab3100-otp", | ||
799 | .id = -1, | ||
800 | }, | ||
801 | { | ||
802 | .name = "ab3100-codec", | ||
803 | .id = -1, | ||
804 | }, | ||
792 | }; | 805 | }; |
793 | 806 | ||
794 | struct ab_family_id { | 807 | struct ab_family_id { |
@@ -796,7 +809,7 @@ struct ab_family_id { | |||
796 | char *name; | 809 | char *name; |
797 | }; | 810 | }; |
798 | 811 | ||
799 | static const struct ab_family_id ids[] __initdata = { | 812 | static const struct ab_family_id ids[] __devinitdata = { |
800 | /* AB3100 */ | 813 | /* AB3100 */ |
801 | { | 814 | { |
802 | .id = 0xc0, | 815 | .id = 0xc0, |
@@ -850,8 +863,8 @@ static const struct ab_family_id ids[] __initdata = { | |||
850 | }, | 863 | }, |
851 | }; | 864 | }; |
852 | 865 | ||
853 | static int __init ab3100_probe(struct i2c_client *client, | 866 | static int __devinit ab3100_probe(struct i2c_client *client, |
854 | const struct i2c_device_id *id) | 867 | const struct i2c_device_id *id) |
855 | { | 868 | { |
856 | struct ab3100 *ab3100; | 869 | struct ab3100 *ab3100; |
857 | struct ab3100_platform_data *ab3100_plf_data = | 870 | struct ab3100_platform_data *ab3100_plf_data = |
@@ -935,18 +948,14 @@ static int __init ab3100_probe(struct i2c_client *client, | |||
935 | if (err) | 948 | if (err) |
936 | goto exit_no_ops; | 949 | goto exit_no_ops; |
937 | 950 | ||
938 | /* Set parent and a pointer back to the container in device data */ | 951 | /* Set up and register the platform devices. */ |
939 | for (i = 0; i < ARRAY_SIZE(ab3100_platform_devs); i++) { | 952 | for (i = 0; i < ARRAY_SIZE(ab3100_devs); i++) { |
940 | ab3100_platform_devs[i]->dev.parent = | 953 | ab3100_devs[i].platform_data = ab3100_plf_data; |
941 | &client->dev; | 954 | ab3100_devs[i].data_size = sizeof(struct ab3100_platform_data); |
942 | ab3100_platform_devs[i]->dev.platform_data = | ||
943 | ab3100_plf_data; | ||
944 | platform_set_drvdata(ab3100_platform_devs[i], ab3100); | ||
945 | } | 955 | } |
946 | 956 | ||
947 | /* Register the platform devices */ | 957 | err = mfd_add_devices(&client->dev, 0, ab3100_devs, |
948 | platform_add_devices(ab3100_platform_devs, | 958 | ARRAY_SIZE(ab3100_devs), NULL, 0); |
949 | ARRAY_SIZE(ab3100_platform_devs)); | ||
950 | 959 | ||
951 | ab3100_setup_debugfs(ab3100); | 960 | ab3100_setup_debugfs(ab3100); |
952 | 961 | ||
@@ -962,14 +971,12 @@ static int __init ab3100_probe(struct i2c_client *client, | |||
962 | return err; | 971 | return err; |
963 | } | 972 | } |
964 | 973 | ||
965 | static int __exit ab3100_remove(struct i2c_client *client) | 974 | static int __devexit ab3100_remove(struct i2c_client *client) |
966 | { | 975 | { |
967 | struct ab3100 *ab3100 = i2c_get_clientdata(client); | 976 | struct ab3100 *ab3100 = i2c_get_clientdata(client); |
968 | int i; | ||
969 | 977 | ||
970 | /* Unregister subdevices */ | 978 | /* Unregister subdevices */ |
971 | for (i = 0; i < ARRAY_SIZE(ab3100_platform_devs); i++) | 979 | mfd_remove_devices(&client->dev); |
972 | platform_device_unregister(ab3100_platform_devs[i]); | ||
973 | 980 | ||
974 | ab3100_remove_debugfs(); | 981 | ab3100_remove_debugfs(); |
975 | i2c_unregister_device(ab3100->testreg_client); | 982 | i2c_unregister_device(ab3100->testreg_client); |
@@ -996,7 +1003,7 @@ static struct i2c_driver ab3100_driver = { | |||
996 | }, | 1003 | }, |
997 | .id_table = ab3100_id, | 1004 | .id_table = ab3100_id, |
998 | .probe = ab3100_probe, | 1005 | .probe = ab3100_probe, |
999 | .remove = __exit_p(ab3100_remove), | 1006 | .remove = __devexit_p(ab3100_remove), |
1000 | }; | 1007 | }; |
1001 | 1008 | ||
1002 | static int __init ab3100_i2c_init(void) | 1009 | static int __init ab3100_i2c_init(void) |