* [PATCH] bonding:update speed/duplex for NETDEV_CHANGE
From: Weiping Pan @ 2011-10-31 14:19 UTC (permalink / raw)
To: netdev; +Cc: fubar, andy, linux-kernel, Weiping Pan
In-Reply-To: <4EAE0D9A.9060408@gmail.com>
Zheng Liang(lzheng@redhat.com) found a bug that if we config bonding with
arp monitor, sometimes bonding driver cannot get the speed and duplex from
its slaves, it will assume them to be 100Mb/sec and Full, please see
/proc/net/bonding/bond0.
But there is no such problem when uses miimon.
(Take igb for example)
I find that the reason is that after dev_open() in bond_enslave(),
bond_update_speed_duplex() will call igb_get_settings()
, but in that function,
it runs ethtool_cmd_speed_set(ecmd, -1); ecmd->duplex = -1;
because igb get an error value of status.
So even dev_open() is called, but the device is not really ready to get its
settings.
Maybe it is safe for us to call igb_get_settings() only after
this message shows up, that is "igb: p4p1 NIC Link is Up 1000 Mbps Full Duplex,
Flow Control: RX".
So I prefer to update the speed and duplex for a slave when reseices
NETDEV_CHANGE/NETDEV_UP event.
Signed-off-by: Weiping Pan <wpan@redhat.com>
---
drivers/net/bonding/bond_main.c | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c34cc1e..f5458eb 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3220,6 +3220,7 @@ static int bond_slave_netdev_event(unsigned long event,
{
struct net_device *bond_dev = slave_dev->master;
struct bonding *bond = netdev_priv(bond_dev);
+ struct slave *slave = NULL;
switch (event) {
case NETDEV_UNREGISTER:
@@ -3230,20 +3231,16 @@ static int bond_slave_netdev_event(unsigned long event,
bond_release(bond_dev, slave_dev);
}
break;
+ case NETDEV_UP:
case NETDEV_CHANGE:
- if (bond->params.mode == BOND_MODE_8023AD || bond_is_lb(bond)) {
- struct slave *slave;
-
- slave = bond_get_slave_by_dev(bond, slave_dev);
- if (slave) {
- u32 old_speed = slave->speed;
- u8 old_duplex = slave->duplex;
-
- bond_update_speed_duplex(slave);
+ slave = bond_get_slave_by_dev(bond, slave_dev);
+ if (slave) {
+ u32 old_speed = slave->speed;
+ u8 old_duplex = slave->duplex;
- if (bond_is_lb(bond))
- break;
+ bond_update_speed_duplex(slave);
+ if (bond->params.mode == BOND_MODE_8023AD) {
if (old_speed != slave->speed)
bond_3ad_adapter_speed_changed(slave);
if (old_duplex != slave->duplex)
--
1.7.4
^ permalink raw reply related
* [lm-sensors] [PATCH 2/3] hwmon: (w83627ehf) Clean up probe function
From: Jean Delvare @ 2011-10-31 14:20 UTC (permalink / raw)
To: lm-sensors
The probe function has grown pretty large, I think it's time for some
cleanups, starting with these two simple ones:
* Move temp3/in6 check for the W83667HG later in the function, where
it is done for all other chip types.
* Move temperature register setting to a separate function, to avoid
code duplication.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
Guenter, had you considered adding support for the NCT6775 and NCT6776
to a separate driver? The code starts being seriously bloated :(
drivers/hwmon/w83627ehf.c | 53 +++++++++++++++++++++++++++------------------
1 file changed, 32 insertions(+), 21 deletions(-)
--- linux-3.2-rc0.orig/drivers/hwmon/w83627ehf.c 2011-10-31 14:24:39.000000000 +0100
+++ linux-3.2-rc0/drivers/hwmon/w83627ehf.c 2011-10-31 14:31:50.000000000 +0100
@@ -1853,6 +1853,19 @@ static void w82627ehf_swap_tempreg(struc
}
static void __devinit
+w83627ehf_set_temp_reg_ehf(struct w83627ehf_data *data, int n_temp)
+{
+ int i;
+
+ for (i = 0; i < n_temp; i++) {
+ data->reg_temp[i] = W83627EHF_REG_TEMP[i];
+ data->reg_temp_over[i] = W83627EHF_REG_TEMP_OVER[i];
+ data->reg_temp_hyst[i] = W83627EHF_REG_TEMP_HYST[i];
+ data->reg_temp_config[i] = W83627EHF_REG_TEMP_CONFIG[i];
+ }
+}
+
+static void __devinit
w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data,
struct w83627ehf_data *data)
{
@@ -1955,17 +1968,8 @@ static int __devinit w83627ehf_probe(str
|| sio_data->kind = nct6775
|| sio_data->kind = nct6776) ? 3 : 4;
+ /* Default to 3 temperature inputs, code below will adjust as needed */
data->have_temp = 0x07;
- /* Check temp3 configuration bit for 667HG */
- if (sio_data->kind = w83667hg) {
- u8 reg;
-
- reg = w83627ehf_read_value(data, W83627EHF_REG_TEMP_CONFIG[2]);
- if (reg & 0x01)
- data->have_temp &= ~(1 << 2);
- else
- data->in6_skip = 1; /* either temp3 or in6 */
- }
/* Deal with temperature register setup first. */
if (sio_data->kind = nct6775 || sio_data->kind = nct6776) {
@@ -2042,16 +2046,12 @@ static int __devinit w83627ehf_probe(str
} else if (sio_data->kind = w83667hg_b) {
u8 reg;
+ w83627ehf_set_temp_reg_ehf(data, 4);
+
/*
* Temperature sources are selected with bank 0, registers 0x49
* and 0x4a.
*/
- for (i = 0; i < ARRAY_SIZE(W83627EHF_REG_TEMP); i++) {
- data->reg_temp[i] = W83627EHF_REG_TEMP[i];
- data->reg_temp_over[i] = W83627EHF_REG_TEMP_OVER[i];
- data->reg_temp_hyst[i] = W83627EHF_REG_TEMP_HYST[i];
- data->reg_temp_config[i] = W83627EHF_REG_TEMP_CONFIG[i];
- }
reg = w83627ehf_read_value(data, 0x4a);
data->temp_src[0] = reg >> 5;
reg = w83627ehf_read_value(data, 0x49);
@@ -2086,12 +2086,23 @@ static int __devinit w83627ehf_probe(str
data->temp_label = w83667hg_b_temp_label;
} else {
+ w83627ehf_set_temp_reg_ehf(data, 3);
+
/* Temperature sources are fixed */
- for (i = 0; i < 3; i++) {
- data->reg_temp[i] = W83627EHF_REG_TEMP[i];
- data->reg_temp_over[i] = W83627EHF_REG_TEMP_OVER[i];
- data->reg_temp_hyst[i] = W83627EHF_REG_TEMP_HYST[i];
- data->reg_temp_config[i] = W83627EHF_REG_TEMP_CONFIG[i];
+
+ if (sio_data->kind = w83667hg) {
+ u8 reg;
+
+ /*
+ * Chip supports either AUXTIN or VIN3. Try to find
+ * out which one.
+ */
+ reg = w83627ehf_read_value(data,
+ W83627EHF_REG_TEMP_CONFIG[2]);
+ if (reg & 0x01)
+ data->have_temp &= ~(1 << 2);
+ else
+ data->in6_skip = 1;
}
}
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply
* [PATCH 0/2] OMAP2+: DMA: fix src/dst position reporting
From: Peter Ujfalusi @ 2011-10-31 14:20 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Jarkko Nikula, linux-omap, alsa-devel
Hello,
If the user asks for the sDMA current position before the first
data has been transmitted (before the first DMA request has been
generated), the reported position is not valid:
src position: CSAC is uninitialized
dst position: CDAC is 0
The return values in both case considered invalid.
This sitation can be identified by checking if the CDAC register
is 0 (it is initialized to 0 in omap_dam_start call).
In this case return the programmed source/destination address.
The affected omap_get_dma_src_pos/omap_get_dma_dst_pos functions
are used by the audio stack mainly for checking the current position
of the audio stream.
Regards,
Peter
---
Peter Ujfalusi (2):
OMAP2+: DMA: Workaround for invalid source position
OMAP2+: DMA: Workaround for invalid destination position
arch/arm/plat-omap/dma.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
--
1.7.7.1
^ permalink raw reply
* [PATCH 1/2] OMAP2+: DMA: Workaround for invalid source position
From: Peter Ujfalusi @ 2011-10-31 14:20 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Jarkko Nikula, linux-omap, alsa-devel
In-Reply-To: <1320070817-9638-1-git-send-email-peter.ujfalusi@ti.com>
If the DMA source position has been asked before the
first actual data transfer has been done, the CSAC
register does not contain valid information.
We can identify this situation by checking the CDAC
register:
CDAC != 0 indicates that the DMA transfer on the channel has
been started already.
When CDAC == 0 we can not trust the CSAC value since it has
not been updated, and can contain random number.
Return the start address in case the DMA has not jet started.
Note: The CDAC register has been initialized to 0 at dma_start
time.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
arch/arm/plat-omap/dma.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index c22217c..38b0d44 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1024,12 +1024,23 @@ EXPORT_SYMBOL(omap_set_dma_callback);
*/
dma_addr_t omap_get_dma_src_pos(int lch)
{
+ u32 cdac;
dma_addr_t offset = 0;
if (cpu_is_omap15xx())
offset = p->dma_read(CPC, lch);
- else
- offset = p->dma_read(CSAC, lch);
+ else {
+ /*
+ * CDAC == 0 indicates that the DMA transfer on the channel has
+ * not been started (no data has been transferred so far).
+ * Return the programmed source start address in this case.
+ */
+ cdac = p->dma_read(CDAC, lch);
+ if (likely(cdac))
+ offset = p->dma_read(CSAC, lch);
+ else
+ offset = p->dma_read(CSSA, lch);
+ }
if (IS_DMA_ERRATA(DMA_ERRATA_3_3) && offset == 0)
offset = p->dma_read(CSAC, lch);
--
1.7.7.1
^ permalink raw reply related
* [PATCH 2/2] OMAP2+: DMA: Workaround for invalid destination position
From: Peter Ujfalusi @ 2011-10-31 14:20 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Jarkko Nikula, linux-omap, alsa-devel
In-Reply-To: <1320070817-9638-1-git-send-email-peter.ujfalusi@ti.com>
If the DMA destination position has been asked before the
first actual data transfer has been done, the CDAC
register still contains 0 (it is initialized to 0 at
omsp_dma_start).
If CDAC == 0, return the programmed start address.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
arch/arm/plat-omap/dma.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 38b0d44..9186491 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1066,8 +1066,16 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
if (cpu_is_omap15xx())
offset = p->dma_read(CPC, lch);
- else
+ else {
offset = p->dma_read(CDAC, lch);
+ /*
+ * CDAC == 0 indicates that the DMA transfer on the channel has
+ * not been started (no data has been transferred so far).
+ * Return the programmed destination start address in this case.
+ */
+ if (unlikely(!offset))
+ offset = p->dma_read(CDSA, lch);
+ }
/*
* omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
--
1.7.7.1
^ permalink raw reply related
* Re: New integration branch for btrfs-progs
From: David Sterba @ 2011-10-31 14:20 UTC (permalink / raw)
To: Hugo Mills, Btrfs mailing list, Chris Mason
In-Reply-To: <20111031084011.GU29548@carfax.org.uk>
On Mon, Oct 31, 2011 at 08:40:11AM +0000, Hugo Mills wrote:
> David Sterba (3):
> btrfs-progs: ignore -a option in mkfs
^^^^
sorry, that's my typo, the utility is btrfsck, please fix it in your
tree.
david
^ permalink raw reply
* Re: [4/4] powerpc/booke: Re-organize debug code
From: Kumar Gala @ 2011-10-31 14:21 UTC (permalink / raw)
To: Jimi Xenidis; +Cc: linuxppc-dev
In-Reply-To: <5EF5AFC4-C852-4D1C-9019-D1CBAE1157EA@pobox.com>
On Oct 28, 2011, at 2:37 PM, Jimi Xenidis wrote:
>=20
> On Oct 5, 2011, at 9:53 PM, Kumar Gala wrote:
>=20
>> * set_dabr/do_dabr are no longer used when CNFIG_PPC_ADV_DEBUG_REGS =
is set
>> refactor code a bit such that we only build the dabr code for
>> !CONFIG_PPC_ADV_DEBUG_REGS and removed some CONFIG_PPC_ADV_DEBUG_REGS
>> code in set_dabr that would never get built.
>>=20
>> * Move do_send_trap into traps.c as its only used there
>>=20
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>>=20
>> ---
>> arch/powerpc/include/asm/system.h | 5 +--
>> arch/powerpc/kernel/process.c | 97 =
+++++++++++++-----------------------
>> arch/powerpc/kernel/traps.c | 17 +++++++
>> 3 files changed, 53 insertions(+), 66 deletions(-)
>>=20
>> diff --git a/arch/powerpc/include/asm/system.h =
b/arch/powerpc/include/asm/system.h
>> index e30a13d..1dc5d9c 100644
>> --- a/arch/powerpc/include/asm/system.h
>> +++ b/arch/powerpc/include/asm/system.h
>> @@ -111,11 +111,8 @@ static inline int debugger_dabr_match(struct =
pt_regs *regs) { return 0; }
>> static inline int debugger_fault_handler(struct pt_regs *regs) { =
return 0; }
>> #endif
>>=20
>> +#ifndef CONFIG_PPC_ADV_DEBUG_REGS
>> extern int set_dabr(unsigned long dabr);
>> -#ifdef CONFIG_PPC_ADV_DEBUG_REGS
>> -extern void do_send_trap(struct pt_regs *regs, unsigned long =
address,
>> - unsigned long error_code, int signal_code, int =
brkpt);
>> -#else
>=20
>=20
> This part of the patch breaks xmon.c
> Naively I simply wrapped the xmon call:
>=20
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index f08836a..b5911b2 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -738,8 +738,10 @@ static void insert_bpts(void)
>=20
> static void insert_cpu_bpts(void)
> {
> +#ifndef CONFIG_PPC_ADV_DEBUG_REGS
> if (dabr.enabled)
> set_dabr(dabr.address | (dabr.enabled & 7));
> +#endif
> if (iabr && cpu_has_feature(CPU_FTR_IABR))
> mtspr(SPRN_IABR, iabr->address
> | (iabr->enabled & (BP_IABR|BP_IABR_TE)));
> @@ -767,7 +769,9 @@ static void remove_bpts(void)
>=20
> static void remove_cpu_bpts(void)
> {
> +#ifndef CONFIG_PPC_ADV_DEBUG_REGS
> set_dabr(0);
> +#endif
> if (cpu_has_feature(CPU_FTR_IABR))
> mtspr(SPRN_IABR, 0);
> }
Shouldn't all of these functions be #ifndef'd out as we don't support =
cpu_bpts on book-e parts in xmon code today?
>=20
> -JX
>=20
>=20
>> extern void do_dabr(struct pt_regs *regs, unsigned long address,
>> unsigned long error_code);
>> #endif
>> diff --git a/arch/powerpc/kernel/process.c =
b/arch/powerpc/kernel/process.c
>> index 269a309..989e574 100644
>> --- a/arch/powerpc/kernel/process.c
>> +++ b/arch/powerpc/kernel/process.c
>> @@ -251,50 +251,6 @@ void discard_lazy_cpu_state(void)
>> #endif /* CONFIG_SMP */
>>=20
>> #ifdef CONFIG_PPC_ADV_DEBUG_REGS
>> -void do_send_trap(struct pt_regs *regs, unsigned long address,
>> - unsigned long error_code, int signal_code, int =
breakpt)
>> -{
>> - siginfo_t info;
>> -
>> - if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
>> - 11, SIGSEGV) =3D=3D NOTIFY_STOP)
>> - return;
>> -
>> - /* Deliver the signal to userspace */
>> - info.si_signo =3D SIGTRAP;
>> - info.si_errno =3D breakpt; /* breakpoint or watchpoint id =
*/
>> - info.si_code =3D signal_code;
>> - info.si_addr =3D (void __user *)address;
>> - force_sig_info(SIGTRAP, &info, current);
>> -}
>> -#else /* !CONFIG_PPC_ADV_DEBUG_REGS */
>> -void do_dabr(struct pt_regs *regs, unsigned long address,
>> - unsigned long error_code)
>> -{
>> - siginfo_t info;
>> -
>> - if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
>> - 11, SIGSEGV) =3D=3D NOTIFY_STOP)
>> - return;
>> -
>> - if (debugger_dabr_match(regs))
>> - return;
>> -
>> - /* Clear the DABR */
>> - set_dabr(0);
>> -
>> - /* Deliver the signal to userspace */
>> - info.si_signo =3D SIGTRAP;
>> - info.si_errno =3D 0;
>> - info.si_code =3D TRAP_HWBKPT;
>> - info.si_addr =3D (void __user *)address;
>> - force_sig_info(SIGTRAP, &info, current);
>> -}
>> -#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
>> -
>> -static DEFINE_PER_CPU(unsigned long, current_dabr);
>> -
>> -#ifdef CONFIG_PPC_ADV_DEBUG_REGS
>> /*
>> * Set the debug registers back to their default "safe" values.
>> */
>> @@ -357,16 +313,7 @@ static void switch_booke_debug_regs(struct =
thread_struct *new_thread)
>> prime_debug_regs(new_thread);
>> }
>> #else /* !CONFIG_PPC_ADV_DEBUG_REGS */
>> -#ifndef CONFIG_HAVE_HW_BREAKPOINT
>> -static void set_debug_reg_defaults(struct thread_struct *thread)
>> -{
>> - if (thread->dabr) {
>> - thread->dabr =3D 0;
>> - set_dabr(0);
>> - }
>> -}
>> -#endif /* !CONFIG_HAVE_HW_BREAKPOINT */
>> -#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
>> +static DEFINE_PER_CPU(unsigned long, current_dabr);
>>=20
>> int set_dabr(unsigned long dabr)
>> {
>> @@ -376,19 +323,45 @@ int set_dabr(unsigned long dabr)
>> return ppc_md.set_dabr(dabr);
>>=20
>> /* XXX should we have a CPU_FTR_HAS_DABR ? */
>> -#ifdef CONFIG_PPC_ADV_DEBUG_REGS
>> - mtspr(SPRN_DAC1, dabr);
>> -#ifdef CONFIG_PPC_47x
>> - isync();
>> -#endif
>> -#elif defined(CONFIG_PPC_BOOK3S)
>> mtspr(SPRN_DABR, dabr);
>> -#endif
>> -
>>=20
>> return 0;
>> }
>>=20
>> +void do_dabr(struct pt_regs *regs, unsigned long address,
>> + unsigned long error_code)
>> +{
>> + siginfo_t info;
>> +
>> + if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
>> + 11, SIGSEGV) =3D=3D NOTIFY_STOP)
>> + return;
>> +
>> + if (debugger_dabr_match(regs))
>> + return;
>> +
>> + /* Clear the DABR */
>> + set_dabr(0);
>> +
>> + /* Deliver the signal to userspace */
>> + info.si_signo =3D SIGTRAP;
>> + info.si_errno =3D 0;
>> + info.si_code =3D TRAP_HWBKPT;
>> + info.si_addr =3D (void __user *)address;
>> + force_sig_info(SIGTRAP, &info, current);
>> +}
>> +
>> +#ifndef CONFIG_HAVE_HW_BREAKPOINT
>> +static void set_debug_reg_defaults(struct thread_struct *thread)
>> +{
>> + if (thread->dabr) {
>> + thread->dabr =3D 0;
>> + set_dabr(0);
>> + }
>> +}
>> +#endif /* !CONFIG_HAVE_HW_BREAKPOINT */
>> +#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
>> +
>> #ifdef CONFIG_PPC64
>> DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
>> #endif
>> diff --git a/arch/powerpc/kernel/traps.c =
b/arch/powerpc/kernel/traps.c
>> index db733d3..edc1108 100644
>> --- a/arch/powerpc/kernel/traps.c
>> +++ b/arch/powerpc/kernel/traps.c
>> @@ -1184,6 +1184,23 @@ void SoftwareEmulation(struct pt_regs *regs)
>> #endif /* CONFIG_8xx */
>>=20
>> #ifdef CONFIG_PPC_ADV_DEBUG_REGS
>> +static void do_send_trap(struct pt_regs *regs, unsigned long =
address,
>> + unsigned long error_code, int signal_code, int =
breakpt)
>> +{
>> + siginfo_t info;
>> +
>> + if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
>> + 11, SIGSEGV) =3D=3D NOTIFY_STOP)
>> + return;
>> +
>> + /* Deliver the signal to userspace */
>> + info.si_signo =3D SIGTRAP;
>> + info.si_errno =3D breakpt; /* breakpoint or watchpoint id =
*/
>> + info.si_code =3D signal_code;
>> + info.si_addr =3D (void __user *)address;
>> + force_sig_info(SIGTRAP, &info, current);
>> +}
>> +
>> static void handle_debug(struct pt_regs *regs, unsigned long =
debug_status)
>> {
>> int changed =3D 0;
^ permalink raw reply
* [lm-sensors] [PATCH 3/3] hwmon: (w83627ehf) Add support for the
From: Jean Delvare @ 2011-10-31 14:23 UTC (permalink / raw)
To: lm-sensors
This is essentially a stripped down version of the W83627DHG. Noticeable
difference is that it is still powered with +5V, as older models, even
though the ADC resolution is 8 mV as newer models have.
Thanks to Ulf Bruman (Saab Group) for doing all the testing.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
Hmm, I'm almost certain that I had originally prepared changes to
Kconfig and the documentation file too, but apparently they got lost
somewhere. I'll see if I can find a backup somewhere.
drivers/hwmon/w83627ehf.c | 146 +++++++++++++++++++++++++++++++++++++--------
1 file changed, 121 insertions(+), 25 deletions(-)
--- linux-3.2-rc0.orig/drivers/hwmon/w83627ehf.c 2011-10-31 14:31:50.000000000 +0100
+++ linux-3.2-rc0/drivers/hwmon/w83627ehf.c 2011-10-31 14:48:18.000000000 +0100
@@ -39,6 +39,7 @@
0x8860 0xa1
w83627dhg 9 5 4 3 0xa020 0xc1 0x5ca3
w83627dhg-p 9 5 4 3 0xb070 0xc1 0x5ca3
+ w83627uhg 8 2 2 2 0xa230 0xc1 0x5ca3
w83667hg 9 5 3 3 0xa510 0xc1 0x5ca3
w83667hg-b 9 5 3 4 0xb350 0xc1 0x5ca3
nct6775f 9 4 3 9 0xb470 0xc1 0x5ca3
@@ -61,14 +62,17 @@
#include <linux/io.h>
#include "lm75.h"
-enum kinds { w83627ehf, w83627dhg, w83627dhg_p, w83667hg, w83667hg_b, nct6775,
- nct6776 };
+enum kinds {
+ w83627ehf, w83627dhg, w83627dhg_p, w83627uhg,
+ w83667hg, w83667hg_b, nct6775, nct6776,
+};
/* used to set data->name = w83627ehf_device_names[data->sio_kind] */
static const char * const w83627ehf_device_names[] = {
"w83627ehf",
"w83627dhg",
"w83627dhg",
+ "w83627uhg",
"w83667hg",
"w83667hg",
"nct6775",
@@ -104,6 +108,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable d
#define SIO_W83627EHG_ID 0x8860
#define SIO_W83627DHG_ID 0xa020
#define SIO_W83627DHG_P_ID 0xb070
+#define SIO_W83627UHG_ID 0xa230
#define SIO_W83667HG_ID 0xa510
#define SIO_W83667HG_B_ID 0xb350
#define SIO_NCT6775_ID 0xb470
@@ -388,18 +393,23 @@ div_from_reg(u8 reg)
return 1 << reg;
}
-/* Some of analog inputs have internal scaling (2x), 8mV is ADC LSB */
-
-static u8 scale_in[10] = { 8, 8, 16, 16, 8, 8, 8, 16, 16, 8 };
+/* Some of the voltage inputs have internal scaling, the tables below
+ * contain 8 (the ADC LSB in mV) * scaling factor * 100 */
+static const u16 scale_in_common[10] = {
+ 800, 800, 1600, 1600, 800, 800, 800, 1600, 1600, 800
+};
+static const u16 scale_in_w83627uhg[9] = {
+ 800, 800, 3328, 3424, 800, 800, 0, 3328, 3400
+};
-static inline long in_from_reg(u8 reg, u8 nr)
+static inline long in_from_reg(u8 reg, u8 nr, const u16 *scale_in)
{
- return reg * scale_in[nr];
+ return DIV_ROUND_CLOSEST(reg * scale_in[nr], 100);
}
-static inline u8 in_to_reg(u32 val, u8 nr)
+static inline u8 in_to_reg(u32 val, u8 nr, const u16 *scale_in)
{
- return SENSORS_LIMIT(((val + (scale_in[nr] / 2)) / scale_in[nr]), 0,
+ return SENSORS_LIMIT(DIV_ROUND_CLOSEST(val * 100, scale_in[nr]), 0,
255);
}
@@ -430,6 +440,7 @@ struct w83627ehf_data {
const u16 *REG_FAN_STOP_TIME;
const u16 *REG_FAN_MAX_OUTPUT;
const u16 *REG_FAN_STEP_OUTPUT;
+ const u16 *scale_in;
unsigned int (*fan_from_reg)(u16 reg, unsigned int divreg);
unsigned int (*fan_from_reg_min)(u16 reg, unsigned int divreg);
@@ -481,7 +492,8 @@ struct w83627ehf_data {
u8 vrm;
u16 have_temp;
- u8 in6_skip;
+ u8 in6_skip:1;
+ u8 temp3_val_only:1;
};
struct w83627ehf_sio_data {
@@ -907,7 +919,8 @@ show_##reg(struct device *dev, struct de
struct sensor_device_attribute *sensor_attr = \
to_sensor_dev_attr(attr); \
int nr = sensor_attr->index; \
- return sprintf(buf, "%ld\n", in_from_reg(data->reg[nr], nr)); \
+ return sprintf(buf, "%ld\n", in_from_reg(data->reg[nr], nr, \
+ data->scale_in)); \
}
show_in_reg(in)
show_in_reg(in_min)
@@ -928,7 +941,7 @@ store_in_##reg(struct device *dev, struc
if (err < 0) \
return err; \
mutex_lock(&data->update_lock); \
- data->in_##reg[nr] = in_to_reg(val, nr); \
+ data->in_##reg[nr] = in_to_reg(val, nr, data->scale_in); \
w83627ehf_write_value(data, W83627EHF_REG_IN_##REG(nr), \
data->in_##reg[nr]); \
mutex_unlock(&data->update_lock); \
@@ -1617,25 +1630,28 @@ static struct sensor_device_attribute sd
store_fan_step_output, 3),
};
+static struct sensor_device_attribute sda_sf3_arrays_fan3[] = {
+ SENSOR_ATTR(pwm3_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time,
+ store_fan_stop_time, 2),
+ SENSOR_ATTR(pwm3_start_output, S_IWUSR | S_IRUGO, show_fan_start_output,
+ store_fan_start_output, 2),
+ SENSOR_ATTR(pwm3_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output,
+ store_fan_stop_output, 2),
+};
+
static struct sensor_device_attribute sda_sf3_arrays[] = {
SENSOR_ATTR(pwm1_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time,
store_fan_stop_time, 0),
SENSOR_ATTR(pwm2_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time,
store_fan_stop_time, 1),
- SENSOR_ATTR(pwm3_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time,
- store_fan_stop_time, 2),
SENSOR_ATTR(pwm1_start_output, S_IWUSR | S_IRUGO, show_fan_start_output,
store_fan_start_output, 0),
SENSOR_ATTR(pwm2_start_output, S_IWUSR | S_IRUGO, show_fan_start_output,
store_fan_start_output, 1),
- SENSOR_ATTR(pwm3_start_output, S_IWUSR | S_IRUGO, show_fan_start_output,
- store_fan_start_output, 2),
SENSOR_ATTR(pwm1_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output,
store_fan_stop_output, 0),
SENSOR_ATTR(pwm2_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output,
store_fan_stop_output, 1),
- SENSOR_ATTR(pwm3_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output,
- store_fan_stop_output, 2),
};
@@ -1728,6 +1744,8 @@ static void w83627ehf_device_remove_file
data->REG_FAN_STEP_OUTPUT[attr->index] != 0xff)
device_remove_file(dev, &attr->dev_attr);
}
+ for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan3); i++)
+ device_remove_file(dev, &sda_sf3_arrays_fan3[i].dev_attr);
for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++)
device_remove_file(dev, &sda_sf3_arrays_fan4[i].dev_attr);
for (i = 0; i < data->in_num; i++) {
@@ -1756,6 +1774,8 @@ static void w83627ehf_device_remove_file
continue;
device_remove_file(dev, &sda_temp_input[i].dev_attr);
device_remove_file(dev, &sda_temp_label[i].dev_attr);
+ if (i = 2 && data->temp3_val_only)
+ continue;
device_remove_file(dev, &sda_temp_max[i].dev_attr);
device_remove_file(dev, &sda_temp_max_hyst[i].dev_attr);
if (i > 2)
@@ -1808,6 +1828,9 @@ static inline void __devinit w83627ehf_i
case w83627ehf:
diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE);
break;
+ case w83627uhg:
+ diode = 0x00;
+ break;
default:
diode = 0x70;
}
@@ -1871,6 +1894,13 @@ w83627ehf_check_fan_inputs(const struct
{
int fan3pin, fan4pin, fan4min, fan5pin, regval;
+ /* The W83627UHG is simple, only two fan inputs, no config */
+ if (sio_data->kind = w83627uhg) {
+ data->has_fan = 0x03; /* fan1 and fan2 */
+ data->has_fan_min = 0x03;
+ return;
+ }
+
superio_enter(sio_data->sioreg);
/* fan4 and fan5 share some pins with the GPIO and serial flash */
@@ -1962,11 +1992,21 @@ static int __devinit w83627ehf_probe(str
/* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */
data->in_num = (sio_data->kind = w83627ehf) ? 10 : 9;
- /* 667HG, NCT6775F, and NCT6776F have 3 pwms */
- data->pwm_num = (sio_data->kind = w83667hg
- || sio_data->kind = w83667hg_b
- || sio_data->kind = nct6775
- || sio_data->kind = nct6776) ? 3 : 4;
+ /* 667HG, NCT6775F, and NCT6776F have 3 pwms, and 627UHG has only 2 */
+ switch (sio_data->kind) {
+ default:
+ data->pwm_num = 4;
+ break;
+ case w83667hg:
+ case w83667hg_b:
+ case nct6775:
+ case nct6776:
+ data->pwm_num = 3;
+ break;
+ case w83627uhg:
+ data->pwm_num = 2;
+ break;
+ }
/* Default to 3 temperature inputs, code below will adjust as needed */
data->have_temp = 0x07;
@@ -2085,6 +2125,42 @@ static int __devinit w83627ehf_probe(str
data->in6_skip = 1;
data->temp_label = w83667hg_b_temp_label;
+ } else if (sio_data->kind = w83627uhg) {
+ u8 reg;
+
+ w83627ehf_set_temp_reg_ehf(data, 3);
+
+ /*
+ * Temperature sources for temp1 and temp2 are selected with
+ * bank 0, registers 0x49 and 0x4a.
+ */
+ data->temp_src[0] = 0; /* SYSTIN */
+ reg = w83627ehf_read_value(data, 0x49) & 0x07;
+ /* Adjust to have the same mapping as other source registers */
+ if (reg = 0)
+ data->temp_src[1]++;
+ else if (reg >= 2 && reg <= 5)
+ data->temp_src[1] += 2;
+ else /* should never happen */
+ data->have_temp &= ~(1 << 1);
+ reg = w83627ehf_read_value(data, 0x4a);
+ data->temp_src[2] = reg >> 5;
+
+ /*
+ * Skip temp3 if source is invalid or the same as temp1
+ * or temp2.
+ */
+ if (data->temp_src[2] = 2 || data->temp_src[2] = 3 ||
+ data->temp_src[2] = data->temp_src[0] ||
+ ((data->have_temp & (1 << 1)) &&
+ data->temp_src[2] = data->temp_src[1]))
+ data->have_temp &= ~(1 << 2);
+ else
+ data->temp3_val_only = 1; /* No limit regs */
+
+ data->in6_skip = 1; /* No VIN3 */
+
+ data->temp_label = w83667hg_b_temp_label;
} else {
w83627ehf_set_temp_reg_ehf(data, 3);
@@ -2162,6 +2238,12 @@ static int __devinit w83627ehf_probe(str
W83627EHF_REG_FAN_STEP_OUTPUT_COMMON;
}
+ /* Setup input voltage scaling factors */
+ if (sio_data->kind = w83627uhg)
+ data->scale_in = scale_in_w83627uhg;
+ else
+ data->scale_in = scale_in_common;
+
/* Initialize the chip */
w83627ehf_init_device(data, sio_data->kind);
@@ -2178,7 +2260,7 @@ static int __devinit w83627ehf_probe(str
err = device_create_file(dev, &dev_attr_cpu0_vid);
if (err)
goto exit_release;
- } else {
+ } else if (sio_data->kind != w83627uhg) {
superio_select(sio_data->sioreg, W83627EHF_LD_HWM);
if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) {
/* Set VID input sensibility if needed. In theory the
@@ -2268,7 +2350,14 @@ static int __devinit w83627ehf_probe(str
goto exit_remove;
}
}
- /* if fan4 is enabled create the sf3 files for it */
+ /* if fan3 and fan4 are enabled create the sf3 files for them */
+ if ((data->has_fan & (1 << 2)) && data->pwm_num >= 3)
+ for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan3); i++) {
+ err = device_create_file(dev,
+ &sda_sf3_arrays_fan3[i].dev_attr);
+ if (err)
+ goto exit_remove;
+ }
if ((data->has_fan & (1 << 3)) && data->pwm_num >= 4)
for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) {
err = device_create_file(dev,
@@ -2336,6 +2425,8 @@ static int __devinit w83627ehf_probe(str
if (err)
goto exit_remove;
}
+ if (i = 2 && data->temp3_val_only)
+ continue;
if (data->reg_temp_over[i]) {
err = device_create_file(dev,
&sda_temp_max[i].dev_attr);
@@ -2419,6 +2510,7 @@ static int __init w83627ehf_find(int sio
static const char __initdata sio_name_W83627EHG[] = "W83627EHG";
static const char __initdata sio_name_W83627DHG[] = "W83627DHG";
static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P";
+ static const char __initdata sio_name_W83627UHG[] = "W83627UHG";
static const char __initdata sio_name_W83667HG[] = "W83667HG";
static const char __initdata sio_name_W83667HG_B[] = "W83667HG-B";
static const char __initdata sio_name_NCT6775[] = "NCT6775F";
@@ -2451,6 +2543,10 @@ static int __init w83627ehf_find(int sio
sio_data->kind = w83627dhg_p;
sio_name = sio_name_W83627DHG_P;
break;
+ case SIO_W83627UHG_ID:
+ sio_data->kind = w83627uhg;
+ sio_name = sio_name_W83627UHG;
+ break;
case SIO_W83667HG_ID:
sio_data->kind = w83667hg;
sio_name = sio_name_W83667HG;
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply
* [PATCH] drm: Make the per-driver file_operations struct const
From: Arjan van de Ven @ 2011-10-31 14:28 UTC (permalink / raw)
To: dri-devel, airlied
>From fdf1fdebaa00f81de18c227f32f8074c8b352d50 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sun, 30 Oct 2011 19:06:07 -0700
Subject: [PATCH] drm: Make the per-driver file_operations struct const
The DRM layer keeps a copy of struct file_operations inside its
big driver struct... which prevents it from being consistent and static.
For consistency (and the general security objective of having such things
static), it's desirable to get this fixed.
This patch splits out the file_operations field to its own struct,
which is then "static const", and just stick a pointer to this into
the driver struct, making it more consistent with how the rest of the
kernel does this.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
drivers/gpu/drm/drm_fops.c | 2 +-
drivers/gpu/drm/i810/i810_drv.c | 23 ++++++------
drivers/gpu/drm/i915/i915_drv.c | 31 +++++++++--------
drivers/gpu/drm/mga/mga_drv.c | 29 ++++++++--------
drivers/gpu/drm/nouveau/nouveau_drv.c | 31 +++++++++--------
drivers/gpu/drm/r128/r128_drv.c | 30 ++++++++--------
drivers/gpu/drm/radeon/radeon_drv.c | 60 +++++++++++++++++----------------
drivers/gpu/drm/savage/savage_drv.c | 23 ++++++------
drivers/gpu/drm/sis/sis_drv.c | 23 ++++++------
drivers/gpu/drm/tdfx/tdfx_drv.c | 23 ++++++------
drivers/gpu/drm/via/via_drv.c | 23 ++++++------
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 28 ++++++++-------
drivers/staging/gma500/psb_drv.c | 23 ++++++------
include/drm/drmP.h | 2 +-
14 files changed, 182 insertions(+), 169 deletions(-)
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 2ec7d48..3d7a75e 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -181,7 +181,7 @@ int drm_stub_open(struct inode *inode, struct file *filp)
goto out;
old_fops = filp->f_op;
- filp->f_op = fops_get(&dev->driver->fops);
+ filp->f_op = fops_get(dev->driver->fops);
if (filp->f_op == NULL) {
filp->f_op = old_fops;
goto out;
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
index 6f98d05..c923956 100644
--- a/drivers/gpu/drm/i810/i810_drv.c
+++ b/drivers/gpu/drm/i810/i810_drv.c
@@ -41,6 +41,17 @@ static struct pci_device_id pciidlist[] = {
i810_PCI_IDS
};
+static const struct file_operations i810_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
@@ -53,17 +64,7 @@ static struct drm_driver driver = {
.reclaim_buffers_locked = i810_driver_reclaim_buffers_locked,
.dma_quiescent = i810_driver_dma_quiescent,
.ioctls = i810_ioctls,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
- .llseek = noop_llseek,
- },
-
+ .fops = &i810_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f07e4252..c395713 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -784,6 +784,21 @@ static struct vm_operations_struct i915_gem_vm_ops = {
.close = drm_gem_vm_close,
};
+static const struct file_operations i915_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = drm_gem_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+ .read = drm_read,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = i915_compat_ioctl,
+#endif
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver = {
/* don't use mtrr's here, the Xserver or user space app should
* deal with them for intel hardware.
@@ -817,21 +832,7 @@ static struct drm_driver driver = {
.dumb_map_offset = i915_gem_mmap_gtt,
.dumb_destroy = i915_gem_dumb_destroy,
.ioctls = i915_ioctls,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = drm_gem_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
- .read = drm_read,
-#ifdef CONFIG_COMPAT
- .compat_ioctl = i915_compat_ioctl,
-#endif
- .llseek = noop_llseek,
- },
-
+ .fops = &i915_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
index 42d3187..1c5d04a 100644
--- a/drivers/gpu/drm/mga/mga_drv.c
+++ b/drivers/gpu/drm/mga/mga_drv.c
@@ -42,6 +42,20 @@ static struct pci_device_id pciidlist[] = {
mga_PCI_IDS
};
+static const struct file_operations mga_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = mga_compat_ioctl,
+#endif
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA |
@@ -62,20 +76,7 @@ static struct drm_driver driver = {
.reclaim_buffers = drm_core_reclaim_buffers,
.ioctls = mga_ioctls,
.dma_ioctl = mga_dma_buffers,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
-#ifdef CONFIG_COMPAT
- .compat_ioctl = mga_compat_ioctl,
-#endif
- .llseek = noop_llseek,
- },
-
+ .fops = &mga_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c
index b30ddd8..725c4f2 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
@@ -387,6 +387,21 @@ nouveau_pci_resume(struct pci_dev *pdev)
return 0;
}
+static const struct file_operations nouveau_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = nouveau_ttm_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+ .read = drm_read,
+#if defined(CONFIG_COMPAT)
+ .compat_ioctl = nouveau_compat_ioctl,
+#endif
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG |
@@ -412,21 +427,7 @@ static struct drm_driver driver = {
.disable_vblank = nouveau_vblank_disable,
.reclaim_buffers = drm_core_reclaim_buffers,
.ioctls = nouveau_ioctls,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = nouveau_ttm_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
- .read = drm_read,
-#if defined(CONFIG_COMPAT)
- .compat_ioctl = nouveau_compat_ioctl,
-#endif
- .llseek = noop_llseek,
- },
-
+ .fops = &nouveau_driver_fops,
.gem_init_object = nouveau_gem_object_new,
.gem_free_object = nouveau_gem_object_del,
.gem_open_object = nouveau_gem_object_open,
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c
index b9e8efd..e5f0fd5 100644
--- a/drivers/gpu/drm/r128/r128_drv.c
+++ b/drivers/gpu/drm/r128/r128_drv.c
@@ -40,6 +40,20 @@ static struct pci_device_id pciidlist[] = {
r128_PCI_IDS
};
+static const struct file_operations r128_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = r128_compat_ioctl,
+#endif
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
@@ -58,21 +72,7 @@ static struct drm_driver driver = {
.reclaim_buffers = drm_core_reclaim_buffers,
.ioctls = r128_ioctls,
.dma_ioctl = r128_cce_buffers,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
-#ifdef CONFIG_COMPAT
- .compat_ioctl = r128_compat_ioctl,
-#endif
- .llseek = noop_llseek,
- },
-
-
+ .fops = &r128_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index e71d2ed..2e9d1a2 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -200,6 +200,21 @@ static struct pci_device_id pciidlist[] = {
MODULE_DEVICE_TABLE(pci, pciidlist);
#endif
+static const struct file_operations radeon_driver_old_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+ .read = drm_read,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = radeon_compat_ioctl,
+#endif
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver_old = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
@@ -226,21 +241,7 @@ static struct drm_driver driver_old = {
.reclaim_buffers = drm_core_reclaim_buffers,
.ioctls = radeon_ioctls,
.dma_ioctl = radeon_cp_buffers,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
- .read = drm_read,
-#ifdef CONFIG_COMPAT
- .compat_ioctl = radeon_compat_ioctl,
-#endif
- .llseek = noop_llseek,
- },
-
+ .fops = &radeon_driver_old_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
@@ -298,6 +299,20 @@ radeon_pci_resume(struct pci_dev *pdev)
return radeon_resume_kms(dev);
}
+static const struct file_operations radeon_driver_kms_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = radeon_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+ .read = drm_read,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = radeon_kms_compat_ioctl,
+#endif
+};
+
static struct drm_driver kms_driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
@@ -333,20 +348,7 @@ static struct drm_driver kms_driver = {
.dumb_create = radeon_mode_dumb_create,
.dumb_map_offset = radeon_mode_dumb_mmap,
.dumb_destroy = radeon_mode_dumb_destroy,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = radeon_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
- .read = drm_read,
-#ifdef CONFIG_COMPAT
- .compat_ioctl = radeon_kms_compat_ioctl,
-#endif
- },
-
+ .fops = &radeon_driver_kms_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/savage/savage_drv.c b/drivers/gpu/drm/savage/savage_drv.c
index 6464490..4705fe4 100644
--- a/drivers/gpu/drm/savage/savage_drv.c
+++ b/drivers/gpu/drm/savage/savage_drv.c
@@ -33,6 +33,17 @@ static struct pci_device_id pciidlist[] = {
savage_PCI_IDS
};
+static const struct file_operations savage_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_PCI_DMA,
@@ -44,17 +55,7 @@ static struct drm_driver driver = {
.reclaim_buffers = savage_reclaim_buffers,
.ioctls = savage_ioctls,
.dma_ioctl = savage_bci_buffers,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
- .llseek = noop_llseek,
- },
-
+ .fops = &savage_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index 46d5be6..8688ab4 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -63,6 +63,17 @@ static int sis_driver_unload(struct drm_device *dev)
return 0;
}
+static const struct file_operations sis_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver = {
.driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR,
.load = sis_driver_load,
@@ -72,17 +83,7 @@ static struct drm_driver driver = {
.reclaim_buffers_idlelocked = sis_reclaim_buffers_locked,
.lastclose = sis_lastclose,
.ioctls = sis_ioctls,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
- .llseek = noop_llseek,
- },
-
+ .fops = &sis_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/tdfx/tdfx_drv.c b/drivers/gpu/drm/tdfx/tdfx_drv.c
index 8bf9881..fb6e97f 100644
--- a/drivers/gpu/drm/tdfx/tdfx_drv.c
+++ b/drivers/gpu/drm/tdfx/tdfx_drv.c
@@ -39,20 +39,21 @@ static struct pci_device_id pciidlist[] = {
tdfx_PCI_IDS
};
+static const struct file_operations tdfx_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver = {
.driver_features = DRIVER_USE_MTRR,
.reclaim_buffers = drm_core_reclaim_buffers,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
- .llseek = noop_llseek,
- },
-
+ .fops = &tdfx_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c
index 920a552..dcb0c44 100644
--- a/drivers/gpu/drm/via/via_drv.c
+++ b/drivers/gpu/drm/via/via_drv.c
@@ -32,6 +32,17 @@ static struct pci_device_id pciidlist[] = {
viadrv_PCI_IDS
};
+static const struct file_operations via_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ |
@@ -52,17 +63,7 @@ static struct drm_driver driver = {
.reclaim_buffers_idlelocked = via_reclaim_buffers_locked,
.lastclose = via_lastclose,
.ioctls = via_ioctls,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
- .llseek = noop_llseek,
- },
-
+ .fops = &via_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 96949b9..8087dce 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -874,6 +874,20 @@ static const struct dev_pm_ops vmw_pm_ops = {
.resume = vmw_pm_resume,
};
+static const struct file_operations vmwgfx_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = vmw_unlocked_ioctl,
+ .mmap = vmw_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+#if defined(CONFIG_COMPAT)
+ .compat_ioctl = drm_compat_ioctl,
+#endif
+ .llseek = noop_llseek,
+};
+
static struct drm_driver driver = {
.driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
DRIVER_MODESET,
@@ -896,19 +910,7 @@ static struct drm_driver driver = {
.master_drop = vmw_master_drop,
.open = vmw_driver_open,
.postclose = vmw_postclose,
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = vmw_unlocked_ioctl,
- .mmap = vmw_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
-#if defined(CONFIG_COMPAT)
- .compat_ioctl = drm_compat_ioctl,
-#endif
- .llseek = noop_llseek,
- },
+ .fops = &vmwgfx_driver_fops,
.name = VMWGFX_DRIVER_NAME,
.desc = VMWGFX_DRIVER_DESC,
.date = VMWGFX_DRIVER_DATE,
diff --git a/drivers/staging/gma500/psb_drv.c b/drivers/staging/gma500/psb_drv.c
index b2cdce7..f71e13a 100644
--- a/drivers/staging/gma500/psb_drv.c
+++ b/drivers/staging/gma500/psb_drv.c
@@ -1150,6 +1150,17 @@ static struct vm_operations_struct psb_gem_vm_ops = {
.close = drm_gem_vm_close,
};
+static const struct file_operations gma500_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = psb_unlocked_ioctl,
+ .mmap = drm_gem_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+ .read = drm_read,
+};
+
static struct drm_driver driver = {
.driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | \
DRIVER_IRQ_VBL | DRIVER_MODESET | DRIVER_GEM ,
@@ -1178,17 +1189,7 @@ static struct drm_driver driver = {
.dumb_create = psb_gem_dumb_create,
.dumb_map_offset = psb_gem_dumb_map_gtt,
.dumb_destroy = psb_gem_dumb_destroy,
-
- .fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .unlocked_ioctl = psb_unlocked_ioctl,
- .mmap = drm_gem_mmap,
- .poll = drm_poll,
- .fasync = drm_fasync,
- .read = drm_read,
- },
+ .fops = &gma500_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = PSB_DRM_DRIVER_DATE,
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 9b7c2bb..add8f4f 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -917,7 +917,7 @@ struct drm_driver {
int dev_priv_size;
struct drm_ioctl_desc *ioctls;
int num_ioctls;
- struct file_operations fops;
+ const struct file_operations *fops;
union {
struct pci_driver *pci;
struct platform_device *platform_device;
--
1.7.6
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
^ permalink raw reply related
* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
From: Jamie Iles @ 2011-10-31 14:26 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20111031141322.GK19187@n2100.arm.linux.org.uk>
Hi Russell,
On Mon, Oct 31, 2011 at 02:13:22PM +0000, Russell King - ARM Linux wrote:
> On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> > The only downside is that I have to go over all of the platforms again
> > unless I can polish up my Coccinelle-fu. Ho-hum.
>
> Well, I've just given coccinelle a go, and having read all the hype about
> it, I'm completely disappointed with it to the extent that I'm going to
> uninstall the tool from my system (unless someone can point out what I'm
> doing wrong.)
>
> I thought I'd give it a spin on a nice simple change - deleting the
> local_irq_disable() calls inside arch_reset() (irqs have already been
> disabled by this time):
>
> @@
> identifier mode, cmd;
> @@
>
> arch_reset(char mode, const char *cmd)
> {
> ...
> - local_irq_disable();
> ...
> }
>
> $ spatch -sp_file arch_reset-1.cocci arch/arm/*/include/*/system.h > arch_reset-1.diff
>
> The diff it created contains:
>
> --- arch/arm/mach-ep93xx/include/mach/system.h 2011-03-04 19:52:46.419272878 +0000
> +++ /tmp/cocci-output-380-f841cc-system.h 2011-10-31 13:54:52.066705107 +0000
> ...
> --- arch/arm/mach-iop32x/include/mach/system.h 2011-03-04 19:52:46.445272534 +0000
> +++ /tmp/cocci-output-380-c0e3f4-system.h 2011-10-31 13:54:52.072705051 +0000
> ...
> --- arch/arm/mach-ixp2000/include/mach/system.h 2011-03-04 19:52:46.449272482 +0000
> +++ /tmp/cocci-output-380-467f17-system.h 2011-10-31 13:54:52.079704984 +0000
> ...
>
> which in total deletes 6 lines. However, the patch is rejected by
> git apply and gnu patch as it stands - it needs the filenames to be
> edited to something more reasonable. So that also takes six edits.
I think you need:
spatch -sp_file arch_reset-1.cocci -patch . arch/arm/*/include/*/system.h > \
arch_reset-1.diff
I've also used -in_place in the past then use git to generate the diff,
but I guess it is nicer to have the patch self-contained.
Jamie
^ permalink raw reply
* Re: [ANNOUNCE] Git 1.7.8.rc0
From: Stefan Näwe @ 2011-10-31 14:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git@vger.kernel.org, Linux Kernel
In-Reply-To: <7vfwi9rc0g.fsf@alter.siamese.dyndns.org>
Am 31.10.2011 06:00, schrieb Junio C Hamano:
> A release candidate Git 1.7.8.rc0 is available for testing.
>
> [...]
>
>
> Git v1.7.8 Release Notes (draft)
> ================================
>
> Updates since v1.7.7
> --------------------
>
> [...]
>
> * HTTP transport did not use pushurl correctly, and also did not tell
> what host it is trying to authenticate with when asking for
> credentials.
> (merge deba493 jk/http-auth later to maint).
This seems to break pushing with https for me.
It never uses values from my '~/.netrc'.
I'll come up with a detailed scenario later.
Stefan
--
----------------------------------------------------------------
/dev/random says: Justice is incidental to law and order.
python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')"
^ permalink raw reply
* Re: [PATCH v3] ASoC: Add new Realtek ALC5632 CODEC driver.
From: Girdwood, Liam @ 2011-10-31 14:28 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: alsa-devel, broonie, Andrey Danin
In-Reply-To: <1319913743-2693-1-git-send-email-leon@leon.nu>
On 29 October 2011 19:42, Leon Romanovsky <leon@leon.nu> wrote:
> This driver implements basic functionality, using I²C for the control
> channel.
>
> Signed-off-by: Leon Romanovsky <leon@leon.nu>
> Signed-off-by: Andrey Danin <danindrey@mail.ru>
>
Mostly looks fine, just some minor comments.
> ---
> v3:
> * DAC is now handled by DAPM
> * Power down control correct handling.
> * Fixed speaker dapm routes.
> * Remove unused variables.
> * Sync stream names in DAPM and codec dai.
> * Use update bits instead write to reg in power depop function.
> * Rename Route to AB-D Amp Mux
> * Add snd controls to codec driver. Don't register it in probe.
> * Add dapm widgets and routes to codec driver. Don't register it.
> * Don't force power for spk apm, main i2s. It is described in DAPM.
> * Set symmetric_rates flag to prevent different rates for playback and capture.
> * Removed commented DEBUG definition.
> * Use SOC infrastructure sync cache mechanism.
> * Remove non possible IF switch.
> * Fix indentation issues
> * Convert alc5632 MICBIAS to a supply widget
> * Remove codec input parameter
> * Remove VERSION define
> * Remove unnecessary dev_kfree() and update copyright notice
> * Control speaker amplifier with DAPM.
> * Let machine driver choose master/slave mode for the codec.
> * Clean up. removed dev_dbg.
> * Use devm_kzalloc/devm_kzfree for memory allocation/deallocation.
> * Fixed stereo headphones playback.
> * Set up correct name for Stereo DAC volume item.
> v2: Free from checkpatch warnings
> v1: Initial code drop
> ---
> ---
> include/sound/alc5632.h | 33 +
> sound/soc/codecs/Kconfig | 4 +
> sound/soc/codecs/Makefile | 2 +
> sound/soc/codecs/alc5632.c | 1157 ++++++++++++++++++++
> sound/soc/codecs/alc5632.h | 243 +++++
> 6 files changed, 3869 insertions(+), 0 deletions(-)
> create mode 100644 include/sound/alc5632.h
> create mode 100644 sound/soc/codecs/alc5632.c
> create mode 100644 sound/soc/codecs/alc5632.h
>
> diff --git a/include/sound/alc5632.h b/include/sound/alc5632.h
> new file mode 100644
> index 0000000..b994350
> --- /dev/null
> +++ b/include/sound/alc5632.h
> @@ -0,0 +1,33 @@
> +/*
> +* alc5632.h -- Platform data for ALC5632
> +*
> +* Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
> +*
> +* Authors: Leon Romanovsky <leon@leon.nu>
> +* Andrey Danin <danindrey@mail.ru>
> +* Ilya Petrov <ilya.muromec@gmail.com>
> +* Marc Dietrich <marvin24@gmx.de>
> +*
> +* Based on alc5623.h by Arnaud Patard
> +*
> +* This program is free software; you can redistribute it and/or modify
> +* it under the terms of the GNU General Public License version 2 as
> +* published by the Free Software Foundation.
> +*/
> +
> +#ifndef _INCLUDE_SOUND_ALC5632_H
> +#define _INCLUDE_SOUND_ALC5632_H
> +
> +struct alc5632_platform_data {
> + /* configure : */
> + /* Lineout/Speaker Amps Vmid ratio control */
> + /* enable/disable adc/dac high pass filters */
> + unsigned int add_ctrl;
> + /* configure : */
> + /* output to enable when jack is low */
> + /* output to enable when jack is high */
> + /* jack detect (gpio/nc/jack detect [12] */
> + unsigned int jack_det_ctrl;
> +};
> +
> +#endif
> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
> index 4584514..cd0aa46 100644
> --- a/sound/soc/codecs/Kconfig
> +++ b/sound/soc/codecs/Kconfig
> @@ -26,6 +26,7 @@ config SND_SOC_ALL_CODECS
> select SND_SOC_AK4642 if I2C
> select SND_SOC_AK4671 if I2C
> select SND_SOC_ALC5623 if I2C
> + select SND_SOC_ALC5632 if I2C
> select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC
> select SND_SOC_CS42L51 if I2C
> select SND_SOC_CS4270 if I2C
> @@ -169,6 +170,9 @@ config SND_SOC_AK4671
> config SND_SOC_ALC5623
> tristate
>
> +config SND_SOC_ALC5632
> + tristate
> +
> config SND_SOC_CQ0093VC
> tristate
>
> diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
> index a2c7842..98bf1b6 100644
> --- a/sound/soc/codecs/Makefile
> +++ b/sound/soc/codecs/Makefile
> @@ -29,6 +29,7 @@ snd-soc-pcm3008-objs := pcm3008.o
> snd-soc-rt5631-objs := rt5631.o
> snd-soc-sgtl5000-objs := sgtl5000.o
> snd-soc-alc5623-objs := alc5623.o
> +snd-soc-alc5632-objs := alc5632.0
> snd-soc-sn95031-objs := sn95031.o
> snd-soc-spdif-objs := spdif_transciever.o
> snd-soc-ssm2602-objs := ssm2602.o
> @@ -113,6 +114,7 @@ obj-$(CONFIG_SND_SOC_AK4641) += snd-soc-ak4641.o
> obj-$(CONFIG_SND_SOC_AK4642) += snd-soc-ak4642.o
> obj-$(CONFIG_SND_SOC_AK4671) += snd-soc-ak4671.o
> obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o
> +obj-$(CONFIG_SND_SOC_ALC5632) += snd-soc-alc5632.o
> obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o
> obj-$(CONFIG_SND_SOC_CS42L51) += snd-soc-cs42l51.o
> obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o
> diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c
> new file mode 100644
> index 0000000..d4383f7
> --- /dev/null
> +++ b/sound/soc/codecs/alc5632.c
> @@ -0,0 +1,1157 @@
> +/*
> +* alc5632.c -- ALC5632 ALSA SoC Audio Codec
> +*
> +* Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
> +*
> +* Authors: Leon Romanovsky <leon@leon.nu>
> +* Andrey Danin <danindrey@mail.ru>
> +* Ilya Petrov <ilya.muromec@gmail.com>
> +* Marc Dietrich <marvin24@gmx.de>
> +*
> +* Based on alc5623.c by Arnaud Patard
> +*
> +* This program is free software; you can redistribute it and/or modify
> +* it under the terms of the GNU General Public License version 2 as
> +* published by the Free Software Foundation.
> +*/
> +
> +#include <linux/module.h>
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/delay.h>
> +#include <linux/pm.h>
> +#include <linux/i2c.h>
> +#include <linux/slab.h>
> +#include <linux/platform_device.h>
> +#include <sound/core.h>
> +#include <sound/pcm.h>
> +#include <sound/pcm_params.h>
> +#include <sound/tlv.h>
> +#include <sound/soc.h>
> +#include <sound/initval.h>
> +#include <sound/alc5632.h>
> +
> +#include "alc5632.h"
> +
> +/*
> + * ALC5632 register cache
> + */
> +static const u16 alc5632_reg_defaults[] = {
> + 0x59B4, 0x0000, 0x8080, 0x0000, /* 0 */
> + 0x8080, 0x0000, 0x8080, 0x0000, /* 4 */
> + 0xC800, 0x0000, 0xE808, 0x0000, /* 8 */
> + 0x1010, 0x0000, 0x0808, 0x0000, /* 12 */
> + 0xEE0F, 0x0000, 0xCBCB, 0x0000, /* 16 */
> + 0x7F7F, 0x0000, 0x0000, 0x0000, /* 20 */
> + 0xE010, 0x0000, 0x0000, 0x0000, /* 24 */
> + 0x8008, 0x0000, 0x0000, 0x0000, /* 28 */
> + 0x0000, 0x0000, 0x0000, 0x0000, /* 32 */
> + 0x00C0, 0x0000, 0xEF00, 0x0000, /* 36 */
> + 0x0000, 0x0000, 0x0000, 0x0000, /* 40 */
> + 0x0000, 0x0000, 0x0000, 0x0000, /* 44 */
> + 0x0000, 0x0000, 0x0000, 0x0000, /* 48 */
> + 0x8000, 0x0000, 0x0000, 0x0000, /* 52 */
> + 0x0000, 0x0000, 0x0000, 0x0000, /* 56 */
> + 0x0000, 0x0000, 0x8000, 0x0000, /* 60 */
> + 0x0C0A, 0x0000, 0x0000, 0x0000, /* 64 */
> + 0x0000, 0x0000, 0x0000, 0x0000, /* 68 */
> + 0x0000, 0x0000, 0x0000, 0x0000, /* 72 */
> + 0xBE3E, 0x0000, 0xBE3E, 0x0000, /* 76 */
> + 0x0000, 0x0000, 0x0000, 0x0000, /* 80 */
> + 0x803A, 0x0000, 0x0000, 0x0000, /* 84 */
> + 0x0000, 0x0000, 0x0009, 0x0000, /* 88 */
> + 0x0000, 0x0000, 0x3000, 0x0000, /* 92 */
> + 0x3075, 0x0000, 0x1010, 0x0000, /* 96 */
> + 0x3110, 0x0000, 0x0000, 0x0000, /* 100 */
> + 0x0553, 0x0000, 0x0000, 0x0000, /* 104 */
> + 0x0000, 0x0000, 0x0000, 0x0000, /* 108 */
> +};
> +
> +/* codec private data */
> +struct alc5632_priv {
> + enum snd_soc_control_type control_type;
> + void *control_data;
> + struct mutex mutex;
> + u8 id;
> + unsigned int sysclk;
> + unsigned int add_ctrl;
> + unsigned int jack_det_ctrl;
> +};
> +
> +static int alc5632_volatile_register(struct snd_soc_codec *codec,
> + unsigned int reg)
> +{
> + switch (reg) {
> + case ALC5632_RESET:
> + case ALC5632_PWR_DOWN_CTRL_STATUS:
> + case ALC5632_GPIO_PIN_STATUS:
> + case ALC5632_OVER_CURR_STATUS:
> + case ALC5632_HID_CTRL_DATA:
> + case ALC5632_EQ_CTRL:
> + return 1;
> +
> + default:
> + break;
> + }
> +
> + return 0;
> +}
> +
> +static inline int alc5632_reset(struct snd_soc_codec *codec)
> +{
> + snd_soc_write(codec, ALC5632_RESET, 0);
> + return snd_soc_read(codec, ALC5632_RESET);
> +}
> +
> +static int amp_mixer_event(struct snd_soc_dapm_widget *w,
> + struct snd_kcontrol *kcontrol, int event)
> +{
> + /* to power-on/off class-d amp generators/speaker */
> + /* need to write to 'index-46h' register : */
> + /* so write index num (here 0x46) to reg 0x6a */
> + /* and then 0xffff/0 to reg 0x6c */
> + snd_soc_write(w->codec, ALC5632_HID_CTRL_INDEX, 0x46);
> +
> + switch (event) {
> + case SND_SOC_DAPM_PRE_PMU:
> + snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0xFFFF);
> + break;
> + case SND_SOC_DAPM_POST_PMD:
> + snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0);
> + break;
> + }
> +
> + return 0;
> +}
> +
> +/*
> + * ALC5632 Controls
> + */
> +
> +/* -34.5db min scale, 1.5db steps, no mute */
> +static const DECLARE_TLV_DB_SCALE(vol_tlv, -3450, 150, 0);
> +/* -46.5db min scale, 1.5db steps, no mute */
> +static const DECLARE_TLV_DB_SCALE(hp_tlv, -4650, 150, 0);
> +/* -16.5db min scale, 1.5db steps, no mute */
> +static const DECLARE_TLV_DB_SCALE(adc_rec_tlv, -1650, 150, 0);
> +static const unsigned int boost_tlv[] = {
> + TLV_DB_RANGE_HEAD(3),
> + 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
> + 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
> + 2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0),
> +};
> +/* 0db min scale, 6 db steps, no mute */
> +static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0);
> +/* 0db min scalem 0.75db steps, no mute */
> +static const DECLARE_TLV_DB_SCALE(vdac_tlv, -3525, 075, 0);
> +
> +static const struct snd_kcontrol_new alc5632_vol_snd_controls[] = {
> + /* left starts at bit 8, right at bit 0 */
> + /* 31 steps (5 bit), -46.5db scale */
> + SOC_DOUBLE_TLV("Line Playback Volume",
> + ALC5632_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv),
> + /* bit 15 mutes left, bit 7 right */
> + SOC_DOUBLE("Line Playback Switch",
> + ALC5632_SPK_OUT_VOL, 15, 7, 1, 1),
> + SOC_DOUBLE_TLV("Headphone Playback Volume",
> + ALC5632_HP_OUT_VOL, 8, 0, 31, 1, hp_tlv),
> + SOC_DOUBLE("Headphone Playback Switch",
> + ALC5632_HP_OUT_VOL, 15, 7, 1, 1),
> +};
> +
> +static const struct snd_kcontrol_new alc5632_snd_controls[] = {
> + SOC_DOUBLE_TLV("Auxout Playback Volume",
> + ALC5632_AUX_OUT_VOL, 8, 0, 31, 1, hp_tlv),
> + SOC_DOUBLE("Auxout Playback Switch",
> + ALC5632_AUX_OUT_VOL, 15, 7, 1, 1),
> + SOC_SINGLE_TLV("Voice DAC Playback Volume",
> + ALC5632_VOICE_DAC_VOL, 0, 63, 0, vdac_tlv),
> + SOC_SINGLE_TLV("Phone Capture Volume",
> + ALC5632_PHONE_IN_VOL, 8, 31, 1, vol_tlv),
> + SOC_DOUBLE_TLV("LineIn Capture Volume",
> + ALC5632_LINE_IN_VOL, 8, 0, 31, 1, vol_tlv),
> + SOC_DOUBLE_TLV("Stereo DAC Playback Volume",
> + ALC5632_STEREO_DAC_IN_VOL, 8, 0, 63, 1, vdac_tlv),
> + SOC_DOUBLE("Stereo DAC Playback Switch",
> + ALC5632_STEREO_DAC_IN_VOL, 15, 7, 1, 1),
> + SOC_SINGLE_TLV("Mic1 Capture Volume",
> + ALC5632_MIC_VOL, 8, 31, 1, vol_tlv),
> + SOC_SINGLE_TLV("Mic2 Capture Volume",
> + ALC5632_MIC_VOL, 0, 31, 1, vol_tlv),
> + SOC_DOUBLE_TLV("Rec Capture Volume",
> + ALC5632_ADC_REC_GAIN, 8, 0, 31, 0, adc_rec_tlv),
> + SOC_SINGLE_TLV("Mic 1 Boost Volume",
> + ALC5632_MIC_CTRL, 10, 2, 0, boost_tlv),
> + SOC_SINGLE_TLV("Mic 2 Boost Volume",
> + ALC5632_MIC_CTRL, 8, 2, 0, boost_tlv),
> + SOC_SINGLE_TLV("Digital Boost Volume",
> + ALC5632_DIGI_BOOST_CTRL, 0, 7, 0, dig_tlv),
> +};
> +
> +/*
> + * DAPM Controls
> + */
> +static const struct snd_kcontrol_new alc5632_hp_mixer_controls[] = {
> +SOC_DAPM_SINGLE("LI2HP Playback Switch", ALC5632_LINE_IN_VOL, 15, 1, 1),
> +SOC_DAPM_SINGLE("PHONE2HP Playback Switch", ALC5632_PHONE_IN_VOL, 15, 1, 1),
> +SOC_DAPM_SINGLE("MIC12HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 15, 1, 1),
> +SOC_DAPM_SINGLE("MIC22HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 11, 1, 1),
> +SOC_DAPM_SINGLE("VOICE2HP Playback Switch", ALC5632_VOICE_DAC_VOL, 15, 1, 1),
> +};
> +
> +static const struct snd_kcontrol_new alc5632_hpl_mixer_controls[] = {
> +SOC_DAPM_SINGLE("ADC2HP_L Playback Switch", ALC5632_ADC_REC_GAIN, 15, 1, 1),
> +SOC_DAPM_SINGLE("DACL2HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 3, 1, 1),
> +};
> +
> +static const struct snd_kcontrol_new alc5632_hpr_mixer_controls[] = {
> +SOC_DAPM_SINGLE("ADC2HP_R Playback Switch", ALC5632_ADC_REC_GAIN, 7, 1, 1),
> +SOC_DAPM_SINGLE("DACR2HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 2, 1, 1),
> +};
> +
> +static const struct snd_kcontrol_new alc5632_mono_mixer_controls[] = {
> +SOC_DAPM_SINGLE("ADC2MONO_L Playback Switch", ALC5632_ADC_REC_GAIN, 14, 1, 1),
> +SOC_DAPM_SINGLE("ADC2MONO_R Playback Switch", ALC5632_ADC_REC_GAIN, 6, 1, 1),
> +SOC_DAPM_SINGLE("LI2MONO Playback Switch", ALC5632_LINE_IN_VOL, 13, 1, 1),
> +SOC_DAPM_SINGLE("MIC12MONO Playback Switch",
> + ALC5632_MIC_ROUTING_CTRL, 13, 1, 1),
> +SOC_DAPM_SINGLE("MIC22MONO Playback Switch",
> + ALC5632_MIC_ROUTING_CTRL, 9, 1, 1),
> +SOC_DAPM_SINGLE("DAC2MONO Playback Switch", ALC5632_MIC_ROUTING_CTRL, 0, 1, 1),
> +SOC_DAPM_SINGLE("VOICE2MONO Playback Switch", ALC5632_VOICE_DAC_VOL, 13, 1, 1),
> +};
> +
> +static const struct snd_kcontrol_new alc5632_speaker_mixer_controls[] = {
> +SOC_DAPM_SINGLE("LI2SPK Playback Switch", ALC5632_LINE_IN_VOL, 14, 1, 1),
> +SOC_DAPM_SINGLE("PHONE2SPK Playback Switch", ALC5632_PHONE_IN_VOL, 14, 1, 1),
> +SOC_DAPM_SINGLE("MIC12SPK Playback Switch",
> + ALC5632_MIC_ROUTING_CTRL, 14, 1, 1),
> +SOC_DAPM_SINGLE("MIC22SPK Playback Switch",
> + ALC5632_MIC_ROUTING_CTRL, 10, 1, 1),
> +SOC_DAPM_SINGLE("DAC2SPK Playback Switch", ALC5632_MIC_ROUTING_CTRL, 1, 1, 1),
> +SOC_DAPM_SINGLE("VOICE2SPK Playback Switch", ALC5632_VOICE_DAC_VOL, 14, 1, 1),
> +};
> +
> +/* Left Record Mixer */
> +static const struct snd_kcontrol_new alc5632_captureL_mixer_controls[] = {
> +SOC_DAPM_SINGLE("Mic1 Capture Switch", ALC5632_ADC_REC_MIXER, 14, 1, 1),
> +SOC_DAPM_SINGLE("Mic2 Capture Switch", ALC5632_ADC_REC_MIXER, 13, 1, 1),
> +SOC_DAPM_SINGLE("LineInL Capture Switch", ALC5632_ADC_REC_MIXER, 12, 1, 1),
> +SOC_DAPM_SINGLE("Left Phone Capture Switch", ALC5632_ADC_REC_MIXER, 11, 1, 1),
> +SOC_DAPM_SINGLE("HPMixerL Capture Switch", ALC5632_ADC_REC_MIXER, 10, 1, 1),
> +SOC_DAPM_SINGLE("SPKMixer Capture Switch", ALC5632_ADC_REC_MIXER, 9, 1, 1),
> +SOC_DAPM_SINGLE("MonoMixer Capture Switch", ALC5632_ADC_REC_MIXER, 8, 1, 1),
> +};
> +
> +/* Right Record Mixer */
> +static const struct snd_kcontrol_new alc5632_captureR_mixer_controls[] = {
> +SOC_DAPM_SINGLE("Mic1 Capture Switch", ALC5632_ADC_REC_MIXER, 6, 1, 1),
> +SOC_DAPM_SINGLE("Mic2 Capture Switch", ALC5632_ADC_REC_MIXER, 5, 1, 1),
> +SOC_DAPM_SINGLE("LineInR Capture Switch", ALC5632_ADC_REC_MIXER, 4, 1, 1),
> +SOC_DAPM_SINGLE("Right Phone Capture Switch", ALC5632_ADC_REC_MIXER, 3, 1, 1),
> +SOC_DAPM_SINGLE("HPMixerR Capture Switch", ALC5632_ADC_REC_MIXER, 2, 1, 1),
> +SOC_DAPM_SINGLE("SPKMixer Capture Switch", ALC5632_ADC_REC_MIXER, 1, 1, 1),
> +SOC_DAPM_SINGLE("MonoMixer Capture Switch", ALC5632_ADC_REC_MIXER, 0, 1, 1),
> +};
> +
> +static const char *alc5632_spk_n_sour_sel[] = {
> + "RN/-R", "RP/+R", "LN/-R", "Mute"};
> +static const char *alc5632_hpl_out_input_sel[] = {
> + "Vmid", "HP Left Mix"};
> +static const char *alc5632_hpr_out_input_sel[] = {
> + "Vmid", "HP Right Mix"};
> +static const char *alc5632_spkout_input_sel[] = {
> + "Vmid", "HPOut Mix", "Speaker Mix", "Mono Mix"};
> +static const char *alc5632_aux_out_input_sel[] = {
> + "Vmid", "HPOut Mix", "Speaker Mix", "Mono Mix"};
> +
> +/* auxout output mux */
> +static const struct soc_enum alc5632_aux_out_input_enum =
> +SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 6, 4, alc5632_aux_out_input_sel);
> +static const struct snd_kcontrol_new alc5632_auxout_mux_controls =
> +SOC_DAPM_ENUM("AuxOut Mux", alc5632_aux_out_input_enum);
> +
> +/* speaker output mux */
> +static const struct soc_enum alc5632_spkout_input_enum =
> +SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 10, 4, alc5632_spkout_input_sel);
> +static const struct snd_kcontrol_new alc5632_spkout_mux_controls =
> +SOC_DAPM_ENUM("SpeakerOut Mux", alc5632_spkout_input_enum);
> +
> +/* headphone left output mux */
> +static const struct soc_enum alc5632_hpl_out_input_enum =
> +SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 9, 2, alc5632_hpl_out_input_sel);
> +static const struct snd_kcontrol_new alc5632_hpl_out_mux_controls =
> +SOC_DAPM_ENUM("Left Headphone Mux", alc5632_hpl_out_input_enum);
> +
> +/* headphone right output mux */
> +static const struct soc_enum alc5632_hpr_out_input_enum =
> +SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 8, 2, alc5632_hpr_out_input_sel);
> +static const struct snd_kcontrol_new alc5632_hpr_out_mux_controls =
> +SOC_DAPM_ENUM("Right Headphone Mux", alc5632_hpr_out_input_enum);
> +
> +/* speaker output N select */
> +static const struct soc_enum alc5632_spk_n_sour_enum =
> +SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 14, 4, alc5632_spk_n_sour_sel);
> +static const struct snd_kcontrol_new alc5632_spkoutn_mux_controls =
> +SOC_DAPM_ENUM("SpeakerOut N Mux", alc5632_spk_n_sour_enum);
> +
> +/* speaker amplifier */
> +static const char *alc5632_amp_names[] = {"AB Amp", "D Amp"};
> +static const struct soc_enum alc5632_amp_enum =
> + SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 13, 2, alc5632_amp_names);
> +static const struct snd_kcontrol_new alc5632_amp_mux_controls =
> + SOC_DAPM_ENUM("AB-D Amp Mux", alc5632_amp_enum);
> +
> +
> +static const struct snd_soc_dapm_widget alc5632_dapm_widgets[] = {
> +/* Muxes */
> +SND_SOC_DAPM_MUX("AuxOut Mux", SND_SOC_NOPM, 0, 0,
> + &alc5632_auxout_mux_controls),
> +SND_SOC_DAPM_MUX("SpeakerOut Mux", SND_SOC_NOPM, 0, 0,
> + &alc5632_spkout_mux_controls),
> +SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0,
> + &alc5632_hpl_out_mux_controls),
> +SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0,
> + &alc5632_hpr_out_mux_controls),
> +SND_SOC_DAPM_MUX("SpeakerOut N Mux", SND_SOC_NOPM, 0, 0,
> + &alc5632_spkoutn_mux_controls),
> +
> +/* output mixers */
> +SND_SOC_DAPM_MIXER("HP Mix", SND_SOC_NOPM, 0, 0,
> + &alc5632_hp_mixer_controls[0],
> + ARRAY_SIZE(alc5632_hp_mixer_controls)),
> +SND_SOC_DAPM_MIXER("HPR Mix", ALC5632_PWR_MANAG_ADD2, 4, 0,
> + &alc5632_hpr_mixer_controls[0],
> + ARRAY_SIZE(alc5632_hpr_mixer_controls)),
> +SND_SOC_DAPM_MIXER("HPL Mix", ALC5632_PWR_MANAG_ADD2, 5, 0,
> + &alc5632_hpl_mixer_controls[0],
> + ARRAY_SIZE(alc5632_hpl_mixer_controls)),
> +SND_SOC_DAPM_MIXER("HPOut Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
> +SND_SOC_DAPM_MIXER("Mono Mix", ALC5632_PWR_MANAG_ADD2, 2, 0,
> + &alc5632_mono_mixer_controls[0],
> + ARRAY_SIZE(alc5632_mono_mixer_controls)),
> +SND_SOC_DAPM_MIXER("Speaker Mix", ALC5632_PWR_MANAG_ADD2, 3, 0,
> + &alc5632_speaker_mixer_controls[0],
> + ARRAY_SIZE(alc5632_speaker_mixer_controls)),
> +
> +/* input mixers */
> +SND_SOC_DAPM_MIXER("Left Capture Mix", ALC5632_PWR_MANAG_ADD2, 1, 0,
> + &alc5632_captureL_mixer_controls[0],
> + ARRAY_SIZE(alc5632_captureL_mixer_controls)),
> +SND_SOC_DAPM_MIXER("Right Capture Mix", ALC5632_PWR_MANAG_ADD2, 0, 0,
> + &alc5632_captureR_mixer_controls[0],
> + ARRAY_SIZE(alc5632_captureR_mixer_controls)),
> +
> +SND_SOC_DAPM_DAC("Left DAC", "HiFi Playback",
> + ALC5632_PWR_MANAG_ADD2, 9, 0),
> +SND_SOC_DAPM_DAC("Right DAC", "HiFi Playback",
> + ALC5632_PWR_MANAG_ADD2, 8, 0),
> +SND_SOC_DAPM_MIXER("DAC Left Channel", ALC5632_PWR_MANAG_ADD1, 15, 0, NULL, 0),
> +SND_SOC_DAPM_MIXER("DAC Right Channel", ALC5632_PWR_MANAG_ADD1, 14, 0, NULL, 0),
> +SND_SOC_DAPM_MIXER("I2S Mix", ALC5632_PWR_MANAG_ADD1, 11, 0, NULL, 0),
> +SND_SOC_DAPM_MIXER("Phone Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
> +SND_SOC_DAPM_MIXER("Line Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
> +SND_SOC_DAPM_ADC("Left ADC", "HiFi Capture",
> + ALC5632_PWR_MANAG_ADD2, 7, 0),
> +SND_SOC_DAPM_ADC("Right ADC", "HiFi Capture",
> + ALC5632_PWR_MANAG_ADD2, 6, 0),
> +SND_SOC_DAPM_PGA("Left Headphone", ALC5632_PWR_MANAG_ADD3, 11, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("Right Headphone", ALC5632_PWR_MANAG_ADD3, 10, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("Left Speaker", ALC5632_PWR_MANAG_ADD3, 13, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("Right Speaker", ALC5632_PWR_MANAG_ADD3, 12, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("Aux Out", ALC5632_PWR_MANAG_ADD3, 14, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("Left LineIn", ALC5632_PWR_MANAG_ADD3, 7, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("Right LineIn", ALC5632_PWR_MANAG_ADD3, 6, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("Phone", ALC5632_PWR_MANAG_ADD3, 5, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("Phone ADMix", ALC5632_PWR_MANAG_ADD3, 4, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("MIC1 PGA", ALC5632_PWR_MANAG_ADD3, 3, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("MIC2 PGA", ALC5632_PWR_MANAG_ADD3, 2, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("MIC1 Pre Amp", ALC5632_PWR_MANAG_ADD3, 1, 0, NULL, 0),
> +SND_SOC_DAPM_PGA("MIC2 Pre Amp", ALC5632_PWR_MANAG_ADD3, 0, 0, NULL, 0),
> +SND_SOC_DAPM_SUPPLY("Mic Bias1", ALC5632_PWR_MANAG_ADD1, 3, 0, NULL, 0),
> +SND_SOC_DAPM_SUPPLY("Mic Bias2", ALC5632_PWR_MANAG_ADD1, 2, 0, NULL, 0),
> +
> +SND_SOC_DAPM_PGA_E("D Amp", ALC5632_PWR_MANAG_ADD2, 14, 0, NULL, 0,
> + amp_mixer_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
> +SND_SOC_DAPM_PGA("AB Amp", ALC5632_PWR_MANAG_ADD2, 15, 0, NULL, 0),
> +SND_SOC_DAPM_MUX("AB-D Amp Mux", ALC5632_PWR_MANAG_ADD1, 10, 0,
> + &alc5632_amp_mux_controls),
> +
> +SND_SOC_DAPM_OUTPUT("AUXOUT"),
> +SND_SOC_DAPM_OUTPUT("HPL"),
> +SND_SOC_DAPM_OUTPUT("HPR"),
> +SND_SOC_DAPM_OUTPUT("SPKOUT"),
> +SND_SOC_DAPM_OUTPUT("SPKOUTN"),
> +SND_SOC_DAPM_INPUT("LINEINL"),
> +SND_SOC_DAPM_INPUT("LINEINR"),
> +SND_SOC_DAPM_INPUT("PHONEP"),
> +SND_SOC_DAPM_INPUT("PHONEN"),
> +SND_SOC_DAPM_INPUT("MIC1"),
> +SND_SOC_DAPM_INPUT("MIC2"),
> +SND_SOC_DAPM_VMID("Vmid"),
> +};
> +
> +
> +static const struct snd_soc_dapm_route alc5632_dapm_routes[] = {
> + /* virtual mixer - mixes left & right channels */
> + {"I2S Mix", NULL, "Left DAC"},
> + {"I2S Mix", NULL, "Right DAC"},
> + {"Line Mix", NULL, "Right LineIn"},
> + {"Line Mix", NULL, "Left LineIn"},
> + {"Phone Mix", NULL, "Phone"},
> + {"Phone Mix", NULL, "Phone ADMix"},
> + {"AUXOUT", NULL, "Aux Out"},
> +
> + /* DAC */
> + {"DAC Right Channel", NULL, "I2S Mix"},
> + {"DAC Left Channel", NULL, "I2S Mix"},
> +
> + /* HP mixer */
> + {"HPL Mix", "ADC2HP_L Playback Switch", "Left Capture Mix"},
> + {"HPL Mix", NULL, "HP Mix"},
> + {"HPR Mix", "ADC2HP_R Playback Switch", "Right Capture Mix"},
> + {"HPR Mix", NULL, "HP Mix"},
> + {"HP Mix", "LI2HP Playback Switch", "Line Mix"},
> + {"HP Mix", "PHONE2HP Playback Switch", "Phone Mix"},
> + {"HP Mix", "MIC12HP Playback Switch", "MIC1 PGA"},
> + {"HP Mix", "MIC22HP Playback Switch", "MIC2 PGA"},
> +
> + {"HPR Mix", "DACR2HP Playback Switch", "DAC Right Channel"},
> + {"HPL Mix", "DACL2HP Playback Switch", "DAC Left Channel"},
> +
> + /* speaker mixer */
> + {"Speaker Mix", "LI2SPK Playback Switch", "Line Mix"},
> + {"Speaker Mix", "PHONE2SPK Playback Switch", "Phone Mix"},
> + {"Speaker Mix", "MIC12SPK Playback Switch", "MIC1 PGA"},
> + {"Speaker Mix", "MIC22SPK Playback Switch", "MIC2 PGA"},
> + {"Speaker Mix", "DAC2SPK Playback Switch", "DAC Left Channel"},
> +
> +
> +
> + /* mono mixer */
> + {"Mono Mix", "ADC2MONO_L Playback Switch", "Left Capture Mix"},
> + {"Mono Mix", "ADC2MONO_R Playback Switch", "Right Capture Mix"},
> + {"Mono Mix", "LI2MONO Playback Switch", "Line Mix"},
> + {"Mono Mix", "VOICE2MONO Playback Switch", "Phone Mix"},
> + {"Mono Mix", "MIC12MONO Playback Switch", "MIC1 PGA"},
> + {"Mono Mix", "MIC22MONO Playback Switch", "MIC2 PGA"},
> + {"Mono Mix", "DAC2MONO Playback Switch", "DAC Left Channel"},
> +
> + /* Left record mixer */
> + {"Left Capture Mix", "LineInL Capture Switch", "LINEINL"},
> + {"Left Capture Mix", "Left Phone Capture Switch", "PHONEN"},
> + {"Left Capture Mix", "Mic1 Capture Switch", "MIC1 Pre Amp"},
> + {"Left Capture Mix", "Mic2 Capture Switch", "MIC2 Pre Amp"},
> + {"Left Capture Mix", "HPMixerL Capture Switch", "HPL Mix"},
> + {"Left Capture Mix", "SPKMixer Capture Switch", "Speaker Mix"},
> + {"Left Capture Mix", "MonoMixer Capture Switch", "Mono Mix"},
> +
> + /*Right record mixer */
> + {"Right Capture Mix", "LineInR Capture Switch", "LINEINR"},
> + {"Right Capture Mix", "Right Phone Capture Switch", "PHONEP"},
> + {"Right Capture Mix", "Mic1 Capture Switch", "MIC1 Pre Amp"},
> + {"Right Capture Mix", "Mic2 Capture Switch", "MIC2 Pre Amp"},
> + {"Right Capture Mix", "HPMixerR Capture Switch", "HPR Mix"},
> + {"Right Capture Mix", "SPKMixer Capture Switch", "Speaker Mix"},
> + {"Right Capture Mix", "MonoMixer Capture Switch", "Mono Mix"},
> +
> + /* headphone left mux */
> + {"Left Headphone Mux", "HP Left Mix", "HPL Mix"},
> + {"Left Headphone Mux", "Vmid", "Vmid"},
> +
> + /* headphone right mux */
> + {"Right Headphone Mux", "HP Right Mix", "HPR Mix"},
> + {"Right Headphone Mux", "Vmid", "Vmid"},
> +
> + /* speaker out mux */
> + {"SpeakerOut Mux", "Vmid", "Vmid"},
> + {"SpeakerOut Mux", "HPOut Mix", "HPOut Mix"},
> + {"SpeakerOut Mux", "Speaker Mix", "Speaker Mix"},
> + {"SpeakerOut Mux", "Mono Mix", "Mono Mix"},
> +
> + /* Mono/Aux Out mux */
> + {"AuxOut Mux", "Vmid", "Vmid"},
> + {"AuxOut Mux", "HPOut Mix", "HPOut Mix"},
> + {"AuxOut Mux", "Speaker Mix", "Speaker Mix"},
> + {"AuxOut Mux", "Mono Mix", "Mono Mix"},
> +
> + /* output pga */
> + {"HPL", NULL, "Left Headphone"},
> + {"Left Headphone", NULL, "Left Headphone Mux"},
> + {"HPR", NULL, "Right Headphone"},
> + {"Right Headphone", NULL, "Right Headphone Mux"},
> + {"Aux Out", NULL, "AuxOut Mux"},
> +
> + /* input pga */
> + {"Left LineIn", NULL, "LINEINL"},
> + {"Right LineIn", NULL, "LINEINR"},
> + {"Phone", NULL, "PHONEP"},
> + {"MIC1 Pre Amp", NULL, "MIC1"},
> + {"MIC2 Pre Amp", NULL, "MIC2"},
> + {"MIC1 PGA", NULL, "MIC1 Pre Amp"},
> + {"MIC2 PGA", NULL, "MIC2 Pre Amp"},
> +
> + /* left ADC */
> + {"Left ADC", NULL, "Left Capture Mix"},
> +
> + /* right ADC */
> + {"Right ADC", NULL, "Right Capture Mix"},
> +
> + {"SpeakerOut N Mux", "RN/-R", "Left Speaker"},
> + {"SpeakerOut N Mux", "RP/+R", "Left Speaker"},
> + {"SpeakerOut N Mux", "LN/-R", "Left Speaker"},
> + {"SpeakerOut N Mux", "Mute", "Vmid"},
> +
> + {"SpeakerOut N Mux", "RN/-R", "Right Speaker"},
> + {"SpeakerOut N Mux", "RP/+R", "Right Speaker"},
> + {"SpeakerOut N Mux", "LN/-R", "Right Speaker"},
> + {"SpeakerOut N Mux", "Mute", "Vmid"},
> +
> + {"AB Amp", NULL, "SpeakerOut Mux"},
> + {"D Amp", NULL, "SpeakerOut Mux"},
> + {"AB-D Amp Mux", "AB Amp", "AB Amp"},
> + {"AB-D Amp Mux", "D Amp", "D Amp"},
> + {"Left Speaker", NULL, "AB-D Amp Mux"},
> + {"Right Speaker", NULL, "AB-D Amp Mux"},
> +
> + {"SPKOUT", NULL, "Left Speaker"},
> + {"SPKOUT", NULL, "Right Speaker"},
> +
> + {"SPKOUTN", NULL, "SpeakerOut N Mux"},
> +
> +};
> +
> +/* PLL divisors */
> +struct _pll_div {
> + u32 pll_in;
> + u32 pll_out;
> + u16 regvalue;
> +};
> +
> +/* Note : pll code from original alc5632 driver. Not sure of how good it is */
> +/* usefull only for master mode */
> +static const struct _pll_div codec_master_pll_div[] = {
> +
> + { 2048000, 8192000, 0x0ea0},
> + { 3686400, 8192000, 0x4e27},
> + { 12000000, 8192000, 0x456b},
> + { 13000000, 8192000, 0x495f},
> + { 13100000, 8192000, 0x0320},
> + { 2048000, 11289600, 0xf637},
> + { 3686400, 11289600, 0x2f22},
> + { 12000000, 11289600, 0x3e2f},
> + { 13000000, 11289600, 0x4d5b},
> + { 13100000, 11289600, 0x363b},
> + { 2048000, 16384000, 0x1ea0},
> + { 3686400, 16384000, 0x9e27},
> + { 12000000, 16384000, 0x452b},
> + { 13000000, 16384000, 0x542f},
> + { 13100000, 16384000, 0x03a0},
> + { 2048000, 16934400, 0xe625},
> + { 3686400, 16934400, 0x9126},
> + { 12000000, 16934400, 0x4d2c},
> + { 13000000, 16934400, 0x742f},
> + { 13100000, 16934400, 0x3c27},
> + { 2048000, 22579200, 0x2aa0},
> + { 3686400, 22579200, 0x2f20},
> + { 12000000, 22579200, 0x7e2f},
> + { 13000000, 22579200, 0x742f},
> + { 13100000, 22579200, 0x3c27},
> + { 2048000, 24576000, 0x2ea0},
> + { 3686400, 24576000, 0xee27},
> + { 12000000, 24576000, 0x2915},
> + { 13000000, 24576000, 0x772e},
> + { 13100000, 24576000, 0x0d20},
> +};
> +
> +/* FOUT = MCLK*(N+2)/((M+2)*(K+2))
> + N: bit 15:8 (div 2 .. div 257)
> + K: bit 6:4 typical 2
> + M: bit 3:0 (div 2 .. div 17)
> +
> + same as for 5623 - thanks!
> +*/
> +
> +static const struct _pll_div codec_slave_pll_div[] = {
> +
> + { 1024000, 16384000, 0x3ea0},
> + { 1411200, 22579200, 0x3ea0},
> + { 1536000, 24576000, 0x3ea0},
> + { 2048000, 16384000, 0x1ea0},
> + { 2822400, 22579200, 0x1ea0},
> + { 3072000, 24576000, 0x1ea0},
> +
> +};
> +
> +static int alc5632_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
> + int source, unsigned int freq_in, unsigned int freq_out)
> +{
> + int i;
> + struct snd_soc_codec *codec = codec_dai->codec;
> + int gbl_clk = 0, pll_div = 0;
> + u16 reg;
> +
> + if (pll_id < ALC5632_PLL_FR_MCLK || pll_id > ALC5632_PLL_FR_VBCLK)
> + return -ENODEV;
Better to use -EINVAL for invalid PLL id number.
> +
> + /* Disable PLL power */
> + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
> + ALC5632_PWR_ADD2_PLL1,
> + 0);
> + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
> + ALC5632_PWR_ADD2_PLL2,
> + 0);
> +
> + /* pll is not used in slave mode */
> + reg = snd_soc_read(codec, ALC5632_DAI_CONTROL);
> + if (reg & ALC5632_DAI_SDP_SLAVE_MODE)
> + return 0;
> +
> + if (!freq_in || !freq_out)
> + return 0;
> +
> + switch (pll_id) {
> + case ALC5632_PLL_FR_MCLK:
> + for (i = 0; i < ARRAY_SIZE(codec_master_pll_div); i++) {
> + if (codec_master_pll_div[i].pll_in == freq_in
> + && codec_master_pll_div[i].pll_out == freq_out) {
> + /* PLL source from MCLK */
> + pll_div = codec_master_pll_div[i].regvalue;
> + break;
> + }
> + }
> + break;
> + case ALC5632_PLL_FR_BCLK:
> + for (i = 0; i < ARRAY_SIZE(codec_slave_pll_div); i++) {
> + if (codec_slave_pll_div[i].pll_in == freq_in
> + && codec_slave_pll_div[i].pll_out == freq_out) {
> + /* PLL source from Bitclk */
> + gbl_clk = ALC5632_PLL_FR_BCLK;
> + pll_div = codec_slave_pll_div[i].regvalue;
> + break;
> + }
> + }
> + break;
> + case ALC5632_PLL_FR_VBCLK:
> + for (i = 0; i < ARRAY_SIZE(codec_slave_pll_div); i++) {
> + if (codec_slave_pll_div[i].pll_in == freq_in
> + && codec_slave_pll_div[i].pll_out == freq_out) {
> + /* PLL source from voice clock */
> + gbl_clk = ALC5632_PLL_FR_VBCLK;
> + pll_div = codec_slave_pll_div[i].regvalue;
> + break;
> + }
> + }
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + if (!pll_div)
> + return -EINVAL;
> +
> + /* choose MCLK/BCLK/VBCLK */
> + snd_soc_write(codec, ALC5632_GPCR2, gbl_clk);
> + /* choose PLL1 clock rate */
> + snd_soc_write(codec, ALC5632_PLL1_CTRL, pll_div);
> + /* enable PLL1 */
> + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
> + ALC5632_PWR_ADD2_PLL1,
> + ALC5632_PWR_ADD2_PLL1);
> + /* enable PLL2 */
> + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
> + ALC5632_PWR_ADD2_PLL2,
> + ALC5632_PWR_ADD2_PLL2);
> + /* use PLL1 as main SYSCLK */
> + snd_soc_update_bits(codec, ALC5632_GPCR1,
> + ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1,
> + ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1);
> +
> + return 0;
> +}
> +
> +struct _coeff_div {
> + u16 fs;
> + u16 regvalue;
> +};
> +
> +/* codec hifi mclk (after PLL) clock divider coefficients */
> +/* values inspired from column BCLK=32Fs of Appendix A table */
> +static const struct _coeff_div coeff_div[] = {
> + {512*1, 0x3075},
> +};
> +
> +static int get_coeff(struct snd_soc_codec *codec, int rate)
> +{
> + struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(coeff_div); i++) {
> + if (coeff_div[i].fs * rate == alc5632->sysclk)
> + return i;
> + }
> + return -EINVAL;
> +}
> +
> +/*
> + * Clock after PLL and dividers
> + */
> +static int alc5632_set_dai_sysclk(struct snd_soc_dai *codec_dai,
> + int clk_id, unsigned int freq, int dir)
> +{
> + struct snd_soc_codec *codec = codec_dai->codec;
> + struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
> +
> + switch (freq) {
> + case 8192000:
> + case 11289600:
> + case 12288000:
> + case 16384000:
> + case 16934400:
> + case 18432000:
> + case 22579200:
> + case 24576000:
> + alc5632->sysclk = freq;
> + return 0;
> + }
> + return -EINVAL;
> +}
> +
> +static int alc5632_set_dai_fmt(struct snd_soc_dai *codec_dai,
> + unsigned int fmt)
> +{
> + struct snd_soc_codec *codec = codec_dai->codec;
> + u16 iface = 0;
> +
> + /* set master/slave audio interface */
> + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> + case SND_SOC_DAIFMT_CBM_CFM:
> + iface = ALC5632_DAI_SDP_MASTER_MODE;
> + break;
> + case SND_SOC_DAIFMT_CBS_CFS:
> + iface = ALC5632_DAI_SDP_SLAVE_MODE;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + /* interface format */
> + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
> + case SND_SOC_DAIFMT_I2S:
> + iface |= ALC5632_DAI_I2S_DF_I2S;
> + break;
> + case SND_SOC_DAIFMT_LEFT_J:
> + iface |= ALC5632_DAI_I2S_DF_LEFT;
> + break;
> + case SND_SOC_DAIFMT_DSP_A:
> + iface |= ALC5632_DAI_I2S_DF_PCM_A;
> + break;
> + case SND_SOC_DAIFMT_DSP_B:
> + iface |= ALC5632_DAI_I2S_DF_PCM_B;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + /* clock inversion */
> + switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
> + case SND_SOC_DAIFMT_NB_NF:
> + break;
> + case SND_SOC_DAIFMT_IB_IF:
> + iface |= ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL;
> + break;
> + case SND_SOC_DAIFMT_IB_NF:
> + iface |= ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL;
> + break;
> + case SND_SOC_DAIFMT_NB_IF:
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + return snd_soc_write(codec, ALC5632_DAI_CONTROL, iface);
> +}
> +
> +static int alc5632_pcm_hw_params(struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct snd_soc_codec *codec = rtd->codec;
> + int coeff, rate;
> + u16 iface;
> +
> + iface = snd_soc_read(codec, ALC5632_DAI_CONTROL);
> + iface &= ~ALC5632_DAI_I2S_DL_MASK;
> +
> + /* bit size */
> + switch (params_format(params)) {
> + case SNDRV_PCM_FORMAT_S16_LE:
> + iface |= ALC5632_DAI_I2S_DL_16;
> + break;
> + case SNDRV_PCM_FORMAT_S20_3LE:
> + iface |= ALC5632_DAI_I2S_DL_20;
> + break;
> + case SNDRV_PCM_FORMAT_S24_LE:
> + iface |= ALC5632_DAI_I2S_DL_24;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + /* set iface & srate */
> + snd_soc_write(codec, ALC5632_DAI_CONTROL, iface);
> + rate = params_rate(params);
> + coeff = get_coeff(codec, rate);
> + if (coeff < 0)
> + return -EINVAL;
> +
> + coeff = coeff_div[coeff].regvalue;
> + snd_soc_write(codec, ALC5632_DAC_CLK_CTRL1, coeff);
> +
> + return 0;
> +}
> +
> +static int alc5632_mute(struct snd_soc_dai *dai, int mute)
> +{
> + struct snd_soc_codec *codec = dai->codec;
> + u16 hp_mute = ALC5632_MISC_HP_DEPOP_MUTE_L \
> + |ALC5632_MISC_HP_DEPOP_MUTE_R;
> + u16 mute_reg = snd_soc_read(codec, ALC5632_MISC_CTRL) & ~hp_mute;
> +
> + if (mute)
> + mute_reg |= hp_mute;
> +
> + return snd_soc_write(codec, ALC5632_MISC_CTRL, mute_reg);
> +}
> +
> +#define ALC5632_ADD2_POWER_EN (ALC5632_PWR_ADD2_VREF)
> +
> +#define ALC5632_ADD3_POWER_EN (ALC5632_PWR_ADD3_MIC1_BOOST_AD)
> +
> +#define ALC5632_ADD1_POWER_EN \
> + (ALC5632_PWR_ADD1_DAC_REF \
> + | ALC5632_PWR_ADD1_SOFTGEN_EN \
> + | ALC5632_PWR_ADD1_HP_OUT_AMP \
> + | ALC5632_PWR_ADD1_HP_OUT_ENH_AMP \
> + | ALC5632_PWR_ADD1_MAIN_BIAS)
> +
> +static void enable_power_depop(struct snd_soc_codec *codec)
> +{
> + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
> + ALC5632_PWR_ADD1_SOFTGEN_EN,
> + ALC5632_PWR_ADD1_SOFTGEN_EN);
> +
> + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3,
> + ALC5632_ADD3_POWER_EN,
> + ALC5632_ADD3_POWER_EN);
> +
> + snd_soc_update_bits(codec, ALC5632_MISC_CTRL,
> + ALC5632_MISC_HP_DEPOP_MODE2_EN,
> + ALC5632_MISC_HP_DEPOP_MODE2_EN);
> +
> + msleep(500);
> +
> + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
> + ALC5632_ADD2_POWER_EN,
> + ALC5632_ADD2_POWER_EN);
> +
> + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
> + ALC5632_ADD1_POWER_EN,
> + ALC5632_ADD1_POWER_EN);
> +
> + /* disable HP Depop2 */
> + snd_soc_update_bits(codec, ALC5632_MISC_CTRL,
> + ALC5632_MISC_HP_DEPOP_MODE2_EN,
> + 0);
> +
> +}
> +
> +static int alc5632_set_bias_level(struct snd_soc_codec *codec,
> + enum snd_soc_bias_level level)
> +{
> + switch (level) {
> + case SND_SOC_BIAS_ON:
> + enable_power_depop(codec);
> + break;
> + case SND_SOC_BIAS_PREPARE:
> + break;
> + case SND_SOC_BIAS_STANDBY:
> + /* everything off except vref/vmid, */
> + snd_soc_write(codec, ALC5632_PWR_MANAG_ADD1,
> + ALC5632_PWR_ADD1_MAIN_BIAS);
> + snd_soc_write(codec, ALC5632_PWR_MANAG_ADD2,
> + ALC5632_PWR_ADD2_VREF);
> + break;
> + case SND_SOC_BIAS_OFF:
> + /* everything off, dac mute, inactive */
> + snd_soc_write(codec, ALC5632_PWR_MANAG_ADD2, 0);
> + snd_soc_write(codec, ALC5632_PWR_MANAG_ADD3, 0);
> + snd_soc_write(codec, ALC5632_PWR_MANAG_ADD1, 0);
> + break;
> + }
> + codec->dapm.bias_level = level;
> + return 0;
> +}
> +
> +#define ALC5632_FORMATS (SNDRV_PCM_FMTBIT_S16_LE \
> + | SNDRV_PCM_FMTBIT_S24_LE \
> + | SNDRV_PCM_FMTBIT_S32_LE)
> +
> +static struct snd_soc_dai_ops alc5632_dai_ops = {
> + .hw_params = alc5632_pcm_hw_params,
> + .digital_mute = alc5632_mute,
> + .set_fmt = alc5632_set_dai_fmt,
> + .set_sysclk = alc5632_set_dai_sysclk,
> + .set_pll = alc5632_set_dai_pll,
> +};
> +
> +static struct snd_soc_dai_driver alc5632_dai = {
> + .name = "alc5632-hifi",
> + .playback = {
> + .stream_name = "HiFi Playback",
> + .channels_min = 1,
> + .channels_max = 2,
> + .rate_min = 8000,
> + .rate_max = 48000,
> + .rates = SNDRV_PCM_RATE_8000_48000,
> + .formats = ALC5632_FORMATS,},
> + .capture = {
> + .stream_name = "HiFi Capture",
> + .channels_min = 1,
> + .channels_max = 2,
> + .rate_min = 8000,
> + .rate_max = 48000,
> + .rates = SNDRV_PCM_RATE_8000_48000,
> + .formats = ALC5632_FORMATS,},
> +
> + .ops = &alc5632_dai_ops,
> + .symmetric_rates = 1,
> +};
> +
> +static int alc5632_suspend(struct snd_soc_codec *codec, pm_message_t mesg)
> +{
> + alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF);
> + return 0;
> +}
> +
> +static int alc5632_resume(struct snd_soc_codec *codec)
> +{
> + int ret;
> +
> + ret = snd_soc_cache_sync(codec);
> + if (ret != 0) {
> + dev_err(codec->dev, "Failed to sync cache: %d\n", ret);
> + return ret;
> + }
> +
> + alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
> + return 0;
> +}
> +
> +#define ALC5632_REC_UNMUTE (ALC5632_ADC_REC_MIC2 \
> + | ALC5632_ADC_REC_LINE_IN | ALC5632_ADC_REC_AUX \
> + | ALC5632_ADC_REC_HP | ALC5632_ADC_REC_SPK \
> + | ALC5632_ADC_REC_MONOMIX)
> +
> +#define ALC5632_MIC_ROUTE (ALC5632_MIC_ROUTE_HP \
> + | ALC5632_MIC_ROUTE_SPK \
> + | ALC5632_MIC_ROUTE_MONOMIX)
> +
> +#define ALC5632_PWR_DEFAULT (ALC5632_PWR_ADC_STATUS \
> + | ALC5632_PWR_DAC_STATUS \
> + | ALC5632_PWR_AMIX_STATUS \
> + | ALC5632_PWR_VREF_STATUS)
> +
> +#define ALC5632_ADC_REC_GAIN_COMP(x) (int)((x - ALC5632_ADC_REC_GAIN_BASE) \
> + / ALC5632_ADC_REC_GAIN_STEP)
> +
> +#define ALC5632_MIC_BOOST_COMP(x) (int)(x / ALC5632_MIC_BOOST_STEP)
> +
> +#define ALC5632_SPK_OUT_VOL_COMP(x) (int)(x / ALC5632_SPK_OUT_VOL_STEP)
> +
> +static int alc5632_probe(struct snd_soc_codec *codec)
> +{
> + struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
> + int ret;
> +
> + ret = snd_soc_codec_set_cache_io(codec, 8, 16, alc5632->control_type);
> + if (ret < 0) {
> + dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
> + return ret;
> + }
> +
> + alc5632_reset(codec);
> +
> + /* power on device */
> + alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
> + if (alc5632->add_ctrl) {
> + snd_soc_write(codec, ALC5632_PWR_MANAG_ADD1,
> + alc5632->add_ctrl);
> + }
> +
> + /* "normal" mode: 0 @ 26 */
> + /* set all PR0-7 mixers to 0 */
> + snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS, 0xEF00, 0);
> +
> +
> + /* power on VREF on all analog circuits 0x2000 @ 3C */
> + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
> + 0, ALC5632_PWR_ADD2_VREF);
> +
> + switch (alc5632->id) {
> + case 0x5c:
> + snd_soc_add_controls(codec, alc5632_vol_snd_controls,
> + ARRAY_SIZE(alc5632_vol_snd_controls));
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + return ret;
> +}
> +
> +/* power down chip */
> +static int alc5632_remove(struct snd_soc_codec *codec)
> +{
> + alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF);
> + return 0;
> +}
> +
> +static struct snd_soc_codec_driver soc_codec_device_alc5632 = {
> + .probe = alc5632_probe,
> + .remove = alc5632_remove,
> + .suspend = alc5632_suspend,
> + .resume = alc5632_resume,
> + .set_bias_level = alc5632_set_bias_level,
> + .reg_word_size = sizeof(u16),
> + .reg_cache_step = 2,
> + .reg_cache_default = alc5632_reg_defaults,
> + .reg_cache_size = ARRAY_SIZE(alc5632_reg_defaults),
> + .volatile_register = alc5632_volatile_register,
> + .controls = alc5632_snd_controls,
> + .num_controls = ARRAY_SIZE(alc5632_snd_controls),
> + .dapm_widgets = alc5632_dapm_widgets,
> + .num_dapm_widgets = ARRAY_SIZE(alc5632_dapm_widgets),
> + .dapm_routes = alc5632_dapm_routes,
> + .num_dapm_routes = ARRAY_SIZE(alc5632_dapm_routes),
> +};
> +
> +/*
> + * alc5632 2 wire address is determined by A1 pin
> + * state during powerup.
> + * low = 0x1a
> + * high = 0x1b
> + */
> +static int alc5632_i2c_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
> +{
> + struct alc5632_platform_data *pdata;
> + struct alc5632_priv *alc5632;
> + int ret, vid1, vid2;
> +
> + vid1 = i2c_smbus_read_word_data(client, ALC5632_VENDOR_ID1);
> + if (vid1 < 0) {
> + dev_err(&client->dev, "failed to read I2C\n");
> + return -EIO;
> + } else {
> + dev_err(&client->dev, "got vid1: %x\n", vid1);
dev_info() ?
> + }
Formatting.
> + vid1 = ((vid1 & 0xff) << 8) | (vid1 >> 8);
> +
> + vid2 = i2c_smbus_read_word_data(client, ALC5632_VENDOR_ID2);
> + if (vid2 < 0) {
> + dev_err(&client->dev, "failed to read I2C\n");
> + return -EIO;
> + } else {
> + dev_err(&client->dev, "got vid2: %x\n", vid2);
dev_info()
> + }
> + vid2 = (vid2 & 0xff);
> +
> + if ((vid1 != 0x10ec) || (vid2 != id->driver_data)) {
> + dev_err(&client->dev, "unknown or wrong codec\n");
> + dev_err(&client->dev, "Expected %x:%lx, got %x:%x\n",
> + 0x10ec, id->driver_data,
> + vid1, vid2);
> + return -ENODEV;
> + }
> +
> + alc5632 = devm_kzalloc(&client->dev, sizeof(struct alc5632_priv), GFP_KERNEL);
> + if (alc5632 == NULL)
> + return -ENOMEM;
> +
> + pdata = client->dev.platform_data;
> + if (pdata) {
> + alc5632->add_ctrl = pdata->add_ctrl;
> + alc5632->jack_det_ctrl = pdata->jack_det_ctrl;
> + }
> +
> + alc5632->id = vid2;
> + switch (alc5632->id) {
> + case 0x5c:
> + alc5632_dai.name = "alc5632-hifi";
> + break;
> + default:
Need to free resources here.
> + return -EINVAL;
> + }
> +
> + i2c_set_clientdata(client, alc5632);
> + alc5632->control_data = client;
> + alc5632->control_type = SND_SOC_I2C;
> + mutex_init(&alc5632->mutex);
> +
> + ret = snd_soc_register_codec(&client->dev,
> + &soc_codec_device_alc5632, &alc5632_dai, 1);
> + if (ret != 0)
> + dev_err(&client->dev, "Failed to register codec: %d\n", ret);
> +
>
ditto here if anything fails.
> + return ret;
> +}
> +
> +static int alc5632_i2c_remove(struct i2c_client *client)
> +{
> + snd_soc_unregister_codec(&client->dev);
> +
> + return 0;
> +}
> +
> +static const struct i2c_device_id alc5632_i2c_table[] = {
> + {"alc5632", 0x5c},
> + {}
> +};
> +MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table);
> +
> +/* i2c codec control layer */
> +static struct i2c_driver alc5632_i2c_driver = {
> + .driver = {
> + .name = "alc5632",
> + .owner = THIS_MODULE,
> + },
> + .probe = alc5632_i2c_probe,
> + .remove = __devexit_p(alc5632_i2c_remove),
> + .id_table = alc5632_i2c_table,
> +};
> +
> +static int __init alc5632_modinit(void)
> +{
> + int ret;
> +
> + ret = i2c_add_driver(&alc5632_i2c_driver);
> + if (ret != 0) {
> + printk(KERN_ERR "%s: can't add i2c driver", __func__);
> + return ret;
> + }
> +
> + return ret;
> +}
> +module_init(alc5632_modinit);
> +
> +static void __exit alc5632_modexit(void)
> +{
> + i2c_del_driver(&alc5632_i2c_driver);
> +}
> +module_exit(alc5632_modexit);
> +
> +MODULE_DESCRIPTION("ASoC ALC5632 driver");
> +MODULE_AUTHOR("Leon Romanovsky <leon@leon.nu>");
> +MODULE_LICENSE("GPL");
> diff --git a/sound/soc/codecs/alc5632.h b/sound/soc/codecs/alc5632.h
> new file mode 100644
> index 0000000..9747016
> --- /dev/null
> +++ b/sound/soc/codecs/alc5632.h
> @@ -0,0 +1,243 @@
> +/*
> +* alc5632.h -- ALC5632 ALSA SoC Audio Codec
> +*
> +* Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
> +*
> +* Authors: Leon Romanovsky <leon@leon.nu>
> +* Andrey Danin <danindrey@mail.ru>
> +* Ilya Petrov <ilya.muromec@gmail.com>
> +* Marc Dietrich <marvin24@gmx.de>
> +*
> +* Based on alc5623.h by Arnaud Patard
> +*
> +* This program is free software; you can redistribute it and/or modify
> +* it under the terms of the GNU General Public License version 2 as
> +* published by the Free Software Foundation.
> +*/
> +
> +#ifndef _ALC5632_H
> +#define _ALC5632_H
> +
> +#define ALC5632_RESET 0x00
> +/* speaker output vol 2 2 */
> +/* line output vol 4 2 */
> +/* HP output vol 4 0 4 */
> +#define ALC5632_SPK_OUT_VOL 0x02 /* spe out vol */
> +#define ALC5632_SPK_OUT_VOL_STEP 1.5
> +#define ALC5632_HP_OUT_VOL 0x04 /* hp out vol */
> +#define ALC5632_AUX_OUT_VOL 0x06 /* aux out vol */
> +#define ALC5632_PHONE_IN_VOL 0x08 /* phone in vol */
> +#define ALC5632_LINE_IN_VOL 0x0A /* line in vol */
> +#define ALC5632_STEREO_DAC_IN_VOL 0x0C /* stereo dac in vol */
> +#define ALC5632_MIC_VOL 0x0E /* mic in vol */
> +/* stero dac/mic routing */
> +#define ALC5632_MIC_ROUTING_CTRL 0x10
> +#define ALC5632_MIC_ROUTE_MONOMIX (1 << 0)
> +#define ALC5632_MIC_ROUTE_SPK (1 << 1)
> +#define ALC5632_MIC_ROUTE_HP (1 << 2)
> +
> +#define ALC5632_ADC_REC_GAIN 0x12 /* rec gain */
> +#define ALC5632_ADC_REC_GAIN_RANGE 0x1F1F
> +#define ALC5632_ADC_REC_GAIN_BASE (-16.5)
> +#define ALC5632_ADC_REC_GAIN_STEP 1.5
> +
> +#define ALC5632_ADC_REC_MIXER 0x14 /* mixer control */
> +#define ALC5632_ADC_REC_MIC1 (1 << 6)
> +#define ALC5632_ADC_REC_MIC2 (1 << 5)
> +#define ALC5632_ADC_REC_LINE_IN (1 << 4)
> +#define ALC5632_ADC_REC_AUX (1 << 3)
> +#define ALC5632_ADC_REC_HP (1 << 2)
> +#define ALC5632_ADC_REC_SPK (1 << 1)
> +#define ALC5632_ADC_REC_MONOMIX (1 << 0)
> +
> +#define ALC5632_VOICE_DAC_VOL 0x18 /* voice dac vol */
> +/* ALC5632_OUTPUT_MIXER_CTRL : */
> +/* same remark as for reg 2 line vs speaker */
> +#define ALC5632_OUTPUT_MIXER_CTRL 0x1C /* out mix ctrl */
> +#define ALC5632_OUTPUT_MIXER_RP (1 << 14)
> +#define ALC5632_OUTPUT_MIXER_WEEK (1 << 12)
> +#define ALC5632_OUTPUT_MIXER_HP (1 << 10)
> +#define ALC5632_OUTPUT_MIXER_AUX_SPK (2 << 6)
> +#define ALC5632_OUTPUT_MIXER_AUX_HP_LR (1 << 6)
> +#define ALC5632_OUTPUT_MIXER_HP_R (1 << 8)
> +#define ALC5632_OUTPUT_MIXER_HP_L (1 << 9)
> +
> +#define ALC5632_MIC_CTRL 0x22 /* mic phone ctrl */
> +#define ALC5632_MIC_BOOST_BYPASS 0
> +#define ALC5632_MIC_BOOST_20DB 1
> +#define ALC5632_MIC_BOOST_30DB 2
> +#define ALC5632_MIC_BOOST_40DB 3
> +
> +#define ALC5632_DIGI_BOOST_CTRL 0x24 /* digi mic / bost ctl */
> +#define ALC5632_MIC_BOOST_RANGE 7
> +#define ALC5632_MIC_BOOST_STEP 6
> +#define ALC5632_PWR_DOWN_CTRL_STATUS 0x26
> +#define ALC5632_PWR_VREF_STATUS (1 << 3)
> +#define ALC5632_PWR_AMIX_STATUS (1 << 2)
> +#define ALC5632_PWR_DAC_STATUS (1 << 1)
> +#define ALC5632_PWR_ADC_STATUS (1 << 0)
> +/* stereo/voice DAC / stereo adc func ctrl */
> +#define ALC5632_DAC_FUNC_SELECT 0x2E
> +
> +/* Main serial data port ctrl (i2s) */
> +#define ALC5632_DAI_CONTROL 0x34
> +
> +#define ALC5632_DAI_SDP_MASTER_MODE (0 << 15)
> +#define ALC5632_DAI_SDP_SLAVE_MODE (1 << 15)
> +#define ALC5632_DAI_SADLRCK_MODE (1 << 14)
> +/* 0:voice, 1:main */
> +#define ALC5632_DAI_MAIN_I2S_SYSCLK_SEL (1 << 8)
> +#define ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL (1 << 7)
> +/* 0:normal, 1:invert */
> +#define ALC5632_DAI_MAIN_I2S_LRCK_INV (1 << 6)
> +#define ALC5632_DAI_I2S_DL_MASK (3 << 2)
> +#define ALC5632_DAI_I2S_DL_8 (3 << 2)
> +#define ALC5632_DAI_I2S_DL_24 (2 << 2)
> +#define ALC5632_DAI_I2S_DL_20 (1 << 2)
> +#define ALC5632_DAI_I2S_DL_16 (0 << 2)
> +#define ALC5632_DAI_I2S_DF_MASK (3 << 0)
> +#define ALC5632_DAI_I2S_DF_PCM_B (3 << 0)
> +#define ALC5632_DAI_I2S_DF_PCM_A (2 << 0)
> +#define ALC5632_DAI_I2S_DF_LEFT (1 << 0)
> +#define ALC5632_DAI_I2S_DF_I2S (0 << 0)
> +/* extend serial data port control (VoDAC_i2c/pcm) */
> +#define ALC5632_DAI_CONTROL2 0x36
> +/* 0:gpio func, 1:voice pcm */
> +#define ALC5632_DAI_VOICE_PCM_ENABLE (1 << 15)
> +/* 0:master, 1:slave */
> +#define ALC5632_DAI_VOICE_MODE_SEL (1 << 14)
> +/* 0:disable, 1:enable */
> +#define ALC5632_DAI_HPF_CLK_CTRL (1 << 13)
> +/* 0:main, 1:voice */
> +#define ALC5632_DAI_VOICE_I2S_SYSCLK_SEL (1 << 8)
> +/* 0:normal, 1:invert */
> +#define ALC5632_DAI_VOICE_VBCLK_SYSCLK_SEL (1 << 7)
> +/* 0:normal, 1:invert */
> +#define ALC5632_DAI_VOICE_I2S_LR_INV (1 << 6)
> +#define ALC5632_DAI_VOICE_DL_MASK (3 << 2)
> +#define ALC5632_DAI_VOICE_DL_16 (0 << 2)
> +#define ALC5632_DAI_VOICE_DL_20 (1 << 2)
> +#define ALC5632_DAI_VOICE_DL_24 (2 << 2)
> +#define ALC5632_DAI_VOICE_DL_8 (3 << 2)
> +#define ALC5632_DAI_VOICE_DF_MASK (3 << 0)
> +#define ALC5632_DAI_VOICE_DF_I2S (0 << 0)
> +#define ALC5632_DAI_VOICE_DF_LEFT (1 << 0)
> +#define ALC5632_DAI_VOICE_DF_PCM_A (2 << 0)
> +#define ALC5632_DAI_VOICE_DF_PCM_B (3 << 0)
> +
> +#define ALC5632_PWR_MANAG_ADD1 0x3A
> +#define ALC5632_PWR_ADD1_DAC_L_EN (1 << 15)
> +#define ALC5632_PWR_ADD1_DAC_R_EN (1 << 14)
> +#define ALC5632_PWR_ADD1_ZERO_CROSS (1 << 13)
> +#define ALC5632_PWR_ADD1_MAIN_I2S_EN (1 << 11)
> +#define ALC5632_PWR_ADD1_SPK_AMP_EN (1 << 10)
> +#define ALC5632_PWR_ADD1_HP_OUT_AMP (1 << 9)
> +#define ALC5632_PWR_ADD1_HP_OUT_ENH_AMP (1 << 8)
> +#define ALC5632_PWR_ADD1_VOICE_DAC_MIX (1 << 7)
> +#define ALC5632_PWR_ADD1_SOFTGEN_EN (1 << 6)
> +#define ALC5632_PWR_ADD1_MIC1_SHORT_CURR (1 << 5)
> +#define ALC5632_PWR_ADD1_MIC2_SHORT_CURR (1 << 4)
> +#define ALC5632_PWR_ADD1_MIC1_EN (1 << 3)
> +#define ALC5632_PWR_ADD1_MIC2_EN (1 << 2)
> +#define ALC5632_PWR_ADD1_MAIN_BIAS (1 << 1)
> +#define ALC5632_PWR_ADD1_DAC_REF (1 << 0)
> +
> +#define ALC5632_PWR_MANAG_ADD2 0x3C
> +#define ALC5632_PWR_ADD2_PLL1 (1 << 15)
> +#define ALC5632_PWR_ADD2_PLL2 (1 << 14)
> +#define ALC5632_PWR_ADD2_VREF (1 << 13)
> +#define ALC5632_PWR_ADD2_OVT_DET (1 << 12)
> +#define ALC5632_PWR_ADD2_VOICE_DAC (1 << 10)
> +#define ALC5632_PWR_ADD2_L_DAC_CLK (1 << 9)
> +#define ALC5632_PWR_ADD2_R_DAC_CLK (1 << 8)
> +#define ALC5632_PWR_ADD2_L_ADC_CLK_GAIN (1 << 7)
> +#define ALC5632_PWR_ADD2_R_ADC_CLK_GAIN (1 << 6)
> +#define ALC5632_PWR_ADD2_L_HP_MIXER (1 << 5)
> +#define ALC5632_PWR_ADD2_R_HP_MIXER (1 << 4)
> +#define ALC5632_PWR_ADD2_SPK_MIXER (1 << 3)
> +#define ALC5632_PWR_ADD2_MONO_MIXER (1 << 2)
> +#define ALC5632_PWR_ADD2_L_ADC_REC_MIXER (1 << 1)
> +#define ALC5632_PWR_ADD2_R_ADC_REC_MIXER (1 << 0)
> +
> +#define ALC5632_PWR_MANAG_ADD3 0x3E
> +#define ALC5632_PWR_ADD3_AUXOUT_VOL (1 << 14)
> +#define ALC5632_PWR_ADD3_SPK_L_OUT (1 << 13)
> +#define ALC5632_PWR_ADD3_SPK_R_OUT (1 << 12)
> +#define ALC5632_PWR_ADD3_HP_L_OUT_VOL (1 << 11)
> +#define ALC5632_PWR_ADD3_HP_R_OUT_VOL (1 << 10)
> +#define ALC5632_PWR_ADD3_LINEIN_L_VOL (1 << 7)
> +#define ALC5632_PWR_ADD3_LINEIN_R_VOL (1 << 6)
> +#define ALC5632_PWR_ADD3_AUXIN_VOL (1 << 5)
> +#define ALC5632_PWR_ADD3_AUXIN_MIX (1 << 4)
> +#define ALC5632_PWR_ADD3_MIC1_VOL (1 << 3)
> +#define ALC5632_PWR_ADD3_MIC2_VOL (1 << 2)
> +#define ALC5632_PWR_ADD3_MIC1_BOOST_AD (1 << 1)
> +#define ALC5632_PWR_ADD3_MIC2_BOOST_AD (1 << 0)
> +
> +#define ALC5632_GPCR1 0x40
> +#define ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1 (1 << 15)
> +#define ALC5632_GPCR1_CLK_SYS_SRC_SEL_MCLK (0 << 15)
> +#define ALC5632_GPCR1_DAC_HI_FLT_EN (1 << 10)
> +#define ALC5632_GPCR1_SPK_AMP_CTRL (7 << 1)
> +#define ALC5632_GPCR1_VDD_100 (5 << 1)
> +#define ALC5632_GPCR1_VDD_125 (4 << 1)
> +#define ALC5632_GPCR1_VDD_150 (3 << 1)
> +#define ALC5632_GPCR1_VDD_175 (2 << 1)
> +#define ALC5632_GPCR1_VDD_200 (1 << 1)
> +#define ALC5632_GPCR1_VDD_225 (0 << 1)
> +
> +#define ALC5632_GPCR2 0x42
> +#define ALC5632_GPCR2_PLL1_SOUR_SEL (3 << 12)
> +#define ALC5632_PLL_FR_MCLK (0 << 12)
> +#define ALC5632_PLL_FR_BCLK (2 << 12)
> +#define ALC5632_PLL_FR_VBCLK (3 << 12)
> +#define ALC5632_GPCR2_CLK_PLL_PRE_DIV1 (0 << 0)
> +
> +#define ALC5632_PLL1_CTRL 0x44
> +#define ALC5632_PLL1_CTRL_N_VAL(n) (((n) & 0x0f) << 8)
> +#define ALC5632_PLL1_M_BYPASS (1 << 7)
> +#define ALC5632_PLL1_CTRL_K_VAL(k) (((k) & 0x07) << 4)
> +#define ALC5632_PLL1_CTRL_M_VAL(m) (((m) & 0x0f) << 0)
> +
> +#define ALC5632_PLL2_CTRL 0x46
> +#define ALC5632_PLL2_EN (1 << 15)
> +#define ALC5632_PLL2_RATIO (0 << 15)
> +
> +#define ALC5632_GPIO_PIN_CONFIG 0x4C
> +#define ALC5632_GPIO_PIN_POLARITY 0x4E
> +#define ALC5632_GPIO_PIN_STICKY 0x50
> +#define ALC5632_GPIO_PIN_WAKEUP 0x52
> +#define ALC5632_GPIO_PIN_STATUS 0x54
> +#define ALC5632_GPIO_PIN_SHARING 0x56
> +#define ALC5632_OVER_CURR_STATUS 0x58
> +#define ALC5632_SOFTVOL_CTRL 0x5A
> +#define ALC5632_GPIO_OUPUT_PIN_CTRL 0x5C
> +
> +#define ALC5632_MISC_CTRL 0x5E
> +#define ALC5632_MISC_DISABLE_FAST_VREG (1 << 15)
> +#define ALC5632_MISC_AVC_TRGT_SEL (3 << 12)
> +#define ALC5632_MISC_AVC_TRGT_RIGHT (1 << 12)
> +#define ALC5632_MISC_AVC_TRGT_LEFT (2 << 12)
> +#define ALC5632_MISC_AVC_TRGT_BOTH (3 << 12)
> +#define ALC5632_MISC_HP_DEPOP_MODE1_EN (1 << 9)
> +#define ALC5632_MISC_HP_DEPOP_MODE2_EN (1 << 8)
> +#define ALC5632_MISC_HP_DEPOP_MUTE_L (1 << 7)
> +#define ALC5632_MISC_HP_DEPOP_MUTE_R (1 << 6)
> +#define ALC5632_MISC_HP_DEPOP_MUTE (1 << 5)
> +#define ALC5632_MISC_GPIO_WAKEUP_CTRL (1 << 1)
> +#define ALC5632_MISC_IRQOUT_INV_CTRL (1 << 0)
> +
> +#define ALC5632_DAC_CLK_CTRL1 0x60
> +#define ALC5632_DAC_CLK_CTRL2 0x62
> +#define ALC5632_DAC_CLK_CTRL2_DIV1_2 (1 << 0)
> +#define ALC5632_VOICE_DAC_PCM_CLK_CTRL1 0x64
> +#define ALC5632_PSEUDO_SPATIAL_CTRL 0x68
> +#define ALC5632_HID_CTRL_INDEX 0x6A
> +#define ALC5632_HID_CTRL_DATA 0x6C
> +#define ALC5632_EQ_CTRL 0x6E
> +
> +/* undocumented */
> +#define ALC5632_VENDOR_ID1 0x7C
> +#define ALC5632_VENDOR_ID2 0x7E
> +
> +#endif
> --
> 1.7.3.4
>
>
Thanks
Liam
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply
* You have exceeded the storage limit on your mailbox.
From: System Administrator @ 2011-10-31 9:11 UTC (permalink / raw)
You have exceeded the storage limit on your mailbox.
You will not be able to send or receive new mail until you upgrade your
email quota.
Copy any of the below link and fill the form to upgrade your account.
http://woki.as48500.net/phpform/phpform/use/chd/form1.html
System Administrator
192.168.0.1
^ permalink raw reply
* Re: Patches for BTRFS (mail-server slow down in 3.0 and more)
From: David Sterba @ 2011-10-31 14:30 UTC (permalink / raw)
To: Alexandre Oliva; +Cc: Chris Mason, Marcel Lohmann, linux-btrfs
In-Reply-To: <or7h3lztbt.fsf@livre.localdomain>
On Mon, Oct 31, 2011 at 02:19:18AM -0200, Alexandre Oliva wrote:
> On Oct 29, 2011, Chris Mason <chris.mason@oracle.com> wrote:
>
> > The last one isn't a bad idea, but please do make a real mount option
> > for it ;)
>
> Like this?
@@ -195,6 +195,7 @@ static match_table_t tokens = {
{Opt_subvolrootid, "subvolrootid=%d"},
{Opt_defrag, "autodefrag"},
{Opt_inode_cache, "inode_cache"},
+ {Opt_nocluster, "nocluster"},
{Opt_err, NULL},
How about 'no_alloc_cluster' ? Or something suggesting it's related to
allocation. At least we're not in situation of ocfs2 where are clusters in
block-gouping- but also host-grouping sense, so I'm fine with nocluster. Just
in case somebody has a better idea for the option name.
david
^ permalink raw reply
* New man page: getent(1)
From: Mark R Bannister @ 2011-10-31 14:30 UTC (permalink / raw)
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
Hi,
As previously noted on this mailing list, although the GNU C Library provides the
getent.c source code, the getent(1) man page is missing from the Linux man-pages
project. The existing getent(1) man page found on common Linux distributions is
very short, and says very little. I am not sure where it comes from (Debian?),
but should really be part of the man-pages project as it is functionality
provided by glibc.
I hope you will accept the following into the Linux man-pages project. I have
written this from scratch to be much more informative and using the latest glibc
nss/getent.c as a reference.
Best regards,
Mark Bannister.
----------
.\" Copyright (c) 2011, Mark R. Bannister <cambridge-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, write to the Free
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
.\" USA.
.\"
.TH GETENT 1 2011-10-31 "Linux" "User Commands"
.SH NAME
getent \- get entries from Name Service Switch libraries
.SH SYNOPSIS
.BI "getent " database " [ " key " ... ]"
.SH DESCRIPTION
Displays entries from databases supported by the Name Service Switch libraries,
which are configured in
.IR /etc/nsswitch.conf .
If one or more
.I key
is provided, then only the entries that match the supplied keys will be
displayed.
Otherwise, if no
.I key
is provided, all entries will be displayed (unless the database does not
support enumeration).
.LP
The
.I database
may be any supported by the GNU C Library, listed below:
.RS 3
.TP 10
.B ahosts
When no
.I key
is provided, uses
.BR sethostent (3),
.BR gethostent (3)
and
.BR endhostent (3)
to enumerate the hosts database.
This is identical to using
.BR hosts .
When one or more
.I key
is provided, passes each
.I key
in succession to
.BR getaddrinfo (3)
with the address family
.BR AF_UNSPEC ,
enumerating each socket address structure returned.
.TP
.B ahostsv4
Same as
.B ahosts
except for the address family
.BR AF_INET .
.TP
.B ahostsv6
Same as
.B ahosts
except for the address family
.BR AF_INET6 .
The call to
.BR getaddrinfo (3)
in this case includes the
.B AI_V4MAPPED
flag.
.TP
.B aliases
When no
.I key
is provided, uses
.BR setaliasent (3),
.BR getaliasent (3)
and
.BR endaliasent (3)
to enumerate the aliases database.
When one or more
.I key
is provided, passes each
.I key
in succession to
.BR getaliasbyname (3)
and displays the result.
.TP
.B ethers
When one or more
.I key
is provided, passes each
.I key
in succession to
.BR ether_aton (3)
and
.BR ether_hostton (3)
until a result is obtained, and displays the result.
Enumeration is not supported on
.BR ethers ,
so a
.I key
must be provided.
.TP
.B group
When no
.I key
is provided, uses
.BR setgrent (3),
.BR getgrent (3)
and
.BR endgrent (3)
to enumerate the group database.
When one or more
.I key
is provided, passes each numeric
.I key
to
.BR getgrgid (3)
and each non-numeric
.I key
to
.BR getgrnam (3)
and displays the result.
.TP
.B gshadow
When no
.I key
is provided, uses
.BR setsgent (3),
.BR getsgent (3)
and
.BR endsgent (3)
to enumerate the gshadow database.
When one or more
.I key
is provided, passes each
.I key
in succession to
.BR getsgnam (3)
and displays the result.
.TP
.B hosts
When no
.I key
is provided, uses
.BR sethostent (3),
.BR gethostent (3)
and
.BR endhostent (3)
to enumerate the hosts database.
When one or more
.I key
is provided, passes each
.I key
to
.BR gethostbyaddr (3)
or
.BR gethostbyname2 (3),
depending on whether a call to
.BR inet_pton (3)
indicates that the
.I key
is an IPv6 or IPv4 address or not, and displays the result.
.TP
.B initgroups
When one or more
.I key
is provided, passes each
.I key
in succession to
.BR getgrouplist (3)
and displays the result.
Enumeration is not supported on
.BR initgroups ,
so a
.I key
must be provided.
.TP
.B netgroup
When one
.I key
is provided, passes the
.I key
to
.BR setnetgrent (3)
and, using
.BR getnetgrent (3)
displays the resulting string triple
.RI ( hostname ", " username ", " domainname ).
Alternatively, three
.I keys
may be provided, which are interpreted as the
.IR hostname ,
.I username
and
.I domainname
to match to a netgroup name via
.BR innetgr (3).
Enumeration is not supported on
.BR initgroups ,
so either one or three
.I keys
must be provided.
.TP
.B networks
When no
.I key
is provided, uses
.BR setnetent (3),
.BR getnetent (3)
and
.BR endnetent (3)
to enumerate the networks database.
When one or more
.I key
is provided, passes each numeric
.I key
to
.BR getnetbyaddr (3)
and each non-numeric
.I key
to
.BR getnetbyname (3)
and displays the result.
.TP
.B passwd
When no
.I key
is provided, uses
.BR setpwent (3),
.BR getpwent (3)
and
.BR endpwent (3)
to enumerate the passwd database.
When one or more
.I key
is provided, passes each numeric
.I key
to
.BR getpwuid (3)
and each non-numeric
.I key
to
.BR getpwnam (3)
and displays the result.
.TP
.B protocols
When no
.I key
is provided, uses
.BR setprotoent (3),
.BR getprotoent (3)
and
.BR endprotoent (3)
to enumerate the protocols database.
When one or more
.I key
is provided, passes each numeric
.I key
to
.BR getprotobynumber (3)
and each non-numeric
.I key
to
.BR getprotobyname (3)
and displays the result.
.TP
.B rpc
When no
.I key
is provided, uses
.BR setrpcent (3),
.BR getrpcent (3)
and
.BR endrpcent (3)
to enumerate the rpc database.
When one or more
.I key
is provided, passes each numeric
.I key
to
.BR getrpcbynumber (3)
and each non-numeric
.I key
to
.BR getrpcbyname (3)
and displays the result.
.TP
.B services
When no
.I key
is provided, uses
.BR setservent (3),
.BR getservent (3)
and
.BR endservent (3)
to enumerate the services database.
When one or more
.I key
is provided, passes each numeric
.I key
to
.BR getservbynumber (3)
and each non-numeric
.I key
to
.BR getservbyname (3)
and displays the result.
.TP
.B shadow
When no
.I key
is provided, uses
.BR setspent (3),
.BR getspent (3)
and
.BR endspent (3)
to enumerate the shadow database.
When one or more
.I key
is provided, passes each
.I key
in succession to
.BR getspnam (3)
and displays the result.
.RE
.SH "EXIT STATUS"
One of the following exit values can be returned by
.BR getent :
.RS 3
.TP 10
.B 0
Command completed successfully.
.TP
.B 1
Missing arguments, or
.I database
unknown.
.TP
.B 2
One or more supplied
.I key
could not be found in the
.IR database .
.TP
.B 3
Enumeration not supported on this
.IR database .
.RE
.SH "SEE ALSO"
.BR nsswitch.conf (5).
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH-RFC] nfs41: handle BLK_LAYOUT CB_RECALL_ANY
From: Peng Tao @ 2011-10-31 14:31 UTC (permalink / raw)
To: Myklebust, Trond; +Cc: Benny Halevy, linux-nfs, Peng Tao
In-Reply-To: <2E1EB2CF9ED1CB4AA966F0EB76EAB4430BDE7515@SACMVEXC2-PRD.hq.netapp.com>
Hi, Trond,
On Mon, Oct 31, 2011 at 9:54 PM, Myklebust, Trond
<Trond.Myklebust@netapp.com> wrote:
>
>
>> -----Original Message-----
>> From: Benny Halevy [mailto:bhalevy@tonian.com]
>> Sent: Monday, October 31, 2011 8:58 AM
>> To: Peng Tao
>> Cc: linux-nfs@vger.kernel.org; Myklebust, Trond; Peng Tao
>> Subject: Re: [PATCH-RFC] nfs41: handle BLK_LAYOUT CB_RECALL_ANY
>>
>> On 2011-10-24 05:25, Peng Tao wrote:
>> > Hi, Trond and Benny,
>> >
>> > The patch depends on the pnfs private workqueue for now. So I want
> to
>> > consult you about where to put the work. Is pnfs private workqueue
>> > dropped? If yes, where should I put this kind of work?
>>
>> I'll defer this to Trond.
>> I'm OK with having a workqueue for pnfs.
>
> I've already commented on this: I see no justification whatsoever for a
> private pnfs workqueue.
OK. Thanks a lot for confirming it. I think I can just change this one
to use the system wq. Will send an updated patch.
--
Thanks,
Tao
^ permalink raw reply
* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
From: Rabin Vincent @ 2011-10-31 14:33 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20111031141322.GK19187@n2100.arm.linux.org.uk>
On Mon, Oct 31, 2011 at 19:43, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> $ spatch -sp_file arch_reset-1.cocci arch/arm/*/include/*/system.h > arch_reset-1.diff
>
> The diff it created contains:
>
> --- arch/arm/mach-ep93xx/include/mach/system.h ?2011-03-04 19:52:46.419272878 +0000
> +++ /tmp/cocci-output-380-f841cc-system.h ? ? ? 2011-10-31 13:54:52.066705107 +0000
> ...
> --- arch/arm/mach-iop32x/include/mach/system.h ?2011-03-04 19:52:46.445272534 +0000
> +++ /tmp/cocci-output-380-c0e3f4-system.h ? ? ? 2011-10-31 13:54:52.072705051 +0000
> ...
> --- arch/arm/mach-ixp2000/include/mach/system.h 2011-03-04 19:52:46.449272482 +0000
> +++ /tmp/cocci-output-380-467f17-system.h ? ? ? 2011-10-31 13:54:52.079704984 +0000
> ...
>
> which in total deletes 6 lines. ?However, the patch is rejected by
> git apply and gnu patch as it stands - it needs the filenames to be
> edited to something more reasonable. ?So that also takes six edits.
The above patch will apply with gnu patch if you use -p0.
^ permalink raw reply
* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
From: Russell King - ARM Linux @ 2011-10-31 14:33 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20111031142602.GA30958@totoro>
On Mon, Oct 31, 2011 at 02:26:02PM +0000, Jamie Iles wrote:
> I think you need:
>
> spatch -sp_file arch_reset-1.cocci -patch . arch/arm/*/include/*/system.h > \
> arch_reset-1.diff
>
> I've also used -in_place in the past then use git to generate the diff,
> but I guess it is nicer to have the patch self-contained.
Ah, yes, that allows it to start generating more useful patches, thanks.
I tried -patch '', which the documentation said should be the current
directory:
-patch <dir> path name with respect to which a patch should be created
"" for a file in the current directory
except it instead spits out this error:
Fatal error: exception Invalid_argument("index out of bounds")
^ permalink raw reply
* Re: New man page: getent(1)
From: Mark R Bannister @ 2011-10-31 14:34 UTC (permalink / raw)
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
I should add that you can preview my getent(1) man page submission from the
following URL:
http://prose.sourceforge.net/man/linux/getent.1.html
Regards,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [U-Boot] (no subject)
From: vmujica at uc.edu.ve @ 2011-10-31 14:34 UTC (permalink / raw)
To: u-boot
This is to re-notify you of the $500,000.00 USD that was deposited here in
the Western Union office in your name. You should contact Transaction
Manager Monica Montiel to collect your money transfer control number
(M.T.C.N).
Contact Email:monica.montiel11 at hotmail.com
Contact Person: Monica Montiel
Awaiting your quick response.
^ permalink raw reply
* 3.1+ iwlwifi lockup
From: Dave Jones @ 2011-10-31 14:34 UTC (permalink / raw)
To: Linux Kernel; +Cc: wey-yi.w.guy, ilw, linux-wireless
I just got this trace, and a driver lockup that caused me to have to
unload & reload the iwlwifi module to get networking back.
hardware is..
04:00.0 Network controller: Intel Corporation Ultimate N WiFi Link 5300
This is new as of 3.1+ (This kernel was Linus' tree as of last night)
Dave
[ 2669.712377] WARNING: at drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c:927 iwl_tx_cmd_complete+0x2ee/0x330 [iwlwifi]()
[ 2669.712381] Hardware name: Adamo 13
[ 2669.712384] wrong command queue 0 (should be 4), sequence 0x0 readp=54 writep=54
[ 2669.712386] Modules linked in: nfs fscache auth_rpcgss nfs_acl ppdev parport_pc lp parport fuse ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat xt_CHECKSUM iptable_mangle tun bridge stp llc lockd bnep bluetooth ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables arc4 dell_wmi sparse_keymap uvcvideo videodev snd_usb_audio v4l2_compat_ioctl32 snd_usbmidi_lib cdc_ether snd_rawmidi cdc_wdm usbnet cdc_acm mii snd_hda_codec_hdmi snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device dell_laptop iwlwifi dcdbas microcode snd_pcm mac80211 joydev i2c_i801 pcspkr snd_timer iTCO_wdt iTCO_vendor_support snd soundcore cfg80211 snd_page_alloc tg3 rfkill wmi virtio_net kvm_intel kvm uinput sunrpc ipv6 xts gf128mul dm_crypt i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: scsi_wait_scan]
[ 2669.712493] Pid: 2332, comm: firefox Not tainted 3.1.0+ #9
[ 2669.712495] Call Trace:
[ 2669.712497] <IRQ> [<ffffffff8107d16f>] warn_slowpath_common+0x7f/0xc0
[ 2669.712509] [<ffffffff8107d266>] warn_slowpath_fmt+0x46/0x50
[ 2669.712519] [<ffffffffa038090e>] iwl_tx_cmd_complete+0x2ee/0x330 [iwlwifi]
[ 2669.712529] [<ffffffffa037e280>] iwl_irq_tasklet+0x210/0x8e0 [iwlwifi]
[ 2669.712535] [<ffffffff810851fd>] tasklet_action+0x9d/0x240
[ 2669.712539] [<ffffffff81085e28>] __do_softirq+0xc8/0x3d0
[ 2669.712544] [<ffffffff81657f3c>] call_softirq+0x1c/0x30
[ 2669.712549] [<ffffffff8101c735>] do_softirq+0xa5/0xe0
[ 2669.712553] [<ffffffff810864a6>] irq_exit+0xa6/0xf0
[ 2669.712557] [<ffffffff81658813>] do_IRQ+0x63/0xd0
[ 2669.712561] [<ffffffff8164e5f3>] common_interrupt+0x73/0x73
[ 2669.712563] <EOI> [<ffffffff81655c7a>] ? sysret_check+0x2e/0x69
[ 2669.712570] ---[ end trace e86fa0935f9dc7a5 ]---
[ 2669.712573] iwl data: 00000000: 00 00 55 55 00 00 00 00 08 53 e0 00 00 00 00 00 ..UU.....S......
[ 2669.712577] iwl data: 00000010: 00 00 00 00 7e 04 19 00 05 00 04 00 94 07 02 00 ....~...........
[ 2669.712619] ------------[ cut here ]------------
[ 2669.712628] WARNING: at drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c:927 iwl_tx_cmd_complete+0x2ee/0x330 [iwlwifi]()
[ 2669.712631] Hardware name: Adamo 13
[ 2669.712634] wrong command queue 11 (should be 4), sequence 0x6B6B readp=54 writep=54
[ 2669.712636] Modules linked in: nfs fscache auth_rpcgss nfs_acl ppdev parport_pc lp parport fuse ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat xt_CHECKSUM iptable_mangle tun bridge stp llc lockd bnep bluetooth ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables arc4 dell_wmi sparse_keymap uvcvideo videodev snd_usb_audio v4l2_compat_ioctl32 snd_usbmidi_lib cdc_ether snd_rawmidi cdc_wdm usbnet cdc_acm mii snd_hda_codec_hdmi snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device dell_laptop iwlwifi dcdbas microcode snd_pcm mac80211 joydev i2c_i801 pcspkr snd_timer iTCO_wdt iTCO_vendor_support snd soundcore cfg80211 snd_page_alloc tg3 rfkill wmi virtio_net kvm_intel kvm uinput sunrpc ipv6 xts gf128mul dm_crypt i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: scsi_wait_scan]
[ 2669.712729] Pid: 2332, comm: firefox Tainted: G W 3.1.0+ #9
[ 2669.712731] Call Trace:
[ 2669.712733] <IRQ> [<ffffffff8107d16f>] warn_slowpath_common+0x7f/0xc0
[ 2669.712743] [<ffffffff8164de90>] ? _raw_spin_unlock_irqrestore+0x40/0x90
[ 2669.712747] [<ffffffff8107d266>] warn_slowpath_fmt+0x46/0x50
[ 2669.712753] [<ffffffff810c189f>] ? trace_hardirqs_on_caller+0x1f/0x1b0
[ 2669.712762] [<ffffffffa038090e>] iwl_tx_cmd_complete+0x2ee/0x330 [iwlwifi]
[ 2669.712772] [<ffffffffa037e280>] iwl_irq_tasklet+0x210/0x8e0 [iwlwifi]
[ 2669.712777] [<ffffffff810851fd>] tasklet_action+0x9d/0x240
[ 2669.712781] [<ffffffff81085e28>] __do_softirq+0xc8/0x3d0
[ 2669.712785] [<ffffffff81657f3c>] call_softirq+0x1c/0x30
[ 2669.712789] [<ffffffff8101c735>] do_softirq+0xa5/0xe0
[ 2669.712792] [<ffffffff810864a6>] irq_exit+0xa6/0xf0
[ 2669.712796] [<ffffffff81658813>] do_IRQ+0x63/0xd0
[ 2669.712800] [<ffffffff8164e5f3>] common_interrupt+0x73/0x73
[ 2669.712802] <EOI> [<ffffffff81655c7a>] ? sysret_check+0x2e/0x69
[ 2669.712808] ---[ end trace e86fa0935f9dc7a6 ]---
[ 2669.712811] iwl data: 00000000: 00 00 55 55 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b ..UUkkkkkkkkkkkk
[ 2669.712815] iwl data: 00000010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
[ 2669.712818] ------------[ cut here ]------------
[ 2669.712826] WARNING: at drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c:927 iwl_tx_cmd_complete+0x2ee/0x330 [iwlwifi]()
[ 2669.712829] Hardware name: Adamo 13
[ 2669.712832] wrong command queue 11 (should be 4), sequence 0x6B6B readp=54 writep=54
[ 2669.712834] Modules linked in: nfs fscache auth_rpcgss nfs_acl ppdev parport_pc lp parport fuse ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat xt_CHECKSUM iptable_mangle tun bridge stp llc lockd bnep bluetooth ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables arc4 dell_wmi sparse_keymap uvcvideo videodev snd_usb_audio v4l2_compat_ioctl32 snd_usbmidi_lib cdc_ether snd_rawmidi cdc_wdm usbnet cdc_acm mii snd_hda_codec_hdmi snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device dell_laptop iwlwifi dcdbas microcode snd_pcm mac80211 joydev i2c_i801 pcspkr snd_timer iTCO_wdt iTCO_vendor_support snd soundcore cfg80211 snd_page_alloc tg3 rfkill wmi virtio_net kvm_intel kvm uinput sunrpc ipv6 xts gf128mul dm_crypt i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: scsi_wait_scan]
[ 2669.712925] Pid: 2332, comm: firefox Tainted: G W 3.1.0+ #9
[ 2669.712928] Call Trace:
[ 2669.712930] <IRQ> [<ffffffff8107d16f>] warn_slowpath_common+0x7f/0xc0
[ 2669.712938] [<ffffffff8107d266>] warn_slowpath_fmt+0x46/0x50
[ 2669.712948] [<ffffffffa038090e>] iwl_tx_cmd_complete+0x2ee/0x330 [iwlwifi]
[ 2669.712958] [<ffffffffa037e280>] iwl_irq_tasklet+0x210/0x8e0 [iwlwifi]
[ 2669.712963] [<ffffffff810851fd>] tasklet_action+0x9d/0x240
[ 2669.712967] [<ffffffff81085e28>] __do_softirq+0xc8/0x3d0
[ 2669.712971] [<ffffffff81657f3c>] call_softirq+0x1c/0x30
[ 2669.712975] [<ffffffff8101c735>] do_softirq+0xa5/0xe0
[ 2669.712979] [<ffffffff810864a6>] irq_exit+0xa6/0xf0
[ 2669.712982] [<ffffffff81658813>] do_IRQ+0x63/0xd0
[ 2669.712986] [<ffffffff8164e5f3>] common_interrupt+0x73/0x73
[ 2669.712988] <EOI> [<ffffffff81655c7a>] ? sysret_check+0x2e/0x69
[ 2669.712994] ---[ end trace e86fa0935f9dc7a7 ]---
[ 2669.712997] iwl data: 00000000: 00 00 55 55 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b ..UUkkkkkkkkkkkk
[ 2669.713018] iwl data: 00000010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
[ 2669.713136] ------------[ cut here ]------------
[ 2669.713146] WARNING: at drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c:927 iwl_tx_cmd_complete+0x2ee/0x330 [iwlwifi]()
[ 2669.713150] Hardware name: Adamo 13
[ 2669.713153] wrong command queue 11 (should be 4), sequence 0x6B6B readp=54 writep=54
[ 2669.713157] Modules linked in: nfs fscache auth_rpcgss nfs_acl ppdev parport_pc lp parport fuse ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat xt_CHECKSUM iptable_mangle tun bridge stp llc lockd bnep bluetooth ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables arc4 dell_wmi sparse_keymap uvcvideo videodev snd_usb_audio v4l2_compat_ioctl32 snd_usbmidi_lib cdc_ether snd_rawmidi cdc_wdm usbnet cdc_acm mii snd_hda_codec_hdmi snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device dell_laptop iwlwifi dcdbas microcode snd_pcm mac80211 joydev i2c_i801 pcspkr snd_timer iTCO_wdt iTCO_vendor_support snd soundcore cfg80211 snd_page_alloc tg3 rfkill wmi virtio_net kvm_intel kvm uinput sunrpc ipv6 xts gf128mul dm_crypt i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: scsi_wait_scan]
[ 2669.713292] Pid: 2332, comm: firefox Tainted: G W 3.1.0+ #9
[ 2669.713295] Call Trace:
[ 2669.713297] <IRQ> [<ffffffff8107d16f>] warn_slowpath_common+0x7f/0xc0
[ 2669.713308] [<ffffffff8107d266>] warn_slowpath_fmt+0x46/0x50
[ 2669.713319] [<ffffffffa038090e>] iwl_tx_cmd_complete+0x2ee/0x330 [iwlwifi]
[ 2669.713331] [<ffffffffa037e280>] iwl_irq_tasklet+0x210/0x8e0 [iwlwifi]
[ 2669.713337] [<ffffffff810851fd>] tasklet_action+0x9d/0x240
[ 2669.713342] [<ffffffff81085e28>] __do_softirq+0xc8/0x3d0
[ 2669.713347] [<ffffffff81657f3c>] call_softirq+0x1c/0x30
[ 2669.713353] [<ffffffff8101c735>] do_softirq+0xa5/0xe0
[ 2669.713357] [<ffffffff810864a6>] irq_exit+0xa6/0xf0
[ 2669.713362] [<ffffffff81658813>] do_IRQ+0x63/0xd0
[ 2669.713367] [<ffffffff8164e5f3>] common_interrupt+0x73/0x73
[ 2669.713369] <EOI> [<ffffffff81655c7a>] ? sysret_check+0x2e/0x69
[ 2669.713377] ---[ end trace e86fa0935f9dc7a8 ]---
[ 2669.713380] iwl data: 00000000: 00 00 55 55 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b ..UUkkkkkkkkkkkk
[ 2669.713385] iwl data: 00000010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
[ 2670.784424] iwlwifi 0000:04:00.0: Microcode SW error detected. Restarting 0x2000000.
[ 2670.784431] iwlwifi 0000:04:00.0: Loaded firmware version: 8.83.5.1 build 33692
[ 2670.784556] iwlwifi 0000:04:00.0: Start IWL Error Log Dump:
[ 2670.784559] iwlwifi 0000:04:00.0: Status: 0x000412E4, count: 5
[ 2670.784562] iwlwifi 0000:04:00.0: 0x00000005 | SYSASSERT
[ 2670.784565] iwlwifi 0000:04:00.0: 0x000024EC | uPc
[ 2670.784568] iwlwifi 0000:04:00.0: 0x000024C8 | branchlink1
[ 2670.784570] iwlwifi 0000:04:00.0: 0x000024C8 | branchlink2
[ 2670.784573] iwlwifi 0000:04:00.0: 0x00000916 | interruptlink1
[ 2670.784576] iwlwifi 0000:04:00.0: 0x00000000 | interruptlink2
[ 2670.784578] iwlwifi 0000:04:00.0: 0x000000FF | data1
[ 2670.784580] iwlwifi 0000:04:00.0: 0x00000489 | data2
[ 2670.784583] iwlwifi 0000:04:00.0: 0x00000489 | line
[ 2670.784585] iwlwifi 0000:04:00.0: 0x1A41414C | beacon time
[ 2670.784588] iwlwifi 0000:04:00.0: 0x54956EB4 | tsf low
[ 2670.784591] iwlwifi 0000:04:00.0: 0x000004FB | tsf hi
[ 2670.784593] iwlwifi 0000:04:00.0: 0x00000000 | time gp1
[ 2670.784596] iwlwifi 0000:04:00.0: 0x9D4D53F1 | time gp2
[ 2670.784598] iwlwifi 0000:04:00.0: 0x00000000 | time gp3
[ 2670.784601] iwlwifi 0000:04:00.0: 0x00010853 | uCode version
[ 2670.784603] iwlwifi 0000:04:00.0: 0x00000024 | hw version
[ 2670.784606] iwlwifi 0000:04:00.0: 0x00480302 | board version
[ 2670.784609] iwlwifi 0000:04:00.0: 0x0B15001C | hcmd
[ 2670.784611] iwlwifi 0000:04:00.0: CSR values:
[ 2670.784614] iwlwifi 0000:04:00.0: (2nd byte of CSR_INT_COALESCING is CSR_INT_PERIODIC_REG)
[ 2670.784641] iwlwifi 0000:04:00.0: CSR_HW_IF_CONFIG_REG: 0X00480302
[ 2670.784666] iwlwifi 0000:04:00.0: CSR_INT_COALESCING: 0X00000040
[ 2670.784691] iwlwifi 0000:04:00.0: CSR_INT: 0X00000000
[ 2670.784715] iwlwifi 0000:04:00.0: CSR_INT_MASK: 0X00000000
[ 2670.784740] iwlwifi 0000:04:00.0: CSR_FH_INT_STATUS: 0X00000000
[ 2670.784765] iwlwifi 0000:04:00.0: CSR_GPIO_IN: 0X00000000
[ 2670.784790] iwlwifi 0000:04:00.0: CSR_RESET: 0X00000000
[ 2670.784814] iwlwifi 0000:04:00.0: CSR_GP_CNTRL: 0X080403c5
[ 2670.784839] iwlwifi 0000:04:00.0: CSR_HW_REV: 0X00000024
[ 2670.784864] iwlwifi 0000:04:00.0: CSR_EEPROM_REG: 0X00000000
[ 2670.784889] iwlwifi 0000:04:00.0: CSR_EEPROM_GP: 0X90000004
[ 2670.784914] iwlwifi 0000:04:00.0: CSR_OTP_GP_REG: 0X00060000
[ 2670.784938] iwlwifi 0000:04:00.0: CSR_GIO_REG: 0X00080042
[ 2670.784963] iwlwifi 0000:04:00.0: CSR_GP_UCODE_REG: 0X00007c71
[ 2670.784988] iwlwifi 0000:04:00.0: CSR_GP_DRIVER_REG: 0X00000000
[ 2670.785012] iwlwifi 0000:04:00.0: CSR_UCODE_DRV_GP1: 0X00000000
[ 2670.785037] iwlwifi 0000:04:00.0: CSR_UCODE_DRV_GP2: 0X00000000
[ 2670.785062] iwlwifi 0000:04:00.0: CSR_LED_REG: 0X00000058
[ 2670.785086] iwlwifi 0000:04:00.0: CSR_DRAM_INT_TBL_REG: 0X8811a5a0
[ 2670.785111] iwlwifi 0000:04:00.0: CSR_GIO_CHICKEN_BITS: 0X27800200
[ 2670.785136] iwlwifi 0000:04:00.0: CSR_ANA_PLL_CFG: 0X00880300
[ 2670.785161] iwlwifi 0000:04:00.0: CSR_HW_REV_WA_REG: 0X0001001a
[ 2670.785186] iwlwifi 0000:04:00.0: CSR_DBG_HPET_MEM_REG: 0Xffff0000
[ 2670.785188] iwlwifi 0000:04:00.0: FH register values:
[ 2670.785224] iwlwifi 0000:04:00.0: FH_RSCSR_CHNL0_STTS_WPTR_REG: 0X1174de00
[ 2670.785243] iwlwifi 0000:04:00.0: FH_RSCSR_CHNL0_RBDCB_BASE_REG: 0X012abbb0
[ 2670.785261] iwlwifi 0000:04:00.0: FH_RSCSR_CHNL0_WPTR: 0X00000048
[ 2670.785280] iwlwifi 0000:04:00.0: FH_MEM_RCSR_CHNL0_CONFIG_REG: 0X80819104
[ 2670.785300] iwlwifi 0000:04:00.0: FH_MEM_RSSR_SHARED_CTRL_REG: 0X000000fc
[ 2670.785343] iwlwifi 0000:04:00.0: FH_MEM_RSSR_RX_STATUS_REG: 0X02630000
[ 2670.785362] iwlwifi 0000:04:00.0: FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV: 0X00000000
[ 2670.785380] iwlwifi 0000:04:00.0: FH_TSSR_TX_STATUS_REG: 0X07ff0001
[ 2670.785389] iwlwifi 0000:04:00.0: FH_TSSR_TX_ERROR_REG: 0X00000000
[ 2670.785389] iwlwifi 0000:04:00.0: Start IWL Event Log Dump: display last 20 entries
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638087993:0x00000000:0355
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638088265:0x00000113:0106
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638088266:0x00000000:0302
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638088289:0x00000000:0355
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638088453:0x00000113:0106
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638088455:0x00000000:0302
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638088478:0x00000000:0355
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638088750:0x0b15001c:0206
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638088752:0x00000001:0204
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638088755:0x00000001:0214
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638088756:0x01002111:0209
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638089055:0x00000000:0210
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638089065:0x00000000:0207
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638089067:0x01002111:0211
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638089072:0x00000000:0212
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638090106:0x00000000:0215
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638090108:0x00000008:0220
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638090127:0x00000000:0301
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2638090315:0x00000000:0355
[ 2670.785389] iwlwifi 0000:04:00.0: EVT_LOGT:2639090696:0x00000000:0125
[ 2670.795643] ieee80211 phy0: Hardware restart was requested
[ 2670.795729] iwlwifi 0000:04:00.0: L1 Enabled; Disabling L0S
[ 2670.798779] iwlwifi 0000:04:00.0: Radio type=0x0-0x2-0x0
^ permalink raw reply
* Re: [PATCH 4/5] hpsa: fix potential array overflow in hpsa_update_scsi_devices
From: scameron @ 2011-10-31 14:36 UTC (permalink / raw)
To: James Bottomley
Cc: stephenmcameron, akpm, linux-kernel, linux-scsi, mikem, scameron
In-Reply-To: <1319969782.5215.23.camel@dabdike>
On Sun, Oct 30, 2011 at 02:16:22PM +0400, James Bottomley wrote:
> On Wed, 2011-10-26 at 16:21 -0500, Stephen M. Cameron wrote:
> > From: Scott Teel <scott.teel@hp.com>
> >
> > The currentsd[] array in hpsa_update_scsi_devices had room for
> > 256 devices. The code was iterating over however many physical
> > and logical devices plus an additional number of possible external
> > MSA2XXX controllers, which together could potentially exceed 256.
> >
> > We increased the size of the currentsd array to 1024 + 1024 + 32 + 1
> > elements to reflect a reasonable maximum possible number of devices
> > which might be encountered. We also don't just walk off the end
> > of the array if the array controller reports more devices than we
> > are prepared to handle, we just ignore the excessive devices.
> >
> > Signed-off-by: Scott Teel <scott.teel@hp.com>
> > Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
>
> This should be Signed-off-by not Acked-by. The reason is that the
> signoffs track whose hands the patch passes through. If you send
> Scott's patch to me, it must have your signoff. If Scott sends the
> patch directly to me and then you OK it on the list, then I'll add
> Acked-by. I've assumed your acquiescence to correcting this in my tree.
>
> James
>
Thanks James.
I don't often have patches from other people to forward, so I tend to
forget how it's supposed to work. I'll try to remember that for next time.
-- steve
^ permalink raw reply
* [U-Boot] Enabling cache on ARM
From: Fabio Estevam @ 2011-10-31 14:36 UTC (permalink / raw)
To: u-boot
Hi Stefano and Albert,
I would like to enable cache on some i.MX boards (ARM9, ARM11 and Cortex-A8).
Are there any boards I could use as a reference on how to properly
implement this?
I thought I should simply do:
#undef CONFIG_SYS_ICACHE_OFF
#undef CONFIG_SYS_DCACHE_OFF
,but still I get a 'WARNING: Caches not enabled' message when I do this.
Thanks,
Fabio Estevam
^ permalink raw reply
* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
From: Will Deacon @ 2011-10-31 14:37 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20111031141322.GK19187@n2100.arm.linux.org.uk>
On Mon, Oct 31, 2011 at 02:13:22PM +0000, Russell King - ARM Linux wrote:
> On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> > The only downside is that I have to go over all of the platforms again
> > unless I can polish up my Coccinelle-fu. Ho-hum.
>
> Well, I've just given coccinelle a go, and having read all the hype about
> it, I'm completely disappointed with it to the extent that I'm going to
> uninstall the tool from my system (unless someone can point out what I'm
> doing wrong.)
I'm really new to it, so I'm by no means an expert...
> I thought I'd give it a spin on a nice simple change - deleting the
> local_irq_disable() calls inside arch_reset() (irqs have already been
> disabled by this time):
>
> @@
> identifier mode, cmd;
> @@
>
> arch_reset(char mode, const char *cmd)
> {
> ...
> - local_irq_disable();
> ...
> }
Looks good to me.
> $ spatch -sp_file arch_reset-1.cocci arch/arm/*/include/*/system.h > arch_reset-1.diff
>
> The diff it created contains:
>
> --- arch/arm/mach-ep93xx/include/mach/system.h 2011-03-04 19:52:46.419272878 +0000
> +++ /tmp/cocci-output-380-f841cc-system.h 2011-10-31 13:54:52.066705107 +0000
> ...
> --- arch/arm/mach-iop32x/include/mach/system.h 2011-03-04 19:52:46.445272534 +0000
> +++ /tmp/cocci-output-380-c0e3f4-system.h 2011-10-31 13:54:52.072705051 +0000
> ...
> --- arch/arm/mach-ixp2000/include/mach/system.h 2011-03-04 19:52:46.449272482 +0000
> +++ /tmp/cocci-output-380-467f17-system.h 2011-10-31 13:54:52.079704984 +0000
> ...
>
> which in total deletes 6 lines. However, the patch is rejected by
> git apply and gnu patch as it stands - it needs the filenames to be
> edited to something more reasonable. So that also takes six edits.
Ah, yeah, that's not good. I tried using the -dir option but ran into
problems, since spatch only descends one level into the filesystem hierarchy.
In the end I used find and xargs :)
Will
^ permalink raw reply
* Re: [ANNOUNCE] xf86-video-intel 2.16.901
From: Julien Cristau @ 2011-10-31 14:37 UTC (permalink / raw)
To: Bojan Smojver; +Cc: intel-gfx
In-Reply-To: <1320023745.1989.2.camel@shrek.rexursive.com>
On Mon, Oct 31, 2011 at 12:15:45 +1100, Bojan Smojver wrote:
> On Sun, 2011-10-30 at 16:57 +0000, Chris Wilson wrote:
> > Bugs fixed in this snapshot (compared to 2.16.0)
>
> No hibernation memory corruption fix. Sniff, sniff... :-(
>
Pretty sure what you should be looking for is in the kernel, not the X
driver.
Cheers,
Julien
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
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.