From f63b1ce5988c0d5b409ebe751e14599bf156ecfe Mon Sep 17 00:00:00 2001 From: Juerg Haefliger Date: Tue, 28 Sep 2021 16:56:19 +0200 Subject: [PATCH 1/3] drm/vc4: hdmi: Fix bvb clock enable error checking Check for errors only if we actually tried to enable the bvb clock. Fixes: 01a6d727b407 ("vc4/drm: hdmi: Handle case when bvb clock is null") Signed-off-by: Juerg Haefliger --- drivers/gpu/drm/vc4/vc4_hdmi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 2a068ba7c83f02..f1adaa9dc5f34b 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -958,11 +958,12 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, else bvb_rate = 75000000; - if (vc4_hdmi->pixel_bvb_clock) + if (vc4_hdmi->pixel_bvb_clock) { vc4_hdmi->bvb_req = clk_request_start(vc4_hdmi->pixel_bvb_clock, bvb_rate); - if (IS_ERR(vc4_hdmi->bvb_req)) { - DRM_ERROR("Failed to set pixel bvb clock rate: %ld\n", PTR_ERR(vc4_hdmi->bvb_req)); - goto err_remove_hsm_req; + if (IS_ERR(vc4_hdmi->bvb_req)) { + DRM_ERROR("Failed to set pixel bvb clock rate: %ld\n", PTR_ERR(vc4_hdmi->bvb_req)); + goto err_remove_hsm_req; + } } ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); From 55f3dc358054a8bd14d83aba17adfe700d29b9c3 Mon Sep 17 00:00:00 2001 From: Juerg Haefliger Date: Wed, 29 Sep 2021 11:39:46 +0200 Subject: [PATCH 2/3] Revert "mmc: sdhci-iproc: Fix vmmc regulators on iProc" This reverts commit aed19399a01733dbad9be8bf026a4f7dd823b04f. Commit 6c92ae1e452f ("mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage()") introduced a generic helper that does the same thing so use that instead in the following commit. Signed-off-by: Juerg Haefliger --- drivers/mmc/host/sdhci-iproc.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c index 7658898cf39b82..b9eb2ec61a83ab 100644 --- a/drivers/mmc/host/sdhci-iproc.c +++ b/drivers/mmc/host/sdhci-iproc.c @@ -173,17 +173,6 @@ static unsigned int sdhci_iproc_get_max_clock(struct sdhci_host *host) return pltfm_host->clock; } -static void sdhci_iproc_set_power(struct sdhci_host *host, unsigned char mode, - unsigned short vdd) -{ - if (!IS_ERR(host->mmc->supply.vmmc)) { - struct mmc_host *mmc = host->mmc; - - mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); - } - sdhci_set_power_noreg(host, mode, vdd); -} - /* * There is a known bug on BCM2711's SDHCI core integration where the * controller will hang when the difference between the core clock and the bus @@ -218,7 +207,6 @@ static const struct sdhci_ops sdhci_iproc_32only_ops = { .write_b = sdhci_iproc_writeb, .set_clock = sdhci_set_clock, .get_max_clock = sdhci_iproc_get_max_clock, - .set_power = sdhci_iproc_set_power, .set_bus_width = sdhci_set_bus_width, .reset = sdhci_reset, .set_uhs_signaling = sdhci_set_uhs_signaling, From 8c535d262f941078e282abc39ab10b08d592885a Mon Sep 17 00:00:00 2001 From: Juerg Haefliger Date: Wed, 29 Sep 2021 11:42:23 +0200 Subject: [PATCH 3/3] mmc: sdhci-iproc: Fix vmmc regulators (pre-bcm2711) The Linux support for controlling card power via regulators appears to be contentious. I would argue that the default behaviour is contrary to the SDHCI spec - turning off the power writes a reserved value to the SD Bus Voltage Select field of the Power Control Register, which seems to kill the Arasan/iProc controller - but fortunately there is a hook in sdhci_ops to override the behaviour. Signed-off-by: Juerg Haefliger Signed-off-by: Phil Elwell --- drivers/mmc/host/sdhci-iproc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c index b9eb2ec61a83ab..404870e6b759b0 100644 --- a/drivers/mmc/host/sdhci-iproc.c +++ b/drivers/mmc/host/sdhci-iproc.c @@ -207,6 +207,7 @@ static const struct sdhci_ops sdhci_iproc_32only_ops = { .write_b = sdhci_iproc_writeb, .set_clock = sdhci_set_clock, .get_max_clock = sdhci_iproc_get_max_clock, + .set_power = sdhci_set_power_and_bus_voltage, .set_bus_width = sdhci_set_bus_width, .reset = sdhci_reset, .set_uhs_signaling = sdhci_set_uhs_signaling,