On 29/02/2024 14:21, Volodymyr Babchuk wrote:
> This patch is the preparation for SM8150 support. This new SoC
> depending on the particular pin can have different numbers for the
> same function. For example "rgmii" function for GPIO4 has id=2 while
> for GPIO59 it has id=1. So, to support this type of SoCs,
> get_function_mux() callback needs to know for which pin the function
> is requested.
> 
> Signed-off-by: Volodymyr Babchuk <volodymyr_babc...@epam.com>
Reviewed-by: Caleb Connolly <caleb.conno...@linaro.org>
> ---
> 
>  drivers/pinctrl/qcom/pinctrl-apq8016.c | 3 ++-
>  drivers/pinctrl/qcom/pinctrl-apq8096.c | 3 ++-
>  drivers/pinctrl/qcom/pinctrl-ipq4019.c | 3 ++-
>  drivers/pinctrl/qcom/pinctrl-qcom.c    | 4 ++--
>  drivers/pinctrl/qcom/pinctrl-qcom.h    | 3 ++-
>  drivers/pinctrl/qcom/pinctrl-qcs404.c  | 3 ++-
>  drivers/pinctrl/qcom/pinctrl-sdm845.c  | 3 ++-
>  7 files changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pinctrl/qcom/pinctrl-apq8016.c 
> b/drivers/pinctrl/qcom/pinctrl-apq8016.c
> index 8149ffd83c..53042b6e05 100644
> --- a/drivers/pinctrl/qcom/pinctrl-apq8016.c
> +++ b/drivers/pinctrl/qcom/pinctrl-apq8016.c
> @@ -49,7 +49,8 @@ static const char *apq8016_get_pin_name(struct udevice *dev,
>       }
>  }
>  
> -static unsigned int apq8016_get_function_mux(unsigned int selector)
> +static unsigned int apq8016_get_function_mux(__maybe_unused unsigned int pin,
> +                                          unsigned int selector)
>  {
>       return msm_pinctrl_functions[selector].val;
>  }
> diff --git a/drivers/pinctrl/qcom/pinctrl-apq8096.c 
> b/drivers/pinctrl/qcom/pinctrl-apq8096.c
> index d64ab1ff7b..8dcd171259 100644
> --- a/drivers/pinctrl/qcom/pinctrl-apq8096.c
> +++ b/drivers/pinctrl/qcom/pinctrl-apq8096.c
> @@ -44,7 +44,8 @@ static const char *apq8096_get_pin_name(struct udevice *dev,
>       }
>  }
>  
> -static unsigned int apq8096_get_function_mux(unsigned int selector)
> +static unsigned int apq8096_get_function_mux(__maybe_unused unsigned int pin,
> +                                          unsigned int selector)
>  {
>       return msm_pinctrl_functions[selector].val;
>  }
> diff --git a/drivers/pinctrl/qcom/pinctrl-ipq4019.c 
> b/drivers/pinctrl/qcom/pinctrl-ipq4019.c
> index 2d99f99e1e..c2c358f556 100644
> --- a/drivers/pinctrl/qcom/pinctrl-ipq4019.c
> +++ b/drivers/pinctrl/qcom/pinctrl-ipq4019.c
> @@ -40,7 +40,8 @@ static const char *ipq4019_get_pin_name(struct udevice *dev,
>       return pin_name;
>  }
>  
> -static unsigned int ipq4019_get_function_mux(unsigned int selector)
> +static unsigned int ipq4019_get_function_mux(__maybe_unused unsigned int pin,
> +                                          unsigned int selector)
>  {
>       return msm_pinctrl_functions[selector].val;
>  }
> diff --git a/drivers/pinctrl/qcom/pinctrl-qcom.c 
> b/drivers/pinctrl/qcom/pinctrl-qcom.c
> index dc3d8c4d90..de0bb4de0a 100644
> --- a/drivers/pinctrl/qcom/pinctrl-qcom.c
> +++ b/drivers/pinctrl/qcom/pinctrl-qcom.c
> @@ -82,10 +82,10 @@ static int msm_pinmux_set(struct udevice *dev, unsigned 
> int pin_selector,
>                         unsigned int func_selector)
>  {
>       struct msm_pinctrl_priv *priv = dev_get_priv(dev);
> +     u32 func = priv->data->get_function_mux(pin_selector, func_selector);
>  
>       clrsetbits_le32(priv->base + GPIO_CONFIG_REG(priv, pin_selector),
> -                     TLMM_FUNC_SEL_MASK | TLMM_GPIO_DISABLE,
> -                     priv->data->get_function_mux(func_selector) << 2);
> +                     TLMM_FUNC_SEL_MASK | TLMM_GPIO_DISABLE, func << 2);
>       return 0;
>  }
>  
> diff --git a/drivers/pinctrl/qcom/pinctrl-qcom.h 
> b/drivers/pinctrl/qcom/pinctrl-qcom.h
> index 07f2eae9ba..49b7bfbc00 100644
> --- a/drivers/pinctrl/qcom/pinctrl-qcom.h
> +++ b/drivers/pinctrl/qcom/pinctrl-qcom.h
> @@ -18,7 +18,8 @@ struct msm_pinctrl_data {
>       int functions_count;
>       const char *(*get_function_name)(struct udevice *dev,
>                                        unsigned int selector);
> -     unsigned int (*get_function_mux)(unsigned int selector);
> +     unsigned int (*get_function_mux)(unsigned int pin,
> +                                      unsigned int selector);
>       const char *(*get_pin_name)(struct udevice *dev,
>                                   unsigned int selector);
>  };
> diff --git a/drivers/pinctrl/qcom/pinctrl-qcs404.c 
> b/drivers/pinctrl/qcom/pinctrl-qcs404.c
> index ac00afa2a1..977f7b2ac3 100644
> --- a/drivers/pinctrl/qcom/pinctrl-qcs404.c
> +++ b/drivers/pinctrl/qcom/pinctrl-qcs404.c
> @@ -56,7 +56,8 @@ static const char *qcs404_get_pin_name(struct udevice *dev,
>       }
>  }
>  
> -static unsigned int qcs404_get_function_mux(unsigned int selector)
> +static unsigned int qcs404_get_function_mux(__maybe_unused unsigned int pin,
> +                                         unsigned int selector)
>  {
>       return msm_pinctrl_functions[selector].val;
>  }
> diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c 
> b/drivers/pinctrl/qcom/pinctrl-sdm845.c
> index 9f0f4085ce..64ce1bf15e 100644
> --- a/drivers/pinctrl/qcom/pinctrl-sdm845.c
> +++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c
> @@ -70,7 +70,8 @@ static const char *sdm845_get_pin_name(struct udevice *dev,
>       return pin_name;
>  }
>  
> -static unsigned int sdm845_get_function_mux(unsigned int selector)
> +static unsigned int sdm845_get_function_mux(__maybe_unused unsigned int pin,
> +                                         unsigned int selector)
>  {
>       return msm_pinctrl_functions[selector].val;
>  }

-- 
// Caleb (they/them)

Reply via email to