Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp727342imm; Wed, 23 May 2018 04:43:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoTk3rum2BO2i2P5o81jZRJgB+uAgBcurZQPgAktTpEJvyxJcwcYlHdTknq3eEp8axdR7CH X-Received: by 2002:a17:902:6bca:: with SMTP id m10-v6mr2643338plt.6.1527075828927; Wed, 23 May 2018 04:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527075828; cv=none; d=google.com; s=arc-20160816; b=q7R1TCYFhna/aLSPFacn4Wp3HHN+xCuzSnH9yTOoVWnQaa+PeKR5iF5YGJpoTsozYB +jhQglo13tGaugE2mlPXtWMT/UIupovGuK1/W4hohJn3qXu1VfIT/N6FdGXcyw/hYrf3 ENFSKzVMwSEosWs5zA1Tl6RxhVohgyhivftWWehYOp12tZEihHkbSuOMGkDPFKjNcahR 0Hrqy4WMfY9PamGrnRtbvFksW1gkhhAWPtGgKoGHi+YfTQLbe08Q35m/Tm9su8AiAx14 fDgR9xyP0QAcGO0p3WD28AQb9aO85DTH/lDiryWApO4ag5Mdiby0uglxM6OL3Waz2P0f sBMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=5gpncsivpUQjKIxMqEuER3RCjTlpQiQNN+oSpW/zykM=; b=SpKHzlvQX33oe1jFct9x7PbzSHIAXSl3h3+K7GFe13M6U+4yNYE2oAxcJ+6XJclY7Q xQI5OsnhTfcrZxjJJwi52iQWZJ29a+2raG3GVJSzKzhBPwQ0GkuOnC3YDFXvcogLsyuL occsBUdWHiMb50KhGa0eJygnLrzIdpALcO/lTdtbDo6eOIINmaXhOm/9kWgDNn5QlneI pG/QaEv25kUSMUShDnj+ffyvQz8+KVOZDtV6sqQ2ZCf2fVHgnvAlzHBOggXvZ/nU220j xxCGuHLcAkp1GAvt+VICP5AnI10M7Z/nHw/NglZBcNcTfE51jy06LzGSCEEaLeGT7rgK DjWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UgVX9Wej; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d90-v6si18776498pld.92.2018.05.23.04.43.34; Wed, 23 May 2018 04:43:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UgVX9Wej; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932696AbeEWLnC (ORCPT + 99 others); Wed, 23 May 2018 07:43:02 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51331 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932550AbeEWLmy (ORCPT ); Wed, 23 May 2018 07:42:54 -0400 Received: by mail-wm0-f68.google.com with SMTP id j4-v6so8141591wme.1; Wed, 23 May 2018 04:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5gpncsivpUQjKIxMqEuER3RCjTlpQiQNN+oSpW/zykM=; b=UgVX9WejxaaM9Wrq9xnaaeX+rjeuUE0ASWDuvcDyqJ1vmfVhZGJhf5Na+iPTqVn/HX su4ExyJAOS5f1tkl1olXfhWZzKY+Iingm6bxOYndZnF3yB50sgYSkVULY7/XfKOGXkxK wH9D4dJ+A/shTK5zYN945jVJiMAJXLB/9G81SyF/JsmDAOoEm5bkg1bJPvyD7eHFWV40 mlY/RiX60RbrHIBJuJCBRIOEOMwI4rRKg99TllHAa75T4krUodrgozEig3g4OZ4clqLn SWboTlkn3/AgJFTy1TTx/rtsYjTGdgzUtI6ugpyuGGdaaJ8qQerOstEnDHYK9mG20CUf UXzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5gpncsivpUQjKIxMqEuER3RCjTlpQiQNN+oSpW/zykM=; b=sTh/w0n2aCbYhWtTmDrD2j0X1U+lE/XpXBwEeBlLobxur+/ge2hhWUEju4igH4pUaW /IzbI0XBFE/2iCOXoxdc+faUfAKL5ssCfTY5rzyMsFhYxIhfdOaYBOKY6i5I3/8Qw0Of HI8ZaLtXSFx9a/wLnSjc7bb/dbpz59qOcr/7uBzEziuIYVaiqvSvPECayByBexL6G/HS CSrdRhJVuIiYy04fC312P5zHpt9atPa8OefQaYCyBqkhDZzjK7ZbREB4QSzL8cj7rZrI 5f9P1Xveb+vSpStaI1qUzxVwEvPVR+/2by9E3+7PITZwkfLU38B9wmSZpF1XyKV6keMz D9CQ== X-Gm-Message-State: ALKqPwd6mVK5v9Qee+mkhGDYvW4y9VfzJwdETUItYEVL7JJOmqhCIAyb 9XJ3twnEhRPBXJzIMyKb3zyt8ZyL X-Received: by 2002:a1c:5403:: with SMTP id i3-v6mr3875537wmb.37.1527075772904; Wed, 23 May 2018 04:42:52 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id y45-v6sm17382223wrd.97.2018.05.23.04.42.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 04:42:52 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-kernel@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Lee Jones , Mark Brown , Steve Twiss , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH 2/6] mfd: da9063: Replace model with type Date: Wed, 23 May 2018 13:42:26 +0200 Message-Id: <20180523114230.10109-2-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180523114230.10109-1-marek.vasut+renesas@gmail.com> References: <20180523114230.10109-1-marek.vasut+renesas@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The model number stored in the struct da9063 is the same for all variants of the da9063 since it is the chip ID, which is always the same. Replace that with a separate identifier instead, which allows us to discern the DA9063 variants by setting the type based on either DT match or otherwise. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Lee Jones Cc: Mark Brown Cc: Steve Twiss Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org --- drivers/mfd/da9063-core.c | 1 - drivers/mfd/da9063-i2c.c | 5 +++-- drivers/regulator/da9063-regulator.c | 6 +++--- include/linux/mfd/da9063/core.h | 6 +++++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c index 00b3caee4e21..7360b76b4f72 100644 --- a/drivers/mfd/da9063-core.c +++ b/drivers/mfd/da9063-core.c @@ -215,7 +215,6 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq) return -ENODEV; } - da9063->model = model; da9063->variant_code = variant_code; ret = da9063_irq_init(da9063); diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c index 7f84030c8d53..5544ce8e3363 100644 --- a/drivers/mfd/da9063-i2c.c +++ b/drivers/mfd/da9063-i2c.c @@ -236,7 +236,7 @@ static const struct of_device_id da9063_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, da9063_dt_ids); static int da9063_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { struct da9063 *da9063; int ret; @@ -248,6 +248,7 @@ static int da9063_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, da9063); da9063->dev = &i2c->dev; da9063->chip_irq = i2c->irq; + da9063->type = (enum da9063_type)id->driver_data; if (da9063->variant_code == PMIC_DA9063_AD) { da9063_regmap_config.rd_table = &da9063_ad_readable_table; @@ -280,7 +281,7 @@ static int da9063_i2c_remove(struct i2c_client *i2c) } static const struct i2c_device_id da9063_i2c_id[] = { - { "da9063", PMIC_CHIP_ID_DA9063 }, + { "da9063", PMIC_TYPE_DA9063 }, {}, }; MODULE_DEVICE_TABLE(i2c, da9063_i2c_id); diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 87c884ae0064..9b5c28392ae6 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -98,7 +98,7 @@ struct da9063_regulator_info { struct da9063_dev_model { const struct da9063_regulator_info *regulator_info; unsigned n_regulators; - unsigned dev_model; + enum da9063_type type; }; /* Single regulator settings */ @@ -585,7 +585,7 @@ static struct da9063_dev_model regulators_models[] = { { .regulator_info = da9063_regulator_info, .n_regulators = ARRAY_SIZE(da9063_regulator_info), - .dev_model = PMIC_CHIP_ID_DA9063, + .type = PMIC_TYPE_DA9063, }, { } }; @@ -741,7 +741,7 @@ static int da9063_regulator_probe(struct platform_device *pdev) /* Find regulators set for particular device model */ for (model = regulators_models; model->regulator_info; model++) { - if (model->dev_model == da9063->model) + if (model->dev_model == da9063->type) break; } if (!model->regulator_info) { diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h index 664f650d0086..eb234582dcb2 100644 --- a/include/linux/mfd/da9063/core.h +++ b/include/linux/mfd/da9063/core.h @@ -31,6 +31,10 @@ #define PMIC_CHIP_ID_DA9063 0x61 +enum da9063_type { + PMIC_TYPE_DA9063 = 0, +}; + enum da9063_variant_codes { PMIC_DA9063_AD = 0x3, PMIC_DA9063_BB = 0x5, @@ -76,7 +80,7 @@ enum da9063_irqs { struct da9063 { /* Device */ struct device *dev; - unsigned short model; + enum da9063_type type; unsigned char variant_code; unsigned int flags; -- 2.16.2