Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: Add MFD driver for ATC260x PMICs

Add initial support for the Actions Semi ATC260x PMICs which integrates
Audio Codec, Power management, Clock generation and GPIO controller
blocks.

For the moment this driver only supports Regulator, Poweroff and Onkey
functionalities for the ATC2603C and ATC2609A chip variants.

Since the PMICs can be accessed using both I2C and SPI buses, the
following driver structure has been adopted:

-----> atc260x-core.c (Implements core functionalities)
/
ATC260x --------> atc260x-i2c.c (Implements I2C interface)
\
-----> atc260x-spi.c (Implements SPI interface - TODO)

Co-developed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Cristian Ciocaltea and committed by
Lee Jones
f7cb7fe3 cf469562

+1042
+18
drivers/mfd/Kconfig
··· 2055 2055 This driver provides common support WCD934x audio codec and its 2056 2056 associated Pin Controller, Soundwire Controller and Audio codec. 2057 2057 2058 + config MFD_ATC260X 2059 + tristate 2060 + select MFD_CORE 2061 + select REGMAP 2062 + select REGMAP_IRQ 2063 + 2064 + config MFD_ATC260X_I2C 2065 + tristate "Actions Semi ATC260x PMICs with I2C" 2066 + select MFD_ATC260X 2067 + select REGMAP_I2C 2068 + depends on I2C 2069 + help 2070 + Support for the Actions Semi ATC260x PMICs controlled via I2C. 2071 + 2072 + This driver provides common support for accessing the ATC2603C 2073 + and ATC2609A chip variants, additional drivers must be enabled 2074 + in order to use the functionality of the device. 2075 + 2058 2076 config MFD_KHADAS_MCU 2059 2077 tristate "Support for Khadas System control Microcontroller" 2060 2078 depends on I2C
+3
drivers/mfd/Makefile
··· 268 268 obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o 269 269 obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o 270 270 obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o 271 + 272 + obj-$(CONFIG_MFD_ATC260X) += atc260x-core.o 273 + obj-$(CONFIG_MFD_ATC260X_I2C) += atc260x-i2c.o
+310
drivers/mfd/atc260x-core.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Core support for ATC260x PMICs 4 + * 5 + * Copyright (C) 2019 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> 6 + * Copyright (C) 2020 Cristian Ciocaltea <cristian.ciocaltea@gmail.com> 7 + */ 8 + 9 + #include <linux/interrupt.h> 10 + #include <linux/mfd/atc260x/core.h> 11 + #include <linux/mfd/core.h> 12 + #include <linux/module.h> 13 + #include <linux/of.h> 14 + #include <linux/of_device.h> 15 + #include <linux/regmap.h> 16 + 17 + #define ATC260X_CHIP_REV_MAX 31 18 + 19 + struct atc260x_init_regs { 20 + unsigned int cmu_devrst; 21 + unsigned int cmu_devrst_ints; 22 + unsigned int ints_msk; 23 + unsigned int pad_en; 24 + unsigned int pad_en_extirq; 25 + }; 26 + 27 + static void regmap_lock_mutex(void *__mutex) 28 + { 29 + struct mutex *mutex = __mutex; 30 + 31 + /* 32 + * Using regmap within an atomic context (e.g. accessing a PMIC when 33 + * powering system down) is normally allowed only if the regmap type 34 + * is MMIO and the regcache type is either REGCACHE_NONE or 35 + * REGCACHE_FLAT. For slow buses like I2C and SPI, the regmap is 36 + * internally protected by a mutex which is acquired non-atomically. 37 + * 38 + * Let's improve this by using a customized locking scheme inspired 39 + * from I2C atomic transfer. See i2c_in_atomic_xfer_mode() for a 40 + * starting point. 41 + */ 42 + if (system_state > SYSTEM_RUNNING && irqs_disabled()) 43 + mutex_trylock(mutex); 44 + else 45 + mutex_lock(mutex); 46 + } 47 + 48 + static void regmap_unlock_mutex(void *__mutex) 49 + { 50 + struct mutex *mutex = __mutex; 51 + 52 + mutex_unlock(mutex); 53 + } 54 + 55 + static const struct regmap_config atc2603c_regmap_config = { 56 + .reg_bits = 8, 57 + .val_bits = 16, 58 + .max_register = ATC2603C_SADDR, 59 + .cache_type = REGCACHE_NONE, 60 + }; 61 + 62 + static const struct regmap_config atc2609a_regmap_config = { 63 + .reg_bits = 8, 64 + .val_bits = 16, 65 + .max_register = ATC2609A_SADDR, 66 + .cache_type = REGCACHE_NONE, 67 + }; 68 + 69 + static const struct regmap_irq atc2603c_regmap_irqs[] = { 70 + REGMAP_IRQ_REG(ATC2603C_IRQ_AUDIO, 0, ATC2603C_INTS_MSK_AUDIO), 71 + REGMAP_IRQ_REG(ATC2603C_IRQ_OV, 0, ATC2603C_INTS_MSK_OV), 72 + REGMAP_IRQ_REG(ATC2603C_IRQ_OC, 0, ATC2603C_INTS_MSK_OC), 73 + REGMAP_IRQ_REG(ATC2603C_IRQ_OT, 0, ATC2603C_INTS_MSK_OT), 74 + REGMAP_IRQ_REG(ATC2603C_IRQ_UV, 0, ATC2603C_INTS_MSK_UV), 75 + REGMAP_IRQ_REG(ATC2603C_IRQ_ALARM, 0, ATC2603C_INTS_MSK_ALARM), 76 + REGMAP_IRQ_REG(ATC2603C_IRQ_ONOFF, 0, ATC2603C_INTS_MSK_ONOFF), 77 + REGMAP_IRQ_REG(ATC2603C_IRQ_SGPIO, 0, ATC2603C_INTS_MSK_SGPIO), 78 + REGMAP_IRQ_REG(ATC2603C_IRQ_IR, 0, ATC2603C_INTS_MSK_IR), 79 + REGMAP_IRQ_REG(ATC2603C_IRQ_REMCON, 0, ATC2603C_INTS_MSK_REMCON), 80 + REGMAP_IRQ_REG(ATC2603C_IRQ_POWER_IN, 0, ATC2603C_INTS_MSK_POWERIN), 81 + }; 82 + 83 + static const struct regmap_irq atc2609a_regmap_irqs[] = { 84 + REGMAP_IRQ_REG(ATC2609A_IRQ_AUDIO, 0, ATC2609A_INTS_MSK_AUDIO), 85 + REGMAP_IRQ_REG(ATC2609A_IRQ_OV, 0, ATC2609A_INTS_MSK_OV), 86 + REGMAP_IRQ_REG(ATC2609A_IRQ_OC, 0, ATC2609A_INTS_MSK_OC), 87 + REGMAP_IRQ_REG(ATC2609A_IRQ_OT, 0, ATC2609A_INTS_MSK_OT), 88 + REGMAP_IRQ_REG(ATC2609A_IRQ_UV, 0, ATC2609A_INTS_MSK_UV), 89 + REGMAP_IRQ_REG(ATC2609A_IRQ_ALARM, 0, ATC2609A_INTS_MSK_ALARM), 90 + REGMAP_IRQ_REG(ATC2609A_IRQ_ONOFF, 0, ATC2609A_INTS_MSK_ONOFF), 91 + REGMAP_IRQ_REG(ATC2609A_IRQ_WKUP, 0, ATC2609A_INTS_MSK_WKUP), 92 + REGMAP_IRQ_REG(ATC2609A_IRQ_IR, 0, ATC2609A_INTS_MSK_IR), 93 + REGMAP_IRQ_REG(ATC2609A_IRQ_REMCON, 0, ATC2609A_INTS_MSK_REMCON), 94 + REGMAP_IRQ_REG(ATC2609A_IRQ_POWER_IN, 0, ATC2609A_INTS_MSK_POWERIN), 95 + }; 96 + 97 + static const struct regmap_irq_chip atc2603c_regmap_irq_chip = { 98 + .name = "atc2603c", 99 + .irqs = atc2603c_regmap_irqs, 100 + .num_irqs = ARRAY_SIZE(atc2603c_regmap_irqs), 101 + .num_regs = 1, 102 + .status_base = ATC2603C_INTS_PD, 103 + .mask_base = ATC2603C_INTS_MSK, 104 + .mask_invert = true, 105 + }; 106 + 107 + static const struct regmap_irq_chip atc2609a_regmap_irq_chip = { 108 + .name = "atc2609a", 109 + .irqs = atc2609a_regmap_irqs, 110 + .num_irqs = ARRAY_SIZE(atc2609a_regmap_irqs), 111 + .num_regs = 1, 112 + .status_base = ATC2609A_INTS_PD, 113 + .mask_base = ATC2609A_INTS_MSK, 114 + .mask_invert = true, 115 + }; 116 + 117 + static const struct resource atc2603c_onkey_resources[] = { 118 + DEFINE_RES_IRQ(ATC2603C_IRQ_ONOFF), 119 + }; 120 + 121 + static const struct resource atc2609a_onkey_resources[] = { 122 + DEFINE_RES_IRQ(ATC2609A_IRQ_ONOFF), 123 + }; 124 + 125 + static const struct mfd_cell atc2603c_mfd_cells[] = { 126 + { .name = "atc260x-regulator" }, 127 + { .name = "atc260x-pwrc" }, 128 + { 129 + .name = "atc260x-onkey", 130 + .num_resources = ARRAY_SIZE(atc2603c_onkey_resources), 131 + .resources = atc2603c_onkey_resources, 132 + }, 133 + }; 134 + 135 + static const struct mfd_cell atc2609a_mfd_cells[] = { 136 + { .name = "atc260x-regulator" }, 137 + { .name = "atc260x-pwrc" }, 138 + { 139 + .name = "atc260x-onkey", 140 + .num_resources = ARRAY_SIZE(atc2609a_onkey_resources), 141 + .resources = atc2609a_onkey_resources, 142 + }, 143 + }; 144 + 145 + static const struct atc260x_init_regs atc2603c_init_regs = { 146 + .cmu_devrst = ATC2603C_CMU_DEVRST, 147 + .cmu_devrst_ints = ATC2603C_CMU_DEVRST_INTS, 148 + .ints_msk = ATC2603C_INTS_MSK, 149 + .pad_en = ATC2603C_PAD_EN, 150 + .pad_en_extirq = ATC2603C_PAD_EN_EXTIRQ, 151 + }; 152 + 153 + static const struct atc260x_init_regs atc2609a_init_regs = { 154 + .cmu_devrst = ATC2609A_CMU_DEVRST, 155 + .cmu_devrst_ints = ATC2609A_CMU_DEVRST_INTS, 156 + .ints_msk = ATC2609A_INTS_MSK, 157 + .pad_en = ATC2609A_PAD_EN, 158 + .pad_en_extirq = ATC2609A_PAD_EN_EXTIRQ, 159 + }; 160 + 161 + static void atc260x_cmu_reset(struct atc260x *atc260x) 162 + { 163 + const struct atc260x_init_regs *regs = atc260x->init_regs; 164 + 165 + /* Assert reset */ 166 + regmap_update_bits(atc260x->regmap, regs->cmu_devrst, 167 + regs->cmu_devrst_ints, ~regs->cmu_devrst_ints); 168 + 169 + /* De-assert reset */ 170 + regmap_update_bits(atc260x->regmap, regs->cmu_devrst, 171 + regs->cmu_devrst_ints, regs->cmu_devrst_ints); 172 + } 173 + 174 + static void atc260x_dev_init(struct atc260x *atc260x) 175 + { 176 + const struct atc260x_init_regs *regs = atc260x->init_regs; 177 + 178 + /* Initialize interrupt block */ 179 + atc260x_cmu_reset(atc260x); 180 + 181 + /* Disable all interrupt sources */ 182 + regmap_write(atc260x->regmap, regs->ints_msk, 0); 183 + 184 + /* Enable EXTIRQ pad */ 185 + regmap_update_bits(atc260x->regmap, regs->pad_en, 186 + regs->pad_en_extirq, regs->pad_en_extirq); 187 + } 188 + 189 + /** 190 + * atc260x_match_device(): Setup ATC260x variant related fields 191 + * 192 + * @atc260x: ATC260x device to setup (.dev field must be set) 193 + * @regmap_cfg: regmap config associated with this ATC260x device 194 + * 195 + * This lets the ATC260x core configure the MFD cells and register maps 196 + * for later use. 197 + */ 198 + int atc260x_match_device(struct atc260x *atc260x, struct regmap_config *regmap_cfg) 199 + { 200 + struct device *dev = atc260x->dev; 201 + const void *of_data; 202 + 203 + of_data = of_device_get_match_data(dev); 204 + if (!of_data) 205 + return -ENODEV; 206 + 207 + atc260x->ic_type = (unsigned long)of_data; 208 + 209 + switch (atc260x->ic_type) { 210 + case ATC2603C: 211 + *regmap_cfg = atc2603c_regmap_config; 212 + atc260x->regmap_irq_chip = &atc2603c_regmap_irq_chip; 213 + atc260x->cells = atc2603c_mfd_cells; 214 + atc260x->nr_cells = ARRAY_SIZE(atc2603c_mfd_cells); 215 + atc260x->type_name = "atc2603c"; 216 + atc260x->rev_reg = ATC2603C_CHIP_VER; 217 + atc260x->init_regs = &atc2603c_init_regs; 218 + break; 219 + case ATC2609A: 220 + *regmap_cfg = atc2609a_regmap_config; 221 + atc260x->regmap_irq_chip = &atc2609a_regmap_irq_chip; 222 + atc260x->cells = atc2609a_mfd_cells; 223 + atc260x->nr_cells = ARRAY_SIZE(atc2609a_mfd_cells); 224 + atc260x->type_name = "atc2609a"; 225 + atc260x->rev_reg = ATC2609A_CHIP_VER; 226 + atc260x->init_regs = &atc2609a_init_regs; 227 + break; 228 + default: 229 + dev_err(dev, "Unsupported ATC260x device type: %u\n", 230 + atc260x->ic_type); 231 + return -EINVAL; 232 + } 233 + 234 + atc260x->regmap_mutex = devm_kzalloc(dev, sizeof(*atc260x->regmap_mutex), 235 + GFP_KERNEL); 236 + if (!atc260x->regmap_mutex) 237 + return -ENOMEM; 238 + 239 + mutex_init(atc260x->regmap_mutex); 240 + 241 + regmap_cfg->lock = regmap_lock_mutex, 242 + regmap_cfg->unlock = regmap_unlock_mutex, 243 + regmap_cfg->lock_arg = atc260x->regmap_mutex; 244 + 245 + return 0; 246 + } 247 + EXPORT_SYMBOL_GPL(atc260x_match_device); 248 + 249 + /** 250 + * atc260x_device_probe(): Probe a configured ATC260x device 251 + * 252 + * @atc260x: ATC260x device to probe (must be configured) 253 + * 254 + * This function lets the ATC260x core register the ATC260x MFD devices 255 + * and IRQCHIP. The ATC260x device passed in must be fully configured 256 + * with atc260x_match_device, its IRQ set, and regmap created. 257 + */ 258 + int atc260x_device_probe(struct atc260x *atc260x) 259 + { 260 + struct device *dev = atc260x->dev; 261 + unsigned int chip_rev; 262 + int ret; 263 + 264 + if (!atc260x->irq) { 265 + dev_err(dev, "No interrupt support\n"); 266 + return -EINVAL; 267 + } 268 + 269 + /* Initialize the hardware */ 270 + atc260x_dev_init(atc260x); 271 + 272 + ret = regmap_read(atc260x->regmap, atc260x->rev_reg, &chip_rev); 273 + if (ret) { 274 + dev_err(dev, "Failed to get chip revision\n"); 275 + return ret; 276 + } 277 + 278 + if (chip_rev > ATC260X_CHIP_REV_MAX) { 279 + dev_err(dev, "Unknown chip revision: %u\n", chip_rev); 280 + return -EINVAL; 281 + } 282 + 283 + atc260x->ic_ver = __ffs(chip_rev + 1U); 284 + 285 + dev_info(dev, "Detected chip type %s rev.%c\n", 286 + atc260x->type_name, 'A' + atc260x->ic_ver); 287 + 288 + ret = devm_regmap_add_irq_chip(dev, atc260x->regmap, atc260x->irq, IRQF_ONESHOT, 289 + -1, atc260x->regmap_irq_chip, &atc260x->irq_data); 290 + if (ret) { 291 + dev_err(dev, "Failed to add IRQ chip: %d\n", ret); 292 + return ret; 293 + } 294 + 295 + ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, 296 + atc260x->cells, atc260x->nr_cells, NULL, 0, 297 + regmap_irq_get_domain(atc260x->irq_data)); 298 + if (ret) { 299 + dev_err(dev, "Failed to add child devices: %d\n", ret); 300 + regmap_del_irq_chip(atc260x->irq, atc260x->irq_data); 301 + } 302 + 303 + return ret; 304 + } 305 + EXPORT_SYMBOL_GPL(atc260x_device_probe); 306 + 307 + MODULE_DESCRIPTION("ATC260x PMICs Core support"); 308 + MODULE_AUTHOR("Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>"); 309 + MODULE_AUTHOR("Cristian Ciocaltea <cristian.ciocaltea@gmail.com>"); 310 + MODULE_LICENSE("GPL");
+64
drivers/mfd/atc260x-i2c.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * I2C bus interface for ATC260x PMICs 4 + * 5 + * Copyright (C) 2019 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> 6 + * Copyright (C) 2020 Cristian Ciocaltea <cristian.ciocaltea@gmail.com> 7 + */ 8 + 9 + #include <linux/i2c.h> 10 + #include <linux/mfd/atc260x/core.h> 11 + #include <linux/module.h> 12 + #include <linux/of.h> 13 + #include <linux/regmap.h> 14 + 15 + static int atc260x_i2c_probe(struct i2c_client *client, 16 + const struct i2c_device_id *id) 17 + { 18 + struct atc260x *atc260x; 19 + struct regmap_config regmap_cfg; 20 + int ret; 21 + 22 + atc260x = devm_kzalloc(&client->dev, sizeof(*atc260x), GFP_KERNEL); 23 + if (!atc260x) 24 + return -ENOMEM; 25 + 26 + atc260x->dev = &client->dev; 27 + atc260x->irq = client->irq; 28 + 29 + ret = atc260x_match_device(atc260x, &regmap_cfg); 30 + if (ret) 31 + return ret; 32 + 33 + i2c_set_clientdata(client, atc260x); 34 + 35 + atc260x->regmap = devm_regmap_init_i2c(client, &regmap_cfg); 36 + if (IS_ERR(atc260x->regmap)) { 37 + ret = PTR_ERR(atc260x->regmap); 38 + dev_err(&client->dev, "failed to init regmap: %d\n", ret); 39 + return ret; 40 + } 41 + 42 + return atc260x_device_probe(atc260x); 43 + } 44 + 45 + const struct of_device_id atc260x_i2c_of_match[] = { 46 + { .compatible = "actions,atc2603c", .data = (void *)ATC2603C }, 47 + { .compatible = "actions,atc2609a", .data = (void *)ATC2609A }, 48 + { } 49 + }; 50 + MODULE_DEVICE_TABLE(of, atc260x_i2c_of_match); 51 + 52 + static struct i2c_driver atc260x_i2c_driver = { 53 + .driver = { 54 + .name = "atc260x", 55 + .of_match_table = of_match_ptr(atc260x_i2c_of_match), 56 + }, 57 + .probe = atc260x_i2c_probe, 58 + }; 59 + module_i2c_driver(atc260x_i2c_driver); 60 + 61 + MODULE_DESCRIPTION("ATC260x PMICs I2C bus interface"); 62 + MODULE_AUTHOR("Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>"); 63 + MODULE_AUTHOR("Cristian Ciocaltea <cristian.ciocaltea@gmail.com>"); 64 + MODULE_LICENSE("GPL");
+281
include/linux/mfd/atc260x/atc2603c.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + /* 3 + * ATC2603C PMIC register definitions 4 + * 5 + * Copyright (C) 2020 Cristian Ciocaltea <cristian.ciocaltea@gmail.com> 6 + */ 7 + 8 + #ifndef __LINUX_MFD_ATC260X_ATC2603C_H 9 + #define __LINUX_MFD_ATC260X_ATC2603C_H 10 + 11 + enum atc2603c_irq_def { 12 + ATC2603C_IRQ_AUDIO = 0, 13 + ATC2603C_IRQ_OV, 14 + ATC2603C_IRQ_OC, 15 + ATC2603C_IRQ_OT, 16 + ATC2603C_IRQ_UV, 17 + ATC2603C_IRQ_ALARM, 18 + ATC2603C_IRQ_ONOFF, 19 + ATC2603C_IRQ_SGPIO, 20 + ATC2603C_IRQ_IR, 21 + ATC2603C_IRQ_REMCON, 22 + ATC2603C_IRQ_POWER_IN, 23 + }; 24 + 25 + /* PMU Registers */ 26 + #define ATC2603C_PMU_SYS_CTL0 0x00 27 + #define ATC2603C_PMU_SYS_CTL1 0x01 28 + #define ATC2603C_PMU_SYS_CTL2 0x02 29 + #define ATC2603C_PMU_SYS_CTL3 0x03 30 + #define ATC2603C_PMU_SYS_CTL4 0x04 31 + #define ATC2603C_PMU_SYS_CTL5 0x05 32 + #define ATC2603C_PMU_SYS_CTL6 0x06 33 + #define ATC2603C_PMU_SYS_CTL7 0x07 34 + #define ATC2603C_PMU_SYS_CTL8 0x08 35 + #define ATC2603C_PMU_SYS_CTL9 0x09 36 + #define ATC2603C_PMU_BAT_CTL0 0x0A 37 + #define ATC2603C_PMU_BAT_CTL1 0x0B 38 + #define ATC2603C_PMU_VBUS_CTL0 0x0C 39 + #define ATC2603C_PMU_VBUS_CTL1 0x0D 40 + #define ATC2603C_PMU_WALL_CTL0 0x0E 41 + #define ATC2603C_PMU_WALL_CTL1 0x0F 42 + #define ATC2603C_PMU_SYS_PENDING 0x10 43 + #define ATC2603C_PMU_DC1_CTL0 0x11 44 + #define ATC2603C_PMU_DC1_CTL1 0x12 // Undocumented 45 + #define ATC2603C_PMU_DC1_CTL2 0x13 // Undocumented 46 + #define ATC2603C_PMU_DC2_CTL0 0x14 47 + #define ATC2603C_PMU_DC2_CTL1 0x15 // Undocumented 48 + #define ATC2603C_PMU_DC2_CTL2 0x16 // Undocumented 49 + #define ATC2603C_PMU_DC3_CTL0 0x17 50 + #define ATC2603C_PMU_DC3_CTL1 0x18 // Undocumented 51 + #define ATC2603C_PMU_DC3_CTL2 0x19 // Undocumented 52 + #define ATC2603C_PMU_DC4_CTL0 0x1A // Undocumented 53 + #define ATC2603C_PMU_DC4_CTL1 0x1B // Undocumented 54 + #define ATC2603C_PMU_DC5_CTL0 0x1C // Undocumented 55 + #define ATC2603C_PMU_DC5_CTL1 0x1D // Undocumented 56 + #define ATC2603C_PMU_LDO1_CTL 0x1E 57 + #define ATC2603C_PMU_LDO2_CTL 0x1F 58 + #define ATC2603C_PMU_LDO3_CTL 0x20 59 + #define ATC2603C_PMU_LDO4_CTL 0x21 // Undocumented 60 + #define ATC2603C_PMU_LDO5_CTL 0x22 61 + #define ATC2603C_PMU_LDO6_CTL 0x23 62 + #define ATC2603C_PMU_LDO7_CTL 0x24 63 + #define ATC2603C_PMU_LDO8_CTL 0x25 // Undocumented 64 + #define ATC2603C_PMU_LDO9_CTL 0x26 // Undocumented 65 + #define ATC2603C_PMU_LDO10_CTL 0x27 // Undocumented 66 + #define ATC2603C_PMU_LDO11_CTL 0x28 67 + #define ATC2603C_PMU_SWITCH_CTL 0x29 68 + #define ATC2603C_PMU_OV_CTL0 0x2A 69 + #define ATC2603C_PMU_OV_CTL1 0x2B 70 + #define ATC2603C_PMU_OV_STATUS 0x2C 71 + #define ATC2603C_PMU_OV_EN 0x2D 72 + #define ATC2603C_PMU_OV_INT_EN 0x2E 73 + #define ATC2603C_PMU_OC_CTL 0x2F 74 + #define ATC2603C_PMU_OC_STATUS 0x30 75 + #define ATC2603C_PMU_OC_EN 0x31 76 + #define ATC2603C_PMU_OC_INT_EN 0x32 77 + #define ATC2603C_PMU_UV_CTL0 0x33 78 + #define ATC2603C_PMU_UV_CTL1 0x34 79 + #define ATC2603C_PMU_UV_STATUS 0x35 80 + #define ATC2603C_PMU_UV_EN 0x36 81 + #define ATC2603C_PMU_UV_INT_EN 0x37 82 + #define ATC2603C_PMU_OT_CTL 0x38 83 + #define ATC2603C_PMU_CHARGER_CTL0 0x39 84 + #define ATC2603C_PMU_CHARGER_CTL1 0x3A 85 + #define ATC2603C_PMU_CHARGER_CTL2 0x3B 86 + #define ATC2603C_PMU_BAKCHARGER_CTL 0x3C // Undocumented 87 + #define ATC2603C_PMU_APDS_CTL 0x3D 88 + #define ATC2603C_PMU_AUXADC_CTL0 0x3E 89 + #define ATC2603C_PMU_AUXADC_CTL1 0x3F 90 + #define ATC2603C_PMU_BATVADC 0x40 91 + #define ATC2603C_PMU_BATIADC 0x41 92 + #define ATC2603C_PMU_WALLVADC 0x42 93 + #define ATC2603C_PMU_WALLIADC 0x43 94 + #define ATC2603C_PMU_VBUSVADC 0x44 95 + #define ATC2603C_PMU_VBUSIADC 0x45 96 + #define ATC2603C_PMU_SYSPWRADC 0x46 97 + #define ATC2603C_PMU_REMCONADC 0x47 98 + #define ATC2603C_PMU_SVCCADC 0x48 99 + #define ATC2603C_PMU_CHGIADC 0x49 100 + #define ATC2603C_PMU_IREFADC 0x4A 101 + #define ATC2603C_PMU_BAKBATADC 0x4B 102 + #define ATC2603C_PMU_ICTEMPADC 0x4C 103 + #define ATC2603C_PMU_AUXADC0 0x4D 104 + #define ATC2603C_PMU_AUXADC1 0x4E 105 + #define ATC2603C_PMU_AUXADC2 0x4F 106 + #define ATC2603C_PMU_ICMADC 0x50 107 + #define ATC2603C_PMU_BDG_CTL 0x51 // Undocumented 108 + #define ATC2603C_RTC_CTL 0x52 109 + #define ATC2603C_RTC_MSALM 0x53 110 + #define ATC2603C_RTC_HALM 0x54 111 + #define ATC2603C_RTC_YMDALM 0x55 112 + #define ATC2603C_RTC_MS 0x56 113 + #define ATC2603C_RTC_H 0x57 114 + #define ATC2603C_RTC_DC 0x58 115 + #define ATC2603C_RTC_YMD 0x59 116 + #define ATC2603C_EFUSE_DAT 0x5A // Undocumented 117 + #define ATC2603C_EFUSECRTL1 0x5B // Undocumented 118 + #define ATC2603C_EFUSECRTL2 0x5C // Undocumented 119 + #define ATC2603C_PMU_FW_USE0 0x5D // Undocumented 120 + #define ATC2603C_PMU_FW_USE1 0x5E // Undocumented 121 + #define ATC2603C_PMU_FW_USE2 0x5F // Undocumented 122 + #define ATC2603C_PMU_FW_USE3 0x60 // Undocumented 123 + #define ATC2603C_PMU_FW_USE4 0x61 // Undocumented 124 + #define ATC2603C_PMU_ABNORMAL_STATUS 0x62 125 + #define ATC2603C_PMU_WALL_APDS_CTL 0x63 126 + #define ATC2603C_PMU_REMCON_CTL0 0x64 127 + #define ATC2603C_PMU_REMCON_CTL1 0x65 128 + #define ATC2603C_PMU_MUX_CTL0 0x66 129 + #define ATC2603C_PMU_SGPIO_CTL0 0x67 130 + #define ATC2603C_PMU_SGPIO_CTL1 0x68 131 + #define ATC2603C_PMU_SGPIO_CTL2 0x69 132 + #define ATC2603C_PMU_SGPIO_CTL3 0x6A 133 + #define ATC2603C_PMU_SGPIO_CTL4 0x6B 134 + #define ATC2603C_PWMCLK_CTL 0x6C 135 + #define ATC2603C_PWM0_CTL 0x6D 136 + #define ATC2603C_PWM1_CTL 0x6E 137 + #define ATC2603C_PMU_ADC_DBG0 0x70 138 + #define ATC2603C_PMU_ADC_DBG1 0x71 139 + #define ATC2603C_PMU_ADC_DBG2 0x72 140 + #define ATC2603C_PMU_ADC_DBG3 0x73 141 + #define ATC2603C_PMU_ADC_DBG4 0x74 142 + #define ATC2603C_IRC_CTL 0x80 143 + #define ATC2603C_IRC_STAT 0x81 144 + #define ATC2603C_IRC_CC 0x82 145 + #define ATC2603C_IRC_KDC 0x83 146 + #define ATC2603C_IRC_WK 0x84 147 + #define ATC2603C_IRC_RCC 0x85 148 + #define ATC2603C_IRC_FILTER 0x86 149 + 150 + /* AUDIO_OUT Registers */ 151 + #define ATC2603C_AUDIOINOUT_CTL 0xA0 152 + #define ATC2603C_AUDIO_DEBUGOUTCTL 0xA1 153 + #define ATC2603C_DAC_DIGITALCTL 0xA2 154 + #define ATC2603C_DAC_VOLUMECTL0 0xA3 155 + #define ATC2603C_DAC_ANALOG0 0xA4 156 + #define ATC2603C_DAC_ANALOG1 0xA5 157 + #define ATC2603C_DAC_ANALOG2 0xA6 158 + #define ATC2603C_DAC_ANALOG3 0xA7 159 + 160 + /* AUDIO_IN Registers */ 161 + #define ATC2603C_ADC_DIGITALCTL 0xA8 162 + #define ATC2603C_ADC_HPFCTL 0xA9 163 + #define ATC2603C_ADC_CTL 0xAA 164 + #define ATC2603C_AGC_CTL0 0xAB 165 + #define ATC2603C_AGC_CTL1 0xAC // Undocumented 166 + #define ATC2603C_AGC_CTL2 0xAD 167 + #define ATC2603C_ADC_ANALOG0 0xAE 168 + #define ATC2603C_ADC_ANALOG1 0xAF 169 + 170 + /* PCM_IF Registers */ 171 + #define ATC2603C_PCM0_CTL 0xB0 // Undocumented 172 + #define ATC2603C_PCM1_CTL 0xB1 // Undocumented 173 + #define ATC2603C_PCM2_CTL 0xB2 // Undocumented 174 + #define ATC2603C_PCMIF_CTL 0xB3 // Undocumented 175 + 176 + /* CMU_CONTROL Registers */ 177 + #define ATC2603C_CMU_DEVRST 0xC1 // Undocumented 178 + 179 + /* INTS Registers */ 180 + #define ATC2603C_INTS_PD 0xC8 181 + #define ATC2603C_INTS_MSK 0xC9 182 + 183 + /* MFP Registers */ 184 + #define ATC2603C_MFP_CTL 0xD0 185 + #define ATC2603C_PAD_VSEL 0xD1 // Undocumented 186 + #define ATC2603C_GPIO_OUTEN 0xD2 187 + #define ATC2603C_GPIO_INEN 0xD3 188 + #define ATC2603C_GPIO_DAT 0xD4 189 + #define ATC2603C_PAD_DRV 0xD5 190 + #define ATC2603C_PAD_EN 0xD6 191 + #define ATC2603C_DEBUG_SEL 0xD7 // Undocumented 192 + #define ATC2603C_DEBUG_IE 0xD8 // Undocumented 193 + #define ATC2603C_DEBUG_OE 0xD9 // Undocumented 194 + #define ATC2603C_BIST_START 0x0A // Undocumented 195 + #define ATC2603C_BIST_RESULT 0x0B // Undocumented 196 + #define ATC2603C_CHIP_VER 0xDC 197 + 198 + /* TWSI Registers */ 199 + #define ATC2603C_SADDR 0xFF 200 + 201 + /* PMU_SYS_CTL0 Register Mask Bits */ 202 + #define ATC2603C_PMU_SYS_CTL0_IR_WK_EN BIT(5) 203 + #define ATC2603C_PMU_SYS_CTL0_RESET_WK_EN BIT(6) 204 + #define ATC2603C_PMU_SYS_CTL0_HDSW_WK_EN BIT(7) 205 + #define ATC2603C_PMU_SYS_CTL0_ALARM_WK_EN BIT(8) 206 + #define ATC2603C_PMU_SYS_CTL0_REM_CON_WK_EN BIT(9) 207 + #define ATC2603C_PMU_SYS_CTL0_RESTART_EN BIT(10) 208 + #define ATC2603C_PMU_SYS_CTL0_SGPIOIRQ_WK_EN BIT(11) 209 + #define ATC2603C_PMU_SYS_CTL0_ONOFF_SHORT_WK_EN BIT(12) 210 + #define ATC2603C_PMU_SYS_CTL0_ONOFF_LONG_WK_EN BIT(13) 211 + #define ATC2603C_PMU_SYS_CTL0_WALL_WK_EN BIT(14) 212 + #define ATC2603C_PMU_SYS_CTL0_USB_WK_EN BIT(15) 213 + #define ATC2603C_PMU_SYS_CTL0_WK_ALL (GENMASK(15, 5) & (~BIT(10))) 214 + 215 + /* PMU_SYS_CTL1 Register Mask Bits */ 216 + #define ATC2603C_PMU_SYS_CTL1_EN_S1 BIT(0) 217 + #define ATC2603C_PMU_SYS_CTL1_LB_S4_EN BIT(2) 218 + #define ATC2603C_PMU_SYS_CTL1_LB_S4 GENMASK(4, 3) 219 + #define ATC2603C_PMU_SYS_CTL1_LB_S4_3_1V BIT(4) 220 + #define ATC2603C_PMU_SYS_CTL1_IR_WK_FLAG BIT(5) 221 + #define ATC2603C_PMU_SYS_CTL1_RESET_WK_FLAG BIT(6) 222 + #define ATC2603C_PMU_SYS_CTL1_HDSW_WK_FLAG BIT(7) 223 + #define ATC2603C_PMU_SYS_CTL1_ALARM_WK_FLAG BIT(8) 224 + #define ATC2603C_PMU_SYS_CTL1_REM_CON_WK_FLAG BIT(9) 225 + #define ATC2603C_PMU_SYS_CTL1_ONOFF_PRESS_RESET_IRQ_PD BIT(10) 226 + #define ATC2603C_PMU_SYS_CTL1_SGPIOIRQ_WK_FLAG BIT(11) 227 + #define ATC2603C_PMU_SYS_CTL1_ONOFF_SHORT_WK_FLAG BIT(12) 228 + #define ATC2603C_PMU_SYS_CTL1_ONOFF_LONG_WK_FLAG BIT(13) 229 + #define ATC2603C_PMU_SYS_CTL1_WALL_WK_FLAG BIT(14) 230 + #define ATC2603C_PMU_SYS_CTL1_USB_WK_FLAG BIT(15) 231 + 232 + /* PMU_SYS_CTL2 Register Mask Bits */ 233 + #define ATC2603C_PMU_SYS_CTL2_PMU_A_EN BIT(0) 234 + #define ATC2603C_PMU_SYS_CTL2_ONOFF_PRESS_INT_EN BIT(1) 235 + #define ATC2603C_PMU_SYS_CTL2_ONOFF_PRESS_PD BIT(2) 236 + #define ATC2603C_PMU_SYS_CTL2_S2TIMER GENMASK(5, 3) 237 + #define ATC2603C_PMU_SYS_CTL2_S2_TIMER_EN BIT(6) 238 + #define ATC2603C_PMU_SYS_CTL2_ONOFF_RESET_TIME_SEL GENMASK(8, 7) 239 + #define ATC2603C_PMU_SYS_CTL2_ONOFF_PRESS_RESET_EN BIT(9) 240 + #define ATC2603C_PMU_SYS_CTL2_ONOFF_PRESS_TIME GENMASK(11, 10) 241 + #define ATC2603C_PMU_SYS_CTL2_ONOFF_INT_EN BIT(12) 242 + #define ATC2603C_PMU_SYS_CTL2_ONOFF_LONG_PRESS BIT(13) 243 + #define ATC2603C_PMU_SYS_CTL2_ONOFF_SHORT_PRESS BIT(14) 244 + #define ATC2603C_PMU_SYS_CTL2_ONOFF_PRESS BIT(15) 245 + 246 + /* PMU_SYS_CTL3 Register Mask Bits */ 247 + #define ATC2603C_PMU_SYS_CTL3_S2S3TOS1_TIMER GENMASK(8, 7) 248 + #define ATC2603C_PMU_SYS_CTL3_S2S3TOS1_TIMER_EN BIT(9) 249 + #define ATC2603C_PMU_SYS_CTL3_S3_TIMER GENMASK(12, 10) 250 + #define ATC2603C_PMU_SYS_CTL3_S3_TIMER_EN BIT(13) 251 + #define ATC2603C_PMU_SYS_CTL3_EN_S3 BIT(14) 252 + #define ATC2603C_PMU_SYS_CTL3_EN_S2 BIT(15) 253 + 254 + /* PMU_SYS_CTL5 Register Mask Bits */ 255 + #define ATC2603C_PMU_SYS_CTL5_WALLWKDTEN BIT(7) 256 + #define ATC2603C_PMU_SYS_CTL5_VBUSWKDTEN BIT(8) 257 + #define ATC2603C_PMU_SYS_CTL5_REMCON_DECT_EN BIT(9) 258 + #define ATC2603C_PMU_SYS_CTL5_ONOFF_8S_SEL BIT(10) 259 + 260 + /* INTS_MSK Register Mask Bits */ 261 + #define ATC2603C_INTS_MSK_AUDIO BIT(0) 262 + #define ATC2603C_INTS_MSK_OV BIT(1) 263 + #define ATC2603C_INTS_MSK_OC BIT(2) 264 + #define ATC2603C_INTS_MSK_OT BIT(3) 265 + #define ATC2603C_INTS_MSK_UV BIT(4) 266 + #define ATC2603C_INTS_MSK_ALARM BIT(5) 267 + #define ATC2603C_INTS_MSK_ONOFF BIT(6) 268 + #define ATC2603C_INTS_MSK_SGPIO BIT(7) 269 + #define ATC2603C_INTS_MSK_IR BIT(8) 270 + #define ATC2603C_INTS_MSK_REMCON BIT(9) 271 + #define ATC2603C_INTS_MSK_POWERIN BIT(10) 272 + 273 + /* CMU_DEVRST Register Mask Bits */ 274 + #define ATC2603C_CMU_DEVRST_MFP BIT(1) 275 + #define ATC2603C_CMU_DEVRST_INTS BIT(2) 276 + #define ATC2603C_CMU_DEVRST_AUDIO BIT(4) 277 + 278 + /* PAD_EN Register Mask Bits */ 279 + #define ATC2603C_PAD_EN_EXTIRQ BIT(0) 280 + 281 + #endif /* __LINUX_MFD_ATC260X_ATC2603C_H */
+308
include/linux/mfd/atc260x/atc2609a.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + /* 3 + * ATC2609A PMIC register definitions 4 + * 5 + * Copyright (C) 2019 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> 6 + */ 7 + 8 + #ifndef __LINUX_MFD_ATC260X_ATC2609A_H 9 + #define __LINUX_MFD_ATC260X_ATC2609A_H 10 + 11 + enum atc2609a_irq_def { 12 + ATC2609A_IRQ_AUDIO = 0, 13 + ATC2609A_IRQ_OV, 14 + ATC2609A_IRQ_OC, 15 + ATC2609A_IRQ_OT, 16 + ATC2609A_IRQ_UV, 17 + ATC2609A_IRQ_ALARM, 18 + ATC2609A_IRQ_ONOFF, 19 + ATC2609A_IRQ_WKUP, 20 + ATC2609A_IRQ_IR, 21 + ATC2609A_IRQ_REMCON, 22 + ATC2609A_IRQ_POWER_IN, 23 + }; 24 + 25 + /* PMU Registers */ 26 + #define ATC2609A_PMU_SYS_CTL0 0x00 27 + #define ATC2609A_PMU_SYS_CTL1 0x01 28 + #define ATC2609A_PMU_SYS_CTL2 0x02 29 + #define ATC2609A_PMU_SYS_CTL3 0x03 30 + #define ATC2609A_PMU_SYS_CTL4 0x04 31 + #define ATC2609A_PMU_SYS_CTL5 0x05 32 + #define ATC2609A_PMU_SYS_CTL6 0x06 33 + #define ATC2609A_PMU_SYS_CTL7 0x07 34 + #define ATC2609A_PMU_SYS_CTL8 0x08 35 + #define ATC2609A_PMU_SYS_CTL9 0x09 36 + #define ATC2609A_PMU_BAT_CTL0 0x0A 37 + #define ATC2609A_PMU_BAT_CTL1 0x0B 38 + #define ATC2609A_PMU_VBUS_CTL0 0x0C 39 + #define ATC2609A_PMU_VBUS_CTL1 0x0D 40 + #define ATC2609A_PMU_WALL_CTL0 0x0E 41 + #define ATC2609A_PMU_WALL_CTL1 0x0F 42 + #define ATC2609A_PMU_SYS_PENDING 0x10 43 + #define ATC2609A_PMU_APDS_CTL0 0x11 44 + #define ATC2609A_PMU_APDS_CTL1 0x12 45 + #define ATC2609A_PMU_APDS_CTL2 0x13 46 + #define ATC2609A_PMU_CHARGER_CTL 0x14 47 + #define ATC2609A_PMU_BAKCHARGER_CTL 0x15 48 + #define ATC2609A_PMU_SWCHG_CTL0 0x16 49 + #define ATC2609A_PMU_SWCHG_CTL1 0x17 50 + #define ATC2609A_PMU_SWCHG_CTL2 0x18 51 + #define ATC2609A_PMU_SWCHG_CTL3 0x19 52 + #define ATC2609A_PMU_SWCHG_CTL4 0x1A 53 + #define ATC2609A_PMU_DC_OSC 0x1B 54 + #define ATC2609A_PMU_DC0_CTL0 0x1C 55 + #define ATC2609A_PMU_DC0_CTL1 0x1D 56 + #define ATC2609A_PMU_DC0_CTL2 0x1E 57 + #define ATC2609A_PMU_DC0_CTL3 0x1F 58 + #define ATC2609A_PMU_DC0_CTL4 0x20 59 + #define ATC2609A_PMU_DC0_CTL5 0x21 60 + #define ATC2609A_PMU_DC0_CTL6 0x22 61 + #define ATC2609A_PMU_DC1_CTL0 0x23 62 + #define ATC2609A_PMU_DC1_CTL1 0x24 63 + #define ATC2609A_PMU_DC1_CTL2 0x25 64 + #define ATC2609A_PMU_DC1_CTL3 0x26 65 + #define ATC2609A_PMU_DC1_CTL4 0x27 66 + #define ATC2609A_PMU_DC1_CTL5 0x28 67 + #define ATC2609A_PMU_DC1_CTL6 0x29 68 + #define ATC2609A_PMU_DC2_CTL0 0x2A 69 + #define ATC2609A_PMU_DC2_CTL1 0x2B 70 + #define ATC2609A_PMU_DC2_CTL2 0x2C 71 + #define ATC2609A_PMU_DC2_CTL3 0x2D 72 + #define ATC2609A_PMU_DC2_CTL4 0x2E 73 + #define ATC2609A_PMU_DC2_CTL5 0x2F 74 + #define ATC2609A_PMU_DC2_CTL6 0x30 75 + #define ATC2609A_PMU_DC3_CTL0 0x31 76 + #define ATC2609A_PMU_DC3_CTL1 0x32 77 + #define ATC2609A_PMU_DC3_CTL2 0x33 78 + #define ATC2609A_PMU_DC3_CTL3 0x34 79 + #define ATC2609A_PMU_DC3_CTL4 0x35 80 + #define ATC2609A_PMU_DC3_CTL5 0x36 81 + #define ATC2609A_PMU_DC3_CTL6 0x37 82 + #define ATC2609A_PMU_DC_ZR 0x38 83 + #define ATC2609A_PMU_LDO0_CTL0 0x39 84 + #define ATC2609A_PMU_LDO0_CTL1 0x3A 85 + #define ATC2609A_PMU_LDO1_CTL0 0x3B 86 + #define ATC2609A_PMU_LDO1_CTL1 0x3C 87 + #define ATC2609A_PMU_LDO2_CTL0 0x3D 88 + #define ATC2609A_PMU_LDO2_CTL1 0x3E 89 + #define ATC2609A_PMU_LDO3_CTL0 0x3F 90 + #define ATC2609A_PMU_LDO3_CTL1 0x40 91 + #define ATC2609A_PMU_LDO4_CTL0 0x41 92 + #define ATC2609A_PMU_LDO4_CTL1 0x42 93 + #define ATC2609A_PMU_LDO5_CTL0 0x43 94 + #define ATC2609A_PMU_LDO5_CTL1 0x44 95 + #define ATC2609A_PMU_LDO6_CTL0 0x45 96 + #define ATC2609A_PMU_LDO6_CTL1 0x46 97 + #define ATC2609A_PMU_LDO7_CTL0 0x47 98 + #define ATC2609A_PMU_LDO7_CTL1 0x48 99 + #define ATC2609A_PMU_LDO8_CTL0 0x49 100 + #define ATC2609A_PMU_LDO8_CTL1 0x4A 101 + #define ATC2609A_PMU_LDO9_CTL 0x4B 102 + #define ATC2609A_PMU_OV_INT_EN 0x4C 103 + #define ATC2609A_PMU_OV_STATUS 0x4D 104 + #define ATC2609A_PMU_UV_INT_EN 0x4E 105 + #define ATC2609A_PMU_UV_STATUS 0x4F 106 + #define ATC2609A_PMU_OC_INT_EN 0x50 107 + #define ATC2609A_PMU_OC_STATUS 0x51 108 + #define ATC2609A_PMU_OT_CTL 0x52 109 + #define ATC2609A_PMU_CM_CTL0 0x53 110 + #define ATC2609A_PMU_FW_USE0 0x54 111 + #define ATC2609A_PMU_FW_USE1 0x55 112 + #define ATC2609A_PMU_ADC12B_I 0x56 113 + #define ATC2609A_PMU_ADC12B_V 0x57 114 + #define ATC2609A_PMU_ADC12B_DUMMY 0x58 115 + #define ATC2609A_PMU_AUXADC_CTL0 0x59 116 + #define ATC2609A_PMU_AUXADC_CTL1 0x5A 117 + #define ATC2609A_PMU_BATVADC 0x5B 118 + #define ATC2609A_PMU_BATIADC 0x5C 119 + #define ATC2609A_PMU_WALLVADC 0x5D 120 + #define ATC2609A_PMU_WALLIADC 0x5E 121 + #define ATC2609A_PMU_VBUSVADC 0x5F 122 + #define ATC2609A_PMU_VBUSIADC 0x60 123 + #define ATC2609A_PMU_SYSPWRADC 0x61 124 + #define ATC2609A_PMU_REMCONADC 0x62 125 + #define ATC2609A_PMU_SVCCADC 0x63 126 + #define ATC2609A_PMU_CHGIADC 0x64 127 + #define ATC2609A_PMU_IREFADC 0x65 128 + #define ATC2609A_PMU_BAKBATADC 0x66 129 + #define ATC2609A_PMU_ICTEMPADC 0x67 130 + #define ATC2609A_PMU_AUXADC0 0x68 131 + #define ATC2609A_PMU_AUXADC1 0x69 132 + #define ATC2609A_PMU_AUXADC2 0x6A 133 + #define ATC2609A_PMU_AUXADC3 0x6B 134 + #define ATC2609A_PMU_ICTEMPADC_ADJ 0x6C 135 + #define ATC2609A_PMU_BDG_CTL 0x6D 136 + #define ATC2609A_RTC_CTL 0x6E 137 + #define ATC2609A_RTC_MSALM 0x6F 138 + #define ATC2609A_RTC_HALM 0x70 139 + #define ATC2609A_RTC_YMDALM 0x71 140 + #define ATC2609A_RTC_MS 0x72 141 + #define ATC2609A_RTC_H 0x73 142 + #define ATC2609A_RTC_DC 0x74 143 + #define ATC2609A_RTC_YMD 0x75 144 + #define ATC2609A_EFUSE_DAT 0x76 145 + #define ATC2609A_EFUSECRTL1 0x77 146 + #define ATC2609A_EFUSECRTL2 0x78 147 + #define ATC2609A_PMU_DC4_CTL0 0x79 148 + #define ATC2609A_PMU_DC4_CTL1 0x7A 149 + #define ATC2609A_PMU_DC4_CTL2 0x7B 150 + #define ATC2609A_PMU_DC4_CTL3 0x7C 151 + #define ATC2609A_PMU_DC4_CTL4 0x7D 152 + #define ATC2609A_PMU_DC4_CTL5 0x7E 153 + #define ATC2609A_PMU_DC4_CTL6 0x7F 154 + #define ATC2609A_PMU_PWR_STATUS 0x80 155 + #define ATC2609A_PMU_S2_PWR 0x81 156 + #define ATC2609A_CLMT_CTL0 0x82 157 + #define ATC2609A_CLMT_DATA0 0x83 158 + #define ATC2609A_CLMT_DATA1 0x84 159 + #define ATC2609A_CLMT_DATA2 0x85 160 + #define ATC2609A_CLMT_DATA3 0x86 161 + #define ATC2609A_CLMT_ADD0 0x87 162 + #define ATC2609A_CLMT_ADD1 0x88 163 + #define ATC2609A_CLMT_OCV_TABLE 0x89 164 + #define ATC2609A_CLMT_R_TABLE 0x8A 165 + #define ATC2609A_PMU_PWRON_CTL0 0x8D 166 + #define ATC2609A_PMU_PWRON_CTL1 0x8E 167 + #define ATC2609A_PMU_PWRON_CTL2 0x8F 168 + #define ATC2609A_IRC_CTL 0x90 169 + #define ATC2609A_IRC_STAT 0x91 170 + #define ATC2609A_IRC_CC 0x92 171 + #define ATC2609A_IRC_KDC 0x93 172 + #define ATC2609A_IRC_WK 0x94 173 + #define ATC2609A_IRC_RCC 0x95 174 + 175 + /* AUDIO_OUT Registers */ 176 + #define ATC2609A_AUDIOINOUT_CTL 0xA0 177 + #define ATC2609A_AUDIO_DEBUGOUTCTL 0xA1 178 + #define ATC2609A_DAC_DIGITALCTL 0xA2 179 + #define ATC2609A_DAC_VOLUMECTL0 0xA3 180 + #define ATC2609A_DAC_ANALOG0 0xA4 181 + #define ATC2609A_DAC_ANALOG1 0xA5 182 + #define ATC2609A_DAC_ANALOG2 0xA6 183 + #define ATC2609A_DAC_ANALOG3 0xA7 184 + 185 + /* AUDIO_IN Registers */ 186 + #define ATC2609A_ADC_DIGITALCTL 0xA8 187 + #define ATC2609A_ADC_HPFCTL 0xA9 188 + #define ATC2609A_ADC_CTL 0xAA 189 + #define ATC2609A_AGC_CTL0 0xAB 190 + #define ATC2609A_AGC_CTL1 0xAC 191 + #define ATC2609A_AGC_CTL2 0xAD 192 + #define ATC2609A_ADC_ANALOG0 0xAE 193 + #define ATC2609A_ADC_ANALOG1 0xAF 194 + 195 + /* PCM_IF Registers */ 196 + #define ATC2609A_PCM0_CTL 0xB0 197 + #define ATC2609A_PCM1_CTL 0xB1 198 + #define ATC2609A_PCM2_CTL 0xB2 199 + #define ATC2609A_PCMIF_CTL 0xB3 200 + 201 + /* CMU_CONTROL Registers */ 202 + #define ATC2609A_CMU_DEVRST 0xC1 203 + 204 + /* INTS Registers */ 205 + #define ATC2609A_INTS_PD 0xC8 206 + #define ATC2609A_INTS_MSK 0xC9 207 + 208 + /* MFP Registers */ 209 + #define ATC2609A_MFP_CTL 0xD0 210 + #define ATC2609A_PAD_VSEL 0xD1 211 + #define ATC2609A_GPIO_OUTEN 0xD2 212 + #define ATC2609A_GPIO_INEN 0xD3 213 + #define ATC2609A_GPIO_DAT 0xD4 214 + #define ATC2609A_PAD_DRV 0xD5 215 + #define ATC2609A_PAD_EN 0xD6 216 + #define ATC2609A_DEBUG_SEL 0xD7 217 + #define ATC2609A_DEBUG_IE 0xD8 218 + #define ATC2609A_DEBUG_OE 0xD9 219 + #define ATC2609A_CHIP_VER 0xDC 220 + 221 + /* PWSI Registers */ 222 + #define ATC2609A_PWSI_CTL 0xF0 223 + #define ATC2609A_PWSI_STATUS 0xF1 224 + 225 + /* TWSI Registers */ 226 + #define ATC2609A_SADDR 0xFF 227 + 228 + /* PMU_SYS_CTL0 Register Mask Bits */ 229 + #define ATC2609A_PMU_SYS_CTL0_IR_WK_EN BIT(5) 230 + #define ATC2609A_PMU_SYS_CTL0_RESET_WK_EN BIT(6) 231 + #define ATC2609A_PMU_SYS_CTL0_HDSW_WK_EN BIT(7) 232 + #define ATC2609A_PMU_SYS_CTL0_ALARM_WK_EN BIT(8) 233 + #define ATC2609A_PMU_SYS_CTL0_REM_CON_WK_EN BIT(9) 234 + #define ATC2609A_PMU_SYS_CTL0_RESTART_EN BIT(10) 235 + #define ATC2609A_PMU_SYS_CTL0_WKIRQ_WK_EN BIT(11) 236 + #define ATC2609A_PMU_SYS_CTL0_ONOFF_SHORT_WK_EN BIT(12) 237 + #define ATC2609A_PMU_SYS_CTL0_ONOFF_LONG_WK_EN BIT(13) 238 + #define ATC2609A_PMU_SYS_CTL0_WALL_WK_EN BIT(14) 239 + #define ATC2609A_PMU_SYS_CTL0_USB_WK_EN BIT(15) 240 + #define ATC2609A_PMU_SYS_CTL0_WK_ALL (GENMASK(15, 5) & (~BIT(10))) 241 + 242 + /* PMU_SYS_CTL1 Register Mask Bits */ 243 + #define ATC2609A_PMU_SYS_CTL1_EN_S1 BIT(0) 244 + #define ATC2609A_PMU_SYS_CTL1_LB_S4_EN BIT(2) 245 + #define ATC2609A_PMU_SYS_CTL1_LB_S4 GENMASK(4, 3) 246 + #define ATC2609A_PMU_SYS_CTL1_LB_S4_3_1V BIT(4) 247 + #define ATC2609A_PMU_SYS_CTL1_IR_WK_FLAG BIT(5) 248 + #define ATC2609A_PMU_SYS_CTL1_RESET_WK_FLAG BIT(6) 249 + #define ATC2609A_PMU_SYS_CTL1_HDSW_WK_FLAG BIT(7) 250 + #define ATC2609A_PMU_SYS_CTL1_ALARM_WK_FLAG BIT(8) 251 + #define ATC2609A_PMU_SYS_CTL1_REM_CON_WK_FLAG BIT(9) 252 + #define ATC2609A_PMU_SYS_CTL1_RESTART_WK_FLAG BIT(10) 253 + #define ATC2609A_PMU_SYS_CTL1_WKIRQ_WK_FLAG BIT(11) 254 + #define ATC2609A_PMU_SYS_CTL1_ONOFF_SHORT_WK_FLAG BIT(12) 255 + #define ATC2609A_PMU_SYS_CTL1_ONOFF_LONG_WK_FLAG BIT(13) 256 + #define ATC2609A_PMU_SYS_CTL1_WALL_WK_FLAG BIT(14) 257 + #define ATC2609A_PMU_SYS_CTL1_USB_WK_FLAG BIT(15) 258 + 259 + /* PMU_SYS_CTL2 Register Mask Bits */ 260 + #define ATC2609A_PMU_SYS_CTL2_PMU_A_EN BIT(0) 261 + #define ATC2609A_PMU_SYS_CTL2_ONOFF_PRESS_INT_EN BIT(1) 262 + #define ATC2609A_PMU_SYS_CTL2_ONOFF_PRESS_PD BIT(2) 263 + #define ATC2609A_PMU_SYS_CTL2_S2TIMER GENMASK(5, 3) 264 + #define ATC2609A_PMU_SYS_CTL2_S2_TIMER_EN BIT(6) 265 + #define ATC2609A_PMU_SYS_CTL2_ONOFF_RESET_TIME_SEL GENMASK(8, 7) 266 + #define ATC2609A_PMU_SYS_CTL2_ONOFF_RESET_EN BIT(9) 267 + #define ATC2609A_PMU_SYS_CTL2_ONOFF_PRESS_TIME GENMASK(11, 10) 268 + #define ATC2609A_PMU_SYS_CTL2_ONOFF_LSP_INT_EN BIT(12) 269 + #define ATC2609A_PMU_SYS_CTL2_ONOFF_LONG_PRESS BIT(13) 270 + #define ATC2609A_PMU_SYS_CTL2_ONOFF_SHORT_PRESS BIT(14) 271 + #define ATC2609A_PMU_SYS_CTL2_ONOFF_PRESS BIT(15) 272 + 273 + /* PMU_SYS_CTL3 Register Mask Bits */ 274 + #define ATC2609A_PMU_SYS_CTL3_S2S3TOS1_TIMER GENMASK(8, 7) 275 + #define ATC2609A_PMU_SYS_CTL3_S2S3TOS1_TIMER_EN BIT(9) 276 + #define ATC2609A_PMU_SYS_CTL3_S3_TIMER GENMASK(12, 10) 277 + #define ATC2609A_PMU_SYS_CTL3_S3_TIMER_EN BIT(13) 278 + #define ATC2609A_PMU_SYS_CTL3_EN_S3 BIT(14) 279 + #define ATC2609A_PMU_SYS_CTL3_EN_S2 BIT(15) 280 + 281 + /* PMU_SYS_CTL5 Register Mask Bits */ 282 + #define ATC2609A_PMU_SYS_CTL5_WALLWKDTEN BIT(7) 283 + #define ATC2609A_PMU_SYS_CTL5_VBUSWKDTEN BIT(8) 284 + #define ATC2609A_PMU_SYS_CTL5_REMCON_DECT_EN BIT(9) 285 + #define ATC2609A_PMU_SYS_CTL5_ONOFF_8S_SEL BIT(10) 286 + 287 + /* INTS_MSK Register Mask Bits */ 288 + #define ATC2609A_INTS_MSK_AUDIO BIT(0) 289 + #define ATC2609A_INTS_MSK_OV BIT(1) 290 + #define ATC2609A_INTS_MSK_OC BIT(2) 291 + #define ATC2609A_INTS_MSK_OT BIT(3) 292 + #define ATC2609A_INTS_MSK_UV BIT(4) 293 + #define ATC2609A_INTS_MSK_ALARM BIT(5) 294 + #define ATC2609A_INTS_MSK_ONOFF BIT(6) 295 + #define ATC2609A_INTS_MSK_WKUP BIT(7) 296 + #define ATC2609A_INTS_MSK_IR BIT(8) 297 + #define ATC2609A_INTS_MSK_REMCON BIT(9) 298 + #define ATC2609A_INTS_MSK_POWERIN BIT(10) 299 + 300 + /* CMU_DEVRST Register Mask Bits */ 301 + #define ATC2609A_CMU_DEVRST_AUDIO BIT(0) 302 + #define ATC2609A_CMU_DEVRST_MFP BIT(1) 303 + #define ATC2609A_CMU_DEVRST_INTS BIT(2) 304 + 305 + /* PAD_EN Register Mask Bits */ 306 + #define ATC2609A_PAD_EN_EXTIRQ BIT(0) 307 + 308 + #endif /* __LINUX_MFD_ATC260X_ATC2609A_H */
+58
include/linux/mfd/atc260x/core.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + /* 3 + * Core MFD defines for ATC260x PMICs 4 + * 5 + * Copyright (C) 2019 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> 6 + * Copyright (C) 2020 Cristian Ciocaltea <cristian.ciocaltea@gmail.com> 7 + */ 8 + 9 + #ifndef __LINUX_MFD_ATC260X_CORE_H 10 + #define __LINUX_MFD_ATC260X_CORE_H 11 + 12 + #include <linux/mfd/atc260x/atc2603c.h> 13 + #include <linux/mfd/atc260x/atc2609a.h> 14 + 15 + enum atc260x_type { 16 + ATC2603A = 0, 17 + ATC2603C, 18 + ATC2609A, 19 + }; 20 + 21 + enum atc260x_ver { 22 + ATC260X_A = 0, 23 + ATC260X_B, 24 + ATC260X_C, 25 + ATC260X_D, 26 + ATC260X_E, 27 + ATC260X_F, 28 + ATC260X_G, 29 + ATC260X_H, 30 + }; 31 + 32 + struct atc260x { 33 + struct device *dev; 34 + 35 + struct regmap *regmap; 36 + const struct regmap_irq_chip *regmap_irq_chip; 37 + struct regmap_irq_chip_data *irq_data; 38 + 39 + struct mutex *regmap_mutex; /* mutex for custom regmap locking */ 40 + 41 + const struct mfd_cell *cells; 42 + int nr_cells; 43 + int irq; 44 + 45 + enum atc260x_type ic_type; 46 + enum atc260x_ver ic_ver; 47 + const char *type_name; 48 + unsigned int rev_reg; 49 + 50 + const struct atc260x_init_regs *init_regs; /* regs for device init */ 51 + }; 52 + 53 + struct regmap_config; 54 + 55 + int atc260x_match_device(struct atc260x *atc260x, struct regmap_config *regmap_cfg); 56 + int atc260x_device_probe(struct atc260x *atc260x); 57 + 58 + #endif /* __LINUX_MFD_ATC260X_CORE_H */