Re: [PATCHv2 01/56] ARM: dts: omap: add channel to DSI panels

2020-02-24 Thread Sebastian Reichel
Hi Laurent,

On Tue, Feb 25, 2020 at 01:38:21AM +0200, Laurent Pinchart wrote:
> Hi Sebastian,
> 
> Thank you for the patch.
> 
> On Tue, Feb 25, 2020 at 12:20:31AM +0100, Sebastian Reichel wrote:
> > The standard binding for DSI requires, that the channel number
> > of the panel is encoded in DT. This adds the channel number in
> > all OMAP3-5 boards, in preparation for using common infrastructure.
> > 
> > Signed-off-by: Sebastian Reichel 
> > ---
> >  .../devicetree/bindings/display/panel/panel-dsi-cm.txt  | 4 +++-
> >  arch/arm/boot/dts/motorola-mapphone-common.dtsi | 3 ++-
> >  arch/arm/boot/dts/omap3-n950.dts| 3 ++-
> >  arch/arm/boot/dts/omap3.dtsi| 3 +++
> >  arch/arm/boot/dts/omap4-sdp.dts | 6 --
> >  arch/arm/boot/dts/omap4.dtsi| 6 ++
> >  arch/arm/boot/dts/omap5.dtsi| 6 ++
> >  7 files changed, 26 insertions(+), 5 deletions(-)
> > 
> > diff --git 
> > a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt 
> > b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
> > index dce48eb9db57..f92d5c9adfc5 100644
> > --- a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
> > +++ b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
> > @@ -3,6 +3,7 @@ Generic MIPI DSI Command Mode Panel
> >  
> >  Required properties:
> >  - compatible: "panel-dsi-cm"
> > +- reg: DSI channel number
> >  
> >  Optional properties:
> >  - label: a symbolic name for the panel
> > @@ -15,9 +16,10 @@ Required nodes:
> >  Example
> >  ---
> >  
> > -lcd0: display {
> > +lcd0: panel@0 {
> > compatible = "tpo,taal", "panel-dsi-cm";
> > label = "lcd0";
> > +   reg = <0>;
> >  
> > reset-gpios = < 6 GPIO_ACTIVE_HIGH>;
> >  
> 
> While at it, how about converting this to yaml ?

Ack. I was waiting for the dsi-controller YAML bindings to land,
which has happened in the meantime. I think it's better to do
this in a separate patch though, so that this one can easily be
backported.

-- Sebastian

> > diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
> > b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
> > index 85665506f4f8..a5e4ba7c8dab 100644
> > --- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
> > +++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
> > @@ -199,8 +199,9 @@ dsi1_out_ep: endpoint {
> > };
> > };
> >  
> > -   lcd0: display {
> > +   lcd0: panel@0 {
> > compatible = "panel-dsi-cm";
> > +   reg = <0>;
> > label = "lcd0";
> > vddi-supply = <_regulator>;
> > reset-gpios = < 5 GPIO_ACTIVE_HIGH>;  /* gpio101 */
> > diff --git a/arch/arm/boot/dts/omap3-n950.dts 
> > b/arch/arm/boot/dts/omap3-n950.dts
> > index 31d47a1fad84..80cf4e1177da 100644
> > --- a/arch/arm/boot/dts/omap3-n950.dts
> > +++ b/arch/arm/boot/dts/omap3-n950.dts
> > @@ -225,8 +225,9 @@ dsi_out_ep: endpoint {
> > };
> > };
> >  
> > -   lcd0: display {
> > +   lcd0: panel@0 {
> > compatible = "nokia,himalaya", "panel-dsi-cm";
> > +   reg = <0>;
> > label = "lcd0";
> >  
> > pinctrl-names = "default";
> > diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
> > index 634ea16a711e..409d434a9b18 100644
> > --- a/arch/arm/boot/dts/omap3.dtsi
> > +++ b/arch/arm/boot/dts/omap3.dtsi
> > @@ -820,6 +820,9 @@ dsi: encoder@4804fc00 {
> > ti,hwmods = "dss_dsi1";
> > clocks = <_alwon_fck>, <_alwon_fck>;
> > clock-names = "fck", "sys_clk";
> > +
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > };
> >  
> > rfbi: encoder@48050800 {
> > diff --git a/arch/arm/boot/dts/omap4-sdp.dts 
> > b/arch/arm/boot/dts/omap4-sdp.dts
> > index 91480ac1f328..8a8307517dab 100644
> > --- a/arch/arm/boot/dts/omap4-sdp.dts
> > +++ b/arch/arm/boot/dts/omap4-sdp.dts
> > @@ -662,8 +662,9 @@ dsi1_out_ep: endpoint {
> > };

Re: [PATCHv2 02/56] ARM: dts: omap4-droid4: add panel compatible

2020-02-24 Thread Sebastian Reichel
Hi Laurent,

On Tue, Feb 25, 2020 at 01:37:08AM +0200, Laurent Pinchart wrote:
> Hi Sebastian,
> 
> Thank you for the patch.

Thanks for the review.

> On Tue, Feb 25, 2020 at 12:20:32AM +0100, Sebastian Reichel wrote:
> > Add Droid 4 specific compatible value in addition to the
> > generic one, so that we have the ability to add panel
> > specific quirks in the future.
> 
> We need to document this compatible string in DT bindings, I don't think
> this is included in this series.

Correct, right now none of the extra compatible strings are
documented in the binding file. E.g. "tpo,taal" is used by
omap4-sdp and in the example section of the DT bindings.

> Furthermore, could we use a compatible string that actually
> matches the panel vendor and model, instead of the device name ?

We don't know the Droid 4 panel vendor and/or model. For
N950 "nokia,himalaya" is used, which is obviously also
not the real vendor. But for N950 there is a good reason
to use a N950 specific compatible anyways, since some
pixels are covered by plastic.

Maybe this can just be handled when the bindings file is
converted to YAML?

-- Sebastian

> 
> > Signed-off-by: Sebastian Reichel 
> > ---
> >  arch/arm/boot/dts/motorola-mapphone-common.dtsi | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
> > b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
> > index a5e4ba7c8dab..622383ec6a75 100644
> > --- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
> > +++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
> > @@ -200,7 +200,7 @@ dsi1_out_ep: endpoint {
> > };
> >  
> > lcd0: panel@0 {
> > -   compatible = "panel-dsi-cm";
> > +   compatible = "motorola,droid4-panel", "panel-dsi-cm";
> > reg = <0>;
> > label = "lcd0";
> > vddi-supply = <_regulator>;
> 
> -- 
> Regards,
> 
> Laurent Pinchart


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv2 00/56] drm/omap: Convert DSI code to use drm_mipi_dsi and drm_panel

2020-02-24 Thread Sebastian Reichel
Hi,

On Mon, Feb 24, 2020 at 04:10:11PM -0800, Tony Lindgren wrote:
> * Sebastian Reichel  [200224 23:22]:
> > This updates the existing omapdrm DSI code, so that it uses
> > common drm_mipi_dsi API and drm_panel.
> > 
> > The patchset has been tested with Droid 4 using Linux console, X.org and
> > Weston. The patchset is based on Laurent Pinchartl's patch series [0]
> > and removes the last custom panel driver, so quite a few cleanups on the
> > omapdrm codebase were possible.
> > 
> > [0] [PATCH v7 00/54] drm/omap: Replace custom display drivers with 
> > drm_bridge and drm_panel
> > 
> > https://lore.kernel.org/dri-devel/20200222150106.22919-1-laurent.pinch...@ideasonboard.com/
> > git://linuxtv.org/pinchartl/media.git omapdrm/bridge/devel
> > 
> > I pushed this patchset into the following branch:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-n900.git 
> > omapdrm/bridge/devel-with-dsi
> 
> I gave your omapdrm/bridge/devel-with-dsi branch a quirk test
> on droid4, but get the following oops with mostly modular
> omap2_defconfig.

:( I was testing with a non-modular kernel, since that gives me a
much easier testing workflow. Guess I need to spend some time to get
a good setup for testing modular kernel with Droid4.

> BTW, I think there's also some refcount issue in general where
> the omapdrm related modules cannot be unloaded any longer?

I wouldn't be too surprised. The dependencies are quite interesting
at the moment with omapdss registering omapdrm and then omapdrm
registers the drm_device, which references the encoders from
omapdss. I think this is something to look at once Laurent's and
my branch have been merged to avoid increasing the complexity.
Technically it should be possible to link everything into one
module.

> 8< -
> Internal error: Oops: 805 [#1] PREEMPT SMP ARM
> Modules linked in: omapdss(+) omapdss_base drm_kms_helper syscopyarea 
> sysfillrect sysimgblt fb_sys_fops drm drm_panel_ors
> CPU: 0 PID: 811 Comm: modprobe Not tainted 5.6.0-rc2-00376-g163017c12d62a 
> #1926
> Hardware name: Generic OMAP4 (Flattened Device Tree)
> PC is at drm_bridge_remove+0x24/0x40 [drm]
> LR is at drm_bridge_remove+0x14/0x40 [drm]
> pc : []lr : []psr: 6013
> sp : edc6fc88  ip : eda3a100  fp : bf38a5b4
> r10: bf38c7d0  r9 : edc164b8  r8 : edc1606c
> r7 : edc1647c  r6 : edc93010  r5 : bf2dc428  r4 : edc164b8
> r3 : edc164fc  r2 :   r1 :   r0 : bf2dc428
> Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
> Control: 10c5387d  Table: adc7404a  DAC: 0051
> Process modprobe (pid: 811, stack limit = 0x(ptrval))
> Stack: (0xedc6fc88 to 0xedc7)
> fc80:   edc16040 fdfb edc93010 bf37dfd0 0080 edc2eb00
> fca0: edc16040 edc93010 edc93010  bf392178   bf392178
> fcc0: 001e c0624424 edc93010 c0efafa0 c0efafa4   c06222e4
> fce0: edc93010 bf392178 bf392178 c0622880 c06243a0 c06243dc c0e93210 c06225cc
> fd00: bf38c450 a013 bf38a5b4 edc93010  bf392178 c0622880 c06243a0
> fd20: c06243dc c0622878  bf392178 edc93010 c06228d8 edc94fb4 edc6e000
> fd40: bf392178 c062069c edc50eb8 ee8dae58 edc94fb4 d759a07d ee8dae6c bf392178
> fd60: edc50e80 c0e93210  c0621618 bf38f0c0 bf3922c0 0006 bf392178
> fd80: bf3922c0 0006 c0623db0 c062344c 0002 bf3922c0 0006 c06244fc
> fda0: bf38a5b0 bf38a5a8 000be666 c0ec0540 bf39a000  bf392308 0002
> fdc0: edc2c300 c01dc694 edc6ff30 c0102fec c0ebbcf4  0cc0 c0d75a70
> fde0: edc2c2c0 c02b4538 c0d75a70 a013 a013 0008 c01de5bc 0002
> fe00: 0001 c01dc694 edc6ff30 d759a07d edbe7400 bf3922c0 0002 d759a07d
> fe20: bf392308 bf3922c0 edbe7400 edc2c2c0 bf392308 c01de5f8 0002 edc2c2c0
> fe40: bf3922c0 0002 edc2c2c0 c01e0b1c bf3922cc 7fff bf3922c0 c01dd34c
> fe60: bf3a44ee 004c1a8f bf3922c0 bf3923d4 bf3924b8 c0a05fa8  bf38d075
> fe80: 0001  c0bddd78 c0bc76d8 bf38a03c 0002  
> fea0:   6e72656b 6c65    
> fec0:        
> fee0:  d759a07d 7fff edc6e000  0003 004c1a8f 7fff
> ff00:  017b 004d56a0 c01e1050 7fff  0003 c093c724
> ff20: 0002 f137 000e3464  f138b0c6 f138f3c0 f137 000e3464
> ff40: f1452a3c f14527a4 f1425e58 00022000 00025680 a084 00027a0b 
> ff60:   a074 003e 003f 0021 0025 0018
> ff80:  d759a07d 004dcb80 64a54c46 b6f6a510 017b 017b c0101204
> ffa0: edc6e000 c0101000 64a54c46 b6f6a510 0

Re: [PATCH 1/3] drm/omap: Prepare DSS for probing without legacy platform data

2020-02-24 Thread Sebastian Reichel
Hi,

On Mon, Feb 24, 2020 at 11:12:28AM -0800, Tony Lindgren wrote:
> In order to probe display subsystem (DSS) components with ti-sysc
> interconnect target module without legacy platform data and using
> devicetree, we need to update dss probing a bit.
> 
> In the device tree, we will be defining the data also for the interconnect
> target modules as DSS really is a private interconnect. There is some
> information about that in 4460 TRM in "Figure 10-3. DSS Integration" for
> example where it mentions "32-bit interconnect (SLX)".
> 
> The changes we need to make are:
> 
> 1. Parse also device tree subnodes for the compatible property fixup
> 
> 2. Update the component code to consider device tree subnodes
> 
> Cc: dri-devel@lists.freedesktop.org
> Cc: Jyri Sarha 
> Cc: Laurent Pinchart 
> Cc: Tomi Valkeinen 
> Signed-off-by: Tony Lindgren 
> ---
> 
> This is needed for dropping DSS platform data that I'll be posting
> seprately. If this looks OK, can you guys please test and ack?
> 
> ---

Reviewed-by: Sebastian Reichel 

FWIW, I dropped omapdss-boot-init.c in my patch series updating DSI
code to use common panel infrastructure, so this will conflict.

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dss.c | 25 ---
>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   | 25 +--
>  2 files changed, 39 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
> b/drivers/gpu/drm/omapdrm/dss/dss.c
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1339,9 +1339,15 @@ static int dss_component_compare(struct device *dev, 
> void *data)
>   return dev == child;
>  }
>  
> +struct dss_component_match_data {
> + struct device *dev;
> + struct component_match **match;
> +};
> +
>  static int dss_add_child_component(struct device *dev, void *data)
>  {
> - struct component_match **match = data;
> + struct dss_component_match_data *cmatch = data;
> + struct component_match **match = cmatch->match;
>  
>   /*
>* HACK
> @@ -1352,7 +1358,17 @@ static int dss_add_child_component(struct device *dev, 
> void *data)
>   if (strstr(dev_name(dev), "rfbi"))
>   return 0;
>  
> - component_match_add(dev->parent, match, dss_component_compare, dev);
> + /*
> +  * Handle possible interconnect target modules defined within the DSS.
> +  * The DSS components can be children of an interconnect target module
> +  * after the device tree has been updated for the module data.
> +  * See also omapdss_boot_init() for compatible fixup.
> +  */
> + if (strstr(dev_name(dev), "target-module"))
> + return device_for_each_child(dev, cmatch,
> +  dss_add_child_component);
> +
> + component_match_add(cmatch->dev, match, dss_component_compare, dev);
>  
>   return 0;
>  }
> @@ -1395,6 +1411,7 @@ static int dss_probe_hardware(struct dss_device *dss)
>  static int dss_probe(struct platform_device *pdev)
>  {
>   const struct soc_device_attribute *soc;
> + struct dss_component_match_data cmatch;
>   struct component_match *match = NULL;
>   struct resource *dss_mem;
>   struct dss_device *dss;
> @@ -1472,7 +1489,9 @@ static int dss_probe(struct platform_device *pdev)
>  
>   omapdss_gather_components(>dev);
>  
> - device_for_each_child(>dev, , dss_add_child_component);
> + cmatch.dev = >dev;
> + cmatch.match = 
> + device_for_each_child(>dev, , dss_add_child_component);
>  
>   r = component_master_add_with_match(>dev, _component_ops, 
> match);
>   if (r)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
> b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> @@ -183,9 +183,24 @@ static const struct of_device_id 
> omapdss_of_fixups_whitelist[] __initconst = {
>   {},
>  };
>  
> +static void __init omapdss_find_children(struct device_node *np)
> +{
> + struct device_node *child;
> +
> + for_each_available_child_of_node(np, child) {
> + if (!of_find_property(child, "compatible", NULL))
> + continue;
> +
> + omapdss_walk_device(child, true);
> +
> + if (of_device_is_compatible(child, "ti,sysc"))
> + omapdss_find_children(child);
> + }
> +}
> +
>  static int __init omapdss_boot_init(void)
>  {
> - struct device_

[PATCHv2.1 45/56] drm/omap: dsi: Register a drm_bridge

2020-02-26 Thread Sebastian Reichel
In order to integrate with a chain of drm_bridge, the internal DSI
output has to expose its operations through the drm_bridge API.
Register a bridge at initialisation time to do so and remove the
omap_dss_device operations that are now unused.

Signed-off-by: Sebastian Reichel 
---
PATCHv2 -> PATCHv2.1: Add missing drm_bridge_add() call
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 130 +++---
 1 file changed, 85 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index f629e6b1025b..cde10c774b8b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -36,6 +36,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -440,6 +441,7 @@ struct dsi_data {
struct omap_dss_dsi_videomode_timings vm_timings;
 
struct omap_dss_device output;
+   struct drm_bridge bridge;
 };
 
 struct dsi_packet_sent_handler_data {
@@ -452,6 +454,9 @@ static bool dsi_perf;
 module_param(dsi_perf, bool, 0644);
 #endif
 
+#define drm_bridge_to_dsi(bridge) \
+   container_of(bridge, struct dsi_data, bridge)
+
 static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
 {
return dev_get_drvdata(dssdev->dev);
@@ -5010,50 +5015,7 @@ static int dsi_get_clocks(struct dsi_data *dsi)
return 0;
 }
 
-static void dsi_set_timings(struct omap_dss_device *dssdev,
-   const struct drm_display_mode *mode)
-{
-   DSSDBG("dsi_set_timings\n");
-   dsi_set_config(dssdev, mode);
-}
-
-static int dsi_check_timings(struct omap_dss_device *dssdev,
-struct drm_display_mode *mode)
-{
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-   struct dsi_clk_calc_ctx ctx;
-   int r;
-
-   DSSDBG("dsi_check_timings\n");
-
-   mutex_lock(>lock);
-   r = __dsi_calc_config(dsi, mode, );
-   mutex_unlock(>lock);
-
-   return r;
-}
-
-static int dsi_connect(struct omap_dss_device *src,
-  struct omap_dss_device *dst)
-{
-   return omapdss_device_connect(dst->dss, dst, dst->next);
-}
-
-static void dsi_disconnect(struct omap_dss_device *src,
-  struct omap_dss_device *dst)
-{
-   omapdss_device_disconnect(dst, dst->next);
-}
-
 static const struct omap_dss_device_ops dsi_ops = {
-   .connect = dsi_connect,
-   .disconnect = dsi_disconnect,
-   .enable = dsi_enable_video_outputs,
-   .disable = dsi_disable_video_outputs,
-
-   .check_timings = dsi_check_timings,
-   .set_timings = dsi_set_timings,
-
.dsi = {
.update = dsi_update_all,
.is_video_mode = dsi_is_video_mode,
@@ -5394,6 +5356,79 @@ static const struct component_ops dsi_component_ops = {
.unbind = dsi_unbind,
 };
 
+/* 
-
+ * DRM Bridge Operations
+ */
+
+static int dsi_bridge_attach(struct drm_bridge *bridge,
+enum drm_bridge_attach_flags flags)
+{
+   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+
+   if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
+   return -EINVAL;
+
+   return drm_bridge_attach(bridge->encoder, dsi->output.next_bridge,
+bridge, flags);
+}
+
+static enum drm_mode_status
+dsi_bridge_mode_valid(struct drm_bridge *bridge,
+ const struct drm_display_mode *mode)
+{
+   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+   struct dsi_clk_calc_ctx ctx;
+   int r;
+
+   mutex_lock(>lock);
+   r = __dsi_calc_config(dsi, mode, );
+   mutex_unlock(>lock);
+
+   return r ? MODE_CLOCK_RANGE : MODE_OK;
+}
+
+static void dsi_bridge_mode_set(struct drm_bridge *bridge,
+   const struct drm_display_mode *mode,
+   const struct drm_display_mode *adjusted_mode)
+{
+   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+   dsi_set_config(>output, adjusted_mode);
+}
+
+static void dsi_bridge_enable(struct drm_bridge *bridge)
+{
+   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+   dsi_enable_video_outputs(>output);
+}
+
+static void dsi_bridge_disable(struct drm_bridge *bridge)
+{
+   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+   dsi_disable_video_outputs(>output);
+}
+
+static const struct drm_bridge_funcs dsi_bridge_funcs = {
+   .attach = dsi_bridge_attach,
+   .mode_valid = dsi_bridge_mode_valid,
+   .mode_set = dsi_bridge_mode_set,
+   .enable = dsi_bridge_enable,
+   .disable = dsi_bridge_disable,
+};
+
+static void dsi_bridge_init(struct dsi_data *dsi)
+{
+   dsi->bridge.funcs = _bridge_funcs;
+   dsi->bridge.of_node = dsi->host.dev->of_node;
+   dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
+
+   d

[PATCHv2 57/56] dt-bindings: display: panel-dsi-cm: convert to YAML

2020-02-26 Thread Sebastian Reichel
Convert panel-dsi-cm bindings to YAML and add
missing properties while at it.

Signed-off-by: Sebastian Reichel 
---
 .../bindings/display/panel/panel-dsi-cm.txt   | 31 --
 .../bindings/display/panel/panel-dsi-cm.yaml  | 97 +++
 2 files changed, 97 insertions(+), 31 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml

diff --git a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt 
b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
deleted file mode 100644
index f92d5c9adfc5..
--- a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-Generic MIPI DSI Command Mode Panel
-===
-
-Required properties:
-- compatible: "panel-dsi-cm"
-- reg: DSI channel number
-
-Optional properties:
-- label: a symbolic name for the panel
-- reset-gpios: panel reset gpio
-- te-gpios: panel TE gpio
-
-Required nodes:
-- Video port for DSI input
-
-Example

-
-lcd0: panel@0 {
-   compatible = "tpo,taal", "panel-dsi-cm";
-   label = "lcd0";
-   reg = <0>;
-
-   reset-gpios = < 6 GPIO_ACTIVE_HIGH>;
-
-   port {
-   lcd0_in: endpoint {
-   remote-endpoint = <_out_ep>;
-   };
-   };
-};
diff --git a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml
new file mode 100644
index ..ca61171ae145
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml
@@ -0,0 +1,97 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/panel-dsi-cm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: DSI command mode panels
+
+maintainers:
+  - Tomi Valkeinen 
+  - Sebastian Reichel 
+
+description: |
+  This binding file is a collection of the DSI panels that
+  are usually driven in command mode. If no backlight is
+  referenced via the optional backlight property, the DSI
+  panel is assumed to have native backlight support.
+  The panel may use an OF graph binding for the association
+  to the display, or it may be a direct child node of the
+  display.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+
+  compatible:
+enum:
+  # compatible must be listed in alphabetical order, ordered by compatible.
+  # The description in the comment is mandatory for each compatible.
+  - motorola,droid4-panel, panel-dsi-cm
+  - nokia,himalaya, panel-dsi-cm
+  - tpo,taal, panel-dsi-cm
+
+  reg:
+maxItems: 1
+description: DSI virtual channel
+
+  te-gpios:
+maxItems: 1
+description:
+  Specifier for a GPIO connected to the panel TE (tearing event) signal.
+  The GPIO informs the system, that data should be sent to the display
+  on rising edges of the GPIO to avoid (or reduce) tearing effects.
+  Falling edge can be supported by inverting the GPIO specifier polarity
+  flag.
+
+  vddi-supply:
+description:
+  Display panels require power to be supplied. While several panels need
+  more than one power supply with panel-specific constraints governing the
+  order and timings of the power supplies, in many cases a single power
+  supply is sufficient, either because the panel has a single power rail, 
or
+  because all its power rails can be driven by the same supply. In that 
case
+  the vddi-supply property specifies the supply powering the panel as a
+  phandle to a regulator.
+
+  vpnl-supply:
+description:
+  When the display panel needs a second power supply, this property can be
+  used in addition to vddi-supply. Both supplies will be enabled at the
+  same time before the panel is being accessed.
+
+  width-mm: true
+  height-mm: true
+  label: true
+  rotation: true
+  panel-timing: true
+  port: true
+  reset-gpios: true
+  backlight: true
+
+additionalProperties: false
+
+required:
+  - compatible
+  - port
+  - reg
+
+examples:
+  - |
+dsi1@12345678 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+  panel@0 {
+compatible = "tpo,taal", "panel-dsi-cm";
+label = "lcd0";
+reg = <0>;
+reset-gpios = < 6 GPIO_ACTIVE_HIGH>;
+
+port {
+  panel: endpoint {
+remote-endpoint = <_out_ep>;
+  };
+};
+  };
+};
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv2 05/56] drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*

2020-02-26 Thread Sebastian Reichel
Hi,

On Tue, Feb 25, 2020 at 03:58:23PM +0200, Laurent Pinchart wrote:
> Hi Sebastian,
> 
> Thank you for the patch.
> 
> On Tue, Feb 25, 2020 at 12:20:35AM +0100, Sebastian Reichel wrote:
> > This replaces OMAP specific enum for pixel format with
> > common implementation.
> > 
> > Signed-off-by: Sebastian Reichel 
> > ---
> >  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 +-
> >  drivers/gpu/drm/omapdrm/dss/dsi.c | 49 +++
> >  drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +---
> >  3 files changed, 20 insertions(+), 41 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> > b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > index e7fe5d702337..e6ebfc35243e 100644
> > --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > @@ -595,7 +595,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
> > int r;
> > struct omap_dss_dsi_config dsi_config = {
> > .mode = OMAP_DSS_DSI_CMD_MODE,
> > -   .pixel_format = OMAP_DSS_DSI_FMT_RGB888,
> > +   .pixel_format = MIPI_DSI_FMT_RGB888,
> > .vm = >vm,
> > .hs_clk_min = 15000,
> > .hs_clk_max = 3,
> > diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> > b/drivers/gpu/drm/omapdrm/dss/dsi.c
> > index 8c39823a8295..bb2548d091ef 100644
> > --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> > +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> > @@ -34,6 +34,7 @@
> >  #include 
> >  
> >  #include 
> > +#include 
> 
> Maybe sort those two headers alphabetically ?

Ack.

> 
> >  
> >  #include "omapdss.h"
> >  #include "dss.h"
> > @@ -410,7 +411,7 @@ struct dsi_data {
> >  
> > struct dss_lcd_mgr_config mgr_config;
> > struct videomode vm;
> > -   enum omap_dss_dsi_pixel_format pix_fmt;
> > +   enum mipi_dsi_pixel_format pix_fmt;
> > enum omap_dss_dsi_mode mode;
> > struct omap_dss_dsi_videomode_timings vm_timings;
> >  
> > @@ -514,22 +515,6 @@ static inline bool wait_for_bit_change(struct dsi_data 
> > *dsi,
> > return false;
> >  }
> >  
> > -static u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
> > -{
> > -   switch (fmt) {
> > -   case OMAP_DSS_DSI_FMT_RGB888:
> > -   case OMAP_DSS_DSI_FMT_RGB666:
> > -   return 24;
> > -   case OMAP_DSS_DSI_FMT_RGB666_PACKED:
> > -   return 18;
> > -   case OMAP_DSS_DSI_FMT_RGB565:
> > -   return 16;
> > -   default:
> > -   BUG();
> 
> Removing a BUG() is really nice :-) I suppose this never happened, or we
> would have heard of it. Still, is there a top-level location where we
> could validate the format (assuming it is still used at the end of this
> series) ? mipi_dsi_pixel_format_to_bpp() returns -EINVAL if the format
> is invalid, and we don't check for that through the code . It doesn't
> have to be handled in this patch, it can be done later in the series as
> you keep reworking the code.

The pixel format is a constant from the panel driver (first change
in this patch). In the encoder stage it originates from dsi_set_config(),
later from omap_dsi_host_attach(). I will add a check there.

> > -   return 0;
> > -   }
> > -}
> > -
> >  #ifdef DSI_PERF_MEASURE
> >  static void dsi_perf_mark_setup(struct dsi_data *dsi)
> >  {
> > @@ -3239,7 +3224,7 @@ static void dsi_config_vp_num_line_buffers(struct 
> > dsi_data *dsi)
> > int num_line_buffers;
> >  
> > if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
> > -   int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> > +   int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
> > const struct videomode *vm = >vm;
> > /*
> >  * Don't use line buffers if width is greater than the video
> > @@ -3370,7 +3355,7 @@ static void dsi_config_cmd_mode_interleaving(struct 
> > dsi_data *dsi)
> > int tclk_trail, ths_exit, exiths_clk;
> > bool ddr_alwon;
> > const struct videomode *vm = >vm;
> > -   int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> > +   int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
> > int ndl = dsi->num_lanes_used - 1;
> > int dsi_fclk_hsdiv = dsi->user_dsi_cinfo.mX[HSDIV_DSI] + 1;
> > int hsa_interleave_hs = 0, hsa_interleave_lp = 0;
> > @@ -3498,7 +3483,7 @@ static int dsi_proto_config(struct dsi_data *

Re: [PATCHv2 04/56] omap/drm: drop unused dsi.configure_pins

2020-02-26 Thread Sebastian Reichel
Hi Laurent,

On Wed, Feb 26, 2020 at 11:36:30PM +0200, Laurent Pinchart wrote:
> > > I think you can drop the definition of the omap_dsi_pin_config structure
> > > earlier in this file too, as well as the OMAP_DSS_MAX_DSI_PINS macro.
> > > With this fixed,
> > 
> > No, the struct is still used by the code setting up the pins from
> > DT.
> 
> Indeed, my bad. I think I'd pass the unsigned int num_pins and const int
> *pins to dsi_configure_pins() directly to drop the structure, but that
> can be done in a subsequent patch (maybe it is already :-)).

I added quite some cleanups at the end of the series, but there is
still quite a few cleanups possible within the DSI encoder
(including this one). Cleaning up dsi.c takes some time and rebasing
this code gets annoying.

After this series the cleanups mostly are internal to dsi.c and
should reduce merge conflict probability.  Also I feel a bit
uncomfortable, since we currently have no DSI video mode user.
Nikolaus Schaller is working on adding support for such a system, so
it would be nice to get that supported first making it possible to
do easy bisecting for issues introduced by refactoring. (This is not
specifically about dsi_configure_pins of course)

> > > Reviewed-by: Laurent Pinchart 
> 
> This tag holds.

Thanks.

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv2 11/56] drm/omap: dsi: simplify write function

2020-02-26 Thread Sebastian Reichel
Hi Laurent,

On Tue, Feb 25, 2020 at 05:31:05PM +0200, Laurent Pinchart wrote:
> > +   if (mipi_dsi_packet_format_is_short(msg->type)) {
> > +   u16 data = packet.header[1] | (packet.header[2] << 8);
> > +   r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
> 
> You use the packet for this case only, I think you could simply write
> 
>   u16 data = ((msg->tx_len > 0) ? tx[0] : 0)
>| (((msg->tx_len > 1) ? tx[1] : 0) << 8);
>   r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);

That probably works with 's/tx[/((u8*) msg->tx_buf)[', which looks
really ugly :) This code is further simplified by a further patch,
which forwards the complete message into dsi_vc_send_short().

> > } else {
> > -   r = dsi_vc_send_long(dsi, channel,
> > -   type == DSS_DSI_CONTENT_GENERIC ?
> > -   MIPI_DSI_GENERIC_LONG_WRITE :
> > -   MIPI_DSI_DCS_LONG_WRITE, data, len, 0);
> > +   r = dsi_vc_send_long(dsi, msg->channel, msg->type,
> > +  msg->tx_buf, msg->tx_len, 0);
> 
> Indentation.

Ok.

> Reviewed-by: Laurent Pinchart 

Are you fine with keeping the mipi_dsi_packet, since it will be
removed in a further patch?

> > }
> >  
> > -   return r;
> > -}
> > -
> > -static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int 
> > channel,
> > -   const u8 *data, int len)
> > -{
> > -   struct dsi_data *dsi = to_dsi_data(dssdev);
> > -
> > -   return dsi_vc_write_nosync_common(dsi, channel, data, len,
> > -   DSS_DSI_CONTENT_DCS);
> > -}
> > -
> > -static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int 
> > channel,
> > -   const u8 *data, int len)
> > -{
> > -   struct dsi_data *dsi = to_dsi_data(dssdev);
> > -
> > -   return dsi_vc_write_nosync_common(dsi, channel, data, len,
> > -   DSS_DSI_CONTENT_GENERIC);
> > -}
> > -
> > -static int dsi_vc_write_common(struct omap_dss_device *dssdev,
> > -  int channel, const u8 *data, int len,
> > -  enum dss_dsi_content_type type)
> > -{
> > -   struct dsi_data *dsi = to_dsi_data(dssdev);
> > -   int r;
> > +   if (r < 0)
> > +   return r;
> >  
> > -   r = dsi_vc_write_nosync_common(dsi, channel, data, len, type);
> > -   if (r)
> > -   goto err;
> > +   /*
> > +* we do not always have to do the BTA sync, for example we can
> > +* improve performance by setting the update window information
> > +* without sending BTA sync between the commands. In that case
> > +* we can return earily.
> 
> s/earily/early/
> 
> Do I understand correctly that this isn't implemented yet ? You should
> make it clear in the comment that it's a candidate for a future
> optimization.

Yes. I forgot the TODO keyword for some reason. Has been quite some
time since I wrote this patch :) I fixed the earily and prefixed the
message with TODO.

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv2 04/56] omap/drm: drop unused dsi.configure_pins

2020-02-26 Thread Sebastian Reichel
Hi Laurent,

On Tue, Feb 25, 2020 at 01:42:49AM +0200, Laurent Pinchart wrote:
> Hi Sebastian,
> 
> Thank you for the patch.
> 
> On Tue, Feb 25, 2020 at 12:20:34AM +0100, Sebastian Reichel wrote:
> > The panel-dsi-cm's ddata->pin_config is always NULL, so this
> > callback is never called. Instead the DSI encoder gets the pin
> > configuration directly from DT.
> > 
> > Signed-off-by: Sebastian Reichel 
> > ---
> >  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 11 ---
> >  drivers/gpu/drm/omapdrm/dss/dsi.c   |  1 -
> >  drivers/gpu/drm/omapdrm/dss/omapdss.h   |  2 --
> >  3 files changed, 14 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> > b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > index 3484b5d4a91c..e7fe5d702337 100644
> > --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > @@ -68,8 +68,6 @@ struct panel_drv_data {
> > int width_mm;
> > int height_mm;
> >  
> > -   struct omap_dsi_pin_config pin_config;
> > -
> > /* runtime variables */
> > bool enabled;
> >  
> > @@ -623,15 +621,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
> > }
> > }
> >  
> > -   if (ddata->pin_config.num_pins > 0) {
> > -   r = src->ops->dsi.configure_pins(src, >pin_config);
> > -   if (r) {
> > -   dev_err(>pdev->dev,
> > -   "failed to configure DSI pins\n");
> > -   goto err_vddi;
> > -   }
> > -   }
> > -
> > r = src->ops->dsi.set_config(src, _config);
> > if (r) {
> > dev_err(>pdev->dev, "failed to configure DSI\n");
> > diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> > b/drivers/gpu/drm/omapdrm/dss/dsi.c
> > index 79ddfbfd1b58..8c39823a8295 100644
> > --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> > +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> > @@ -4892,7 +4892,6 @@ static const struct omap_dss_device_ops dsi_ops = {
> >  
> > .enable_hs = dsi_vc_enable_hs,
> >  
> > -   .configure_pins = dsi_configure_pins,
> > .set_config = dsi_set_config,
> >  
> > .enable_video_output = dsi_enable_video_output,
> > diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> > b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> > index cbbe10b2b60d..b0424daaceed 100644
> > --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> > +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> > @@ -292,8 +292,6 @@ struct omapdss_dsi_ops {
> 
> I think you can drop the definition of the omap_dsi_pin_config structure
> earlier in this file too, as well as the OMAP_DSS_MAX_DSI_PINS macro.
> With this fixed,

No, the struct is still used by the code setting up the pins from
DT.

-- Sebastian

> Reviewed-by: Laurent Pinchart 
> 
> > /* bus configuration */
> > int (*set_config)(struct omap_dss_device *dssdev,
> > const struct omap_dss_dsi_config *cfg);
> > -   int (*configure_pins)(struct omap_dss_device *dssdev,
> > -   const struct omap_dsi_pin_config *pin_cfg);
> >  
> > void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
> > bool enable);
> 
> -- 
> Regards,
> 
> Laurent Pinchart


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv2 08/56] drm/omap: panel-dsi-cm: convert to transfer API

2020-02-26 Thread Sebastian Reichel
Hi,

On Tue, Feb 25, 2020 at 04:52:21PM +0200, Laurent Pinchart wrote:
> Hi Sebastian,
> 
> Thank you for the patch.
> 
> On Tue, Feb 25, 2020 at 12:20:38AM +0100, Sebastian Reichel wrote:
> > This converts the panel-dsi-cm driver to use the transfer
> > API instead of specific functions, so that the specific
> > functions can be unexported and squashed into the generic
> > transfer function.
> > 
> > Signed-off-by: Sebastian Reichel 
> > ---
> >  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 133 +-
> >  1 file changed, 96 insertions(+), 37 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> > b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > index e6ebfc35243e..92f510a771fe 100644
> > --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > @@ -140,45 +140,61 @@ static void hw_guard_wait(struct panel_drv_data 
> > *ddata)
> >  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
> > *data)
> >  {
> > struct omap_dss_device *src = ddata->src;
> > -   int r;
> > -   u8 buf[1];
> > -
> > -   r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd, buf, 1);
> > -
> > -   if (r < 0)
> > -   return r;
> > -
> > -   *data = buf[0];
> > +   const struct mipi_dsi_msg msg = {
> > +   .channel = ddata->channel,
> > +   .type = MIPI_DSI_DCS_READ,
> > +   .tx_len = 1,
> > +   .tx_buf = _cmd,
> > +   .rx_len = 1,
> > +   .rx_buf = data
> > +   };
> >  
> > -   return 0;
> > +   return src->ops->dsi.transfer(src, );
> >  }
> >  
> >  static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
> >  {
> > struct omap_dss_device *src = ddata->src;
> > +   const struct mipi_dsi_msg msg = {
> > +   .channel = ddata->channel,
> > +   .type = MIPI_DSI_DCS_SHORT_WRITE,
> > +   .tx_buf = _cmd,
> > +   .tx_len = 1,
> > +   };
> >  
> > -   return src->ops->dsi.dcs_write(src, ddata->channel, _cmd, 1);
> > +   return src->ops->dsi.transfer(src, );
> >  }
> >  
> >  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
> > param)
> >  {
> > struct omap_dss_device *src = ddata->src;
> > -   u8 buf[2] = { dcs_cmd, param };
> > +   const u8 buf[] = { dcs_cmd, param };
> > +   const struct mipi_dsi_msg msg = {
> > +   .channel = ddata->channel,
> > +   .type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> > +   .tx_buf = ,
> > +   .tx_len = 2,
> > +   };
> >  
> > -   return src->ops->dsi.dcs_write(src, ddata->channel, buf, 2);
> > +   return src->ops->dsi.transfer(src, );
> >  }
> >  
> >  static int dsicm_sleep_in(struct panel_drv_data *ddata)
> >  
> >  {
> > struct omap_dss_device *src = ddata->src;
> > -   u8 cmd;
> > int r;
> > +   const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> > +   const struct mipi_dsi_msg msg = {
> > +   .channel = ddata->channel,
> > +   .type = MIPI_DSI_DCS_SHORT_WRITE,
> > +   .tx_buf = ,
> > +   .tx_len = 1,
> > +   };
> >  
> > hw_guard_wait(ddata);
> >  
> > -   cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> > -   r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, , 1);
> > +   r = src->ops->dsi.transfer(src, );
> 
> Should you call dsicm_dcs_write_0(ddata, MIPI_DCS_ENTER_SLEEP_MODE)
> instead ? This uses the _nosync variant though, is it an issue ?

Right, this will be replaced by mipi_dsi_dcs_enter_sleep_mode() in
a future patch. I did not notice any issues with commands not being
send when panel is turned off, so it should be fine.

> > if (r)
> > return r;
> >  
> > @@ -233,28 +249,44 @@ static int dsicm_set_update_window(struct 
> > panel_drv_data *ddata,
> > u16 y1 = y;
> > u16 y2 = y + h - 1;
> >  
> > -   u8 buf[5];
> > -   buf[0] = MIPI_DCS_SET_COLUMN_ADDRESS;
> > -   buf[1] = (x1 >> 8) & 0xff;
> > -   buf[2] = (x1 >> 0) & 0xff;
> > -   buf[3] = (x2 >> 8) & 0xff;
> > -   buf[4] = (x2 >> 0) & 0xff;
> > +   const u8 paramX[] = {
> > +   MIPI_DCS_SET_COLUMN_ADDRESS,
> > +   (x1 >> 8) & 0xff,
> > +   (x1 >> 0)

Re: [PATCHv2 43/56] drm/omap: bind components with drm_device argument

2020-02-26 Thread Sebastian Reichel
Hi,

On Tue, Feb 25, 2020 at 12:21:13AM +0100, Sebastian Reichel wrote:
> This fixes the omapdrm driver to call component_bind_all()
> with drm_device as data argument as recommended in the
> DRM component helper usage text.
> 
> After this patch DRM functionality can be implemented directly
> in the components resulting in a simpler driver stack by removing
> one layer of abstraction.

Please ignore this faulty patch, its fortunately not required for
the remaining series. For details see my reply to Tomi:

https://lore.kernel.org/dri-devel/20200227002843.7ea73mewcr4rmzli@earth.universe/T/#m2b76dd570804845e997da19214647634f5fc7dd0

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv2 00/56] drm/omap: Convert DSI code to use drm_mipi_dsi and drm_panel

2020-02-26 Thread Sebastian Reichel
Hi,

On Wed, Feb 26, 2020 at 02:28:23PM +0200, Tomi Valkeinen wrote:
> On 25/02/2020 01:20, Sebastian Reichel wrote:
> > This updates the existing omapdrm DSI code, so that it uses
> > common drm_mipi_dsi API and drm_panel.
> > 
> > The patchset has been tested with Droid 4 using Linux console, X.org and
> > Weston. The patchset is based on Laurent Pinchartl's patch series [0]
> > and removes the last custom panel driver, so quite a few cleanups on the
> > omapdrm codebase were possible.
> 
> I haven't done any reviews yet, but applied these (and the one
> v2.1 patch) on top of Laurent's. I booted up AM5 EVM and loaded
> the modules:
> 
> [   17.261560] WARNING: CPU: 0 PID: 419 at drivers/base/component.c:636 
> component_bind_all+0x1f4/0x258

I did not see that warning for some reason. I guess I was always
lucky, since its a race condition introduced by "drm/omap: bind
components with drm_device argument". That patch moves
component_bind_all from dss_bind() to omapdrm's probe() to get
access to drm_dev. Currently omapdrm is the only DRM driver not
supplying that as parameter and its required to move encoder init
into the DSS output drivers. I assumed that it would be ok, since
it just postpones the call a little bit. Unfortunately it also
moves it out of the lock protection from dss_bind().

The only fix, that I see is to register the drm_dev is dss_bind
and then supply it to omapdrm via pdata. But I think we could
actually get rid of the omapdrm platform device completly and
just use its parent "omapdss_dss". I suppose a follow-up patchset
could merge the code into one module and do this merge.

Probably it's the best to drop that patch for now. It's not yet
used in the patches, that I sent.

> [   17.270811] Modules linked in: omapdrm(+) omapdss omapdss_base 
> panel_osd_osd101t2587_53ts panel_simple simple_bridge ti_tpd12s015 
> display_connec
> tor tc358767 tc358768 sii902x ti_tfp410 drm_kms_helper drm 
> drm_panel_orientation_quirks cfbfillrect cfbimgblt cfbcopyarea cec
> [   17.295521] CPU: 0 PID: 419 Comm: insmod Not tainted 
> 5.6.0-rc2-00375-g66c4203ed9d4 #2
> [   17.303387] Hardware name: Generic DRA74X (Flattened Device Tree)
> [   17.309520] [] (unwind_backtrace) from [] 
> (show_stack+0x10/0x14)
> [   17.317306] [] (show_stack) from [] 
> (dump_stack+0xb4/0xd0)
> [   17.324567] [] (dump_stack) from [] (__warn+0xc0/0xf8)
> [   17.331477] [] (__warn) from [] 
> (warn_slowpath_fmt+0x58/0xb8)
> [   17.338998] [] (warn_slowpath_fmt) from [] 
> (component_bind_all+0x1f4/0x258)
> [   17.347768] [] (component_bind_all) from [] 
> (pdev_probe+0xe0/0x7a0 [omapdrm])
> [   17.356709] [] (pdev_probe [omapdrm]) from [] 
> (platform_drv_probe+0x48/0x98)
> [   17.365537] [] (platform_drv_probe) from [] 
> (really_probe+0x200/0x478)
> [   17.373841] [] (really_probe) from [] 
> (driver_probe_device+0x6c/0x1b4)
> [   17.382145] [] (driver_probe_device) from [] 
> (device_driver_attach+0x58/0x60)
> [   17.391060] [] (device_driver_attach) from [] 
> (__driver_attach+0xa4/0x148)
> [   17.399713] [] (__driver_attach) from [] 
> (bus_for_each_dev+0x70/0xb4)
> [   17.407930] [] (bus_for_each_dev) from [] 
> (bus_add_driver+0x100/0x204)
> [   17.416233] [] (bus_add_driver) from [] 
> (driver_register+0x74/0x108)
> [   17.424361] [] (driver_register) from [] 
> (__platform_register_drivers+0x58/0x150)
> [   17.433628] [] (__platform_register_drivers) from [] 
> (do_one_initcall+0x48/0x2a0)
> [   17.442893] [] (do_one_initcall) from [] 
> (do_init_module+0x5c/0x234)
> [   17.451022] [] (do_init_module) from [] 
> (load_module+0x250c/0x28a4)
> [   17.459064] [] (load_module) from [] 
> (sys_finit_module+0xcc/0x110)
> [   17.467020] [] (sys_finit_module) from [] 
> (ret_fast_syscall+0x0/0x54)
> [   17.475233] Exception stack(0xea84bfa8 to 0xea84bff0)
> [   17.480307] bfa0:   0002  0003 0002a894 
>  bebd2d74
> [   17.488524] bfc0: 0002  00028424 017b 0003eeb0 0002 
> b6ffe000 
> [   17.496738] bfe0: bebd2bb8 bebd2ba8 00020d7c b6edb0b0
> [   17.502365] ---[ end trace c20802296d6b2775 ]---
> [   17.508567] omapdss_dss 5800.dss: bound 58001000.dispc (ops 
> dsi_framedone_timeout_work_callback [omapdss])
> [   17.520358] omapdss_dss 5800.dss: bound 5804.encoder (ops 
> dsi_framedone_timeout_work_callback [omapdss])
> [   17.559728] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
> [   17.574544] [drm] Enabling DMM ywrap scrolling
> [   17.580606] omapdrm omapdrm.0: fb0: omapdrmdrmfb frame buffer device
> [   17.625099] [drm] Initialized omapdrm 1.0.0 20110917 for omapdrm.0 on 
> minor 0
> 
> Similar warning on module unload. The display works, though.

same problem, with dss_unbind() and omapdrm's remove function.

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv2 13/56] drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg

2020-02-26 Thread Sebastian Reichel
Hi Laurent,

On Tue, Feb 25, 2020 at 06:30:01PM +0200, Laurent Pinchart wrote:
> On Tue, Feb 25, 2020 at 12:20:43AM +0100, Sebastian Reichel wrote:
> > Simplify the DSI encoder by using mipi_dsi_msg for
> > dsi_vc_send_long and dsi_vc_send_short. Further improvements
> > require cleaning up the channel allocation code first.
> > 
> > Signed-off-by: Sebastian Reichel 
> > ---
> >  drivers/gpu/drm/omapdrm/dss/dsi.c | 92 +++
> >  1 file changed, 45 insertions(+), 47 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> > b/drivers/gpu/drm/omapdrm/dss/dsi.c
> > index 9b5b078beb6d..4899bfa2d76f 100644
> > --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> > +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> > @@ -2599,30 +2599,36 @@ static inline void dsi_vc_write_long_payload(struct 
> > dsi_data *dsi, int channel,
> > dsi_write_reg(dsi, DSI_VC_LONG_PACKET_PAYLOAD(channel), val);
> >  }
> >  
> > -static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 
> > data_type,
> > -   const u8 *data, u16 len, u8 ecc)
> > +static int dsi_vc_send_long(struct dsi_data *dsi,
> > +   const struct mipi_dsi_msg *msg)
> >  {
> > +   struct mipi_dsi_packet pkg;
> > /*u32 val; */
> > int i;
> > const u8 *p;
> > int r = 0;
> > u8 b1, b2, b3, b4;
> >  
> > +   r = mipi_dsi_create_packet(, msg);
> > +   if (r < 0)
> > +   return r;
> > +
> > if (dsi->debug_write)
> > -   DSSDBG("dsi_vc_send_long, %d bytes\n", len);
> > +   DSSDBG("dsi_vc_send_long, %d bytes\n", msg->tx_len);
> >  
> > /* len + header */
> > -   if (dsi->vc[channel].tx_fifo_size * 32 * 4 < len + 4) {
> > +   if (dsi->vc[msg->channel].tx_fifo_size * 32 * 4 < msg->tx_len + 4) {
> > DSSERR("unable to send long packet: packet too long.\n");
> > return -EINVAL;
> > }
> >  
> > -   dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
> > +   dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
> >  
> > -   dsi_vc_write_long_header(dsi, channel, data_type, len, ecc);
> > +   dsi_vc_write_long_header(dsi, msg->channel, msg->type, msg->tx_len,
> > +pkg.header[3]);
> 
> mipi_dsi_create_packet() never sets header[3]. I suppose that's not an
> issue as we were always passing ecc as 0 to this function, but you may
> want to drop mipi_dsi_create_packet() above and just hardcode 0 here.

sure.

> >  
> > -   p = data;
> > -   for (i = 0; i < len >> 2; i++) {
> > +   p = msg->tx_buf;
> > +   for (i = 0; i < msg->tx_len >> 2; i++) {
> > if (dsi->debug_write)
> > DSSDBG("\tsending full packet %d\n", i);
> >  
> > @@ -2631,10 +2637,10 @@ static int dsi_vc_send_long(struct dsi_data *dsi, 
> > int channel, u8 data_type,
> > b3 = *p++;
> > b4 = *p++;
> >  
> > -   dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, b4);
> > +   dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, b4);
> > }
> >  
> > -   i = len % 4;
> > +   i = msg->tx_len % 4;
> > if (i) {
> > b1 = 0; b2 = 0; b3 = 0;
> >  
> > @@ -2656,64 +2662,64 @@ static int dsi_vc_send_long(struct dsi_data *dsi, 
> > int channel, u8 data_type,
> > break;
> > }
> >  
> > -   dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, 0);
> > +   dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, 0);
> > }
> >  
> > return r;
> >  }
> >  
> > -static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 
> > data_type,
> > -u16 data, u8 ecc)
> > +static int dsi_vc_send_short(struct dsi_data *dsi,
> > +const struct mipi_dsi_msg *msg)
> >  {
> > +   struct mipi_dsi_packet pkg;
> 
> s/pkg/pkt/ (or packet)

Ack.

-- Sebastian

> > u32 r;
> > -   u8 data_id;
> > +
> > +   r = mipi_dsi_create_packet(, msg);
> > +   if (r < 0)
> > +   return r;
> >  
> > WARN_ON(!dsi_bus_is_locked(dsi));
> >  
> > if (dsi->debug_write)
> > DSSDBG("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n",
> > -   channel,
> > -   

[PATCHv2 42/56] drm/omap: remove global dss_device variable

2020-02-25 Thread Sebastian Reichel
We can simply provide the device to the omapdrm driver
via pdata. omapdss_is_initialized() is no longer required
(even before this patch), since omapdrm device is only
registered after the pointer is initialized.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/base.c| 14 --
 drivers/gpu/drm/omapdrm/dss/dss.c |  9 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  9 +++--
 drivers/gpu/drm/omapdrm/omap_drv.c|  6 ++
 4 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 455b410f7401..8e08c49b4f97 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -16,20 +16,6 @@
 #include "dss.h"
 #include "omapdss.h"
 
-static struct dss_device *dss_device;
-
-struct dss_device *omapdss_get_dss(void)
-{
-   return dss_device;
-}
-EXPORT_SYMBOL(omapdss_get_dss);
-
-void omapdss_set_dss(struct dss_device *dss)
-{
-   dss_device = dss;
-}
-EXPORT_SYMBOL(omapdss_set_dss);
-
 struct dispc_device *dispc_get_dispc(struct dss_device *dss)
 {
return dss->dispc;
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
b/drivers/gpu/drm/omapdrm/dss/dss.c
index b76fc2b56227..4438947326ea 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1305,6 +1305,7 @@ static int dss_bind(struct device *dev)
 {
struct dss_device *dss = dev_get_drvdata(dev);
struct platform_device *drm_pdev;
+   struct dss_pdata pdata;
int r;
 
r = component_bind_all(dev, NULL);
@@ -1313,9 +1314,9 @@ static int dss_bind(struct device *dev)
 
pm_set_vt_switch(0);
 
-   omapdss_set_dss(dss);
-
-   drm_pdev = platform_device_register_simple("omapdrm", 0, NULL, 0);
+   pdata.dss = dss;
+   drm_pdev = platform_device_register_data(NULL, "omapdrm", 0,
+, sizeof(pdata));
if (IS_ERR(drm_pdev)) {
component_unbind_all(dev, NULL);
return PTR_ERR(drm_pdev);
@@ -1332,8 +1333,6 @@ static void dss_unbind(struct device *dev)
 
platform_device_unregister(dss->drm_pdev);
 
-   omapdss_set_dss(NULL);
-
component_unbind_all(dev, NULL);
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 10e6ae666dfa..9f8aefaadefe 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -355,12 +355,9 @@ struct omap_dss_device {
unsigned int of_port;
 };
 
-struct dss_device *omapdss_get_dss(void);
-void omapdss_set_dss(struct dss_device *dss);
-static inline bool omapdss_is_initialized(void)
-{
-   return !!omapdss_get_dss();
-}
+struct dss_pdata {
+   struct dss_device *dss;
+};
 
 void omapdss_display_init(struct omap_dss_device *dssdev);
 int omapdss_display_get_modes(struct drm_connector *connector,
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index cdafd7ef1c32..579f9d80fec9 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -594,6 +594,7 @@ static const struct soc_device_attribute 
omapdrm_soc_devices[] = {
 static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 {
const struct soc_device_attribute *soc;
+   struct dss_pdata *pdata = dev->platform_data;
struct drm_device *ddev;
unsigned int i;
int ret;
@@ -609,7 +610,7 @@ static int omapdrm_init(struct omap_drm_private *priv, 
struct device *dev)
ddev->dev_private = priv;
 
priv->dev = dev;
-   priv->dss = omapdss_get_dss();
+   priv->dss = pdata->dss;
priv->dispc = dispc_get_dispc(priv->dss);
priv->dispc_ops = dispc_get_ops(priv->dss);
 
@@ -707,9 +708,6 @@ static int pdev_probe(struct platform_device *pdev)
struct omap_drm_private *priv;
int ret;
 
-   if (omapdss_is_initialized() == false)
-   return -EPROBE_DEFER;
-
ret = dma_coerce_mask_and_coherent(>dev, DMA_BIT_MASK(32));
if (ret) {
dev_err(>dev, "Failed to set the DMA mask\n");
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 36/56] drm/omap: drop omapdss-boot-init

2020-02-25 Thread Sebastian Reichel
The table of compatible values needed to be prefixed with "omapdss,"
is empty, so all of this code is doing nothing now. Let's drop it.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/Kconfig   |   3 -
 drivers/gpu/drm/omapdrm/dss/Makefile  |   2 -
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   | 219 --
 3 files changed, 224 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c

diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig 
b/drivers/gpu/drm/omapdrm/dss/Kconfig
index 90e2dd522896..9ac60c24787b 100644
--- a/drivers/gpu/drm/omapdrm/dss/Kconfig
+++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
@@ -1,7 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
-config OMAP2_DSS_INIT
-   bool
-
 config OMAP_DSS_BASE
tristate
 
diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile 
b/drivers/gpu/drm/omapdrm/dss/Makefile
index f967e6948f2e..811966cd7468 100644
--- a/drivers/gpu/drm/omapdrm/dss/Makefile
+++ b/drivers/gpu/drm/omapdrm/dss/Makefile
@@ -1,6 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_OMAP2_DSS_INIT) += omapdss-boot-init.o
-
 obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
 omapdss-base-y := base.o display.o output.o
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
deleted file mode 100644
index c849927ff185..
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ /dev/null
@@ -1,219 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Tomi Valkeinen 
- */
-
-/*
- * As omapdss panel drivers are omapdss specific, but we want to define the
- * DT-data in generic manner, we convert the compatible strings of the panel 
and
- * encoder nodes from "panel-foo" to "omapdss,panel-foo". This way we can have
- * both correct DT data and omapdss specific drivers.
- *
- * When we get generic panel drivers to the kernel, this file will be removed.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static struct list_head dss_conv_list __initdata;
-
-static const char prefix[] __initconst = "omapdss,";
-
-struct dss_conv_node {
-   struct list_head list;
-   struct device_node *node;
-   bool root;
-};
-
-static int __init omapdss_count_strings(const struct property *prop)
-{
-   const char *p = prop->value;
-   int l = 0, total = 0;
-   int i;
-
-   for (i = 0; total < prop->length; total += l, p += l, i++)
-   l = strlen(p) + 1;
-
-   return i;
-}
-
-static void __init omapdss_update_prop(struct device_node *node, char *compat,
-   int len)
-{
-   struct property *prop;
-
-   prop = kzalloc(sizeof(*prop), GFP_KERNEL);
-   if (!prop)
-   return;
-
-   prop->name = "compatible";
-   prop->value = compat;
-   prop->length = len;
-
-   of_update_property(node, prop);
-}
-
-static void __init omapdss_prefix_strcpy(char *dst, int dst_len,
-   const char *src, int src_len)
-{
-   size_t total = 0;
-
-   while (total < src_len) {
-   size_t l = strlen(src) + 1;
-
-   strcpy(dst, prefix);
-   dst += strlen(prefix);
-
-   strcpy(dst, src);
-   dst += l;
-
-   src += l;
-   total += l;
-   }
-}
-
-/* prepend compatible property strings with "omapdss," */
-static void __init omapdss_omapify_node(struct device_node *node)
-{
-   struct property *prop;
-   char *new_compat;
-   int num_strs;
-   int new_len;
-
-   prop = of_find_property(node, "compatible", NULL);
-
-   if (!prop || !prop->value)
-   return;
-
-   if (strnlen(prop->value, prop->length) >= prop->length)
-   return;
-
-   /* is it already prefixed? */
-   if (strncmp(prefix, prop->value, strlen(prefix)) == 0)
-   return;
-
-   num_strs = omapdss_count_strings(prop);
-
-   new_len = prop->length + strlen(prefix) * num_strs;
-   new_compat = kmalloc(new_len, GFP_KERNEL);
-
-   omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);
-
-   omapdss_update_prop(node, new_compat, new_len);
-}
-
-static void __init omapdss_add_to_list(struct device_node *node, bool root)
-{
-   struct dss_conv_node *n = kmalloc(sizeof(*n), GFP_KERNEL);
-   if (n) {
-   n->node = node;
-   n->root = root;
-   list_add(>list, _conv_list);
-   }
-}
-
-static bool __init omapdss_list_contains(const struct device_node *node)
-{
-   struct dss_conv_node *n;
-
-   list_for_each_entry(n, _conv_list, list) {
-   if (n->node == node)
-   return true;
-   }
-
-   return false;
-}
-
-static void __init o

[PATCHv2 48/56] drm/omap: simplify omap_display_id

2020-02-25 Thread Sebastian Reichel
We no longer need to check for the DSS API, since all encoders,
panels and connectors have been converted to the bridge API.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index 4c2095067544..3a1982e7aa98 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -206,14 +206,7 @@ static int omap_display_id(struct omap_dss_device *output)
 {
struct device_node *node = NULL;
 
-   if (output->next) {
-   struct omap_dss_device *display = output;
-
-   while (display->next)
-   display = display->next;
-
-   node = display->dev->of_node;
-   } else if (output->bridge) {
+   if (output->bridge) {
struct drm_bridge *bridge = output->bridge;
 
while (drm_bridge_get_next_bridge(bridge))
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 00/56] drm/omap: Convert DSI code to use drm_mipi_dsi and drm_panel

2020-02-25 Thread Sebastian Reichel
This updates the existing omapdrm DSI code, so that it uses
common drm_mipi_dsi API and drm_panel.

The patchset has been tested with Droid 4 using Linux console, X.org and
Weston. The patchset is based on Laurent Pinchartl's patch series [0]
and removes the last custom panel driver, so quite a few cleanups on the
omapdrm codebase were possible.

[0] [PATCH v7 00/54] drm/omap: Replace custom display drivers with drm_bridge 
and drm_panel

https://lore.kernel.org/dri-devel/20200222150106.22919-1-laurent.pinch...@ideasonboard.com/
git://linuxtv.org/pinchartl/media.git omapdrm/bridge/devel

I pushed this patchset into the following branch:

git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-n900.git 
omapdrm/bridge/devel-with-dsi

The previous version of this patchset has been sent quite some time ago.
This version has been rebased and required cleaning up most of the
hacks. I do not have a detailed changelog, but quite a few things
changed. I decided against doing anything special for the DT change
(adding DSI channel number), since only 3 devices are affected. It is
quite likely, that all developers of those devices update DT together
with kernel for those devices. My suggestion is to merge the first two
patches ASAP and backport to stable, since it does not affect old
kernels and the change is rather small.

RFCv1: 
https://lore.kernel.org/dri-devel/20191117023946.VjCC3yE08DMx7JIKxNagPoT5et7WTnKGVV6MtOtB9Ro@z/

-- Sebastian

Sebastian Reichel (56):
  ARM: dts: omap: add channel to DSI panels
  ARM: dts: omap4-droid4: add panel compatible
  Revert "drm/omap: dss: Remove unused omap_dss_device operations"
  omap/drm: drop unused dsi.configure_pins
  drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*
  drm/omap: constify write buffers
  drm/omap: dsi: add generic transfer function
  drm/omap: panel-dsi-cm: convert to transfer API
  drm/omap: dsi: unexport specific data transfer functions
  drm/omap: dsi: drop virtual channel logic
  drm/omap: dsi: simplify write function
  drm/omap: dsi: simplify read functions
  drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg
  drm/omap: dsi: introduce mipi_dsi_host
  drm/omap: panel-dsi-cm: use DSI helpers
  drm/omap: dsi: request VC via mipi_dsi_attach
  drm/omap: panel-dsi-cm: drop hardcoded VC
  drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines
  drm/omap: dsi: drop unused memory_read()
  drm/omap: dsi: drop unused get_te()
  drm/omap: dsi: drop unused enable_te()
  drm/omap: dsi: drop useless sync()
  drm/omap: dsi: use pixel-format and mode from attach
  drm/omap: panel-dsi-cm: use bulk regulator API
  drm/omap: dsi: lp/hs switching support for transfer()
  drm/omap: dsi: move TE GPIO handling into core
  drm/omap: dsi: drop custom enable_te() API
  drm/omap: dsi: do bus locking in host driver
  drm/omap: dsi: untangle ulps ops from enable/disable
  drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE
  drm/omap: dsi: do ULPS in host driver
  drm/omap: dsi: move panel refresh function to host
  drm/omap: dsi: Reverse direction of the DSS device enable/disable
operations
  drm/omap: dsi: drop custom panel capability support
  drm/omap: dsi: convert to drm_panel
  drm/omap: drop omapdss-boot-init
  drm/omap: dsi: implement check timings
  drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO
  drm/omap: panel-dsi-cm: support unbinding
  drm/omap: panel-dsi-cm: fix remove()
  drm/omap: dsi: return proper error code from dsi_update_all()
  drm/omap: remove global dss_device variable
  drm/omap: bind components with drm_device argument
  drm/panel: Move OMAP's DSI command mode panel driver
  drm/omap: dsi: Register a drm_bridge
  drm/omap: remove legacy DSS device operations
  drm/omap: remove unused omap_connector
  drm/omap: simplify omap_display_id
  drm/omap: drop unused DSS next pointer
  drm/omap: drop empty omap_encoder helper functions
  drm/omap: drop DSS ops_flags
  drm/omap: drop dssdev display field
  drm/omap: simplify DSI manual update code
  ARM: omap2plus_defconfig: Update for moved DSI command mode panel
  drm/panel/panel-dsi-cm: support rotation property
  ARM: dts: omap4-droid4: add panel orientation

 .../bindings/display/panel/panel-dsi-cm.txt   |4 +-
 .../boot/dts/motorola-mapphone-common.dtsi|6 +-
 arch/arm/boot/dts/omap3-n950.dts  |3 +-
 arch/arm/boot/dts/omap3.dtsi  |3 +
 arch/arm/boot/dts/omap4-sdp.dts   |6 +-
 arch/arm/boot/dts/omap4.dtsi  |6 +
 arch/arm/boot/dts/omap5.dtsi  |6 +
 arch/arm/configs/omap2plus_defconfig  |2 +-
 drivers/gpu/drm/omapdrm/Kconfig   |1 -
 drivers/gpu/drm/omapdrm/Makefile  |2 -
 drivers/gpu/drm/omapdrm/displays/Kconfig  |   10 -
 drivers/gpu/drm/omapdrm/displays/Makefile |2 -
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 1387 -
 drivers/gpu/drm/omapdrm/dss/Kconfig   |4 +-
 drivers/gpu/drm/omapdrm/ds

[PATCHv2 46/56] drm/omap: remove legacy DSS device operations

2020-02-25 Thread Sebastian Reichel
All DSS devices have been converted to bridge API, so
the device operations are always NULL. This removes
the device ops function pointers and all code using it.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/base.c   | 66 
 drivers/gpu/drm/omapdrm/dss/dss.c|  8 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h| 34 
 drivers/gpu/drm/omapdrm/omap_connector.c | 29 ---
 drivers/gpu/drm/omapdrm/omap_encoder.c   | 40 --
 5 files changed, 177 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 8e08c49b4f97..c2791305c332 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -161,8 +161,6 @@ int omapdss_device_connect(struct dss_device *dss,
   struct omap_dss_device *src,
   struct omap_dss_device *dst)
 {
-   int ret;
-
dev_dbg(>pdev->dev, "connect(%s, %s)\n",
src ? dev_name(src->dev) : "NULL",
dst ? dev_name(dst->dev) : "NULL");
@@ -181,14 +179,6 @@ int omapdss_device_connect(struct dss_device *dss,
 
dst->dss = dss;
 
-   if (dst->ops && dst->ops->connect) {
-   ret = dst->ops->connect(src, dst);
-   if (ret < 0) {
-   dst->dss = NULL;
-   return ret;
-   }
-   }
-
return 0;
 }
 EXPORT_SYMBOL_GPL(omapdss_device_connect);
@@ -212,66 +202,10 @@ void omapdss_device_disconnect(struct omap_dss_device 
*src,
return;
}
 
-   WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);
-
-   if (dst->ops && dst->ops->disconnect)
-   dst->ops->disconnect(src, dst);
dst->dss = NULL;
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
 
-void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
-{
-   if (!dssdev)
-   return;
-
-   omapdss_device_pre_enable(dssdev->next);
-
-   if (dssdev->ops && dssdev->ops->pre_enable)
-   dssdev->ops->pre_enable(dssdev);
-}
-EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
-
-void omapdss_device_enable(struct omap_dss_device *dssdev)
-{
-   if (!dssdev)
-   return;
-
-   if (dssdev->ops && dssdev->ops->enable)
-   dssdev->ops->enable(dssdev);
-
-   omapdss_device_enable(dssdev->next);
-
-   dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-}
-EXPORT_SYMBOL_GPL(omapdss_device_enable);
-
-void omapdss_device_disable(struct omap_dss_device *dssdev)
-{
-   if (!dssdev)
-   return;
-
-   omapdss_device_disable(dssdev->next);
-
-   if (dssdev->ops && dssdev->ops->disable)
-   dssdev->ops->disable(dssdev);
-}
-EXPORT_SYMBOL_GPL(omapdss_device_disable);
-
-void omapdss_device_post_disable(struct omap_dss_device *dssdev)
-{
-   if (!dssdev)
-   return;
-
-   if (dssdev->ops && dssdev->ops->post_disable)
-   dssdev->ops->post_disable(dssdev);
-
-   omapdss_device_post_disable(dssdev->next);
-
-   dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
-}
-EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
-
 /* 
-
  * Components Handling
  */
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
b/drivers/gpu/drm/omapdrm/dss/dss.c
index a0b37d9b62ea..bf627a50e72f 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1553,15 +1553,7 @@ static int dss_remove(struct platform_device *pdev)
 
 static void dss_shutdown(struct platform_device *pdev)
 {
-   struct omap_dss_device *dssdev = NULL;
-
DSSDBG("shutdown\n");
-
-   for_each_dss_output(dssdev) {
-   if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE &&
-   dssdev->ops && dssdev->ops->disable)
-   dssdev->ops->disable(dssdev);
-   }
 }
 
 static int dss_runtime_suspend(struct device *dev)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 45f5c46712eb..325a89d802e2 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -122,11 +122,6 @@ enum omap_dss_dsi_mode {
OMAP_DSS_DSI_VIDEO_MODE,
 };
 
-enum omap_dss_display_state {
-   OMAP_DSS_DISPLAY_DISABLED = 0,
-   OMAP_DSS_DISPLAY_ACTIVE,
-};
-
 enum omap_dss_rotation_type {
OMAP_DSS_ROT_NONE   = 0,
OMAP_DSS_ROT_TILER  = 1 << 0,
@@ -280,24 +275,6 @@ struct omapdss_dsi_ops {
 };
 
 struct omap_dss_device_ops {
-   int (*connect)(struct omap_dss_device *dssdev,
-   struct omap_dss_device *dst)

[PATCHv2 20/56] drm/omap: dsi: drop unused get_te()

2020-02-25 Thread Sebastian Reichel
The get_te() callback is not used, so we can drop the
custom API.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 13 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h   |  1 -
 2 files changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 59b8fc71c974..e4b24c67c45d 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -919,18 +919,6 @@ static int dsicm_enable_te(struct omap_dss_device *dssdev, 
bool enable)
return r;
 }
 
-static int dsicm_get_te(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   int r;
-
-   mutex_lock(>lock);
-   r = ddata->te_enabled;
-   mutex_unlock(>lock);
-
-   return r;
-}
-
 static void dsicm_ulps_work(struct work_struct *work)
 {
struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
@@ -1002,7 +990,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
.sync   = dsicm_sync,
 
.enable_te  = dsicm_enable_te,
-   .get_te = dsicm_get_te,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 54f362cc5223..a1e78ba665d8 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -387,7 +387,6 @@ struct omap_dss_driver {
int (*sync)(struct omap_dss_device *dssdev);
 
int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
-   int (*get_te)(struct omap_dss_device *dssdev);
 };
 
 struct dss_device *omapdss_get_dss(void);
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 13/56] drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg

2020-02-25 Thread Sebastian Reichel
Simplify the DSI encoder by using mipi_dsi_msg for
dsi_vc_send_long and dsi_vc_send_short. Further improvements
require cleaning up the channel allocation code first.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 92 +++
 1 file changed, 45 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 9b5b078beb6d..4899bfa2d76f 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2599,30 +2599,36 @@ static inline void dsi_vc_write_long_payload(struct 
dsi_data *dsi, int channel,
dsi_write_reg(dsi, DSI_VC_LONG_PACKET_PAYLOAD(channel), val);
 }
 
-static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
-   const u8 *data, u16 len, u8 ecc)
+static int dsi_vc_send_long(struct dsi_data *dsi,
+   const struct mipi_dsi_msg *msg)
 {
+   struct mipi_dsi_packet pkg;
/*u32 val; */
int i;
const u8 *p;
int r = 0;
u8 b1, b2, b3, b4;
 
+   r = mipi_dsi_create_packet(, msg);
+   if (r < 0)
+   return r;
+
if (dsi->debug_write)
-   DSSDBG("dsi_vc_send_long, %d bytes\n", len);
+   DSSDBG("dsi_vc_send_long, %d bytes\n", msg->tx_len);
 
/* len + header */
-   if (dsi->vc[channel].tx_fifo_size * 32 * 4 < len + 4) {
+   if (dsi->vc[msg->channel].tx_fifo_size * 32 * 4 < msg->tx_len + 4) {
DSSERR("unable to send long packet: packet too long.\n");
return -EINVAL;
}
 
-   dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
+   dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
 
-   dsi_vc_write_long_header(dsi, channel, data_type, len, ecc);
+   dsi_vc_write_long_header(dsi, msg->channel, msg->type, msg->tx_len,
+pkg.header[3]);
 
-   p = data;
-   for (i = 0; i < len >> 2; i++) {
+   p = msg->tx_buf;
+   for (i = 0; i < msg->tx_len >> 2; i++) {
if (dsi->debug_write)
DSSDBG("\tsending full packet %d\n", i);
 
@@ -2631,10 +2637,10 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int 
channel, u8 data_type,
b3 = *p++;
b4 = *p++;
 
-   dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, b4);
+   dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, b4);
}
 
-   i = len % 4;
+   i = msg->tx_len % 4;
if (i) {
b1 = 0; b2 = 0; b3 = 0;
 
@@ -2656,64 +2662,64 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int 
channel, u8 data_type,
break;
}
 
-   dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, 0);
+   dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, 0);
}
 
return r;
 }
 
-static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type,
-u16 data, u8 ecc)
+static int dsi_vc_send_short(struct dsi_data *dsi,
+const struct mipi_dsi_msg *msg)
 {
+   struct mipi_dsi_packet pkg;
u32 r;
-   u8 data_id;
+
+   r = mipi_dsi_create_packet(, msg);
+   if (r < 0)
+   return r;
 
WARN_ON(!dsi_bus_is_locked(dsi));
 
if (dsi->debug_write)
DSSDBG("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n",
-   channel,
-   data_type, data & 0xff, (data >> 8) & 0xff);
+   msg->channel,
+   msg->type, pkg.header[1], pkg.header[2]);
 
-   dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
+   dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
 
-   if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(channel)), 16, 16)) {
+   if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(msg->channel)), 16, 16)) {
DSSERR("ERROR FIFO FULL, aborting transfer\n");
return -EINVAL;
}
 
-   data_id = data_type | channel << 6;
-
-   r = (data_id << 0) | (data << 8) | (ecc << 24);
+   r = pkg.header[3] << 24 | pkg.header[2] << 16 | pkg.header[1] << 8 |
+   pkg.header[0];
 
-   dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(channel), r);
+   dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(msg->channel), r);
 
return 0;
 }
 
 static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
 {
-   return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
+   const struct mipi_dsi_msg msg = {
+   .channel = channel,
+   .

[PATCHv2 47/56] drm/omap: remove unused omap_connector

2020-02-25 Thread Sebastian Reichel
Remove unused code. Connectors are now created via drm_bridge_connector_init()
and no longer OMAP specific.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/Makefile |   1 -
 drivers/gpu/drm/omapdrm/omap_connector.c | 128 ---
 drivers/gpu/drm/omapdrm/omap_connector.h |  28 -
 drivers/gpu/drm/omapdrm/omap_drv.c   |  19 ++--
 drivers/gpu/drm/omapdrm/omap_drv.h   |   1 -
 drivers/gpu/drm/omapdrm/omap_encoder.c   |  11 --
 6 files changed, 6 insertions(+), 182 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
 delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.h

diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 66a73eae6f7c..2a404e045b78 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -12,7 +12,6 @@ omapdrm-y := omap_drv.o \
omap_crtc.o \
omap_plane.o \
omap_encoder.o \
-   omap_connector.o \
omap_fb.o \
omap_gem.o \
omap_gem_dmabuf.o \
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c 
b/drivers/gpu/drm/omapdrm/omap_connector.c
deleted file mode 100644
index db6becd345a0..
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ /dev/null
@@ -1,128 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Rob Clark 
- */
-
-#include 
-#include 
-#include 
-
-#include "omap_drv.h"
-
-/*
- * connector funcs
- */
-
-#define to_omap_connector(x) container_of(x, struct omap_connector, base)
-
-struct omap_connector {
-   struct drm_connector base;
-   struct omap_dss_device *output;
-};
-
-static enum drm_connector_status omap_connector_detect(
-   struct drm_connector *connector, bool force)
-{
-   return connector_status_connected;
-}
-
-static void omap_connector_destroy(struct drm_connector *connector)
-{
-   struct omap_connector *omap_connector = to_omap_connector(connector);
-
-   DBG("%s", connector->name);
-
-   drm_connector_unregister(connector);
-   drm_connector_cleanup(connector);
-
-   omapdss_device_put(omap_connector->output);
-
-   kfree(omap_connector);
-}
-
-static int omap_connector_get_modes(struct drm_connector *connector)
-{
-   DBG("%s", connector->name);
-
-   /* We can't retrieve modes. The KMS core will add the default modes. */
-   return 0;
-}
-
-enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return MODE_OK;
-}
-
-static enum drm_mode_status omap_connector_mode_valid(struct drm_connector 
*connector,
-struct drm_display_mode *mode)
-{
-   struct omap_connector *omap_connector = to_omap_connector(connector);
-   struct drm_display_mode new_mode = { { 0 } };
-   enum drm_mode_status status;
-
-   status = omap_connector_mode_fixup(omap_connector->output, mode,
-  _mode);
-   if (status != MODE_OK)
-   goto done;
-
-   /* Check if vrefresh is still valid. */
-   if (drm_mode_vrefresh(mode) != drm_mode_vrefresh(_mode))
-   status = MODE_NOCLOCK;
-
-done:
-   DBG("connector: mode %s: " DRM_MODE_FMT,
-   (status == MODE_OK) ? "valid" : "invalid",
-   DRM_MODE_ARG(mode));
-
-   return status;
-}
-
-static const struct drm_connector_funcs omap_connector_funcs = {
-   .reset = drm_atomic_helper_connector_reset,
-   .detect = omap_connector_detect,
-   .fill_modes = drm_helper_probe_single_connector_modes,
-   .destroy = omap_connector_destroy,
-   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-};
-
-static const struct drm_connector_helper_funcs omap_connector_helper_funcs = {
-   .get_modes = omap_connector_get_modes,
-   .mode_valid = omap_connector_mode_valid,
-};
-
-/* initialize connector */
-struct drm_connector *omap_connector_init(struct drm_device *dev,
- struct omap_dss_device *output,
- struct drm_encoder *encoder)
-{
-   struct drm_connector *connector = NULL;
-   struct omap_connector *omap_connector;
-
-   DBG("%s", output->name);
-
-   omap_connector = kzalloc(sizeof(*omap_connector), GFP_KERNEL);
-   if (!omap_connector)
-   goto fail;
-
-   omap_connector->output = omapdss_device_get(output);
-
-   connector = _connector->base;
-   connector->interlace_allowed = 1;
-   co

[PATCHv2 19/56] drm/omap: dsi: drop unused memory_read()

2020-02-25 Thread Sebastian Reichel
Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 93 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 -
 2 files changed, 97 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 92c9dc211aeb..59b8fc71c974 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -931,97 +931,6 @@ static int dsicm_get_te(struct omap_dss_device *dssdev)
return r;
 }
 
-static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
-u16 size)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct mipi_dsi_device *dsi = ddata->dsi;
-
-   return mipi_dsi_set_maximum_return_packet_size(dsi, size);
-}
-
-static int dsicm_memory_read(struct omap_dss_device *dssdev,
-   void *buf, size_t size,
-   u16 x, u16 y, u16 w, u16 h)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct mipi_dsi_device *dsi = ddata->dsi;
-   struct omap_dss_device *src = ddata->src;
-   int r;
-   int first = 1;
-   int plen;
-   unsigned int buf_used = 0;
-
-   if (size < w * h * 3)
-   return -ENOMEM;
-
-   mutex_lock(>lock);
-
-   if (!ddata->enabled) {
-   r = -ENODEV;
-   goto err1;
-   }
-
-   size = min((u32)w * h * 3,
-  ddata->vm.hactive * ddata->vm.vactive * 3);
-
-   src->ops->dsi.bus_lock(src);
-
-   r = dsicm_wake_up(ddata);
-   if (r)
-   goto err2;
-
-   /* plen 1 or 2 goes into short packet. until checksum error is fixed,
-* use short packets. plen 32 works, but bigger packets seem to cause
-* an error. */
-   if (size % 2)
-   plen = 1;
-   else
-   plen = 2;
-
-   dsicm_set_update_window(ddata, x, y, w, h);
-
-   r = dsicm_set_max_rx_packet_size(dssdev, plen);
-   if (r)
-   goto err2;
-
-   while (buf_used < size) {
-   u8 dcs_cmd = first ? 0x2e : 0x3e;
-   first = 0;
-
-   r = mipi_dsi_dcs_read(dsi, dcs_cmd,
- buf + buf_used, size - buf_used);
-   if (r < 0) {
-   dev_err(dssdev->dev, "read error\n");
-   goto err3;
-   }
-
-   buf_used += r;
-
-   if (r < plen) {
-   dev_err(>dsi->dev, "short read\n");
-   break;
-   }
-
-   if (signal_pending(current)) {
-   dev_err(>dsi->dev, "signal pending, "
-   "aborting memory read\n");
-   r = -ERESTARTSYS;
-   goto err3;
-   }
-   }
-
-   r = buf_used;
-
-err3:
-   dsicm_set_max_rx_packet_size(dssdev, 1);
-err2:
-   src->ops->dsi.bus_unlock(src);
-err1:
-   mutex_unlock(>lock);
-   return r;
-}
-
 static void dsicm_ulps_work(struct work_struct *work)
 {
struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
@@ -1094,8 +1003,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
 
.enable_te  = dsicm_enable_te,
.get_te = dsicm_get_te,
-
-   .memory_read= dsicm_memory_read,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index b946b90ce01b..54f362cc5223 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -388,10 +388,6 @@ struct omap_dss_driver {
 
int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
int (*get_te)(struct omap_dss_device *dssdev);
-
-   int (*memory_read)(struct omap_dss_device *dssdev,
-   void *buf, size_t size,
-   u16 x, u16 y, u16 w, u16 h);
 };
 
 struct dss_device *omapdss_get_dss(void);
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 28/56] drm/omap: dsi: do bus locking in host driver

2020-02-25 Thread Sebastian Reichel
This moves the bus locking into the host driver and unexports
the custom API in preparation for drm_panel support.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 46 +--
 drivers/gpu/drm/omapdrm/dss/dsi.c | 33 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 --
 3 files changed, 23 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index e4ffe34324f8..42a4a69b03fd 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -298,7 +298,6 @@ static int dsicm_wake_up(struct panel_drv_data *ddata)
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
struct panel_drv_data *ddata = dev_get_drvdata(>dev);
-   struct omap_dss_device *src = ddata->src;
int r = 0;
int level;
 
@@ -313,15 +312,11 @@ static int dsicm_bl_update_status(struct backlight_device 
*dev)
mutex_lock(>lock);
 
if (ddata->enabled) {
-   src->ops->dsi.bus_lock(src);
-
r = dsicm_wake_up(ddata);
if (!r) {
r = dsicm_dcs_write_1(ddata,
MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
}
-
-   src->ops->dsi.bus_unlock(src);
}
 
mutex_unlock(>lock);
@@ -347,21 +342,16 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
-   struct omap_dss_device *src = ddata->src;
u8 errors = 0;
int r;
 
mutex_lock(>lock);
 
if (ddata->enabled) {
-   src->ops->dsi.bus_lock(src);
-
r = dsicm_wake_up(ddata);
if (!r)
r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
);
-
-   src->ops->dsi.bus_unlock(src);
} else {
r = -ENODEV;
}
@@ -378,20 +368,15 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
-   struct omap_dss_device *src = ddata->src;
u8 id1, id2, id3;
int r;
 
mutex_lock(>lock);
 
if (ddata->enabled) {
-   src->ops->dsi.bus_lock(src);
-
r = dsicm_wake_up(ddata);
if (!r)
r = dsicm_get_id(ddata, , , );
-
-   src->ops->dsi.bus_unlock(src);
} else {
r = -ENODEV;
}
@@ -409,7 +394,6 @@ static ssize_t dsicm_store_ulps(struct device *dev,
const char *buf, size_t count)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
-   struct omap_dss_device *src = ddata->src;
unsigned long t;
int r;
 
@@ -420,14 +404,10 @@ static ssize_t dsicm_store_ulps(struct device *dev,
mutex_lock(>lock);
 
if (ddata->enabled) {
-   src->ops->dsi.bus_lock(src);
-
if (t)
r = dsicm_enter_ulps(ddata);
else
r = dsicm_wake_up(ddata);
-
-   src->ops->dsi.bus_unlock(src);
}
 
mutex_unlock(>lock);
@@ -457,7 +437,6 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
const char *buf, size_t count)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
-   struct omap_dss_device *src = ddata->src;
unsigned long t;
int r;
 
@@ -470,9 +449,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
 
if (ddata->enabled) {
/* dsicm_wake_up will restart the timer */
-   src->ops->dsi.bus_lock(src);
r = dsicm_wake_up(ddata);
-   src->ops->dsi.bus_unlock(src);
}
 
mutex_unlock(>lock);
@@ -673,17 +650,11 @@ static void dsicm_disconnect(struct omap_dss_device *src,
 static void dsicm_enable(struct omap_dss_device *dssdev)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *src = ddata->src;
int r;
 
mutex_lock(>lock);
 
-   src->ops->dsi.bus_lock(src);
-
r = dsicm_power_on(ddata);
-
-   src->ops->dsi.bus_unlock(src);
-
if (r)
goto err;
 
@@ -700,7 +671,6 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 static void dsicm_disable(struct omap_dss_device *dssdev)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *src = ddata->src;
int r;
 
dsicm_bl_power(ddata, false);
@@ -

[PATCHv2 02/56] ARM: dts: omap4-droid4: add panel compatible

2020-02-25 Thread Sebastian Reichel
Add Droid 4 specific compatible value in addition to the
generic one, so that we have the ability to add panel
specific quirks in the future.

Signed-off-by: Sebastian Reichel 
---
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
index a5e4ba7c8dab..622383ec6a75 100644
--- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
+++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
@@ -200,7 +200,7 @@ dsi1_out_ep: endpoint {
};
 
lcd0: panel@0 {
-   compatible = "panel-dsi-cm";
+   compatible = "motorola,droid4-panel", "panel-dsi-cm";
reg = <0>;
label = "lcd0";
vddi-supply = <_regulator>;
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 05/56] drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*

2020-02-25 Thread Sebastian Reichel
This replaces OMAP specific enum for pixel format with
common implementation.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 +-
 drivers/gpu/drm/omapdrm/dss/dsi.c | 49 +++
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +---
 3 files changed, 20 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index e7fe5d702337..e6ebfc35243e 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -595,7 +595,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
int r;
struct omap_dss_dsi_config dsi_config = {
.mode = OMAP_DSS_DSI_CMD_MODE,
-   .pixel_format = OMAP_DSS_DSI_FMT_RGB888,
+   .pixel_format = MIPI_DSI_FMT_RGB888,
.vm = >vm,
.hs_clk_min = 15000,
.hs_clk_max = 3,
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 8c39823a8295..bb2548d091ef 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -34,6 +34,7 @@
 #include 
 
 #include 
+#include 
 
 #include "omapdss.h"
 #include "dss.h"
@@ -410,7 +411,7 @@ struct dsi_data {
 
struct dss_lcd_mgr_config mgr_config;
struct videomode vm;
-   enum omap_dss_dsi_pixel_format pix_fmt;
+   enum mipi_dsi_pixel_format pix_fmt;
enum omap_dss_dsi_mode mode;
struct omap_dss_dsi_videomode_timings vm_timings;
 
@@ -514,22 +515,6 @@ static inline bool wait_for_bit_change(struct dsi_data 
*dsi,
return false;
 }
 
-static u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
-{
-   switch (fmt) {
-   case OMAP_DSS_DSI_FMT_RGB888:
-   case OMAP_DSS_DSI_FMT_RGB666:
-   return 24;
-   case OMAP_DSS_DSI_FMT_RGB666_PACKED:
-   return 18;
-   case OMAP_DSS_DSI_FMT_RGB565:
-   return 16;
-   default:
-   BUG();
-   return 0;
-   }
-}
-
 #ifdef DSI_PERF_MEASURE
 static void dsi_perf_mark_setup(struct dsi_data *dsi)
 {
@@ -3239,7 +3224,7 @@ static void dsi_config_vp_num_line_buffers(struct 
dsi_data *dsi)
int num_line_buffers;
 
if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
-   int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+   int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
const struct videomode *vm = >vm;
/*
 * Don't use line buffers if width is greater than the video
@@ -3370,7 +3355,7 @@ static void dsi_config_cmd_mode_interleaving(struct 
dsi_data *dsi)
int tclk_trail, ths_exit, exiths_clk;
bool ddr_alwon;
const struct videomode *vm = >vm;
-   int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+   int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
int ndl = dsi->num_lanes_used - 1;
int dsi_fclk_hsdiv = dsi->user_dsi_cinfo.mX[HSDIV_DSI] + 1;
int hsa_interleave_hs = 0, hsa_interleave_lp = 0;
@@ -3498,7 +3483,7 @@ static int dsi_proto_config(struct dsi_data *dsi)
dsi_set_lp_rx_timeout(dsi, 0x1fff, true, true);
dsi_set_hs_tx_timeout(dsi, 0x1fff, true, true);
 
-   switch (dsi_get_pixel_size(dsi->pix_fmt)) {
+   switch (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt)) {
case 16:
buswidth = 0;
break;
@@ -3619,7 +3604,7 @@ static void dsi_proto_timings(struct dsi_data *dsi)
int window_sync = dsi->vm_timings.window_sync;
bool hsync_end;
const struct videomode *vm = >vm;
-   int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+   int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
int tl, t_he, width_bytes;
 
hsync_end = dsi->vm_timings.trans_mode == 
OMAP_DSS_DSI_PULSE_MODE;
@@ -3726,7 +3711,7 @@ static int dsi_configure_pins(struct omap_dss_device 
*dssdev,
 static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
-   int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+   int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
u8 data_type;
u16 word_count;
int r;
@@ -3737,16 +3722,16 @@ static int dsi_enable_video_output(struct 
omap_dss_device *dssdev, int channel)
 
if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
switch (dsi->pix_fmt) {
-   case OMAP_DSS_DSI_FMT_RGB888:
+   case MIPI_DSI_FMT_RGB888:
data_type = MIPI_DSI_PACKED_PIXEL_STREAM_24;
break;
-   case OMAP_DSS_DSI_FMT_RGB666:
+   case MIPI_DSI_FMT_RGB666:
  

[PATCHv2 50/56] drm/omap: drop empty omap_encoder helper functions

2020-02-25 Thread Sebastian Reichel
Cleanup empty functions for encoder enable, disable and atomic check.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/omap_encoder.c | 28 --
 1 file changed, 28 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 5f5fa01240a7..e24411fb9dac 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -113,36 +113,8 @@ static void omap_encoder_mode_set(struct drm_encoder 
*encoder,
dss_mgr_set_timings(output, );
 }
 
-static void omap_encoder_disable(struct drm_encoder *encoder)
-{
-   struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
-   struct omap_dss_device *dssdev = omap_encoder->output;
-   struct drm_device *dev = encoder->dev;
-
-   dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
-}
-
-static void omap_encoder_enable(struct drm_encoder *encoder)
-{
-   struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
-   struct omap_dss_device *dssdev = omap_encoder->output;
-   struct drm_device *dev = encoder->dev;
-
-   dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
-}
-
-static int omap_encoder_atomic_check(struct drm_encoder *encoder,
-struct drm_crtc_state *crtc_state,
-struct drm_connector_state *conn_state)
-{
-   return 0;
-}
-
 static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = {
.mode_set = omap_encoder_mode_set,
-   .disable = omap_encoder_disable,
-   .enable = omap_encoder_enable,
-   .atomic_check = omap_encoder_atomic_check,
 };
 
 /* initialize encoder */
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 23/56] drm/omap: dsi: use pixel-format and mode from attach

2020-02-25 Thread Sebastian Reichel
In order to reduce the amount of custom functionality, this moves
handling of pixel format and DSI mode from set_config() to dsi
attach.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 --
 drivers/gpu/drm/omapdrm/dss/dsi.c | 20 +--
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index a45df247aad1..199eac88a777 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -550,8 +550,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
u8 id1, id2, id3;
int r;
struct omap_dss_dsi_config dsi_config = {
-   .mode = OMAP_DSS_DSI_CMD_MODE,
-   .pixel_format = MIPI_DSI_FMT_RGB888,
.vm = >vm,
.hs_clk_min = 15000,
.hs_clk_max = 3,
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 64407f4651af..6c625b6d6d6b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4583,18 +4583,19 @@ static int dsi_set_config(struct omap_dss_device 
*dssdev,
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
struct dsi_clk_calc_ctx ctx;
+   struct omap_dss_dsi_config cfg = *config;
bool ok;
int r;
 
mutex_lock(>lock);
 
-   dsi->pix_fmt = config->pixel_format;
-   dsi->mode = config->mode;
+   cfg.mode = dsi->mode;
+   cfg.pixel_format = dsi->pix_fmt;
 
-   if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
-   ok = dsi_vm_calc(dsi, config, );
+   if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
+   ok = dsi_vm_calc(dsi, , );
else
-   ok = dsi_cm_calc(dsi, config, );
+   ok = dsi_cm_calc(dsi, , );
 
if (!ok) {
DSSERR("failed to find suitable DSI clock settings\n");
@@ -4605,7 +4606,7 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
dsi_pll_calc_dsi_fck(dsi, _cinfo);
 
r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
-   config->lp_clk_min, config->lp_clk_max, >user_lp_cinfo);
+   cfg.lp_clk_min, cfg.lp_clk_max, >user_lp_cinfo);
if (r) {
DSSERR("failed to find suitable DSI LP clock settings\n");
goto err;
@@ -4784,6 +4785,13 @@ int omap_dsi_host_attach(struct mipi_dsi_host *host,
}
 
dsi->vc[channel].dest = client;
+
+   dsi->pix_fmt = client->format;
+   if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
+   dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
+   else
+   dsi->mode = OMAP_DSS_DSI_CMD_MODE;
+
return 0;
 }
 
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 26/56] drm/omap: dsi: move TE GPIO handling into core

2020-02-25 Thread Sebastian Reichel
In preparation for removing custom DSS calls from the DSI
panel driver, this moves support for external tearing event
GPIOs into the DSI host driver. This way tearing events are
always handled in the core resulting in simplification of
the panel drivers.

The TE GPIO acquisition follows works in the same way as the
exynos DSI implementation.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 101 +
 drivers/gpu/drm/omapdrm/dss/dsi.c | 140 --
 2 files changed, 135 insertions(+), 106 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 79ac1f6b375a..30e48d0de961 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -54,7 +54,6 @@ struct panel_drv_data {
 
/* panel HW configuration from DT or platform data */
struct gpio_desc *reset_gpio;
-   struct gpio_desc *ext_te_gpio;
 
struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
 
@@ -68,10 +67,6 @@ struct panel_drv_data {
 
bool te_enabled;
 
-   atomic_t do_update;
-
-   struct delayed_work te_timeout_work;
-
bool intro_printed;
 
struct workqueue_struct *workqueue;
@@ -83,8 +78,6 @@ struct panel_drv_data {
 
 #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
 
-static irqreturn_t dsicm_te_isr(int irq, void *data);
-static void dsicm_te_timeout_work_callback(struct work_struct *work);
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
 
 static int dsicm_panel_reset(struct panel_drv_data *ddata);
@@ -240,9 +233,6 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
if (r)
goto err;
 
-   if (ddata->ext_te_gpio)
-   disable_irq(gpiod_to_irq(ddata->ext_te_gpio));
-
src->ops->dsi.disable(src, false, true);
 
ddata->ulps_enabled = true;
@@ -271,15 +261,12 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
src->ops->enable(src);
ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
-   r = _dsicm_enable_te(ddata, true);
+   r = _dsicm_enable_te(ddata, ddata->te_enabled);
if (r) {
dev_err(>dsi->dev, "failed to re-enable TE");
goto err2;
}
 
-   if (ddata->ext_te_gpio)
-   enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
-
dsicm_queue_ulps_work(ddata);
 
ddata->ulps_enabled = false;
@@ -290,11 +277,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
dev_err(>dsi->dev, "failed to exit ULPS");
 
r = dsicm_panel_reset(ddata);
-   if (!r) {
-   if (ddata->ext_te_gpio)
-   enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
+   if (!r)
ddata->ulps_enabled = false;
-   }
 
dsicm_queue_ulps_work(ddata);
 
@@ -745,43 +729,6 @@ static void dsicm_framedone_cb(int err, void *data)
src->ops->dsi.bus_unlock(src);
 }
 
-static irqreturn_t dsicm_te_isr(int irq, void *data)
-{
-   struct panel_drv_data *ddata = data;
-   struct omap_dss_device *src = ddata->src;
-   int old;
-   int r;
-
-   old = atomic_cmpxchg(>do_update, 1, 0);
-
-   if (old) {
-   cancel_delayed_work(>te_timeout_work);
-
-   r = src->ops->dsi.update(src, ddata->dsi->channel, 
dsicm_framedone_cb,
-   ddata);
-   if (r)
-   goto err;
-   }
-
-   return IRQ_HANDLED;
-err:
-   dev_err(>dsi->dev, "start update failed\n");
-   src->ops->dsi.bus_unlock(src);
-   return IRQ_HANDLED;
-}
-
-static void dsicm_te_timeout_work_callback(struct work_struct *work)
-{
-   struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
-   te_timeout_work.work);
-   struct omap_dss_device *src = ddata->src;
-
-   dev_err(>dsi->dev, "TE not received for 250ms!\n");
-
-   atomic_set(>do_update, 0);
-   src->ops->dsi.bus_unlock(src);
-}
-
 static int dsicm_update(struct omap_dss_device *dssdev,
u16 x, u16 y, u16 w, u16 h)
 {
@@ -809,16 +756,10 @@ static int dsicm_update(struct omap_dss_device *dssdev,
if (r)
goto err;
 
-   if (ddata->te_enabled && ddata->ext_te_gpio) {
-   schedule_delayed_work(>te_timeout_work,
-   msecs_to_jiffies(250));
-   atomic_set(>do_update, 1);
-   } else {
-   r = src->ops->dsi.update(src, ddata->dsi->channel, 
dsicm_framedone_cb,
-   ddata);
-   if (r)
-

[PATCHv2 17/56] drm/omap: panel-dsi-cm: drop hardcoded VC

2020-02-25 Thread Sebastian Reichel
Use dsi->channel everywhere, which originates from DT.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 20 +++
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index b3688a8ca3cf..9a2ccec27f7e 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -27,9 +27,6 @@
 
 #include "../dss/omapdss.h"
 
-/* DSI Virtual channel. Hardcoded for now. */
-#define TCH 0
-
 #define DCS_READ_NUM_ERRORS0x05
 #define DCS_BRIGHTNESS 0x51
 #define DCS_CTRL_DISPLAY   0x53
@@ -73,7 +70,6 @@ struct panel_drv_data {
bool te_enabled;
 
atomic_t do_update;
-   int channel;
 
struct delayed_work te_timeout_work;
 
@@ -274,7 +270,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
return 0;
 
src->ops->enable(src);
-   src->ops->dsi.enable_hs(src, ddata->channel, true);
+   src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
 
r = _dsicm_enable_te(ddata, true);
if (r) {
@@ -591,7 +587,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
dsicm_hw_reset(ddata);
 
-   src->ops->dsi.enable_hs(src, ddata->channel, false);
+   src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
 
r = dsicm_sleep_out(ddata);
if (r)
@@ -622,7 +618,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
if (r)
goto err;
 
-   r = src->ops->dsi.enable_video_output(src, ddata->channel);
+   r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
if (r)
goto err;
 
@@ -634,7 +630,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
ddata->intro_printed = true;
}
 
-   src->ops->dsi.enable_hs(src, ddata->channel, true);
+   src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
 
return 0;
 err:
@@ -658,7 +654,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
struct omap_dss_device *src = ddata->src;
int r;
 
-   src->ops->dsi.disable_video_output(src, ddata->channel);
+   src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
 
r = mipi_dsi_dcs_set_display_off(ddata->dsi);
if (!r)
@@ -777,7 +773,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
if (old) {
cancel_delayed_work(>te_timeout_work);
 
-   r = src->ops->dsi.update(src, ddata->channel, 
dsicm_framedone_cb,
+   r = src->ops->dsi.update(src, ddata->dsi->channel, 
dsicm_framedone_cb,
ddata);
if (r)
goto err;
@@ -834,7 +830,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
msecs_to_jiffies(250));
atomic_set(>do_update, 1);
} else {
-   r = src->ops->dsi.update(src, ddata->channel, 
dsicm_framedone_cb,
+   r = src->ops->dsi.update(src, ddata->dsi->channel, 
dsicm_framedone_cb,
ddata);
if (r)
goto err;
@@ -1110,8 +1106,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
struct display_timing timing;
int err;
 
-   ddata->channel = TCH;
-
ddata->reset_gpio = devm_gpiod_get(>dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(ddata->reset_gpio)) {
err = PTR_ERR(ddata->reset_gpio);
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 34/56] drm/omap: dsi: drop custom panel capability support

2020-02-25 Thread Sebastian Reichel
Due to previous changes the DSI encoder gets the capabilities
via DSI client's mode_flags and no longer needs the omapdss
specific caps. The core code now checks if the DSI encoder
is actually configured into command mode instead of just checking
the panel capabilities.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  3 ---
 drivers/gpu/drm/omapdrm/dss/dsi.c   |  8 
 drivers/gpu/drm/omapdrm/dss/omapdss.h   |  8 +---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 17 -
 4 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 6f559c1b0bf6..30be9e4ab908 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -602,9 +602,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
dssdev->of_port = 0;
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
-   dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
-   OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
-
omapdss_display_init(dssdev);
omapdss_device_register(dssdev);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index b0e796f90fca..42f995da21a5 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4732,6 +4732,13 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
dsi_vm_calc_pll_cb, ctx);
 }
 
+static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
+{
+   struct dsi_data *dsi = to_dsi_data(dssdev);
+
+   return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);
+}
+
 static int dsi_set_config(struct omap_dss_device *dssdev,
const struct omap_dss_dsi_config *config)
 {
@@ -4951,6 +4958,7 @@ static const struct omap_dss_device_ops dsi_ops = {
.disable_video_output = dsi_disable_video_output,
 
.update = dsi_update_all,
+   .is_video_mode = dsi_is_video_mode,
},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index d7081086c2b1..430e915d2759 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -122,11 +122,6 @@ enum omap_dss_dsi_mode {
OMAP_DSS_DSI_VIDEO_MODE,
 };
 
-enum omap_display_caps {
-   OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE  = 1 << 0,
-   OMAP_DSS_DISPLAY_CAP_TEAR_ELIM  = 1 << 1,
-};
-
 enum omap_dss_display_state {
OMAP_DSS_DISPLAY_DISABLED = 0,
OMAP_DSS_DISPLAY_ACTIVE,
@@ -281,6 +276,7 @@ struct omap_dss_writeback_info {
 
 struct omapdss_dsi_ops {
int (*update)(struct omap_dss_device *dssdev);
+   bool (*is_video_mode)(struct omap_dss_device *dssdev);
 
/* legacy API used by omapdss panels */
int (*set_config)(struct omap_dss_device *dssdev,
@@ -353,8 +349,6 @@ struct omap_dss_device {
unsigned long ops_flags;
u32 bus_flags;
 
-   enum omap_display_caps caps;
-
enum omap_dss_display_state state;
 
/* OMAP DSS output specific fields */
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index c924d77207fb..af62f6075602 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -495,8 +495,7 @@ static enum drm_mode_status omap_crtc_mode_valid(struct 
drm_crtc *crtc,
 * valid DISPC mode. DSI will calculate and configure the
 * proper DISPC mode later.
 */
-   if (omap_crtc->pipe->output->next == NULL ||
-   omap_crtc->pipe->output->next->type != OMAP_DISPLAY_TYPE_DSI) {
+   if (omap_crtc->pipe->output->type != OMAP_DISPLAY_TYPE_DSI) {
r = priv->dispc_ops->mgr_check_timings(priv->dispc,
   omap_crtc->channel,
   );
@@ -548,17 +547,17 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
 static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
 {
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
-   struct omap_dss_device *display = omap_crtc->pipe->output->next;
+   struct omap_dss_device *dssdev = omap_crtc->pipe->output;
 
-   if (!display)
+   if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
+   !dssdev->ops->dsi.is_video_mode)
return false;
 
-   if (display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
-   DBG("detected manually updated display!");
-   return true;
-   }
+   if (dssdev->ops->dsi.is_video_mode(dssdev))
+   return false;
 
-   return false;
+   DBG("detected manually updated display!");
+   return true;
 }
 
 sta

[PATCHv2 01/56] ARM: dts: omap: add channel to DSI panels

2020-02-25 Thread Sebastian Reichel
The standard binding for DSI requires, that the channel number
of the panel is encoded in DT. This adds the channel number in
all OMAP3-5 boards, in preparation for using common infrastructure.

Signed-off-by: Sebastian Reichel 
---
 .../devicetree/bindings/display/panel/panel-dsi-cm.txt  | 4 +++-
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 3 ++-
 arch/arm/boot/dts/omap3-n950.dts| 3 ++-
 arch/arm/boot/dts/omap3.dtsi| 3 +++
 arch/arm/boot/dts/omap4-sdp.dts | 6 --
 arch/arm/boot/dts/omap4.dtsi| 6 ++
 arch/arm/boot/dts/omap5.dtsi| 6 ++
 7 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt 
b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
index dce48eb9db57..f92d5c9adfc5 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
+++ b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
@@ -3,6 +3,7 @@ Generic MIPI DSI Command Mode Panel
 
 Required properties:
 - compatible: "panel-dsi-cm"
+- reg: DSI channel number
 
 Optional properties:
 - label: a symbolic name for the panel
@@ -15,9 +16,10 @@ Required nodes:
 Example
 ---
 
-lcd0: display {
+lcd0: panel@0 {
compatible = "tpo,taal", "panel-dsi-cm";
label = "lcd0";
+   reg = <0>;
 
reset-gpios = < 6 GPIO_ACTIVE_HIGH>;
 
diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
index 85665506f4f8..a5e4ba7c8dab 100644
--- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
+++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
@@ -199,8 +199,9 @@ dsi1_out_ep: endpoint {
};
};
 
-   lcd0: display {
+   lcd0: panel@0 {
compatible = "panel-dsi-cm";
+   reg = <0>;
label = "lcd0";
vddi-supply = <_regulator>;
reset-gpios = < 5 GPIO_ACTIVE_HIGH>;  /* gpio101 */
diff --git a/arch/arm/boot/dts/omap3-n950.dts b/arch/arm/boot/dts/omap3-n950.dts
index 31d47a1fad84..80cf4e1177da 100644
--- a/arch/arm/boot/dts/omap3-n950.dts
+++ b/arch/arm/boot/dts/omap3-n950.dts
@@ -225,8 +225,9 @@ dsi_out_ep: endpoint {
};
};
 
-   lcd0: display {
+   lcd0: panel@0 {
compatible = "nokia,himalaya", "panel-dsi-cm";
+   reg = <0>;
label = "lcd0";
 
pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 634ea16a711e..409d434a9b18 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -820,6 +820,9 @@ dsi: encoder@4804fc00 {
ti,hwmods = "dss_dsi1";
clocks = <_alwon_fck>, <_alwon_fck>;
clock-names = "fck", "sys_clk";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
};
 
rfbi: encoder@48050800 {
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 91480ac1f328..8a8307517dab 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -662,8 +662,9 @@ dsi1_out_ep: endpoint {
};
};
 
-   lcd0: display {
+   lcd0: panel@0 {
compatible = "tpo,taal", "panel-dsi-cm";
+   reg = <0>;
label = "lcd0";
 
reset-gpios = < 6 GPIO_ACTIVE_HIGH>;  /* 102 */
@@ -687,8 +688,9 @@ dsi2_out_ep: endpoint {
};
};
 
-   lcd1: display {
+   lcd1: panel@0 {
compatible = "tpo,taal", "panel-dsi-cm";
+   reg = <0>;
label = "lcd1";
 
reset-gpios = < 8 GPIO_ACTIVE_HIGH>;  /* 104 */
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 9a87440d0b9d..a75734065cac 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -465,6 +465,9 @@ dsi1: encoder@58004000 {
clocks = <_dss_clkctrl 
OMAP4_DSS_CORE_CLKCTRL 8>,
 <_dss_clkctrl 
OMAP4_DSS_CORE_CLKCTRL 10>;
clock-names = "fck", "sys_clk";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
};
 

[PATCHv2 15/56] drm/omap: panel-dsi-cm: use DSI helpers

2020-02-25 Thread Sebastian Reichel
After converting the driver to mipi_dsi_device we can use the generic
message helpers to simplify the driver a lot.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 126 +++---
 1 file changed, 18 insertions(+), 108 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index c34daecb1de5..4a4a55135494 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -138,62 +138,22 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
 
 static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 {
-   struct mipi_dsi_device *dsi = ddata->dsi;
-   const struct mipi_dsi_msg msg = {
-   .channel = ddata->channel,
-   .type = MIPI_DSI_DCS_READ,
-   .tx_len = 1,
-   .tx_buf = _cmd,
-   .rx_len = 1,
-   .rx_buf = data
-   };
-
-   return dsi->host->ops->transfer(dsi->host, );
-}
-
-static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
-{
-   struct mipi_dsi_device *dsi = ddata->dsi;
-   const struct mipi_dsi_msg msg = {
-   .channel = ddata->channel,
-   .type = MIPI_DSI_DCS_SHORT_WRITE,
-   .tx_buf = _cmd,
-   .tx_len = 1,
-   };
-
-   return dsi->host->ops->transfer(dsi->host, );
+   return mipi_dsi_dcs_read(ddata->dsi, dcs_cmd, data, 1);
 }
 
 static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
param)
 {
-   struct mipi_dsi_device *dsi = ddata->dsi;
-   const u8 buf[] = { dcs_cmd, param };
-   const struct mipi_dsi_msg msg = {
-   .channel = ddata->channel,
-   .type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
-   .tx_buf = ,
-   .tx_len = 2,
-   };
-
-   return dsi->host->ops->transfer(dsi->host, );
+   return mipi_dsi_dcs_write(ddata->dsi, dcs_cmd, , 1);
 }
 
 static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 {
-   struct mipi_dsi_device *dsi = ddata->dsi;
int r;
-   const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
-   const struct mipi_dsi_msg msg = {
-   .channel = ddata->channel,
-   .type = MIPI_DSI_DCS_SHORT_WRITE,
-   .tx_buf = ,
-   .tx_len = 1,
-   };
 
hw_guard_wait(ddata);
 
-   r = dsi->host->ops->transfer(dsi->host, );
+   r = mipi_dsi_dcs_enter_sleep_mode(ddata->dsi);
if (r)
return r;
 
@@ -210,7 +170,7 @@ static int dsicm_sleep_out(struct panel_drv_data *ddata)
 
hw_guard_wait(ddata);
 
-   r = dsicm_dcs_write_0(ddata, MIPI_DCS_EXIT_SLEEP_MODE);
+   r = mipi_dsi_dcs_exit_sleep_mode(ddata->dsi);
if (r)
return r;
 
@@ -248,46 +208,15 @@ static int dsicm_set_update_window(struct panel_drv_data 
*ddata,
u16 y1 = y;
u16 y2 = y + h - 1;
 
-   const u8 paramX[] = {
-   MIPI_DCS_SET_COLUMN_ADDRESS,
-   (x1 >> 8) & 0xff,
-   (x1 >> 0) & 0xff,
-   (x2 >> 8) & 0xff,
-   (x2 >> 0) & 0xff,
-   };
-
-   const struct mipi_dsi_msg msgX = {
-   .channel = ddata->channel,
-   .type = MIPI_DSI_GENERIC_LONG_WRITE,
-   .tx_buf = paramX,
-   .tx_len = 5,
-   };
-
-   const u8 paramY[] = {
-   MIPI_DCS_SET_PAGE_ADDRESS,
-   (y1 >> 8) & 0xff,
-   (y1 >> 0) & 0xff,
-   (y2 >> 8) & 0xff,
-   (y2 >> 0) & 0xff,
-   };
-
-   const struct mipi_dsi_msg msgY = {
-   .channel = ddata->channel,
-   .type = MIPI_DSI_GENERIC_LONG_WRITE,
-   .tx_buf = paramY,
-   .tx_len = 5,
-   };
-
-
-   r = dsi->host->ops->transfer(dsi->host, );
-   if (r)
+   r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
+   if (r < 0)
return r;
 
-   r = dsi->host->ops->transfer(dsi->host, );
-   if (r)
+   r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
+   if (r < 0)
return r;
 
-   return r;
+   return 0;
 }
 
 static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
@@ -681,12 +610,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
if (r)
goto err;
 
-   r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_PIXEL_FORMAT,
-   MIPI_DCS_PIXEL_FMT_24BIT);
+   r = mipi_dsi_dcs_set_pixel_format(ddata->dsi, MIPI_DCS_PIXEL_FMT_24BIT);
if (r)
goto err;
 
-   r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_ON);
+   r = mipi_dsi_dcs_set_displa

[PATCHv2 49/56] drm/omap: drop unused DSS next pointer

2020-02-25 Thread Sebastian Reichel
Since all encoders and panels are using the bridge API now,
we next pointer is no longer useful and can be dropped.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/base.c |  2 +-
 drivers/gpu/drm/omapdrm/dss/omapdss.h  |  1 -
 drivers/gpu/drm/omapdrm/dss/output.c   | 13 +
 drivers/gpu/drm/omapdrm/omap_encoder.c |  4 
 4 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index c2791305c332..d62713b241d2 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -135,7 +135,7 @@ struct omap_dss_device *omapdss_device_next_output(struct 
omap_dss_device *from)
goto done;
}
 
-   if (dssdev->id && (dssdev->next || dssdev->bridge))
+   if (dssdev->id && (dssdev->bridge))
goto done;
}
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 325a89d802e2..03498f0ed6c2 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -292,7 +292,6 @@ struct omap_dss_device {
struct module *owner;
 
struct dss_device *dss;
-   struct omap_dss_device *next;
struct drm_bridge *bridge;
struct drm_bridge *next_bridge;
struct drm_panel *panel;
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
b/drivers/gpu/drm/omapdrm/dss/output.c
index ce21c798cca6..40cb353572f6 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -30,7 +30,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
return 0;
}
 
-   out->next = omapdss_find_device_by_node(remote_node);
out->bridge = of_drm_find_bridge(remote_node);
out->panel = of_drm_find_panel(remote_node);
if (IS_ERR(out->panel))
@@ -38,12 +37,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 
of_node_put(remote_node);
 
-   if (out->next && out->type != out->next->type) {
-   dev_err(out->dev, "output type and display type don't match\n");
-   ret = -EINVAL;
-   goto error;
-   }
-
if (out->panel) {
struct drm_bridge *bridge;
 
@@ -69,7 +62,7 @@ int omapdss_device_init_output(struct omap_dss_device *out,
out->bridge = local_bridge;
}
 
-   if (!out->next && !out->bridge) {
+   if (!out->bridge) {
ret = -EPROBE_DEFER;
goto error;
}
@@ -78,7 +71,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 
 error:
omapdss_device_cleanup_output(out);
-   out->next = NULL;
return ret;
 }
 EXPORT_SYMBOL(omapdss_device_init_output);
@@ -88,9 +80,6 @@ void omapdss_device_cleanup_output(struct omap_dss_device 
*out)
if (out->bridge && out->panel)
drm_panel_bridge_remove(out->next_bridge ?
out->next_bridge : out->bridge);
-
-   if (out->next)
-   omapdss_device_put(out->next);
 }
 EXPORT_SYMBOL(omapdss_device_cleanup_output);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 610c5a2f2771..5f5fa01240a7 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -75,7 +75,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 {
struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
struct omap_dss_device *output = omap_encoder->output;
-   struct omap_dss_device *dssdev;
struct drm_device *dev = encoder->dev;
struct drm_connector *connector;
struct drm_bridge *bridge;
@@ -98,9 +97,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 *
 * A better solution is to use DRM's bus-flags through the whole driver.
 */
-   for (dssdev = output; dssdev; dssdev = dssdev->next)
-   omap_encoder_update_videomode_flags(, dssdev->bus_flags);
-
for (bridge = output->bridge; bridge;
 bridge = drm_bridge_get_next_bridge(bridge)) {
if (!bridge->timings)
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 30/56] drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE

2020-02-25 Thread Sebastian Reichel
DSI command mode panels are self-refreshing displays, that
can be updated very rarely for static images. For this kind
of scenario some panels support, that the DSI bus switches
into ULPS mode until the panel needs to be refreshed.

This is problematic on some panels, so introduce a flag to
signal the DSI host implementation that the panel allows
going into ULPS mode.

Signed-off-by: Sebastian Reichel 
---
 include/drm/drm_mipi_dsi.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 360e6377e84b..f36f89c14b4a 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -132,6 +132,8 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct 
device_node *node);
 #define MIPI_DSI_CLOCK_NON_CONTINUOUS  BIT(10)
 /* transmit data in low power */
 #define MIPI_DSI_MODE_LPM  BIT(11)
+/* allow going into ULPS mode while command mode panel is not updated */
+#define MIPI_DSI_MODE_ULPS_IDLEBIT(12)
 
 enum mipi_dsi_pixel_format {
MIPI_DSI_FMT_RGB888,
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 40/56] drm/omap: panel-dsi-cm: fix remove()

2020-02-25 Thread Sebastian Reichel
Do not try to reset the panel after DSI has been
detached, since the DSI clocks may have been disabled
at this point. The panel will be disabled and unprepared
before being removed and a reset will be done when being
probed again.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 8562f056585d..fef9ba5319c2 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -627,9 +627,6 @@ static int dsicm_remove(struct mipi_dsi_device *dsi)
if (ddata->extbldev)
put_device(>extbldev->dev);
 
-   /* reset, to be sure that the panel is in a valid state */
-   dsicm_hw_reset(ddata);
-
return 0;
 }
 
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 27/56] drm/omap: dsi: drop custom enable_te() API

2020-02-25 Thread Sebastian Reichel
Instead of using the custon enable_te() API, this automatically
enables/disables TE core support when a matching packet is send
to the panel.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  3 --
 drivers/gpu/drm/omapdrm/dss/dsi.c | 33 ++-
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  2 --
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 30e48d0de961..e4ffe34324f8 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -772,7 +772,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
-   struct omap_dss_device *src = ddata->src;
struct mipi_dsi_device *dsi = ddata->dsi;
int r;
 
@@ -781,8 +780,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, 
bool enable)
else
r = mipi_dsi_dcs_set_tear_off(dsi);
 
-   src->ops->dsi.enable_te(src, enable);
-
/* possible panel bug */
msleep(100);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 7c160512c886..50a567ebfb86 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4117,10 +4117,8 @@ static void dsi_display_disable(struct omap_dss_device 
*dssdev,
mutex_unlock(>lock);
 }
 
-static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
+static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 {
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-
dsi->te_enabled = enable;
 
if (dsi->te_gpio) {
@@ -4730,6 +4728,7 @@ static ssize_t omap_dsi_host_transfer(struct 
mipi_dsi_host *host,
 {
struct dsi_data *dsi = host_to_omap(host);
struct omap_dss_device *dssdev = >output;
+   int r;
 
if (NEQV(msg->flags & MIPI_DSI_MSG_USE_LPM, dsi->in_lp_mode)) {
dsi_vc_enable_hs(dssdev, msg->channel,
@@ -4746,16 +4745,34 @@ static ssize_t omap_dsi_host_transfer(struct 
mipi_dsi_host *host,
case MIPI_DSI_DCS_LONG_WRITE:
case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
case MIPI_DSI_NULL_PACKET:
-   return dsi_vc_write_common(dssdev, msg);
+   r = dsi_vc_write_common(dssdev, msg);
+   break;
case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
-   return dsi_vc_generic_read(dssdev, msg);
+   r = dsi_vc_generic_read(dssdev, msg);
+   break;
case MIPI_DSI_DCS_READ:
-   return dsi_vc_dcs_read(dssdev, msg);
+   r = dsi_vc_dcs_read(dssdev, msg);
+   break;
+   default:
+   r = -EINVAL;
+   break;
}
 
-   return -EINVAL;
+   if (r < 0)
+   return r;
+
+   if (msg->type == MIPI_DSI_DCS_SHORT_WRITE ||
+   msg->type == MIPI_DSI_DCS_SHORT_WRITE_PARAM) {
+   u8 cmd = ((u8*) msg->tx_buf)[0];
+   if (cmd == MIPI_DCS_SET_TEAR_OFF)
+   dsi_enable_te(dsi, false);
+   else if(cmd == MIPI_DCS_SET_TEAR_ON)
+   dsi_enable_te(dsi, true);
+   }
+
+   return 0;
 }
 
 static int dsi_get_clocks(struct dsi_data *dsi)
@@ -4802,8 +4819,6 @@ static const struct omap_dss_device_ops dsi_ops = {
.disable_video_output = dsi_disable_video_output,
 
.update = dsi_update,
-
-   .enable_te = dsi_enable_te,
},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 355aa235c23c..dc41f982a082 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -287,8 +287,6 @@ struct omapdss_dsi_ops {
int (*set_config)(struct omap_dss_device *dssdev,
const struct omap_dss_dsi_config *cfg);
 
-   int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
-
int (*update)(struct omap_dss_device *dssdev, int channel,
void (*callback)(int, void *), void *data);
 
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 12/56] drm/omap: dsi: simplify read functions

2020-02-25 Thread Sebastian Reichel
Simplify the read related message handling by using the functionality
provided by CONFIG_DRM_MIPI_DSI.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 109 +-
 1 file changed, 33 insertions(+), 76 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index e5589e615808..9b5b078beb6d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2741,60 +2741,6 @@ static int dsi_vc_write_common(struct omap_dss_device 
*dssdev,
return 0;
 }
 
-static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
-   u8 dcs_cmd)
-{
-   int r;
-
-   if (dsi->debug_read)
-   DSSDBG("dsi_vc_dcs_send_read_request(ch%d, dcs_cmd %x)\n",
-   channel, dcs_cmd);
-
-   r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
-   if (r) {
-   DSSERR("dsi_vc_dcs_send_read_request(ch %d, cmd 0x%02x)"
-   " failed\n", channel, dcs_cmd);
-   return r;
-   }
-
-   return 0;
-}
-
-static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int channel,
-   const u8 *reqdata, int reqlen)
-{
-   u16 data;
-   u8 data_type;
-   int r;
-
-   if (dsi->debug_read)
-   DSSDBG("dsi_vc_generic_send_read_request(ch %d, reqlen %d)\n",
-   channel, reqlen);
-
-   if (reqlen == 0) {
-   data_type = MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM;
-   data = 0;
-   } else if (reqlen == 1) {
-   data_type = MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM;
-   data = reqdata[0];
-   } else if (reqlen == 2) {
-   data_type = MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM;
-   data = reqdata[0] | (reqdata[1] << 8);
-   } else {
-   BUG();
-   return -EINVAL;
-   }
-
-   r = dsi_vc_send_short(dsi, channel, data_type, data, 0);
-   if (r) {
-   DSSERR("dsi_vc_generic_send_read_request(ch %d, reqlen %d)"
-   " failed\n", channel, reqlen);
-   return r;
-   }
-
-   return 0;
-}
-
 static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,
   int buflen, enum dss_dsi_content_type type)
 {
@@ -2903,61 +2849,75 @@ static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, 
int channel, u8 *buf,
return r;
 }
 
-static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 
dcs_cmd,
-   u8 *buf, int buflen)
+static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
+  const struct mipi_dsi_msg *msg)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
int r;
+   u8 dcs_cmd = ((u8*) msg->tx_buf)[0];
 
-   r = dsi_vc_dcs_send_read_request(dsi, channel, dcs_cmd);
+   r = dsi_vc_send_short(dsi, msg->channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
if (r)
goto err;
 
-   r = dsi_vc_send_bta_sync(dssdev, channel);
+   r = dsi_vc_send_bta_sync(dssdev, msg->channel);
if (r)
goto err;
 
-   r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,
+   r = dsi_vc_read_rx_fifo(dsi, msg->channel, msg->rx_buf, msg->rx_len,
DSS_DSI_CONTENT_DCS);
if (r < 0)
goto err;
 
-   if (r != buflen) {
+   if (r != msg->rx_len) {
r = -EIO;
goto err;
}
 
return 0;
 err:
-   DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", channel, dcs_cmd);
+   DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n",
+   msg->channel, dcs_cmd);
return r;
 }
 
-static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
-   const u8 *reqdata, int reqlen, u8 *buf, int buflen)
+static int dsi_vc_generic_read(struct omap_dss_device *dssdev,
+  const struct mipi_dsi_msg *msg)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
+   struct mipi_dsi_packet packet;
+   u16 data;
int r;
 
-   r = dsi_vc_generic_send_read_request(dsi, channel, reqdata, reqlen);
+   r = mipi_dsi_create_packet(, msg);
+   if (r < 0)
+   goto err;
+
+   data = packet.header[1] | (packet.header[2] << 8);
+
+   r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
if (r)
-   return r;
+   goto err;
 
-   r = dsi_vc_send_bta_sync(dssdev, channel);
+   r = dsi_vc_send_bta_sync(dssdev, msg->channel);
if (r)
-   return r;
+   goto err;
 
-   r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,

[PATCHv2 54/56] ARM: omap2plus_defconfig: Update for moved DSI command mode panel

2020-02-25 Thread Sebastian Reichel
The DSI command mode panel is no longer specific
to OMAP and thus the config option has been renamed
slightly.

Signed-off-by: Sebastian Reichel 
---
 arch/arm/configs/omap2plus_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/configs/omap2plus_defconfig 
b/arch/arm/configs/omap2plus_defconfig
index b9698e217aa7..31ac2315f47c 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -350,7 +350,7 @@ CONFIG_DRM_OMAP=m
 CONFIG_OMAP5_DSS_HDMI=y
 CONFIG_OMAP2_DSS_SDI=y
 CONFIG_OMAP2_DSS_DSI=y
-CONFIG_DRM_OMAP_PANEL_DSI_CM=m
+CONFIG_DRM_PANEL_DSI_CM=m
 CONFIG_DRM_TILCDC=m
 CONFIG_DRM_PANEL_SIMPLE=m
 CONFIG_DRM_DISPLAY_CONNECTOR=m
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 44/56] drm/panel: Move OMAP's DSI command mode panel driver

2020-02-25 Thread Sebastian Reichel
The panel driver is no longer using any OMAP specific APIs, so
let's move it into the generic panel directory.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/Kconfig|  1 -
 drivers/gpu/drm/omapdrm/Makefile   |  1 -
 drivers/gpu/drm/omapdrm/displays/Kconfig   | 10 --
 drivers/gpu/drm/omapdrm/displays/Makefile  |  2 --
 drivers/gpu/drm/panel/Kconfig  |  9 +
 drivers/gpu/drm/panel/Makefile |  1 +
 .../gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c |  0
 7 files changed, 10 insertions(+), 14 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
 rename drivers/gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c (100%)

diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index 5417e7a47072..cea3f44ea6d4 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -12,6 +12,5 @@ config DRM_OMAP
 if DRM_OMAP
 
 source "drivers/gpu/drm/omapdrm/dss/Kconfig"
-source "drivers/gpu/drm/omapdrm/displays/Kconfig"
 
 endif
diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index f115253115c5..66a73eae6f7c 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -5,7 +5,6 @@
 #
 
 obj-y += dss/
-obj-y += displays/
 
 omapdrm-y := omap_drv.o \
omap_irq.o \
diff --git a/drivers/gpu/drm/omapdrm/displays/Kconfig 
b/drivers/gpu/drm/omapdrm/displays/Kconfig
deleted file mode 100644
index f2be594c7eff..
--- a/drivers/gpu/drm/omapdrm/displays/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-menu "OMAPDRM External Display Device Drivers"
-
-config DRM_OMAP_PANEL_DSI_CM
-   tristate "Generic DSI Command Mode Panel"
-   depends on BACKLIGHT_CLASS_DEVICE
-   help
- Driver for generic DSI command mode panels.
-
-endmenu
diff --git a/drivers/gpu/drm/omapdrm/displays/Makefile 
b/drivers/gpu/drm/omapdrm/displays/Makefile
deleted file mode 100644
index 488ddf153613..
--- a/drivers/gpu/drm/omapdrm/displays/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_DRM_OMAP_PANEL_DSI_CM) += panel-dsi-cm.o
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index da3b84602cdd..07ab75a66607 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -38,6 +38,15 @@ config DRM_PANEL_BOE_TV101WUM_NL6
  Say Y here if you want to support for BOE TV101WUM and AUO KD101N80
  45NA WUXGA PANEL DSI Video Mode panel
 
+config DRM_PANEL_DSI_CM
+   tristate "Generic DSI command mode panels"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ DRM panel driver for DSI command mode panels with support for
+ embedded and external backlights.
+
 config DRM_PANEL_LVDS
tristate "Generic LVDS panel driver"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index af1e2a3cc5fc..bb19cda8a619 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o
 obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
 obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
+obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
 obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
 obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/panel/panel-dsi-cm.c
similarity index 100%
rename from drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
rename to drivers/gpu/drm/panel/panel-dsi-cm.c
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 16/56] drm/omap: dsi: request VC via mipi_dsi_attach

2020-02-25 Thread Sebastian Reichel
Drop custom request_vc/release_vc callbacks by using the
generic mipi_dsi_attach/mipi_dsi_detach functions.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 24 +---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 61 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 -
 3 files changed, 41 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 4a4a55135494..b3688a8ca3cf 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src,
 struct omap_dss_device *dst)
 {
struct panel_drv_data *ddata = to_panel_data(dst);
-   struct device *dev = >dsi->dev;
-   int r;
-
-   r = src->ops->dsi.request_vc(src, ddata->channel);
-   if (r) {
-   dev_err(dev, "failed to get virtual channel\n");
-   return r;
-   }
 
ddata->src = src;
return 0;
@@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src,
 {
struct panel_drv_data *ddata = to_panel_data(dst);
 
-   src->ops->dsi.release_vc(src, ddata->channel);
ddata->src = NULL;
 }
 
@@ -1278,8 +1269,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
goto err_bl;
}
 
+   dsi->lanes = 3;
+   dsi->format = MIPI_DSI_FMT_RGB888;
+   dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
+ MIPI_DSI_MODE_EOT_PACKET;
+   dsi->hs_rate = 3;
+   dsi->lp_rate = 1000;
+
+   r = mipi_dsi_attach(dsi);
+   if (r < 0)
+   goto err_dsi_attach;
+
return 0;
 
+err_dsi_attach:
+   sysfs_remove_group(>dev.kobj, _attr_group);
 err_bl:
destroy_workqueue(ddata->workqueue);
 err_reg:
@@ -1296,6 +1300,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device 
*dsi)
 
dev_dbg(>dev, "remove\n");
 
+   mipi_dsi_detach(dsi);
+
omapdss_device_unregister(dssdev);
 
if (omapdss_device_is_enabled(dssdev))
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 3e6a57e00456..64407f4651af 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -349,7 +349,7 @@ struct dsi_data {
 
struct {
enum dsi_vc_source source;
-   struct omap_dss_device *dssdev;
+   struct mipi_dsi_device *dest;
enum fifo_size tx_fifo_size;
enum fifo_size rx_fifo_size;
} vc[4];
@@ -4690,32 +4690,6 @@ static enum omap_channel dsi_get_channel(struct dsi_data 
*dsi)
}
 }
 
-static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
-{
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-
-   if (channel < 0 || channel > 3)
-   return -EINVAL;
-
-   if (dsi->vc[channel].dssdev) {
-   DSSERR("cannot get VC for display %s", dssdev->name);
-   return -EBUSY;
-   }
-
-   dsi->vc[channel].dssdev = dssdev;
-   return 0;
-}
-
-static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
-{
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-
-   if ((channel >= 0 && channel <= 3) &&
-   dsi->vc[channel].dssdev == dssdev) {
-   dsi->vc[channel].dssdev = NULL;
-   }
-}
-
 static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
  const struct mipi_dsi_msg *msg)
 {
@@ -4792,23 +4766,40 @@ static const struct omap_dss_device_ops dsi_ops = {
.update = dsi_update,
 
.enable_te = dsi_enable_te,
-
-   .request_vc = dsi_request_vc,
-   .release_vc = dsi_release_vc,
},
 };
 
 int omap_dsi_host_attach(struct mipi_dsi_host *host,
-struct mipi_dsi_device *dsi)
+struct mipi_dsi_device *client)
 {
-   /* TODO: convert driver from custom binding method to this one */
+   struct dsi_data *dsi = host_to_omap(host);
+   unsigned int channel = client->channel;
+
+   if (channel > 3)
+   return -EINVAL;
+
+   if (dsi->vc[channel].dest) {
+   DSSERR("cannot get VC for display %s", dev_name(>dev));
+   return -EBUSY;
+   }
+
+   dsi->vc[channel].dest = client;
return 0;
 }
 
 int omap_dsi_host_detach(struct mipi_dsi_host *host,
-struct mipi_dsi_device *dsi)
+struct mipi_dsi_device *client)
 {
-   /* TODO: convert driver from custom binding method to this one */
+   struct dsi_data *dsi = host_to_omap(host

[PATCHv2 33/56] drm/omap: dsi: Reverse direction of the DSS device enable/disable operations

2020-02-25 Thread Sebastian Reichel
Complete the direction reversal of the DSS device enable/disable
operations started by 19b4200d8f4b ("drm/omap: Reverse direction
of the DSS device enable/disable operations").

This effectively drops the requirement of calling DSS specific
code from the DSI panel driver moving it a bit further to a
standard drm_panel driver.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 75 ++-
 drivers/gpu/drm/omapdrm/omap_encoder.c| 24 ++
 2 files changed, 46 insertions(+), 53 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 5a2a8cee9186..6f559c1b0bf6 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -288,27 +288,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
struct omap_dss_device *src = ddata->src;
u8 id1, id2, id3;
int r;
-   struct omap_dss_dsi_config dsi_config = {
-   .vm = >vm,
-   .hs_clk_min = 15000,
-   .hs_clk_max = 3,
-   .lp_clk_min = 700,
-   .lp_clk_max = 1000,
-   };
-
-   r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-   if (r) {
-   dev_err(>dsi->dev, "failed to enable supplies: %d\n", r);
-   return r;
-   }
-
-   r = src->ops->dsi.set_config(src, _config);
-   if (r) {
-   dev_err(>dsi->dev, "failed to configure DSI\n");
-   goto err_regulators;
-   }
-
-   src->ops->enable(src);
 
dsicm_hw_reset(ddata);
 
@@ -363,12 +342,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
dsicm_hw_reset(ddata);
 
-   src->ops->disable(src);
-err_regulators:
-   r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-   if (r)
-   dev_err(>dsi->dev, "failed to disable supplies: %d\n", 
r);
-
return r;
 }
 
@@ -377,6 +350,8 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
struct omap_dss_device *src = ddata->src;
int r;
 
+   ddata->enabled = false;
+
src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
 
r = mipi_dsi_dcs_set_display_off(ddata->dsi);
@@ -388,14 +363,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
"error disabling panel, issuing HW reset\n");
dsicm_hw_reset(ddata);
}
-
-   src->ops->disable(src);
-
-   r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-   if (r)
-   dev_err(>dsi->dev, "failed to disable supplies: %d\n", 
r);
-
-   ddata->enabled = false;
 }
 
 static int dsicm_connect(struct omap_dss_device *src,
@@ -415,6 +382,30 @@ static void dsicm_disconnect(struct omap_dss_device *src,
ddata->src = NULL;
 }
 
+static void dsicm_pre_enable(struct omap_dss_device *dssdev)
+{
+   struct panel_drv_data *ddata = to_panel_data(dssdev);
+   struct omap_dss_device *src = ddata->src;
+   int r;
+   struct omap_dss_dsi_config dsi_config = {
+   .vm = >vm,
+   .hs_clk_min = 15000,
+   .hs_clk_max = 3,
+   .lp_clk_min = 700,
+   .lp_clk_max = 1000,
+   };
+
+   r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+   if (r) {
+   dev_err(>dsi->dev, "failed to enable supplies: %d\n", r);
+   }
+
+   r = src->ops->dsi.set_config(src, _config);
+   if (r) {
+   dev_err(>dsi->dev, "failed to configure DSI\n");
+   }
+}
+
 static void dsicm_enable(struct omap_dss_device *dssdev)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
@@ -449,6 +440,16 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
mutex_unlock(>lock);
 }
 
+static void dsicm_post_disable(struct omap_dss_device *dssdev)
+{
+   struct panel_drv_data *ddata = to_panel_data(dssdev);
+   int r;
+
+   r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+   if (r)
+   dev_err(>dsi->dev, "failed to disable supplies: %d\n", 
r);
+}
+
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
struct mipi_dsi_device *dsi = ddata->dsi;
@@ -502,8 +503,10 @@ static const struct omap_dss_device_ops dsicm_ops = {
.connect= dsicm_connect,
.disconnect = dsicm_disconnect,
 
+   .pre_enable = dsicm_pre_enable,
.enable = dsicm_enable,
.disable= dsicm_disable,
+   .post_disable   = dsicm_post_d

[PATCHv2 43/56] drm/omap: bind components with drm_device argument

2020-02-25 Thread Sebastian Reichel
This fixes the omapdrm driver to call component_bind_all()
with drm_device as data argument as recommended in the
DRM component helper usage text.

After this patch DRM functionality can be implemented directly
in the components resulting in a simpler driver stack by removing
one layer of abstraction.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dss.c | 27 +--
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 +++
 drivers/gpu/drm/omapdrm/omap_drv.c| 15 +++
 3 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
b/drivers/gpu/drm/omapdrm/dss/dss.c
index 4438947326ea..a0b37d9b62ea 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1301,26 +1301,35 @@ static const struct soc_device_attribute 
dss_soc_devices[] = {
{ /* sentinel */ }
 };
 
+int dss_bind_components(struct dss_device *dss, struct drm_device *drm_dev)
+{
+   struct platform_device *pdev = dss->pdev;
+
+   return component_bind_all(>dev, drm_dev);
+}
+EXPORT_SYMBOL(dss_bind_components);
+
+void dss_unbind_components(struct dss_device *dss, struct drm_device *drm_dev)
+{
+   struct platform_device *pdev = dss->pdev;
+
+   component_unbind_all(>dev, drm_dev);
+}
+EXPORT_SYMBOL(dss_unbind_components);
+
 static int dss_bind(struct device *dev)
 {
struct dss_device *dss = dev_get_drvdata(dev);
struct platform_device *drm_pdev;
struct dss_pdata pdata;
-   int r;
-
-   r = component_bind_all(dev, NULL);
-   if (r)
-   return r;
 
pm_set_vt_switch(0);
 
pdata.dss = dss;
drm_pdev = platform_device_register_data(NULL, "omapdrm", 0,
 , sizeof(pdata));
-   if (IS_ERR(drm_pdev)) {
-   component_unbind_all(dev, NULL);
+   if (IS_ERR(drm_pdev))
return PTR_ERR(drm_pdev);
-   }
 
dss->drm_pdev = drm_pdev;
 
@@ -1332,8 +1341,6 @@ static void dss_unbind(struct device *dev)
struct dss_device *dss = dev_get_drvdata(dev);
 
platform_device_unregister(dss->drm_pdev);
-
-   component_unbind_all(dev, NULL);
 }
 
 static const struct component_master_ops dss_component_ops = {
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 9f8aefaadefe..45f5c46712eb 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -526,4 +526,7 @@ const struct dispc_ops *dispc_get_ops(struct dss_device 
*dss);
 bool omapdss_stack_is_ready(void);
 void omapdss_gather_components(struct device *dev);
 
+int dss_bind_components(struct dss_device *dss, struct drm_device *drm_dev);
+void dss_unbind_components(struct dss_device *dss, struct drm_device *drm_dev);
+
 #endif /* __OMAP_DRM_DSS_H */
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index 579f9d80fec9..c47e63e94a2e 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -237,8 +237,6 @@ static int omap_modeset_init(struct drm_device *dev)
if (!omapdss_stack_is_ready())
return -EPROBE_DEFER;
 
-   drm_mode_config_init(dev);
-
ret = omap_modeset_init_properties(dev);
if (ret < 0)
return ret;
@@ -605,10 +603,15 @@ static int omapdrm_init(struct omap_drm_private *priv, 
struct device *dev)
ddev = drm_dev_alloc(_drm_driver, dev);
if (IS_ERR(ddev))
return PTR_ERR(ddev);
-
-   priv->ddev = ddev;
ddev->dev_private = priv;
 
+   drm_mode_config_init(ddev);
+
+   ret = dss_bind_components(pdata->dss, ddev);
+   if (ret)
+   goto err_ddev_deinit;
+
+   priv->ddev = ddev;
priv->dev = dev;
priv->dss = pdata->dss;
priv->dispc = dispc_get_dispc(priv->dss);
@@ -673,6 +676,8 @@ static int omapdrm_init(struct omap_drm_private *priv, 
struct device *dev)
destroy_workqueue(priv->wq);
omap_disconnect_pipelines(ddev);
omap_crtc_pre_uninit(priv);
+   dss_unbind_components(priv->dss, ddev);
+err_ddev_deinit:
drm_dev_put(ddev);
return ret;
 }
@@ -700,6 +705,8 @@ static void omapdrm_cleanup(struct omap_drm_private *priv)
omap_disconnect_pipelines(ddev);
omap_crtc_pre_uninit(priv);
 
+   dss_unbind_components(priv->dss, ddev);
+
drm_dev_put(ddev);
 }
 
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 51/56] drm/omap: drop DSS ops_flags

2020-02-25 Thread Sebastian Reichel
The omapdss device's ops_flags field is no longer
used and can be dropped.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 9 -
 drivers/gpu/drm/omapdrm/dss/venc.c| 1 -
 2 files changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 03498f0ed6c2..0ee042228c96 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -278,14 +278,6 @@ struct omap_dss_device_ops {
const struct omapdss_dsi_ops dsi;
 };
 
-/**
- * enum omap_dss_device_ops_flag - Indicates which device ops are supported
- * @OMAP_DSS_DEVICE_OP_MODES: The device supports reading modes
- */
-enum omap_dss_device_ops_flag {
-   OMAP_DSS_DEVICE_OP_MODES = BIT(3),
-};
-
 struct omap_dss_device {
struct device *dev;
 
@@ -314,7 +306,6 @@ struct omap_dss_device {
const char *name;
 
const struct omap_dss_device_ops *ops;
-   unsigned long ops_flags;
u32 bus_flags;
 
/* OMAP DSS output specific fields */
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
b/drivers/gpu/drm/omapdrm/dss/venc.c
index 766553bb2f87..96e5d2944452 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -774,7 +774,6 @@ static int venc_init_output(struct venc_device *venc)
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
out->owner = THIS_MODULE;
out->of_port = 0;
-   out->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
r = omapdss_device_init_output(out, >bridge);
if (r < 0) {
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 06/56] drm/omap: constify write buffers

2020-02-25 Thread Sebastian Reichel
The write buffers are not modified, so they can be constant.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 24 
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +-
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index bb2548d091ef..f01e0476296d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2601,11 +2601,11 @@ static inline void dsi_vc_write_long_payload(struct 
dsi_data *dsi, int channel,
 }
 
 static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
-   u8 *data, u16 len, u8 ecc)
+   const u8 *data, u16 len, u8 ecc)
 {
/*u32 val; */
int i;
-   u8 *p;
+   const u8 *p;
int r = 0;
u8 b1, b2, b3, b4;
 
@@ -2698,7 +2698,7 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int 
channel)
 }
 
 static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
- u8 *data, int len,
+ const u8 *data, int len,
  enum dss_dsi_content_type type)
 {
int r;
@@ -2729,7 +2729,7 @@ static int dsi_vc_write_nosync_common(struct dsi_data 
*dsi, int channel,
 }
 
 static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
-   u8 *data, int len)
+   const u8 *data, int len)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
 
@@ -2738,7 +2738,7 @@ static int dsi_vc_dcs_write_nosync(struct omap_dss_device 
*dssdev, int channel,
 }
 
 static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int 
channel,
-   u8 *data, int len)
+   const u8 *data, int len)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
 
@@ -2747,7 +2747,7 @@ static int dsi_vc_generic_write_nosync(struct 
omap_dss_device *dssdev, int chann
 }
 
 static int dsi_vc_write_common(struct omap_dss_device *dssdev,
-  int channel, u8 *data, int len,
+  int channel, const u8 *data, int len,
   enum dss_dsi_content_type type)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
@@ -2776,15 +2776,15 @@ static int dsi_vc_write_common(struct omap_dss_device 
*dssdev,
return r;
 }
 
-static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 
*data,
-   int len)
+static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel,
+   const u8 *data, int len)
 {
return dsi_vc_write_common(dssdev, channel, data, len,
DSS_DSI_CONTENT_DCS);
 }
 
-static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, 
u8 *data,
-   int len)
+static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel,
+   const u8 *data, int len)
 {
return dsi_vc_write_common(dssdev, channel, data, len,
DSS_DSI_CONTENT_GENERIC);
@@ -2810,7 +2810,7 @@ static int dsi_vc_dcs_send_read_request(struct dsi_data 
*dsi, int channel,
 }
 
 static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int channel,
-   u8 *reqdata, int reqlen)
+   const u8 *reqdata, int reqlen)
 {
u16 data;
u8 data_type;
@@ -2983,7 +2983,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device 
*dssdev, int channel, u8 dcs_c
 }
 
 static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
-   u8 *reqdata, int reqlen, u8 *buf, int buflen)
+   const u8 *reqdata, int reqlen, u8 *buf, int buflen)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
int r;
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 53fea1cbbc2d..b909b3a8c835 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -308,18 +308,18 @@ struct omapdss_dsi_ops {
 
/* data transfer */
int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
-   u8 *data, int len);
+   const u8 *data, int len);
int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
-   u8 *data, int len);
+   const u8 *data, int len);
int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
u8 *data, int len);
 
int (*gen_write)(struct omap_dss_device *dssdev, int channel,
-   u8 *data, int len);
+   const u8 *data, int len);
int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
-   u8 *data, int len);
+   const u8 *data, int len

[PATCHv2 07/56] drm/omap: dsi: add generic transfer function

2020-02-25 Thread Sebastian Reichel
This prepares the driver for becoming a mipi_dsi_host implementation,
which provides a generic transfer function instead of all kind of
different read/write functions. The implementation will become more
elegant after unexporting the specific functions in the following
patches.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 52 +++
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 ++
 2 files changed, 55 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index f01e0476296d..84e2eb0b51d7 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4836,6 +4836,56 @@ static void dsi_release_vc(struct omap_dss_device 
*dssdev, int channel)
}
 }
 
+static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
+const struct mipi_dsi_msg *msg)
+{
+   /*
+* no_sync can be used to optimize performance by sending
+* e.g. column and page information without syncing in
+* between. It's not absolutley required, so postpone this
+* feature for now.
+*/
+   bool no_sync = false;
+   u16 val;
+
+   switch (msg->type) {
+   case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
+   case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
+   case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
+   case MIPI_DSI_GENERIC_LONG_WRITE:
+   if (no_sync)
+   return dsi_vc_generic_write_nosync(dssdev, msg->channel,
+ msg->tx_buf, msg->tx_len);
+   else
+   return dsi_vc_generic_write(dssdev, msg->channel,
+   msg->tx_buf, msg->tx_len);
+   case MIPI_DSI_DCS_SHORT_WRITE:
+   case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
+   case MIPI_DSI_DCS_LONG_WRITE:
+   if (no_sync)
+   return dsi_vc_dcs_write_nosync(dssdev, msg->channel,
+ msg->tx_buf, msg->tx_len);
+   else
+   return dsi_vc_dcs_write(dssdev, msg->channel,
+   msg->tx_buf, msg->tx_len);
+   case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
+   case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
+   case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
+   return dsi_vc_generic_read(dssdev, msg->channel, msg->tx_buf,
+   msg->tx_len, msg->rx_buf, msg->rx_len);
+   case MIPI_DSI_DCS_READ:
+   return dsi_vc_dcs_read(dssdev, msg->channel,
+   ((u8*) msg->tx_buf)[0],
+   msg->rx_buf, msg->rx_len);
+   case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
+   val = le16_to_cpu(*((__le16*) msg->tx_buf));
+   return dsi_vc_set_max_rx_packet_size(dssdev, msg->channel, val);
+   case MIPI_DSI_NULL_PACKET:
+   return dsi_vc_send_null(to_dsi_data(dssdev), msg->channel);
+   }
+
+   return -EINVAL;
+}
 
 static int dsi_get_clocks(struct dsi_data *dsi)
 {
@@ -4890,6 +4940,8 @@ static const struct omap_dss_device_ops dsi_ops = {
.set_vc_id = dsi_set_vc_id,
.release_vc = dsi_release_vc,
 
+   .transfer = omap_dsi_transfer,
+
.dcs_write = dsi_vc_dcs_write,
.dcs_write_nosync = dsi_vc_dcs_write_nosync,
.dcs_read = dsi_vc_dcs_read,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index b909b3a8c835..ea7bf0970677 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -307,6 +307,9 @@ struct omapdss_dsi_ops {
void (*release_vc)(struct omap_dss_device *dssdev, int channel);
 
/* data transfer */
+   ssize_t (*transfer)(struct omap_dss_device *dssdev,
+   const struct mipi_dsi_msg *msg);
+
int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
const u8 *data, int len);
int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 04/56] omap/drm: drop unused dsi.configure_pins

2020-02-25 Thread Sebastian Reichel
The panel-dsi-cm's ddata->pin_config is always NULL, so this
callback is never called. Instead the DSI encoder gets the pin
configuration directly from DT.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 11 ---
 drivers/gpu/drm/omapdrm/dss/dsi.c   |  1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h   |  2 --
 3 files changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 3484b5d4a91c..e7fe5d702337 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -68,8 +68,6 @@ struct panel_drv_data {
int width_mm;
int height_mm;
 
-   struct omap_dsi_pin_config pin_config;
-
/* runtime variables */
bool enabled;
 
@@ -623,15 +621,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
}
}
 
-   if (ddata->pin_config.num_pins > 0) {
-   r = src->ops->dsi.configure_pins(src, >pin_config);
-   if (r) {
-   dev_err(>pdev->dev,
-   "failed to configure DSI pins\n");
-   goto err_vddi;
-   }
-   }
-
r = src->ops->dsi.set_config(src, _config);
if (r) {
dev_err(>pdev->dev, "failed to configure DSI\n");
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 79ddfbfd1b58..8c39823a8295 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4892,7 +4892,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 
.enable_hs = dsi_vc_enable_hs,
 
-   .configure_pins = dsi_configure_pins,
.set_config = dsi_set_config,
 
.enable_video_output = dsi_enable_video_output,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index cbbe10b2b60d..b0424daaceed 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -292,8 +292,6 @@ struct omapdss_dsi_ops {
/* bus configuration */
int (*set_config)(struct omap_dss_device *dssdev,
const struct omap_dss_dsi_config *cfg);
-   int (*configure_pins)(struct omap_dss_device *dssdev,
-   const struct omap_dsi_pin_config *pin_cfg);
 
void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
bool enable);
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 32/56] drm/omap: dsi: move panel refresh function to host

2020-02-25 Thread Sebastian Reichel
This moves the panel refresh/update function from the panel
driver into the DSI host driver to prepare for common drm_panel
support.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 
 drivers/gpu/drm/omapdrm/dss/dsi.c | 101 --
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  13 +--
 drivers/gpu/drm/omapdrm/omap_crtc.c   |  11 +-
 4 files changed, 97 insertions(+), 96 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 1e33cf7c1448..5a2a8cee9186 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 
*id1, u8 *id2, u8 *id3)
return 0;
 }
 
-static int dsicm_set_update_window(struct panel_drv_data *ddata,
-   u16 x, u16 y, u16 w, u16 h)
-{
-   struct mipi_dsi_device *dsi = ddata->dsi;
-   int r;
-   u16 x1 = x;
-   u16 x2 = x + w - 1;
-   u16 y1 = y;
-   u16 y2 = y + h - 1;
-
-   r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
-   if (r < 0)
-   return r;
-
-   r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
-   if (r < 0)
-   return r;
-
-   return 0;
-}
-
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
struct panel_drv_data *ddata = dev_get_drvdata(>dev);
@@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
mutex_unlock(>lock);
 }
 
-static void dsicm_framedone_cb(int err, void *data)
-{
-   struct panel_drv_data *ddata = data;
-
-   dev_dbg(>dsi->dev, "framedone, err %d\n", err);
-   mutex_unlock(>lock);
-}
-
-static int dsicm_update(struct omap_dss_device *dssdev,
-   u16 x, u16 y, u16 w, u16 h)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *src = ddata->src;
-   int r;
-
-   dev_dbg(>dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
-
-   mutex_lock(>lock);
-
-   if (!ddata->enabled) {
-   r = 0;
-   goto err;
-   }
-
-   /* XXX no need to send this every frame, but dsi break if not done */
-   r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
-   ddata->vm.vactive);
-   if (r)
-   goto err;
-
-   r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
-   ddata);
-   if (r)
-   goto err;
-
-   /* note: no unlock here. unlock is src framedone_cb */
-   return 0;
-err:
-   mutex_unlock(>lock);
-   return r;
-}
-
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
struct mipi_dsi_device *dsi = ddata->dsi;
@@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
.check_timings  = dsicm_check_timings,
 };
 
-static const struct omap_dss_driver dsicm_dss_driver = {
-   .update = dsicm_update,
-};
-
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 {
struct device_node *node = dsi->dev.of_node;
@@ -660,7 +593,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
dssdev = >dssdev;
dssdev->dev = dev;
dssdev->ops = _ops;
-   dssdev->driver = _dss_driver;
dssdev->type = OMAP_DISPLAY_TYPE_DSI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 12d661ad37ad..b0e796f90fca 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -217,6 +217,9 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi);
 
 static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
 
+static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
+  const struct mipi_dsi_msg *msg);
+
 /* DSI PLL HSDIV indices */
 #define HSDIV_DISPC0
 #define HSDIV_DSI  1
@@ -386,9 +389,6 @@ struct dsi_data {
 
struct delayed_work ulps_work;
 
-   void (*framedone_callback)(int, void *);
-   void *framedone_data;
-
struct delayed_work framedone_timeout_work;
 
 #ifdef DSI_CATCH_MISSING_TE
@@ -3809,8 +3809,6 @@ static void dsi_handle_framedone(struct dsi_data *dsi, 
int error)
dsi_set_ulps_auto(dsi, true);
dsi_bus_unlock(dsi);
 
-   dsi->framedone_callback(error, dsi->framedone_data);
-
if (!error)
dsi_perf_show(dsi, "DISPC");
 }
@@ -3842,6 +3840,8 @@ static void dsi_framedone_irq_callback(void *data)
 
cancel_delayed_work(>framedone_timeout_work);
 
+   DSSDBG("Framedone received!\n");
+
dsi_handle_fr

[PATCHv2 55/56] drm/panel/panel-dsi-cm: support rotation property

2020-02-25 Thread Sebastian Reichel
Add support for the rotation property described by the
common panel bindings. The information is forwarded to
userspace using the orientation property.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/panel/panel-dsi-cm.c | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c 
b/drivers/gpu/drm/panel/panel-dsi-cm.c
index fef9ba5319c2..b043ebb9c247 100644
--- a/drivers/gpu/drm/panel/panel-dsi-cm.c
+++ b/drivers/gpu/drm/panel/panel-dsi-cm.c
@@ -58,6 +58,7 @@ struct panel_drv_data {
 
int width_mm;
int height_mm;
+   enum drm_panel_orientation panel_orientation;
 
/* runtime variables */
bool enabled;
@@ -458,6 +459,7 @@ static int dsicm_get_modes(struct drm_panel *panel,
 
connector->display_info.width_mm = ddata->width_mm;
connector->display_info.height_mm = ddata->height_mm;
+   connector->display_info.panel_orientation = ddata->panel_orientation;
 
drm_mode_probed_add(connector, mode);
 
@@ -479,7 +481,7 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
struct display_timing timing;
struct videomode vm;
-   int err;
+   int err, rotation;
 
vm.hactive = 864;
vm.vactive = 480;
@@ -509,6 +511,26 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
ddata->height_mm = 0;
of_property_read_u32(node, "height-mm", >height_mm);
 
+   rotation = -1;
+   of_property_read_u32(node, "rotation", );
+   switch (rotation) {
+   case 0:
+   ddata->panel_orientation = 
DRM_MODE_PANEL_ORIENTATION_NORMAL;
+   break;
+   case 90:
+   ddata->panel_orientation = 
DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
+   break;
+   case 180:
+   ddata->panel_orientation = 
DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
+   break;
+   case 270:
+   ddata->panel_orientation = 
DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
+   break;
+   default:
+   ddata->panel_orientation = 
DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+   break;
+   }
+
ddata->supplies[0].supply = "vpnl";
ddata->supplies[1].supply = "vddi";
err = devm_regulator_bulk_get(>dev, DCS_REGULATOR_SUPPLY_NUM,
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 09/56] drm/omap: dsi: unexport specific data transfer functions

2020-02-25 Thread Sebastian Reichel
After converting all DSI drivers, unexport the specific transfer
functions.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 12 
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 20 
 2 files changed, 32 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 84e2eb0b51d7..0990777a42f7 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4941,18 +4941,6 @@ static const struct omap_dss_device_ops dsi_ops = {
.release_vc = dsi_release_vc,
 
.transfer = omap_dsi_transfer,
-
-   .dcs_write = dsi_vc_dcs_write,
-   .dcs_write_nosync = dsi_vc_dcs_write_nosync,
-   .dcs_read = dsi_vc_dcs_read,
-
-   .gen_write = dsi_vc_generic_write,
-   .gen_write_nosync = dsi_vc_generic_write_nosync,
-   .gen_read = dsi_vc_generic_read,
-
-   .bta_sync = dsi_vc_send_bta_sync,
-
-   .set_max_rx_packet_size = dsi_vc_set_max_rx_packet_size,
},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index ea7bf0970677..787e102eb068 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -309,26 +309,6 @@ struct omapdss_dsi_ops {
/* data transfer */
ssize_t (*transfer)(struct omap_dss_device *dssdev,
const struct mipi_dsi_msg *msg);
-
-   int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
-   const u8 *data, int len);
-   int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
-   const u8 *data, int len);
-   int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
-   u8 *data, int len);
-
-   int (*gen_write)(struct omap_dss_device *dssdev, int channel,
-   const u8 *data, int len);
-   int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
-   const u8 *data, int len);
-   int (*gen_read)(struct omap_dss_device *dssdev, int channel,
-   const u8 *reqdata, int reqlen,
-   u8 *data, int len);
-
-   int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
-
-   int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
-   int channel, u16 plen);
 };
 
 struct omap_dss_device_ops {
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 10/56] drm/omap: dsi: drop virtual channel logic

2020-02-25 Thread Sebastian Reichel
This drops the virtual channel logic. Afterwards DSI clients
request their channel number and get the virtual channel with
the same number or -EBUSY if already in use.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 46 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 +-
 3 files changed, 12 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 92f510a771fe..ba046a596044 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -769,19 +769,12 @@ static int dsicm_connect(struct omap_dss_device *src,
struct device *dev = >pdev->dev;
int r;
 
-   r = src->ops->dsi.request_vc(src, >channel);
+   r = src->ops->dsi.request_vc(src, ddata->channel);
if (r) {
dev_err(dev, "failed to get virtual channel\n");
return r;
}
 
-   r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
-   if (r) {
-   dev_err(dev, "failed to set VC_ID\n");
-   src->ops->dsi.release_vc(src, ddata->channel);
-   return r;
-   }
-
ddata->src = src;
return 0;
 }
@@ -1216,6 +1209,8 @@ static int dsicm_probe_of(struct platform_device *pdev)
struct display_timing timing;
int err;
 
+   ddata->channel = TCH;
+
ddata->reset_gpio = devm_gpiod_get(>dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(ddata->reset_gpio)) {
err = PTR_ERR(ddata->reset_gpio);
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 0990777a42f7..8c223b808740 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -350,7 +350,6 @@ struct dsi_data {
struct omap_dss_device *dssdev;
enum fifo_size tx_fifo_size;
enum fifo_size rx_fifo_size;
-   int vc_id;
} vc[4];
 
struct mutex lock;
@@ -2579,7 +2578,7 @@ static inline void dsi_vc_write_long_header(struct 
dsi_data *dsi, int channel,
 
WARN_ON(!dsi_bus_is_locked(dsi));
 
-   data_id = data_type | dsi->vc[channel].vc_id << 6;
+   data_id = data_type | channel << 6;
 
val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) |
FLD_VAL(ecc, 31, 24);
@@ -2683,7 +2682,7 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int 
channel, u8 data_type,
return -EINVAL;
}
 
-   data_id = data_type | dsi->vc[channel].vc_id << 6;
+   data_id = data_type | channel << 6;
 
r = (data_id << 0) | (data << 8) | (ecc << 24);
 
@@ -4783,45 +4782,19 @@ static enum omap_channel dsi_get_channel(struct 
dsi_data *dsi)
}
 }
 
-static int dsi_request_vc(struct omap_dss_device *dssdev, int *channel)
+static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
-   int i;
-
-   for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
-   if (!dsi->vc[i].dssdev) {
-   dsi->vc[i].dssdev = dssdev;
-   *channel = i;
-   return 0;
-   }
-   }
 
-   DSSERR("cannot get VC for display %s", dssdev->name);
-   return -ENOSPC;
-}
-
-static int dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int 
vc_id)
-{
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-
-   if (vc_id < 0 || vc_id > 3) {
-   DSSERR("VC ID out of range\n");
-   return -EINVAL;
-   }
-
-   if (channel < 0 || channel > 3) {
-   DSSERR("Virtual Channel out of range\n");
+   if (channel < 0 || channel > 3)
return -EINVAL;
-   }
 
-   if (dsi->vc[channel].dssdev != dssdev) {
-   DSSERR("Virtual Channel not allocated to display %s\n",
-   dssdev->name);
-   return -EINVAL;
+   if (dsi->vc[channel].dssdev) {
+   DSSERR("cannot get VC for display %s", dssdev->name);
+   return -EBUSY;
}
 
-   dsi->vc[channel].vc_id = vc_id;
-
+   dsi->vc[channel].dssdev = dssdev;
return 0;
 }
 
@@ -4832,7 +4805,6 @@ static void dsi_release_vc(struct omap_dss_device 
*dssdev, int channel)
if ((channel >= 0 && channel <= 3) &&
dsi->vc[channel].dssdev == dssdev) {
dsi->vc[channel].dssdev = NULL;
-   dsi->vc[channel].vc_id = 0;
}
 }
 
@@ -4937,7 +4909,6 @@ static const struct omap_dss_device_ops d

[PATCHv2 14/56] drm/omap: dsi: introduce mipi_dsi_host

2020-02-25 Thread Sebastian Reichel
This moves from custom platform driver infrastructure to mipi_dsi_host
and mipi_dsi_device. Note, that this is a graduate step and the driver
only uses the devices types and transfer function, but not yet the new
device binding style or drm_panel.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 119 +-
 drivers/gpu/drm/omapdrm/dss/dsi.c |  54 ++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h |   4 -
 3 files changed, 102 insertions(+), 75 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index ba046a596044..c34daecb1de5 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -39,13 +38,13 @@
 #define DCS_GET_ID30xdc
 
 struct panel_drv_data {
+   struct mipi_dsi_device *dsi;
+
struct omap_dss_device dssdev;
struct omap_dss_device *src;
 
struct videomode vm;
 
-   struct platform_device *pdev;
-
struct mutex lock;
 
struct backlight_device *bldev;
@@ -139,7 +138,7 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
 
 static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 {
-   struct omap_dss_device *src = ddata->src;
+   struct mipi_dsi_device *dsi = ddata->dsi;
const struct mipi_dsi_msg msg = {
.channel = ddata->channel,
.type = MIPI_DSI_DCS_READ,
@@ -149,12 +148,12 @@ static int dsicm_dcs_read_1(struct panel_drv_data *ddata, 
u8 dcs_cmd, u8 *data)
.rx_buf = data
};
 
-   return src->ops->dsi.transfer(src, );
+   return dsi->host->ops->transfer(dsi->host, );
 }
 
 static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
 {
-   struct omap_dss_device *src = ddata->src;
+   struct mipi_dsi_device *dsi = ddata->dsi;
const struct mipi_dsi_msg msg = {
.channel = ddata->channel,
.type = MIPI_DSI_DCS_SHORT_WRITE,
@@ -162,12 +161,12 @@ static int dsicm_dcs_write_0(struct panel_drv_data 
*ddata, u8 dcs_cmd)
.tx_len = 1,
};
 
-   return src->ops->dsi.transfer(src, );
+   return dsi->host->ops->transfer(dsi->host, );
 }
 
 static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
param)
 {
-   struct omap_dss_device *src = ddata->src;
+   struct mipi_dsi_device *dsi = ddata->dsi;
const u8 buf[] = { dcs_cmd, param };
const struct mipi_dsi_msg msg = {
.channel = ddata->channel,
@@ -176,13 +175,13 @@ static int dsicm_dcs_write_1(struct panel_drv_data 
*ddata, u8 dcs_cmd, u8 param)
.tx_len = 2,
};
 
-   return src->ops->dsi.transfer(src, );
+   return dsi->host->ops->transfer(dsi->host, );
 }
 
 static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 {
-   struct omap_dss_device *src = ddata->src;
+   struct mipi_dsi_device *dsi = ddata->dsi;
int r;
const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
const struct mipi_dsi_msg msg = {
@@ -194,7 +193,7 @@ static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
hw_guard_wait(ddata);
 
-   r = src->ops->dsi.transfer(src, );
+   r = dsi->host->ops->transfer(dsi->host, );
if (r)
return r;
 
@@ -242,7 +241,7 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 
*id1, u8 *id2, u8 *id3)
 static int dsicm_set_update_window(struct panel_drv_data *ddata,
u16 x, u16 y, u16 w, u16 h)
 {
-   struct omap_dss_device *src = ddata->src;
+   struct mipi_dsi_device *dsi = ddata->dsi;
int r;
u16 x1 = x;
u16 x2 = x + w - 1;
@@ -280,11 +279,11 @@ static int dsicm_set_update_window(struct panel_drv_data 
*ddata,
};
 
 
-   r = src->ops->dsi.transfer(src, );
+   r = dsi->host->ops->transfer(dsi->host, );
if (r)
return r;
 
-   r = src->ops->dsi.transfer(src, );
+   r = dsi->host->ops->transfer(dsi->host, );
if (r)
return r;
 
@@ -327,7 +326,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
return 0;
 
 err:
-   dev_err(>pdev->dev, "enter ULPS failed");
+   dev_err(>dsi->dev, "enter ULPS failed");
dsicm_panel_reset(ddata);
 
ddata->ulps_enabled = false;
@@ -350,7 +349,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 
r = _dsicm_enable_te(ddata, true);
if (r) {
-   dev_err(>pdev->dev, "failed to re-enable TE");
+   dev_err(>dsi->dev, "failed t

[PATCHv2 11/56] drm/omap: dsi: simplify write function

2020-02-25 Thread Sebastian Reichel
Simplify the write related messages handling by using the functionality
provided by CONFIG_DRM_MIPI_DSI.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/Kconfig |   1 +
 drivers/gpu/drm/omapdrm/dss/dsi.c   | 144 +++-
 2 files changed, 33 insertions(+), 112 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig 
b/drivers/gpu/drm/omapdrm/dss/Kconfig
index 72ae79c0c9b4..90e2dd522896 100644
--- a/drivers/gpu/drm/omapdrm/dss/Kconfig
+++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
@@ -95,6 +95,7 @@ config OMAP2_DSS_SDI
 config OMAP2_DSS_DSI
bool "DSI support"
default n
+   select DRM_MIPI_DSI
help
  MIPI DSI (Display Serial Interface) support.
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 8c223b808740..e5589e615808 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2696,97 +2696,49 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int 
channel)
return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
 }
 
-static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
- const u8 *data, int len,
- enum dss_dsi_content_type type)
+static int dsi_vc_write_common(struct omap_dss_device *dssdev,
+  const struct mipi_dsi_msg *msg)
 {
+   struct dsi_data *dsi = to_dsi_data(dssdev);
+   struct mipi_dsi_packet packet;
int r;
 
-   if (len == 0) {
-   BUG_ON(type == DSS_DSI_CONTENT_DCS);
-   r = dsi_vc_send_short(dsi, channel,
-   MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM, 0, 0);
-   } else if (len == 1) {
-   r = dsi_vc_send_short(dsi, channel,
-   type == DSS_DSI_CONTENT_GENERIC ?
-   MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM :
-   MIPI_DSI_DCS_SHORT_WRITE, data[0], 0);
-   } else if (len == 2) {
-   r = dsi_vc_send_short(dsi, channel,
-   type == DSS_DSI_CONTENT_GENERIC ?
-   MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM :
-   MIPI_DSI_DCS_SHORT_WRITE_PARAM,
-   data[0] | (data[1] << 8), 0);
+   r = mipi_dsi_create_packet(, msg);
+   if (r < 0)
+   return r;
+
+   if (mipi_dsi_packet_format_is_short(msg->type)) {
+   u16 data = packet.header[1] | (packet.header[2] << 8);
+   r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
} else {
-   r = dsi_vc_send_long(dsi, channel,
-   type == DSS_DSI_CONTENT_GENERIC ?
-   MIPI_DSI_GENERIC_LONG_WRITE :
-   MIPI_DSI_DCS_LONG_WRITE, data, len, 0);
+   r = dsi_vc_send_long(dsi, msg->channel, msg->type,
+  msg->tx_buf, msg->tx_len, 0);
}
 
-   return r;
-}
-
-static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
-   const u8 *data, int len)
-{
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-
-   return dsi_vc_write_nosync_common(dsi, channel, data, len,
-   DSS_DSI_CONTENT_DCS);
-}
-
-static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int 
channel,
-   const u8 *data, int len)
-{
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-
-   return dsi_vc_write_nosync_common(dsi, channel, data, len,
-   DSS_DSI_CONTENT_GENERIC);
-}
-
-static int dsi_vc_write_common(struct omap_dss_device *dssdev,
-  int channel, const u8 *data, int len,
-  enum dss_dsi_content_type type)
-{
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-   int r;
+   if (r < 0)
+   return r;
 
-   r = dsi_vc_write_nosync_common(dsi, channel, data, len, type);
-   if (r)
-   goto err;
+   /*
+* we do not always have to do the BTA sync, for example we can
+* improve performance by setting the update window information
+* without sending BTA sync between the commands. In that case
+* we can return earily.
+*/
 
-   r = dsi_vc_send_bta_sync(dssdev, channel);
-   if (r)
-   goto err;
+   r = dsi_vc_send_bta_sync(dssdev, msg->channel);
+   if (r) {
+   DSSERR("bta sync failed\n");
+   return r;
+   }
 
/* RX_FIFO_NOT_EMPTY */
-   if (REG_GET(dsi, DSI_VC_CTRL(channel), 20, 20)) {
+   if (REG_GET(dsi, DSI_VC_CTRL(msg->channel), 20, 20)) {
DSSERR("rx fifo not empty after write, dumping data:\n");

[PATCHv2 41/56] drm/omap: dsi: return proper error code from dsi_update_all()

2020-02-25 Thread Sebastian Reichel
Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index acbfffe83b3e..f629e6b1025b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -3987,7 +3987,7 @@ static int dsi_update_all(struct omap_dss_device *dssdev)
return r;
}
 
-   return 0;
+   return r;
 }
 
 /* Display funcs */
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 35/56] drm/omap: dsi: convert to drm_panel

2020-02-25 Thread Sebastian Reichel
This converts the DSI module to expect common drm_panel display
drivers instead of dssdev based ones.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 210 +++---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 133 +--
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h |   8 -
 4 files changed, 193 insertions(+), 159 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 30be9e4ab908..803b7dada343 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -6,8 +6,6 @@
  * Author: Tomi Valkeinen 
  */
 
-/* #define DEBUG */
-
 #include 
 #include 
 #include 
@@ -20,11 +18,14 @@
 #include 
 
 #include 
+#include 
+#include 
+#include 
 
+#include 
 #include 
 #include 
-
-#include "../dss/omapdss.h"
+#include 
 
 #define DCS_READ_NUM_ERRORS0x05
 #define DCS_GET_ID10xda
@@ -35,11 +36,8 @@
 
 struct panel_drv_data {
struct mipi_dsi_device *dsi;
-
-   struct omap_dss_device dssdev;
-   struct omap_dss_device *src;
-
-   struct videomode vm;
+   struct drm_panel panel;
+   struct drm_display_mode mode;
 
struct mutex lock;
 
@@ -71,7 +69,11 @@ struct panel_drv_data {
bool ulps_enabled;
 };
 
-#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
+
+static inline struct panel_drv_data *panel_to_ddata(struct drm_panel *panel)
+{
+   return container_of(panel, struct panel_drv_data, panel);
+}
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
 
@@ -285,7 +287,6 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
 
 static int dsicm_power_on(struct panel_drv_data *ddata)
 {
-   struct omap_dss_device *src = ddata->src;
u8 id1, id2, id3;
int r;
 
@@ -322,10 +323,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
if (r)
goto err;
 
-   r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
-   if (r)
-   goto err;
-
ddata->enabled = true;
 
if (!ddata->intro_printed) {
@@ -345,15 +342,12 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
return r;
 }
 
-static void dsicm_power_off(struct panel_drv_data *ddata)
+static int dsicm_power_off(struct panel_drv_data *ddata)
 {
-   struct omap_dss_device *src = ddata->src;
int r;
 
ddata->enabled = false;
 
-   src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
-
r = mipi_dsi_dcs_set_display_off(ddata->dsi);
if (!r)
r = dsicm_sleep_in(ddata);
@@ -363,52 +357,25 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
"error disabling panel, issuing HW reset\n");
dsicm_hw_reset(ddata);
}
-}
-
-static int dsicm_connect(struct omap_dss_device *src,
-struct omap_dss_device *dst)
-{
-   struct panel_drv_data *ddata = to_panel_data(dst);
-
-   ddata->src = src;
-   return 0;
-}
 
-static void dsicm_disconnect(struct omap_dss_device *src,
-struct omap_dss_device *dst)
-{
-   struct panel_drv_data *ddata = to_panel_data(dst);
-
-   ddata->src = NULL;
+   return r;
 }
 
-static void dsicm_pre_enable(struct omap_dss_device *dssdev)
+static int dsicm_prepare(struct drm_panel *panel)
 {
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *src = ddata->src;
+   struct panel_drv_data *ddata = panel_to_ddata(panel);
int r;
-   struct omap_dss_dsi_config dsi_config = {
-   .vm = >vm,
-   .hs_clk_min = 15000,
-   .hs_clk_max = 3,
-   .lp_clk_min = 700,
-   .lp_clk_max = 1000,
-   };
 
r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-   if (r) {
+   if (r)
dev_err(>dsi->dev, "failed to enable supplies: %d\n", r);
-   }
 
-   r = src->ops->dsi.set_config(src, _config);
-   if (r) {
-   dev_err(>dsi->dev, "failed to configure DSI\n");
-   }
+   return r;
 }
 
-static void dsicm_enable(struct omap_dss_device *dssdev)
+static int dsicm_enable(struct drm_panel *panel)
 {
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
+   struct panel_drv_data *ddata = panel_to_ddata(panel);
int r;
 
mutex_lock(>lock);
@@ -421,33 +388,39 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 
dsicm_bl_power(ddata, true);
 
-   return;
+   return 0;
 err:
-   dev_dbg(>dsi->dev, "enable failed (%d)\n", r);
+   dev_err(>dsi-

[PATCHv2 56/56] ARM: dts: omap4-droid4: add panel orientation

2020-02-25 Thread Sebastian Reichel
Add information about panel orientation, so that the
system boots into a properly rotated shell.

Signed-off-by: Sebastian Reichel 
---
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
index 622383ec6a75..ec77b20470d2 100644
--- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
+++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
@@ -208,6 +208,7 @@ lcd0: panel@0 {
 
width-mm = <50>;
height-mm = <89>;
+   rotation = <90>;
 
panel-timing {
clock-frequency = <0>;  /* Calculated by dsi */
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 18/56] drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines

2020-02-25 Thread Sebastian Reichel
Drop local definition of common MIPI DCS 1.3 defines.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 9a2ccec27f7e..92c9dc211aeb 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -28,8 +28,6 @@
 #include "../dss/omapdss.h"
 
 #define DCS_READ_NUM_ERRORS0x05
-#define DCS_BRIGHTNESS 0x51
-#define DCS_CTRL_DISPLAY   0x53
 #define DCS_GET_ID10xda
 #define DCS_GET_ID20xdb
 #define DCS_GET_ID30xdc
@@ -333,8 +331,10 @@ static int dsicm_bl_update_status(struct backlight_device 
*dev)
src->ops->dsi.bus_lock(src);
 
r = dsicm_wake_up(ddata);
-   if (!r)
-   r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);
+   if (!r) {
+   r = dsicm_dcs_write_1(ddata,
+   MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
+   }
 
src->ops->dsi.bus_unlock(src);
}
@@ -597,11 +597,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
if (r)
goto err;
 
-   r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, 0xff);
+   r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0xff);
if (r)
goto err;
 
-   r = dsicm_dcs_write_1(ddata, DCS_CTRL_DISPLAY,
+   r = dsicm_dcs_write_1(ddata, MIPI_DCS_WRITE_CONTROL_DISPLAY,
(1<<2) | (1<<5));   /* BL | BCTRL */
if (r)
goto err;
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 08/56] drm/omap: panel-dsi-cm: convert to transfer API

2020-02-25 Thread Sebastian Reichel
This converts the panel-dsi-cm driver to use the transfer
API instead of specific functions, so that the specific
functions can be unexported and squashed into the generic
transfer function.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 133 +-
 1 file changed, 96 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index e6ebfc35243e..92f510a771fe 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -140,45 +140,61 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
 static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 {
struct omap_dss_device *src = ddata->src;
-   int r;
-   u8 buf[1];
-
-   r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd, buf, 1);
-
-   if (r < 0)
-   return r;
-
-   *data = buf[0];
+   const struct mipi_dsi_msg msg = {
+   .channel = ddata->channel,
+   .type = MIPI_DSI_DCS_READ,
+   .tx_len = 1,
+   .tx_buf = _cmd,
+   .rx_len = 1,
+   .rx_buf = data
+   };
 
-   return 0;
+   return src->ops->dsi.transfer(src, );
 }
 
 static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
 {
struct omap_dss_device *src = ddata->src;
+   const struct mipi_dsi_msg msg = {
+   .channel = ddata->channel,
+   .type = MIPI_DSI_DCS_SHORT_WRITE,
+   .tx_buf = _cmd,
+   .tx_len = 1,
+   };
 
-   return src->ops->dsi.dcs_write(src, ddata->channel, _cmd, 1);
+   return src->ops->dsi.transfer(src, );
 }
 
 static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
param)
 {
struct omap_dss_device *src = ddata->src;
-   u8 buf[2] = { dcs_cmd, param };
+   const u8 buf[] = { dcs_cmd, param };
+   const struct mipi_dsi_msg msg = {
+   .channel = ddata->channel,
+   .type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
+   .tx_buf = ,
+   .tx_len = 2,
+   };
 
-   return src->ops->dsi.dcs_write(src, ddata->channel, buf, 2);
+   return src->ops->dsi.transfer(src, );
 }
 
 static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 {
struct omap_dss_device *src = ddata->src;
-   u8 cmd;
int r;
+   const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
+   const struct mipi_dsi_msg msg = {
+   .channel = ddata->channel,
+   .type = MIPI_DSI_DCS_SHORT_WRITE,
+   .tx_buf = ,
+   .tx_len = 1,
+   };
 
hw_guard_wait(ddata);
 
-   cmd = MIPI_DCS_ENTER_SLEEP_MODE;
-   r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, , 1);
+   r = src->ops->dsi.transfer(src, );
if (r)
return r;
 
@@ -233,28 +249,44 @@ static int dsicm_set_update_window(struct panel_drv_data 
*ddata,
u16 y1 = y;
u16 y2 = y + h - 1;
 
-   u8 buf[5];
-   buf[0] = MIPI_DCS_SET_COLUMN_ADDRESS;
-   buf[1] = (x1 >> 8) & 0xff;
-   buf[2] = (x1 >> 0) & 0xff;
-   buf[3] = (x2 >> 8) & 0xff;
-   buf[4] = (x2 >> 0) & 0xff;
+   const u8 paramX[] = {
+   MIPI_DCS_SET_COLUMN_ADDRESS,
+   (x1 >> 8) & 0xff,
+   (x1 >> 0) & 0xff,
+   (x2 >> 8) & 0xff,
+   (x2 >> 0) & 0xff,
+   };
 
-   r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, 
sizeof(buf));
-   if (r)
-   return r;
+   const struct mipi_dsi_msg msgX = {
+   .channel = ddata->channel,
+   .type = MIPI_DSI_GENERIC_LONG_WRITE,
+   .tx_buf = paramX,
+   .tx_len = 5,
+   };
 
-   buf[0] = MIPI_DCS_SET_PAGE_ADDRESS;
-   buf[1] = (y1 >> 8) & 0xff;
-   buf[2] = (y1 >> 0) & 0xff;
-   buf[3] = (y2 >> 8) & 0xff;
-   buf[4] = (y2 >> 0) & 0xff;
+   const u8 paramY[] = {
+   MIPI_DCS_SET_PAGE_ADDRESS,
+   (y1 >> 8) & 0xff,
+   (y1 >> 0) & 0xff,
+   (y2 >> 8) & 0xff,
+   (y2 >> 0) & 0xff,
+   };
 
-   r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, 
sizeof(buf));
+   const struct mipi_dsi_msg msgY = {
+   .channel = ddata->channel,
+   .type = MIPI_DSI_GENERIC_LONG_WRITE,
+   .tx_buf = paramY,
+   .tx_len = 5,
+   };
+
+
+   r = src->ops->dsi.transfer(src, );
if (r)
return r;
 
-   src->ops->dsi.bta_sync(src, ddata

[PATCHv2 29/56] drm/omap: dsi: untangle ulps ops from enable/disable

2020-02-25 Thread Sebastian Reichel
Create a custom function pointer for ULPS and use it instead of
reusing disable/enable functions for ULPS mode switch. This allows
us to use the common disable/enable functions pointers for DSI.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  8 ++--
 drivers/gpu/drm/omapdrm/dss/dsi.c | 38 ++-
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  5 +--
 3 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 42a4a69b03fd..239a48910db7 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -233,7 +233,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
if (r)
goto err;
 
-   src->ops->dsi.disable(src, false, true);
+   src->ops->dsi.ulps(src, true);
 
ddata->ulps_enabled = true;
 
@@ -258,7 +258,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
if (!ddata->ulps_enabled)
return 0;
 
-   src->ops->enable(src);
+   src->ops->dsi.ulps(src, false);
ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
r = _dsicm_enable_te(ddata, ddata->te_enabled);
@@ -586,7 +586,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
dsicm_hw_reset(ddata);
 
-   src->ops->dsi.disable(src, true, false);
+   src->ops->disable(src);
 err_regulators:
r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
if (r)
@@ -612,7 +612,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
dsicm_hw_reset(ddata);
}
 
-   src->ops->dsi.disable(src, true, false);
+   src->ops->disable(src);
 
r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
if (r)
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index ce45021c99ce..684d52079e89 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4062,13 +4062,10 @@ static void dsi_display_uninit_dsi(struct dsi_data 
*dsi, bool disconnect_lanes,
}
 }
 
-static void dsi_display_enable(struct omap_dss_device *dssdev)
+static void dsi_display_ulps_enable(struct dsi_data *dsi)
 {
-   struct dsi_data *dsi = to_dsi_data(dssdev);
int r;
 
-   DSSDBG("dsi_display_enable\n");
-
WARN_ON(!dsi_bus_is_locked(dsi));
 
mutex_lock(>lock);
@@ -4091,16 +4088,19 @@ static void dsi_display_enable(struct omap_dss_device 
*dssdev)
dsi_runtime_put(dsi);
 err_get_dsi:
mutex_unlock(>lock);
-   DSSDBG("dsi_display_enable FAILED\n");
+   DSSDBG("dsi_display_ulps_enable FAILED\n");
 }
 
-static void dsi_display_disable(struct omap_dss_device *dssdev,
-   bool disconnect_lanes, bool enter_ulps)
+static void dsi_display_enable(struct omap_dss_device *dssdev)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
+   DSSDBG("dsi_display_enable\n");
+   dsi_display_ulps_enable(dsi);
+}
 
-   DSSDBG("dsi_display_disable\n");
-
+static void dsi_display_ulps_disable(struct dsi_data *dsi,
+   bool disconnect_lanes, bool enter_ulps)
+{
WARN_ON(!dsi_bus_is_locked(dsi));
 
mutex_lock(>lock);
@@ -4117,6 +4117,23 @@ static void dsi_display_disable(struct omap_dss_device 
*dssdev,
mutex_unlock(>lock);
 }
 
+static void dsi_display_disable(struct omap_dss_device *dssdev)
+{
+   struct dsi_data *dsi = to_dsi_data(dssdev);
+   DSSDBG("dsi_display_disable\n");
+   dsi_display_ulps_disable(dsi, true, false);
+}
+
+static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
+{
+   struct dsi_data *dsi = to_dsi_data(dssdev);
+   DSSDBG("dsi_ulps\n");
+   if (enable)
+   dsi_display_ulps_disable(dsi, false, true);
+   else
+   dsi_display_ulps_enable(dsi);
+}
+
 static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 {
dsi->te_enabled = enable;
@@ -4818,9 +4835,10 @@ static const struct omap_dss_device_ops dsi_ops = {
.connect = dsi_connect,
.disconnect = dsi_disconnect,
.enable = dsi_display_enable,
+   .disable = dsi_display_disable,
 
.dsi = {
-   .disable = dsi_display_disable,
+   .ulps = dsi_ulps,
 
.set_config = dsi_set_config,
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 8ff99c00c708..484bdb01871f 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -280,10 +280,9 @@ struct omap_dss_writeback_info {
 };
 
 struct omapdss_dsi_ops {
-   void (*disable)(struct omap_dss_device *dssdev, bool 

[PATCHv2 39/56] drm/omap: panel-dsi-cm: support unbinding

2020-02-25 Thread Sebastian Reichel
Now, that the driver implements the common DRM panel API
the unbind no longer needs to be suppressed.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 00dc7b0a349b..8562f056585d 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -612,7 +612,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
return r;
 }
 
-static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
+static int dsicm_remove(struct mipi_dsi_device *dsi)
 {
struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
 
@@ -642,11 +642,10 @@ MODULE_DEVICE_TABLE(of, dsicm_of_match);
 
 static struct mipi_dsi_driver dsicm_driver = {
.probe = dsicm_probe,
-   .remove = __exit_p(dsicm_remove),
+   .remove = dsicm_remove,
.driver = {
.name = "panel-dsi-cm",
.of_match_table = dsicm_of_match,
-   .suppress_bind_attrs = true,
},
 };
 module_mipi_dsi_driver(dsicm_driver);
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 38/56] drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO

2020-02-25 Thread Sebastian Reichel
Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR,
which makes the code a bit shorter and easier to read.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 803b7dada343..00dc7b0a349b 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -219,7 +219,7 @@ static const struct backlight_ops dsicm_bl_ops = {
.update_status  = dsicm_bl_update_status,
 };
 
-static ssize_t dsicm_num_errors_show(struct device *dev,
+static ssize_t num_dsi_errors_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
@@ -239,7 +239,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%d\n", errors);
 }
 
-static ssize_t dsicm_hw_revision_show(struct device *dev,
+static ssize_t hw_revision_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
@@ -259,8 +259,8 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
 }
 
-static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
-static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
+static DEVICE_ATTR_RO(num_dsi_errors);
+static DEVICE_ATTR_RO(hw_revision);
 
 static struct attribute *dsicm_attrs[] = {
_attr_num_dsi_errors.attr,
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 25/56] drm/omap: dsi: lp/hs switching support for transfer()

2020-02-25 Thread Sebastian Reichel
Integrate low-power / high-speed bus switching into transfer
function and drop the omapdrm specific enable_hs() callback.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  6 +++---
 drivers/gpu/drm/omapdrm/dss/dsi.c   | 13 +++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h   |  2 --
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 8ad407a4072e..79ac1f6b375a 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -269,7 +269,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
return 0;
 
src->ops->enable(src);
-   src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
+   ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
r = _dsicm_enable_te(ddata, true);
if (r) {
@@ -574,7 +574,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
dsicm_hw_reset(ddata);
 
-   src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
+   ddata->dsi->mode_flags |= MIPI_DSI_MODE_LPM;
 
r = dsicm_sleep_out(ddata);
if (r)
@@ -617,7 +617,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
ddata->intro_printed = true;
}
 
-   src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
+   ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
return 0;
 err:
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 6c625b6d6d6b..15298ebb9d69 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -45,6 +45,9 @@ struct dsi_reg { u16 module; u16 idx; };
 
 #define DSI_REG(mod, idx)  ((const struct dsi_reg) { mod, idx })
 
+/* returns true iff both arguments logically differs */
+#define NEQV(a, b) (!(a) ^ !(b))
+
 /* DSI Protocol Engine */
 
 #define DSI_PROTO  0
@@ -329,6 +332,7 @@ struct dsi_data {
int irq;
 
bool is_enabled;
+   bool in_lp_mode;
 
struct clk *dss_clk;
struct regmap *syscon;
@@ -2431,6 +2435,8 @@ static void dsi_vc_enable_hs(struct omap_dss_device 
*dssdev, int channel,
/* start the DDR clock by sending a NULL packet */
if (dsi->vm_timings.ddr_clk_always_on && enable)
dsi_vc_send_null(dsi, channel);
+
+   dsi->in_lp_mode = !enable;
 }
 
 static void dsi_vc_flush_long_data(struct dsi_data *dsi, int channel)
@@ -4697,6 +4703,11 @@ static ssize_t omap_dsi_host_transfer(struct 
mipi_dsi_host *host,
struct dsi_data *dsi = host_to_omap(host);
struct omap_dss_device *dssdev = >output;
 
+   if (NEQV(msg->flags & MIPI_DSI_MSG_USE_LPM, dsi->in_lp_mode)) {
+   dsi_vc_enable_hs(dssdev, msg->channel,
+!(msg->flags & MIPI_DSI_MSG_USE_LPM));
+   }
+
switch (msg->type) {
case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
@@ -4757,8 +4768,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 
.disable = dsi_display_disable,
 
-   .enable_hs = dsi_vc_enable_hs,
-
.set_config = dsi_set_config,
 
.enable_video_output = dsi_enable_video_output,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 2c6c32240e20..355aa235c23c 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -287,8 +287,6 @@ struct omapdss_dsi_ops {
int (*set_config)(struct omap_dss_device *dssdev,
const struct omap_dss_dsi_config *cfg);
 
-   void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
-   bool enable);
int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
 
int (*update)(struct omap_dss_device *dssdev, int channel,
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 22/56] drm/omap: dsi: drop useless sync()

2020-02-25 Thread Sebastian Reichel
The DSI sync() function only locks the bus and then releases
it again. Currently the only invocation is directly before
update(), which locks the bus anyways.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c| 18 --
 drivers/gpu/drm/omapdrm/dss/omapdss.h  |  1 -
 drivers/gpu/drm/omapdrm/omap_crtc.c|  3 ---
 3 files changed, 22 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 64f493c722c0..a45df247aad1 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -845,23 +845,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
return r;
 }
 
-static int dsicm_sync(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *src = ddata->src;
-
-   dev_dbg(>dsi->dev, "sync\n");
-
-   mutex_lock(>lock);
-   src->ops->dsi.bus_lock(src);
-   src->ops->dsi.bus_unlock(src);
-   mutex_unlock(>lock);
-
-   dev_dbg(>dsi->dev, "sync done\n");
-
-   return 0;
-}
-
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
struct omap_dss_device *src = ddata->src;
@@ -950,7 +933,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
 
 static const struct omap_dss_driver dsicm_dss_driver = {
.update = dsicm_update,
-   .sync   = dsicm_sync,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index e6832bf22ed0..2c6c32240e20 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -384,7 +384,6 @@ struct omap_dss_device {
 struct omap_dss_driver {
int (*update)(struct omap_dss_device *dssdev,
   u16 x, u16 y, u16 w, u16 h);
-   int (*sync)(struct omap_dss_device *dssdev);
 };
 
 struct dss_device *omapdss_get_dss(void);
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index fce7e944a280..3f78ce2f85a1 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -379,9 +379,6 @@ static void omap_crtc_manual_display_update(struct 
work_struct *data)
return;
}
 
-   if (dssdrv->sync)
-   dssdrv->sync(dssdev);
-
ret = dssdrv->update(dssdev, 0, 0, mode->hdisplay, mode->vdisplay);
if (ret < 0) {
spin_lock_irq(>event_lock);
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 21/56] drm/omap: dsi: drop unused enable_te()

2020-02-25 Thread Sebastian Reichel
enable_te() is not used, so the custom API can be dropped.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 39 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  2 -
 2 files changed, 41 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index e4b24c67c45d..64f493c722c0 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -882,43 +882,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, 
bool enable)
return r;
 }
 
-static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *src = ddata->src;
-   int r;
-
-   mutex_lock(>lock);
-
-   if (ddata->te_enabled == enable)
-   goto end;
-
-   src->ops->dsi.bus_lock(src);
-
-   if (ddata->enabled) {
-   r = dsicm_wake_up(ddata);
-   if (r)
-   goto err;
-
-   r = _dsicm_enable_te(ddata, enable);
-   if (r)
-   goto err;
-   }
-
-   ddata->te_enabled = enable;
-
-   src->ops->dsi.bus_unlock(src);
-end:
-   mutex_unlock(>lock);
-
-   return 0;
-err:
-   src->ops->dsi.bus_unlock(src);
-   mutex_unlock(>lock);
-
-   return r;
-}
-
 static void dsicm_ulps_work(struct work_struct *work)
 {
struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
@@ -988,8 +951,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
 static const struct omap_dss_driver dsicm_dss_driver = {
.update = dsicm_update,
.sync   = dsicm_sync,
-
-   .enable_te  = dsicm_enable_te,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index a1e78ba665d8..e6832bf22ed0 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -385,8 +385,6 @@ struct omap_dss_driver {
int (*update)(struct omap_dss_device *dssdev,
   u16 x, u16 y, u16 w, u16 h);
int (*sync)(struct omap_dss_device *dssdev);
-
-   int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
 };
 
 struct dss_device *omapdss_get_dss(void);
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 03/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations"

2020-02-25 Thread Sebastian Reichel
From: Sebastian Reichel 

This reverts commit 4ff8e98879e6eeae9d125dfcf3b642075d00089d.
---
 drivers/gpu/drm/omapdrm/dss/base.c | 26 +++
 drivers/gpu/drm/omapdrm/dss/omapdss.h  |  6 
 drivers/gpu/drm/omapdrm/omap_encoder.c | 44 +++---
 3 files changed, 71 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index c7650a7c155d..455b410f7401 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -234,6 +234,18 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
 
+void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
+{
+   if (!dssdev)
+   return;
+
+   omapdss_device_pre_enable(dssdev->next);
+
+   if (dssdev->ops && dssdev->ops->pre_enable)
+   dssdev->ops->pre_enable(dssdev);
+}
+EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
+
 void omapdss_device_enable(struct omap_dss_device *dssdev)
 {
if (!dssdev)
@@ -260,6 +272,20 @@ void omapdss_device_disable(struct omap_dss_device *dssdev)
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disable);
 
+void omapdss_device_post_disable(struct omap_dss_device *dssdev)
+{
+   if (!dssdev)
+   return;
+
+   if (dssdev->ops && dssdev->ops->post_disable)
+   dssdev->ops->post_disable(dssdev);
+
+   omapdss_device_post_disable(dssdev->next);
+
+   dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+}
+EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
+
 /* 
-
  * Components Handling
  */
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index ab19d4af8de7..cbbe10b2b60d 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -342,11 +342,15 @@ struct omap_dss_device_ops {
void (*disconnect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
 
+   void (*pre_enable)(struct omap_dss_device *dssdev);
void (*enable)(struct omap_dss_device *dssdev);
void (*disable)(struct omap_dss_device *dssdev);
+   void (*post_disable)(struct omap_dss_device *dssdev);
 
int (*check_timings)(struct omap_dss_device *dssdev,
 struct drm_display_mode *mode);
+   void (*set_timings)(struct omap_dss_device *dssdev,
+   const struct drm_display_mode *mode);
 
int (*get_modes)(struct omap_dss_device *dssdev,
 struct drm_connector *connector);
@@ -445,8 +449,10 @@ int omapdss_device_connect(struct dss_device *dss,
   struct omap_dss_device *dst);
 void omapdss_device_disconnect(struct omap_dss_device *src,
   struct omap_dss_device *dst);
+void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
 void omapdss_device_enable(struct omap_dss_device *dssdev);
 void omapdss_device_disable(struct omap_dss_device *dssdev);
+void omapdss_device_post_disable(struct omap_dss_device *dssdev);
 
 int omap_dss_get_num_overlay_managers(void);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
b/drivers/gpu/drm/omapdrm/omap_encoder.c
index ae4b867a67a3..18a79dde6815 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -113,8 +113,13 @@ static void omap_encoder_mode_set(struct drm_encoder 
*encoder,
bus_flags = connector->display_info.bus_flags;
omap_encoder_update_videomode_flags(, bus_flags);
 
-   /* Set timings for the dss manager. */
+   /* Set timings for all devices in the display pipeline. */
dss_mgr_set_timings(output, );
+
+   for (dssdev = output; dssdev; dssdev = dssdev->next) {
+   if (dssdev->ops && dssdev->ops->set_timings)
+   dssdev->ops->set_timings(dssdev, adjusted_mode);
+   }
 }
 
 static void omap_encoder_disable(struct drm_encoder *encoder)
@@ -127,10 +132,26 @@ static void omap_encoder_disable(struct drm_encoder 
*encoder)
 
/*
 * Disable the chain of external devices, starting at the one at the
-* internal encoder's output. This is used for DSI outputs only, as
-* dssdev->next is NULL for all other outputs.
+* internal encoder's output.
 */
omapdss_device_disable(dssdev->next);
+
+   /*
+* Disable the internal encoder. This will disable the DSS output. The
+* DSI is treated as an exception as DSI pipelines still use the legacy
+* flow where the pipeline output controls the encoder.
+*/
+   if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
+   if (dssdev->ops && dssdev->ops->disable)
+

[PATCHv2 24/56] drm/omap: panel-dsi-cm: use bulk regulator API

2020-02-25 Thread Sebastian Reichel
Use bulk regulator API to simplify the code. This also switches
from _optional variant to normal variant, which will provide a
dummy regulator (i.e. if some always-enabled regulator is not
described in DT).

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 65 ++-
 1 file changed, 21 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 199eac88a777..8ad407a4072e 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -32,6 +32,8 @@
 #define DCS_GET_ID20xdb
 #define DCS_GET_ID30xdc
 
+#define DCS_REGULATOR_SUPPLY_NUM 2
+
 struct panel_drv_data {
struct mipi_dsi_device *dsi;
 
@@ -54,8 +56,7 @@ struct panel_drv_data {
struct gpio_desc *reset_gpio;
struct gpio_desc *ext_te_gpio;
 
-   struct regulator *vpnl;
-   struct regulator *vddi;
+   struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
 
bool use_dsi_backlight;
 
@@ -557,28 +558,16 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
.lp_clk_max = 1000,
};
 
-   if (ddata->vpnl) {
-   r = regulator_enable(ddata->vpnl);
-   if (r) {
-   dev_err(>dsi->dev,
-   "failed to enable VPNL: %d\n", r);
-   return r;
-   }
-   }
-
-   if (ddata->vddi) {
-   r = regulator_enable(ddata->vddi);
-   if (r) {
-   dev_err(>dsi->dev,
-   "failed to enable VDDI: %d\n", r);
-   goto err_vpnl;
-   }
+   r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+   if (r) {
+   dev_err(>dsi->dev, "failed to enable supplies: %d\n", r);
+   return r;
}
 
r = src->ops->dsi.set_config(src, _config);
if (r) {
dev_err(>dsi->dev, "failed to configure DSI\n");
-   goto err_vddi;
+   goto err_regulators;
}
 
src->ops->enable(src);
@@ -637,12 +626,10 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
dsicm_hw_reset(ddata);
 
src->ops->dsi.disable(src, true, false);
-err_vddi:
-   if (ddata->vddi)
-   regulator_disable(ddata->vddi);
-err_vpnl:
-   if (ddata->vpnl)
-   regulator_disable(ddata->vpnl);
+err_regulators:
+   r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+   if (r)
+   dev_err(>dsi->dev, "failed to disable supplies: %d\n", 
r);
 
return r;
 }
@@ -666,10 +653,9 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 
src->ops->dsi.disable(src, true, false);
 
-   if (ddata->vddi)
-   regulator_disable(ddata->vddi);
-   if (ddata->vpnl)
-   regulator_disable(ddata->vpnl);
+   r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+   if (r)
+   dev_err(>dsi->dev, "failed to disable supplies: %d\n", 
r);
 
ddata->enabled = false;
 }
@@ -973,21 +959,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
ddata->height_mm = 0;
of_property_read_u32(node, "height-mm", >height_mm);
 
-   ddata->vpnl = devm_regulator_get_optional(>dev, "vpnl");
-   if (IS_ERR(ddata->vpnl)) {
-   err = PTR_ERR(ddata->vpnl);
-   if (err == -EPROBE_DEFER)
-   return err;
-   ddata->vpnl = NULL;
-   }
-
-   ddata->vddi = devm_regulator_get_optional(>dev, "vddi");
-   if (IS_ERR(ddata->vddi)) {
-   err = PTR_ERR(ddata->vddi);
-   if (err == -EPROBE_DEFER)
-   return err;
-   ddata->vddi = NULL;
-   }
+   ddata->supplies[0].supply = "vpnl";
+   ddata->supplies[1].supply = "vddi";
+   err = devm_regulator_bulk_get(>dev, DCS_REGULATOR_SUPPLY_NUM,
+ ddata->supplies);
+   if (err)
+   return err;
 
backlight = of_parse_phandle(node, "backlight", 0);
if (backlight) {
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 31/56] drm/omap: dsi: do ULPS in host driver

2020-02-25 Thread Sebastian Reichel
Move ULPS handling into the DSI host controller, so that we
no longer need a custom API for the DSI client.

Signed-off-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 273 +-
 drivers/gpu/drm/omapdrm/dss/dsi.c |  61 +++-
 drivers/gpu/drm/omapdrm/dss/omapdss.h |   2 -
 3 files changed, 62 insertions(+), 274 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 239a48910db7..1e33cf7c1448 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -69,21 +68,13 @@ struct panel_drv_data {
 
bool intro_printed;
 
-   struct workqueue_struct *workqueue;
-
bool ulps_enabled;
-   unsigned int ulps_timeout;
-   struct delayed_work ulps_work;
 };
 
 #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
 
-static int dsicm_panel_reset(struct panel_drv_data *ddata);
-
-static void dsicm_ulps_work(struct work_struct *work);
-
 static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
 {
struct backlight_device *backlight;
@@ -207,94 +198,6 @@ static int dsicm_set_update_window(struct panel_drv_data 
*ddata,
return 0;
 }
 
-static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
-{
-   if (ddata->ulps_timeout > 0)
-   queue_delayed_work(ddata->workqueue, >ulps_work,
-   msecs_to_jiffies(ddata->ulps_timeout));
-}
-
-static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
-{
-   cancel_delayed_work(>ulps_work);
-}
-
-static int dsicm_enter_ulps(struct panel_drv_data *ddata)
-{
-   struct omap_dss_device *src = ddata->src;
-   int r;
-
-   if (ddata->ulps_enabled)
-   return 0;
-
-   dsicm_cancel_ulps_work(ddata);
-
-   r = _dsicm_enable_te(ddata, false);
-   if (r)
-   goto err;
-
-   src->ops->dsi.ulps(src, true);
-
-   ddata->ulps_enabled = true;
-
-   return 0;
-
-err:
-   dev_err(>dsi->dev, "enter ULPS failed");
-   dsicm_panel_reset(ddata);
-
-   ddata->ulps_enabled = false;
-
-   dsicm_queue_ulps_work(ddata);
-
-   return r;
-}
-
-static int dsicm_exit_ulps(struct panel_drv_data *ddata)
-{
-   struct omap_dss_device *src = ddata->src;
-   int r;
-
-   if (!ddata->ulps_enabled)
-   return 0;
-
-   src->ops->dsi.ulps(src, false);
-   ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
-
-   r = _dsicm_enable_te(ddata, ddata->te_enabled);
-   if (r) {
-   dev_err(>dsi->dev, "failed to re-enable TE");
-   goto err2;
-   }
-
-   dsicm_queue_ulps_work(ddata);
-
-   ddata->ulps_enabled = false;
-
-   return 0;
-
-err2:
-   dev_err(>dsi->dev, "failed to exit ULPS");
-
-   r = dsicm_panel_reset(ddata);
-   if (!r)
-   ddata->ulps_enabled = false;
-
-   dsicm_queue_ulps_work(ddata);
-
-   return r;
-}
-
-static int dsicm_wake_up(struct panel_drv_data *ddata)
-{
-   if (ddata->ulps_enabled)
-   return dsicm_exit_ulps(ddata);
-
-   dsicm_cancel_ulps_work(ddata);
-   dsicm_queue_ulps_work(ddata);
-   return 0;
-}
-
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
struct panel_drv_data *ddata = dev_get_drvdata(>dev);
@@ -312,11 +215,8 @@ static int dsicm_bl_update_status(struct backlight_device 
*dev)
mutex_lock(>lock);
 
if (ddata->enabled) {
-   r = dsicm_wake_up(ddata);
-   if (!r) {
-   r = dsicm_dcs_write_1(ddata,
-   MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
-   }
+   r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+ level);
}
 
mutex_unlock(>lock);
@@ -343,18 +243,12 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
u8 errors = 0;
-   int r;
+   int r = -ENODEV;
 
mutex_lock(>lock);
 
-   if (ddata->enabled) {
-   r = dsicm_wake_up(ddata);
-   if (!r)
-   r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
-   );
-   } else {
-   r = -ENODEV;
-   }
+   if (ddata->enabled)
+   r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS, );
 
mutex_unlock(>lock);
 
@@ -369,17 +263,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 {
str

[PATCHv2 37/56] drm/omap: dsi: implement check timings

2020-02-25 Thread Sebastian Reichel
Implement check timings, which will check if its possible to
configure the clocks for the provided mode using the same code
as the set_config() hook.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 70 +++
 1 file changed, 44 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index a399d6857c0d..acbfffe83b3e 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -283,6 +283,11 @@ struct dsi_isr_tables {
struct dsi_isr_data isr_table_cio[DSI_MAX_NR_ISRS];
 };
 
+struct dsi_lp_clock_info {
+   unsigned long lp_clk;
+   u16 lp_clk_div;
+};
+
 struct dsi_clk_calc_ctx {
struct dsi_data *dsi;
struct dss_pll *pll;
@@ -297,16 +302,12 @@ struct dsi_clk_calc_ctx {
 
struct dss_pll_clock_info dsi_cinfo;
struct dispc_clock_info dispc_cinfo;
+   struct dsi_lp_clock_info user_lp_cinfo;
 
struct videomode vm;
struct omap_dss_dsi_videomode_timings dsi_vm;
 };
 
-struct dsi_lp_clock_info {
-   unsigned long lp_clk;
-   u16 lp_clk_div;
-};
-
 struct dsi_module_id_data {
u32 address;
int id;
@@ -4794,44 +4795,55 @@ static bool dsi_is_video_mode(struct omap_dss_device 
*dssdev)
return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);
 }
 
-static int dsi_set_config(struct omap_dss_device *dssdev,
-   const struct drm_display_mode *mode)
+static int __dsi_calc_config(struct dsi_data *dsi,
+   const struct drm_display_mode *mode,
+   struct dsi_clk_calc_ctx *ctx)
 {
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-   struct dsi_clk_calc_ctx ctx;
-   struct videomode vm;
struct omap_dss_dsi_config cfg = dsi->config;
+   struct videomode vm;
bool ok;
int r;
 
drm_display_mode_to_videomode(mode, );
-   cfg.vm = 
-
-   mutex_lock(>lock);
 
+   cfg.vm = 
cfg.mode = dsi->mode;
cfg.pixel_format = dsi->pix_fmt;
 
if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
-   ok = dsi_vm_calc(dsi, , );
+   ok = dsi_vm_calc(dsi, , ctx);
else
-   ok = dsi_cm_calc(dsi, , );
+   ok = dsi_cm_calc(dsi, , ctx);
 
-   if (!ok) {
-   DSSERR("failed to find suitable DSI clock settings\n");
-   r = -EINVAL;
-   goto err;
-   }
+   if (!ok)
+   return -EINVAL;
+
+   dsi_pll_calc_dsi_fck(dsi, >dsi_cinfo);
 
-   dsi_pll_calc_dsi_fck(dsi, _cinfo);
+   r = dsi_lp_clock_calc(ctx->dsi_cinfo.clkout[HSDIV_DSI],
+   cfg.lp_clk_min, cfg.lp_clk_max, >user_lp_cinfo);
+   if (r)
+   return r;
+
+   return 0;
+}
 
-   r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
-   cfg.lp_clk_min, cfg.lp_clk_max, >user_lp_cinfo);
+static int dsi_set_config(struct omap_dss_device *dssdev,
+   const struct drm_display_mode *mode)
+{
+   struct dsi_data *dsi = to_dsi_data(dssdev);
+   struct dsi_clk_calc_ctx ctx;
+   int r;
+
+   mutex_lock(>lock);
+
+   r = __dsi_calc_config(dsi, mode, );
if (r) {
-   DSSERR("failed to find suitable DSI LP clock settings\n");
+   DSSERR("failed to find suitable DSI clock settings\n");
goto err;
}
 
+   dsi->user_lp_cinfo = ctx.user_lp_cinfo;
dsi->user_dsi_cinfo = ctx.dsi_cinfo;
dsi->user_dispc_cinfo = ctx.dispc_cinfo;
 
@@ -5008,11 +5020,17 @@ static void dsi_set_timings(struct omap_dss_device 
*dssdev,
 static int dsi_check_timings(struct omap_dss_device *dssdev,
 struct drm_display_mode *mode)
 {
+   struct dsi_data *dsi = to_dsi_data(dssdev);
+   struct dsi_clk_calc_ctx ctx;
+   int r;
+
DSSDBG("dsi_check_timings\n");
 
-   /* TODO */
+   mutex_lock(>lock);
+   r = __dsi_calc_config(dsi, mode, );
+   mutex_unlock(>lock);
 
-   return 0;
+   return r;
 }
 
 static int dsi_connect(struct omap_dss_device *src,
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 45/56] drm/omap: dsi: Register a drm_bridge

2020-02-25 Thread Sebastian Reichel
In order to integrate with a chain of drm_bridge, the internal DSI
output has to expose its operations through the drm_bridge API.
Register a bridge at initialisation time to do so and remove the
omap_dss_device operations that are now unused.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 128 +++---
 1 file changed, 83 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index f629e6b1025b..0d6162875b30 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -36,6 +36,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -440,6 +441,7 @@ struct dsi_data {
struct omap_dss_dsi_videomode_timings vm_timings;
 
struct omap_dss_device output;
+   struct drm_bridge bridge;
 };
 
 struct dsi_packet_sent_handler_data {
@@ -452,6 +454,9 @@ static bool dsi_perf;
 module_param(dsi_perf, bool, 0644);
 #endif
 
+#define drm_bridge_to_dsi(bridge) \
+   container_of(bridge, struct dsi_data, bridge)
+
 static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
 {
return dev_get_drvdata(dssdev->dev);
@@ -5010,50 +5015,7 @@ static int dsi_get_clocks(struct dsi_data *dsi)
return 0;
 }
 
-static void dsi_set_timings(struct omap_dss_device *dssdev,
-   const struct drm_display_mode *mode)
-{
-   DSSDBG("dsi_set_timings\n");
-   dsi_set_config(dssdev, mode);
-}
-
-static int dsi_check_timings(struct omap_dss_device *dssdev,
-struct drm_display_mode *mode)
-{
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-   struct dsi_clk_calc_ctx ctx;
-   int r;
-
-   DSSDBG("dsi_check_timings\n");
-
-   mutex_lock(>lock);
-   r = __dsi_calc_config(dsi, mode, );
-   mutex_unlock(>lock);
-
-   return r;
-}
-
-static int dsi_connect(struct omap_dss_device *src,
-  struct omap_dss_device *dst)
-{
-   return omapdss_device_connect(dst->dss, dst, dst->next);
-}
-
-static void dsi_disconnect(struct omap_dss_device *src,
-  struct omap_dss_device *dst)
-{
-   omapdss_device_disconnect(dst, dst->next);
-}
-
 static const struct omap_dss_device_ops dsi_ops = {
-   .connect = dsi_connect,
-   .disconnect = dsi_disconnect,
-   .enable = dsi_enable_video_outputs,
-   .disable = dsi_disable_video_outputs,
-
-   .check_timings = dsi_check_timings,
-   .set_timings = dsi_set_timings,
-
.dsi = {
.update = dsi_update_all,
.is_video_mode = dsi_is_video_mode,
@@ -5394,6 +5356,77 @@ static const struct component_ops dsi_component_ops = {
.unbind = dsi_unbind,
 };
 
+/* 
-
+ * DRM Bridge Operations
+ */
+
+static int dsi_bridge_attach(struct drm_bridge *bridge,
+enum drm_bridge_attach_flags flags)
+{
+   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+
+   if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
+   return -EINVAL;
+
+   return drm_bridge_attach(bridge->encoder, dsi->output.next_bridge,
+bridge, flags);
+}
+
+static enum drm_mode_status
+dsi_bridge_mode_valid(struct drm_bridge *bridge,
+ const struct drm_display_mode *mode)
+{
+   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+   struct dsi_clk_calc_ctx ctx;
+   int r;
+
+   mutex_lock(>lock);
+   r = __dsi_calc_config(dsi, mode, );
+   mutex_unlock(>lock);
+
+   return r ? MODE_CLOCK_RANGE : MODE_OK;
+}
+
+static void dsi_bridge_mode_set(struct drm_bridge *bridge,
+   const struct drm_display_mode *mode,
+   const struct drm_display_mode *adjusted_mode)
+{
+   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+   dsi_set_config(>output, adjusted_mode);
+}
+
+static void dsi_bridge_enable(struct drm_bridge *bridge)
+{
+   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+   dsi_enable_video_outputs(>output);
+}
+
+static void dsi_bridge_disable(struct drm_bridge *bridge)
+{
+   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+   dsi_disable_video_outputs(>output);
+}
+
+static const struct drm_bridge_funcs dsi_bridge_funcs = {
+   .attach = dsi_bridge_attach,
+   .mode_valid = dsi_bridge_mode_valid,
+   .mode_set = dsi_bridge_mode_set,
+   .enable = dsi_bridge_enable,
+   .disable = dsi_bridge_disable,
+};
+
+static void dsi_bridge_init(struct dsi_data *dsi)
+{
+   dsi->bridge.funcs = _bridge_funcs;
+   dsi->bridge.of_node = dsi->host.dev->of_node;
+   dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
+}
+
+static void

[PATCHv2 53/56] drm/omap: simplify DSI manual update code

2020-02-25 Thread Sebastian Reichel
Move dsi_ops into the main structure, since all other ops
are gone. Instead of checking the device type we can simply
check if dsi_ops are set.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 10 --
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  6 +-
 drivers/gpu/drm/omapdrm/omap_crtc.c   | 16 
 3 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 0d6162875b30..e8924af4c30f 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5015,11 +5015,9 @@ static int dsi_get_clocks(struct dsi_data *dsi)
return 0;
 }
 
-static const struct omap_dss_device_ops dsi_ops = {
-   .dsi = {
-   .update = dsi_update_all,
-   .is_video_mode = dsi_is_video_mode,
-   },
+static const struct omapdss_dsi_ops dsi_ops = {
+   .update = dsi_update_all,
+   .is_video_mode = dsi_is_video_mode,
 };
 
 static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
@@ -5445,7 +5443,7 @@ static int dsi_init_output(struct dsi_data *dsi)
out->type = OMAP_DISPLAY_TYPE_DSI;
out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
out->dispc_channel = dsi_get_channel(dsi);
-   out->ops = _ops;
+   out->dsi_ops = _ops;
out->owner = THIS_MODULE;
out->of_port = 0;
out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4ad1b63c1b07..fb045eca03a6 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -274,10 +274,6 @@ struct omapdss_dsi_ops {
bool (*is_video_mode)(struct omap_dss_device *dssdev);
 };
 
-struct omap_dss_device_ops {
-   const struct omapdss_dsi_ops dsi;
-};
-
 struct omap_dss_device {
struct device *dev;
 
@@ -299,7 +295,7 @@ struct omap_dss_device {
 
const char *name;
 
-   const struct omap_dss_device_ops *ops;
+   const struct omapdss_dsi_ops *dsi_ops;
u32 bus_flags;
 
/* OMAP DSS output specific fields */
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index af62f6075602..e94b69871a32 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -366,17 +366,10 @@ static void omap_crtc_manual_display_update(struct 
work_struct *data)
struct drm_device *dev = omap_crtc->base.dev;
int ret;
 
-   if (!dssdev) {
-   dev_err_once(dev->dev, "missing display dssdev!");
+   if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->update)
return;
-   }
-
-   if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
-   dev_err_once(dev->dev, "no DSI update callback found!");
-   return;
-   }
 
-   ret = dssdev->ops->dsi.update(dssdev);
+   ret = dssdev->dsi_ops->update(dssdev);
if (ret < 0) {
spin_lock_irq(>event_lock);
omap_crtc->pending = false;
@@ -549,11 +542,10 @@ static bool omap_crtc_is_manually_updated(struct drm_crtc 
*crtc)
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
struct omap_dss_device *dssdev = omap_crtc->pipe->output;
 
-   if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
-   !dssdev->ops->dsi.is_video_mode)
+   if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->is_video_mode)
return false;
 
-   if (dssdev->ops->dsi.is_video_mode(dssdev))
+   if (dssdev->dsi_ops->is_video_mode(dssdev))
return false;
 
DBG("detected manually updated display!");
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 52/56] drm/omap: drop dssdev display field

2020-02-25 Thread Sebastian Reichel
All displays are using drm_panel instead off dssdev
now, so this field is always 0 and can be dropped.

Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/base.c| 2 +-
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 6 --
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index d62713b241d2..d9a5e7b9d401 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -198,7 +198,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
}
 
if (!dst->id && !omapdss_device_is_connected(dst)) {
-   WARN_ON(!dst->display);
+   WARN_ON(1);
return;
}
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 0ee042228c96..4ad1b63c1b07 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -297,12 +297,6 @@ struct omap_dss_device {
 */
enum omap_display_type type;
 
-   /*
-* True if the device is a display (panel or connector) at the end of
-* the pipeline, false otherwise.
-*/
-   bool display;
-
const char *name;
 
const struct omap_dss_device_ops *ops;
-- 
2.25.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v6 00/51] drm/omap: Replace custom display drivers with drm_bridge and drm_panel

2020-02-17 Thread Sebastian Reichel
Hi,

On Sun, Feb 16, 2020 at 11:02:17PM +0200, Laurent Pinchart wrote:
> This patch series is the sixth attempt to (nearly, see [1])
> complete the rework of the omapdrm driver to move to drm_bridge
> and drm_panel.
> 
> Version 2, available at [2], explains in its long cover letter the
> rationale for the changes. I won't duplicate it here as it is
> still valid as-is.
> 
> Compared to v5, available at [3], this version has been rebased on
> top of drm-misc-next, and minor bugs have been fixed, including
> interlaced modes support with VENC.
> 
> The patches can be found at
> 
> git://linuxtv.org/pinchartl/media.git omapdrm/bridge/devel
> 
> [1] The only notable exception is the omapdrm-specific DSI panel
> driver that implements a large number of custom operations. This
> is being addressed separately.
> 
> [2] https://patchwork.kernel.org/cover/11102445/
> [3] https://patchwork.kernel.org/cover/11349617/

The series is

Tested-by: Sebastian Reichel 
Reviewed-by: Sebastian Reichel 

Testing was done on Droid 4, DSI command mode panel is still
working. I had to add the following patch because of the base
you chose for the branch. Might make sense to use 5.6-rc1 instead.

https://lore.kernel.org/lkml/CAHk-=wh8VLe3AEKhz=1bzSO=1fv4EM71EhufxuC=Gp=+blh...@mail.gmail.com/

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v6 49/51] drm/omap: dss: Remove unused omap_dss_device operations

2020-02-20 Thread Sebastian Reichel
Hi,

On Sun, Feb 16, 2020 at 11:03:06PM +0200, Laurent Pinchart wrote:
> The omap_dss_device .pre_enable(), .post_disable() and .set_timings()
> are not used anymore. Remove them.
> 
> Signed-off-by: Laurent Pinchart 
> Reviewed-by: Tomi Valkeinen 
> ---

Actually it would be good to postpone this patch a bit, since 
I need those functions as intermediate step for converting DSI
code (I'm currently rebasing my series on yours).

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v6 49/51] drm/omap: dss: Remove unused omap_dss_device operations

2020-02-21 Thread Sebastian Reichel
Hi,

On Thu, Feb 20, 2020 at 11:45:30PM +0200, Laurent Pinchart wrote:
> On Thu, Feb 20, 2020 at 10:39:38PM +0100, Sebastian Reichel wrote:
> > On Sun, Feb 16, 2020 at 11:03:06PM +0200, Laurent Pinchart wrote:
> > > The omap_dss_device .pre_enable(), .post_disable() and .set_timings()
> > > are not used anymore. Remove them.
> > > 
> > > Signed-off-by: Laurent Pinchart 
> > > Reviewed-by: Tomi Valkeinen 
> > > ---
> > 
> > Actually it would be good to postpone this patch a bit, since 
> > I need those functions as intermediate step for converting DSI
> > code (I'm currently rebasing my series on yours).
> 
> I'm fine with that. I'll move the patch to the end of the series
> (nothing depends on it) and postpone it for now.

Great, Thanks. I got my DSI cleanup patches working on top of your
series:

https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-n900.git/log/?h=omapdrm/bridge/devel-with-dsi

I added a similar patch towards the end, which removes all
of the omap_dss_device ops:

https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-n900.git/commit/?h=omapdrm/bridge/devel-with-dsi=4269becc2bf39631a4ae5aba8e21f4aab83fc837

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] ARM: dts: am437x-gp/epos-evm: drop unused panel timings

2020-02-13 Thread Sebastian Reichel
Hi,

On Tue, Feb 11, 2020 at 07:22:14PM +0200, Tomi Valkeinen wrote:
> On 11/02/2020 18:27, Tony Lindgren wrote:
> > > We are still missing DSI command mode support, and moving it
> > > to the common DRM model.
> > 
> > Nope, DSI command mode support has been working just fine for
> > a while now :) And Sebastian has a WIP git tree of the common DRM
> 
> Indeed... It had been going on for so long that now my mind is
> stuck at dsi-command-mode-not-yet-in =).

Welcome in the future :)

> > model changes for it. I don't think we have devices with DSI
> > command mode working for omapfb but not for omapdrm?
> 
> Yes, I think that is true.

Note, that OMAP3 quirk is missing (IDK if its supported in omapfb,
haven't used it for ages). I planned to have a look at OMAP3 once
the patchset moving omapdrm DSI to common DRM is merged, which
needs a non-trivial rebase.

> > What got missed for v5.6-rc1 is the LCD backlight patch though,
> > I think the only issue there is default-brightness vs more common
> > default-brightness-value usage if you have any input to that.
> 
> At least for some boards a power supply is needed, and I think
> there was no conclusion on who should enable that. It didn't seem
> to fit in anywhere...
> 
> But need to check on the latest status. I wasn't following that
> work closely, as JJ was working on it.

FWIW omapdrm's DSI driver is ready for that and omapfb is not :P

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] ARM: dts: am437x-gp/epos-evm: drop unused panel timings

2020-02-13 Thread Sebastian Reichel
Hi,

On Tue, Feb 11, 2020 at 01:10:07PM +0200, Laurent Pinchart wrote:
> On Tue, Feb 11, 2020 at 01:08:12PM +0200, Tomi Valkeinen wrote:
> > On 11/02/2020 13:07, Laurent Pinchart wrote:
> > 
> > >> Hopefully soon (in five years? =) we can say that omapdrm supports all
> > >> the boards, and we can deprecate omapfb.
> > > 
> > > I'd love to send a patch to remove omapfb, but I'll let you do the
> > > honours :-)
> > 
> > Not before we add DSI support to omapdrm...
> 
> Details, details ;-)
> 
> Seriously speaking, Sebastian's patches are on my todo list.

The patches need to be rebased. My hack for supporting panel
un/rebind stole connector and drm_dev pointer from drm_panel,
which is no longer possible. I hoped this could be cleaned up
once your and my omapdrm patches landed...

I do have a compile-tested-only WIP branch here, but I doubt
I got this working on the first try:

https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-n900.git/log/?h=omapdrm-dsi-drm-panel-5.6-rc1-wip

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] backlight: add led-backlight driver

2020-02-19 Thread Sebastian Reichel
On Wed, Feb 19, 2020 at 11:45:40AM -0800, Tony Lindgren wrote:
> * Pavel Machek  [200219 19:15]:
> > From: Tomi Valkeinen 
> > 
> > This patch adds a led-backlight driver (led_bl), which is similar to
> > pwm_bl except the driver uses a LED class driver to adjust the
> > brightness in the HW. Multiple LEDs can be used for a single backlight.
> > 
> > Signed-off-by: Tomi Valkeinen 
> > Signed-off-by: Jean-Jacques Hiblot 
> > Acked-by: Pavel Machek 
> > Reviewed-by: Daniel Thompson 
> > Acked-by: Lee Jones 
> > Acked-by: Tony Lindgren 
> > Tested-by: Tony Lindgren 
> > Signed-off-by: Pavel Machek 
> > ---
> >  drivers/video/backlight/Kconfig  |   7 ++
> >  drivers/video/backlight/Makefile |   1 +
> >  drivers/video/backlight/led_bl.c | 260 
> > +++
> >  3 files changed, 268 insertions(+)
> >  create mode 100644 drivers/video/backlight/led_bl.c
> > 
> > Hi!
> > 
> > Here's the version of the driver I have. AFAICT
> > default-brightness-level handling is ok, so does not need to be
> > changed.
> > 
> > Lee, it would be easiest for me if you could apply it to your tree and
> > push, but given enough time I can push it to Linus, too.
> 
> Oh you're using quoted-printable for patches.. Got it applied now,
> and it still works. Below is also the related dts change that
> I tested with.
> 
> Feel free to pick the dts change too, naturally that should
> not be applied before the driver.
> 
> If you guys instead want me to pick these both into my fixes
> branch, just let me know and I'll do the explaining why these
> are needed as fixes. Basically we no longer have a way to enable
> the LCD backlight for droid4 manually starting with v5.6-rc1
> unlike earlier.
> 
> Regards,
> 
> Tony
> 
> 8< --
> From tony Mon Sep 17 00:00:00 2001
> From: Tony Lindgren 
> Date: Wed, 19 Feb 2020 11:25:27 -0800
> Subject: [PATCH] ARM: dts: droid4: Configure LED backlight for lm3532
> 
> With the LED backlight changes merged, we still need the dts configured
> to have backlight working for droid4. Based on an earlier patch from
> Pavel Machek , let's configure the backlight but update
> the value range to be more usable.
> 
> We have a range of 256 register values split into 8 steps, so we can
> generate the brightness levels backwards with:
> 
> $ for i in 0 1 2 3 4 5 6 7; do echo "255 - ${i} * (256 / 8)" | bc; done
> 
> To avoid more confusion why the LCD backlight is still not on, let's
> also enable LED backlight as a loadable module for omap2plus_defconfig.
> 
> Cc: Merlijn Wajer 
> Cc: Pavel Machek 
> Signed-off-by: Tony Lindgren 
> ---
>  arch/arm/boot/dts/motorola-mapphone-common.dtsi | 13 +++--
>  arch/arm/configs/omap2plus_defconfig|  1 +
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
> b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
> --- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
> +++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
> @@ -182,6 +182,14 @@ vibrator {
>   pwm-names = "enable", "direction";
>   direction-duty-cycle-ns = <1000>;
>   };
> +
> + backlight: backlight {
> + compatible = "led-backlight";
> +
> + leds = <_led>;
> + brightness-levels = <31 63 95 127 159 191 223 255>;
> + default-brightness-level = <6>;
> + };
>  };
>  
>   {
> @@ -205,6 +213,8 @@ lcd0: display {
>   vddi-supply = <_regulator>;
>   reset-gpios = < 5 GPIO_ACTIVE_HIGH>;  /* gpio101 */
>  
> + backlight = <>;
> +
>   width-mm = <50>;
>   height-mm = <89>;
>  
> @@ -393,12 +403,11 @@ led-controller@38 {
>   ramp-up-us = <1024>;
>   ramp-down-us = <8193>;
>  
> - led@0 {
> + backlight_led: led@0 {
>   reg = <0>;
>   led-sources = <2>;
>   ti,led-mode = <0>;
>   label = ":backlight";
> -     linux,default-trigger = "backlight";
>   };
>  
>   led@1 {
> diff --git a/arch/arm/configs/omap2plus_defconfig 
> b/arch/arm/configs/omap2plus_defconfig
> --- a/arch/arm/configs/omap2plus_defconfig
> +++ b/arch/arm/configs/omap2plus_defconfig
> @@ -375,6 +375,7 @@ CONFIG_BACKLIGHT_GENERIC=m
>  CONFIG_BACKLIGHT_PWM=m
>  CONFIG_BACKLIGHT_PANDORA=m
>  CONFIG_BACKLIGHT_GPIO=m
> +CONFIG_BACKLIGHT_LED=m
>  CONFIG_FRAMEBUFFER_CONSOLE=y
>  CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
>  CONFIG_LOGO=y

Finally :)

Reviewed-by: Sebastian Reichel 

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 1/3] drm/panel: simple: Add support for AUO G190EAN01 panel

2020-04-16 Thread Sebastian Reichel
Add timings for the G190EAN01 dual channel LVDS panel.

Signed-off-by: Sebastian Reichel 
---
 .../bindings/display/panel/panel-simple.yaml  |  2 ++
 drivers/gpu/drm/panel/panel-simple.c  | 33 +++
 2 files changed, 35 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
index 8fc117d1547c..7c9a08d846b9 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
@@ -59,6 +59,8 @@ properties:
   - auo,g133han01
 # AU Optronics Corporation 18.5" FHD (1920x1080) TFT LCD panel
   - auo,g185han01
+# AU Optronics Corporation 19.0" (1280x1024) TFT LCD panel
+  - auo,g190ean01
 # AU Optronics Corporation 31.5" FHD (1920x1080) TFT LCD panel
   - auo,p320hvn03
 # AU Optronics Corporation 21.5" FHD (1920x1080) color TFT LCD panel
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 44a1f5dfb571..8d1cf68ca01b 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -933,6 +933,36 @@ static const struct panel_desc auo_g185han01 = {
.connector_type = DRM_MODE_CONNECTOR_LVDS,
 };
 
+static const struct display_timing auo_g190ean01_timings = {
+   .pixelclock = { 9000, 10800, 13500 },
+   .hactive = { 1280, 1280, 1280 },
+   .hfront_porch = { 126, 184, 1266 },
+   .hback_porch = { 84, 122, 844 },
+   .hsync_len = { 70, 102, 704 },
+   .vactive = { 1024, 1024, 1024 },
+   .vfront_porch = { 4, 26, 76 },
+   .vback_porch = { 2, 8, 25 },
+   .vsync_len = { 2, 8, 25 },
+};
+
+static const struct panel_desc auo_g190ean01 = {
+   .timings = _g190ean01_timings,
+   .num_timings = 1,
+   .bpc = 8,
+   .size = {
+   .width = 376,
+   .height = 301,
+   },
+   .delay = {
+   .prepare = 50,
+   .enable = 200,
+   .disable = 110,
+   .unprepare = 1000,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   .connector_type = DRM_MODE_CONNECTOR_LVDS,
+};
+
 static const struct display_timing auo_p320hvn03_timings = {
.pixelclock = { 10600, 14850, 16400 },
.hactive = { 1920, 1920, 1920 },
@@ -3497,6 +3527,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "auo,g185han01",
.data = _g185han01,
+   }, {
+   .compatible = "auo,g190ean01",
+   .data = _g190ean01,
}, {
.compatible = "auo,p320hvn03",
.data = _p320hvn03,
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 0/3] Add multiple AUO panels

2020-04-16 Thread Sebastian Reichel
Hi,

Patches are more or less independent of each other. There
was a previous version for the 12" and 15" panels, which
was missing the DT binding update. The 19" patch is new,
for the previous 10" panel a different patch has been merged
in the meantime.

-- Sebastian

Sebastian Reichel (3):
  drm/panel: simple: Add support for AUO G190EAN01 panel
  drm/panel: simple: Add support for AUO G156XTN01.0 panel
  drm/panel: simple: Add support for AUO G121EAN01.4 panel

 .../bindings/display/panel/panel-simple.yaml  |  6 ++
 drivers/gpu/drm/panel/panel-simple.c  | 89 +++
 2 files changed, 95 insertions(+)

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 3/3] drm/panel: simple: Add support for AUO G121EAN01.4 panel

2020-04-16 Thread Sebastian Reichel
Add timings for the AUO G121EAN01.4 panel.

Signed-off-by: Sebastian Reichel 
---
 .../bindings/display/panel/panel-simple.yaml  |  2 ++
 drivers/gpu/drm/panel/panel-simple.c  | 28 +++
 2 files changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
index b3f1f4c83da6..db05bfc0fa6a 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
@@ -55,6 +55,8 @@ properties:
   - auo,g101evn010
 # AU Optronics Corporation 10.4" (800x600) color TFT LCD panel
   - auo,g104sn02
+# AU Optronics Corporation 12.1" (1280x800) TFT LCD panel
+  - auo,g121ean01
 # AU Optronics Corporation 13.3" FHD (1920x1080) TFT LCD panel
   - auo,g133han01
 # AU Optronics Corporation 15.6" (1366x768) TFT LCD panel
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index a80dced09b16..e1979952691e 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -873,6 +873,31 @@ static const struct panel_desc auo_g104sn02 = {
},
 };
 
+static const struct drm_display_mode auo_g121ean01_mode = {
+   .clock = 66700,
+   .hdisplay = 1280,
+   .hsync_start = 1280 + 58,
+   .hsync_end = 1280 + 58 + 8,
+   .htotal = 1280 + 58 + 8 + 70,
+   .vdisplay = 800,
+   .vsync_start = 800 + 6,
+   .vsync_end = 800 + 6 + 4,
+   .vtotal = 800 + 6 + 4 + 10,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc auo_g121ean01 = {
+   .modes = _g121ean01_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 261,
+   .height = 163,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   .connector_type = DRM_MODE_CONNECTOR_LVDS,
+};
+
 static const struct display_timing auo_g133han01_timings = {
.pixelclock = { 13400, 14120, 14900 },
.hactive = { 1920, 1920, 1920 },
@@ -3546,6 +3571,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "auo,g104sn02",
.data = _g104sn02,
+   }, {
+   .compatible = "auo,g121ean01",
+   .data = _g121ean01,
}, {
.compatible = "auo,g133han01",
.data = _g133han01,
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 2/3] drm/panel: simple: Add support for AUO G156XTN01.0 panel

2020-04-16 Thread Sebastian Reichel
Add timings for the AUO G156XTN01.0 panel.

Signed-off-by: Sebastian Reichel 
---
 .../bindings/display/panel/panel-simple.yaml  |  2 ++
 drivers/gpu/drm/panel/panel-simple.c  | 28 +++
 2 files changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
index 7c9a08d846b9..b3f1f4c83da6 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
@@ -57,6 +57,8 @@ properties:
   - auo,g104sn02
 # AU Optronics Corporation 13.3" FHD (1920x1080) TFT LCD panel
   - auo,g133han01
+# AU Optronics Corporation 15.6" (1366x768) TFT LCD panel
+  - auo,g156xtn01
 # AU Optronics Corporation 18.5" FHD (1920x1080) TFT LCD panel
   - auo,g185han01
 # AU Optronics Corporation 19.0" (1280x1024) TFT LCD panel
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 8d1cf68ca01b..a80dced09b16 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -903,6 +903,31 @@ static const struct panel_desc auo_g133han01 = {
.connector_type = DRM_MODE_CONNECTOR_LVDS,
 };
 
+static const struct drm_display_mode auo_g156xtn01_mode = {
+   .clock = 76000,
+   .hdisplay = 1366,
+   .hsync_start = 1366 + 33,
+   .hsync_end = 1366 + 33 + 67,
+   .htotal = 1560,
+   .vdisplay = 768,
+   .vsync_start = 768 + 4,
+   .vsync_end = 768 + 4 + 4,
+   .vtotal = 806,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc auo_g156xtn01 = {
+   .modes = _g156xtn01_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 344,
+   .height = 194,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   .connector_type = DRM_MODE_CONNECTOR_LVDS,
+};
+
 static const struct display_timing auo_g185han01_timings = {
.pixelclock = { 12000, 14400, 17500 },
.hactive = { 1920, 1920, 1920 },
@@ -3524,6 +3549,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "auo,g133han01",
.data = _g133han01,
+   }, {
+   .compatible = "auo,g156xtn01",
+   .data = _g156xtn01,
}, {
.compatible = "auo,g185han01",
.data = _g185han01,
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv1] gpu: ipu-v3: Add 8 pixel alignment fix

2020-09-11 Thread Sebastian Reichel
Some standard (but unusual) resolutions like 1366x768 do not work
properly with i.MX6 SoCs, since the horizontal resolution needs to
be aligned to 8 pixels (so 1360x768 or 1368x768 work).

This patch allocates framebuffers allocated to 8 pixels. The extra
time required to send the additional pixels is removed from the blank
time. In order to expose the correct display size to userspace, the
stride is increased without increasing the width.

Without this patch, system hangs on an imx6dl board with 1366x768
panel connected via LVDS (and will be rebooted by watchdog). Last
message printed by a kernel at default loglevel is:

[1.876609] [drm] Initialized imx-drm 1.0.0 20120507 for display-subsystem 
on minor 1

After this patch the system boots fine and it is possible to start
X.org and Weston from Debian testing.

Suggested-by: Boris Brezillon 
Signed-off-by: Sebastian Reichel 
---
Hi,

I could not find much about the 8 pixel requirement in the datasheets,
but the problem is real and the NXP kernel has an alignment fix for
this. I think this was not yet detected because resolutions with width
not being a multiply of 8 are not that common.

PS: I'm on vacation for two weeks, so take your time reviewing this
and don't expect timely replies from me :)

-- Sebastian
---
 drivers/gpu/drm/imx/imx-drm-core.c | 26 +-
 drivers/gpu/drm/imx/ipuv3-crtc.c   | 11 ++-
 drivers/gpu/drm/imx/ipuv3-plane.c  | 18 ++
 drivers/gpu/ipu-v3/ipu-dc.c|  5 +
 drivers/gpu/ipu-v3/ipu-di.c|  7 +++
 5 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
b/drivers/gpu/drm/imx/imx-drm-core.c
index 7d00c49fd5a5..c4d904ecb517 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -144,9 +144,33 @@ static const struct drm_ioctl_desc imx_drm_ioctls[] = {
/* none so far */
 };
 
+static int imx_drm_dumb_create(struct drm_file *file_priv,
+  struct drm_device *drm,
+  struct drm_mode_create_dumb *args)
+{
+   u32 width = args->width;
+   int ret;
+
+   /*
+* Width must be multiple of 8 pixels or system will hang. This
+* generates a big enough buffer, so that we can send a few 'dead'
+* pixels to satisfy this requirement. Userspace is supposed to
+* see 'correct' panel resolution instead, so that it does not
+* render content into non-visible pixels.
+*/
+   args->width = ALIGN(width, 8);
+
+   ret = drm_gem_cma_dumb_create(file_priv, drm, args);
+   if (ret)
+   return ret;
+
+   args->width = width;
+   return ret;
+}
+
 static struct drm_driver imx_drm_driver = {
.driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
-   DRM_GEM_CMA_DRIVER_OPS,
+   DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(imx_drm_dumb_create),
.ioctls = imx_drm_ioctls,
.num_ioctls = ARRAY_SIZE(imx_drm_ioctls),
.fops   = _drm_driver_fops,
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index d412fc265395..87a408e77694 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -301,10 +301,19 @@ static void ipu_crtc_mode_set_nofb(struct drm_crtc *crtc)
sig_cfg.vsync_pin = imx_crtc_state->di_vsync_pin;
 
drm_display_mode_to_videomode(mode, _cfg.mode);
+   if (!IS_ALIGNED(sig_cfg.mode.hactive, 8)) {
+   unsigned int new_hactive = ALIGN(sig_cfg.mode.hactive, 8);
+
+   dev_info(ipu_crtc->dev, "8-pixel alignment change hactive %d -> 
%d\n",
+sig_cfg.mode.hactive, new_hactive);
+
+   sig_cfg.mode.hfront_porch = new_hactive - sig_cfg.mode.hactive;
+   sig_cfg.mode.hactive = new_hactive;
+   }
 
ipu_dc_init_sync(ipu_crtc->dc, ipu_crtc->di,
 mode->flags & DRM_MODE_FLAG_INTERLACE,
-imx_crtc_state->bus_format, mode->hdisplay);
+imx_crtc_state->bus_format, sig_cfg.mode.hactive);
ipu_di_init_sync_panel(ipu_crtc->di, _cfg);
 }
 
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index 6776ebb3246d..3e33dc59f454 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -29,6 +29,11 @@ to_ipu_plane_state(struct drm_plane_state *p)
return container_of(p, struct ipu_plane_state, base);
 }
 
+static unsigned int ipu_src_rect_width(const struct drm_plane_state *state)
+{
+   return ALIGN(drm_rect_width(>src) >> 16, 8);
+}
+
 static inline struct ipu_plane *to_ipu_plane(struct drm_plane *p)
 {
return container_of(p, struct ipu_plane, base);
@@ -418,6 +423,11 @@ static int ipu_plane_atomic_check(struct dr

Re: [PATCH 4/4] dt-bindings: Explicitly allow additional properties in common schemas

2020-10-05 Thread Sebastian Reichel
Hi,

On Mon, Oct 05, 2020 at 01:38:30PM -0500, Rob Herring wrote:
> In order to add meta-schema checks for additional/unevaluatedProperties
> being present, all schema need to make this explicit. As common/shared
> schema are included by other schemas, they should always allow for
> additionalProperties.
> 
> Signed-off-by: Rob Herring 
> ---
>  [...]
>  .../devicetree/bindings/power/supply/power-supply.yaml   | 2 ++
>  [...]

Acked-by: Sebastian Reichel 

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] dt-bindings: Another round of adding missing 'additionalProperties'

2020-10-05 Thread Sebastian Reichel
On Fri, Oct 02, 2020 at 06:41:43PM -0500, Rob Herring wrote:
> Another round of wack-a-mole. The json-schema default is additional
> unknown properties are allowed, but for DT all properties should be
> defined.
> 
> Signed-off-by: Rob Herring 
> ---
> 
> I'll take this thru the DT tree.
> 
>  [...]
>  .../bindings/power/supply/cw2015_battery.yaml |  2 ++
>  .../bindings/power/supply/rohm,bd99954.yaml   |  8 ++++
> [...]

Acked-by: Sebastian Reichel 

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 23/24] drm/omap: display: Backlight update

2020-08-29 Thread Sebastian Reichel

Hi,

On Sun, Aug 23, 2020 at 12:45:31PM +0200, Sam Ravnborg wrote:
> - Introduce backlight_{enable/disable)
> - Use get/set methods for backlight_properties
> - Drop redundant get_brightness() implementation
>   The default implementation return the current brightness value
> - Use macro for backlight initialization
> 
> v2:
>   - Drop backlight_update() call as it is redundant (Sebastian)
> 
> Signed-off-by: Sam Ravnborg 
> Cc: Tomi Valkeinen 
> Cc: Sebastian Reichel 
> Cc: Laurent Pinchart 
> Cc: Zheng Bin 
> Cc: Sam Ravnborg 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 37 +++
>  1 file changed, 6 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 3484b5d4a91c..39b3a7affbc8 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -110,17 +110,10 @@ static void dsicm_bl_power(struct panel_drv_data 
> *ddata, bool enable)
>   else
>   return;
>  
> - if (enable) {
> - backlight->props.fb_blank = FB_BLANK_UNBLANK;
> - backlight->props.state = ~(BL_CORE_FBBLANK | BL_CORE_SUSPENDED);
> - backlight->props.power = FB_BLANK_UNBLANK;
> - } else {
> - backlight->props.fb_blank = FB_BLANK_NORMAL;
> - backlight->props.power = FB_BLANK_POWERDOWN;
> - backlight->props.state |= BL_CORE_FBBLANK | BL_CORE_SUSPENDED;
> - }
> -
> - backlight_update_status(backlight);
> + if (enable)
> + backlight_enable(backlight);
> + else
> + backlight_disable(backlight);
>  }
>  
>  static void hw_guard_start(struct panel_drv_data *ddata, int guard_msec)
> @@ -363,13 +356,7 @@ static int dsicm_bl_update_status(struct 
> backlight_device *dev)
>   struct panel_drv_data *ddata = dev_get_drvdata(>dev);
>   struct omap_dss_device *src = ddata->src;
>   int r = 0;
> - int level;
> -
> - if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
> - dev->props.power == FB_BLANK_UNBLANK)
> - level = dev->props.brightness;
> - else
> - level = 0;
> + int level = backlight_get_brightness(dev);
>  
>   dev_dbg(>pdev->dev, "update brightness to %d\n", level);
>  
> @@ -390,17 +377,7 @@ static int dsicm_bl_update_status(struct 
> backlight_device *dev)
>   return r;
>  }
>  
> -static int dsicm_bl_get_intensity(struct backlight_device *dev)
> -{
> - if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
> - dev->props.power == FB_BLANK_UNBLANK)
> - return dev->props.brightness;
> -
> - return 0;
> -}
> -
>  static const struct backlight_ops dsicm_bl_ops = {
> - .get_brightness = dsicm_bl_get_intensity,
>   .update_status  = dsicm_bl_update_status,
>  };
>  
> @@ -1305,9 +1282,7 @@ static int dsicm_probe(struct platform_device *pdev)
>   dsicm_hw_reset(ddata);
>  
>   if (ddata->use_dsi_backlight) {
> - struct backlight_properties props = { 0 };
> - props.max_brightness = 255;
> - props.type = BACKLIGHT_RAW;
> + DECLARE_BACKLIGHT_INIT_RAW(props, 0, 255);
>  
>   bldev = devm_backlight_device_register(dev, dev_name(dev),
>   dev, ddata, _bl_ops, );
> -- 
> 2.25.1
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] MAINTAINERS: add Dan Murphy as TP LP8xxx drivers maintainer

2020-09-29 Thread Sebastian Reichel
Hi,

On Thu, Sep 24, 2020 at 01:23:31PM +0100, Lee Jones wrote:
> On Thu, 24 Sep 2020, Krzysztof Kozlowski wrote:
> 
> > On Wed, 23 Sep 2020 at 22:01, Jonathan Cameron  wrote:
> > >
> > > On Wed, 23 Sep 2020 11:53:33 -0500
> > > Dan Murphy  wrote:
> > >
> > > > Hello
> > > >
> > > > On 9/22/20 10:28 AM, Krzysztof Kozlowski wrote:
> > > > > Milo Kim's email in TI bounces with permanent error (550: Invalid
> > > > > recipient).  Last email from him on LKML was in 2017.  Move Milo Kim 
> > > > > to
> > > > > credits and add Dan Murphy from TI to look after:
> > > > >   - TI LP855x backlight driver,
> > > > >   - TI LP8727 charger driver,
> > > > >   - TI LP8788 MFD (ADC, LEDs, charger and regulator) drivers.
> > > > >
> > > > > Cc: Dan Murphy 
> > > > > Signed-off-by: Krzysztof Kozlowski 
> > > >
> > > > Acked-by: Dan Murphy 
> > > >
> > > Not sure who will pick this one up, but
> > > Acked-by: Jonathan Cameron 
> > 
> > I guess whoever is first. :)
> > This spans across systems but the common part is MFD, so maybe Lee -
> > could you pick it up?
> 
> Yes, I'll handle it.

Acked-by: Sebastian Reichel 

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 0/4] Subject: panel-dsi-cm: update bindings

2020-07-17 Thread Sebastian Reichel
The cleanup series for omapdrm's DSI code got too big. Reviewing
this is not fun and the same goes for keeping track of the change
requests. Let's do the cleanup in smaller steps instead. This is
the first batch, which updates the binding (txt -> yaml) and
modifies the DT slightly.

Changes since PATCHv1 [0]:

PATCHv1..PATCHv2:
 * Update binding as suggested by Sam
  * Remove 'port' from required list
  * Drop 'lanes' and 'port' from example ('lanes' is a port property
used by OMAP's DSI controller)
  * Drop the label from example
  * Add '...' at end of file
 * Fix , in patch description from patch 2
 * Apply Reviewed-by tags

[0] 
https://lore.kernel.org/dri-devel/20200629223315.118256-1-sebastian.reic...@collabora.com/

-- Sebastian

Sebastian Reichel (4):
  dt-bindings: display: panel-dsi-cm: convert to YAML
  ARM: dts: omap: add channel to DSI panels
  ARM: dts: omap4-droid4: add panel compatible
  ARM: dts: omap4-droid4: add panel orientation

 .../bindings/display/panel/panel-dsi-cm.txt   | 29 ---
 .../bindings/display/panel/panel-dsi-cm.yaml  | 86 +++
 .../boot/dts/motorola-mapphone-common.dtsi|  6 +-
 arch/arm/boot/dts/omap3-n950.dts  |  3 +-
 arch/arm/boot/dts/omap3.dtsi  |  3 +
 arch/arm/boot/dts/omap4-sdp.dts   |  6 +-
 arch/arm/boot/dts/omap4.dtsi  |  6 ++
 arch/arm/boot/dts/omap5.dtsi  |  6 ++
 8 files changed, 111 insertions(+), 34 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml

-- 
2.27.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 1/4] dt-bindings: display: panel-dsi-cm: convert to YAML

2020-07-17 Thread Sebastian Reichel
Convert panel-dsi-cm bindings to YAML and add
missing properties while at it.

Reviewed-by: Laurent Pinchart 
Reviewed-by: Rob Herring 
Signed-off-by: Sebastian Reichel 
---
 .../bindings/display/panel/panel-dsi-cm.txt   | 29 ---
 .../bindings/display/panel/panel-dsi-cm.yaml  | 86 +++
 2 files changed, 86 insertions(+), 29 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml

diff --git a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt 
b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
deleted file mode 100644
index dce48eb9db57..
--- a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-Generic MIPI DSI Command Mode Panel
-===
-
-Required properties:
-- compatible: "panel-dsi-cm"
-
-Optional properties:
-- label: a symbolic name for the panel
-- reset-gpios: panel reset gpio
-- te-gpios: panel TE gpio
-
-Required nodes:
-- Video port for DSI input
-
-Example

-
-lcd0: display {
-   compatible = "tpo,taal", "panel-dsi-cm";
-   label = "lcd0";
-
-   reset-gpios = < 6 GPIO_ACTIVE_HIGH>;
-
-   port {
-   lcd0_in: endpoint {
-   remote-endpoint = <_out_ep>;
-   };
-   };
-};
diff --git a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml
new file mode 100644
index ..d766c949c622
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/panel-dsi-cm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: DSI command mode panels
+
+maintainers:
+  - Tomi Valkeinen 
+  - Sebastian Reichel 
+
+description: |
+  This binding file is a collection of the DSI panels that
+  are usually driven in command mode. If no backlight is
+  referenced via the optional backlight property, the DSI
+  panel is assumed to have native backlight support.
+  The panel may use an OF graph binding for the association
+  to the display, or it may be a direct child node of the
+  display.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+
+  compatible:
+items:
+  - enum:
+- motorola,droid4-panel# Panel from Motorola Droid4 phone
+- nokia,himalaya   # Panel from Nokia N950 phone
+- tpo,taal # Panel from OMAP4 SDP board
+  - const: panel-dsi-cm# Generic DSI command mode panel 
compatible fallback
+
+  reg:
+maxItems: 1
+description: DSI virtual channel
+
+  vddi-supply:
+description:
+  Display panels require power to be supplied. While several panels need
+  more than one power supply with panel-specific constraints governing the
+  order and timings of the power supplies, in many cases a single power
+  supply is sufficient, either because the panel has a single power rail, 
or
+  because all its power rails can be driven by the same supply. In that 
case
+  the vddi-supply property specifies the supply powering the panel as a
+  phandle to a regulator.
+
+  vpnl-supply:
+description:
+  When the display panel needs a second power supply, this property can be
+  used in addition to vddi-supply. Both supplies will be enabled at the
+  same time before the panel is being accessed.
+
+  width-mm: true
+  height-mm: true
+  label: true
+  rotation: true
+  panel-timing: true
+  port: true
+  reset-gpios: true
+  te-gpios: true
+  backlight: true
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+#include 
+
+dsi-controller {
+#address-cells = <1>;
+#size-cells = <0>;
+
+panel@0 {
+compatible = "tpo,taal", "panel-dsi-cm";
+reg = <0>;
+reset-gpios = < 6 GPIO_ACTIVE_HIGH>;
+};
+};
+
+...
-- 
2.27.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 4/4] ARM: dts: omap4-droid4: add panel orientation

2020-07-17 Thread Sebastian Reichel
Add information about panel orientation, so that the
system boots into a properly rotated shell.

Reviewed-by: Laurent Pinchart 
Signed-off-by: Sebastian Reichel 
---
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
index 0e22fdfa42aa..e672e714fcbe 100644
--- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
+++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
@@ -218,6 +218,7 @@ lcd0: panel@0 {
 
width-mm = <50>;
height-mm = <89>;
+   rotation = <90>;
 
panel-timing {
clock-frequency = <0>;  /* Calculated by dsi */
-- 
2.27.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 2/4] ARM: dts: omap: add channel to DSI panels

2020-07-17 Thread Sebastian Reichel
The standard binding for DSI requires that the channel number
of the panel is encoded in DT. This adds the channel number in
all OMAP3-5 boards in preparation for using common infrastructure.

Reviewed-by: Laurent Pinchart 
Signed-off-by: Sebastian Reichel 
---
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 3 ++-
 arch/arm/boot/dts/omap3-n950.dts| 3 ++-
 arch/arm/boot/dts/omap3.dtsi| 3 +++
 arch/arm/boot/dts/omap4-sdp.dts | 6 --
 arch/arm/boot/dts/omap4.dtsi| 6 ++
 arch/arm/boot/dts/omap5.dtsi| 6 ++
 6 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
index 06fbffa81636..4ffe461c3808 100644
--- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
+++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
@@ -207,8 +207,9 @@ dsi1_out_ep: endpoint {
};
};
 
-   lcd0: display {
+   lcd0: panel@0 {
compatible = "panel-dsi-cm";
+   reg = <0>;
label = "lcd0";
vddi-supply = <_regulator>;
reset-gpios = < 5 GPIO_ACTIVE_HIGH>;  /* gpio101 */
diff --git a/arch/arm/boot/dts/omap3-n950.dts b/arch/arm/boot/dts/omap3-n950.dts
index 31d47a1fad84..80cf4e1177da 100644
--- a/arch/arm/boot/dts/omap3-n950.dts
+++ b/arch/arm/boot/dts/omap3-n950.dts
@@ -225,8 +225,9 @@ dsi_out_ep: endpoint {
};
};
 
-   lcd0: display {
+   lcd0: panel@0 {
compatible = "nokia,himalaya", "panel-dsi-cm";
+   reg = <0>;
label = "lcd0";
 
pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 1296d0643943..0ebbb6c11f04 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -898,6 +898,9 @@ dsi: encoder@4804fc00 {
ti,hwmods = "dss_dsi1";
clocks = <_alwon_fck>, <_alwon_fck>;
clock-names = "fck", "sys_clk";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
};
 
rfbi: encoder@48050800 {
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 91480ac1f328..8a8307517dab 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -662,8 +662,9 @@ dsi1_out_ep: endpoint {
};
};
 
-   lcd0: display {
+   lcd0: panel@0 {
compatible = "tpo,taal", "panel-dsi-cm";
+   reg = <0>;
label = "lcd0";
 
reset-gpios = < 6 GPIO_ACTIVE_HIGH>;  /* 102 */
@@ -687,8 +688,9 @@ dsi2_out_ep: endpoint {
};
};
 
-   lcd1: display {
+   lcd1: panel@0 {
compatible = "tpo,taal", "panel-dsi-cm";
+   reg = <0>;
label = "lcd1";
 
reset-gpios = < 8 GPIO_ACTIVE_HIGH>;  /* 104 */
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 4400f5f8e099..c5b426616443 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -551,6 +551,9 @@ dsi1: encoder@0 {
clocks = <_dss_clkctrl 
OMAP4_DSS_CORE_CLKCTRL 8>,
 <_dss_clkctrl 
OMAP4_DSS_CORE_CLKCTRL 10>;
clock-names = "fck", "sys_clk";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
};
};
 
@@ -583,6 +586,9 @@ dsi2: encoder@0 {
clocks = <_dss_clkctrl 
OMAP4_DSS_CORE_CLKCTRL 8>,
 <_dss_clkctrl 
OMAP4_DSS_CORE_CLKCTRL 10>;
clock-names = "fck", "sys_clk";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
};
};
 
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index fb889c5b00c9..0855c0a4050f 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -491,6 +491,9 @@ dsi1: enco

[PATCHv2 3/4] ARM: dts: omap4-droid4: add panel compatible

2020-07-17 Thread Sebastian Reichel
Add Droid 4 specific compatible value in addition to the
generic one, so that we have the ability to add panel
specific quirks in the future.

Reviewed-by: Laurent Pinchart 
Signed-off-by: Sebastian Reichel 
---
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
index 4ffe461c3808..0e22fdfa42aa 100644
--- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
+++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
@@ -208,7 +208,7 @@ dsi1_out_ep: endpoint {
};
 
lcd0: panel@0 {
-   compatible = "panel-dsi-cm";
+   compatible = "motorola,droid4-panel", "panel-dsi-cm";
reg = <0>;
label = "lcd0";
vddi-supply = <_regulator>;
-- 
2.27.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1 21/22] drm/omap: display: Backlight update

2020-08-02 Thread Sebastian Reichel
Hi,

On Sun, Aug 02, 2020 at 01:06:35PM +0200, Sam Ravnborg wrote:
> - Introduce backlight_{enable/disable)
> - Use get/set methods for backlight_properties
> - Drop redundant get_brightness() implementation
>   The default implementation return the current brightness value
> - Use macro for backlight initialization
> 
> Signed-off-by: Sam Ravnborg 
> Cc: Tomi Valkeinen 
> Cc: Sebastian Reichel 
> Cc: Laurent Pinchart 
> Cc: Zheng Bin 
> Cc: Sam Ravnborg 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 35 ---
>  1 file changed, 6 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 3484b5d4a91c..433e240896b3 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -110,15 +110,10 @@ static void dsicm_bl_power(struct panel_drv_data 
> *ddata, bool enable)
>   else
>   return;
>  
> - if (enable) {
> - backlight->props.fb_blank = FB_BLANK_UNBLANK;
> - backlight->props.state = ~(BL_CORE_FBBLANK | BL_CORE_SUSPENDED);
> - backlight->props.power = FB_BLANK_UNBLANK;
> - } else {
> - backlight->props.fb_blank = FB_BLANK_NORMAL;
> - backlight->props.power = FB_BLANK_POWERDOWN;
> - backlight->props.state |= BL_CORE_FBBLANK | BL_CORE_SUSPENDED;
> - }
> + if (enable)
> + backlight_enable(backlight);
> + else
> + backlight_disable(backlight);
>  
>   backlight_update_status(backlight);

backlight_update_status() is already called by backlight_enable/disable.

-- Sebastian
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1 21/22] drm/omap: display: Backlight update

2020-08-02 Thread Sebastian Reichel
Hi,

On Sun, Aug 02, 2020 at 04:32:07PM +0200, Sam Ravnborg wrote:
> On Sun, Aug 02, 2020 at 04:26:05PM +0200, Sebastian Reichel wrote:
> > On Sun, Aug 02, 2020 at 01:06:35PM +0200, Sam Ravnborg wrote:
> > > - Introduce backlight_{enable/disable)
> > > - Use get/set methods for backlight_properties
> > > - Drop redundant get_brightness() implementation
> > >   The default implementation return the current brightness value
> > > - Use macro for backlight initialization
> > > 
> > > Signed-off-by: Sam Ravnborg 
> > > Cc: Tomi Valkeinen 
> > > Cc: Sebastian Reichel 
> > > Cc: Laurent Pinchart 
> > > Cc: Zheng Bin 
> > > Cc: Sam Ravnborg 
> > > ---
> > >  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 35 ---
> > >  1 file changed, 6 insertions(+), 29 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> > > b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > > index 3484b5d4a91c..433e240896b3 100644
> > > --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > > +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > > @@ -110,15 +110,10 @@ static void dsicm_bl_power(struct panel_drv_data 
> > > *ddata, bool enable)
> > >   else
> > >   return;
> > >  
> > > - if (enable) {
> > > - backlight->props.fb_blank = FB_BLANK_UNBLANK;
> > > - backlight->props.state = ~(BL_CORE_FBBLANK | BL_CORE_SUSPENDED);
> > > - backlight->props.power = FB_BLANK_UNBLANK;
> > > - } else {
> > > - backlight->props.fb_blank = FB_BLANK_NORMAL;
> > > - backlight->props.power = FB_BLANK_POWERDOWN;
> > > - backlight->props.state |= BL_CORE_FBBLANK | BL_CORE_SUSPENDED;
> > > - }
> > > + if (enable)
> > > + backlight_enable(backlight);
> > > + else
> > > + backlight_disable(backlight);
> > >  
> > >   backlight_update_status(backlight);
> > 
> > backlight_update_status() is already called by backlight_enable/disable.
> 
> Right, thanks.
> Dropped in v2.
> 
> Let me know if you already have a similar patch and if I shall
> drop this.

I did not touch the backlight bits and I can easily rebase my patches. I think
this should be kept.

> It would be nice to have the panel parts of omapdrm migrated in
> this cycle. I recall you have 50+ patches pending.

I plan to send only the first part and go step by step.

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv1 3/4] ARM: dts: omap4-droid4: add panel compatible

2020-06-30 Thread Sebastian Reichel
Add Droid 4 specific compatible value in addition to the
generic one, so that we have the ability to add panel
specific quirks in the future.

Signed-off-by: Sebastian Reichel 
---
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
index 4ffe461c3808..0e22fdfa42aa 100644
--- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
+++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
@@ -208,7 +208,7 @@ dsi1_out_ep: endpoint {
};
 
lcd0: panel@0 {
-   compatible = "panel-dsi-cm";
+   compatible = "motorola,droid4-panel", "panel-dsi-cm";
reg = <0>;
label = "lcd0";
vddi-supply = <_regulator>;
-- 
2.27.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv1 0/4] panel-dsi-cm: update bindings

2020-06-30 Thread Sebastian Reichel
Subject: panel-dsi-cm: update bindings

The cleanup series for omapdrm's DSI code got too big. Reviewing
this is not fun and the same goes for keeping track of the change
requests. Let's do the cleanup in smaller steps instead. This is
the first batch, which updates the binding (txt -> yaml) and
modifies the DT slightly.

-- Sebastian

Sebastian Reichel (4):
  dt-bindings: display: panel-dsi-cm: convert to YAML
  ARM: dts: omap: add channel to DSI panels
  ARM: dts: omap4-droid4: add panel compatible
  ARM: dts: omap4-droid4: add panel orientation

 .../bindings/display/panel/panel-dsi-cm.txt   |  29 -
 .../bindings/display/panel/panel-dsi-cm.yaml  | 100 ++
 .../boot/dts/motorola-mapphone-common.dtsi|   6 +-
 arch/arm/boot/dts/omap3-n950.dts  |   3 +-
 arch/arm/boot/dts/omap3.dtsi  |   3 +
 arch/arm/boot/dts/omap4-sdp.dts   |   6 +-
 arch/arm/boot/dts/omap4.dtsi  |   6 ++
 arch/arm/boot/dts/omap5.dtsi  |   6 ++
 8 files changed, 125 insertions(+), 34 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml

-- 
2.27.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv1 1/4] dt-bindings: display: panel-dsi-cm: convert to YAML

2020-06-30 Thread Sebastian Reichel
Convert panel-dsi-cm bindings to YAML and add
missing properties while at it.

Signed-off-by: Sebastian Reichel 
---
 .../bindings/display/panel/panel-dsi-cm.txt   |  29 -
 .../bindings/display/panel/panel-dsi-cm.yaml  | 100 ++
 2 files changed, 100 insertions(+), 29 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml

diff --git a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt 
b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
deleted file mode 100644
index dce48eb9db57..
--- a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-Generic MIPI DSI Command Mode Panel
-===
-
-Required properties:
-- compatible: "panel-dsi-cm"
-
-Optional properties:
-- label: a symbolic name for the panel
-- reset-gpios: panel reset gpio
-- te-gpios: panel TE gpio
-
-Required nodes:
-- Video port for DSI input
-
-Example

-
-lcd0: display {
-   compatible = "tpo,taal", "panel-dsi-cm";
-   label = "lcd0";
-
-   reset-gpios = < 6 GPIO_ACTIVE_HIGH>;
-
-   port {
-   lcd0_in: endpoint {
-   remote-endpoint = <_out_ep>;
-   };
-   };
-};
diff --git a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml
new file mode 100644
index ..8d6a20f26470
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/panel-dsi-cm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: DSI command mode panels
+
+maintainers:
+  - Tomi Valkeinen 
+  - Sebastian Reichel 
+
+description: |
+  This binding file is a collection of the DSI panels that
+  are usually driven in command mode. If no backlight is
+  referenced via the optional backlight property, the DSI
+  panel is assumed to have native backlight support.
+  The panel may use an OF graph binding for the association
+  to the display, or it may be a direct child node of the
+  display.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+
+  compatible:
+items:
+  - enum:
+- motorola,droid4-panel# Panel from Motorola Droid4 phone
+- nokia,himalaya   # Panel from Nokia N950 phone
+- tpo,taal # Panel from OMAP4 SDP board
+  - const: panel-dsi-cm# Generic DSI command mode panel 
compatible fallback
+
+  reg:
+maxItems: 1
+description: DSI virtual channel
+
+  vddi-supply:
+description:
+  Display panels require power to be supplied. While several panels need
+  more than one power supply with panel-specific constraints governing the
+  order and timings of the power supplies, in many cases a single power
+  supply is sufficient, either because the panel has a single power rail, 
or
+  because all its power rails can be driven by the same supply. In that 
case
+  the vddi-supply property specifies the supply powering the panel as a
+  phandle to a regulator.
+
+  vpnl-supply:
+description:
+  When the display panel needs a second power supply, this property can be
+  used in addition to vddi-supply. Both supplies will be enabled at the
+  same time before the panel is being accessed.
+
+  width-mm: true
+  height-mm: true
+  label: true
+  rotation: true
+  panel-timing: true
+  port: true
+  reset-gpios: true
+  te-gpios: true
+  backlight: true
+
+additionalProperties: false
+
+required:
+  - compatible
+  - port
+  - reg
+
+examples:
+  - |
+#include 
+
+dsi-controller {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port {
+dsi1_out_ep: endpoint {
+  remote-endpoint = <_in>;
+  lanes = <0 1 2 3 4 5>;
+};
+  };
+
+  panel@0 {
+compatible = "tpo,taal", "panel-dsi-cm";
+label = "lcd0";
+reg = <0>;
+reset-gpios = < 6 GPIO_ACTIVE_HIGH>;
+
+port {
+  lcd0_in: endpoint {
+remote-endpoint = <_out_ep>;
+  };
+};
+  };
+
+};
-- 
2.27.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv1 4/4] ARM: dts: omap4-droid4: add panel orientation

2020-06-30 Thread Sebastian Reichel
Add information about panel orientation, so that the
system boots into a properly rotated shell.

Signed-off-by: Sebastian Reichel 
---
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
index 0e22fdfa42aa..e672e714fcbe 100644
--- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
+++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
@@ -218,6 +218,7 @@ lcd0: panel@0 {
 
width-mm = <50>;
height-mm = <89>;
+   rotation = <90>;
 
panel-timing {
clock-frequency = <0>;  /* Calculated by dsi */
-- 
2.27.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv1 2/4] ARM: dts: omap: add channel to DSI panels

2020-06-30 Thread Sebastian Reichel
The standard binding for DSI requires, that the channel number
of the panel is encoded in DT. This adds the channel number in
all OMAP3-5 boards, in preparation for using common infrastructure.

Signed-off-by: Sebastian Reichel 
---
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 3 ++-
 arch/arm/boot/dts/omap3-n950.dts| 3 ++-
 arch/arm/boot/dts/omap3.dtsi| 3 +++
 arch/arm/boot/dts/omap4-sdp.dts | 6 --
 arch/arm/boot/dts/omap4.dtsi| 6 ++
 arch/arm/boot/dts/omap5.dtsi| 6 ++
 6 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/motorola-mapphone-common.dtsi 
b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
index 06fbffa81636..4ffe461c3808 100644
--- a/arch/arm/boot/dts/motorola-mapphone-common.dtsi
+++ b/arch/arm/boot/dts/motorola-mapphone-common.dtsi
@@ -207,8 +207,9 @@ dsi1_out_ep: endpoint {
};
};
 
-   lcd0: display {
+   lcd0: panel@0 {
compatible = "panel-dsi-cm";
+   reg = <0>;
label = "lcd0";
vddi-supply = <_regulator>;
reset-gpios = < 5 GPIO_ACTIVE_HIGH>;  /* gpio101 */
diff --git a/arch/arm/boot/dts/omap3-n950.dts b/arch/arm/boot/dts/omap3-n950.dts
index 31d47a1fad84..80cf4e1177da 100644
--- a/arch/arm/boot/dts/omap3-n950.dts
+++ b/arch/arm/boot/dts/omap3-n950.dts
@@ -225,8 +225,9 @@ dsi_out_ep: endpoint {
};
};
 
-   lcd0: display {
+   lcd0: panel@0 {
compatible = "nokia,himalaya", "panel-dsi-cm";
+   reg = <0>;
label = "lcd0";
 
pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 1296d0643943..0ebbb6c11f04 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -898,6 +898,9 @@ dsi: encoder@4804fc00 {
ti,hwmods = "dss_dsi1";
clocks = <_alwon_fck>, <_alwon_fck>;
clock-names = "fck", "sys_clk";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
};
 
rfbi: encoder@48050800 {
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 91480ac1f328..8a8307517dab 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -662,8 +662,9 @@ dsi1_out_ep: endpoint {
};
};
 
-   lcd0: display {
+   lcd0: panel@0 {
compatible = "tpo,taal", "panel-dsi-cm";
+   reg = <0>;
label = "lcd0";
 
reset-gpios = < 6 GPIO_ACTIVE_HIGH>;  /* 102 */
@@ -687,8 +688,9 @@ dsi2_out_ep: endpoint {
};
};
 
-   lcd1: display {
+   lcd1: panel@0 {
compatible = "tpo,taal", "panel-dsi-cm";
+   reg = <0>;
label = "lcd1";
 
reset-gpios = < 8 GPIO_ACTIVE_HIGH>;  /* 104 */
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 4400f5f8e099..c5b426616443 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -551,6 +551,9 @@ dsi1: encoder@0 {
clocks = <_dss_clkctrl 
OMAP4_DSS_CORE_CLKCTRL 8>,
 <_dss_clkctrl 
OMAP4_DSS_CORE_CLKCTRL 10>;
clock-names = "fck", "sys_clk";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
};
};
 
@@ -583,6 +586,9 @@ dsi2: encoder@0 {
clocks = <_dss_clkctrl 
OMAP4_DSS_CORE_CLKCTRL 8>,
 <_dss_clkctrl 
OMAP4_DSS_CORE_CLKCTRL 10>;
clock-names = "fck", "sys_clk";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
};
};
 
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index fb889c5b00c9..0855c0a4050f 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -491,6 +491,9 @@ dsi1: encoder@0 {
status = &q

Re: [PATCHv2 1/4] dt-bindings: display: panel-dsi-cm: convert to YAML

2020-07-16 Thread Sebastian Reichel
Hi,

On Thu, Jul 16, 2020 at 07:52:58PM +0200, Sam Ravnborg wrote:
> On Thu, Jul 16, 2020 at 02:57:30PM +0200, Sebastian Reichel wrote:
> > Convert panel-dsi-cm bindings to YAML and add
> > missing properties while at it.
> > 
> > Reviewed-by: Laurent Pinchart 
> > Reviewed-by: Rob Herring 
> > Signed-off-by: Sebastian Reichel 
> 
> Hi Sebastian.
> 
> Look good now. Applied this patch to drm-misc-next.

Thanks!

> $ ls Documentation/devicetree/bindings/display/panel/*.txt
> Documentation/devicetree/bindings/display/panel/display-timing.txt
> 
> Nice :-)

Indeed.

> The DTS file changes needs to go in via another route.

No worries. I guess Tony will queue them up when he finds some time.

-- Sebastian

> 
>   Sam
> 
> > ---
> >  .../bindings/display/panel/panel-dsi-cm.txt   | 29 ---
> >  .../bindings/display/panel/panel-dsi-cm.yaml  | 86 +++
> >  2 files changed, 86 insertions(+), 29 deletions(-)
> >  delete mode 100644 
> > Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
> >  create mode 100644 
> > Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml
> > 
> > diff --git 
> > a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt 
> > b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
> > deleted file mode 100644
> > index dce48eb9db57..
> > --- a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.txt
> > +++ /dev/null
> > @@ -1,29 +0,0 @@
> > -Generic MIPI DSI Command Mode Panel
> > -===
> > -
> > -Required properties:
> > -- compatible: "panel-dsi-cm"
> > -
> > -Optional properties:
> > -- label: a symbolic name for the panel
> > -- reset-gpios: panel reset gpio
> > -- te-gpios: panel TE gpio
> > -
> > -Required nodes:
> > -- Video port for DSI input
> > -
> > -Example
> > 
> > -
> > -lcd0: display {
> > -   compatible = "tpo,taal", "panel-dsi-cm";
> > -   label = "lcd0";
> > -
> > -   reset-gpios = < 6 GPIO_ACTIVE_HIGH>;
> > -
> > -   port {
> > -   lcd0_in: endpoint {
> > -   remote-endpoint = <_out_ep>;
> > -   };
> > -   };
> > -};
> > diff --git 
> > a/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml 
> > b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml
> > new file mode 100644
> > index ..d766c949c622
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/panel/panel-dsi-cm.yaml
> > @@ -0,0 +1,86 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/display/panel/panel-dsi-cm.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: DSI command mode panels
> > +
> > +maintainers:
> > +  - Tomi Valkeinen 
> > +  - Sebastian Reichel 
> > +
> > +description: |
> > +  This binding file is a collection of the DSI panels that
> > +  are usually driven in command mode. If no backlight is
> > +  referenced via the optional backlight property, the DSI
> > +  panel is assumed to have native backlight support.
> > +  The panel may use an OF graph binding for the association
> > +  to the display, or it may be a direct child node of the
> > +  display.
> > +
> > +allOf:
> > +  - $ref: panel-common.yaml#
> > +
> > +properties:
> > +
> > +  compatible:
> > +items:
> > +  - enum:
> > +- motorola,droid4-panel# Panel from Motorola Droid4 phone
> > +- nokia,himalaya   # Panel from Nokia N950 phone
> > +- tpo,taal # Panel from OMAP4 SDP board
> > +  - const: panel-dsi-cm# Generic DSI command mode panel 
> > compatible fallback
> > +
> > +  reg:
> > +maxItems: 1
> > +description: DSI virtual channel
> > +
> > +  vddi-supply:
> > +description:
> > +  Display panels require power to be supplied. While several panels 
> > need
> > +  more than one power supply with panel-specific constraints governing 
> > the
> > +  order and timings of the power supplies, in many cases a single power
> > +  supply is sufficient, either because the panel has a single power 
> > rail, or
> > +  because all its power rails can be driven by

[PATCH] drm/panel: sony-acx565akm: Fix race condition in probe

2020-11-29 Thread Sebastian Reichel
The probe routine acquires the reset GPIO using GPIOD_OUT_LOW. Directly
afterwards it calls acx565akm_detect(), which sets the GPIO value to
HIGH. If the bootloader initialized the GPIO to HIGH before the probe
routine was called, there is only a very short time period of a few
instructions where the reset signal is LOW. Exact time depends on
compiler optimizations, kernel configuration and alignment of the stars,
but I expect it to be always way less than 10us. There are no public
datasheets for the panel, but acx565akm_power_on() has a comment with
timings and reset period should be at least 10us. So this potentially
brings the panel into a half-reset state.

The result is, that panel may not work after boot and can get into a
working state by re-enabling it (e.g. by blanking + unblanking), since
that does a clean reset cycle. This bug has recently been hit by Ivaylo
Dimitrov, but there are some older reports which are probably the same
bug. At least Tony Lindgren, Peter Ujfalusi and Jarkko Nikula have
experienced it in 2017 describing the blank/unblank procedure as
possible workaround.

Note, that the bug really goes back in time. It has originally been
introduced in the predecessor of the omapfb driver in 3c45d05be382
("OMAPDSS: acx565akm panel: handle gpios in panel driver") in 2012.
That driver eventually got replaced by a newer one, which had the bug
from the beginning in 84192742d9c2 ("OMAPDSS: Add Sony ACX565AKM panel
driver") and still exists in fbdev world. That driver has later been
copied to omapdrm and then was used as a basis for this driver. Last
but not least the omapdrm specific driver has been removed in
45f16c82db7e ("drm/omap: displays: Remove unused panel drivers").

Reported-by: Jarkko Nikula 
Reported-by: Peter Ujfalusi 
Reported-by: Tony Lindgren 
Reported-by: Aaro Koskinen 
Reported-by: Ivaylo Dimitrov 
Cc: Merlijn Wajer 
Cc: Laurent Pinchart 
Cc: Tomi Valkeinen 
Fixes: 1c8fc3f0c5d2 ("drm/panel: Add driver for the Sony ACX565AKM panel")
Signed-off-by: Sebastian Reichel 
---
 drivers/gpu/drm/panel/panel-sony-acx565akm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c 
b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
index e95fdfb16b6c..ba0b3ead150f 100644
--- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
@@ -629,7 +629,7 @@ static int acx565akm_probe(struct spi_device *spi)
lcd->spi = spi;
mutex_init(>mutex);
 
-   lcd->reset_gpio = devm_gpiod_get(>dev, "reset", GPIOD_OUT_LOW);
+   lcd->reset_gpio = devm_gpiod_get(>dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(lcd->reset_gpio)) {
dev_err(>dev, "failed to get reset GPIO\n");
return PTR_ERR(lcd->reset_gpio);
-- 
2.29.2

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


<    1   2   3   4   5   6   7   >