pinctrl-sprd.c (bb0f472f96fa2bda2c3e412cd84f16b15d992a56) pinctrl-sprd.c (1592c4b9935fa8a3b7c297955bb872a357e5a3b6)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Spreadtrum pin controller driver
4 * Copyright (C) 2017 Spreadtrum - http://www.spreadtrum.com
5 */
6
7#include <linux/debugfs.h>
8#include <linux/err.h>

--- 453 unchanged lines hidden (view full) ---

462 arg = (reg >> SLEEP_MODE_SHIFT) & SLEEP_MODE_MASK;
463 break;
464 case PIN_CONFIG_INPUT_ENABLE:
465 arg = (reg >> SLEEP_INPUT_SHIFT) & SLEEP_INPUT_MASK;
466 break;
467 case PIN_CONFIG_OUTPUT_ENABLE:
468 arg = reg & SLEEP_OUTPUT_MASK;
469 break;
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Spreadtrum pin controller driver
4 * Copyright (C) 2017 Spreadtrum - http://www.spreadtrum.com
5 */
6
7#include <linux/debugfs.h>
8#include <linux/err.h>

--- 453 unchanged lines hidden (view full) ---

462 arg = (reg >> SLEEP_MODE_SHIFT) & SLEEP_MODE_MASK;
463 break;
464 case PIN_CONFIG_INPUT_ENABLE:
465 arg = (reg >> SLEEP_INPUT_SHIFT) & SLEEP_INPUT_MASK;
466 break;
467 case PIN_CONFIG_OUTPUT_ENABLE:
468 arg = reg & SLEEP_OUTPUT_MASK;
469 break;
470 case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
471 if ((reg & SLEEP_OUTPUT) || (reg & SLEEP_INPUT))
472 return -EINVAL;
473
474 arg = 1;
475 break;
470 case PIN_CONFIG_DRIVE_STRENGTH:
471 arg = (reg >> DRIVE_STRENGTH_SHIFT) &
472 DRIVE_STRENGTH_MASK;
473 break;
474 case PIN_CONFIG_BIAS_PULL_DOWN:
475 /* combine sleep pull down and pull down config */
476 arg = ((reg >> SLEEP_PULL_DOWN_SHIFT) &
477 SLEEP_PULL_DOWN_MASK) << 16;

--- 163 unchanged lines hidden (view full) ---

641 val |= SLEEP_OUTPUT;
642 else
643 val &= ~SLEEP_OUTPUT;
644
645 mask = SLEEP_OUTPUT_MASK;
646 shift = SLEEP_OUTPUT_SHIFT;
647 }
648 break;
476 case PIN_CONFIG_DRIVE_STRENGTH:
477 arg = (reg >> DRIVE_STRENGTH_SHIFT) &
478 DRIVE_STRENGTH_MASK;
479 break;
480 case PIN_CONFIG_BIAS_PULL_DOWN:
481 /* combine sleep pull down and pull down config */
482 arg = ((reg >> SLEEP_PULL_DOWN_SHIFT) &
483 SLEEP_PULL_DOWN_MASK) << 16;

--- 163 unchanged lines hidden (view full) ---

647 val |= SLEEP_OUTPUT;
648 else
649 val &= ~SLEEP_OUTPUT;
650
651 mask = SLEEP_OUTPUT_MASK;
652 shift = SLEEP_OUTPUT_SHIFT;
653 }
654 break;
655 case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
656 if (is_sleep_config == true) {
657 val = shift = 0;
658 mask = SLEEP_OUTPUT | SLEEP_INPUT;
659 }
660 break;
649 case PIN_CONFIG_DRIVE_STRENGTH:
650 if (arg < 2 || arg > 60)
651 return -EINVAL;
652
653 val = sprd_pinconf_drive(arg);
654 mask = DRIVE_STRENGTH_MASK;
655 shift = DRIVE_STRENGTH_SHIFT;
656 break;

--- 469 unchanged lines hidden ---
661 case PIN_CONFIG_DRIVE_STRENGTH:
662 if (arg < 2 || arg > 60)
663 return -EINVAL;
664
665 val = sprd_pinconf_drive(arg);
666 mask = DRIVE_STRENGTH_MASK;
667 shift = DRIVE_STRENGTH_SHIFT;
668 break;

--- 469 unchanged lines hidden ---