Re: [PATCH v3 5/6] pinctrl: amd: Add amd_get_iomux_res function

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

 



On Tue, May 31, 2022 at 02:13:21PM +0530, Basavaraj Natikar wrote:
> Presently there is no way to change pinmux configuration run time.
> Hence add a function to get IOMUX resource which can be used to
> configure IOMUX GPIO pins run time.

> +static void amd_get_iomux_res(struct amd_gpio *gpio_dev)
> +{
> +	struct acpi_device *adev = ACPI_COMPANION(&gpio_dev->pdev->dev);


No need. See below.

	struct device *dev = &gpio_dev->pdev->dev;


and use it everywhere in this function. It makes lines shorter.

> +	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
> +	struct resource *res;
> +	int index;

> +	if (!adev)
> +		return;

No need.

> +	index = fwnode_property_match_string(acpi_fwnode_handle(adev),
> +					     "pinctrl-resource-names",  "iomux");


	index = device_property_match_string(dev, ...);

> +	if (index > 0) {
> +		res = platform_get_resource(gpio_dev->pdev, IORESOURCE_MEM, index);
> +		if (!res) {
> +			dev_warn(&gpio_dev->pdev->dev, "Failed to get iomux %d io resource\n",
> +				 index);

	dev_warn(dev, ...);

> +			return;
> +		}
> +
> +		gpio_dev->iomux_base = devm_ioremap(&gpio_dev->pdev->dev, res->start,
> +						    resource_size(res));
> +		if (!gpio_dev->iomux_base) {
> +			desc->pmxops = NULL;
> +			dev_warn(&gpio_dev->pdev->dev, "failed to devm_ioremap() iomux_base\n");
> +		}
> +	} else {
> +		desc->pmxops = NULL;
> +		dev_warn(&gpio_dev->pdev->dev, "failed to get iomux index\n");
> +	}
> +}

-- 
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