mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Zev Weiss <zev@bewilderbeest.net>, Mark Brown <broonie@kernel.org>
Cc: Chanwoo Choi <cwchoi00@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	openbmc@lists.ozlabs.org,
	Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: Re: [PATCH v2 2/2] extcon: Add extcon-regulator driver
Date: Tue, 17 May 2022 12:15:31 +0900	[thread overview]
Message-ID: <bc6595c8-5f05-ac2c-63e0-f442f9ec83be@samsung.com> (raw)
In-Reply-To: <YoL0UGR+TiZojL9Y@hatter.bewilderbeest.net>

Hi Mark, Zev,

On 5/17/22 10:03 AM, Zev Weiss wrote:
> [Adding Sebastian for drivers/power discussion]
> 
> On Mon, May 09, 2022 at 08:24:16AM PDT, Mark Brown wrote:
>> On Mon, May 09, 2022 at 09:24:39PM +0900, Chanwoo Choi wrote:
>>> Hi Zev,
>>>
>>> I checked this patch. But, it doesn't look like the extcon provider
>>> driver. Because basically, extcon provider driver need the circuit
>>> in order to detect the kind of external connector. But, there are
>>> no any code for detection. Just add the specific sysfs attribute
>>> for only this driver. It is not standard interface.
>>
>> OTOH it's something where if I look at the physical system with the
>> hardware there's a clearly visible external connector that I can point
>> to - it just happens to not support hotplug.  It's not clear what other
>> system it would sit in, and it seems like an application that displays
>> external connections on a system in a UI would be able to do something
>> sensible with it.
> 
> Chanwoo, any further thoughts on Mark's reasoning above?
> 
> I certainly understand the reluctance to add an extcon driver that 
> doesn't really do anything with the extcon API, and I have no idea when 
> we might end up enhancing it to do something more meaningful with that 
> API (I don't know of any hardware at the moment that would need it).
> 
> That said, as Mark points out, the hardware *is* ultimately an "external 
> connector" (if a very simplistic one).
> 
> Do you have any other ideas for where this functionality could go?  Greg 
> wasn't enthusiastic about a previous revision that had it in 
> drivers/misc -- though now a fair amount of what was in that version is 
> now going to be in the regulator core, so maybe that could be 
> reconsidered?
> 
> Or maybe something under drivers/power, though it's not really a supply 
> or a reset device...drivers/power/output.c or something?
> 
> Personally I don't have any terribly strong opinions on this, I'd just 
> like to reach a mutually-agreeable consensus on a place for it to live.
> 

After Mark's reply, I considered extcon provider driver without hotplug
feature. I think that extcon need to support the following something:

1. Need to specify the type of external connector instead of EXTCON_NONE.
2. extcon subsystem provides the standard sysfs interface
   for non-hotplug extcon provider driver.
3. User can control the state of external connector via
   the standard extcon sysfs attributes.


For example of extcon provider driver,
static const unsigned int supported_cables[] = {
	EXTCON_USB,
	EXTCON_NONE,
};

int extcon_usb_callback(int connector_id, int property_id, int state, void *data) {
	struct extcon_dev *edev = data;

	if (id == EXTCON_USB && property_id == EXTCON_NOT_HOTPLUG) {
		regulator_enable() or regulator_disable()
	}

	return 0;
}

int extcon_provider_probe(...) {
	edev = devm_extcon_dev_allocate(dev, supported_cables);

	devm_extcon_dev_register(dev, edev);

	extcon_set_property_capability(edev, EXTCON_USB, EXTCON_NOT_HOTPLUG);
	extcon_set_property_callback(edev, EXTCON_USB, extcon_usb_callback);

	...
}

And then user can change the state of each external connector
via '/sys/class/extcon/extcon0/cable.0/state' 
if cable.0 contains the EXTCON_NOT_HOTPLUG property.

I'm designing this approach. But it has not yet decided
because try to check that this approach is right or not.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

  reply	other threads:[~2022-05-17  2:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 23:25 [PATCH v2 0/2] " Zev Weiss
2022-05-05 23:25 ` [PATCH v2 1/2] dt-bindings: connector: Add regulator-connector binding Zev Weiss
2022-05-17  0:15   ` Rob Herring
2022-05-05 23:25 ` [PATCH v2 2/2] extcon: Add extcon-regulator driver Zev Weiss
2022-05-09 12:24   ` Chanwoo Choi
2022-05-09 15:24     ` Mark Brown
2022-05-17  1:03       ` Zev Weiss
2022-05-17  3:15         ` Chanwoo Choi [this message]
2022-05-17 10:07           ` Zev Weiss
2022-05-17 18:15             ` Chanwoo Choi

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=bc6595c8-5f05-ac2c-63e0-f442f9ec83be@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=broonie@kernel.org \
    --cc=cwchoi00@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=sebastian.reichel@collabora.com \
    --cc=zev@bewilderbeest.net \
    /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

all inboxes | Powered by JetHome®