Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753182AbbKXHvb (ORCPT ); Tue, 24 Nov 2015 02:51:31 -0500 Received: from mail-cys01nam02on0043.outbound.protection.outlook.com ([104.47.37.43]:28131 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752287AbbKXHv3 convert rfc822-to-8bit (ORCPT ); Tue, 24 Nov 2015 02:51:29 -0500 X-Greylist: delayed 3576 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 Nov 2015 02:51:28 EST Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; From: Ranjit Waghmode To: , , , , , CC: , , , , , Ranjit Waghmode Subject: [LINUX PATCH] iio: xadc: fix for extended name remains same issue Date: Tue, 24 Nov 2015 11:47:27 +0530 Message-ID: <1448345847-15051-1-git-send-email-ranjit.waghmode@xilinx.com> X-Mailer: git-send-email 2.1.2 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21958.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(63266004)(47776003)(106466001)(5001960100002)(4001430100002)(90966002)(5008740100001)(5820100001)(11100500001)(81156007)(586003)(36386004)(103686003)(5007970100001)(6806005)(5001770100001)(107886002)(36756003)(4001450100002)(189998001)(92566002)(50986999)(45336002)(23676002)(50226001)(46386002)(50466002)(19580395003)(42186005)(229853001)(33646002)(86362001)(52956003)(19580405001)(87936001)(2201001)(7059030)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1NAM02HT020;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501001);SRVR:CY1NAM02HT020; X-Microsoft-Antispam-PRVS: <910d33e0c4a246608f95baff2ea18e9e@CY1NAM02HT020.eop-nam02.prod.protection.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046);SRVR:CY1NAM02HT020;BCL:0;PCL:0;RULEID:;SRVR:CY1NAM02HT020; X-Forefront-PRVS: 0770F75EA9 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2015 06:18:17.8576 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT020 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4915 Lines: 113 If we read channel details based on the device tree entry; channel’s scan_index and channel’s address were overwritten by scan_index and address of channel based on device tree. But extended name were remaining same because of which sysfs entry names were continuous. So this patch takes care of the above issue by updating 'channels' structure inside xadc_parse_dt() function with the help of 'xadc_channels' structure so that every channel's parameters will be updated properly. Also for the sake of simplicity this patch updates default values for extend_name. Signed-off-by: Ranjit Waghmode --- drivers/iio/adc/xilinx-xadc-core.c | 52 +++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index a221f73..b3f158f 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c @@ -1015,23 +1015,23 @@ static const struct iio_chan_spec xadc_channels[] = { XADC_CHAN_VOLTAGE(5, 7, XADC_REG_VCCO_DDR, "vccoddr", true), XADC_CHAN_VOLTAGE(6, 12, XADC_REG_VREFP, "vrefp", false), XADC_CHAN_VOLTAGE(7, 13, XADC_REG_VREFN, "vrefn", false), - XADC_CHAN_VOLTAGE(8, 11, XADC_REG_VPVN, NULL, false), - XADC_CHAN_VOLTAGE(9, 16, XADC_REG_VAUX(0), NULL, false), - XADC_CHAN_VOLTAGE(10, 17, XADC_REG_VAUX(1), NULL, false), - XADC_CHAN_VOLTAGE(11, 18, XADC_REG_VAUX(2), NULL, false), - XADC_CHAN_VOLTAGE(12, 19, XADC_REG_VAUX(3), NULL, false), - XADC_CHAN_VOLTAGE(13, 20, XADC_REG_VAUX(4), NULL, false), - XADC_CHAN_VOLTAGE(14, 21, XADC_REG_VAUX(5), NULL, false), - XADC_CHAN_VOLTAGE(15, 22, XADC_REG_VAUX(6), NULL, false), - XADC_CHAN_VOLTAGE(16, 23, XADC_REG_VAUX(7), NULL, false), - XADC_CHAN_VOLTAGE(17, 24, XADC_REG_VAUX(8), NULL, false), - XADC_CHAN_VOLTAGE(18, 25, XADC_REG_VAUX(9), NULL, false), - XADC_CHAN_VOLTAGE(19, 26, XADC_REG_VAUX(10), NULL, false), - XADC_CHAN_VOLTAGE(20, 27, XADC_REG_VAUX(11), NULL, false), - XADC_CHAN_VOLTAGE(21, 28, XADC_REG_VAUX(12), NULL, false), - XADC_CHAN_VOLTAGE(22, 29, XADC_REG_VAUX(13), NULL, false), - XADC_CHAN_VOLTAGE(23, 30, XADC_REG_VAUX(14), NULL, false), - XADC_CHAN_VOLTAGE(24, 31, XADC_REG_VAUX(15), NULL, false), + XADC_CHAN_VOLTAGE(8, 11, XADC_REG_VPVN, "vpvn", false), + XADC_CHAN_VOLTAGE(9, 16, XADC_REG_VAUX(0), "vaux0", false), + XADC_CHAN_VOLTAGE(10, 17, XADC_REG_VAUX(1), "vaux1", false), + XADC_CHAN_VOLTAGE(11, 18, XADC_REG_VAUX(2), "vaux2", false), + XADC_CHAN_VOLTAGE(12, 19, XADC_REG_VAUX(3), "vaux3", false), + XADC_CHAN_VOLTAGE(13, 20, XADC_REG_VAUX(4), "vaux4", false), + XADC_CHAN_VOLTAGE(14, 21, XADC_REG_VAUX(5), "vaux5", false), + XADC_CHAN_VOLTAGE(15, 22, XADC_REG_VAUX(6), "vaux6", false), + XADC_CHAN_VOLTAGE(16, 23, XADC_REG_VAUX(7), "vaux7", false), + XADC_CHAN_VOLTAGE(17, 24, XADC_REG_VAUX(8), "vaux8", false), + XADC_CHAN_VOLTAGE(18, 25, XADC_REG_VAUX(9), "vaux9", false), + XADC_CHAN_VOLTAGE(19, 26, XADC_REG_VAUX(10), "vaux10", false), + XADC_CHAN_VOLTAGE(20, 27, XADC_REG_VAUX(11), "vaux11", false), + XADC_CHAN_VOLTAGE(21, 28, XADC_REG_VAUX(12), "vaux12", false), + XADC_CHAN_VOLTAGE(22, 29, XADC_REG_VAUX(13), "vaux13", false), + XADC_CHAN_VOLTAGE(23, 30, XADC_REG_VAUX(14), "vaux14", false), + XADC_CHAN_VOLTAGE(24, 31, XADC_REG_VAUX(15), "vaux15", false), }; static const struct iio_info xadc_info = { @@ -1056,7 +1056,7 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np, unsigned int *conf) { struct xadc *xadc = iio_priv(indio_dev); - struct iio_chan_spec *channels, *chan; + struct iio_chan_spec *channels; struct device_node *chan_node, *child; unsigned int num_channels; const char *external_mux; @@ -1104,7 +1104,6 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np, return -ENOMEM; num_channels = 9; - chan = &channels[9]; chan_node = of_get_child_by_name(np, "xlnx,channels"); if (chan_node) { @@ -1114,22 +1113,17 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np, break; } + channels[num_channels] = xadc_channels[reg + 9]; + channels[num_channels].channel = num_channels - 1; + ret = of_property_read_u32(child, "reg", ®); if (ret || reg > 16) continue; if (of_property_read_bool(child, "xlnx,bipolar")) - chan->scan_type.sign = 's'; - - if (reg == 0) { - chan->scan_index = 11; - chan->address = XADC_REG_VPVN; - } else { - chan->scan_index = 15 + reg; - chan->address = XADC_REG_VAUX(reg - 1); - } + channels[num_channels].scan_type.sign = 's'; + num_channels++; - chan++; } } of_node_put(chan_node); -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/