[PATCH 2/3] drm/fb: add support for not enabling fbcon on non-std displays

2017-10-15 Thread Dave Airlie
From: Dave Airlie 

We don't want fbcon to get used on non-standard dislays,
don't pass them as enabled connectors to the fb helper setup.

This prevents my HMD from getting disorted fbcon, and from
affecting other displays console.

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/drm_fb_helper.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 6a31d13f2f81..41ff51ca0396 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2033,6 +2033,9 @@ static bool drm_connector_enabled(struct drm_connector 
*connector, bool strict)
 {
bool enable;
 
+   if (connector->display_info.non_std)
+   return false;
+
if (strict)
enable = connector->status == connector_status_connected;
else
@@ -2052,7 +2055,8 @@ static void drm_enable_connectors(struct drm_fb_helper 
*fb_helper,
connector = fb_helper->connector_info[i]->connector;
enabled[i] = drm_connector_enabled(connector, true);
DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
- enabled[i] ? "yes" : "no");
+ connector->display_info.non_std ? "non standard" 
: enabled[i] ? "yes" : "no");
+
any_enabled |= enabled[i];
}
 
-- 
2.14.2

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


[PATCH 1/3] drm: add connector info/property for non-std displays

2017-10-15 Thread Dave Airlie
From: Dave Airlie 

This adds the infrastructure needed to quirk displays
using edid and to mark them a non-standard.

A non-standard display is one which doesn't work like
a normal rectangular monitor or requires some transformation
of the output by the rendering process to make sense.

This is meant to cover head mounted devices like HTC Vive.

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/drm_connector.c | 13 +
 drivers/gpu/drm/drm_edid.c  |  8 ++--
 include/drm/drm_connector.h |  5 +
 include/drm/drm_mode_config.h   |  7 +++
 4 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 704fc8934616..50a176483619 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -234,6 +234,10 @@ int drm_connector_init(struct drm_device *dev,
   config->link_status_property,
   0);
 
+   drm_object_attach_property(>base,
+  config->non_std_display_property,
+  0);
+
if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
drm_object_attach_property(>base, 
config->prop_crtc_id, 0);
}
@@ -811,6 +815,11 @@ int drm_connector_create_standard_properties(struct 
drm_device *dev)
return -ENOMEM;
dev->mode_config.link_status_property = prop;
 
+   prop = drm_property_create_bool(dev, DRM_MODE_PROP_IMMUTABLE, 
"non_standard");
+   if (!prop)
+   return -ENOMEM;
+   dev->mode_config.non_std_display_property = prop;
+
return 0;
 }
 
@@ -1194,6 +1203,10 @@ int drm_mode_connector_update_edid_property(struct 
drm_connector *connector,
if (edid)
size = EDID_LENGTH * (1 + edid->extensions);
 
+   drm_object_property_set_value(>base,
+ dev->mode_config.non_std_display_property,
+ connector->display_info.non_std);
+
ret = drm_property_replace_global_blob(dev,
   >edid_blob_ptr,
   size,
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 00ddabfbf980..4225052def37 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -82,6 +82,8 @@
 #define EDID_QUIRK_FORCE_6BPC  (1 << 10)
 /* Force 10bpc */
 #define EDID_QUIRK_FORCE_10BPC (1 << 11)
+/* Non standard display device (i.e. HMD) */
+#define EDID_QUIRK_NON_STD_DEVICE   (1 << 12)
 
 struct detailed_mode_closure {
struct drm_connector *connector;
@@ -4393,7 +4395,7 @@ static void drm_parse_cea_ext(struct drm_connector 
*connector,
 }
 
 static void drm_add_display_info(struct drm_connector *connector,
-struct edid *edid)
+struct edid *edid, u32 quirks)
 {
struct drm_display_info *info = >display_info;
 
@@ -4407,6 +4409,8 @@ static void drm_add_display_info(struct drm_connector 
*connector,
info->max_tmds_clock = 0;
info->dvi_dual = false;
 
+   info->non_std = !!(quirks & EDID_QUIRK_NON_STD_DEVICE);
+
if (edid->revision < 3)
return;
 
@@ -4627,7 +4631,7 @@ int drm_add_edid_modes(struct drm_connector *connector, 
struct edid *edid)
 * To avoid multiple parsing of same block, lets parse that map
 * from sink info, before parsing CEA modes.
 */
-   drm_add_display_info(connector, edid);
+   drm_add_display_info(connector, edid, quirks);
 
/*
 * EDID spec says modes should be preferred in this order:
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index b4285c40e1e4..5c3a1667458b 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -284,6 +284,11 @@ struct drm_display_info {
 * @hdmi: advance features of a HDMI sink.
 */
struct drm_hdmi_info hdmi;
+
+   /**
+* @non_std: Non standard display device (HMD).
+*/
+   bool non_std;
 };
 
 int drm_display_info_set_bus_formats(struct drm_display_info *info,
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 0b4ac2ebc610..a5a44aeccff4 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -728,6 +728,13 @@ struct drm_mode_config {
 */
struct drm_property *suggested_y_property;
 
+   /**
+* @non_std_display_property: Optional connector property with a hint
+* that device isn't a standard display, and the console/desktop,
+* should not be displayed on it.
+*/
+   struct drm_property *non_std_display_property;
+
/* dumb ioctl parameters */
uint32_t preferred_depth, prefer_shadow;
 
-- 
2.14.2


[PATCH 3/3] drm/edid: quirk HTC vive headset as non-standard.

2017-10-15 Thread Dave Airlie
From: Dave Airlie 

This uses the EDID info from my HTC Vive to mark it as
non-standard.

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/drm_edid.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 4225052def37..b491b3c3cc1f 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -159,6 +159,9 @@ static const struct edid_quirk {
 
/* Rotel RSX-1058 forwards sink's EDID but only does HDMI 1.1*/
{ "ETR", 13896, EDID_QUIRK_FORCE_8BPC },
+
+   /* HTC Vive VR Headset */
+   { "HVR", 0xaa01, EDID_QUIRK_NON_STD_DEVICE },
 };
 
 /*
-- 
2.14.2

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


Re: [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v3]

2017-10-15 Thread Keith Packard
Sean Paul  writes:

> Sphinx won't pick these up, and will issue warnings. Please update to @
> instead of \param
>
> If you want to try it out:
> make htmldocs

Yeah, I was attempting to emulate the existing style. I suggest that a
general cleanup to fix the docstrings should be in a separate patch and
cover a file at at time so that we can reasonably test the results. I
don't have a strong opinion on what format we should use before that
happens.

> Otherwise,
>
> Reviewed-by: Sean Paul 

Thanks for your review.

-- 
-keith


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


[Bug 99801] Rx480 doesn't output properly onto z27q at 5120x2880

2017-10-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99801

--- Comment #15 from Matthew Treinish  ---
I tested the most recent kernel from the drm-next-4.15-dc branch found at:
https://cgit.freedesktop.org/~agd5f/linux/log/?h=drm-next-4.15-dc (commit   
b175d392cfb28a9d260904bbb330917efe039331 ) The problem with my 5K display still
persists. Has there been any update on this issue?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[GIT PULL] exynos-drm-fixes

2017-10-15 Thread Inki Dae
Hi Dave,

   Just two regression fixups to potential use-after-free and
   NULL pointer dereference issues in suspend/resume.

   Please kindly let me know if there is any problem.


Thanks,
Inki Dae


The following changes since commit a480f30846d19b50106b3243d9d48683d2966249:

  Merge tag 'drm-intel-fixes-2017-10-11' of 
git://anongit.freedesktop.org/drm/drm-intel into drm-fixes (2017-10-14 09:59:20 
+1000)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos 
tags/exynos-drm-fixes-for-v4.14-rc5

for you to fetch changes up to 238604ca0b708319e089e22545bcda39afb5faa8:

  drm/exynos: Clear drvdata after component unbind (2017-10-16 07:44:49 +0900)


- Fix potential use-after-free issue in suspend/resume
  by cleanning up drvdata at unbind.
- Fix potential NULL pointer dereference issue in suspend/resume
  by setting drm_dev after checking if drm_dev is null or not.


Marek Szyprowski (2):
  drm/exynos: Fix potential NULL pointer dereference in suspend/resume paths
  drm/exynos: Clear drvdata after component unbind

 drivers/gpu/drm/exynos/exynos_drm_drv.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3] drm: exynos: Add driver for HDMI audio interface

2017-10-15 Thread Inki Dae


2017년 10월 12일 18:51에 Sylwester Nawrocki 이(가) 쓴 글:
> On 09/26/2017 04:17 PM, Sylwester Nawrocki wrote:
>> The hdmi-codec interface added in this patch is required to properly
>> support HDMI audio. Currently the audio part of the SoC internal
>> HDMI transmitter is configured with fixed values, which makes HDMI
>> audio working by chance, only on boards having an external audio
>> codec connected in parallel with the HDMI audio transmitter's input
>> I2S interface.
>>
>> Signed-off-by: Sylwester Nawrocki 
>> Reviewed-by: Andrzej Hajda 
> 
> Any comments on this patch?

I will review this patch including other patch series which should go to -next 
at end of this week.

Thanks,
Inki Dae

> 
> Thanks,
> Sylwester
> 
>> ---
>> Tested on Odroid XU3 and Odroid XU4 with Ubuntu 14.04.
>>
>> Changes since v2:
>>  - u8 replaced with bool type,
>>  - the  HDMI codec iec.status data used directly for setting up
>>the HDMI controller registers rather than using hard coded
>>constants,
>>  - constants used for configuring the HDMI_AUI_CON register
>>instead of plain numbers,
>>  - if/IS_ERR/return replaced with PTR_ERR_OR_ZERO().
>>
>> Changes since v1:
>>  - rebased onto v4.14-rc1 and adapted locking
>>
>> Changes since RFC version:
>>  - fixed hdmi-codec locking issue
>>  - added a comment documenting struct hdmi_contex::mutex
>> ---
>>  drivers/gpu/drm/exynos/Kconfig   |   1 +
>>  drivers/gpu/drm/exynos/exynos_hdmi.c | 253 
>> ++-
>>  drivers/gpu/drm/exynos/regs-hdmi.h   |   8 +-
>>  3 files changed, 197 insertions(+), 65 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
>> index 305dc3d..5a7c9d8 100644
>> --- a/drivers/gpu/drm/exynos/Kconfig
>> +++ b/drivers/gpu/drm/exynos/Kconfig
>> @@ -3,6 +3,7 @@ config DRM_EXYNOS
>>  depends on OF && DRM && (ARCH_S3C64XX || ARCH_EXYNOS || 
>> ARCH_MULTIPLATFORM)
>>  select DRM_KMS_HELPER
>>  select VIDEOMODE_HELPERS
>> +select SND_SOC_HDMI_CODEC if SND_SOC
>>  help
>>Choose this option if you have a Samsung SoC EXYNOS chipset.
>>If M is selected the module will be called exynosdrm.
>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
>> b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> index 214fa5e..d2b389a 100644
>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> @@ -40,7 +40,7 @@
>>  #include 
>>  #include 
>>  #include 
>> -
>> +#include 
>>  #include 
>>
>>  #include 
>> @@ -111,12 +111,18 @@ struct hdmi_driver_data {
>>  struct string_array_spec clk_muxes;
>>  };
>>
>> +struct hdmi_audio {
>> +struct platform_device  *pdev;
>> +struct hdmi_audio_infoframe infoframe;
>> +struct hdmi_codec_paramsparams;
>> +boolenable;
>> +};
>> +
>>  struct hdmi_context {
>>  struct drm_encoder  encoder;
>>  struct device   *dev;
>>  struct drm_device   *drm_dev;
>>  struct drm_connectorconnector;
>> -boolpowered;
>>  booldvi_mode;
>>  struct delayed_work hotplug_work;
>>  struct drm_display_mode current_mode;
>> @@ -137,6 +143,11 @@ struct hdmi_context {
>>  struct regulator*reg_hdmi_en;
>>  struct exynos_drm_clk   phy_clk;
>>  struct drm_bridge   *bridge;
>> +
>> +/* mutex protecting subsequent fields below */
>> +struct mutexmutex;
>> +struct hdmi_audio   audio;
>> +boolpowered;
>>  };
>>
>>  static inline struct hdmi_context *encoder_to_hdmi(struct drm_encoder *e)
>> @@ -768,6 +779,22 @@ static int hdmi_clk_set_parents(struct hdmi_context 
>> *hdata, bool to_phy)
>>  return ret;
>>  }
>>
>> +static int hdmi_audio_infoframe_apply(struct hdmi_context *hdata)
>> +{
>> +struct hdmi_audio_infoframe *infoframe = >audio.infoframe;
>> +u8 buf[HDMI_INFOFRAME_SIZE(AUDIO)];
>> +int len;
>> +
>> +len = hdmi_audio_infoframe_pack(infoframe, buf, sizeof(buf));
>> +if (len < 0)
>> +return len;
>> +
>> +hdmi_reg_writeb(hdata, HDMI_AUI_CON, HDMI_AUI_CON_EVERY_VSYNC);
>> +hdmi_reg_write_buf(hdata, HDMI_AUI_HEADER0, buf, len);
>> +
>> +return 0;
>> +}
>> +
>>  static void hdmi_reg_infoframes(struct hdmi_context *hdata)
>>  {
>>  union hdmi_infoframe frm;
>> @@ -805,15 +832,7 @@ static void hdmi_reg_infoframes(struct hdmi_context 
>> *hdata)
>>  hdmi_reg_write_buf(hdata, HDMI_VSI_DATA(0), buf + 3, ret - 3);
>>  }
>>
>> -ret = hdmi_audio_infoframe_init();
>> -if (!ret) {
>> -frm.audio.channels = 2;
>> -ret = hdmi_audio_infoframe_pack(, buf, sizeof(buf));
>> -}
>> -if (ret > 0) {
>> -hdmi_reg_writeb(hdata, HDMI_AUI_CON, 

Re: [PATCH 21/48] drm: omapdrm: dss: Support passing private data to debugfs show handlers

2017-10-15 Thread Sebastian Reichel
Hi Laurent,

On Fri, Oct 13, 2017 at 05:59:17PM +0300, Laurent Pinchart wrote:
> To simplify implementation of debugfs seq_file show handlers, the driver
> passes the pointer to the show function through the debugfs_create_file
> data pointer. This prevents using the pointer to pass driver private
> data to the show handler, and requires all handlers to use global
> variables to access private data.
> 
> To prepare for the removal of global private data in the driver, rework
> the debugfs infrastructure to allow passing a private data pointer to
> show handlers.
> 
> The price to pay is explicit removal of debugfs files to free the
> internally allocated memory. This is desirable anyway as debugfs entries
> should be removed when a component driver is unbound, otherwise crashes
> will occur due to access to freed memory when the components will be
> dynamically allocated instead of stored in global variables.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

(One nit-pick in dss.h, see below)

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dispc.c | 13 --
>  drivers/gpu/drm/omapdrm/dss/dsi.c   | 40 +++-
>  drivers/gpu/drm/omapdrm/dss/dss.c   | 92 
> +
>  drivers/gpu/drm/omapdrm/dss/dss.h   | 27 +++
>  drivers/gpu/drm/omapdrm/dss/hdmi.h  |  2 +
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c |  9 ++--
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c |  9 ++--
>  drivers/gpu/drm/omapdrm/dss/venc.c  | 11 +++--
>  8 files changed, 140 insertions(+), 63 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c 
> b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index f0ae6be36a4e..1afd2802e807 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -168,6 +168,8 @@ static struct {
>   struct platform_device *pdev;
>   void __iomem*base;
>  
> + struct dss_debugfs_entry *debugfs;
> +
>   int irq;
>   irq_handler_t user_handler;
>   void *user_data;
> @@ -3269,7 +3271,7 @@ void dispc_dump_clocks(struct seq_file *s)
>   dispc_runtime_put();
>  }
>  
> -static void dispc_dump_regs(struct seq_file *s)
> +static int dispc_dump_regs(struct seq_file *s, void *p)
>  {
>   int i, j;
>   const char *mgr_names[] = {
> @@ -3290,7 +3292,7 @@ static void dispc_dump_regs(struct seq_file *s)
>  #define DUMPREG(r) seq_printf(s, "%-50s %08x\n", #r, dispc_read_reg(r))
>  
>   if (dispc_runtime_get())
> - return;
> + return 0;
>  
>   /* DISPC common registers */
>   DUMPREG(DISPC_REVISION);
> @@ -3462,6 +3464,8 @@ static void dispc_dump_regs(struct seq_file *s)
>  
>  #undef DISPC_REG
>  #undef DUMPREG
> +
> + return 0;
>  }
>  
>  /* calculate clock rates using dividers in cinfo */
> @@ -4606,7 +4610,8 @@ static int dispc_bind(struct device *dev, struct device 
> *master, void *data)
>  
>   dispc_set_ops(_ops);
>  
> - dss_debugfs_create_file("dispc", dispc_dump_regs);
> + dispc.debugfs = dss_debugfs_create_file("dispc", dispc_dump_regs,
> + );
>  
>   return 0;
>  
> @@ -4618,6 +4623,8 @@ static int dispc_bind(struct device *dev, struct device 
> *master, void *data)
>  static void dispc_unbind(struct device *dev, struct device *master,
>  void *data)
>  {
> + dss_debugfs_remove_file(dispc.debugfs);
> +
>   dispc_set_ops(NULL);
>  
>   pm_runtime_disable(dev);
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 6a1569149453..a64e6a39ebf1 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -402,6 +402,10 @@ struct dsi_data {
>  #endif
>   int debug_read;
>   int debug_write;
> + struct {
> + struct dss_debugfs_entry *irqs;
> + struct dss_debugfs_entry *regs;
> + } debugfs;
>  
>  #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
>   spinlock_t irq_stats_lock;
> @@ -1659,18 +1663,20 @@ static void dsi_dump_dsidev_irqs(struct 
> platform_device *dsidev,
>  #undef PIS
>  }
>  
> -static void dsi1_dump_irqs(struct seq_file *s)
> +static int dsi1_dump_irqs(struct seq_file *s, void *p)
>  {
>   struct platform_device *dsidev = dsi_get_dsidev_from_id(0);
>  
>   dsi_dump_dsidev_irqs(dsidev, s);
> + return 0;
>  }
>  
> -static void dsi2_dump_irqs(struct seq_file *s)
> +static int dsi2_dump_irqs(struct seq_file *s, void *p)
>  {
>   struct platform_device *dsidev = dsi_get_dsidev_from_id(1);
>  
>   dsi_dump_dsidev_irqs(dsidev, s);
> + return 0;
>  }
>  #endif
>  
> @@ -1758,18 +1764,20 @@ static void dsi_dump_dsidev_regs(struct 
> platform_device *dsidev,
>  #undef DUMPREG
>  }
>  
> -static void dsi1_dump_regs(struct seq_file *s)
> +static int dsi1_dump_regs(struct seq_file *s, void *p)
>  {
>   struct platform_device *dsidev = 

[Bug 103100] Image corruptions, instability and performance regression in drm-next-wip Kernel

2017-10-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103100

--- Comment #2 from Gregor Münch  ---
I tested again with yesterdays git and newer Kernel:
OpenGL renderer string: AMD Radeon HD 7900 Series (TAHITI / DRM 3.21.0 /
4.14.0-2-drm-next-dc-git, LLVM 6.0.0)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 17.3.0-devel
(git-0c1aecf177)

The system doesnt hang anymore, it completes phoronix benchmark runs again.
Before it was always crashing when the 3rd game test was started. The benchmark
suite let the games run 3 times each test. So it usually crashed after 7-8
starts.
However I still see those GPU faults in the log.
Performance in Shadow of Mordor is still just 61-62fps.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 92827] Tonga: No Sound over HDMI with connected AV receiver

2017-10-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=92827

--- Comment #4 from dwagner  ---
JFYI: HDMI audio output works fine with amdgpu as present in current
https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-drm-next

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 103277] [bisected] Systems hangs on resume from S3 sleep due to "Match actual state during S3 resume" commit

2017-10-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103277

--- Comment #2 from Jordan L  ---
(In reply to dwagner from comment #0)
> After I updated my kernel to
> https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-drm-next as of
> today (latest commit at this time: 
> 1c630e83443a0f271c192ecfa0d94023661a) I noticed that my computer would
> no longer wake up from S3 sleep - power LED goes on, but apart from that no
> display and no reaction to any input (other than Num-Lock still switchable).
> 
> The difference to the ~2 weeks older kernel was 100% reproducable by just
> doing:
> 
> - boot to console (no start of X11 required) and login as root
> - echo "mem" >/sys/power/state
> - wait till power LED blinks
> - press some key to wake up the system
> - observe no display output and no reaction to anything
> 
> GPU is a RX 460, CPU a Ryzen R7 1800X, board Asus X370 Pro, connected is one
> 4k display via HDMI 2.0.
> 
> I bisected the git commits, and the one that causes the bug is:
> 
> >  7ae4acd21e9e264afb079e23d43bcf2238c7dbea
> >  drm/amd/display: Match actual state during S3 resume.
> 
> After this, I went back to the current HEAD of amd-staging-drm-next and
> (manually) reverted only commit 7ae4acd21e9e264afb079e23d43bcf2238c7dbea,
> and this indeed results in a kernel that works fine with regards to resuming
> from S3 sleep.
> 
> There are no noteworthy "dmesg"-emissions that accompany going to S3 sleep,
> but the dmesg-output that I can collect ends slightly before the system
> actually sleeps, so wether anything is emitted upon the wake-up attempt, I
> have no way to know.

Thanks, we can reproduce this too, should have something shortly.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 6/8] drm: Add vmalloc BO helper

2017-10-15 Thread Noralf Trønnes
Add vmalloc buffer object helper that can be useful for modesetting
drivers, particularly the framebuffer flushing kind.

Signed-off-by: Noralf Trønnes 
---
 Documentation/gpu/drm-kms-helpers.rst   |  12 ++
 drivers/gpu/drm/Kconfig |   7 +
 drivers/gpu/drm/Makefile|   1 +
 drivers/gpu/drm/drm_vmalloc_bo_helper.c | 305 
 include/drm/drm_vmalloc_bo_helper.h |  88 +
 5 files changed, 413 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_vmalloc_bo_helper.c
 create mode 100644 include/drm/drm_vmalloc_bo_helper.h

diff --git a/Documentation/gpu/drm-kms-helpers.rst 
b/Documentation/gpu/drm-kms-helpers.rst
index 13dd237418cc..fd1ca10f6611 100644
--- a/Documentation/gpu/drm-kms-helpers.rst
+++ b/Documentation/gpu/drm-kms-helpers.rst
@@ -305,3 +305,15 @@ Framebuffer GEM Helper Reference
 
 .. kernel-doc:: drivers/gpu/drm/drm_gem_framebuffer_helper.c
:export:
+
+vmalloc buffer object helper
+
+
+.. kernel-doc:: drivers/gpu/drm/drm_vmalloc_bo_helper.c
+   :doc: overview
+
+.. kernel-doc:: include/drm/drm_vmalloc_bo_helper.h
+   :internal:
+
+.. kernel-doc:: drivers/gpu/drm/drm_vmalloc_bo_helper.c
+   :export:
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 4d9f21831741..5d580440a259 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -145,6 +145,13 @@ config DRM_KMS_CMA_HELPER
help
  Choose this if you need the KMS CMA helper functions
 
+config DRM_VMALLOC_BO_HELPER
+   bool
+   depends on DRM
+   select DRM_KMS_HELPER
+   help
+ Choose this if you need the vmalloc buffer object helper functions
+
 config DRM_VM
bool
depends on DRM && MMU
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index a3fdc5a68dff..ed3eafa97a69 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -39,6 +39,7 @@ drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o 
drm_probe_helper.o \
 drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
 drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
 drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
+drm_kms_helper-$(CONFIG_DRM_VMALLOC_BO_HELPER) += drm_vmalloc_bo_helper.o
 drm_kms_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
 
 obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
diff --git a/drivers/gpu/drm/drm_vmalloc_bo_helper.c 
b/drivers/gpu/drm/drm_vmalloc_bo_helper.c
new file mode 100644
index ..4015b9d1d671
--- /dev/null
+++ b/drivers/gpu/drm/drm_vmalloc_bo_helper.c
@@ -0,0 +1,305 @@
+/*
+ * DRM vmalloc buffer object helper functions
+ *
+ * Copyright (C) 2017 Noralf Trønnes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * DOC: overview
+ *
+ * This helper provides a simple GEM based buffer object with buffers allocated
+ * using vmalloc(). This is useful for modesetting drivers that do framebuffer
+ * flushing. It supports dumb buffers and PRIME import which can be setup using
+ * the DEFINE_DRM_VMALLOC_BO_FOPS() and DRM_VMALLOC_BO_DRIVER_OPS() macros.
+ *
+ * fbdev emulation can be setup using the drm_vmalloc_bo_fbdev_probe() 
function.
+ */
+
+static struct drm_vmalloc_bo *
+drm_vmalloc_bo_create(struct drm_device *dev, size_t size, bool backing)
+{
+   struct drm_vmalloc_bo *bo;
+   int ret;
+
+   size = PAGE_ALIGN(size);
+
+   bo = kzalloc(sizeof(*bo), GFP_KERNEL);
+   if (!bo)
+   return ERR_PTR(-ENOMEM);
+
+   if (backing) {
+   bo->vaddr = vmalloc_user(size);
+   if (!bo->vaddr) {
+   ret = -ENOMEM;
+   goto error_free;
+   }
+   }
+
+   drm_gem_private_object_init(dev, >base, size);
+
+   return bo;
+
+error_free:
+   kfree(bo);
+
+   return ERR_PTR(ret);
+}
+
+/**
+ * drm_vmalloc_bo_free_object() - Free resources associated with a vmalloc BO
+ *object
+ * @obj: GEM object to free
+ *
+ * This function frees the backing memory of the vmalloc BO object, cleans up
+ * the GEM object state and frees the memory used to store the object itself.
+ * Drivers using the vmalloc BO helpers should set this as their
+ * _driver.gem_free_object callback.
+ */
+void drm_vmalloc_bo_free_object(struct drm_gem_object *obj)
+{
+   struct drm_vmalloc_bo *bo = to_drm_vmalloc_bo(obj);
+
+   if (obj->import_attach)
+   dma_buf_vunmap(obj->import_attach->dmabuf, bo->vaddr);
+   else
+   vfree(bo->vaddr);
+
+   drm_gem_object_release(obj);
+   kfree(bo);
+}

[PATCH v2 5/8] drm/gem-fb-helper: Add drm_gem_fb_debugfs_show()

2017-10-15 Thread Noralf Trønnes
Add drm_gem_fb_debugfs_show() function to provide a debugfs
representation of the framebuffer and GEM object(s).

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_gem_framebuffer_helper.c | 45 
 include/drm/drm_gem_framebuffer_helper.h |  6 
 2 files changed, 51 insertions(+)

diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c 
b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
index aa8cb9bfa499..18fdcc29427a 100644
--- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
+++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
@@ -265,6 +265,51 @@ int drm_gem_fb_prepare_fb(struct drm_plane *plane,
 }
 EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
 
+#ifdef CONFIG_DEBUG_FS
+static void drm_gem_fb_describe(struct drm_framebuffer *fb, struct seq_file *m)
+{
+   struct drm_gem_object *obj;
+   unsigned int i;
+
+   seq_printf(m, "[FB:%d] %dx%d@%4.4s\n", fb->base.id, fb->width,
+  fb->height, (char *)>format->format);
+
+   for (i = 0; i < fb->format->num_planes; i++) {
+   obj = fb->obj[i];
+   seq_printf(m, "\t%u: offset=%d pitch=%d, GEM: name=%d",
+  i, fb->offsets[i], fb->pitches[i], obj->name);
+   seq_printf(m, " refcount=%d start=%08lx size=%zu%s\n",
+  kref_read(>refcount),
+  drm_vma_node_start(>vma_node), obj->size,
+  obj->import_attach ? " (imported)" : "");
+   }
+}
+
+/**
+ * drm_gem_fb_debugfs_show() - Helper to list GEM backed framebuffer objects
+ * in debugfs.
+ * @m: Output file
+ * @arg: Private data for the callback
+ *
+ * This function gives a debugfs representation of the framebuffers with their
+ * backing GEM objects. See drm_debugfs_create_files() for more info.
+ */
+int drm_gem_fb_debugfs_show(struct seq_file *m, void *arg)
+{
+   struct drm_info_node *node = m->private;
+   struct drm_device *dev = node->minor->dev;
+   struct drm_framebuffer *fb;
+
+   mutex_lock(>mode_config.fb_lock);
+   drm_for_each_fb(fb, dev)
+   drm_gem_fb_describe(fb, m);
+   mutex_unlock(>mode_config.fb_lock);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(drm_gem_fb_debugfs_show);
+#endif
+
 /**
  * drm_gem_fbdev_fb_create - Create a GEM backed _framebuffer for fbdev
  *   emulation
diff --git a/include/drm/drm_gem_framebuffer_helper.h 
b/include/drm/drm_gem_framebuffer_helper.h
index 5ca7cdc3f527..1bb73d961aba 100644
--- a/include/drm/drm_gem_framebuffer_helper.h
+++ b/include/drm/drm_gem_framebuffer_helper.h
@@ -28,6 +28,12 @@ drm_gem_fb_create(struct drm_device *dev, struct drm_file 
*file,
 int drm_gem_fb_prepare_fb(struct drm_plane *plane,
  struct drm_plane_state *state);
 
+#ifdef CONFIG_DEBUG_FS
+struct seq_file;
+
+int drm_gem_fb_debugfs_show(struct seq_file *m, void *arg);
+#endif
+
 struct drm_framebuffer *
 drm_gem_fbdev_fb_create(struct drm_device *dev,
struct drm_fb_helper_surface_size *sizes,
-- 
2.14.2

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


[PATCH v2 1/8] drm/fb-helper: Handle function NULL argument

2017-10-15 Thread Noralf Trønnes
Make functions tolerate that the drm_fb_helper argument is NULL.
This is useful for drivers that continue probing when fbdev emulation
fails and not having to do this check themselves.
Update docs for functions that already handles this.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_fb_helper.c | 28 +---
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 116d1f1337c7..954cdd48de92 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -150,6 +150,9 @@ int drm_fb_helper_add_one_connector(struct drm_fb_helper 
*fb_helper,
 {
int err;
 
+   if (!fb_helper)
+   return 0;
+
mutex_lock(_helper->lock);
err = __drm_fb_helper_add_one_connector(fb_helper, connector);
mutex_unlock(_helper->lock);
@@ -161,7 +164,7 @@ EXPORT_SYMBOL(drm_fb_helper_add_one_connector);
 /**
  * drm_fb_helper_single_add_all_connectors() - add all connectors to fbdev
  *emulation helper
- * @fb_helper: fbdev initialized with drm_fb_helper_init
+ * @fb_helper: fbdev initialized with drm_fb_helper_init, can be NULL
  *
  * This functions adds all the available connectors for use with the given
  * fb_helper. This is a separate step to allow drivers to freely assign
@@ -179,7 +182,7 @@ int drm_fb_helper_single_add_all_connectors(struct 
drm_fb_helper *fb_helper)
struct drm_connector_list_iter conn_iter;
int i, ret = 0;
 
-   if (!drm_fbdev_emulation)
+   if (!drm_fbdev_emulation || !fb_helper)
return 0;
 
mutex_lock(_helper->lock);
@@ -245,6 +248,9 @@ int drm_fb_helper_remove_one_connector(struct drm_fb_helper 
*fb_helper,
 {
int err;
 
+   if (!fb_helper)
+   return 0;
+
mutex_lock(_helper->lock);
err = __drm_fb_helper_remove_one_connector(fb_helper, connector);
mutex_unlock(_helper->lock);
@@ -484,7 +490,7 @@ static int restore_fbdev_mode(struct drm_fb_helper 
*fb_helper)
 
 /**
  * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
- * @fb_helper: fbcon to restore
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  *
  * This should be called from driver's drm _driver.lastclose callback
  * when implementing an fbcon on top of kms using this helper. This ensures 
that
@@ -498,7 +504,7 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct 
drm_fb_helper *fb_helper)
bool do_delayed;
int ret;
 
-   if (!drm_fbdev_emulation)
+   if (!drm_fbdev_emulation || !fb_helper)
return -ENODEV;
 
if (READ_ONCE(fb_helper->deferred_setup))
@@ -883,7 +889,7 @@ EXPORT_SYMBOL(drm_fb_helper_alloc_fbi);
 
 /**
  * drm_fb_helper_unregister_fbi - unregister fb_info framebuffer device
- * @fb_helper: driver-allocated fbdev helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  *
  * A wrapper around unregister_framebuffer, to release the fb_info
  * framebuffer device. This must be called before releasing all resources for
@@ -898,7 +904,7 @@ EXPORT_SYMBOL(drm_fb_helper_unregister_fbi);
 
 /**
  * drm_fb_helper_fini - finialize a  drm_fb_helper
- * @fb_helper: driver-allocated fbdev helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  *
  * This cleans up all remaining resources associated with @fb_helper. Must be
  * called after drm_fb_helper_unlink_fbi() was called.
@@ -937,7 +943,7 @@ EXPORT_SYMBOL(drm_fb_helper_fini);
 
 /**
  * drm_fb_helper_unlink_fbi - wrapper around unlink_framebuffer
- * @fb_helper: driver-allocated fbdev helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  *
  * A wrapper around unlink_framebuffer implemented by fbdev core
  */
@@ -1138,7 +1144,7 @@ EXPORT_SYMBOL(drm_fb_helper_cfb_imageblit);
 
 /**
  * drm_fb_helper_set_suspend - wrapper around fb_set_suspend
- * @fb_helper: driver-allocated fbdev helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  * @suspend: whether to suspend or resume
  *
  * A wrapper around fb_set_suspend implemented by fbdev core.
@@ -1155,7 +1161,7 @@ EXPORT_SYMBOL(drm_fb_helper_set_suspend);
 /**
  * drm_fb_helper_set_suspend_unlocked - wrapper around fb_set_suspend that also
  *  takes the console lock
- * @fb_helper: driver-allocated fbdev helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  * @suspend: whether to suspend or resume
  *
  * A wrapper around fb_set_suspend() that takes the console lock. If the lock
@@ -2568,7 +2574,7 @@ EXPORT_SYMBOL(drm_fb_helper_initial_config);
 /**
  * drm_fb_helper_hotplug_event - respond to a hotplug notification by
  *   probing all the outputs attached to the fb
- * @fb_helper: the drm_fb_helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  *
  * Scan the connectors attached to the 

[PATCH v2 8/8] drm/tinydrm: Relax buffer line prefetch

2017-10-15 Thread Noralf Trønnes
vmalloc BO's gives us cached reads, so no need to prefetch in that case.
Prefetching gives a ~20% speedup on a cma buffer using the mi0283qt
driver on a Raspberry Pi 1.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 54 ++
 1 file changed, 30 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index ee9a8f305b26..bca905213cdd 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -15,6 +15,8 @@
 #include 
 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -115,22 +117,25 @@ void tinydrm_swab16(u16 *dst, void *vaddr, struct 
drm_framebuffer *fb,
struct drm_clip_rect *clip)
 {
size_t len = (clip->x2 - clip->x1) * sizeof(u16);
+   u16 *src, *buf = NULL;
unsigned int x, y;
-   u16 *src, *buf;
 
/*
-* The cma memory is write-combined so reads are uncached.
-* Speed up by fetching one line at a time.
+* Imported buffers are likely to be write-combined with uncached
+* reads. Speed up by fetching one line at a time.
+* prefetch_range() was tried, but didn't give any noticeable speedup
+* on the Raspberry Pi 1.
 */
-   buf = kmalloc(len, GFP_KERNEL);
-   if (!buf)
-   return;
+   if (drm_gem_fb_get_obj(fb, 0)->import_attach)
+   buf = kmalloc(len, GFP_KERNEL);
 
for (y = clip->y1; y < clip->y2; y++) {
src = vaddr + (y * fb->pitches[0]);
src += clip->x1;
-   memcpy(buf, src, len);
-   src = buf;
+   if (buf) {
+   memcpy(buf, src, len);
+   src = buf;
+   }
for (x = clip->x1; x < clip->x2; x++)
*dst++ = swab16(*src++);
}
@@ -155,19 +160,21 @@ void tinydrm_xrgb_to_rgb565(u16 *dst, void *vaddr,
struct drm_clip_rect *clip, bool swap)
 {
size_t len = (clip->x2 - clip->x1) * sizeof(u32);
+   u32 *src, *buf = NULL;
unsigned int x, y;
-   u32 *src, *buf;
u16 val16;
 
-   buf = kmalloc(len, GFP_KERNEL);
-   if (!buf)
-   return;
+   /* See tinydrm_swab16() for an explanation */
+   if (drm_gem_fb_get_obj(fb, 0)->import_attach)
+   buf = kmalloc(len, GFP_KERNEL);
 
for (y = clip->y1; y < clip->y2; y++) {
src = vaddr + (y * fb->pitches[0]);
src += clip->x1;
-   memcpy(buf, src, len);
-   src = buf;
+   if (buf) {
+   memcpy(buf, src, len);
+   src = buf;
+   }
for (x = clip->x1; x < clip->x2; x++) {
val16 = ((*src & 0x00F8) >> 8) |
((*src & 0xFC00) >> 5) |
@@ -205,24 +212,23 @@ void tinydrm_xrgb_to_gray8(u8 *dst, void *vaddr, 
struct drm_framebuffer *fb,
 {
unsigned int len = (clip->x2 - clip->x1) * sizeof(u32);
unsigned int x, y;
-   void *buf;
+   void *buf = NULL;
u32 *src;
 
if (WARN_ON(fb->format->format != DRM_FORMAT_XRGB))
return;
-   /*
-* The cma memory is write-combined so reads are uncached.
-* Speed up by fetching one line at a time.
-*/
-   buf = kmalloc(len, GFP_KERNEL);
-   if (!buf)
-   return;
+
+   /* See tinydrm_swab16() for an explanation */
+   if (drm_gem_fb_get_obj(fb, 0)->import_attach)
+   buf = kmalloc(len, GFP_KERNEL);
 
for (y = clip->y1; y < clip->y2; y++) {
src = vaddr + (y * fb->pitches[0]);
src += clip->x1;
-   memcpy(buf, src, len);
-   src = buf;
+   if (buf) {
+   memcpy(buf, src, len);
+   src = buf;
+   }
for (x = clip->x1; x < clip->x2; x++) {
u8 r = (*src & 0x00ff) >> 16;
u8 g = (*src & 0xff00) >> 8;
-- 
2.14.2

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


[PATCH v2 3/8] drm/fb-helper: Add simple init/fini functions

2017-10-15 Thread Noralf Trønnes
This adds some simple init/fini helpers for drivers that don't need
anything special in their fbdev emulation setup.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_fb_helper.c | 163 
 include/drm/drm_fb_helper.h |  22 ++
 2 files changed, 185 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 954cdd48de92..166535da9a9b 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -105,6 +105,127 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
  * mmap page writes.
  */
 
+/**
+ * drm_fb_helper_simple_init - Simple fbdev emulation setup
+ * @dev: DRM device
+ * @funcs: Pointer to structure of functions associated with this helper
+ * @bpp: Bits per pixel value to use for the framebuffer configuration.
+ *   @dev->mode_config.preferred_depth is used if this is zero.
+ * @max_conn: Max connector count. @dev->mode_config.num_connector is used if
+ *this is zero.
+ *
+ * Simple fbdev emulation initialization. This function allocates a
+ * _fb_helper structure attaches it to _device->fbdev and calls:
+ * drm_fb_helper_prepare(), drm_fb_helper_init(),
+ * drm_fb_helper_single_add_all_connectors() and
+ * drm_fb_helper_initial_config().
+ *
+ * If fbdev emulation is disabled, this function does nothing. In that case
+ * _device->fbdev will be NULL. All drm_fb_helper entry function can handle
+ * a NULL argument.
+ *
+ * fbdev deferred I/O users should use the drm_fb_helper_defio_init() function
+ * in their _fb_helper_funcs.fb_probe callback.
+ *
+ * Returns:
+ * Zero on success or if fbdev emulation is disabled, negative error code on
+ * failure.
+ */
+int drm_fb_helper_simple_init(struct drm_device *dev,
+ const struct drm_fb_helper_funcs *funcs,
+ unsigned int bpp, int max_conn)
+{
+   struct drm_fb_helper *fb_helper;
+   int ret;
+
+   if (!drm_fbdev_emulation)
+   return 0;
+
+   if (!bpp)
+   bpp = dev->mode_config.preferred_depth;
+
+   if (!max_conn)
+   max_conn = dev->mode_config.num_connector;
+
+   fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
+   if (!fb_helper)
+   return -ENOMEM;
+
+   drm_fb_helper_prepare(dev, fb_helper, funcs);
+
+   ret = drm_fb_helper_init(dev, fb_helper, max_conn);
+   if (ret < 0) {
+   DRM_DEV_ERROR(dev->dev, "Failed to initialize fb helper.\n");
+   goto err_drm_fb_helper_free;
+   }
+
+   ret = drm_fb_helper_single_add_all_connectors(fb_helper);
+   if (ret < 0) {
+   DRM_DEV_ERROR(dev->dev, "Failed to add connectors.\n");
+   goto err_drm_fb_helper_fini;
+   }
+
+   ret = drm_fb_helper_initial_config(fb_helper, bpp);
+   if (ret < 0) {
+   DRM_DEV_ERROR(dev->dev, "Failed to set initial hw config.\n");
+   goto err_drm_fb_helper_fini;
+   }
+
+   dev->fbdev = fb_helper;
+
+   return 0;
+
+err_drm_fb_helper_fini:
+   drm_fb_helper_fini(fb_helper);
+err_drm_fb_helper_free:
+   kfree(fb_helper);
+
+   return ret;
+}
+EXPORT_SYMBOL_GPL(drm_fb_helper_simple_init);
+
+/**
+ * drm_fb_helper_simple_fini - Simple fbdev cleanup
+ * @dev: DRM device
+ *
+ * Simple fbdev emulation cleanup. This function unregisters fbdev if it is not
+ * done, cleans up deferred IO if necessary, removes framebuffer, finalizes
+ * @fb_helper and frees the structure.
+ */
+void drm_fb_helper_simple_fini(struct drm_device *dev)
+{
+   struct drm_fb_helper *fb_helper = dev->fbdev;
+   struct fb_info *info;
+   struct fb_ops *fbops;
+
+   if (!fb_helper)
+   return;
+
+   dev->fbdev = NULL;
+   info = fb_helper->fbdev;
+
+   /* Make sure it hasn't been unregistered already */
+   if (info && info->dev)
+   drm_fb_helper_unregister_fbi(fb_helper);
+
+   if (info && info->fbdefio) {
+   fb_deferred_io_cleanup(info);
+   kfree(info->fbdefio);
+   fbops = info->fbops;
+   }
+
+   drm_fb_helper_fini(fb_helper);
+
+   if (info && info->fbdefio)
+   kfree(fbops);
+
+   if (fb_helper->fb)
+   drm_framebuffer_remove(fb_helper->fb);
+
+   kfree(fb_helper);
+}
+EXPORT_SYMBOL_GPL(drm_fb_helper_simple_fini);
+
 #define drm_fb_helper_for_each_connector(fbh, i__) \
for (({ lockdep_assert_held(&(fbh)->lock); }), \
 i__ = 0; i__ < (fbh)->connector_count; i__++)
@@ -954,6 +1075,48 @@ void drm_fb_helper_unlink_fbi(struct drm_fb_helper 
*fb_helper)
 }
 EXPORT_SYMBOL(drm_fb_helper_unlink_fbi);
 
+/**
+ * drm_fb_helper_defio_init - fbdev deferred I/O initialization
+ * @fb_helper: driver-allocated fbdev helper
+ *
+ * This function allocates _deferred_io, sets callback to
+ * drm_fb_helper_deferred_io(), delay to 50ms and calls 

[PATCH v2 4/8] drm/fb-helper: Add .last_close and .output_poll_changed helpers

2017-10-15 Thread Noralf Trønnes
This adds helpers for the drm_driver->last_close and the
drm_mode_config_funcs->output_poll_changed callbacks.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_fb_helper.c | 32 
 include/drm/drm_fb_helper.h | 10 ++
 2 files changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 166535da9a9b..897be5304135 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -226,6 +226,38 @@ void drm_fb_helper_simple_fini(struct drm_device *dev)
 }
 EXPORT_SYMBOL_GPL(drm_fb_helper_simple_fini);
 
+/**
+ * drm_fb_helper_lastclose - DRM driver lastclose helper for fbdev emulation
+ * @dev: DRM device
+ *
+ * This function can be used as the _driver->lastclose callback for drivers
+ * that only need to call drm_fb_helper_restore_fbdev_mode_unlocked().
+ *
+ * Note: _device->fbdev needs to be set.
+ */
+void drm_fb_helper_lastclose(struct drm_device *dev)
+{
+   drm_fb_helper_restore_fbdev_mode_unlocked(dev->fbdev);
+}
+EXPORT_SYMBOL(drm_fb_helper_lastclose);
+
+/**
+ * drm_fb_helper_output_poll_changed - DRM mode config \.output_poll_changed
+ * helper for fbdev emulation
+ * @dev: DRM device
+ *
+ * This function can be used as the
+ * _mode_config_funcs.output_poll_changed callback for drivers that only
+ * need to call drm_fb_helper_hotplug_event().
+ *
+ * Note: _device->fbdev needs to be set.
+ */
+void drm_fb_helper_output_poll_changed(struct drm_device *dev)
+{
+   drm_fb_helper_hotplug_event(dev->fbdev);
+}
+EXPORT_SYMBOL(drm_fb_helper_output_poll_changed);
+
 #define drm_fb_helper_for_each_connector(fbh, i__) \
for (({ lockdep_assert_held(&(fbh)->lock); }), \
 i__ = 0; i__ < (fbh)->connector_count; i__++)
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 6503f4c3e3ef..2558425e29e5 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -246,6 +246,8 @@ int drm_fb_helper_simple_init(struct drm_device *dev,
  const struct drm_fb_helper_funcs *funcs,
  unsigned int bpp, int max_conn);
 void drm_fb_helper_simple_fini(struct drm_device *dev);
+void drm_fb_helper_lastclose(struct drm_device *dev);
+void drm_fb_helper_output_poll_changed(struct drm_device *dev);
 void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper 
*helper,
   const struct drm_fb_helper_funcs *funcs);
 int drm_fb_helper_init(struct drm_device *dev,
@@ -328,6 +330,14 @@ static inline void drm_fb_helper_simple_fini(struct 
drm_device *dev)
 {
 }
 
+static inline void drm_fb_helper_lastclose(struct drm_device *dev)
+{
+}
+
+static inline void drm_fb_helper_output_poll_changed(struct drm_device *dev)
+{
+}
+
 static inline void drm_fb_helper_prepare(struct drm_device *dev,
struct drm_fb_helper *helper,
const struct drm_fb_helper_funcs *funcs)
-- 
2.14.2

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


[PATCH v2 0/8] drm/tinydrm: Use vmalloc BO

2017-10-15 Thread Noralf Trønnes
This patchset adds a library for vmalloc buffer objects and makes use of
it in tinydrm.

The reason I want to move away from the cma helper, is that it restricts
which drivers to PRIME import from, since cma requires the buffer to be
physically continuous. Initially I looked at udl and decided to use
shmem, but have later decided against it since shmem doesn't work with
fbdev deferred I/O, they both use page->lru and page->mapping. This
meant adding a shadow buffer for fbdev with increased complexity, so I
fell back to the KISS principle.

I'm trying to make tinydrm support drivers like simpledrm and udl, so if
using vmalloc blocks those use cases, please let me know.

I will do a follow up for the cma library which removes struct
drm_fbdev_cma and wrappers.

Noralf.

Changes since version 1:
- tinydrm: Remove dma_coerce_mask_and_coherent() calls (Matt Gattis)

Noralf Trønnes (8):
  drm/fb-helper: Handle function NULL argument
  drm: Add drm_device->fbdev pointer
  drm/fb-helper: Add simple init/fini functions
  drm/fb-helper: Add .last_close and .output_poll_changed helpers
  drm/gem-fb-helper: Add drm_gem_fb_debugfs_show()
  drm: Add vmalloc BO helper
  drm/tinydrm: Use drm_vmalloc_bo
  drm/tinydrm: Relax buffer line prefetch

 Documentation/gpu/drm-kms-helpers.rst  |  12 +
 drivers/gpu/drm/Kconfig|   7 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/drm_fb_helper.c| 223 +-
 drivers/gpu/drm/drm_gem_framebuffer_helper.c   |  45 
 drivers/gpu/drm/drm_vmalloc_bo_helper.c| 305 +
 drivers/gpu/drm/tinydrm/Kconfig|   2 +-
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c| 134 +++
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c |  56 +++--
 drivers/gpu/drm/tinydrm/mi0283qt.c |   8 +-
 drivers/gpu/drm/tinydrm/mipi-dbi.c |  31 +--
 drivers/gpu/drm/tinydrm/repaper.c  |  21 +-
 drivers/gpu/drm/tinydrm/st7586.c   |  14 +-
 include/drm/drm_device.h   |   8 +
 include/drm/drm_fb_helper.h|  32 +++
 include/drm/drm_gem_framebuffer_helper.h   |   6 +
 include/drm/drm_vmalloc_bo_helper.h|  88 +++
 include/drm/tinydrm/mipi-dbi.h |   2 +
 include/drm/tinydrm/tinydrm.h  |  38 +--
 19 files changed, 811 insertions(+), 222 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_vmalloc_bo_helper.c
 create mode 100644 include/drm/drm_vmalloc_bo_helper.h

-- 
2.14.2

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


[PATCH v2 2/8] drm: Add drm_device->fbdev pointer

2017-10-15 Thread Noralf Trønnes
drm_fb_helper is *the* way of doing fbdev emulation so add a pointer to
struct drm_device. This makes it possible to add callback helpers for
.last_close and .output_poll_changed further reducing fbdev emulation
footprint in drivers.

Signed-off-by: Noralf Trønnes 
---
 include/drm/drm_device.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index e21af87a2f3c..3c104b15a0c8 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -17,6 +17,7 @@ struct drm_vblank_crtc;
 struct drm_sg_mem;
 struct drm_local_map;
 struct drm_vma_offset_manager;
+struct drm_fb_helper;
 
 struct inode;
 
@@ -185,6 +186,13 @@ struct drm_device {
struct drm_vma_offset_manager *vma_offset_manager;
/*@} */
int switch_power_state;
+
+   /**
+* @fbdev:
+*
+* Optional pointer to the fbdev emulation structure.
+*/
+   struct drm_fb_helper *fbdev;
 };
 
 #endif
-- 
2.14.2

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


[PATCH v2 7/8] drm/tinydrm: Use drm_vmalloc_bo

2017-10-15 Thread Noralf Trønnes
Use the vmalloc BO helper instead of the cma helper to be able to PRIME
import from more drivers. The cma helper can only import physically
continuous buffers, but tinydrm only requires the buffer to be virtually
continuous.

This switch also makes it possible to use the drm_fb_helper_lastclose()
helper.

Some extra includes were necessary in tinydrm-helpers.c, because it
relied on includes in tinydrm.h that are now gone.

Cc: David Lechner 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/tinydrm/Kconfig|   2 +-
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c| 134 +
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c |   2 +
 drivers/gpu/drm/tinydrm/mi0283qt.c |   8 +-
 drivers/gpu/drm/tinydrm/mipi-dbi.c |  31 ++
 drivers/gpu/drm/tinydrm/repaper.c  |  21 ++--
 drivers/gpu/drm/tinydrm/st7586.c   |  14 +--
 include/drm/tinydrm/mipi-dbi.h |   2 +
 include/drm/tinydrm/tinydrm.h  |  38 ++-
 9 files changed, 65 insertions(+), 187 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/Kconfig b/drivers/gpu/drm/tinydrm/Kconfig
index 2e790e7dced5..d47bcd6c8bfb 100644
--- a/drivers/gpu/drm/tinydrm/Kconfig
+++ b/drivers/gpu/drm/tinydrm/Kconfig
@@ -2,7 +2,7 @@ menuconfig DRM_TINYDRM
tristate "Support for simple displays"
depends on DRM
select DRM_KMS_HELPER
-   select DRM_KMS_CMA_HELPER
+   select DRM_VMALLOC_BO_HELPER
select BACKLIGHT_LCD_SUPPORT
select BACKLIGHT_CLASS_DEVICE
help
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
index 1a8a57cad431..77c5fd50af7a 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
@@ -10,7 +10,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -22,9 +24,11 @@
  *
  * It is based on _simple_display_pipe coupled with a _connector which
  * has only one fixed _display_mode. The framebuffers are backed by the
- * cma helper and have support for framebuffer flushing (dirty).
+ * vmalloc BO helper and have support for framebuffer flushing (dirty).
  * fbdev support is also included.
  *
+ * Note: The SPI core is able to create a scatter/gather table from a vmalloc
+ * buffer when dealing with DMA capable SPI controllers
  */
 
 /**
@@ -35,94 +39,6 @@
  * and registers the DRM device using devm_tinydrm_register().
  */
 
-/**
- * tinydrm_lastclose - DRM lastclose helper
- * @drm: DRM device
- *
- * This function ensures that fbdev is restored when drm_lastclose() is called
- * on the last drm_release(). Drivers can use this as their
- * _driver->lastclose callback.
- */
-void tinydrm_lastclose(struct drm_device *drm)
-{
-   struct tinydrm_device *tdev = drm->dev_private;
-
-   DRM_DEBUG_KMS("\n");
-   drm_fbdev_cma_restore_mode(tdev->fbdev_cma);
-}
-EXPORT_SYMBOL(tinydrm_lastclose);
-
-/**
- * tinydrm_gem_cma_prime_import_sg_table - Produce a CMA GEM object from
- * another driver's scatter/gather table of pinned pages
- * @drm: DRM device to import into
- * @attach: DMA-BUF attachment
- * @sgt: Scatter/gather table of pinned pages
- *
- * This function imports a scatter/gather table exported via DMA-BUF by
- * another driver using drm_gem_cma_prime_import_sg_table(). It sets the
- * kernel virtual address on the CMA object. Drivers should use this as their
- * _driver->gem_prime_import_sg_table callback if they need the virtual
- * address. tinydrm_gem_cma_free_object() should be used in combination with
- * this function.
- *
- * Returns:
- * A pointer to a newly created GEM object or an ERR_PTR-encoded negative
- * error code on failure.
- */
-struct drm_gem_object *
-tinydrm_gem_cma_prime_import_sg_table(struct drm_device *drm,
- struct dma_buf_attachment *attach,
- struct sg_table *sgt)
-{
-   struct drm_gem_cma_object *cma_obj;
-   struct drm_gem_object *obj;
-   void *vaddr;
-
-   vaddr = dma_buf_vmap(attach->dmabuf);
-   if (!vaddr) {
-   DRM_ERROR("Failed to vmap PRIME buffer\n");
-   return ERR_PTR(-ENOMEM);
-   }
-
-   obj = drm_gem_cma_prime_import_sg_table(drm, attach, sgt);
-   if (IS_ERR(obj)) {
-   dma_buf_vunmap(attach->dmabuf, vaddr);
-   return obj;
-   }
-
-   cma_obj = to_drm_gem_cma_obj(obj);
-   cma_obj->vaddr = vaddr;
-
-   return obj;
-}
-EXPORT_SYMBOL(tinydrm_gem_cma_prime_import_sg_table);
-
-/**
- * tinydrm_gem_cma_free_object - Free resources associated with a CMA GEM
- *   object
- * @gem_obj: GEM object to free
- *
- * This function frees the backing memory of the CMA GEM object, cleans up the
- * GEM object state and frees the memory used to store the object itself using

Re: drm_kms_helper cycle detected build error in next

2017-10-15 Thread Tony Lindgren
* Tony Lindgren  [171013 07:59]:
> Hi Tomi,
> 
> Looks like today's next build fails if omapdrm is enabled as modules
> with:
> 
> depmod: ERROR: Cycle detected: drm_kms_helper -> drm -> drm_kms_helper
> depmod: ERROR: Found 2 modules in dependency cycles!
> make: *** [Makefile:1261: _modinst_post] Error 1

Making CONFIG_DRM=y and CONFIG_DRM_KMS_HELPER=y instead of
lodable modules makes it build.

Regards,

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


Re: [PATCH] video: fbdev: Fix an errro handling path in 'au1200fb_drv_probe()'

2017-10-15 Thread Christophe JAILLET

Le 12/10/2017 à 18:25, Bartlomiej Zolnierkiewicz a écrit :

[ added dri-devel ML to cc: ]

On Tuesday, September 12, 2017 07:39:30 AM Christophe JAILLET wrote:

If 'dmam_alloc_attrs()' fails, we must go through the error handling code,
as done elsewhere in this function. Otherwise, there is a resource leak.

Signed-off-by: Christophe JAILLET 
---
I'm also puzzled by the 'framebuffer_alloc()' call a few lines above.
'ret' is known to be 0 at this point. I guess that -ENOMEM should also be
returned.

Yes, moreover the "failed:" error path is incomplete (please take
a look at au1200fb_drv_remove() for comparison) and needs to be fixed.

Could you please take care of it?


I will try, but be indulgent :)

My understanding of the code is that they are several issues all related 
to this error handling path (double free, missing memory release, 
invalid irq release...)
I will try to sort it out, but my first tries will likely be incomplete 
and/or broken.


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


[PATCH 1/4] dt-bindings: display: rcar-du: Document R8A774[35] DU

2017-10-15 Thread Fabrizio Castro
Add device tree bindings for r8a7743 and r8a7745 DUs.
r8a7743 DU is similar to the one from r8a7791, r8a7745 DU is similar
to the one from r8a7794.

Signed-off-by: Fabrizio Castro 
Reviewed-by: Biju Das 
---
 .../devicetree/bindings/display/renesas,du.txt | 30 --
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/renesas,du.txt 
b/Documentation/devicetree/bindings/display/renesas,du.txt
index 4bbd1e9..c520226 100644
--- a/Documentation/devicetree/bindings/display/renesas,du.txt
+++ b/Documentation/devicetree/bindings/display/renesas,du.txt
@@ -3,6 +3,8 @@
 Required Properties:
 
   - compatible: must be one of the following.
+- "renesas,du-r8a7743" for R8A7743 (RZ/G1M) compatible DU
+- "renesas,du-r8a7745" for R8A7745 (RZ/G1E) compatible DU
 - "renesas,du-r8a7779" for R8A7779 (R-Car H1) compatible DU
 - "renesas,du-r8a7790" for R8A7790 (R-Car H2) compatible DU
 - "renesas,du-r8a7791" for R8A7791 (R-Car M2-W) compatible DU
@@ -27,10 +29,10 @@ Required Properties:
   - clock-names: Name of the clocks. This property is model-dependent.
 - R8A7779 uses a single functional clock. The clock doesn't need to be
   named.
-- R8A779[0123456] use one functional clock per channel and one clock per
-  LVDS encoder (if available). The functional clocks must be named "du.x"
-  with "x" being the channel numerical index. The LVDS clocks must be
-  named "lvds.x" with "x" being the LVDS encoder numerical index.
+- R8A779[0123456] and R8A774[35] use one functional clock per channel and
+  one clock per LVDS encoder (if available). The functional clocks must be
+  named "du.x" with "x" being the channel numerical index. The LVDS clocks
+  must be named "lvds.x" with "x" being the LVDS encoder numerical index.
 - In addition to the functional and encoder clocks, all DU versions also
   support externally supplied pixel clocks. Those clocks are optional.
   When supplied they must be named "dclkin.x" with "x" being the input
@@ -49,16 +51,18 @@ bindings specified in 
Documentation/devicetree/bindings/graph.txt.
 The following table lists for each supported model the port number
 corresponding to each DU output.
 
-   Port 0  Port1   Port2   Port3
+  Port0  Port1  Port2  Port3
 -
- R8A7779 (H1)  DPAD 0  DPAD 1  -   -
- R8A7790 (H2)  DPADLVDS 0  LVDS 1  -
- R8A7791 (M2-W)DPADLVDS 0  -   -
- R8A7792 (V2H) DPAD 0  DPAD 1  -   -
- R8A7793 (M2-N)DPADLVDS 0  -   -
- R8A7794 (E2)  DPAD 0  DPAD 1  -   -
- R8A7795 (H3)  DPADHDMI 0  HDMI 1  LVDS
- R8A7796 (M3-W)DPADHDMILVDS-
+ R8A7743 (RZ/G1M) DPAD 0 LVDS 0 -  -
+ R8A7745 (RZ/G1E) DPAD 0 DPAD 1 -  -
+ R8A7779 (R-Car H1)   DPAD 0 DPAD 1 -  -
+ R8A7790 (R-Car H2)   DPAD   LVDS 0 LVDS 1 -
+ R8A7791 (R-Car M2-W) DPAD   LVDS 0 -  -
+ R8A7792 (R-Car V2H)  DPAD 0 DPAD 1 -  -
+ R8A7793 (R-Car M2-N) DPAD   LVDS 0 -  -
+ R8A7794 (R-Car E2)   DPAD 0 DPAD 1 -  -
+ R8A7795 (R-Car H3)   DPAD   HDMI 0 HDMI 1 LVDS
+ R8A7796 (R-Car M3-W) DPAD   HDMI   LVDS   -
 
 
 Example: R8A7795 (R-Car H3) ES2.0 DU
-- 
2.7.4

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


[PATCH v4] drm/amd/powerplay: Remove unnecessary cast on void pointer

2017-10-15 Thread Harsha Sharma
Done with following coccinelle patch

@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|

- (T*)
  e
)

Signed-off-by: Harsha Sharma 
---
Changes in v4:
 -Removed git diff warning "No newline at end of file"
Changes in v3:
 -Removed unnecessary lines
 -Remove more useless casts
Changes in v2:
 -Remove unnecessary parentheses
 -Remove one more useless cast
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c |   6 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c|   8 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   |   2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c |   4 +-
 .../gpu/drm/amd/powerplay/hwmgr/processpptables.c  |   2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 177 ++---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c |   2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  22 +--
 .../gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c   |   2 +-
 9 files changed, 105 insertions(+), 120 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
index bc839ff0bdd0..f22104c78dcb 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
@@ -474,7 +474,7 @@ static int cz_tf_upload_pptable_to_smu(struct pp_hwmgr 
*hwmgr, void *input,
PP_ASSERT_WITH_CODE((0 == ret && NULL != table),
"Fail to get clock table from SMU!", return 
-EINVAL;);
 
-   clock_table = (struct SMU8_Fusion_ClkTable *)table;
+   clock_table = table;
 
/* patch clock table */
PP_ASSERT_WITH_CODE((vddc_table->count <= CZ_MAX_HARDWARE_POWERLEVELS),
@@ -868,8 +868,8 @@ static int cz_tf_update_low_mem_pstate(struct pp_hwmgr 
*hwmgr,
 {
bool disable_switch;
bool enable_low_mem_state;
-   struct cz_hwmgr *hw_data = (struct cz_hwmgr *)(hwmgr->backend);
-   const struct phm_set_power_state_input *states = (struct 
phm_set_power_state_input *)input;
+   struct cz_hwmgr *hw_data = hwmgr->backend;
+   const struct phm_set_power_state_input *states = input;
const struct cz_power_state *pnew_state = 
cast_const_PhwCzPowerState(states->pnew_state);
 
if (hw_data->sys_info.nb_dpm_enable) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index 9547f265a8bb..5d63a1b18b39 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -469,7 +469,7 @@ int phm_reset_single_dpm_table(void *table,
 {
int i;
 
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
dpm_table->count = count > max ? max : count;
 
@@ -484,7 +484,7 @@ void phm_setup_pcie_table_entry(
uint32_t index, uint32_t pcie_gen,
uint32_t pcie_lanes)
 {
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
dpm_table->dpm_level[index].value = pcie_gen;
dpm_table->dpm_level[index].param1 = pcie_lanes;
dpm_table->dpm_level[index].enabled = 1;
@@ -494,7 +494,7 @@ int32_t phm_get_dpm_level_enable_mask_value(void *table)
 {
int32_t i;
int32_t mask = 0;
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
for (i = dpm_table->count; i > 0; i--) {
mask = mask << 1;
@@ -566,7 +566,7 @@ int phm_find_boot_level(void *table,
 {
int result = -EINVAL;
uint32_t i;
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
for (i = 0; i < dpm_table->count; i++) {
if (value == dpm_table->dpm_level[i].value) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
index 953e0c9ad7cd..676f2e8bb2ee 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
@@ -579,7 +579,7 @@ static ATOM_GPIO_PIN_LUT *get_gpio_lookup_table(void 
*device)
PP_ASSERT_WITH_CODE((NULL != table_address),
"Error retrieving BIOS Table Address!", return NULL;);
 
-   return (ATOM_GPIO_PIN_LUT *)table_address;
+   return table_address;
 }
 
 /**
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
index c062844b15f3..219f478482bb 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
@@ -66,7 +66,7 @@ static struct atom_voltage_objects_info_v4_1 
*pp_atomfwctrl_get_voltage_info_tab
 "Error retrieving BIOS Table Address!",
 return NULL);
 
-return (struct atom_voltage_objects_info_v4_1 

Re: [PATCH 18/48] drm: omapdrm: displays: Get panel source at connect time

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:14PM +0300, Laurent Pinchart wrote:
> The connector drivers need a handle to the source they are connected to
> in order to control the source.
> 
> All drivers get that handle at probe time, resulting in probe deferral
> when the source hasn't been probed yet. However they don't need the
> handle until their connect handler is called.
> 
> Move retrieval of the source handle to the connect handler to avoid
> probe deferrals.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c   | 35 +++-
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c| 27 +++--
>  .../omapdrm/displays/panel-lgphilips-lb035q02.c| 35 +++-
>  .../drm/omapdrm/displays/panel-nec-nl8048hl11.c| 39 --
>  .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c | 35 +++-
>  .../drm/omapdrm/displays/panel-sony-acx565akm.c| 26 ++--
>  .../drm/omapdrm/displays/panel-tpo-td028ttec1.c| 46 
> +++---
>  .../drm/omapdrm/displays/panel-tpo-td043mtea1.c| 29 +++---
>  8 files changed, 119 insertions(+), 153 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> index 6468a765f3d1..e48c4a7d5276 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> @@ -38,16 +38,25 @@ struct panel_drv_data {
>  static int panel_dpi_connect(struct omap_dss_device *dssdev)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> + struct omap_dss_device *in;
>   int r;
>  
>   if (omapdss_device_is_connected(dssdev))
>   return 0;
>  
> + in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> + if (IS_ERR(in)) {
> + dev_err(dssdev->dev, "failed to find video source\n");
> + return PTR_ERR(in);
> + }
> +
>   r = in->ops.dpi->connect(in, dssdev);
> - if (r)
> + if (r) {
> + omap_dss_put_device(in);
>   return r;
> + }
>  
> + ddata->in = in;
>   return 0;
>  }
>  
> @@ -60,6 +69,9 @@ static void panel_dpi_disconnect(struct omap_dss_device 
> *dssdev)
>   return;
>  
>   in->ops.dpi->disconnect(in, dssdev);
> +
> + omap_dss_put_device(in);
> + ddata->in = NULL;
>  }
>  
>  static int panel_dpi_enable(struct omap_dss_device *dssdev)
> @@ -165,7 +177,6 @@ static int panel_dpi_probe_of(struct platform_device 
> *pdev)
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct device_node *node = pdev->dev.of_node;
>   struct device_node *bl_node;
> - struct omap_dss_device *in;
>   int r;
>   struct display_timing timing;
>   struct gpio_desc *gpio;
> @@ -207,15 +218,6 @@ static int panel_dpi_probe_of(struct platform_device 
> *pdev)
>  
>   videomode_from_timing(, >vm);
>  
> - in = omapdss_of_find_source_for_first_ep(node);
> - if (IS_ERR(in)) {
> - dev_err(>dev, "failed to find video source\n");
> - r = PTR_ERR(in);
> - goto error_free_backlight;
> - }
> -
> - ddata->in = in;
> -
>   return 0;
>  
>  error_free_backlight:
> @@ -251,29 +253,22 @@ static int panel_dpi_probe(struct platform_device *pdev)
>   r = omapdss_register_display(dssdev);
>   if (r) {
>   dev_err(>dev, "Failed to register panel\n");
> - goto err_reg;
> + return r;
>   }
>  
>   return 0;
> -
> -err_reg:
> - omap_dss_put_device(ddata->in);
> - return r;
>  }
>  
>  static int __exit panel_dpi_remove(struct platform_device *pdev)
>  {
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = >dssdev;
> - struct omap_dss_device *in = ddata->in;
>  
>   omapdss_unregister_display(dssdev);
>  
>   panel_dpi_disable(dssdev);
>   panel_dpi_disconnect(dssdev);
>  
> - omap_dss_put_device(in);
> -
>   if (ddata->backlight)
>   put_device(>backlight->dev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index aac14f399657..1262b7b08ba2 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -703,17 +703,23 @@ static int dsicm_panel_reset(struct panel_drv_data 
> *ddata)
>  static int dsicm_connect(struct omap_dss_device *dssdev)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
>   struct device *dev = >pdev->dev;
> + struct omap_dss_device *in;
>   int r;
>  
>   if (omapdss_device_is_connected(dssdev))
>   

Re: [PATCH 17/48] drm: omapdrm: displays: Get connector source at connect time

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:13PM +0300, Laurent Pinchart wrote:
> The connector drivers need a handle to the source they are connected to
> in order to control the source.
> 
> All drivers get that handle at probe time, resulting in probe deferral
> when the source hasn't been probed yet. However they don't need the
> handle until their connect handler is called.
> 
> Move retrieval of the source handle to the connect handler to avoid
> probe deferrals.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  .../gpu/drm/omapdrm/displays/connector-analog-tv.c | 45 
> --
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c   | 31 +++
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c  | 37 --
>  3 files changed, 46 insertions(+), 67 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index 44c7d9238b54..f07546b8e8dd 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -45,7 +45,7 @@ static const struct videomode tvc_pal_vm = {
>  static int tvc_connect(struct omap_dss_device *dssdev)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> + struct omap_dss_device *in;
>   int r;
>  
>   dev_dbg(ddata->dev, "connect\n");
> @@ -53,10 +53,19 @@ static int tvc_connect(struct omap_dss_device *dssdev)
>   if (omapdss_device_is_connected(dssdev))
>   return 0;
>  
> + in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
> + if (IS_ERR(in)) {
> + dev_err(ddata->dev, "failed to find video source\n");
> + return PTR_ERR(in);
> + }
> +
>   r = in->ops.atv->connect(in, dssdev);
> - if (r)
> + if (r) {
> + omap_dss_put_device(in);
>   return r;
> + }
>  
> + ddata->in = in;
>   return 0;
>  }
>  
> @@ -71,6 +80,9 @@ static void tvc_disconnect(struct omap_dss_device *dssdev)
>   return;
>  
>   in->ops.atv->disconnect(in, dssdev);
> +
> + omap_dss_put_device(in);
> + ddata->in = NULL;
>  }
>  
>  static int tvc_enable(struct omap_dss_device *dssdev)
> @@ -173,23 +185,6 @@ static struct omap_dss_driver tvc_driver = {
>   .set_wss= tvc_set_wss,
>  };
>  
> -static int tvc_probe_of(struct platform_device *pdev)
> -{
> - struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> - struct device_node *node = pdev->dev.of_node;
> - struct omap_dss_device *in;
> -
> - in = omapdss_of_find_source_for_first_ep(node);
> - if (IS_ERR(in)) {
> - dev_err(>dev, "failed to find video source\n");
> - return PTR_ERR(in);
> - }
> -
> - ddata->in = in;
> -
> - return 0;
> -}
> -
>  static int tvc_probe(struct platform_device *pdev)
>  {
>   struct panel_drv_data *ddata;
> @@ -203,10 +198,6 @@ static int tvc_probe(struct platform_device *pdev)
>   platform_set_drvdata(pdev, ddata);
>   ddata->dev = >dev;
>  
> - r = tvc_probe_of(pdev);
> - if (r)
> - return r;
> -
>   ddata->vm = tvc_pal_vm;
>  
>   dssdev = >dssdev;
> @@ -219,28 +210,22 @@ static int tvc_probe(struct platform_device *pdev)
>   r = omapdss_register_display(dssdev);
>   if (r) {
>   dev_err(>dev, "Failed to register panel\n");
> - goto err_reg;
> + return r;
>   }
>  
>   return 0;
> -err_reg:
> - omap_dss_put_device(ddata->in);
> - return r;
>  }
>  
>  static int __exit tvc_remove(struct platform_device *pdev)
>  {
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = >dssdev;
> - struct omap_dss_device *in = ddata->in;
>  
>   omapdss_unregister_display(>dssdev);
>  
>   tvc_disable(dssdev);
>   tvc_disconnect(dssdev);
>  
> - omap_dss_put_device(in);
> -
>   return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 7728b5425d19..ad915860b7fd 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -51,16 +51,25 @@ struct panel_drv_data {
>  static int dvic_connect(struct omap_dss_device *dssdev)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> + struct omap_dss_device *in;
>   int r;
>  
>   if (omapdss_device_is_connected(dssdev))
>   return 0;
>  
> + in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> + if (IS_ERR(in)) {
> + dev_err(dssdev->dev, "failed to find video source\n");
> + 

Re: [PATCH 02/48] drm: omapdrm: Pass drm_device to omap_gem_resume()

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:58:58PM +0300, Laurent Pinchart wrote:
> The omap_gem_resume() function is internal to the driver. Pass it a
> drm_device pointer that the caller already has instead of looking it up
> from device data.
> 
> Signed-off-by: Laurent Pinchart 

Reviewed-by: Sebastian Reichel 

-- Sebastian

> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c | 2 +-
>  drivers/gpu/drm/omapdrm/omap_drv.h | 2 +-
>  drivers/gpu/drm/omapdrm/omap_gem.c | 7 +++
>  3 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index cdf5b0601eba..2d15ea1d6c92 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -740,7 +740,7 @@ static int omap_drm_resume(struct device *dev)
>  
>   drm_kms_helper_poll_enable(drm_dev);
>  
> - return omap_gem_resume(dev);
> + return omap_gem_resume(drm_dev);
>  }
>  #endif
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
> b/drivers/gpu/drm/omapdrm/omap_drv.h
> index 4bd1e9070b31..04f35f74f80c 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.h
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
> @@ -94,7 +94,7 @@ void omap_gem_describe_objects(struct list_head *list, 
> struct seq_file *m);
>  #endif
>  
>  #ifdef CONFIG_PM
> -int omap_gem_resume(struct device *dev);
> +int omap_gem_resume(struct drm_device *dev);
>  #endif
>  
>  int omap_irq_enable_vblank(struct drm_crtc *crtc);
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c 
> b/drivers/gpu/drm/omapdrm/omap_gem.c
> index 5c5c86ddd6f4..fd81396baaf9 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem.c
> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
> @@ -996,10 +996,9 @@ void *omap_gem_vaddr(struct drm_gem_object *obj)
>  
>  #ifdef CONFIG_PM
>  /* re-pin objects in DMM in resume path: */
> -int omap_gem_resume(struct device *dev)
> +int omap_gem_resume(struct drm_device *dev)
>  {
> - struct drm_device *drm_dev = dev_get_drvdata(dev);
> - struct omap_drm_private *priv = drm_dev->dev_private;
> + struct omap_drm_private *priv = dev->dev_private;
>   struct omap_gem_object *omap_obj;
>   int ret = 0;
>  
> @@ -1012,7 +1011,7 @@ int omap_gem_resume(struct device *dev)
>   omap_obj->pages, npages,
>   omap_obj->roll, true);
>   if (ret) {
> - dev_err(dev, "could not repin: %d\n", ret);
> + dev_err(dev->dev, "could not repin: %d\n", ret);
>   return ret;
>   }
>   }
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> 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


[PATCH 2/4] drm: rcar-du: Add R8A7743 support

2017-10-15 Thread Fabrizio Castro
Add support for the R8A7743 DU (which is very similar to the R8A7791 DU);
it has 1 DPAD (RGB) output and 1 LVDS output.

Signed-off-by: Fabrizio Castro 
Reviewed-by: Biju Das 
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index d2f29e6..3db5e8d 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -34,6 +34,27 @@
  * Device Information
  */
 
+static const struct rcar_du_device_info rzg1_du_r8a7743_info = {
+   .gen = 2,
+   .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
+ | RCAR_DU_FEATURE_EXT_CTRL_REGS,
+   .num_crtcs = 2,
+   .routes = {
+   /*
+* R8A7743 has one RGB output and one LVDS output
+*/
+   [RCAR_DU_OUTPUT_DPAD0] = {
+   .possible_crtcs = BIT(1) | BIT(0),
+   .port = 0,
+   },
+   [RCAR_DU_OUTPUT_LVDS0] = {
+   .possible_crtcs = BIT(0),
+   .port = 1,
+   },
+   },
+   .num_lvds = 1,
+};
+
 static const struct rcar_du_device_info rcar_du_r8a7779_info = {
.gen = 2,
.features = 0,
@@ -207,6 +228,7 @@ static const struct rcar_du_device_info 
rcar_du_r8a7796_info = {
 };
 
 static const struct of_device_id rcar_du_of_table[] = {
+   { .compatible = "renesas,du-r8a7743", .data = _du_r8a7743_info },
{ .compatible = "renesas,du-r8a7779", .data = _du_r8a7779_info },
{ .compatible = "renesas,du-r8a7790", .data = _du_r8a7790_info },
{ .compatible = "renesas,du-r8a7791", .data = _du_r8a7791_info },
-- 
2.7.4

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


Re: [PATCH 13/48] drm: omapdrm: connector-analog-tv: Remove tvc_of_match forward declaration

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:09PM +0300, Laurent Pinchart wrote:
> The tvc_of_match variable is never referenced before its definition.
> Remove the forward declaration.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index 542a76503fbd..d3611233e264 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -40,8 +40,6 @@ static const struct videomode tvc_pal_vm = {
> DISPLAY_FLAGS_VSYNC_LOW,
>  };
>  
> -static const struct of_device_id tvc_of_match[];
> -
>  #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
>  
>  static int tvc_connect(struct omap_dss_device *dssdev)
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> 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 04/48] drm: omapdrm: Merge the omapdss and omapdss-base modules

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:00PM +0300, Laurent Pinchart wrote:
> There's no need for the omapdss-base code to be part of a separate
> module. Merge it with the omapdss module. This allows removing the
> exports for internal symbols.
> 
> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/omapdrm/dss/Kconfig   |  4 
>  drivers/gpu/drm/omapdrm/dss/Makefile  | 19 +--
>  drivers/gpu/drm/omapdrm/dss/base.c|  7 ---
>  drivers/gpu/drm/omapdrm/dss/display.c |  2 --
>  drivers/gpu/drm/omapdrm/dss/dss-of.c  |  2 --
>  drivers/gpu/drm/omapdrm/dss/output.c  | 14 --
>  6 files changed, 13 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig 
> b/drivers/gpu/drm/omapdrm/dss/Kconfig
> index f24ebf7f61dd..39a30a64448a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
> @@ -1,12 +1,8 @@
>  config OMAP2_DSS_INIT
>   bool
>  
> -config OMAP_DSS_BASE
> - tristate
> -
>  menuconfig OMAP2_DSS
>  tristate "OMAP2+ Display Subsystem support"
> - select OMAP_DSS_BASE
>   select VIDEOMODE_HELPERS
>   select OMAP2_DSS_INIT
>   select HDMI
> diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile 
> b/drivers/gpu/drm/omapdrm/dss/Makefile
> index 3c5644c3fc38..531b4d8075e5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Makefile
> +++ b/drivers/gpu/drm/omapdrm/dss/Makefile
> @@ -1,12 +1,19 @@
>  obj-$(CONFIG_OMAP2_DSS_INIT) += omapdss-boot-init.o
> -
> -obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
> -omapdss-base-y := base.o display.o dss-of.o output.o
> -
>  obj-$(CONFIG_OMAP2_DSS) += omapdss.o
> +
>  # Core DSS files
> -omapdss-y := core.o dss.o dispc.o dispc_coefs.o \
> - pll.o video-pll.o
> +omapdss-y := \
> + base.o \
> + display.o \
> + dss-of.o \
> + output.o \
> + core.o \
> + dss.o \
> + dispc.o \
> + dispc_coefs.o \
> + pll.o \
> + video-pll.o
> +

I guess it makes sense to sort this alphabetically, otherwise:

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
>  omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
>  omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 13e91faaf7a6..eff427dd3297 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -20,7 +20,6 @@ void omapdss_set_is_initialized(bool set)
>  {
>   dss_initialized = set;
>  }
> -EXPORT_SYMBOL(omapdss_set_is_initialized);
>  
>  bool omapdss_is_initialized(void)
>  {
> @@ -32,7 +31,6 @@ void dispc_set_ops(const struct dispc_ops *o)
>  {
>   ops = o;
>  }
> -EXPORT_SYMBOL(dispc_set_ops);
>  
>  const struct dispc_ops *dispc_get_ops(void)
>  {
> @@ -108,7 +106,6 @@ void omapdss_gather_components(struct device *dev)
>   omapdss_walk_device(dev, child, true);
>   }
>  }
> -EXPORT_SYMBOL(omapdss_gather_components);
>  
>  static bool omapdss_component_is_loaded(struct omapdss_comp_node *comp)
>  {
> @@ -134,7 +131,3 @@ bool omapdss_stack_is_ready(void)
>   return true;
>  }
>  EXPORT_SYMBOL(omapdss_stack_is_ready);
> -
> -MODULE_AUTHOR("Tomi Valkeinen ");
> -MODULE_DESCRIPTION("OMAP Display Subsystem Base");
> -MODULE_LICENSE("GPL v2");
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
> b/drivers/gpu/drm/omapdrm/dss/display.c
> index 8c77a2d20969..a86471f73094 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -35,7 +35,6 @@ void omapdss_default_get_timings(struct omap_dss_device 
> *dssdev,
>  {
>   *vm = dssdev->panel.vm;
>  }
> -EXPORT_SYMBOL(omapdss_default_get_timings);
>  
>  static LIST_HEAD(panel_list);
>  static DEFINE_MUTEX(panel_list_mutex);
> @@ -104,7 +103,6 @@ bool omapdss_component_is_display(struct device_node 
> *node)
>   mutex_unlock(_list_mutex);
>   return found;
>  }
> -EXPORT_SYMBOL(omapdss_component_is_display);
>  
>  struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev)
>  {
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss-of.c 
> b/drivers/gpu/drm/omapdrm/dss/dss-of.c
> index c6b86f348a5c..d3a19a5dfd35 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss-of.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss-of.c
> @@ -44,7 +44,6 @@ struct device_node *dss_of_port_get_parent_device(struct 
> device_node *port)
>  
>   return NULL;
>  }
> -EXPORT_SYMBOL_GPL(dss_of_port_get_parent_device);
>  
>  u32 dss_of_port_get_port_number(struct device_node *port)
>  {
> @@ -57,7 +56,6 @@ u32 dss_of_port_get_port_number(struct device_node *port)
>  
>   return reg;
>  }
> -EXPORT_SYMBOL_GPL(dss_of_port_get_port_number);
>  
>  struct omap_dss_device *
>  omapdss_of_find_source_for_first_ep(struct device_node *node)
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
> 

Re: [PATCH 16/48] drm: omapdrm: displays: Remove OF node check in panel drivers

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:12PM +0300, Laurent Pinchart wrote:
> No panel is instantiated through platform data anymore, there is no
> need to check for OF node presence.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c| 3 ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 3 ---
>  drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c | 3 ---
>  drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c | 3 ---
>  drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  | 3 ---
>  drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c | 3 ---
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c | 3 ---
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c | 3 ---
>  8 files changed, 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> index e065f7e10cca..6468a765f3d1 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> @@ -231,9 +231,6 @@ static int panel_dpi_probe(struct platform_device *pdev)
>   struct omap_dss_device *dssdev;
>   int r;
>  
> - if (!pdev->dev.of_node)
> - return -ENODEV;
> -
>   ddata = devm_kzalloc(>dev, sizeof(*ddata), GFP_KERNEL);
>   if (ddata == NULL)
>   return -ENOMEM;
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index bdc0e8a3832d..aac14f399657 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -1168,9 +1168,6 @@ static int dsicm_probe(struct platform_device *pdev)
>   platform_set_drvdata(pdev, ddata);
>   ddata->pdev = pdev;
>  
> - if (!pdev->dev.of_node)
> - return -ENODEV;
> -
>   r = dsicm_probe_of(pdev);
>   if (r)
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> index 74d13969b9ca..b955aa615a5f 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> @@ -268,9 +268,6 @@ static int lb035q02_panel_spi_probe(struct spi_device 
> *spi)
>  
>   ddata->spi = spi;
>  
> - if (!spi->dev.of_node)
> - return -ENODEV;
> -
>   r = lb035q02_probe_of(spi);
>   if (r)
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> index df8132d3b9c6..70fa5a04c00e 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> @@ -277,9 +277,6 @@ static int nec_8048_probe(struct spi_device *spi)
>  
>   ddata->spi = spi;
>  
> - if (!spi->dev.of_node)
> - return -ENODEV;
> -
>   r = nec_8048_probe_of(spi);
>   if (r)
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
> index 98d170aecaba..99048e430871 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
> @@ -268,9 +268,6 @@ static int sharp_ls_probe(struct platform_device *pdev)
>  
>   platform_set_drvdata(pdev, ddata);
>  
> - if (!pdev->dev.of_node)
> - return -ENODEV;
> -
>   r = sharp_ls_probe_of(pdev);
>   if (r)
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> index 06d7d8362a73..cc5e9a68726a 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> @@ -720,9 +720,6 @@ static int acx565akm_probe(struct spi_device *spi)
>  
>   dev_dbg(>dev, "%s\n", __func__);
>  
> - if (!spi->dev.of_node)
> - return -ENODEV;
> -
>   spi->mode = SPI_MODE_3;
>  
>   ddata = devm_kzalloc(>dev, sizeof(*ddata), GFP_KERNEL);
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
> index 0a38a0e8c925..34d8f42fefbe 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
> @@ -404,9 +404,6 @@ static int td028ttec1_panel_probe(struct spi_device *spi)
>  
>   ddata->spi_dev = spi;
>  
> - if (!spi->dev.of_node)
> - return -ENODEV;
> -
>   r = td028ttec1_probe_of(spi);
>   if (r)
>   return r;
> diff --git 

Re: [PATCH 06/48] drm: omapdrm: dss: Make dss_dump_clocks() function static

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:02PM +0300, Laurent Pinchart wrote:
> The function isn't used outside of its compilation unit, make it static.
> 
> Signed-off-by: Laurent Pinchart 

Reviewed-by: Sebastian Reichel 

-- Sebastian

> ---
>  drivers/gpu/drm/omapdrm/dss/dss.c | 4 +++-
>  drivers/gpu/drm/omapdrm/dss/dss.h | 1 -
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
> b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 6ce26a4b93b3..0d447eddf4d6 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -368,7 +368,8 @@ const char *dss_get_clk_source_name(enum dss_clk_source 
> clk_src)
>   return dss_generic_clk_source_names[clk_src];
>  }
>  
> -void dss_dump_clocks(struct seq_file *s)
> +#if defined(CONFIG_OMAP2_DSS_DEBUGFS)
> +static void dss_dump_clocks(struct seq_file *s)
>  {
>   const char *fclk_name;
>   unsigned long fclk_rate;
> @@ -387,6 +388,7 @@ void dss_dump_clocks(struct seq_file *s)
>  
>   dss_runtime_put();
>  }
> +#endif
>  
>  static void dss_dump_regs(struct seq_file *s)
>  {
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h 
> b/drivers/gpu/drm/omapdrm/dss/dss.h
> index ed465572491e..0d7f2b08b7ff 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -277,7 +277,6 @@ int dss_dpi_select_source(int port, enum omap_channel 
> channel);
>  void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select);
>  enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void);
>  const char *dss_get_clk_source_name(enum dss_clk_source clk_src);
> -void dss_dump_clocks(struct seq_file *s);
>  
>  /* DSS VIDEO PLL */
>  struct dss_pll *dss_video_pll_init(struct platform_device *pdev, int id,
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> 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


[PATCH] drm/tilcdc: Remove redundant OF_DETACHED flag setting

2017-10-15 Thread Stephen Boyd
of_fdt_unflatten_tree() already sets the flag on this node to
OF_DETACHED, because of_fdt_unflatten_tree() calls
__unflatten_device_tree() with the detached bool set to true.

Cc: Rob Herring 
Cc: Frank Rowand 
Signed-off-by: Stephen Boyd 
---
 drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c 
b/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c
index 623a9140493c..482299a6f3b0 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c
@@ -163,7 +163,6 @@ static struct device_node * __init 
tilcdc_get_overlay(struct kfree_table *kft)
return NULL;
}
 
-   of_node_set_flag(overlay, OF_DETACHED);
ret = of_resolve_phandles(overlay);
if (ret) {
pr_err("%s: Failed to resolve phandles: %d\n", __func__, ret);
-- 
2.14.GIT

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


[PATCH] drm/omap: Replace list_for_each with list_for_each_entry

2017-10-15 Thread Harsha Sharma
Replace use of list_for_each with list_for_each_entry to simplify the
code and remove variables that are used only in list_for_each.
Done with following coccinelle patch:

@r@
identifier fn,i,f,p;
expression e;
iterator name list_for_each, list_for_each_entry;
type T;
@@

fn(...) {
++ T *i;
  <+...
- list_for_each(p,e)
+ list_for_each_entry(i,e,f)
  {
  ...
-   T *i = list_entry(p,T,f);
  ...
   }
   ...+>
}

@@
identifier r.fn,r.p;
@@

fn(...) {
  ...
- struct list_head *p;
  ... when != p
}

@@
identifier r.fn,r.i,r.f;
expression r.e;
statement S;
@@

fn(...) {
  <...
  list_for_each_entry(i,e,f)
- {
  S
- }
  ...>
}

@s@
identifier i,f,p;
expression e;
type T;
@@

- list_for_each(p,e)
+ list_for_each_entry(i,e,f)
  {
... when != T *i;
-   i = list_entry(p,T,f);
...
  }

@@
identifier s.p;
@@

- struct list_head *p;
  ... when != p

@@
identifier s.i,s.f;
expression s.e;
statement S;
@@

  list_for_each_entry(i,e,f)
- {
  S
- }

Signed-off-by: Harsha Sharma 
---
 drivers/gpu/drm/omapdrm/dss/display.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
b/drivers/gpu/drm/omapdrm/dss/display.c
index 42279933790e..e6f86026dd93 100644
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ b/drivers/gpu/drm/omapdrm/dss/display.c
@@ -43,6 +43,7 @@ static int disp_num_counter;
 
 int omapdss_register_display(struct omap_dss_device *dssdev)
 {
+   struct omp_dss_device *ldev;
struct omap_dss_driver *drv = dssdev->driver;
struct list_head *cur;
int id;
@@ -67,13 +68,9 @@ int omapdss_register_display(struct omap_dss_device *dssdev)
drv->get_timings = omapdss_default_get_timings;
 
mutex_lock(_list_mutex);
-   list_for_each(cur, _list) {
-   struct omap_dss_device *ldev = list_entry(cur,
-struct omap_dss_device,
-panel_list);
+   list_for_each_entry(ldev, _list, panel_list)
if (strcmp(ldev->alias, dssdev->alias) > 0)
break;
-   }
list_add_tail(>panel_list, cur);
mutex_unlock(_list_mutex);
return 0;
@@ -94,12 +91,11 @@ bool omapdss_component_is_display(struct device_node *node)
bool found = false;
 
mutex_lock(_list_mutex);
-   list_for_each_entry(dssdev, _list, panel_list) {
+   list_for_each_entry(dssdev, _list, panel_list)
if (dssdev->dev->of_node == node) {
found = true;
goto out;
}
-   }
 out:
mutex_unlock(_list_mutex);
return found;
@@ -152,8 +148,7 @@ struct omap_dss_device *omap_dss_get_next_device(struct 
omap_dss_device *from)
 
omap_dss_put_device(from);
 
-   list_for_each(l, _list) {
-   dssdev = list_entry(l, struct omap_dss_device, panel_list);
+   list_for_each_entry(dssdev, _list, panel_list)
if (dssdev == from) {
if (list_is_last(l, _list)) {
dssdev = NULL;
@@ -165,7 +160,6 @@ struct omap_dss_device *omap_dss_get_next_device(struct 
omap_dss_device *from)
omap_dss_get_device(dssdev);
goto out;
}
-   }
 
WARN(1, "'from' dssdev not found\n");
 
-- 
2.11.0

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


Re: [PATCH v2 1/3] drm: Extract drm_debug.[hc]

2017-10-15 Thread Haneen Mohammed
On Thu, Oct 12, 2017 at 11:35:12AM +0100, Chris Wilson wrote:
> Quoting Haneen Mohammed (2017-10-12 03:32:53)
> > diff --git a/drivers/gpu/drm/drm_debug.c b/drivers/gpu/drm/drm_debug.c
> > new file mode 100644
> > index 000..a79593f
> > --- /dev/null
> > +++ b/drivers/gpu/drm/drm_debug.c
> > @@ -0,0 +1,75 @@
> > +/*
> > + * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California.
> > + * All Rights Reserved.
> > + *
> > + * Author Rickard E. (Rik) Faith 
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the 
> > "Software"),
> > + * to deal in the Software without restriction, including without 
> > limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the 
> > next
> > + * paragraph) shall be included in all copies or substantial portions of 
> > the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
> > OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> > + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES 
> > OR
> > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> > OTHER
> > + * DEALINGS IN THE SOFTWARE.
> > + */
> > +
> > +#include 
> > +#include 
> > +
> > +#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
> > +
> > +void drm_dev_printk(const struct device *dev, const char *level,
> > +   unsigned int category, const char *function_name,
> > +   const char *prefix, const char *format, ...)
> > +{
> > +   struct va_format vaf;
> > +   va_list args;
> > +
> > +   if (category != DRM_UT_NONE && !(drm_debug & category))
> > +   return;
> > +
> > +   va_start(args, format);
> > +   vaf.fmt = format;
> > +   vaf.va = 
> > +
> > +   if (dev)
> > +   dev_printk(level, dev, DRM_PRINTK_FMT, function_name, 
> > prefix,
> > +  );
> > +   else
> > +   printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, 
> > );
> > +
> > +   va_end(args);
> > +}
> > +EXPORT_SYMBOL(drm_dev_printk);
> > +
> > +void drm_printk(const char *level, unsigned int category,
> > +   const char *format, ...)
> > +{
> > +   struct va_format vaf;
> > +   va_list args;
> > +
> > +   if (category != DRM_UT_NONE && !(drm_debug & category))
> > +   return;
> > +
> > +   va_start(args, format);
> > +   vaf.fmt = format;
> > +   vaf.va = 
> > +
> > +   printk("%s" "[" DRM_NAME ":%ps]%s %pV",
> > +  level, __builtin_return_address(0),
> > +  strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", );
> > +
> > +   va_end(args);
> > +}
> > +EXPORT_SYMBOL(drm_printk);
> 
> We already have drm_print.c, currently used to house drm_printf and the
> drm_printer. It might be a bit confusing to have drm_printk and
> drm_printf next to each other, but less confusing that calling user
> error messages drm_debug.c.
> -Chris

I didn't notice that. 
Should I move these functions and macros to drm_print.[hc] instead then?

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


[PATCH] drm/tinydrm: Replace list_for_each with list_for_each_entry

2017-10-15 Thread Harsha Sharma
Replace use of list_for_each with list_for_each_entry to simplify the
code and remove variables that are used only in list_for_each.
Done with following coccinelle patch:

@r@
identifier fn,i,f,p;
expression e;
iterator name list_for_each, list_for_each_entry;
type T;
@@

fn(...) {
++ T *i;
  <+...
- list_for_each(p,e)
+ list_for_each_entry(i,e,f)
  {
  ...
-   T *i = list_entry(p,T,f);
  ...
   }
   ...+>
}

@@
identifier r.fn,r.p;
@@

fn(...) {
  ...
- struct list_head *p;
  ... when != p
}

@@
identifier r.fn,r.i,r.f;
expression r.e;
statement S;
@@

fn(...) {
  <...
  list_for_each_entry(i,e,f)
- {
  S
- }
  ...>
}

@s@
identifier i,f,p;
expression e;
type T;
@@

- list_for_each(p,e)
+ list_for_each_entry(i,e,f)
  {
... when != T *i;
-   i = list_entry(p,T,f);
...
  }

@@
identifier s.p;
@@

- struct list_head *p;
  ... when != p

@@
identifier s.i,s.f;
expression s.e;
statement S;
@@

  list_for_each_entry(i,e,f)
- {
  S
- }

Signed-off-by: Harsha Sharma 
---
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index bd6cce093a85..bf96072d1b97 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -414,11 +414,9 @@ tinydrm_dbg_spi_print(struct spi_device *spi, struct 
spi_transfer *tr,
 void _tinydrm_dbg_spi_message(struct spi_device *spi, struct spi_message *m)
 {
struct spi_transfer *tmp;
-   struct list_head *pos;
int i = 0;
 
-   list_for_each(pos, >transfers) {
-   tmp = list_entry(pos, struct spi_transfer, transfer_list);
+   list_for_each_entry(tmp, >transfers, transfer_list) {
 
if (tmp->tx_buf)
tinydrm_dbg_spi_print(spi, tmp, tmp->tx_buf, i, true);
-- 
2.11.0

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


Re: [PATCH 4.4 23/31] drm/bridge: adv7511: Use work_struct to defer hotplug handing to out of irq context

2017-10-15 Thread Ben Hutchings
On Tue, 2017-09-12 at 09:56 -0700, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me
> know.
> 
> --
> 
> From: John Stultz 
> 
> commit 518cb7057a59b9441336d2e88a396d52b6ab0cce upstream.
> 
> I was recently seeing issues with EDID probing, where
> the logic to wait for the EDID read bit to be set by the
> IRQ wasn't happening and the code would time out and fail.
> 
> Digging deeper, I found this was due to the fact that
> IRQs were disabled as we were running in IRQ context from
> the HPD signal.
> 
> Thus this patch changes the logic to handle the HPD signal
> via a work_struct so we can be out of irq context.
[...]

Shouldn't there also be a cancel_work_sync() in the remove function?

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

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


[PATCH v5] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()

2017-10-15 Thread Harsha Sharma
Replace instances of drm_framebuffer_reference/unreference() with
*_get/put() suffixes and drm_dev_unref with *_put() suffix
because get/put is shorter and consistent with the
kernel use of *_get/put suffixes.
Done with following coccinelle semantic patch

@@
expression ex;
@@

(
-drm_framebuffer_unreference(ex);
+drm_framebuffer_put(ex);
|
-drm_dev_unref(ex);
+drm_dev_put(ex);
|
-drm_framebuffer_reference(ex);
+drm_framebuffer_get(ex);
)

Signed-off-by: Harsha Sharma 
---
Changes in v5:
 -rebase drm_dev_put change on drm-tip
Changes in v4:
 -change one instance of *_put to *_get
Changes in v3:
 -Removed changes in selftests
Changes in v2:
 -Added cocinelle patch in log message
 -cc to all driver-specific mailing lists
 drivers/gpu/drm/i915/i915_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index bf467f30c99b..1223961c3700 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -645,7 +645,7 @@ static void i915_pci_remove(struct pci_dev *pdev)
struct drm_device *dev = pci_get_drvdata(pdev);
 
i915_driver_unload(dev);
-   drm_dev_unref(dev);
+   drm_dev_put(dev);
 }
 
 static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id 
*ent)
-- 
2.11.0

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


Re: [PATCH 14/48] drm: omapdrm: displays: Remove OF node check in connector drivers

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:10PM +0300, Laurent Pinchart wrote:
> No connector is instantiated through platform data anymore, there is no
> need to check for OF node presence.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c | 3 ---
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c   | 3 ---
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c  | 3 ---
>  3 files changed, 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index d3611233e264..44c7d9238b54 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -196,9 +196,6 @@ static int tvc_probe(struct platform_device *pdev)
>   struct omap_dss_device *dssdev;
>   int r;
>  
> - if (!pdev->dev.of_node)
> - return -ENODEV;
> -
>   ddata = devm_kzalloc(>dev, sizeof(*ddata), GFP_KERNEL);
>   if (!ddata)
>   return -ENOMEM;
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 05fa24a518c8..7728b5425d19 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -275,9 +275,6 @@ static int dvic_probe(struct platform_device *pdev)
>  
>   platform_set_drvdata(pdev, ddata);
>  
> - if (!pdev->dev.of_node)
> - return -ENODEV;
> -
>   r = dvic_probe_of(pdev);
>   if (r)
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index 4600d3841c25..b8d74fba4f45 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -336,9 +336,6 @@ static int hdmic_probe(struct platform_device *pdev)
>   platform_set_drvdata(pdev, ddata);
>   ddata->dev = >dev;
>  
> - if (!pdev->dev.of_node)
> - return -ENODEV;
> -
>   r = hdmic_probe_of(pdev);
>   if (r)
>   return r;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> 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


[PATCH 3/4] clk: renesas: cpg-mssr: Add du1 clock to R8A7745

2017-10-15 Thread Fabrizio Castro
Signed-off-by: Fabrizio Castro 
Reviewed-by: Biju Das 
---
 drivers/clk/renesas/r8a7745-cpg-mssr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/renesas/r8a7745-cpg-mssr.c 
b/drivers/clk/renesas/r8a7745-cpg-mssr.c
index 9e2360a..2859504 100644
--- a/drivers/clk/renesas/r8a7745-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7745-cpg-mssr.c
@@ -129,6 +129,7 @@ static const struct mssr_mod_clk r8a7745_mod_clks[] 
__initconst = {
DEF_MOD("scif2", 719,   R8A7745_CLK_P),
DEF_MOD("scif1", 720,   R8A7745_CLK_P),
DEF_MOD("scif0", 721,   R8A7745_CLK_P),
+   DEF_MOD("du1",   723,   R8A7745_CLK_ZX),
DEF_MOD("du0",   724,   R8A7745_CLK_ZX),
DEF_MOD("ipmmu-sgx", 800,   R8A7745_CLK_ZX),
DEF_MOD("vin1",  810,   R8A7745_CLK_ZG),
-- 
2.7.4

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


[PATCH 4/4] drm: rcar-du: Add R8A7745 support

2017-10-15 Thread Fabrizio Castro
Add support for the R8A7745 DU (which is very similar to the R8A7794 DU);
it has 2 RGB outputs.

Signed-off-by: Fabrizio Castro 
Reviewed-by: Biju Das 
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 3db5e8d..faa5b32 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -55,6 +55,27 @@ static const struct rcar_du_device_info rzg1_du_r8a7743_info 
= {
.num_lvds = 1,
 };
 
+static const struct rcar_du_device_info rzg1_du_r8a7745_info = {
+   .gen = 2,
+   .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
+ | RCAR_DU_FEATURE_EXT_CTRL_REGS,
+   .num_crtcs = 2,
+   .routes = {
+   /*
+* R8A7745 has two RGB outputs
+*/
+   [RCAR_DU_OUTPUT_DPAD0] = {
+   .possible_crtcs = BIT(0),
+   .port = 0,
+   },
+   [RCAR_DU_OUTPUT_DPAD1] = {
+   .possible_crtcs = BIT(1),
+   .port = 1,
+   },
+   },
+   .num_lvds = 0,
+};
+
 static const struct rcar_du_device_info rcar_du_r8a7779_info = {
.gen = 2,
.features = 0,
@@ -229,6 +250,7 @@ static const struct rcar_du_device_info 
rcar_du_r8a7796_info = {
 
 static const struct of_device_id rcar_du_of_table[] = {
{ .compatible = "renesas,du-r8a7743", .data = _du_r8a7743_info },
+   { .compatible = "renesas,du-r8a7745", .data = _du_r8a7745_info },
{ .compatible = "renesas,du-r8a7779", .data = _du_r8a7779_info },
{ .compatible = "renesas,du-r8a7790", .data = _du_r8a7790_info },
{ .compatible = "renesas,du-r8a7791", .data = _du_r8a7791_info },
-- 
2.7.4

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


[PATCH v2] drm/amd/powerplay: Remove unnecessary cast on void pointer

2017-10-15 Thread Harsha Sharma
Done with following coccinelle patch

@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|

- (T*)
  e
)

Signed-off-by: Harsha Sharma 
---
Changes in v2:
 -Remove unnecessary parentheses 
 -Remove one more useless cast

 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c   |  6 +++---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c  |  8 
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c |  2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c   |  6 +++---
 .../gpu/drm/amd/powerplay/hwmgr/processpptables.c|  2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 20 ++--
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c   |  4 ++--
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c   | 12 ++--
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c |  2 +-
 9 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
index bc839ff0bdd0..f22104c78dcb 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
@@ -474,7 +474,7 @@ static int cz_tf_upload_pptable_to_smu(struct pp_hwmgr 
*hwmgr, void *input,
PP_ASSERT_WITH_CODE((0 == ret && NULL != table),
"Fail to get clock table from SMU!", return 
-EINVAL;);
 
-   clock_table = (struct SMU8_Fusion_ClkTable *)table;
+   clock_table = table;
 
/* patch clock table */
PP_ASSERT_WITH_CODE((vddc_table->count <= CZ_MAX_HARDWARE_POWERLEVELS),
@@ -868,8 +868,8 @@ static int cz_tf_update_low_mem_pstate(struct pp_hwmgr 
*hwmgr,
 {
bool disable_switch;
bool enable_low_mem_state;
-   struct cz_hwmgr *hw_data = (struct cz_hwmgr *)(hwmgr->backend);
-   const struct phm_set_power_state_input *states = (struct 
phm_set_power_state_input *)input;
+   struct cz_hwmgr *hw_data = hwmgr->backend;
+   const struct phm_set_power_state_input *states = input;
const struct cz_power_state *pnew_state = 
cast_const_PhwCzPowerState(states->pnew_state);
 
if (hw_data->sys_info.nb_dpm_enable) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index 9547f265a8bb..5d63a1b18b39 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -469,7 +469,7 @@ int phm_reset_single_dpm_table(void *table,
 {
int i;
 
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
dpm_table->count = count > max ? max : count;
 
@@ -484,7 +484,7 @@ void phm_setup_pcie_table_entry(
uint32_t index, uint32_t pcie_gen,
uint32_t pcie_lanes)
 {
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
dpm_table->dpm_level[index].value = pcie_gen;
dpm_table->dpm_level[index].param1 = pcie_lanes;
dpm_table->dpm_level[index].enabled = 1;
@@ -494,7 +494,7 @@ int32_t phm_get_dpm_level_enable_mask_value(void *table)
 {
int32_t i;
int32_t mask = 0;
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
for (i = dpm_table->count; i > 0; i--) {
mask = mask << 1;
@@ -566,7 +566,7 @@ int phm_find_boot_level(void *table,
 {
int result = -EINVAL;
uint32_t i;
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
for (i = 0; i < dpm_table->count; i++) {
if (value == dpm_table->dpm_level[i].value) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
index 953e0c9ad7cd..676f2e8bb2ee 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
@@ -579,7 +579,7 @@ static ATOM_GPIO_PIN_LUT *get_gpio_lookup_table(void 
*device)
PP_ASSERT_WITH_CODE((NULL != table_address),
"Error retrieving BIOS Table Address!", return NULL;);
 
-   return (ATOM_GPIO_PIN_LUT *)table_address;
+   return table_address;
 }
 
 /**
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
index c062844b15f3..05e3f5302994 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
@@ -66,7 +66,7 @@ static struct atom_voltage_objects_info_v4_1 
*pp_atomfwctrl_get_voltage_info_tab
 "Error retrieving BIOS Table Address!",
 return NULL);
 
-return (struct atom_voltage_objects_info_v4_1 *)table_address;
+return table_address;
 }
 
 /**
@@ -173,7 +173,7 @@ static struct 

Re: [PATCH 05/48] drm: omapdrm: dss: Set the DMA coherent mask

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:01PM +0300, Laurent Pinchart wrote:
> When merging the omapdrm and omapdss drivers the omapdrm virtual
> platform device will disappear, and the omapdss platform device will be
> used for DMA memory allocation. To prepare for that, set the DMA
> coherent mask for the device.
> 
> Signed-off-by: Laurent Pinchart 

Reviewed-by: Sebastian Reichel 

-- Sebastian

> ---
>  drivers/gpu/drm/omapdrm/dss/dss.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
> b/drivers/gpu/drm/omapdrm/dss/dss.c
> index d1755f12236b..6ce26a4b93b3 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -23,6 +23,7 @@
>  #define DSS_SUBSYS_NAME "DSS"
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -1441,6 +1442,12 @@ static int dss_probe(struct platform_device *pdev)
>  
>   dss.pdev = pdev;
>  
> + r = dma_set_coherent_mask(>dev, DMA_BIT_MASK(32));
> + if (r) {
> + dev_err(>dev, "Failed to set the DMA mask\n");
> + return r;
> + }
> +
>   /*
>* The various OMAP3-based SoCs can't be told apart using the compatible
>* string, use SoC device matching.
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> 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


[PATCH v2] drm: Replace kzalloc with kcalloc

2017-10-15 Thread Harsha Sharma
Prefer kcalloc over kzalloc to allocate an array.
This patch fixes checkcpatch issue.

Signed-off-by: Harsha Sharma 
---
Changes in v2:
 -kcalloc will take 3 arguments

 drivers/gpu/drm/drm_crtc_helper.c  | 4 ++--
 drivers/gpu/drm/drm_fb_helper.c| 2 +-
 drivers/gpu/drm/drm_plane_helper.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index eab36a460638..5a84c3bc915d 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -562,12 +562,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
 * Allocate space for the backup of all (non-pointer) encoder and
 * connector data.
 */
-   save_encoder_crtcs = kzalloc(dev->mode_config.num_encoder *
+   save_encoder_crtcs = kcalloc(dev->mode_config.num_encoder,
sizeof(struct drm_crtc *), GFP_KERNEL);
if (!save_encoder_crtcs)
return -ENOMEM;
 
-   save_connector_encoders = kzalloc(dev->mode_config.num_connector *
+   save_connector_encoders = kcalloc(dev->mode_config.num_connector,
sizeof(struct drm_encoder *), GFP_KERNEL);
if (!save_connector_encoders) {
kfree(save_encoder_crtcs);
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 1b8f013ffa65..de31e52ab9cb 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2266,7 +2266,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
if (modes[n] == NULL)
return best_score;
 
-   crtcs = kzalloc(fb_helper->connector_count *
+   crtcs = kcalloc(fb_helper->connector_count,
sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL);
if (!crtcs)
return best_score;
diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
index 06aee1741e96..759ed93f4ba8 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -354,7 +354,7 @@ int drm_primary_helper_update(struct drm_plane *plane, 
struct drm_crtc *crtc,
/* Find current connectors for CRTC */
num_connectors = get_connectors_for_crtc(crtc, NULL, 0);
BUG_ON(num_connectors == 0);
-   connector_list = kzalloc(num_connectors * sizeof(*connector_list),
+   connector_list = kcalloc(num_connectors, sizeof(*connector_list),
 GFP_KERNEL);
if (!connector_list)
return -ENOMEM;
-- 
2.11.0

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


Re: [PATCH 12/48] drm: omapdrm: Split init and cleanup from probe and remove functions

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:08PM +0300, Laurent Pinchart wrote:
> When merging the omapdrm and omapdss drivers there will be not omapdrm
> platform device anymore, and thus no associated probe and remove
> functions. To prepare for that, split all the initialization code from
> the probe function to make it usable without a platform device.
> Similarly, split the cleanup code from the remove function.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/omap_drv.c | 83 
> +++---
>  drivers/gpu/drm/omapdrm/omap_drv.h |  2 +
>  2 files changed, 53 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 2d15ea1d6c92..cbca70f80d8e 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -542,24 +542,16 @@ static const struct soc_device_attribute 
> omapdrm_soc_devices[] = {
>   { /* sentinel */ }
>  };
>  
> -static int pdev_probe(struct platform_device *pdev)
> +static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  {
>   const struct soc_device_attribute *soc;
> - struct omap_drm_private *priv;
>   struct drm_device *ddev;
>   unsigned int i;
>   int ret;
>  
> - DBG("%s", pdev->name);
> -
> - if (omapdss_is_initialized() == false)
> - return -EPROBE_DEFER;
> + DBG("%s", dev_name(dev));
>  
> - ret = dma_set_coherent_mask(>dev, DMA_BIT_MASK(32));
> - if (ret) {
> - dev_err(>dev, "Failed to set the DMA mask\n");
> - return ret;
> - }
> + priv->dev = dev;
>  
>   omap_crtc_pre_init();
>  
> @@ -567,13 +559,6 @@ static int pdev_probe(struct platform_device *pdev)
>   if (ret)
>   goto err_crtc_uninit;
>  
> - /* Allocate and initialize the driver private structure. */
> - priv = kzalloc(sizeof(*priv), GFP_KERNEL);
> - if (!priv) {
> - ret = -ENOMEM;
> - goto err_disconnect_dssdevs;
> - }
> -
>   priv->dispc_ops = dispc_get_ops();
>  
>   soc = soc_device_match(omapdrm_soc_devices);
> @@ -584,27 +569,27 @@ static int pdev_probe(struct platform_device *pdev)
>   INIT_LIST_HEAD(>obj_list);
>  
>   /* Allocate and initialize the DRM device. */
> - ddev = drm_dev_alloc(_drm_driver, >dev);
> + ddev = drm_dev_alloc(_drm_driver, priv->dev);
>   if (IS_ERR(ddev)) {
>   ret = PTR_ERR(ddev);
> - goto err_free_priv;
> + goto err_destroy_wq;
>   }
>  
> + priv->ddev = ddev;
>   ddev->dev_private = priv;
> - platform_set_drvdata(pdev, ddev);
>  
>   omap_gem_init(ddev);
>  
>   ret = omap_modeset_init(ddev);
>   if (ret) {
> - dev_err(>dev, "omap_modeset_init failed: ret=%d\n", ret);
> + dev_err(priv->dev, "omap_modeset_init failed: ret=%d\n", ret);
>   goto err_free_drm_dev;
>   }
>  
>   /* Initialize vblank handling, start with all CRTCs disabled. */
>   ret = drm_vblank_init(ddev, priv->num_crtcs);
>   if (ret) {
> - dev_err(>dev, "could not init vblank\n");
> + dev_err(priv->dev, "could not init vblank\n");
>   goto err_cleanup_modeset;
>   }
>  
> @@ -637,20 +622,17 @@ static int pdev_probe(struct platform_device *pdev)
>  err_free_drm_dev:
>   omap_gem_deinit(ddev);
>   drm_dev_unref(ddev);
> -err_free_priv:
> +err_destroy_wq:
>   destroy_workqueue(priv->wq);
> - kfree(priv);
> -err_disconnect_dssdevs:
>   omap_disconnect_dssdevs();
>  err_crtc_uninit:
>   omap_crtc_pre_uninit();
>   return ret;
>  }
>  
> -static int pdev_remove(struct platform_device *pdev)
> +static void omapdrm_cleanup(struct omap_drm_private *priv)
>  {
> - struct drm_device *ddev = platform_get_drvdata(pdev);
> - struct omap_drm_private *priv = ddev->dev_private;
> + struct drm_device *ddev = priv->ddev;
>  
>   DBG("");
>  
> @@ -672,10 +654,45 @@ static int pdev_remove(struct platform_device *pdev)
>   drm_dev_unref(ddev);
>  
>   destroy_workqueue(priv->wq);
> - kfree(priv);
>  
>   omap_disconnect_dssdevs();
>   omap_crtc_pre_uninit();
> +}
> +
> +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_set_coherent_mask(>dev, DMA_BIT_MASK(32));
> + if (ret) {
> + dev_err(>dev, "Failed to set the DMA mask\n");
> + return ret;
> + }
> +
> + /* Allocate and initialize the driver private structure. */
> + priv = kzalloc(sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, priv);

Re: [PATCH 19/48] drm: omapdrm: displays: Get encoder source at connect time

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:15PM +0300, Laurent Pinchart wrote:
> The encoder drivers need a handle to the source they are connected to in
> order to control the source.
> 
> All drivers get that handle at probe time, resulting in probe deferral
> when the source hasn't been probed yet. However they don't need the
> handle until their connect handler is called.
> 
> Move retrieval of the source handle to the connect handler to avoid
> probe deferrals.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c  | 35 ++--
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c  | 36 ++--
>  .../gpu/drm/omapdrm/displays/encoder-tpd12s015.c   | 66 
> --
>  3 files changed, 54 insertions(+), 83 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index b28ec62267b1..b3bb64b477fa 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -36,7 +36,7 @@ static int opa362_connect(struct omap_dss_device *dssdev,
>   struct omap_dss_device *dst)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> + struct omap_dss_device *in;
>   int r;
>  
>   dev_dbg(dssdev->dev, "connect\n");
> @@ -44,13 +44,22 @@ static int opa362_connect(struct omap_dss_device *dssdev,
>   if (omapdss_device_is_connected(dssdev))
>   return -EBUSY;
>  
> + in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> + if (IS_ERR(in)) {
> + dev_err(dssdev->dev, "failed to find video source\n");
> + return PTR_ERR(in);
> + }
> +
>   r = in->ops.atv->connect(in, dssdev);
> - if (r)
> + if (r) {
> + omap_dss_put_device(in);
>   return r;
> + }
>  
>   dst->src = dssdev;
>   dssdev->dst = dst;
>  
> + ddata->in = in;
>   return 0;
>  }
>  
> @@ -74,6 +83,9 @@ static void opa362_disconnect(struct omap_dss_device 
> *dssdev,
>   dssdev->dst = NULL;
>  
>   in->ops.atv->disconnect(in, >dssdev);
> +
> + omap_dss_put_device(in);
> + ddata->in = NULL;
>  }
>  
>  static int opa362_enable(struct omap_dss_device *dssdev)
> @@ -171,9 +183,8 @@ static const struct omapdss_atv_ops opa362_atv_ops = {
>  
>  static int opa362_probe(struct platform_device *pdev)
>  {
> - struct device_node *node = pdev->dev.of_node;
>   struct panel_drv_data *ddata;
> - struct omap_dss_device *dssdev, *in;
> + struct omap_dss_device *dssdev;
>   struct gpio_desc *gpio;
>   int r;
>  
> @@ -191,14 +202,6 @@ static int opa362_probe(struct platform_device *pdev)
>  
>   ddata->enable_gpio = gpio;
>  
> - in = omapdss_of_find_source_for_first_ep(node);
> - if (IS_ERR(in)) {
> - dev_err(>dev, "failed to find video source\n");
> - return PTR_ERR(in);
> - }
> -
> - ddata->in = in;
> -
>   dssdev = >dssdev;
>   dssdev->ops.atv = _atv_ops;
>   dssdev->dev = >dev;
> @@ -209,20 +212,16 @@ static int opa362_probe(struct platform_device *pdev)
>   r = omapdss_register_output(dssdev);
>   if (r) {
>   dev_err(>dev, "Failed to register output\n");
> - goto err_reg;
> + return r;
>   }
>  
>   return 0;
> -err_reg:
> - omap_dss_put_device(ddata->in);
> - return r;
>  }
>  
>  static int __exit opa362_remove(struct platform_device *pdev)
>  {
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = >dssdev;
> - struct omap_dss_device *in = ddata->in;
>  
>   omapdss_unregister_output(>dssdev);
>  
> @@ -234,8 +233,6 @@ static int __exit opa362_remove(struct platform_device 
> *pdev)
>   if (omapdss_device_is_connected(dssdev))
>   opa362_disconnect(dssdev, dssdev->dst);
>  
> - omap_dss_put_device(in);
> -
>   return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index 9e0ab4e77366..0d640f8c0689 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -32,19 +32,28 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
>   struct omap_dss_device *dst)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> + struct omap_dss_device *in;
>   int r;
>  
>   if (omapdss_device_is_connected(dssdev))
>   return -EBUSY;
>  
> + in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> + if (IS_ERR(in)) {
> + dev_err(dssdev->dev, "failed to 

Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

2017-10-15 Thread Tony Lindgren
* Tomi Valkeinen  [171012 01:46]:
> On 29/09/17 16:26, Sebastian Reichel wrote:
> > Hi Tomi & Laurent,
> > 
> > ping?
> 
> I've been having quick glances at this every now and then, but I'm not
> sure what to do with the series.
> 
> We have one work item that more or less overrides everything but
> critical fixes: moving to common DRM encoder/panel drivers. Anything
> that makes that work more difficult should be postponed.
> 
> Especially patch 6 in this series most likely falls into that category,
> and might require a very different implementation with common DRM
> drivers. Also everything in panel-dsi-cm needs to be ported to a common
> DRM panel driver when can use them.
> 
> So my gut feeling is that it's best to keep this out for now, and rework
> it after Laurent gets the common DRM drivers working with omapdrm.

Laurent, got any other comments?

Maybe some of patches can be already applied to shrink down this
set a bit?

Regards,

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


[PATCH 0/4] rcar-du: add R8A774[35] DU driver(s) support

2017-10-15 Thread Fabrizio Castro
In order to be able to define du nodes in r8a7743 and r8a7745 device
trees, we need to define data structures, compatible strings, missing
clock, and update the dt-bindings.
I'll send out the patches to add the du nodes in r8a774[35] device trees
once the patches in this series get accepted.

Best regards,

Fabrizio Castro (4):
  dt-bindings: display: rcar-du: Document R8A774[35] DU
  drm: rcar-du: Add R8A7743 support
  clk: renesas: cpg-mssr: Add du1 clock to R8A7745
  drm: rcar-du: Add R8A7745 support

 .../devicetree/bindings/display/renesas,du.txt | 30 ---
 drivers/clk/renesas/r8a7745-cpg-mssr.c |  1 +
 drivers/gpu/drm/rcar-du/rcar_du_drv.c  | 44 ++
 3 files changed, 62 insertions(+), 13 deletions(-)

-- 
2.7.4

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


Re: [PATCH 00/12] of: overlay: clean up device tree overlay code

2017-10-15 Thread Frank Rowand
Hi Rob,

On 10/02/17 20:53, frowand.l...@gmail.com wrote:
> From: Frank Rowand 
> 
> I have found the device tree overlay code to be difficult to read and
> maintain.  This patch series attempts to improve that situation.
> 
> The cleanup includes some changes visible to users of overlays.  The
> only in kernel user of overlays is fixed up for those changes.  The
> in kernel user is:
> 
>drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c
> 
> Following the cleanup patches are a set of patches to fix various
> issues.
> 
> The first five patches are intended to not make any functional
> changes, and are segrated to ease review.
> 
> Frank Rowand (12):
>   of: overlay.c: Remove comments that state the obvious, to reduce
> clutter
>   of: overlay.c: Convert comparisons to zero or NULL to logical
> expressions
>   of: overlay: rename identifiers to more reflect what they do
>   of: overlay: rename identifiers in dup_and_fixup_symbol_prop()
>   of: overlay: minor restructuring
>   of: overlay: detect cases where device tree may become corrupt
>   of: overlay: expand check of whether overlay changeset can be removed
>   of: overlay: loosen overly strict phandle clash check
>   of: overlay: avoid race condition between applying multiple overlays
>   of: overlay: simplify applying symbols from an overlay
>   of: overlay: remove a dependency on device node full_name
>   of: overlay: remove unneeded check for NULL kbasename()
> 
>  Documentation/devicetree/overlay-notes.txt   |   12 +-
>  drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c |   15 +-
>  drivers/of/base.c|2 +-
>  drivers/of/dynamic.c |  137 +++-
>  drivers/of/of_private.h  |   10 +-
>  drivers/of/overlay.c | 1024 
> --
>  drivers/of/unittest.c|   80 +-
>  include/linux/of.h   |   33 +-
>  8 files changed, 871 insertions(+), 442 deletions(-)
> 

What is the status on this series?  Did I resolve all of the issues that
you found?  Is there anything else I need to do?

The last issue that I recall, was a question about "[PATCH 09/12] of: overlay: 
avoid race condition between applying multiple overlays", were you asked if
of_resolve_phandles() could be moved into of_overlay_apply().  I sent an
additional patch "[PATCH] of: overlay: move resolve phandles into
of_overlay_apply()" [1] that applies on top of this series to do so.

There is a trickle of new patches against the same files as in my
series, so I would like to get my series applied sooner that later,
if possible.

Thanks,

Frank

[1] https://lkml.org/lkml/2017/10/10/1389
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3] drm/amd/powerplay: Remove unnecessary cast on void pointer

2017-10-15 Thread Harsha Sharma
Done with following coccinelle patch

@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|

- (T*)
  e
)

Signed-off-by: Harsha Sharma 
---
Changes in v3:
 -Removed unnecessary lines
 -Remove more useless casts
Changes in v2:
 -Remove unnecessary parentheses
 -Remove one more useless cast

 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c |   6 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c|   8 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   |   2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c |   6 +-
 .../gpu/drm/amd/powerplay/hwmgr/processpptables.c  |   2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 177 ++---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c |   4 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  22 +--
 .../gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c   |   2 +-
 9 files changed, 107 insertions(+), 122 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
index bc839ff0bdd0..f22104c78dcb 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
@@ -474,7 +474,7 @@ static int cz_tf_upload_pptable_to_smu(struct pp_hwmgr 
*hwmgr, void *input,
PP_ASSERT_WITH_CODE((0 == ret && NULL != table),
"Fail to get clock table from SMU!", return 
-EINVAL;);
 
-   clock_table = (struct SMU8_Fusion_ClkTable *)table;
+   clock_table = table;
 
/* patch clock table */
PP_ASSERT_WITH_CODE((vddc_table->count <= CZ_MAX_HARDWARE_POWERLEVELS),
@@ -868,8 +868,8 @@ static int cz_tf_update_low_mem_pstate(struct pp_hwmgr 
*hwmgr,
 {
bool disable_switch;
bool enable_low_mem_state;
-   struct cz_hwmgr *hw_data = (struct cz_hwmgr *)(hwmgr->backend);
-   const struct phm_set_power_state_input *states = (struct 
phm_set_power_state_input *)input;
+   struct cz_hwmgr *hw_data = hwmgr->backend;
+   const struct phm_set_power_state_input *states = input;
const struct cz_power_state *pnew_state = 
cast_const_PhwCzPowerState(states->pnew_state);
 
if (hw_data->sys_info.nb_dpm_enable) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index 9547f265a8bb..5d63a1b18b39 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -469,7 +469,7 @@ int phm_reset_single_dpm_table(void *table,
 {
int i;
 
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
dpm_table->count = count > max ? max : count;
 
@@ -484,7 +484,7 @@ void phm_setup_pcie_table_entry(
uint32_t index, uint32_t pcie_gen,
uint32_t pcie_lanes)
 {
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
dpm_table->dpm_level[index].value = pcie_gen;
dpm_table->dpm_level[index].param1 = pcie_lanes;
dpm_table->dpm_level[index].enabled = 1;
@@ -494,7 +494,7 @@ int32_t phm_get_dpm_level_enable_mask_value(void *table)
 {
int32_t i;
int32_t mask = 0;
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
for (i = dpm_table->count; i > 0; i--) {
mask = mask << 1;
@@ -566,7 +566,7 @@ int phm_find_boot_level(void *table,
 {
int result = -EINVAL;
uint32_t i;
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
for (i = 0; i < dpm_table->count; i++) {
if (value == dpm_table->dpm_level[i].value) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
index 953e0c9ad7cd..676f2e8bb2ee 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
@@ -579,7 +579,7 @@ static ATOM_GPIO_PIN_LUT *get_gpio_lookup_table(void 
*device)
PP_ASSERT_WITH_CODE((NULL != table_address),
"Error retrieving BIOS Table Address!", return NULL;);
 
-   return (ATOM_GPIO_PIN_LUT *)table_address;
+   return table_address;
 }
 
 /**
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
index c062844b15f3..05e3f5302994 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
@@ -66,7 +66,7 @@ static struct atom_voltage_objects_info_v4_1 
*pp_atomfwctrl_get_voltage_info_tab
 "Error retrieving BIOS Table Address!",
 return NULL);
 
-return (struct atom_voltage_objects_info_v4_1 *)table_address;
+return table_address;
 }
 
 /**
@@ -173,7 

Re: [PATCH 11/48] drm: omapdrm: Use unsigned int type

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:07PM +0300, Laurent Pinchart wrote:
> The kernel favours 'unsigned int' over plain 'unsigned'. Replace all
> occurences of the latter by the former. This avoid lots of checkpatch
> complaints in patches that touch lines where a plain 'unsigned' is used.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c|  8 +-
>  .../drm/omapdrm/displays/panel-sony-acx565akm.c|  6 +-
>  drivers/gpu/drm/omapdrm/dss/dispc.c| 25 +++---
>  drivers/gpu/drm/omapdrm/dss/dpi.c  |  2 +-
>  drivers/gpu/drm/omapdrm/dss/dsi.c  | 98 
> +++---
>  drivers/gpu/drm/omapdrm/dss/dss.c  | 12 +--
>  drivers/gpu/drm/omapdrm/dss/dss.h  | 12 +--
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c|  2 +-
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c|  2 +-
>  drivers/gpu/drm/omapdrm/dss/hdmi5_core.c   | 24 +++---
>  drivers/gpu/drm/omapdrm/dss/hdmi_phy.c |  2 +-
>  drivers/gpu/drm/omapdrm/dss/hdmi_wp.c  |  2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  4 +-
>  drivers/gpu/drm/omapdrm/dss/pll.c  |  4 +-
>  14 files changed, 102 insertions(+), 101 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 92c556ac22c7..bdc0e8a3832d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -78,7 +78,7 @@ struct panel_drv_data {
>   struct workqueue_struct *workqueue;
>  
>   bool ulps_enabled;
> - unsigned ulps_timeout;
> + unsigned int ulps_timeout;
>   struct delayed_work ulps_work;
>  };
>  
> @@ -483,7 +483,7 @@ static ssize_t dsicm_show_ulps(struct device *dev,
>  {
>   struct platform_device *pdev = to_platform_device(dev);
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> - unsigned t;
> + unsigned int t;
>  
>   mutex_lock(>lock);
>   t = ddata->ulps_enabled;
> @@ -530,7 +530,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev,
>  {
>   struct platform_device *pdev = to_platform_device(dev);
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> - unsigned t;
> + unsigned int t;
>  
>   mutex_lock(>lock);
>   t = ddata->ulps_timeout;
> @@ -1004,7 +1004,7 @@ static int dsicm_memory_read(struct omap_dss_device 
> *dssdev,
>   int r;
>   int first = 1;
>   int plen;
> - unsigned buf_used = 0;
> + unsigned int buf_used = 0;
>  
>   if (size < w * h * 3)
>   return -ENOMEM;
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> index 8e5bff4e5226..06d7d8362a73 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> @@ -289,7 +289,7 @@ static void enable_backlight_ctrl(struct panel_drv_data 
> *ddata, int enable)
>   acx565akm_write(ddata, MIPID_CMD_WRITE_CTRL_DISP, (u8 *), 2);
>  }
>  
> -static void set_cabc_mode(struct panel_drv_data *ddata, unsigned mode)
> +static void set_cabc_mode(struct panel_drv_data *ddata, unsigned int mode)
>  {
>   u16 cabc_ctrl;
>  
> @@ -303,12 +303,12 @@ static void set_cabc_mode(struct panel_drv_data *ddata, 
> unsigned mode)
>   acx565akm_write(ddata, MIPID_CMD_WRITE_CABC, (u8 *)_ctrl, 2);
>  }
>  
> -static unsigned get_cabc_mode(struct panel_drv_data *ddata)
> +static unsigned int get_cabc_mode(struct panel_drv_data *ddata)
>  {
>   return ddata->cabc_mode;
>  }
>  
> -static unsigned get_hw_cabc_mode(struct panel_drv_data *ddata)
> +static unsigned int get_hw_cabc_mode(struct panel_drv_data *ddata)
>  {
>   u8 cabc_ctrl;
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c 
> b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index 0f4fdb221498..f0ae6be36a4e 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -971,7 +971,7 @@ static void dispc_ovl_set_pre_mult_alpha(enum 
> omap_plane_id plane,
>  static void dispc_ovl_setup_global_alpha(enum omap_plane_id plane,
>   enum omap_overlay_caps caps, u8 global_alpha)
>  {
> - static const unsigned shifts[] = { 0, 8, 16, 24, };
> + static const unsigned int shifts[] = { 0, 8, 16, 24, };
>   int shift;
>  
>   if ((caps & OMAP_DSS_OVL_CAP_GLOBAL_ALPHA) == 0)
> @@ -1199,7 +1199,7 @@ void dispc_wb_set_channel_in(enum dss_writeback_channel 
> channel)
>  static void dispc_ovl_set_burst_size(enum omap_plane_id plane,
>   enum omap_burst_size burst_size)
>  {
> - static const unsigned shifts[] = { 6, 14, 14, 14, 14, };
> + static const unsigned int shifts[] = 

Re: [PATCH 08/48] drm: omapdrm: venc: Return error code on OF parsing failure

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:04PM +0300, Laurent Pinchart wrote:
> The venc_probe_of() function has an error cleanup path that returns
> success instead of an error code. Fix it.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Maybe this should be tagged for stable backporting?

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/venc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
> b/drivers/gpu/drm/omapdrm/dss/venc.c
> index d58da6f32693..1b0fa952b494 100644
> --- a/drivers/gpu/drm/omapdrm/dss/venc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/venc.c
> @@ -857,10 +857,10 @@ static int venc_probe_of(struct platform_device *pdev)
>   of_node_put(ep);
>  
>   return 0;
> +
>  err:
>   of_node_put(ep);
> -
> - return 0;
> + return r;
>  }
>  
>  /* VENC HW IP initialisation */
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> 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 07/48] drm: omapdrm: dpi: Remove dpi_data port_initialized field

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:03PM +0300, Laurent Pinchart wrote:
> The dpi_data structure port_initialized field is used to check in the
> cleanup path whether the DPI has been initialized. This can be performed
> through the associated device_node data field instead. Remove the
> port_initialized field.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dpi.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
> b/drivers/gpu/drm/omapdrm/dss/dpi.c
> index daf286fc8a40..ce9b27978f48 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dpi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
> @@ -52,8 +52,6 @@ struct dpi_data {
>   int data_lines;
>  
>   struct omap_dss_device output;
> -
> - bool port_initialized;
>  };
>  
>  static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device 
> *dssdev)
> @@ -786,8 +784,6 @@ int dpi_init_port(struct platform_device *pdev, struct 
> device_node *port,
>  
>   dpi_init_output_port(dpi, port);
>  
> - dpi->port_initialized = true;
> -
>   return 0;
>  
>  err_datalines:
> @@ -800,7 +796,7 @@ void dpi_uninit_port(struct device_node *port)
>  {
>   struct dpi_data *dpi = port->data;
>  
> - if (!dpi->port_initialized)
> + if (!dpi)
>   return;
>  
>   dpi_uninit_output_port(port);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> 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 15/48] drm: omapdrm: displays: Remove OF node check in encoder drivers

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:11PM +0300, Laurent Pinchart wrote:
> No encoder is instantiated through platform data anymore, there is no
> need to check for OF node presence.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c| 5 -
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c| 3 ---
>  drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c | 3 ---
>  3 files changed, 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index b1f6aa09f699..b28ec62267b1 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -179,11 +179,6 @@ static int opa362_probe(struct platform_device *pdev)
>  
>   dev_dbg(>dev, "probe\n");
>  
> - if (node == NULL) {
> - dev_err(>dev, "Unable to find device tree\n");
> - return -EINVAL;
> - }
> -
>   ddata = devm_kzalloc(>dev, sizeof(*ddata), GFP_KERNEL);
>   if (!ddata)
>   return -ENOMEM;
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index b8e420c7d680..9e0ab4e77366 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -201,9 +201,6 @@ static int tfp410_probe(struct platform_device *pdev)
>  
>   platform_set_drvdata(pdev, ddata);
>  
> - if (!pdev->dev.of_node)
> - return -ENODEV;
> -
>   r = tfp410_probe_of(pdev);
>   if (r)
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> index e3d98d78fc40..6c478140a52e 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> @@ -299,9 +299,6 @@ static int tpd_probe(struct platform_device *pdev)
>  
>   platform_set_drvdata(pdev, ddata);
>  
> - if (!pdev->dev.of_node)
> - return -ENODEV;
> -
>   r = tpd_probe_of(pdev);
>   if (r)
>   return r;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> 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 v4] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()

2017-10-15 Thread Harsha Sharma
On Mon, Oct 9, 2017 at 5:36 PM, Harsha Sharma
 wrote:
> Replace instances of drm_framebuffer_reference/unreference() with
> *_get/put() suffixes and drm_dev_unref with *_put() suffix
> because get/put is shorter and consistent with the
> kernel use of *_get/put suffixes.
> Done with following coccinelle semantic patch
>
> @@
> expression ex;
> @@
>
> (
> -drm_framebuffer_unreference(ex);
> +drm_framebuffer_put(ex);
> |
> -drm_dev_unref(ex);
> +drm_dev_put(ex);
> |
> -drm_framebuffer_reference(ex);
> +drm_framebuffer_get(ex);
> )
>
> Signed-off-by: Harsha Sharma 
> ---
> Changes in v4:
>  -change one instance of *_put to *_get
> Changes in v3:
>  -Removed changes in selftests
> Changes in v2:
>  -Added cocinelle patch in log message
>  -cc to all driver-specific mailing lists
>
>  drivers/gpu/drm/i915/i915_pci.c  |  2 +-
>  drivers/gpu/drm/i915/intel_display.c | 10 +-
>  drivers/gpu/drm/i915/intel_fbdev.c   |  4 ++--
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index 09d97e0990b7..2f106cca46b4 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -510,7 +510,7 @@ static void i915_pci_remove(struct pci_dev *pdev)
> struct drm_device *dev = pci_get_drvdata(pdev);
>
> i915_driver_unload(dev);
> -   drm_dev_unref(dev);
> +   drm_dev_put(dev);
>  }
>
>  static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id 
> *ent)
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 64f7b51ed97c..cb62f7e5d59a 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2856,7 +2856,7 @@ intel_find_initial_plane_obj(struct intel_crtc 
> *intel_crtc,
>
> if (intel_plane_ggtt_offset(state) == plane_config->base) {
> fb = c->primary->fb;
> -   drm_framebuffer_reference(fb);
> +   drm_framebuffer_get(fb);
> goto valid_fb;
> }
> }
> @@ -2887,7 +2887,7 @@ intel_find_initial_plane_obj(struct intel_crtc 
> *intel_crtc,
>   intel_crtc->pipe, PTR_ERR(intel_state->vma));
>
> intel_state->vma = NULL;
> -   drm_framebuffer_unreference(fb);
> +   drm_framebuffer_put(fb);
> return;
> }
>
> @@ -2908,7 +2908,7 @@ intel_find_initial_plane_obj(struct intel_crtc 
> *intel_crtc,
> if (i915_gem_object_is_tiled(obj))
> dev_priv->preserve_bios_swizzle = true;
>
> -   drm_framebuffer_reference(fb);
> +   drm_framebuffer_get(fb);
> primary->fb = primary->state->fb = fb;
> primary->crtc = primary->state->crtc = _crtc->base;
>
> @@ -9847,7 +9847,7 @@ mode_fits_in_fbdev(struct drm_device *dev,
> if (obj->base.size < mode->vdisplay * fb->pitches[0])
> return NULL;
>
> -   drm_framebuffer_reference(fb);
> +   drm_framebuffer_get(fb);
> return fb;
>  #else
> return NULL;
> @@ -10028,7 +10028,7 @@ int intel_get_load_detect_pipe(struct drm_connector 
> *connector,
> if (ret)
> goto fail;
>
> -   drm_framebuffer_unreference(fb);
> +   drm_framebuffer_put(fb);
>
> ret = drm_atomic_set_mode_for_crtc(_state->base, mode);
> if (ret)
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c 
> b/drivers/gpu/drm/i915/intel_fbdev.c
> index 262e75c00dd2..e34334a1fbf9 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>   " releasing it\n",
>   intel_fb->base.width, intel_fb->base.height,
>   sizes->fb_width, sizes->fb_height);
> -   drm_framebuffer_unreference(_fb->base);
> +   drm_framebuffer_put(_fb->base);
> intel_fb = ifbdev->fb = NULL;
> }
> if (!intel_fb || WARN_ON(!intel_fb->obj)) {
> @@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
> ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
> ifbdev->fb = fb;
>
> -   drm_framebuffer_reference(>fb->base);
> +   drm_framebuffer_get(>fb->base);
>
> /* Final pass to check if any active pipes don't have fbs */
> for_each_crtc(dev, crtc) {
>
I hope that this one can be merged.
Please let me know if any change is required.
Thanks for your time.

Regards,
Harsha Sharma

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


Re: [PATCH 03/48] drm: omapdrm: Remove unused omap_dss_find_device() function

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:58:59PM +0300, Laurent Pinchart wrote:
> The omap_dss_find_device() function is unused. Remove it.
> 
> Signed-off-by: Laurent Pinchart 

Reviewed-by: Sebastian Reichel 

-- Sebastian

> ---
>  drivers/gpu/drm/omapdrm/dss/display.c | 14 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 ---
>  2 files changed, 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
> b/drivers/gpu/drm/omapdrm/dss/display.c
> index 42279933790e..8c77a2d20969 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -175,17 +175,3 @@ struct omap_dss_device *omap_dss_get_next_device(struct 
> omap_dss_device *from)
>   return dssdev;
>  }
>  EXPORT_SYMBOL(omap_dss_get_next_device);
> -
> -struct omap_dss_device *omap_dss_find_device(void *data,
> - int (*match)(struct omap_dss_device *dssdev, void *data))
> -{
> - struct omap_dss_device *dssdev = NULL;
> -
> - while ((dssdev = omap_dss_get_next_device(dssdev)) != NULL) {
> - if (match(dssdev, data))
> - return dssdev;
> - }
> -
> - return NULL;
> -}
> -EXPORT_SYMBOL(omap_dss_find_device);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 990422b35784..6f7dc8384055 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -595,9 +595,6 @@ struct omap_dss_device *omap_dss_get_device(struct 
> omap_dss_device *dssdev);
>  void omap_dss_put_device(struct omap_dss_device *dssdev);
>  #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
>  struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device 
> *from);
> -struct omap_dss_device *omap_dss_find_device(void *data,
> - int (*match)(struct omap_dss_device *dssdev, void *data));
> -
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> 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 01/48] drm: omapdrm: dpi: Don't treat GPIO probe deferral as an error

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:58:57PM +0300, Laurent Pinchart wrote:
> There's no need to print an error message on probe deferral, that's a
> normal situation. Probe deferral debugging can be performed by enabling
> the related debug messages in the drivers core.
> 
> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index 947295f9e30f..b8e420c7d680 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -173,7 +173,8 @@ static int tfp410_probe_of(struct platform_device *pdev)
>   if (gpio_is_valid(gpio) || gpio == -ENOENT) {
>   ddata->pd_gpio = gpio;
>   } else {
> - dev_err(>dev, "failed to parse PD gpio\n");
> + if (gpio != -EPROBE_DEFER)
> + dev_err(>dev, "failed to parse PD gpio\n");
>   return gpio;
>   }

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


[PATCH] drm/amd/powerplay: Remove unnecessary cast on void pointer

2017-10-15 Thread Harsha Sharma
Done with following coccinelle patch

@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|

- (T*)
  e
)

Signed-off-by: Harsha Sharma 
---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c|  6 +++---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c   |  8 
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c  |  2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c|  6 +++---
 drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c |  2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  | 18 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c|  4 ++--
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c| 12 ++--
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c  |  2 +-
 9 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
index bc839ff0bdd0..897f22f3 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
@@ -474,7 +474,7 @@ static int cz_tf_upload_pptable_to_smu(struct pp_hwmgr 
*hwmgr, void *input,
PP_ASSERT_WITH_CODE((0 == ret && NULL != table),
"Fail to get clock table from SMU!", return 
-EINVAL;);
 
-   clock_table = (struct SMU8_Fusion_ClkTable *)table;
+   clock_table = table;
 
/* patch clock table */
PP_ASSERT_WITH_CODE((vddc_table->count <= CZ_MAX_HARDWARE_POWERLEVELS),
@@ -868,8 +868,8 @@ static int cz_tf_update_low_mem_pstate(struct pp_hwmgr 
*hwmgr,
 {
bool disable_switch;
bool enable_low_mem_state;
-   struct cz_hwmgr *hw_data = (struct cz_hwmgr *)(hwmgr->backend);
-   const struct phm_set_power_state_input *states = (struct 
phm_set_power_state_input *)input;
+   struct cz_hwmgr *hw_data = (hwmgr->backend);
+   const struct phm_set_power_state_input *states = input;
const struct cz_power_state *pnew_state = 
cast_const_PhwCzPowerState(states->pnew_state);
 
if (hw_data->sys_info.nb_dpm_enable) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index 9547f265a8bb..5d63a1b18b39 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -469,7 +469,7 @@ int phm_reset_single_dpm_table(void *table,
 {
int i;
 
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
dpm_table->count = count > max ? max : count;
 
@@ -484,7 +484,7 @@ void phm_setup_pcie_table_entry(
uint32_t index, uint32_t pcie_gen,
uint32_t pcie_lanes)
 {
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
dpm_table->dpm_level[index].value = pcie_gen;
dpm_table->dpm_level[index].param1 = pcie_lanes;
dpm_table->dpm_level[index].enabled = 1;
@@ -494,7 +494,7 @@ int32_t phm_get_dpm_level_enable_mask_value(void *table)
 {
int32_t i;
int32_t mask = 0;
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
for (i = dpm_table->count; i > 0; i--) {
mask = mask << 1;
@@ -566,7 +566,7 @@ int phm_find_boot_level(void *table,
 {
int result = -EINVAL;
uint32_t i;
-   struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table;
+   struct vi_dpm_table *dpm_table = table;
 
for (i = 0; i < dpm_table->count; i++) {
if (value == dpm_table->dpm_level[i].value) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
index 953e0c9ad7cd..676f2e8bb2ee 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
@@ -579,7 +579,7 @@ static ATOM_GPIO_PIN_LUT *get_gpio_lookup_table(void 
*device)
PP_ASSERT_WITH_CODE((NULL != table_address),
"Error retrieving BIOS Table Address!", return NULL;);
 
-   return (ATOM_GPIO_PIN_LUT *)table_address;
+   return table_address;
 }
 
 /**
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
index c062844b15f3..05e3f5302994 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
@@ -66,7 +66,7 @@ static struct atom_voltage_objects_info_v4_1 
*pp_atomfwctrl_get_voltage_info_tab
 "Error retrieving BIOS Table Address!",
 return NULL);
 
-return (struct atom_voltage_objects_info_v4_1 *)table_address;
+return table_address;
 }
 
 /**
@@ -173,7 +173,7 @@ static struct atom_gpio_pin_lut_v2_1 
*pp_atomfwctrl_get_gpio_lookup_table(
"Error 

Re: [PATCH 10/48] drm: omapdrm: Use kernel integer types

2017-10-15 Thread Sebastian Reichel
Hi,

On Fri, Oct 13, 2017 at 05:59:06PM +0300, Laurent Pinchart wrote:
> The standard kernel integer types are [us]{8,16,32}. Use them instead of
> the u?int{8,16,32}_t types.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/omap_crtc.c  | 12 -
>  drivers/gpu/drm/omapdrm/omap_crtc.h  |  2 +-
>  drivers/gpu/drm/omapdrm/omap_dmm_priv.h  | 10 +++
>  drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 46 
> 
>  drivers/gpu/drm/omapdrm/omap_dmm_tiler.h | 22 +++
>  drivers/gpu/drm/omapdrm/omap_drv.h   |  4 +--
>  drivers/gpu/drm/omapdrm/omap_fb.c| 18 ++---
>  drivers/gpu/drm/omapdrm/omap_gem.c   | 41 +++-
>  drivers/gpu/drm/omapdrm/omap_gem.h   | 16 +--
>  drivers/gpu/drm/omapdrm/omap_irq.c   |  6 ++---
>  drivers/gpu/drm/omapdrm/omap_irq.h   |  2 +-
>  drivers/gpu/drm/omapdrm/omap_plane.c |  4 +--
>  drivers/gpu/drm/omapdrm/tcm-sita.c   | 12 -
>  drivers/gpu/drm/omapdrm/tcm.h|  4 +--
>  14 files changed, 101 insertions(+), 98 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
> b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index cc85c16cbc2a..f78eac4a8b34 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -273,7 +273,7 @@ static const struct dss_mgr_ops mgr_ops = {
>   * Setup, Flush and Page Flip
>   */
>  
> -void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus)
> +void omap_crtc_error_irq(struct drm_crtc *crtc, u32 irqstatus)
>  {
>   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
>  
> @@ -458,7 +458,7 @@ static int omap_crtc_atomic_check(struct drm_crtc *crtc,
>   struct drm_plane_state *pri_state;
>  
>   if (state->color_mgmt_changed && state->gamma_lut) {
> - uint length = state->gamma_lut->length /
> + unsigned int length = state->gamma_lut->length /
>   sizeof(struct drm_color_lut);
>  
>   if (length < 2)
> @@ -492,7 +492,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
>  
>   if (crtc->state->color_mgmt_changed) {
>   struct drm_color_lut *lut = NULL;
> - uint length = 0;
> + unsigned int length = 0;
>  
>   if (crtc->state->gamma_lut) {
>   lut = (struct drm_color_lut *)
> @@ -523,7 +523,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
>  static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
>struct drm_crtc_state *state,
>struct drm_property *property,
> -  uint64_t val)
> +  u64 val)
>  {
>   struct omap_drm_private *priv = crtc->dev->dev_private;
>   struct drm_plane_state *plane_state;
> @@ -551,7 +551,7 @@ static int omap_crtc_atomic_set_property(struct drm_crtc 
> *crtc,
>  static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,
>const struct drm_crtc_state *state,
>struct drm_property *property,
> -  uint64_t *val)
> +  u64 *val)
>  {
>   struct omap_drm_private *priv = crtc->dev->dev_private;
>   struct omap_crtc_state *omap_state = to_omap_crtc_state(state);
> @@ -697,7 +697,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>* gamma table is not supprted.
>*/
>   if (priv->dispc_ops->mgr_gamma_size(channel)) {
> - uint gamma_lut_size = 256;
> + unsigned int gamma_lut_size = 256;
>  
>   drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size);
>   drm_mode_crtc_set_gamma_size(crtc, gamma_lut_size);
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.h 
> b/drivers/gpu/drm/omapdrm/omap_crtc.h
> index ad7b007c6174..7f01e730a050 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.h
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.h
> @@ -37,7 +37,7 @@ void omap_crtc_pre_uninit(void);
>  struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>   struct drm_plane *plane, struct omap_dss_device *dssdev);
>  int omap_crtc_wait_pending(struct drm_crtc *crtc);
> -void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus);
> +void omap_crtc_error_irq(struct drm_crtc *crtc, u32 irqstatus);
>  void omap_crtc_vblank_irq(struct drm_crtc *crtc);
>  
>  #endif /* __OMAPDRM_CRTC_H__ */
> diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_priv.h 
> b/drivers/gpu/drm/omapdrm/omap_dmm_priv.h
> index 9f32a83ca507..80fc850212a3 100644
> --- a/drivers/gpu/drm/omapdrm/omap_dmm_priv.h
> +++ b/drivers/gpu/drm/omapdrm/omap_dmm_priv.h
> @@ -102,10 +102,10 @@ struct pat_ctrl