Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1389441lqj; Mon, 3 Jun 2024 22:55:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXv8GKI5MAI8SAOQodQdEe2ixqCOrXw5tKL4lCbyJllnPkKgmgAK7QkoBaX/tkXifYzfm77n2/RC25p7F1qt8Fl35GTjRnVg9PGt5Hp1g== X-Google-Smtp-Source: AGHT+IGbtVlNKCdT3xLvOT7RSJCP3nZ4ixAf5LZJrWOHJx2t8CEIwYfNDZROon4y5eEO/FvtK6u0 X-Received: by 2002:a17:906:128b:b0:a60:c58e:d323 with SMTP id a640c23a62f3a-a681fa6aab8mr719905566b.10.1717480540105; Mon, 03 Jun 2024 22:55:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717480540; cv=pass; d=google.com; s=arc-20160816; b=qtcE75WRwJJa/+qIURdXh2rCTWx42bhlfCMdg4qv1/2NQBgZpz2whU8Bd9VaJu7AVe O6DeuQwx5+VoGCacHZYnfIj1SMz8EhxDqoykE7JvTujWApfKgHzGMSitblsnUQIokkSf jc23Um1BBQqVsWDRxMb8mWfjiMKoEHVhtar14VCbzQSXqwzxngMWVNnKqXIU8MOY2xKL m3Jevt9bfkzcaB1oNYXyg1b+O2KucR/In5pqVHQ29SKewZWeUf5amnPOq6OyJTgnoO7U A8iFhADXefZ9eJKgohZ7LdDQuo4nuViCha4b5Rnmff1cUs+1VIXQgTDJSBl/u83aGB6C waCg== 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:to:from:dkim-signature; bh=hNXQ/SoJYaWo0NJj93vx8GPkV2wEKcXWEow45UeQsg8=; fh=wfI/6NNWFDpUNLrdYwt9ZFXETLy5RusUnV5Ct7NrhB0=; b=mjuMODws0g7OHltPvhlzLQdqI0INSVDt0kHx1zqKNpJlSvF06uwGXiLaf4CpNjaw0w KYE9WmjkG9RomrIvvfemyLF1Ga2YHcjqDkBCuMNojdHgx1nC3QouMQ19vTBR45Owf8ZO YvCcW2fvvZSibXirOnLrla5prFcCApFBtGSICG1aX31RERHU8R/1j5ujNAA30VoOipSd A+hh1dyH9QwCv/IzGlOP6KzmXhNeAgVTiRjenP++zLgyatNIjsBbJxYDJsb/TBfrtAVL 5ao54U5Ws55Q6qiL3lZ/GSZA7pfKGszCuHkFPNQYfutX3qPM6bmh8nmjPgHQFIKLpq9U e93Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UO4whNME; 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-200077-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a68441329e7si445352966b.51.2024.06.03.22.55.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 22:55:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200077-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UO4whNME; 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-200077-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200077-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A78721F23546 for ; Tue, 4 Jun 2024 05:55:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3C82140E3C; Tue, 4 Jun 2024 05:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UO4whNME" Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 67D01140374; Tue, 4 Jun 2024 05:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717480482; cv=none; b=szEZ0gCS3Y/OF8UakIfXws6hwDJMsPSP5vRTLp3s7IiZPbwXRhoDQ0Lzz79GmhSfKewNECTSmdCy1nABhiqarqb14YMU1xyJAshhEjsoNfHwaLYuYx7iZSu//hrlPOvKImsaytCVY0ehJHZaIBPk3ZlF/VscH6qhQwRI1jP+ve4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717480482; c=relaxed/simple; bh=vBMOrsEvWet6SnV8icQIYbE/21MSLFGaoualfXxCRnI=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uk+dHcVR61TlojSLJ+FFkZug+OjnS2TKjv+Xa2nu7wKSMRHtNF5uOtl+pU/HoNqJS1r1IRV4ZOvd3eAlvL16B2bzY/uJ7FclmCUYweOEX+UN3+HsKYCbDly+8vQBP1Ve837xyQehqxufoNuKhyY0K/by8x06NIcALoWob6lgbAc= 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=UO4whNME; arc=none smtp.client-ip=209.85.208.47 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-f47.google.com with SMTP id 4fb4d7f45d1cf-57a68b0fbd0so1485997a12.1; Mon, 03 Jun 2024 22:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717480479; x=1718085279; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hNXQ/SoJYaWo0NJj93vx8GPkV2wEKcXWEow45UeQsg8=; b=UO4whNMEd0MfoVjqlp1gfxzbuWdsEmGYEJBANDjE8KqAYcC7F44iVb0of7oP70+uCa ap9T1rIBgsyYr0OKkPft6pugbyl370nUz6lsBuqVwMAzKNfiNMU8WYjPMeuWpoZ6IisB OaTY93qrxfDiPXnFj0ZoxdWcVAoZ/XXmDb5FAzb1pIs70kySy6bLtyDbEV0zd3lGFxp1 Uuy3w+TzB+xOEgzwHoEODk5KEhTVKcGXDnkTQoHDMn4ajxHr2LDgFwnXhRCFdFr9S+ky eYv+9zprqfkCBLyLCxljDVJBR92xyfuWJXg138QWmpiXM9KPfhNZd1jdImfMbVZUgXik MIdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717480479; x=1718085279; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hNXQ/SoJYaWo0NJj93vx8GPkV2wEKcXWEow45UeQsg8=; b=jmIm+TztqgEkMNgZu9Ot+lOiEz/R3DfoKRDVC1RxrvKEGoDHvKEnGwz6nO5WTUmY1E JhoGup3KLsC2ecvD935f9PMEE5yhApmRDOI+x328mwEEvp3XDHG9zyOK9ufdbc/MdU9i X2X/Xo0NMDJYVtkb5960d6XMwgemglGaJX9jEjJUbUVNQ+Xb5bOz3GcZ/nXgasEnBLfh NpFcwJi0R1wXNkh8Uth8TUfXPI6A+sVKf8FD5HvnXleAJ4KRw5C5oB4VbB3h0Kb0uIef MJtYtLSIg97WLhTFZiATIxaGmr7D1lzbaPP1L68U2d9pnOc3WT/rlK72rTUvrNxgyjh4 +72w== X-Forwarded-Encrypted: i=1; AJvYcCVVrNZvDTHyPz1N9Hw9iRR7wibuEK/oX+AHcsDhQcvThDz1km7MLLY4BHYnAQQuKa0RKa125q/GkLnQMGgki+sj5bNGW9bvNT37zVBd3hCcP/q9El15mbkJWHSdVoOv6nUfdJkMoaqTtK8Rx0JtQIm4TrdGYiaH7DxLUo/FcNCNLDP20Q== X-Gm-Message-State: AOJu0YwYzG1fklLFjE1+lJ3n8DYhzJt3RiGoojRHfmtoKFhGabyb/hXs uUcIi9hMuPzT6s4E1Z6s7rNkdgaWnlBEVEz5eTXasNhktrrILxsk X-Received: by 2002:a50:9ee1:0:b0:578:36a2:7073 with SMTP id 4fb4d7f45d1cf-57a36450a36mr7711221a12.29.1717480478704; Mon, 03 Jun 2024 22:54:38 -0700 (PDT) Received: from toolbox.. ([87.200.95.144]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57a4fc842b5sm4895643a12.71.2024.06.03.22.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 22:54:38 -0700 (PDT) From: Christian Hewitt To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] iio: adc: meson: add support for the GXLX SoC Date: Tue, 4 Jun 2024 05:54:31 +0000 Message-Id: <20240604055431.3313961-2-christianshewitt@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604055431.3313961-1-christianshewitt@gmail.com> References: <20240604055431.3313961-1-christianshewitt@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Martin Blumenstingl The SARADC IP on GXLX is identical to the one found on GXL SoCs: except GXLX requires poking the first three bits in the MESON_SAR_ADC_REG12 register to get the three MPLL clocks (used as clock generators for the audio frequencies) to work. Register bits are from the vendor kernel. Signed-off-by: Martin Blumenstingl Signed-off-by: Christian Hewitt --- drivers/iio/adc/meson_saradc.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c index 13b473d8c6c7..200eb8271617 100644 --- a/drivers/iio/adc/meson_saradc.c +++ b/drivers/iio/adc/meson_saradc.c @@ -160,6 +160,11 @@ #define MESON_SAR_ADC_REG11_EOC BIT(1) #define MESON_SAR_ADC_REG11_VREF_SEL BIT(0) +#define MESON_SAR_ADC_REG12 0x30 + #define MESON_SAR_ADC_REG12_MPLL0_UNKNOWN BIT(0) + #define MESON_SAR_ADC_REG12_MPLL1_UNKNOWN BIT(1) + #define MESON_SAR_ADC_REG12_MPLL2_UNKNOWN BIT(2) + #define MESON_SAR_ADC_REG13 0x34 #define MESON_SAR_ADC_REG13_12BIT_CALIBRATION_MASK GENMASK(13, 8) @@ -327,6 +332,7 @@ struct meson_sar_adc_param { u8 vref_select; u8 cmv_select; u8 adc_eoc; + bool mpll_clock_bits; enum meson_sar_adc_vref_sel vref_volatge; }; @@ -1009,6 +1015,12 @@ static int meson_sar_adc_init(struct iio_dev *indio_dev) priv->param->cmv_select); regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG11, MESON_SAR_ADC_REG11_CMV_SEL, regval); + + if (priv->param->mpll_clock_bits) + regmap_write(priv->regmap, MESON_SAR_ADC_REG12, + MESON_SAR_ADC_REG12_MPLL0_UNKNOWN | + MESON_SAR_ADC_REG12_MPLL1_UNKNOWN | + MESON_SAR_ADC_REG12_MPLL2_UNKNOWN); } ret = clk_set_parent(priv->adc_sel_clk, priv->clkin); @@ -1241,6 +1253,17 @@ static const struct meson_sar_adc_param meson_sar_adc_gxl_param = { .cmv_select = 1, }; +static const struct meson_sar_adc_param meson_sar_adc_gxlx_param = { + .has_bl30_integration = true, + .clock_rate = 1200000, + .regmap_config = &meson_sar_adc_regmap_config_gxbb, + .resolution = 12, + .disable_ring_counter = 1, + .vref_voltage = VREF_VOLTAGE_1V8, + .cmv_select = true, + .mpll_clock_bits = true, +}; + static const struct meson_sar_adc_param meson_sar_adc_axg_param = { .has_bl30_integration = true, .clock_rate = 1200000, @@ -1293,6 +1316,11 @@ static const struct meson_sar_adc_data meson_sar_adc_gxl_data = { .name = "meson-gxl-saradc", }; +static const struct meson_sar_adc_data meson_sar_adc_gxlx_data = { + .param = &meson_sar_adc_gxlx_param, + .name = "meson-gxlx-saradc", +}; + static const struct meson_sar_adc_data meson_sar_adc_gxm_data = { .param = &meson_sar_adc_gxl_param, .name = "meson-gxm-saradc", @@ -1324,6 +1352,9 @@ static const struct of_device_id meson_sar_adc_of_match[] = { }, { .compatible = "amlogic,meson-gxl-saradc", .data = &meson_sar_adc_gxl_data, + }, { + .compatible = "amlogic,meson-gxlx-saradc", + .data = &meson_sar_adc_gxlx_data, }, { .compatible = "amlogic,meson-gxm-saradc", .data = &meson_sar_adc_gxm_data, -- 2.34.1