Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp230333iog; Fri, 24 Jun 2022 02:59:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tZ4j5u9v+2/YY5vb4ELBqI77joBlKKPHs0MSzbc3Lz13Wn0NP7IgMhcd2qTY+LcS3KdA6B X-Received: by 2002:a17:906:64d7:b0:712:c6d:46f8 with SMTP id p23-20020a17090664d700b007120c6d46f8mr12134630ejn.40.1656064763085; Fri, 24 Jun 2022 02:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656064763; cv=none; d=google.com; s=arc-20160816; b=rAvkEWtRXiM6OOO1HxuQ53AJo1Y9EXlC8BZP1UV6G/XYQ95El+5voxGkvE1t6J913i UuICOZQGAFAAMzPaujPCfCFInzPPoma6LeHXL3VC38l3E/TV6g9oAK9cSgOB+ORk7Exz phd0zI8/l2pqn734l6yMNPx8jdpfuuU9yW8oO41iCeTwz37FR1ws9ZSTlVAFUPxhlR5o BIGVe3DDQSFSYJs2gTUp6AKueUWnLYPuCjybPX4Jd4Hc5TRFDOSgm532KB1wpLAcGdM9 9FWcRH045tCeLlLozNumozb4QhmVZp/iDb6ZlkdfFq8+iCVvf2Kxmu4xOIhJH17ATkyz AP3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=P+xAWw+Bp79/ff3vorq93ipaITpawgJ5CXoeUyR3LMY=; b=D4CqfJc4GiqCkf0S5RhZA7CyLheZzOxuqrF1XUmIoNmWYL6m5tOEOej47WT9CLyShh 2snSHgAhKxAQC+6DmCbo+Au0OFZRUypiHi+rTsTI1/UHcoH0l9uA1Z9uTvPo2KoOdOyC B/Ez736JfOl461FYTes8nrOadDQhv4BRXy8s5j/uUpPhvHdJcft2PiNn3uYnF4FH5z8C u6lX8nuDKw5kg0EmgAzgRaBMR+x5sTdQ74Uf/PHuEtQPGONcVZGPjU9+FRxdjMpfDW2U nL1HvZ/XtiX7Hh57TvVwNh9KHlelyHj3tgkRs1i89iDMcrlbAvDf9vPX3Z4gq3WWpImt SRUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZP2yeGuv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a170906794400b006fe95bb93b3si2163401ejo.861.2022.06.24.02.58.57; Fri, 24 Jun 2022 02:59:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZP2yeGuv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbiFXJ41 (ORCPT + 99 others); Fri, 24 Jun 2022 05:56:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230077AbiFXJ4Y (ORCPT ); Fri, 24 Jun 2022 05:56:24 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FCC37A189; Fri, 24 Jun 2022 02:56:22 -0700 (PDT) Received: (Authenticated sender: kory.maincent@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 27895FF803; Fri, 24 Jun 2022 09:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1656064581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=P+xAWw+Bp79/ff3vorq93ipaITpawgJ5CXoeUyR3LMY=; b=ZP2yeGuv8xiH2UwEEajX1vft4nQdwDgCflluP3aygsyT320Jiqt1u/+wn82yLuxmN+Xb83 E1GQPfH80/o9HIC6iZlCmk/ECKypAFUOCf0hO0jxGhc4PCOSS/TlF4odF+OM5Oxomf1dWr K2g7/uXO4HoWW5a8nBPXup4kGVEO+GAp94OiuX6Nvk0KVjJ5lbQ8+/fy+pc7aRj1FSvbi3 pZ6hD1woVK/g5cGJNR3bti4VDQgsz1XeK1BFwCiAKhr4ISRT6yotvzE7hk8kBtgxF4Nk4J pxUJNsGkz7wW69l/JmnaBfASWLTwDSz5PVzMW963Lx03I9ZwWVzC5bh+ifcexg== From: Kory Maincent To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: thomas.petazzoni@bootlin.com, Jonathan Cameron , Lars-Peter Clausen , Cai Huoqing , Alexandre Belloni , Geert Uytterhoeven , Miquel Raynal , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Subject: [PATCH 1/2] iio: dac: mcp4922: add support to mcp4921 Date: Fri, 24 Jun 2022 11:56:17 +0200 Message-Id: <20220624095619.1415614-1-kory.maincent@bootlin.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to mcp4921 which has only one output channel. Signed-off-by: Kory Maincent --- drivers/iio/dac/mcp4922.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/mcp4922.c b/drivers/iio/dac/mcp4922.c index cb9e60e71b91..0d41c0f25515 100644 --- a/drivers/iio/dac/mcp4922.c +++ b/drivers/iio/dac/mcp4922.c @@ -17,10 +17,12 @@ #include #define MCP4922_NUM_CHANNELS 2 +#define MCP4921_NUM_CHANNELS 1 enum mcp4922_supported_device_ids { ID_MCP4902, ID_MCP4912, + ID_MCP4921, ID_MCP4922, }; @@ -105,9 +107,10 @@ static int mcp4922_write_raw(struct iio_dev *indio_dev, } } -static const struct iio_chan_spec mcp4922_channels[3][MCP4922_NUM_CHANNELS] = { +static const struct iio_chan_spec mcp4922_channels[4][MCP4922_NUM_CHANNELS] = { [ID_MCP4902] = { MCP4922_CHAN(0, 8), MCP4922_CHAN(1, 8) }, [ID_MCP4912] = { MCP4922_CHAN(0, 10), MCP4922_CHAN(1, 10) }, + [ID_MCP4921] = { MCP4922_CHAN(0, 12), {} }, [ID_MCP4922] = { MCP4922_CHAN(0, 12), MCP4922_CHAN(1, 12) }, }; @@ -154,7 +157,10 @@ static int mcp4922_probe(struct spi_device *spi) indio_dev->info = &mcp4922_info; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = mcp4922_channels[id->driver_data]; - indio_dev->num_channels = MCP4922_NUM_CHANNELS; + if (id->driver_data == ID_MCP4921) + indio_dev->num_channels = MCP4921_NUM_CHANNELS; + else + indio_dev->num_channels = MCP4922_NUM_CHANNELS; indio_dev->name = id->name; ret = iio_device_register(indio_dev); @@ -185,6 +191,7 @@ static void mcp4922_remove(struct spi_device *spi) static const struct spi_device_id mcp4922_id[] = { {"mcp4902", ID_MCP4902}, {"mcp4912", ID_MCP4912}, + {"mcp4921", ID_MCP4921}, {"mcp4922", ID_MCP4922}, {} }; -- 2.25.1