Skip to content

KMS 7" DSI panel and touchscreen fixes #4750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion arch/arm/boot/dts/overlays/vc4-kms-dsi-7inch-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
target = <&i2c0if>;
__overlay__ {
status = "okay";
clock-frequency = <50000>;
};
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/vc4/vc4_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
snd_soc_card_set_drvdata(card, vc4_hdmi);
ret = devm_snd_soc_register_card(dev, card);
if (ret)
dev_err_probe(dev, ret, "Could not register sound card: %d\n");
dev_err_probe(dev, ret, "Could not register sound card.\n");

return ret;

Expand Down
9 changes: 8 additions & 1 deletion drivers/input/touchscreen/edt-ft5x06.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
unsigned int active_ids = 0, known_ids = tsdata->known_ids;
long released_ids;
int b = 0;
unsigned int num_points;

switch (tsdata->version) {
case EDT_M06:
Expand Down Expand Up @@ -248,9 +249,15 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)

if (!edt_ft5x06_ts_check_crc(tsdata, rdbuf, datalen))
goto out;
num_points = tsdata->max_support_points;
} else {
/* Register 2 is TD_STATUS, containing the number of touch
* points.
*/
num_points = min(rdbuf[2] & 0xf, tsdata->max_support_points);
}

for (i = 0; i < tsdata->max_support_points; i++) {
for (i = 0; i < num_points; i++) {
u8 *buf = &rdbuf[i * tplen + offset];

type = buf[0] >> 6;
Expand Down
53 changes: 35 additions & 18 deletions drivers/regulator/rpi-panel-attiny-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,24 +144,8 @@ static int attiny_lcd_power_disable(struct regulator_dev *rdev)
static int attiny_lcd_power_is_enabled(struct regulator_dev *rdev)
{
struct attiny_lcd *state = rdev_get_drvdata(rdev);
unsigned int data;
int ret, i;

mutex_lock(&state->lock);

for (i = 0; i < 10; i++) {
ret = regmap_read(rdev->regmap, REG_PORTC, &data);
if (!ret)
break;
usleep_range(10000, 12000);
}

mutex_unlock(&state->lock);

if (ret < 0)
return ret;

return data & PC_RST_BRIDGE_N;
return state->port_states[REG_PORTC - REG_PORTA] & PC_RST_BRIDGE_N;
}

static const struct regulator_init_data attiny_regulator_default = {
Expand Down Expand Up @@ -250,6 +234,39 @@ static void attiny_gpio_set(struct gpio_chip *gc, unsigned int off, int val)
mutex_unlock(&state->lock);
}

static int attiny_i2c_read(struct i2c_client *client, u8 reg, unsigned int *buf)
{
struct i2c_msg msgs[1];
u8 addr_buf[1] = { reg };
u8 data_buf[1] = { 0, };
int ret;

/* Write register address */
msgs[0].addr = client->addr;
msgs[0].flags = 0;
msgs[0].len = ARRAY_SIZE(addr_buf);
msgs[0].buf = addr_buf;

ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
if (ret != ARRAY_SIZE(msgs))
return -EIO;

usleep_range(5000, 10000);

/* Read data from register */
msgs[0].addr = client->addr;
msgs[0].flags = I2C_M_RD;
msgs[0].len = 1;
msgs[0].buf = data_buf;

ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
if (ret != ARRAY_SIZE(msgs))
return -EIO;

*buf = data_buf[0];
return 0;
}

/*
* I2C driver interface functions
*/
Expand Down Expand Up @@ -280,7 +297,7 @@ static int attiny_i2c_probe(struct i2c_client *i2c,
goto error;
}

ret = regmap_read(regmap, REG_ID, &data);
ret = attiny_i2c_read(i2c, REG_ID, &data);
if (ret < 0) {
dev_err(&i2c->dev, "Failed to read REG_ID reg: %d\n", ret);
goto error;
Expand Down