From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751659AbdJCJwi (ORCPT ); Tue, 3 Oct 2017 05:52:38 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:46348 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751200AbdJCJwg (ORCPT ); Tue, 3 Oct 2017 05:52:36 -0400 X-Google-Smtp-Source: AOwi7QBrQdHqzrrBEXdQzcjlvH+7fMyKywQKaxs1jrniPikDWazYLf50nFxSxiPK2XM6iOXce1qrPA== Subject: Re: [PATCH v2 2/7] drm/rockchip: dw_hdmi: add device type To: Algea Cao , daniel.vetter@intel.com, jani.nikula@linux.intel.com, seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org Cc: yang.zheng@rock-chips.com, kever.yang@rock-chips.com References: <1506735713-147081-0> <1506735836-151661-1-git-send-email-algea.cao@rock-chips.com> From: Neil Armstrong Organization: Baylibre Message-ID: <7133fdf3-afde-f548-06fa-81b0dc170116@baylibre.com> Date: Tue, 3 Oct 2017 11:52:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1506735836-151661-1-git-send-email-algea.cao@rock-chips.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/09/2017 03:43, Algea Cao wrote: > To determine type of SOC, we add a parameter dev_type. > > Signed-off-by: Algea Cao > --- > drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 5 +++++ > include/drm/bridge/dw_hdmi.h | 10 ++++++++++ > 2 files changed, 15 insertions(+) > > diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c > index 719452d..09c77f9 100644 > --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c > +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c > @@ -46,6 +46,7 @@ struct rockchip_hdmi { > struct regmap *regmap; > struct drm_encoder encoder; > const struct rockchip_hdmi_chip_data *chip_data; > + enum dw_hdmi_devtype dev_type; > struct clk *vpll_clk; > struct clk *grf_clk; > }; > @@ -305,6 +306,7 @@ static const struct dw_hdmi_plat_data rk3288_hdmi_drv_data = { > .cur_ctr = rockchip_cur_ctr, > .phy_config = rockchip_phy_config, > .phy_data = &rk3288_chip_data, > + .dev_type = RK3288_HDMI, > }; > > static struct rockchip_hdmi_chip_data rk3399_chip_data = { > @@ -315,6 +317,7 @@ static struct rockchip_hdmi_chip_data rk3399_chip_data = { > > static const struct dw_hdmi_plat_data rk3328_hdmi_drv_data = { > .mode_valid = dw_hdmi_rockchip_mode_valid, > + .dev_type = RK3328_HDMI, > }; > static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = { > .mode_valid = dw_hdmi_rockchip_mode_valid, > @@ -322,6 +325,7 @@ static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = { > .cur_ctr = rockchip_cur_ctr, > .phy_config = rockchip_phy_config, > .phy_data = &rk3399_chip_data, > + .dev_type = RK3399_HDMI, > }; > > static const struct of_device_id dw_hdmi_rockchip_dt_ids[] = { > @@ -360,6 +364,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, > plat_data = match->data; > hdmi->dev = &pdev->dev; > hdmi->chip_data = plat_data->phy_data; > + hdmi->dev_type = plat_data->dev_type; > encoder = &hdmi->encoder; > > encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node); > diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h > index 182f832..fdb1f0a 100644 > --- a/include/drm/bridge/dw_hdmi.h > +++ b/include/drm/bridge/dw_hdmi.h > @@ -92,6 +92,15 @@ enum dw_hdmi_phy_type { > DW_HDMI_PHY_VENDOR_PHY = 0xfe, > }; > > +enum dw_hdmi_devtype { > + RK3228_HDMI, > + RK3288_HDMI, > + RK3328_HDMI, > + RK3366_HDMI, > + RK3368_HDMI, > + RK3399_HDMI, > +}; > + > struct dw_hdmi_mpll_config { > unsigned long mpixelclock; > struct { > @@ -124,6 +133,7 @@ struct dw_hdmi_phy_ops { > > struct dw_hdmi_plat_data { > struct regmap *regm; > + enum dw_hdmi_devtype dev_type; Please don't do that, dw-hdmi driver should not have knowledge of the device type, if the vendor PHY reporting is broken, add a way to force phy_type to DW_HDMI_PHY_VENDOR_PHY. Neil > enum drm_mode_status (*mode_valid)(struct drm_connector *connector, > const struct drm_display_mode *mode); > unsigned long input_bus_format; >