All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Balakrishna Godavarthi <bgodavar@codeaurora.org>
Cc: marcel@holtmann.org, johan.hedberg@gmail.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-bluetooth@vger.kernel.org, thierry.escande@linaro.org,
	rtatiya@codeaurora.org, hemantg@codeaurora.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v10 7/7] Bluetooth: hci_qca: Add support for Qualcomm Bluetooth chip wcn3990
Date: Wed, 25 Jul 2018 11:31:44 -0700	[thread overview]
Message-ID: <20180725183144.GQ129942@google.com> (raw)
In-Reply-To: <81c324ee9104508cf5c862de3f697e4c@codeaurora.org>

On Tue, Jul 24, 2018 at 09:25:16PM +0530, Balakrishna Godavarthi wrote:
> Hi Matthias,
> 
> On 2018-07-24 01:24, Matthias Kaehlcke wrote:
> > On Fri, Jul 20, 2018 at 07:02:43PM +0530, Balakrishna Godavarthi wrote:
> > > +	 * sometimes we will face communication synchronization issues,
> > > +	 * like reading version command timeouts. In which HCI_SETUP fails,
> > > +	 * to overcome these issues, we try to communicate by performing an
> > > +	 * COLD power OFF and ON.
> > > +	 */
> > > +	for (i = 1; i <= 10 && ret; i++) {
> > 
> > Is it really that bad that more than say 3 iterations might be needed?
> > 
> [Bala]: will restrict to 3 iterations.

Is 3x expected to be enough to 'guarantee' as successful
initialization? Just wondered about the 10x since it suddendly changed
from 1x. What is the failure rate without retries?

Could you provide more information about the 'communication
synchronization issues'? Is the root cause understood? Maybe there is
a better way than retries.

> > > +static void qca_regulator_get_current(struct device *dev,
> > > +				      struct qca_vreg *vregs)
> > > +{
> > > +	char prop_name[32]; /* 32 is max size of property name */
> > > +
> > > +	/* We have different platforms where the load value is controlled
> > > +	 * via PMIC controllers. In such cases load required to power ON
> > > +	 * Bluetooth chips are defined in the PMIC. We have option to set
> > > +	 * operation mode like high or low power modes.
> > > +	 * We do have some platforms where driver need to enable the load
> > > for
> > > +	 * WCN3990. Based on the current property value defined for the
> > > +	 * regulators, driver will decide the regulator output load.
> > > +	 * If the current property for the regulator is defined in the dts
> > > +	 * we will read from dts tree, else from the default load values.
> > > +	 */
> > 
> > Let's make sure we all really understand why this is needed. You
> > mentioned RPMh regulators earlier and said a special value of 1uA
> > would be needed to enable high power mode. Later when I pointed to the
> > RPMh regulator code you agreed that this special value wouldn't make
> > any difference.
> > 
> > Now the defaults are higher:
> > 
> [Bala]: today i got the info from the power teams here, currently in the
> downstream what we have is different wrt to the
>         patch "https://patchwork.kernel.org/patch/10524299/" by David
> Collins.
>         prior to his patch we have different architecture where 1uA will
> change the mode to HPM mode.
>         which is not valid, so 1uA will not work any more. we have go with
> actual current values.

Ok, in any case downstream drivers shouldn't impact the design of
upstream drivers. If there are incompatibilities the BT driver needs
to be hacked in the downstream tree.

>         coming back to reading current values from dts. we have reason for
> it.
>         let us assume that later stages of wcn3990 if we have less current
> values than default values.
>         instead of updating the driver again, we can assign the current no
> in the dts, which we will read.
> 
>         This is how it works.
> 
>         if(current value for the reg is declared in dts tree)
>               consider the current value from the dts.
>         else
>            go with default value.
> 
>       pls let me know if you any queries.

If I understand correctly you describe a hypothetical situation of a
future wcn3990 variant having lower power requirements. I'd say let's
deal with this when these chips actually exist and need to be
supported by Linux. As of now it seems there is no need for current
limits in the DT.

> > > +	if (device_property_read_bool(dev, prop_name))
> > > +		device_property_read_u32(dev, prop_name, &vregs->load_uA);
> > 
> > Why device_property_read_bool()?
> > 
> [Bala]: if the current prop is present we read from dts. else we go with
> default current no's.
>         if block  is used to check whether the property is present in dts or
> not.
>         this is required because before calling _regualtor_get_current() we
> hold the default current in the vregs[].
>         if we skip the read bool here, if the current property is not
> present then the function call of device_property_read_u32() will assign
> zero the vregs[].
>         so we miss the default current values.
> 
>         this how it work if we miss read_bool check
> 
>         //vregs hold default current
>          device_property_read_u32(dev, prop_name, &vregs->load_uA);
>          the above will read the current property value from dts store in
> the vregs.. if the property is missing in dts it will store zero.

Where does of_property_read_u32() set the value to zero when the
property does not exist?

A simple test in a probe function:

{
	u32 v = 123;
	of_property_read_u32(node, "no-such-property", &v);
	printk("DBG: v = %d\n", v);
}

[    7.598366] DBG: v = 123

And looking at the code, of_property_read_u32() ends up in a call to
of_property_read_variable_u32_array():

int of_property_read_variable_u32_array(const struct device_node *np,
			       const char *propname, u32 *out_values,
			       size_t sz_min, size_t sz_max)
{
	size_t sz, count;
	const __be32 *val = of_find_property_value_of_size(np, propname,
						(sz_min * sizeof(*out_values)),
						(sz_max * sizeof(*out_values)),
						&sz);

	if (IS_ERR(val))
		return PTR_ERR(val);

	...
}

i.e. 'out_values' is not modified when the property does not exit.

  reply	other threads:[~2018-07-25 18:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-20 13:32 [PATCH v10 0/7] Enable Bluetooth functionality for WCN3990 Balakrishna Godavarthi
2018-07-20 13:32 ` [PATCH v10 1/7] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip wcn3990 Balakrishna Godavarthi
2018-07-23 22:32   ` Matthias Kaehlcke
2018-07-20 13:32 ` [PATCH v10 2/7] Bluetooth: btqca: Rename ROME specific functions to generic functions Balakrishna Godavarthi
2018-07-20 13:32 ` [PATCH v10 3/7] Bluetooth: btqca: Redefine qca_uart_setup() to generic function Balakrishna Godavarthi
2018-07-23 17:40   ` Matthias Kaehlcke
2018-07-24  6:56     ` Balakrishna Godavarthi
2018-07-20 13:32 ` [PATCH v10 4/7] Bluetooth: hci_qca: Add wrapper functions for setting UART speed Balakrishna Godavarthi
2018-07-23 17:56   ` Matthias Kaehlcke
2018-07-24  7:02     ` Balakrishna Godavarthi
2018-07-25 17:02       ` Matthias Kaehlcke
2018-07-20 13:32 ` [PATCH v10 5/7] Bluetooth: hci_qca: Enable 3.2 Mbps operating speed Balakrishna Godavarthi
2018-07-20 13:32 ` [PATCH v10 6/7] Bluetooth: btqca: Add wcn3990 firmware download support Balakrishna Godavarthi
2018-07-20 13:32 ` [PATCH v10 7/7] Bluetooth: hci_qca: Add support for Qualcomm Bluetooth chip wcn3990 Balakrishna Godavarthi
2018-07-23 19:54   ` Matthias Kaehlcke
2018-07-24 15:55     ` Balakrishna Godavarthi
2018-07-25 18:31       ` Matthias Kaehlcke [this message]
2018-07-26 14:21         ` Balakrishna Godavarthi
2018-07-26 19:51           ` Matthias Kaehlcke
2018-07-27 11:39             ` Balakrishna Godavarthi
2018-07-30 20:07               ` Matthias Kaehlcke
2018-07-31 14:38                 ` Balakrishna Godavarthi
2018-07-31 16:03                   ` Matthias Kaehlcke
2018-08-01 13:59                     ` Balakrishna Godavarthi
2018-08-01 16:16                       ` Matthias Kaehlcke
2018-08-01 18:39                         ` Balakrishna Godavarthi

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=20180725183144.GQ129942@google.com \
    --to=mka@chromium.org \
    --cc=bgodavar@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hemantg@codeaurora.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=rtatiya@codeaurora.org \
    --cc=thierry.escande@linaro.org \
    /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.