From patchwork Sat Sep 26 23:59:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 256489 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=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 07E9CC47427 for ; Sun, 27 Sep 2020 00:05:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6C362184D for ; Sun, 27 Sep 2020 00:05:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="NhkYopv9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728410AbgI0AFW (ORCPT ); Sat, 26 Sep 2020 20:05:22 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:51711 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728724AbgI0AFV (ORCPT ); Sat, 26 Sep 2020 20:05:21 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4BzQjv4blbzC4; Sun, 27 Sep 2020 01:59:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1601164755; bh=dgb3fryIR/h82S0ZIMI7wbAYSPc3yco4sMhX5KqPpwc=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=NhkYopv9ND1jdmR/tAcCd4KO+bSuyrvpcIiGUGGwMwO1ZrWLFNd/eSmYjX4PHb7hG sX19Gg3RjLv7CqRNEeRSzaJZs2zxoFpx6n+edFEF3ZrRpyeQRbJ65YQaQ0OK9rOGEQ awllVz1yJTs//yRQ+/hvV5T+13l+ruxgdkPKk51qn2aotC60HAS3rZNBfPlXkU4u2S ToHg4fsoebmpjDjTvrBSAIfLAQ5mbpFv9iWVQDqTFrZyPVnfu0RXMiRNxj7iSa9fIv u43kcgxGEAEtl3O4zEeHdmEhuKEdDl0diel4JYNwue3FuwQCr91iOTZZuEIlbD7Kj2 WaVSTDoPC8S0w== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Sun, 27 Sep 2020 01:59:15 +0200 Message-Id: In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH 1/5] gpio: tps65910: use regmap accessors MIME-Version: 1.0 To: Linus Walleij , Bartosz Golaszewski , Lee Jones , Liam Girdwood , Mark Brown , Tony Lindgren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Use regmap accessors directly for register manipulation - removing one layer of abstraction. Signed-off-by: Michał Mirosław Acked-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Acked-by: Linus Walleij --- drivers/gpio/gpio-tps65910.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c index 0c785b0fd161..0c0b445c75c0 100644 --- a/drivers/gpio/gpio-tps65910.c +++ b/drivers/gpio/gpio-tps65910.c @@ -28,7 +28,7 @@ static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset) struct tps65910 *tps65910 = tps65910_gpio->tps65910; unsigned int val; - tps65910_reg_read(tps65910, TPS65910_GPIO0 + offset, &val); + regmap_read(tps65910->regmap, TPS65910_GPIO0 + offset, &val); if (val & GPIO_STS_MASK) return 1; @@ -43,10 +43,10 @@ static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset, struct tps65910 *tps65910 = tps65910_gpio->tps65910; if (value) - tps65910_reg_set_bits(tps65910, TPS65910_GPIO0 + offset, + regmap_set_bits(tps65910->regmap, TPS65910_GPIO0 + offset, GPIO_SET_MASK); else - tps65910_reg_clear_bits(tps65910, TPS65910_GPIO0 + offset, + regmap_clear_bits(tps65910->regmap, TPS65910_GPIO0 + offset, GPIO_SET_MASK); } @@ -59,7 +59,7 @@ static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset, /* Set the initial value */ tps65910_gpio_set(gc, offset, value); - return tps65910_reg_set_bits(tps65910, TPS65910_GPIO0 + offset, + return regmap_set_bits(tps65910->regmap, TPS65910_GPIO0 + offset, GPIO_CFG_MASK); } @@ -68,7 +68,7 @@ static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset) struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc); struct tps65910 *tps65910 = tps65910_gpio->tps65910; - return tps65910_reg_clear_bits(tps65910, TPS65910_GPIO0 + offset, + return regmap_clear_bits(tps65910->regmap, TPS65910_GPIO0 + offset, GPIO_CFG_MASK); } @@ -157,7 +157,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev) if (!pdata->en_gpio_sleep[i]) continue; - ret = tps65910_reg_set_bits(tps65910, + ret = regmap_set_bits(tps65910->regmap, TPS65910_GPIO0 + i, GPIO_SLEEP_MASK); if (ret < 0) dev_warn(tps65910->dev, From patchwork Sat Sep 26 23:59:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 256488 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=-9.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 E5D7FC2D0A8 for ; Sun, 27 Sep 2020 00:08:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98DA02184D for ; Sun, 27 Sep 2020 00:08:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="DkzzlQYP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728721AbgI0AFY (ORCPT ); Sat, 26 Sep 2020 20:05:24 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:65469 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726311AbgI0AFY (ORCPT ); Sat, 26 Sep 2020 20:05:24 -0400 X-Greylist: delayed 364 seconds by postgrey-1.27 at vger.kernel.org; Sat, 26 Sep 2020 20:05:20 EDT Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4BzQjv6gH4zWS; Sun, 27 Sep 2020 01:59:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1601164756; bh=4nAv6U26QMceZhE6mlilp7UbAoqJ2qt3XIJwygPTvZs=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=DkzzlQYPp8KLkLsJ2sNx4uZElGsGdzcvkR0Yw8TLTqKhma4+aLNcb060Fg7SorJPl 5vIUoq6TUZlrpk757msk/A77NmUJsfz+KsLV4Ar5iuMkOrz6DDxyxr1tNAdWN36JTk Mqqaz0+24LhHqe5sbVI2BbxnHSpRyeUHDfMyIpZEHzlYUgaWoHW+qLo9h5QiB7rSp2 BMzPOIwFMSY/ylU+MqbUjsrps6t8QSGpROieCzuFyUczh4e0MQXonkLIhuNJykY8Cp y5twxO4JE+tetEGja0vtwQCmmlPsGL3T8wuxukGlERLCUq6geLNyrBAiT0f79grA+f 6aGUdWBSrZ5wA== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Sun, 27 Sep 2020 01:59:15 +0200 Message-Id: In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH 2/5] regulator: tps65910: use regmap accessors MIME-Version: 1.0 To: Tony Lindgren , Liam Girdwood , Mark Brown , Bartosz Golaszewski , Lee Jones , Linus Walleij Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Use regmap accessors directly for register manipulation - removing one layer of abstraction. Signed-off-by: Michał Mirosław --- drivers/regulator/tps65910-regulator.c | 125 +++++++++++++------------ 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index faa5b3538167..1d5b0a1b86f7 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c @@ -390,8 +390,8 @@ static int tps65911_get_ctrl_register(int id) static int tps65910_set_mode(struct regulator_dev *dev, unsigned int mode) { struct tps65910_reg *pmic = rdev_get_drvdata(dev); - struct tps65910 *mfd = pmic->mfd; - int reg, value, id = rdev_get_id(dev); + struct regmap *regmap = rdev_get_regmap(dev); + int reg, id = rdev_get_id(dev); reg = pmic->get_ctrl_reg(id); if (reg < 0) @@ -399,14 +399,14 @@ static int tps65910_set_mode(struct regulator_dev *dev, unsigned int mode) switch (mode) { case REGULATOR_MODE_NORMAL: - return tps65910_reg_update_bits(pmic->mfd, reg, - LDO_ST_MODE_BIT | LDO_ST_ON_BIT, - LDO_ST_ON_BIT); + return regmap_update_bits(regmap, reg, + LDO_ST_MODE_BIT | LDO_ST_ON_BIT, + LDO_ST_ON_BIT); case REGULATOR_MODE_IDLE: - value = LDO_ST_ON_BIT | LDO_ST_MODE_BIT; - return tps65910_reg_set_bits(mfd, reg, value); + return regmap_set_bits(regmap, reg, + LDO_ST_ON_BIT | LDO_ST_MODE_BIT); case REGULATOR_MODE_STANDBY: - return tps65910_reg_clear_bits(mfd, reg, LDO_ST_ON_BIT); + return regmap_clear_bits(regmap, reg, LDO_ST_ON_BIT); } return -EINVAL; @@ -415,13 +415,14 @@ static int tps65910_set_mode(struct regulator_dev *dev, unsigned int mode) static unsigned int tps65910_get_mode(struct regulator_dev *dev) { struct tps65910_reg *pmic = rdev_get_drvdata(dev); + struct regmap *regmap = rdev_get_regmap(dev); int ret, reg, value, id = rdev_get_id(dev); reg = pmic->get_ctrl_reg(id); if (reg < 0) return reg; - ret = tps65910_reg_read(pmic->mfd, reg, &value); + ret = regmap_read(regmap, reg, &value); if (ret < 0) return ret; @@ -435,20 +436,20 @@ static unsigned int tps65910_get_mode(struct regulator_dev *dev) static int tps65910_get_voltage_dcdc_sel(struct regulator_dev *dev) { - struct tps65910_reg *pmic = rdev_get_drvdata(dev); + struct regmap *regmap = rdev_get_regmap(dev); int ret, id = rdev_get_id(dev); int opvsel = 0, srvsel = 0, vselmax = 0, mult = 0, sr = 0; switch (id) { case TPS65910_REG_VDD1: - ret = tps65910_reg_read(pmic->mfd, TPS65910_VDD1_OP, &opvsel); + ret = regmap_read(regmap, TPS65910_VDD1_OP, &opvsel); if (ret < 0) return ret; - ret = tps65910_reg_read(pmic->mfd, TPS65910_VDD1, &mult); + ret = regmap_read(regmap, TPS65910_VDD1, &mult); if (ret < 0) return ret; mult = (mult & VDD1_VGAIN_SEL_MASK) >> VDD1_VGAIN_SEL_SHIFT; - ret = tps65910_reg_read(pmic->mfd, TPS65910_VDD1_SR, &srvsel); + ret = regmap_read(regmap, TPS65910_VDD1_SR, &srvsel); if (ret < 0) return ret; sr = opvsel & VDD1_OP_CMD_MASK; @@ -457,14 +458,14 @@ static int tps65910_get_voltage_dcdc_sel(struct regulator_dev *dev) vselmax = 75; break; case TPS65910_REG_VDD2: - ret = tps65910_reg_read(pmic->mfd, TPS65910_VDD2_OP, &opvsel); + ret = regmap_read(regmap, TPS65910_VDD2_OP, &opvsel); if (ret < 0) return ret; - ret = tps65910_reg_read(pmic->mfd, TPS65910_VDD2, &mult); + ret = regmap_read(regmap, TPS65910_VDD2, &mult); if (ret < 0) return ret; mult = (mult & VDD2_VGAIN_SEL_MASK) >> VDD2_VGAIN_SEL_SHIFT; - ret = tps65910_reg_read(pmic->mfd, TPS65910_VDD2_SR, &srvsel); + ret = regmap_read(regmap, TPS65910_VDD2_SR, &srvsel); if (ret < 0) return ret; sr = opvsel & VDD2_OP_CMD_MASK; @@ -473,12 +474,10 @@ static int tps65910_get_voltage_dcdc_sel(struct regulator_dev *dev) vselmax = 75; break; case TPS65911_REG_VDDCTRL: - ret = tps65910_reg_read(pmic->mfd, TPS65911_VDDCTRL_OP, - &opvsel); + ret = regmap_read(regmap, TPS65911_VDDCTRL_OP, &opvsel); if (ret < 0) return ret; - ret = tps65910_reg_read(pmic->mfd, TPS65911_VDDCTRL_SR, - &srvsel); + ret = regmap_read(regmap, TPS65911_VDDCTRL_SR, &srvsel); if (ret < 0) return ret; sr = opvsel & VDDCTRL_OP_CMD_MASK; @@ -514,13 +513,14 @@ static int tps65910_get_voltage_dcdc_sel(struct regulator_dev *dev) static int tps65910_get_voltage_sel(struct regulator_dev *dev) { struct tps65910_reg *pmic = rdev_get_drvdata(dev); + struct regmap *regmap = rdev_get_regmap(dev); int ret, reg, value, id = rdev_get_id(dev); reg = pmic->get_ctrl_reg(id); if (reg < 0) return reg; - ret = tps65910_reg_read(pmic->mfd, reg, &value); + ret = regmap_read(regmap, reg, &value); if (ret < 0) return ret; @@ -556,12 +556,13 @@ static int tps65910_get_voltage_vdd3(struct regulator_dev *dev) static int tps65911_get_voltage_sel(struct regulator_dev *dev) { struct tps65910_reg *pmic = rdev_get_drvdata(dev); + struct regmap *regmap = rdev_get_regmap(dev); int ret, id = rdev_get_id(dev); unsigned int value, reg; reg = pmic->get_ctrl_reg(id); - ret = tps65910_reg_read(pmic->mfd, reg, &value); + ret = regmap_read(regmap, reg, &value); if (ret < 0) return ret; @@ -594,7 +595,7 @@ static int tps65911_get_voltage_sel(struct regulator_dev *dev) static int tps65910_set_voltage_dcdc_sel(struct regulator_dev *dev, unsigned selector) { - struct tps65910_reg *pmic = rdev_get_drvdata(dev); + struct regmap *regmap = rdev_get_regmap(dev); int id = rdev_get_id(dev), vsel; int dcdc_mult = 0; @@ -605,10 +606,9 @@ static int tps65910_set_voltage_dcdc_sel(struct regulator_dev *dev, dcdc_mult--; vsel = (selector % VDD1_2_NUM_VOLT_FINE) + 3; - tps65910_reg_update_bits(pmic->mfd, TPS65910_VDD1, - VDD1_VGAIN_SEL_MASK, - dcdc_mult << VDD1_VGAIN_SEL_SHIFT); - tps65910_reg_write(pmic->mfd, TPS65910_VDD1_OP, vsel); + regmap_update_bits(regmap, TPS65910_VDD1, VDD1_VGAIN_SEL_MASK, + dcdc_mult << VDD1_VGAIN_SEL_SHIFT); + regmap_write(regmap, TPS65910_VDD1_OP, vsel); break; case TPS65910_REG_VDD2: dcdc_mult = (selector / VDD1_2_NUM_VOLT_FINE) + 1; @@ -616,14 +616,14 @@ static int tps65910_set_voltage_dcdc_sel(struct regulator_dev *dev, dcdc_mult--; vsel = (selector % VDD1_2_NUM_VOLT_FINE) + 3; - tps65910_reg_update_bits(pmic->mfd, TPS65910_VDD2, - VDD1_VGAIN_SEL_MASK, - dcdc_mult << VDD2_VGAIN_SEL_SHIFT); - tps65910_reg_write(pmic->mfd, TPS65910_VDD2_OP, vsel); + regmap_update_bits(regmap, TPS65910_VDD2, VDD1_VGAIN_SEL_MASK, + dcdc_mult << VDD2_VGAIN_SEL_SHIFT); + regmap_write(regmap, TPS65910_VDD2_OP, vsel); break; case TPS65911_REG_VDDCTRL: vsel = selector + 3; - tps65910_reg_write(pmic->mfd, TPS65911_VDDCTRL_OP, vsel); + regmap_write(regmap, TPS65911_VDDCTRL_OP, vsel); + break; } return 0; @@ -633,6 +633,7 @@ static int tps65910_set_voltage_sel(struct regulator_dev *dev, unsigned selector) { struct tps65910_reg *pmic = rdev_get_drvdata(dev); + struct regmap *regmap = rdev_get_regmap(dev); int reg, id = rdev_get_id(dev); reg = pmic->get_ctrl_reg(id); @@ -649,11 +650,11 @@ static int tps65910_set_voltage_sel(struct regulator_dev *dev, case TPS65910_REG_VAUX2: case TPS65910_REG_VAUX33: case TPS65910_REG_VMMC: - return tps65910_reg_update_bits(pmic->mfd, reg, LDO_SEL_MASK, - selector << LDO_SEL_SHIFT); + return regmap_update_bits(regmap, reg, LDO_SEL_MASK, + selector << LDO_SEL_SHIFT); case TPS65910_REG_VBB: - return tps65910_reg_update_bits(pmic->mfd, reg, BBCH_BBSEL_MASK, - selector << BBCH_BBSEL_SHIFT); + return regmap_update_bits(regmap, reg, BBCH_BBSEL_MASK, + selector << BBCH_BBSEL_SHIFT); } return -EINVAL; @@ -663,6 +664,7 @@ static int tps65911_set_voltage_sel(struct regulator_dev *dev, unsigned selector) { struct tps65910_reg *pmic = rdev_get_drvdata(dev); + struct regmap *regmap = rdev_get_regmap(dev); int reg, id = rdev_get_id(dev); reg = pmic->get_ctrl_reg(id); @@ -673,21 +675,21 @@ static int tps65911_set_voltage_sel(struct regulator_dev *dev, case TPS65911_REG_LDO1: case TPS65911_REG_LDO2: case TPS65911_REG_LDO4: - return tps65910_reg_update_bits(pmic->mfd, reg, LDO1_SEL_MASK, - selector << LDO_SEL_SHIFT); + return regmap_update_bits(regmap, reg, LDO1_SEL_MASK, + selector << LDO_SEL_SHIFT); case TPS65911_REG_LDO3: case TPS65911_REG_LDO5: case TPS65911_REG_LDO6: case TPS65911_REG_LDO7: case TPS65911_REG_LDO8: - return tps65910_reg_update_bits(pmic->mfd, reg, LDO3_SEL_MASK, - selector << LDO_SEL_SHIFT); + return regmap_update_bits(regmap, reg, LDO3_SEL_MASK, + selector << LDO_SEL_SHIFT); case TPS65910_REG_VIO: - return tps65910_reg_update_bits(pmic->mfd, reg, LDO_SEL_MASK, - selector << LDO_SEL_SHIFT); + return regmap_update_bits(regmap, reg, LDO_SEL_MASK, + selector << LDO_SEL_SHIFT); case TPS65910_REG_VBB: - return tps65910_reg_update_bits(pmic->mfd, reg, BBCH_BBSEL_MASK, - selector << BBCH_BBSEL_SHIFT); + return regmap_update_bits(regmap, reg, BBCH_BBSEL_MASK, + selector << BBCH_BBSEL_SHIFT); } return -EINVAL; @@ -850,10 +852,10 @@ static int tps65910_set_ext_sleep_config(struct tps65910_reg *pmic, /* External EN1 control */ if (ext_sleep_config & TPS65910_SLEEP_CONTROL_EXT_INPUT_EN1) - ret = tps65910_reg_set_bits(mfd, + ret = regmap_set_bits(mfd->regmap, TPS65910_EN1_LDO_ASS + regoffs, bit_pos); else - ret = tps65910_reg_clear_bits(mfd, + ret = regmap_clear_bits(mfd->regmap, TPS65910_EN1_LDO_ASS + regoffs, bit_pos); if (ret < 0) { dev_err(mfd->dev, @@ -863,10 +865,10 @@ static int tps65910_set_ext_sleep_config(struct tps65910_reg *pmic, /* External EN2 control */ if (ext_sleep_config & TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2) - ret = tps65910_reg_set_bits(mfd, + ret = regmap_set_bits(mfd->regmap, TPS65910_EN2_LDO_ASS + regoffs, bit_pos); else - ret = tps65910_reg_clear_bits(mfd, + ret = regmap_clear_bits(mfd->regmap, TPS65910_EN2_LDO_ASS + regoffs, bit_pos); if (ret < 0) { dev_err(mfd->dev, @@ -878,10 +880,10 @@ static int tps65910_set_ext_sleep_config(struct tps65910_reg *pmic, if ((tps65910_chip_id(mfd) == TPS65910) && (id >= TPS65910_REG_VDIG1)) { if (ext_sleep_config & TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3) - ret = tps65910_reg_set_bits(mfd, + ret = regmap_set_bits(mfd->regmap, TPS65910_EN3_LDO_ASS + regoffs, bit_pos); else - ret = tps65910_reg_clear_bits(mfd, + ret = regmap_clear_bits(mfd->regmap, TPS65910_EN3_LDO_ASS + regoffs, bit_pos); if (ret < 0) { dev_err(mfd->dev, @@ -893,10 +895,10 @@ static int tps65910_set_ext_sleep_config(struct tps65910_reg *pmic, /* Return if no external control is selected */ if (!(ext_sleep_config & EXT_SLEEP_CONTROL)) { /* Clear all sleep controls */ - ret = tps65910_reg_clear_bits(mfd, + ret = regmap_clear_bits(mfd->regmap, TPS65910_SLEEP_KEEP_LDO_ON + regoffs, bit_pos); if (!ret) - ret = tps65910_reg_clear_bits(mfd, + ret = regmap_clear_bits(mfd->regmap, TPS65910_SLEEP_SET_LDO_OFF + regoffs, bit_pos); if (ret < 0) dev_err(mfd->dev, @@ -917,39 +919,38 @@ static int tps65910_set_ext_sleep_config(struct tps65910_reg *pmic, int sr_reg_add = pmic->get_ctrl_reg(id) + 2; int opvsel, srvsel; - ret = tps65910_reg_read(pmic->mfd, op_reg_add, &opvsel); + ret = regmap_read(mfd->regmap, op_reg_add, &opvsel); if (ret < 0) return ret; - ret = tps65910_reg_read(pmic->mfd, sr_reg_add, &srvsel); + ret = regmap_read(mfd->regmap, sr_reg_add, &srvsel); if (ret < 0) return ret; if (opvsel & VDD1_OP_CMD_MASK) { u8 reg_val = srvsel & VDD1_OP_SEL_MASK; - ret = tps65910_reg_write(pmic->mfd, op_reg_add, - reg_val); + ret = regmap_write(mfd->regmap, op_reg_add, reg_val); if (ret < 0) { dev_err(mfd->dev, "Error in configuring op register\n"); return ret; } } - ret = tps65910_reg_write(pmic->mfd, sr_reg_add, 0); + ret = regmap_write(mfd->regmap, sr_reg_add, 0); if (ret < 0) { dev_err(mfd->dev, "Error in setting sr register\n"); return ret; } } - ret = tps65910_reg_clear_bits(mfd, + ret = regmap_clear_bits(mfd->regmap, TPS65910_SLEEP_KEEP_LDO_ON + regoffs, bit_pos); if (!ret) { if (ext_sleep_config & TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP) - ret = tps65910_reg_set_bits(mfd, + ret = regmap_set_bits(mfd->regmap, TPS65910_SLEEP_SET_LDO_OFF + regoffs, bit_pos); else - ret = tps65910_reg_clear_bits(mfd, + ret = regmap_clear_bits(mfd->regmap, TPS65910_SLEEP_SET_LDO_OFF + regoffs, bit_pos); } if (ret < 0) @@ -1097,7 +1098,7 @@ static int tps65910_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pmic); /* Give control of all register to control port */ - err = tps65910_reg_set_bits(pmic->mfd, TPS65910_DEVCTRL, + err = regmap_set_bits(pmic->mfd->regmap, TPS65910_DEVCTRL, DEVCTRL_SR_CTL_I2C_SEL_MASK); if (err < 0) return err; @@ -1113,7 +1114,7 @@ static int tps65910_probe(struct platform_device *pdev) * voltage level can go higher than expected or crash * Workaround: use no synchronization of DCDC clocks */ - tps65910_reg_clear_bits(pmic->mfd, TPS65910_DCDCCTRL, + regmap_clear_bits(pmic->mfd->regmap, TPS65910_DCDCCTRL, DCDCCTRL_DCDCCKSYNC_MASK); break; case TPS65911: From patchwork Sat Sep 26 23:59:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 295501 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=-9.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 86E4AC4741F for ; Sun, 27 Sep 2020 00:05:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3CC962184D for ; Sun, 27 Sep 2020 00:05:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="omVwFkZi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728808AbgI0AFV (ORCPT ); Sat, 26 Sep 2020 20:05:21 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:22724 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728580AbgI0AFV (ORCPT ); Sat, 26 Sep 2020 20:05:21 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4BzQjx5nYBzc8; Sun, 27 Sep 2020 01:59:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1601164757; bh=uMRVWVBG1Z+A3OIeVUCDbEDNzEgxLJlsjWfFkOCe9zw=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=omVwFkZi3ZCahiHcVV3f4vO/nTr6+fvrDqyvW3Kr4aMX7ia0sk8/1osuWb/bK8PAw YTW2xKt0SolJvtvurmGcPFSLb1OWNok5zfN/XYP3EsFhxY7uv24r5+1SG8Dj71qo4y WSqvTa7JZRP18uOsSBHC9baTHQ26Zgh89ARSQf0Vv61IFahXdl8JFEckHBSVEYci87 tdIBtQGJN9MnFN3Ookc2LtDmCzVVE41Svxgw13YU3PfDMjvWCv+JxUXQI2znzAb/nE fazs2E1j9LJsSMJ+FMJ71m3C+mqucsJnP8fvUTM6YMMyPI//x98U/sxr03l0YvU9O3 uLg4HxJDVsvdA== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Sun, 27 Sep 2020 01:59:17 +0200 Message-Id: <3c37cdd9a0f23157e56ada0e2f15aa7370661ef4.1601164493.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH 3/5] mfd: tps65911-comparator: use regmap accessors MIME-Version: 1.0 To: Lee Jones , Bartosz Golaszewski , Liam Girdwood , Linus Walleij , Mark Brown , Tony Lindgren Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-omap@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Use regmap accessors directly for register manipulation - removing one layer of abstraction. Signed-off-by: Michał Mirosław --- drivers/mfd/tps65911-comparator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/tps65911-comparator.c b/drivers/mfd/tps65911-comparator.c index 2334cd61c98d..8f4210075913 100644 --- a/drivers/mfd/tps65911-comparator.c +++ b/drivers/mfd/tps65911-comparator.c @@ -69,7 +69,7 @@ static int comp_threshold_set(struct tps65910 *tps65910, int id, int voltage) return -EINVAL; val = index << 1; - ret = tps65910_reg_write(tps65910, tps_comp.reg, val); + ret = regmap_write(tps65910->regmap, tps_comp.reg, val); return ret; } @@ -80,7 +80,7 @@ static int comp_threshold_get(struct tps65910 *tps65910, int id) unsigned int val; int ret; - ret = tps65910_reg_read(tps65910, tps_comp.reg, &val); + ret = regmap_read(tps65910->regmap, tps_comp.reg, &val); if (ret < 0) return ret; From patchwork Sat Sep 26 23:59:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 295499 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=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 C5A31C4742A for ; Sun, 27 Sep 2020 00:05:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9023A238D6 for ; Sun, 27 Sep 2020 00:05:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="kZ4cAb9v" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728724AbgI0AFX (ORCPT ); Sat, 26 Sep 2020 20:05:23 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:56996 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728721AbgI0AFX (ORCPT ); Sat, 26 Sep 2020 20:05:23 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4BzQjy3tW1zdb; Sun, 27 Sep 2020 01:59:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1601164758; bh=SrdWKpugfgEvsUIujDpbZcnVd69Nyy4z5hiP/mxvhCU=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=kZ4cAb9v7gDCp42cYiTvjJDfb02ylYrk+HS0c/GvOa3voPr8Iaw8iAfLX7Jem4tfy m/bIvRoL8ziIqmektzpisknBcrQcFNy4931xJkuKyTxH1FA/1LiRsGTiLftYN9XU/a cR8THSk22cOQOvM0OEHUasz7b/aT00sFgj0aI7ty0PJopT/2qUKlDE6CeLc13iO210 SqhRwG6zpG8nXESluhSCUnOTUrPFZ4wh9pfhrWe+cMXW0MzlnOdGVicwZFI2Mmi0ON xEjYDQCFWkKXZk93RTW+ZeVayOfPcFsFq7XdRdIuRlOchQp4V8Ey/PlYxGde3EMNyq DyYq9nLNEK0xQ== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Sun, 27 Sep 2020 01:59:17 +0200 Message-Id: <8ebfb748eb55b68e5da4c5eefcf708ae9307b418.1601164493.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH 4/5] mfd: tps65910: clean up after switching to regmap MIME-Version: 1.0 To: Bartosz Golaszewski , Lee Jones , Liam Girdwood , Linus Walleij , Mark Brown , Tony Lindgren Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Remove wrappers around regmap calls to remove now-useless indirection. Signed-off-by: Michał Mirosław --- drivers/mfd/tps65910.c | 16 ++++++++-------- include/linux/mfd/tps65910.h | 35 ----------------------------------- 2 files changed, 8 insertions(+), 43 deletions(-) diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index 11959021b50a..36a52f44cd11 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -292,7 +292,7 @@ static int tps65910_ck32k_init(struct tps65910 *tps65910, if (!pmic_pdata->en_ck32k_xtal) return 0; - ret = tps65910_reg_clear_bits(tps65910, TPS65910_DEVCTRL, + ret = regmap_clear_bits(tps65910->regmap, TPS65910_DEVCTRL, DEVCTRL_CK32K_CTRL_MASK); if (ret < 0) { dev_err(tps65910->dev, "clear ck32k_ctrl failed: %d\n", ret); @@ -314,7 +314,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, dev = tps65910->dev; /* enabling SLEEP device state */ - ret = tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL, + ret = regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL, DEVCTRL_DEV_SLP_MASK); if (ret < 0) { dev_err(dev, "set dev_slp failed: %d\n", ret); @@ -322,7 +322,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, } if (pmic_pdata->slp_keepon.therm_keepon) { - ret = tps65910_reg_set_bits(tps65910, + ret = regmap_set_bits(tps65910->regmap, TPS65910_SLEEP_KEEP_RES_ON, SLEEP_KEEP_RES_ON_THERM_KEEPON_MASK); if (ret < 0) { @@ -332,7 +332,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, } if (pmic_pdata->slp_keepon.clkout32k_keepon) { - ret = tps65910_reg_set_bits(tps65910, + ret = regmap_set_bits(tps65910->regmap, TPS65910_SLEEP_KEEP_RES_ON, SLEEP_KEEP_RES_ON_CLKOUT32K_KEEPON_MASK); if (ret < 0) { @@ -342,7 +342,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, } if (pmic_pdata->slp_keepon.i2chs_keepon) { - ret = tps65910_reg_set_bits(tps65910, + ret = regmap_set_bits(tps65910->regmap, TPS65910_SLEEP_KEEP_RES_ON, SLEEP_KEEP_RES_ON_I2CHS_KEEPON_MASK); if (ret < 0) { @@ -354,7 +354,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, return 0; disable_dev_slp: - tps65910_reg_clear_bits(tps65910, TPS65910_DEVCTRL, + regmap_clear_bits(tps65910->regmap, TPS65910_DEVCTRL, DEVCTRL_DEV_SLP_MASK); err_sleep_init: @@ -436,11 +436,11 @@ static void tps65910_power_off(void) tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev); - if (tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL, + if (regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL, DEVCTRL_PWR_OFF_MASK) < 0) return; - tps65910_reg_clear_bits(tps65910, TPS65910_DEVCTRL, + regmap_clear_bits(tps65910->regmap, TPS65910_DEVCTRL, DEVCTRL_DEV_ON_MASK); } diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index ce4b9e743f7c..f7398d982f23 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h @@ -913,39 +913,4 @@ static inline int tps65910_chip_id(struct tps65910 *tps65910) return tps65910->id; } -static inline int tps65910_reg_read(struct tps65910 *tps65910, u8 reg, - unsigned int *val) -{ - return regmap_read(tps65910->regmap, reg, val); -} - -static inline int tps65910_reg_write(struct tps65910 *tps65910, u8 reg, - unsigned int val) -{ - return regmap_write(tps65910->regmap, reg, val); -} - -static inline int tps65910_reg_set_bits(struct tps65910 *tps65910, u8 reg, - u8 mask) -{ - return regmap_update_bits(tps65910->regmap, reg, mask, mask); -} - -static inline int tps65910_reg_clear_bits(struct tps65910 *tps65910, u8 reg, - u8 mask) -{ - return regmap_update_bits(tps65910->regmap, reg, mask, 0); -} - -static inline int tps65910_reg_update_bits(struct tps65910 *tps65910, u8 reg, - u8 mask, u8 val) -{ - return regmap_update_bits(tps65910->regmap, reg, mask, val); -} - -static inline int tps65910_irq_get_virq(struct tps65910 *tps65910, int irq) -{ - return regmap_irq_get_virq(tps65910->irq_data, irq); -} - #endif /* __LINUX_MFD_TPS65910_H */ From patchwork Sat Sep 26 23:59:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 295500 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=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 B37DEC47426 for ; Sun, 27 Sep 2020 00:05:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 497EE2184D for ; Sun, 27 Sep 2020 00:05:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="RrRIv+6g" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728838AbgI0AFW (ORCPT ); Sat, 26 Sep 2020 20:05:22 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:14783 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726587AbgI0AFV (ORCPT ); Sat, 26 Sep 2020 20:05:21 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4BzQjz0hnZzjx; Sun, 27 Sep 2020 01:59:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1601164759; bh=NIuh/lK92fim30F3SinZhziQenIzdH4Nck3dt31fXrE=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=RrRIv+6gk0Efhi5EQN9GGcmgUhhzQv1fl6sXa5ScG85IunYRoBWjnIZp2EahVob20 ItnubAXLtcBrfANltJotam7JjvO2fiwD2R6XiR6Mzybw/hfvMIkBrw8Fkp8kTRP8f3 lhCn1aL72s5fQKGrFthn3yW1EdB8516eW7xqvzGh80dhKxmqRTuXVgJwSuxZazzRGa JDREnKtchXrC4hJRrzprrHcVUVLD57Oj2r+GhMvnVIYs2/qMID079iVvaxll54S0jG YrMMeXlh3UryN+Y1M5cVPHvC0dImZHVbAEy6p6U5L0clbTjuhcUPqIlPEYRo64XrcL iJnDFQbSHgYig== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Sun, 27 Sep 2020 01:59:18 +0200 Message-Id: <2843e1c8a4e469762559b92bf9c0107f67aa83f0.1601164493.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH 5/5] mfd: tps65910: remove unused pointers MIME-Version: 1.0 To: Lee Jones , Bartosz Golaszewski , Liam Girdwood , Linus Walleij , Mark Brown , Tony Lindgren Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-omap@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Client pointers in tps65910 data are not used in the drivers. Remove those fields. Signed-off-by: Michał Mirosław --- include/linux/mfd/tps65910.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index f7398d982f23..701925db75b3 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h @@ -890,11 +890,6 @@ struct tps65910 { struct regmap *regmap; unsigned long id; - /* Client devices */ - struct tps65910_pmic *pmic; - struct tps65910_rtc *rtc; - struct tps65910_power *power; - /* Device node parsed board data */ struct tps65910_board *of_plat_data;