Merge tag 'drm-misc-fixes-2020-10-29' of git://anongit.freedesktop.org/drm/drm-misc...
authorDave Airlie <airlied@redhat.com>
Thu, 29 Oct 2020 23:33:51 +0000 (09:33 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 29 Oct 2020 23:34:32 +0000 (09:34 +1000)
First round of drm-misc-fixes with a couple of leftovers from
drm-misc-fixes next.

Some reset fixes for the mantix panel, some fixes for a scaler issue on
sun4i, many kernel-doc fixes and various fixes for vc4 (mostly HDMI audio
related)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20201029173414.fxrl5jacsdwqheto@gilmour.lan
16 files changed:
Documentation/devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml
drivers/gpu/drm/drm_dp_helper.c
drivers/gpu/drm/drm_edid.c
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/drm_gem_shmem_helper.c
drivers/gpu/drm/drm_prime.c
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
drivers/gpu/drm/sun4i/sun4i_frontend.c
drivers/gpu/drm/sun4i/sun4i_frontend.h
drivers/gpu/drm/v3d/v3d_gem.c
drivers/gpu/drm/vc4/vc4_drv.c
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_hdmi.c
include/drm/drm_dp_helper.h
include/drm/drm_edid.h
include/drm/drm_print.h

index 937323cc9aaac12f3abae9f9941d0ea86c558932..51f423297ec8447b46575016d8b428644ba4822d 100644 (file)
@@ -37,6 +37,9 @@ properties:
 
   reset-gpios: true
 
+  'mantix,tp-rstn-gpios':
+    description: second reset line that triggers DSI config load
+
   backlight: true
 
 required:
@@ -63,6 +66,7 @@ examples:
             avee-supply = <&reg_avee>;
             vddi-supply = <&reg_1v8_p>;
             reset-gpios = <&gpio1 29 GPIO_ACTIVE_LOW>;
+            mantix,tp-rstn-gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
             backlight = <&backlight>;
         };
     };
index 90807a6b415ca8598e83f72dd0a589c0d3cbc0b6..deeed73f4ed6924d92a9f66668a1249a6f144f4d 100644 (file)
@@ -374,6 +374,10 @@ static bool is_edid_digital_input_dp(const struct edid *edid)
  * drm_dp_downstream_is_type() - is the downstream facing port of certain type?
  * @dpcd: DisplayPort configuration data
  * @port_cap: port capabilities
+ * @type: port type to be checked. Can be:
+ *       %DP_DS_PORT_TYPE_DP, %DP_DS_PORT_TYPE_VGA, %DP_DS_PORT_TYPE_DVI,
+ *       %DP_DS_PORT_TYPE_HDMI, %DP_DS_PORT_TYPE_NON_EDID,
+ *       %DP_DS_PORT_TYPE_DP_DUALMODE or %DP_DS_PORT_TYPE_WIRELESS.
  *
  * Caveat: Only works with DPCD 1.1+ port caps.
  *
@@ -870,6 +874,7 @@ EXPORT_SYMBOL(drm_dp_downstream_444_to_420_conversion);
 
 /**
  * drm_dp_downstream_mode() - return a mode for downstream facing port
+ * @dev: DRM device
  * @dpcd: DisplayPort configuration data
  * @port_cap: port capabilities
  *
@@ -1028,7 +1033,8 @@ EXPORT_SYMBOL(drm_dp_downstream_debug);
 
 /**
  * drm_dp_subconnector_type() - get DP branch device type
- *
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
  */
 enum drm_mode_subconnector
 drm_dp_subconnector_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
@@ -1079,6 +1085,10 @@ EXPORT_SYMBOL(drm_dp_subconnector_type);
 
 /**
  * drm_mode_set_dp_subconnector_property - set subconnector for DP connector
+ * @connector: connector to set property on
+ * @status: connector status
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
  *
  * Called by a driver on every detect event.
  */
index a82f37d4425826b72f9bb036fad293c51408574f..631125b46e04c6df67a5a14a13cc4b98b6061137 100644 (file)
@@ -3741,7 +3741,7 @@ drm_add_cmdb_modes(struct drm_connector *connector, u8 svd)
 /**
  * drm_display_mode_from_cea_vic() - return a mode for CEA VIC
  * @dev: DRM device
- * @vic: CEA VIC of the mode
+ * @video_code: CEA VIC of the mode
  *
  * Creates a new mode matching the specified CEA VIC.
  *
index 19d73868490e65d3b35040a47065378186101674..69c2c079d8036bcde1d17b717c50ea5168cea2a1 100644 (file)
@@ -1085,6 +1085,8 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
         */
        drm_gem_object_get(obj);
 
+       vma->vm_private_data = obj;
+
        if (obj->funcs && obj->funcs->mmap) {
                ret = obj->funcs->mmap(obj, vma);
                if (ret) {
@@ -1107,8 +1109,6 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
                vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
        }
 
-       vma->vm_private_data = obj;
-
        return 0;
 }
 EXPORT_SYMBOL(drm_gem_mmap_obj);
index d77c9f8ff26ced1e994792f36e4cc49321bb31f3..e00616d94f26ef9b21584fd2a0f8311b5a714d32 100644 (file)
@@ -593,8 +593,13 @@ int drm_gem_shmem_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
        /* Remove the fake offset */
        vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node);
 
-       if (obj->import_attach)
+       if (obj->import_attach) {
+               /* Drop the reference drm_gem_mmap_obj() acquired.*/
+               drm_gem_object_put(obj);
+               vma->vm_private_data = NULL;
+
                return dma_buf_mmap(obj->dma_buf, vma, 0);
+       }
 
        shmem = to_drm_gem_shmem_obj(obj);
 
index d6808f678db541388e1e808085d4ec022e6acd43..9f955f2010c25770f53110a2ff92ba98d0caadf4 100644 (file)
@@ -794,6 +794,7 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
 
 /**
  * drm_prime_pages_to_sg - converts a page array into an sg list
+ * @dev: DRM device
  * @pages: pointer to the array of page pointers to convert
  * @nr_pages: length of the page vector
  *
index 3482e28e30fc9ed3c68698891e6ffcf0929e9598..0c5f22e95c2dbbafb9850faf2aeb4771788d09ad 100644 (file)
@@ -26,7 +26,9 @@
 struct mantix {
        struct device *dev;
        struct drm_panel panel;
+
        struct gpio_desc *reset_gpio;
+       struct gpio_desc *tp_rstn_gpio;
 
        struct regulator *avdd;
        struct regulator *avee;
@@ -124,6 +126,10 @@ static int mantix_unprepare(struct drm_panel *panel)
 {
        struct mantix *ctx = panel_to_mantix(panel);
 
+       gpiod_set_value_cansleep(ctx->tp_rstn_gpio, 1);
+       usleep_range(5000, 6000);
+       gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
        regulator_disable(ctx->avee);
        regulator_disable(ctx->avdd);
        /* T11 */
@@ -165,13 +171,10 @@ static int mantix_prepare(struct drm_panel *panel)
                return ret;
        }
 
-       /* T3+T5 */
-       usleep_range(10000, 12000);
-
-       gpiod_set_value_cansleep(ctx->reset_gpio, 1);
-       usleep_range(5150, 7000);
-
+       /* T3 + T4 + time for voltage to become stable: */
+       usleep_range(6000, 7000);
        gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+       gpiod_set_value_cansleep(ctx->tp_rstn_gpio, 0);
 
        /* T6 */
        msleep(50);
@@ -204,7 +207,7 @@ static int mantix_get_modes(struct drm_panel *panel,
        if (!mode) {
                dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n",
                        default_mode.hdisplay, default_mode.vdisplay,
-                       drm_mode_vrefresh(mode));
+                       drm_mode_vrefresh(&default_mode));
                return -ENOMEM;
        }
 
@@ -236,12 +239,18 @@ static int mantix_probe(struct mipi_dsi_device *dsi)
        if (!ctx)
                return -ENOMEM;
 
-       ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
+       ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(ctx->reset_gpio)) {
                dev_err(dev, "cannot get reset gpio\n");
                return PTR_ERR(ctx->reset_gpio);
        }
 
+       ctx->tp_rstn_gpio = devm_gpiod_get(dev, "mantix,tp-rstn", GPIOD_OUT_HIGH);
+       if (IS_ERR(ctx->tp_rstn_gpio)) {
+               dev_err(dev, "cannot get tp-rstn gpio\n");
+               return PTR_ERR(ctx->tp_rstn_gpio);
+       }
+
        mipi_dsi_set_drvdata(dsi, ctx);
        ctx->dev = dev;
 
index b51cc685c13adbff30cc21fd36bb08d639950029..edb60ae0a9b75f667b67f65d7380c1208b8f977e 100644 (file)
@@ -407,6 +407,7 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
        struct drm_framebuffer *fb = state->fb;
        const struct drm_format_info *format = fb->format;
        uint64_t modifier = fb->modifier;
+       unsigned int ch1_phase_idx;
        u32 out_fmt_val;
        u32 in_fmt_val, in_mod_val, in_ps_val;
        unsigned int i;
@@ -442,18 +443,19 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
         * I have no idea what this does exactly, but it seems to be
         * related to the scaler FIR filter phase parameters.
         */
+       ch1_phase_idx = (format->num_planes > 1) ? 1 : 0;
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_HORZPHASE_REG,
-                    frontend->data->ch_phase[0].horzphase);
+                    frontend->data->ch_phase[0]);
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_HORZPHASE_REG,
-                    frontend->data->ch_phase[1].horzphase);
+                    frontend->data->ch_phase[ch1_phase_idx]);
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_VERTPHASE0_REG,
-                    frontend->data->ch_phase[0].vertphase[0]);
+                    frontend->data->ch_phase[0]);
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_VERTPHASE0_REG,
-                    frontend->data->ch_phase[1].vertphase[0]);
+                    frontend->data->ch_phase[ch1_phase_idx]);
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_VERTPHASE1_REG,
-                    frontend->data->ch_phase[0].vertphase[1]);
+                    frontend->data->ch_phase[0]);
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_VERTPHASE1_REG,
-                    frontend->data->ch_phase[1].vertphase[1]);
+                    frontend->data->ch_phase[ch1_phase_idx]);
 
        /*
         * Checking the input format is sufficient since we currently only
@@ -687,30 +689,12 @@ static const struct dev_pm_ops sun4i_frontend_pm_ops = {
 };
 
 static const struct sun4i_frontend_data sun4i_a10_frontend = {
-       .ch_phase               = {
-               {
-                       .horzphase = 0,
-                       .vertphase = { 0, 0 },
-               },
-               {
-                       .horzphase = 0xfc000,
-                       .vertphase = { 0xfc000, 0xfc000 },
-               },
-       },
+       .ch_phase               = { 0x000, 0xfc000 },
        .has_coef_rdy           = true,
 };
 
 static const struct sun4i_frontend_data sun8i_a33_frontend = {
-       .ch_phase               = {
-               {
-                       .horzphase = 0x400,
-                       .vertphase = { 0x400, 0x400 },
-               },
-               {
-                       .horzphase = 0x400,
-                       .vertphase = { 0x400, 0x400 },
-               },
-       },
+       .ch_phase               = { 0x400, 0xfc400 },
        .has_coef_access_ctrl   = true,
 };
 
index 0c382c1ddb0fe81b0eb8f63999d0f6e2856d650c..2e7b76e50c2ba21942fa16b4c5d42f33c6f15326 100644 (file)
@@ -115,11 +115,7 @@ struct reset_control;
 struct sun4i_frontend_data {
        bool    has_coef_access_ctrl;
        bool    has_coef_rdy;
-
-       struct {
-               u32     horzphase;
-               u32     vertphase[2];
-       } ch_phase[2];
+       u32     ch_phase[2];
 };
 
 struct sun4i_frontend {
index 915f8bfdb58cad0f355b4e5c94fbf37df651309a..182c586525eb844807588c2e62064e779f887d9f 100644 (file)
@@ -568,7 +568,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
                ret = v3d_job_init(v3d, file_priv, &bin->base,
                                   v3d_job_free, args->in_sync_bcl);
                if (ret) {
-                       kfree(bin);
                        v3d_job_put(&render->base);
                        kfree(bin);
                        return ret;
index f1a5fd5dab6f5caf103a98764449fa79bfaf374f..a17aa1db11b6f7ee85a2eb5b717ca8c593c53d8f 100644 (file)
@@ -314,6 +314,7 @@ unbind_all:
        component_unbind_all(dev, drm);
 gem_destroy:
        vc4_gem_destroy(drm);
+       drm_mode_config_cleanup(drm);
        vc4_bo_cache_destroy(drm);
 dev_put:
        drm_dev_put(drm);
index 90b911fd2a7f3b43191fdba401ea03ecc19809c1..66d4fb16db8f01587eaf5a24253af626ca8d8bd1 100644 (file)
@@ -287,7 +287,7 @@ struct vc4_bo {
 static inline struct vc4_bo *
 to_vc4_bo(struct drm_gem_object *bo)
 {
-       return (struct vc4_bo *)bo;
+       return container_of(to_drm_gem_cma_obj(bo), struct vc4_bo, base);
 }
 
 struct vc4_fence {
@@ -300,7 +300,7 @@ struct vc4_fence {
 static inline struct vc4_fence *
 to_vc4_fence(struct dma_fence *fence)
 {
-       return (struct vc4_fence *)fence;
+       return container_of(fence, struct vc4_fence, base);
 }
 
 struct vc4_seqno_cb {
@@ -347,7 +347,7 @@ struct vc4_plane {
 static inline struct vc4_plane *
 to_vc4_plane(struct drm_plane *plane)
 {
-       return (struct vc4_plane *)plane;
+       return container_of(plane, struct vc4_plane, base);
 }
 
 enum vc4_scaling_mode {
@@ -423,7 +423,7 @@ struct vc4_plane_state {
 static inline struct vc4_plane_state *
 to_vc4_plane_state(struct drm_plane_state *state)
 {
-       return (struct vc4_plane_state *)state;
+       return container_of(state, struct vc4_plane_state, base);
 }
 
 enum vc4_encoder_type {
@@ -499,7 +499,7 @@ struct vc4_crtc {
 static inline struct vc4_crtc *
 to_vc4_crtc(struct drm_crtc *crtc)
 {
-       return (struct vc4_crtc *)crtc;
+       return container_of(crtc, struct vc4_crtc, base);
 }
 
 static inline const struct vc4_crtc_data *
@@ -537,7 +537,7 @@ struct vc4_crtc_state {
 static inline struct vc4_crtc_state *
 to_vc4_crtc_state(struct drm_crtc_state *crtc_state)
 {
-       return (struct vc4_crtc_state *)crtc_state;
+       return container_of(crtc_state, struct vc4_crtc_state, base);
 }
 
 #define V3D_READ(offset) readl(vc4->v3d->regs + offset)
index e8f99e29065559a58bfc7be61e48d3239445304f..95779d50cca0b45cf38bdbeb413c4a47a450f33d 100644 (file)
@@ -922,6 +922,7 @@ static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream,
                                    struct snd_soc_dai *dai)
 {
        struct vc4_hdmi *vc4_hdmi = dai_to_hdmi(dai);
+       struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
        struct device *dev = &vc4_hdmi->pdev->dev;
        u32 audio_packet_config, channel_mask;
        u32 channel_map;
@@ -981,6 +982,8 @@ static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream,
        HDMI_WRITE(HDMI_AUDIO_PACKET_CONFIG, audio_packet_config);
        vc4_hdmi_set_n_cts(vc4_hdmi);
 
+       vc4_hdmi_set_audio_infoframe(encoder);
+
        return 0;
 }
 
@@ -988,11 +991,9 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
                                  struct snd_soc_dai *dai)
 {
        struct vc4_hdmi *vc4_hdmi = dai_to_hdmi(dai);
-       struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
 
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
-               vc4_hdmi_set_audio_infoframe(encoder);
                vc4_hdmi->audio.streaming = true;
 
                if (vc4_hdmi->variant->phy_rng_enable)
@@ -1076,6 +1077,7 @@ static const struct snd_soc_dapm_route vc4_hdmi_audio_routes[] = {
 };
 
 static const struct snd_soc_component_driver vc4_hdmi_audio_component_drv = {
+       .name                   = "vc4-hdmi-codec-dai-component",
        .controls               = vc4_hdmi_audio_controls,
        .num_controls           = ARRAY_SIZE(vc4_hdmi_audio_controls),
        .dapm_widgets           = vc4_hdmi_audio_widgets,
index da53aebb7230b980ba23e9c87d361d9b6d6906df..a53243abd9450508bb302d59122607dede8eb049 100644 (file)
@@ -1836,7 +1836,7 @@ static inline void drm_dp_cec_unset_edid(struct drm_dp_aux *aux)
  * @link_rate: Requested Link rate from DPCD 0x219
  * @num_lanes: Number of lanes requested by sing through DPCD 0x220
  * @phy_pattern: DP Phy test pattern from DPCD 0x248
- * @hb2_reset: DP HBR2_COMPLIANCE_SCRAMBLER_RESET from DCPD 0x24A and 0x24B
+ * @hbr2_reset: DP HBR2_COMPLIANCE_SCRAMBLER_RESET from DCPD 0x24A and 0x24B
  * @custom80: DP Test_80BIT_CUSTOM_PATTERN from DPCDs 0x250 through 0x259
  * @enhanced_frame_cap: flag for enhanced frame capability.
  */
index b27a0e2169c8f56bdcd882ea18f5cd200248a327..e97daf6ffbb193a74505026492b9f29825ee365d 100644 (file)
@@ -359,13 +359,6 @@ drm_load_edid_firmware(struct drm_connector *connector)
 }
 #endif
 
-/**
- * drm_edid_are_equal - compare two edid blobs.
- * @edid1: pointer to first blob
- * @edid2: pointer to second blob
- * This helper can be used during probing to determine if
- * edid had changed.
- */
 bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2);
 
 int
index 1c9417430d08520f8c5c9a593ee874f7d5aebdfc..f32d179e139d9cdd45621436fe866d5332bd510d 100644 (file)
@@ -338,7 +338,7 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                 const char *format, ...);
 
 /**
- * Error output.
+ * DRM_DEV_ERROR() - Error output.
  *
  * @dev: device pointer
  * @fmt: printf() like format string.
@@ -347,10 +347,12 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
        drm_dev_printk(dev, KERN_ERR, "*ERROR* " fmt, ##__VA_ARGS__)
 
 /**
- * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
+ * DRM_DEV_ERROR_RATELIMITED() - Rate limited error output.
  *
  * @dev: device pointer
  * @fmt: printf() like format string.
+ *
+ * Like DRM_ERROR() but won't flood the log.
  */
 #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)                       \
 ({                                                                     \
@@ -375,15 +377,27 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
 })
 
 /**
- * Debug output.
+ * DRM_DEV_DEBUG() - Debug output for generic drm code
  *
  * @dev: device pointer
  * @fmt: printf() like format string.
  */
 #define DRM_DEV_DEBUG(dev, fmt, ...)                                   \
        drm_dev_dbg(dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
+/**
+ * DRM_DEV_DEBUG_DRIVER() - Debug output for vendor specific part of the driver
+ *
+ * @dev: device pointer
+ * @fmt: printf() like format string.
+ */
 #define DRM_DEV_DEBUG_DRIVER(dev, fmt, ...)                            \
        drm_dev_dbg(dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
+/**
+ * DRM_DEV_DEBUG_KMS() - Debug output for modesetting code
+ *
+ * @dev: device pointer
+ * @fmt: printf() like format string.
+ */
 #define DRM_DEV_DEBUG_KMS(dev, fmt, ...)                               \
        drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)