From patchwork Thu Apr 3 05:32:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gyeyoung X-Patchwork-Id: 14036710 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (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 05FC0156C72; Thu, 3 Apr 2025 05:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743658459; cv=none; b=kMRciJcY5hzpDfk+y2ewPUKtkQ08J6+OIzP7xG9u6vm3MLCNnLm2MA45hqIuz+VVw1DN2eY3eggsrmyZ27Ia6wb422unEFIXpC1rBla/tAYjfOSLtU+N3bJCRB3HIIGLfmmKj64pfeOPkxtDTU2Xr4BRYkQ+QPQ/fS5304yOWXo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743658459; c=relaxed/simple; bh=Zc950WA+vES0d5LaJupaHH0s6pTQfhPPaJY75H8ygug=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=okKrgN8GBFHwPej00Cf/RgQpbbWHi11L3Ct+lO7ceUjoNk9MWP/BczR8VltKe2/PU9lckH2W085I8UtrCt4pzSydYFXjaFk3cFpXp6imtY6HHtOP5NOzt9IQfehTZJQKMIKYezZ7yPCKbY7TtxEcdgTQl3zPkGxn/XenOWX9RVs= 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=M8vEwVx5; arc=none smtp.client-ip=209.85.216.48 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M8vEwVx5" Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-301302a328bso545816a91.2; Wed, 02 Apr 2025 22:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743658457; x=1744263257; 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=QBw6C0ziFRnbZ9N8eAluNk0SPMVQX2BRjnDnpLWinvM=; b=M8vEwVx5Ckulm518Fc56ta2+wJRmo3L+MmgAjYW5PsZX1cJJ7RtOty68wz0QhH62Rg /BVTCpilaPdFgP3VCbZdNyU0u/xZziDWVtS5P1X14pvBG8opDyBs7H5Uj6cVzIUPp1oR p8vGH4HI0NjXqqhWWVOffUqNPFmaGlXVthUTNM574yoFzeFXVV7e4GV/Tpl7/CsB7mBH jhyesZajpVRHwT5b1wyNxN9DZxGcyEnBotWo1VLK4Z6193uYInye9EJKmFsLin+eLG1/ /xnt9i3ZmX7h3Rgd9P8yAUhEW7mFvv2EFr0X+3la4K3Ap5d4F85iSemAu/xM/xSSf2bO rYVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743658457; x=1744263257; 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=QBw6C0ziFRnbZ9N8eAluNk0SPMVQX2BRjnDnpLWinvM=; b=kxLnyUdKpqmYZexoKVNcObW5JJ8DYCKmRdzJYwKklXZ9ofsFh7oiLPqJ7a7lTKQpok VpHBjdt+bMtLc/GGtfm9ezPuJcPLcRkYCVLJTtKtc3XV6QRsV2nLQ+4NGiBMSGSjOs5Y kFXHmxhbJVB8KTSFq5fluqeNjDGiql5rrEblqeycwMMDnVjD4M5cf3DGBwgDcntwa+xy MDqQUy/Ulk8uYXV3st7pow+G9MIRPy3W5Ch73/vLKjdp3M4u6lXGFO7BNHk945RiL/H9 Q6FXnXSYFlBRZ8+MSu7RA5k2quNuJRAbMh/xL9+NSiMjkq8uoxQkvh/YhnriAYtAsWYx Kojg== X-Forwarded-Encrypted: i=1; AJvYcCVsi+h+xc0cBK8FBvMP4oRhebygtBhacsyrMDA91oMKFoiWgqjV14Dw+EjK75kXq6cCbFihOTtS64s0@vger.kernel.org, AJvYcCWEXaDp4PjkQL522e+qinTKbaeQZy+AIM5fIwB1fobuEgZaT++WFC+b3UqEutRUFaLnxW7D5xy6Pg4T@vger.kernel.org X-Gm-Message-State: AOJu0YxhksyTAKfnmRwweSxwPZIrM2GRr0XF3vBeA9G9V+qYHE3SMsvR JMn5zzsj3LB7nzsN4ja5P3FakOWIAI0EqRQDgU/NFc/mVkAiqXzmW8X6sD3j X-Gm-Gg: ASbGncumU8Vzk3q/wOiQCAUgUhMhCmaXaxTS04jJmLMvvmFEI3YE10RlgPuw+mAL+Ny RgpTfoQW6h0HT7Q32ivpM/06SWcpH2SNWhTt3mfDGyEmeO3GgOYdGGLToZemHCPwifcBaTEPeIi zi8UZ+fcSD0vqHZpSuuWG0GM2gNpRQiYHgARjv+eP3R8T66s1IWMqr9JLRvTaBSwT6ZUfnUMT2R QzyJBlenGlTkYUBx8fgOSWGtF8yISPvfwWmU0S3OJIYz8hOhORpOiF1OW2FCOER2BwKL8AMmy3r dE3aEllyGt+w2WUWNV7EcVX/R0nCKLOhg6u20VPEQG0wH7BCfA== X-Google-Smtp-Source: AGHT+IGAxxeQPKZeai7NtCSWi1XQXLt1ZcqEyfeMtWqZgeNCRrH1RoMVCWvvNVgwTiFWkcFJitT6IQ== X-Received: by 2002:a17:90b:51c5:b0:2fc:3264:3657 with SMTP id 98e67ed59e1d1-30531e89d22mr32987624a91.0.1743658457275; Wed, 02 Apr 2025 22:34:17 -0700 (PDT) Received: from gye-ThinkPad-T590.. ([61.108.38.194]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-22978776601sm5537575ad.237.2025.04.02.22.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 22:34:17 -0700 (PDT) From: Gyeyoung Baek To: jic23@kernel.org Cc: Gyeyoung Baek , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, lars@metafoo.de, gustavograzs@gmail.com, javier.carrasco.cruz@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Subject: [PATCH v1 1/5] dt-bindings: add winsen to the vendor prefixes Date: Thu, 3 Apr 2025 14:32:21 +0900 Message-Id: <20250403053225.298308-2-gye976@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250403053225.298308-1-gye976@gmail.com> References: <20250403053225.298308-1-gye976@gmail.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add winsen to the vendor prefixes. Signed-off-by: Gyeyoung Baek Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+) -- 2.34.1 diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index 5079ca6ce1d1..ee7f6100c432 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -1679,6 +1679,8 @@ patternProperties: description: Wingtech Technology Co., Ltd. "^winlink,.*": description: WinLink Co., Ltd + "^winsen,.*": + description: Winsen Corp. "^winstar,.*": description: Winstar Display Corp. "^wirelesstag,.*": From patchwork Thu Apr 3 05:32:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gyeyoung X-Patchwork-Id: 14036711 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 7F8AE19CCEC; Thu, 3 Apr 2025 05:34:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743658463; cv=none; b=Ii8ELlEdXf9qE+i5HNOap1w4nJa3MOV2yp2kxZdOtFsR5wVrqdQZ6k0XVmQLNuCaMsxrO7BWyVE39MrWwwqHNew41FX7W3yqltcMtZ/MYnVXINLiYDBYWuyV21f/AQklEv7Jy0CTXJc/owM5YX4R6VcB5PefTre7FK1UAAme6Dk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743658463; c=relaxed/simple; bh=VLNPLeC12AEoU9rDIa9o/83SXKAuM855cpR3HtpEZmc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y/fix7Kvne2+7CtM0qHaPTOzNrjPcCriIH0rLOmJKMRNyJGm5UP0XsPaXWkr75Id+Q3Fv2+fpDRaI+CokvTD4eW7LUCn5Ry6bp84AKMvuJ9aSWCvapnU3Df3uwt5IkyZGK32GwK7IpF7RMs7ldNprA6ungIHnLmD7yoDktatvYE= 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=dBqv6sB2; arc=none smtp.client-ip=209.85.214.171 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dBqv6sB2" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-224100e9a5cso5414265ad.2; Wed, 02 Apr 2025 22:34:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743658462; x=1744263262; 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=HXnOMlB/9rWVjqA9q3b7pF6bOI11URF+QKz6rkVSzRo=; b=dBqv6sB2bNRub1hmUXDPcSmCt39dXLQHvuv9cCfuBwPOAGlSiunfwsoe/uTgngVz86 8Hu5p/g1bpkPc4SD9xHfBTFf+bGmjaY48ePqQcjvIgd4guVzSzBOwaCAGE9oXeYFyWSN x4yzRNVMx7r51Gh+37Xfih0kOuSx6NzKr6kJ72eYJXWJ/X5qZaBdmlSUFKRzVdX59J8a W+rJwd+PeKSsn0WpgFcqYMUo306ooyqGvvKlBGjIZLsxOr8m7HM1nt9i+F9i4Gf1ZhD/ Vo/4UY4Vot3lieWQlSs0Hcokg8ZB0wPparnjf21qyVARpyIqJeKE0xmxRt4RE+pvNNql 8ZCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743658462; x=1744263262; 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=HXnOMlB/9rWVjqA9q3b7pF6bOI11URF+QKz6rkVSzRo=; b=ebmZdLhsZxKcJBnp3QhAuscTVcFIOiDFzU648c1S2mNnX0jS3sWIGY5gUoudWf8GwI sdE1g/jsgWQWJ0wJglT/67BSi6hIl8nPXpj5LeBdY3swI4JMddMvIp73IyqWtzbCvMoU CPd79N/lKjPOgN8rQDamuGjybnuSqHSI8/BSRukcl/eqW88gULe6ko3ebZGr/y9UsCIG 6RA65ThN6MJjNeyKwBrILOVBh4N36CuqS2D3MDctgkUZLq74SUM3/KpatxvXD6DTbCx0 C6Cf9S2ID657aCbGwDMBneuWZxzc33o28NmhEjKtp33n34QX8mSe7368bixHUN+NjzL8 F2hA== X-Forwarded-Encrypted: i=1; AJvYcCVTjkoL+w8BosFvjm99Q2a8DVmmIW/wkyK1mJTSTuEhXae4xLwH6mbuFm4GtxZUrOGkTIWQhSxF1fx8@vger.kernel.org, AJvYcCWQNKsdPGVkPgh6komt/sx7GRECBzGywXrS2nMUIbqDuF0V6+cOfWX1J++ls3oyGgPmHBVdBa6+27lN@vger.kernel.org X-Gm-Message-State: AOJu0YzQ7JISVQCvNCQf1fLKrjJTf2MLv8lcnc0hMm+xlGvakpaK3WSn 6UeudOlrmVoyrZziRUbMAzDtoMc88AbiyxotbEHdtk/q7EkYaXonwGgXtH5T X-Gm-Gg: ASbGncvheEll3TUr0NuG0gQnfm/OltRHEj6tjQNBvMZuEw0VlrZtgNxZbM8JIsqejWz aD5o5Odf3sTqpuVqy8rjovjr/LrAcRL72nBGUuVBdbR0+RzEWhHIK9bWEQ7r5AyocoEJChWDHTz u0B+YO7RBM0vTmuuiU0M8BZY7PT83kPIWQRwaHa1fchbzlXjvVAne1reVa6sgBq/ss2qOMBE5RH snZh2Am/DTqa+EGuCWDdhpK14GCkbdoyAtNSSBtGD3dq28qw5XIH/FGHdUiz1mlC94MfEKibxKs PcMqYKOuqf9cJoeKdf6vJwmnwjR5qvLWzGocPyIbvd10+2wvng== X-Google-Smtp-Source: AGHT+IG7XLDm6zLf92mLkEv4BsnDQOX6/Jwh9eFMyuPmCJnsv+EQ/0O5DkSS5zJGFtJUD/iXm8gRtw== X-Received: by 2002:a17:902:f688:b0:224:1935:fb7e with SMTP id d9443c01a7336-2292f979c51mr327453525ad.24.1743658461624; Wed, 02 Apr 2025 22:34:21 -0700 (PDT) Received: from gye-ThinkPad-T590.. ([61.108.38.194]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-22978776601sm5537575ad.237.2025.04.02.22.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 22:34:21 -0700 (PDT) From: Gyeyoung Baek To: jic23@kernel.org Cc: Gyeyoung Baek , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, lars@metafoo.de, gustavograzs@gmail.com, javier.carrasco.cruz@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Subject: [PATCH v1 2/5] dt-bindings: add device tree support for winsen MHZ19B CO2 sensor Date: Thu, 3 Apr 2025 14:32:22 +0900 Message-Id: <20250403053225.298308-3-gye976@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250403053225.298308-1-gye976@gmail.com> References: <20250403053225.298308-1-gye976@gmail.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add device tree support for winsen MHZ19B sensor. Signed-off-by: Gyeyoung Baek Reviewed-by: Krzysztof Kozlowski --- .../bindings/iio/chemical/winsen,mhz19b.yaml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml -- 2.34.1 diff --git a/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml new file mode 100644 index 000000000000..16ec902c906e --- /dev/null +++ b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/chemical/winsen,mhz19b.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MHZ19B CO2 sensor + +maintainers: + - Gyeyoung Baek + +properties: + compatible: + const: winsen,mhz19b + + vin-supply: + description: Regulator that provides power to the sensor + +required: + - compatible + - vin-supply + +additionalProperties: false + +examples: + - | + serial { + co2-sensor { + compatible = "winsen,mhz19b"; + vin-supply = <&vdd>; + }; + }; +... From patchwork Thu Apr 3 05:32:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gyeyoung X-Patchwork-Id: 14036712 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 1485D19CCEC; Thu, 3 Apr 2025 05:34:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743658467; cv=none; b=P5WyOaps40fQu2OXlOPodLeKFBS1W6k0xUZ27LVvAt9tm68IgzfIYV38+KhqLP+IsfKjhY75nmGCTXDeBAHljFmMQYk9nboXHteVydBTIKD4JTp27XcNAmSi89RTsp4XriVJmw6e6K5QA5JDYsVtevIoKSZD21cxn9JSTxvvhmQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743658467; c=relaxed/simple; bh=hSrl4Yd4qs6gKIOXwcZN4iwmnSX8vsZ4UzlLhnJFye8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U5Rye4I8SCS0fgIlOGGk55ReC3+UQuqXIP7SXY0HBgrBNZ2SIop0aQYSDUGyQPKaInAO9z7WPE5cNBGxVi8OAfm+GVgvFeAaZOWd9jfaHT9dYRZ8h8IXU/TlQvLlENXPtC8lXwNxbQmI9bOQl4lR/aLO5JrqhOoTcWIlc0p7Jkk= 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=U3ucKUdO; arc=none smtp.client-ip=209.85.214.173 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U3ucKUdO" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-225df540edcso22115545ad.0; Wed, 02 Apr 2025 22:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743658465; x=1744263265; 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=p68hZDkCnGzhFlhvnUMt2CtWrkoGWDvwJns2pSEUGu0=; b=U3ucKUdOMIMbuFLqYtqMaQdr10Za/oA57PMab6NfG6HUP+SOs+WDZMSwPFEbnzE2kI Wuhx3FA8nzZMuFmGMONohBb+7AZ2QexoykFPF5VEENL1d8x8Za7a1gqd4RMO3YWdAWKI gfMJkelCCxCD1Wu9tumWaIqZ1Sa43MOiSKK4fukvl7PXlTBQdANfVJMp0KHQUgvrmSwk vufc3xH3yPB/YnaPTDJ5nVq0TVF5Q4EhrqXsNPID/Yb6V1Db6pnpGkAtw3KvknI5Vhl1 AGQsEeR8bAdhl262uBzXnVfBDKZP2uvcQFG6xJ6XEhqiLGJm2PC41iYlwxOdjD31/J3i wlPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743658465; x=1744263265; 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=p68hZDkCnGzhFlhvnUMt2CtWrkoGWDvwJns2pSEUGu0=; b=CPkbmSGGOkt4iukjmHfpE8hqA/8AmypOyOvqB0BXVN5TSnOPBsblqOCOW9HZhvvyfb /JQlcIYB/F9VtLprckwvOQnUH/DMPA5rogTA0os8ExQagZSCTlrZaUgRDKuY656MJAVd 2eZO1/TS3faYtt0gFZZgYas0mkl+2Iz1owbCoiroHfv4teu/2StUyyA+iQjLnR5wy/j7 ctw1MG1Tv2bwh5MzTuHER2ogOBrnnFKUXwbZ8FJ5zp79i/u7yJP099XFYEQa4wODNzJC x6SiKxaJSYiRg/le9NOrVbjSCfJRi5BUhdVdxm5h4lpn5TejU81gGvUdkNji7rGTUVAO jfdw== X-Forwarded-Encrypted: i=1; AJvYcCUjsBI6r0vudHStpV45NBhN3vUN7vlaJShCNxhg90+GbVQq2ESq93pspj/9FSgTU2bGduMvU57VcIjX@vger.kernel.org, AJvYcCUsc+EII/yRg6ocGmyWseaipFQVP3WsAwo/Q1sVk3MqwDTgdB6M93JA0Wm6j2+gu03bMIBh6iZg4AqS@vger.kernel.org X-Gm-Message-State: AOJu0Yx4rSFOO7F+1lNBHl2OMDXuG0e97f57mVt9bW0LLdAXA2LouTgJ KrA3iY9VrborflF0FlSW/eQP02UXBzmSHKIDVqzySzTFZGrfrkhH X-Gm-Gg: ASbGnctxHK2PgrQdmLLPOdc1Js6Q3J4YJWyvIwxo15stzxcS71GgeOTSXFGFwzWtaOb Ba7BXaXFZW4Y3CwvR328Z8QjkD/nC73qmWbmwkSKoRk28C+eYp6TOBWeFhFFtuQ/EmHL/+akBnP a8yyZ9xafb40bWd0Ks74Bqm38O+oaQeumUaoOKxiZ4Bi7xblOWHXpzecwn9hhOTScs5y+slBb3z DPbEpRrB2YUvMk3dijxe1iSMmlF8pgfk1ozoG57z6+RSxV2n6kRfddhUPu8LRH2nxfYrI8deKsn MYhw/9DvcmEFU36rotFu6Sa3Z++L0pkRv/ujZ0hLtgjAFLbFJTzpmVVj79AD X-Google-Smtp-Source: AGHT+IFHdPbA5g+HSszh5t6L6AoO/OLBeT3e1aqjC3bbbCWU+/xNb8agMYD8z0+07HiY0tAM4+qbQA== X-Received: by 2002:a17:902:d510:b0:223:517a:d4ed with SMTP id d9443c01a7336-229765ed0b9mr25325835ad.15.1743658465397; Wed, 02 Apr 2025 22:34:25 -0700 (PDT) Received: from gye-ThinkPad-T590.. ([61.108.38.194]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-22978776601sm5537575ad.237.2025.04.02.22.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 22:34:25 -0700 (PDT) From: Gyeyoung Baek To: jic23@kernel.org Cc: Gyeyoung Baek , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, lars@metafoo.de, gustavograzs@gmail.com, javier.carrasco.cruz@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Subject: [PATCH v1 3/5] ABI: iio: add new ABI doc for mhz19b Date: Thu, 3 Apr 2025 14:32:23 +0900 Message-Id: <20250403053225.298308-4-gye976@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250403053225.298308-1-gye976@gmail.com> References: <20250403053225.298308-1-gye976@gmail.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add support for winsen MHZ19B CO2 sensor. Signed-off-by: Gyeyoung Baek --- Documentation/ABI/testing/sysfs-bus-iio-chemical-mhz19b | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-chemical-mhz19b -- 2.34.1 diff --git a/Documentation/ABI/testing/sysfs-bus-iio-chemical-mhz19b b/Documentation/ABI/testing/sysfs-bus-iio-chemical-mhz19b new file mode 100644 index 000000000000..6cdfd34be016 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-iio-chemical-mhz19b @@ -0,0 +1,7 @@ +What: /sys/bus/iio/devices/co2_range +Date: April 2025 +KernelVersion: 6.14 +Contact: Gyeyoung Baek +Description: + Writing a value adjust maximum measurable PPM. + should be 2000 or 5000. From patchwork Thu Apr 3 05:32:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gyeyoung X-Patchwork-Id: 14036713 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (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 2DF5319CCEC; Thu, 3 Apr 2025 05:34:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743658472; cv=none; b=jxMOxbUdZEsgmFhSpOcBBAM7B6lpqeMfI6zMvwK+uWmEbyaTqqgcTqAjP35DF0Ph4aq1rh2iJJGzKsTcU6hZA0DU6daM4V+4wEEEiIaVnyWy6KHi0/SqpYu0V7grppa+VdOm4AtS9GmjxciYEmBq6KDjzhbWWNB3pY5vDaLKddw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743658472; c=relaxed/simple; bh=WNIRl26+O5kxmjd0m6LZCxP0N0yO4ju9Ezqa36Iqo2g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PKGd7I9Tq/DiBV/TZgMY7N9SCju19Fb6aJbxAa79H5pn0isG9uV9Sp7SuiZok4ee2aIadKb3lou8E/sf68aN/gQgQj+1x9knQDnQgxqvUNUuatMWB8i41iSgShebW5IGKkSxSZmACv8ESUaJgo6zjPAcpYpd+sIqhTJ1UBW2Zvg= 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=PSZgG3gF; arc=none smtp.client-ip=209.85.215.176 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PSZgG3gF" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-af980595952so352831a12.2; Wed, 02 Apr 2025 22:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743658469; x=1744263269; 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=RFq1wJF1n23kC7u4lYR6eyLevB5PSh5c/AAzXL0/UZg=; b=PSZgG3gF3veKjcSV3L5XjAXGtoc6G/jhevQr6ybbUtU+bZaZ2hAG2umj9h3N2+VnmL tkRIrQVY7lSaYMr0M8pj9vm70cIsCzCD0PE+EyIerP7ROziYjxUNmHZU/XqpaXImthx4 wos6Lga7GF1jtvQdxQaLnj+ZAvFeI8/iX6LXunc+3ceEUYvbEFm+iHrpSDQCD++xZpqM 1pS/AH/QWRZKq+x3zll6vYjdpXu9o2p7KmSOZYN1JGojLWE4U1Rhuh+C6ptTOL5VygkT /8+m/3kwCKGSN2cWJtR2IP29zgaA58SFneog8mAdIDNMgXG4+lWETX1T2IVwvDPIl+zc 7j3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743658469; x=1744263269; 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=RFq1wJF1n23kC7u4lYR6eyLevB5PSh5c/AAzXL0/UZg=; b=cCEZwC0H2bHv8xRcjFAtOUjoURqmA602s24Zem+dkImKxzafqGK0oOPFp3kl7IZZwi irtMZk9yIyvMEpfmYLQlnh3tHY7WNR3Dr4E8y2nQIs01SHSMnFMyw9kEbv/P34Qvq4uq X+t3a3MMHybBt2KHMTVMpebqudVkqMzWgmnE+el4/TFkQzo4/qbjRLB225B2l1GMvbmY u6NKx+nyOlQmX2Q9bHtxfY11xsJ3itH3f7mIDAE3TrbfJzaPeFP2rC+8iXr/1Gl37Nv5 JJyshk1uZLf71iKIRWWcLOgCnZYBKEWurofqeKn6N1fH6i6J2eUWuAG/uuM9OqEUR9PZ RfCg== X-Forwarded-Encrypted: i=1; AJvYcCVGVZSMhjf2ijt1V9ZNnHhL1AnfN2gVVePkC6BmapDV4P/oLdzjpxalWFJlLY/bGa6PlUh8jNtntNfj@vger.kernel.org, AJvYcCVYp1XrPnsN2DEUVuUcW0Hm66zbVVtzMZZtXlhPPhE5WfysJNid7GRb9jZLQUwUALmyl+J6qzM9Kfsi@vger.kernel.org X-Gm-Message-State: AOJu0Yx8U18K0pvNV0N8h92JHcQEcMOexA+TyuDlqYqC+rcELQGWLaf3 lQp5N7rV2fpiW9dqEqdqRLO7y72G6HGmE5xSt3OfixZyadVi6QI8 X-Gm-Gg: ASbGncu5QQbUNkVSt45Duow/ZOcQG159c60R7q1GKkA/OUv7yuuKHQokuuhR+16ZL0P YThi+5XvS90h9j47c3Sa3wxQWGlY6BIHsDku2CRN12+1w0kRZEbeByvMZx/vpneSn8Kjc/QzxWD TC6LnYSK7KSGIgOsLdNtS/p5j+nbCHfSpK2hoMRpErTgFdrMCBulrhiEoDrc+sQO3YA6ett1lb5 A2klzoRfEt8gKrbBkwL7vY45ynMyAqcvH6lyZHPc9clh6mB7RvYQe/24jNlMlh9yolvVJ7STpfz JIw7hhmKefoHuhyeMKud/I8/nVo7UknirfY5Ov5QYWxgH/JnaejemW2m4Ifr X-Google-Smtp-Source: AGHT+IFI3xqQ04DJCr4fgt2rkNczBgrRuMF+XjrYZsiEycCD9KwV5NY8qm74Z7rXWrRLuu0VvRLwNQ== X-Received: by 2002:a17:903:2450:b0:215:acb3:3786 with SMTP id d9443c01a7336-2292f95da05mr276017305ad.19.1743658469355; Wed, 02 Apr 2025 22:34:29 -0700 (PDT) Received: from gye-ThinkPad-T590.. ([61.108.38.194]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-22978776601sm5537575ad.237.2025.04.02.22.34.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 22:34:29 -0700 (PDT) From: Gyeyoung Baek To: jic23@kernel.org Cc: Gyeyoung Baek , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, lars@metafoo.de, gustavograzs@gmail.com, javier.carrasco.cruz@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Subject: [PATCH v1 4/5] iio: chemical: add support for winsen MHZ19B CO2 sensor Date: Thu, 3 Apr 2025 14:32:24 +0900 Message-Id: <20250403053225.298308-5-gye976@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250403053225.298308-1-gye976@gmail.com> References: <20250403053225.298308-1-gye976@gmail.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add support for winsen MHZ19B CO2 sensor. Datasheet: https://www.winsen-sensor.com/d/files/infrared-gas-sensor/mh-z19b-co2-ver1_0.pdf Signed-off-by: Gyeyoung Baek --- drivers/iio/chemical/Kconfig | 10 + drivers/iio/chemical/Makefile | 1 + drivers/iio/chemical/mhz19b.c | 386 ++++++++++++++++++++++++++++++++++ 3 files changed, 397 insertions(+) create mode 100644 drivers/iio/chemical/mhz19b.c diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig index 330fe0af946f..bb4dfe3986f6 100644 --- a/drivers/iio/chemical/Kconfig +++ b/drivers/iio/chemical/Kconfig @@ -108,6 +108,16 @@ config IAQCORE iAQ-Core Continuous/Pulsed VOC (Volatile Organic Compounds) sensors +config MHZ19B + tristate "MHZ19B CO2 sensor" + depends on SERIAL_DEV_BUS + help + Say Y here to build Serdev binterface support for the MHZ19B + CO2 sensor. + + To compile this driver as a module, choose M here: the module will + be called mhz19b. + config PMS7003 tristate "Plantower PMS7003 particulate matter sensor" depends on SERIAL_DEV_BUS diff --git a/drivers/iio/chemical/Makefile b/drivers/iio/chemical/Makefile index 4866db06bdc9..c63daebf39ac 100644 --- a/drivers/iio/chemical/Makefile +++ b/drivers/iio/chemical/Makefile @@ -15,6 +15,7 @@ obj-$(CONFIG_ENS160) += ens160_core.o obj-$(CONFIG_ENS160_I2C) += ens160_i2c.o obj-$(CONFIG_ENS160_SPI) += ens160_spi.o obj-$(CONFIG_IAQCORE) += ams-iaq-core.o +obj-$(CONFIG_MHZ19B) += mhz19b.o obj-$(CONFIG_PMS7003) += pms7003.o obj-$(CONFIG_SCD30_CORE) += scd30_core.o obj-$(CONFIG_SCD30_I2C) += scd30_i2c.o diff --git a/drivers/iio/chemical/mhz19b.c b/drivers/iio/chemical/mhz19b.c new file mode 100644 index 000000000000..f8f06c01623f --- /dev/null +++ b/drivers/iio/chemical/mhz19b.c @@ -0,0 +1,386 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * mh-z19b co2 sensor driver + * + * Copyright (c) 2025 Gyeyoung Baek + * + * Datasheet: + * https://www.winsen-sensor.com/d/files/infrared-gas-sensor/mh-z19b-co2-ver1_0.pdf + * + * TODO: + * - vin supply regulator + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct mhz19b_state { + struct serdev_device *serdev; + + /* TO DO, nothing for now.*/ + struct regulator *vin_supply; + + /* serdev receive buffer. + * When data is received from the MH-Z19B, + * the 'mhz19b_receive_buf' callback function is called and fills this buffer. + */ + char buf[9]; + int buf_idx; + + /* must wait the 'buf' is filled with 9 bytes.*/ + struct completion buf_ready; + + /* protect access to mhz19b_state */ + struct mutex lock; +}; + +/* + * commands have following format: + * + * +------+------+-----+------+------+------+------+------+-------+ + * | 0xFF | 0x01 | cmd | arg0 | arg1 | 0x00 | 0x00 | 0x00 | cksum | + * +------+------+-----+------+------+------+------+------+-------+ + * + * The following commands are defined in the datasheet. + * https://www.winsen-sensor.com/d/files/infrared-gas-sensor/mh-z19b-co2-ver1_0.pdf + */ +#define MHZ19B_CMD_SIZE 9 + +/* ABC logic in MHZ19B means auto calibration. + */ +#define MHZ19B_ABC_LOGIC_CMD 0x79 +#define MHZ19B_READ_CO2_CMD 0x86 +#define MHZ19B_ZERO_POINT_CMD 0x87 +#define MHZ19B_SPAN_POINT_CMD 0x88 +#define MHZ19B_DETECTION_RANGE_CMD 0x99 + +#define MHZ19B_SERDEV_TIMEOUT msecs_to_jiffies(100) + +static uint8_t mhz19b_get_checksum(uint8_t *packet) +{ + uint8_t i, checksum = 0; + + for (i = 1; i < 8; i++) + checksum += packet[i]; + + checksum = 0xff - checksum; + checksum += 1; + + return checksum; +} + +static int mhz19b_serdev_cmd(struct iio_dev *indio_dev, + int cmd, void *arg) +{ + int ret = 0; + struct mhz19b_state *st = iio_priv(indio_dev); + struct serdev_device *serdev = st->serdev; + struct device *dev = &indio_dev->dev; + + /* commands format is described above. */ + uint8_t cmd_buf[MHZ19B_CMD_SIZE] = { + 0xFF, 0x01, cmd, + }; + + switch (cmd) { + case MHZ19B_ABC_LOGIC_CMD: { + bool enable = *((bool *)arg); + + cmd_buf[3] = enable ? 0xA0 : 0x00; + break; + } case MHZ19B_SPAN_POINT_CMD: { + uint16_t ppm = *((uint16_t *)arg); + + put_unaligned_be16(ppm, &cmd_buf[3]); + break; + } case MHZ19B_DETECTION_RANGE_CMD: { + uint16_t range = *((uint16_t *)arg); + + put_unaligned_be16(range, &cmd_buf[3]); + break; + } default: + break; + } + cmd_buf[MHZ19B_CMD_SIZE - 1] = mhz19b_get_checksum(cmd_buf); + + scoped_guard(mutex, &st->lock) { + /* write buf to uart ctrl syncronously */ + ret = serdev_device_write(serdev, cmd_buf, MHZ19B_CMD_SIZE, 0); + if (ret != MHZ19B_CMD_SIZE) { + dev_err(dev, "write err, %d bytes written", ret); + return -EINVAL; + } + + switch (cmd) { + case MHZ19B_READ_CO2_CMD: + ret = wait_for_completion_interruptible_timeout(&st->buf_ready, + MHZ19B_SERDEV_TIMEOUT); + if (ret < 0) + return ret; + if (!ret) + return -ETIMEDOUT; + + ret = mhz19b_get_checksum(st->buf); + if (st->buf[MHZ19B_CMD_SIZE - 1] != mhz19b_get_checksum(st->buf)) { + dev_err(dev, "checksum err"); + return -EINVAL; + } + + ret = get_unaligned_be16(&st->buf[2]); + return ret; + default: + /* no response commands. */ + return 0; + } + } +} + +static int mhz19b_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + int ret = mhz19b_serdev_cmd(indio_dev, MHZ19B_READ_CO2_CMD, NULL); + + if (ret < 0) + return ret; + + *val = ret; + return IIO_VAL_INT; +} + +/* MHZ19B only supports writing configuration values. */ + +static ssize_t calibration_auto_enable_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + bool enable; + + int ret = kstrtobool(buf, &enable); + + if (ret) + return ret; + + ret = mhz19b_serdev_cmd(indio_dev, MHZ19B_ABC_LOGIC_CMD, &enable); + if (ret < 0) + return ret; + + return len; +} +static IIO_DEVICE_ATTR_WO(calibration_auto_enable, 0); + +/* write 0 : zero point calibration_auto_enable + * (make sure the sensor had been worked under 400ppm for over 20 minutes.) + * + * write 1000-5000 : span point calibration: + * (make sure the sensor had been worked under a certain level co2 for over 20 minutes.) + */ +static ssize_t calibration_forced_value_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + uint16_t ppm; + int cmd; + + int ret = kstrtou16(buf, 10, &ppm); + + if (ret) + return ret; + + /* at least 1000ppm */ + if (ppm) { + if (ppm < 1000 || ppm > 5000) { + dev_dbg(&indio_dev->dev, + "span point ppm should be 1000~5000"); + return -EINVAL; + } + + cmd = MHZ19B_SPAN_POINT_CMD; + } else { + cmd = MHZ19B_ZERO_POINT_CMD; + } + + ret = mhz19b_serdev_cmd(indio_dev, cmd, &ppm); + if (ret < 0) + return ret; + + return len; +} +static IIO_CONST_ATTR(calibration_forced_value_available, + "0 1000-5000"); +static IIO_DEVICE_ATTR_WO(calibration_forced_value, 0); + +/* MH-Z19B supports a measurement range adjustment feature. + * It can measure up to 2000 ppm or up to 5000 ppm. + */ +static ssize_t co2_range_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + int ret; + uint16_t range; + + ret = kstrtou16(buf, 10, &range); + if (ret) + return ret; + + /* Detection Range should be 2000 or 5000 */ + if (!(range == 2000 || range == 5000)) { + dev_dbg(&indio_dev->dev, "detection range should be 2000 or 5000"); + return -EINVAL; + } + + + ret = mhz19b_serdev_cmd(indio_dev, MHZ19B_DETECTION_RANGE_CMD, &range); + if (ret < 0) + return ret; + + return len; +} +static IIO_CONST_ATTR(co2_range_available, + "2000 5000"); +static IIO_DEVICE_ATTR_WO(co2_range, 0); + +static struct attribute *mhz19b_attrs[] = { + &iio_const_attr_calibration_forced_value_available.dev_attr.attr, + &iio_const_attr_co2_range_available.dev_attr.attr, + &iio_dev_attr_calibration_auto_enable.dev_attr.attr, + &iio_dev_attr_calibration_forced_value.dev_attr.attr, + &iio_dev_attr_co2_range.dev_attr.attr, + NULL +}; + +static const struct attribute_group mhz19b_attr_group = { + .attrs = mhz19b_attrs, +}; + +static const struct iio_info mhz19b_info = { + .attrs = &mhz19b_attr_group, + .read_raw = mhz19b_read_raw, +}; + +static const struct iio_chan_spec mhz19b_channels[] = { + { + .type = IIO_CONCENTRATION, + .channel2 = IIO_MOD_CO2, + .modified = 1, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, +}; + +static size_t mhz19b_receive_buf(struct serdev_device *serdev, const u8 *data, size_t len) +{ + struct iio_dev *indio_dev = dev_get_drvdata(&serdev->dev); + struct mhz19b_state *st = iio_priv(indio_dev); + + for (int i = 0; i < len; i++) + st->buf[st->buf_idx++] = data[i]; + + if (st->buf_idx == MHZ19B_CMD_SIZE) { + st->buf_idx = 0; + complete(&st->buf_ready); + } + + return len; +} + +/* The 'serdev_device_write' function returns -EINVAL if the 'write_wakeup' member is NULL, + * so it must be mandatory. + */ +static void mhz19b_write_wakeup(struct serdev_device *serdev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(&serdev->dev); + + dev_dbg(&indio_dev->dev, "mhz19b_write_wakeup"); +} + +static const struct serdev_device_ops mhz19b_ops = { + .receive_buf = mhz19b_receive_buf, + .write_wakeup = mhz19b_write_wakeup, +}; + +static int mhz19b_probe(struct serdev_device *serdev) +{ + int ret; + struct device *dev = &serdev->dev; + struct iio_dev *indio_dev; + struct mhz19b_state *st; + + serdev_device_set_client_ops(serdev, &mhz19b_ops); + + ret = devm_serdev_device_open(dev, serdev); + if (ret) + return ret; + + ret = serdev_device_set_baudrate(serdev, 9600); + if (ret < 0) + return ret; + + /* void type func, no return */ + serdev_device_set_flow_control(serdev, false); + + ret = serdev_device_set_parity(serdev, SERDEV_PARITY_NONE); + if (ret < 0) + return ret; + + indio_dev = devm_iio_device_alloc(dev, sizeof(struct mhz19b_state)); + if (indio_dev == NULL) + return ret; + dev_set_drvdata(dev, indio_dev); + + st = iio_priv(indio_dev); + st->serdev = serdev; + + init_completion(&st->buf_ready); + ret = devm_mutex_init(dev, &st->lock); + if (ret) + return ret; + + /* TO DO: + * - vin supply + */ + + indio_dev->name = "mh-z19b"; + indio_dev->channels = mhz19b_channels; + indio_dev->num_channels = ARRAY_SIZE(mhz19b_channels); + indio_dev->info = &mhz19b_info; + ret = devm_iio_device_register(dev, indio_dev); + if (ret) + return ret; + + return 0; +} + +static const struct of_device_id mhz19b_of_match[] = { + { .compatible = "winsen,mhz19b", }, + { } +}; +MODULE_DEVICE_TABLE(of, mhz19b_of_match); + +static struct serdev_device_driver mhz19b_driver = { + .driver = { + .name = "mhz19b", + .of_match_table = mhz19b_of_match, + }, + .probe = mhz19b_probe, +}; +module_serdev_device_driver(mhz19b_driver); + +MODULE_AUTHOR("Gyeyoung Baek"); +MODULE_DESCRIPTION("MH-Z19B CO2 sensor driver using serdev interface"); +MODULE_LICENSE("GPL v2"); -- 2.34.1 From patchwork Thu Apr 3 05:32:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: gyeyoung X-Patchwork-Id: 14036714 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 6A42019CD1D; Thu, 3 Apr 2025 05:34:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743658475; cv=none; b=eYN94S4RIFwcAQgmxCDaVxj4SiMUYWuc1lpM1jK9etJxbhVNffpVbvwxeSj8KDs0I+vD3ae55YPoSy6PZfdRsxIcRRnV6I9LFr6zfeRak833VE6UaVZ10IJBj7FMZOkH09Y8G/aZzmRt46RmzSk6rZdfe3bIJoQHyoC8FbkSANw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743658475; c=relaxed/simple; bh=Q49KsDhVxmMVF428fpWujXNXfZmzsnwHsWV2ZErI6FQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=GqY0OoklPxXyst3eLWZl8AuWes3g7BfhVP69VA2rKOQXPNf75vX2hmzCVxf97rIbJIlOGjKj6eGyEhTFKU6o5fhFlxav/oXILRs2H7j8VYl43NMSy63QaQj0f++0rEWH4rndIYLXha1t9tHge//VvNWvmzYmg34XrSk5qWJmmOQ= 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=EP9l5hsq; arc=none smtp.client-ip=209.85.214.174 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EP9l5hsq" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-224019ad9edso7215435ad.1; Wed, 02 Apr 2025 22:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743658474; x=1744263274; 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=9BdiurNJ55x7dn380U3JXrTyhKoZwsyqMKnMVKDa2IA=; b=EP9l5hsq0nF7SLtCAUPf+huD5Rrfmf42DeM5YdrfW3YUOSenpvmEoJj+JhrHMUKncG 6092NGNX6EnFXFQBOUQFa9EkdW5v9NABPH/cLRIUWkxJLpiye9m0j+0AdbVD2hu7B7CO krHAgHCrcCxA19Kp8rg/EXkLq3VjJCwlUxlb1eSIkBwX7Phd3co57WmHjAgiWvz1CaFL hikXkoj6tctc7KNbjdWL4rzx6AsROCWLja6CodHv35XycRsEPDexeU3EIRO5t74rFYsn wTGOiLa+dGNuq0xTcnQAXrjfvCq/ZX5TEli5OBmslgAJLjcR/XKFyO1uQrnanzfnFNRw sQIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743658474; x=1744263274; 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=9BdiurNJ55x7dn380U3JXrTyhKoZwsyqMKnMVKDa2IA=; b=XbqpmBcrbTpYUISyCSgeMP5rZNIS5zxAkg0Ls+6bhdInq3/lPQ6lNj9vFIhvJyTyDU RT2uE1H2X8c0SKsiLTomwfSeoWOdlB4IH/zoCDU5OP7yreEdv/rLxLNu/NbuZxeAzvf2 gjls/tBLIZS3RgB0QMxwU3BBz3rzhPVrgtAHEAx38cIgADl/y9Dr2pBrm67SHKaEWkIZ xExJ/ykiZv5OcZi242o1omHzaCdrG2IqpJOGBNfUpgYX91Amr5lSM03qZWVzA0xA+QD4 1Lsh90u8xSi4zwwnarPWZLrpM3CU+5t1tB0LSyjUgyI/wr073h4IDTIucS1K6BunbH0l HD6w== X-Forwarded-Encrypted: i=1; AJvYcCVD6eqxeYJ/JWtZyQSHw9YZ+6oJIPS2zsaSWnpIYi0jcYFrJCgFIwWuvzNE87gQxh4OBq62cbYl/RCX@vger.kernel.org, AJvYcCXbcWYTHCyEXsrx2RsRc4ceKz0fDiKkQinoAJ4CnqvvuqTvM6FdqTrPEt0efVAsrdZFSBrbx+ZKNyK0@vger.kernel.org X-Gm-Message-State: AOJu0Yyr53Ude4DmqBOL+n3jRZ9UP5nWjxtO1R2YqzpkuXv1aQKYkXea FasiK5iQov42KkkKFIXvihTB7JHUmA9Nyy8cfP2tYe1n4SREx/gS X-Gm-Gg: ASbGnct3UrXp+CDAwcepRxVp+SSKas4os2wTFSOSidaURdfb83lYQLI8IKGrVpc2Xwv Pb70dOCHernRMCPslXcj/4VeT+5zuBlKhJ0PZ8RUVJsVWJlUh2/qP1ulh+rDZ/e7RcccrkCSl0g 43SZjWCPYFdBCT0GDxJ/7e5ptWkrj2hTtv3o734dgDOdq1P27pBTFWXGyWXw2WYJcNU/0kSOM99 8NBIlUiyJhLLwfLvlQARlI2BcUk+pUSEys4KflhlgVhZJ/tHW8sU6NwEebt/OmD1F2S7aR8l+IC GZvN0pAnTKPGOy89pUDKppa0WntAxtQ9IdfeHkGE3zWAFowxeQ== X-Google-Smtp-Source: AGHT+IE0jCUBbiXte4mxVAUQfr3gdVPGEcwQRG5dhaoNQC5MY3ydMxteHQWVZHd3j9gF07fyMHuUzg== X-Received: by 2002:a17:902:e88c:b0:215:a179:14ca with SMTP id d9443c01a7336-2296c603a3cmr54082595ad.2.1743658473640; Wed, 02 Apr 2025 22:34:33 -0700 (PDT) Received: from gye-ThinkPad-T590.. ([61.108.38.194]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-22978776601sm5537575ad.237.2025.04.02.22.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 22:34:33 -0700 (PDT) From: Gyeyoung Baek To: jic23@kernel.org Cc: Gyeyoung Baek , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, lars@metafoo.de, gustavograzs@gmail.com, javier.carrasco.cruz@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Subject: [PATCH v1 5/5] MAINTAINERS: Add WINSEN MHZ19B Date: Thu, 3 Apr 2025 14:32:25 +0900 Message-Id: <20250403053225.298308-6-gye976@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250403053225.298308-1-gye976@gmail.com> References: <20250403053225.298308-1-gye976@gmail.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add undersigned as a maintainer for the WINSEN MHZ19B. Signed-off-by: Gyeyoung Baek --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.34.1 diff --git a/MAINTAINERS b/MAINTAINERS index 98e9e318178b..c78c758cd069 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -25615,6 +25615,13 @@ M: David Härdeman S: Maintained F: drivers/media/rc/winbond-cir.c +WINSEN MHZ19B +M: Gyeyoung Baek +S: Maintained +F: Documentation/ABI/testing/sysfs-bus-iio-chemical-mhz19b +F: Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml +F: drivers/iio/chemical/mhz19b.c + WINSYSTEMS EBC-C384 WATCHDOG DRIVER L: linux-watchdog@vger.kernel.org S: Orphan