public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: Ian Ray <ian.ray@gehealthcare.com>
Cc: Support Opensource <support.opensource@diasemi.com>,
	Lee Jones <lee@kernel.org>, Axel Lin <axel.lin@ingics.com>,
	Adam Thomson <Adam.Thomson.Opensource@diasemi.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mfd: da9052-spi: change read-mask to write-mask
Date: Thu, 2 Oct 2025 09:56:32 +0200	[thread overview]
Message-ID: <aN4wMMY5Jq4zdd6e@gmail.com> (raw)
In-Reply-To: <aN4ujFg_uRufUXn-@zeus>

[-- Attachment #1: Type: text/plain, Size: 2689 bytes --]

Hello Ian,

On Thu, Oct 02, 2025 at 10:49:32AM +0300, Ian Ray wrote:
> On Thu, Oct 02, 2025 at 09:23:21AM +0200, Marcus Folkesson wrote:
> > Hello Ian,
> > 
> > On Wed, Oct 01, 2025 at 04:03:37PM +0300, Ian Ray wrote:
> > > Hello Marcus,
> > > 
> > > On Wed, Sep 25, 2024 at 12:19:53PM +0200, Marcus Folkesson wrote:
> > > > Driver has mixed up the R/W bit.
> > > > The LSB bit is set on write rather than read.
> > > > Change it to avoid nasty things to happen.
> > > > 
> > > > Fixes: e9e9d3973594 ("mfd: da9052: Avoid setting read_flag_mask for da9052-i2c driver")
> > > > Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> > > 
> > > Your patch breaks DA9053 SPI communication (for me, at least) on the
> > > 6.1.y branch (I have not tested on master).
> > > 
> > > The datasheets [1] and [2] both refer to R/Wn in the SPI signalling.
> > > 
> > > What led to the assertion that "The LSB bit is set on write rather
> > > than read."?
> > > 
> > > In the original code "config.read_flag_mask = 1;", is OR'd into the
> > > buffer in regmap_set_work_buf_flag_mask.  This sets the "R" bit as
> > > expected.
> > 
> > Hrm.
> > 
> > I follow you and agree with what you say.
> > Could you please read out R19 INTERFACE register?
> > Bit 3, R/W POL, deviates from the default value (1) in my setup, which
> > is probably the reason why it doesn't work for me without the patch.
> 
> -- >8 -- 
> # cat /sys/kernel/debug/regmap/spi2.0/registers |grep "^13:"
> 13: 88
> -- >8 -- 
> 
> > 
> > Your datasheet revision is later than mine, could you plese verify that
> > the default value is still 1 for DA9052 in your revision?
> 
> Yes it is still 1 (the complete set of defaults for R19 is 10011000).
> 
> > 
> > If that is the case, either the datasheet is wrong or my chips must
> > somehow been preloaded with some values.
> 
> Yes, in my understanding these PMICs are highly configurable via OTP.
> (Almost every register can be customized.)
> 
> > 
> > As nobody else has reported any issue I guess it is safer to revert
> > this patch.
> 
> Agree -- following the datasheet default is probably the right thing to
> do here.
> 
> For the future, we could consider an optional device tree property to
> describe this read/write bit polarity.

Yes, I'm actually working on a patch for this, I will send it out
shortly.

> 
> Thanks,
> Ian
> 
> > 
> > > 
> > > [1] DA9052 CFR0011-120-00 Rev 5, Revision 2.5, 13-Feb-2017, page 67.
> > > [2] DA9053 DA9053-00-IDS2n_131017, page 54.
> > > 
> > > Blue skies,
> > > Ian
> > 
> > 
> > Best regards,
> > Marcus Folkesson

Best regards,
Marcus Folkesson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2025-10-02  7:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25 10:19 [PATCH v2] mfd: da9052-spi: change read-mask to write-mask Marcus Folkesson
2024-10-09 13:31 ` (subset) " Lee Jones
2025-10-01 13:03 ` Ian Ray
2025-10-02  7:23   ` Marcus Folkesson
2025-10-02  7:49     ` Ian Ray
2025-10-02  7:56       ` Marcus Folkesson [this message]

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=aN4wMMY5Jq4zdd6e@gmail.com \
    --to=marcus.folkesson@gmail.com \
    --cc=Adam.Thomson.Opensource@diasemi.com \
    --cc=axel.lin@ingics.com \
    --cc=ian.ray@gehealthcare.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=support.opensource@diasemi.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox