Skip to content

Commit aac0664

Browse files
committed
Merge tag 'drm/tegra/for-5.10-rc7' of ssh://git.freedesktop.org/git/tegra/linux into drm-fixes
drm/tegra: Fixes for v5.10-rc7 This is a set of small fixes for various issues found during the last couple of weeks. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thierry Reding <thierry.reding@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201127145324.125776-1-thierry.reding@gmail.com
2 parents b650545 + bf3a3cd commit aac0664

3 files changed

Lines changed: 36 additions & 43 deletions

File tree

drivers/gpu/drm/tegra/drm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int tegra_drm_open(struct drm_device *drm, struct drm_file *filp)
9090
if (!fpriv)
9191
return -ENOMEM;
9292

93-
idr_init(&fpriv->contexts);
93+
idr_init_base(&fpriv->contexts, 1);
9494
mutex_init(&fpriv->lock);
9595
filp->driver_priv = fpriv;
9696

drivers/gpu/drm/tegra/output.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ int tegra_output_probe(struct tegra_output *output)
129129

130130
if (!output->ddc) {
131131
err = -EPROBE_DEFER;
132-
of_node_put(ddc);
133132
return err;
134133
}
135134
}

drivers/gpu/drm/tegra/sor.c

Lines changed: 35 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ struct tegra_sor;
397397
struct tegra_sor_ops {
398398
const char *name;
399399
int (*probe)(struct tegra_sor *sor);
400-
int (*remove)(struct tegra_sor *sor);
401400
void (*audio_enable)(struct tegra_sor *sor);
402401
void (*audio_disable)(struct tegra_sor *sor);
403402
};
@@ -2942,6 +2941,24 @@ static const struct drm_encoder_helper_funcs tegra_sor_dp_helpers = {
29422941
.atomic_check = tegra_sor_encoder_atomic_check,
29432942
};
29442943

2944+
static void tegra_sor_disable_regulator(void *data)
2945+
{
2946+
struct regulator *reg = data;
2947+
2948+
regulator_disable(reg);
2949+
}
2950+
2951+
static int tegra_sor_enable_regulator(struct tegra_sor *sor, struct regulator *reg)
2952+
{
2953+
int err;
2954+
2955+
err = regulator_enable(reg);
2956+
if (err)
2957+
return err;
2958+
2959+
return devm_add_action_or_reset(sor->dev, tegra_sor_disable_regulator, reg);
2960+
}
2961+
29452962
static int tegra_sor_hdmi_probe(struct tegra_sor *sor)
29462963
{
29472964
int err;
@@ -2953,7 +2970,7 @@ static int tegra_sor_hdmi_probe(struct tegra_sor *sor)
29532970
return PTR_ERR(sor->avdd_io_supply);
29542971
}
29552972

2956-
err = regulator_enable(sor->avdd_io_supply);
2973+
err = tegra_sor_enable_regulator(sor, sor->avdd_io_supply);
29572974
if (err < 0) {
29582975
dev_err(sor->dev, "failed to enable AVDD I/O supply: %d\n",
29592976
err);
@@ -2967,7 +2984,7 @@ static int tegra_sor_hdmi_probe(struct tegra_sor *sor)
29672984
return PTR_ERR(sor->vdd_pll_supply);
29682985
}
29692986

2970-
err = regulator_enable(sor->vdd_pll_supply);
2987+
err = tegra_sor_enable_regulator(sor, sor->vdd_pll_supply);
29712988
if (err < 0) {
29722989
dev_err(sor->dev, "failed to enable VDD PLL supply: %d\n",
29732990
err);
@@ -2981,7 +2998,7 @@ static int tegra_sor_hdmi_probe(struct tegra_sor *sor)
29812998
return PTR_ERR(sor->hdmi_supply);
29822999
}
29833000

2984-
err = regulator_enable(sor->hdmi_supply);
3001+
err = tegra_sor_enable_regulator(sor, sor->hdmi_supply);
29853002
if (err < 0) {
29863003
dev_err(sor->dev, "failed to enable HDMI supply: %d\n", err);
29873004
return err;
@@ -2992,19 +3009,9 @@ static int tegra_sor_hdmi_probe(struct tegra_sor *sor)
29923009
return 0;
29933010
}
29943011

2995-
static int tegra_sor_hdmi_remove(struct tegra_sor *sor)
2996-
{
2997-
regulator_disable(sor->hdmi_supply);
2998-
regulator_disable(sor->vdd_pll_supply);
2999-
regulator_disable(sor->avdd_io_supply);
3000-
3001-
return 0;
3002-
}
3003-
30043012
static const struct tegra_sor_ops tegra_sor_hdmi_ops = {
30053013
.name = "HDMI",
30063014
.probe = tegra_sor_hdmi_probe,
3007-
.remove = tegra_sor_hdmi_remove,
30083015
.audio_enable = tegra_sor_hdmi_audio_enable,
30093016
.audio_disable = tegra_sor_hdmi_audio_disable,
30103017
};
@@ -3017,33 +3024,24 @@ static int tegra_sor_dp_probe(struct tegra_sor *sor)
30173024
if (IS_ERR(sor->avdd_io_supply))
30183025
return PTR_ERR(sor->avdd_io_supply);
30193026

3020-
err = regulator_enable(sor->avdd_io_supply);
3027+
err = tegra_sor_enable_regulator(sor, sor->avdd_io_supply);
30213028
if (err < 0)
30223029
return err;
30233030

30243031
sor->vdd_pll_supply = devm_regulator_get(sor->dev, "vdd-hdmi-dp-pll");
30253032
if (IS_ERR(sor->vdd_pll_supply))
30263033
return PTR_ERR(sor->vdd_pll_supply);
30273034

3028-
err = regulator_enable(sor->vdd_pll_supply);
3035+
err = tegra_sor_enable_regulator(sor, sor->vdd_pll_supply);
30293036
if (err < 0)
30303037
return err;
30313038

30323039
return 0;
30333040
}
30343041

3035-
static int tegra_sor_dp_remove(struct tegra_sor *sor)
3036-
{
3037-
regulator_disable(sor->vdd_pll_supply);
3038-
regulator_disable(sor->avdd_io_supply);
3039-
3040-
return 0;
3041-
}
3042-
30433042
static const struct tegra_sor_ops tegra_sor_dp_ops = {
30443043
.name = "DP",
30453044
.probe = tegra_sor_dp_probe,
3046-
.remove = tegra_sor_dp_remove,
30473045
};
30483046

30493047
static int tegra_sor_init(struct host1x_client *client)
@@ -3145,19 +3143,25 @@ static int tegra_sor_init(struct host1x_client *client)
31453143
if (err < 0) {
31463144
dev_err(sor->dev, "failed to deassert SOR reset: %d\n",
31473145
err);
3146+
clk_disable_unprepare(sor->clk);
31483147
return err;
31493148
}
31503149

31513150
reset_control_release(sor->rst);
31523151
}
31533152

31543153
err = clk_prepare_enable(sor->clk_safe);
3155-
if (err < 0)
3154+
if (err < 0) {
3155+
clk_disable_unprepare(sor->clk);
31563156
return err;
3157+
}
31573158

31583159
err = clk_prepare_enable(sor->clk_dp);
3159-
if (err < 0)
3160+
if (err < 0) {
3161+
clk_disable_unprepare(sor->clk_safe);
3162+
clk_disable_unprepare(sor->clk);
31603163
return err;
3164+
}
31613165

31623166
return 0;
31633167
}
@@ -3764,17 +3768,16 @@ static int tegra_sor_probe(struct platform_device *pdev)
37643768
return err;
37653769

37663770
err = tegra_output_probe(&sor->output);
3767-
if (err < 0) {
3768-
dev_err(&pdev->dev, "failed to probe output: %d\n", err);
3769-
return err;
3770-
}
3771+
if (err < 0)
3772+
return dev_err_probe(&pdev->dev, err,
3773+
"failed to probe output\n");
37713774

37723775
if (sor->ops && sor->ops->probe) {
37733776
err = sor->ops->probe(sor);
37743777
if (err < 0) {
37753778
dev_err(&pdev->dev, "failed to probe %s: %d\n",
37763779
sor->ops->name, err);
3777-
goto output;
3780+
goto remove;
37783781
}
37793782
}
37803783

@@ -3955,9 +3958,6 @@ static int tegra_sor_probe(struct platform_device *pdev)
39553958
rpm_disable:
39563959
pm_runtime_disable(&pdev->dev);
39573960
remove:
3958-
if (sor->ops && sor->ops->remove)
3959-
sor->ops->remove(sor);
3960-
output:
39613961
tegra_output_remove(&sor->output);
39623962
return err;
39633963
}
@@ -3976,12 +3976,6 @@ static int tegra_sor_remove(struct platform_device *pdev)
39763976

39773977
pm_runtime_disable(&pdev->dev);
39783978

3979-
if (sor->ops && sor->ops->remove) {
3980-
err = sor->ops->remove(sor);
3981-
if (err < 0)
3982-
dev_err(&pdev->dev, "failed to remove SOR: %d\n", err);
3983-
}
3984-
39853979
tegra_output_remove(&sor->output);
39863980

39873981
return 0;

0 commit comments

Comments
 (0)