* How to set fops in "struct platform_pwm_backlight_data"? @ 2013-10-17 6:49 Mark Zhang 2013-10-17 7:14 ` Thierry Reding 0 siblings, 1 reply; 19+ messages in thread From: Mark Zhang @ 2013-10-17 6:49 UTC (permalink / raw) To: thierry.reding, rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen Cc: linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Hi, This is the first time I send mail to linux-pwm, I didn't read through the mails in this list, so if somebody already asked this question, I'm sorry about that. I wanna set some fops in "struct platform_pwm_backlight_data". But the currrent probe function in pwm_bl.c says: ------- if (!data) { ret = pwm_backlight_parse_dt(&pdev->dev, &defdata); if (ret < 0) { dev_err(&pdev->dev, "failed to find platform data\n"); return ret; } data = &defdata; } ------- This looks like if we set the platform data for pwm backlight device, "pwm_backlight_parse_dt" will never have a chance to be called, which means the stuffs I defined in backlight DT node will be ignored. If I don't set the platform data for pwm backlight device, according to the pwm_backlight_probe, I will never have a chance to set some fops which I need(like "notify", "check_fb"...). So, what I suppose to do now? Maybe there is a way to set function pointers in DT? Mark ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-17 6:49 How to set fops in "struct platform_pwm_backlight_data"? Mark Zhang @ 2013-10-17 7:14 ` Thierry Reding 2013-10-18 4:48 ` Mark Zhang 0 siblings, 1 reply; 19+ messages in thread From: Thierry Reding @ 2013-10-17 7:14 UTC (permalink / raw) To: Mark Zhang Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org [-- Attachment #1: Type: text/plain, Size: 1303 bytes --] On Thu, Oct 17, 2013 at 02:49:57PM +0800, Mark Zhang wrote: > Hi, > > This is the first time I send mail to linux-pwm, I didn't read through > the mails in this list, so if somebody already asked this question, I'm > sorry about that. > > I wanna set some fops in "struct platform_pwm_backlight_data". But the > currrent probe function in pwm_bl.c says: > > ------- > if (!data) { > ret = pwm_backlight_parse_dt(&pdev->dev, &defdata); > if (ret < 0) { > dev_err(&pdev->dev, "failed to find platform data\n"); > return ret; > } > > data = &defdata; > } > ------- > > This looks like if we set the platform data for pwm backlight device, > "pwm_backlight_parse_dt" will never have a chance to be called, which > means the stuffs I defined in backlight DT node will be ignored. > > If I don't set the platform data for pwm backlight device, according to > the pwm_backlight_probe, I will never have a chance to set some fops > which I need(like "notify", "check_fb"...). > > So, what I suppose to do now? Maybe there is a way to set function > pointers in DT? Perhaps you could describe in more detail what you need the functions for. Generally you're not supposed to mix DT and platform data. Without more info that's about all I can say. Thierry [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-17 7:14 ` Thierry Reding @ 2013-10-18 4:48 ` Mark Zhang 2013-10-22 2:41 ` Mark Zhang 2013-10-22 7:24 ` Thierry Reding 0 siblings, 2 replies; 19+ messages in thread From: Mark Zhang @ 2013-10-18 4:48 UTC (permalink / raw) To: Thierry Reding Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org On 10/17/2013 03:14 PM, Thierry Reding wrote: > On Thu, Oct 17, 2013 at 02:49:57PM +0800, Mark Zhang wrote: >> Hi, >> >> This is the first time I send mail to linux-pwm, I didn't read through >> the mails in this list, so if somebody already asked this question, I'm >> sorry about that. >> >> I wanna set some fops in "struct platform_pwm_backlight_data". But the >> currrent probe function in pwm_bl.c says: >> >> ------- >> if (!data) { >> ret = pwm_backlight_parse_dt(&pdev->dev, &defdata); >> if (ret < 0) { >> dev_err(&pdev->dev, "failed to find platform data\n"); >> return ret; >> } >> >> data = &defdata; >> } >> ------- >> >> This looks like if we set the platform data for pwm backlight device, >> "pwm_backlight_parse_dt" will never have a chance to be called, which >> means the stuffs I defined in backlight DT node will be ignored. >> >> If I don't set the platform data for pwm backlight device, according to >> the pwm_backlight_probe, I will never have a chance to set some fops >> which I need(like "notify", "check_fb"...). >> >> So, what I suppose to do now? Maybe there is a way to set function >> pointers in DT? > > Perhaps you could describe in more detail what you need the functions > for. > Okay, I just want to set the "notify" function pointer in "struct platform_pwm_backlight_data", because I want to tune the brightness value before the pwm-bl sets the brightness to hardware. I don't know how to do that, unless we define the platform data explicitly. Mark > Generally you're not supposed to mix DT and platform data. Without more > info that's about all I can say. > > Thierry > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-18 4:48 ` Mark Zhang @ 2013-10-22 2:41 ` Mark Zhang 2013-10-22 7:24 ` Thierry Reding 1 sibling, 0 replies; 19+ messages in thread From: Mark Zhang @ 2013-10-22 2:41 UTC (permalink / raw) To: Thierry Reding Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Ping Thierry... Mark On 10/18/2013 12:48 PM, Mark Zhang wrote: > On 10/17/2013 03:14 PM, Thierry Reding wrote: >> On Thu, Oct 17, 2013 at 02:49:57PM +0800, Mark Zhang wrote: >>> Hi, >>> >>> This is the first time I send mail to linux-pwm, I didn't read through >>> the mails in this list, so if somebody already asked this question, I'm >>> sorry about that. >>> >>> I wanna set some fops in "struct platform_pwm_backlight_data". But the >>> currrent probe function in pwm_bl.c says: >>> >>> ------- >>> if (!data) { >>> ret = pwm_backlight_parse_dt(&pdev->dev, &defdata); >>> if (ret < 0) { >>> dev_err(&pdev->dev, "failed to find platform data\n"); >>> return ret; >>> } >>> >>> data = &defdata; >>> } >>> ------- >>> >>> This looks like if we set the platform data for pwm backlight device, >>> "pwm_backlight_parse_dt" will never have a chance to be called, which >>> means the stuffs I defined in backlight DT node will be ignored. >>> >>> If I don't set the platform data for pwm backlight device, according to >>> the pwm_backlight_probe, I will never have a chance to set some fops >>> which I need(like "notify", "check_fb"...). >>> >>> So, what I suppose to do now? Maybe there is a way to set function >>> pointers in DT? >> >> Perhaps you could describe in more detail what you need the functions >> for. >> > > Okay, I just want to set the "notify" function pointer in "struct > platform_pwm_backlight_data", because I want to tune the brightness > value before the pwm-bl sets the brightness to hardware. I don't know > how to do that, unless we define the platform data explicitly. > > Mark >> Generally you're not supposed to mix DT and platform data. Without more >> info that's about all I can say. >> >> Thierry >> ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-18 4:48 ` Mark Zhang 2013-10-22 2:41 ` Mark Zhang @ 2013-10-22 7:24 ` Thierry Reding 2013-10-22 8:55 ` Mark Zhang 1 sibling, 1 reply; 19+ messages in thread From: Thierry Reding @ 2013-10-22 7:24 UTC (permalink / raw) To: Mark Zhang Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org [-- Attachment #1: Type: text/plain, Size: 1799 bytes --] On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: > On 10/17/2013 03:14 PM, Thierry Reding wrote: > > On Thu, Oct 17, 2013 at 02:49:57PM +0800, Mark Zhang wrote: > >> Hi, > >> > >> This is the first time I send mail to linux-pwm, I didn't read through > >> the mails in this list, so if somebody already asked this question, I'm > >> sorry about that. > >> > >> I wanna set some fops in "struct platform_pwm_backlight_data". But the > >> currrent probe function in pwm_bl.c says: > >> > >> ------- > >> if (!data) { > >> ret = pwm_backlight_parse_dt(&pdev->dev, &defdata); > >> if (ret < 0) { > >> dev_err(&pdev->dev, "failed to find platform data\n"); > >> return ret; > >> } > >> > >> data = &defdata; > >> } > >> ------- > >> > >> This looks like if we set the platform data for pwm backlight device, > >> "pwm_backlight_parse_dt" will never have a chance to be called, which > >> means the stuffs I defined in backlight DT node will be ignored. > >> > >> If I don't set the platform data for pwm backlight device, according to > >> the pwm_backlight_probe, I will never have a chance to set some fops > >> which I need(like "notify", "check_fb"...). > >> > >> So, what I suppose to do now? Maybe there is a way to set function > >> pointers in DT? > > > > Perhaps you could describe in more detail what you need the functions > > for. > > > > Okay, I just want to set the "notify" function pointer in "struct > platform_pwm_backlight_data", because I want to tune the brightness > value before the pwm-bl sets the brightness to hardware. I don't know > how to do that, unless we define the platform data explicitly. Okay, my question should have been what you need the functions for and why you think you need them. Thierry [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-22 7:24 ` Thierry Reding @ 2013-10-22 8:55 ` Mark Zhang 2013-10-22 12:49 ` Thierry Reding 0 siblings, 1 reply; 19+ messages in thread From: Mark Zhang @ 2013-10-22 8:55 UTC (permalink / raw) To: Thierry Reding Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org On 10/22/2013 03:24 PM, Thierry Reding wrote: > On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: [...] >>> >> >> Okay, I just want to set the "notify" function pointer in "struct >> platform_pwm_backlight_data", because I want to tune the brightness >> value before the pwm-bl sets the brightness to hardware. I don't know >> how to do that, unless we define the platform data explicitly. > > Okay, my question should have been what you need the functions for and > why you think you need them. > If I understanding you correctly, I suppose I've said that: "because I want to tune the brightness value before the pwm-bl sets the brightness to hardware". Mark > Thierry > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-22 8:55 ` Mark Zhang @ 2013-10-22 12:49 ` Thierry Reding 2013-10-23 2:16 ` Mark Zhang 0 siblings, 1 reply; 19+ messages in thread From: Thierry Reding @ 2013-10-22 12:49 UTC (permalink / raw) To: Mark Zhang Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org [-- Attachment #1: Type: text/plain, Size: 873 bytes --] On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: > On 10/22/2013 03:24 PM, Thierry Reding wrote: > > On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: > [...] > >>> > >> > >> Okay, I just want to set the "notify" function pointer in "struct > >> platform_pwm_backlight_data", because I want to tune the brightness > >> value before the pwm-bl sets the brightness to hardware. I don't know > >> how to do that, unless we define the platform data explicitly. > > > > Okay, my question should have been what you need the functions for and > > why you think you need them. > > > > If I understanding you correctly, I suppose I've said that: "because I > want to tune the brightness value before the pwm-bl sets the brightness > to hardware". Why do you want to tune the brightness value? What are you trying to achieve? Thierry [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-22 12:49 ` Thierry Reding @ 2013-10-23 2:16 ` Mark Zhang 2013-10-23 8:00 ` Thierry Reding 0 siblings, 1 reply; 19+ messages in thread From: Mark Zhang @ 2013-10-23 2:16 UTC (permalink / raw) To: Thierry Reding Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org On 10/22/2013 08:49 PM, Thierry Reding wrote: > On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: >> On 10/22/2013 03:24 PM, Thierry Reding wrote: >>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: >> [...] >>>>> >>>> >>>> Okay, I just want to set the "notify" function pointer in "struct >>>> platform_pwm_backlight_data", because I want to tune the brightness >>>> value before the pwm-bl sets the brightness to hardware. I don't know >>>> how to do that, unless we define the platform data explicitly. >>> >>> Okay, my question should have been what you need the functions for and >>> why you think you need them. >>> >> >> If I understanding you correctly, I suppose I've said that: "because I >> want to tune the brightness value before the pwm-bl sets the brightness >> to hardware". > > Why do you want to tune the brightness value? What are you trying to > achieve? > Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the color value to make the display looks bright so that we can reduce the backlight brightness to save power. So everytime PRISM is triggered, we call "backlight_update_status", then in the "notify" callback, we change the brightness value which pwm-bl provides by considering the PRISM compensations. Mark > Thierry > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 2:16 ` Mark Zhang @ 2013-10-23 8:00 ` Thierry Reding 2013-10-23 8:49 ` Mark Zhang 0 siblings, 1 reply; 19+ messages in thread From: Thierry Reding @ 2013-10-23 8:00 UTC (permalink / raw) To: Mark Zhang Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org [-- Attachment #1: Type: text/plain, Size: 1648 bytes --] On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: > On 10/22/2013 08:49 PM, Thierry Reding wrote: > > On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: > >> On 10/22/2013 03:24 PM, Thierry Reding wrote: > >>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: > >> [...] > >>>>> > >>>> > >>>> Okay, I just want to set the "notify" function pointer in "struct > >>>> platform_pwm_backlight_data", because I want to tune the brightness > >>>> value before the pwm-bl sets the brightness to hardware. I don't know > >>>> how to do that, unless we define the platform data explicitly. > >>> > >>> Okay, my question should have been what you need the functions for and > >>> why you think you need them. > >>> > >> > >> If I understanding you correctly, I suppose I've said that: "because I > >> want to tune the brightness value before the pwm-bl sets the brightness > >> to hardware". > > > > Why do you want to tune the brightness value? What are you trying to > > achieve? > > > > Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the > color value to make the display looks bright so that we can reduce the > backlight brightness to save power. So everytime PRISM is triggered, we > call "backlight_update_status", then in the "notify" callback, we change > the brightness value which pwm-bl provides by considering the PRISM > compensations. If you automatically call backlight_update_status() everytime PRISM gives you new data, can't you just pass the correct value in in the first place so that you don't have to tweak it in the .notify() callback? Thierry [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 8:00 ` Thierry Reding @ 2013-10-23 8:49 ` Mark Zhang 2013-10-23 9:09 ` Thierry Reding 0 siblings, 1 reply; 19+ messages in thread From: Mark Zhang @ 2013-10-23 8:49 UTC (permalink / raw) To: Thierry Reding Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org On 10/23/2013 04:00 PM, Thierry Reding wrote: > On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: >> On 10/22/2013 08:49 PM, Thierry Reding wrote: >>> On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: >>>> On 10/22/2013 03:24 PM, Thierry Reding wrote: >>>>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: >>>> [...] >>>>>>> >>>>>> >>>>>> Okay, I just want to set the "notify" function pointer in "struct >>>>>> platform_pwm_backlight_data", because I want to tune the brightness >>>>>> value before the pwm-bl sets the brightness to hardware. I don't know >>>>>> how to do that, unless we define the platform data explicitly. >>>>> >>>>> Okay, my question should have been what you need the functions for and >>>>> why you think you need them. >>>>> >>>> >>>> If I understanding you correctly, I suppose I've said that: "because I >>>> want to tune the brightness value before the pwm-bl sets the brightness >>>> to hardware". >>> >>> Why do you want to tune the brightness value? What are you trying to >>> achieve? >>> >> >> Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the >> color value to make the display looks bright so that we can reduce the >> backlight brightness to save power. So everytime PRISM is triggered, we >> call "backlight_update_status", then in the "notify" callback, we change >> the brightness value which pwm-bl provides by considering the PRISM >> compensations. > > If you automatically call backlight_update_status() everytime PRISM > gives you new data, can't you just pass the correct value in in the > first place so that you don't have to tweak it in the .notify() > callback? OK, how to do that? -- "pass the correct value in in the first place"? Mark > > Thierry > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 8:49 ` Mark Zhang @ 2013-10-23 9:09 ` Thierry Reding 2013-10-23 10:31 ` Mark Zhang 2013-10-23 10:36 ` Mark Zhang 0 siblings, 2 replies; 19+ messages in thread From: Thierry Reding @ 2013-10-23 9:09 UTC (permalink / raw) To: Mark Zhang Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org [-- Attachment #1: Type: text/plain, Size: 2333 bytes --] On Wed, Oct 23, 2013 at 04:49:29PM +0800, Mark Zhang wrote: > On 10/23/2013 04:00 PM, Thierry Reding wrote: > > On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: > >> On 10/22/2013 08:49 PM, Thierry Reding wrote: > >>> On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: > >>>> On 10/22/2013 03:24 PM, Thierry Reding wrote: > >>>>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: > >>>> [...] > >>>>>>> > >>>>>> > >>>>>> Okay, I just want to set the "notify" function pointer in "struct > >>>>>> platform_pwm_backlight_data", because I want to tune the brightness > >>>>>> value before the pwm-bl sets the brightness to hardware. I don't know > >>>>>> how to do that, unless we define the platform data explicitly. > >>>>> > >>>>> Okay, my question should have been what you need the functions for and > >>>>> why you think you need them. > >>>>> > >>>> > >>>> If I understanding you correctly, I suppose I've said that: "because I > >>>> want to tune the brightness value before the pwm-bl sets the brightness > >>>> to hardware". > >>> > >>> Why do you want to tune the brightness value? What are you trying to > >>> achieve? > >>> > >> > >> Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the > >> color value to make the display looks bright so that we can reduce the > >> backlight brightness to save power. So everytime PRISM is triggered, we > >> call "backlight_update_status", then in the "notify" callback, we change > >> the brightness value which pwm-bl provides by considering the PRISM > >> compensations. > > > > If you automatically call backlight_update_status() everytime PRISM > > gives you new data, can't you just pass the correct value in in the > > first place so that you don't have to tweak it in the .notify() > > callback? > > OK, how to do that? -- "pass the correct value in in the first place"? Well, if you call backlight_update_status(), then you can pass in a brightness value, right? You usually do that by setting the backlight's props.brightness field. So when PRISM gives you new data, you could just read out the current brightness, compute the new one based on the current one and the PRISM data, set the props.brightness field to that value and then call backlight_update_status(). Thierry [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 9:09 ` Thierry Reding @ 2013-10-23 10:31 ` Mark Zhang 2013-10-23 10:54 ` Thierry Reding 2013-10-23 10:36 ` Mark Zhang 1 sibling, 1 reply; 19+ messages in thread From: Mark Zhang @ 2013-10-23 10:31 UTC (permalink / raw) To: Thierry Reding Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org On 10/23/2013 05:09 PM, Thierry Reding wrote: > On Wed, Oct 23, 2013 at 04:49:29PM +0800, Mark Zhang wrote: >> On 10/23/2013 04:00 PM, Thierry Reding wrote: >>> On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: >>>> On 10/22/2013 08:49 PM, Thierry Reding wrote: >>>>> On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: >>>>>> On 10/22/2013 03:24 PM, Thierry Reding wrote: >>>>>>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: >>>>>> [...] >>>>>>>>> >>>>>>>> >>>>>>>> Okay, I just want to set the "notify" function pointer in "struct >>>>>>>> platform_pwm_backlight_data", because I want to tune the brightness >>>>>>>> value before the pwm-bl sets the brightness to hardware. I don't know >>>>>>>> how to do that, unless we define the platform data explicitly. >>>>>>> >>>>>>> Okay, my question should have been what you need the functions for and >>>>>>> why you think you need them. >>>>>>> >>>>>> >>>>>> If I understanding you correctly, I suppose I've said that: "because I >>>>>> want to tune the brightness value before the pwm-bl sets the brightness >>>>>> to hardware". >>>>> >>>>> Why do you want to tune the brightness value? What are you trying to >>>>> achieve? >>>>> >>>> >>>> Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the >>>> color value to make the display looks bright so that we can reduce the >>>> backlight brightness to save power. So everytime PRISM is triggered, we >>>> call "backlight_update_status", then in the "notify" callback, we change >>>> the brightness value which pwm-bl provides by considering the PRISM >>>> compensations. >>> >>> If you automatically call backlight_update_status() everytime PRISM >>> gives you new data, can't you just pass the correct value in in the >>> first place so that you don't have to tweak it in the .notify() >>> callback? >> >> OK, how to do that? -- "pass the correct value in in the first place"? > > Well, if you call backlight_update_status(), then you can pass in a > brightness value, right? You usually do that by setting the backlight's > props.brightness field. > > So when PRISM gives you new data, you could just read out the current > brightness, compute the new one based on the current one and the PRISM > data, set the props.brightness field to that value and then call > backlight_update_status(). > The param of "backlight_update_status" is "struct backlight_device *". So you mean after I get a pointer of correct backlight device, just set the brightness value I want to it's "props.brightness" directly? I think the "struct backlight_device" should be opaque(although it's definition is in include/linux/backlight.h, I know that), so it's better not to touch it's member directly, that's why I wanna use that "notify" callback. Mark > Thierry > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 10:31 ` Mark Zhang @ 2013-10-23 10:54 ` Thierry Reding 2013-10-23 11:33 ` Mark Zhang 0 siblings, 1 reply; 19+ messages in thread From: Thierry Reding @ 2013-10-23 10:54 UTC (permalink / raw) To: Mark Zhang Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org [-- Attachment #1: Type: text/plain, Size: 3356 bytes --] On Wed, Oct 23, 2013 at 06:31:30PM +0800, Mark Zhang wrote: > On 10/23/2013 05:09 PM, Thierry Reding wrote: > > On Wed, Oct 23, 2013 at 04:49:29PM +0800, Mark Zhang wrote: > >> On 10/23/2013 04:00 PM, Thierry Reding wrote: > >>> On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: > >>>> On 10/22/2013 08:49 PM, Thierry Reding wrote: > >>>>> On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: > >>>>>> On 10/22/2013 03:24 PM, Thierry Reding wrote: > >>>>>>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: > >>>>>> [...] > >>>>>>>>> > >>>>>>>> > >>>>>>>> Okay, I just want to set the "notify" function pointer in "struct > >>>>>>>> platform_pwm_backlight_data", because I want to tune the brightness > >>>>>>>> value before the pwm-bl sets the brightness to hardware. I don't know > >>>>>>>> how to do that, unless we define the platform data explicitly. > >>>>>>> > >>>>>>> Okay, my question should have been what you need the functions for and > >>>>>>> why you think you need them. > >>>>>>> > >>>>>> > >>>>>> If I understanding you correctly, I suppose I've said that: "because I > >>>>>> want to tune the brightness value before the pwm-bl sets the brightness > >>>>>> to hardware". > >>>>> > >>>>> Why do you want to tune the brightness value? What are you trying to > >>>>> achieve? > >>>>> > >>>> > >>>> Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the > >>>> color value to make the display looks bright so that we can reduce the > >>>> backlight brightness to save power. So everytime PRISM is triggered, we > >>>> call "backlight_update_status", then in the "notify" callback, we change > >>>> the brightness value which pwm-bl provides by considering the PRISM > >>>> compensations. > >>> > >>> If you automatically call backlight_update_status() everytime PRISM > >>> gives you new data, can't you just pass the correct value in in the > >>> first place so that you don't have to tweak it in the .notify() > >>> callback? > >> > >> OK, how to do that? -- "pass the correct value in in the first place"? > > > > Well, if you call backlight_update_status(), then you can pass in a > > brightness value, right? You usually do that by setting the backlight's > > props.brightness field. > > > > So when PRISM gives you new data, you could just read out the current > > brightness, compute the new one based on the current one and the PRISM > > data, set the props.brightness field to that value and then call > > backlight_update_status(). > > > > The param of "backlight_update_status" is "struct backlight_device *". > So you mean after I get a pointer of correct backlight device, just set > the brightness value I want to it's "props.brightness" directly? Yes. > I think the "struct backlight_device" should be opaque(although it's > definition is in include/linux/backlight.h, I know that), so it's better > not to touch it's member directly, that's why I wanna use that "notify" > callback. Well, backlight_update_status() is the only way to change the brightness of a backlight. If nobody ever calls backlight_update_status() then the .notify() callback will never be called either. By the way, what method do you use to control the backlight brightness? Do you use the sysfs interface from userspace? Thierry [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 10:54 ` Thierry Reding @ 2013-10-23 11:33 ` Mark Zhang 0 siblings, 0 replies; 19+ messages in thread From: Mark Zhang @ 2013-10-23 11:33 UTC (permalink / raw) To: Thierry Reding Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org On 10/23/2013 06:54 PM, Thierry Reding wrote: > On Wed, Oct 23, 2013 at 06:31:30PM +0800, Mark Zhang wrote: >> On 10/23/2013 05:09 PM, Thierry Reding wrote: >>> On Wed, Oct 23, 2013 at 04:49:29PM +0800, Mark Zhang wrote: >>>> On 10/23/2013 04:00 PM, Thierry Reding wrote: >>>>> On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: >>>>>> On 10/22/2013 08:49 PM, Thierry Reding wrote: >>>>>>> On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: >>>>>>>> On 10/22/2013 03:24 PM, Thierry Reding wrote: >>>>>>>>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: >>>>>>>> [...] >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Okay, I just want to set the "notify" function pointer in "struct >>>>>>>>>> platform_pwm_backlight_data", because I want to tune the brightness >>>>>>>>>> value before the pwm-bl sets the brightness to hardware. I don't know >>>>>>>>>> how to do that, unless we define the platform data explicitly. >>>>>>>>> >>>>>>>>> Okay, my question should have been what you need the functions for and >>>>>>>>> why you think you need them. >>>>>>>>> >>>>>>>> >>>>>>>> If I understanding you correctly, I suppose I've said that: "because I >>>>>>>> want to tune the brightness value before the pwm-bl sets the brightness >>>>>>>> to hardware". >>>>>>> >>>>>>> Why do you want to tune the brightness value? What are you trying to >>>>>>> achieve? >>>>>>> >>>>>> >>>>>> Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the >>>>>> color value to make the display looks bright so that we can reduce the >>>>>> backlight brightness to save power. So everytime PRISM is triggered, we >>>>>> call "backlight_update_status", then in the "notify" callback, we change >>>>>> the brightness value which pwm-bl provides by considering the PRISM >>>>>> compensations. >>>>> >>>>> If you automatically call backlight_update_status() everytime PRISM >>>>> gives you new data, can't you just pass the correct value in in the >>>>> first place so that you don't have to tweak it in the .notify() >>>>> callback? >>>> >>>> OK, how to do that? -- "pass the correct value in in the first place"? >>> >>> Well, if you call backlight_update_status(), then you can pass in a >>> brightness value, right? You usually do that by setting the backlight's >>> props.brightness field. >>> >>> So when PRISM gives you new data, you could just read out the current >>> brightness, compute the new one based on the current one and the PRISM >>> data, set the props.brightness field to that value and then call >>> backlight_update_status(). >>> >> >> The param of "backlight_update_status" is "struct backlight_device *". >> So you mean after I get a pointer of correct backlight device, just set >> the brightness value I want to it's "props.brightness" directly? > > Yes. > >> I think the "struct backlight_device" should be opaque(although it's >> definition is in include/linux/backlight.h, I know that), so it's better >> not to touch it's member directly, that's why I wanna use that "notify" >> callback. > > Well, backlight_update_status() is the only way to change the brightness > of a backlight. If nobody ever calls backlight_update_status() then the > .notify() callback will never be called either. > Yes, so this is exactly my understanding before I posted this thread. I think "struct backlight_device" is a handle, we get it and call "backlight_update_status", then if we wanna change it's default behavior or brightness value, we overwrite the fops it provides. > By the way, what method do you use to control the backlight brightness? > Do you use the sysfs interface from userspace? > Yes. Mark > Thierry > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 9:09 ` Thierry Reding 2013-10-23 10:31 ` Mark Zhang @ 2013-10-23 10:36 ` Mark Zhang 2013-10-23 10:46 ` Mark Zhang 2013-10-23 10:51 ` Thierry Reding 1 sibling, 2 replies; 19+ messages in thread From: Mark Zhang @ 2013-10-23 10:36 UTC (permalink / raw) To: Thierry Reding Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org On 10/23/2013 05:09 PM, Thierry Reding wrote: > On Wed, Oct 23, 2013 at 04:49:29PM +0800, Mark Zhang wrote: >> On 10/23/2013 04:00 PM, Thierry Reding wrote: >>> On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: >>>> On 10/22/2013 08:49 PM, Thierry Reding wrote: >>>>> On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: >>>>>> On 10/22/2013 03:24 PM, Thierry Reding wrote: >>>>>>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: >>>>>> [...] >>>>>>>>> >>>>>>>> >>>>>>>> Okay, I just want to set the "notify" function pointer in "struct >>>>>>>> platform_pwm_backlight_data", because I want to tune the brightness >>>>>>>> value before the pwm-bl sets the brightness to hardware. I don't know >>>>>>>> how to do that, unless we define the platform data explicitly. >>>>>>> >>>>>>> Okay, my question should have been what you need the functions for and >>>>>>> why you think you need them. >>>>>>> >>>>>> >>>>>> If I understanding you correctly, I suppose I've said that: "because I >>>>>> want to tune the brightness value before the pwm-bl sets the brightness >>>>>> to hardware". >>>>> >>>>> Why do you want to tune the brightness value? What are you trying to >>>>> achieve? >>>>> >>>> >>>> Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the >>>> color value to make the display looks bright so that we can reduce the >>>> backlight brightness to save power. So everytime PRISM is triggered, we >>>> call "backlight_update_status", then in the "notify" callback, we change >>>> the brightness value which pwm-bl provides by considering the PRISM >>>> compensations. >>> >>> If you automatically call backlight_update_status() everytime PRISM >>> gives you new data, can't you just pass the correct value in in the >>> first place so that you don't have to tweak it in the .notify() >>> callback? >> >> OK, how to do that? -- "pass the correct value in in the first place"? > > Well, if you call backlight_update_status(), then you can pass in a > brightness value, right? You usually do that by setting the backlight's > props.brightness field. > > So when PRISM gives you new data, you could just read out the current > brightness, compute the new one based on the current one and the PRISM > data, set the props.brightness field to that value and then call > backlight_update_status(). > Okay, anyway, I got the idea. Actually it's simpler. :) I'm just curious that if we can do that in this way, why we need "notify" anymore? Mark > Thierry > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 10:36 ` Mark Zhang @ 2013-10-23 10:46 ` Mark Zhang 2013-10-23 10:58 ` Thierry Reding 2013-10-23 10:51 ` Thierry Reding 1 sibling, 1 reply; 19+ messages in thread From: Mark Zhang @ 2013-10-23 10:46 UTC (permalink / raw) To: Thierry Reding Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org On 10/23/2013 06:36 PM, Mark Zhang wrote: > On 10/23/2013 05:09 PM, Thierry Reding wrote: >> On Wed, Oct 23, 2013 at 04:49:29PM +0800, Mark Zhang wrote: >>> On 10/23/2013 04:00 PM, Thierry Reding wrote: >>>> On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: >>>>> On 10/22/2013 08:49 PM, Thierry Reding wrote: >>>>>> On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: >>>>>>> On 10/22/2013 03:24 PM, Thierry Reding wrote: >>>>>>>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: >>>>>>> [...] >>>>>>>>>> >>>>>>>>> >>>>>>>>> Okay, I just want to set the "notify" function pointer in "struct >>>>>>>>> platform_pwm_backlight_data", because I want to tune the brightness >>>>>>>>> value before the pwm-bl sets the brightness to hardware. I don't know >>>>>>>>> how to do that, unless we define the platform data explicitly. >>>>>>>> >>>>>>>> Okay, my question should have been what you need the functions for and >>>>>>>> why you think you need them. >>>>>>>> >>>>>>> >>>>>>> If I understanding you correctly, I suppose I've said that: "because I >>>>>>> want to tune the brightness value before the pwm-bl sets the brightness >>>>>>> to hardware". >>>>>> >>>>>> Why do you want to tune the brightness value? What are you trying to >>>>>> achieve? >>>>>> >>>>> >>>>> Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the >>>>> color value to make the display looks bright so that we can reduce the >>>>> backlight brightness to save power. So everytime PRISM is triggered, we >>>>> call "backlight_update_status", then in the "notify" callback, we change >>>>> the brightness value which pwm-bl provides by considering the PRISM >>>>> compensations. >>>> >>>> If you automatically call backlight_update_status() everytime PRISM >>>> gives you new data, can't you just pass the correct value in in the >>>> first place so that you don't have to tweak it in the .notify() >>>> callback? >>> >>> OK, how to do that? -- "pass the correct value in in the first place"? >> >> Well, if you call backlight_update_status(), then you can pass in a >> brightness value, right? You usually do that by setting the backlight's >> props.brightness field. >> >> So when PRISM gives you new data, you could just read out the current >> brightness, compute the new one based on the current one and the PRISM >> data, set the props.brightness field to that value and then call >> backlight_update_status(). >> > > Okay, anyway, I got the idea. Actually it's simpler. :) > I'm just curious that if we can do that in this way, why we need > "notify" anymore? Oh, by the way, how about "check_fb" fops? Is there some kind of substitution as well? I mean, if I wanna set "check_fb" and also want to define the backlight device via DT, is there a way to do that? Mark > > Mark >> Thierry >> ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 10:46 ` Mark Zhang @ 2013-10-23 10:58 ` Thierry Reding 2013-10-23 11:34 ` Mark Zhang 0 siblings, 1 reply; 19+ messages in thread From: Thierry Reding @ 2013-10-23 10:58 UTC (permalink / raw) To: Mark Zhang Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org [-- Attachment #1: Type: text/plain, Size: 3276 bytes --] On Wed, Oct 23, 2013 at 06:46:17PM +0800, Mark Zhang wrote: > On 10/23/2013 06:36 PM, Mark Zhang wrote: > > On 10/23/2013 05:09 PM, Thierry Reding wrote: > >> On Wed, Oct 23, 2013 at 04:49:29PM +0800, Mark Zhang wrote: > >>> On 10/23/2013 04:00 PM, Thierry Reding wrote: > >>>> On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: > >>>>> On 10/22/2013 08:49 PM, Thierry Reding wrote: > >>>>>> On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: > >>>>>>> On 10/22/2013 03:24 PM, Thierry Reding wrote: > >>>>>>>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: > >>>>>>> [...] > >>>>>>>>>> > >>>>>>>>> > >>>>>>>>> Okay, I just want to set the "notify" function pointer in "struct > >>>>>>>>> platform_pwm_backlight_data", because I want to tune the brightness > >>>>>>>>> value before the pwm-bl sets the brightness to hardware. I don't know > >>>>>>>>> how to do that, unless we define the platform data explicitly. > >>>>>>>> > >>>>>>>> Okay, my question should have been what you need the functions for and > >>>>>>>> why you think you need them. > >>>>>>>> > >>>>>>> > >>>>>>> If I understanding you correctly, I suppose I've said that: "because I > >>>>>>> want to tune the brightness value before the pwm-bl sets the brightness > >>>>>>> to hardware". > >>>>>> > >>>>>> Why do you want to tune the brightness value? What are you trying to > >>>>>> achieve? > >>>>>> > >>>>> > >>>>> Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the > >>>>> color value to make the display looks bright so that we can reduce the > >>>>> backlight brightness to save power. So everytime PRISM is triggered, we > >>>>> call "backlight_update_status", then in the "notify" callback, we change > >>>>> the brightness value which pwm-bl provides by considering the PRISM > >>>>> compensations. > >>>> > >>>> If you automatically call backlight_update_status() everytime PRISM > >>>> gives you new data, can't you just pass the correct value in in the > >>>> first place so that you don't have to tweak it in the .notify() > >>>> callback? > >>> > >>> OK, how to do that? -- "pass the correct value in in the first place"? > >> > >> Well, if you call backlight_update_status(), then you can pass in a > >> brightness value, right? You usually do that by setting the backlight's > >> props.brightness field. > >> > >> So when PRISM gives you new data, you could just read out the current > >> brightness, compute the new one based on the current one and the PRISM > >> data, set the props.brightness field to that value and then call > >> backlight_update_status(). > >> > > > > Okay, anyway, I got the idea. Actually it's simpler. :) > > I'm just curious that if we can do that in this way, why we need > > "notify" anymore? > > Oh, by the way, how about "check_fb" fops? Is there some kind of > substitution as well? I mean, if I wanna set "check_fb" and also want to > define the backlight device via DT, is there a way to do that? No, there's no substitution for that. .check_fb() is used to verify that a backlight device is associated with a framebuffer device. There are better ways to check for that with DT, although nothing has been merged into mainline yet. Thierry [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 10:58 ` Thierry Reding @ 2013-10-23 11:34 ` Mark Zhang 0 siblings, 0 replies; 19+ messages in thread From: Mark Zhang @ 2013-10-23 11:34 UTC (permalink / raw) To: Thierry Reding Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org On 10/23/2013 06:58 PM, Thierry Reding wrote: > On Wed, Oct 23, 2013 at 06:46:17PM +0800, Mark Zhang wrote: >> On 10/23/2013 06:36 PM, Mark Zhang wrote: >>> On 10/23/2013 05:09 PM, Thierry Reding wrote: >>>> On Wed, Oct 23, 2013 at 04:49:29PM +0800, Mark Zhang wrote: >>>>> On 10/23/2013 04:00 PM, Thierry Reding wrote: >>>>>> On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: >>>>>>> On 10/22/2013 08:49 PM, Thierry Reding wrote: >>>>>>>> On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: >>>>>>>>> On 10/22/2013 03:24 PM, Thierry Reding wrote: >>>>>>>>>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: >>>>>>>>> [...] >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Okay, I just want to set the "notify" function pointer in "struct >>>>>>>>>>> platform_pwm_backlight_data", because I want to tune the brightness >>>>>>>>>>> value before the pwm-bl sets the brightness to hardware. I don't know >>>>>>>>>>> how to do that, unless we define the platform data explicitly. >>>>>>>>>> >>>>>>>>>> Okay, my question should have been what you need the functions for and >>>>>>>>>> why you think you need them. >>>>>>>>>> >>>>>>>>> >>>>>>>>> If I understanding you correctly, I suppose I've said that: "because I >>>>>>>>> want to tune the brightness value before the pwm-bl sets the brightness >>>>>>>>> to hardware". >>>>>>>> >>>>>>>> Why do you want to tune the brightness value? What are you trying to >>>>>>>> achieve? >>>>>>>> >>>>>>> >>>>>>> Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the >>>>>>> color value to make the display looks bright so that we can reduce the >>>>>>> backlight brightness to save power. So everytime PRISM is triggered, we >>>>>>> call "backlight_update_status", then in the "notify" callback, we change >>>>>>> the brightness value which pwm-bl provides by considering the PRISM >>>>>>> compensations. >>>>>> >>>>>> If you automatically call backlight_update_status() everytime PRISM >>>>>> gives you new data, can't you just pass the correct value in in the >>>>>> first place so that you don't have to tweak it in the .notify() >>>>>> callback? >>>>> >>>>> OK, how to do that? -- "pass the correct value in in the first place"? >>>> >>>> Well, if you call backlight_update_status(), then you can pass in a >>>> brightness value, right? You usually do that by setting the backlight's >>>> props.brightness field. >>>> >>>> So when PRISM gives you new data, you could just read out the current >>>> brightness, compute the new one based on the current one and the PRISM >>>> data, set the props.brightness field to that value and then call >>>> backlight_update_status(). >>>> >>> >>> Okay, anyway, I got the idea. Actually it's simpler. :) >>> I'm just curious that if we can do that in this way, why we need >>> "notify" anymore? >> >> Oh, by the way, how about "check_fb" fops? Is there some kind of >> substitution as well? I mean, if I wanna set "check_fb" and also want to >> define the backlight device via DT, is there a way to do that? > > No, there's no substitution for that. .check_fb() is used to verify that > a backlight device is associated with a framebuffer device. There are > better ways to check for that with DT, although nothing has been merged > into mainline yet. > Okay, thanks for the explanation. Mark > Thierry > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: How to set fops in "struct platform_pwm_backlight_data"? 2013-10-23 10:36 ` Mark Zhang 2013-10-23 10:46 ` Mark Zhang @ 2013-10-23 10:51 ` Thierry Reding 1 sibling, 0 replies; 19+ messages in thread From: Thierry Reding @ 2013-10-23 10:51 UTC (permalink / raw) To: Mark Zhang Cc: rpurdie, jg1.han, Jean-Christophe PLAGNIOL-VILLARD, tomi.valkeinen, linux-pwm, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org [-- Attachment #1: Type: text/plain, Size: 2995 bytes --] On Wed, Oct 23, 2013 at 06:36:01PM +0800, Mark Zhang wrote: > On 10/23/2013 05:09 PM, Thierry Reding wrote: > > On Wed, Oct 23, 2013 at 04:49:29PM +0800, Mark Zhang wrote: > >> On 10/23/2013 04:00 PM, Thierry Reding wrote: > >>> On Wed, Oct 23, 2013 at 10:16:24AM +0800, Mark Zhang wrote: > >>>> On 10/22/2013 08:49 PM, Thierry Reding wrote: > >>>>> On Tue, Oct 22, 2013 at 04:55:09PM +0800, Mark Zhang wrote: > >>>>>> On 10/22/2013 03:24 PM, Thierry Reding wrote: > >>>>>>> On Fri, Oct 18, 2013 at 12:48:12PM +0800, Mark Zhang wrote: > >>>>>> [...] > >>>>>>>>> > >>>>>>>> > >>>>>>>> Okay, I just want to set the "notify" function pointer in "struct > >>>>>>>> platform_pwm_backlight_data", because I want to tune the brightness > >>>>>>>> value before the pwm-bl sets the brightness to hardware. I don't know > >>>>>>>> how to do that, unless we define the platform data explicitly. > >>>>>>> > >>>>>>> Okay, my question should have been what you need the functions for and > >>>>>>> why you think you need them. > >>>>>>> > >>>>>> > >>>>>> If I understanding you correctly, I suppose I've said that: "because I > >>>>>> want to tune the brightness value before the pwm-bl sets the brightness > >>>>>> to hardware". > >>>>> > >>>>> Why do you want to tune the brightness value? What are you trying to > >>>>> achieve? > >>>>> > >>>> > >>>> Oh, Tegra has a feature named PRISM(aka SmartDimmer). It changes the > >>>> color value to make the display looks bright so that we can reduce the > >>>> backlight brightness to save power. So everytime PRISM is triggered, we > >>>> call "backlight_update_status", then in the "notify" callback, we change > >>>> the brightness value which pwm-bl provides by considering the PRISM > >>>> compensations. > >>> > >>> If you automatically call backlight_update_status() everytime PRISM > >>> gives you new data, can't you just pass the correct value in in the > >>> first place so that you don't have to tweak it in the .notify() > >>> callback? > >> > >> OK, how to do that? -- "pass the correct value in in the first place"? > > > > Well, if you call backlight_update_status(), then you can pass in a > > brightness value, right? You usually do that by setting the backlight's > > props.brightness field. > > > > So when PRISM gives you new data, you could just read out the current > > brightness, compute the new one based on the current one and the PRISM > > data, set the props.brightness field to that value and then call > > backlight_update_status(). > > > > Okay, anyway, I got the idea. Actually it's simpler. :) > I'm just curious that if we can do that in this way, why we need > "notify" anymore? We don't need it any longer for DT, you've just proven that. =) However we still need to support board files, and the .notify() callback is the only way for board files to use board specific means to enable or disable the backlight depending on the brightness value. Thierry [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2013-10-23 11:34 UTC | newest] Thread overview: 19+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-10-17 6:49 How to set fops in "struct platform_pwm_backlight_data"? Mark Zhang 2013-10-17 7:14 ` Thierry Reding 2013-10-18 4:48 ` Mark Zhang 2013-10-22 2:41 ` Mark Zhang 2013-10-22 7:24 ` Thierry Reding 2013-10-22 8:55 ` Mark Zhang 2013-10-22 12:49 ` Thierry Reding 2013-10-23 2:16 ` Mark Zhang 2013-10-23 8:00 ` Thierry Reding 2013-10-23 8:49 ` Mark Zhang 2013-10-23 9:09 ` Thierry Reding 2013-10-23 10:31 ` Mark Zhang 2013-10-23 10:54 ` Thierry Reding 2013-10-23 11:33 ` Mark Zhang 2013-10-23 10:36 ` Mark Zhang 2013-10-23 10:46 ` Mark Zhang 2013-10-23 10:58 ` Thierry Reding 2013-10-23 11:34 ` Mark Zhang 2013-10-23 10:51 ` Thierry Reding
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).