From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11395C43381 for ; Tue, 2 Apr 2019 06:52:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C941320857 for ; Tue, 2 Apr 2019 06:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554187927; bh=mEoF9gd4jw3iZ5f7G0JaxtEJ3m+rm3QqpS6ejRv10/I=; h=Subject:To:From:Date:List-ID:From; b=s2c+AzNpVTZjjasRdCEullYPixb/0Ucc5t6jV9rmcSkWC3lYmFk9LGQT1XZ1YtjiY 9gHIgYTH/dDloKd1VSFEj1WFlEG6RquWH4cJqbqcSEDaiRfffrcf3bPEyOZqK2TzeM TBemcByhmfQ+AS7z3oOz4dxEY38j9A6QJHCzR/nw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728159AbfDBGwH (ORCPT ); Tue, 2 Apr 2019 02:52:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:45228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbfDBGwH (ORCPT ); Tue, 2 Apr 2019 02:52:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 00002208E4; Tue, 2 Apr 2019 06:52:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554187926; bh=mEoF9gd4jw3iZ5f7G0JaxtEJ3m+rm3QqpS6ejRv10/I=; h=Subject:To:From:Date:From; b=o/Hchd88l1Oqx9CmB2YfoyN/dopZYea/0DUBNvZ+1dyFM476BksOxDv0+2iYZNP9Z NgRX3o/am/JFuYvkSWmQApbZGbIx2ToFPUlijRXVZKsdOGOE9id1NvYwvwUz+BIoyr iOO6+EywXO+avbfpW5zN+IJ7q7bLpUKfAaH4YH5I= Subject: patch "iio: dac: mcp4725: add missing powerdown bits in store eeprom" added to staging-linus To: jeff.dagenais@gmail.com, Jonathan.Cameron@huawei.com, Stable@vger.kernel.org, pmeerw@pmeerw.net From: Date: Tue, 02 Apr 2019 08:51:38 +0200 Message-ID: <155418789820397@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled iio: dac: mcp4725: add missing powerdown bits in store eeprom to my staging git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git in the staging-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From 06003531502d06bc89d32528f6ec96bf978790f9 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dagenais Date: Wed, 6 Mar 2019 15:56:06 -0500 Subject: iio: dac: mcp4725: add missing powerdown bits in store eeprom When issuing the write DAC register and write eeprom command, the two powerdown bits (PD0 and PD1) are assumed by the chip to be present in the bytes sent. Leaving them at 0 implies "powerdown disabled" which is a different state that the current one. By adding the current state of the powerdown in the i2c write, the chip will correctly power-on exactly like as it is at the moment of store_eeprom call. This is documented in MCP4725's datasheet, FIGURE 6-2: "Write Commands for DAC Input Register and EEPROM" and MCP4726's datasheet, FIGURE 6-3: "Write All Memory Command". Signed-off-by: Jean-Francois Dagenais Acked-by: Peter Meerwald-Stadler Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/dac/mcp4725.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c index 6d71fd905e29..c701a45469f6 100644 --- a/drivers/iio/dac/mcp4725.c +++ b/drivers/iio/dac/mcp4725.c @@ -92,6 +92,7 @@ static ssize_t mcp4725_store_eeprom(struct device *dev, inoutbuf[0] = 0x60; /* write EEPROM */ inoutbuf[0] |= data->ref_mode << 3; + inoutbuf[0] |= data->powerdown ? ((data->powerdown_mode + 1) << 1) : 0; inoutbuf[1] = data->dac_value >> 4; inoutbuf[2] = (data->dac_value & 0xf) << 4; -- 2.21.0