From patchwork Fri Jan 15 12:55:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 8040071 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CD133BEEE5 for ; Fri, 15 Jan 2016 12:55:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E35232045A for ; Fri, 15 Jan 2016 12:55:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 05ED620361 for ; Fri, 15 Jan 2016 12:55:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755782AbcAOMzu (ORCPT ); Fri, 15 Jan 2016 07:55:50 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:34186 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754261AbcAOMzt (ORCPT ); Fri, 15 Jan 2016 07:55:49 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u0FCtYOd032281; Fri, 15 Jan 2016 06:55:34 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u0FCtXUp027989; Fri, 15 Jan 2016 06:55:33 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Fri, 15 Jan 2016 06:55:34 -0600 Received: from imryr.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u0FCtVoK011102; Fri, 15 Jan 2016 06:55:31 -0600 From: Jyri Sarha To: , , CC: , , , , Jyri Sarha Subject: [PATCH RFC] drm/i2c: tda998x: Only set atomic funcs if bound to atomic drm driver Date: Fri, 15 Jan 2016 14:55:26 +0200 Message-ID: <1452862526-32176-1-git-send-email-jsarha@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Only set atomic connector callbacks if the tda998x driver is bound to a drm driver that supports atomic modesetting. At least drm_crtc_helper_set_config() calls connectors dpms callback without knowing that it may assume atomic modeset support. Calling drm_atomic_helper_connector_dpms() causes a crash with a driver that does not have atomic state initialized. Fixes commit 9736e988d328 ("drm/i2c: tda998x: Add support for atomic modesetting"). Signed-off-by: Jyri Sarha --- I am not sure if this is the best way to fix the issue, but after 9736e988d328 Beaglebone-Black HDMI is totally broken and this fixes the issue. I am currently working on atomic modesetting for tilcdc, but there is no way it makes it to 4.5 release. Best regards, Jyri drivers/gpu/drm/i2c/tda998x_drv.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 012d36d..67d1408 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1382,7 +1382,7 @@ static void tda998x_connector_destroy(struct drm_connector *connector) drm_connector_cleanup(connector); } -static const struct drm_connector_funcs tda998x_connector_funcs = { +static const struct drm_connector_funcs tda998x_connector_atomic_funcs = { .dpms = drm_atomic_helper_connector_dpms, .reset = drm_atomic_helper_connector_reset, .fill_modes = drm_helper_probe_single_connector_modes, @@ -1392,15 +1392,28 @@ static const struct drm_connector_funcs tda998x_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; +static const struct drm_connector_funcs tda998x_connector_funcs = { + .dpms = drm_helper_connector_dpms, + .fill_modes = drm_helper_probe_single_connector_modes, + .detect = tda998x_connector_detect, + .destroy = tda998x_connector_destroy, +}; + static int tda998x_bind(struct device *dev, struct device *master, void *data) { struct tda998x_encoder_params *params = dev->platform_data; struct i2c_client *client = to_i2c_client(dev); struct drm_device *drm = data; struct tda998x_priv *priv; + const struct drm_connector_funcs *connector_funcs; u32 crtcs = 0; int ret; + if (drm_core_check_feature(drm, DRIVER_ATOMIC)) + connector_funcs = &tda998x_connector_atomic_funcs; + else + connector_funcs = &tda998x_connector_funcs; + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -1437,7 +1450,7 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data) drm_connector_helper_add(&priv->connector, &tda998x_connector_helper_funcs); ret = drm_connector_init(drm, &priv->connector, - &tda998x_connector_funcs, + connector_funcs, DRM_MODE_CONNECTOR_HDMIA); if (ret) goto err_connector;