summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/tegra
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2019-06-25 12:59:35 +1000
committerDave Airlie <airlied@redhat.com>2019-06-25 12:59:43 +1000
commitdfd03396d7b66f90071aa5e8fdc0f3c4a66471c5 (patch)
tree0988d127866346fdeb1f63f9cb87266edca3fe05 /drivers/gpu/drm/tegra
parent9b75276e4fb190b47ed62693cc4d9549a45c76a2 (diff)
parenteb7cf945a8dac8603e6d0759023e9b6cfed7a008 (diff)
Merge tag 'drm/tegra/for-5.3-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next
drm/tegra: Changes for v5.3-rc1 This contains a couple of small improvements and cleanups for the Tegra DRM driver. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thierry Reding <thierry.reding@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190621150753.19550-1-thierry.reding@gmail.com
Diffstat (limited to 'drivers/gpu/drm/tegra')
-rw-r--r--drivers/gpu/drm/tegra/dpaux.c13
-rw-r--r--drivers/gpu/drm/tegra/drm.h3
-rw-r--r--drivers/gpu/drm/tegra/output.c52
3 files changed, 29 insertions, 39 deletions
diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
index ee4180d8db14..65c389d9c85d 100644
--- a/drivers/gpu/drm/tegra/dpaux.c
+++ b/drivers/gpu/drm/tegra/dpaux.c
@@ -485,11 +485,16 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
return err;
}
- dpaux->vdd = devm_regulator_get(&pdev->dev, "vdd");
+ dpaux->vdd = devm_regulator_get_optional(&pdev->dev, "vdd");
if (IS_ERR(dpaux->vdd)) {
- dev_err(&pdev->dev, "failed to get VDD supply: %ld\n",
- PTR_ERR(dpaux->vdd));
- return PTR_ERR(dpaux->vdd);
+ if (PTR_ERR(dpaux->vdd) != -ENODEV) {
+ if (PTR_ERR(dpaux->vdd) != -EPROBE_DEFER)
+ dev_err(&pdev->dev,
+ "failed to get VDD supply: %ld\n",
+ PTR_ERR(dpaux->vdd));
+
+ return PTR_ERR(dpaux->vdd);
+ }
}
platform_set_drvdata(pdev, dpaux);
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 70154c253d45..488f36f00bd8 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -127,8 +127,7 @@ struct tegra_output {
const struct edid *edid;
struct cec_notifier *cec;
unsigned int hpd_irq;
- int hpd_gpio;
- enum of_gpio_flags hpd_gpio_flags;
+ struct gpio_desc *hpd_gpio;
struct drm_encoder encoder;
struct drm_connector connector;
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index 9c2b9dad55c3..e4d242ca27b8 100644
--- a/drivers/gpu/drm/tegra/output.c
+++ b/drivers/gpu/drm/tegra/output.c
@@ -53,18 +53,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force)
struct tegra_output *output = connector_to_output(connector);
enum drm_connector_status status = connector_status_unknown;
- if (gpio_is_valid(output->hpd_gpio)) {
- if (output->hpd_gpio_flags & OF_GPIO_ACTIVE_LOW) {
- if (gpio_get_value(output->hpd_gpio) != 0)
- status = connector_status_disconnected;
- else
- status = connector_status_connected;
- } else {
- if (gpio_get_value(output->hpd_gpio) == 0)
- status = connector_status_disconnected;
- else
- status = connector_status_connected;
- }
+ if (output->hpd_gpio) {
+ if (gpiod_get_value(output->hpd_gpio) == 0)
+ status = connector_status_disconnected;
+ else
+ status = connector_status_connected;
} else {
if (!output->panel)
status = connector_status_disconnected;
@@ -102,6 +95,7 @@ static irqreturn_t hpd_irq(int irq, void *data)
int tegra_output_probe(struct tegra_output *output)
{
struct device_node *ddc, *panel;
+ unsigned long flags;
int err, size;
if (!output->of_node)
@@ -130,23 +124,18 @@ int tegra_output_probe(struct tegra_output *output)
of_node_put(ddc);
}
- output->hpd_gpio = of_get_named_gpio_flags(output->of_node,
- "nvidia,hpd-gpio", 0,
- &output->hpd_gpio_flags);
- if (gpio_is_valid(output->hpd_gpio)) {
- unsigned long flags;
+ output->hpd_gpio = devm_gpiod_get_from_of_node(output->dev,
+ output->of_node,
+ "nvidia,hpd-gpio", 0,
+ GPIOD_IN,
+ "HDMI hotplug detect");
+ if (IS_ERR(output->hpd_gpio))
+ return PTR_ERR(output->hpd_gpio);
- err = gpio_request_one(output->hpd_gpio, GPIOF_DIR_IN,
- "HDMI hotplug detect");
+ if (output->hpd_gpio) {
+ err = gpiod_to_irq(output->hpd_gpio);
if (err < 0) {
- dev_err(output->dev, "gpio_request_one(): %d\n", err);
- return err;
- }
-
- err = gpio_to_irq(output->hpd_gpio);
- if (err < 0) {
- dev_err(output->dev, "gpio_to_irq(): %d\n", err);
- gpio_free(output->hpd_gpio);
+ dev_err(output->dev, "gpiod_to_irq(): %d\n", err);
return err;
}
@@ -160,7 +149,6 @@ int tegra_output_probe(struct tegra_output *output)
if (err < 0) {
dev_err(output->dev, "failed to request IRQ#%u: %d\n",
output->hpd_irq, err);
- gpio_free(output->hpd_gpio);
return err;
}
@@ -186,10 +174,8 @@ void tegra_output_remove(struct tegra_output *output)
if (output->cec)
cec_notifier_put(output->cec);
- if (gpio_is_valid(output->hpd_gpio)) {
+ if (output->hpd_gpio)
free_irq(output->hpd_irq, output);
- gpio_free(output->hpd_gpio);
- }
if (output->ddc)
put_device(&output->ddc->dev);
@@ -209,7 +195,7 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
* The connector is now registered and ready to receive hotplug events
* so the hotplug interrupt can be enabled.
*/
- if (gpio_is_valid(output->hpd_gpio))
+ if (output->hpd_gpio)
enable_irq(output->hpd_irq);
return 0;
@@ -221,7 +207,7 @@ void tegra_output_exit(struct tegra_output *output)
* The connector is going away, so the interrupt must be disabled to
* prevent the hotplug interrupt handler from potentially crashing.
*/
- if (gpio_is_valid(output->hpd_gpio))
+ if (output->hpd_gpio)
disable_irq(output->hpd_irq);
if (output->panel)