Skip to content

Commit 98365ca

Browse files
committed
drm/tegra: convert to struct drm_edid
Prefer the struct drm_edid based functions for reading the EDID and updating the connector. Acked-by: Thierry Reding <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/e764b50f4ad2de95e449ccb37f49c3f37b3333fc.1724348429.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <[email protected]>
1 parent f7945d9 commit 98365ca

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

drivers/gpu/drm/tegra/drm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ struct tegra_output {
133133
struct drm_bridge *bridge;
134134
struct drm_panel *panel;
135135
struct i2c_adapter *ddc;
136-
const struct edid *edid;
136+
const struct drm_edid *drm_edid;
137137
struct cec_notifier *cec;
138138
unsigned int hpd_irq;
139139
struct gpio_desc *hpd_gpio;

drivers/gpu/drm/tegra/output.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
int tegra_output_connector_get_modes(struct drm_connector *connector)
2222
{
2323
struct tegra_output *output = connector_to_output(connector);
24-
struct edid *edid = NULL;
24+
const struct drm_edid *drm_edid;
2525
int err = 0;
2626

2727
/*
@@ -34,18 +34,17 @@ int tegra_output_connector_get_modes(struct drm_connector *connector)
3434
return err;
3535
}
3636

37-
if (output->edid)
38-
edid = kmemdup(output->edid, sizeof(*edid), GFP_KERNEL);
37+
if (output->drm_edid)
38+
drm_edid = drm_edid_dup(output->drm_edid);
3939
else if (output->ddc)
40-
edid = drm_get_edid(connector, output->ddc);
40+
drm_edid = drm_edid_read_ddc(connector, output->ddc);
4141

42-
cec_notifier_set_phys_addr_from_edid(output->cec, edid);
43-
drm_connector_update_edid_property(connector, edid);
42+
drm_edid_connector_update(connector, drm_edid);
43+
cec_notifier_set_phys_addr(output->cec,
44+
connector->display_info.source_physical_address);
4445

45-
if (edid) {
46-
err = drm_add_edid_modes(connector, edid);
47-
kfree(edid);
48-
}
46+
err = drm_edid_connector_add_modes(connector);
47+
drm_edid_free(drm_edid);
4948

5049
return err;
5150
}
@@ -98,6 +97,7 @@ static irqreturn_t hpd_irq(int irq, void *data)
9897
int tegra_output_probe(struct tegra_output *output)
9998
{
10099
struct device_node *ddc, *panel;
100+
const void *edid;
101101
unsigned long flags;
102102
int err, size;
103103

@@ -124,8 +124,6 @@ int tegra_output_probe(struct tegra_output *output)
124124
return PTR_ERR(output->panel);
125125
}
126126

127-
output->edid = of_get_property(output->of_node, "nvidia,edid", &size);
128-
129127
ddc = of_parse_phandle(output->of_node, "nvidia,ddc-i2c-bus", 0);
130128
if (ddc) {
131129
output->ddc = of_get_i2c_adapter_by_node(ddc);
@@ -137,6 +135,9 @@ int tegra_output_probe(struct tegra_output *output)
137135
}
138136
}
139137

138+
edid = of_get_property(output->of_node, "nvidia,edid", &size);
139+
output->drm_edid = drm_edid_alloc(edid, size);
140+
140141
output->hpd_gpio = devm_fwnode_gpiod_get(output->dev,
141142
of_fwnode_handle(output->of_node),
142143
"nvidia,hpd",
@@ -187,6 +188,8 @@ int tegra_output_probe(struct tegra_output *output)
187188
if (output->ddc)
188189
i2c_put_adapter(output->ddc);
189190

191+
drm_edid_free(output->drm_edid);
192+
190193
return err;
191194
}
192195

@@ -197,6 +200,8 @@ void tegra_output_remove(struct tegra_output *output)
197200

198201
if (output->ddc)
199202
i2c_put_adapter(output->ddc);
203+
204+
drm_edid_free(output->drm_edid);
200205
}
201206

202207
int tegra_output_init(struct drm_device *drm, struct tegra_output *output)

0 commit comments

Comments
 (0)