// SPDX-License-Identifier: GPL-2.0-only /* * Core driver for STw4810/STw4811 * * Copyright (C) 2013 ST-Ericsson SA * Written on behalf of Linaro for ST-Ericsson * * Author: Linus Walleij <[email protected]> */ #include <linux/err.h> #include <linux/i2c.h> #include <linux/init.h> #include <linux/mfd/core.h> #include <linux/mfd/stw481x.h> #include <linux/module.h> #include <linux/regmap.h> #include <linux/spinlock.h> #include <linux/slab.h> /* * This driver can only access the non-USB portions of STw4811, the register * range 0x00-0x10 dealing with USB is bound to the two special I2C pins used * for USB control. */ /* Registers inside the power control address space */ #define STW_PC_VCORE_SEL … #define STW_PC_VAUX_SEL … #define STW_PC_VPLL_SEL … /** * stw481x_get_pctl_reg() - get a power control register * @stw481x: handle to the stw481x chip * @reg: power control register to fetch * * The power control registers is a set of one-time-programmable registers * in its own register space, accessed by writing addess bits to these * two registers: bits 7,6,5 of PCTL_REG_LO corresponds to the 3 LSBs of * the address and bits 8,9 of PCTL_REG_HI corresponds to the 2 MSBs of * the address, forming an address space of 5 bits, i.e. 32 registers * 0x00 ... 0x1f can be obtained. */ static int stw481x_get_pctl_reg(struct stw481x *stw481x, u8 reg) { … } static int stw481x_startup(struct stw481x *stw481x) { … } /* * MFD cells - we have one cell which is selected operation * mode, and we always have a GPIO cell. */ static struct mfd_cell stw481x_cells[] = …; static const struct regmap_config stw481x_regmap_config = …; static int stw481x_probe(struct i2c_client *client) { … } /* * This ID table is completely unused, as this is a pure * device-tree probed driver, but it has to be here due to * the structure of the I2C core. */ static const struct i2c_device_id stw481x_id[] = …; MODULE_DEVICE_TABLE(i2c, stw481x_id); static const struct of_device_id stw481x_match[] = …; MODULE_DEVICE_TABLE(of, stw481x_match); static struct i2c_driver stw481x_driver = …; module_i2c_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;