From patchwork Sat Nov 2 19:50:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aren X-Patchwork-Id: 13860221 Received: from a.peacevolution.org (a.peacevolution.org [206.189.193.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDE2A1A4E9E; Sat, 2 Nov 2024 19:54:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=206.189.193.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730577277; cv=none; b=sP9+3Y/qoJdOAgO9wNYOsMei/UuYftr1JH9TO4YOXzcJds044OmuoQwgsssdUVW/XoOCk59RjYDkdnI/B3FbjabZX1mbJohFbsVX6GgGHI3AV3xdykFBh0DBMv7/d1sPRdlx35Dj0WPBR2EQTKdtdjYOqyH0Qjo6iDecoWnjOPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730577277; c=relaxed/simple; bh=EvtA0L6i7PVpTUXFS8v/MeTEdxw2Y5yqzQ012t++dO8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gR0/DSCPK6PeZp7gi1VjVfMsBN95Z4Us6POlr1LvGJNHvMfPbjZCzBehxUTHvM2dkKtydGWVaXh119idcSHYoXvlRV+LsHYkoxPLyo2KNjeYUXwIIOn9/4fH/YEreiByDIcJNQbJRX3JaGJEyFuGQk0CG3TJC8ykIFb8tVux/no= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peacevolution.org; spf=pass smtp.mailfrom=peacevolution.org; dkim=pass (1024-bit key) header.d=peacevolution.org header.i=@peacevolution.org header.b=Tzc7jf7/; arc=none smtp.client-ip=206.189.193.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peacevolution.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peacevolution.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=peacevolution.org header.i=@peacevolution.org header.b="Tzc7jf7/" Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id AC5EF4C845; Sat, 2 Nov 2024 19:54:26 +0000 (UTC) From: Aren Moynihan To: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Aren Moynihan , Kaustabh Chakraborty , =?utf-8?b?QmFybmFiw6FzIEN6?= =?utf-8?b?w6ltw6Fu?= , Ondrej Jirman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Dragan Simic , phone-devel@vger.kernel.org Subject: [PATCH v4 0/6] iio: light: stk3310: support powering off during suspend Date: Sat, 2 Nov 2024 15:50:33 -0400 Message-ID: <20241102195037.3013934-3-aren@peacevolution.org> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org X-Spam-Level: **** X-Spamd-Bar: ++++ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1730577268; h=from:subject:date:message-id:to:cc:mime-version:content-transfer-encoding; bh=G68ZaVveeAPDy61zCvgR6ZvWngMfCpzqwzzHizbuydU=; b=Tzc7jf7/YcxSmOknbQHGUntcT+2BmHXa6PKRE5Wi0BLJKcBuya7pa2msevfer6Ii9LupZQ 8ZRP4N3ShUjjF1/anXp3sGNM7Vs/RAFgIZLYNz/cj46M2bbucjlHbDYwslM0zJVkscVh+X 7C3j+jd96ZG7dEYMS3rRQqPYmiSs+oI= In the Pine64 PinePhone, the stk3310 chip is powered by a regulator that is disabled at system boot and can be shut off during suspend. To ensure that the chip properly initializes, both after boot and suspend, we need to manage this regulator. Additionally if the chip is shut off in suspend, we need to make sure that it gets reinitialized with the same parameters after resume. Major changes in v4: - replace mutex_init with devm_mutex_init - code style cleanup Major changes in v3: - Use bulk regulators instead of two individual ones - Replace stk3310_remove with devm callbacks Major changes in v2: - Add handling of the IR LED. I was hesitant to include this as it is the same as pull-up regulator for the i2c bus on the hardware I have, so I can't test it well. I think leaving it out is more likely to cause issues than including it. - Convert stk3310 to use dev_err_probe for errors. - Always enable / disable regulators and rely on dummy devices if they're not specified. - more listed in individual patches Aren Moynihan (5): dt-bindings: iio: light: stk33xx: add vdd and leda regulators iio: light: stk3310: handle all remove logic with devm callbacks iio: light: stk3310: Implement vdd and leda supplies iio: light: stk3310: use dev_err_probe where possible iio: light: stk3310: log error if reading the chip id fails Ondrej Jirman (1): arm64: dts: allwinner: pinephone: Add power supplies to stk3311 .../bindings/iio/light/stk33xx.yaml | 4 + .../dts/allwinner/sun50i-a64-pinephone.dtsi | 2 + drivers/iio/light/stk3310.c | 162 ++++++++++++------ 3 files changed, 120 insertions(+), 48 deletions(-)