From patchwork Tue Aug 6 06:10:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QmFybmFiw6FzIEN6w6ltw6Fu?= X-Patchwork-Id: 13754471 Received: from mail.mainlining.org (mail.mainlining.org [5.75.144.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C3EA1BC085; Tue, 6 Aug 2024 06:10:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.75.144.95 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722924626; cv=none; b=UDgZFpiQpsnwEil5ao40xc/BOhDBtpW80LkuMwxgbaSFSAPs0wxRLFXgcX+3bno4Xlc+rTWnl6ZbMgtpjSmO9GOpbFsI6GA7z6BZNRln9iNKUD0+F+/Rh/8Ap7kxxwTKQYKhcS9gqIK5nG2x4OpjAg/UTpsXAebWjeHrRPIL5TE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722924626; c=relaxed/simple; bh=4rYFsMje+NZGfL9e7OyJNriJnWdptgF7A8GUj7+GTnY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HEwYD9bZ0/4JGmXSVheIdmMa2l+xJ8EznpuLjO0I677nDHPKCY3qs6AxRqf0Jo41m3MIILDo6G2ku5s4DQW0AMruHvX53eu00RyuYIGZaUxAOr+gR55ja3BnVSM9/fJtAYw9nfiIvv6K88kRGCCA0sCGUsFqk7rVVTdEkTUfpHM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mainlining.org; spf=pass smtp.mailfrom=mainlining.org; dkim=pass (2048-bit key) header.d=mainlining.org header.i=@mainlining.org header.b=Ooc6NDsO; arc=none smtp.client-ip=5.75.144.95 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mainlining.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mainlining.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mainlining.org header.i=@mainlining.org header.b="Ooc6NDsO" Received: from [192.168.1.90] (86FF4CFD.dsl.pool.telekom.hu [134.255.76.253]) by mail.mainlining.org (Postfix) with ESMTPSA id 26702E450E; Tue, 6 Aug 2024 06:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mainlining.org; s=psm; t=1722924622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fwbnq+5yNmFaQ5aTCbNjKdWw69NnDfl+wFQPeG16EVo=; b=Ooc6NDsOuKr6/v1ohze4DKCmOGyjS8THzYfpATJUyRNMIlDFq5nNdQtZMUkeVKGJWNXi9W UGMSE+d8p3wOZ5+To8KPPVL95pLXMIuf+XyfuwgcsHXEsuIfh0UFUff3xvoFIJmyNEzWY/ 5iANrn74HmxeHYbi2fdw8bytO/uMZg5btS3JgRGNYSsdzf80bLnaYadxJHaCSEK8pE55xz XF80NI9UL0b92iBSOxb2dEdLs5BMTEECmqHq0/FONhV2mSAXDz7J60mTPp922KzEYJopOV y2wvPdQz7hQQyNbwC0i5pie1IuYoew8uB/bKjt4+NHMyIWOLgEqtFjHDaFzdAw== From: =?utf-8?b?QmFybmFiw6FzIEN6w6ltw6Fu?= Date: Tue, 06 Aug 2024 08:10:18 +0200 Subject: [PATCH v2 1/3] iio: magnetometer: ak8975: Fix reading for ak099xx sensors Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240806-ak09918-v2-1-c300da66c198@mainlining.org> References: <20240806-ak09918-v2-0-c300da66c198@mainlining.org> In-Reply-To: <20240806-ak09918-v2-0-c300da66c198@mainlining.org> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Albrieux Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux@mainlining.org, =?utf-8?b?QmFybmFiw6Fz?= =?utf-8?b?IEN6w6ltw6Fu?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722924621; l=1899; i=barnabas.czeman@mainlining.org; s=20240730; h=from:subject:message-id; bh=4rYFsMje+NZGfL9e7OyJNriJnWdptgF7A8GUj7+GTnY=; b=sp2pfATD7yxX5yYWArvJWdIUj65ui5i9OD9Y3AdAL0XwqvLsrFw7iZ46myuzhJAFS45rim+q5 q6j7w349wPQC+QKB/hNdeOBCOu7Bxl3VwhpXfryDyog3h/De7GEQAIT X-Developer-Key: i=barnabas.czeman@mainlining.org; a=ed25519; pk=TWUSIGgwW/Sn4xnX25nw+lszj1AT/A3bzkahn7EhOFc= ST2 register read should be placed after read measurment data, because it will get correct values after it. Signed-off-by: Barnabás Czémán --- drivers/iio/magnetometer/ak8975.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index dd466c5fa621..925d76062b3e 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -692,22 +692,7 @@ static int ak8975_start_read_axis(struct ak8975_data *data, if (ret < 0) return ret; - /* This will be executed only for non-interrupt based waiting case */ - if (ret & data->def->ctrl_masks[ST1_DRDY]) { - ret = i2c_smbus_read_byte_data(client, - data->def->ctrl_regs[ST2]); - if (ret < 0) { - dev_err(&client->dev, "Error in reading ST2\n"); - return ret; - } - if (ret & (data->def->ctrl_masks[ST2_DERR] | - data->def->ctrl_masks[ST2_HOFL])) { - dev_err(&client->dev, "ST2 status error 0x%x\n", ret); - return -EINVAL; - } - } - - return 0; + return !(ret & data->def->ctrl_masks[ST1_DRDY]); } /* Retrieve raw flux value for one of the x, y, or z axis. */ @@ -731,6 +716,20 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) ret = i2c_smbus_read_i2c_block_data_or_emulated( client, def->data_regs[index], sizeof(rval), (u8*)&rval); + ret = i2c_smbus_read_byte_data(client, + data->def->ctrl_regs[ST2]); + if (ret < 0) { + dev_err(&client->dev, "Error in reading ST2\n"); + goto exit; + } + + if (ret & (data->def->ctrl_masks[ST2_DERR] | + data->def->ctrl_masks[ST2_HOFL])) { + dev_err(&client->dev, "ST2 status error 0x%x\n", ret); + ret = -EINVAL; + goto exit; + } + if (ret < 0) goto exit; From patchwork Tue Aug 6 06:10:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QmFybmFiw6FzIEN6w6ltw6Fu?= X-Patchwork-Id: 13754472 Received: from mail.mainlining.org (mail.mainlining.org [5.75.144.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58292173355; Tue, 6 Aug 2024 06:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.75.144.95 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722924626; cv=none; b=uDl9Y86DT2XzH1TCMO/D1TmVOAFfHQSGwPWl/O06gjpu/+HbNZwIseOtR5a0R/rrjieN3p2lKJTxm9AM+HnjKio1lC28zfsXL9s4kiO25ryLejubRaeATEGFEeLAGtNjZm9W/hmj3a2yNRcwdjHRvNbANKxLZNBit0dpE86fKEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722924626; c=relaxed/simple; bh=/aR0rd0XPcnGk9sgCYTOVDuWkg0jv1QW76X2UGj+JVI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qW5WTbRBuwZM2RDDMWSSy4Xs/ybKB8RgkSVRD51MUArKISwwEm1H6lqFmFhBP7M2DMMrtLNQ8wsO+Mh6pyXt4suhIF0eP75/j7nBnJqwMrDdBCoJqNf4pUUZrICK+6pdF8IVmCbnaOGkmX3OGILnrZxefgKYzMuil7MIVadC2oA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mainlining.org; spf=pass smtp.mailfrom=mainlining.org; dkim=pass (2048-bit key) header.d=mainlining.org header.i=@mainlining.org header.b=sE4ztBlt; arc=none smtp.client-ip=5.75.144.95 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mainlining.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mainlining.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mainlining.org header.i=@mainlining.org header.b="sE4ztBlt" Received: from [192.168.1.90] (86FF4CFD.dsl.pool.telekom.hu [134.255.76.253]) by mail.mainlining.org (Postfix) with ESMTPSA id AE47EE4518; Tue, 6 Aug 2024 06:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mainlining.org; s=psm; t=1722924623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IJZUmn7JyGIcTWkU35zRShPZwpKokJ9nyUFL88PGBxY=; b=sE4ztBltpjGLHhU3n9JW+B3KWHAx30jeMpXxToFLstxxLiScyDWuAu7beYpErx8oUD7g2a +Bx0k9OSdjt7NT/W4fSQSffRCmCcyF9/KRFF8wLb2SGxFeRv7oqO+P2NlY0481SXCYTvnW iSJQQzICG5koZBG+0ER8YaowXTvmNero2loUr7y4uV1qL+HIVCPI8vT4qDxWevZ1vyMZPk dIR34lYtvAWi+eBYGqM9BXBG2mO5SP0CrmHyTGdGJ59hOhE7pzaGJdlriunU7pTrdsDKoh SezniZjNf40Ddv21JngObuTvpz4KgTFZEMPL5u+0C7aJMKsPy52MF2NrU/x6EQ== From: =?utf-8?b?QmFybmFiw6FzIEN6w6ltw6Fu?= Date: Tue, 06 Aug 2024 08:10:19 +0200 Subject: [PATCH v2 2/3] dt-bindings: iio: imu: magnetometer: Add ak09118 Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240806-ak09918-v2-2-c300da66c198@mainlining.org> References: <20240806-ak09918-v2-0-c300da66c198@mainlining.org> In-Reply-To: <20240806-ak09918-v2-0-c300da66c198@mainlining.org> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Albrieux Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux@mainlining.org, =?utf-8?b?QmFybmFiw6Fz?= =?utf-8?b?IEN6w6ltw6Fu?= , Danila Tikhonov X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722924621; l=897; i=barnabas.czeman@mainlining.org; s=20240730; h=from:subject:message-id; bh=J/+B3b4VjBRnoZnfNcIcJo3x+qavQtylTR6VOAYGePc=; b=4PeA/OAMZmPLjGTgMN0DI/lUhq0/mli9saFlv7JmGiSnbu640SaEeHVLYyUxqmmENUyXRQ/Q/ z/3MPfQ5jOYBz2JvERfXIwVihstC+HBpzMjUp1+OoHZuF2GROMe6U4v X-Developer-Key: i=barnabas.czeman@mainlining.org; a=ed25519; pk=TWUSIGgwW/Sn4xnX25nw+lszj1AT/A3bzkahn7EhOFc= From: Danila Tikhonov Document asahi-kasei,ak09918 compatible. Signed-off-by: Danila Tikhonov Signed-off-by: Barnabás Czémán Reviewed-by: Krzysztof Kozlowski --- .../devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml index 9790f75fc669..583cdd2fad7e 100644 --- a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +++ b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml @@ -18,6 +18,7 @@ properties: - asahi-kasei,ak09911 - asahi-kasei,ak09912 - asahi-kasei,ak09916 + - asahi-kasei,ak09918 - enum: - ak8975 - ak8963 From patchwork Tue Aug 6 06:10:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QmFybmFiw6FzIEN6w6ltw6Fu?= X-Patchwork-Id: 13754473 Received: from mail.mainlining.org (mail.mainlining.org [5.75.144.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85F111BA87B; Tue, 6 Aug 2024 06:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.75.144.95 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722924627; cv=none; b=Z4/Md6dX8NVA2Nj1BNUtxdXF93emvja/fh4TkZqgBvMsesyDhQwdTApl2wEhQpw4EGXg6AB31z7BB+gwBVPmTUDyEXoRXyVbjhtEtoyx/SZPTVMhsMI19VNq9sL/1Jx/qQazbxY7r14c9hzu6jHMo1LQTjJTq31ktb4FBhXZFyE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722924627; c=relaxed/simple; bh=aPKE4/8trXpSquPAIuTqESMHokl3vhV6kOilccBLWLU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L+0Vkd0Zd2DRpCG9+uw3sKp05ly5mCxos6LUJUCZfWvDlojGOYDS35JhedJunpG9NiE5q56m7QjWK8NdWuMiqsFbGsRItqefpLXXEAgeyDy8874l9HUmXOeTfXBxg8SQeqS4oLPni0fEvftyZ5bSDiWoszdwjvTsv9lXaUwjBf8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mainlining.org; spf=pass smtp.mailfrom=mainlining.org; dkim=pass (2048-bit key) header.d=mainlining.org header.i=@mainlining.org header.b=nYIcZwLk; arc=none smtp.client-ip=5.75.144.95 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mainlining.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mainlining.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mainlining.org header.i=@mainlining.org header.b="nYIcZwLk" Received: from [192.168.1.90] (86FF4CFD.dsl.pool.telekom.hu [134.255.76.253]) by mail.mainlining.org (Postfix) with ESMTPSA id 68C8EE4519; Tue, 6 Aug 2024 06:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mainlining.org; s=psm; t=1722924623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HNDFTztkXS/sedAHfU7QWiVYU7fhTTZK67e1Wh/UHys=; b=nYIcZwLkUKiwoJb2zyWMv/9j+CA4ShgUmHPCFSvw9Mft4YOLL924aq96uYLs6qNbaisyFm yhiLNcKjXIwNUyZISfQEb1MaRRwvReAsBx8dwCVZawGx0xT+22yHAewihcncY2LRmSA6me rk9fQXK7MfLS8svvSm4fL2WEBLibXP5HFVaT+gLw5/gD9K5mY4NxPAhTaRB8B9Itm0Huqv 7OaNZohiky5BNUzNIVcf9YRQjUR/pMkCaYnOti3bTt9GYGZ0eoyusYHB+/rj6ADI9dwN9B yfTYk3fVGqBsnzfao5wF2LM67f1ukCzyF8D1uA3uvkq1WZttqCZFAJ8Rq8QvUw== From: =?utf-8?b?QmFybmFiw6FzIEN6w6ltw6Fu?= Date: Tue, 06 Aug 2024 08:10:20 +0200 Subject: [PATCH v2 3/3] iio: magnetometer: ak8975: Add AK09118 support Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240806-ak09918-v2-3-c300da66c198@mainlining.org> References: <20240806-ak09918-v2-0-c300da66c198@mainlining.org> In-Reply-To: <20240806-ak09918-v2-0-c300da66c198@mainlining.org> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Albrieux Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux@mainlining.org, =?utf-8?b?QmFybmFiw6Fz?= =?utf-8?b?IEN6w6ltw6Fu?= , Danila Tikhonov X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722924621; l=3739; i=barnabas.czeman@mainlining.org; s=20240730; h=from:subject:message-id; bh=Xdbc05wTk5VMNycxtvRYoLhMwu6ggaU3k/NJrqplOAk=; b=V5GXI3sTfYh5s+9b/YeC3DxjPQrm1MgP46/7ofTwuKbt6dQ7T+KtWyqJcrUfK9dBmg9eTrtnE KdNUwcSWpSkDVYDPyOwn3dtq1awE++nz+tRHyeVvTK5CeCcgflGHd8M X-Developer-Key: i=barnabas.czeman@mainlining.org; a=ed25519; pk=TWUSIGgwW/Sn4xnX25nw+lszj1AT/A3bzkahn7EhOFc= From: Danila Tikhonov Add additional AK09118 to the magnetometer driver which has the same register mapping and scaling as the AK09112 device. Signed-off-by: Danila Tikhonov Signed-off-by: Barnabás Czémán Acked-by: Krzysztof Kozlowski --- drivers/iio/magnetometer/Kconfig | 2 +- drivers/iio/magnetometer/ak8975.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/iio/magnetometer/Kconfig b/drivers/iio/magnetometer/Kconfig index cd2917d71904..8eb718f5e50f 100644 --- a/drivers/iio/magnetometer/Kconfig +++ b/drivers/iio/magnetometer/Kconfig @@ -39,7 +39,7 @@ config AK8975 select IIO_TRIGGERED_BUFFER help Say yes here to build support for Asahi Kasei AK8975, AK8963, - AK09911, AK09912 or AK09916 3-Axis Magnetometer. + AK09911, AK09912, AK09916 or AK09918 3-Axis Magnetometer. To compile this driver as a module, choose M here: the module will be called ak8975. diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 925d76062b3e..9871fea67ae3 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -78,6 +78,7 @@ */ #define AK09912_REG_WIA1 0x00 #define AK09912_REG_WIA2 0x01 +#define AK09918_DEVICE_ID 0x0C #define AK09916_DEVICE_ID 0x09 #define AK09912_DEVICE_ID 0x04 #define AK09911_DEVICE_ID 0x05 @@ -209,6 +210,7 @@ enum asahi_compass_chipset { AK09911, AK09912, AK09916, + AK09918, }; enum ak_ctrl_reg_addr { @@ -371,6 +373,31 @@ static const struct ak_def ak_def_array[] = { AK09912_REG_HXL, AK09912_REG_HYL, AK09912_REG_HZL}, + }, + [AK09918] = { + .type = AK09918, + .raw_to_gauss = ak09912_raw_to_gauss, + .range = 32752, + .ctrl_regs = { + AK09912_REG_ST1, + AK09912_REG_ST2, + AK09912_REG_CNTL2, + AK09912_REG_ASAX, + AK09912_MAX_REGS}, + .ctrl_masks = { + AK09912_REG_ST1_DRDY_MASK, + AK09912_REG_ST2_HOFL_MASK, + 0, + AK09912_REG_CNTL2_MODE_MASK}, + .ctrl_modes = { + AK09912_REG_CNTL_MODE_POWER_DOWN, + AK09912_REG_CNTL_MODE_ONCE, + AK09912_REG_CNTL_MODE_SELF_TEST, + AK09912_REG_CNTL_MODE_FUSE_ROM}, + .data_regs = { + AK09912_REG_HXL, + AK09912_REG_HYL, + AK09912_REG_HZL}, } }; @@ -452,6 +479,7 @@ static int ak8975_who_i_am(struct i2c_client *client, /* * Signature for each device: * Device | WIA1 | WIA2 + * AK09918 | DEVICE_ID_| AK09918_DEVICE_ID * AK09916 | DEVICE_ID_| AK09916_DEVICE_ID * AK09912 | DEVICE_ID | AK09912_DEVICE_ID * AK09911 | DEVICE_ID | AK09911_DEVICE_ID @@ -484,6 +512,10 @@ static int ak8975_who_i_am(struct i2c_client *client, if (wia_val[1] == AK09916_DEVICE_ID) return 0; break; + case AK09918: + if (wia_val[1] == AK09918_DEVICE_ID) + return 0; + break; default: dev_err(&client->dev, "Type %d unknown\n", type); } @@ -1066,6 +1098,7 @@ static const struct i2c_device_id ak8975_id[] = { {"ak09911", (kernel_ulong_t)&ak_def_array[AK09911] }, {"ak09912", (kernel_ulong_t)&ak_def_array[AK09912] }, {"ak09916", (kernel_ulong_t)&ak_def_array[AK09916] }, + {"ak09918", (kernel_ulong_t)&ak_def_array[AK09918] }, {} }; MODULE_DEVICE_TABLE(i2c, ak8975_id); @@ -1081,6 +1114,7 @@ static const struct of_device_id ak8975_of_match[] = { { .compatible = "ak09912", .data = &ak_def_array[AK09912] }, { .compatible = "asahi-kasei,ak09916", .data = &ak_def_array[AK09916] }, { .compatible = "ak09916", .data = &ak_def_array[AK09916] }, + { .compatible = "asahi-kasei,ak09918", .data = &ak_def_array[AK09918] }, {} }; MODULE_DEVICE_TABLE(of, ak8975_of_match);