phy: qcom-qmp-combo: separate USB and DP init ops
Separate the USB and DP init and exit operations by calling the common initialisation code directly from the USB operation and adding a "dp" infix to the DP callbacks. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20221114110621.4639-9-johan+linaro@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
@@ -1964,7 +1964,7 @@ static int qmp_combo_com_exit(struct qmp_phy *qphy)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qmp_combo_init(struct phy *phy)
|
static int qmp_combo_dp_init(struct phy *phy)
|
||||||
{
|
{
|
||||||
struct qmp_phy *qphy = phy_get_drvdata(phy);
|
struct qmp_phy *qphy = phy_get_drvdata(phy);
|
||||||
const struct qmp_phy_cfg *cfg = qphy->cfg;
|
const struct qmp_phy_cfg *cfg = qphy->cfg;
|
||||||
@@ -1974,12 +1974,20 @@ static int qmp_combo_init(struct phy *phy)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (cfg->type == PHY_TYPE_DP)
|
|
||||||
cfg->dp_aux_init(qphy);
|
cfg->dp_aux_init(qphy);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int qmp_combo_dp_exit(struct phy *phy)
|
||||||
|
{
|
||||||
|
struct qmp_phy *qphy = phy_get_drvdata(phy);
|
||||||
|
|
||||||
|
qmp_combo_com_exit(qphy);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int qmp_combo_power_on(struct phy *phy)
|
static int qmp_combo_power_on(struct phy *phy)
|
||||||
{
|
{
|
||||||
struct qmp_phy *qphy = phy_get_drvdata(phy);
|
struct qmp_phy *qphy = phy_get_drvdata(phy);
|
||||||
@@ -2073,38 +2081,32 @@ static int qmp_combo_power_off(struct phy *phy)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qmp_combo_exit(struct phy *phy)
|
|
||||||
{
|
|
||||||
struct qmp_phy *qphy = phy_get_drvdata(phy);
|
|
||||||
|
|
||||||
qmp_combo_com_exit(qphy);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int qmp_combo_usb_init(struct phy *phy)
|
static int qmp_combo_usb_init(struct phy *phy)
|
||||||
{
|
{
|
||||||
|
struct qmp_phy *qphy = phy_get_drvdata(phy);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = qmp_combo_init(phy);
|
ret = qmp_combo_com_init(qphy);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = qmp_combo_power_on(phy);
|
ret = qmp_combo_power_on(phy);
|
||||||
if (ret)
|
if (ret)
|
||||||
qmp_combo_exit(phy);
|
qmp_combo_com_exit(qphy);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qmp_combo_usb_exit(struct phy *phy)
|
static int qmp_combo_usb_exit(struct phy *phy)
|
||||||
{
|
{
|
||||||
|
struct qmp_phy *qphy = phy_get_drvdata(phy);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = qmp_combo_power_off(phy);
|
ret = qmp_combo_power_off(phy);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
return qmp_combo_exit(phy);
|
|
||||||
|
return qmp_combo_com_exit(qphy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qmp_combo_usb_set_mode(struct phy *phy, enum phy_mode mode, int submode)
|
static int qmp_combo_usb_set_mode(struct phy *phy, enum phy_mode mode, int submode)
|
||||||
@@ -2124,12 +2126,12 @@ static const struct phy_ops qmp_combo_usb_phy_ops = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct phy_ops qmp_combo_dp_phy_ops = {
|
static const struct phy_ops qmp_combo_dp_phy_ops = {
|
||||||
.init = qmp_combo_init,
|
.init = qmp_combo_dp_init,
|
||||||
.configure = qcom_qmp_dp_phy_configure,
|
.configure = qcom_qmp_dp_phy_configure,
|
||||||
.power_on = qmp_combo_power_on,
|
.power_on = qmp_combo_power_on,
|
||||||
.calibrate = qcom_qmp_dp_phy_calibrate,
|
.calibrate = qcom_qmp_dp_phy_calibrate,
|
||||||
.power_off = qmp_combo_power_off,
|
.power_off = qmp_combo_power_off,
|
||||||
.exit = qmp_combo_exit,
|
.exit = qmp_combo_dp_exit,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user