Skip to content

Commit

Permalink
pinctrl: qcom: pass pin number to get_function_mux callback
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Caleb Connolly <[email protected]>
Reviewed-by: Sumit Garg <[email protected]>
Signed-off-by: Caleb Connolly <[email protected]>
  • Loading branch information
lorc authored and calebccff committed Apr 4, 2024
1 parent b563e76 commit 493f069
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion drivers/pinctrl/qcom/pinctrl-apq8016.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/pinctrl/qcom/pinctrl-apq8096.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/pinctrl/qcom/pinctrl-ipq4019.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/pinctrl/qcom/pinctrl-qcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ 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);

/* Always NOP for special pins, assume they're in the correct state */
if (qcom_is_special_pin(&priv->data->pin_data, pin_selector))
return 0;

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

Expand Down
3 changes: 2 additions & 1 deletion drivers/pinctrl/qcom/pinctrl-qcom.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
3 changes: 2 additions & 1 deletion drivers/pinctrl/qcom/pinctrl-qcs404.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,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;
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/pinctrl/qcom/pinctrl-sdm845.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 493f069

Please sign in to comment.