Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp3815lqb; Tue, 28 May 2024 07:25:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVRDgOp1z2SdyocrdqtSNmL6LaDFkWSo29+GOJQjZPXImkI3vMv5Gr50sdvs/GWb/DnUe5lXEFtF1sJUvHev9OGrdx6QCtElXV48YxAUw== X-Google-Smtp-Source: AGHT+IHuDREqTTqVeQYfdL/4mz06vwetLgM3KrnW0Jqd2XkVEqAzQqX0FXmEuHvh3Twmhe1vrZmZ X-Received: by 2002:a17:90b:1e10:b0:2bf:ec0e:7969 with SMTP id 98e67ed59e1d1-2bfec0e7d31mr4036149a91.48.1716906312138; Tue, 28 May 2024 07:25:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716906312; cv=pass; d=google.com; s=arc-20160816; b=08RP2cxCIi5OxxspVg7BOBaUXn6FPh383w8t/C4ITyEqbc2IrbtP7fkVPGyG+HAtIu MiPbpJSNn/625J5m0G4uZeFcVjAwoieEcV9Bn33TSHz8xCv495msjM+8NACz1GTZFPu6 LGWQjrljFW+h929PROyNXtaf04LNXYpdPkarsEfUmIbAUmDxLxJ0HdqI81Eaalh9JDY8 AE9HIjOrqRjTFGswXiJJeuOD3V51VSN360zvayjymw5B6SF/UYbuCTPkWqQq/d4qZP23 P+Ucpume+RYLHlTGFrJJnVMgSYUcthYDHAHRUpMwAt5HRVrTRWYo41SUH0dX+7NizXvC Y5kA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wg8CtjNjFgeTw9feqCVVRxh9BF8aMu7Y3qqfuAJtbso=; fh=NAzgvmk67nOp53BtGqxGtJZFVeSk77n9ziHAqDa+h2M=; b=zS6M9abVBjsqTStglTjSLXGjqYteiD6RTD89w2l8HdpwaogEtm54vgELzTvdG/Bx90 PRjQKwE5TASk2ZLEvzgIWzjXYO/99ycgcE+IDG77rIEFtbXZF5xcaTGpFaoTE8nbu7KX kBrhnbrUbj6tMYvr3AG387IvmlD4yGN6iDZkm9wuhceHlppos23BBzVKbTPzkft3SM41 DyOXmfq4hSh7gPs8KTbozQUQDg3f9UKgC+dIaN12LE2E5SUkH1HmAsjO5yr0CYZ7r+MK FeiwhBCoOPH02M84QgR609f9W7N+cROcJ6ukSCB1gArz/DDh+iaFjRp8gfMa31XDlbuy 2nWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZTIMlGoA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-192531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192531-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bdd9ef2a30si9880534a91.62.2024.05.28.07.25.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 07:25:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZTIMlGoA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-192531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192531-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 25F6B2864F2 for ; Tue, 28 May 2024 14:25:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 346E217082C; Tue, 28 May 2024 14:24:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZTIMlGoA" Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3072F16F90B; Tue, 28 May 2024 14:24:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716906283; cv=none; b=b3drlxIGCMaoZa0oCZJ30E4FP0M/G+95+URlnmOrRuiY1f+I6KAUpXQjOB3MIp0YtUbUNVB3/PO1W8BNl+UESVCiS9NgyXVM9iUkIU3FnexiFGS5dFH7jcnhZgwVnxCqBpUoCoOLOH9KTVnLkjQiVnQ+VEWT2YYqwv6oHCGhYOQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716906283; c=relaxed/simple; bh=SqVjZBVKLoxCG9HOpyPz22UIfMp7t6E7WIQ4bXXJRSA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=PSB0L/yKbUIpe21vWpx4OaXbn50utkqjeNDAfqn5ES9pVpJt8Rzoy2i2a3bt5yj8S6HacBP3NGTXprC4Q6tQuMjv/YJo0S6daRSuQpmLcIkC3eytRBRHLNPChjbIfRnIImDTpLvygezLe7rmtxH7fAZYSoULhE3WI9UADHnXpac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZTIMlGoA; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-57863a8f4b2so1047621a12.0; Tue, 28 May 2024 07:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716906279; x=1717511079; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wg8CtjNjFgeTw9feqCVVRxh9BF8aMu7Y3qqfuAJtbso=; b=ZTIMlGoAuJR82vTLpV/gQHG2DUKjrqHgBkKaDeizO71DX4I43rmQF4+JyXvYNHgDvP BzR27M5fT76i6JFSsAsYpUMauqGKdUfUn8f++cbx22HKTgVJHmx4MoTRPoOCaqDTVUaP HywPYUriFS9uDpZdicckb6oWMuj+AyP/ZW6/iU5Ans13LlQ1s3KItqqbLCcz9jI36f+h Pfg96XcDs/dftv0NZxi3m8EF/g+HksSZXIDziZKQWdrB1oit0RCyIOXzHfHlt3SuXTjB sWpvpJqkAta+vRFq13GCKs8ZSV1aS0FM6qnLk3DDuv7znRvDlIs3nKP9HdHiVNMGOdBT RHSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716906279; x=1717511079; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wg8CtjNjFgeTw9feqCVVRxh9BF8aMu7Y3qqfuAJtbso=; b=hN4M+CfvxaZ6Xja911kfh0G95yRw3fhgr71/C63FWxhj54mya6zkJL0xg4x0jZ8Hb0 YEq89oEEikTJh84HtBRmr86MbmsHKwScv7CcKnz1Ldpf6de/Jvz8FmHERBAtsEDE7UEZ or/ODpYJECXz7NILfU8L4lb8YdT/0JZEiIbXaiM5vy/mfWuFDR2dbQnG81YrYb0YkU1t /Rq7Ay5jCsdAeq8bj3eg91eEKs/Cv439G8KFjVd47pqmiFXA3cBxGWmEMEICCW26MqE7 E5X9DtWIcfuhAvjmcRt2iY6IGFffpXAoDTlaJXr0SPhQljjONbNagFRBsZM7VXdg4bud PD9A== X-Forwarded-Encrypted: i=1; AJvYcCVkwqj0XY314JFiYAKNq/MN1BXjdfhFUQJqiRvoVM4wlV3ASYcaPYPmYkSjUcHl5CAR8jAYprSc6XwK4EjrnLOwj2tvAObYk+uLt4ujxG6LmBecumKIXBIgYSh4vscaqQWz2ZxGtT1leJE91Y3AmLPlDplILAvwKPZ7TroHbjXTYg== X-Gm-Message-State: AOJu0YxsD2Py7FLHss+TFS0RGfKdxWMigOV0a/os/5Sy9SCsAM1dtjx2 NpPNo/XuMSp524tCWBJtmnAOIvQ6LUguNrqGSCjNx23D4o+PkI1OOnkxHcKrnSk= X-Received: by 2002:a50:d615:0:b0:579:c1fc:b94d with SMTP id 4fb4d7f45d1cf-579c1fcbc25mr5794864a12.6.1716906278575; Tue, 28 May 2024 07:24:38 -0700 (PDT) Received: from rbolboac.. ([2a02:2f0e:350b:4500:3736:ef2a:a857:c911]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-579d7dc9efesm2495580a12.48.2024.05.28.07.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 07:24:38 -0700 (PDT) From: Ramona Gradinariu X-Google-Original-From: Ramona Gradinariu To: linux-kernel@vger.kernel.org, jic23@kernel.org, linux-iio@vger.kernel.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, corbet@lwn.net, conor+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, robh@kernel.org Cc: Ramona Gradinariu , =?UTF-8?q?Nuno=20S=C3=A1?= Subject: [PATCH v2 1/6] iio: adis16480: make the burst_max_speed configurable Date: Tue, 28 May 2024 17:24:04 +0300 Message-Id: <20240528142409.239187-2-ramona.gradinariu@analog.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240528142409.239187-1-ramona.gradinariu@analog.com> References: <20240528142409.239187-1-ramona.gradinariu@analog.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this, we can pass the maxixum spi burst speed to the 'ADIS16480_DATA()' macro. This is in preparation to support new devices that have a different speed than the one used so far. Co-developed-by: Nuno Sá Signed-off-by: Ramona Gradinariu --- no changes in v2 drivers/iio/imu/adis16480.c | 84 +++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c index b40a55bba30c..bc6cbd00cd4b 100644 --- a/drivers/iio/imu/adis16480.c +++ b/drivers/iio/imu/adis16480.c @@ -107,8 +107,6 @@ #define ADIS16495_BURST_ID 0xA5A5 /* total number of segments in burst */ #define ADIS16495_BURST_MAX_DATA 20 -/* spi max speed in burst mode */ -#define ADIS16495_BURST_MAX_SPEED 6000000 #define ADIS16480_REG_SERIAL_NUM ADIS16480_REG(0x04, 0x20) @@ -872,33 +870,33 @@ static const char * const adis16480_status_error_msgs[] = { static int adis16480_enable_irq(struct adis *adis, bool enable); -#define ADIS16480_DATA(_prod_id, _timeouts, _burst_len) \ -{ \ - .diag_stat_reg = ADIS16480_REG_DIAG_STS, \ - .glob_cmd_reg = ADIS16480_REG_GLOB_CMD, \ - .prod_id_reg = ADIS16480_REG_PROD_ID, \ - .prod_id = (_prod_id), \ - .has_paging = true, \ - .read_delay = 5, \ - .write_delay = 5, \ - .self_test_mask = BIT(1), \ - .self_test_reg = ADIS16480_REG_GLOB_CMD, \ - .status_error_msgs = adis16480_status_error_msgs, \ - .status_error_mask = BIT(ADIS16480_DIAG_STAT_XGYRO_FAIL) | \ - BIT(ADIS16480_DIAG_STAT_YGYRO_FAIL) | \ - BIT(ADIS16480_DIAG_STAT_ZGYRO_FAIL) | \ - BIT(ADIS16480_DIAG_STAT_XACCL_FAIL) | \ - BIT(ADIS16480_DIAG_STAT_YACCL_FAIL) | \ - BIT(ADIS16480_DIAG_STAT_ZACCL_FAIL) | \ - BIT(ADIS16480_DIAG_STAT_XMAGN_FAIL) | \ - BIT(ADIS16480_DIAG_STAT_YMAGN_FAIL) | \ - BIT(ADIS16480_DIAG_STAT_ZMAGN_FAIL) | \ - BIT(ADIS16480_DIAG_STAT_BARO_FAIL), \ - .enable_irq = adis16480_enable_irq, \ - .timeouts = (_timeouts), \ - .burst_reg_cmd = ADIS16495_REG_BURST_CMD, \ - .burst_len = (_burst_len), \ - .burst_max_speed_hz = ADIS16495_BURST_MAX_SPEED \ +#define ADIS16480_DATA(_prod_id, _timeouts, _burst_len, _burst_max_speed) \ +{ \ + .diag_stat_reg = ADIS16480_REG_DIAG_STS, \ + .glob_cmd_reg = ADIS16480_REG_GLOB_CMD, \ + .prod_id_reg = ADIS16480_REG_PROD_ID, \ + .prod_id = (_prod_id), \ + .has_paging = true, \ + .read_delay = 5, \ + .write_delay = 5, \ + .self_test_mask = BIT(1), \ + .self_test_reg = ADIS16480_REG_GLOB_CMD, \ + .status_error_msgs = adis16480_status_error_msgs, \ + .status_error_mask = BIT(ADIS16480_DIAG_STAT_XGYRO_FAIL) | \ + BIT(ADIS16480_DIAG_STAT_YGYRO_FAIL) | \ + BIT(ADIS16480_DIAG_STAT_ZGYRO_FAIL) | \ + BIT(ADIS16480_DIAG_STAT_XACCL_FAIL) | \ + BIT(ADIS16480_DIAG_STAT_YACCL_FAIL) | \ + BIT(ADIS16480_DIAG_STAT_ZACCL_FAIL) | \ + BIT(ADIS16480_DIAG_STAT_XMAGN_FAIL) | \ + BIT(ADIS16480_DIAG_STAT_YMAGN_FAIL) | \ + BIT(ADIS16480_DIAG_STAT_ZMAGN_FAIL) | \ + BIT(ADIS16480_DIAG_STAT_BARO_FAIL), \ + .enable_irq = adis16480_enable_irq, \ + .timeouts = (_timeouts), \ + .burst_reg_cmd = ADIS16495_REG_BURST_CMD, \ + .burst_len = (_burst_len), \ + .burst_max_speed_hz = _burst_max_speed \ } static const struct adis_timeout adis16485_timeouts = { @@ -944,7 +942,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .max_dec_rate = 2048, .has_sleep_cnt = true, .filter_freqs = adis16480_def_filter_freqs, - .adis_data = ADIS16480_DATA(16375, &adis16485_timeouts, 0), + .adis_data = ADIS16480_DATA(16375, &adis16485_timeouts, 0, 0), }, [ADIS16480] = { .channels = adis16480_channels, @@ -958,7 +956,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .max_dec_rate = 2048, .has_sleep_cnt = true, .filter_freqs = adis16480_def_filter_freqs, - .adis_data = ADIS16480_DATA(16480, &adis16480_timeouts, 0), + .adis_data = ADIS16480_DATA(16480, &adis16480_timeouts, 0, 0), }, [ADIS16485] = { .channels = adis16485_channels, @@ -972,7 +970,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .max_dec_rate = 2048, .has_sleep_cnt = true, .filter_freqs = adis16480_def_filter_freqs, - .adis_data = ADIS16480_DATA(16485, &adis16485_timeouts, 0), + .adis_data = ADIS16480_DATA(16485, &adis16485_timeouts, 0, 0), }, [ADIS16488] = { .channels = adis16480_channels, @@ -986,7 +984,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .max_dec_rate = 2048, .has_sleep_cnt = true, .filter_freqs = adis16480_def_filter_freqs, - .adis_data = ADIS16480_DATA(16488, &adis16485_timeouts, 0), + .adis_data = ADIS16480_DATA(16488, &adis16485_timeouts, 0, 0), }, [ADIS16490] = { .channels = adis16485_channels, @@ -1000,7 +998,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .max_dec_rate = 4250, .filter_freqs = adis16495_def_filter_freqs, .has_pps_clk_mode = true, - .adis_data = ADIS16480_DATA(16490, &adis16495_timeouts, 0), + .adis_data = ADIS16480_DATA(16490, &adis16495_timeouts, 0, 0), }, [ADIS16495_1] = { .channels = adis16485_channels, @@ -1016,7 +1014,8 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .has_pps_clk_mode = true, /* 20 elements of 16bits */ .adis_data = ADIS16480_DATA(16495, &adis16495_1_timeouts, - ADIS16495_BURST_MAX_DATA * 2), + ADIS16495_BURST_MAX_DATA * 2, + 6000000), }, [ADIS16495_2] = { .channels = adis16485_channels, @@ -1032,7 +1031,8 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .has_pps_clk_mode = true, /* 20 elements of 16bits */ .adis_data = ADIS16480_DATA(16495, &adis16495_1_timeouts, - ADIS16495_BURST_MAX_DATA * 2), + ADIS16495_BURST_MAX_DATA * 2, + 6000000), }, [ADIS16495_3] = { .channels = adis16485_channels, @@ -1048,7 +1048,8 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .has_pps_clk_mode = true, /* 20 elements of 16bits */ .adis_data = ADIS16480_DATA(16495, &adis16495_1_timeouts, - ADIS16495_BURST_MAX_DATA * 2), + ADIS16495_BURST_MAX_DATA * 2, + 6000000), }, [ADIS16497_1] = { .channels = adis16485_channels, @@ -1064,7 +1065,8 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .has_pps_clk_mode = true, /* 20 elements of 16bits */ .adis_data = ADIS16480_DATA(16497, &adis16495_1_timeouts, - ADIS16495_BURST_MAX_DATA * 2), + ADIS16495_BURST_MAX_DATA * 2, + 6000000), }, [ADIS16497_2] = { .channels = adis16485_channels, @@ -1080,7 +1082,8 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .has_pps_clk_mode = true, /* 20 elements of 16bits */ .adis_data = ADIS16480_DATA(16497, &adis16495_1_timeouts, - ADIS16495_BURST_MAX_DATA * 2), + ADIS16495_BURST_MAX_DATA * 2, + 6000000), }, [ADIS16497_3] = { .channels = adis16485_channels, @@ -1096,7 +1099,8 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { .has_pps_clk_mode = true, /* 20 elements of 16bits */ .adis_data = ADIS16480_DATA(16497, &adis16495_1_timeouts, - ADIS16495_BURST_MAX_DATA * 2), + ADIS16495_BURST_MAX_DATA * 2, + 6000000), }, }; -- 2.34.1