.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for Linear Technology LTC4245 I2C Multiple Supply Hot Swap Controller |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2008 Ira W. Snyder <iws@ovro.caltech.edu> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; version 2 of the License. |
---|
9 | 6 | * |
---|
10 | 7 | * This driver is based on the ds1621 and ina209 drivers. |
---|
11 | 8 | * |
---|
.. | .. |
---|
362 | 359 | case hwmon_in_input: |
---|
363 | 360 | if (channel > 9 && !data->use_extra_gpios) |
---|
364 | 361 | return 0; |
---|
365 | | - return S_IRUGO; |
---|
| 362 | + return 0444; |
---|
366 | 363 | case hwmon_in_min_alarm: |
---|
367 | 364 | if (channel > 8) |
---|
368 | 365 | return 0; |
---|
369 | | - return S_IRUGO; |
---|
| 366 | + return 0444; |
---|
370 | 367 | default: |
---|
371 | 368 | return 0; |
---|
372 | 369 | } |
---|
.. | .. |
---|
374 | 371 | switch (attr) { |
---|
375 | 372 | case hwmon_curr_input: |
---|
376 | 373 | case hwmon_curr_max_alarm: |
---|
377 | | - return S_IRUGO; |
---|
| 374 | + return 0444; |
---|
378 | 375 | default: |
---|
379 | 376 | return 0; |
---|
380 | 377 | } |
---|
381 | 378 | case hwmon_power: |
---|
382 | 379 | switch (attr) { |
---|
383 | 380 | case hwmon_power_input: |
---|
384 | | - return S_IRUGO; |
---|
| 381 | + return 0444; |
---|
385 | 382 | default: |
---|
386 | 383 | return 0; |
---|
387 | 384 | } |
---|
.. | .. |
---|
390 | 387 | } |
---|
391 | 388 | } |
---|
392 | 389 | |
---|
393 | | -static const u32 ltc4245_in_config[] = { |
---|
394 | | - HWMON_I_INPUT, /* dummy, skipped in is_visible */ |
---|
395 | | - HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
396 | | - HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
397 | | - HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
398 | | - HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
399 | | - HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
400 | | - HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
401 | | - HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
402 | | - HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
403 | | - HWMON_I_INPUT, |
---|
404 | | - HWMON_I_INPUT, |
---|
405 | | - HWMON_I_INPUT, |
---|
406 | | - 0 |
---|
407 | | -}; |
---|
408 | | - |
---|
409 | | -static const struct hwmon_channel_info ltc4245_in = { |
---|
410 | | - .type = hwmon_in, |
---|
411 | | - .config = ltc4245_in_config, |
---|
412 | | -}; |
---|
413 | | - |
---|
414 | | -static const u32 ltc4245_curr_config[] = { |
---|
415 | | - HWMON_C_INPUT | HWMON_C_MAX_ALARM, |
---|
416 | | - HWMON_C_INPUT | HWMON_C_MAX_ALARM, |
---|
417 | | - HWMON_C_INPUT | HWMON_C_MAX_ALARM, |
---|
418 | | - HWMON_C_INPUT | HWMON_C_MAX_ALARM, |
---|
419 | | - 0 |
---|
420 | | -}; |
---|
421 | | - |
---|
422 | | -static const struct hwmon_channel_info ltc4245_curr = { |
---|
423 | | - .type = hwmon_curr, |
---|
424 | | - .config = ltc4245_curr_config, |
---|
425 | | -}; |
---|
426 | | - |
---|
427 | | -static const u32 ltc4245_power_config[] = { |
---|
428 | | - HWMON_P_INPUT, |
---|
429 | | - HWMON_P_INPUT, |
---|
430 | | - HWMON_P_INPUT, |
---|
431 | | - HWMON_P_INPUT, |
---|
432 | | - 0 |
---|
433 | | -}; |
---|
434 | | - |
---|
435 | | -static const struct hwmon_channel_info ltc4245_power = { |
---|
436 | | - .type = hwmon_power, |
---|
437 | | - .config = ltc4245_power_config, |
---|
438 | | -}; |
---|
439 | | - |
---|
440 | 390 | static const struct hwmon_channel_info *ltc4245_info[] = { |
---|
441 | | - <c4245_in, |
---|
442 | | - <c4245_curr, |
---|
443 | | - <c4245_power, |
---|
| 391 | + HWMON_CHANNEL_INFO(in, |
---|
| 392 | + HWMON_I_INPUT, |
---|
| 393 | + HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
| 394 | + HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
| 395 | + HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
| 396 | + HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
| 397 | + HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
| 398 | + HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
| 399 | + HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
| 400 | + HWMON_I_INPUT | HWMON_I_MIN_ALARM, |
---|
| 401 | + HWMON_I_INPUT, |
---|
| 402 | + HWMON_I_INPUT, |
---|
| 403 | + HWMON_I_INPUT), |
---|
| 404 | + HWMON_CHANNEL_INFO(curr, |
---|
| 405 | + HWMON_C_INPUT | HWMON_C_MAX_ALARM, |
---|
| 406 | + HWMON_C_INPUT | HWMON_C_MAX_ALARM, |
---|
| 407 | + HWMON_C_INPUT | HWMON_C_MAX_ALARM, |
---|
| 408 | + HWMON_C_INPUT | HWMON_C_MAX_ALARM), |
---|
| 409 | + HWMON_CHANNEL_INFO(power, |
---|
| 410 | + HWMON_P_INPUT, |
---|
| 411 | + HWMON_P_INPUT, |
---|
| 412 | + HWMON_P_INPUT, |
---|
| 413 | + HWMON_P_INPUT), |
---|
444 | 414 | NULL |
---|
445 | 415 | }; |
---|
446 | 416 | |
---|
.. | .. |
---|
470 | 440 | return false; |
---|
471 | 441 | } |
---|
472 | 442 | |
---|
473 | | -static int ltc4245_probe(struct i2c_client *client, |
---|
474 | | - const struct i2c_device_id *id) |
---|
| 443 | +static int ltc4245_probe(struct i2c_client *client) |
---|
475 | 444 | { |
---|
476 | 445 | struct i2c_adapter *adapter = client->adapter; |
---|
477 | 446 | struct ltc4245_data *data; |
---|
.. | .. |
---|
510 | 479 | .driver = { |
---|
511 | 480 | .name = "ltc4245", |
---|
512 | 481 | }, |
---|
513 | | - .probe = ltc4245_probe, |
---|
| 482 | + .probe_new = ltc4245_probe, |
---|
514 | 483 | .id_table = ltc4245_id, |
---|
515 | 484 | }; |
---|
516 | 485 | |
---|