···791791 lines on the SM501. The platform data is used to supply the792792 base number for the first GPIO line to register.793793794794+config MFD_SKY81452795795+ tristate "Skyworks Solutions SKY81452"796796+ select MFD_CORE797797+ select REGMAP_I2C798798+ depends on I2C799799+ help800800+ This is the core driver for the Skyworks SKY81452 backlight and801801+ voltage regulator device.802802+803803+ This driver can also be built as a module. If so, the module804804+ will be called sky81452.805805+794806config MFD_SMSC795807 bool "SMSC ECE1099 series chips"796808 depends on I2C=y
···11+/*22+ * sky81452.c SKY81452 MFD driver33+ *44+ * Copyright 2014 Skyworks Solutions Inc.55+ * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>66+ *77+ * This program is free software; you can redistribute it and/or modify it88+ * under the terms of the GNU General Public License version 299+ * as published by the Free Software Foundation.1010+ *1111+ * This program is distributed in the hope that it will be useful, but1212+ * WITHOUT ANY WARRANTY; without even the implied warranty of1313+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1414+ * General Public License for more details.1515+ *1616+ * You should have received a copy of the GNU General Public License along1717+ * with this program; if not, see <http://www.gnu.org/licenses/>.1818+ */1919+2020+#include <linux/kernel.h>2121+#include <linux/module.h>2222+#include <linux/init.h>2323+#include <linux/err.h>2424+#include <linux/slab.h>2525+#include <linux/i2c.h>2626+#include <linux/regmap.h>2727+#include <linux/mfd/core.h>2828+#include <linux/mfd/sky81452.h>2929+3030+static const struct regmap_config sky81452_config = {3131+ .reg_bits = 8,3232+ .val_bits = 8,3333+};3434+3535+static int sky81452_probe(struct i2c_client *client,3636+ const struct i2c_device_id *id)3737+{3838+ struct device *dev = &client->dev;3939+ const struct sky81452_platform_data *pdata = dev_get_platdata(dev);4040+ struct mfd_cell cells[2];4141+ struct regmap *regmap;4242+ int ret;4343+4444+ if (!pdata) {4545+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);4646+ if (!pdata)4747+ return -ENOMEM;4848+ }4949+5050+ regmap = devm_regmap_init_i2c(client, &sky81452_config);5151+ if (IS_ERR(regmap)) {5252+ dev_err(dev, "failed to initialize.err=%ld\n", PTR_ERR(regmap));5353+ return PTR_ERR(regmap);5454+ }5555+5656+ i2c_set_clientdata(client, regmap);5757+5858+ memset(cells, 0, sizeof(cells));5959+ cells[0].name = "sky81452-backlight";6060+ cells[0].of_compatible = "skyworks,sky81452-backlight";6161+ cells[0].platform_data = pdata->bl_pdata;6262+ cells[0].pdata_size = sizeof(*pdata->bl_pdata);6363+ cells[1].name = "sky81452-regulator";6464+ cells[1].platform_data = pdata->regulator_init_data;6565+ cells[1].pdata_size = sizeof(*pdata->regulator_init_data);6666+6767+ ret = mfd_add_devices(dev, -1, cells, ARRAY_SIZE(cells), NULL, 0, NULL);6868+ if (ret)6969+ dev_err(dev, "failed to add child devices. err=%d\n", ret);7070+7171+ return ret;7272+}7373+7474+static int sky81452_remove(struct i2c_client *client)7575+{7676+ mfd_remove_devices(&client->dev);7777+ return 0;7878+}7979+8080+static const struct i2c_device_id sky81452_ids[] = {8181+ { "sky81452" },8282+ { }8383+};8484+MODULE_DEVICE_TABLE(i2c, sky81452_ids);8585+8686+#ifdef CONFIG_OF8787+static const struct of_device_id sky81452_of_match[] = {8888+ { .compatible = "skyworks,sky81452", },8989+ { }9090+};9191+MODULE_DEVICE_TABLE(of, sky81452_of_match);9292+#endif9393+9494+static struct i2c_driver sky81452_driver = {9595+ .driver = {9696+ .name = "sky81452",9797+ .of_match_table = of_match_ptr(sky81452_of_match),9898+ },9999+ .probe = sky81452_probe,100100+ .remove = sky81452_remove,101101+ .id_table = sky81452_ids,102102+};103103+104104+module_i2c_driver(sky81452_driver);105105+106106+MODULE_DESCRIPTION("Skyworks SKY81452 MFD driver");107107+MODULE_AUTHOR("Gyungoh Yoo <jack.yoo@skyworksinc.com>");108108+MODULE_LICENSE("GPL v2");
+31
include/linux/mfd/sky81452.h
···11+/*22+ * sky81452.h SKY81452 MFD driver33+ *44+ * Copyright 2014 Skyworks Solutions Inc.55+ * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>66+ *77+ * This program is free software; you can redistribute it and/or modify it88+ * under the terms of the GNU General Public License version 299+ * as published by the Free Software Foundation.1010+ *1111+ * This program is distributed in the hope that it will be useful, but1212+ * WITHOUT ANY WARRANTY; without even the implied warranty of1313+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1414+ * General Public License for more details.1515+ *1616+ * You should have received a copy of the GNU General Public License along1717+ * with this program; if not, see <http://www.gnu.org/licenses/>.1818+ */1919+2020+#ifndef _SKY81452_H2121+#define _SKY81452_H2222+2323+#include <linux/platform_data/sky81452-backlight.h>2424+#include <linux/regulator/machine.h>2525+2626+struct sky81452_platform_data {2727+ struct sky81452_bl_platform_data *bl_pdata;2828+ struct regulator_init_data *regulator_init_data;2929+};3030+3131+#endif