2010-09-09 14:48:30     Control IGAIN & OGAIN for AD73311L via ioctl syscall

Document created by Aaronwu Employee on Aug 23, 2013
Version 1Show Document
  • View in full screen mode

2010-09-09 14:48:30     Control IGAIN & OGAIN for AD73311L via ioctl syscall

Chrysostomos Nanakos (GREECE)

Message: 93309   

 

Hi,

 

I've recently changed the source code of "sound/soc/blackfin/bf5xx-ad73311.c" to include an ioctl syscall acting on a new device dynamically created under /dev with the name ad73311ctl. I am trying to change the OGAIN (Output Gain) from the default value to something else by issuing from userspace an ioctl with a proper value. The code I use in the switch statement is the same as the one been used while configuring the device for the first time but it is reffering only to the Control Register D via SPORT. The ioctl seems to work fine but nothing happens to the Output Gain for example after the issue of the syscall. Is this the right way to change the value of the control register via SPORT? What am I missing here? Below is the code being used in the switch statement.

 

case AD73311CTL_IOCSOGAIN:

                        if(!capable(CAP_SYS_ADMIN))

                                return -EPERM;

                        ret = __get_user(ogain,(int __user *)arg);

                        if(ogain < 0 || ogain > 7) return -EFAULT;

                        /* We doesnt read yet but we should do to preserve the IGS value */

                        ctrl_regd = AD_CONTROL | AD_WRITE | CTRL_REG_D | REGD_OGS(ogain) | REGD_IGS(igain);

                        local_irq_disable();

                        udelay(1);

                        bfin_write_SPORT_TCR1(TFSR);

                        bfin_write_SPORT_TCR2(0xF);

                        SSYNC();

                        bfin_write_SPORT_TX16(ctrl_regd);

                        SSYNC();

                        bfin_write_SPORT_TCR1(bfin_read_SPORT_TCR1() | TSPEN);

                        SSYNC();

                        while (!(status & TUVF) && ++count < 10000) {

                                udelay(1);

                                status = bfin_read_SPORT_STAT();

                                SSYNC();

                        }

                        bfin_write_SPORT_TCR1(bfin_read_SPORT_TCR1() & ~TSPEN);

                        SSYNC();

                        local_irq_enable();

                        break;

QuoteReplyEditDelete

 

 

2010-09-09 22:40:44     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall

Bob Liu (CHINA)

Message: 93316   

 

Hi,

 

I think this is because after probe the device entered normal data mode.

 

And as the ad73311 spec said

 

"When the device is in normal Data Mode (i.e., mixed

mode disabled), it must receive a hardware reset to reprogram

any of the control register settings."

QuoteReplyEditDelete

 

 

2010-09-10 04:45:42     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall

Chrysostomos Nanakos (GREECE)

Message: 93326   

 

I figured that out yesterday. Thanks very much for the reply.

QuoteReplyEditDelete

 

 

2010-09-10 05:43:17     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall

Chrysostomos Nanakos (GREECE)

Message: 93327   

 

Is there any other way to reset the ad73311 wihtout reseting the CPU??? I see in my case, TCM-BF537, that the RESET pin for AD73311 is hooked to the CPU Reset Pin....

QuoteReplyEditDelete

 

 

2010-09-10 06:17:42     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall [SOLVED]

Chrysostomos Nanakos (GREECE)

Message: 93329   

 

Problem solved....Thanks for your replies..

QuoteReplyEditDelete

 

 

2010-09-10 06:24:32     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall [SOLVED]

Bob Liu (CHINA)

Message: 93331   

 

Did you use the software reset in REGA to solve this problem?

 

Thanks.

QuoteReplyEditDelete

 

 

2010-09-10 10:18:40     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall [SOLVED]

Rob Maris (GERMANY)

Message: 93335   

 

Bob, thanks for your interest. I have asked Chris to take care of runtime configuration stuff.

 

The problem was solved that way in that the port pin as assigned in menuconfig  (I use PF7) is attached to the SE pin AND the RESET pin of the AD73311, at least with my commercial target board. I know that a reference design does not provide this connection, so your hint could be used to do it in the driver, hence making this upgrade more universal.

 

I have attached a patch now that serves as a test opportunity for you, or a review opportunity. A small userspace test source code is attached as separate file.

 

I also refer to this posting thread

 

https://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&forum_id=39&thread_id=33608&_forum_action=ForumMessageBrowse

 

where another solution was presented (without commenting this).

 

ad73311ctl_ioctl.c

patch

QuoteReplyEditDelete

 

 

2010-09-10 13:09:44     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall [SOLVED]

Mike Frysinger (UNITED STATES)

Message: 93342   

 

ideally, this should fit into the existing ASoC framework instead of requiring custom ioctls.  since this is a hardware limitation, i dont think resetting the codec is a problem.

 

so you would want to declare all of the configuration options like any other codec (see controls in ad1980.c).  then whenever one of these options are changed using the standard mixer api, the codec itself would take care of resetting the part on the fly.  seems the AD73311 only has two -- IGAIN and OGAIN, and their settings are easy.

 

you might get clicks or pops or something when changing settings via the mixer, but this is now a policy issue that is the problem of the end user.  there's nothing the software driver can do it prevent this since the hardware requires the reset to reprogram configuration settings.

 

maybe Bob can highlight any invalid ASoC assumptions i might have that'd prevent this from working ...

QuoteReplyEditDelete

 

 

2010-09-12 06:26:45     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall [SOLVED]

Chrysostomos Nanakos (GREECE)

Message: 93370   

 

I agree with Mike. This would be a proper way to control IGAIN & OGAIN. I don't know if this can be done for other device options though. I will have a patch in the next few days for the ASoc framework that will fit into ad73311.c codec.

QuoteReplyEditDelete

 

 

2010-09-13 02:40:53     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall [SOLVED]

Rob Maris (GERMANY)

Message: 93373   

 

Other device options: Chris, I think yes, e.g. look at following snippet from ad193x.c:

 

/* ADC high-pass filter */

SOC_SINGLE("ADC High Pass Filter Switch", AD193X_ADC_CTRL0, AD193X_ADC_HIGHPASS_FILTER, 1, 0),

 

where something specific is being defined, which can hold as an analogy to the requirement to have the mic single-ended enable flag (REGF_SEEN) being runtime configurable - when I'm right here.

 

Another requirement, configurable Sample Rate, requires settability of .rates in playback & capture structure with simultaneous modification of the appropriate register (REGB_DIRATE(..)).

 

Mike: clicks and pops while affecting such controls are harmless, since the intended controls are primarily targeted for application dependent configuration upon app start. In some cases the app might modify the state of REGF_SEEN while "running".

I treat hardware RESET as necessary, while using software RESET implies 15-bit data transfers. I remember, this was the reason why I wired "PF pin for AD73311L Chip Select" with the chip's RESET input, too, at the time I designed the application board.

QuoteReplyEditDelete

 

 

2010-09-14 08:11:34     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall [SOLVED]

Rob Maris (GERMANY)

Message: 93421   

 

A first version of the asoc-based controls, written by Chris, reviewed by me, is attached. Primary goal: having it working OK. Controls:

 

 

 

root: /> amixer

Simple mixer control 'IGAIN',0

Capabilities: volume volume-joined

Playback channels: Mono

Capture channels: Mono

Limits: 0 - 7

Mono: 2 [29%]

Simple mixer control 'OGAIN',0

Capabilities: volume volume-joined

Playback channels: Mono

Capture channels: Mono

Limits: 0 - 7

Mono: 5 [71%]

Simple mixer control 'SEEN',0

Capabilities: volume volume-joined

Playback channels: Mono

Capture channels: Mono

Limits: 0 - 1

Mono: 1 [100%]

Simple mixer control 'SRATE',0

Capabilities: volume volume-joined

Playback channels: Mono

Capture channels: Mono

Limits: 0 - 3

Mono: 0 [0%]

 

Sample rate is coded as index now (0 for 8ksmps, 1 for 16ksmps, etc.). The output control is 0-7 reversed related to data sheet, in order to have a plausible %-scale.

 

Review is appreciated. Should register-related stuff be moved to bf5xx-ad73311.c?

 

All four controls are tested and do not interfer anyway. The new feature operate only when AD73311 RESET is connected to the port pin that drives SE.

 

-Rob

 

patch

QuoteReplyEditDelete

 

 

2010-09-14 08:27:16     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall [SOLVED]

Mike Frysinger (UNITED STATES)

Message: 93422   

 

all codec-specific stuff should be in this codec file.  the bf5xx-<codec> file only serves to connect a specific codec to a specific transport (these files are supposed to be board-specific).

 

the codec needs to use its transport layer to talk to the sport.  it cant bang on mmrs directly.  so at the very least, the regupdate func needs to be moved to the bf5xx-ad73311.c file if not rewritten ...

 

any reason for disabling IRQs ?  what are you trying to prevent exactly ?  if you're using it as a poor man's locking scheme, that'll need fixing to use/take a proper mutex.

QuoteReplyEditDelete

 

 

2010-09-14 11:07:45     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall [SOLVED]

Chrysostomos Nanakos (GREECE)

Message: 93434   

 

Mike: the regupdate func should write to codec registers by communicating over the bus that connects the SoC to the codec, so it has to be rewritten into bf5xx-ad73311.c and EXPORTed to use in the codec. It's pretty easy and can be done; also the patch is not in it's final state and has to consider some more things like proper locking etc. . What I was thinking is that this code can only apply to Rob's board and only. Once the AD73311 is programmed in DATA MODE cannot be resetted by using Control Register A and has to be hard resetted....I don't know how this can be applied to other boards also.

QuoteReplyEditDelete

 

 

2010-09-14 13:52:20     Re: Control IGAIN & OGAIN for AD73311L via ioctl syscall [SOLVED]

Mike Frysinger (UNITED STATES)

Message: 93436   

 

the bf5xx-<codec>.c file is supposed to be "board specific", so moving all of the SPORT/GPIO logic there would be the first step.  then we can take the ad7331.c codec changes and worry about just those.

QuoteReplyEditDelete

 

 

2010-09-15 19:09:04     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 93475   

 

any reason for disabling IRQs ?  what are you trying to prevent exactly ?  if you're using it as a poor man's locking scheme, that'll need fixing to use/take a proper mutex.

 

--- 

 

I have attached the second version of this alsa-based stuff. The separation is done. IRQ's? In fact the same code is present in the original bf5xx-ad73311.c file. The patch is referred to original file state (as prior to any action in this thread).

 

-Rob

 

patch

QuoteReplyEditDelete

 

 

2010-09-17 00:26:44     Re: Control IGAIN & OGAIN for AD73311L via alsa

Bob Liu (CHINA)

Message: 93522   

 

I think this patch is ok.  Thanks for your work.

QuoteReplyEditDelete

 

 

2010-09-17 00:36:35     Re: Control IGAIN & OGAIN for AD73311L via alsa

Mike Frysinger (UNITED STATES)

Message: 93523   

 

it's a good start, but it isnt ok for merging.  it will fail to build when it isnt on SPORT0.

 

also, the style is still a little incorrect.

QuoteReplyEditDelete

 

 

2010-09-17 02:10:55     Re: Control IGAIN & OGAIN for AD73311L via alsa

Bob Liu (CHINA)

Message: 93524   

 

What about adding a task for next realse?

QuoteReplyEditDelete

 

 

2010-09-17 03:05:31     Re: Control IGAIN & OGAIN for AD73311L via alsa

Mike Frysinger (UNITED STATES)

Message: 93528   

 

sure

QuoteReplyEditDelete

 

 

2010-09-17 03:33:32     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 93549   

 

Mike: while reviewing, I overlooked a small error related to SPORT0/1. See patch, which also includes a change to have sample rate entered as real values.

 

Regarding the style: I think this is a matter which Bob could review much better than Rob. ;-)

 

patch

QuoteReplyEditDelete

 

 

2010-09-17 12:48:52     Re: Control IGAIN & OGAIN for AD73311L via alsa

Chrysostomos Nanakos (GREECE)

Message: 93561   

 

If something is to be changed and need some help please tell me....

QuoteReplyEditDelete

 

 

2010-09-17 15:43:05     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 93566   

 

After having completed some application stuff, a bit annoying click burst (approx. in 1/5 sec. interval) is happening, because I configure 3 paramers in my rc.local:

 

amixer sset OGAIN 7 > /dev/null

amixer sset IGAIN 0 > /dev/null

amixer sset SRATE 16000 > /dev/null

 

I think I found a quite elegant solution to cope with this: keeping the AD73311 in CTRL mode as long as the user issues an amixer control to put it in DATA mode. This allows for the controls also being used with boards where AD73311's RESET is not tied to the SE control GPIO-pin. I have arranged that setting SRATE toggles to DATA mode. This means that SRATE must always be issued, just as a sset SRATE 8000 if default is requested.

 

As a result, any initial click appears to be less pronounced related to the old state of the driver.

 

By the way I have looked at the how-to of the configuration code. I'm not sure why no macros from soc.h are used. I think this is subject to future work. I think it is also nicer to have the SEEN switch more conform to habis, like this (from AD183x):

 

Simple mixer control 'ADC High Pass Filter',0

Capabilities: pswitch pswitch-joined

Playback channels: Mono

Mono: Playback [on]

 

-Rob

 

 

P.S.: The attached patch adds to previous patch in this posting thread

 

patch

QuoteReplyEditDelete

 

 

2010-09-27 07:25:14     Re: Control IGAIN & OGAIN for AD73311L via alsa

Bob Liu (CHINA)

Message: 93884   

 

Hi, Rob and Nanakos

 

Could you have a test with the attached patch?

 

I have changed the format and use soc function.

 

Thanks a lot.

 

patch

QuoteReplyEditDelete

 

 

2010-09-27 14:47:34     Re: Control IGAIN & OGAIN for AD73311L via alsa

Mike Frysinger (UNITED STATES)

Message: 93888   

 

please drop the "#if" logic surrounding the new functions.  then change the register point to do:

if (CONFIG_XXX == 1)

    snd_soc_add_controls(...);

 

this should result in the same compiled size while letting gcc always compile this code.  CPP #if statements should be avoided when possible.

QuoteReplyEditDelete

 

 

2010-09-28 20:51:35     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 93938   

 

I have tested Bob's patch (which was originated from trunk).

 

bf5xx-ad73311.c had to be remodified with a SPORT issue (why was that suffixig 16 deleted? - yields a boot crash).

 

ad73311.c:

 

    ad73111.data = 1 is restored again, relative to my last state. Otherwise the AD73311 is not set into DATA mode. As stated earlier, execution of amixer sset RATE is necessary, however, I had a small error in it. It is corrected and moveover moved to OGAIN. output gain now defaults to minimal value. Any startup-sequence would - in most cases - justify OGAIN, therefore set data bit here. This necessity to sset OGAIN is the only drawback with respect to the old code without amixer capabilities.

    compiler error/warning causes are removed.

    #if issue is OK now.

    SRATE is no longer in steps of 8000, starting with 8000. I have no problems with this, but please let us fix it this way or the indexed way as a definite decision - opinions appreciated.

 

Attached patch is with respect to Bob's patch state

AD74111 yet to being considered for correct build.

 

 

 

 

root: /> amixer

Simple mixer control 'IGAIN',0

Capabilities: volume volume-joined

Playback channels: Mono

Capture channels: Mono

Limits: 0 - 7

Mono: 2 [29%]

Simple mixer control 'OGAIN',0

Capabilities: volume volume-joined

Playback channels: Mono

Capture channels: Mono

Limits: 0 - 7

Mono: 5 [71%]

Simple mixer control 'SEEN',0

Capabilities: pswitch pswitch-joined

Playback channels: Mono

Mono: Playback [on]

Simple mixer control 'SRATE',0

Capabilities: volume volume-joined

Playback channels: Mono

Capture channels: Mono

Limits: 0 - 3

Mono: 0 [0%]

 

 

patch

QuoteReplyEditDelete

 

 

2010-09-29 02:54:35     Re: Control IGAIN & OGAIN for AD73311L via alsa

Bob Liu (CHINA)

Message: 93943   

 

> bf5xx-ad73311.c had to be remodified with a SPORT issue (why was that suffixig 16 deleted? - yields a boot crash).

 

What's your platform ? BF537-stamp?

 

>ad73111.data = 1 is restored again, relative to my last state. Otherwise the AD73311 is not set into DATA mode. As stated >earlier, execution of amixer sset RATE is necessary, however, I had a small error in it. It is corrected and moveover >moved to OGAIN. output gain now defaults to minimal value. Any startup-sequence would - in most cases - justify OGAIN, >therefore set data bit here. This necessity to sset OGAIN is the only drawback with respect to the old code without amixer >capabilities.

 

In order to make things simple,  I prefer add a CONFIG_SND_BFIN_AD73311_RESET opinion.

 

>compiler error/warning causes are removed.

 

>#if issue is OK now.

 

Thanks.

 

>SRATE is no longer in steps of 8000, starting with 8000. I have no problems with this, but please let us fix it this way or the >indexed way as a definite decision - opinions appreciated.

 

I use the index way because I don't know how to set the min and max value in SOC_SINGLE_EXT if using the fix way.

 

 

Attached the newest patch.

 

patch

QuoteReplyEditDelete

 

 

2010-09-29 04:32:00     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 93960   

 

First of all, I'm not sure about best practice regarding patches. My patches are incrementally, as I think that it best serves the purpose of quick checks. The absolute patches require me to restore a trunk branch state for the soc directory and then patch and then CHECK the difference with my last state - other policy hints appreciated...

 

Regarding your changes, Bob:

 

I can't use the patch for my app since your patch requires ad73311 RESET and SE be separate GPIO's. Since the new Kconfig setting is a MUST setting, this is not compatible with ANY existing design. Moreover, you'd have a click on every amixer sset command issued, which is - stated in a former posting - annoying when subsequent codec parameters are sent in a rc post-boot sequence. I had arranged the code to be compatible with my board as well as with other boards where ad73311 RESET is not tied with a GPIO. The latter case simply adds the possibility to also set parameters when the DATA bit is already set.

 

Regarding the SPORT TX16 issue. TX16 was trunk state, therefore again: for what reason is the "16" removed? Which board I use shoudn't matter, since MCU - codec interconnection shoudn't vary that much - okay, it's a BF537-based board (TCM-BF537).

QuoteReplyEditDelete

 

 

2010-09-29 04:40:08     Re: Control IGAIN & OGAIN for AD73311L via alsa

Bob Liu (CHINA)

Message: 93961   

 

I didn't requires ad73311 RESET and SE separate GPIO's, If they are connected together, just config them the same number in the Kconfig.

 

About TX16, that's because I use bf527 and SPORT0_TX16 on that board are not defined.

 

But I have fixed it, it willn't be a problem.

 

Thanks

QuoteReplyEditDelete

 

 

2010-09-29 06:01:16     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 93968   

 

Bob, I'd suggest to have Mike a look first regarding the open issues SRATE interpretation andRESET. Okay, I didn't know that the same GPIO could be requested twice - so, for my board this would be OK, but still compatibility seems broken with other boards out there having no RESET assigned at all.

QuoteReplyEditDelete

 

 

2010-09-29 15:07:25     Re: Control IGAIN & OGAIN for AD73311L via alsa

Chrysostomos Nanakos (GREECE)

Message: 93982   

 

Rob: If some boards don't have an assigned RESET gpio then they wont configure the kernel to use the new alsa commands to control the device. I suggest by default the kernel should be configured not to use the alsa controls.

QuoteReplyEditDelete

 

 

2010-09-30 01:38:22     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 94002   

 

Chris: thanks for your complaint. I already had the impression (with Bob), that a crucial point in my efforts aren't interpreted well. My post above from 2010-09-17 (#93566) was an attempt to explain it while parallel inspection of the patch could help understand.

 

To be precise: You don't need a RESET to have controlled the device. This is because per 17/9 I have set the famous DATA bit to 0 right from the start. So, each transfer of a register set results in keeping the codec in control mode. Hence, more register adjustments can be transferred subsequently (and without annoying clicks). The consequence is that at least an amixer command must be issued that puts the AD73311 in DATA mode. The only difference with all boards out there without controlled RESET pin and my particular board is this: I can even modify the registers AFTER the device is put in DATA mode. If the DATA bit is already set, it will automatically issue a RESET impulse "click!". Well, I don't need on the fly changes, I need post-boot changes. But at hardware design time I wasn't sure about the best opportunity regarding such a feature, and I have decided to tie RESET with SE.

 

When the ADI guys agree with this concept, the commit only must be accompanied with a message to the users that they need to include an amixer sset OGAIN command in post-boot for proper operating condition.

 

QuoteReplyEditDelete

 

 

2010-09-30 02:39:09     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 94004   

 

... or, of course, still a kernel config option could be created as you suggest in order to allow 100%, fool-proof backward compatibility.

QuoteReplyEditDelete

 

 

2010-09-30 10:07:03     Re: Control IGAIN & OGAIN for AD73311L via alsa

Chrysostomos Nanakos (GREECE)

Message: 94069   

 

Rob: What you propose seems to be a more robust solution that covers a variety of boards.

QuoteReplyEditDelete

 

 

2010-10-04 04:08:19     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 94162   

 

Bob: I found an ad73311 driver update on trunk, but with the handling as of your proposal state. Is this a definitive way to go for trunk?

 

-Rob

QuoteReplyEditDelete

 

 

2010-10-07 23:52:23     Re: Control IGAIN & OGAIN for AD73311L via alsa

Bob Liu (CHINA)

Message: 94318   

 

Hi, Rob

 

Sorry for the delay reply. My commit is just the first version.

 

And I think add a RESET pin is better than let the user must to amixer sset OGAIN command.

 

Keep uniform is more acceptable for the user.

 

In my commit whether the RESET and SE pin is tied, it can work.

 

If they are tied i just request the pin once,else different pins are request independent.

 

Thanks

QuoteReplyEditDelete

 

 

2010-10-08 05:20:19     Re: Control IGAIN & OGAIN for AD73311L via alsa

Mike Frysinger (UNITED STATES)

Message: 94330   

 

the symbol design wont work as noted in the other thread.  the ASOC module dependency is supposed to be the codec exports symbols for the machine driver to use, and the machine driver itself exports no symbols.  but this patch adds symbols to the machine driver that the codec relies on thus creating a circular dependency loop.  which means these drivers will not work as modules.

 

so the structure that keeps track of the codec state ("struct ad73311_ctrls ad73311") needs to live in the codec file (ad73311.c).

QuoteReplyEditDelete

 

 

2010-10-08 06:17:59     Re: Control IGAIN & OGAIN for AD73311L via alsa

Bob Liu (CHINA)

Message: 94331   

 

Sorry, It's my fault, I have fixed it.

QuoteReplyEditDelete

 

 

2010-10-08 15:24:14     Re: Control IGAIN & OGAIN for AD73311L via alsa

Mike Frysinger (UNITED STATES)

Message: 94343   

 

moving the EXPORT_SYMBOL() line doesnt fix the issue.  you need to move the actual symbols between the files.

QuoteReplyEditDelete

 

 

2010-10-08 22:02:56     Re: Control IGAIN & OGAIN for AD73311L via alsa

Bob Liu (CHINA)

Message: 94346   

 

But in order to move the actual symbols to codec-specific file the boad-specific sport logic must be added to the codec file.

 

Is that okay?

QuoteReplyEditDelete

 

 

2010-10-09 19:30:47     Re: Control IGAIN & OGAIN for AD73311L via alsa

Mike Frysinger (UNITED STATES)

Message: 94374   

 

what is board specific ?  the initial values can be tweaked by the board-specific file already.  where the storage is declared isnt terribly important.

QuoteReplyEditDelete

 

 

2010-10-14 20:41:02     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 94523   

 

Patch. See comments at task #6260

 

patch

QuoteReplyEditDelete

 

 

2010-10-14 22:22:05     Re: Control IGAIN & OGAIN for AD73311L via alsa

Bob Liu (CHINA)

Message: 94524   

 

Hi,

 

Have you test it as modules ?

 

I think this maybe can't work, because bf5xx_ad73311_init() will be called before ad73311_soc_probe().

 

But I have no time to test it now.

 

Thanks.

QuoteReplyEditDelete

 

 

2010-10-15 03:15:22     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 94542   

 

I have tested it as module. Indeed I needed to have some stuff into the init routine, not before it is executed to soc probe, but while soc probe is executed before this init ends. At is at this place where the reference to the ad73311 struct is given and I can do the first configure() as well as assign the address of the hw_write function.

 

To a certain extent it may seem like hacked code (e.g. because of an absolute reference in bf5xx_ad73311_init() - should be okay - the bf5xx_ad73311 struct is defined as global in the same source file), but at least the modified stuff in ad73311_soc_probe() has the same usage of "private" structs as other ADI drivers.

 

Of course, still some stuff is present that may be improved, e.g. usage of SOC_SINGLE macros instead of SOC_SINGLE_EXT macros - but that's up to the SoC specialists...

QuoteReplyEditDelete

 

 

2010-10-15 06:02:46     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 94556   

 

Patch replaces previous patch (forgotten to include my local commit to SRATE controls change)

 

patch

QuoteReplyEditDelete

 

 

2010-10-15 12:26:07     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 94567   

 

Finally, I have restored the capability to have amixer sset commands issued while the bit 'data' in control register A because of the desire to have no burst of audible clicks when more than one command must be issued.

 

First things first: only with this capability, existing designs (without RESET) can be controlled via amixer commands, too. But because it requires at least one SRATE parameter be set, it is still a break (however more minor than to being forced to assign a RESET pin). So, I'd propose to move the parametrics for AD73311 to the board file. This would also clean up Kconfig a bit, where most other devices only have a Y/mod/no setting. The board file section for AD73311 should allow specification of GPIO and whether the data bit is 0 or 1 from module load on (takes all hardware or software constraints into account).

 

The file patch is incremental on top of the last patch, and the file patch_trunk is related to trunk state. From my local commit log (applies to 'patch'):

 

AD73311 again with programmable 'data' bit (via SRATE setting). And...

- chip driver remove added (now modprobe/rmmod iterations possible)

- correction in codec file soc_remove (due to introduction of ad73311_priv)

- SRATE now via enum function

 

.

QuoteReplyEditDelete

 

 

2010-10-15 12:30:23     Re: Control IGAIN & OGAIN for AD73311L via alsa

Rob Maris (GERMANY)

Message: 94568   

 

The patch files failed...

 

root: /> amixer

Simple mixer control 'IGAIN',0

Capabilities: volume volume-joined

Playback channels: Mono

Capture channels: Mono

Limits: 0 - 7

Mono: 2 [29%]

Simple mixer control 'OGAIN',0

Capabilities: volume volume-joined

Playback channels: Mono

Capture channels: Mono

Limits: 0 - 7

Mono: 5 [71%]

Simple mixer control 'SEEN',0

Capabilities: pswitch pswitch-joined

Playback channels: Mono

Mono: Playback [on]

Simple mixer control 'SRATE',0

Capabilities: enum

Items: '8kHz' '16kHz' '32kHz' '64kHz'

Item0: '8kHz'

 

 

patch

patch_trunk

QuoteReplyEditDelete

Outcomes