From patchwork Tue Aug 20 23:06:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171876 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp180334ily; Tue, 20 Aug 2019 16:06:55 -0700 (PDT) X-Received: by 2002:a65:6281:: with SMTP id f1mr25234891pgv.400.1566342415663; Tue, 20 Aug 2019 16:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566342415; cv=none; d=google.com; s=arc-20160816; b=iM32+j6DMiPbegz44Fwj8LKgugRUENxXgA3aF3+q+JtpTzQ+ypK3iYnXypjqf5mWCa B3+juLCKDv9E51sL7Ld3MCd9U6/NUPZa3bQGa1CW0gNf6e5mZA/kcylHvLhzGKQsAbpd dXa2RMyFnNT0bBkKuTNRc1s0MJDtQJYnoUiHgPd2DFmy2sfl58+DFAl2C/ZsrdujHTgX qGo3zV7GlX9IdsdXs6LFPah3HXudU2JZk0BaSkyGMhITeVuxp3z8tM+0jtZ18Pw2uv3x OVOyFq7+eqCZwQ4YuPbmH0hnC9e2iOBBAbR5ac0jwkWFxVQboywCgrC1cHAWRNPsYcXI Evng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Nc0HKvLqdfxQ4XGBrfjKvfOMJNdfixijHmLsJLYaeJM=; b=I0YVXhRiKL/jJHyzT29PyEOVvjBARnvcF9UgTVLyPF1xPO/YmSr2cEwrCXZI+L761B hHuezstK3mDGZKaHvgZj4idF77tQX09E7FJIQ9J8r23EYUBkWqxGdZ0jkEOOZlXL98DB /uc08n5IJ1sXGf91YB6BBsbu8ru43KylozLUczzoLzqy9W8AxhPHX2tlrAUCfvATgJKS jjw2ujRMQM1qEykOQdiwSuj53M40kBG2wmqDFB3k9iDns7JZHO5InW4PcSrX2EIrjoSC LG8BrhKkHyg2pfe9v1rJIjA6RkQTsEZyf1oOKOMeZcPmxv5f7oLqf/Gc/mdiigWId36Z UPOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GJQNBGk5; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 1sor5541186pfz.26.2019.08.20.16.06.55 for (Google Transport Security); Tue, 20 Aug 2019 16:06:55 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GJQNBGk5; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Nc0HKvLqdfxQ4XGBrfjKvfOMJNdfixijHmLsJLYaeJM=; b=GJQNBGk5r/2vcoEMF2xMvysOdEQINWPzyB68OUdnEgdsP+PFQgWLf5Gk+wnqCbVE3k MHW9uNhKC7xDRdBUuUzVDyuppOCKAyTs6CRisMkdUpzHFAuqEWKBVDHtGCQ8HUDezlrm 5jNCCeZINejwuo60CoS7OfL08l3Ip/8ixVny4TedC7prbf+I6rV2ycGv1kNC5akcGW/f zJUOz4A7khwYlnW4oHgw/iOjwONpuAcsAxi3clf0DSahsstYfsa+zMdU6XE9zKWSmv8g Rn6ljFFKO6eCX3Fh0fQZ//J1FNyRJaWvKVWfgYX2522ZXI197xHpgSjgFi/ZKJImjSOM H7fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Nc0HKvLqdfxQ4XGBrfjKvfOMJNdfixijHmLsJLYaeJM=; b=n6lggXuEv2jYCEEAB5EV8rp07TiGQ5ajmPo3oZghN+VLKiLsEPbS/tPWaqszisSRyh /VUhXdwtfEHi4ZONiZVMWOuFo8jXDu8VGp9vS8EuNzc/b9arRuj3+zXPHqcASGk8AcMH K1ibqh7GMiBBpFXLx8w9VJll1Nc45dw9KiDX47ViOpEQMc0E0OZI3yzqROiiaqH1jZqE Fv/XmgGqDop+4EuHhItL7arIVSVHVY7LnMqdYYdKUXbmbduXyMeF3igYDP48xAzW0IyM AMTo2mgNuHZX5tDmf/BZByUdsBJwC2OGUbrembEiuMGMecr6nZWQ5cgMf6uG+7Ybs6M0 LUrw== X-Gm-Message-State: APjAAAVimmqG6ZwK1GZH1uIvaHAONEwUIAYhcgdZC8adZPPguQWX+F8R NQjIkAPSscT/yXEzanToxP4tkLMHZbCvjA== X-Google-Smtp-Source: APXvYqyycOrj5QO/qCGc2tAh0Oxqq8tIKtAZe2eG52cV3l89piP4mv+qYGEtbuNk91J/oP8Yz4OZrg== X-Received: by 2002:a63:121b:: with SMTP id h27mr451417pgl.335.1566342415194; Tue, 20 Aug 2019 16:06:55 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id q4sm27564747pff.183.2019.08.20.16.06.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 16:06:53 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v5 17/25] drm: kirin: Move config max_width and max_height to driver data Date: Tue, 20 Aug 2019 23:06:18 +0000 Message-Id: <20190820230626.23253-18-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190820230626.23253-1-john.stultz@linaro.org> References: <20190820230626.23253-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the max_width and max_height values used in kirin_drm_mode_config_inita to hardware specific driver data. This will make it easier to add support for new devices via a new kirin_drm_data structure. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 ++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 17 +++++------------ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 ++ 3 files changed, 9 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index a74b2623dbbb..a4cf122375ea 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1054,6 +1054,8 @@ struct kirin_drm_data ade_driver_data = { .prim_plane = ADE_CH1, .channel_formats = channel_formats, .channel_formats_cnt = ARRAY_SIZE(channel_formats), + .config_max_width = 2048, + .config_max_height = 2048, .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 25191824b64e..2ab32c2e3f95 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -40,17 +40,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) return 0; } -static void kirin_drm_mode_config_init(struct drm_device *dev) -{ - dev->mode_config.min_width = 0; - dev->mode_config.min_height = 0; - - dev->mode_config.max_width = 2048; - dev->mode_config.max_height = 2048; - - dev->mode_config.funcs = driver_data->mode_config_funcs; -} - static int kirin_drm_kms_init(struct drm_device *dev) { int ret; @@ -59,7 +48,11 @@ static int kirin_drm_kms_init(struct drm_device *dev) /* dev->mode_config initialization */ drm_mode_config_init(dev); - kirin_drm_mode_config_init(dev); + dev->mode_config.min_width = 0; + dev->mode_config.min_height = 0; + dev->mode_config.max_width = driver_data->config_max_width; + dev->mode_config.max_height = driver_data->config_max_width; + dev->mode_config.funcs = driver_data->mode_config_funcs; /* display controller init */ ret = driver_data->init(to_platform_device(dev->dev)); diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 2b660df60293..43be65f82a03 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -37,6 +37,8 @@ struct kirin_plane { struct kirin_drm_data { const u32 *channel_formats; u32 channel_formats_cnt; + int config_max_width; + int config_max_height; u32 num_planes; u32 prim_plane;