Re: [PATCH V2 2/2] pinctrl: bcm2835: Implement bcm2711_pinconf_get

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sat, Mar 02, 2024 at 10:54:30AM +0100, Stefan Wahren kirjoitti:
> The BCM2711 allows to read the bias config. So implement pin_conf_get
> accordingly. The pull resistor values has been taken from the
> BCM2711/7211 datasheet.
> 
> This implementation assumes that BCM7211 behaves the same way.

...

> +	switch (param) {
> +	case PIN_CONFIG_BIAS_DISABLE:
> +		if (((val >> shift) & PUD_2711_MASK) == BCM2711_PULL_NONE)
> +			return 0;
> +		else
> +			return -EINVAL;

Redundant 'else' in all cases. Also as in previous patch, use single return point of success.

		if (((val >> shift) & PUD_2711_MASK) != BCM2711_PULL_NONE)
			return -EINVAL;
		break;

> +	case PIN_CONFIG_BIAS_PULL_UP:
> +		if (((val >> shift) & PUD_2711_MASK) == BCM2711_PULL_UP) {
> +			*config = pinconf_to_config_packed(param, 50000);
> +			return 0;
> +		} else {
> +			return -EINVAL;
> +		}
> +
> +	case PIN_CONFIG_BIAS_PULL_DOWN:
> +		if (((val >> shift) & PUD_2711_MASK) == BCM2711_PULL_DOWN) {
> +			*config = pinconf_to_config_packed(param, 50000);
> +			return 0;
> +		} else {
> +			return -EINVAL;
> +		}
> +
> +	default:
> +		break;

Return directly from here.

		return bcm2835_pinconf_get(pctldev, pin, config);

> +	}
> +
> +	return bcm2835_pinconf_get(pctldev, pin, config);

	return 0;

> +}

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux