All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>,
	Jyri Sarha <jsarha@ti.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Tony Lindgren <tony@atomide.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.0 29/95] drm/omap: hdmi4_cec: Fix CEC clock handling for PM
Date: Thu,  9 May 2019 20:41:46 +0200	[thread overview]
Message-ID: <20190509181311.346632359@linuxfoundation.org> (raw)
In-Reply-To: <20190509181309.180685671@linuxfoundation.org>

[ Upstream commit 36a1da15b5df493241b0011d2185fdd724ac1ed1 ]

If CONFIG_OMAP4_DSS_HDMI_CEC is enabled in .config, deeper SoC idle
states are blocked because the CEC clock gets always enabled on init.

Let's fix the issue by moving the CEC clock handling to happen later in
hdmi_cec_adap_enable() as suggested by Hans Verkuil <hverkuil@xs4all.nl>.
This way the CEC clock gets only enabled when needed. This can be tested
by doing cec-ctl --playback to enable the CEC, and doing cec-ctl --clear
to disable it.

Let's also fix the typo for "divider" in the comments while at it.

Fixes: 8d7f934df8d8 ("omapdrm: hdmi4_cec: add OMAP4 HDMI CEC support")
Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Jyri Sarha <jsarha@ti.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190326151438.32414-1-tony@atomide.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c | 26 ++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c
index 340383150fb98..ebf9c96d43eee 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c
@@ -175,6 +175,7 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
 		REG_FLD_MOD(core->base, HDMI_CORE_SYS_INTR_UNMASK4, 0, 3, 3);
 		hdmi_wp_clear_irqenable(core->wp, HDMI_IRQ_CORE);
 		hdmi_wp_set_irqstatus(core->wp, HDMI_IRQ_CORE);
+		REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0);
 		hdmi4_core_disable(core);
 		return 0;
 	}
@@ -182,16 +183,24 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
 	if (err)
 		return err;
 
+	/*
+	 * Initialize CEC clock divider: CEC needs 2MHz clock hence
+	 * set the divider to 24 to get 48/24=2MHz clock
+	 */
+	REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0x18, 5, 0);
+
 	/* Clear TX FIFO */
 	if (!hdmi_cec_clear_tx_fifo(adap)) {
 		pr_err("cec-%s: could not clear TX FIFO\n", adap->name);
-		return -EIO;
+		err = -EIO;
+		goto err_disable_clk;
 	}
 
 	/* Clear RX FIFO */
 	if (!hdmi_cec_clear_rx_fifo(adap)) {
 		pr_err("cec-%s: could not clear RX FIFO\n", adap->name);
-		return -EIO;
+		err = -EIO;
+		goto err_disable_clk;
 	}
 
 	/* Clear CEC interrupts */
@@ -236,6 +245,12 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
 		hdmi_write_reg(core->base, HDMI_CEC_INT_STATUS_1, temp);
 	}
 	return 0;
+
+err_disable_clk:
+	REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0);
+	hdmi4_core_disable(core);
+
+	return err;
 }
 
 static int hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr)
@@ -333,11 +348,8 @@ int hdmi4_cec_init(struct platform_device *pdev, struct hdmi_core_data *core,
 		return ret;
 	core->wp = wp;
 
-	/*
-	 * Initialize CEC clock divider: CEC needs 2MHz clock hence
-	 * set the devider to 24 to get 48/24=2MHz clock
-	 */
-	REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0x18, 5, 0);
+	/* Disable clock initially, hdmi_cec_adap_enable() manages it */
+	REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0);
 
 	ret = cec_register_adapter(core->adap, &pdev->dev);
 	if (ret < 0) {
-- 
2.20.1




  parent reply	other threads:[~2019-05-09 18:58 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 18:41 [PATCH 5.0 00/95] 5.0.15-stable review Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 01/95] net: stmmac: Use bfsize1 in ndesc_init_rx_desc Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 02/95] Drivers: hv: vmbus: Remove the undesired put_cpu_ptr() in hv_synic_cleanup() Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 03/95] ubsan: Fix nasty -Wbuiltin-declaration-mismatch GCC-9 warnings Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 04/95] staging: greybus: power_supply: fix prop-descriptor request size Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 05/95] staging: wilc1000: Avoid GFP_KERNEL allocation from atomic context Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 06/95] staging: most: cdev: fix chrdev_region leak in mod_exit Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 07/95] staging: most: sound: pass correct device when creating a sound card Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 08/95] ASoC: tlv320aic3x: fix reset gpio reference counting Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 09/95] ASoC: hdmi-codec: fix S/PDIF DAI Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 10/95] ASoC: stm32: sai: fix iec958 controls indexation Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 11/95] ASoC: stm32: sai: fix exposed capabilities in spdif mode Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 12/95] ASoC: stm32: sai: fix race condition in irq handler Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 13/95] ASoC:soc-pcm:fix a codec fixup issue in TDM case Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 14/95] ASoC:hdac_hda:use correct format to setup hda codec Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 15/95] ASoC:intel:skl:fix a simultaneous playback & capture issue on hda platform Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 16/95] ASoC: dpcm: prevent snd_soc_dpcm use after free Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 17/95] ASoC: nau8824: fix the issue of the widget with prefix name Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 18/95] ASoC: nau8810: fix the issue of widget with prefixed name Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 19/95] ASoC: samsung: odroid: Fix clock configuration for 44100 sample rate Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 20/95] ASoC: rt5682: Check JD status when system resume Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 21/95] ASoC: rt5682: fix jack type detection issue Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 22/95] ASoC: rt5682: recording has no sound after booting Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 23/95] ASoC: wm_adsp: Add locking to wm_adsp2_bus_error Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 24/95] clk: meson-gxbb: round the vdec dividers to closest Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 25/95] ASoC: stm32: dfsdm: manage multiple prepare Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 26/95] ASoC: stm32: dfsdm: fix debugfs warnings on entry creation Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 27/95] ASoC: cs4270: Set auto-increment bit for register writes Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 28/95] ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_free_kcontrol Greg Kroah-Hartman
2019-05-09 18:41 ` Greg Kroah-Hartman [this message]
2019-05-09 18:41 ` [PATCH 5.0 30/95] IB/hfi1: Clear the IOWAIT pending bits when QP is put into error state Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 31/95] IB/hfi1: Eliminate opcode tests on mr deref Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 32/95] IB/hfi1: Fix the allocation of RSM table Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 33/95] MIPS: KGDB: fix kgdb support for SMP platforms Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 34/95] ASoC: tlv320aic32x4: Fix Common Pins Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 35/95] drm/mediatek: Fix an error code in mtk_hdmi_dt_parse_pdata() Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 36/95] perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 37/95] perf/x86/intel: Initialize TFA MSR Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 38/95] linux/kernel.h: Use parentheses around argument in u64_to_user_ptr() Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 39/95] iov_iter: Fix build error without CONFIG_CRYPTO Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 40/95] xtensa: fix initialization of pt_regs::syscall in start_thread Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 41/95] ASoC: rockchip: pdm: fix regmap_ops hang issue Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 5.0 42/95] drm/amdkfd: Add picasso pci id Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 43/95] drm/amdgpu: Adjust IB test timeout for XGMI configuration Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 44/95] drm/amdgpu: amdgpu_device_recover_vram always failed if only one node in shadow_list Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 45/95] drm/amd/display: fix cursor black issue Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 46/95] ASoC: cs35l35: Disable regulators on driver removal Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 47/95] objtool: Add rewind_stack_do_exit() to the noreturn list Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 48/95] slab: fix a crash by reading /proc/slab_allocators Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 49/95] drm/sun4i: tcon top: Fix NULL/invalid pointer dereference in sun8i_tcon_top_un/bind Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 50/95] virtio_pci: fix a NULL pointer reference in vp_del_vqs Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 51/95] RDMA/vmw_pvrdma: Fix memory leak on pvrdma_pci_remove Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 52/95] RDMA/hns: Fix bug that caused srq creation to fail Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 53/95] KEYS: trusted: fix -Wvarags warning Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 54/95] scsi: csiostor: fix missing data copy in csio_scsi_err_handler() Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 55/95] drm/mediatek: fix possible object reference leak Greg Kroah-Hartman
2019-05-09 18:42   ` Greg Kroah-Hartman
2019-05-09 18:42   ` Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 56/95] drm/mediatek: fix the rate and divder of hdmi phy for MT2701 Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 57/95] drm/mediatek: make implementation of recalc_rate() for MT2701 hdmi phy Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 58/95] drm/mediatek: remove flag CLK_SET_RATE_PARENT " Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 59/95] drm/mediatek: using new factor for tvdpll " Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 60/95] drm/mediatek: no change parent rate in round_rate() " Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 61/95] ASoC: Intel: kbl: fix wrong number of channels Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 62/95] ASoC: stm32: sai: fix master clock management Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 63/95] ALSA: hda: Fix racy display power access Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 64/95] virtio-blk: limit number of hw queues by nr_cpu_ids Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 65/95] blk-mq: introduce blk_mq_complete_request_sync() Greg Kroah-Hartman
2019-05-09 18:42   ` Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 66/95] nvme: cancel request synchronously Greg Kroah-Hartman
2019-05-09 18:42   ` Greg Kroah-Hartman
2019-05-21  8:36   ` Max Gurtovoy
2019-05-21  9:45     ` Ming Lei
2019-05-21 10:21       ` Max Gurtovoy
2019-05-21 10:41         ` Ming Lei
2019-05-21 11:50           ` Max Gurtovoy
2019-05-21 12:49             ` Ming Lei
2019-05-24  8:15               ` Sagi Grimberg
2019-05-24  8:23                 ` Ming Lei
2019-05-09 18:42 ` [PATCH 5.0 67/95] nvme-fc: correct csn initialization and increments on error Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 68/95] nvmet: fix discover log page when offsets are used Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 69/95] platform/x86: pmc_atom: Drop __initconst on dmi table Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 70/95] NFSv4.1 fix incorrect return value in copy_file_range Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 71/95] perf/core: Fix perf_event_disable_inatomic() race Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 72/95] iommu/amd: Set exclusion range correctly Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 73/95] genirq: Prevent use-after-free and work list corruption Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 74/95] usb: dwc3: Allow building USB_DWC3_QCOM without EXTCON Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 75/95] usb: dwc3: Fix default lpm_nyet_threshold value Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 76/95] USB: serial: f81232: fix interrupt worker not stop Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 77/95] USB: cdc-acm: fix unthrottle races Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 78/95] usb-storage: Set virt_boundary_mask to avoid SG overflows Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 79/95] intel_th: pci: Add Comet Lake support Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 80/95] iio: adc: qcom-spmi-adc5: Fix of-based module autoloading Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 81/95] cpufreq: armada-37xx: fix frequency calculation for opp Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 82/95] ACPI / LPSS: Use acpi_lpss_* instead of acpi_subsys_* functions for hibernate Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 83/95] soc: sunxi: Fix missing dependency on REGMAP_MMIO Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 84/95] scsi: lpfc: change snprintf to scnprintf for possible overflow Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 85/95] scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 86/95] scsi: qla2xxx: Fix device staying in blocked state Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 87/95] Bluetooth: hidp: fix buffer overflow Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 88/95] Bluetooth: Align minimum encryption key size for LE and BR/EDR connections Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 89/95] Bluetooth: Fix not initializing L2CAP tx_credits Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 90/95] Bluetooth: hci_bcm: Fix empty regulator supplies for Intel Macs Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 91/95] UAS: fix alignment of scatter/gather segments Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 92/95] ASoC: Intel: avoid Oops if DMA setup fails Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 93/95] i3c: Fix a shift wrap bug in i3c_bus_set_addr_slot_status() Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 94/95] locking/futex: Allow low-level atomic operations to return -EAGAIN Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 95/95] arm64: futex: Bound number of LDXR/STXR loops in FUTEX_WAKE_OP Greg Kroah-Hartman
2019-05-10  0:27 ` [PATCH 5.0 00/95] 5.0.15-stable review kernelci.org bot
2019-05-10  6:25   ` Greg Kroah-Hartman
2019-05-10  6:36 ` Naresh Kamboju
2019-05-10 15:50   ` Greg Kroah-Hartman
2019-05-10 16:30     ` Guenter Roeck
2019-05-10 10:17 ` Jon Hunter
2019-05-10 10:17   ` Jon Hunter
2019-05-10 13:36 ` Guenter Roeck
2019-05-10 13:43   ` Vandana BN
2019-05-10 15:49     ` Greg Kroah-Hartman
2019-05-10 21:15 ` shuah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190509181311.346632359@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=hverkuil@xs4all.nl \
    --cc=jsarha@ti.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.