linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Joey Lee" <jlee@novell.com>
To: <ospite@studenti.unina.it>
Cc: <gmzhuo@gmail.com>, <marek.vasut@gmail.com>,
	<openezx-devel@lists.openezx.org>,
	<broonie@opensource.wolfsonmicro.com>,
	<johannes@sipsolutions.net>, <lrg@slimlogic.co.uk>,
	<linville@tuxdriver.com>, <linux-kernel@vger.kernel.org>,
	<linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] rfkill: Regulator consumer driver for rfkill
Date: Wed, 06 Apr 2011 08:50:13 -0600	[thread overview]
Message-ID: <4D9D0A45020000230002AEF7@novprvlin0050.provo.novell.com> (raw)
In-Reply-To: <20110406162431.cbcb0fd6.ospite@studenti.unina.it>

Hi Antonio, 

於 三,2011-04-06 於 16:24 +0200,Antonio Ospite 提到:
> On Wed, 06 Apr 2011 16:09:28 +0200
> Johannes Berg <johannes@sipsolutions.net> wrote:
> 
> > On Wed, 2011-04-06 at 16:06 +0200, Antonio Ospite wrote:
> > 
> > > > > +	if (regulator_is_enabled(vcc)) {
> > > > > +		dev_dbg(&pdev->dev, "Regulator already enabled\n");
> > > > > +		rfkill_data->reg_enabled = 1;
> > > > > +	}
> > > > > +	rfkill_init_sw_state(rf_kill, !rfkill_data->reg_enabled);
> > > > > +
> > > > > +	ret = rfkill_register(rf_kill);
> > > > 
> > > > We recently had a thread about how rfkill_init_sw_state() isn't quite
> > > > working the right way. Also, it is indented to be used for devices that
> > > > keep their state over resume. I think you should remove it here and rely
> > > > on rfkill to sync you after registration.
> > > > 
> > > > Cf. the long thread here:
> > > > http://thread.gmane.org/gmane.linux.acpi.devel/49577
> > > >
> > > 
> > > Ok, but I still need to replace that call with a rfkill_set_sw_state()
> > > to expose the initial status of the regulator to the rfkill system,
> > > right?
> > 
> > Well, you could, but if you don't do that then the rfkill subsystem will
> > simply call set_block() shortly after registration to put it into the
> > state that it thinks it should be in, which is usually more useful.
> > 
> 
> I see, let's just drop rfkill_init_sw_state() then.
> 
> Regards,
>    Antonio
> 

Like Johannes's comment, the rfkill_init_sw_state is a bit tricky
especially when RFKILL_INPUT enabled. The rfkill_init_sw_state will
replicate the state to device global state, then rfkill will replicate
it to other killswitch.

If you want to use rfkill_init_sw_state to set rfkill initial state when
driver probed, then I suggest you need test it when:
	- RFKILL_INPUT enabled
	and
	- when device initial state is disabled(BLOCKED)

If you want to maintain the rfkill initial state by your self, you can
reference this patch:
http://git.kernel.org/?p=linux/kernel/git/mjg59/platform-drivers-x86.git;a=commitdiff;h=8215af019040ce9182728afee9642d8fdeb17f59

The patch set intial state by rfkill_set_sw_state after rfkill register,
and don't touch the BIOS (firmware?) state in set_block until driver
probe finished.


Thank's a lot!
Joey Lee


  reply	other threads:[~2011-04-06 14:50 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06  9:21 [PATCH] rfkill: Regulator consumer driver for rfkill Antonio Ospite
2011-04-06  9:29 ` Johannes Berg
2011-04-06 14:06   ` Antonio Ospite
2011-04-06 14:09     ` Johannes Berg
2011-04-06 14:24       ` Antonio Ospite
2011-04-06 14:50         ` Joey Lee [this message]
2011-04-08 10:59   ` [PATCH v2] " Antonio Ospite
2011-04-12 11:41     ` Johannes Berg
2011-04-12 11:44       ` Johannes Berg
2011-04-12 15:15         ` Mark Brown
2011-04-12 15:23           ` Johannes Berg
2011-04-13 16:53             ` Mark Brown
2011-04-13  8:44         ` Antonio Ospite
2011-04-13  9:19           ` Johannes Berg
2011-04-13 19:40             ` [PATCH v3] " Antonio Ospite
2011-04-13 19:53               ` Johannes Berg
2011-04-14 10:39                 ` Antonio Ospite
2011-04-14 13:06                   ` Mark Brown
2011-04-15 10:24                     ` Antonio Ospite
2011-04-13  8:53       ` [PATCH v2] " Antonio Ospite
2011-04-06 14:11 ` [PATCH] " Mark Brown
2011-04-06 14:21   ` Johannes Berg
2011-04-06 18:12     ` Paul Bolle
2011-04-06 18:38       ` John W. Linville
2011-04-06 20:10         ` Paul Bolle
2011-04-06 20:15           ` Johannes Berg
2011-04-06 20:17             ` Johannes Berg
2011-04-06 20:19               ` Johannes Berg
2011-04-06 18:46       ` Johannes Berg
2011-04-07 10:01         ` Bernd Petrovitsch
2011-04-07 10:09           ` Johannes Berg
2011-04-07 10:33             ` Bernd Petrovitsch
2011-04-07 10:42               ` depends on tristate logic (was: [PATCH] rfkill: Regulator consumer driver for rfkill) Johannes Berg
2011-04-06 14:29   ` [PATCH] rfkill: Regulator consumer driver for rfkill Antonio Ospite
2011-04-06 14:32     ` Johannes Berg

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=4D9D0A45020000230002AEF7@novprvlin0050.provo.novell.com \
    --to=jlee@novell.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=gmzhuo@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=lrg@slimlogic.co.uk \
    --cc=marek.vasut@gmail.com \
    --cc=openezx-devel@lists.openezx.org \
    --cc=ospite@studenti.unina.it \
    /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;
as well as URLs for NNTP newsgroup(s).