* Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
*/
-#include <linux/gpio.h>
+#include <linux/err.h>
+#include <linux/gpio/consumer.h>
#include <linux/module.h>
+#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
-#include <linux/of_gpio.h>
#include <video/omapfb_dss.h>
struct omap_dss_device dssdev;
struct omap_dss_device *in;
- int pd_gpio;
+ struct gpio_desc *pd_gpio;
+
int data_lines;
struct omap_video_timings timings;
if (r)
return r;
- if (gpio_is_valid(ddata->pd_gpio))
- gpio_set_value_cansleep(ddata->pd_gpio, 1);
+ if (ddata->pd_gpio)
+ gpiod_set_value_cansleep(ddata->pd_gpio, 0);
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
if (!omapdss_device_is_enabled(dssdev))
return;
- if (gpio_is_valid(ddata->pd_gpio))
- gpio_set_value_cansleep(ddata->pd_gpio, 0);
+ if (ddata->pd_gpio)
+ gpiod_set_value_cansleep(ddata->pd_gpio, 1);
in->ops.dpi->disable(in);
.get_timings = tfp410_get_timings,
};
-static int tfp410_probe_of(struct platform_device *pdev)
-{
- struct panel_drv_data *ddata = platform_get_drvdata(pdev);
- struct device_node *node = pdev->dev.of_node;
- struct omap_dss_device *in;
- int gpio;
-
- gpio = of_get_named_gpio(node, "powerdown-gpios", 0);
-
- if (gpio_is_valid(gpio) || gpio == -ENOENT) {
- ddata->pd_gpio = gpio;
- } else {
- dev_err(&pdev->dev, "failed to parse PD gpio\n");
- return gpio;
- }
-
- in = omapdss_of_find_source_for_first_ep(node);
- if (IS_ERR(in)) {
- dev_err(&pdev->dev, "failed to find video source\n");
- return PTR_ERR(in);
- }
-
- ddata->in = in;
-
- return 0;
-}
-
static int tfp410_probe(struct platform_device *pdev)
{
struct panel_drv_data *ddata;
platform_set_drvdata(pdev, ddata);
- r = tfp410_probe_of(pdev);
- if (r)
+ ddata->pd_gpio = devm_gpiod_get_optional(&pdev->dev, "powerdown",
+ GPIOD_OUT_HIGH);
+ r = PTR_ERR_OR_ZERO(ddata->pd_gpio);
+ if (r) {
+ dev_err(&pdev->dev, "Failed to request PD GPIO: %d\n", r);
return r;
+ }
+
+ gpiod_set_consumer_name(ddata->pd_gpio, "tfp410 PD");
- if (gpio_is_valid(ddata->pd_gpio)) {
- r = devm_gpio_request_one(&pdev->dev, ddata->pd_gpio,
- GPIOF_OUT_INIT_LOW, "tfp410 PD");
- if (r) {
- dev_err(&pdev->dev, "Failed to request PD GPIO %d\n",
- ddata->pd_gpio);
- goto err_gpio;
- }
+ ddata->in = omapdss_of_find_source_for_first_ep(pdev->dev.of_node);
+ r = PTR_ERR_OR_ZERO(ddata->in);
+ if (r) {
+ dev_err(&pdev->dev, "failed to find video source: %d\n", r);
+ return r;
}
dssdev = &ddata->dssdev;
return 0;
err_reg:
-err_gpio:
omap_dss_put_device(ddata->in);
return r;
}