Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3199C433FE for ; Wed, 27 Apr 2022 13:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235257AbiD0NFn (ORCPT ); Wed, 27 Apr 2022 09:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235211AbiD0NFk (ORCPT ); Wed, 27 Apr 2022 09:05:40 -0400 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEA2C344EF for ; Wed, 27 Apr 2022 06:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1651064549; x=1682600549; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ty+/c1GiIMN9adN9mb/HrXR9YcJj4kR5Q/lW3+pbUoQ=; b=QzfaS4x91QmW+8XVur2o/5bU/bGAinT6N7Y/C+F/bdP8ZiTuAUySoxjg cgkyi9jSxFwHZqUCIJR3CaKB9KgmCIhcFVrhqE+uSAz5qXbg4pWdHOvb/ BC0VswnEdiQ8u7Fr+fXqEzmrHWaED+ZiZ6QI9MTdHY5s0EG5IybfkpjVU 0orGi4oAwduF18jjFj2hHS06qPda2K4NH7lPzVTVxajp9XzZE8Uo4TbEO R5uU4VK377oNsJYnyK5MXL0+fbSVYSUjiPTAKVK0eMqIzPTxE0tDzPvKF BYr9lgN0008+Eu7IMETCX1s7Yv5QcAW919p4l7oRW4GbIg8mHX9vUHZj7 A==; From: =?UTF-8?q?M=C3=A5rten=20Lindahl?= To: Guenter Roeck , Jean Delvare CC: , , =?UTF-8?q?M=C3=A5rten=20Lindahl?= Subject: [PATCH v3 2/3] hwmon: (pmbus/ltc2978) Add chip specific write_byte_data Date: Wed, 27 Apr 2022 15:02:12 +0200 Message-ID: <20220427130213.1557793-3-marten.lindahl@axis.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220427130213.1557793-1-marten.lindahl@axis.com> References: <20220427130213.1557793-1-marten.lindahl@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Several of the manuals for devices supported by this driver describes the need for a minimum wait time before the chip is ready to receive next command. This wait time is already implemented in the driver as a ltc_wait_ready function with a driver defined wait time of 100 ms, and is considered for specific devices before reading/writing data on the pmbus. Since this driver uses the default pmbus_regulator_ops for the enable/ disable/is_enabled functions we should add a driver specific callback for write_byte_data to prevent bypassing the wait time recommendations for the following devices: ltc3880/ltc3882/ltc3883/ltc3884/ltc3886/ ltc3887/ltc3889/ltm4664/ltm4675/ltm4676/ltm4677/ltm4678/ltm4680/ltm4686/ ltm4700/ltc7880. Signed-off-by: MÃ¥rten Lindahl --- drivers/hwmon/pmbus/ltc2978.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c index 0127273883f0..531aa674a928 100644 --- a/drivers/hwmon/pmbus/ltc2978.c +++ b/drivers/hwmon/pmbus/ltc2978.c @@ -196,6 +196,17 @@ static int ltc_read_byte_data(struct i2c_client *client, int page, int reg) return pmbus_read_byte_data(client, page, reg); } +static int ltc_write_byte_data(struct i2c_client *client, int page, int reg, u8 value) +{ + int ret; + + ret = ltc_wait_ready(client); + if (ret < 0) + return ret; + + return pmbus_write_byte_data(client, page, reg, value); +} + static int ltc_write_byte(struct i2c_client *client, int page, u8 byte) { int ret; @@ -681,6 +692,7 @@ static int ltc2978_probe(struct i2c_client *client) info = &data->info; info->write_word_data = ltc2978_write_word_data; info->write_byte = ltc_write_byte; + info->write_byte_data = ltc_write_byte_data; info->read_word_data = ltc_read_word_data; info->read_byte_data = ltc_read_byte_data; -- 2.30.2