UPSTREAM: drm/tegra: Get ref for DP AUX channel, not its ddc adapter

While we're taking a reference of the DDC adapter for a DP AUX channel in
tegra_sor_probe() because we're going to be using that adapter with the
SOR, now that we've moved where AUX registration happens the actual device
structure for the DDC adapter isn't initialized yet. Which means that we
can't really take a reference from it to try to keep it around anymore.

This should be fine though, because we can just take a reference of its
parent instead.

v2:
* Avoid calling i2c_put_adapter() in tegra_output_remove() for eDP/DP cases

Change-Id: I2a992474c16db294ecfb4ab5ce5da7419bad6851
Signed-off-by: Lyude Paul <lyude@redhat.com>
Fixes: 39c17ae60ea9 ("drm/tegra: Don't register DP AUX channels before connectors")
Cc: Lyude Paul <lyude@redhat.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545950
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Lyude Paul
2021-05-14 18:13:05 -04:00
committed by Laxman Dewangan
parent f0231b05dc
commit 7cd5671ce4
2 changed files with 7 additions and 4 deletions

View File

@@ -180,10 +180,13 @@ int tegra_output_probe(struct tegra_output *output)
void tegra_output_remove(struct tegra_output *output) void tegra_output_remove(struct tegra_output *output)
{ {
int connector_type = output->connector.connector_type;
if (output->hpd_gpio) if (output->hpd_gpio)
free_irq(output->hpd_irq, output); free_irq(output->hpd_irq, output);
if (output->ddc) if (connector_type != DRM_MODE_CONNECTOR_eDP &&
connector_type != DRM_MODE_CONNECTOR_DisplayPort && output->ddc)
i2c_put_adapter(output->ddc); i2c_put_adapter(output->ddc);
} }

View File

@@ -3741,11 +3741,11 @@ static int tegra_sor_probe(struct platform_device *pdev)
if (!sor->aux) if (!sor->aux)
return -EPROBE_DEFER; return -EPROBE_DEFER;
if (get_device(&sor->aux->ddc.dev)) { if (get_device(sor->aux->dev)) {
if (try_module_get(sor->aux->ddc.owner)) if (try_module_get(sor->aux->dev->driver->owner))
sor->output.ddc = &sor->aux->ddc; sor->output.ddc = &sor->aux->ddc;
else else
put_device(&sor->aux->ddc.dev); put_device(sor->aux->dev);
} }
} }