Commit 444fec19 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'mfd-fixes-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MDF bugfixes from Lee Jones:

  - Fix message timing issues and report correct state when an error
    occurs in cros_ec_spi

  - Reorder enums used for Power Management in rtsx_pci

  - Use correct OF helper for obtaining child nodes in twl4030-audio and
    twl6040

* tag 'mfd-fixes-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd:
  mfd: Fix RTS5227 (and others) powermanagement
  mfd: cros ec: spi: Fix "in progress" error signaling
  mfd: twl6040: Fix child-node lookup
  mfd: twl4030-audio: Fix sibling-node lookup
  mfd: cros ec: spi: Don't send first message too soon
parents a5f89a50 b860b419
...@@ -377,6 +377,7 @@ static int cros_ec_pkt_xfer_spi(struct cros_ec_device *ec_dev, ...@@ -377,6 +377,7 @@ static int cros_ec_pkt_xfer_spi(struct cros_ec_device *ec_dev,
u8 *ptr; u8 *ptr;
u8 *rx_buf; u8 *rx_buf;
u8 sum; u8 sum;
u8 rx_byte;
int ret = 0, final_ret; int ret = 0, final_ret;
len = cros_ec_prepare_tx(ec_dev, ec_msg); len = cros_ec_prepare_tx(ec_dev, ec_msg);
...@@ -421,25 +422,22 @@ static int cros_ec_pkt_xfer_spi(struct cros_ec_device *ec_dev, ...@@ -421,25 +422,22 @@ static int cros_ec_pkt_xfer_spi(struct cros_ec_device *ec_dev,
if (!ret) { if (!ret) {
/* Verify that EC can process command */ /* Verify that EC can process command */
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
switch (rx_buf[i]) { rx_byte = rx_buf[i];
case EC_SPI_PAST_END: if (rx_byte == EC_SPI_PAST_END ||
case EC_SPI_RX_BAD_DATA: rx_byte == EC_SPI_RX_BAD_DATA ||
case EC_SPI_NOT_READY: rx_byte == EC_SPI_NOT_READY) {
ret = -EAGAIN; ret = -EREMOTEIO;
ec_msg->result = EC_RES_IN_PROGRESS;
default:
break; break;
} }
if (ret)
break;
} }
if (!ret)
ret = cros_ec_spi_receive_packet(ec_dev,
ec_msg->insize + sizeof(*response));
} else {
dev_err(ec_dev->dev, "spi transfer failed: %d\n", ret);
} }
if (!ret)
ret = cros_ec_spi_receive_packet(ec_dev,
ec_msg->insize + sizeof(*response));
else
dev_err(ec_dev->dev, "spi transfer failed: %d\n", ret);
final_ret = terminate_request(ec_dev); final_ret = terminate_request(ec_dev);
spi_bus_unlock(ec_spi->spi->master); spi_bus_unlock(ec_spi->spi->master);
...@@ -508,6 +506,7 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, ...@@ -508,6 +506,7 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev,
int i, len; int i, len;
u8 *ptr; u8 *ptr;
u8 *rx_buf; u8 *rx_buf;
u8 rx_byte;
int sum; int sum;
int ret = 0, final_ret; int ret = 0, final_ret;
...@@ -544,25 +543,22 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, ...@@ -544,25 +543,22 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev,
if (!ret) { if (!ret) {
/* Verify that EC can process command */ /* Verify that EC can process command */
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
switch (rx_buf[i]) { rx_byte = rx_buf[i];
case EC_SPI_PAST_END: if (rx_byte == EC_SPI_PAST_END ||
case EC_SPI_RX_BAD_DATA: rx_byte == EC_SPI_RX_BAD_DATA ||
case EC_SPI_NOT_READY: rx_byte == EC_SPI_NOT_READY) {
ret = -EAGAIN; ret = -EREMOTEIO;
ec_msg->result = EC_RES_IN_PROGRESS;
default:
break; break;
} }
if (ret)
break;
} }
if (!ret)
ret = cros_ec_spi_receive_response(ec_dev,
ec_msg->insize + EC_MSG_TX_PROTO_BYTES);
} else {
dev_err(ec_dev->dev, "spi transfer failed: %d\n", ret);
} }
if (!ret)
ret = cros_ec_spi_receive_response(ec_dev,
ec_msg->insize + EC_MSG_TX_PROTO_BYTES);
else
dev_err(ec_dev->dev, "spi transfer failed: %d\n", ret);
final_ret = terminate_request(ec_dev); final_ret = terminate_request(ec_dev);
spi_bus_unlock(ec_spi->spi->master); spi_bus_unlock(ec_spi->spi->master);
...@@ -667,6 +663,7 @@ static int cros_ec_spi_probe(struct spi_device *spi) ...@@ -667,6 +663,7 @@ static int cros_ec_spi_probe(struct spi_device *spi)
sizeof(struct ec_response_get_protocol_info); sizeof(struct ec_response_get_protocol_info);
ec_dev->dout_size = sizeof(struct ec_host_request); ec_dev->dout_size = sizeof(struct ec_host_request);
ec_spi->last_transfer_ns = ktime_get_ns();
err = cros_ec_register(ec_dev); err = cros_ec_register(ec_dev);
if (err) { if (err) {
......
...@@ -159,13 +159,18 @@ unsigned int twl4030_audio_get_mclk(void) ...@@ -159,13 +159,18 @@ unsigned int twl4030_audio_get_mclk(void)
EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk); EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk);
static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata, static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
struct device_node *node) struct device_node *parent)
{ {
struct device_node *node;
if (pdata && pdata->codec) if (pdata && pdata->codec)
return true; return true;
if (of_find_node_by_name(node, "codec")) node = of_get_child_by_name(parent, "codec");
if (node) {
of_node_put(node);
return true; return true;
}
return false; return false;
} }
......
...@@ -97,12 +97,16 @@ static struct reg_sequence twl6040_patch[] = { ...@@ -97,12 +97,16 @@ static struct reg_sequence twl6040_patch[] = {
}; };
static bool twl6040_has_vibra(struct device_node *node) static bool twl6040_has_vibra(struct device_node *parent)
{ {
#ifdef CONFIG_OF struct device_node *node;
if (of_find_node_by_name(node, "vibra"))
node = of_get_child_by_name(parent, "vibra");
if (node) {
of_node_put(node);
return true; return true;
#endif }
return false; return false;
} }
......
...@@ -915,10 +915,10 @@ enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; ...@@ -915,10 +915,10 @@ enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
#define LTR_L1SS_PWR_GATE_CHECK_CARD_EN BIT(6) #define LTR_L1SS_PWR_GATE_CHECK_CARD_EN BIT(6)
enum dev_aspm_mode { enum dev_aspm_mode {
DEV_ASPM_DISABLE = 0,
DEV_ASPM_DYNAMIC, DEV_ASPM_DYNAMIC,
DEV_ASPM_BACKDOOR, DEV_ASPM_BACKDOOR,
DEV_ASPM_STATIC, DEV_ASPM_STATIC,
DEV_ASPM_DISABLE,
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment