UPDATE!
I contacted Alexandre Belloni, he recommended the following patch and it
works
https://patchwork.kernel.org/patch/9495007/
On Saturday, March 25, 2017 at 8:38:54 PM UTC+2, Eyad Majali wrote:
>
> again sorry !! I'm posting this for future reference if anyone had the
> same problem , in pwm-sun4i.c
> in function sun4i_pwm_probe
>
> platform_set_drvdata(pdev, pwm);
>
> ret = clk_prepare_enable(pwm->clk);
> if (ret) {
> dev_err(&pdev->dev, "failed to enable PWM clock\n");
> goto clk_error;
> }
>
> + sun4i_pwm_config(&pwm->chip,&pwm->chip.pwms[0],50000,50000);
> + sun4i_pwm_enable(&pwm->chip,&pwm->chip.pwms[0]);
> val = sun4i_pwm_readl(pwm, PWM_CTRL_REG);
> for (i = 0; i < pwm->chip.npwm; i++)
> if (!(val & BIT_CH(PWM_ACT_STATE, i)))
> pwm_set_polarity(&pwm->chip.pwms[i],
> PWM_POLARITY_INVERSED);
> clk_disable_unprepare(pwm->clk);
>
> return 0;
>
>
>
>
> On Saturday, March 25, 2017 at 8:16:12 PM UTC+2, Eyad Majali wrote:
>>
>> sorry the correct modification is the following in pwm-sun4i.c
>> in function sun4i_pwm_probe
>>
>> spin_lock_init(&pwm->ctrl_lock);
>>
>> ret = pwmchip_add(&pwm->chip);
>> if (ret < 0) {
>> dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret);
>> return ret;
>> }
>>
>> platform_set_drvdata(pdev, pwm);
>>
>> ret = clk_prepare_enable(pwm->clk);
>> if (ret) {
>> dev_err(&pdev->dev, "failed to enable PWM clock\n");
>> goto clk_error;
>> }
>> +sun4i_pwm_config(&pwm->chip,&pwm->chip.pwms[0],50000,50000);
>>
>>
>>
>>
>> On Friday, March 24, 2017 at 7:57:48 PM UTC+2, Eyad Majali wrote:
>>>
>>>
>>> I fixed the problem by modifying drivers/pwm/core.c as following:
>>> in function pwmchip_add_with_polarity
>>>
>>> for (i = 0; i < chip->npwm; i++) {
>>> pwm = &chip->pwms[i];
>>>
>>> pwm->chip = chip;
>>> pwm->pwm = chip->base + i;
>>> pwm->hwpwm = i;
>>> pwm->state.polarity = polarity;
>>> +pwm->state.period = 50000;
>>> +pwm->state.duty_cycle = 50000;
>>> +pwm->state.enabled = true;
>>> if (chip->ops->get_state)
>>> chip->ops->get_state(chip, pwm, &pwm->state);
>>>
>>> radix_tree_insert(&pwm_tree, pwm->pwm, pwm);
>>> }
>>>
>>> It's a hack but its working
>>>
>>> On Monday, March 20, 2017 at 11:39:43 AM UTC+2, Eyad Majali wrote:
>>>>
>>>> Yes it did , I think I have to modify the source code of pwm-sun4i and
>>>> init it to 100% duty cycle , is there any easier solution ?
>>>>
>>>> On Monday, March 20, 2017 at 6:25:49 AM UTC+2, Icenowy Zheng wrote:
>>>>>
>>>>>
>>>>>
>>>>> 20.03.2017, 04:21, "Eyad Majali" <[email protected]>:
>>>>> > I did these changes before I know about the patch to prevent
>>>>> complete lcd turn off , yes I'm on 4.11-rc , the problem is mainly with
>>>>> pwm-sun4i
>>>>> > when its enabled alone without pwm_bl the screen brightness is very
>>>>> low, enabling pwm_bl doesnt solve the problem until i rmmod it the load
>>>>> it
>>>>> again
>>>>>
>>>>> Does it really prevented complete LCD blacklight turn off on your
>>>>> tablet? At least it worked on my A33 ;-)
>>>>>
>>>>> > On Sunday, March 19, 2017 at 6:29:35 PM UTC+2, Icenowy Zheng wrote:
>>>>> >
>>>>> >> 20.03.2017, 00:08, "Quentin Schulz" <[email protected]>:
>>>>>
>>>>> >>> Hi,
>>>>> >>>
>>>>> >>> On 19/03/2017 15:59, Eyad Majali wrote:
>>>>> >>>> Hi,
>>>>> >>>> pwm is configured in dtsi , when the module loads screen
>>>>> brightness
>>>>> >>>> decrease to minimum ( barely sees anything) how to fix that ?
>>>>> >>>> also when i enable pwm-bl it turns off the screen completely ,
>>>>> but when
>>>>> >>>> i removed the enable-gpios the result was the same with
>>>>> pwm-sun4i alone but
>>>>> >>>> if i rmmod pwm-bl and then modprobe pwm-bl it will load the
>>>>> default
>>>>> >>>> brightness level correctly
>>>>> >>>> any help is apreciated , Thanks
>>>>> >>>
>>>>> >>> I think this patch can help you:
>>>>> https://patchwork.kernel.org/patch/9631655/
>>>>> >>
>>>>> >> P.S. are you using 4.11-rc now?
>>>>> >>
>>>>> >> This patch only takes effect on 4.11-rc.
>>>>> >>
>>>>> >>>
>>>>> >>> Quentin
>>>>> >>>
>>>>> >>>> --
>>>>> >>>> You received this message because you are subscribed to the
>>>>> Google
>>>>> >>>> Groups "linux-sunxi" group.
>>>>> >>>> To unsubscribe from this group and stop receiving emails from
>>>>> it, send
>>>>> >>>> an email to [email protected]
>>>>> >>>> <mailto:[email protected]>.
>>>>> >>>> For more options, visit https://groups.google.com/d/optout.
>>>>> >>>
>>>>> >>> --
>>>>> >>> Quentin Schulz, Free Electrons
>>>>> >>> Embedded Linux and Kernel engineering
>>>>> >>> http://free-electrons.com
>>>>> >>>
>>>>> >>> --
>>>>> >>> You received this message because you are subscribed to the Google
>>>>> Groups "linux-sunxi" group.
>>>>> >>> To unsubscribe from this group and stop receiving emails from it,
>>>>> send an email to [email protected].
>>>>> >>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
--
You received this message because you are subscribed to the Google Groups
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.