Re: [PATCH 1/4] video: omapdss: Add opa362 driver

2014-11-12 Thread Tomi Valkeinen
Hi,


On 03/11/14 23:59, Marek Belisko wrote:
 opa362 is amplifier for videoand can be connected to the tvout pads
 of the OMAP3. It has one gpio control for enable/disable of the output
 (high impedance).
 
 Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
 ---
  drivers/video/fbdev/omap2/displays-new/Kconfig |   6 +
  drivers/video/fbdev/omap2/displays-new/Makefile|   1 +
  .../fbdev/omap2/displays-new/amplifier-opa362.c| 347 
 +
  3 files changed, 354 insertions(+)
  create mode 100644 drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c

This doesn't even compile:

drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c:207:28: error:
dereferencing pointer to incomplete type
  ddata-enable_gpio = pdata-enable_gpio;

And it seems to have fields for bypass and bypass which are handled in
the devconf1 patch.

 Tomi




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 1/4] video: omapdss: Add opa362 driver

2014-11-12 Thread Belisko Marek
Hi Tomi,

On Wed, Nov 12, 2014 at 2:57 PM, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 Hi,


 On 03/11/14 23:59, Marek Belisko wrote:
 opa362 is amplifier for videoand can be connected to the tvout pads
 of the OMAP3. It has one gpio control for enable/disable of the output
 (high impedance).

 Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
 ---
  drivers/video/fbdev/omap2/displays-new/Kconfig |   6 +
  drivers/video/fbdev/omap2/displays-new/Makefile|   1 +
  .../fbdev/omap2/displays-new/amplifier-opa362.c| 347 
 +
  3 files changed, 354 insertions(+)
  create mode 100644 drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c

 This doesn't even compile:

 drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c:207:28: error:
 dereferencing pointer to incomplete type
   ddata-enable_gpio = pdata-enable_gpio;
Hmm sorry about that. I must mixed something up. I'll post updated version soon.
Thanks for review.

 And it seems to have fields for bypass and bypass which are handled in
 the devconf1 patch.

  Tomi



BR,

marek

-- 
as simple and primitive as possible
-
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] video: omapdss: Add opa362 driver

2014-11-03 Thread Marek Belisko
opa362 is amplifier for videoand can be connected to the tvout pads
of the OMAP3. It has one gpio control for enable/disable of the output
(high impedance).

Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
---
 drivers/video/fbdev/omap2/displays-new/Kconfig |   6 +
 drivers/video/fbdev/omap2/displays-new/Makefile|   1 +
 .../fbdev/omap2/displays-new/amplifier-opa362.c| 347 +
 3 files changed, 354 insertions(+)
 create mode 100644 drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c

diff --git a/drivers/video/fbdev/omap2/displays-new/Kconfig 
b/drivers/video/fbdev/omap2/displays-new/Kconfig
index e6cfc38..211b3ec 100644
--- a/drivers/video/fbdev/omap2/displays-new/Kconfig
+++ b/drivers/video/fbdev/omap2/displays-new/Kconfig
@@ -1,6 +1,12 @@
 menu OMAP Display Device Drivers (new device model)
 depends on OMAP2_DSS
 
+config DISPLAY_AMPLIFIER_OPA362
+tristate external analog amplifier with output disable/high-Z (e.g. 
OPA362)
+   help
+ Driver to enable an external analog TV amplifier (e.g. OPA362)
+ through a GPIO.
+
 config DISPLAY_ENCODER_TFP410
 tristate TFP410 DPI to DVI Encoder
help
diff --git a/drivers/video/fbdev/omap2/displays-new/Makefile 
b/drivers/video/fbdev/omap2/displays-new/Makefile
index 0323a8a..b311542 100644
--- a/drivers/video/fbdev/omap2/displays-new/Makefile
+++ b/drivers/video/fbdev/omap2/displays-new/Makefile
@@ -1,3 +1,4 @@
+obj-$(CONFIG_DISPLAY_AMPLIFIER_OPA362) += amplifier-opa362.o
 obj-$(CONFIG_DISPLAY_ENCODER_TFP410) += encoder-tfp410.o
 obj-$(CONFIG_DISPLAY_ENCODER_TPD12S015) += encoder-tpd12s015.o
 obj-$(CONFIG_DISPLAY_CONNECTOR_DVI) += connector-dvi.o
diff --git a/drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c 
b/drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c
new file mode 100644
index 000..37b2443
--- /dev/null
+++ b/drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c
@@ -0,0 +1,347 @@
+/*
+ * OPA362 analog video amplifier with output/power control
+ *
+ * Copyright (C) 2014 Golden Delicious Computers
+ * Author: H. Nikolaus Schaller h...@goldelico.com
+ *
+ * based on encoder-tfp410
+ *
+ * Copyright (C) 2013 Texas Instruments
+ * Author: Tomi Valkeinen tomi.valkei...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+#include linux/gpio.h
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/slab.h
+#include linux/of_gpio.h
+
+#include video/omapdss.h
+#include video/omap-panel-data.h
+
+struct panel_drv_data {
+   struct omap_dss_device dssdev;
+   struct omap_dss_device *in;
+
+   int enable_gpio;
+   bool bypass;
+   bool acbias;
+
+   struct omap_video_timings timings;
+};
+
+#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
+
+static int opa362_connect(struct omap_dss_device *dssdev,
+   struct omap_dss_device *dst)
+{
+   struct panel_drv_data *ddata = to_panel_data(dssdev);
+   struct omap_dss_device *in = ddata-in;
+   int r;
+
+   dev_dbg(dssdev-dev, connect\n);
+
+   if (omapdss_device_is_connected(dssdev))
+   return -EBUSY;
+
+   r = in-ops.atv-connect(in, dssdev);
+   if (r)
+   return r;
+
+   dst-src = dssdev;
+   dssdev-dst = dst;
+
+   return 0;
+}
+
+static void opa362_disconnect(struct omap_dss_device *dssdev,
+   struct omap_dss_device *dst)
+{
+   struct panel_drv_data *ddata = to_panel_data(dssdev);
+   struct omap_dss_device *in = ddata-in;
+
+   dev_dbg(dssdev-dev, disconnect\n);
+
+   WARN_ON(!omapdss_device_is_connected(dssdev));
+   if (!omapdss_device_is_connected(dssdev))
+   return;
+
+   WARN_ON(dst != dssdev-dst);
+   if (dst != dssdev-dst)
+   return;
+
+   dst-src = NULL;
+   dssdev-dst = NULL;
+
+   in-ops.atv-disconnect(in, ddata-dssdev);
+}
+
+static int opa362_enable(struct omap_dss_device *dssdev)
+{
+   struct panel_drv_data *ddata = to_panel_data(dssdev);
+   struct omap_dss_device *in = ddata-in;
+   int r;
+
+   dev_dbg(dssdev-dev, enable\n);
+
+   if (!omapdss_device_is_connected(dssdev))
+   return -ENODEV;
+
+   if (omapdss_device_is_enabled(dssdev))
+   return 0;
+
+   in-ops.atv-set_timings(in, ddata-timings);
+   /* fixme: should we receive the invert from our consumer, i.e. the 
connector? */
+   in-ops.atv-invert_vid_out_polarity(in, true);
+
+   r = in-ops.atv-enable(in);
+   if (r)
+   return r;
+
+   if (gpio_is_valid(ddata-enable_gpio))
+   gpio_set_value_cansleep(ddata-enable_gpio, 1);
+
+   dssdev-state = OMAP_DSS_DISPLAY_ACTIVE;
+
+   return 0;
+}
+
+static void opa362_disable(struct omap_dss_device *dssdev)
+{
+