Message ID | 20210913175747.47456-14-sean@poorly.run (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/hdcp: Pull HDCP auth/exchange/check into | expand |
Quoting Sean Paul (2021-09-13 10:57:44) > From: Sean Paul <seanpaul@chromium.org> > > This patch adds the register ranges required for HDCP to the sc7180 > device tree. These registers will be used to inject HDCP key as well as > toggle HDCP on and off. It doesn't look to do any of that? > > Signed-off-by: Sean Paul <seanpaul@chromium.org> > --- > drivers/gpu/drm/msm/dp/dp_parser.c | 30 +++++++++++++++++++++++++++--- > drivers/gpu/drm/msm/dp/dp_parser.h | 4 ++++ > 2 files changed, 31 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c > index 0519dd3ac3c3..4bbe2485ce3c 100644 > --- a/drivers/gpu/drm/msm/dp/dp_parser.c > +++ b/drivers/gpu/drm/msm/dp/dp_parser.c > @@ -20,11 +20,19 @@ static const struct dp_regulator_cfg sdm845_dp_reg_cfg = { > }; > > static int msm_dss_ioremap(struct platform_device *pdev, > - struct dss_io_data *io_data) > + struct dss_io_data *io_data, const char *name, > + int fallback_idx) > { > struct resource *res = NULL; > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); > + > + /* Support dts which do not have named resources */ Please no. Just use index and know that 0 is the dp hardware, 1 is the hdcp key and 2 is the tz interaction zone. There is some backwards compat logic to maintain for when it was split out but I hope we can drop that soon. Alternatively we could make a new compatible and then not care about future conflicts. > + if (!res) { > + if (fallback_idx >= 0) > + res = platform_get_resource(pdev, IORESOURCE_MEM, > + fallback_idx); > + } > if (!res) { > DRM_ERROR("%pS->%s: msm_dss_get_res failed\n", > __builtin_return_address(0), __func__); > @@ -55,6 +63,8 @@ static void dp_parser_unmap_io_resources(struct dp_parser *parser) > { > struct dp_io *io = &parser->io; > > + msm_dss_iounmap(&io->hdcp_tz); > + msm_dss_iounmap(&io->hdcp_key); > msm_dss_iounmap(&io->dp_controller); > } > > @@ -64,12 +74,26 @@ static int dp_parser_ctrl_res(struct dp_parser *parser) > struct platform_device *pdev = parser->pdev; > struct dp_io *io = &parser->io; > > - rc = msm_dss_ioremap(pdev, &io->dp_controller); > + rc = msm_dss_ioremap(pdev, &io->dp_controller, "dp_controller", 0); > if (rc) { > DRM_ERROR("unable to remap dp io resources, rc=%d\n", rc); > goto err; > } > > + rc = msm_dss_ioremap(pdev, &io->hdcp_key, "hdcp_key", -1); > + if (rc) { > + DRM_INFO("unable to remap dp hdcp resources, rc=%d\n", rc); > + io->hdcp_key.base = NULL; > + io->hdcp_key.len = 0; > + } > + > + rc = msm_dss_ioremap(pdev, &io->hdcp_tz, "hdcp_tz", -1); > + if (rc) { > + DRM_INFO("unable to remap dp hdcp resources, rc=%d\n", rc); These shouldn't be info messages. Also, the ioremap wrapper already prints the message that it failed so these are redundant. > + io->hdcp_tz.base = NULL; > + io->hdcp_tz.len = 0; > + } > + > io->phy = devm_phy_get(&pdev->dev, "dp"); > if (IS_ERR(io->phy)) { > rc = PTR_ERR(io->phy);
diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index 0519dd3ac3c3..4bbe2485ce3c 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -20,11 +20,19 @@ static const struct dp_regulator_cfg sdm845_dp_reg_cfg = { }; static int msm_dss_ioremap(struct platform_device *pdev, - struct dss_io_data *io_data) + struct dss_io_data *io_data, const char *name, + int fallback_idx) { struct resource *res = NULL; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); + + /* Support dts which do not have named resources */ + if (!res) { + if (fallback_idx >= 0) + res = platform_get_resource(pdev, IORESOURCE_MEM, + fallback_idx); + } if (!res) { DRM_ERROR("%pS->%s: msm_dss_get_res failed\n", __builtin_return_address(0), __func__); @@ -55,6 +63,8 @@ static void dp_parser_unmap_io_resources(struct dp_parser *parser) { struct dp_io *io = &parser->io; + msm_dss_iounmap(&io->hdcp_tz); + msm_dss_iounmap(&io->hdcp_key); msm_dss_iounmap(&io->dp_controller); } @@ -64,12 +74,26 @@ static int dp_parser_ctrl_res(struct dp_parser *parser) struct platform_device *pdev = parser->pdev; struct dp_io *io = &parser->io; - rc = msm_dss_ioremap(pdev, &io->dp_controller); + rc = msm_dss_ioremap(pdev, &io->dp_controller, "dp_controller", 0); if (rc) { DRM_ERROR("unable to remap dp io resources, rc=%d\n", rc); goto err; } + rc = msm_dss_ioremap(pdev, &io->hdcp_key, "hdcp_key", -1); + if (rc) { + DRM_INFO("unable to remap dp hdcp resources, rc=%d\n", rc); + io->hdcp_key.base = NULL; + io->hdcp_key.len = 0; + } + + rc = msm_dss_ioremap(pdev, &io->hdcp_tz, "hdcp_tz", -1); + if (rc) { + DRM_INFO("unable to remap dp hdcp resources, rc=%d\n", rc); + io->hdcp_tz.base = NULL; + io->hdcp_tz.len = 0; + } + io->phy = devm_phy_get(&pdev->dev, "dp"); if (IS_ERR(io->phy)) { rc = PTR_ERR(io->phy); diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index 34b49628bbaf..09d876620175 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -62,10 +62,14 @@ struct dp_display_data { * struct dp_ctrl_resource - controller's IO related data * * @dp_controller: Display Port controller mapped memory address + * @hdcp_key: mapped memory for HDCP key ingestion + * @hdcp_tz: mapped memory for HDCP TZ interaction * @phy_io: phy's mapped memory address */ struct dp_io { struct dss_io_data dp_controller; + struct dss_io_data hdcp_key; + struct dss_io_data hdcp_tz; struct phy *phy; union phy_configure_opts phy_opts; };