mfd: Switch AB3100 to use MFD cells
This switches the AB3100 core driver to using MFD cells for subdevices instead of spawning common platform devices. Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
2524468ee5
commit
8c96aefbe7
@ -444,6 +444,7 @@ config ABX500_CORE
|
|||||||
config AB3100_CORE
|
config AB3100_CORE
|
||||||
bool "ST-Ericsson AB3100 Mixed Signal Circuit core functions"
|
bool "ST-Ericsson AB3100 Mixed Signal Circuit core functions"
|
||||||
depends on I2C=y && ABX500_CORE
|
depends on I2C=y && ABX500_CORE
|
||||||
|
select MFD_CORE
|
||||||
default y if ARCH_U300
|
default y if ARCH_U300
|
||||||
help
|
help
|
||||||
Select this to enable the AB3100 Mixed Signal IC core
|
Select this to enable the AB3100 Mixed Signal IC core
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
|
#include <linux/mfd/core.h>
|
||||||
#include <linux/mfd/abx500.h>
|
#include <linux/mfd/abx500.h>
|
||||||
|
|
||||||
/* These are the only registers inside AB3100 used in this main file */
|
/* 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,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ab3100_get_register_interruptible(struct ab3100 *ab3100,
|
static int ab3100_get_register_interruptible(struct ab3100 *ab3100,
|
||||||
u8 reg, u8 *regval)
|
u8 reg, u8 *regval)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@ -202,7 +203,7 @@ static int ab3100_get_register_interruptible(struct ab3100 *ab3100,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int get_register_interruptible(struct device *dev, u8 bank, u8 reg,
|
static int get_register_interruptible(struct device *dev, u8 bank, u8 reg,
|
||||||
u8 *value)
|
u8 *value)
|
||||||
{
|
{
|
||||||
struct ab3100 *ab3100 = dev_get_drvdata(dev->parent);
|
struct ab3100 *ab3100 = dev_get_drvdata(dev->parent);
|
||||||
|
|
||||||
@ -743,52 +744,64 @@ static int __devinit ab3100_setup(struct ab3100 *ab3100)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* The subdevices of the AB3100 */
|
||||||
* Here we define all the platform devices that appear
|
static struct mfd_cell ab3100_devs[] = {
|
||||||
* as children of the AB3100. These are regular platform
|
{
|
||||||
* devices with the IORESOURCE_IO .start and .end set
|
.name = "ab3100-dac",
|
||||||
* to correspond to the internal AB3100 register range
|
.id = -1,
|
||||||
* mapping to the corresponding subdevice.
|
},
|
||||||
*/
|
{
|
||||||
|
.name = "ab3100-leds",
|
||||||
#define AB3100_DEVICE(devname, devid) \
|
.id = -1,
|
||||||
static struct platform_device ab3100_##devname##_device = { \
|
},
|
||||||
.name = devid, \
|
{
|
||||||
.id = -1, \
|
.name = "ab3100-power",
|
||||||
}
|
.id = -1,
|
||||||
|
},
|
||||||
/* This lists all the subdevices */
|
{
|
||||||
AB3100_DEVICE(dac, "ab3100-dac");
|
.name = "ab3100-regulators",
|
||||||
AB3100_DEVICE(leds, "ab3100-leds");
|
.id = -1,
|
||||||
AB3100_DEVICE(power, "ab3100-power");
|
},
|
||||||
AB3100_DEVICE(regulators, "ab3100-regulators");
|
{
|
||||||
AB3100_DEVICE(sim, "ab3100-sim");
|
.name = "ab3100-sim",
|
||||||
AB3100_DEVICE(uart, "ab3100-uart");
|
.id = -1,
|
||||||
AB3100_DEVICE(rtc, "ab3100-rtc");
|
},
|
||||||
AB3100_DEVICE(charger, "ab3100-charger");
|
{
|
||||||
AB3100_DEVICE(boost, "ab3100-boost");
|
.name = "ab3100-uart",
|
||||||
AB3100_DEVICE(adc, "ab3100-adc");
|
.id = -1,
|
||||||
AB3100_DEVICE(fuelgauge, "ab3100-fuelgauge");
|
},
|
||||||
AB3100_DEVICE(vibrator, "ab3100-vibrator");
|
{
|
||||||
AB3100_DEVICE(otp, "ab3100-otp");
|
.name = "ab3100-rtc",
|
||||||
AB3100_DEVICE(codec, "ab3100-codec");
|
.id = -1,
|
||||||
|
},
|
||||||
static struct platform_device *
|
{
|
||||||
ab3100_platform_devs[] = {
|
.name = "ab3100-charger",
|
||||||
&ab3100_dac_device,
|
.id = -1,
|
||||||
&ab3100_leds_device,
|
},
|
||||||
&ab3100_power_device,
|
{
|
||||||
&ab3100_regulators_device,
|
.name = "ab3100-boost",
|
||||||
&ab3100_sim_device,
|
.id = -1,
|
||||||
&ab3100_uart_device,
|
},
|
||||||
&ab3100_rtc_device,
|
{
|
||||||
&ab3100_charger_device,
|
.name = "ab3100-adc",
|
||||||
&ab3100_boost_device,
|
.id = -1,
|
||||||
&ab3100_adc_device,
|
},
|
||||||
&ab3100_fuelgauge_device,
|
{
|
||||||
&ab3100_vibrator_device,
|
.name = "ab3100-fuelgauge",
|
||||||
&ab3100_otp_device,
|
.id = -1,
|
||||||
&ab3100_codec_device,
|
},
|
||||||
|
{
|
||||||
|
.name = "ab3100-vibrator",
|
||||||
|
.id = -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "ab3100-otp",
|
||||||
|
.id = -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "ab3100-codec",
|
||||||
|
.id = -1,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ab_family_id {
|
struct ab_family_id {
|
||||||
@ -935,18 +948,14 @@ static int __devinit ab3100_probe(struct i2c_client *client,
|
|||||||
if (err)
|
if (err)
|
||||||
goto exit_no_ops;
|
goto exit_no_ops;
|
||||||
|
|
||||||
/* Set parent and a pointer back to the container in device data */
|
/* Set up and register the platform devices. */
|
||||||
for (i = 0; i < ARRAY_SIZE(ab3100_platform_devs); i++) {
|
for (i = 0; i < ARRAY_SIZE(ab3100_devs); i++) {
|
||||||
ab3100_platform_devs[i]->dev.parent =
|
ab3100_devs[i].platform_data = ab3100_plf_data;
|
||||||
&client->dev;
|
ab3100_devs[i].data_size = sizeof(struct ab3100_platform_data);
|
||||||
ab3100_platform_devs[i]->dev.platform_data =
|
|
||||||
ab3100_plf_data;
|
|
||||||
platform_set_drvdata(ab3100_platform_devs[i], ab3100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register the platform devices */
|
err = mfd_add_devices(&client->dev, 0, ab3100_devs,
|
||||||
platform_add_devices(ab3100_platform_devs,
|
ARRAY_SIZE(ab3100_devs), NULL, 0);
|
||||||
ARRAY_SIZE(ab3100_platform_devs));
|
|
||||||
|
|
||||||
ab3100_setup_debugfs(ab3100);
|
ab3100_setup_debugfs(ab3100);
|
||||||
|
|
||||||
@ -965,11 +974,9 @@ static int __devinit ab3100_probe(struct i2c_client *client,
|
|||||||
static int __devexit ab3100_remove(struct i2c_client *client)
|
static int __devexit ab3100_remove(struct i2c_client *client)
|
||||||
{
|
{
|
||||||
struct ab3100 *ab3100 = i2c_get_clientdata(client);
|
struct ab3100 *ab3100 = i2c_get_clientdata(client);
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Unregister subdevices */
|
/* Unregister subdevices */
|
||||||
for (i = 0; i < ARRAY_SIZE(ab3100_platform_devs); i++)
|
mfd_remove_devices(&client->dev);
|
||||||
platform_device_unregister(ab3100_platform_devs[i]);
|
|
||||||
|
|
||||||
ab3100_remove_debugfs();
|
ab3100_remove_debugfs();
|
||||||
i2c_unregister_device(ab3100->testreg_client);
|
i2c_unregister_device(ab3100->testreg_client);
|
||||||
|
Loading…
Reference in New Issue
Block a user