[PATCH 05/13] usb: typec: qcom-pmic-typec: allow different implementations for the PD PHY
Konrad Dybcio
konrad.dybcio at linaro.org
Sat Jan 13 02:32:32 PST 2024
On 13.01.2024 06:42, Dmitry Baryshkov wrote:
> Rework Qualcomm PMIC TCPM driver to allow different platform-specific
> implementations of the PD PHY interface. While majority of platforms
> has the same of register for the PD PHY, some obscure ones (PMI632) do
> not have real PD PHY support. Add proper interface between the main
> module and the PD PHY backend to allow switching the PD PHY
> implementation.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>
> ---
[...]
> @@ -366,12 +439,13 @@ int qcom_pmic_typec_pdphy_set_roles(struct pmic_typec_pdphy *pmic_typec_pdphy,
> pmic_typec_pdphy->base + USB_PDPHY_MSG_CONFIG_REG,
> MSG_CONFIG_PORT_DATA_ROLE |
> MSG_CONFIG_PORT_POWER_ROLE,
> - data_role_host << 3 | power_role_src << 2);
> + (data_role == TYPEC_HOST ? MSG_CONFIG_PORT_DATA_ROLE : 0) |
> + (power_role == TYPEC_SOURCE ? MSG_CONFIG_PORT_POWER_ROLE : 0));
Was this hunk supposed to be part of this patch?
[...]
> int qcom_pmic_typec_pdphy_probe(struct platform_device *pdev,
> - struct pmic_typec_pdphy *pmic_typec_pdphy,
> - struct pmic_typec_pdphy_resources *res,
> + struct pmic_typec *tcpm,
> + const struct pmic_typec_pdphy_resources *res,
> struct regmap *regmap,
> u32 base)
> {
> + struct pmic_typec_pdphy *pmic_typec_pdphy;
> struct device *dev = &pdev->dev;
> struct pmic_typec_pdphy_irq_data *irq_data;
> int i, ret, irq;
>
> + pmic_typec_pdphy = devm_kzalloc(dev, sizeof(struct pmic_typec_pdphy), GFP_KERNEL);
> + if (!pmic_typec_pdphy)
> + return -ENOMEM;
or simply sizeof(*pdphy)
Konrad
More information about the linux-phy
mailing list