From patchwork Mon Aug 5 20:31:42 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: 13754048 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 870B51428E4; Mon, 5 Aug 2024 20:31:58 +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=1722889920; cv=none; b=ZisBmz4PmuR7aWIFmUNwbQv4m+EZiBUalDaF14K9gcFkLHg5NkllDjh5I6a6F2EqNxZjhLXTe1gqpy2pYT6UnTeRQXYvf9p6wC53IyHI6CVREVY36163euDDf/pKyHXt16oP/PSSWUon+INra7ybV92ytGl/HMJdk7p+fTav49o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722889920; c=relaxed/simple; bh=4rYFsMje+NZGfL9e7OyJNriJnWdptgF7A8GUj7+GTnY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PLYbijEHsY+ADYH01IUQ3oSU+sz9RtwLuJdtuaiRrW8AkKZEcmD0gHtNoAeDDloWxPt3yQQJTdxLqVLvxVcQsc0lkGKwBVupuJHBsQnfxaax7JIW55lFWWFY+CW6mivG6xH96K6guk8v6ntgHaYgAuD+N4yk1mkHbfa44JdCDMc= 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=OwpboKYH; 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="OwpboKYH" Received: from [192.168.1.90] (86FF4CFD.dsl.pool.telekom.hu [134.255.76.253]) by mail.mainlining.org (Postfix) with ESMTPSA id 368E0E450E; Mon, 5 Aug 2024 20:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mainlining.org; s=psm; t=1722889910; 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=OwpboKYHu++N0PHkffWv3Lg5HXqT7JXs9p4FYmEpRC3T237zJre+msJ63EqZcYttiwx7vS 4MHHMOomZiPXTM1AvJAn9toi9VwlzPMZMfeXeC7CarqwRciv/OtKu9x+vJVea2lg3gnHxv VG2yRZVVBSqm7Pl922LQjRQVBKz6bd/V5suXkJprzt66zC2b0cIueZiyNqNfzq5HNl2G3b g2a2jvWBpouy4+CdjFtktQEt5Nyci8SfCMQJ7nL9BgXxfo1rV5Xpoah+/LzLhsQjUhLffu QOd8McWIdD4rrAM0MeLeL3MWudkt7m2sTZl2DD91wkSEg5mm1vC4hjOq+zSVFw== From: =?utf-8?b?QmFybmFiw6FzIEN6w6ltw6Fu?= Date: Mon, 05 Aug 2024 22:31:42 +0200 Subject: [PATCH 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: <20240805-ak09918-v1-1-70837eebd7d8@mainlining.org> References: <20240805-ak09918-v1-0-70837eebd7d8@mainlining.org> In-Reply-To: <20240805-ak09918-v1-0-70837eebd7d8@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=1722889909; l=1899; i=barnabas.czeman@mainlining.org; s=20240730; h=from:subject:message-id; bh=4rYFsMje+NZGfL9e7OyJNriJnWdptgF7A8GUj7+GTnY=; b=PtRYzzv6kAT2F/SR+1UUL/hc9cVnzyv/9yOnuHPadlHo8jr8W92wFt/5VSqp9hN50Dj+K0PRT 1CF3AcT0mNlARIWOvzrOoMaHvo7HGbLrxim+gE7lTH8DSgZ+6KUrprO 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 Mon Aug 5 20:31:43 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: 13754049 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 870E7143C4B; Mon, 5 Aug 2024 20:31:58 +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=1722889920; cv=none; b=XpMLTeii0jSFOt1jeZcxlpNJEkPz2+ESphn+4dWtxLn/kwm1z4Ul1s+xS0LabG31JA5FaHh8pvQOR/+u5YlL+QeUFVBIAKUGAL9/bu9rZ6YDTUYbUnaR5Bd+UaCSIS5dmdJRNMK5RW27qjsszIwhKZrgnIRmJqXOv+VuR5kamTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722889920; c=relaxed/simple; bh=+SXTIe3f9S9YtLjpDF3jRC9wGFSwxnS1+ANtFERZKss=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UKqUoUCXwniM0MWcBiblA+Dr5+gpUA2Hxi2MhQbNCQYqIZbebSih/EOZ9ZsxY82KcBh1aqTu+nSg3ZZCCN3qQcM/IwObPHWkHAiMOMHrTtfRzs6W1BIRbe6haYlZK7W5l/FejwN+TGlVn1qbe849WgL/L9DQrXn7n2R5GW+aRmM= 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=oJshHzU1; 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="oJshHzU1" Received: from [192.168.1.90] (86FF4CFD.dsl.pool.telekom.hu [134.255.76.253]) by mail.mainlining.org (Postfix) with ESMTPSA id E7CD1E4518; Mon, 5 Aug 2024 20:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mainlining.org; s=psm; t=1722889911; 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=Jr7SpfDFS9+WtsvUSprOh+Q497G+LRPTnkvvNlcphQ8=; b=oJshHzU1v29gG+ZxTKAF91XOkDbV+UXG1M8ZuhKJ0+RFLoeuAxDm9LefFsFglc607EjvYp AWVJvDEPOKM4ju3EsUh7LzMkdk2JKgE2t6PeLhG/e3AeRWnsQFpEQMHaGC/PsdQVWLEXBm gXncvjuEG0CRTwzFI3f8YCM3BFTyL13lVJkrAnAH8yrQw9aqxIgyPKZYtRH56jJQsydrLy 3vbWzApZE2/EhdGuJxe7VBmWd294xrzck1/HPHVmQssdbqcP+pRJxSvJe47d7F+yPsd2LW TFYOnf4b5xMwZV8a0/EMI0uy/P2ZmvAPRLzMtCIwr9z0fTRWA7J6m181UBGs4A== From: =?utf-8?b?QmFybmFiw6FzIEN6w6ltw6Fu?= Date: Mon, 05 Aug 2024 22:31:43 +0200 Subject: [PATCH 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: <20240805-ak09918-v1-2-70837eebd7d8@mainlining.org> References: <20240805-ak09918-v1-0-70837eebd7d8@mainlining.org> In-Reply-To: <20240805-ak09918-v1-0-70837eebd7d8@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=1722889909; l=1027; i=barnabas.czeman@mainlining.org; s=20240730; h=from:subject:message-id; bh=2sJy5WfIbNskIVyW23EqSE1dEhalHShmGhVggS+O8so=; b=gpAXqOd+S+IErU4kFNRkQOSSARuxcqd4fxhbl3snMF9m3SOYQO8LXR9BRHKjwyp/tM2s8nWmK pO6ZhxynDk3B1jz1zPRnDPlkEenqam0tgFTnQ9RTdCWsbcknAmSdxsh 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 --- .../devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml index 9790f75fc669..67c60abbfcf0 100644 --- a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +++ b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml @@ -18,12 +18,14 @@ properties: - asahi-kasei,ak09911 - asahi-kasei,ak09912 - asahi-kasei,ak09916 + - asahi-kasei,ak09918 - enum: - ak8975 - ak8963 - ak09911 - ak09912 - ak09916 + - ak09918 deprecated: true reg: From patchwork Mon Aug 5 20:31:44 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: 13754050 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 4D817145FE2; Mon, 5 Aug 2024 20:31:59 +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=1722889921; cv=none; b=cZ64Pdyx27+dVcr8rjRbtA4O9SwvA6bt3gC78Z7u3MW/+ndnZ6XnlKYwsDFlQ5IVoQW5g0djKWR0cN040sDl2FAKXGbZdQqZ59hO+a6cHtV3qYMpkc1lcJiefldBWWXssFG6hO5e+Qd3/igfs6jmFNK/EcEwRZD0HWXhK/6DVwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722889921; c=relaxed/simple; bh=iKlmqjTTVUIVzdWep4q0Un0kla+81/3zrI9ztK0YyNg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K2qOi1i7QewsQXNMNAC59SXj1IiTdgDLHvS9VKzQgcwWxrUX9FEgwKeYRGaiDl/EEViINJC9ifal3RG9QQxOo8XLcweV+P7EFo6DKkSSexjTvvB5VZ0aH04rPPR+TQhyCE6S7NkXK76POM3ORqXAprphSL437nRX+//86kKyfPM= 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=cnaAnsJQ; 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="cnaAnsJQ" Received: from [192.168.1.90] (86FF4CFD.dsl.pool.telekom.hu [134.255.76.253]) by mail.mainlining.org (Postfix) with ESMTPSA id A7779E4519; Mon, 5 Aug 2024 20:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mainlining.org; s=psm; t=1722889911; 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=z0q+GusqWBUe2EzSPu3nKa1GVJny5raM0Sw0sxXHXa0=; b=cnaAnsJQ1TdwY9RxdVsyYj/TiAdQuv7z2UD3v+sDGlc/RporTHlfD0zCIR3JtYN3UNeMhM iMs4qUZoShyRCqlPrqg/6PvohVgVzj8fe2JgVr2VhroYRabhfmthbG3lHApRiXiCsyIDSJ gy/L/1Yx54wLf1bADw6n7HqBs5jq4Vqk6kHKwHcuLFHBUWy8Xu1iNiFjiN2iYtDBRj7Rum +J7ePjYZqc83aWxlm9socggnrQJBHJPZj25Hd5580CBfQuRWHklelfwqidcrzCALdf96mG nfEFVFTvK4CWDz2q+Gh0Q1Ic16yH8GnOi6a5kZ/qPSZUX0t+OOb7PQjtfIGGpg== From: =?utf-8?b?QmFybmFiw6FzIEN6w6ltw6Fu?= Date: Mon, 05 Aug 2024 22:31:44 +0200 Subject: [PATCH 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: <20240805-ak09918-v1-3-70837eebd7d8@mainlining.org> References: <20240805-ak09918-v1-0-70837eebd7d8@mainlining.org> In-Reply-To: <20240805-ak09918-v1-0-70837eebd7d8@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=1722889909; l=3804; i=barnabas.czeman@mainlining.org; s=20240730; h=from:subject:message-id; bh=IIAIm5BL+K1epLT5q5KDQJEdRvERDnrX+8Qw+YI7cVI=; b=gvsA+k6VoD7c5Q3V/+/+yNXQk4CrZ3JPV62gc9qAySktINTuRVicgjsijcEyyzSmgnHLBEbEe ybSLTMF1XcxB4B5wAl5NIObVxOb8s+BegqL4U6+U898cqqWzz2E0U97 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 --- drivers/iio/magnetometer/Kconfig | 2 +- drivers/iio/magnetometer/ak8975.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 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..de1ba7f48b4b 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,8 @@ 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] }, + { .compatible = "ak09918", .data = &ak_def_array[AK09918] }, {} }; MODULE_DEVICE_TABLE(of, ak8975_of_match);