From: Jakob Hauser <jahau@rocketmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Hans de Goede <hdegoede@redhat.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
phone-devel@vger.kernel.org,
~postmarketos/upstreaming@lists.sr.ht,
Jakob Hauser <jahau@rocketmail.com>
Subject: [PATCH v4 00/10] Add support for magnetometer Yamaha YAS537
Date: Mon, 4 Jul 2022 00:02:34 +0200 [thread overview]
Message-ID: <cover.1656883851.git.jahau@rocketmail.com> (raw)
In-Reply-To: cover.1656883851.git.jahau.ref@rocketmail.com
This patchset adds YAS537 variant to the already existing driver for
Yamaha YAS magnetometers.
Patch 1 is a fix on the current driver.
Patches 2-9 are cleanups and refactoring.
Patch 10 finally adds the YAS537 variant.
Patch 9 adds the "chip_info" approach. As this change is quite extensive, it
might need some more discussion and refinement. Also the patchset as such.
However, applying that patch late in the patchset allows a good traceability
how the other changes were introduced.
By adding patch 9 (chip_info), some of the review comments on the last patchset
became obsolete:
- Patch 8 v3: Comment "Can't return here, because you leave the PM counters
imbalanced."
- Patch 8 v3: Comment on strncpy() vs. strscpy(),
- Patch 8 v3: "fall through" comment at function yas5xx_volatile_reg().
- Patch 8 v3: Empty line between "break" and "default" within switch statement
of function yas5xx_probe().
Changes in v4:
- Rebased to torvalds/linux v5.19-rc4, as this now includes Linus' patch
"Fix memchr_inv() misuse" on driver yamaha-yas530.
- Removed redundant Cc tags.
- Patch 2: Replaced "<= ... + 7" by "< ... + 8" and adapted commit message.
- Patch 3: Added default for switch statement, I forgot to add this.
- Patch 4: In function yas5xx_get_measure(), changed wording "milli degrees"
to "millidegrees".
- Patch 6: Changed the renaming of function from "yas530_532_" to "yas530_".
Same for registers. Added additional comments where appropriate.
- Patch 6: Removed "Reviewed-by:" tag of Andy.
- Split patch 7 v3 into two patches -> patch 7 v4 and patch 8 v4.
- Patch 8: Applied "if (a && b)" suggestion at memchr_inv() by Andy in
function yas532_get_calibration_data().
- Patch 8: Removed defines for device IDs YAS537 and YAS539 and accordingly
the comment "These variant IDs are known from code dumps".
- Patch 9: New patch to introduce the "chip_info" approach.
- Patch 10: In function yas537_get_calibration_data(), removed "the exact
meaning is unknown" from comment "Writing SRST register".
- Patch 10: Also applied "if (a && b)" suggestion at memchr_inv() by Andy
in function yas537_get_calibration_data(). Additionally changed the second
condition from "== 0" to "!".
- Patch 10: In function yas537_get_calibration_data(), removed empty lines
within switch statement. In that context, removed comment "Get data into
these four blocks val1 to val4".
- Patch 10: In Kconfig, simplified wording.
- Patch 10: In function yas537_get_calibration_data() "case YAS537_VERSION_0",
reduced indent of "for" loop by splitting it into multiple loops. I didn't
use integer j, as it was suggested by Jonathan, because only using integer i
is more consistant with the loop in "case YAS537_VERSION_1".
- Accordingly, split the "for" loop in "case YAS537_VERSION_1" into two loops
as well. Technically this isn't neccessary but it improves readability.
- Patch 10: Added new defines of masks for YAS537 and applied these by
FIELD_PREP and FIELD_GET in function yas537_get_calibration_data()
within "case YAS537_VERSION_1".
- Patch 10: In function yas537_power_on(), added spaced at "YAS537_ADCCAL + 1".
Changes in v3:
- In patch 3 fixed 2x typo "Divide".
- In commit message of patch 4 fixed wording "in the yas5xx_get_measure()
function".
- In patch 4 in the comment for the temperature calculation fixed wording
"is the number of counts".
- In patch 4 added defaults to switch statements.
- Splitted stray changes into new patch 7 v3. "Add YAS537 variant" is now
patch 8 v3. I haven't added "Reviewed-by:" tag of Linus to patch 7 v3
because as a separate patch these changes appear in a different context.
- In new patch 7 v3, changed printk format specifiers in the function
yas530_get_calibration_data() to "%16ph" and in the function
yas532_get_calibration_data() to "%14ph". The first one is also a minor
correction in behaviour, as the calibration data array size of YAS530
is 16 (the dev_dbg printed 14 before).
- Rebased to linux-next to include patch bb52d3691db8 "iio: magnetometer:
yas530: Fix memchr_inv() misuse".
- In patch 7 v3, changed memchr_inv() line for YAS532.
- In patch 8 v3 in the function yas537_get_calibration_data(), changed
memchr_inv() line for YAS537.
- Removed comment "corresponds to 0x70" at define YAS537_MAG_AVERAGE_32_MASK.
- Added suffixes _US and _MS in defines for YAS537.
- In the function yas537_measure(), removed comments "Read data", "Arrange
data", "Assign data".
- In the function yas537_measure(), replaced bitwise shift by
get_unaligned_be16().
- Replaced "if (h[i] < -8192)" etc. by clamp_val().
- In the functions yas537_measure() and yas537_get_measure(), replaced 8192
by BIT(13) and 16384 by BIT(14).
- Fixed typo "resolution" in the function yas5xx_read_raw().
- Fixed typo "Divide" in patch 8 v3 in the function yas5xx_read_raw().
- In patch 8 v3 in the yas537_get_calibration_data(), changed printk format
specifier to "%17ph"
- In the functions yas537_measure() and yas537_get_calibration_data(), drop
some parentheses in regmap_write().
- In the function yas537_power_on(), added comment "Wait until the coil has
ramped up".
- In the function yas5xx_probe(), put YAS537 variant and version printings
into one print.
- In the function yas537_get_measure(), fixed wording "is the number of
counts" in the comment for the temperature calculation.
- In the function yas537_get_measure(), added product description document No.
into the comment for the temperature calculation (as I first thought the
review comment "the number" is related to this).
- In the function yas537_get_calibration_data(), corrected comment "Get data
into these four blocks val1 to val4".
Changes in v2:
- Reordered the patchset by moving patch 4 v1 to patch 1 v2.
- Removed patch 6 v1 ("Remove redundant defaults on switch devid")
- Accordingly, added "default:" to each switch statement in patch 7.
- Moved renamings in patch 7 v1 into a separate new patch 6 v2. I added
the "Reviewed-by:" tag of Linus to both patches, hope that's ok, else
feel free to comment.
- Removed regmap reads and related debug dumps in patch 7 in function
yas537_dump_calibration(). As this function now applies to version 1
only, replaced switch statement by if clause.
- Also removed "hard_offsets" debug dumps in that function.
- Fixed typo "initialized" in commit message of patch 7.
Jakob Hauser (10):
iio: magnetometer: yas530: Change data type of hard_offsets to signed
iio: magnetometer: yas530: Change range of data in volatile register
iio: magnetometer: yas530: Correct scaling of magnetic axes
iio: magnetometer: yas530: Correct temperature handling
iio: magnetometer: yas530: Change data type of calibration
coefficients
iio: magnetometer: yas530: Rename functions and registers
iio: magnetometer: yas530: Move printk %*ph parameters out from stack
iio: magnetometer: yas530: Apply documentation and style fixes
iio: magnetometer: yas530: Introduce "chip_info" structure
iio: magnetometer: yas530: Add YAS537 variant
drivers/iio/magnetometer/Kconfig | 4 +-
drivers/iio/magnetometer/yamaha-yas530.c | 808 +++++++++++++++++++----
2 files changed, 680 insertions(+), 132 deletions(-)
--
2.35.1
next parent reply other threads:[~2022-07-03 22:03 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1656883851.git.jahau.ref@rocketmail.com>
2022-07-03 22:02 ` Jakob Hauser [this message]
2022-07-03 22:02 ` [PATCH v4 01/10] iio: magnetometer: yas530: Change data type of hard_offsets to signed Jakob Hauser
2022-07-03 22:02 ` [PATCH v4 02/10] iio: magnetometer: yas530: Change range of data in volatile register Jakob Hauser
2022-07-03 22:02 ` [PATCH v4 03/10] iio: magnetometer: yas530: Correct scaling of magnetic axes Jakob Hauser
2022-07-03 22:02 ` [PATCH v4 04/10] iio: magnetometer: yas530: Correct temperature handling Jakob Hauser
2022-07-03 22:02 ` [PATCH v4 05/10] iio: magnetometer: yas530: Change data type of calibration coefficients Jakob Hauser
2022-07-03 22:02 ` [PATCH v4 06/10] iio: magnetometer: yas530: Rename functions and registers Jakob Hauser
2022-07-04 18:04 ` Andy Shevchenko
2022-07-26 21:40 ` Jakob Hauser
2022-07-03 22:02 ` [PATCH v4 07/10] iio: magnetometer: yas530: Move printk %*ph parameters out from stack Jakob Hauser
2022-07-04 18:06 ` Andy Shevchenko
2022-07-03 22:02 ` [PATCH v4 08/10] iio: magnetometer: yas530: Apply documentation and style fixes Jakob Hauser
2022-07-04 18:07 ` Andy Shevchenko
2022-07-04 23:29 ` Linus Walleij
2022-07-03 22:04 ` [PATCH v4 09/10] iio: magnetometer: yas530: Introduce "chip_info" structure Jakob Hauser
2022-07-04 19:37 ` Andy Shevchenko
2022-07-16 17:10 ` Jonathan Cameron
2022-07-26 22:01 ` Jakob Hauser
2022-07-27 17:39 ` Andy Shevchenko
2022-07-28 23:05 ` Jakob Hauser
2022-07-29 16:08 ` Andy Shevchenko
2022-07-29 22:52 ` Jakob Hauser
2022-07-29 16:13 ` Andy Shevchenko
2022-07-29 22:56 ` Jakob Hauser
2022-07-30 0:53 ` Andy Shevchenko
2022-07-03 22:05 ` [PATCH v4 10/10] iio: magnetometer: yas530: Add YAS537 variant Jakob Hauser
2022-07-04 19:47 ` Andy Shevchenko
2022-07-26 22:13 ` Jakob Hauser
2022-07-27 17:46 ` Andy Shevchenko
2022-07-28 23:13 ` Jakob Hauser
2022-07-29 17:24 ` Andy Shevchenko
2022-07-29 23:10 ` Jakob Hauser
2022-07-30 11:32 ` Andy Shevchenko
2022-07-30 13:31 ` Jakob Hauser
2022-07-30 16:36 ` Andy Shevchenko
2022-07-31 17:53 ` Jakob Hauser
2022-08-03 18:27 ` Linus Walleij
2022-07-04 23:31 ` [PATCH v4 00/10] Add support for magnetometer Yamaha YAS537 Linus Walleij
2022-07-16 17:05 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1656883851.git.jahau@rocketmail.com \
--to=jahau@rocketmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=hdegoede@redhat.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=phone-devel@vger.kernel.org \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.