linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.18 091/126] usb: typec: tcpm: Report back negotiated PPS voltage and current
Date: Wed, 31 Oct 2018 19:07:19 -0400	[thread overview]
Message-ID: <20181031230754.29029-91-sashal@kernel.org> (raw)
In-Reply-To: <20181031230754.29029-1-sashal@kernel.org>

From: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

[ Upstream commit 554fab6dbf20ee7298ed2d4e8398b85e6058abb7 ]

Currently when requesting a specific voltage or current through
the psy interface, for PPS, when reading back from that interface
the values will always be the same as previously given, if the
request was successful. However PPS only allows for 20mV voltage
steps and 50mA current steps, and the psy class expects microvolt
and micro amp requests, so inbetween values can be provided through
this interface. Really when reading back the true values negotiated
should be given, and not the ones originally asked for.

To report the actual values negotiated with the Source, the values
stored are now rounded down to the relevant step units prior to
building the PPS request, so that those values are later correctly
reported through the psy interface. In addition this improves the
adjustments made to meet the operating power requirements of the
platform, which previously could have been slightly out due to not
using valid PPS units of voltage and current.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/typec/tcpm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index d1d20252bad8..0a3c41a91cba 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -4018,6 +4018,9 @@ static int tcpm_pps_set_op_curr(struct tcpm_port *port, u16 op_curr)
 		goto port_unlock;
 	}
 
+	/* Round down operating current to align with PPS valid steps */
+	op_curr = op_curr - (op_curr % RDO_PROG_CURR_MA_STEP);
+
 	reinit_completion(&port->pps_complete);
 	port->pps_data.op_curr = op_curr;
 	port->pps_status = 0;
@@ -4071,6 +4074,9 @@ static int tcpm_pps_set_out_volt(struct tcpm_port *port, u16 out_volt)
 		goto port_unlock;
 	}
 
+	/* Round down output voltage to align with PPS valid steps */
+	out_volt = out_volt - (out_volt % RDO_PROG_VOLT_MV_STEP);
+
 	reinit_completion(&port->pps_complete);
 	port->pps_data.out_volt = out_volt;
 	port->pps_status = 0;
-- 
2.17.1


  parent reply	other threads:[~2018-10-31 23:09 UTC|newest]

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31 23:05 [PATCH AUTOSEL 4.18 001/126] net: socionext: Reset tx queue in ndo_stop Sasha Levin
2018-10-31 23:05 ` [PATCH AUTOSEL 4.18 002/126] net: ethernet: ti: cpsw: unsync mcast entries while switch promisc mode Sasha Levin
2018-10-31 23:05 ` [PATCH AUTOSEL 4.18 003/126] locking/lockdep: Fix debug_locks off performance problem Sasha Levin
2018-10-31 23:05 ` [PATCH AUTOSEL 4.18 004/126] netfilter: xt_nat: fix DNAT target for shifted portmap ranges Sasha Levin
2018-10-31 23:05 ` [PATCH AUTOSEL 4.18 005/126] ataflop: fix error handling during setup Sasha Levin
2018-10-31 23:05 ` [PATCH AUTOSEL 4.18 006/126] swim: fix cleanup on setup error Sasha Levin
2018-10-31 23:05 ` [PATCH AUTOSEL 4.18 007/126] arm64: cpufeature: ctr: Fix cpu capability check for late CPUs Sasha Levin
2018-10-31 23:05 ` [PATCH AUTOSEL 4.18 008/126] nfp: devlink port split support for 1x100G CXP NIC Sasha Levin
2018-10-31 23:05 ` [PATCH AUTOSEL 4.18 009/126] tun: Consistently configure generic netdev params via rtnetlink Sasha Levin
2018-10-31 23:05 ` [PATCH AUTOSEL 4.18 010/126] s390/sthyi: Fix machine name validity indication Sasha Levin
2018-10-31 23:05 ` [PATCH AUTOSEL 4.18 011/126] hwmon: (pwm-fan) Set fan speed to 0 on suspend Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 012/126] lightnvm: pblk: fix race on sysfs line state Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 013/126] lightnvm: pblk: fix two sleep-in-atomic-context bugs Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 014/126] lightnvm: pblk: fix race condition on metadata I/O Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 015/126] spi: spi-ep93xx: Use dma_data_direction for ep93xx_spi_dma_{finish,prepare} Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 016/126] perf tools: Free temporary 'sys' string in read_event_files() Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 017/126] perf tools: Cleanup trace-event-info 'tdata' leak Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 018/126] perf strbuf: Match va_{add,copy} with va_end Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 019/126] cpupower: Fix coredump on VMWare Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 020/126] bcache: Populate writeback_rate_minimum attribute Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 021/126] mmc: sdhci-pci-o2micro: Add quirk for O2 Micro dev 0x8620 rev 0x01 Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 022/126] sdhci: acpi: add free_slot callback Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 023/126] mtd: rawnand: denali: set SPARE_AREA_SKIP_BYTES register to 8 if unset Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 024/126] iwlwifi: pcie: avoid empty free RB queue Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 025/126] iwlwifi: mvm: clear HW_RESTART_REQUESTED when stopping the interface Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 026/126] iwlwifi: mvm: check for n_profiles validity in EWRD ACPI Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 027/126] x86/olpc: Indicate that legacy PC XO-1 platform should not register RTC Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 028/126] nvmet-rdma: use a private workqueue for delete Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 029/126] ACPI/PPTT: Handle architecturally unknown cache types Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 030/126] ACPI / PM: LPIT: Register sysfs attributes based on FADT Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 031/126] ACPI / processor: Fix the return value of acpi_processor_ids_walk() Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 032/126] cpufreq: dt: Try freeing static OPPs only if we have added them Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 033/126] x86/intel_rdt: Show missing resctrl mount options Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 034/126] mtd: rawnand: atmel: Fix potential NULL pointer dereference Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 035/126] regulator: fixed: Default enable high on DT regulators Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 036/126] signal: Introduce COMPAT_SIGMINSTKSZ for use in compat_sys_sigaltstack Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 037/126] ice: fix changing of ring descriptor size (ethtool -G) Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 038/126] ice: update fw version check logic Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 039/126] net: hns3: Fix for packet buffer setting bug Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 040/126] Bluetooth: btbcm: Add entry for BCM4335C0 UART bluetooth Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 041/126] x86: boot: Fix EFI stub alignment Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 042/126] net: hns3: Add nic state check before calling netif_tx_wake_queue Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 043/126] net: hns3: Fix ets validate issue Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 044/126] pinctrl: sunxi: fix 'pctrl->functions' allocation in sunxi_pinctrl_build_state Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 045/126] pinctrl: qcom: spmi-mpp: Fix err handling of pmic_mpp_set_mux Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 046/126] brcmfmac: fix for proper support of 160MHz bandwidth Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 047/126] net: hns3: Check hdev state when getting link status Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 048/126] net: hns3: Set STATE_DOWN bit of hdev state when stopping net Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 049/126] net: phy: phylink: ensure the carrier is off when starting phylink Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 050/126] block, bfq: correctly charge and reset entity service in all cases Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 051/126] arm64: entry: Allow handling of undefined instructions from EL1 Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 052/126] kprobes: Return error if we fail to reuse kprobe instead of BUG_ON() Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 053/126] spi: gpio: No MISO does not imply no RX Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 054/126] ACPI / LPSS: Add alternative ACPI HIDs for Cherry Trail DMA controllers Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 055/126] pinctrl: qcom: spmi-mpp: Fix drive strength setting Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 056/126] bpf/verifier: fix verifier instability Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 057/126] failover: Add missing check to validate 'slave_dev' in net_failover_slave_unregister Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 058/126] perf tests: Fix record+probe_libc_inet_pton.sh without ping's debuginfo Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 059/126] pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 060/126] pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() " Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 061/126] net: hns3: Preserve vlan 0 in hardware table Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 062/126] net: hns3: Fix ping exited problem when doing lp selftest Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 063/126] net: hns3: Fix for vf vlan delete failed problem Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 064/126] net: dsa: mv88e6xxx: Fix writing to a PHY page Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 065/126] rsi: fix memory alignment issue in ARM32 platforms Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 066/126] iwlwifi: mvm: fix BAR seq ctrl reporting Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 067/126] gpio: brcmstb: allow 0 width GPIO banks Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 068/126] ixgbe: disallow IPsec Tx offload when in SR-IOV mode Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 069/126] ixgbevf: VF2VF TCP RSS Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 070/126] ath10k: schedule hardware restart if WMI command times out Sasha Levin
2018-10-31 23:06 ` [PATCH AUTOSEL 4.18 071/126] libata: Apply NOLPM quirk for SAMSUNG MZ7TD256HAFV-000L9 Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 072/126] thermal: rcar_thermal: Prevent doing work after unbind Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 073/126] thermal: da9062/61: Prevent hardware access during system suspend Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 074/126] cgroup, netclassid: add a preemption point to write_classid Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 075/126] net: stmmac: dwmac-sun8i: fix OF child-node lookup Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 076/126] f2fs: fix to account IO correctly for cgroup writeback Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 077/126] MD: Memory leak when flush bio size is zero Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 078/126] md: fix memleak for mempool Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 079/126] scsi: esp_scsi: Track residual for PIO transfers Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 080/126] scsi: ufs: Schedule clk gating work on correct queue Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 081/126] UAPI: ndctl: Fix g++-unsupported initialisation in headers Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 082/126] KVM: nVMX: Clear reserved bits of #DB exit qualification Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 083/126] scsi: megaraid_sas: fix a missing-check bug Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 084/126] RDMA/core: Do not expose unsupported counters Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 085/126] IB/ipoib: Clear IPCB before icmp_send Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 086/126] RDMA/bnxt_re: Avoid accessing nq->bar_reg_iomem in failure case Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 087/126] RDMA/bnxt_re: Fix recursive lock warning in debug kernel Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 088/126] usb: host: ohci-at91: fix request of irq for optional gpio Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 089/126] PCI: mediatek: Fix mtk_pcie_find_port() endpoint/port matching logic Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 090/126] PCI: cadence: Use AXI region 0 to signal interrupts from EP Sasha Levin
2018-10-31 23:07 ` Sasha Levin [this message]
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 092/126] tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 093/126] f2fs: clear PageError on the read path Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 094/126] Drivers: hv: vmbus: Use cpumask_var_t for on-stack cpu mask Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 095/126] Drivers: hv: kvp: Fix two "this statement may fall through" warnings Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 096/126] VMCI: Resource wildcard match fixed Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 097/126] PCI / ACPI: Enable wake automatically for power managed bridges Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 098/126] xprtrdma: Reset credit grant properly after a disconnect Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 099/126] irqchip/pdc: Setup all edge interrupts as rising edge at GIC Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 100/126] usb: dwc2: fix a race with external vbus supply Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 101/126] usb: gadget: udc: atmel: handle at91sam9rl PMC Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 102/126] ext4: fix argument checking in EXT4_IOC_MOVE_EXT Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 103/126] MD: fix invalid stored role for a disk Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 104/126] nvmem: check the return value of nvmem_add_cells() Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 105/126] xhci: Avoid USB autosuspend when resuming USB2 ports Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 106/126] f2fs: fix to recover inode's crtime during POR Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 107/126] f2fs: fix to recover inode's i_flags " Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 108/126] PCI/MSI: Warn and return error if driver enables MSI/MSI-X twice Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 109/126] coresight: etb10: Fix handling of perf mode Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 110/126] PCI: dwc: pci-dra7xx: Enable errata i870 for both EP and RC mode Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 111/126] crypto: caam - fix implicit casts in endianness helpers Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 112/126] usb: chipidea: Prevent unbalanced IRQ disable Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 113/126] Smack: ptrace capability use fixes Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 114/126] driver/dma/ioat: Call del_timer_sync() without holding prep_lock Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 115/126] firmware: coreboot: Unmap ioregion after device population Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 116/126] IB/mlx5: Allow transition of DCI QP to reset Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 117/126] uio: ensure class is registered before devices Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 118/126] scsi: lpfc: Correct soft lockup when running mds diagnostics Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 119/126] scsi: lpfc: Correct race with abort on completion path Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 120/126] f2fs: avoid sleeping under spin_lock Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 121/126] f2fs: report error if quota off error during umount Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 122/126] signal: Always deliver the kernel's SIGKILL and SIGSTOP to a pid namespace init Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 123/126] mfd: menelaus: Fix possible race condition and leak Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 124/126] dmaengine: dma-jz4780: Return error if not probed from DT Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 125/126] IB/rxe: fix for duplicate request processing and ack psns Sasha Levin
2018-10-31 23:07 ` [PATCH AUTOSEL 4.18 126/126] ALSA: hda: Check the non-cached stream buffers more explicitly Sasha Levin

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=20181031230754.29029-91-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=Adam.Thomson.Opensource@diasemi.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).