From patchwork Wed Aug 14 18:46:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171347 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203348ily; Wed, 14 Aug 2019 11:47:35 -0700 (PDT) X-Received: by 2002:a65:4304:: with SMTP id j4mr480749pgq.419.1565808455242; Wed, 14 Aug 2019 11:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808455; cv=none; d=google.com; s=arc-20160816; b=gpK9Bb6jFR97XXb5daOLxlT1xiwLbHZFBxKUIc+igY0OuuNltO98QqK4a02Ox7qY+e grZLK6D3Q+wbZUtl+N7OjeiwE8p7KTkpiYzw5/PUT7FfanNq71TYwpQbtHjonfZi31bd cLqS/pYDIE4LC1mLtcBUj6al5SBcJ6n1k3yza1ZNUwXl8OA8VJ5Dq4XRJsQmsBGi5gZl qQJMY4V4+vuMJCBk/iarW7Zxtixe5IIRHM0nsGEPsV0edeiFM6qalL0Na2LY5mczk/ZU hjghoAlAXNOJDqb9cfDrArmbfWuHnrztK7Y83p7/he/OPmyPnKRd/3FNHHJVqabQPVc1 MdWg== 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=f7xcuRX/1vBOSp3204JRR3FGT/MGHZqTKrSmOwFZnf4=; b=rGLjZBG+yIjpEUIen2CHqCkjC3Rqe+0b6qs+RZT1aX+ZupE4ih9e1HQhvJAny3ZEzo rxEjkZsT+CMR8oOwLuJD+7AQK2DmJR99kw4qwuXdyc3UxnTdWpwtn40g74rihUJ6ijqD p847Y1pplh8sqrOMhLHn8P5ys9b5HpbdBelfEj0uAd57HtY6R21FPX1E3vJ6MNOBsEOD YJR+DNSMz++ytd2Qx+UYcYl6cg/wtcPSfwzf7nsamTWW79kXrfpB8NhfbcHRvkFm4Hdy 4iApzZvMrzRpTZ1Lhczb+jlN5YRBb4qjq6Xp2lttz2cDh6tmAbkIZqN9MHWGNOP1igzr VIzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="g8HG/tRx"; 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 11sor382804pgf.75.2019.08.14.11.47.35 for (Google Transport Security); Wed, 14 Aug 2019 11:47:35 -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="g8HG/tRx"; 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=f7xcuRX/1vBOSp3204JRR3FGT/MGHZqTKrSmOwFZnf4=; b=g8HG/tRxey5TUfBHN6Wyf9GMHW1PjL30NIA/P1GlCecHTr5xSmbZzb5clD16Ntw9A5 eMeWcPBdGnfp+XOYG/bjsc1UAXqNG8yEiDHnIP6BLc8hq8a8lCg/TgKr+Ga5R6fH8NuR M7Qzm8QZZxECjgZiWLkk9dpNYbti7ep5G2GAJmDCDKtTf7Og7CtA2H1Wfun+4CCSDTxP Wsf0bfYcJ91GIOWkRdGcHRLeYTwjHUnnU9aXalI2kgE58/iIWf+PnUqqZPM4qlrHV2NG XIG7tsVSJWmF3xGJcWKS1RFMsJt1KsQU3Y549DRMhjD/DVrf1Al1vn2vw1C+fk7l5Nf8 S8ow== 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=f7xcuRX/1vBOSp3204JRR3FGT/MGHZqTKrSmOwFZnf4=; b=TyJ25Ht+MTcqhQz8AZyxr9Dtn3OkNfhlBrJWzpRTg25+exv+DAEnuC/qZebXBA5VTM Op59jN9fKbjJHrOMYVyLoou26IxrgWhrW7OmlAr/p/u6+k9oaQBxu2iJxotme3EtrJu3 7gXQkkF25Rx9zVxxNEYv0XjV5UhfTLQjm0UWm8XU/2Ox6jnMVK4flNIeiX4BsURvQiYg figxC5Mn+BVoV390DMgdnTEIKnijnSOySA7wU5KXPSg0gXgc9jI21yzPhMV8RW/CNpRV KjXKEXVg5TBkFr8/g7QwTx2dCb23KiDpkB+CURODfA6JQ5qTcwiiJuEePK65xAAwfCRZ 223A== X-Gm-Message-State: APjAAAXj376to32a0RNLq/3IlXbBJnCD82gFLzk6419UJXBa1Do+tZf6 PS2EnF3ok3cb5JKVSaYXth5LuL1U X-Google-Smtp-Source: APXvYqwOJ5gF01XhACt/fu5chx2S5A7OH6nw2xpAfmT3vkaJgq5qP2DrY09y93lww3VSrJsXoZ6Oig== X-Received: by 2002:a63:5c7:: with SMTP id 190mr474913pgf.67.1565808454735; Wed, 14 Aug 2019 11:47:34 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:33 -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: [RESEND][PATCH v3 18/26] drm: kirin: Move config max_width and max_height to driver data Date: Wed, 14 Aug 2019 18:46:54 +0000 Message-Id: <20190814184702.54275-19-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 fc0f4c04d1c9..68efd508d86b 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 bf1e601fb367..7956d698d368 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -39,17 +39,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; @@ -58,7 +47,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;