Get Pin Control Status

By using the pinctrl_lookup_state interface, you can obtain all the pin status of a device.

The following code block provides an example.
        pcie->perst_state_def
                = pinctrl_lookup_state(pcie->pinctrl, "perst-default");
        if (IS_ERR_OR_NULL(pcie->perst_state_def)) {
                dev_err(dev, "Failed to get the perst-default pinctrl han-dle\n");
                return -EINVAL;
        }

        pcie->perst_state_active
                = pinctrl_lookup_state(pcie->pinctrl, "perst-active");
        if (IS_ERR_OR_NULL(pcie->perst_state_active)) {
                dev_err(dev, "Failed to get the perst-active pinctrl handle\n");
                return -EINVAL;
        }

        pcie->power_state_active
                = pinctrl_lookup_state(pcie->pinctrl, "power-active");
        if (IS_ERR_OR_NULL(pcie->power_state_active)) {
                dev_err(dev, "Failed to get the power-default pinctrl han-dle\n");
                return -EINVAL;
        }