I’m confused about the muxing. How should the muxing be configured ?
As far as I understand leds-qcom-lpg.txt is schould be something like:
&pm8916_mpps {
pinctrl-names = “default”;
pinctrl-0 = <&lpwm_backlight>;
pwm_backlight: pm8916_mpp4 {
pinconf {
pins = "mpp4";
function = "digital";
output-low;
power-source = <PM8916_MPP_L5>; // 1.8V
dtest = ???
};
};
};
&spmi_bus {
pm8916@1 {
pm8916_pwm: pwm {
compatible = "qcom,pm8916-pwm";
qcom,dtest = ???
#pwm-cells = <2>;
};
};
};
There is further a MPP GPIO configuration for MPP1 - MPP4:
pm8916_mpps: mpps@a000 {
compatible = "qcom,pm8916-mpp";
reg = <0xa000>;
gpio-controller;
#gpio-cells = <2>;
interrupts = <0 0xa0 0 IRQ_TYPE_NONE>,
<0 0xa1 0 IRQ_TYPE_NONE>,
<0 0xa2 0 IRQ_TYPE_NONE>,
<0 0xa3 0 IRQ_TYPE_NONE>;
};
My questions:
- What exactly is dtest? How does the routing sink/source work?
- What has to be configured in pm8916_mpps and in pm8916_pwm, both seem to have a dtest parameter.
- The MPP block configures and registers all 4 pins as GPIO. If I use MPP4 as PWM, should MPP4 be removed with MPP1 - MPP3 keeping the GPIO functionality? Or should I rather remove the GPIO configuration?
- Is just MPP4 available for PWM function?
My datasheet seems to be incomplete. There is no explanation about that DTEST stuff. Further I did not have any specification about the registers PWM_DTEST_REG(x) that seems to make that config.
More specific:
LPG/PWM driver:
I need morde background about this function:
static void lpg_apply_dtest(struct lpg_channel *chan)
{
struct lpg *lpg = chan->lpg;
if (!chan->dtest_line)
return;
regmap_write(lpg->map, chan->base + PWM_SEC_ACCESS_REG, 0xa5);
regmap_write(lpg->map, chan->base + PWM_DTEST_REG(chan->dtest_line),
chan->dtest_value);
}
This seems to be the output cndiguration of the PWM unit.
Does this mean:
qcom, dtest = <1 0> // leds-qcom-lpg.txt: ... and the second
// configures how the value should be outputed ...
for pn8916 to route the PWM output via DTEST1 to MPP4 ?
Further, Irvin wrote:
MPP4_MODE_CTL - EN_AND_SOURCE_SEL: 1000 = DTEST1
Does this mean
qcom,dtest = <1>
for MPP4 pin in the MPP pinconf driver?
If not, what else?
I found this in the old 3.18 PWM driver (pwm-qpnp.c\pwm\drivers - kernel/msm-3.18 - Unnamed repository; edit this file 'description' to name the repository.):
…
/* PWM DTEST */
#define QPNP_PWM_DTEST_LINE_MAX 2
#define QPNP_PWM_DTEST_OUTPUT_MAX 2
#define QPNP_PWM_DTEST_OUTPUT_MASK 0x03
…
So, dtest_line seems to be 1 or 2 and dtest_config 0 … 2.
@bamse @irvin Can you help?
Best regards
-Carsten
Update:
Got it working by myself (current 4.9.x kernel):
arch/arm64/boot/dts/qcom/pm8916.dtsi (settings untouched):
....
pm8916_mpps: mpps@a000 {
compatible = "qcom,pm8916-mpp";
reg = <0xa000>;
gpio-controller;
#gpio-cells = <2>;
interrupts = <0 0xa0 0 IRQ_TYPE_NONE>,
<0 0xa1 0 IRQ_TYPE_NONE>,
<0 0xa2 0 IRQ_TYPE_NONE>,
<0 0xa3 0 IRQ_TYPE_NONE>;
};
....
arch/arm64/boot/dts/qcom/apq8016-myboard-pmic-pins.dtsi:
&pm8916_mpps {
pinctrl-names = “default”;
pinctrl-0 = <&pwm_backlight>;
pwm_backlight: pm8916_mpp4 {
pinconf {
pins = "mpp4";
function = "digital"; // see 96boards issue #3732
qcom,dtest = <1>; // see 96boards issue #3732
output-low;
power-source = <PM8916_MPP_L5>; // 1.8V
};
};
pm8916_mpps_leds: pm8916_mpps_leds {
pinconf {
pins = "mpp2", "mpp3";
function = "digital";
output-low;
};
};
};
....
&spmi_bus {
pm8916@1 {
pm8916_pwm: pwm {
compatible = "qcom,pm8916-pwm";
qcom,dtest = <1 1>; // see 96boards issue #3732
#pwm-cells = <2>;
};
};
};
Best regards
-Carsten