Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f22e202 authored by Baolin Wang's avatar Baolin Wang Committed by Linus Walleij
Browse files

pinctrl: sprd: Combine the condition of MISC_PIN and COMMON_PIN



Since the follow-up pin design on Spreadtrum platform has some changes,
some configuration of MISC_PIN moved to COMMON_PIN. To support current
pin design and keep backward compatibility, we should combine the
condition of MISC_PIN and COMMON_PIN to configure an individual pin.

Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
Link: https://lore.kernel.org/r/17af5e761e0515d288a7ea4078ac9aa4a82a7a4e.1564048446.git.baolin.wang@linaro.org


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent e89febc7
Loading
Loading
Loading
Loading
+2 −17
Original line number Original line Diff line number Diff line
@@ -454,7 +454,7 @@ static int sprd_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin_id,
	if (pin->type == GLOBAL_CTRL_PIN &&
	if (pin->type == GLOBAL_CTRL_PIN &&
	    param == SPRD_PIN_CONFIG_CONTROL) {
	    param == SPRD_PIN_CONFIG_CONTROL) {
		arg = reg;
		arg = reg;
	} else if (pin->type == COMMON_PIN) {
	} else if (pin->type == COMMON_PIN || pin->type == MISC_PIN) {
		switch (param) {
		switch (param) {
		case SPRD_PIN_CONFIG_SLEEP_MODE:
		case SPRD_PIN_CONFIG_SLEEP_MODE:
			arg = (reg >> SLEEP_MODE_SHIFT) & SLEEP_MODE_MASK;
			arg = (reg >> SLEEP_MODE_SHIFT) & SLEEP_MODE_MASK;
@@ -465,14 +465,6 @@ static int sprd_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin_id,
		case PIN_CONFIG_OUTPUT:
		case PIN_CONFIG_OUTPUT:
			arg = reg & SLEEP_OUTPUT_MASK;
			arg = reg & SLEEP_OUTPUT_MASK;
			break;
			break;
		case PIN_CONFIG_SLEEP_HARDWARE_STATE:
			arg = 0;
			break;
		default:
			return -ENOTSUPP;
		}
	} else if (pin->type == MISC_PIN) {
		switch (param) {
		case PIN_CONFIG_DRIVE_STRENGTH:
		case PIN_CONFIG_DRIVE_STRENGTH:
			arg = (reg >> DRIVE_STRENGTH_SHIFT) &
			arg = (reg >> DRIVE_STRENGTH_SHIFT) &
				DRIVE_STRENGTH_MASK;
				DRIVE_STRENGTH_MASK;
@@ -606,7 +598,7 @@ static int sprd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin_id,
		if (pin->type == GLOBAL_CTRL_PIN &&
		if (pin->type == GLOBAL_CTRL_PIN &&
		    param == SPRD_PIN_CONFIG_CONTROL) {
		    param == SPRD_PIN_CONFIG_CONTROL) {
			val = arg;
			val = arg;
		} else if (pin->type == COMMON_PIN) {
		} else if (pin->type == COMMON_PIN || pin->type == MISC_PIN) {
			switch (param) {
			switch (param) {
			case SPRD_PIN_CONFIG_SLEEP_MODE:
			case SPRD_PIN_CONFIG_SLEEP_MODE:
				if (arg & AP_SLEEP)
				if (arg & AP_SLEEP)
@@ -639,13 +631,6 @@ static int sprd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin_id,
					shift = SLEEP_OUTPUT_SHIFT;
					shift = SLEEP_OUTPUT_SHIFT;
				}
				}
				break;
				break;
			case PIN_CONFIG_SLEEP_HARDWARE_STATE:
				continue;
			default:
				return -ENOTSUPP;
			}
		} else if (pin->type == MISC_PIN) {
			switch (param) {
			case PIN_CONFIG_DRIVE_STRENGTH:
			case PIN_CONFIG_DRIVE_STRENGTH:
				if (arg < 2 || arg > 60)
				if (arg < 2 || arg > 60)
					return -EINVAL;
					return -EINVAL;