| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2016 Gateworks Corporation, Inc. All Rights Reserved. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 |
|---|
| 6 | | - * as published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 9 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 11 | | - * GNU General Public License for more details. |
|---|
| 12 | | - * |
|---|
| 13 | 4 | */ |
|---|
| 14 | 5 | #include <linux/i2c.h> |
|---|
| 15 | 6 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 230 | 221 | #define LTC3676_FIXED_REG(_id, _name, _en_reg, _en_bit) \ |
|---|
| 231 | 222 | LTC3676_REG(_id, _name, fixed, LTC3676_ ## _en_reg, _en_bit, 0, 0) |
|---|
| 232 | 223 | |
|---|
| 233 | | -static struct regulator_desc ltc3676_regulators[LTC3676_NUM_REGULATORS] = { |
|---|
| 224 | +static const struct regulator_desc ltc3676_regulators[LTC3676_NUM_REGULATORS] = { |
|---|
| 234 | 225 | LTC3676_LINEAR_REG(SW1, sw1, BUCK1, DVB1A), |
|---|
| 235 | 226 | LTC3676_LINEAR_REG(SW2, sw2, BUCK2, DVB2A), |
|---|
| 236 | 227 | LTC3676_LINEAR_REG(SW3, sw3, BUCK3, DVB3A), |
|---|
| .. | .. |
|---|
| 241 | 232 | LTC3676_FIXED_REG(LDO4, ldo4, LDOB, 2), |
|---|
| 242 | 233 | }; |
|---|
| 243 | 234 | |
|---|
| 244 | | -static bool ltc3676_writeable_reg(struct device *dev, unsigned int reg) |
|---|
| 235 | +static bool ltc3676_readable_writeable_reg(struct device *dev, unsigned int reg) |
|---|
| 245 | 236 | { |
|---|
| 246 | 237 | switch (reg) { |
|---|
| 247 | | - case LTC3676_IRQSTAT: |
|---|
| 248 | | - case LTC3676_BUCK1: |
|---|
| 249 | | - case LTC3676_BUCK2: |
|---|
| 250 | | - case LTC3676_BUCK3: |
|---|
| 251 | | - case LTC3676_BUCK4: |
|---|
| 252 | | - case LTC3676_LDOA: |
|---|
| 253 | | - case LTC3676_LDOB: |
|---|
| 254 | | - case LTC3676_SQD1: |
|---|
| 255 | | - case LTC3676_SQD2: |
|---|
| 256 | | - case LTC3676_CNTRL: |
|---|
| 257 | | - case LTC3676_DVB1A: |
|---|
| 258 | | - case LTC3676_DVB1B: |
|---|
| 259 | | - case LTC3676_DVB2A: |
|---|
| 260 | | - case LTC3676_DVB2B: |
|---|
| 261 | | - case LTC3676_DVB3A: |
|---|
| 262 | | - case LTC3676_DVB3B: |
|---|
| 263 | | - case LTC3676_DVB4A: |
|---|
| 264 | | - case LTC3676_DVB4B: |
|---|
| 265 | | - case LTC3676_MSKIRQ: |
|---|
| 266 | | - case LTC3676_MSKPG: |
|---|
| 267 | | - case LTC3676_USER: |
|---|
| 268 | | - case LTC3676_HRST: |
|---|
| 269 | | - case LTC3676_CLIRQ: |
|---|
| 270 | | - return true; |
|---|
| 271 | | - } |
|---|
| 272 | | - return false; |
|---|
| 273 | | -} |
|---|
| 274 | | - |
|---|
| 275 | | -static bool ltc3676_readable_reg(struct device *dev, unsigned int reg) |
|---|
| 276 | | -{ |
|---|
| 277 | | - switch (reg) { |
|---|
| 278 | | - case LTC3676_IRQSTAT: |
|---|
| 279 | | - case LTC3676_BUCK1: |
|---|
| 280 | | - case LTC3676_BUCK2: |
|---|
| 281 | | - case LTC3676_BUCK3: |
|---|
| 282 | | - case LTC3676_BUCK4: |
|---|
| 283 | | - case LTC3676_LDOA: |
|---|
| 284 | | - case LTC3676_LDOB: |
|---|
| 285 | | - case LTC3676_SQD1: |
|---|
| 286 | | - case LTC3676_SQD2: |
|---|
| 287 | | - case LTC3676_CNTRL: |
|---|
| 288 | | - case LTC3676_DVB1A: |
|---|
| 289 | | - case LTC3676_DVB1B: |
|---|
| 290 | | - case LTC3676_DVB2A: |
|---|
| 291 | | - case LTC3676_DVB2B: |
|---|
| 292 | | - case LTC3676_DVB3A: |
|---|
| 293 | | - case LTC3676_DVB3B: |
|---|
| 294 | | - case LTC3676_DVB4A: |
|---|
| 295 | | - case LTC3676_DVB4B: |
|---|
| 296 | | - case LTC3676_MSKIRQ: |
|---|
| 297 | | - case LTC3676_MSKPG: |
|---|
| 298 | | - case LTC3676_USER: |
|---|
| 238 | + case LTC3676_BUCK1 ... LTC3676_IRQSTAT: |
|---|
| 299 | 239 | case LTC3676_HRST: |
|---|
| 300 | 240 | case LTC3676_CLIRQ: |
|---|
| 301 | 241 | return true; |
|---|
| .. | .. |
|---|
| 306 | 246 | static bool ltc3676_volatile_reg(struct device *dev, unsigned int reg) |
|---|
| 307 | 247 | { |
|---|
| 308 | 248 | switch (reg) { |
|---|
| 309 | | - case LTC3676_IRQSTAT: |
|---|
| 310 | | - case LTC3676_PGSTATL: |
|---|
| 311 | | - case LTC3676_PGSTATRT: |
|---|
| 249 | + case LTC3676_IRQSTAT ... LTC3676_PGSTATRT: |
|---|
| 312 | 250 | return true; |
|---|
| 313 | 251 | } |
|---|
| 314 | 252 | return false; |
|---|
| .. | .. |
|---|
| 317 | 255 | static const struct regmap_config ltc3676_regmap_config = { |
|---|
| 318 | 256 | .reg_bits = 8, |
|---|
| 319 | 257 | .val_bits = 8, |
|---|
| 320 | | - .writeable_reg = ltc3676_writeable_reg, |
|---|
| 321 | | - .readable_reg = ltc3676_readable_reg, |
|---|
| 258 | + .writeable_reg = ltc3676_readable_writeable_reg, |
|---|
| 259 | + .readable_reg = ltc3676_readable_writeable_reg, |
|---|
| 322 | 260 | .volatile_reg = ltc3676_volatile_reg, |
|---|
| 323 | 261 | .max_register = LTC3676_CLIRQ, |
|---|
| 324 | | - .use_single_rw = true, |
|---|
| 262 | + .use_single_read = true, |
|---|
| 263 | + .use_single_write = true, |
|---|
| 325 | 264 | .cache_type = REGCACHE_RBTREE, |
|---|
| 326 | 265 | }; |
|---|
| 327 | 266 | |
|---|
| .. | .. |
|---|
| 356 | 295 | return IRQ_HANDLED; |
|---|
| 357 | 296 | } |
|---|
| 358 | 297 | |
|---|
| 359 | | -static int ltc3676_regulator_probe(struct i2c_client *client, |
|---|
| 360 | | - const struct i2c_device_id *id) |
|---|
| 298 | +static int ltc3676_regulator_probe(struct i2c_client *client) |
|---|
| 361 | 299 | { |
|---|
| 362 | 300 | struct device *dev = &client->dev; |
|---|
| 363 | 301 | struct regulator_init_data *init_data = dev_get_platdata(dev); |
|---|
| .. | .. |
|---|
| 424 | 362 | }; |
|---|
| 425 | 363 | MODULE_DEVICE_TABLE(i2c, ltc3676_i2c_id); |
|---|
| 426 | 364 | |
|---|
| 427 | | -static const struct of_device_id ltc3676_of_match[] = { |
|---|
| 365 | +static const struct of_device_id __maybe_unused ltc3676_of_match[] = { |
|---|
| 428 | 366 | { .compatible = "lltc,ltc3676" }, |
|---|
| 429 | 367 | { }, |
|---|
| 430 | 368 | }; |
|---|
| .. | .. |
|---|
| 435 | 373 | .name = DRIVER_NAME, |
|---|
| 436 | 374 | .of_match_table = of_match_ptr(ltc3676_of_match), |
|---|
| 437 | 375 | }, |
|---|
| 438 | | - .probe = ltc3676_regulator_probe, |
|---|
| 376 | + .probe_new = ltc3676_regulator_probe, |
|---|
| 439 | 377 | .id_table = ltc3676_i2c_id, |
|---|
| 440 | 378 | }; |
|---|
| 441 | 379 | module_i2c_driver(ltc3676_driver); |
|---|
| 442 | 380 | |
|---|
| 443 | 381 | MODULE_AUTHOR("Tim Harvey <tharvey@gateworks.com>"); |
|---|
| 444 | | -MODULE_DESCRIPTION("Regulator driver for Linear Technology LTC1376"); |
|---|
| 382 | +MODULE_DESCRIPTION("Regulator driver for Linear Technology LTC3676"); |
|---|
| 445 | 383 | MODULE_LICENSE("GPL v2"); |
|---|