soc: qcom: qpnp-haptic: Remove use-play-irq and use-sc-irq flags

Remove use_play_irq and use_sc_irq flags as they are not really
needed. Interrupts can be obtained and registered always. Keep
the play interrupt enabled only for buffer mode.

Change-Id: Ie530819ed18b048d43d59dd7a0dc5f73cc3a9b70
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
This commit is contained in:
Subbaraman Narayanamurthy 2017-03-03 18:01:56 -08:00
parent c8eb719755
commit 427a991945
5 changed files with 34 additions and 60 deletions

View file

@ -24,8 +24,6 @@ Optional Properties:
2-bit amplitude control 0x00: 0, 0x01: vmax/4, 0x02: vmax/2,
0x03: vmax. Default values are 0x00.
- qcom,sc-deb-cycles : short circuit debounce in internal pwm switching clock cycles
- qcom,use-play-irq : boolean, use this if the device uses irq for play
- qcom,use-sc-irq : boolean, use this if the device uses irq for play
- interrupts: Specifies the interrupt associated with Haptics. The available
interrupts are play and short circuit. The values for play and
short circuit are <0x3 0xc0 0x0> and <0x3 0xc0 0x1>.
@ -132,8 +130,6 @@ Example:
qcom,int-pwm-freq-khz = <505>;
qcom,en-brake;
qcom,brake-pattern = [03 03 00 00];
qcom,use-play-irq;
qcom,use-sc-irq;
qcom,wave-samples = [3e 3e 3e 3e 3e 3e 3e 3e];
qcom,wave-rep-cnt = <1>;
qcom,wave-samp-rep-cnt = <1>;

View file

@ -609,8 +609,8 @@
pm660_haptics: qcom,haptic@c000 {
compatible = "qcom,qpnp-haptic";
reg = <0xc000 0x100>;
interrupts = <0x1 0xc0 0x0 IRQ_TYPE_NONE>,
<0x1 0xc0 0x1 IRQ_TYPE_NONE>;
interrupts = <0x1 0xc0 0x0 IRQ_TYPE_EDGE_BOTH>,
<0x1 0xc0 0x1 IRQ_TYPE_EDGE_BOTH>;
interrupt-names = "sc-irq", "play-irq";
qcom,pmic-revid = <&pm660_revid>;
qcom,pmic-misc = <&pm660_misc>;
@ -625,8 +625,6 @@
qcom,sc-deb-cycles = <8>;
qcom,en-brake;
qcom,brake-pattern = [03 03 00 00];
qcom,use-play-irq;
qcom,use-sc-irq;
qcom,lra-high-z = "opt0";
qcom,lra-auto-res-mode = "qwd";
qcom,lra-calibrate-at-eop = <0>;

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -544,8 +544,8 @@
status = "disabled";
compatible = "qcom,qpnp-haptic";
reg = <0xc000 0x100>;
interrupts = <0x3 0xc0 0x0 IRQ_TYPE_NONE>,
<0x3 0xc0 0x1 IRQ_TYPE_NONE>;
interrupts = <0x3 0xc0 0x0 IRQ_TYPE_EDGE_BOTH>,
<0x3 0xc0 0x1 IRQ_TYPE_EDGE_BOTH>;
interrupt-names = "sc-irq", "play-irq";
vcc_pon-supply = <&pon_perph_reg>;
qcom,play-mode = "direct";
@ -558,8 +558,6 @@
qcom,int-pwm-freq-khz = <505>;
qcom,en-brake;
qcom,brake-pattern = [03 03 00 00];
qcom,use-play-irq;
qcom,use-sc-irq;
qcom,wave-samples = [3e 3e 3e 3e 3e 3e 3e 3e];
qcom,wave-rep-cnt = <1>;
qcom,wave-samp-rep-cnt = <1>;

View file

@ -633,8 +633,8 @@
status = "disabled";
compatible = "qcom,qpnp-haptic";
reg = <0xc000 0x100>;
interrupts = <0x3 0xc0 0x0 IRQ_TYPE_NONE>,
<0x3 0xc0 0x1 IRQ_TYPE_NONE>;
interrupts = <0x3 0xc0 0x0 IRQ_TYPE_EDGE_BOTH>,
<0x3 0xc0 0x1 IRQ_TYPE_EDGE_BOTH>;
interrupt-names = "sc-irq", "play-irq";
qcom,pmic-revid = <&pmi8998_revid>;
qcom,pmic-misc = <&pmi8998_misc>;
@ -649,8 +649,6 @@
qcom,sc-deb-cycles = <8>;
qcom,en-brake;
qcom,brake-pattern = [03 03 00 00];
qcom,use-play-irq;
qcom,use-sc-irq;
qcom,lra-high-z = "opt1";
qcom,lra-auto-res-mode = "qwd";
qcom,lra-res-cal-period = <4>;

View file

@ -33,10 +33,6 @@
#include <linux/qpnp/qpnp-revid.h>
#include "../../staging/android/timed_output.h"
#define QPNP_IRQ_FLAGS (IRQF_TRIGGER_RISING | \
IRQF_TRIGGER_FALLING | \
IRQF_ONESHOT)
#define QPNP_HAP_STATUS(b) (b + 0x0A)
#define QPNP_HAP_LRA_AUTO_RES_LO(b) (b + 0x0B)
#define QPNP_HAP_LRA_AUTO_RES_HI(b) (b + 0x0C)
@ -313,8 +309,6 @@ struct qpnp_pwm_info {
* @ lra_res_cal_period - period for resonance calibration
* @ sc_duration - counter to determine the duration of short circuit condition
* @ state - current state of haptics
* @ use_play_irq - play irq usage state
* @ use_sc_irq - short circuit irq usage state
* @ wf_update - waveform update flag
* @ pwm_cfg_state - pwm mode configuration state
* @ buffer_cfg_state - buffer mode configuration state
@ -381,8 +375,6 @@ struct qpnp_hap {
u8 clk_trim_error_code;
bool vcc_pon_enabled;
bool state;
bool use_play_irq;
bool use_sc_irq;
bool manage_pon_supply;
bool wf_update;
bool pwm_cfg_state;
@ -660,19 +652,6 @@ static int qpnp_hap_buffer_config(struct qpnp_hap *hap)
return rc;
}
/* setup play irq */
if (hap->use_play_irq) {
rc = devm_request_threaded_irq(&hap->pdev->dev, hap->play_irq,
NULL, qpnp_hap_play_irq,
QPNP_IRQ_FLAGS,
"qpnp_play_irq", hap);
if (rc < 0) {
pr_err("Unable to request play(%d) IRQ(err:%d)\n",
hap->play_irq, rc);
return rc;
}
}
hap->buffer_cfg_state = true;
return 0;
}
@ -937,16 +916,6 @@ static int qpnp_hap_parse_buffer_dt(struct qpnp_hap *hap)
memcpy(hap->wave_samp, prop->value, QPNP_HAP_WAV_SAMP_LEN);
}
hap->use_play_irq = of_property_read_bool(pdev->dev.of_node,
"qcom,use-play-irq");
if (hap->use_play_irq) {
hap->play_irq = platform_get_irq_byname(hap->pdev, "play-irq");
if (hap->play_irq < 0) {
pr_err("Unable to get play irq\n");
return hap->play_irq;
}
}
return 0;
}
@ -2056,12 +2025,27 @@ static int qpnp_hap_config(struct qpnp_hap *hap)
if (rc)
return rc;
/* setup play irq */
if (hap->play_irq >= 0) {
rc = devm_request_threaded_irq(&hap->pdev->dev, hap->play_irq,
NULL, qpnp_hap_play_irq, IRQF_ONESHOT, "qpnp_hap_play",
hap);
if (rc < 0) {
pr_err("Unable to request play(%d) IRQ(err:%d)\n",
hap->play_irq, rc);
return rc;
}
/* use play_irq only for buffer mode */
if (hap->play_mode != QPNP_HAP_BUFFER)
disable_irq(hap->play_irq);
}
/* setup short circuit irq */
if (hap->use_sc_irq) {
if (hap->sc_irq >= 0) {
rc = devm_request_threaded_irq(&hap->pdev->dev, hap->sc_irq,
NULL, qpnp_hap_sc_irq,
QPNP_IRQ_FLAGS,
"qpnp_sc_irq", hap);
NULL, qpnp_hap_sc_irq, IRQF_ONESHOT, "qpnp_hap_sc",
hap);
if (rc < 0) {
pr_err("Unable to request sc(%d) IRQ(err:%d)\n",
hap->sc_irq, rc);
@ -2362,15 +2346,15 @@ static int qpnp_hap_parse_dt(struct qpnp_hap *hap)
}
}
hap->use_sc_irq = of_property_read_bool(pdev->dev.of_node,
"qcom,use-sc-irq");
if (hap->use_sc_irq) {
hap->play_irq = platform_get_irq_byname(hap->pdev, "play-irq");
if (hap->play_irq < 0)
pr_warn("Unable to get play irq\n");
hap->sc_irq = platform_get_irq_byname(hap->pdev, "sc-irq");
if (hap->sc_irq < 0) {
pr_err("Unable to get sc irq\n");
return hap->sc_irq;
}
}
if (of_find_property(pdev->dev.of_node, "vcc_pon-supply", NULL))
hap->manage_pon_supply = true;